Nimble Page Builder - Version 1.5.0

Version Description

Introducing a section navigation UI. A new interface allowing users to navigate in the structure of Nimble Builder elements : locations, sections, columns and modules. Added a new option for the Menu module to expand the mobile menu in full width below the hamburger icon.

=

Download this release

Release Info

Developer nikeo
Plugin Icon 128x128 Nimble Page Builder
Version 1.5.0
Comparing to
See all releases

Code changes from version 1.4.14 to 1.5.0

assets/czr/sek/css/sek-control.css CHANGED
@@ -111,7 +111,7 @@ li[id*="sek_draggable_modules"] [data-sek-content-type="preset_section"] {
111
  bottom: 0;
112
  background-color: #000000;
113
  opacity: 0;
114
- -webkit-transition: opacity .35s ease;
115
  transition: opacity .35s ease;
116
  -o-transition: opacity .35s ease;
117
  }
@@ -1139,7 +1139,6 @@ body.nimble-save-ui-visible #nimble-top-save-ui {
1139
 
1140
  /* LEVEL TREE */
1141
  /* space for the Level Tree */
1142
- #nimble-top-bar .sek-level-tree { display: none;}
1143
  #customize-preview iframe, #nimble-level-tree {
1144
  -webkit-transition: top 0.3s ease-in-out;
1145
  -moz-transition: top, 0.3s ease-in-out;
@@ -1152,23 +1151,25 @@ body.nimble-save-ui-visible #nimble-top-save-ui {
1152
  }
1153
  .sek-level-tree-expanded #customize-preview iframe {
1154
  top: 366px;
 
1155
  }
1156
  /* highlight icon */
1157
  .sek-level-tree-expanded #nimble-top-bar .sek-level-tree button {
1158
  color: #44b9e2;
1159
  }
1160
  #nimble-level-tree {
1161
- position: absolute;
1162
- top: 36px;
1163
- right: 0;
1164
- left: 0;
1165
- background: #000000ad;
1166
- min-height: 20px;
1167
- color: #32ff1e;
1168
- height: 300px;
1169
- overflow: auto;
1170
- padding: 15px;
1171
- z-index: 0;
 
1172
  }
1173
  /*.sek-level-tree-expanded #nimble-level-tree {
1174
  top: 36px;
@@ -1179,13 +1180,91 @@ body.nimble-save-ui-visible #nimble-top-save-ui {
1179
  transition: all 0.3s ease-in-out;
1180
  }*/
1181
  #nimble-level-tree ul li {
1182
- padding-left: 25px;
1183
- line-height: 1.5em;
1184
- font-size: 12px;
1185
  cursor: pointer;
1186
  margin-bottom: 8px;
1187
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1189
 
1190
 
1191
 
111
  bottom: 0;
112
  background-color: #000000;
113
  opacity: 0;
114
+ -webkit-transition: opacity .35s ease;
115
  transition: opacity .35s ease;
116
  -o-transition: opacity .35s ease;
117
  }
1139
 
1140
  /* LEVEL TREE */
1141
  /* space for the Level Tree */
 
1142
  #customize-preview iframe, #nimble-level-tree {
1143
  -webkit-transition: top 0.3s ease-in-out;
1144
  -moz-transition: top, 0.3s ease-in-out;
1151
  }
1152
  .sek-level-tree-expanded #customize-preview iframe {
1153
  top: 366px;
1154
+ height: calc(100vh - 366px);
1155
  }
1156
  /* highlight icon */
1157
  .sek-level-tree-expanded #nimble-top-bar .sek-level-tree button {
1158
  color: #44b9e2;
1159
  }
1160
  #nimble-level-tree {
1161
+ background: #f0f0f0!important;
1162
+ border-bottom: 1px solid #aaa!important;
1163
+ color: #222!important;
1164
+ font-size: 12px!important;
1165
+ position: absolute;
1166
+ top: 36px;
1167
+ right: 0;
1168
+ left: 0;
1169
+ height: 299px;
1170
+ overflow: auto;
1171
+ padding: 15px;
1172
+ z-index: 0;
1173
  }
1174
  /*.sek-level-tree-expanded #nimble-level-tree {
1175
  top: 36px;
1180
  transition: all 0.3s ease-in-out;
1181
  }*/
1182
  #nimble-level-tree ul li {
1183
+ padding-left: 30px;
 
 
1184
  cursor: pointer;
1185
  margin-bottom: 8px;
1186
  }
1187
+ #nimble-level-tree ul li .sek-remove-level {
1188
+ font-size: 16px;
1189
+ opacity: 0.6;
1190
+ }
1191
+ #nimble-level-tree ul li .sek-remove-level:hover{
1192
+ opacity: 1;
1193
+ }
1194
+ #nimble-level-tree ul li .sek-level-infos {
1195
+ line-height: 30px;
1196
+ height: 30px;
1197
+ padding-left: 33px;
1198
+ position: relative;
1199
+ width: calc(100% - 25px);
1200
+ }
1201
+ .sek-level-infos .sek-inner-level-infos {
1202
+ background: inherit;
1203
+ width: inherit;
1204
+ height: inherit;
1205
+ line-height: inherit;
1206
+ padding-left: 4px;
1207
+ display: -webkit-inline-box;
1208
+ display: -ms-inline-flexbox;
1209
+ display: inline-flex;
1210
+ -webkit-box-align: center;
1211
+ -ms-flex-align: center;
1212
+ align-items: center;
1213
+ -webkit-transition: background .20s ease;
1214
+ transition: background .20s ease;
1215
+ -o-transition: background .20s ease;
1216
+ }
1217
+
1218
+ .sek-inner-level-infos:hover {
1219
+ color: #000;
1220
+ background: white;
1221
+ }
1222
+ .sek-close-level-tree {
1223
+ position: fixed;
1224
+ top: 44px;
1225
+ right: 25px;
1226
+ }
1227
+
1228
+ img.sek-svg-mod-icon {
1229
+ max-width: 45px;
1230
+ }
1231
 
1232
+ /* TREE */
1233
+ .sek-level-infos::before {
1234
+ position: absolute;
1235
+ left: -31px;
1236
+ background: #a2aab2;
1237
+ width: 63px;
1238
+ height: 2px;
1239
+ content: "";
1240
+ top: calc(50% - 1px);
1241
+ }
1242
+ #nimble-level-tree ul > li:first-child::before {
1243
+ position: absolute;
1244
+ content: "";
1245
+ background: #a2aab2;
1246
+ top: -15px;
1247
+ height: 16px;
1248
+ bottom: 0;
1249
+ left: -2px;
1250
+ width: 2px;
1251
+ }
1252
+ #nimble-level-tree ul > li:last-child::after {
1253
+ position: absolute;
1254
+ content: "";
1255
+ background: #f0f0f0;
1256
+ top: 16px;
1257
+ bottom: 0;
1258
+ left: -2px;
1259
+ width: 2px;
1260
+ }
1261
+ #nimble-level-tree ul {
1262
+ border-left: 2px solid #a2aab2;
1263
+ position:relative;
1264
+ }
1265
+ #nimble-level-tree ul > li:last-child {
1266
+ position: relative;
1267
+ }
1268
 
1269
 
1270
 
assets/czr/sek/css/sek-control.min.css CHANGED
@@ -1 +1 @@
1
- @font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(../fonts/material-icons/MaterialIcons-Regular.eot);src:local('Material Icons'),local('MaterialIcons-Regular'),url(../fonts/material-icons/MaterialIcons-Regular.woff2) format('woff2'),url(../fonts/material-icons/MaterialIcons-Regular.woff) format('woff'),url(../fonts/material-icons/MaterialIcons-Regular.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;-webkit-font-feature-settings:'liga';font-feature-settings:'liga'}ul[id*=sub-accordion-section-__nimble__]{background:#f2f2f2!important}#customize-theme-controls .customize-pane-child[id*="__nimble__"]{-webkit-transition:unset;-o-transition:unset;transition:unset}li[id*="__nimble__"].customize-control{margin:8px 0;padding:2px;width:calc(100% - 4px);border:1px solid rgba(221,221,221,.43);box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);-webkit-box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);background-color:#fff}li[id*="__nimble__"].customize-control span.customize-control-title:first-child{margin-left:21px}[data-sek-content-type]{float:left;padding:0;margin:1.8%;text-align:center;cursor:move;-webkit-transition:-webkit-box-shadow .2s ease;transition:-webkit-box-shadow .2s ease;-o-transition:box-shadow .2s ease;transition:box-shadow .2s ease;transition:box-shadow .2s ease,-webkit-box-shadow .2s ease;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25);box-shadow:0 2px 5px rgba(0,0,0,.25);border-radius:4px}[data-sek-content-type=module]{width:29%;height:130px}li[id*=sek_draggable_modules] [data-sek-content-type=preset_section]{width:29%}[data-sek-content-type=preset_section]{width:95%;height:165px;position:relative}[data-sek-content-type=preset_section] .sek-overlay{display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:0;-webkit-transition:opacity .35s ease;transition:opacity .35s ease;-o-transition:opacity .35s ease}[data-sek-content-type=preset_section]:hover .sek-overlay{opacity:.15}[data-sek-content-type][draggable=true]:hover{-webkit-box-shadow:0 12px 20px rgba(0,0,0,.2);box-shadow:0 12px 20px rgba(0,0,0,.2)}[data-sek-content-type][draggable=false]{background:#eee;opacity:.8}.sek-user-section-wrapper{margin-bottom:15px;float:left}.sek-user-section-wrapper{width:100%}.sek-user-section-wrapper [data-sek-is-user-section=true]{height:auto;padding:2%;width:89%}.sek-saved-section-date{font-size:11px;text-align:left}.sek-saved-section-description{font-size:13px;font-style:italic;text-align:left}.sek-dragging [data-sek-content-type]{-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25)!important;box-shadow:0 2px 5px rgba(0,0,0,.25)!important}.sek-dragged{background:#33b3db3d;background:rgba(51,179,219,.24)}[data-sek-content-type] .sek-module-icon{display:block;padding:0}[data-sek-content-type] .sek-module-icon .nimble-module-icons{font-size:3rem;max-width:100%;color:#878787;max-height:86px}[data-sek-content-type] .sek-module-icon.is-font-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%;min-height:70%}[data-sek-content-type] .sek-module-icon.is-font-icon i{font-size:35px}[data-sek-content-type] .sek-module-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 6px 0;font-size:.75rem;height:45px;justify-content:center;position:relative;top:-18px}.sek-centered-module-title{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.sek-pad-marg-inner{font-size:12px;display:-webkit-box;display:-ms-flexbox;display:flex;margin:10px auto 10px auto;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:0;background-color:#e6e6e6;border:1px solid #c5c5c5;height:192px;width:232px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-pm-top-bottom-wrap{height:46px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-center-stretch{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.sek-pm-input{width:35px;height:15px;padding:0;text-align:center;font-family:Source Sans Pro;padding:5px;border-radius:3px;text-align:left;font-size:13px;outline:0;-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);border:1px solid #ced6d9}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131}.sek-pm-middle-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;height:100px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-margin-left,.sek-pm-margin-right{width:46px}.sek-pm-padding-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border:1px solid #ced6d9;height:100px;width:140px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:5px;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease;-webkit-box-sizing:border-box;box-sizing:border-box;margin:auto}.sek-flex-justify-center{min-height:0;min-width:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-space-between{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-input-parent{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex}.sek-pm-input-parent .sek-pm-input{min-height:25px;min-width:40px;background-color:#fff}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px!important;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131;width:40px!important;text-align:center}.sek-pm-padding-wrapper label{margin:0}.sek-pad-marg-inner label{-webkit-box-flex:0;-ms-flex:0;flex:0}.reset-spacing-wrap{padding:10px 0 0;font-size:.8em;text-decoration:underline;cursor:pointer;text-align:center}.reset-spacing-wrap:hover{color:#006799}.sek-bg-pos-wrapper{padding:10px;text-align:center;display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper{display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper .sek-bg-pos{cursor:pointer;width:24px;height:24px;margin:3px;float:left}.sek-bg-pos-wrapper input[type=radio]{display:none}.sek-bg-pos-wrapper .sek-bg-pos span{display:inline-block;width:100%;height:100%;border-radius:6px;background:#e6e6e6 no-repeat center;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-bg-pos-wrapper .sek-bg-pos span:hover{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos span:hover svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos span svg{visibility:hidden;shape-rendering:crispEdges}.sek-bg-pos-wrapper .sek-svg-bg-pos{fill:#fff}div[data-sek-align]{margin:0 5px;padding:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:relative;text-align:center;width:23px;height:24px;top:-4px;border-radius:4px;cursor:pointer}horizAlignmentWithDeviceSwitcher div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}div[data-input-type=horizAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}.sek-h-align-wrapper .sek-align-icons{float:right}div[data-sek-align]:hover{-webkit-box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff}div[data-sek-align].selected{outline:0;color:#fff;-webkit-box-shadow:none;box-shadow:none;background:#555d66}.sek-side-nimble-logo-wrapper{padding:4px 25px 0 2px!important}.sek-side-nimble-logo-wrapper .sek-nimble-logo{height:45px}[data-input-type=code_editor] .czr-input{width:100%;float:left}.sek-unit-wrapper{text-align:center}.sek-ui-button-group{display:inline-block}.sek-ui-button-group .sek-ui-button:first-child{border-radius:3px 0 0 3px}.sek-ui-button-group .sek-ui-button+.sek-ui-button{margin-left:-1px}.sek-ui-button-group .sek-ui-button:last-child{border-radius:0 3px 3px 0}.sek-ui-button{height:28px;line-height:25px;padding:0 10px 2px;border-radius:3px;white-space:nowrap;border-width:1px;border-style:solid;display:inline-flex;text-decoration:none;font-size:12px;margin:0;cursor:pointer;-webkit-appearance:none;background:0 0;color:#555;border-color:#ccc;background:#f7f7f7;box-shadow:inset 0 -1px 0 #ccc;vertical-align:top}.sek-ui-button:hover{background:#fafafa;border-color:#999;box-shadow:inset 0 -1px 0 #999;color:#23282d}.sek-ui-button:active:not(:disabled){background:#eee;border-color:#999;box-shadow:inset 0 1px 0 #999}.sek-ui-button:focus:not(:disabled){background:#fafafa;color:#23282d;border-color:#999;box-shadow:inset 0 -1px 0 #999,0 0 0 2px #fbfbfb;outline:0}.sek-ui-button.is-selected{background:#555d66;border-color:#555d66;box-shadow:inset 0 -1px 0 #555d66;color:#fff;text-decoration:none}.sek-ui-button.is-selected:focus:not(:disabled),.sek-ui-button.is-selected:hover{background:#555d66;border-color:#4f4f4f;color:#fff}.sek-ui-button.is-selected:focus:not(:disabled){box-shadow:inset 0 -1px 0 #4f4f4f}.sek-ui-button.is-selected:focus:not(:disabled){outline:0}.sek-content-type-wrapper{margin-bottom:8px;width:100%;float:left}.sek-content-type-wrapper .sek-ui-button-group{display:block}.sek-content-type-wrapper .sek-ui-button{width:49%;text-align:center;display:inline-block;padding:3px 0;height:auto;text-transform:uppercase}.sek-input-device-switcher .sek-switcher:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#656a6f;position:relative;top:-5px}.sek-input-device-switcher .sek-switcher{cursor:pointer;background:0 0;border:none;padding:0 1px;margin:0 0 0 -2px;box-shadow:none;border-top:1px solid transparent;border-bottom:4px solid transparent;-webkit-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;-o-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}.sek-input-device-switcher .sek-switcher:focus,.sek-input-device-switcher .sek-switcher:hover{background-color:#fff}.sek-input-device-switcher .sek-switcher.active:before{color:#191e23}.sek-input-device-switcher .sek-switcher:focus:before,.sek-input-device-switcher .sek-switcher:hover:before{color:#0073aa}.sek-input-device-switcher .preview-desktop:before{content:"\f472"}.sek-input-device-switcher .preview-tablet:before{content:"\f471"}.sek-input-device-switcher .preview-mobile:before{content:"\f470"}.sek-range-with-unit-picker-wrapper{width:100%;float:left;margin-bottom:8px}.sek-range-with-unit-picker-wrapper .sek-unit-wrapper{float:right}.sek-range-with-unit-picker-wrapper>div{float:left}.sek-borders{width:100%;float:left;margin-bottom:8px}.sek-borders>div{float:left;width:100%}.sek-borders .sek-range-unit-wrapper>div{float:left}.sek-borders .sek-border-type-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper .sek-unit-wrapper{float:right}.sek-borders .sek-color-wrapper{width:100%}.sek-borders .sek-color-wrapper .sek-color-picker{width:50%;float:left}.sek-borders .sek-color-wrapper .sek-reset-button{width:50%;float:right}[data-sek-radius-type=top_right]>i.material-icons{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}[data-sek-radius-type=bottom_right]>i.material-icons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-radius-type=bottom_left]>i.material-icons{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.sek-range-wrapper{width:44%;margin-right:4px}.sek-no-unit-picker .sek-range-wrapper{width:70%}.sek-number-wrapper{width:50px;margin-right:5px}.sek-range-input{flex:1;width:100%;padding:0;-webkit-appearance:none;background:0 0}.sek-range-input::-webkit-slider-thumb{-webkit-appearance:none;height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input::-moz-range-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-7px}.sek-range-input::-ms-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input:focus{outline:0}.sek-range-input::-webkit-slider-runnable-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px;margin-top:-4px}.sek-range-input::-moz-range-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-range-input::-ms-track{margin-top:-4px;background:0 0;border-color:transparent;color:transparent;height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-animated-arrow{position:absolute;left:-20px;margin-left:6px;top:3px;font-size:10px;color:#617379;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;-o-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-align:center;-ms-flex-align:center;align-items:center}[data-sek-expanded=true] label>.customize-control-title .sek-animated-arrow{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-expanded=true] label>.customize-control-title .sek-ctrl-accordion-title,[data-sek-expanded] label>.customize-control-title .sek-ctrl-accordion-title:hover{text-decoration:underline;text-underline-position:under}.sek-level-option-icon{padding-right:5px;min-width:22px;text-align:center}#customize-preview iframe{top:36px}#nimble-top-bar{max-height:36px;position:absolute;text-align:center;right:0;left:0;z-index:20;color:#fff;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;opacity:.3;top:0;background:rgba(0,0,0,.5);padding:2px;z-index:99999;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}body.nimble-top-bar-visible #nimble-top-bar{opacity:1}#nimble-top-bar:hover{background:rgba(0,0,0,.7)}#nimble-top-bar .nimble-top-bar-content{display:inline-block;line-height:20px;width:80%}#nimble-top-bar .sek-do-undo .icon:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#fff}#nimble-top-bar .sek-settings{font-size:18px;padding:0 10px}#nimble-top-bar button{background:0 0;border:none;color:#fff;cursor:pointer}#nimble-top-bar button[data-nimble-state=disabled]{cursor:inherit;opacity:.4!important;cursor:not-allowed}#nimble-top-bar .sek-do-undo button:hover{opacity:1}#nimble-top-bar .sek-do-undo button:focus{outline:0}#nimble-top-bar .sek-do-undo .icon.undo:before{content:"\f171";-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}#nimble-top-bar .sek-do-undo .icon.do:before{content:"\f172";-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}#nimble-top-bar .sek-add-content button{padding-top:3px}#nimble-top-bar .sek-nimble-doc{position:absolute;right:10px;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}#nimble-top-bar .sek-nimble-doc img{width:30px;height:30px;position:relative;top:2px;-webkit-filter:grayscale(100%);filter:grayscale(100%);-webkit-filter:gray;filter:gray}#nimble-top-bar .sek-nimble-doc:hover img{-webkit-filter:none;filter:none;-webkit-filter:none;filter:none}#nimble-top-bar .sek-notifications{max-width:300px;overflow:hidden}#nimble-top-save-ui{height:300px;padding:20px;position:absolute;top:-300px;right:0;left:0;z-index:20;color:#fff;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;opacity:.3;background:rgba(0,0,0,.5);z-index:99999;max-width:100%}#nimble-top-save-ui>div{width:100%}body.nimble-save-ui-visible #nimble-top-save-ui{opacity:1;top:36px}#nimble-top-save-ui .sek-cancel-save{position:absolute;bottom:10px;right:10px}#nimble-top-save-ui #sek-saved-section-title.error{border:1px solid red}#nimble-top-bar .sek-level-tree{display:none}#customize-preview iframe,#nimble-level-tree{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}#customize-preview iframe{z-index:1}.sek-level-tree-expanded #customize-preview iframe{top:366px}.sek-level-tree-expanded #nimble-top-bar .sek-level-tree button{color:#44b9e2}#nimble-level-tree{position:absolute;top:36px;right:0;left:0;background:#000000ad;min-height:20px;color:#32ff1e;height:300px;overflow:auto;padding:15px;z-index:0}#nimble-level-tree ul li{padding-left:25px;line-height:1.5em;font-size:12px;cursor:pointer;margin-bottom:8px}.sek-float-right{float:right}.sek-float-left{float:left}.sek-flex-vertical-center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}li[id^=accordion-section-__nimble__]{margin-top:16px}li[id^=accordion-section-__nimble__]>h3{border-top:1px solid #ddd}
1
+ @font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(../fonts/material-icons/MaterialIcons-Regular.eot);src:local('Material Icons'),local('MaterialIcons-Regular'),url(../fonts/material-icons/MaterialIcons-Regular.woff2) format('woff2'),url(../fonts/material-icons/MaterialIcons-Regular.woff) format('woff'),url(../fonts/material-icons/MaterialIcons-Regular.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;-webkit-font-feature-settings:'liga';font-feature-settings:'liga'}ul[id*=sub-accordion-section-__nimble__]{background:#f2f2f2!important}#customize-theme-controls .customize-pane-child[id*="__nimble__"]{-webkit-transition:unset;-o-transition:unset;transition:unset}li[id*="__nimble__"].customize-control{margin:8px 0;padding:2px;width:calc(100% - 4px);border:1px solid rgba(221,221,221,.43);box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);-webkit-box-shadow:1px 1px 2px 0 rgba(75,75,85,.2);background-color:#fff}li[id*="__nimble__"].customize-control span.customize-control-title:first-child{margin-left:21px}[data-sek-content-type]{float:left;padding:0;margin:1.8%;text-align:center;cursor:move;-webkit-transition:-webkit-box-shadow .2s ease;transition:-webkit-box-shadow .2s ease;-o-transition:box-shadow .2s ease;transition:box-shadow .2s ease;transition:box-shadow .2s ease,-webkit-box-shadow .2s ease;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25);box-shadow:0 2px 5px rgba(0,0,0,.25);border-radius:4px}[data-sek-content-type=module]{width:29%;height:130px}li[id*=sek_draggable_modules] [data-sek-content-type=preset_section]{width:29%}[data-sek-content-type=preset_section]{width:95%;height:165px;position:relative}[data-sek-content-type=preset_section] .sek-overlay{display:block;position:absolute;top:0;left:0;right:0;bottom:0;background-color:#000;opacity:0;-webkit-transition:opacity .35s ease;transition:opacity .35s ease;-o-transition:opacity .35s ease}[data-sek-content-type=preset_section]:hover .sek-overlay{opacity:.15}[data-sek-content-type][draggable=true]:hover{-webkit-box-shadow:0 12px 20px rgba(0,0,0,.2);box-shadow:0 12px 20px rgba(0,0,0,.2)}[data-sek-content-type][draggable=false]{background:#eee;opacity:.8}.sek-user-section-wrapper{margin-bottom:15px;float:left}.sek-user-section-wrapper{width:100%}.sek-user-section-wrapper [data-sek-is-user-section=true]{height:auto;padding:2%;width:89%}.sek-saved-section-date{font-size:11px;text-align:left}.sek-saved-section-description{font-size:13px;font-style:italic;text-align:left}.sek-dragging [data-sek-content-type]{-webkit-box-shadow:0 2px 5px rgba(0,0,0,.25)!important;box-shadow:0 2px 5px rgba(0,0,0,.25)!important}.sek-dragged{background:#33b3db3d;background:rgba(51,179,219,.24)}[data-sek-content-type] .sek-module-icon{display:block;padding:0}[data-sek-content-type] .sek-module-icon .nimble-module-icons{font-size:3rem;max-width:100%;color:#878787;max-height:86px}[data-sek-content-type] .sek-module-icon.is-font-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%;min-height:70%}[data-sek-content-type] .sek-module-icon.is-font-icon i{font-size:35px}[data-sek-content-type] .sek-module-title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 6px 0;font-size:.75rem;height:45px;justify-content:center;position:relative;top:-18px}.sek-centered-module-title{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.sek-pad-marg-inner{font-size:12px;display:-webkit-box;display:-ms-flexbox;display:flex;margin:10px auto 10px auto;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:0;background-color:#e6e6e6;border:1px solid #c5c5c5;height:192px;width:232px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-pm-top-bottom-wrap{height:46px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-center-stretch{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.sek-pm-input{width:35px;height:15px;padding:0;text-align:center;font-family:Source Sans Pro;padding:5px;border-radius:3px;text-align:left;font-size:13px;outline:0;-webkit-box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);box-shadow:inset 1px 1px 3px rgba(0,0,0,.15);border:1px solid #ced6d9}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131}.sek-pm-middle-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;height:100px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-margin-left,.sek-pm-margin-right{width:46px}.sek-pm-padding-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border:1px solid #ced6d9;height:100px;width:140px;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:5px;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease;-webkit-box-sizing:border-box;box-sizing:border-box;margin:auto}.sek-flex-justify-center{min-height:0;min-width:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sek-flex-space-between{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.sek-pm-input-parent{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex}.sek-pm-input-parent .sek-pm-input{min-height:25px;min-width:40px;background-color:#fff}.sek-pm-input-parent .sek-pm-input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;display:block;margin:auto 3px!important;-webkit-box-sizing:border-box;box-sizing:border-box;padding:1px 3px;font-size:12px;font-weight:300;min-width:34px;min-height:20px;color:#313131;width:40px!important;text-align:center}.sek-pm-padding-wrapper label{margin:0}.sek-pad-marg-inner label{-webkit-box-flex:0;-ms-flex:0;flex:0}.reset-spacing-wrap{padding:10px 0 0;font-size:.8em;text-decoration:underline;cursor:pointer;text-align:center}.reset-spacing-wrap:hover{color:#006799}.sek-bg-pos-wrapper{padding:10px;text-align:center;display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper{display:inline-block;width:90px;height:90px}.sek-bg-pos-wrapper .sek-bg-pos{cursor:pointer;width:24px;height:24px;margin:3px;float:left}.sek-bg-pos-wrapper input[type=radio]{display:none}.sek-bg-pos-wrapper .sek-bg-pos span{display:inline-block;width:100%;height:100%;border-radius:6px;background:#e6e6e6 no-repeat center;-webkit-transition:background-color .2s ease;-o-transition:background-color .2s ease;transition:background-color .2s ease}.sek-bg-pos-wrapper .sek-bg-pos span:hover{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos span:hover svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span{background-color:#33b3db}.sek-bg-pos-wrapper .sek-bg-pos input[type=radio]:checked+span svg{visibility:visible}.sek-bg-pos-wrapper .sek-bg-pos span svg{visibility:hidden;shape-rendering:crispEdges}.sek-bg-pos-wrapper .sek-svg-bg-pos{fill:#fff}div[data-sek-align]{margin:0 5px;padding:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:relative;text-align:center;width:23px;height:24px;top:-4px;border-radius:4px;cursor:pointer}horizAlignmentWithDeviceSwitcher div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizTextAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}div[data-input-type=horizAlignmentWithDeviceSwitcher] .czr-input{text-align:center}div[data-input-type=horizAlignmentWithDeviceSwitcher] .sek-h-align-wrapper{display:inline-block}.sek-h-align-wrapper .sek-align-icons{float:right}div[data-sek-align]:hover{-webkit-box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff;box-shadow:inset 0 0 0 1px #555d66,inset 0 0 0 2px #fff}div[data-sek-align].selected{outline:0;color:#fff;-webkit-box-shadow:none;box-shadow:none;background:#555d66}.sek-side-nimble-logo-wrapper{padding:4px 25px 0 2px!important}.sek-side-nimble-logo-wrapper .sek-nimble-logo{height:45px}[data-input-type=code_editor] .czr-input{width:100%;float:left}.sek-unit-wrapper{text-align:center}.sek-ui-button-group{display:inline-block}.sek-ui-button-group .sek-ui-button:first-child{border-radius:3px 0 0 3px}.sek-ui-button-group .sek-ui-button+.sek-ui-button{margin-left:-1px}.sek-ui-button-group .sek-ui-button:last-child{border-radius:0 3px 3px 0}.sek-ui-button{height:28px;line-height:25px;padding:0 10px 2px;border-radius:3px;white-space:nowrap;border-width:1px;border-style:solid;display:inline-flex;text-decoration:none;font-size:12px;margin:0;cursor:pointer;-webkit-appearance:none;background:0 0;color:#555;border-color:#ccc;background:#f7f7f7;box-shadow:inset 0 -1px 0 #ccc;vertical-align:top}.sek-ui-button:hover{background:#fafafa;border-color:#999;box-shadow:inset 0 -1px 0 #999;color:#23282d}.sek-ui-button:active:not(:disabled){background:#eee;border-color:#999;box-shadow:inset 0 1px 0 #999}.sek-ui-button:focus:not(:disabled){background:#fafafa;color:#23282d;border-color:#999;box-shadow:inset 0 -1px 0 #999,0 0 0 2px #fbfbfb;outline:0}.sek-ui-button.is-selected{background:#555d66;border-color:#555d66;box-shadow:inset 0 -1px 0 #555d66;color:#fff;text-decoration:none}.sek-ui-button.is-selected:focus:not(:disabled),.sek-ui-button.is-selected:hover{background:#555d66;border-color:#4f4f4f;color:#fff}.sek-ui-button.is-selected:focus:not(:disabled){box-shadow:inset 0 -1px 0 #4f4f4f}.sek-ui-button.is-selected:focus:not(:disabled){outline:0}.sek-content-type-wrapper{margin-bottom:8px;width:100%;float:left}.sek-content-type-wrapper .sek-ui-button-group{display:block}.sek-content-type-wrapper .sek-ui-button{width:49%;text-align:center;display:inline-block;padding:3px 0;height:auto;text-transform:uppercase}.sek-input-device-switcher .sek-switcher:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#656a6f;position:relative;top:-5px}.sek-input-device-switcher .sek-switcher{cursor:pointer;background:0 0;border:none;padding:0 1px;margin:0 0 0 -2px;box-shadow:none;border-top:1px solid transparent;border-bottom:4px solid transparent;-webkit-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;-o-transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out;transition:.15s color ease-in-out,.15s background-color ease-in-out,.15s border-color ease-in-out}.sek-input-device-switcher .sek-switcher:focus,.sek-input-device-switcher .sek-switcher:hover{background-color:#fff}.sek-input-device-switcher .sek-switcher.active:before{color:#191e23}.sek-input-device-switcher .sek-switcher:focus:before,.sek-input-device-switcher .sek-switcher:hover:before{color:#0073aa}.sek-input-device-switcher .preview-desktop:before{content:"\f472"}.sek-input-device-switcher .preview-tablet:before{content:"\f471"}.sek-input-device-switcher .preview-mobile:before{content:"\f470"}.sek-range-with-unit-picker-wrapper{width:100%;float:left;margin-bottom:8px}.sek-range-with-unit-picker-wrapper .sek-unit-wrapper{float:right}.sek-range-with-unit-picker-wrapper>div{float:left}.sek-borders{width:100%;float:left;margin-bottom:8px}.sek-borders>div{float:left;width:100%}.sek-borders .sek-range-unit-wrapper>div{float:left}.sek-borders .sek-border-type-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper{margin-bottom:5px}.sek-borders .sek-range-unit-wrapper .sek-unit-wrapper{float:right}.sek-borders .sek-color-wrapper{width:100%}.sek-borders .sek-color-wrapper .sek-color-picker{width:50%;float:left}.sek-borders .sek-color-wrapper .sek-reset-button{width:50%;float:right}[data-sek-radius-type=top_right]>i.material-icons{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}[data-sek-radius-type=bottom_right]>i.material-icons{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-radius-type=bottom_left]>i.material-icons{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.sek-range-wrapper{width:44%;margin-right:4px}.sek-no-unit-picker .sek-range-wrapper{width:70%}.sek-number-wrapper{width:50px;margin-right:5px}.sek-range-input{flex:1;width:100%;padding:0;-webkit-appearance:none;background:0 0}.sek-range-input::-webkit-slider-thumb{-webkit-appearance:none;height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input::-moz-range-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-7px}.sek-range-input::-ms-thumb{height:20px;width:20px;border-radius:50%;cursor:pointer;background:#555d66;border:4px solid transparent;background-clip:padding-box;box-sizing:border-box;margin-top:-8px}.sek-range-input:focus{outline:0}.sek-range-input::-webkit-slider-runnable-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px;margin-top:-4px}.sek-range-input::-moz-range-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-range-input::-ms-track{margin-top:-4px;background:0 0;border-color:transparent;color:transparent;height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.sek-animated-arrow{position:absolute;left:-20px;margin-left:6px;top:3px;font-size:10px;color:#617379;-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;-o-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:100%;-webkit-box-align:center;-ms-flex-align:center;align-items:center}[data-sek-expanded=true] label>.customize-control-title .sek-animated-arrow{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}[data-sek-expanded=true] label>.customize-control-title .sek-ctrl-accordion-title,[data-sek-expanded] label>.customize-control-title .sek-ctrl-accordion-title:hover{text-decoration:underline;text-underline-position:under}.sek-level-option-icon{padding-right:5px;min-width:22px;text-align:center}#customize-preview iframe{top:36px}#nimble-top-bar{max-height:36px;position:absolute;text-align:center;right:0;left:0;z-index:20;color:#fff;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;opacity:.3;top:0;background:rgba(0,0,0,.5);padding:2px;z-index:99999;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}body.nimble-top-bar-visible #nimble-top-bar{opacity:1}#nimble-top-bar:hover{background:rgba(0,0,0,.7)}#nimble-top-bar .nimble-top-bar-content{display:inline-block;line-height:20px;width:80%}#nimble-top-bar .sek-do-undo .icon:before{display:inline-block;-webkit-font-smoothing:antialiased;font:normal 20px/30px dashicons;vertical-align:top;color:#fff}#nimble-top-bar .sek-settings{font-size:18px;padding:0 10px}#nimble-top-bar button{background:0 0;border:none;color:#fff;cursor:pointer}#nimble-top-bar button[data-nimble-state=disabled]{cursor:inherit;opacity:.4!important;cursor:not-allowed}#nimble-top-bar .sek-do-undo button:hover{opacity:1}#nimble-top-bar .sek-do-undo button:focus{outline:0}#nimble-top-bar .sek-do-undo .icon.undo:before{content:"\f171";-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}#nimble-top-bar .sek-do-undo .icon.do:before{content:"\f172";-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}#nimble-top-bar .sek-add-content button{padding-top:3px}#nimble-top-bar .sek-nimble-doc{position:absolute;right:10px;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;flex:0 0 100%;max-width:100%}#nimble-top-bar .sek-nimble-doc img{width:30px;height:30px;position:relative;top:2px;-webkit-filter:grayscale(100%);filter:grayscale(100%);-webkit-filter:gray;filter:gray}#nimble-top-bar .sek-nimble-doc:hover img{-webkit-filter:none;filter:none;-webkit-filter:none;filter:none}#nimble-top-bar .sek-notifications{max-width:300px;overflow:hidden}#nimble-top-save-ui{height:300px;padding:20px;position:absolute;top:-300px;right:0;left:0;z-index:20;color:#fff;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;opacity:.3;background:rgba(0,0,0,.5);z-index:99999;max-width:100%}#nimble-top-save-ui>div{width:100%}body.nimble-save-ui-visible #nimble-top-save-ui{opacity:1;top:36px}#nimble-top-save-ui .sek-cancel-save{position:absolute;bottom:10px;right:10px}#nimble-top-save-ui #sek-saved-section-title.error{border:1px solid red}#customize-preview iframe,#nimble-level-tree{-webkit-transition:top .3s ease-in-out;-moz-transition:top,.3s ease-in-out;-ms-transition:top,.3s ease-in-out;-o-transition:top,.3s ease-in-out;transition:top .3s ease-in-out}#customize-preview iframe{z-index:1}.sek-level-tree-expanded #customize-preview iframe{top:366px;height:calc(100vh - 366px)}.sek-level-tree-expanded #nimble-top-bar .sek-level-tree button{color:#44b9e2}#nimble-level-tree{background:#f0f0f0!important;border-bottom:1px solid #aaa!important;color:#222!important;font-size:12px!important;position:absolute;top:36px;right:0;left:0;height:299px;overflow:auto;padding:15px;z-index:0}#nimble-level-tree ul li{padding-left:30px;cursor:pointer;margin-bottom:8px}#nimble-level-tree ul li .sek-remove-level{font-size:16px;opacity:.6}#nimble-level-tree ul li .sek-remove-level:hover{opacity:1}#nimble-level-tree ul li .sek-level-infos{line-height:30px;height:30px;padding-left:33px;position:relative;width:calc(100% - 25px)}.sek-level-infos .sek-inner-level-infos{background:inherit;width:inherit;height:inherit;line-height:inherit;padding-left:4px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:background .2s ease;transition:background .2s ease;-o-transition:background .2s ease}.sek-inner-level-infos:hover{color:#000;background:#fff}.sek-close-level-tree{position:fixed;top:44px;right:25px}img.sek-svg-mod-icon{max-width:45px}.sek-level-infos::before{position:absolute;left:-31px;background:#a2aab2;width:63px;height:2px;content:"";top:calc(50% - 1px)}#nimble-level-tree ul>li:first-child::before{position:absolute;content:"";background:#a2aab2;top:-15px;height:16px;bottom:0;left:-2px;width:2px}#nimble-level-tree ul>li:last-child::after{position:absolute;content:"";background:#f0f0f0;top:16px;bottom:0;left:-2px;width:2px}#nimble-level-tree ul{border-left:2px solid #a2aab2;position:relative}#nimble-level-tree ul>li:last-child{position:relative}.sek-float-right{float:right}.sek-float-left{float:left}.sek-flex-vertical-center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}li[id^=accordion-section-__nimble__]{margin-top:16px}li[id^=accordion-section-__nimble__]>h3{border-top:1px solid #ddd}
assets/czr/sek/js/ccat-sek-control.js CHANGED
@@ -1,4 +1,4 @@
1
-
2
  var CZRSeksPrototype = CZRSeksPrototype || {};
3
  (function ( api, $ ) {
4
  $.extend( CZRSeksPrototype, {
@@ -8,42 +8,115 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8
  if ( _.isUndefined( window.sektionsLocalizedData ) ) {
9
  throw new Error( 'CZRSeksPrototype => missing localized server params sektionsLocalizedData' );
10
  }
 
11
  if ( ! _.isFunction( api.czr_activeSkopes ) ) {
12
  throw new Error( 'CZRSeksPrototype => api.czr_activeSkopes' );
13
  }
 
14
  self.SECTION_ID_FOR_GLOBAL_OPTIONS = '__globalOptionsSectionId';
15
  self.SECTION_ID_FOR_LOCAL_OPTIONS = '__localOptionsSection';
 
 
16
  self.SECTION_ID_FOR_CONTENT_PICKER = '__content_picker__';
 
 
17
  self.MAX_NUMBER_OF_COLUMNS = 12;
 
 
 
18
  self.SETTING_UPDATE_BUFFER = 100;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  self.defaultLocalSektionSettingValue = self.getDefaultSektionSettingValue( 'local' );
 
 
20
  self.localSectionsSettingId = new api.Value( {} );
 
 
 
 
21
  self.registered = new api.Value([]);
22
 
23
 
24
  api.bind( 'ready', function() {
25
  self.doSektionThinksOnApiReady();
26
  });//api.bind( 'ready' )
 
 
 
 
 
 
 
 
27
  api.bind( 'save-request-params', function( query ) {
28
  $.extend( query, { local_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ) } );
29
  });
30
 
31
  },// initialize()
 
 
 
 
32
  doSektionThinksOnApiReady : function() {
33
  var self = this;
 
 
34
  self.registerAndSetupDefaultPanelSectionOptions();
 
 
 
 
 
 
 
 
 
 
35
  self.localSectionsSettingId.callbacks.add( function( collectionSettingIds, previousCollectionSettingIds ) {
 
 
36
  try { self.setupSettingsToBeSaved(); } catch( er ) {
37
  api.errare( 'Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()' , er );
38
  }
 
 
39
  self.initializeHistoryLogWhenSettingsRegistered();
 
 
 
 
 
 
 
40
  });
 
 
 
 
 
41
  var doSkopeDependantActions = function( newSkopes, previousSkopes ) {
42
  self.setContextualCollectionSettingIdWhenSkopeSet( newSkopes, previousSkopes );
 
 
43
  api.section( self.SECTION_ID_FOR_LOCAL_OPTIONS, function( _section_ ) {
44
  _section_.deferred.embedded.done( function() {
45
  if( true === _section_.boundForLocalOptionGeneration )
46
  return;
 
47
  _section_.boundForLocalOptionGeneration = true;
48
  _section_.expanded.bind( function( expanded ) {
49
  if ( true === expanded ) {
@@ -52,27 +125,58 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
52
  });
53
  });
54
  });
 
 
 
 
55
  api.section( self.SECTION_ID_FOR_GLOBAL_OPTIONS, function( _section_ ) {
56
  if ( true === _section_.nimbleGlobalOptionGenerated )
57
  return;
58
  self.generateUI({ action : 'sek-generate-global-options-ui'});
59
  _section_.nimbleGlobalOptionGenerated = true;
60
  });
 
 
61
  api.trigger('nimble-ready-for-current-skope');
62
  };//doSkopeDependantActions()
 
 
63
  if ( ! _.isEmpty( api.czr_activeSkopes().local ) ) {
64
  doSkopeDependantActions();
65
  }
 
 
 
 
66
  api.czr_activeSkopes.callbacks.add( function( newSkopes, previousSkopes ) {
67
  doSkopeDependantActions( newSkopes, previousSkopes );
68
  });
 
 
 
69
  self.reactToPreviewMsg();
 
 
70
  self.setupDnd();
 
 
 
 
71
  self.setupTinyMceEditor();
 
 
72
  self.schedulePrintSectionJson();
 
 
 
 
73
  self.bind( 'sek-ui-removed', function() {
74
  api.previewedDevice( 'desktop' );
75
  });
 
 
 
 
76
  api.previewedDevice.bind( function( device ) {
77
  var currentControls = _.filter( self.registered(), function( uiData ) {
78
  return 'control' == uiData.what;
@@ -85,10 +189,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
85
  });
86
  });
87
  });
 
 
88
  $('#customize-notifications-area').on( 'click', '[data-sek-reset="true"]', function() {
89
  self.resetCollectionSetting();
90
  });
 
 
 
 
 
91
  self.bind( 'sek-ui-pre-removal', function( params ) {
 
92
  if ( 'control' == params.what && -1 < params.id.indexOf( 'draggable') ) {
93
  api.control( params.id, function( _ctrl_ ) {
94
  _ctrl_.container.find( '[draggable]' ).each( function() {
@@ -96,6 +208,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
96
  });
97
  });
98
  }
 
 
 
99
  if ( 'control' == params.what ) {
100
  api.control( params.id, function( _ctrl_ ) {
101
  _ctrl_.container.find( 'select' ).each( function() {
@@ -106,57 +221,121 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
106
  });
107
  }
108
  });
 
 
 
 
109
  api.bind( 'czr-new-registered', function( params ) {
 
 
110
  if ( _.isUndefined( params.origin ) ) {
111
  throw new Error( 'czr-new-registered event => missing params.origin' );
112
  }
113
  if ( 'nimble' !== params.origin )
114
  return;
 
 
115
  if ( false !== params.track ) {
116
  var currentlyRegistered = self.registered();
117
  var newRegistered = $.extend( true, [], currentlyRegistered );
 
118
  var duplicateCandidate = _.findWhere( newRegistered, { id : params.id } );
119
  if ( ! _.isEmpty( duplicateCandidate ) && _.isEqual( duplicateCandidate, params ) ) {
120
  throw new Error( 'register => duplicated element in self.registered() collection ' + params.id );
121
  }
122
  newRegistered.push( params );
123
  self.registered( newRegistered );
 
 
 
124
  }
125
  });
 
 
 
 
 
 
 
 
 
 
 
 
126
  self.setupTopBar();//@see specific dev file
 
 
127
  if ( sektionsLocalizedData.isSavedSectionEnabled ) {
128
  self.setupSaveUI();
129
  }
 
 
 
 
 
130
  self.lastClickedTargetInPreview = new api.Value();
131
  self.lastClickedTargetInPreview.bind( function( to, from ) {
 
 
 
 
 
132
  if ( _.isObject( to ) && to.id ) {
133
  api.previewer.send( 'sek-set-double-click-target', to );
134
  } else {
 
135
  api.previewer.send( 'sek-reset-double-click-target' );
136
  }
 
 
137
  clearTimeout( $(window).data('_preview_target_timer_') );
138
  $(window).data('_preview_target_timer_', setTimeout(function() {
 
139
  self.lastClickedTargetInPreview( {} );
 
140
  api.previewer.send( 'sek-reset-double-click-target' );
141
  }, 20000 ) );
142
  });
 
 
 
 
143
  api.previewer.bind( 'sek-clean-target-drop-zone', function() {
 
144
  self.lastClickedTargetInPreview({});
145
  });
 
 
146
  $(document).keydown(function( evt ) {
 
147
  if ( evt && 27 === evt.keyCode ) {
148
  self.lastClickedTargetInPreview({});
149
  }
150
  });
151
  },//doSektionThinksOnApiReady
 
 
 
 
 
 
 
 
152
  registerAndSetupDefaultPanelSectionOptions : function() {
153
  var self = this;
 
 
154
  var SektionPanelConstructor = api.Panel.extend({
 
 
155
  isContextuallyActive : function () {
156
  return this.active();
157
  },
158
  _toggleActive : function(){ return true; }
159
  });
 
 
 
160
  api.panel( sektionsLocalizedData.sektionsPanelId, function( _mainPanel_ ) {
161
  _mainPanel_.deferred.embedded.done( function() {
162
  var $sidePanelTitleEl = _mainPanel_.container.find('h3.accordion-section-title'),
@@ -164,14 +343,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
164
  logoHtml = [ '<img class="sek-nimble-logo" alt="'+ _mainPanel_.params.title +'" src="', sektionsLocalizedData.baseUrl, '/assets/img/nimble/nimble_horizontal.svg?ver=' + sektionsLocalizedData.nimbleVersion , '"/>' ].join('');
165
 
166
  if ( 0 < $sidePanelTitleEl.length ) {
 
 
167
  var $sidePanelTitleElSpan = $sidePanelTitleEl.find('span');
168
  $sidePanelTitleEl
169
  .addClass('sek-side-nimble-logo-wrapper')
170
  .html( logoHtml )
171
  .append( $sidePanelTitleElSpan );
172
  }
 
 
 
 
 
 
 
173
  });
174
  });
 
 
175
  api.CZR_Helpers.register({
176
  origin : 'nimble',
177
  what : 'panel',
@@ -181,6 +371,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
181
  constructWith : SektionPanelConstructor,
182
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
183
  });
 
 
 
184
  api.CZR_Helpers.register({
185
  origin : 'nimble',
186
  what : 'section',
@@ -190,6 +383,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
190
  priority : 20,
191
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
192
  constructWith : api.Section.extend({
 
 
193
  isContextuallyActive : function () {
194
  return this.active();
195
  },
@@ -197,17 +392,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
197
  })
198
  }).done( function() {
199
  api.section( self.SECTION_ID_FOR_GLOBAL_OPTIONS, function( _section_ ) {
 
200
  var $sectionTitleEl = _section_.container.find('.accordion-section-title'),
201
  $panelTitleEl = _section_.container.find('.customize-section-title h3');
 
 
202
  if ( 0 < $sectionTitleEl.length ) {
203
  $sectionTitleEl.prepend( '<i class="fas fa-globe sek-level-option-icon"></i>' );
204
  }
 
 
205
  if ( 0 < $panelTitleEl.length ) {
206
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-globe sek-level-option-icon"></i>' );
207
  }
 
 
208
  self.scheduleModuleAccordion.call( _section_ );
209
  });
210
  });
 
 
211
  api.CZR_Helpers.register({
212
  origin : 'nimble',
213
  what : 'section',
@@ -217,6 +421,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
217
  priority : 10,
218
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
219
  constructWith : api.Section.extend({
 
 
220
  isContextuallyActive : function () {
221
  return this.active();
222
  },
@@ -224,19 +430,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
224
  })
225
  }).done( function() {
226
  api.section( self.SECTION_ID_FOR_LOCAL_OPTIONS, function( _section_ ) {
 
227
  var $sectionTitleEl = _section_.container.find('.accordion-section-title'),
228
  $panelTitleEl = _section_.container.find('.customize-section-title h3');
 
 
229
  if ( 0 < $sectionTitleEl.length ) {
230
  $sectionTitleEl.prepend( '<i class="fas fa-map-marker-alt sek-level-option-icon"></i>' );
231
  }
 
 
232
  if ( 0 < $panelTitleEl.length ) {
233
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-map-marker-alt sek-level-option-icon"></i>' );
234
  }
 
 
235
  self.scheduleModuleAccordion.call( _section_ );
236
  });
237
  });
 
 
 
 
 
238
  api.CZR_Helpers.register( {
239
  origin : 'nimble',
 
240
  what : 'setting',
241
  id : sektionsLocalizedData.optNameForGlobalOptions,
242
  dirty : false,
@@ -244,6 +463,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
244
  transport : 'refresh',//'refresh',//// ,
245
  type : 'option'
246
  });
 
 
 
247
  api.CZR_Helpers.register({
248
  origin : 'nimble',
249
  what : 'section',
@@ -253,12 +475,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
253
  priority : 30,
254
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
255
  constructWith : api.Section.extend({
 
 
256
  isContextuallyActive : function () {
257
  return this.active();
258
  },
259
  _toggleActive : function(){ return true; }
260
  })
261
  }).done( function() {
 
 
 
 
 
262
  api.section( self.SECTION_ID_FOR_CONTENT_PICKER, function( _section_ ) {
263
  if ( 'resolved' != api.czr_initialSkopeCollectionPopulated.state() ) {
264
  api.czr_initialSkopeCollectionPopulated.done( function() {
@@ -270,12 +499,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
270
  });
271
  });
272
  },//registerAndSetupDefaultPanelSectionOptions()
 
 
 
 
 
 
 
 
 
 
 
 
 
273
  setContextualCollectionSettingIdWhenSkopeSet : function( newSkopes, previousSkopes ) {
274
  var self = this;
275
  previousSkopes = previousSkopes || {};
 
276
  if ( ! _.isEmpty( previousSkopes.local ) && api.panel( sektionsLocalizedData.sektionsPanelId ).expanded() ) {
277
  api.previewer.trigger('sek-pick-content');
278
  }
 
 
279
  sektionsData = api.czr_skopeBase.getSkopeProperty( 'sektions', 'local');
280
  if ( sektionsLocalizedData.isDevMode ) {
281
  api.infoLog( '::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ', sektionsData );
@@ -290,9 +535,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
290
  }
291
  });//$.extend()
292
  })( wp.customize, jQuery );
 
293
  var CZRSeksPrototype = CZRSeksPrototype || {};
294
  (function ( api, $ ) {
295
  $.extend( CZRSeksPrototype, {
 
296
  setupTopBar : function() {
297
  var self = this;
298
  self.topBarId = '#nimble-top-bar';
@@ -319,14 +566,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
319
  api.previewer.bind('ready', function() {
320
  $(api.previewer.targetWindow().document ).on( 'mousemove scroll,', _.throttle( trackMouseMovements , 50 ) );
321
  });
 
 
322
  self.setupLevelTree();
323
  },
 
 
 
 
 
 
324
  toggleTopBar : function( visible ) {
325
  visible = _.isUndefined( visible ) ? true : visible;
326
  var self = this,
327
  _renderAndSetup = function() {
328
  $.when( self.renderAndSetupTopBarTmpl({}) ).done( function( $_el ) {
329
  self.topBarContainer = $_el;
 
330
  _.delay( function() {
331
  $('body').addClass('nimble-top-bar-visible');
332
  }, 200 );
@@ -336,7 +592,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
336
  var dfd = $.Deferred();
337
  $('body').removeClass('nimble-top-bar-visible');
338
  if ( self.topBarContainer && self.topBarContainer.length ) {
 
339
  _.delay( function() {
 
340
  dfd.resolve();
341
  }, 300 );
342
  } else {
@@ -353,10 +611,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
353
  });
354
  }
355
  },
 
 
 
356
  renderAndSetupTopBarTmpl : function( params ) {
357
- var self = this;
 
 
 
358
  if ( $( self.topBarId ).length > 0 )
359
  return $( self.topBarId );
 
 
360
  try {
361
  _tmpl = wp.template( 'nimble-top-bar' )( {} );
362
  } catch( er ) {
@@ -364,6 +630,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
364
  return false;
365
  }
366
  $('#customize-preview').after( $( _tmpl ) );
 
 
367
  $(document).keydown( function( evt ) {
368
  if ( evt.ctrlKey && _.contains( [89, 90], evt.keyCode ) ) {
369
  try { self.navigateHistory( 90 === evt.keyCode ? 'undo' : 'redo'); } catch( er ) {
@@ -371,6 +639,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
371
  }
372
  }
373
  });
 
 
 
 
374
  $('.sek-add-content', self.topBarId).on( 'click', function(evt) {
375
  evt.preventDefault();
376
  api.previewer.trigger( 'sek-pick-content', { content_type : 'module' });
@@ -385,16 +657,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
385
  }
386
  });
387
  $('.sek-settings', self.topBarId).on( 'click', function(evt) {
 
388
  api.panel( sektionsLocalizedData.sektionsPanelId, function( _panel_ ) {
389
  self.rootPanelFocus();
390
  _panel_.focus();
391
  });
 
 
 
 
 
 
392
  });
393
 
394
  $('.sek-nimble-doc', self.topBarId).on( 'click', function(evt) {
395
  evt.preventDefault();
396
  window.open($(this).data('doc-href'), '_blank');
397
  });
 
 
 
398
  var maybePrintNotificationForUsageOfNimbleTemplate = function( templateSettingValue ) {
399
  if ( $(self.topBarId).length < 1 )
400
  return;
@@ -409,18 +691,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
409
  };
410
 
411
  var initOnSkopeReady = function() {
 
 
412
  api( self.localSectionsSettingId(), function( _localSectionsSetting_ ) {
413
  var localSectionsValue = _localSectionsSetting_(),
414
  initialLocalTemplateValue = ( _.isObject( localSectionsValue ) && localSectionsValue.local_options && localSectionsValue.local_options.template ) ? localSectionsValue.local_options.template : null;
 
415
  maybePrintNotificationForUsageOfNimbleTemplate( initialLocalTemplateValue );
416
  });
 
 
 
417
  api( self.getLocalSkopeOptionId() + '__template', function( _set_ ) {
418
  _set_.bind( function( to, from ) {
419
  maybePrintNotificationForUsageOfNimbleTemplate( to );
420
  });
421
  });
422
  };
 
 
423
  initOnSkopeReady();
 
 
424
  api.bind('nimble-ready-for-current-skope', function() {
425
  initOnSkopeReady();
426
  });
@@ -429,13 +721,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
429
  }
430
  });//$.extend()
431
  })( wp.customize, jQuery );
 
432
  var CZRSeksPrototype = CZRSeksPrototype || {};
433
  (function ( api, $ ) {
434
  $.extend( CZRSeksPrototype, {
435
  /* HISTORY */
 
 
436
  navigateHistory : function( direction ) {
437
  var self = this,
438
  historyLog = $.extend( true, [], self.historyLog() );
 
 
 
 
 
 
 
 
439
  var previous,
440
  current,
441
  future,
@@ -461,6 +764,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
461
  }
462
  switch( direction ) {
463
  case 'undo' :
 
464
  if ( ! _.isEmpty( current ) && ! _.isEmpty( previous ) ) {
465
  newSettingValue = previous.value;
466
  previousSektionToRefresh = current.sektionToRefresh;
@@ -468,6 +772,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
468
  }
469
  break;
470
  case 'redo' :
 
471
  if ( ! _.isEmpty( future ) ) {
472
  newSettingValue = future.value;
473
  previousSektionToRefresh = current.sektionToRefresh;
@@ -476,6 +781,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
476
  break;
477
  }
478
  });
 
 
479
  if( ! _.isUndefined( newSettingValue ) ) {
480
  if ( ! _.isEmpty( newSettingValue.local ) ) {
481
  api( self.localSectionsSettingId() )( self.validateSettingValue( newSettingValue.local ), { navigatingHistoryLogs : true } );
@@ -483,12 +790,40 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
483
  if ( ! _.isEmpty( newSettingValue.global ) ) {
484
  api( self.getGlobalSectionsSettingId() )( self.validateSettingValue( newSettingValue.global ), { navigatingHistoryLogs : true } );
485
  }
 
 
486
  var previewHasBeenRefreshed = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  api.previewer.refresh();
 
 
488
  api.previewer.trigger( 'sek-pick-content', {});
 
 
489
  self.cleanRegistered();//<= normal cleaning
490
  self.cleanRegisteredLevelSettingsAfterHistoryNavigation();// setting cleaning
491
  }
 
 
492
  var currentKey = _.findKey( historyLog, { status : 'current'} );
493
  currentKey = Number( currentKey );
494
  if ( ! _.isNumber( currentKey ) ) {
@@ -498,6 +833,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
498
 
499
  _.each( historyLog, function( log, key ) {
500
  newLog = $.extend( true, {}, log );
 
501
  key = Number( key );
502
  switch( direction ) {
503
  case 'undo' :
@@ -525,22 +861,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
525
  }
526
  });//$.extend()
527
  })( wp.customize, jQuery );
 
528
  var CZRSeksPrototype = CZRSeksPrototype || {};
529
  (function ( api, $ ) {
530
  $.extend( CZRSeksPrototype, {
 
531
  setupLevelTree : function() {
532
  var self = this;
533
  self.levelTree = new api.Value([]);
534
- self.levelTree.bind( function( _collection ) {
 
535
  if ( self.levelTreeExpanded() ) {
536
  self.renderOrRefreshTree();
537
  }
538
  });
 
 
 
539
  self.levelTreeExpanded = new api.Value(false);
540
  self.levelTreeExpanded.bind( function(expanded) {
541
  $('body').toggleClass( 'sek-level-tree-expanded', expanded );
542
  if ( expanded ) {
 
543
  self.setLevelTreeValue();
 
 
544
  if ( _.isEmpty( self.levelTree() ) ) {
545
  api.previewer.trigger('sek-notify', {
546
  type : 'info',
@@ -551,6 +896,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
551
  '</span>'
552
  ].join('')
553
  });
 
554
  self.levelTreeExpanded(false);
555
  return;
556
  }
@@ -563,9 +909,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
563
  }, 300 );
564
  }
565
  });
 
 
 
 
 
 
 
 
 
 
566
  api.previewer.bind('ready', function() {
 
 
 
 
567
  self.localSectionsSettingId.callbacks.add( function() {
568
- _.each( [ self.getGlobalSectionsSettingId(), self.localSectionsSettingId() ], function( setId ){
 
 
569
  if ( api(setId)._isBoundForNimbleLevelTree )
570
  return;
571
 
@@ -576,12 +938,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
576
  });
577
  });
578
  });
 
 
 
 
579
  $('body').on('click', '#nimble-level-tree [data-nimb-level]', function(evt) {
580
  evt.preventDefault();
581
  evt.stopPropagation();
582
- var $el = $(evt.target);
583
- api.previewer.send('sek-animate-to-level', { id : $el.data('nimb-id') });
584
- api.previewer.send('sek-display-level-ui', { id : $el.data('nimb-id') });
 
585
  });
586
 
587
  $('body').on('click', '#nimble-level-tree .sek-remove-level', function(evt) {
@@ -596,41 +963,163 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
596
  in_column : $el.closest('[data-nimb-level="column"]').data('nimb-id')
597
  });
598
  $el.fadeOut('slow');
 
599
  self.renderOrRefreshTree();
600
  });
 
 
 
 
 
 
601
  },
602
- hasLocalHeaderFooter : function() {
603
- if ( ! api.has( self.localSectionsSettingId() ) )
604
- return;
605
- },
606
  setLevelTreeValue : function() {
607
  var self = this,
608
- globalId = self.getGlobalSectionsSettingId(),
609
- localId = self.localSectionsSettingId();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
 
611
- _global_col = api(globalId)();
612
- _global_col = ( _.isObject( _global_col ) && ! _.isEmpty( _global_col.collection ) ) ? _global_col.collection : [];
613
- _global_col = _.isArray( _global_col ) ? _global_col : [];
 
614
 
615
- _local_col = api(localId)();
616
- _local_col = ( _.isObject( _local_col ) && ! _.isEmpty( _local_col.collection ) ) ? _local_col.collection : [];
617
- _local_col = _.isArray( _local_col ) ? _local_col : [];
618
- self.levelTree( _.union( _global_col, _local_col ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
619
  },
 
 
 
620
  renderOrRefreshTree : function() {
621
- var self = this;
 
622
  if( $('#nimble-level-tree').length < 1 ) {
623
- $( '#customize-preview' ).after( $('<div/>', { id : 'nimble-level-tree' } ) );
 
 
 
 
 
 
 
624
  }
625
- $('#nimble-level-tree').html( self.getLevelTreeHtml( self.levelTree() ) );
626
  },
 
 
 
627
  getLevelTreeHtml : function( _col, level ) {
628
  var self = this;
 
 
 
 
 
 
 
629
  if ( !_.isArray( _col ) || _.isEmpty( _col ) ) {
630
  api.errare('::buildLevelTree => invalid collection param', _col );
631
  return _html;
632
  }
633
- var remove_icon_html = '<i class="material-icons sek-remove-level" title="">delete_forever</i>';
634
  _html = '<ul>';
635
  _.each( _col, function( _level_param ) {
636
  if ( _.isUndefined( _level_param.level ) ){
@@ -642,24 +1131,100 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
642
  return;
643
  }
644
 
645
- if ( 'module' !== _level_param.level && ( _.isUndefined( _level_param.collection ) || !_.isArray( _level_param.collection ) || _.isEmpty( _level_param.collection ) ) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
646
  return;
647
- remove_icon_html = 'location' !== _level_param.level ? remove_icon_html : '';
648
- _html = _html + '<li data-nimb-level="'+_level_param.level+'" data-nimb-id="'+_level_param.id+'">';
649
- _html = _html + [ _level_param.level , ' id :', _level_param.id, ' ', remove_icon_html ].join('');
650
- if ( _.isArray( _level_param.collection ) && ! _.isEmpty( _level_param.collection ) ) {
651
- _html = _html + self.getLevelTreeHtml( _level_param.collection, level );
652
  }
653
- _html = _html + '</li>';
654
  });
655
- _html = _html + '</ul>';
656
- return _html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  }
658
  });//$.extend()
659
  })( wp.customize, jQuery );
 
660
  var CZRSeksPrototype = CZRSeksPrototype || {};
661
  (function ( api, $ ) {
662
  $.extend( CZRSeksPrototype, {
 
 
663
  setupSaveUI : function() {
664
  var self = this;
665
  self.saveUIVisible = new api.Value( false );
@@ -667,15 +1232,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
667
  self.toggleSaveUI( to, params ? params.id : null );
668
  });
669
  },
 
 
 
 
 
 
670
  toggleSaveUI : function( visible, sectionId ) {
671
  visible = _.isUndefined( visible ) ? true : visible;
672
  var self = this,
673
  _renderAndSetup = function() {
674
  $.when( self.renderAndSetupSaveUITmpl({}) ).done( function( $_el ) {
675
  self.saveUIContainer = $_el;
 
676
  _.delay( function() {
677
  $('body').addClass('nimble-save-ui-visible');
678
  }, 200 );
 
679
  $('#sek-saved-section-id').val( sectionId );
680
  });
681
  },
@@ -683,6 +1256,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
683
  var dfd = $.Deferred();
684
  $('body').removeClass('nimble-save-ui-visible');
685
  if ( $( '#nimble-top-save-ui' ).length > 0 ) {
 
686
  _.delay( function() {
687
 
688
  self.saveUIContainer.remove();
@@ -702,12 +1276,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
702
  });
703
  }
704
  },
 
 
 
 
 
 
 
 
 
 
 
 
705
  preProcessSektion : function( sectionModel ) {
706
  var self = this, sektionCandidate = self.cleanIds( sectionModel );
707
  return _.omit( sektionCandidate, function( val, key ) {
708
  return _.contains( ['id', 'level'], key );
709
  });
710
  },
 
 
 
711
  renderAndSetupSaveUITmpl : function( params ) {
712
  if ( $( '#nimble-top-save-ui' ).length > 0 )
713
  return $( '#nimble-top-save-ui' );
@@ -721,6 +1310,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
721
  return false;
722
  }
723
  $('#customize-preview').after( $( _tmpl ) );
 
 
724
  $('.sek-do-save-section', '#nimble-top-save-ui').on( 'click', function(evt) {
725
  evt.preventDefault();
726
  var sectionModel = $.extend( true, {}, self.getLevelModel( $('#sek-saved-section-id').val() ) ),
@@ -754,6 +1345,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
754
  sek_data: JSON.stringify( sek_data )
755
  })
756
  .done( function( response ) {
 
 
757
  api.previewer.trigger('sek-notify', {
758
  type : 'success',
759
  duration : 10000,
@@ -787,12 +1380,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
787
  }
788
  });//$.extend()
789
  })( wp.customize, jQuery );
 
790
  var CZRSeksPrototype = CZRSeksPrototype || {};
791
  (function ( api, $ ) {
792
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
793
  setupSettingsToBeSaved : function() {
794
  var self = this,
795
  serverCollection;
 
 
796
  var _settingsToRegister_ = {
797
  'local' : { collectionSettingId : self.localSectionsSettingId() },//<= "nimble___[skp__post_page_10]"
798
  'global' : { collectionSettingId : self.getGlobalSectionsSettingId() }//<= "nimble___[skp__global]"
@@ -803,6 +1404,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
803
  if ( _.isEmpty( settingData.collectionSettingId ) ) {
804
  throw new Error( 'setupSettingsToBeSaved => the collectionSettingId is invalid' );
805
  }
 
 
 
806
  if ( ! api.has( settingData.collectionSettingId ) ) {
807
  var __collectionSettingInstance__ = api.CZR_Helpers.register({
808
  what : 'setting',
@@ -813,18 +1417,60 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
813
  track : false,//don't register in the self.registered()
814
  origin : 'nimble'
815
  });
 
 
 
816
  api( settingData.collectionSettingId, function( sektionSetInstance ) {
 
 
817
  sektionSetInstance.bind( _.debounce( function( newSektionSettingValue, previousValue, params ) {
 
 
 
 
 
 
 
818
  self.trackHistoryLog( sektionSetInstance, params );
819
 
820
  }, 1000 ) );
821
  });//api( settingData.collectionSettingId, function( sektionSetInstance ){}
822
  }//if ( ! api.has( settingData.collectionSettingId ) ) {
823
  });//_.each(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824
  },// SetupSettingsToBeSaved()
 
 
 
825
  trackHistoryLog : function( sektionSetInstance, params ) {
826
  var self = this,
827
  _isGlobal = sektionSetInstance.id === self.getGlobalSectionsSettingId();
 
 
 
828
  if ( params && true !== params.navigatingHistoryLogs ) {
829
  var newHistoryLog = [],
830
  historyLog = $.extend( true, [], self.historyLog() ),
@@ -835,6 +1481,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
835
  } else if ( ! _.isEmpty( params.to_sektion ) ) {// column moved /
836
  sektionToRefresh = params.to_sektion;
837
  }
 
 
838
  _.each( historyLog, function( log ) {
839
  var newStatus = 'previous';
840
  if ( 'future' == log.status )
@@ -851,8 +1499,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
851
  self.historyLog( newHistoryLog );
852
  }
853
  },
 
 
 
 
854
  initializeHistoryLogWhenSettingsRegistered : function() {
855
  var self = this;
 
856
  self.historyLog = new api.Value([{
857
  status : 'current',
858
  value : {
@@ -861,6 +1514,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
861
  },
862
  action : 'initial'
863
  }]);
 
864
  self.historyLog.bind( function( newLog ) {
865
  if ( _.isEmpty( newLog ) )
866
  return;
@@ -876,6 +1530,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
876
  });
877
  });
878
  },
 
 
 
 
 
879
  validateSettingValue : function( valCandidate ) {
880
  if ( ! _.isObject( valCandidate ) ) {
881
  api.errare('validation error => the setting should be an object', valCandidate );
@@ -884,6 +1543,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
884
  var parentLevel = {},
885
  errorDetected = false,
886
  levelIds = [];
 
887
  var _errorDetected_ = function( msg ) {
888
  api.errare( msg , valCandidate );
889
  api.previewer.trigger('sek-notify', {
@@ -893,7 +1553,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
893
  '<span style="font-size:0.95em">',
894
  '<strong>' + msg + '</strong>',
895
  '<br>',
896
- sektionsLocalizedData.i18n['If this problem locks the Nimble builder, you might try to reset the sections for this page.'],
897
  '<br>',
898
  '<span style="text-align:center;display:block">',
899
  '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n.Reset + '" data-sek-reset="true">' + sektionsLocalizedData.i18n.Reset + '</button>',
@@ -909,8 +1569,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
909
  return;
910
  }
911
  if ( _.isUndefined( level ) && _.isEmpty( parentLevel ) ) {
 
912
  level = $.extend( true, {}, valCandidate );
913
  if ( _.isUndefined( level.id ) || _.isUndefined( level.level ) ) {
 
 
 
914
  if ( _.isUndefined( level.collection ) ) {
915
  _errorDetected_( 'validation error => the root level is missing the collection of locations' );
916
  return;
@@ -919,12 +1583,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
919
  _errorDetected_( 'validation error => the root level should not have a "level" or an "id" property' );
920
  return;
921
  }
 
 
922
  _.each( valCandidate.collection, function( _l_ ) {
 
923
  parentLevel = level;
 
924
  _checkWalker_( _l_ );
925
  });
926
  }
927
  } else {
 
 
 
 
928
  if ( _.isEmpty( level.id ) || ! _.isString( level.id )) {
929
  _errorDetected_('validation error => a ' + level.level + ' level must have a valid id' );
930
  return;
@@ -934,6 +1606,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
934
  } else {
935
  levelIds.push( level.id );
936
  }
 
 
 
 
 
 
 
 
937
  if ( _.isEmpty( level.level ) || ! _.isString( level.level ) ) {
938
  _errorDetected_('validation error => a ' + level.level + ' level must have a level property' );
939
  return;
@@ -941,6 +1621,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
941
  _errorDetected_('validation error => the level "' + level.level + '" is not authorized' );
942
  return;
943
  }
 
 
 
944
  if ( 'module' == level.level ) {
945
  if ( ! _.isUndefined( level.collection ) ) {
946
  _errorDetected_('validation error => a module can not have a collection property' );
@@ -952,9 +1635,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
952
  return;
953
  }
954
  }
 
 
955
  if ( _.isUndefined( level.ver_ini ) ) {
 
 
956
  api.errare( 'validateSettingValue() => validation error => a ' + level.level + ' should have a version property : "ver_ini"' );
957
  }
 
 
958
  switch ( level.level ) {
959
  case 'location' :
960
  if ( ! _.isEmpty( parentLevel.level ) ) {
@@ -988,31 +1677,65 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
988
  }
989
  break;
990
  }
 
 
991
  if ( 'module' != level.level ) {
992
  _.each( level.collection, function( _l_ ) {
 
993
  parentLevel = $.extend( true, {}, level );
 
994
  _checkWalker_( _l_ );
995
  });
996
  }
997
  }
998
  };
999
  _checkWalker_();
 
 
 
1000
  return errorDetected ? null : valCandidate;
1001
  },//validateSettingValue
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1002
  resetCollectionSetting : function() {
1003
  var self = this;
1004
  if ( _.isEmpty( self.localSectionsSettingId() ) ) {
1005
  throw new Error( 'setupSettingsToBeSaved => the collectionSettingId is invalid' );
1006
  }
 
1007
  api( self.localSectionsSettingId() )( self.getDefaultSektionSettingValue( 'local' ) );
 
1008
  api.previewer.refresh();
 
1009
  api.notifications.remove( 'sek-notify' );
 
1010
  api.panel( sektionsLocalizedData.sektionsPanelId, function( __main_panel__ ) {
1011
  api.notifications.add( new api.Notification( 'sek-reset-done', {
1012
  type: 'success',
1013
  message: sektionsLocalizedData.i18n['Reset complete'],
1014
  dismissible: true
1015
  } ) );
 
 
1016
  _.delay( function() {
1017
  api.notifications.remove( 'sek-reset-done' );
1018
  }, 5000 );
@@ -1023,12 +1746,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1023
  var CZRSeksPrototype = CZRSeksPrototype || {};
1024
  (function ( api, $ ) {
1025
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
1026
  reactToPreviewMsg : function() {
1027
  var self = this,
1028
  apiParams = {},
1029
  uiParams = {},
1030
  sendToPreview = true, //<= the default behaviour is to send a message to the preview when the setting has been changed
1031
  msgCollection = {
 
 
 
 
 
 
 
1032
  'sek-add-section' : {
1033
  callback : function( params ) {
1034
  sendToPreview = ! _.isUndefined( params.send_to_preview ) ? params.send_to_preview : true;//<= when the level is refreshed when complete, we don't need to send to preview.
@@ -1047,6 +1784,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1047
  return self.updateAPISetting( apiParams );
1048
  },
1049
  complete : function( params ) {
 
1050
  if ( params.apiParams.is_first_section ) {
1051
  api.previewer.trigger( 'sek-refresh-level', {
1052
  level : 'location',
@@ -1054,6 +1792,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1054
  });
1055
  }
1056
  api.previewer.trigger( 'sek-pick-content', {
 
 
1057
  id : params.apiParams ? params.apiParams.id : '',
1058
  content_type : 'section'
1059
  });
@@ -1075,6 +1815,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1075
  return self.updateAPISetting( apiParams );
1076
  },
1077
  complete : function( params ) {
 
 
 
1078
  if ( false !== params.apiParams.autofocus ) {
1079
  api.previewer.trigger( 'sek-pick-content', {});
1080
  }
@@ -1103,10 +1846,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1103
  in_sektion : params.apiParams.in_sektion,
1104
  in_column : params.apiParams.in_column
1105
  });
 
 
1106
  self.updateAPISetting({
1107
  action : 'sek-update-fonts',
1108
  is_global_location : self.isGlobalLocation( params.apiParams )
1109
  });
 
 
 
 
 
1110
  api.previewer.trigger('sek-refresh-stylesheet', {
1111
  id : params.apiParams.in_column,
1112
  location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
@@ -1156,10 +1906,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1156
  },
1157
  complete : function( params ) {
1158
  api.previewer.trigger( 'sek-pick-content', {});
 
 
1159
  self.updateAPISetting({
1160
  action : 'sek-update-fonts',
1161
  is_global_location : self.isGlobalLocation( params.apiParams )
1162
  });
 
 
1163
  if ( 'sek-remove-section' === params.apiParams.action ) {
1164
  var locationLevel = self.getLevelModel( params.apiParams.location );
1165
  if ( _.isEmpty( locationLevel.collection ) ) {
@@ -1218,6 +1972,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1218
  level : 'section',
1219
  in_sektion : params.apiParams.id
1220
  });
 
1221
  if ( params.apiParams.from_location != params.apiParams.to_location ) {
1222
  api.previewer.trigger( 'sek-refresh-level', {
1223
  level : 'location',
@@ -1291,6 +2046,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1291
  });
1292
  }
1293
  },
 
 
 
1294
  'sek-duplicate' : {
1295
  callback : function( params ) {
1296
  sendToPreview = true;
@@ -1335,6 +2093,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1335
  in_sektion : params.apiParams.id
1336
  });
1337
  idForStyleSheetRefresh = params.apiParams.location;
 
1338
  api.previewer.send('sek-animate-to-level', { id : params.apiParams.id });
1339
  break;
1340
  case 'sek-duplicate-column' :
@@ -1356,6 +2115,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1356
  idForStyleSheetRefresh = params.apiParams.in_column;
1357
  break;
1358
  }
 
 
 
 
1359
  api.previewer.trigger('sek-refresh-stylesheet', {
1360
  id : idForStyleSheetRefresh,
1361
  location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
@@ -1369,6 +2132,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1369
  apiParams = params;
1370
  return self.updateAPISetting( apiParams );
1371
  },
 
 
 
 
 
 
 
 
 
1372
  'sek-add-content-in-new-sektion' : {
1373
  callback : function( params ) {
1374
  sendToPreview = ! _.isUndefined( params.send_to_preview ) ? params.send_to_preview : true;//<= when the level is refreshed when complete, we don't need to send to preview.
@@ -1377,9 +2149,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1377
  apiParams.action = 'sek-add-content-in-new-sektion';
1378
  apiParams.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();//we set the id here because it will be needed when ajaxing
1379
  switch( params.content_type) {
 
1380
  case 'module' :
1381
  apiParams.droppedModuleId = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();//we set the id here because it will be needed when ajaxing
1382
  break;
 
 
1383
  case 'preset_section' :
1384
  api.previewer.send( 'sek-maybe-print-loader', { loader_located_in_level_id : params.location });
1385
  api.previewer.send( 'sek-maybe-print-loader', { fullPageLoader : true });
@@ -1395,28 +2170,44 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1395
  id : params.apiParams.droppedModuleId
1396
  });
1397
  break;
 
1398
  case 'preset_section' :
1399
  api.previewer.send( 'sek-clean-loader', { cleanFullPageLoader : true });
1400
  break;
1401
  }
 
 
 
1402
  self.updateAPISetting({
1403
  action : 'sek-update-fonts',
1404
  is_global_location : self.isGlobalLocation( params.apiParams )
1405
  });
 
 
 
 
 
 
 
1406
  var location_skope_id = params.location_skope_id;
1407
  if ( _.isUndefined( location_skope_id ) ) {
1408
  location_skope_id = true === params.is_global_location ? sektionsLocalizedData.globalSkopeId : api.czr_skopeBase.getSkopeProperty( 'skope_id' );
1409
  }
1410
  api.previewer.trigger('sek-refresh-stylesheet', {
 
1411
  location_skope_id : location_skope_id,//<= send skope id to the preview so we can use it when ajaxing
1412
  is_global_location : self.isGlobalLocation( params.apiParams )
1413
  });
 
 
1414
  if ( params.apiParams.is_first_section ) {
1415
  api.previewer.trigger( 'sek-refresh-level', {
1416
  level : 'location',
1417
  id : params.apiParams.location
1418
  });
1419
  }
 
 
1420
  if ( params.apiParams.sektion_to_replace ) {
1421
  api.previewer.trigger( 'sek-remove', {
1422
  id : params.apiParams.sektion_to_replace,
@@ -1425,8 +2216,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1425
  level : 'section'
1426
  });
1427
  }
 
 
 
 
 
 
 
 
 
 
1428
  }
1429
  },
 
 
 
 
 
 
 
 
 
 
1430
  'sek-add-preset-section-in-new-nested-sektion' : {
1431
  callback : function( params ) {
1432
  sendToPreview = false;//<= when the level is refreshed when complete, we don't need to send to preview.
@@ -1438,10 +2249,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1438
  return self.updateAPISetting( apiParams );
1439
  },
1440
  complete : function( params ) {
 
 
 
 
1441
  api.previewer.trigger('sek-refresh-stylesheet', {
1442
  id : params.apiParams.in_sektion,
1443
  location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
1444
  });
 
 
 
1445
  self.updateAPISetting({
1446
  action : 'sek-update-fonts',
1447
  is_global_location : self.isGlobalLocation( params.apiParams )
@@ -1453,11 +2271,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1453
  });
1454
  }
1455
  },
 
 
 
 
 
 
 
 
1456
  'sek-pick-content' : function( params ) {
1457
  params = _.isObject(params) ? params : {};
 
 
 
1458
  api.czr_sektions.currentContentPickerType = api.czr_sektions.currentContentPickerType || new api.Value();
1459
  api.czr_sektions.currentContentPickerType( params.content_type || 'module' );
 
 
1460
  if ( _.isObject( params ) && params.id ) {
 
 
 
1461
  self.lastClickedTargetInPreview( { id : params.id } );
1462
  }
1463
 
@@ -1467,6 +2301,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1467
  uiParams = {
1468
  action : 'sek-generate-draggable-candidates-picker-ui',
1469
  content_type : params.content_type || 'module',
 
 
 
1470
  was_triggered : _.has( params, 'was_triggered' ) ? params.was_triggered : true,
1471
  focus : _.has( params, 'focus' ) ? params.focus : true
1472
  };
@@ -1504,6 +2341,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1504
  };
1505
  return self.generateUI( uiParams );
1506
  },
 
 
 
 
 
 
 
 
1507
  'sek-notify' : function( params ) {
1508
  sendToPreview = false;
1509
  return $.Deferred(function() {
@@ -1513,10 +2358,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1513
  message: params.message,
1514
  dismissible: true
1515
  } ) );
 
 
1516
  _.delay( function() {
1517
  api.notifications.remove( 'sek-notify' );
1518
  }, params.duration || 5000 );
1519
  });
 
 
1520
  this.resolve({
1521
  is_global_location : self.isGlobalLocation( params )
1522
  });
@@ -1532,6 +2381,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1532
  id : params.id
1533
  };
1534
  uiParams = {};
 
 
1535
  _dfd_.resolve({
1536
  is_global_location : self.isGlobalLocation( params )
1537
  });
@@ -1544,6 +2395,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1544
  return $.Deferred(function(_dfd_) {
1545
  apiParams = {id : params.id};
1546
  uiParams = {};
 
 
1547
  _dfd_.resolve({
1548
  is_global_location : self.isGlobalLocation( params )
1549
  });
@@ -1555,14 +2408,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1555
  self.saveUIVisible( true, params );
1556
  return $.Deferred(function(_dfd_) {
1557
  apiParams = {
 
 
 
1558
  };
1559
  uiParams = {};
 
 
1560
  _dfd_.resolve({
1561
  is_global_location : self.isGlobalLocation( params )
1562
  });
1563
  });
1564
  }
1565
  };//msgCollection
 
 
 
1566
  _.each( msgCollection, function( callbackFn, msgId ) {
1567
  api.previewer.bind( msgId, function( params ) {
1568
  var _cb_;
@@ -1576,8 +2437,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1576
  }
1577
 
1578
  try { _cb_( params )
 
 
1579
  .done( function( promiseParams ) {
1580
  promiseParams = promiseParams || {};
 
1581
  if ( sendToPreview ) {
1582
  api.previewer.send(
1583
  msgId,
@@ -1590,12 +2454,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1590
  }
1591
  );
1592
  } else {
 
1593
  api.previewer.trigger( [ msgId, 'done' ].join('_'), { apiParams : apiParams, uiParams : uiParams } );
1594
  }
 
1595
  self.trigger( [ msgId, 'done' ].join('_'), params );
1596
  })
1597
  .fail( function( er ) {
1598
  api.errare( 'reactToPreviewMsg => error when firing ' + msgId, er );
 
 
 
 
 
 
 
 
 
 
 
 
1599
  api.previewer.trigger('sek-notify', {
1600
  type : 'error',
1601
  duration : 30000,
@@ -1603,7 +2481,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1603
  '<span style="font-size:0.95em">',
1604
  '<strong>' + er + '</strong>',
1605
  '<br>',
1606
- sektionsLocalizedData.i18n['If this problem locks the Nimble builder, you might try to reset the sections for this page.'],
1607
  '<br>',
1608
  '<span style="text-align:center;display:block">',
1609
  '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n.Reset + '" data-sek-reset="true">' + sektionsLocalizedData.i18n.Reset + '</button>',
@@ -1617,6 +2495,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1617
  }
1618
  });
1619
  });
 
 
 
1620
  _.each( msgCollection, function( callbackFn, msgId ) {
1621
  api.previewer.bind( [ msgId, 'done' ].join('_'), function( params ) {
1622
  if ( _.isFunction( callbackFn.complete ) ) {
@@ -1627,11 +2508,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1627
  });
1628
  });
1629
  },//reactToPreview();
 
 
 
 
 
 
 
1630
  schedulePrintSectionJson : function() {
1631
  var self = this;
1632
  var popupCenter = function ( content ) {
1633
  w = 400;
1634
  h = 300;
 
1635
  var dualScreenLeft = ! _.isUndefined( window.screenLeft ) ? window.screenLeft : window.screenX;
1636
  var dualScreenTop = ! _.isUndefined( window.screenTop ) ? window.screenTop : window.screenY;
1637
 
@@ -1645,6 +2534,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1645
  doc.open("text/html");
1646
  doc.write( content );
1647
  doc.close();
 
1648
  if (window.focus) {
1649
  newWindow.focus();
1650
  }
@@ -1653,6 +2543,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1653
  api.previewer.bind( 'sek-to-json', function( params ) {
1654
  var sectionModel = $.extend( true, {}, self.getLevelModel( params.id ) );
1655
  console.log( JSON.stringify( self.cleanIds( sectionModel ) ) );
 
1656
  });
1657
  }//schedulePrintSectionJson
1658
  });//$.extend()
@@ -1660,6 +2551,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1660
  var CZRSeksPrototype = CZRSeksPrototype || {};
1661
  (function ( api, $ ) {
1662
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
 
 
1663
  generateUI : function( params ) {
1664
  var self = this,
1665
  dfd = $.Deferred();
@@ -1667,7 +2567,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1667
  if ( _.isEmpty( params.action ) ) {
1668
  dfd.reject( 'generateUI => missing action' );
1669
  }
 
 
1670
  switch ( params.action ) {
 
 
 
1671
  case 'sek-generate-module-ui' :
1672
  try{ dfd = self.generateUIforFrontModules( params, dfd ); } catch( er ) {
1673
  api.errare( '::generateUI() => error', er );
@@ -1681,21 +2586,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1681
  dfd = $.Deferred();
1682
  }
1683
  break;
 
 
 
 
1684
  case 'sek-generate-draggable-candidates-picker-ui' :
 
1685
  self.cleanRegistered();
1686
  try{ dfd = self.generateUIforDraggableContent( params, dfd ); } catch( er ) {
1687
  api.errare( '::generateUI() => error', er );
1688
  dfd = $.Deferred();
1689
  }
1690
  break;
 
 
1691
  case 'sek-generate-local-skope-options-ui' :
 
1692
  self.cleanRegistered();
1693
  try{ dfd = self.generateUIforLocalSkopeOptions( params, dfd ); } catch( er ) {
1694
  api.errare( '::generateUI() => error', er );
1695
  dfd = $.Deferred();
1696
  }
1697
  break;
 
 
1698
  case 'sek-generate-global-options-ui' :
 
1699
  self.cleanRegistered();
1700
  try{ dfd = self.generateUIforGlobalOptions( params, dfd ); } catch( er ) {
1701
  api.errare( '::generateUI() => error', er );
@@ -1706,12 +2622,56 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1706
 
1707
  return 'pending' == dfd.state() ? dfd.resolve().promise() : dfd.promise();//<= we might want to resolve on focus.completeCallback ?
1708
  },//generateUI()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1709
  updateAPISettingAndExecutePreviewActions : function( params ) {
1710
  if ( _.isEmpty( params.settingParams ) || ! _.has( params.settingParams, 'to' ) ) {
1711
  api.errare( 'updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated', params );
1712
  return;
1713
  }
1714
  var self = this;
 
 
 
 
1715
  var rawModuleValue = params.settingParams.to,
1716
  moduleValueCandidate,// {} or [] if mono item of multi-item module
1717
  parentModuleType = null,
@@ -1732,6 +2692,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1732
  } else {
1733
  api.errare( 'updateAPISettingAndExecutePreviewActions => missing parentModuleInstance', params );
1734
  }
 
 
 
 
 
1735
  if ( ! isMultiItemModule && _.isObject( rawModuleValue ) ) {
1736
  moduleValueCandidate = self.normalizeAndSanitizeSingleItemInputValues( rawModuleValue, parentModuleType );
1737
  } else {
@@ -1740,14 +2705,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1740
  moduleValueCandidate.push( self.normalizeAndSanitizeSingleItemInputValues( item, parentModuleType ) );
1741
  });
1742
  }
 
 
 
 
 
1743
  if ( _.isEmpty( params.defaultPreviewAction ) ) {
1744
  api.errare( 'updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.', params );
1745
  return;
1746
  }
 
1747
  var refresh_stylesheet = 'refresh_stylesheet' === params.defaultPreviewAction,//<= default action for level options
1748
  refresh_markup = 'refresh_markup' === params.defaultPreviewAction,//<= default action for module options
1749
  refresh_fonts = 'refresh_fonts' === params.defaultPreviewAction,
1750
  refresh_preview = 'refresh_preview' === params.defaultPreviewAction;
 
 
1751
  var input_id = params.settingParams.args.input_changed;
1752
  var inputRegistrationParams;
1753
  if ( ! _.isUndefined( input_id ) ) {
@@ -1767,33 +2740,46 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1767
  }
1768
 
1769
  var _doUpdateWithRequestedAction = function() {
 
1770
  if ( true === params.isGlobalOptions ) {
1771
  if ( _.isEmpty( params.options_type ) ) {
1772
  api.errare( 'updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type');
1773
  return;
1774
  }
 
1775
  var rawGlobalOptions = api( sektionsLocalizedData.optNameForGlobalOptions )(),
1776
  clonedGlobalOptions = $.extend( true, {}, _.isObject( rawGlobalOptions ) ? rawGlobalOptions : {} ),
1777
  _valueCandidate = {};
 
 
 
1778
  _.each( moduleValueCandidate || {}, function( _val_, _key_ ) {
 
 
1779
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
1780
  return;
1781
  _valueCandidate[ _key_ ] = _val_;
1782
  });
1783
 
1784
  clonedGlobalOptions[ params.options_type ] = _valueCandidate;
 
 
1785
  api( sektionsLocalizedData.optNameForGlobalOptions )( clonedGlobalOptions );
1786
  } else {
 
1787
  return self.updateAPISetting({
1788
  action : params.uiParams.action,// mandatory : 'sek-generate-level-options-ui', 'sek-generate-local-skope-options-ui',...
1789
  id : params.uiParams.id,
1790
  value : moduleValueCandidate,
1791
  in_column : params.uiParams.in_column,//not mandatory
1792
  in_sektion : params.uiParams.in_sektion,//not mandatory
 
 
1793
  options_type : params.options_type,// mandatory : 'layout', 'spacing', 'bg_border', 'height', ...
1794
 
1795
  settingParams : params.settingParams
1796
  }).done( function( promiseParams ) {
 
1797
  if ( true === refresh_stylesheet ) {
1798
  api.previewer.send( 'sek-refresh-stylesheet', {
1799
  location_skope_id : true === promiseParams.is_global_location ? sektionsLocalizedData.globalSkopeId : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
@@ -1805,6 +2791,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1805
  },
1806
  });
1807
  }
 
 
1808
  if ( true === refresh_markup ) {
1809
  api.previewer.send( 'sek-refresh-level', {
1810
  location_skope_id : true === promiseParams.is_global_location ? sektionsLocalizedData.globalSkopeId : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
@@ -1817,26 +2805,42 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1817
  skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
1818
  });
1819
  }
 
 
1820
  if ( true === refresh_preview ) {
1821
  api.previewer.refresh();
1822
  }
1823
  });//self.updateAPISetting()
1824
  }
1825
  };//_doUpdateWithRequestedAction
 
 
 
 
1826
  if ( true === refresh_fonts ) {
1827
  var newFontFamily = params.settingParams.args.input_value;
1828
  if ( ! _.isString( newFontFamily ) ) {
1829
  api.errare( 'updateAPISettingAndExecutePreviewActions => font-family must be a string', newFontFamily );
1830
  return;
1831
  }
 
 
1832
  if ( newFontFamily.indexOf('gfont') > -1 ) {
1833
  self.updateAPISetting({
1834
  action : 'sek-update-fonts',
1835
  font_family : newFontFamily,
1836
  is_global_location : self.isGlobalLocation( params.uiParams )
1837
  })
 
 
 
1838
  .always( function() {
1839
  _doUpdateWithRequestedAction().then( function() {
 
 
 
 
 
1840
  self.updateAPISetting({
1841
  action : 'sek-update-fonts',
1842
  is_global_location : self.isGlobalLocation( params.uiParams )
@@ -1850,6 +2854,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1850
  _doUpdateWithRequestedAction();
1851
  }
1852
  },//updateAPISettingAndExecutePreviewActions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1853
  normalizeAndSanitizeSingleItemInputValues : function( _item_, parentModuleType ) {
1854
  var itemNormalized = {},
1855
  itemNormalizedAndSanitized = {},
@@ -1868,12 +2888,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1868
  } else if ( _.isObject( _val ) && _.isObject( _default ) ) {
1869
  equal = _.isEqual( _val,_default );
1870
  } else if ( _.isArray( _val ) && _.isArray( _default ) ) {
 
1871
  equal = JSON.stringify(_val.sort()) === JSON.stringify(_default.sort());
1872
  } else {
1873
  equal = _val === _default;
1874
  }
1875
  return equal;
1876
  };
 
 
 
 
 
1877
  _.each( _item_, function( _val, input_id ) {
1878
  if ( _.contains( ['title', 'id' ], input_id ) )
1879
  return;
@@ -1886,13 +2912,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1886
  }
1887
  if ( isEqualToDefault( _val, inputDefaultValue ) ) {
1888
  return;
 
1889
  } else if ( ( _.isString( _val ) || _.isObject( _val ) ) && _.isEmpty( _val ) ) {
1890
  return;
1891
  } else {
1892
  itemNormalized[ input_id ] = _val;
1893
  }
1894
  });
 
 
 
1895
  _.each( itemNormalized, function( _val, input_id ) {
 
 
1896
  switch( self.getInputType( input_id, parentModuleType ) ) {
1897
  case 'text' :
1898
  case 'textarea' :
@@ -1932,16 +2964,34 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1932
  });
1933
  return itemNormalizedAndSanitized;
1934
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1935
  isUIControlAlreadyRegistered : function( uiElementId ) {
1936
  var self = this,
1937
  uiCandidate = _.filter( self.registered(), function( registered ) {
1938
  return registered.id == uiElementId && 'control' === registered.what;
1939
  }),
1940
  controlIsAlreadyRegistered = false;
 
 
 
1941
  if ( _.isEmpty( uiCandidate ) ) {
1942
  controlIsAlreadyRegistered = api.control.has( uiElementId );
1943
  } else {
1944
  controlIsAlreadyRegistered = true;
 
1945
  if ( uiCandidate.length > 1 ) {
1946
  api.errare( 'generateUI => why is this control registered more than once ? => ' + uiElementId );
1947
  }
@@ -1953,8 +3003,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1953
  var CZRSeksPrototype = CZRSeksPrototype || {};
1954
  (function ( api, $ ) {
1955
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
 
 
 
1956
  generateUIforDraggableContent : function( params, dfd ) {
1957
  var self = this;
 
1958
  var registrationParams = {};
1959
 
1960
  $.extend( registrationParams, {
@@ -1964,6 +3025,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
1964
  controlLabel : sektionsLocalizedData.i18n['Select a content type'],
1965
  priority : 0,
1966
  settingValue : { content_type : params.content_type }
 
1967
  },
1968
  module_picker : {
1969
  settingControlId : sektionsLocalizedData.optPrefixForSektionsNotSaved + '_sek_draggable_modules_ui',
@@ -2011,6 +3073,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2011
  icon : '<i class="fas fa-grip-vertical sek-level-option-icon"></i>'
2012
  }
2013
  });
 
 
 
2014
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
2015
  $.extend( registrationParams, {
2016
  sek_header_sec_picker_module : {
@@ -2047,6 +3112,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2047
  }
2048
  });
2049
  }
 
 
 
 
 
 
 
2050
  var firstKey = _.keys( registrationParams )[0],
2051
  firstControlId = registrationParams[firstKey].settingControlId;
2052
 
@@ -2055,6 +3127,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2055
  _control_.focus({
2056
  completeCallback : function() {
2057
  var $container = _control_.container;
 
2058
  if ( $container.hasClass( 'button-see-me') )
2059
  return;
2060
  $container.addClass('button-see-me');
@@ -2067,9 +3140,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2067
 
2068
  return dfd;
2069
  }//if
 
 
 
2070
  _do_register_ = function() {
2071
  _.each( registrationParams, function( optionData, optionType ){
2072
  if ( ! api.has( optionData.settingControlId ) ) {
 
2073
  api( optionData.settingControlId, function( _setting_ ) {
2074
  _setting_.bind( function( to, from ) {
2075
  api.errare('generateUIforDraggableContent => the setting() should not changed');
@@ -2101,7 +3178,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2101
  track : false//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
2102
  }).done( function() {
2103
  api.control( optionData.settingControlId, function( _control_ ) {
 
2104
  _control_.content_type = optionData.content_type;//<= used to handle visibility when switching content type with the "content_type_switcher" control
 
 
2105
  if ( true === params.focus ) {
2106
  _control_.focus({
2107
  completeCallback : function() {}
@@ -2110,13 +3190,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2110
 
2111
  var $title = _control_.container.find('label > .customize-control-title'),
2112
  _titleContent = $title.html();
 
2113
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
 
 
2114
  if ( ! _.isUndefined( optionData.icon ) ) {
2115
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
2116
  }
 
 
 
2117
  if ( 'section' === _control_.content_type ) {
 
2118
  _control_.container.find('.czr-items-wrapper').hide();
 
2119
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
 
2120
  _control_.container.attr('data-sek-expanded', "false" );
2121
  if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
2122
  _control_.container.find('.czr-items-wrapper').show();
@@ -2130,17 +3219,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2130
  });
2131
  });//_.each
2132
  };//_do_register_
 
 
 
 
2133
  api.section( self.SECTION_ID_FOR_CONTENT_PICKER, function( _section_ ) {
2134
  _do_register_();
 
 
2135
  var $sectionTitleEl = _section_.container.find('.accordion-section-title'),
2136
  $panelTitleEl = _section_.container.find('.customize-section-title h3');
 
 
2137
  if ( 0 < $sectionTitleEl.length && $sectionTitleEl.find('.sek-level-option-icon').length < 1 ) {
2138
  $sectionTitleEl.prepend( '<i class="fas fa-grip-vertical sek-level-option-icon"></i>' );
2139
  }
 
 
2140
  if ( 0 < $panelTitleEl.length && $panelTitleEl.find('.sek-level-option-icon').length < 1 ) {
2141
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-grip-vertical sek-level-option-icon"></i>' );
2142
  }
 
 
2143
  self.scheduleModuleAccordion.call( _section_, { expand_first_control : true } );
 
 
 
2144
  self._maybeFetchSectionsFromServer();
2145
  });
2146
  return dfd;
@@ -2150,11 +3254,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2150
  var CZRSeksPrototype = CZRSeksPrototype || {};
2151
  (function ( api, $ ) {
2152
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
 
 
 
2153
  generateUIforFrontModules : function( params, dfd ) {
2154
  var self = this;
2155
  if ( _.isEmpty( params.id ) ) {
2156
  dfd.reject( 'generateUI => missing id' );
2157
  }
 
 
2158
  var moduleValue = self.getLevelProperty({
2159
  property : 'value',
2160
  id : params.id
@@ -2170,6 +3286,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2170
  if ( _.isEmpty( moduleType ) ) {
2171
  dfd.reject( 'generateUI => module => invalid module_type' );
2172
  }
 
 
2173
  var modulesRegistrationParams = {};
2174
 
2175
  if ( true === self.getRegisteredModuleProperty( moduleType, 'is_father' ) ) {
@@ -2182,6 +3300,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2182
  settingControlId : params.id + '__' + optionType,
2183
  module_type : mod_type,
2184
  controlLabel : self.getRegisteredModuleProperty( mod_type, 'name' )
 
2185
  };
2186
  });
2187
  }
@@ -2190,8 +3309,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2190
  settingControlId : params.id,
2191
  module_type : moduleType,
2192
  controlLabel : moduleName
 
2193
  };
2194
  }
 
 
 
 
 
2195
  var firstKey = _.keys( modulesRegistrationParams )[0],
2196
  firstControlId = modulesRegistrationParams[firstKey].settingControlId;
2197
 
@@ -2199,6 +3324,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2199
  api.control( firstControlId ).focus({
2200
  completeCallback : function() {
2201
  var $container = api.control( firstControlId ).container;
 
2202
  if ( $container.hasClass( 'button-see-me') )
2203
  return;
2204
  $container.addClass('button-see-me');
@@ -2209,10 +3335,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2209
  });
2210
  return dfd;
2211
  }//if
 
 
2212
  self.cleanRegistered();
2213
 
2214
  _do_register_ = function() {
2215
  _.each( modulesRegistrationParams, function( optionData, optionType ){
 
2216
  if ( ! api.has( optionData.settingControlId ) ) {
2217
  var doUpdate = function( to, from, args ) {
2218
  try { self.updateAPISettingAndExecutePreviewActions({
@@ -2228,6 +3357,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2228
  api.errare( '::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions', er );
2229
  }
2230
  };
 
 
 
 
 
2231
  api( optionData.settingControlId, function( _setting_ ) {
2232
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
2233
  });
@@ -2255,33 +3389,47 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2255
  what : 'control',
2256
  id : optionData.settingControlId,
2257
  label : optionData.controlLabel,
 
2258
  type : 'czr_module',//sekData.controlType,
2259
  module_type : optionData.module_type,
2260
  section : params.id,
2261
  priority : 10,
2262
  settings : { default : optionData.settingControlId }
2263
  }).done( function() {});
 
 
2264
  api.control( optionData.settingControlId, function( _control_ ) {
2265
  api.control( optionData.settingControlId ).focus({
2266
  completeCallback : function() {}
2267
  });
 
2268
  _control_.container.find('.czr-items-wrapper').hide();
2269
  var $title = _control_.container.find('label > .customize-control-title'),
2270
  _titleContent = $title.html();
2271
 
2272
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
 
2273
  if ( ! _.isUndefined( optionData.icon ) ) {
2274
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
2275
  }
 
2276
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
 
2277
  _control_.container.attr('data-sek-expanded', "false" );
2278
  });
2279
  });//each()
2280
  };//_do_register()
 
 
 
 
2281
  api.section.when( params.id, function() {
2282
  api.section(params.id).focus();
2283
  _do_register_();
2284
  });
 
 
 
2285
  api.CZR_Helpers.register({
2286
  origin : 'nimble',
2287
  what : 'section',
@@ -2289,14 +3437,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2289
  title: sektionsLocalizedData.i18n['Content for'] + ' ' + moduleName,
2290
  panel : sektionsLocalizedData.sektionsPanelId,
2291
  priority : 1000,
 
 
2292
  }).done( function() {});
2293
 
2294
  api.section( params.id, function( _section_ ) {
 
2295
  _section_.container.find('.accordion-section-title').first().hide();
 
 
2296
  var $panelTitleEl = _section_.container.find('.customize-section-title h3');
 
 
2297
  if ( 0 < $panelTitleEl.length ) {
2298
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-pencil-alt sek-level-option-icon"></i>' );
2299
  }
 
 
2300
  self.scheduleModuleAccordion.call( _section_, { expand_first_control : true } );
2301
  });
2302
  return dfd;
@@ -2306,13 +3463,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2306
  var CZRSeksPrototype = CZRSeksPrototype || {};
2307
  (function ( api, $ ) {
2308
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
 
 
 
2309
  generateUIforLevelOptions : function( params, dfd ) {
2310
  var self = this;
 
2311
  var levelOptionValues = self.getLevelProperty({
2312
  property : 'options',
2313
  id : params.id
2314
  });
2315
  levelOptionValues = _.isObject( levelOptionValues ) ? levelOptionValues : {};
 
 
 
2316
  var modulesRegistrationParams = {};
2317
 
2318
  $.extend( modulesRegistrationParams, {
@@ -2327,6 +3498,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2327
  settingControlId : params.id + '__border_options',
2328
  module_type : 'sek_level_border_module',
2329
  controlLabel : sektionsLocalizedData.i18n['Borders settings for the'] + ' ' + sektionsLocalizedData.i18n[params.level],
 
2330
  icon : '<i class="material-icons sek-level-option-icon">rounded_corner</i>'//'<i class="material-icons sek-level-option-icon">brush</i>'
2331
  },
2332
  spacing : {
@@ -2338,7 +3510,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2338
  anchor : {
2339
  settingControlId : params.id + '__anchor_options',
2340
  module_type : 'sek_level_anchor_module',
2341
- controlLabel : sektionsLocalizedData.i18n['Set a custom anchor for the'] + ' ' + sektionsLocalizedData.i18n[params.level],
2342
  icon : '<i class="fas fa-anchor sek-level-option-icon"></i>'
2343
  },
2344
  visibility : {
@@ -2364,6 +3536,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2364
  icon : '<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'
2365
  }
2366
  });
 
 
 
 
 
 
 
 
 
 
2367
  $.extend( modulesRegistrationParams, {
2368
  breakpoint : {
2369
  settingControlId : params.id + '__breakpoint_options',
@@ -2383,6 +3565,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2383
  }
2384
  });
2385
  }
 
 
 
 
 
 
2386
  var firstKey = _.keys( modulesRegistrationParams )[0],
2387
  firstControlId = modulesRegistrationParams[firstKey].settingControlId;
2388
 
@@ -2390,6 +3578,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2390
  api.control( firstControlId ).focus({
2391
  completeCallback : function() {
2392
  var $container = api.control( firstControlId ).container;
 
2393
  if ( $container.hasClass( 'button-see-me') )
2394
  return;
2395
  $container.addClass('button-see-me');
@@ -2400,9 +3589,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2400
  });
2401
  return dfd;
2402
  }//if
 
 
2403
  self.cleanRegistered();
 
 
 
2404
  _do_register_ = function() {
2405
  _.each( modulesRegistrationParams, function( optionData, optionType ){
 
 
2406
  if ( self.isUIControlAlreadyRegistered( optionData.settingControlId ) ) {
2407
  api.section( api.control( optionData.settingControlId ).section() ).expanded( true );
2408
  return;
@@ -2422,12 +3618,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2422
  api.errare( '::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions', er );
2423
  }
2424
  };
 
 
 
 
 
2425
  api( optionData.settingControlId, function( _setting_ ) {
2426
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
2427
  });//api( Id, function( _setting_ ) {})
 
 
2428
  var initialModuleValues = levelOptionValues[ optionType ] || {};
2429
  var startingModuleValue = self.getModuleStartingValue( optionData.module_type );
2430
  if ( 'no_starting_value' !== startingModuleValue && _.isObject( startingModuleValue ) ) {
 
2431
  var clonedStartingModuleValue = $.extend( true, {}, startingModuleValue );
2432
  initialModuleValues = $.extend( clonedStartingModuleValue, initialModuleValues );
2433
  }
@@ -2457,26 +3661,41 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2457
  priority : 0,
2458
  settings : { default : optionData.settingControlId }
2459
  }).done( function() {});
 
 
2460
  api.control( optionData.settingControlId, function( _control_ ) {
2461
  if ( true === optionData.expandAndFocusOnInit ) {
2462
  _control_.focus({
2463
  completeCallback : function() {}
2464
  });
2465
  }
 
 
2466
  _control_.container.find('.czr-items-wrapper').hide();
2467
  var $title = _control_.container.find('label > .customize-control-title'),
2468
  _titleContent = $title.html();
 
2469
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
 
2470
  if ( ! _.isUndefined( optionData.icon ) ) {
2471
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
2472
  }
 
2473
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
 
2474
  _control_.container.attr('data-sek-expanded', "false" );
 
 
 
2475
  });
2476
  });//_.each()
2477
  };//_do_register_()
 
 
 
2478
  if ( ! api.section.has( params.id ) ) {
2479
  api.section( params.id, function( _section_ ) {
 
2480
  self.scheduleModuleAccordion.call( _section_, { expand_first_control : true } );
2481
  });
2482
  }
@@ -2488,11 +3707,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2488
  title: sektionsLocalizedData.i18n['Settings for the'] + ' ' + params.level,
2489
  panel : sektionsLocalizedData.sektionsPanelId,
2490
  priority : 10,
 
 
2491
  }).done( function() {});
 
 
 
2492
  api.section( params.id, function( _section_ ) {
2493
  _do_register_();
 
2494
  _section_.container.find('.accordion-section-title').first().hide();
 
 
2495
  var $panelTitleEl = _section_.container.find('.customize-section-title h3');
 
 
2496
  if ( 0 < $panelTitleEl.length && $panelTitleEl.find('.sek-level-option-icon').length < 1 ) {
2497
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-sliders-h sek-level-option-icon"></i>' );
2498
  }
@@ -2513,17 +3742,33 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2513
  }
2514
  return sektionsLocalizedData.optPrefixForSektionsNotSaved + skope_id + '__localSkopeOptions';
2515
  },
 
 
 
 
 
 
 
 
 
 
2516
  generateUIforLocalSkopeOptions : function( params, dfd ) {
2517
  var self = this,
2518
  _id_ = self.getLocalSkopeOptionId();
 
 
2519
  if ( self.isUIControlAlreadyRegistered( _id_ ) ) {
2520
  return dfd;
2521
  }
 
 
2522
  var registrationParams = {};
2523
  if ( _.isUndefined( sektionsLocalizedData.localOptionsMap ) || ! _.isObject( sektionsLocalizedData.localOptionsMap ) ) {
2524
  api.errare( '::generateUIforGlobalOptions => missing or invalid localOptionsMap');
2525
  return dfd;
2526
  }
 
 
2527
  _.each( sektionsLocalizedData.localOptionsMap, function( mod_type, opt_name ) {
2528
  switch( opt_name ) {
2529
  case 'template' :
@@ -2535,6 +3780,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2535
  icon : '<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'
2536
  };
2537
  break;
 
2538
  case 'local_header_footer':
2539
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
2540
  registrationParams[ opt_name ] = {
@@ -2601,9 +3847,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2601
  api.errare( '::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions', er );
2602
  }
2603
  };
 
 
 
 
 
2604
  api( optionData.settingControlId, function( _setting_ ) {
2605
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
2606
  });//api( Id, function( _setting_ ) {})
 
 
2607
  var startingModuleValue = self.getModuleStartingValue( optionData.module_type ),
2608
  currentSetValue = api( self.localSectionsSettingId() )(),
2609
  allSkopeOptions = $.extend( true, {}, _.isObject( currentSetValue.local_options ) ? currentSetValue.local_options : {} ),
@@ -2611,6 +3864,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2611
  initialModuleValues = optionTypeValue;
2612
 
2613
  if ( 'no_starting_value' !== startingModuleValue && _.isObject( startingModuleValue ) ) {
 
2614
  var clonedStartingModuleValue = $.extend( true, {}, startingModuleValue );
2615
  initialModuleValues = $.extend( clonedStartingModuleValue, initialModuleValues );
2616
  }
@@ -2637,16 +3891,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2637
  section : self.SECTION_ID_FOR_LOCAL_OPTIONS,
2638
  priority : 10,
2639
  settings : { default : optionData.settingControlId },
 
2640
  }).done( function() {
 
 
 
 
 
 
 
 
2641
  api.control( optionData.settingControlId, function( _control_ ) {
 
2642
  _control_.container.find('.czr-items-wrapper').hide();
2643
  var $title = _control_.container.find('label > .customize-control-title'),
2644
  _titleContent = $title.html();
 
2645
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
 
 
2646
  if ( ! _.isUndefined( optionData.icon ) ) {
2647
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
2648
  }
 
2649
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
 
2650
  _control_.container.attr('data-sek-expanded', "false" );
2651
  if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
2652
  $title.trigger('click');
@@ -2655,6 +3924,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2655
  });
2656
  });//_.each()
2657
  };//_do_register()
 
 
2658
  _do_register_();
2659
 
2660
  return dfd;
@@ -2664,19 +3935,37 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2664
  var CZRSeksPrototype = CZRSeksPrototype || {};
2665
  (function ( api, $ ) {
2666
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
 
 
 
2667
  generateUIforGlobalOptions : function( params, dfd ) {
2668
  var self = this,
2669
  _id_ = sektionsLocalizedData.optPrefixForSektionsNotSaved + sektionsLocalizedData.optNameForGlobalOptions;
 
 
 
2670
  if ( self.isUIControlAlreadyRegistered( _id_ ) ) {
2671
  return dfd;
2672
  }
 
 
2673
  var registrationParams = {};
2674
  if ( _.isUndefined( sektionsLocalizedData.globalOptionsMap ) || ! _.isObject( sektionsLocalizedData.globalOptionsMap ) ) {
2675
  api.errare( '::generateUIforGlobalOptions => missing or invalid globalOptionsMap');
2676
  return dfd;
2677
  }
 
 
2678
  _.each( sektionsLocalizedData.globalOptionsMap, function( mod_type, opt_name ) {
2679
  switch( opt_name ) {
 
2680
  case 'global_header_footer':
2681
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
2682
  registrationParams[ opt_name ] = {
@@ -2753,14 +4042,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2753
  api.errare( '::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions', er );
2754
  }
2755
  };
 
 
 
 
 
2756
  api( optionData.settingControlId, function( _setting_ ) {
2757
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
2758
  });//api( Id, function( _setting_ ) {})
 
 
2759
  var dbValues = sektionsLocalizedData.globalOptionDBValues,
2760
  startingModuleValue = self.getModuleStartingValue( optionData.module_type ),
2761
  initialModuleValues = ( _.isObject( dbValues ) && ! _.isEmpty( dbValues[ optionType ] ) ) ? dbValues[ optionType ] : {};
2762
 
2763
  if ( 'no_starting_value' !== startingModuleValue && _.isObject( startingModuleValue ) ) {
 
2764
  var clonedStartingModuleValue = $.extend( true, {}, startingModuleValue );
2765
  initialModuleValues = $.extend( clonedStartingModuleValue, initialModuleValues );
2766
  }
@@ -2790,15 +4087,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2790
  settings : { default : optionData.settingControlId },
2791
  track : false//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
2792
  }).done( function() {
 
 
 
 
 
 
 
2793
  api.control( optionData.settingControlId, function( _control_ ) {
 
2794
  _control_.container.find('.czr-items-wrapper').hide();
2795
  var $title = _control_.container.find('label > .customize-control-title'),
2796
  _titleContent = $title.html();
 
2797
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
 
 
2798
  if ( ! _.isUndefined( optionData.icon ) ) {
2799
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
2800
  }
 
2801
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
 
2802
  _control_.container.attr('data-sek-expanded', "false" );
2803
  if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
2804
  $title.trigger('click');
@@ -2807,6 +4117,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2807
  });
2808
  });//_.each();
2809
  };//do register
 
 
2810
  _do_register_();
2811
 
2812
  return dfd;
@@ -2816,31 +4128,60 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2816
  var CZRSeksPrototype = CZRSeksPrototype || {};
2817
  (function ( api, $ ) {
2818
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
2819
  updateAPISetting : function( params ) {
2820
 
2821
  var self = this,
2822
  __updateAPISettingDeferred__ = $.Deferred();
 
 
 
 
2823
  params = params || {};
2824
  params.is_global_location = self.isGlobalLocation( params );
2825
 
2826
  var _collectionSettingId_ = params.is_global_location ? self.getGlobalSectionsSettingId() : self.localSectionsSettingId();
 
 
2827
  api( _collectionSettingId_, function( sektionSetInstance ) {
 
 
 
 
 
 
 
 
 
2828
  var currentSetValue = sektionSetInstance(),
2829
  newSetValue = _.isObject( currentSetValue ) ? $.extend( true, {}, currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
2830
  locationCandidate,
2831
  sektionCandidate,
2832
  columnCandidate,
2833
  moduleCandidate,
 
2834
  originalCollection,
2835
  reorderedCollection,
 
2836
  cloneId, //will be passed in resolve()
2837
  startingModuleValue,// will be populated by the optional starting value specificied on module registration
2838
  __presetSectionInjected__ = false,
2839
  parentSektionCandidate;
 
 
2840
  newSetValue.collection = _.isArray( newSetValue.collection ) ? newSetValue.collection : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ).collection;
2841
 
2842
  switch( params.action ) {
 
 
 
2843
  case 'sek-add-section' :
 
2844
  if ( _.isEmpty( params.id ) ) {
2845
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
2846
  }
@@ -2848,8 +4189,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2848
  if ( _.isEmpty( params.location ) ) {
2849
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing location' );
2850
  }
 
2851
  if ( true === params.is_nested ) {
2852
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
 
 
2853
  parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
2854
  if ( 'no_match' == parentSektionCandidate ) {
2855
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
@@ -2893,7 +4237,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2893
  position = index + 1;
2894
  }
2895
  });
 
 
2896
  locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
 
2897
  locationCandidate.collection.splice( position, 0, {
2898
  id : params.id,
2899
  level : 'section',
@@ -2910,6 +4257,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2910
 
2911
 
2912
  case 'sek-duplicate-section' :
 
 
2913
  if ( _.isEmpty( params.id ) ) {
2914
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
2915
  }
@@ -2924,6 +4273,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2924
  }
2925
 
2926
  var _position_ = self.getLevelPositionInCollection( params.id, newSetValue.collection );
 
2927
  if ( true === params.is_nested ) {
2928
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
2929
  if ( 'no_match' == columnCandidate ) {
@@ -2944,12 +4294,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2944
  break;
2945
  }
2946
  locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
 
2947
  locationCandidate.collection.splice( parseInt( _position_ + 1, 10 ), 0, deepClonedSektion );
2948
 
2949
  }
2950
  cloneId = deepClonedSektion.id;//will be passed in resolve()
2951
  break;
 
 
 
2952
  case 'sek-remove-section' :
 
2953
  if ( true === params.is_nested ) {
2954
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
2955
  if ( 'no_match' != columnCandidate ) {
@@ -2974,6 +4329,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2974
  break;
2975
 
2976
  case 'sek-move-section' :
 
2977
  var toLocationCandidate = self.getLevelModel( params.to_location, newSetValue.collection ),
2978
  movedSektionCandidate,
2979
  copyOfMovedSektionCandidate;
@@ -2981,23 +4337,33 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
2981
  if ( _.isEmpty( toLocationCandidate ) || 'no_match' == toLocationCandidate ) {
2982
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing target location' );
2983
  }
 
 
 
 
2984
  if ( params.from_location != params.to_location ) {
 
2985
  var fromLocationCandidate = self.getLevelModel( params.from_location, newSetValue.collection );
2986
  if ( _.isEmpty( fromLocationCandidate ) || 'no_match' == fromLocationCandidate ) {
2987
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing source location' );
2988
  }
2989
 
2990
  fromLocationCandidate.collection = _.isArray( fromLocationCandidate.collection ) ? fromLocationCandidate.collection : [];
 
2991
  movedSektionCandidate = self.getLevelModel( params.id, fromLocationCandidate.collection );
2992
  copyOfMovedSektionCandidate = $.extend( true, {}, movedSektionCandidate );
 
2993
  fromLocationCandidate.collection = _.filter( fromLocationCandidate.collection, function( sektion ) {
2994
  return sektion.id != params.id;
2995
  });
2996
  }
 
 
2997
  toLocationCandidate.collection = _.isArray( toLocationCandidate.collection ) ? toLocationCandidate.collection : [];
2998
  originalCollection = $.extend( true, [], toLocationCandidate.collection );
2999
  reorderedCollection = [];
3000
  _.each( params.newOrder, function( _id_ ) {
 
3001
  if ( params.from_location != params.to_location && _id_ == copyOfMovedSektionCandidate.id ) {
3002
  reorderedCollection.push( copyOfMovedSektionCandidate );
3003
  } else {
@@ -3011,7 +4377,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3011
  toLocationCandidate.collection = reorderedCollection;
3012
 
3013
  break;
 
 
 
3014
  case 'sek-move-section-up-down' :
 
3015
 
3016
  inLocationCandidate = self.getLevelModel( params.location, newSetValue.collection );
3017
 
@@ -3025,16 +4395,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3025
  var _indexInOriginal = _.findIndex( originalCollection, function( _sec_ ) {
3026
  return _sec_.id === params.id;
3027
  });
 
3028
  if ( -1 === _indexInOriginal ) {
3029
  throw new Error( 'updateAPISetting => ' + params.action + ' => invalid index' );
3030
  }
 
 
3031
  var direction = params.direction || 'up';
3032
  reorderedCollection[ _indexInOriginal ] = originalCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ];
3033
  reorderedCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ] = originalCollection[ _indexInOriginal ];
3034
 
3035
  inLocationCandidate.collection = reorderedCollection;
3036
  break;
 
 
 
 
 
 
 
 
 
 
 
3037
  case 'sek-add-column' :
 
3038
  if ( _.isEmpty( params.id ) ) {
3039
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3040
  }
@@ -3046,10 +4431,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3046
  }
3047
 
3048
  sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
 
3049
  if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
3050
  __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
3051
  break;
3052
  }
 
 
3053
  _.each( sektionCandidate.collection, function( colModel ) {
3054
  colModel.width = '';
3055
  });
@@ -3065,6 +4453,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3065
  case 'sek-remove-column' :
3066
  sektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
3067
  if ( 'no_match' != sektionCandidate ) {
 
3068
  if ( 1 === _.size( sektionCandidate.collection ) ) {
3069
  __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["A section must have at least one column."]);
3070
  break;
@@ -3073,6 +4462,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3073
  sektionCandidate.collection = _.filter( sektionCandidate.collection, function( column ) {
3074
  return column.id != params.id;
3075
  });
 
3076
  _.each( sektionCandidate.collection, function( colModel ) {
3077
  colModel.width = '';
3078
  });
@@ -3083,6 +4473,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3083
  break;
3084
 
3085
  case 'sek-duplicate-column' :
 
3086
  if ( _.isEmpty( params.id ) ) {
3087
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3088
  }
@@ -3095,6 +4486,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3095
  }
3096
 
3097
  sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
 
3098
  if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
3099
  __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
3100
  break;
@@ -3108,16 +4500,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3108
  var _position = self.getLevelPositionInCollection( params.id, newSetValue.collection );
3109
  cloneId = deepClonedColumn.id;//will be passed in resolve()
3110
  sektionCandidate.collection.splice( parseInt( _position + 1, 10 ), 0, deepClonedColumn );
 
3111
  _.each( sektionCandidate.collection, function( colModel ) {
3112
  colModel.width = '';
3113
  });
3114
  break;
 
 
 
3115
  case 'sek-resize-columns' :
3116
  if ( params.col_number < 2 )
3117
  break;
3118
 
3119
  var resizedColumn = self.getLevelModel( params.resized_column, newSetValue.collection ),
3120
  sistercolumn = self.getLevelModel( params.sister_column, newSetValue.collection );
 
 
 
 
3121
  if ( 'no_match' == resizedColumn ) {
3122
  api.errare( 'updateAPISetting => ' + params.action + ' => no resized column matched' );
3123
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no resized column matched');
@@ -3125,6 +4525,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3125
  }
3126
 
3127
  resizedColumn.width = parseFloat( params.resizedColumnWidthInPercent );
 
 
 
3128
  var parentSektion = self.getLevelModel( params.in_sektion, newSetValue.collection );
3129
  var otherColumns = _.filter( parentSektion.collection, function( _col_ ) {
3130
  return _col_.id != resizedColumn.id && _col_.id != sistercolumn.id;
@@ -3137,10 +4540,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3137
  if ( ! _.has( colModel, 'width') || ! _.isNumber( currentColWidth * 1 ) || _.isEmpty( currentColWidth + '' ) || 1 > currentColWidth ) {
3138
  colModel.width = parseFloat( ( 100 / params.col_number ).toFixed(3) );
3139
  }
 
3140
  otherColumnsWidth = parseFloat( ( otherColumnsWidth + colModel.width ).toFixed(3) );
3141
  });
3142
  }
 
 
 
 
 
 
 
 
 
3143
  sistercolumn.width = parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) );
 
 
 
 
 
3144
  break;
3145
 
3146
 
@@ -3156,25 +4574,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3156
  }
3157
 
3158
  if ( params.from_sektion != params.to_sektion ) {
 
3159
  var fromSektionCandidate = self.getLevelModel( params.from_sektion, newSetValue.collection );
3160
  if ( _.isEmpty( fromSektionCandidate ) || 'no_match' == fromSektionCandidate ) {
3161
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing source column' );
3162
  }
3163
 
3164
  fromSektionCandidate.collection = _.isArray( fromSektionCandidate.collection ) ? fromSektionCandidate.collection : [];
 
3165
  movedColumnCandidate = self.getLevelModel( params.id, fromSektionCandidate.collection );
3166
  copyOfMovedColumnCandidate = $.extend( true, {}, movedColumnCandidate );
 
3167
  fromSektionCandidate.collection = _.filter( fromSektionCandidate.collection, function( column ) {
3168
  return column.id != params.id;
3169
  });
 
3170
  _.each( fromSektionCandidate.collection, function( colModel ) {
3171
  colModel.width = '';
3172
  });
3173
  }
 
 
3174
  toSektionCandidate.collection = _.isArray( toSektionCandidate.collection ) ? toSektionCandidate.collection : [];
3175
  originalCollection = $.extend( true, [], toSektionCandidate.collection );
3176
  reorderedCollection = [];
3177
  _.each( params.newOrder, function( _id_ ) {
 
3178
  if ( params.from_sektion != params.to_sektion && _id_ == copyOfMovedColumnCandidate.id ) {
3179
  reorderedCollection.push( copyOfMovedColumnCandidate );
3180
  } else {
@@ -3186,15 +4611,34 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3186
  }
3187
  });
3188
  toSektionCandidate.collection = reorderedCollection;
 
 
3189
  _.each( toSektionCandidate.collection, function( colModel ) {
3190
  colModel.width = '';
3191
  });
3192
 
3193
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3194
  case 'sek-add-module' :
 
3195
  if ( _.isEmpty( params.id ) ) {
3196
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3197
  }
 
3198
  if ( _.isEmpty( params.module_type ) ) {
3199
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing module_type' );
3200
  }
@@ -3207,6 +4651,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3207
 
3208
  var position = 0;
3209
  columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
 
3210
  _.each( columnCandidate.collection, function( moduleModel, index ) {
3211
  if ( params.before_module === moduleModel.id ) {
3212
  position = index;
@@ -3222,6 +4667,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3222
  module_type : params.module_type,
3223
  ver_ini : sektionsLocalizedData.nimbleVersion
3224
  };
 
3225
  startingModuleValue = self.getModuleStartingValue( params.module_type );
3226
  if ( 'no_starting_value' !== startingModuleValue ) {
3227
  _moduleParams.value = startingModuleValue;
@@ -3231,6 +4677,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3231
  break;
3232
 
3233
  case 'sek-duplicate-module' :
 
3234
  if ( _.isEmpty( params.id ) ) {
3235
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3236
  }
@@ -3256,6 +4703,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3256
  break;
3257
 
3258
  case 'sek-remove-module' :
 
3259
  if ( _.isEmpty( params.id ) ) {
3260
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3261
  }
@@ -3275,11 +4723,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3275
  var toColumnCandidate,
3276
  movedModuleCandidate,
3277
  copyOfMovedModuleCandidate;
 
 
 
 
 
 
 
 
 
3278
  toColumnCandidate = self.getLevelModel( params.to_column, newSetValue.collection );
3279
 
3280
  if ( _.isEmpty( toColumnCandidate ) || 'no_match' == toColumnCandidate ) {
3281
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing target column' );
3282
  }
 
 
 
3283
  if ( params.from_column != params.to_column ) {
3284
  var fromColumnCandidate;
3285
  fromColumnCandidate = self.getLevelModel( params.from_column, newSetValue.collection );
@@ -3289,12 +4749,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3289
  }
3290
 
3291
  fromColumnCandidate.collection = _.isArray( fromColumnCandidate.collection ) ? fromColumnCandidate.collection : [];
 
3292
  movedModuleCandidate = self.getLevelModel( params.id, newSetValue.collection );
3293
  copyOfMovedModuleCandidate = $.extend( true, {}, movedModuleCandidate );
 
3294
  fromColumnCandidate.collection = _.filter( fromColumnCandidate.collection, function( module ) {
3295
  return module.id != params.id;
3296
  });
3297
  }// if params.from_column != params.to_column
 
 
3298
  toColumnCandidate.collection = _.isArray( toColumnCandidate.collection ) ? toColumnCandidate.collection : [];
3299
  originalCollection = $.extend( true, [], toColumnCandidate.collection );
3300
  reorderedCollection = [];
@@ -3309,6 +4773,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3309
  reorderedCollection.push( moduleCandidate );
3310
  }
3311
  });
 
3312
  if ( reorderedCollection.length != _.uniq( reorderedCollection ).length ) {
3313
  throw new Error( 'updateAPISetting => ' + params.action + ' => there are duplicated modules in column : ' + toColumnCandidate.id );
3314
  } else {
@@ -3321,7 +4786,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3321
  moduleCandidate = self.getLevelModel( params.id, newSetValue.collection );
3322
 
3323
  var _value_ = {};
 
 
3324
  _.each( params.value || {}, function( _val_, _key_ ) {
 
 
3325
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
3326
  return;
3327
  _value_[ _key_ ] = _val_;
@@ -3336,6 +4805,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3336
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => missing options_type');
3337
  break;
3338
  }
 
 
 
 
3339
  if ( '__no_option_group_to_be_updated_by_children_modules__' === params.options_type ) {
3340
  moduleCandidate.value = _value_;
3341
  } else {
@@ -3344,6 +4817,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3344
  }
3345
 
3346
  break;
 
 
 
 
 
 
 
 
 
3347
  case 'sek-generate-level-options-ui' :
3348
  var _candidate_ = self.getLevelModel( params.id, newSetValue.collection ),
3349
  _valueCandidate = {};
@@ -3353,7 +4835,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3353
  break;
3354
  }
3355
  _candidate_.options = _candidate_.options || {};
 
 
 
3356
  _.each( params.value || {}, function( _val_, _key_ ) {
 
 
3357
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
3358
  return;
3359
  _valueCandidate[ _key_ ] = _val_;
@@ -3363,11 +4850,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3363
  }
3364
  _candidate_.options[ params.options_type ] = _valueCandidate;
3365
  break;
 
 
 
 
 
 
 
 
 
3366
  case 'sek-generate-local-skope-options-ui' :
3367
  _valueCandidate = {};
3368
 
3369
  var _currentOptions = $.extend( true, {}, _.isObject( newSetValue.local_options ) ? newSetValue.local_options : {} );
 
 
3370
  _.each( params.value || {}, function( _val_, _key_ ) {
 
 
3371
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
3372
  return;
3373
  _valueCandidate[ _key_ ] = _val_;
@@ -3380,10 +4880,33 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3380
  newSetValue.local_options = $.extend( _currentOptions, newOptionsValues );
3381
  }
3382
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3383
  case 'sek-add-content-in-new-sektion' :
 
 
3384
  if ( _.isEmpty( params.id ) ) {
3385
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3386
  }
 
3387
  position = 0;
3388
  locationCandidate = self.getLevelModel( params.location, newSetValue.collection );
3389
  if ( 'no_match' == locationCandidate ) {
@@ -3402,8 +4925,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3402
  });
3403
 
3404
  switch( params.content_type) {
 
3405
  case 'module' :
 
 
3406
  startingModuleValue = self.getModuleStartingValue( params.content_id );
 
 
3407
  locationCandidate.collection.splice( position, 0, {
3408
  id : params.id,
3409
  level : 'section',
@@ -3426,16 +4954,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3426
  ver_ini : sektionsLocalizedData.nimbleVersion
3427
  });
3428
  break;
 
 
3429
  case 'preset_section' :
 
3430
  __presetSectionInjected__ = $.Deferred();//defined at the beginning of the method
3431
 
3432
  var _doWhenPresetSectionCollectionFetched = function( presetColumnCollection ) {
3433
  self.preparePresetSectionForInjection( presetColumnCollection )
3434
  .fail( function( _er_ ){
3435
  __updateAPISettingDeferred__.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
 
 
3436
  __presetSectionInjected__.reject( _er_ );
3437
  })
3438
  .done( function( sectionReadyToInject ) {
 
 
 
 
3439
  var insertedInANestedSektion = false;
3440
  if ( ! _.isEmpty( params.sektion_to_replace ) ) {
3441
  var sektionToReplace = self.getLevelModel( params.sektion_to_replace, newSetValue.collection );
@@ -3462,6 +4999,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3462
  }
3463
 
3464
  columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
 
3465
  _.each( columnCandidate.collection, function( moduleOrSectionModel, index ) {
3466
  if ( params.before_section === moduleOrSectionModel.id ) {
3467
  position = index;
@@ -3479,9 +5017,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3479
  ver_ini : sektionsLocalizedData.nimbleVersion
3480
  });
3481
  }
 
 
 
3482
  __presetSectionInjected__.resolve();
3483
  });// self.preparePresetSectionForInjection.done()
3484
  };//_doWhenPresetSectionCollectionFetched()
 
 
 
 
3485
  self.getPresetSectionCollection({
3486
  is_user_section : params.is_user_section,
3487
  presetSectionId : params.content_id,
@@ -3496,17 +5041,36 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3496
  api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnCollection );
3497
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
3498
  }
 
3499
  _doWhenPresetSectionCollectionFetched( presetColumnCollection );
3500
  });//self.getPresetSectionCollection().done()
3501
  break;
3502
  }//switch( params.content_type)
3503
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3504
  case 'sek-add-preset-section-in-new-nested-sektion' :
 
3505
  if ( _.isEmpty( params.id ) ) {
3506
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
3507
  }
3508
 
3509
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
 
 
 
3510
  parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
3511
  if ( 'no_match' == parentSektionCandidate ) {
3512
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
@@ -3522,6 +5086,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3522
  break;
3523
  }
3524
  columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
 
 
3525
  var presetColumnCollection;
3526
  __presetSectionInjected__ = $.Deferred();//defined at the beginning of the method
3527
 
@@ -3529,6 +5095,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3529
  self.preparePresetSectionForInjection( presetColumnCollection )
3530
  .fail( function( _er_ ){
3531
  __updateAPISettingDeferred__.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
 
 
3532
  __presetSectionInjected__.reject( _er_ );
3533
  })
3534
  .done( function( sectionReadyToInject ) {
@@ -3540,9 +5108,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3540
  is_nested : true,
3541
  ver_ini : sektionsLocalizedData.nimbleVersion
3542
  });
 
 
 
3543
  __presetSectionInjected__.resolve();
3544
  });//self.preparePresetSectionForInjection.done()
3545
  };//_doWhenPresetSectionCollectionFetched
 
 
 
 
3546
  self.getPresetSectionCollection({
3547
  is_user_section : params.is_user_section,
3548
  presetSectionId : params.content_id,
@@ -3557,10 +5132,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3557
  api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnCollection );
3558
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
3559
  }
 
3560
  _doWhenPresetSectionCollectionFetched( presetColumnCollection );
3561
  });//self.getPresetSectionCollection().done()
3562
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3563
  case 'sek-update-fonts' :
 
3564
  var currentGfonts = self.sniffGFonts( { is_global_location : params && true === params.is_global_location } );
3565
  if ( ! _.isEmpty( params.font_family ) && _.isString( params.font_family ) && ! _.contains( currentGfonts, params.font_family ) ) {
3566
  if ( params.font_family.indexOf('gfont') < 0 ) {
@@ -3570,9 +5166,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3570
  }
3571
  currentGfonts.push( params.font_family );
3572
  }
 
 
3573
  newSetValue.fonts = currentGfonts;
3574
  break;
3575
  }// switch
 
 
 
 
 
3576
  if ( 'pending' == __updateAPISettingDeferred__.state() ) {
3577
  var mayBeUpdateSektionsSetting = function() {
3578
  if ( _.isEqual( currentSetValue, newSetValue ) ) {
@@ -3582,11 +5185,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3582
  } else {
3583
  if ( null !== self.validateSettingValue( newSetValue ) ) {
3584
  sektionSetInstance( newSetValue, params );
 
 
3585
  params.cloneId = cloneId;
3586
  __updateAPISettingDeferred__.resolve( params );
3587
  } else {
3588
  __updateAPISettingDeferred__.reject( 'Validation problem for action ' + params.action );
3589
  }
 
3590
  }
3591
  };//mayBeUpdateSektionsSetting()
3592
 
@@ -3605,6 +5211,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3605
  });//api( _collectionSettingId_, function( sektionSetInstance ) {}
3606
  return __updateAPISettingDeferred__.promise();
3607
  },//updateAPISetting
 
 
 
 
 
 
 
 
 
 
3608
  _maybeFetchSectionsFromServer : function( params ) {
3609
  var dfd = $.Deferred(),
3610
  _ajaxRequest_;
@@ -3625,6 +5241,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3625
  api.sek_fetchingUserSavedSections = _ajaxRequest_;
3626
  }
3627
  _ajaxRequest_.done( function( _sectionData_ ) {
 
3628
  api.sek_userSavedSections[ params.preset_section_id ] = _sectionData_;
3629
  dfd.resolve( api.sek_userSavedSections );
3630
  }).fail( function( _r_ ) {
@@ -3642,6 +5259,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3642
  api.sek_fetchingPresetSections = _ajaxRequest_;
3643
  }
3644
  _ajaxRequest_.done( function( _collection_ ) {
 
3645
  api.sek_presetSections = _collection_;
3646
  dfd.resolve( api.sek_presetSections );
3647
  }).fail( function( _r_ ) {
@@ -3652,6 +5270,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3652
 
3653
  return dfd.promise();
3654
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3655
  getPresetSectionCollection : function( sectionParams ) {
3656
  var self = this,
3657
  __dfd__ = $.Deferred();
@@ -3664,6 +5300,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3664
  __dfd__.reject( er );
3665
  })
3666
  .done( function( _collection_ ) {
 
3667
  var presetSection,
3668
  allPresets = $.extend( true, {}, _.isObject( _collection_ ) ? _collection_ : {} );
3669
 
@@ -3675,6 +5312,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3675
  }
3676
  var presetCandidate = allPresets[ sectionParams.presetSectionId ];
3677
 
 
 
 
 
 
 
3678
  var setIds = function( collection ) {
3679
  _.each( collection, function( levelData ) {
3680
  levelData.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
@@ -3694,25 +5337,44 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3694
  });
3695
  return collection;
3696
  };
 
 
 
3697
  presetCandidate.id = sectionParams.section_id;
 
3698
  presetCandidate.collection = setIds( presetCandidate.collection );
 
 
 
3699
  presetCandidate.ver_ini = sektionsLocalizedData.nimbleVersion;
 
3700
  presetCandidate.collection = setVersion( presetCandidate.collection );
3701
  __dfd__.resolve( presetCandidate );
3702
  });//_maybeFetchSectionsFromServer.done()
3703
 
3704
  return __dfd__.promise();
3705
  },
 
 
 
 
 
 
 
3706
  preparePresetSectionForInjection : function( columnCollection ) {
3707
  var self = this,
3708
  deferreds = {},
3709
  preparedSection = {},
3710
  _dfd_ = $.Deferred();
 
 
3711
  var _sniffImg = function( data ) {
3712
  _.each( data, function( val, key ) {
3713
  if ( _.isObject( val ) || _.isArray( val ) ) {
3714
  _sniffImg( val );
3715
  } else if ( _.isString( val ) && -1 != val.indexOf( '::img-path::' ) ) {
 
 
3716
  if ( ! _.has( deferreds, val ) ) {
3717
  deferreds[ val ] = self.importAttachment( val.replace( '::img-path::', '' ) );
3718
  }
@@ -3720,6 +5382,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3720
  });
3721
  return deferreds;
3722
  };
 
 
 
 
 
 
3723
  var _replaceImgPlaceholderById = function( data, imgList) {
3724
  _.each( data, function( val, key ) {
3725
  if ( _.isObject( val ) || _.isArray( val ) ) {
@@ -3747,6 +5415,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3747
  var CZRSeksPrototype = CZRSeksPrototype || {};
3748
  (function ( api, $ ) {
3749
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
3750
  cleanRegistered : function( _id_ ) {
3751
  var self = this,
3752
  registered = $.extend( true, [], self.registered() || [] );
@@ -3756,11 +5431,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3756
  if ( api[ _reg_.what ].has( _reg_.id ) ) {
3757
  if ( ! _.isEmpty( _id_ ) && _reg_.id !== _id_ )
3758
  return;
 
3759
  if ( _.isFunction( api[ _reg_.what ]( _reg_.id ).trigger ) ) {//<= Section and Panel constructor are not extended with the Event class, that's why we check if this method exists
3760
  self.trigger( 'sek-ui-pre-removal', { what : _reg_.what, id : _reg_.id } );
3761
  }
3762
  $.when( api[ _reg_.what ]( _reg_.id ).container.remove() ).done( function() {
 
3763
  api[ _reg_.what ].remove( _reg_.id );
 
3764
  self.trigger( 'sek-ui-removed', { what : _reg_.what, id : _reg_.id } );
3765
  });
3766
  }
@@ -3769,13 +5447,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3769
  });
3770
  self.registered( registered );
3771
  },
 
 
 
3772
  cleanRegisteredLevelSettingsAfterHistoryNavigation : function() {
3773
  var self = this,
3774
  registered = $.extend( true, [], self.registered() || [] );
3775
 
3776
  registered = _.filter( registered, function( _reg_ ) {
 
3777
  if ( ! _.isEmpty( _reg_.level ) && 'setting' === _reg_.what ) {
3778
  if ( api.has( _reg_.id ) ) {
 
3779
  api.remove( _reg_.id );
3780
  }
3781
  }
@@ -3789,7 +5472,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3789
  var CZRSeksPrototype = CZRSeksPrototype || {};
3790
  (function ( api, $ ) {
3791
  $.extend( CZRSeksPrototype, {
 
3792
  rootPanelFocus : function() {
 
3793
  if ( api.section.has( api.czr_activeSectionId() ) ) {
3794
  api.section( api.czr_activeSectionId() ).expanded( false );
3795
  } else {
@@ -3801,6 +5486,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3801
  _p.expanded( false );
3802
  });
3803
  },
 
 
3804
  guid : function() {
3805
  function s4() {
3806
  return Math.floor((1 + Math.random()) * 0x10000)
@@ -3809,18 +5496,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3809
  }
3810
  return s4() + s4() + s4();//s4() + s4() + s4() + s4() + s4() + s4();
3811
  },
 
 
3812
  getGlobalSectionsSettingId : function() {
3813
  return sektionsLocalizedData.settingIdForGlobalSections;
3814
  },
 
 
 
 
3815
  getLevelModel : function( id, collection ) {
3816
  var self = this, _data_ = 'no_match',
 
 
 
 
3817
  _walk_ = function( id, collection, collectionSettingId, localOrGlobal ) {
 
 
3818
  if ( _.isUndefined( collection ) ) {
3819
  var currentSektionSettingValue = api( collectionSettingId )();
3820
  var sektionSettingValue = _.isObject( currentSektionSettingValue ) ? $.extend( true, {}, currentSektionSettingValue ) : $.extend( true, {}, self.getDefaultSektionSettingValue( localOrGlobal ) );
3821
  collection = _.isArray( sektionSettingValue.collection ) ? sektionSettingValue.collection : [];
3822
  }
3823
  _.each( collection, function( levelData ) {
 
3824
  if ( 'no_match' != _data_ )
3825
  return;
3826
  if ( id === levelData.id ) {
@@ -3833,6 +5533,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3833
  });
3834
  return _data_;
3835
  };
 
 
 
3836
  if ( ! _.isEmpty( collection ) ) {
3837
  _walk_( id, collection );
3838
  } else {
@@ -3848,6 +5551,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3848
 
3849
  return _data_;
3850
  },
 
 
 
 
 
 
3851
  isGlobalLocation : function( params ) {
3852
  var self = this, is_global_location = false;
3853
  params = params || {};
@@ -3862,16 +5571,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3862
  }
3863
  return is_global_location;
3864
  },
 
 
 
 
3865
  isChildOfAGlobalLocation : function( id ) {
3866
  var self = this,
3867
  walkCollection = function( id, collection ) {
3868
  var _data_ = 'no_match';
 
 
3869
  if ( _.isUndefined( collection ) ) {
3870
  var currentSettingValue = api( self.getGlobalSectionsSettingId() )();
3871
  var sektionSettingValue = _.isObject( currentSettingValue ) ? $.extend( true, {}, currentSettingValue ) : self.getDefaultSektionSettingValue( 'global' );
3872
  collection = _.isArray( sektionSettingValue.collection ) ? sektionSettingValue.collection : [];
3873
  }
3874
  _.each( collection, function( levelData ) {
 
3875
  if ( 'no_match' != _data_ )
3876
  return;
3877
  if ( id === levelData.id ) {
@@ -3890,13 +5606,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3890
 
3891
  getLevelPositionInCollection : function( id, collection ) {
3892
  var self = this, _position_ = 'no_match',
 
 
 
 
3893
  _walk_ = function( id, collection, collectionSettingId, localOrGlobal ) {
 
 
3894
  if ( _.isUndefined( collection ) ) {
3895
  var currentSektionSettingValue = api( collectionSettingId )();
3896
  var sektionSettingValue = _.isObject( currentSektionSettingValue ) ? $.extend( true, {}, currentSektionSettingValue ) : $.extend( true, {}, self.getDefaultSektionSettingValue( localOrGlobal ) );
3897
  collection = _.isArray( sektionSettingValue.collection ) ? sektionSettingValue.collection : [];
3898
  }
3899
  _.each( collection, function( levelData, _key_ ) {
 
3900
  if ( 'no_match' != _position_ )
3901
  return;
3902
  if ( id === levelData.id ) {
@@ -3908,6 +5631,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3908
  }
3909
  });
3910
  };
 
 
 
3911
  if ( ! _.isEmpty( collection ) ) {
3912
  _walk_( id, collection );
3913
  } else {
@@ -3922,6 +5648,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3922
  }
3923
  return _position_;
3924
  },
 
 
 
 
3925
  getLevelProperty : function( params ) {
3926
  params = _.extend( {
3927
  id : '',
@@ -3944,6 +5674,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3944
  }
3945
  return modelCandidate[ params.property ];
3946
  },
 
 
3947
  cloneLevel : function( levelId ) {
3948
  var self = this;
3949
  var levelModelCandidate = self.getLevelModel( levelId );
@@ -3951,10 +5683,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3951
  throw new Error( 'cloneLevel => no match for level id : ' + levelId );
3952
  }
3953
  var deepClonedLevel = $.extend( true, {}, levelModelCandidate );
 
3954
  var newIdWalker = function( level_model ) {
3955
  if ( _.isEmpty( level_model.id ) ) {
3956
  throw new Error( 'cloneLevel => missing level id');
3957
  }
 
3958
  level_model.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
3959
  if ( ! _.isEmpty( level_model.collection ) ) {
3960
  if ( ! _.isArray( level_model.collection ) ) {
@@ -3967,17 +5701,37 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
3967
  }
3968
  return level_model;
3969
  };
 
3970
  return newIdWalker( deepClonedLevel );
3971
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3972
  getDefaultItemModelFromRegisteredModuleData : function( moduleType ) {
3973
  if ( ! this.isModuleRegistered( moduleType ) ) {
3974
  return {};
3975
  }
 
3976
  if ( sektionsLocalizedData.registeredModules[moduleType].is_father ) {
3977
  api.errare( 'getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically' );
3978
  return;
3979
  }
3980
  var data = sektionsLocalizedData.registeredModules[ moduleType ].tmpl['item-inputs'],
 
 
3981
  defaultItemModel = {
3982
  id : '',
3983
  title : ''
@@ -4000,15 +5754,29 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4000
  });
4001
  return defaultItemModel;
4002
  },
 
 
4003
  getRegisteredModuleProperty : function( moduleType, property ) {
4004
  if ( ! this.isModuleRegistered( moduleType ) ) {
4005
  return 'not_set';
4006
  }
4007
  return sektionsLocalizedData.registeredModules[ moduleType ][ property ];
4008
  },
 
 
4009
  isModuleRegistered : function( moduleType ) {
4010
  return sektionsLocalizedData.registeredModules && ! _.isUndefined( sektionsLocalizedData.registeredModules[ moduleType ] );
4011
  },
 
 
 
 
 
 
 
 
 
 
4012
  sniffGFonts : function( args ) {
4013
  args = args || { is_global_location : false };
4014
  var self = this,
@@ -4019,6 +5787,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4019
  level = _.isObject( currentSektionSettingValue ) ? $.extend( true, {}, currentSektionSettingValue ) : $.extend( true, {}, self.getDefaultSektionSettingValue( localOrGlobal ) );
4020
  }
4021
  _.each( level, function( levelData, _key_ ) {
 
4022
  if ( _.isString( _key_ ) && '_css' === _key_.substr( _key_.length - 4 ) ) {
4023
  if ( true === self.inputIsAFontFamilyModifier( _key_ ) ) {
4024
  if ( levelData.indexOf('gfont') > -1 && ! _.contains( gfonts, levelData ) ) {
@@ -4040,8 +5809,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4040
 
4041
  return gfonts;
4042
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4043
  getInputDefaultValue : function( input_id, module_type, level ) {
4044
  var self = this;
 
 
4045
  self.cachedDefaultInputValues = self.cachedDefaultInputValues || {};
4046
  self.cachedDefaultInputValues[ module_type ] = self.cachedDefaultInputValues[ module_type ] || {};
4047
  if ( _.has( self.cachedDefaultInputValues[ module_type ], input_id ) ) {
@@ -4055,6 +5842,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4055
  api.errare( 'getInputDefaultValue => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
4056
  return;
4057
  }
 
4058
  if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
4059
  api.errare( 'getInputDefaultValue => Father modules should be treated specifically' );
4060
  return;
@@ -4064,22 +5852,34 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4064
  }
4065
  var _defaultVal_ = 'no_default_value_specified';
4066
  _.each( level, function( levelData, _key_ ) {
 
4067
  if ( 'no_default_value_specified' !== _defaultVal_ )
4068
  return;
4069
  if ( input_id === _key_ && ! _.isUndefined( levelData.default ) ) {
4070
  _defaultVal_ = levelData.default;
4071
  }
 
4072
  if ( 'no_default_value_specified' === _defaultVal_ && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
4073
  _defaultVal_ = self.getInputDefaultValue( input_id, module_type, levelData );
4074
  }
4075
  if ( 'no_default_value_specified' !== _defaultVal_ ) {
 
4076
  self.cachedDefaultInputValues[ module_type ][ input_id ] = _defaultVal_;
4077
  }
4078
  });
4079
  return _defaultVal_;
4080
  },
 
 
 
 
 
 
 
4081
  getInputType : function( input_id, module_type, level ) {
4082
  var self = this;
 
 
4083
  self.cachedInputTypes = self.cachedInputTypes || {};
4084
  self.cachedInputTypes[ module_type ] = self.cachedInputTypes[ module_type ] || {};
4085
  if ( _.has( self.cachedInputTypes[ module_type ], input_id ) ) {
@@ -4102,22 +5902,36 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4102
  }
4103
  var _inputType_ = 'no_input_type_specified';
4104
  _.each( level, function( levelData, _key_ ) {
 
4105
  if ( 'no_input_type_specified' !== _inputType_ )
4106
  return;
4107
  if ( input_id === _key_ && ! _.isUndefined( levelData.input_type ) ) {
4108
  _inputType_ = levelData.input_type;
4109
  }
 
4110
  if ( 'no_input_type_specified' === _inputType_ && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
4111
  _inputType_ = self.getInputType( input_id, module_type, levelData );
4112
  }
4113
  if ( 'no_input_type_specified' !== _inputType_ ) {
 
4114
  self.cachedInputTypes[ module_type ][ input_id ] = _inputType_;
4115
  }
4116
  });
4117
  return _inputType_;
4118
  },
 
 
 
 
 
 
 
 
 
4119
  getInputRegistrationParams : function( input_id, module_type, level ) {
4120
  var self = this;
 
 
4121
  self.cachedInputRegistrationParams = self.cachedInputRegistrationParams || {};
4122
  self.cachedInputRegistrationParams[ module_type ] = self.cachedInputRegistrationParams[ module_type ] || {};
4123
  if ( _.has( self.cachedInputRegistrationParams[ module_type ], input_id ) ) {
@@ -4131,6 +5945,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4131
  api.errare( 'getInputRegistrationParams => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
4132
  return;
4133
  }
 
4134
  if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
4135
  api.errare( 'getInputRegistrationParams => Father modules should be treated specifically' );
4136
  return;
@@ -4140,22 +5955,33 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4140
  }
4141
  var _params_ = {};
4142
  _.each( level, function( levelData, _key_ ) {
 
4143
  if ( ! _.isEmpty( _params_ ) )
4144
  return;
4145
  if ( input_id === _key_ && ! _.isUndefined( levelData.input_type ) ) {
4146
  _params_ = levelData;
4147
  }
 
4148
  if ( _.isEmpty( _params_ ) && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
4149
  _params_ = self.getInputRegistrationParams( input_id, module_type, levelData );
4150
  }
4151
  if ( ! _.isEmpty( _params_ ) ) {
 
4152
  self.cachedInputRegistrationParams[ module_type ][ input_id ] = _params_;
4153
  }
4154
  });
4155
  return _params_;
4156
  },
 
 
 
 
 
 
4157
  inputIsAFontFamilyModifier : function( input_id, level ) {
4158
  var self = this;
 
 
4159
  self.cachedFontFamilyModifier = self.cachedFontFamilyModifier || {};
4160
  if ( _.has( self.cachedFontFamilyModifier, input_id ) ) {
4161
  return self.cachedFontFamilyModifier[ input_id ];
@@ -4169,20 +5995,42 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4169
  }
4170
  var _bool_ = 'not_set';
4171
  _.each( level, function( levelData, _key_ ) {
 
4172
  if ( 'not_set' !== _bool_ )
4173
  return;
4174
  if ( input_id === _key_ && ! _.isUndefined( levelData.input_type ) ) {
4175
  _bool_ = _.isUndefined( levelData.refresh_fonts ) ? false : levelData.refresh_fonts;
4176
  }
 
4177
  if ( 'not_set' === _bool_ && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
4178
  _bool_ = self.inputIsAFontFamilyModifier( input_id, levelData );
4179
  }
4180
  if ( 'not_set' !== _bool_ ) {
 
4181
  self.cachedFontFamilyModifier[ input_id ] = _bool_;
4182
  }
4183
  });
4184
  return _bool_;
4185
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4186
  getModuleStartingValue : function( module_type ) {
4187
  if ( ! sektionsLocalizedData.registeredModules ) {
4188
  api.errare( 'getModuleStartingValue => missing sektionsLocalizedData.registeredModules' );
@@ -4232,6 +6080,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4232
 
4233
  selectables.eq( prevIndex ).focus();
4234
  },
 
 
 
 
 
 
 
 
 
4235
  setupSelectInput : function( selectOptions ) {
4236
  var input = this,
4237
  item = input.input_parent,
@@ -4244,6 +6101,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4244
  api.errare( 'api.czr_sektions.setupSelectInput => missing select options for input id => ' + input.id + ' in image module');
4245
  return;
4246
  } else {
 
4247
  _.each( selectOptions , function( title, value ) {
4248
  var _attributes = {
4249
  value : value,
@@ -4259,6 +6117,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4259
  $( 'select[data-czrtype]', input.container ).selecter();
4260
  }
4261
  },
 
 
 
 
 
 
 
4262
  setupFontSizeAndLineHeightInputs : function( obj ) {
4263
  var input = this,
4264
  $wrapper = $('.sek-font-size-line-height-wrapper', input.container ),
@@ -4270,25 +6135,45 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4270
  }
4271
  return unit;
4272
  };
 
4273
  input.css_unit = new api.Value( _.isEmpty( initial_unit ) ? 'px' : validateUnit( initial_unit ) );
 
4274
  input.css_unit.bind( function( to ) {
4275
  to = _.isEmpty( to ) ? 'px' : to;
4276
  $wrapper.find( 'input[type="number"]').trigger('change');
4277
  });
 
 
4278
  $wrapper.find( 'input[type="number"]').on('input change', function( evt ) {
4279
  input( $(this).val() + validateUnit( input.css_unit() ) );
4280
  }).stepper();
 
 
 
4281
  $wrapper.on( 'click', '[data-sek-unit]', function(evt) {
4282
  evt.preventDefault();
 
4283
  $wrapper.find('[data-sek-unit]').removeClass('is-selected').attr( 'aria-pressed', false );
4284
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
 
4285
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
 
4286
  input.css_unit( $(this).data('sek-unit') );
4287
  });
 
 
4288
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ initial_unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
4289
  },
 
 
 
 
 
 
 
4290
  maybeSetupDeviceSwitcherForInput : function() {
4291
  var input = this;
 
4292
  var deviceSwitcherHtml = [
4293
  '<span class="sek-input-device-switcher">',
4294
  '<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+ sektionsLocalizedData.i18n['Settings on desktops'] +'"></i>',
@@ -4314,16 +6199,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4314
  }
4315
  input.previewedDevice( device );
4316
  };
 
4317
  input.container.on( 'click', '[data-sek-device]', syncWithPreviewedDevice );
 
 
4318
  var $currentDeviceIcon = input.container.find('[data-sek-device="' + api.previewedDevice() + '"]');
4319
  if ( $currentDeviceIcon.length > 0 ) {
4320
  $currentDeviceIcon.trigger('click');
4321
  }
4322
  },
 
 
 
 
 
 
 
 
 
 
4323
  scheduleModuleAccordion : function( params ) {
4324
  params = params || { expand_first_control : true };
4325
  var _section_ = this;
 
4326
  $( _section_.container ).on( 'click', '.customize-control label > .customize-control-title', function( evt ) {
 
4327
  evt.stopPropagation();
4328
  var $control = $(this).closest( '.customize-control');
4329
 
@@ -4340,10 +6240,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4340
  duration : 0,
4341
  start : function() {
4342
  $control.attr('data-sek-expanded', "false" == $control.attr('data-sek-expanded') ? "true" : "false" );
 
 
 
4343
  $control.trigger( "true" == $control.attr('data-sek-expanded') ? 'sek-accordion-expanded' : 'sek-accordion-collapsed' );
4344
  }
4345
  });
4346
  });
 
 
4347
  if ( params.expand_first_control ) {
4348
  var firstControl = _.first( _section_.controls() );
4349
  if ( _.isObject( firstControl ) && ! _.isEmpty( firstControl.id ) ) {
@@ -4354,9 +6259,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4354
  }
4355
  }
4356
  },
 
 
 
 
 
 
4357
  isPromise : function (fn) {
4358
  return fn && typeof fn.then === 'function' && String( $.Deferred().then ) === String( fn.then );
4359
  },
 
 
4360
  whenAllPromisesInParallel : function ( deferreds ) {
4361
  var self = this,
4362
  mainDfd = $.Deferred(),
@@ -4385,6 +6298,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4385
 
4386
  return mainDfd;
4387
  },
 
 
 
 
4388
  whenAllPromisesInSerie : function ( deferreds, ind, promiseMessages, mainDfd ) {
4389
  ind = ind || 0;
4390
  promiseMessages = promiseMessages || {};
@@ -4407,7 +6324,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4407
  }//if
4408
  return mainDfd;
4409
  },
 
 
 
 
4410
  importAttachment : function( relpath ) {
 
4411
  return wp.ajax.post( 'sek_import_attachment', {
4412
  rel_path : relpath,
4413
  nonce: api.settings.nonce.save//<= do we need to set a specific nonce to fetch the attachment
@@ -4415,7 +6337,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4415
  .fail( function( _er_ ) {
4416
  api.errare( 'sek_import_attachment ajax action failed for image ' + relpath, _er_ );
4417
  });
 
 
 
4418
  },
 
 
 
 
 
 
 
 
4419
  cleanIds : function( levelData ) {
4420
  levelData.id = "";
4421
  var self = this;
@@ -4427,23 +6360,29 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4427
  });
4428
  return levelData;
4429
  },
 
 
4430
  getDefaultSektionSettingValue : function( localOrGlobal ) {
4431
  if ( _.isUndefined( localOrGlobal ) || !_.contains( [ 'local', 'global' ], localOrGlobal ) ) {
4432
  api.errare( 'getDefaultSektionSettingValue => the skope should be set to local or global');
4433
  }
4434
  return 'global' === localOrGlobal ? sektionsLocalizedData.defaultGlobalSektionSettingValue : sektionsLocalizedData.defaultLocalSektionSettingValue;
4435
  },
 
 
 
4436
  scheduleVisibilityOfInputId : function( controlledInputId, visibilityCallBack ) {
4437
  var item = this.input_parent;
4438
  if ( !_.isFunction(visibilityCallBack) || _.isEmpty(controlledInputId) ) {
4439
  throw new Error('::scheduleVisibilityOfInputId => error when firing for input id : ' + this.id );
4440
  }
 
4441
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
 
4442
  this.bind( function( to ) {
4443
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
4444
  });
4445
- },
4446
-
4447
  });//$.extend()
4448
  })( wp.customize, jQuery );//global sektionsLocalizedData
4449
  /**
@@ -4452,12 +6391,42 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4452
  * @https://html.spec.whatwg.org/multipage/dnd.html#dnd
4453
  * @https://caniuse.com/#feat=dragndrop
4454
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4455
  var CZRSeksPrototype = CZRSeksPrototype || {};
4456
  (function ( api, $ ) {
4457
  $.extend( CZRSeksPrototype, {
 
 
 
 
 
 
 
 
4458
  setupDnd : function() {
4459
  var self = this;
 
 
4460
  self.bind( 'sek-refresh-dragzones', function( params ) {
 
 
4461
  if ( true !== 'draggable' in document.createElement('span') ) {
4462
  api.panel( sektionsLocalizedData.sektionsPanelId, function( __main_panel__ ) {
4463
  api.notifications.add( new api.Notification( 'drag-drop-support', {
@@ -4465,6 +6434,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4465
  message: sektionsLocalizedData.i18n['This browser does not support drag and drop. You might need to update your browser or use another one.'],
4466
  dismissible: true
4467
  } ) );
 
 
4468
  _.delay( function() {
4469
  api.notifications.remove( 'drag-drop-support' );
4470
  }, 10000 );
@@ -4474,34 +6445,64 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4474
 
4475
  self.setupNimbleDragZones( params.input_container );//<= module or section picker
4476
  });
 
 
4477
  api.previewer.bind( 'ready', function() {
4478
  try { self.setupNimbleDropZones();//<= module or section picker
4479
  } catch( er ) {
4480
  api.errare( '::setupDnd => error on self.setupNimbleDropZones()', er );
4481
  }
 
 
 
 
 
 
 
 
4482
  if ( ! _.isUndefined( _.findWhere( self.registered(), { module_type : 'sek_intro_sec_picker_module' } ) ) ) {
4483
  self.rootPanelFocus();
4484
  } else if ( ! _.isUndefined( _.findWhere( self.registered(), { module_type : 'sek_module_picker_module' } ) ) ) {
4485
  self.rootPanelFocus();
4486
  }
4487
  });
 
 
4488
  self.reactToDrop();
4489
  },
 
 
 
 
 
 
4490
  setupNimbleDragZones : function( $draggableWrapper ) {
4491
  var self = this;
 
 
4492
  var _onStart = function( evt ) {
 
 
4493
  self.lastClickedTargetInPreview({});
4494
 
4495
  evt.originalEvent.dataTransfer.setData( "sek-content-type", $(this).data('sek-content-type') );
4496
  evt.originalEvent.dataTransfer.setData( "sek-content-id", $(this).data('sek-content-id') );
4497
  evt.originalEvent.dataTransfer.setData( "sek-section-type", $(this).data('sek-section-type') );
4498
  evt.originalEvent.dataTransfer.setData( "sek-is-user-section", $(this).data('sek-is-user-section') );
 
 
 
4499
  self.dndData = {
4500
  content_type : evt.originalEvent.dataTransfer.getData( "sek-content-type" ),
4501
  content_id : evt.originalEvent.dataTransfer.getData( "sek-content-id" ),
4502
  section_type : evt.originalEvent.dataTransfer.getData( "sek-section-type" ),
 
4503
  is_user_section : "true" === evt.originalEvent.dataTransfer.getData( "sek-is-user-section" )
4504
  };
 
 
 
 
4505
  try {
4506
  evt.originalEvent.dataTransfer.setData( 'browserSupport', 'browserSupport' );
4507
  evt.originalEvent.dataTransfer.clearData( 'browserSupport' );
@@ -4512,6 +6513,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4512
  message: sektionsLocalizedData.i18n['This browser does not support drag and drop. You might need to update your browser or use another one.'],
4513
  dismissible: true
4514
  } ) );
 
 
4515
  _.delay( function() {
4516
  api.notifications.remove( 'drag-drop-support' );
4517
  }, 10000 );
@@ -4521,11 +6524,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4521
  $('body').addClass('sek-dragging');
4522
  api.previewer.send( 'sek-drag-start', { type : self.dndData.content_type } );//fires the rendering of the dropzones
4523
  };
 
4524
  var _onEnd = function( evt ) {
4525
  $('body').removeClass('sek-dragging');
4526
  $(this).removeClass('sek-dragged');
4527
  api.previewer.send( 'sek-drag-stop' );
4528
  };
 
4529
  var _onDoubleClick = function( evt ) {
4530
  var _targetCandidate = self.lastClickedTargetInPreview();// { id : "__nimble__fb2ab3e47472" }
4531
  var $dropTarget;
@@ -4536,11 +6541,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4536
  }
4537
 
4538
  if ( $dropTarget && $dropTarget.length > 0 ) {
 
 
4539
  api.czr_sektions.trigger( 'sek-content-dropped', {
4540
  drop_target_element : $dropTarget,
4541
  location : $dropTarget.closest('[data-sek-level="location"]').data('sek-id'),
 
4542
  before_module : $dropTarget.data('drop-zone-before-module-or-nested-section'),
4543
  after_module : $dropTarget.data('drop-zone-after-module-or-nested-section'),
 
 
4544
  before_section : $dropTarget.data('drop-zone-before-section'),
4545
  after_section : $dropTarget.data('drop-zone-after-section'),
4546
 
@@ -4548,8 +6558,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4548
  content_id : $(this).data('sek-content-id'),
4549
 
4550
  section_type : $(this).data('sek-section-type'),
 
4551
  is_user_section : "true" === $(this).data('sek-is-user-section')
4552
  });
 
4553
  self.lastClickedTargetInPreview({});
4554
  } else {
4555
  _doubleClickTargetMissingNotif();
@@ -4562,17 +6574,38 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4562
  message: sektionsLocalizedData.i18n['You first need to click on a target ( with a + icon ) in the preview.'],
4563
  dismissible: true
4564
  } ) );
 
4565
  _.delay( function() {
4566
  api.notifications.remove( 'missing-injection-target' );
4567
  }, 30000 );
4568
  };
 
 
4569
  $draggableWrapper.find( '[draggable="true"]' ).each( function() {
4570
  $(this)
4571
  .on( 'dragstart', function( evt ) { _onStart.call( $(this), evt ); })
4572
  .on( 'dragend', function( evt ) { _onEnd.call( $(this), evt ); })
 
 
4573
  .dblclick( function( evt ) { _onDoubleClick.call( $(this), evt ); });
4574
  });
4575
  },//setupNimbleZones()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4576
  setupNimbleDropZones : function() {
4577
  var self = this;
4578
  this.$dropZones = this.dnd_getDropZonesElements();
@@ -4586,15 +6619,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4586
 
4587
  this.$dropZones.each( function() {
4588
  var $zone = $(this);
 
4589
  if ( true === $zone.data('zone-droppable-setup') )
4590
  return;
4591
 
4592
  self.enterOverTimer = null;
 
4593
  $zone
 
4594
  .on( 'dragenter dragover', sektionsLocalizedData.dropSelectors, function( evt ) {
 
4595
  if ( _.isNull( self.enterOverTimer ) ) {
4596
  self.enterOverTimer = true;
4597
  _.delay(function() {
 
 
4598
  if ( self.currentMousePosition && ( ( self.currentMousePosition + '' ) == ( evt.clientY + '' + evt.clientX + '') ) ) {
4599
  self.enterOverTimer = null;
4600
  return;
@@ -4618,6 +6657,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4618
  }
4619
  break;
4620
  case 'drop' :
 
4621
  this.$cachedDropZoneCandidates = null;//has been declared on enter over
4622
 
4623
  if ( ! self.dnd_canDrop( { targetEl : $(this), evt : evt } ) )
@@ -4625,6 +6665,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4625
  evt.preventDefault();//@see https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#drop
4626
  self.dnd_onDrop( $(this), evt );
4627
  self.dnd_cleanOnLeaveDrop( $(this), evt );
 
 
4628
  api.previewer.send( 'sek-drag-stop' );
4629
  break;
4630
  }
@@ -4644,6 +6686,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4644
  isInVertically = yPos >= dzoneRect.top && dzoneRect.bottom >= yPos;
4645
  return isInVertically && isInHorizontally;
4646
  },
 
 
 
 
 
 
 
 
 
 
4647
  dnd_toggleDragApproachClassesToDropZones : function( evt ) {
4648
 
4649
  var self = this,
@@ -4679,10 +6731,50 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4679
  isInHorizontally = xPos <= dzoneRect.right && dzoneRect.left <= xPos,
4680
  isInVertically = yPos >= dzoneRect.top && dzoneRect.bottom >= yPos;
4681
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4682
  self.distanceTable.push({
4683
  el : $(this),
4684
  dist : ( isInVertically && isInHorizontally ) ? 0 : getHypotenuse( mouseToXCenter, mouseToYCenter )
4685
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4686
  $(this).removeClass( 'sek-drag-is-in');
4687
 
4688
  if ( ( isVeryCloseVertically || isInVertically ) && ( isVeryCloseHorizontally || isInHorizontally ) ) {
@@ -4690,12 +6782,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4690
  $(this).removeClass( 'sek-drag-is-close' );
4691
  $(this).addClass( 'sek-drag-is-very-close');
4692
  $(this).removeClass( 'sek-drag-is-in');
 
4693
  } else {
4694
  $(this).removeClass( 'sek-drag-is-approaching');
4695
  $(this).removeClass( 'sek-drag-is-close' );
4696
  $(this).removeClass( 'sek-drag-is-very-close');
4697
  $(this).removeClass( 'sek-drag-is-in');
4698
  }
 
 
 
4699
  });//$('.sek-drop-zones').each()
4700
 
4701
 
@@ -4709,8 +6805,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4709
  if ( self.$dropTargetCandidate && self.$dropTargetCandidate.length > 0 && self.dnd_isInTarget( self.$dropTargetCandidate, evt ) ) {
4710
  self.$dropTargetCandidate.addClass('sek-drag-is-in');
4711
  }
 
4712
  self.enterOverTimer = null;
4713
  },
 
 
4714
  dnd_getPreDropElementContent : function( evt ) {
4715
  var $target = $( evt.currentTarget ),
4716
  html,
@@ -4738,9 +6837,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4738
  }
4739
  return preDropContent;
4740
  },
 
 
4741
  dnd_getDropZonesElements : function() {
4742
  return $( api.previewer.targetWindow().document );
4743
  },
 
 
 
 
4744
  dnd_canDrop : function( params ) {
4745
  params = _.extend( { targetEl : {}, evt : {} }, params || {} );
4746
  var self = this, $dropTarget = params.targetEl;
@@ -4784,11 +6889,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4784
 
4785
  return $dropTarget.hasClass('sek-drop-zone') && ( ( 'preset_section' === self.dndData.content_type && isSectionDropZone ) || ( 'module' === self.dndData.content_type && ! isSectionDropZone ) || ( 'preset_section' === self.dndData.content_type && sectionHasNoModule ) );
4786
  },
 
 
4787
  dnd_OnEnterOver : function( $dropTarget, evt ) {
4788
  evt.preventDefault();//@see :https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#droptargets
 
4789
  if ( true !== $dropTarget.data( 'is-drag-entered' ) ) {
 
4790
  $dropTarget.data( 'is-drag-entered', true );
4791
  $dropTarget.addClass( 'sek-active-drop-zone' );
 
4792
  this.$dropZones.addClass( 'sek-is-dragging' );
4793
  }
4794
 
@@ -4796,6 +6906,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4796
  api.errare('Error when trying to insert the preDrop content', er );
4797
  }
4798
  },
 
 
4799
  dnd_cleanOnLeaveDrop : function( $dropTarget, evt ) {
4800
  var self = this;
4801
  this.$dropZones = this.$dropZones || this.dnd_getDropZonesElements();
@@ -4806,6 +6918,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4806
  self.dnd_cleanSingleDropTarget( $(this) );
4807
  });
4808
  },
 
 
4809
  dnd_cleanSingleDropTarget : function( $dropTarget ) {
4810
  if ( _.isEmpty( $dropTarget ) || $dropTarget.length < 1 )
4811
  return;
@@ -4819,9 +6933,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4819
 
4820
  $dropTarget.find('.sek-no-drop-possible-message').remove();
4821
  },
 
 
 
4822
  dnd_getPosition : function( $dropTarget, evt ) {
4823
  var targetRect = $dropTarget[0].getBoundingClientRect(),
4824
  targetHeight = targetRect.height;
 
 
4825
  if ( 'before' === $dropTarget.data( 'preDrop-position' ) ) {
4826
  targetHeight = targetHeight + this.preDropElement.outerHeight();
4827
  } else if ( 'after' === $dropTarget.data( 'preDrop-position' ) ) {
@@ -4830,6 +6949,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4830
 
4831
  return evt.originalEvent.clientY - targetRect.top - ( targetHeight / 2 ) > 0 ? 'after' : 'before';
4832
  },
 
 
4833
  dnd_mayBePrintPreDropElement : function( $dropTarget, evt ) {
4834
  var self = this,
4835
  previousPosition = $dropTarget.data( 'preDrop-position' ),
@@ -4843,11 +6964,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4843
  }
4844
 
4845
  self.isPrintingPreDrop = true;
 
 
4846
  this.dnd_cleanSingleDropTarget( this.$currentPreDropTarget );
4847
  var inNewSection = 'between-sections' === $dropTarget.data('sek-location') || 'in-empty-location' === $dropTarget.data('sek-location');
4848
  $.when( self.preDropElement.remove() ).done( function(){
4849
  $dropTarget[ 'before' === newPosition ? 'prepend' : 'append' ]( self.preDropElement )
4850
  .find( '.' + sektionsLocalizedData.preDropElementClass ).html( self.dnd_getPreDropElementContent( evt ) );
 
4851
  $dropTarget.find( '.' + sektionsLocalizedData.preDropElementClass ).toggleClass('in-new-sektion', inNewSection );
4852
  $dropTarget.data( 'preDrop-position', newPosition );
4853
 
@@ -4857,6 +6981,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4857
  self.$currentPreDropTarget = $dropTarget;
4858
  });
4859
  },
 
 
4860
  dnd_isOveringDropTarget : function( $dropTarget, evt ) {
4861
  var targetRect = $dropTarget[0].getBoundingClientRect(),
4862
  mouseX = evt.clientX,
@@ -4869,14 +6995,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4869
  isYin = mouseY >= tTop && ( tBottom - tTop ) >= ( mouseY - tTop);
4870
  return isXin && isYin;
4871
  },
 
 
4872
  dnd_onDrop: function( $dropTarget, evt ) {
4873
  evt.stopPropagation();
4874
  var _position = 'after' === this.dnd_getPosition( $dropTarget, evt ) ? $dropTarget.index() + 1 : $dropTarget.index();
 
 
4875
  api.czr_sektions.trigger( 'sek-content-dropped', {
4876
  drop_target_element : $dropTarget,
4877
  location : $dropTarget.closest('[data-sek-level="location"]').data('sek-id'),
 
4878
  before_module : $dropTarget.data('drop-zone-before-module-or-nested-section'),
4879
  after_module : $dropTarget.data('drop-zone-after-module-or-nested-section'),
 
 
4880
  before_section : $dropTarget.data('drop-zone-before-section'),
4881
  after_section : $dropTarget.data('drop-zone-after-section'),
4882
 
@@ -4884,11 +7017,40 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4884
  content_id : evt.originalEvent.dataTransfer.getData( "sek-content-id" ),
4885
 
4886
  section_type : evt.originalEvent.dataTransfer.getData( "sek-section-type" ),
 
4887
  is_user_section : "true" === evt.originalEvent.dataTransfer.getData( "sek-is-user-section" )
4888
  });
4889
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4890
  reactToDrop : function() {
4891
  var self = this;
 
 
 
 
 
 
 
 
 
 
4892
  var _do_ = function( params ) {
4893
  if ( ! _.isObject( params ) ) {
4894
  throw new Error( 'Invalid params provided' );
@@ -4899,6 +7061,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4899
 
4900
  var $dropTarget = params.drop_target_element,
4901
  dropCase = 'content-in-column';
 
 
4902
  switch( $dropTarget.data('sek-location') ) {
4903
  case 'between-sections' :
4904
  dropCase = 'content-in-a-section-to-create';
@@ -4912,18 +7076,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4912
  dropCase = 'content-in-new-column';
4913
  break;
4914
  }
 
 
4915
  if ( 'preset_section' === params.content_type ) {
4916
  if ( $dropTarget.hasClass( 'sek-module-drop-zone-for-first-module' ) ) {
4917
  var $parentSektion = $dropTarget.closest('div[data-sek-level="section"]');
 
4918
  var colNumber = $parentSektion.find('.sek-sektion-inner').first().children( '[data-sek-level="column"]' ).length;
 
4919
  if ( colNumber > 1 ) {
4920
  dropCase = 'preset-section-in-a-nested-section-to-create';
4921
  params.is_nested = true;
4922
  params.in_column = $dropTarget.closest('[data-sek-level="column"]').data('sek-id');
4923
  params.in_sektion = $parentSektion.data('sek-id');
 
4924
  } else {
4925
  params.sektion_to_replace = $parentSektion.data('sek-id');
4926
  params.after_section = params.sektion_to_replace;
 
4927
  params.in_column = $parentSektion.closest('[data-sek-level="column"]').data('sek-id');
4928
  dropCase = 'content-in-a-section-to-replace';
4929
  }
@@ -4968,6 +7138,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4968
  case 'content-in-a-section-to-create' :
4969
  api.previewer.trigger( 'sek-add-content-in-new-sektion', params );
4970
  break;
 
4971
  case 'content-in-a-section-to-replace' :
4972
  api.previewer.trigger( 'sek-add-content-in-new-sektion', params );
4973
  break;
@@ -4981,9 +7152,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4981
  default :
4982
  api.errare( 'sek control panel => ::reactToDrop => invalid drop case : ' + dropCase );
4983
  break;
 
 
 
4984
  }
4985
  };
 
 
 
 
 
 
 
 
 
 
 
4986
  this.bind( 'sek-content-dropped', function( params ) {
 
4987
  try { _do_( params ); } catch( er ) {
4988
  api.errare( 'error when reactToDrop', er );
4989
  }
@@ -4998,12 +7184,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
4998
  Credits : xwp, westonruter, valendesigns, sayedwp, utkarshpatel.
4999
  Date of original code modification : July 2018
5000
  */
 
5001
  setupTinyMceEditor: function() {
5002
  var self = this;
 
5003
  api.sekEditorExpanded = new api.Value( false );
5004
  api.sekEditorSynchronizedInput = new api.Value();
5005
 
5006
  self.editorEventsListenerSetup = false;//this status will help us ensure that we bind the shared tinyMce instance only once
 
 
5007
  var mayBeAwakeTinyMceEditor = function() {
5008
  api.sekTinyMceEditor = api.sekTinyMceEditor || tinyMCE.get( 'czr-customize-content_editor' );
5009
 
@@ -5013,14 +7203,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5013
  self.trigger('sek-tiny-mce-editor-bound-and-instantiated');
5014
  }
5015
  };
 
 
 
 
 
 
 
 
 
 
5016
  self.bind( 'sek-edit-module_done', function( params ) {
5017
  params = _.isObject( params ) ? params : {};
5018
  if ( 'tiny_mce_editor' !== params.clicked_input_type && 'czr_tiny_mce_editor_module' !== params.module_type )
5019
  return;
 
 
 
5020
  if ( _.isEmpty( params.syncedTinyMceInputId ) )
5021
  return;
5022
 
5023
  var controlId = params.id;
 
5024
  if ( true === self.getRegisteredModuleProperty( params.module_type, 'is_father' ) ) {
5025
  var _childModules_ = self.getRegisteredModuleProperty( params.module_type, 'children' );
5026
  if ( _.isEmpty( _childModules_ ) ) {
@@ -5033,6 +7237,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5033
  });
5034
  }
5035
  }
 
 
5036
  api.sekEditorSynchronizedInput({
5037
  control_id : controlId,
5038
  input_id : params.syncedTinyMceInputId
@@ -5041,7 +7247,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5041
  api.sekEditorExpanded( true );
5042
  api.sekTinyMceEditor.focus();
5043
  });
 
 
 
 
 
5044
  $('#customize-theme-controls').on('click', '[data-czr-action="open-tinymce-editor"]', function() {
 
 
 
5045
  var control_id = $(this).data('czr-control-id'),
5046
  input_id = $(this).data('czr-input-id');
5047
  if ( _.isEmpty( control_id ) || _.isEmpty( input_id ) ) {
@@ -5057,11 +7271,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5057
  api.sekEditorExpanded( true );
5058
  api.sekTinyMceEditor.focus();
5059
  });
 
 
 
 
 
 
5060
  api.sekEditorSynchronizedInput.bind( function( to, from ) {
5061
  mayBeAwakeTinyMceEditor();
 
 
 
 
 
5062
  api( to.control_id, function( _setting_ ) {
5063
  var _currentModuleValue_ = _setting_(),
5064
  _currentInputContent_ = ( _.isObject( _currentModuleValue_ ) && ! _.isEmpty( _currentModuleValue_[ to.input_id ] ) ) ? _currentModuleValue_[ to.input_id ] : '';
 
 
 
 
5065
  _currentInputContent_ = _currentInputContent_.replace(/\r?\n/g, '<br/>');
5066
  try { api.sekTinyMceEditor.setContent( _currentInputContent_ ); } catch( er ) {
5067
  api.errare( 'Error when setting the tiny mce editor content in setupTinyMceEditor', er );
@@ -5070,8 +7299,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5070
  });
5071
 
5072
  });//api.sekEditorSynchronizedInput.bind( function( to, from )
 
 
 
 
 
 
 
 
 
5073
  api.sekEditorExpanded.bind( function ( expanded, from, params ) {
5074
  mayBeAwakeTinyMceEditor();
 
5075
  if ( expanded ) {
5076
  api.sekTinyMceEditor.focus();
5077
  }
@@ -5080,6 +7319,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5080
  /*
5081
  * Ensure only the latest input is bound
5082
  */
 
 
 
 
 
 
 
5083
 
5084
  $( window )[ expanded ? 'on' : 'off' ]('resize', function() {
5085
  if ( ! api.sekEditorExpanded() )
@@ -5093,18 +7339,31 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5093
  if ( expanded ) {
5094
  self.czrResizeEditor( window.innerHeight - self.$editorPane.height() );
5095
  } else {
 
 
5096
  self.$preview.css( 'bottom', '' );
5097
  self.$collapseSidebar.css( 'bottom', '' );
5098
  }
5099
  });
 
 
 
 
 
 
5100
  $('#czr-customize-content_editor-pane' ).on('click', '[data-czr-action="close-tinymce-editor"]', function() {
5101
  api.sekEditorExpanded( false );
5102
  });
 
 
5103
  $('#customize-controls' ).on('click', function( evt ) {
5104
  if ( 'open-tinymce-editor' == $( evt.target ).data( 'czr-action') )
5105
  return;
5106
  api.sekEditorExpanded( false, { context : "clicked anywhere"} );
5107
  });
 
 
 
5108
  $(document).on( 'keydown', _.throttle( function( evt ) {
5109
  if ( 27 === evt.keyCode ) {
5110
  api.sekEditorExpanded( false );
@@ -5150,6 +7409,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5150
 
5151
  attachEventsToEditor : function() {
5152
  var self = this;
 
5153
  self.$editorTextArea = $( '#czr-customize-content_editor' );
5154
  self.$editorPane = $( '#czr-customize-content_editor-pane' );
5155
  self.$editorDragbar = $( '#czr-customize-content_editor-dragbar' );
@@ -5160,7 +7420,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5160
 
5161
  self.$preview = $( '#customize-preview' );
5162
  self.$collapseSidebar = $( '.collapse-sidebar' );
 
 
 
 
 
 
5163
  api.sekTinyMceEditor.on( 'input change keyup', function( evt ) {
 
 
5164
  if ( api.control.has( api.sekEditorSynchronizedInput().control_id ) ) {
5165
  try { api.control( api.sekEditorSynchronizedInput().control_id )
5166
  .trigger( 'tinyMceEditorUpdated', {
@@ -5173,7 +7441,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5173
  }
5174
  }
5175
  });
 
 
5176
  self.$editorTextArea.on( 'input', function( evt ) {
 
5177
  try { api.control( api.sekEditorSynchronizedInput().control_id )
5178
  .trigger( 'tinyMceEditorUpdated', {
5179
  input_id : api.sekEditorSynchronizedInput().input_id,
@@ -5184,6 +7455,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5184
  api.errare( 'Error when triggering tinyMceEditorUpdated', er );
5185
  }
5186
  });
 
 
 
 
 
 
5187
  $('#czr-customize-content_editor-pane').on( 'mousedown mouseup', function( evt ) {
5188
  if ( 'mousedown' === evt.type && 'czr-customize-content_editor-dragbar' !== $(evt.target).attr('id') && ! $(evt.target).hasClass('czr-resize-handle') )
5189
  return;
@@ -5214,6 +7491,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5214
 
5215
  czrResizeEditor : function( position ) {
5216
  var self = this,
 
5217
  windowHeight = window.innerHeight,
5218
  windowWidth = window.innerWidth,
5219
  minScroll = 40,
@@ -5255,19 +7533,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5255
  'bottom',
5256
  collapseMinSpacing > windowHeight - args.height ? self.$mceStatusbar.outerHeight() + collapseBottomInsideEditor : args.height + collapseBottomOutsideEditor
5257
  );
 
 
5258
  }
5259
  });//$.extend()
5260
  })( wp.customize, jQuery );//global sektionsLocalizedData
5261
  var CZRSeksPrototype = CZRSeksPrototype || {};
5262
  (function ( api, $ ) {
 
5263
  $.extend( CZRSeksPrototype, api.Events );
5264
  var CZR_SeksConstructor = api.Class.extend( CZRSeksPrototype );
 
 
 
 
 
5265
  try { api.czr_sektions = new CZR_SeksConstructor(); } catch( er ) {
5266
  api.errare( 'api.czr_sektions => problem on instantiation', er );
5267
  }
5268
  })( wp.customize, jQuery );//global sektionsLocalizedData
5269
  ( function ( api, $, _ ) {
 
5270
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
5271
  var validateUnit = function( unit ) {
5272
  if ( ! _.contains( ['px', 'em', '%'], unit ) ) {
5273
  api.errare( 'error : invalid unit for input ' + this.id, unit );
@@ -5280,12 +7571,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5280
  },
5281
  unitButtonsSetup = function( $wrapper ) {
5282
  var input = this;
 
 
5283
  $wrapper.on( 'click', '.sek-ui-button', function( evt, params ) {
5284
  evt.preventDefault();
 
5285
  $wrapper.find('.sek-ui-button').removeClass('is-selected').attr( 'aria-pressed', false );
5286
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
 
5287
  input.css_unit( $(this).data('sek-unit'), params );
5288
  });
 
 
5289
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ ( input.initial_unit || 'px' ) +'"]').addClass('is-selected').attr( 'aria-pressed', true );
5290
  },
5291
  setupResetAction = function( $wrapper, defaultVal ) {
@@ -5297,6 +7594,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5297
  });
5298
 
5299
  input( defaultVal );
 
5300
  $('.sek-unit-wrapper', $wrapper ).find('[data-sek-unit="px"]').trigger('click');
5301
  });
5302
  };
@@ -5312,25 +7610,36 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5312
  $wrapper = $('.sek-spacing-wrapper', input.container ),
5313
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
5314
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : [];
 
 
5315
  $wrapper.on( 'input', 'input[type="number"]', function(evt) {
5316
  var _type_ = $(this).closest('[data-sek-spacing]').data('sek-spacing'),
5317
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
5318
  _rawVal = $(this).val();
 
 
 
5319
  if ( ( _.isString( _rawVal ) && ! _.isEmpty( _rawVal ) ) || _.isNumber( _rawVal ) ) {
5320
  _newInputVal[ _type_ ] = _rawVal;
5321
  } else {
 
5322
  _newInputVal = _.omit( _newInputVal, _type_ );
5323
  }
5324
  input( _newInputVal );
5325
  });
 
5326
  setupResetAction.call( input, $wrapper, defaultVal );
 
 
5327
  if ( _.isObject( input() ) ) {
5328
  _.each( input(), function( _val_, _key_ ) {
5329
  $( '[data-sek-spacing="' + _key_ +'"]', $wrapper ).find( 'input[type="number"]' ).val( _val_ );
5330
  });
 
5331
  var unitToActivate = 'px';
5332
  $('.sek-unit-wrapper .sek-ui-button', input.container ).each( function() {
5333
  var unit = $(this).data('sek-unit');
 
5334
  if ( ! _.isEmpty( input() ) ) {
5335
  if ( ! _.isEmpty( input()[ 'unit' ] ) ) {
5336
  if ( unit === input()[ 'unit' ] ) {
@@ -5341,12 +7650,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5341
  });
5342
  $('.sek-unit-wrapper', input.container ).find('[data-sek-unit="' + validateUnit.call( input, unitToActivate ) + '"]').trigger('click');
5343
  }
 
 
5344
  var initial_value = input();
5345
  input.initial_unit = 'px';
5346
  if ( ! _.isEmpty( initial_value ) ) {
5347
  input.initial_unit = _.isEmpty( initial_value['unit'] ) ? 'px' : initial_value['unit'];
5348
  }
 
 
5349
  input.css_unit = new api.Value( validateUnit.call( input, input.initial_unit ) );
 
 
5350
  input.css_unit.bind( function( to ) {
5351
  to = _.isEmpty( to ) ? 'px' : to;
5352
  var _newInputVal;
@@ -5355,6 +7670,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5355
  _newInputVal[ 'unit' ] = to;
5356
  input( _newInputVal );
5357
  });
 
 
 
5358
  unitButtonsSetup.call( input, $wrapper );
5359
  }
5360
  });//$.extend( api.czrInputMap, {})
@@ -5376,12 +7694,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5376
  /* ------------------------------------------------------------------------- *
5377
  * SPACING WITH DEVICE SWITCHER
5378
  /* ------------------------------------------------------------------------- */
 
 
 
 
5379
  $.extend( api.czrInputMap, {
5380
  spacingWithDeviceSwitcher : function( input_options ) {
 
5381
  var input = this,
5382
  $wrapper = $('.sek-spacing-wrapper', input.container ),
5383
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
5384
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
 
 
 
 
 
 
 
5385
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
5386
  var deviceHierarchy = [ 'mobile' , 'tablet', 'desktop' ];
5387
  if ( _.has( inputValues, currentDevice ) ) {
@@ -5395,14 +7725,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5395
  }
5396
  }
5397
  };
 
 
5398
  var syncWithPreviewedDevice = function( currentDevice ) {
5399
  var inputValues = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
5400
  clonedDefault = $.extend( true, {}, defaultVal );
5401
  inputValues = _.isObject( inputValues ) ? $.extend( clonedDefault, inputValues ) : clonedDefault;
5402
  var _currentDeviceValues = getCurrentDeviceActualOrInheritedValue( inputValues, currentDevice );
 
 
5403
  $( '[data-sek-spacing]', $wrapper ).each( function() {
5404
  var spacingType = $(this).data('sek-spacing'),
5405
  _val_ = '';
 
5406
  if ( ! _.isEmpty( _currentDeviceValues ) ) {
5407
  if ( ! _.isEmpty( _currentDeviceValues[ spacingType ] ) ) {
5408
  _val_ = _currentDeviceValues[ spacingType ];
@@ -5410,9 +7745,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5410
  }
5411
  $(this).find( 'input[type="number"]' ).val( _val_ );
5412
  });
 
 
5413
  var unitToActivate = 'px';
5414
  $( '.sek-unit-wrapper .sek-ui-button', input.container).each( function() {
5415
  var unit = $(this).data('sek-unit');
 
5416
  if ( ! _.isEmpty( _currentDeviceValues ) ) {
5417
  if ( ! _.isEmpty( _currentDeviceValues[ 'unit' ] ) ) {
5418
  if ( unit === _currentDeviceValues[ 'unit' ] ) {
@@ -5423,13 +7761,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5423
  });
5424
  $('.sek-unit-wrapper', input.container ).find('[data-sek-unit="' + validateUnit.call( input, unitToActivate ) + '"]').trigger('click', { previewed_device_switched : true });// We don't want to update the input();
5425
  };
 
 
 
 
 
5426
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
 
 
5427
  var initial_value = input();
5428
  input.initial_unit = 'px';
5429
  if ( ! _.isEmpty( initial_value ) && ! _.isEmpty( initial_value[ input.previewedDevice() ] ) ) {
5430
  input.initial_unit = _.isEmpty( initial_value[ input.previewedDevice() ]['unit'] ) ? 'px' : initial_value[ input.previewedDevice() ]['unit'];
5431
  }
 
 
5432
  input.css_unit = new api.Value( validateUnit.call( input, input.initial_unit ) );
 
 
 
 
 
 
5433
  $wrapper.on( 'input', 'input[type="number"]', function(evt) {
5434
  var changedSpacingType = $(this).closest('[data-sek-spacing]').data('sek-spacing'),
5435
  changedNumberInputVal = $(this).val(),
@@ -5438,20 +7791,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5438
 
5439
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
5440
  _newInputVal[ previewedDevice ] = $.extend( true, {}, _newInputVal[ previewedDevice ] || {} );
 
 
5441
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) || _.isNumber( changedNumberInputVal ) ) {
5442
  _newInputVal[ previewedDevice ][ changedSpacingType ] = changedNumberInputVal;
5443
  } else {
 
5444
  _newInputVal[ previewedDevice ] = _.omit( _newInputVal[ previewedDevice ], changedSpacingType );
5445
  }
5446
 
5447
  input( _newInputVal );
5448
  });
 
 
5449
  setupResetAction.call( input, $wrapper, defaultVal );
 
 
 
5450
  input.previewedDevice.bind( function( currentDevice ) {
5451
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
5452
  api.errare('Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id ' + input.id , er );
5453
  }
5454
  });
 
 
 
 
5455
  input.css_unit.bind( function( to, from, params ) {
5456
  if ( _.isObject( params ) && true === params.previewed_device_switched )
5457
  return;
@@ -5464,7 +7829,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5464
  _newInputVal[ previewedDevice ][ 'unit' ] = to;
5465
  input( _newInputVal );
5466
  });
 
 
 
5467
  unitButtonsSetup.call( input, $wrapper );
 
 
 
 
5468
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
5469
  api.errare('Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id ' + input.id , er );
5470
  }
@@ -5474,16 +7846,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5474
 
5475
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5476
  ( function ( api, $, _ ) {
 
5477
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
5478
  $.extend( api.czrInputMap, {
5479
  /* ------------------------------------------------------------------------- *
5480
  * BG POSITION SIMPLE
5481
  /* ------------------------------------------------------------------------- */
5482
  bg_position : function( input_options ) {
5483
  var input = this;
 
5484
  $('.sek-bg-pos-wrapper', input.container ).on( 'change', 'input[type="radio"]', function(evt) {
5485
  input( $(this).val() );
5486
  });
 
 
5487
  if ( ! _.isEmpty( input() ) ) {
5488
  input.container.find('input[value="'+ input() +'"]').attr('checked', true).trigger('click');
5489
  }
@@ -5497,6 +7878,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5497
  var input = this,
5498
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
5499
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
 
 
5500
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
5501
 
5502
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
@@ -5512,6 +7895,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5512
  }
5513
  }
5514
  };
 
 
5515
  var syncWithPreviewedDevice = function( currentDevice ) {
5516
  var inputValues = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
5517
  clonedDefault = $.extend( true, {}, defaultVal );
@@ -5520,6 +7905,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5520
 
5521
  input.container.find('input[value="'+ _currentDeviceValue +'"]').attr('checked', true).trigger('click', { previewed_device_switched : true } );
5522
  };
 
 
 
 
5523
  $('.sek-bg-pos-wrapper', input.container ).on( 'change', 'input[type="radio"]', function( evt ) {
5524
  var changedRadioVal = $(this).val(),
5525
  _newInputVal;
@@ -5529,11 +7918,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5529
 
5530
  input( _newInputVal );
5531
  });
 
 
 
 
5532
  input.previewedDevice.bind( function( currentDevice ) {
5533
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
5534
  api.errare('Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id ' + input.id , er );
5535
  }
5536
  });
 
 
5537
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
5538
  api.errare('Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id ' + input.id , er );
5539
  }
@@ -5543,13 +7938,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5543
 
5544
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5545
  ( function ( api, $, _ ) {
 
5546
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
5547
  var x_or_y_AlignWithDeviceSwitcher = function( params ) {
5548
  var input = this,
5549
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
5550
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {},
5551
  tmplSelector = 'verticalAlignWithDeviceSwitcher' === input.type ? '.sek-v-align-wrapper' : '.sek-h-align-wrapper',// <= because used by 2 different input tmpl
5552
  $wrapper = $( tmplSelector, input.container );
 
 
5553
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
5554
 
5555
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
@@ -5565,14 +7967,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5565
  }
5566
  }
5567
  };
 
 
5568
  var syncWithPreviewedDevice = function( currentDevice ) {
5569
  var inputValues = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
5570
  clonedDefault = $.extend( true, {}, defaultVal );
5571
  inputValues = _.isObject( inputValues ) ? $.extend( clonedDefault, inputValues ) : clonedDefault;
5572
  var _currentDeviceValue = getCurrentDeviceActualOrInheritedValue( inputValues, currentDevice );
 
 
5573
  $wrapper.find('.selected').removeClass('selected');
5574
  $wrapper.find( 'div[data-sek-align="' + _currentDeviceValue +'"]' ).addClass('selected');
5575
  };
 
 
5576
  $wrapper.on( 'click', '[data-sek-align]', function(evt) {
5577
  evt.preventDefault();
5578
  var _newInputVal;
@@ -5585,15 +7993,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5585
  input( _newInputVal );
5586
  });
5587
  });
 
 
 
5588
  input.previewedDevice.bind( function( currentDevice ) {
5589
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
5590
  api.errare('Error when firing syncWithPreviewedDevice for input type : ' + input.type + ' for input id ' + input.id , er );
5591
  }
5592
  });
 
 
5593
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
5594
  api.errare('Error when firing syncWithPreviewedDevice for input type : ' + input.type + ' for input id ' + input.id , er );
5595
  }
5596
  };
 
 
 
 
 
 
5597
  $.extend( api.czrInputMap, {
5598
  horizTextAlignmentWithDeviceSwitcher : x_or_y_AlignWithDeviceSwitcher,
5599
  horizAlignmentWithDeviceSwitcher : x_or_y_AlignWithDeviceSwitcher,
@@ -5601,7 +8020,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5601
  });//$.extend( api.czrInputMap, {})
5602
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5603
  ( function ( api, $, _ ) {
 
5604
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
5605
  $.extend( api.czrInputMap, {
5606
  font_size : function( params ) {
5607
  api.czr_sektions.setupFontSizeAndLineHeightInputs.call(this);
@@ -5612,7 +8037,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5612
 
5613
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5614
  ( function ( api, $, _ ) {
 
5615
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
5616
  $.extend( api.czrInputMap, {
5617
  line_height : function( params ) {
5618
  api.czr_sektions.setupFontSizeAndLineHeightInputs.call(this);
@@ -5622,8 +8053,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5622
 
5623
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5624
  ( function ( api, $, _ ) {
 
5625
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
5626
  $.extend( api.czrInputMap, {
 
5627
  font_picker : function( input_options ) {
5628
  var input = this,
5629
  item = input.input_parent;
@@ -5637,6 +8075,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5637
  if ( ! _.isUndefined( api.sek_fetchingFontCollection ) && 'pending' == api.sek_fetchingFontCollection.state() ) {
5638
  _ajaxRequest_ = api.sek_fetchingFontCollection;
5639
  } else {
 
 
5640
  _ajaxRequest_ = api.CZR_Helpers.getModuleTmpl( {
5641
  tmpl : 'font_list',
5642
  module_type: 'font_picker_input',
@@ -5645,6 +8085,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5645
  api.sek_fetchingFontCollection = _ajaxRequest_;
5646
  }
5647
  _ajaxRequest_.done( function( _serverTmpl_ ) {
 
5648
  if ( typeof _serverTmpl_ !== 'string' || _serverTmpl_[0] !== '{' ) {
5649
  throw new Error( 'font_picker => server list is not JSON.parse-able');
5650
  }
@@ -5691,6 +8132,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5691
  return selectFocusResults.promise();
5692
 
5693
  };//_preprocessSelect2ForFontFamily
 
 
 
 
5694
  var _setupSelectForFontFamilySelector = function( customResultsAdapter, fontCollections ) {
5695
  var _model = item(),
5696
  _googleFontsFilteredBySubset = function() {
@@ -5707,6 +8152,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5707
 
5708
  },
5709
  $fontSelectElement = $( 'select[data-czrtype="' + input.id + '"]', input.container );
 
 
 
5710
  var _generateFontOptions = function( fontList, type ) {
5711
  var _html_ = '';
5712
  _.each( fontList , function( font_data ) {
@@ -5726,11 +8174,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5726
  });
5727
  return _html_;
5728
  };
 
 
5729
  if ( _.isNull( input() ) || _.isEmpty( input() ) ) {
5730
  $fontSelectElement.append( '<option value="none" selected="selected">' + sektionsLocalizedData.i18n['Select a font family'] + '</option>' );
5731
  } else {
5732
  $fontSelectElement.append( '<option value="none">' + sektionsLocalizedData.i18n['Select a font family'] + '</option>' );
5733
  }
 
 
 
5734
  _.each( [
5735
  {
5736
  title : sektionsLocalizedData.i18n['Web Safe Fonts'],
@@ -5748,6 +8201,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5748
  });
5749
 
5750
  var _fonts_czrSelect2_params = {
 
 
 
5751
  escapeMarkup: function(m) { return m; },
5752
  };
5753
  /*
@@ -5759,13 +8215,24 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5759
  closeOnSelect: false,
5760
  } );
5761
  }
 
 
 
5762
  $fontSelectElement.czrSelect2( _fonts_czrSelect2_params );
5763
  $( '.czrSelect2-selection__rendered', input.container ).css( getInlineFontStyle( input() ) );
5764
 
5765
  };//_setupSelectForFontFamilySelector
 
 
 
 
 
5766
  var getInlineFontStyle = function( _fontFamily_ ){
 
5767
  if ( ! _.isString( _fontFamily_ ) || _.isEmpty( _fontFamily_ ) )
5768
  return {};
 
 
5769
  _fontFamily_ = _fontFamily_.replace('[gfont]', '').replace('[cfont]', '');
5770
 
5771
  var module = this,
@@ -5784,6 +8251,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5784
  'font-style' : font_style || 'normal'
5785
  };
5786
  };
 
 
 
 
5787
  var getFontFamilyName = function( rawFontFamily ) {
5788
  if ( ! _.isString( rawFontFamily ) || _.isEmpty( rawFontFamily ) )
5789
  return rawFontFamily;
@@ -5806,15 +8277,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5806
 
5807
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5808
  ( function ( api, $, _ ) {
 
5809
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
5810
  $.extend( api.czrInputMap, {
 
 
5811
  fa_icon_picker : function() {
5812
  var input = this,
5813
  _selected_found = false;
 
 
5814
  var _generateOptions = function( iconCollection ) {
5815
  _.each( iconCollection , function( iconClass ) {
5816
  var _attributes = {
5817
  value: iconClass,
 
5818
  html: api.CZR_Helpers.capitalize( iconClass.substring( 7 ) )
5819
  };
5820
 
@@ -5828,17 +8309,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5828
 
5829
  var addIcon = function ( state ) {
5830
  if (! state.id) { return state.text; }
 
 
5831
  var $state = $(
5832
  '<span class="' + state.element.value + '"></span><span class="social-name">&nbsp;&nbsp;' + state.text + '</span>'
5833
  );
5834
  return $state;
5835
  };
 
 
5836
  var $_placeholder;
5837
  if ( _selected_found ) {
5838
  $_placeholder = $('<option>');
5839
  } else {
5840
  $_placeholder = $('<option>', { selected: 'selected' } );
5841
  }
 
5842
  $( 'select[data-czrtype]', input.container )
5843
  .prepend( $_placeholder )
5844
  .czrSelect2({
@@ -5855,11 +8341,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5855
  if ( ! _.isEmpty( input.sek_faIconCollection ) ) {
5856
  _dfd_.resolve( input.sek_faIconCollection );
5857
  } else {
 
 
5858
  api.CZR_Helpers.getModuleTmpl( {
5859
  tmpl : 'icon_list',
5860
  module_type: 'fa_icon_picker_input',
5861
  module_id : input.module.id
5862
  } ).done( function( _serverTmpl_ ) {
 
5863
  if ( typeof _serverTmpl_ !== 'string' || _serverTmpl_[0] !== '[' ) {
5864
  throw new Error( 'fa_icon_picker => server list is not JSON.parse-able');
5865
  }
@@ -5869,14 +8358,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5869
  _dfd_.reject( _r_ );
5870
  });
5871
  }
 
5872
  });
5873
  };//_getIconsCollections
 
 
5874
  var _do_ = function( params ) {
5875
  if ( true === input.iconCollectionSet )
5876
  return;
5877
  $.when( _getIconsCollections() ).done( function( iconCollection ) {
5878
  _generateOptions( iconCollection );
5879
  if ( params && true === params.open_on_init ) {
 
5880
  _.delay( function() {
5881
  try{ $( 'select[data-czrtype]', input.container ).czrSelect2('open'); }catch(er) {}
5882
  }, 100 );
@@ -5886,9 +8379,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5886
  });
5887
  input.iconCollectionSet = true;
5888
  };
 
 
5889
  input.container.on('click', function() {
5890
  _do_();
5891
  });
 
 
5892
  _.delay( function() { _do_( { open_on_init : false } );}, 1000 );
5893
 
5894
  }
@@ -5896,7 +8393,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5896
 
5897
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
5898
  ( function ( api, $, _ ) {
 
5899
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
5900
  $.extend( api.czrInputMap, {
5901
  code_editor : function( input_options ) {
5902
  var input = this,
@@ -5906,15 +8409,43 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5906
  $textarea = input.container.find( 'textarea' ),
5907
  $input_title = input.container.find( '.customize-control-title' ),
5908
  editor_params = $textarea.data( 'editor-params' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5909
  if ( wp.codeEditor && ( _.isUndefined( editor_params ) || false !== editor_params ) ) {
 
5910
  editorSettings = editor_params;
5911
  }
5912
 
5913
  input.isReady.done( function() {
5914
  var _doInstantiate = function( evt ) {
5915
  var input = this;
 
5916
  if ( ! _.isEmpty( input.editor ) )
5917
  return;
 
5918
  if ( _.isEmpty( input.module.control.container.attr('data-sek-expanded') ) || "false" == input.module.control.container.attr('data-sek-expanded') )
5919
  return;
5920
 
@@ -5927,10 +8458,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5927
  } else {
5928
  initPlainTextareaEditor();
5929
  }
 
5930
  $input_title.click();
5931
  }, 10 );
5932
  };
 
5933
  _doInstantiate.call(input);
 
 
 
 
 
5934
  input.module.control.container.on('sek-accordion-expanded', function() {
5935
  _doInstantiate.call( input );
5936
  });
@@ -5951,6 +8489,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5951
  });
5952
 
5953
  input.editor = wp.codeEditor.initialize( $textarea, settings );
 
 
 
5954
  $( input.editor.codemirror.display.lineDiv )
5955
  .attr({
5956
  role: 'textbox',
@@ -5958,6 +8499,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5958
  'aria-label': $input_title.html(),
5959
  'aria-describedby': 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4'
5960
  });
 
 
5961
  $input_title.on( 'click', function( evt ) {
5962
  evt.stopPropagation();
5963
  input.editor.codemirror.focus();
@@ -5975,12 +8518,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
5975
  });
5976
 
5977
  input.editor.codemirror.setValue( input() );
 
 
5978
  /* TODO: check this */
5979
  input.bind( input.id + ':changed', function( value ) {
5980
  if ( ! suspendEditorUpdate ) {
5981
  input.editor.codemirror.setValue( value );
5982
  }
5983
  });
 
 
5984
  input.editor.codemirror.on( 'keydown', function onKeydown( codemirror, event ) {
5985
  var escKeyCode = 27;
5986
  if ( escKeyCode === event.keyCode ) {
@@ -6011,9 +8558,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6011
  }
6012
  return;
6013
  }
 
 
6014
  if ( tabKeyCode !== event.keyCode || event.ctrlKey || event.altKey || event.shiftKey ) {
6015
  return;
6016
  }
 
 
6017
  if ( $textarea.data( 'next-tab-blurs' ) ) {
6018
  return;
6019
  }
@@ -6057,13 +8608,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6057
  });//$.extend( api.czrInputMap, {})
6058
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6059
  ( function ( api, $, _ ) {
 
6060
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6061
  $.extend( api.czrInputMap, {
6062
  range_simple : function( params ) {
6063
  var input = this,
6064
  $wrapper = $('.sek-range-with-unit-picker-wrapper', input.container ),
6065
  $numberInput = $wrapper.find( 'input[type="number"]'),
6066
  $rangeInput = $wrapper.find( 'input[type="range"]');
 
 
 
6067
  $rangeInput.on('input', function( evt ) {
6068
  $numberInput.val( $(this).val() ).trigger('input');
6069
  });
@@ -6071,6 +8631,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6071
  input( $(this).val() );
6072
  $rangeInput.val( $(this).val() );
6073
  });
 
6074
  $rangeInput.val( $numberInput.val() || 0 );
6075
  },
6076
 
@@ -6079,7 +8640,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6079
 
6080
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6081
  ( function ( api, $, _ ) {
 
6082
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6083
  $.extend( api.czrInputMap, {
6084
  range_with_unit_picker : function( params ) {
6085
  var input = this,
@@ -6094,11 +8661,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6094
  }
6095
  return unit;
6096
  };
 
6097
  input.css_unit = new api.Value( _.isEmpty( initial_unit ) ? 'px' : validateUnit( initial_unit ) );
 
6098
  input.css_unit.bind( function( to ) {
6099
  to = _.isEmpty( to ) ? 'px' : to;
6100
  $wrapper.find( 'input[type="number"]').trigger('input');
6101
  });
 
 
 
6102
  $rangeInput.on('input', function( evt ) {
6103
  $numberInput.val( $(this).val() ).trigger('input');
6104
  });
@@ -6106,14 +8678,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6106
  input( $(this).val() + validateUnit( input.css_unit() ) );
6107
  $rangeInput.val( $(this).val() );
6108
  });
 
6109
  $rangeInput.val( $numberInput.val() || 0 );
 
 
6110
  $wrapper.on( 'click', '.sek-ui-button', function(evt) {
6111
  evt.preventDefault();
 
6112
  $wrapper.find('.sek-ui-button').removeClass('is-selected').attr( 'aria-pressed', false );
6113
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
 
6114
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
 
6115
  input.css_unit( $(this).data('sek-unit') );
6116
  });
 
 
6117
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ initial_unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
6118
  },
6119
 
@@ -6122,7 +8702,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6122
 
6123
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6124
  ( function ( api, $, _ ) {
 
6125
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6126
  $.extend( api.czrInputMap, {
6127
  range_with_unit_picker_device_switcher : function( params ) {
6128
  var input = this,
@@ -6136,6 +8722,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6136
  }
6137
  return unit;
6138
  },
 
6139
  _extractNumericVal = function( _rawVal ) {
6140
  return ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) ? '16' : _rawVal.replace(/px|em|%/g,'');
6141
  },
@@ -6148,6 +8735,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6148
  var getInitialUnit = function() {
6149
  return $wrapper.find('input[data-czrtype]').data('sek-unit') || 'px';
6150
  };
 
 
 
 
 
 
 
6151
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
6152
  var deviceHierarchy = [ 'mobile' , 'tablet', 'desktop' ];
6153
  if ( _.has( inputValues, currentDevice ) ) {
@@ -6162,7 +8756,12 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6162
  }
6163
  }
6164
  };
 
 
6165
  var syncWithPreviewedDevice = function( currentDevice ) {
 
 
 
6166
  var inputVal = input(), inputValues = {}, clonedDefault = $.extend( true, {}, defaultVal );
6167
  inputValues = clonedDefault;
6168
  if ( _.isObject( inputVal ) ) {
@@ -6170,25 +8769,55 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6170
  } else if ( _.isString( inputVal ) && ! _.isEmpty( inputVal ) ) {
6171
  inputValues = { desktop : inputVal };
6172
  }
 
 
6173
  var _rawVal = getCurrentDeviceActualOrInheritedValue( inputValues, currentDevice ),
6174
  _unit = _extractUnit( _rawVal ),
6175
  _numberVal = _extractNumericVal( _rawVal );
 
 
6176
  $('.sek-unit-wrapper', $wrapper).find('[data-sek-unit="' + _unit +'"]').trigger('click', { previewed_device_switched : true });// We don't want to update the input()
 
6177
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ _unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
 
 
6178
  $numberInput.val( _numberVal ).trigger('input', { previewed_device_switched : true });// We don't want to update the input()
6179
  };
 
 
 
 
 
6180
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
 
 
6181
  input.css_unit = new api.Value( _.isEmpty( getInitialUnit() ) ? 'px' : validateUnit( getInitialUnit() ) );
 
 
6182
  var resetButton = '<button type="button" class="button sek-reset-button sek-float-right">' + sektionsLocalizedData.i18n['Reset'] + '</button>';
6183
  input.container.find('.customize-control-title').append( resetButton );
 
 
 
 
 
 
 
 
 
 
6184
  input.css_unit.bind( function( to, from, params ) {
6185
  if ( _.isObject( params ) && true === params.previewed_device_switched )
6186
  return;
6187
  $numberInput.trigger('input');
6188
  });
 
 
 
6189
  $rangeInput.on('input', function( evt ) {
6190
  $numberInput.val( $(this).val() ).trigger('input');
6191
  });
 
6192
  $numberInput.on('input', function( evt, params ) {
6193
  var previewedDevice = api.previewedDevice() || 'desktop',
6194
  changedNumberInputVal = $(this).val() + validateUnit( input.css_unit() ),
@@ -6196,26 +8825,41 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6196
 
6197
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
6198
  _newInputVal[ previewedDevice ] = $.extend( true, {}, _newInputVal[ previewedDevice ] || {} );
 
 
6199
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) ) {
6200
  _newInputVal[ previewedDevice ]= changedNumberInputVal;
6201
  }
 
 
6202
  if ( _.isEmpty( params ) || ( _.isObject( params ) && true !== params.previewed_device_switched ) ) {
6203
  input( _newInputVal );
6204
  }
6205
  $rangeInput.val( $(this).val() );
6206
  });
 
 
6207
  $wrapper.on( 'click', '.sek-ui-button', function( evt, params ) {
 
6208
  evt.stopPropagation();
 
6209
  $wrapper.find('.sek-ui-button').removeClass('is-selected').attr( 'aria-pressed', false );
6210
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
 
6211
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
 
6212
  input.css_unit( $(this).data('sek-unit'), params );
6213
  });
 
 
 
6214
  input.previewedDevice.bind( function( currentDevice ) {
6215
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
6216
  api.errare('Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id ' + input.id , er );
6217
  }
6218
  });
 
 
6219
  input.container.on( 'click', '.sek-reset-button', function( evt ) {
6220
  var _currentDevice = api.previewedDevice(),
6221
  _newVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
@@ -6225,6 +8869,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6225
  syncWithPreviewedDevice( api.previewedDevice() );
6226
  }
6227
  });
 
 
 
 
6228
  $rangeInput.val( $numberInput.val() || 0 );
6229
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
6230
  api.errare('Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id ' + input.id , er );
@@ -6236,7 +8884,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6236
 
6237
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6238
  ( function ( api, $, _ ) {
 
6239
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6240
  $.extend( api.czrInputMap, {
6241
  borders : function( params ) {
6242
  var input = this,
@@ -6251,6 +8905,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6251
  }
6252
  return unit;
6253
  },
 
6254
  _extractNumericVal = function( _rawVal ) {
6255
  return ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) ? '16' : _rawVal.replace(/px|em|%/g,'');
6256
  },
@@ -6261,6 +8916,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6261
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
6262
 
6263
  input.cssBorderTypes = [ 'top', 'left', 'right', 'bottom' ];
 
 
6264
  var getInitialUnit = function() {
6265
  var inputVal = input(), initial_unit = 'px';
6266
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) && _.isObject( inputVal['_all_'] ) && ! _.isEmpty( inputVal['_all_'][ 'wght'] ) ) {
@@ -6268,6 +8925,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6268
  }
6269
  return initial_unit;
6270
  };
 
6271
  var getInitialWeight = function() {
6272
  var inputVal = input(), initial_weight = 1;
6273
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) && _.isObject( inputVal['_all_'] ) && ! _.isEmpty( inputVal['_all_'][ 'wght'] ) ) {
@@ -6280,6 +8938,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6280
  }
6281
  return initial_weight;
6282
  };
 
6283
  var getInitialColor = function() {
6284
  var inputVal = input(), initial_color = '#000000';
6285
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) && _.isObject( inputVal['_all_'] ) && ! _.isEmpty( inputVal['_all_'][ 'col'] ) ) {
@@ -6287,6 +8946,10 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6287
  }
6288
  return initial_color;
6289
  };
 
 
 
 
6290
  var getCurrentBorderTypeOrAllValue = function( inputValues, borderType ) {
6291
  var clonedDefaults = $.extend( true, {}, defaultVal ), _all_Value;
6292
  if ( ! _.has( clonedDefaults, '_all_' ) ) {
@@ -6300,10 +8963,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6300
  return clonedDefaults['_all_'];
6301
  }
6302
  };
 
 
6303
  var syncWithBorderType = function( borderType ) {
6304
  if ( ! _.contains( _.union( input.cssBorderTypes, [ '_all_' ] ) , borderType ) ) {
6305
  throw new Error( "Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'" );
6306
  }
 
 
 
 
6307
  var inputVal = input(), inputValues = {}, clonedDefault = $.extend( true, {}, defaultVal );
6308
  if ( _.isObject( inputVal ) ) {
6309
  inputValues = $.extend( true, {}, inputVal );
@@ -6311,6 +8980,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6311
  inputValues = { _all_ : { wght : inputVal } };
6312
  }
6313
  inputValues = $.extend( clonedDefault, inputValues );
 
 
6314
  var _rawVal = getCurrentBorderTypeOrAllValue( inputValues, borderType ), _unit, _numberVal;
6315
  if ( _.isEmpty( _rawVal ) || ! _.isObject( _rawVal ) || _.isEmpty( _rawVal.wght ) || _.isEmpty( _rawVal.col ) ) {
6316
  throw new Error( "Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");
@@ -6318,48 +8989,103 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6318
 
6319
  _unit = _extractUnit( _rawVal.wght );
6320
  _numberVal = _extractNumericVal( _rawVal.wght );
 
 
6321
  $('.sek-unit-wrapper', $wrapper).find('[data-sek-unit="' + _unit +'"]').trigger('click', { border_type_switched : true });// We don't want to update the input()
 
6322
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ _unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
 
6323
  $numberInput.val( _numberVal ).trigger('input', { border_type_switched : true });// We don't want to update the input()
 
 
 
6324
  $colorInput.data('border_type_switched', true );
6325
  $colorInput.val( _rawVal.col ).trigger( 'change' );
6326
  $colorInput.data('border_type_switched', false );
6327
  };
 
 
 
 
 
 
6328
  input.borderColor = new api.Value( _.isEmpty( getInitialColor() ) ? '#000000' : getInitialColor() );
 
6329
  input.css_unit = new api.Value( _.isEmpty( getInitialUnit() ) ? 'px' : validateUnit( getInitialUnit() ) );
 
6330
  input.borderType = new api.Value( '_all_');
 
6331
  $numberInput.val( getInitialWeight() );
 
6332
  $colorInput.val( input.borderColor() );
6333
  $colorInput.wpColorPicker({
6334
  palettes: true,
 
6335
  width: window.innerWidth >= 1440 ? 271 : 251,
6336
  change : function( evt, o ) {
 
 
 
 
 
 
 
 
6337
  $(this).val( o.color.toString() ).trigger('colorpickerchange');
6338
  input.borderColor( o.color.toString(), { border_type_switched : true === $(this).data('border_type_switched') } );
 
 
 
 
 
 
6339
  },
6340
  clear : function( e, o ) {
6341
  $(this).val('').trigger('colorpickerchange');
6342
  input.borderColor('');
6343
  }
6344
  });
 
 
 
 
 
 
 
 
 
 
6345
  input.css_unit.bind( function( to, from, params ) {
 
6346
  if ( _.isObject( params ) && ( true === params.border_type_switched || true === params.initializing_the_unit ) )
6347
  return;
6348
  $numberInput.trigger('input', params);
6349
  });
 
 
 
 
6350
  input.borderColor.bind( function( to, from, params ) {
 
6351
  if ( _.isObject( params ) && ( true === params.border_type_switched || true === params.initializing_the_color ) )
6352
  return;
6353
  $numberInput.trigger('input', params);
6354
  });
 
 
6355
  input.borderType.bind( function( borderType ) {
6356
  try { syncWithBorderType( borderType ); } catch( er ) {
6357
  api.errare('Error when firing syncWithBorderType for input type borders for module type ' + input.module.module_type , er );
6358
  }
6359
  });
 
 
 
6360
  $rangeInput.on('input', function( evt ) {
6361
  $numberInput.val( $(this).val() ).trigger('input');
6362
  });
 
 
6363
  $numberInput.on('input', function( evt, params ) {
6364
  var currentBorderType = input.borderType() || '_all_',
6365
  currentColor = input.borderColor(),
@@ -6369,10 +9095,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6369
 
6370
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : clonedDefaults );
6371
  _newInputVal[ currentBorderType ] = $.extend( true, {}, _newInputVal[ currentBorderType ] || clonedDefaults[ currentBorderType ] );
 
 
6372
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) ) {
6373
  _newInputVal[ currentBorderType ][ 'wght' ] = changedNumberInputVal;
6374
  }
 
6375
  _newInputVal[ currentBorderType ][ 'col' ] = currentColor;
 
 
 
6376
  if ( _.isEmpty( params ) || ( _.isObject( params ) && true !== params.border_type_switched ) ) {
6377
  if ( '_all_' === currentBorderType ) {
6378
  _.each( input.cssBorderTypes, function( _type ) {
@@ -6381,17 +9113,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6381
  }
6382
  input( _newInputVal );
6383
  }
 
6384
  $rangeInput.val( $(this).val() );
6385
  });
 
 
 
6386
  $wrapper.on( 'click', '[data-sek-unit]', function( evt, params ) {
6387
  evt.preventDefault();
 
6388
  $wrapper.find('[data-sek-unit]').removeClass('is-selected').attr( 'aria-pressed', false );
6389
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
 
6390
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
 
6391
  input.css_unit( $(this).data('sek-unit'), params );
6392
  });
 
 
6393
  $wrapper.on( 'click', '[data-sek-border-type]', function( evt, params ) {
6394
  evt.preventDefault();
 
6395
  $wrapper.find('[data-sek-border-type]').removeClass('is-selected').attr( 'aria-pressed', false );
6396
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
6397
  var border = '_all_';
@@ -6400,6 +9142,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6400
  }
6401
  input.borderType( border, params );
6402
  });
 
 
6403
  input.container.on( 'click', '.sek-reset-button', function( evt ) {
6404
  var currentBorderType = input.borderType() || '_all_',
6405
  _newVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
@@ -6409,10 +9153,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6409
  syncWithBorderType( currentBorderType );
6410
  }
6411
  });
 
 
 
 
 
 
 
 
 
 
6412
  $rangeInput.val( $numberInput.val() || 0 );
6413
  try { syncWithBorderType( input.borderType() ); } catch( er ) {
6414
  api.errare('Error when firing syncWithBorderType for input type borders for module type ' + input.module.module_type , er );
6415
  }
 
 
6416
  $( '[data-sek-unit="' + input.css_unit() + '"]', $wrapper ).trigger('click', { initializing_the_unit : true } );
6417
  },
6418
 
@@ -6421,7 +9177,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6421
 
6422
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6423
  ( function ( api, $, _ ) {
 
6424
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6425
  $.extend( api.czrInputMap, {
6426
  border_radius : function( params ) {
6427
  var input = this,
@@ -6435,6 +9197,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6435
  }
6436
  return unit;
6437
  },
 
6438
  _extractNumericVal = function( _rawVal ) {
6439
  return ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) ? '16' : _rawVal.replace(/px|em|%/g,'');
6440
  },
@@ -6445,6 +9208,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6445
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
6446
 
6447
  input.cssRadiusTypes = [ 'top_left','top_right','bottom_right','bottom_left' ];
 
 
6448
  var getInitialUnit = function() {
6449
  var inputVal = input(), initial_unit = 'px';
6450
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) ) {
@@ -6452,6 +9217,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6452
  }
6453
  return initial_unit;
6454
  };
 
6455
  var getInitialRadius = function() {
6456
  var inputVal = input(), initial_rad = 0;
6457
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) ) {
@@ -6464,6 +9230,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6464
  }
6465
  return initial_rad;
6466
  };
 
 
 
 
 
6467
  var getCurrentRadiusTypeOrAllValue = function( inputValues, radiusType ) {
6468
  var clonedDefaults = $.extend( true, {}, defaultVal ), _all_Value;
6469
  if ( ! _.has( clonedDefaults, '_all_' ) ) {
@@ -6477,10 +9248,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6477
  return _all_Value;
6478
  }
6479
  };
 
 
6480
  var syncWithRadiusType = function( radiusType ) {
6481
  if ( ! _.contains( [ '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left' ], radiusType ) ) {
6482
  throw new Error( "Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => " + radiusType );
6483
  }
 
 
 
 
6484
  var inputVal = input(), inputValues = {}, clonedDefault = $.extend( true, {}, defaultVal );
6485
  if ( _.isObject( inputVal ) ) {
6486
  inputValues = $.extend( true, {}, inputVal );
@@ -6488,6 +9265,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6488
  inputValues = { _all_ : '0px' };
6489
  }
6490
  inputValues = $.extend( clonedDefault, inputValues );
 
 
6491
  var _rawVal = getCurrentRadiusTypeOrAllValue( inputValues, radiusType ), _unit, _numberVal;
6492
  if ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) {
6493
  throw new Error( "Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");
@@ -6495,26 +9274,61 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6495
 
6496
  _unit = _extractUnit( _rawVal );
6497
  _numberVal = _extractNumericVal( _rawVal );
 
 
6498
  $('.sek-unit-wrapper', $wrapper).find('[data-sek-unit="' + _unit +'"]').trigger('click', { radius_type_switched : true });// We don't want to update the input()
 
6499
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ _unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
 
6500
  $numberInput.val( _numberVal ).trigger('input', { radius_type_switched : true });// We don't want to update the input()
6501
  };
 
 
 
 
 
 
 
 
 
6502
  input.css_unit = new api.Value( _.isEmpty( getInitialUnit() ) ? 'px' : validateUnit( getInitialUnit() ) );
 
6503
  input.radiusType = new api.Value('_all_');
 
6504
  $numberInput.val( getInitialRadius() );
 
 
 
 
 
 
 
 
 
 
 
 
6505
  input.css_unit.bind( function( to, from, params ) {
 
6506
  if ( _.isObject( params ) && ( true === params.radius_type_switched || true === params.initializing_the_unit ) )
6507
  return;
6508
  $numberInput.trigger('input', params);
6509
  });
 
 
6510
  input.radiusType.bind( function( radiusType ) {
6511
  try { syncWithRadiusType( radiusType ); } catch( er ) {
6512
  api.errare('Error when firing syncWithRadiusType for input type border_radius for module type ' + input.module.module_type , er );
6513
  }
6514
  });
 
 
 
6515
  $rangeInput.on('input', function( evt ) {
6516
  $numberInput.val( $(this).val() ).trigger('input');
6517
  });
 
 
6518
  $numberInput.on('input', function( evt, params ) {
6519
  var currentRadiusType = input.radiusType() || '_all_',
6520
  changedNumberInputVal = $(this).val() + validateUnit( input.css_unit() ),
@@ -6523,9 +9337,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6523
 
6524
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : clonedDefaults );
6525
  _newInputVal[ currentRadiusType ] = $.extend( true, {}, _newInputVal[ currentRadiusType ] || clonedDefaults[ currentRadiusType ] );
 
 
6526
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) ) {
6527
  _newInputVal[ currentRadiusType ] = changedNumberInputVal;
6528
  }
 
 
6529
  if ( _.isEmpty( params ) || ( _.isObject( params ) && true !== params.radius_type_switched ) ) {
6530
  if ( '_all_' === currentRadiusType ) {
6531
  _.each( input.cssRadiusTypes, function( _type ) {
@@ -6534,17 +9352,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6534
  }
6535
  input( _newInputVal );
6536
  }
 
6537
  $rangeInput.val( $(this).val() );
6538
  });
 
 
 
6539
  $wrapper.on( 'click', '[data-sek-unit]', function( evt, params ) {
6540
  evt.preventDefault();
 
6541
  $wrapper.find('[data-sek-unit]').removeClass('is-selected').attr( 'aria-pressed', false );
6542
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
 
6543
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
 
6544
  input.css_unit( $(this).data('sek-unit'), params );
6545
  });
 
 
6546
  $wrapper.on( 'click', '[data-sek-radius-type]', function( evt, params ) {
6547
  evt.preventDefault();
 
6548
  $wrapper.find('[data-sek-radius-type]').removeClass('is-selected').attr( 'aria-pressed', false );
6549
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
6550
  var border = '_all_';
@@ -6553,6 +9381,8 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6553
  }
6554
  input.radiusType( border, params );
6555
  });
 
 
6556
  input.container.on( 'click', '.sek-reset-button', function( evt ) {
6557
  var currentRadiusType = input.radiusType() || '_all_',
6558
  _newVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
@@ -6562,10 +9392,22 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6562
  syncWithRadiusType( currentRadiusType );
6563
  }
6564
  });
 
 
 
 
 
 
 
 
 
 
6565
  $rangeInput.val( $numberInput.val() || 0 );
6566
  try { syncWithRadiusType( input.radiusType() ); } catch( er ) {
6567
  api.errare('Error when firing syncWithRadiusType for input type border_radius for module type ' + input.module.module_type , er );
6568
  }
 
 
6569
  $( '[data-sek-unit="' + input.css_unit() + '"]', $wrapper ).trigger('click', { initializing_the_unit : true } );
6570
  },
6571
 
@@ -6574,7 +9416,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6574
 
6575
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6576
  ( function ( api, $, _ ) {
 
6577
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6578
  $.extend( api.czrInputMap, {
6579
  buttons_choice : function( params ) {
6580
  var input = this,
@@ -6582,9 +9430,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6582
  $mainInput = $wrapper.find( 'input[type="number"]'),
6583
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
6584
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
 
 
 
6585
  $mainInput.val( input() );
 
 
6586
  $wrapper.on( 'click', '[data-sek-choice]', function( evt, params ) {
6587
  evt.stopPropagation();
 
6588
  $wrapper.find('[data-sek-choice]').removeClass('is-selected').attr( 'aria-pressed', false );
6589
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
6590
  var newChoice;
@@ -6593,15 +9447,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6593
  }
6594
  input( newChoice );
6595
  });
 
 
 
 
 
6596
  $( '[data-sek-choice="' + input() + '"]', $wrapper ).trigger('click', { initializing_the_unit : true } );
6597
  }
6598
  });//$.extend( api.czrInputMap, {})
6599
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
6600
  ( function ( api, $, _ ) {
 
6601
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
 
6602
  $.extend( api.czrInputMap, {
6603
  reset_button : function( params ) {
6604
  var input = this;
 
 
6605
  input.container.on( 'click', '[data-sek-reset-scope]', function( evt, params ) {
6606
  evt.stopPropagation();
6607
  var scope = $(this).data( 'sek-reset-scope' );
@@ -6614,13 +9481,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6614
  }
6615
  });//$.extend( api.czrInputMap, {})
6616
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
6617
  /* ------------------------------------------------------------------------- *
6618
  * CONTENT TYPE SWITCHER
6619
  /* ------------------------------------------------------------------------- */
6620
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
6621
  api.czrModuleMap = api.czrModuleMap || {};
6622
  $.extend( api.czrModuleMap, {
6623
  sek_content_type_switcher_module : {
 
6624
  crud : false,
6625
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_content_type_switcher_module', 'name' ),
6626
  has_mod_opt : false,
@@ -6633,6 +9510,9 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6633
  });
6634
 
6635
  api.czrInputMap = api.czrInputMap || {};
 
 
 
6636
  $.extend( api.czrInputMap, {
6637
  content_type_switcher : function( input_options ) {
6638
  var input = this,
@@ -6643,8 +9523,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6643
  throw new Error( 'api.czrInputMap.content_type_switcher => section not registered' );
6644
  }
6645
  _section_ = api.section( input.module.control.section() );
 
 
6646
  input.container.on('click', '[data-sek-content-type]', function( evt ) {
6647
  evt.preventDefault();
 
6648
  input.container.find('[data-sek-content-type]').removeClass('is-selected').attr( 'aria-pressed', false );
6649
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
6650
  api.czr_sektions.currentContentPickerType( $(this).data( 'sek-content-type') );
@@ -6659,8 +9542,13 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6659
  }
6660
  });
6661
  };
 
 
 
6662
  api.czr_sektions.currentContentPickerType = api.czr_sektions.currentContentPickerType || new api.Value( input() );
6663
  _do_( api.czr_sektions.currentContentPickerType() );
 
 
6664
  api.czr_sektions.currentContentPickerType.bind( function( contentType ) {
6665
  _do_( contentType );
6666
  });
@@ -6675,10 +9563,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6675
  /* ------------------------------------------------------------------------- *
6676
  * MODULE PICKER MODULE
6677
  /* ------------------------------------------------------------------------- */
 
 
6678
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
6679
  api.czrModuleMap = api.czrModuleMap || {};
6680
  $.extend( api.czrModuleMap, {
6681
  sek_module_picker_module : {
 
6682
  crud : false,
6683
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_module_picker_module', 'name' ),
6684
  has_mod_opt : false,
@@ -6691,10 +9590,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6691
  });
6692
 
6693
  api.czrInputMap = api.czrInputMap || {};
 
 
 
 
6694
  $.extend( api.czrInputMap, {
6695
  module_picker : function( input_options ) {
6696
  var input = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
6697
  api.czr_sektions.trigger( 'sek-refresh-dragzones', { type : 'module', input_container : input.container } );
 
6698
  }
6699
  });
6700
  })( wp.customize , jQuery, _ );
@@ -6705,6 +9622,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6705
  * SECTION PICKER MODULES
6706
  /* ------------------------------------------------------------------------- */
6707
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
6708
  api.czrModuleMap = api.czrModuleMap || {};
6709
  var section_modules = [
6710
  'sek_intro_sec_picker_module',
@@ -6712,11 +9637,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6712
  'sek_contact_sec_picker_module',
6713
  'sek_column_layouts_sec_picker_module'
6714
  ];
 
 
6715
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
6716
  section_modules = _.union( section_modules, [ 'sek_header_sec_picker_module','sek_footer_sec_picker_module' ] );
6717
  }
6718
  _.each( section_modules, function( module_type ) {
6719
  api.czrModuleMap[ module_type ] = {
 
6720
  crud : false,
6721
  name : api.czr_sektions.getRegisteredModuleProperty( module_type, 'name' ),
6722
  has_mod_opt : false,
@@ -6737,10 +9665,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6737
  /* ------------------------------------------------------------------------- *
6738
  * MY SECTIONS MODULE
6739
  /* ------------------------------------------------------------------------- */
 
 
6740
  ( function ( api, $, _ ) {
6741
  var Constructor = {
6742
  initialize: function( id, options ) {
6743
  var module = this;
 
 
6744
  module.inputConstructor = api.CZRInput.extend({
6745
  initialize : function( name, options ) {
6746
  var input = this;
@@ -6757,6 +9689,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6757
  html = '',
6758
  $wrapper = input.container.find('.sek-content-type-wrapper'),
6759
  creation_date = '',
 
6760
  formatDate = function(date) {
6761
  var monthNames = [
6762
  "January", "February", "March",
@@ -6776,6 +9709,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6776
  day,
6777
  monthNames[monthIndex],
6778
  year
 
6779
  ].join(' ');
6780
  };
6781
 
@@ -6797,9 +9731,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6797
  });
6798
  }
6799
  });
 
 
 
 
6800
  api.CZRDynModule.prototype.initialize.call( module, id, options );
 
 
 
 
6801
  },//initialize
6802
  };
 
 
 
 
 
 
 
 
 
 
6803
  api.czrModuleMap = api.czrModuleMap || {};
6804
  if ( sektionsLocalizedData.isSavedSectionEnabled ) {
6805
  $.extend( api.czrModuleMap, {
@@ -6826,17 +9778,43 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6826
  /* ------------------------------------------------------------------------- */
6827
  ( function ( api, $, _ ) {
6828
  api.czrInputMap = api.czrInputMap || {};
 
 
 
6829
  $.extend( api.czrInputMap, {
6830
  section_picker : function( input_options ) {
6831
  var input = this;
 
 
 
 
 
 
 
 
 
 
 
 
 
6832
  api.czr_sektions.trigger( 'sek-refresh-dragzones', { type : 'preset_section', input_container : input.container } );
6833
  }
6834
  });
6835
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
6836
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
6837
  api.czrModuleMap = api.czrModuleMap || {};
6838
  $.extend( api.czrModuleMap, {
6839
  sek_level_anchor_module : {
 
6840
  crud : false,
6841
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_level_anchor_module', 'name' ),
6842
  has_mod_opt : false,
@@ -6849,12 +9827,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6849
  },
6850
  });
6851
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
6852
  ( function ( api, $, _ ) {
6853
  var Constructor = {
6854
  initialize: function( id, options ) {
 
6855
  var module = this;
 
 
6856
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
 
6857
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
6858
  api.CZRDynModule.prototype.initialize.call( module, id, options );
6859
  },//initialize
6860
 
@@ -6866,8 +9851,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6866
  },//CZRInputMths
6867
 
6868
  CZRItemConstructor : {
 
6869
  ready : function() {
6870
  var item = this;
 
 
6871
  item.inputCollection.bind( function( col ) {
6872
  if( _.isEmpty( col ) )
6873
  return;
@@ -6875,11 +9863,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6875
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
6876
  }
6877
  });//item.inputCollection.bind()
 
 
6878
  api.CZRItem.prototype.ready.call( item );
6879
  },
 
 
 
 
6880
  setInputVisibilityDeps : function() {
6881
  var item = this,
6882
  module = item.module;
 
6883
  item.czr_Input.each( function( input ) {
6884
  switch( input.id ) {
6885
  case 'bg-image' :
@@ -6935,6 +9930,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6935
  api.errare( module.id + ' => error in setInputVisibilityDeps', er );
6936
  }
6937
  });
 
6938
  input.bind( function( to ) {
6939
  if ( api.CZR_Helpers.isChecked( input() ) ) {
6940
  if ( api.CZR_Helpers.isChecked( item.czr_Input('bg-attachment')()) ) {
@@ -6944,6 +9940,7 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6944
  });
6945
  break;
6946
  case 'bg-attachment' :
 
6947
  input.bind( function( to ) {
6948
  if ( api.CZR_Helpers.isChecked( input() ) ) {
6949
  if ( api.CZR_Helpers.isChecked( item.czr_Input('bg-parallax')()) ) {
@@ -6957,6 +9954,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6957
  }
6958
  }//CZRItemConstructor
6959
  };
 
 
 
 
 
 
 
 
 
 
6960
  api.czrModuleMap = api.czrModuleMap || {};
6961
  $.extend( api.czrModuleMap, {
6962
  sek_level_bg_module : {
@@ -6973,12 +9980,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6973
  },
6974
  });
6975
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
6976
  ( function ( api, $, _ ) {
6977
  var Constructor = {
6978
  initialize: function( id, options ) {
 
6979
  var module = this;
 
 
6980
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
 
6981
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
6982
  api.CZRDynModule.prototype.initialize.call( module, id, options );
6983
  },//initialize
6984
 
@@ -6990,8 +10004,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6990
  },//CZRInputMths
6991
 
6992
  CZRItemConstructor : {
 
6993
  ready : function() {
6994
  var item = this;
 
 
6995
  item.inputCollection.bind( function( col ) {
6996
  if( _.isEmpty( col ) )
6997
  return;
@@ -6999,11 +10016,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
6999
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7000
  }
7001
  });//item.inputCollection.bind()
 
 
7002
  api.CZRItem.prototype.ready.call( item );
7003
  },
 
 
 
 
7004
  setInputVisibilityDeps : function() {
7005
  var item = this,
7006
  module = item.module;
 
7007
  item.czr_Input.each( function( input ) {
7008
  switch( input.id ) {
7009
  case 'border-type' :
@@ -7020,6 +10044,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7020
  }
7021
  }//CZRItemConstructor
7022
  };
 
 
 
 
 
 
 
 
 
 
7023
  api.czrModuleMap = api.czrModuleMap || {};
7024
  $.extend( api.czrModuleMap, {
7025
  sek_level_border_module : {
@@ -7036,18 +10070,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7036
  },
7037
  });
7038
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7039
  ( function ( api, $, _ ) {
7040
  var Constructor = {
7041
  initialize: function( id, options ) {
7042
  var module = this;
 
 
 
7043
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7044
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7045
 
7046
  },//initialize
7047
 
 
 
 
 
 
 
7048
  CZRItemConstructor : {
 
7049
  ready : function() {
7050
  var item = this;
 
 
7051
  item.inputCollection.bind( function( col ) {
7052
  if( _.isEmpty( col ) )
7053
  return;
@@ -7055,11 +10103,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7055
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7056
  }
7057
  });//item.inputCollection.bind()
 
 
7058
  api.CZRItem.prototype.ready.call( item );
7059
  },
 
 
 
 
7060
  setInputVisibilityDeps : function() {
7061
  var item = this,
7062
  module = item.module;
 
7063
  item.czr_Input.each( function( input ) {
7064
  switch( input.id ) {
7065
  case 'use-custom-breakpoint' :
@@ -7072,6 +10127,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7072
  }
7073
  }//CZRItemConstructor
7074
  };
 
 
 
 
 
 
 
 
 
7075
  api.czrModuleMap = api.czrModuleMap || {};
7076
  $.extend( api.czrModuleMap, {
7077
  sek_level_breakpoint_module : {
@@ -7088,12 +10152,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7088
  },
7089
  });
7090
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7091
  ( function ( api, $, _ ) {
7092
  var Constructor = {
7093
  initialize: function( id, options ) {
7094
  var module = this;
 
7095
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
 
7096
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7097
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7098
 
7099
  },//initialize
@@ -7105,8 +10173,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7105
  },//CZRInputMths
7106
 
7107
  CZRItemConstructor : {
 
7108
  ready : function() {
7109
  var item = this;
 
 
7110
  item.inputCollection.bind( function( col ) {
7111
  if( _.isEmpty( col ) )
7112
  return;
@@ -7114,11 +10185,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7114
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7115
  }
7116
  });//item.inputCollection.bind()
 
 
7117
  api.CZRItem.prototype.ready.call( item );
7118
  },
 
 
 
 
7119
  setInputVisibilityDeps : function() {
7120
  var item = this,
7121
  module = item.module;
 
7122
  item.czr_Input.each( function( input ) {
7123
  switch( input.id ) {
7124
  case 'height-type' :
@@ -7135,6 +10213,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7135
  }
7136
  }//CZRItemConstructor
7137
  };
 
 
 
 
 
 
 
 
 
 
7138
  api.czrModuleMap = api.czrModuleMap || {};
7139
  $.extend( api.czrModuleMap, {
7140
  sek_level_height_module : {
@@ -7151,10 +10239,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7151
  },
7152
  });
7153
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7154
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
7155
  api.czrModuleMap = api.czrModuleMap || {};
7156
  $.extend( api.czrModuleMap, {
7157
  sek_level_visibility_module : {
 
7158
  crud : false,
7159
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_level_visibility_module', 'name' ),
7160
  has_mod_opt : false,
@@ -7167,12 +10265,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7167
  },
7168
  });
7169
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7170
  ( function ( api, $, _ ) {
7171
  var Constructor = {
7172
  initialize: function( id, options ) {
7173
  var module = this;
 
7174
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
 
7175
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7176
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7177
 
7178
  },//initialize
@@ -7184,8 +10286,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7184
  },//CZRInputMths
7185
 
7186
  CZRItemConstructor : {
 
7187
  ready : function() {
7188
  var item = this;
 
 
7189
  item.inputCollection.bind( function( col ) {
7190
  if( _.isEmpty( col ) )
7191
  return;
@@ -7193,11 +10298,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7193
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7194
  }
7195
  });//item.inputCollection.bind()
 
 
7196
  api.CZRItem.prototype.ready.call( item );
7197
  },
 
 
 
 
7198
  setInputVisibilityDeps : function() {
7199
  var item = this,
7200
  module = item.module;
 
 
7201
  item.czr_Input.each( function( input ) {
7202
  switch( input.id ) {
7203
  case 'width-type' :
@@ -7213,6 +10326,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7213
  }
7214
  }//CZRItemConstructor
7215
  };
 
 
 
 
 
 
 
 
 
 
7216
  api.czrModuleMap = api.czrModuleMap || {};
7217
  $.extend( api.czrModuleMap, {
7218
  sek_level_width_module : {
@@ -7229,12 +10352,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7229
  },
7230
  });
7231
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7232
  ( function ( api, $, _ ) {
7233
  var Constructor = {
7234
  initialize: function( id, options ) {
7235
  var module = this;
 
7236
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
 
7237
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7238
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7239
 
7240
  },//initialize
@@ -7246,8 +10373,11 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7246
  },//CZRInputMths
7247
 
7248
  CZRItemConstructor : {
 
7249
  ready : function() {
7250
  var item = this;
 
 
7251
  item.inputCollection.bind( function( col ) {
7252
  if( _.isEmpty( col ) )
7253
  return;
@@ -7255,11 +10385,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7255
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7256
  }
7257
  });//item.inputCollection.bind()
 
 
7258
  api.CZRItem.prototype.ready.call( item );
7259
  },
 
 
 
 
7260
  setInputVisibilityDeps : function() {
7261
  var item = this,
7262
  module = item.module;
 
 
7263
  item.czr_Input.each( function( input ) {
7264
  switch( input.id ) {
7265
  case 'use-custom-outer-width' :
@@ -7277,6 +10415,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7277
  }
7278
  }//CZRItemConstructor
7279
  };
 
 
 
 
 
 
 
 
 
 
7280
  api.czrModuleMap = api.czrModuleMap || {};
7281
  $.extend( api.czrModuleMap, {
7282
  sek_level_width_section : {
@@ -7293,7 +10441,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7293
  },
7294
  });
7295
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7296
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
7297
  api.czrModuleMap = api.czrModuleMap || {};
7298
  $.extend( api.czrModuleMap, {
7299
  sek_level_spacing_module : {
@@ -7310,19 +10467,34 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7310
  },
7311
  });
7312
  })( wp.customize , jQuery, _ );
 
 
7313
  ( function ( api, $, _ ) {
7314
  var Constructor = {
7315
  initialize: function( id, options ) {
7316
  var module = this;
 
7317
  module.inputConstructor = api.CZRInput.extend({
7318
  setupSelect : function() {
7319
  api.czr_sektions.setupSelectInput.call( this );
7320
  }
7321
  });
 
 
 
7322
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7323
 
7324
  }//initialize
7325
  };
 
 
 
 
 
 
 
 
 
7326
  api.czrModuleMap = api.czrModuleMap || {};
7327
  $.extend( api.czrModuleMap, {
7328
  sek_local_template : {
@@ -7338,23 +10510,30 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7338
  },
7339
  });
7340
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7341
  ( function ( api, $, _ ) {
7342
  var Constructor = {
7343
  initialize: function( id, options ) {
7344
  var module = this;
 
7345
  module.inputConstructor = api.CZRInput.extend({
7346
  setupSelect : function() {
7347
  api.czr_sektions.setupSelectInput.call( this );
7348
  }
7349
  });
 
7350
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7351
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7352
 
7353
  },//initialize
7354
 
7355
  CZRItemConstructor : {
 
7356
  ready : function() {
7357
  var item = this;
 
 
7358
  item.inputCollection.bind( function( col ) {
7359
  if( _.isEmpty( col ) )
7360
  return;
@@ -7362,11 +10541,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7362
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7363
  }
7364
  });//item.inputCollection.bind()
 
 
7365
  api.CZRItem.prototype.ready.call( item );
7366
  },
 
 
 
 
7367
  setInputVisibilityDeps : function() {
7368
  var item = this,
7369
  module = item.module;
 
 
7370
  item.czr_Input.each( function( input ) {
7371
  switch( input.id ) {
7372
  case 'use-custom-outer-width' :
@@ -7384,6 +10571,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7384
  }
7385
  }//CZRItemConstructor
7386
  };
 
 
 
 
 
 
 
 
 
 
7387
  api.czrModuleMap = api.czrModuleMap || {};
7388
  $.extend( api.czrModuleMap, {
7389
  sek_local_widths : {
@@ -7399,10 +10596,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7399
  },
7400
  });
7401
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7402
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
 
7403
  api.czrModuleMap = api.czrModuleMap || {};
7404
  $.extend( api.czrModuleMap, {
7405
  sek_local_custom_css : {
 
7406
  crud : false,
7407
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_local_custom_css', 'name' ),
7408
  has_mod_opt : false,
@@ -7414,10 +10622,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7414
  },
7415
  });
7416
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7417
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
 
7418
  api.czrModuleMap = api.czrModuleMap || {};
7419
  $.extend( api.czrModuleMap, {
7420
  sek_local_reset : {
 
7421
  crud : false,
7422
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_local_reset', 'name' ),
7423
  has_mod_opt : false,
@@ -7429,19 +10648,32 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7429
  },
7430
  });
7431
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7432
  ( function ( api, $, _ ) {
7433
  var Constructor = {
7434
  initialize: function( id, options ) {
7435
  var module = this;
 
7436
  module.inputConstructor = api.CZRInput.extend({
7437
  setupSelect : function() {
7438
  api.czr_sektions.setupSelectInput.call( this );
7439
  }
7440
  });
 
 
 
7441
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7442
 
7443
  }//initialize
7444
  };
 
 
 
 
 
 
 
 
7445
  api.czrModuleMap = api.czrModuleMap || {};
7446
  $.extend( api.czrModuleMap, {
7447
  sek_local_performances : {
@@ -7457,19 +10689,33 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7457
  },
7458
  });
7459
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7460
  ( function ( api, $, _ ) {
7461
  var Constructor = {
7462
  initialize: function( id, options ) {
7463
  var module = this;
 
7464
  module.inputConstructor = api.CZRInput.extend({
7465
  setupSelect : function() {
7466
  api.czr_sektions.setupSelectInput.call( this );
7467
  }
7468
  });
 
 
 
7469
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7470
 
7471
  }//initialize
7472
  };
 
 
 
 
 
 
 
 
 
7473
  api.czrModuleMap = api.czrModuleMap || {};
7474
  $.extend( api.czrModuleMap, {
7475
  sek_local_header_footer : {
@@ -7485,23 +10731,30 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7485
  },
7486
  });
7487
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7488
  ( function ( api, $, _ ) {
7489
  var Constructor = {
7490
  initialize: function( id, options ) {
7491
  var module = this;
 
7492
  module.inputConstructor = api.CZRInput.extend({
7493
  setupSelect : function() {
7494
  api.czr_sektions.setupSelectInput.call( this );
7495
  }
7496
  });
 
7497
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7498
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7499
 
7500
  },//initialize
7501
 
7502
  CZRItemConstructor : {
 
7503
  ready : function() {
7504
  var item = this;
 
 
7505
  item.inputCollection.bind( function( col ) {
7506
  if( _.isEmpty( col ) )
7507
  return;
@@ -7509,11 +10762,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7509
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7510
  }
7511
  });//item.inputCollection.bind()
 
 
7512
  api.CZRItem.prototype.ready.call( item );
7513
  },
 
 
 
 
7514
  setInputVisibilityDeps : function() {
7515
  var item = this,
7516
  module = item.module;
 
 
7517
  item.czr_Input.each( function( input ) {
7518
  switch( input.id ) {
7519
  case 'use-custom-breakpoint' :
@@ -7526,6 +10787,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7526
  }
7527
  }//CZRItemConstructor
7528
  };
 
 
 
 
 
 
 
 
 
 
7529
  api.czrModuleMap = api.czrModuleMap || {};
7530
  $.extend( api.czrModuleMap, {
7531
  sek_global_breakpoint : {
@@ -7541,23 +10812,30 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7541
  },
7542
  });
7543
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7544
  ( function ( api, $, _ ) {
7545
  var Constructor = {
7546
  initialize: function( id, options ) {
7547
  var module = this;
 
7548
  module.inputConstructor = api.CZRInput.extend({
7549
  setupSelect : function() {
7550
  api.czr_sektions.setupSelectInput.call( this );
7551
  }
7552
  });
 
7553
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7554
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7555
 
7556
  },//initialize
7557
 
7558
  CZRItemConstructor : {
 
7559
  ready : function() {
7560
  var item = this;
 
 
7561
  item.inputCollection.bind( function( col ) {
7562
  if( _.isEmpty( col ) )
7563
  return;
@@ -7565,11 +10843,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7565
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7566
  }
7567
  });//item.inputCollection.bind()
 
 
7568
  api.CZRItem.prototype.ready.call( item );
7569
  },
 
 
 
 
7570
  setInputVisibilityDeps : function() {
7571
  var item = this,
7572
  module = item.module;
 
 
7573
  item.czr_Input.each( function( input ) {
7574
  switch( input.id ) {
7575
  case 'use-custom-outer-width' :
@@ -7587,6 +10873,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7587
  }
7588
  }//CZRItemConstructor
7589
  };
 
 
 
 
 
 
 
 
 
 
7590
  api.czrModuleMap = api.czrModuleMap || {};
7591
  $.extend( api.czrModuleMap, {
7592
  sek_global_widths : {
@@ -7602,10 +10898,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7602
  },
7603
  });
7604
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7605
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
7606
  api.czrModuleMap = api.czrModuleMap || {};
7607
  $.extend( api.czrModuleMap, {
7608
  sek_global_performances : {
 
7609
  crud : false,
7610
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_global_performances', 'name' ),
7611
  has_mod_opt : false,
@@ -7617,19 +10923,33 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7617
  },
7618
  });
7619
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7620
  ( function ( api, $, _ ) {
7621
  var Constructor = {
7622
  initialize: function( id, options ) {
7623
  var module = this;
 
7624
  module.inputConstructor = api.CZRInput.extend({
7625
  setupSelect : function() {
7626
  api.czr_sektions.setupSelectInput.call( this );
7627
  }
7628
  });
 
 
 
7629
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7630
 
7631
  }//initialize
7632
  };
 
 
 
 
 
 
 
 
 
7633
  api.czrModuleMap = api.czrModuleMap || {};
7634
  $.extend( api.czrModuleMap, {
7635
  sek_global_header_footer : {
@@ -7645,18 +10965,30 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7645
  },
7646
  });
7647
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7648
  ( function ( api, $, _ ) {
7649
  var Constructor = {
7650
  initialize: function( id, options ) {
7651
  var module = this;
 
 
 
 
 
 
 
7652
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
7653
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7654
 
7655
  },//initialize
7656
 
7657
  CZRItemConstructor : {
 
7658
  ready : function() {
7659
  var item = this;
 
 
7660
  item.inputCollection.bind( function( col ) {
7661
  if( _.isEmpty( col ) )
7662
  return;
@@ -7664,11 +10996,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7664
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7665
  }
7666
  });//item.inputCollection.bind()
 
 
7667
  api.CZRItem.prototype.ready.call( item );
7668
  },
 
 
 
 
7669
  setInputVisibilityDeps : function() {
7670
  var item = this,
7671
  module = item.module;
 
 
7672
  item.czr_Input.each( function( input ) {
7673
  switch( input.id ) {
7674
  case 'enable' :
@@ -7703,6 +11043,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7703
  }
7704
  }//CZRItemConstructor
7705
  };
 
 
 
 
 
 
 
 
 
 
7706
  api.czrModuleMap = api.czrModuleMap || {};
7707
  $.extend( api.czrModuleMap, {
7708
  sek_global_recaptcha : {
@@ -7718,10 +11068,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7718
  },
7719
  });
7720
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7721
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
7722
  api.czrModuleMap = api.czrModuleMap || {};
7723
  $.extend( api.czrModuleMap, {
7724
  sek_global_beta_features : {
 
7725
  crud : false,
7726
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_global_beta_features', 'name' ),
7727
  has_mod_opt : false,
@@ -7735,17 +11095,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7735
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
7736
  * IMAGE MAIN SETTINGS
7737
  /* ------------------------------------------------------------------------- */
 
 
7738
  ( function ( api, $, _ ) {
7739
  var Constructor = {
7740
  initialize: function( id, options ) {
7741
  var module = this;
 
7742
  module.inputConstructor = api.CZRInput.extend({
7743
  setupSelect : function() {
7744
  api.czr_sektions.setupSelectInput.call( this );
7745
  }
7746
  });
 
7747
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
7748
  api.CZRDynModule.prototype.initialize.call( module, id, options );
 
 
 
7749
  module.bind( 'set_default_content_picker_options', function( params ) {
7750
  params.defaultContentPickerOption.defaultOption = {
7751
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
@@ -7758,9 +11129,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7758
  return params;
7759
  });
7760
  },//initialize
 
 
 
 
 
 
 
 
7761
  CZRItemConstructor : {
 
7762
  ready : function() {
7763
  var item = this;
 
 
7764
  item.inputCollection.bind( function( col ) {
7765
  if( _.isEmpty( col ) )
7766
  return;
@@ -7768,11 +11150,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7768
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7769
  }
7770
  });//item.inputCollection.bind()
 
 
7771
  api.CZRItem.prototype.ready.call( item );
7772
  },
 
 
 
 
7773
  setInputVisibilityDeps : function() {
7774
  var item = this,
7775
  module = item.module;
 
 
7776
  item.czr_Input.each( function( input ) {
7777
  switch( input.id ) {
7778
  case 'img' :
@@ -7839,6 +11229,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7839
  },//CZRItemConstructor
7840
 
7841
  };//Constructor
 
 
 
 
 
 
 
 
 
7842
  api.czrModuleMap = api.czrModuleMap || {};
7843
  $.extend( api.czrModuleMap, {
7844
  czr_image_main_settings_child : {
@@ -7863,21 +11262,40 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7863
  /* ------------------------------------------------------------------------- *
7864
  * IMAGE BORDERS AND BORDER RADIUS
7865
  /* ------------------------------------------------------------------------- */
 
 
7866
  ( function ( api, $, _ ) {
7867
  var Constructor = {
7868
  initialize: function( id, options ) {
7869
  var module = this;
 
7870
  module.inputConstructor = api.CZRInput.extend({
7871
  setupSelect : function() {
7872
  api.czr_sektions.setupSelectInput.call( this );
7873
  }
7874
  });
 
7875
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
7876
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7877
  },//initialize
 
 
 
 
 
 
 
 
7878
  CZRItemConstructor : {
 
7879
  ready : function() {
7880
  var item = this;
 
 
7881
  item.inputCollection.bind( function( col ) {
7882
  if( _.isEmpty( col ) )
7883
  return;
@@ -7885,17 +11303,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7885
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7886
  }
7887
  });//item.inputCollection.bind()
 
 
7888
  api.CZRItem.prototype.ready.call( item );
7889
  },
 
 
 
 
7890
  setInputVisibilityDeps : function() {
7891
  var item = this,
7892
  module = item.module;
 
7893
  var scheduleVisibilityOfInputId = function( controlledInputId, visibilityCallBack ) {
 
7894
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
 
7895
  this.bind( function( to ) {
7896
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
7897
  });
7898
  };
 
7899
  item.czr_Input.each( function( input ) {
7900
  switch( input.id ) {
7901
  case 'border-type' :
@@ -7913,6 +11341,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7913
  },//CZRItemConstructor
7914
 
7915
  };//Constructor
 
 
 
 
 
 
 
 
 
7916
  api.czrModuleMap = api.czrModuleMap || {};
7917
  $.extend( api.czrModuleMap, {
7918
  czr_image_borders_corners_child : {
@@ -7926,17 +11363,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7926
  },
7927
  });
7928
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7929
  ( function ( api, $, _ ) {
7930
  var Constructor = {
7931
  initialize: function( id, options ) {
 
7932
  var module = this;
 
7933
  module.inputConstructor = api.CZRInput.extend( module.CZRTextEditorInputMths || {} );
 
 
 
 
 
 
7934
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7935
  },//initialize
7936
 
7937
  CZRTextEditorInputMths : {
7938
  initialize : function( name, options ) {
7939
  var input = this;
 
7940
  if ( 'tiny_mce_editor' == input.type ) {
7941
  input.isReady.then( function() {
7942
  input.container.find('[data-czr-action="open-tinymce-editor"]').trigger('click');
@@ -7949,7 +11396,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7949
  api.czr_sektions.setupSelectInput.call( this );
7950
  }
7951
  },//CZRTextEditorInputMths
 
 
7952
  };//Constructor
 
 
 
 
 
 
 
 
 
 
7953
  api.czrModuleMap = api.czrModuleMap || {};
7954
  $.extend( api.czrModuleMap, {
7955
  czr_tinymce_child : {
@@ -7963,10 +11422,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7963
  },
7964
  });
7965
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7966
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
7967
  api.czrModuleMap = api.czrModuleMap || {};
7968
  $.extend( api.czrModuleMap, {
7969
  czr_simple_html_module : {
 
7970
  crud : false,
7971
  name : api.czr_sektions.getRegisteredModuleProperty( 'czr_simple_html_module', 'name' ),
7972
  has_mod_opt : false,
@@ -7976,21 +11445,39 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7976
  },
7977
  });
7978
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
7979
  ( function ( api, $, _ ) {
7980
  var FeaturedPagesConstruct = {
7981
  initialize: function( id, options ) {
 
7982
  var module = this;
 
 
 
7983
  module.inputConstructor = api.CZRInput.extend({
7984
  setupSelect : function() {
7985
  api.czr_sektions.setupSelectInput.call( this );
7986
  }
7987
  });
 
 
7988
  module.itemConstructor = api.CZRItem.extend( module.CZRFPItemConstructor || {} );
 
 
 
 
7989
  api.CZRDynModule.prototype.initialize.call( module, id, options );
7990
  },//initialize
 
 
 
 
7991
  CZRFPItemConstructor : {
 
7992
  ready : function() {
7993
  var item = this;
 
 
7994
  item.inputCollection.bind( function( col ) {
7995
  if( _.isEmpty( col ) )
7996
  return;
@@ -7998,11 +11485,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
7998
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
7999
  }
8000
  });//item.inputCollection.bind()
 
 
8001
  api.CZRItem.prototype.ready.call( item );
8002
  },
 
 
8003
  setInputVisibilityDeps : function() {
8004
  var item = this,
8005
  module = item.module;
 
 
8006
  item.czr_Input.each( function( input ) {
8007
  switch( input.id ) {
8008
  case 'img-type' :
@@ -8046,6 +11539,15 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8046
  }
8047
  },//CZRFPItemConstructor
8048
  };//FeaturedPagesConstruct
 
 
 
 
 
 
 
 
 
8049
  api.czrModuleMap = api.czrModuleMap || {};
8050
  $.extend( api.czrModuleMap, {
8051
  czr_featured_pages_module : {
@@ -8061,16 +11563,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8061
  },
8062
  });
8063
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8064
  ( function ( api, $, _ ) {
 
8065
  var Constructor = {
8066
  initialize: function( id, options ) {
 
8067
  var module = this;
 
 
8068
  module.inputConstructor = api.CZRInput.extend({
8069
  setupSelect : function() {
8070
  api.czr_sektions.setupSelectInput.call( this );
8071
  }
8072
  });
 
 
8073
  module.itemConstructor = api.CZRItem.extend( module.CZRIconItemConstructor || {} );
 
 
 
 
8074
  module.bind( 'set_default_content_picker_options', function( params ) {
8075
  params.defaultContentPickerOption.defaultOption = {
8076
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
@@ -8082,14 +11595,25 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8082
  };
8083
  return params;
8084
  });
 
 
 
 
8085
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8086
 
8087
  },//initialize
8088
 
8089
  /* Helpers */
 
 
 
 
8090
  CZRIconItemConstructor : {
 
8091
  ready : function() {
8092
  var item = this;
 
 
8093
  item.inputCollection.bind( function( col ) {
8094
  if( _.isEmpty( col ) )
8095
  return;
@@ -8097,11 +11621,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8097
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8098
  }
8099
  });//item.inputCollection.bind()
 
 
8100
  api.CZRItem.prototype.ready.call( item );
8101
  },
 
 
 
 
8102
  setInputVisibilityDeps : function() {
8103
  var item = this,
8104
  module = item.module;
 
 
8105
  item.czr_Input.each( function( input ) {
8106
  switch( input.id ) {
8107
  case 'link-to' :
@@ -8142,6 +11674,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8142
  },//CZRIconItemConstructor
8143
 
8144
  };//Constructor
 
 
 
 
 
 
 
 
 
 
8145
  api.czrModuleMap = api.czrModuleMap || {};
8146
  $.extend( api.czrModuleMap, {
8147
  czr_icon_settings_child : {
@@ -8155,22 +11697,42 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8155
  },
8156
  });
8157
  })( wp.customize , jQuery, _ );
 
 
 
 
 
 
 
 
 
8158
  ( function ( api, $, _ ) {
 
8159
  var Constructor = {
8160
  initialize: function( id, options ) {
8161
  var module = this;
 
 
8162
  module.inputConstructor = api.CZRInput.extend({
8163
  setupSelect : function() {
8164
  api.czr_sektions.setupSelectInput.call( this );
8165
  }
8166
  });
 
8167
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
8168
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8169
  },//initialize
8170
 
8171
  CZRItemConstructor : {
 
8172
  ready : function() {
8173
  var item = this;
 
 
8174
  item.inputCollection.bind( function( col ) {
8175
  if( _.isEmpty( col ) )
8176
  return;
@@ -8178,17 +11740,27 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8178
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8179
  }
8180
  });//item.inputCollection.bind()
 
 
8181
  api.CZRItem.prototype.ready.call( item );
8182
  },
 
 
 
 
8183
  setInputVisibilityDeps : function() {
8184
  var item = this,
8185
  module = item.module;
 
8186
  var scheduleVisibilityOfInputId = function( controlledInputId, visibilityCallBack ) {
 
8187
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
 
8188
  this.bind( function( to ) {
8189
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
8190
  });
8191
  };
 
8192
  item.czr_Input.each( function( input ) {
8193
  switch( input.id ) {
8194
  case 'border-type' :
@@ -8205,6 +11777,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8205
  }
8206
  }//CZRItemConstructor
8207
  };// Constructor
 
 
 
 
 
 
 
 
8208
  api.czrModuleMap = api.czrModuleMap || {};
8209
  $.extend( api.czrModuleMap, {
8210
  czr_icon_spacing_border_child: {
@@ -8220,13 +11800,28 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8220
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
8221
  * HEADING MAIN CHILD
8222
  /* ------------------------------------------------------------------------- */
 
 
8223
  ( function ( api, $, _ ) {
 
8224
  var Constructor = {
8225
  initialize: function( id, options ) {
8226
  var module = this;
 
 
8227
  module.inputConstructor = api.CZRInput.extend( module.CZRHeadingInputMths || {} );
 
 
 
8228
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
8229
  api.CZRDynModule.prototype.initialize.call( module, id, options );
 
 
 
8230
  module.bind( 'set_default_content_picker_options', function( params ) {
8231
  params.defaultContentPickerOption.defaultOption = {
8232
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
@@ -8245,9 +11840,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8245
  api.czr_sektions.setupSelectInput.call( this );
8246
  }
8247
  },//CZRHeadingsInputMths
 
 
 
 
 
 
 
8248
  CZRItemConstructor : {
 
8249
  ready : function() {
8250
  var item = this;
 
 
8251
  item.inputCollection.bind( function( col ) {
8252
  if( _.isEmpty( col ) )
8253
  return;
@@ -8255,11 +11860,19 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8255
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8256
  }
8257
  });//item.inputCollection.bind()
 
 
8258
  api.CZRItem.prototype.ready.call( item );
8259
  },
 
 
 
 
8260
  setInputVisibilityDeps : function() {
8261
  var item = this,
8262
  module = item.module;
 
 
8263
  item.czr_Input.each( function( input ) {
8264
  switch( input.id ) {
8265
  case 'link-to' :
@@ -8293,6 +11906,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8293
  }//setInputVisibilityDeps
8294
  },//CZRItemConstructor
8295
  };//Constructor
 
 
 
 
 
 
 
 
 
 
8296
  api.czrModuleMap = api.czrModuleMap || {};
8297
  $.extend( api.czrModuleMap, {
8298
  czr_heading_child : {
@@ -8311,10 +11934,21 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8311
  * HEADING SPACING
8312
  /* ------------------------------------------------------------------------- */
8313
  ( function ( api, $, _ ) {
 
8314
  var Constructor = {
8315
  initialize: function( id, options ) {
8316
  var module = this;
 
 
8317
  module.inputConstructor = api.CZRInput.extend( module.CZRHeadingInputMths || {} );
 
 
 
 
 
 
 
 
8318
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8319
  },//initialize
8320
 
@@ -8324,6 +11958,16 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8324
  }
8325
  },//CZRHeadingsInputMths
8326
  };//Constructor
 
 
 
 
 
 
 
 
 
 
8327
  api.czrModuleMap = api.czrModuleMap || {};
8328
  $.extend( api.czrModuleMap, {
8329
  czr_heading_spacing_child : {
@@ -8337,11 +11981,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8337
  }
8338
  });
8339
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8340
  ( function ( api, $, _ ) {
 
8341
  var DividerModuleConstructor = {
8342
  initialize: function( id, options ) {
 
8343
  var module = this;
 
 
8344
  module.inputConstructor = api.CZRInput.extend( module.CZRDividerInputMths || {} );
 
 
 
 
 
 
 
8345
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8346
  },//initialize
8347
 
@@ -8352,6 +12008,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8352
  }
8353
  },//CZRDividerInputMths
8354
  };//DividerModuleConstructor
 
 
 
 
 
 
 
 
 
 
 
8355
  api.czrModuleMap = api.czrModuleMap || {};
8356
  $.extend( api.czrModuleMap, {
8357
  czr_divider_module : {
@@ -8365,10 +12032,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8365
  }
8366
  });
8367
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8368
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
8369
  api.czrModuleMap = api.czrModuleMap || {};
8370
  $.extend( api.czrModuleMap, {
8371
  czr_spacer_module : {
 
8372
  crud : false,
8373
  name : api.czr_sektions.getRegisteredModuleProperty( 'czr_spacer_module', 'name' ),
8374
  has_mod_opt : false,
@@ -8378,10 +12055,20 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8378
  }
8379
  });
8380
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8381
  ( function ( api, $, _ ) {
 
 
 
 
 
 
 
 
8382
  api.czrModuleMap = api.czrModuleMap || {};
8383
  $.extend( api.czrModuleMap, {
8384
  czr_map_module : {
 
8385
  crud : false,
8386
  name : api.czr_sektions.getRegisteredModuleProperty( 'czr_map_module', 'name' ),
8387
  has_mod_opt : false,
@@ -8391,25 +12078,44 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8391
  }
8392
  });
8393
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8394
  /* ------------------------------------------------------------------------- *
8395
  * QUOTE DESIGN
8396
  /* ------------------------------------------------------------------------- */
 
 
8397
  ( function ( api, $, _ ) {
 
8398
  var Constructor = {
8399
  initialize: function( id, options ) {
8400
  var module = this;
 
 
8401
  module.inputConstructor = api.CZRInput.extend({
8402
  setupSelect : function() {
8403
  api.czr_sektions.setupSelectInput.call( this );
8404
  }
8405
  });
 
 
8406
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
 
 
 
 
8407
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8408
 
8409
  },//initialize
 
 
 
 
8410
  CZRButtonItemConstructor : {
 
8411
  ready : function() {
8412
  var item = this;
 
 
8413
  item.inputCollection.bind( function( col ) {
8414
  if( _.isEmpty( col ) )
8415
  return;
@@ -8417,11 +12123,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8417
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8418
  }
8419
  });//item.inputCollection.bind()
 
 
8420
  api.CZRItem.prototype.ready.call( item );
8421
  },
 
 
 
8422
  setInputVisibilityDeps : function() {
8423
  var item = this,
8424
  module = item.module;
 
 
8425
  item.czr_Input.each( function( input ) {
8426
  switch( input.id ) {
8427
  case 'quote_design' :
@@ -8445,6 +12158,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8445
  }
8446
  }
8447
  };
 
 
 
 
 
 
 
 
8448
  api.czrModuleMap = api.czrModuleMap || {};
8449
  $.extend( api.czrModuleMap, {
8450
  czr_quote_design_child : {
@@ -8471,19 +12192,39 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8471
  /* ------------------------------------------------------------------------- *
8472
  * QUOTE CONTENT
8473
  /* ------------------------------------------------------------------------- */
 
 
8474
  ( function ( api, $, _ ) {
 
8475
  var Constructor = {
8476
  initialize: function( id, options ) {
8477
  var module = this;
 
 
8478
  module.inputConstructor = api.CZRInput.extend({
8479
  setupSelect : function() {
8480
  api.czr_sektions.setupSelectInput.call( this );
8481
  }
8482
  });
 
 
 
 
 
 
 
8483
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8484
 
8485
  },//initialize
8486
  };
 
 
 
 
 
 
 
 
8487
  api.czrModuleMap = api.czrModuleMap || {};
8488
  $.extend( api.czrModuleMap, {
8489
  czr_quote_quote_child : {
@@ -8506,19 +12247,39 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8506
  /* ------------------------------------------------------------------------- *
8507
  * CITE CONTENT
8508
  /* ------------------------------------------------------------------------- */
 
 
8509
  ( function ( api, $, _ ) {
 
8510
  var Constructor = {
8511
  initialize: function( id, options ) {
8512
  var module = this;
 
 
8513
  module.inputConstructor = api.CZRInput.extend({
8514
  setupSelect : function() {
8515
  api.czr_sektions.setupSelectInput.call( this );
8516
  }
8517
  });
 
 
 
 
 
 
 
8518
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8519
 
8520
  },//initialize
8521
  };
 
 
 
 
 
 
 
 
8522
  api.czrModuleMap = api.czrModuleMap || {};
8523
  $.extend( api.czrModuleMap, {
8524
  czr_quote_cite_child : {
@@ -8535,16 +12296,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8535
  /* ------------------------------------------------------------------------- *
8536
  * BUTTON CONTENT
8537
  /* ------------------------------------------------------------------------- */
 
 
8538
  ( function ( api, $, _ ) {
 
8539
  var Constructor = {
8540
  initialize: function( id, options ) {
8541
  var module = this;
 
 
8542
  module.inputConstructor = api.CZRInput.extend({
8543
  setupSelect : function() {
8544
  api.czr_sektions.setupSelectInput.call( this );
8545
  }
8546
  });
 
 
8547
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
 
 
 
8548
  module.bind( 'set_default_content_picker_options', function( params ) {
8549
  params.defaultContentPickerOption.defaultOption = {
8550
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
@@ -8556,12 +12327,23 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8556
  };
8557
  return params;
8558
  });
 
 
 
 
8559
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8560
 
8561
  },//initialize
 
 
 
 
8562
  CZRButtonItemConstructor : {
 
8563
  ready : function() {
8564
  var item = this;
 
 
8565
  item.inputCollection.bind( function( col ) {
8566
  if( _.isEmpty( col ) )
8567
  return;
@@ -8569,11 +12351,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8569
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8570
  }
8571
  });//item.inputCollection.bind()
 
 
8572
  api.CZRItem.prototype.ready.call( item );
8573
  },
 
 
 
8574
  setInputVisibilityDeps : function() {
8575
  var item = this,
8576
  module = item.module;
 
 
8577
  item.czr_Input.each( function( input ) {
8578
  switch( input.id ) {
8579
  case 'link-to' :
@@ -8609,6 +12398,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8609
  }
8610
  }
8611
  };
 
 
 
 
 
 
 
 
8612
  api.czrModuleMap = api.czrModuleMap || {};
8613
  $.extend( api.czrModuleMap, {
8614
  czr_btn_content_child : {
@@ -8635,22 +12432,40 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8635
  /* ------------------------------------------------------------------------- *
8636
  * BUTTON DESIGN
8637
  /* ------------------------------------------------------------------------- */
 
 
8638
  ( function ( api, $, _ ) {
 
8639
  var Constructor = {
8640
  initialize: function( id, options ) {
8641
  var module = this;
 
 
8642
  module.inputConstructor = api.CZRInput.extend({
8643
  setupSelect : function() {
8644
  api.czr_sektions.setupSelectInput.call( this );
8645
  }
8646
  });
 
 
8647
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
 
 
 
 
8648
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8649
 
8650
  },//initialize
 
 
 
 
8651
  CZRButtonItemConstructor : {
 
8652
  ready : function() {
8653
  var item = this;
 
 
8654
  item.inputCollection.bind( function( col ) {
8655
  if( _.isEmpty( col ) )
8656
  return;
@@ -8658,17 +12473,26 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8658
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8659
  }
8660
  });//item.inputCollection.bind()
 
 
8661
  api.CZRItem.prototype.ready.call( item );
8662
  },
 
 
 
8663
  setInputVisibilityDeps : function() {
8664
  var item = this,
8665
  module = item.module;
 
8666
  var scheduleVisibilityOfInputId = function( controlledInputId, visibilityCallBack ) {
 
8667
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
 
8668
  this.bind( function( to ) {
8669
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
8670
  });
8671
  };
 
8672
  item.czr_Input.each( function( input ) {
8673
  switch( input.id ) {
8674
  case 'use_custom_bg_color_on_hover' :
@@ -8703,6 +12527,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8703
  }
8704
  }
8705
  };
 
 
 
 
 
 
 
 
8706
  api.czrModuleMap = api.czrModuleMap || {};
8707
  $.extend( api.czrModuleMap, {
8708
  czr_btn_design_child : {
@@ -8718,40 +12550,34 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8718
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
8719
  * MENU CONTENT
8720
  /* ------------------------------------------------------------------------- */
 
 
8721
  ( function ( api, $, _ ) {
8722
  var Constructor = {
8723
  initialize: function( id, options ) {
8724
  var module = this;
 
8725
  module.inputConstructor = api.CZRInput.extend({
8726
  setupSelect : function() {
8727
  api.czr_sektions.setupSelectInput.call( this );
8728
  }
8729
  });
8730
- module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
 
 
 
 
8731
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8732
  },//initialize
8733
- CZRButtonItemConstructor : {
8734
- ready : function() {
8735
- var item = this;
8736
- item.inputCollection.bind( function( col ) {
8737
- if( _.isEmpty( col ) )
8738
- return;
8739
- try { item.setInputVisibilityDeps(); } catch( er ) {
8740
- api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8741
- }
8742
- });//item.inputCollection.bind()
8743
- api.CZRItem.prototype.ready.call( item );
8744
- },
8745
- setInputVisibilityDeps : function() {
8746
- var item = this,
8747
- module = item.module;
8748
- item.czr_Input.each( function( input ) {
8749
- switch( input.id ) {
8750
- }
8751
- });
8752
- }
8753
- }
8754
- };
8755
  api.czrModuleMap = api.czrModuleMap || {};
8756
  $.extend( api.czrModuleMap, {
8757
  czr_menu_content_child : {
@@ -8764,23 +12590,69 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8764
  defaultItemModel : api.czr_sektions.getDefaultItemModelFromRegisteredModuleData( 'czr_menu_content_child' )
8765
  }
8766
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8767
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8768
  ( function ( api, $, _ ) {
 
8769
  var Constructor = {
8770
  initialize: function( id, options ) {
8771
  var module = this;
 
 
8772
  module.inputConstructor = api.CZRInput.extend({
8773
  setupSelect : function() {
8774
  api.czr_sektions.setupSelectInput.call( this );
8775
  }
8776
  });
 
 
8777
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
8778
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8779
 
8780
  },//initialize
 
 
 
 
8781
  CZRItemConstructor : {
 
8782
  ready : function() {
8783
  var item = this;
 
 
8784
  item.inputCollection.bind( function( col ) {
8785
  if( _.isEmpty( col ) )
8786
  return;
@@ -8788,11 +12660,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8788
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8789
  }
8790
  });//item.inputCollection.bind()
 
 
8791
  api.CZRItem.prototype.ready.call( item );
8792
  },
 
 
 
8793
  setInputVisibilityDeps : function() {
8794
  var item = this,
8795
  module = item.module;
 
 
8796
  item.czr_Input.each( function( input ) {
8797
  switch( input.id ) {
8798
  case 'show_name_field' :
@@ -8834,6 +12713,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8834
  }
8835
  }
8836
  };
 
 
 
 
 
 
 
 
8837
  api.czrModuleMap = api.czrModuleMap || {};
8838
  $.extend( api.czrModuleMap, {
8839
  czr_simple_form_fields_child: {
@@ -8847,22 +12734,39 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8847
  }
8848
  });
8849
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8850
  ( function ( api, $, _ ) {
 
8851
  var Constructor = {
8852
  initialize: function( id, options ) {
8853
  var module = this;
 
 
8854
  module.inputConstructor = api.CZRInput.extend({
8855
  setupSelect : function() {
8856
  api.czr_sektions.setupSelectInput.call( this );
8857
  }
8858
  });
 
 
8859
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
8860
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8861
 
8862
  },//initialize
 
 
 
 
8863
  CZRItemConstructor : {
 
8864
  ready : function() {
8865
  var item = this;
 
 
8866
  item.inputCollection.bind( function( col ) {
8867
  if( _.isEmpty( col ) )
8868
  return;
@@ -8870,11 +12774,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8870
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8871
  }
8872
  });//item.inputCollection.bind()
 
 
8873
  api.CZRItem.prototype.ready.call( item );
8874
  },
 
 
 
8875
  setInputVisibilityDeps : function() {
8876
  var item = this,
8877
  module = item.module;
 
8878
  item.czr_Input.each( function( input ) {
8879
  switch( input.id ) {
8880
  case 'border-type' :
@@ -8891,6 +12801,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8891
  }
8892
  }
8893
  };
 
 
 
 
 
 
 
 
8894
  api.czrModuleMap = api.czrModuleMap || {};
8895
  $.extend( api.czrModuleMap, {
8896
  czr_simple_form_design_child: {
@@ -8904,22 +12822,39 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8904
  }
8905
  });
8906
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8907
  ( function ( api, $, _ ) {
 
8908
  var Constructor = {
8909
  initialize: function( id, options ) {
8910
  var module = this;
 
 
8911
  module.inputConstructor = api.CZRInput.extend({
8912
  setupSelect : function() {
8913
  api.czr_sektions.setupSelectInput.call( this );
8914
  }
8915
  });
 
 
8916
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
 
 
 
 
8917
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8918
 
8919
  },//initialize
 
 
 
 
8920
  CZRItemConstructor : {
 
8921
  ready : function() {
8922
  var item = this;
 
 
8923
  item.inputCollection.bind( function( col ) {
8924
  if( _.isEmpty( col ) )
8925
  return;
@@ -8927,11 +12862,17 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8927
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
8928
  }
8929
  });//item.inputCollection.bind()
 
 
8930
  api.CZRItem.prototype.ready.call( item );
8931
  },
 
 
 
8932
  setInputVisibilityDeps : function() {
8933
  var item = this,
8934
  module = item.module;
 
8935
  item.czr_Input.each( function( input ) {
8936
  switch( input.id ) {
8937
  case 'use_custom_bg_color_on_hover' :
@@ -8966,6 +12907,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8966
  }
8967
  }
8968
  };
 
 
 
 
 
 
 
 
8969
  api.czrModuleMap = api.czrModuleMap || {};
8970
  $.extend( api.czrModuleMap, {
8971
  czr_simple_form_button_child: {
@@ -8979,19 +12928,35 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
8979
  }
8980
  });
8981
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
8982
  ( function ( api, $, _ ) {
 
8983
  var Constructor = {
8984
  initialize: function( id, options ) {
8985
  var module = this;
 
 
8986
  module.inputConstructor = api.CZRInput.extend({
8987
  setupSelect : function() {
8988
  api.czr_sektions.setupSelectInput.call( this );
8989
  }
8990
  });
 
 
 
 
8991
  api.CZRDynModule.prototype.initialize.call( module, id, options );
8992
 
8993
  },//initialize
8994
  };
 
 
 
 
 
 
 
 
8995
  api.czrModuleMap = api.czrModuleMap || {};
8996
  $.extend( api.czrModuleMap, {
8997
  czr_simple_form_fonts_child: {
@@ -9005,19 +12970,78 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9005
  }
9006
  });
9007
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
9008
  ( function ( api, $, _ ) {
9009
  var Constructor = {
9010
  initialize: function( id, options ) {
9011
  var module = this;
 
9012
  module.inputConstructor = api.CZRInput.extend({
9013
  setupSelect : function() {
9014
  api.czr_sektions.setupSelectInput.call( this );
9015
  }
9016
  });
 
 
 
 
 
 
9017
  api.CZRDynModule.prototype.initialize.call( module, id, options );
9018
 
9019
  },//initialize
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9020
  };
 
 
 
 
 
 
 
 
9021
  api.czrModuleMap = api.czrModuleMap || {};
9022
  $.extend( api.czrModuleMap, {
9023
  czr_simple_form_submission_child: {
@@ -9031,22 +13055,39 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9031
  }
9032
  });
9033
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
9034
  ( function ( api, $, _ ) {
 
9035
  var Constructor = {
9036
  initialize: function( id, options ) {
9037
  var module = this;
 
 
9038
  module.inputConstructor = api.CZRInput.extend({
9039
  setupSelect : function() {
9040
  api.czr_sektions.setupSelectInput.call( this );
9041
  }
9042
  });
 
 
9043
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
 
 
 
 
9044
  api.CZRDynModule.prototype.initialize.call( module, id, options );
9045
 
9046
  },//initialize
 
 
 
 
9047
  CZRButtonItemConstructor : {
 
9048
  ready : function() {
9049
  var item = this;
 
 
9050
  item.inputCollection.bind( function( col ) {
9051
  if( _.isEmpty( col ) )
9052
  return;
@@ -9054,11 +13095,18 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9054
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
9055
  }
9056
  });//item.inputCollection.bind()
 
 
9057
  api.CZRItem.prototype.ready.call( item );
9058
  },
 
 
 
9059
  setInputVisibilityDeps : function() {
9060
  var item = this,
9061
  module = item.module;
 
 
9062
  item.czr_Input.each( function( input ) {
9063
  switch( input.id ) {
9064
  case 'use_custom_bg_color_on_hover' :
@@ -9107,6 +13155,14 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9107
  }
9108
  }
9109
  };
 
 
 
 
 
 
 
 
9110
  api.czrModuleMap = api.czrModuleMap || {};
9111
  $.extend( api.czrModuleMap, {
9112
  czr_font_child : {
@@ -9120,19 +13176,35 @@ var CZRSeksPrototype = CZRSeksPrototype || {};
9120
  }
9121
  });
9122
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
 
9123
  ( function ( api, $, _ ) {
 
9124
  var Constructor = {
9125
  initialize: function( id, options ) {
9126
  var module = this;
 
 
9127
  module.inputConstructor = api.CZRInput.extend({
9128
  setupSelect : function() {
9129
  api.czr_sektions.setupSelectInput.call( this, sektionsLocalizedData.registeredWidgetZones );
9130
  }
9131
  });
 
 
 
 
9132
  api.CZRDynModule.prototype.initialize.call( module, id, options );
9133
 
9134
  },//initialize
9135
  };
 
 
 
 
 
 
 
 
9136
  api.czrModuleMap = api.czrModuleMap || {};
9137
  $.extend( api.czrModuleMap, {
9138
  czr_widget_area_module : {
1
+ //global sektionsLocalizedData
2
  var CZRSeksPrototype = CZRSeksPrototype || {};
3
  (function ( api, $ ) {
4
  $.extend( CZRSeksPrototype, {
8
  if ( _.isUndefined( window.sektionsLocalizedData ) ) {
9
  throw new Error( 'CZRSeksPrototype => missing localized server params sektionsLocalizedData' );
10
  }
11
+ // this class is skope dependant
12
  if ( ! _.isFunction( api.czr_activeSkopes ) ) {
13
  throw new Error( 'CZRSeksPrototype => api.czr_activeSkopes' );
14
  }
15
+ // SECTIONS ID FOR LOCAL AND GLOBAL OPTIONS
16
  self.SECTION_ID_FOR_GLOBAL_OPTIONS = '__globalOptionsSectionId';
17
  self.SECTION_ID_FOR_LOCAL_OPTIONS = '__localOptionsSection';
18
+
19
+ // SECTION ID FOR THE CONTENT PICKER
20
  self.SECTION_ID_FOR_CONTENT_PICKER = '__content_picker__';
21
+
22
+ // Max possible number of columns in a section
23
  self.MAX_NUMBER_OF_COLUMNS = 12;
24
+
25
+ // _.debounce param when updating the UI setting
26
+ // prevent hammering server + fixes https://github.com/presscustomizr/nimble-builder/issues/244
27
  self.SETTING_UPDATE_BUFFER = 100;
28
+
29
+ // Define a default value for the sektion setting value, used when no server value has been sent
30
+ // @see php function
31
+ // function sek_get_default_location_model() {
32
+ // $defaut_sektions_value = [ 'collection' => [], 'options' => [] ];
33
+ // foreach( sek_get_locations() as $location ) {
34
+ // $defaut_sektions_value['collection'][] = [
35
+ // 'id' => $location,
36
+ // 'level' => 'location',
37
+ // 'collection' => [],
38
+ // 'options' => []
39
+ // ];
40
+ // }
41
+ // return $defaut_sektions_value;
42
+ // }
43
  self.defaultLocalSektionSettingValue = self.getDefaultSektionSettingValue( 'local' );
44
+
45
+ // Store the contextual setting prefix
46
  self.localSectionsSettingId = new api.Value( {} );
47
+
48
+ // Keep track of the registered ui elements dynamically registered
49
+ // this collection is populated in ::register(), if the track param is true
50
+ // this is used to know what ui elements are currently being displayed
51
  self.registered = new api.Value([]);
52
 
53
 
54
  api.bind( 'ready', function() {
55
  self.doSektionThinksOnApiReady();
56
  });//api.bind( 'ready' )
57
+
58
+ // Add the skope id on save
59
+ // Uses a WP core hook to filter the query on a customize_save action
60
+ //
61
+ // This posted skope id is useful when we need to know the skope id during ajax.
62
+ // ( Note that with the nimble ajax action, the skope_id is always posted. Not in WP core ajax actions. )
63
+ // Example of use of $_POST['local_skope_id'] => @see sek_get_parent_level_model()
64
+ // Helps fixing : https://github.com/presscustomizr/nimble-builder/issues/242, for which sek_add_css_rules_for_spacing() couldn't be set for columns margins
65
  api.bind( 'save-request-params', function( query ) {
66
  $.extend( query, { local_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ) } );
67
  });
68
 
69
  },// initialize()
70
+
71
+
72
+ // @ API READY
73
+ // Fired at api.bind( 'ready', function() {})
74
  doSektionThinksOnApiReady : function() {
75
  var self = this;
76
+ // the main sektion panel
77
+ // the local and global options section
78
  self.registerAndSetupDefaultPanelSectionOptions();
79
+
80
+ // Setup the collection settings => register the main settings for local and global skope and bind it
81
+ // schedule reaction to collection setting ids => the setup of the collection setting when the collection setting ids are set
82
+ //=> on skope change
83
+ //@see setContextualCollectionSettingIdWhenSkopeSet
84
+ //
85
+ // var _settingsToRegister_ = {
86
+ // 'local' : { collectionSettingId : self.localSectionsSettingId() },//<= "nimble___[skp__post_page_10]"
87
+ // 'global' : { collectionSettingId : self.getGlobalSectionsSettingId() }//<= "nimble___[skp__global]"
88
+ // };
89
  self.localSectionsSettingId.callbacks.add( function( collectionSettingIds, previousCollectionSettingIds ) {
90
+ // register the collection setting id
91
+ // and schedule the reaction to different collection changes : refreshModules, ...
92
  try { self.setupSettingsToBeSaved(); } catch( er ) {
93
  api.errare( 'Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()' , er );
94
  }
95
+
96
+ // Now that the local and global settings are registered, initialize the history log
97
  self.initializeHistoryLogWhenSettingsRegistered();
98
+
99
+ // On init and when skope changes, request the contextually active locations
100
+ // We should not need this call, because the preview sends it on initialize
101
+ // But this is safer.
102
+ // The preview send back the list of active locations 'sek-active-locations-in-preview'
103
+ // introduced for the level tree, https://github.com/presscustomizr/nimble-builder/issues/359
104
+ api.previewer.send('sek-request-active-locations');
105
  });
106
+
107
+
108
+ // POPULATE THE MAIN SETTING ID NOW
109
+ // + GENERATE UI FOR THE LOCAL SKOPE OPTIONS
110
+ // + GENERATE UI FOR THE GLOBAL OPTIONS
111
  var doSkopeDependantActions = function( newSkopes, previousSkopes ) {
112
  self.setContextualCollectionSettingIdWhenSkopeSet( newSkopes, previousSkopes );
113
+
114
+ // Generate UI for the local skope options and the global options
115
  api.section( self.SECTION_ID_FOR_LOCAL_OPTIONS, function( _section_ ) {
116
  _section_.deferred.embedded.done( function() {
117
  if( true === _section_.boundForLocalOptionGeneration )
118
  return;
119
+ // Defer the UI generation when the section is expanded
120
  _section_.boundForLocalOptionGeneration = true;
121
  _section_.expanded.bind( function( expanded ) {
122
  if ( true === expanded ) {
125
  });
126
  });
127
  });
128
+
129
+ // The UI of the global option must be generated only once.
130
+ // We don't want to re-generate on each skope change
131
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/271
132
  api.section( self.SECTION_ID_FOR_GLOBAL_OPTIONS, function( _section_ ) {
133
  if ( true === _section_.nimbleGlobalOptionGenerated )
134
  return;
135
  self.generateUI({ action : 'sek-generate-global-options-ui'});
136
  _section_.nimbleGlobalOptionGenerated = true;
137
  });
138
+
139
+ // This event has been introduced when implementing https://github.com/presscustomizr/nimble-builder/issues/304
140
  api.trigger('nimble-ready-for-current-skope');
141
  };//doSkopeDependantActions()
142
+
143
+ // populate the setting ids now if skopes are set
144
  if ( ! _.isEmpty( api.czr_activeSkopes().local ) ) {
145
  doSkopeDependantActions();
146
  }
147
+ // ON SKOPE READY
148
+ // - Set the contextual setting prefix
149
+ // - Generate UI for Nimble local skope options
150
+ // - Generate the content picker
151
  api.czr_activeSkopes.callbacks.add( function( newSkopes, previousSkopes ) {
152
  doSkopeDependantActions( newSkopes, previousSkopes );
153
  });
154
+
155
+
156
+ // Communicate with the preview
157
  self.reactToPreviewMsg();
158
+
159
+ // Setup Dnd
160
  self.setupDnd();
161
+
162
+
163
+ // setup the tinyMce editor used for the tiny_mce_editor input
164
+ // => one object listened to by each tiny_mce_editor input
165
  self.setupTinyMceEditor();
166
+
167
+ // print json
168
  self.schedulePrintSectionJson();
169
+
170
+ // Always set the previewed device back to desktop on ui change
171
+ // event 'sek-ui-removed' id triggered when cleaning the registered ui controls
172
+ // @see ::cleanRegistered()
173
  self.bind( 'sek-ui-removed', function() {
174
  api.previewedDevice( 'desktop' );
175
  });
176
+
177
+ // Synchronize api.previewedDevice with the currently rendered ui
178
+ // ensure that the selected device tab of the spacing module is the one being previewed
179
+ // =>@see spacing module, in item constructor CZRSpacingItemMths
180
  api.previewedDevice.bind( function( device ) {
181
  var currentControls = _.filter( self.registered(), function( uiData ) {
182
  return 'control' == uiData.what;
189
  });
190
  });
191
  });
192
+
193
+ // Schedule a reset
194
  $('#customize-notifications-area').on( 'click', '[data-sek-reset="true"]', function() {
195
  self.resetCollectionSetting();
196
  });
197
+
198
+
199
+ // CLEAN UI BEFORE REMOVAL
200
+ // 'sek-ui-pre-removal' is triggered in ::cleanRegistered
201
+ // @params { what : control, id : '' }
202
  self.bind( 'sek-ui-pre-removal', function( params ) {
203
+ // CLEAN DRAG N DROP
204
  if ( 'control' == params.what && -1 < params.id.indexOf( 'draggable') ) {
205
  api.control( params.id, function( _ctrl_ ) {
206
  _ctrl_.container.find( '[draggable]' ).each( function() {
208
  });
209
  });
210
  }
211
+
212
+ // CLEAN SELECT2
213
+ // => we need to destroy the czrSelect2 instance, otherwise it can stay open when switching to another ui.
214
  if ( 'control' == params.what ) {
215
  api.control( params.id, function( _ctrl_ ) {
216
  _ctrl_.container.find( 'select' ).each( function() {
221
  });
222
  }
223
  });
224
+
225
+
226
+ // POPULATE THE REGISTERED COLLECTION
227
+ // 'czr-new-registered' is fired in api.CZR_Helpers.register()
228
  api.bind( 'czr-new-registered', function( params ) {
229
+ //console.log( 'czr-new-registered => ', params );
230
+ // Check that we have an origin property and that make sure we populate only the registration emitted by 'nimble'
231
  if ( _.isUndefined( params.origin ) ) {
232
  throw new Error( 'czr-new-registered event => missing params.origin' );
233
  }
234
  if ( 'nimble' !== params.origin )
235
  return;
236
+
237
+ // when no collection is provided, we use
238
  if ( false !== params.track ) {
239
  var currentlyRegistered = self.registered();
240
  var newRegistered = $.extend( true, [], currentlyRegistered );
241
+ //Check for duplicates
242
  var duplicateCandidate = _.findWhere( newRegistered, { id : params.id } );
243
  if ( ! _.isEmpty( duplicateCandidate ) && _.isEqual( duplicateCandidate, params ) ) {
244
  throw new Error( 'register => duplicated element in self.registered() collection ' + params.id );
245
  }
246
  newRegistered.push( params );
247
  self.registered( newRegistered );
248
+
249
+ // say it
250
+ //this.trigger( [params.what, params.id , 'registered' ].join('__'), params );
251
  }
252
  });
253
+
254
+
255
+ // store active locations
256
+ // introduced for the level tree, https://github.com/presscustomizr/nimble-builder/issues/359
257
+ self.activeLocations = new api.Value([]);
258
+ api.previewer.bind('sek-active-locations-in-preview', function( activelocs ){
259
+ self.activeLocations( ( _.isObject(activelocs) && _.isArray( activelocs.active_locations ) ) ? activelocs.active_locations : [] );
260
+ });
261
+
262
+
263
+ // TOP BAR
264
+ // Setup the topbar including do/undo action buttons
265
  self.setupTopBar();//@see specific dev file
266
+
267
+ // SAVE SECTION UI
268
  if ( sektionsLocalizedData.isSavedSectionEnabled ) {
269
  self.setupSaveUI();
270
  }
271
+
272
+
273
+ // SETUP DOUBLE CLICK INSERTION THINGS
274
+ // Stores the preview target for double click insertion
275
+ // implemented for https://github.com/presscustomizr/nimble-builder/issues/317
276
  self.lastClickedTargetInPreview = new api.Value();
277
  self.lastClickedTargetInPreview.bind( function( to, from ) {
278
+ // to and from are formed this way : { id : "__nimble__fb2ab3e47472" }
279
+ // @see 'sek-pick-content' event in ::reactToPreviewMsg()
280
+
281
+ // Send the level id of the current double-click insertion target
282
+ // => this will be used to style the level id container with a pulse animation
283
  if ( _.isObject( to ) && to.id ) {
284
  api.previewer.send( 'sek-set-double-click-target', to );
285
  } else {
286
+ // Tell the preview to clean the target highlight effect
287
  api.previewer.send( 'sek-reset-double-click-target' );
288
  }
289
+
290
+ // reset after a delay
291
  clearTimeout( $(window).data('_preview_target_timer_') );
292
  $(window).data('_preview_target_timer_', setTimeout(function() {
293
+ // Reset the click target
294
  self.lastClickedTargetInPreview( {} );
295
+ // Tell the preview to clean the target highlight effect
296
  api.previewer.send( 'sek-reset-double-click-target' );
297
  }, 20000 ) );
298
  });
299
+
300
+ // React to the preview to clean any currently highlighted drop zone
301
+ // This event is triggered on all click in the preview iframe
302
+ // @see preview::scheduleUiClickReactions()
303
  api.previewer.bind( 'sek-clean-target-drop-zone', function() {
304
+ // Reset the click target
305
  self.lastClickedTargetInPreview({});
306
  });
307
+
308
+ // Clean the current target when hitting escape
309
  $(document).keydown(function( evt ) {
310
+ // ESCAPE key pressed
311
  if ( evt && 27 === evt.keyCode ) {
312
  self.lastClickedTargetInPreview({});
313
  }
314
  });
315
  },//doSektionThinksOnApiReady
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+ // Fired at api "ready"
324
  registerAndSetupDefaultPanelSectionOptions : function() {
325
  var self = this;
326
+
327
+ // MAIN SEKTION PANEL
328
  var SektionPanelConstructor = api.Panel.extend({
329
+ //attachEvents : function () {},
330
+ // Always make the panel active, event if we have no sections / control in it
331
  isContextuallyActive : function () {
332
  return this.active();
333
  },
334
  _toggleActive : function(){ return true; }
335
  });
336
+
337
+ // Prepend the Nimble logo in the main panel title
338
+ // the panel.expanded() Value is not the right candidate to be observed because it gets changed on too many events, when generating the various UI.
339
  api.panel( sektionsLocalizedData.sektionsPanelId, function( _mainPanel_ ) {
340
  _mainPanel_.deferred.embedded.done( function() {
341
  var $sidePanelTitleEl = _mainPanel_.container.find('h3.accordion-section-title'),
343
  logoHtml = [ '<img class="sek-nimble-logo" alt="'+ _mainPanel_.params.title +'" src="', sektionsLocalizedData.baseUrl, '/assets/img/nimble/nimble_horizontal.svg?ver=' + sektionsLocalizedData.nimbleVersion , '"/>' ].join('');
344
 
345
  if ( 0 < $sidePanelTitleEl.length ) {
346
+ // The default title looks like this : Nimble Builder <span class="screen-reader-text">Press return or enter to open this section</span>
347
+ // we want to style "Nimble Builder" only.
348
  var $sidePanelTitleElSpan = $sidePanelTitleEl.find('span');
349
  $sidePanelTitleEl
350
  .addClass('sek-side-nimble-logo-wrapper')
351
  .html( logoHtml )
352
  .append( $sidePanelTitleElSpan );
353
  }
354
+
355
+ // default looks like
356
+ // <span class="preview-notice">You are customizing <strong class="panel-title">Nimble Builder</strong></span>
357
+ // if ( 0 < $topPanelTitleEl.length ) {
358
+ // var $topPanelTitleElInner = $topPanelTitleEl.find('.panel-title');
359
+ // $topPanelTitleElInner.html( logoHtml );
360
+ // }
361
  });
362
  });
363
+
364
+ // The parent panel for all ui sections + global options section
365
  api.CZR_Helpers.register({
366
  origin : 'nimble',
367
  what : 'panel',
371
  constructWith : SektionPanelConstructor,
372
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
373
  });
374
+
375
+
376
+ //GLOBAL OPTIONS SECTION
377
  api.CZR_Helpers.register({
378
  origin : 'nimble',
379
  what : 'section',
383
  priority : 20,
384
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
385
  constructWith : api.Section.extend({
386
+ //attachEvents : function () {},
387
+ // Always make the section active, event if we have no control in it
388
  isContextuallyActive : function () {
389
  return this.active();
390
  },
392
  })
393
  }).done( function() {
394
  api.section( self.SECTION_ID_FOR_GLOBAL_OPTIONS, function( _section_ ) {
395
+ // Style the section title
396
  var $sectionTitleEl = _section_.container.find('.accordion-section-title'),
397
  $panelTitleEl = _section_.container.find('.customize-section-title h3');
398
+
399
+ // The default title looks like this : Title <span class="screen-reader-text">Press return or enter to open this section</span>
400
  if ( 0 < $sectionTitleEl.length ) {
401
  $sectionTitleEl.prepend( '<i class="fas fa-globe sek-level-option-icon"></i>' );
402
  }
403
+
404
+ // The default title looks like this : <span class="customize-action">Customizing</span> Title
405
  if ( 0 < $panelTitleEl.length ) {
406
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-globe sek-level-option-icon"></i>' );
407
  }
408
+
409
+ // Schedule the accordion behaviour
410
  self.scheduleModuleAccordion.call( _section_ );
411
  });
412
  });
413
+
414
+ //LOCAL OPTIONS SECTION
415
  api.CZR_Helpers.register({
416
  origin : 'nimble',
417
  what : 'section',
421
  priority : 10,
422
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
423
  constructWith : api.Section.extend({
424
+ //attachEvents : function () {},
425
+ // Always make the section active, event if we have no control in it
426
  isContextuallyActive : function () {
427
  return this.active();
428
  },
430
  })
431
  }).done( function() {
432
  api.section( self.SECTION_ID_FOR_LOCAL_OPTIONS, function( _section_ ) {
433
+ // Style the section title
434
  var $sectionTitleEl = _section_.container.find('.accordion-section-title'),
435
  $panelTitleEl = _section_.container.find('.customize-section-title h3');
436
+
437
+ // The default title looks like this : Title <span class="screen-reader-text">Press return or enter to open this section</span>
438
  if ( 0 < $sectionTitleEl.length ) {
439
  $sectionTitleEl.prepend( '<i class="fas fa-map-marker-alt sek-level-option-icon"></i>' );
440
  }
441
+
442
+ // The default title looks like this : <span class="customize-action">Customizing</span> Title
443
  if ( 0 < $panelTitleEl.length ) {
444
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-map-marker-alt sek-level-option-icon"></i>' );
445
  }
446
+
447
+ // Schedule the accordion behaviour
448
  self.scheduleModuleAccordion.call( _section_ );
449
  });
450
  });
451
+
452
+
453
+ // GLOBAL OPTIONS SETTING
454
+ // Will Be updated in ::generateUIforGlobalOptions()
455
+ // has no control.
456
  api.CZR_Helpers.register( {
457
  origin : 'nimble',
458
+ //level : params.level,
459
  what : 'setting',
460
  id : sektionsLocalizedData.optNameForGlobalOptions,
461
  dirty : false,
463
  transport : 'refresh',//'refresh',//// ,
464
  type : 'option'
465
  });
466
+
467
+
468
+ // CONTENT PICKER SECTION
469
  api.CZR_Helpers.register({
470
  origin : 'nimble',
471
  what : 'section',
475
  priority : 30,
476
  track : false,//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
477
  constructWith : api.Section.extend({
478
+ //attachEvents : function () {},
479
+ // Always make the section active, event if we have no control in it
480
  isContextuallyActive : function () {
481
  return this.active();
482
  },
483
  _toggleActive : function(){ return true; }
484
  })
485
  }).done( function() {
486
+ // generate the UI for the content picker if not done yet
487
+ // defer this action when the section is instantiated AND the api.previewer is active, so we can trigger event on it
488
+ // => we also need the local skope to be set, that's why api.czr_initialSkopeCollectionPopulated is convenient because it ensures the api.previewer is ready and we have a local skope set.
489
+ // @see czr-skope-base.js
490
+ // @fixes https://github.com/presscustomizr/nimble-builder/issues/187
491
  api.section( self.SECTION_ID_FOR_CONTENT_PICKER, function( _section_ ) {
492
  if ( 'resolved' != api.czr_initialSkopeCollectionPopulated.state() ) {
493
  api.czr_initialSkopeCollectionPopulated.done( function() {
499
  });
500
  });
501
  },//registerAndSetupDefaultPanelSectionOptions()
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+ //@return void()
510
+ // sektionsData is built server side :
511
+ //array(
512
+ // 'db_values' => sek_get_skoped_seks( $skope_id ),
513
+ // 'setting_id' => sek_get_seks_setting_id( $skope_id )//nimble___[skp__post_page_home]
514
+ // )
515
  setContextualCollectionSettingIdWhenSkopeSet : function( newSkopes, previousSkopes ) {
516
  var self = this;
517
  previousSkopes = previousSkopes || {};
518
+ // Clear all previous sektions if the main panel is expanded and we're coming from a previousSkopes
519
  if ( ! _.isEmpty( previousSkopes.local ) && api.panel( sektionsLocalizedData.sektionsPanelId ).expanded() ) {
520
  api.previewer.trigger('sek-pick-content');
521
  }
522
+
523
+ // set the localSectionsSettingId now, and update it on skope change
524
  sektionsData = api.czr_skopeBase.getSkopeProperty( 'sektions', 'local');
525
  if ( sektionsLocalizedData.isDevMode ) {
526
  api.infoLog( '::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ', sektionsData );
535
  }
536
  });//$.extend()
537
  })( wp.customize, jQuery );
538
+ //global sektionsLocalizedData
539
  var CZRSeksPrototype = CZRSeksPrototype || {};
540
  (function ( api, $ ) {
541
  $.extend( CZRSeksPrototype, {
542
+ // fired in ::initialize(), at api.bind( 'ready', function() {})
543
  setupTopBar : function() {
544
  var self = this;
545
  self.topBarId = '#nimble-top-bar';
566
  api.previewer.bind('ready', function() {
567
  $(api.previewer.targetWindow().document ).on( 'mousemove scroll,', _.throttle( trackMouseMovements , 50 ) );
568
  });
569
+
570
+ // LEVEL TREE
571
  self.setupLevelTree();
572
  },
573
+
574
+
575
+ // @return void()
576
+ // self.topBarVisible.bind( function( visible ){
577
+ // self.toggleTopBar( visible );
578
+ // });
579
  toggleTopBar : function( visible ) {
580
  visible = _.isUndefined( visible ) ? true : visible;
581
  var self = this,
582
  _renderAndSetup = function() {
583
  $.when( self.renderAndSetupTopBarTmpl({}) ).done( function( $_el ) {
584
  self.topBarContainer = $_el;
585
+ //display
586
  _.delay( function() {
587
  $('body').addClass('nimble-top-bar-visible');
588
  }, 200 );
592
  var dfd = $.Deferred();
593
  $('body').removeClass('nimble-top-bar-visible');
594
  if ( self.topBarContainer && self.topBarContainer.length ) {
595
+ //remove Dom element after slide up
596
  _.delay( function() {
597
+ //self.topBarContainer.remove();
598
  dfd.resolve();
599
  }, 300 );
600
  } else {
611
  });
612
  }
613
  },
614
+
615
+
616
+ //@param = { }
617
  renderAndSetupTopBarTmpl : function( params ) {
618
+ var self = this,
619
+ _tmpl;
620
+
621
+ // CHECK IF ALREADY RENDERED
622
  if ( $( self.topBarId ).length > 0 )
623
  return $( self.topBarId );
624
+
625
+ // RENDER
626
  try {
627
  _tmpl = wp.template( 'nimble-top-bar' )( {} );
628
  } catch( er ) {
630
  return false;
631
  }
632
  $('#customize-preview').after( $( _tmpl ) );
633
+
634
+ // UNDO / REDO ON CTRL + Z / CTRL + Y EVENTS
635
  $(document).keydown( function( evt ) {
636
  if ( evt.ctrlKey && _.contains( [89, 90], evt.keyCode ) ) {
637
  try { self.navigateHistory( 90 === evt.keyCode ? 'undo' : 'redo'); } catch( er ) {
639
  }
640
  }
641
  });
642
+
643
+
644
+ // CLICK EVENTS
645
+ // Attach click events
646
  $('.sek-add-content', self.topBarId).on( 'click', function(evt) {
647
  evt.preventDefault();
648
  api.previewer.trigger( 'sek-pick-content', { content_type : 'module' });
657
  }
658
  });
659
  $('.sek-settings', self.topBarId).on( 'click', function(evt) {
660
+ // Focus on the Nimble panel
661
  api.panel( sektionsLocalizedData.sektionsPanelId, function( _panel_ ) {
662
  self.rootPanelFocus();
663
  _panel_.focus();
664
  });
665
+ // // Generate UI for the local skope options
666
+ // self.generateUI({ action : 'sek-generate-local-skope-options-ui'}).done( function() {
667
+ // api.control( self.getLocalSkopeOptionId(), function( _control_ ) {
668
+ // _control_.focus();
669
+ // });
670
+ // });
671
  });
672
 
673
  $('.sek-nimble-doc', self.topBarId).on( 'click', function(evt) {
674
  evt.preventDefault();
675
  window.open($(this).data('doc-href'), '_blank');
676
  });
677
+
678
+ // NOTIFICATION WHEN USING CUSTOM TEMPLATE
679
+ // implemented for https://github.com/presscustomizr/nimble-builder/issues/304
680
  var maybePrintNotificationForUsageOfNimbleTemplate = function( templateSettingValue ) {
681
  if ( $(self.topBarId).length < 1 )
682
  return;
691
  };
692
 
693
  var initOnSkopeReady = function() {
694
+ // Schedule notification rendering on init
695
+ // @see ::generateUIforLocalSkopeOptions()
696
  api( self.localSectionsSettingId(), function( _localSectionsSetting_ ) {
697
  var localSectionsValue = _localSectionsSetting_(),
698
  initialLocalTemplateValue = ( _.isObject( localSectionsValue ) && localSectionsValue.local_options && localSectionsValue.local_options.template ) ? localSectionsValue.local_options.template : null;
699
+ // on init
700
  maybePrintNotificationForUsageOfNimbleTemplate( initialLocalTemplateValue );
701
  });
702
+
703
+ // React to template changes
704
+ // @see ::generateUIforLocalSkopeOptions() for the declaration of self.getLocalSkopeOptionId() + '__template'
705
  api( self.getLocalSkopeOptionId() + '__template', function( _set_ ) {
706
  _set_.bind( function( to, from ) {
707
  maybePrintNotificationForUsageOfNimbleTemplate( to );
708
  });
709
  });
710
  };
711
+
712
+ // fire now
713
  initOnSkopeReady();
714
+ // and on skope change, when user navigates through the previewed pages
715
+ // 'nimble-ready-for-current-skope' declared in ::initialize()
716
  api.bind('nimble-ready-for-current-skope', function() {
717
  initOnSkopeReady();
718
  });
721
  }
722
  });//$.extend()
723
  })( wp.customize, jQuery );
724
+ //global sektionsLocalizedData
725
  var CZRSeksPrototype = CZRSeksPrototype || {};
726
  (function ( api, $ ) {
727
  $.extend( CZRSeksPrototype, {
728
  /* HISTORY */
729
+ // @param direction = string 'undo', 'redo'
730
+ // @return void()
731
  navigateHistory : function( direction ) {
732
  var self = this,
733
  historyLog = $.extend( true, [], self.historyLog() );
734
+ // log model
735
+ // {
736
+ // status : 'current', 'previous', 'future'
737
+ // value : {},
738
+ // action : 'sek-add-column'
739
+ // }
740
+
741
+ // UPDATE THE SETTING VALUE
742
  var previous,
743
  current,
744
  future,
764
  }
765
  switch( direction ) {
766
  case 'undo' :
767
+ // the last previous is our new setting value
768
  if ( ! _.isEmpty( current ) && ! _.isEmpty( previous ) ) {
769
  newSettingValue = previous.value;
770
  previousSektionToRefresh = current.sektionToRefresh;
772
  }
773
  break;
774
  case 'redo' :
775
+ // the first future is our new setting value
776
  if ( ! _.isEmpty( future ) ) {
777
  newSettingValue = future.value;
778
  previousSektionToRefresh = current.sektionToRefresh;
781
  break;
782
  }
783
  });
784
+
785
+ // set the new setting Value
786
  if( ! _.isUndefined( newSettingValue ) ) {
787
  if ( ! _.isEmpty( newSettingValue.local ) ) {
788
  api( self.localSectionsSettingId() )( self.validateSettingValue( newSettingValue.local ), { navigatingHistoryLogs : true } );
790
  if ( ! _.isEmpty( newSettingValue.global ) ) {
791
  api( self.getGlobalSectionsSettingId() )( self.validateSettingValue( newSettingValue.global ), { navigatingHistoryLogs : true } );
792
  }
793
+ // If the information is available, refresh only the relevant sections
794
+ // otherwise fallback on a full refresh
795
  var previewHasBeenRefreshed = false;
796
+
797
+ // if ( ! _.isEmpty( previousSektionToRefresh ) ) {
798
+ // api.previewer.trigger( 'sek-refresh-level', {
799
+ // level : 'section',
800
+ // id : previousSektionToRefresh
801
+ // });
802
+ // } else {
803
+ // api.previewer.refresh();
804
+ // previewHasBeenRefreshed = true;
805
+ // }
806
+ // if ( currentSektionToRefresh != previousSektionToRefresh ) {
807
+ // if ( ! _.isEmpty( currentSektionToRefresh ) ) {
808
+ // api.previewer.trigger( 'sek-refresh-level', {
809
+ // level : 'section',
810
+ // id : currentSektionToRefresh
811
+ // });
812
+ // } else if ( ! previewHasBeenRefreshed ) {
813
+ // api.previewer.refresh();
814
+ // }
815
+ // }
816
  api.previewer.refresh();
817
+
818
+ // Always make sure that the ui gets refreshed
819
  api.previewer.trigger( 'sek-pick-content', {});
820
+ // Clean registered setting and control, even the level settings
821
+ // => otherwise the level settings won't be synchronized when regenerating their ui.
822
  self.cleanRegistered();//<= normal cleaning
823
  self.cleanRegisteredLevelSettingsAfterHistoryNavigation();// setting cleaning
824
  }
825
+
826
+ // UPDATE THE HISTORY LOG
827
  var currentKey = _.findKey( historyLog, { status : 'current'} );
828
  currentKey = Number( currentKey );
829
  if ( ! _.isNumber( currentKey ) ) {
833
 
834
  _.each( historyLog, function( log, key ) {
835
  newLog = $.extend( true, {}, log );
836
+ // cast keys to number so we can compare them
837
  key = Number( key );
838
  switch( direction ) {
839
  case 'undo' :
861
  }
862
  });//$.extend()
863
  })( wp.customize, jQuery );
864
+ //global sektionsLocalizedData
865
  var CZRSeksPrototype = CZRSeksPrototype || {};
866
  (function ( api, $ ) {
867
  $.extend( CZRSeksPrototype, {
868
+ // fired in ::setupTopBar(), at api.bind( 'ready', function() {})
869
  setupLevelTree : function() {
870
  var self = this;
871
  self.levelTree = new api.Value([]);
872
+ self.levelTree.bind( function() {
873
+ // Refresh when the collection is being modified from the tree
874
  if ( self.levelTreeExpanded() ) {
875
  self.renderOrRefreshTree();
876
  }
877
  });
878
+
879
+
880
+ // SETUP AND REACT TO LEVEL TREE EXPANSION
881
  self.levelTreeExpanded = new api.Value(false);
882
  self.levelTreeExpanded.bind( function(expanded) {
883
  $('body').toggleClass( 'sek-level-tree-expanded', expanded );
884
  if ( expanded ) {
885
+ // Set the level tree now
886
  self.setLevelTreeValue();
887
+
888
+ // Make sure we the tree is set first
889
  if ( _.isEmpty( self.levelTree() ) ) {
890
  api.previewer.trigger('sek-notify', {
891
  type : 'info',
896
  '</span>'
897
  ].join('')
898
  });
899
+ // self disable
900
  self.levelTreeExpanded(false);
901
  return;
902
  }
909
  }, 300 );
910
  }
911
  });
912
+
913
+ // REFRESH THE TREE WHEN THE ACTIVE LOCATIONS CHANGE
914
+ // @see ::initialize to understand how active locations are updated
915
+ self.activeLocations.bind(function() {
916
+ if ( !_.isEmpty( self.levelTree() ) ) {
917
+ self.renderOrRefreshTree();
918
+ }
919
+ });
920
+
921
+ // API READY
922
  api.previewer.bind('ready', function() {
923
+ // LEVEL TREE
924
+ // on each skope change
925
+ // - set the level tree
926
+ // - bind the local and global settings so that they refresh the level tree when changed
927
  self.localSectionsSettingId.callbacks.add( function() {
928
+ self.levelTreeExpanded(false);
929
+ // Bind the global and local settings if not bound yet
930
+ _.each( [ self.getGlobalSectionsSettingId(), self.localSectionsSettingId(), sektionsLocalizedData.optNameForGlobalOptions ], function( setId ){
931
  if ( api(setId)._isBoundForNimbleLevelTree )
932
  return;
933
 
938
  });
939
  });
940
  });
941
+
942
+
943
+
944
+ // SETUP CLICK EVENTS IN THE TREE
945
  $('body').on('click', '#nimble-level-tree [data-nimb-level]', function(evt) {
946
  evt.preventDefault();
947
  evt.stopPropagation();
948
+ var $el = $(evt.target),
949
+ $closestLevel = $el.closest('[data-nimb-level]');
950
+ api.previewer.send('sek-animate-to-level', { id : $closestLevel.data('nimb-id') });
951
+ api.previewer.send('sek-display-level-ui', { id : $closestLevel.data('nimb-id') });
952
  });
953
 
954
  $('body').on('click', '#nimble-level-tree .sek-remove-level', function(evt) {
963
  in_column : $el.closest('[data-nimb-level="column"]').data('nimb-id')
964
  });
965
  $el.fadeOut('slow');
966
+ // Refresh
967
  self.renderOrRefreshTree();
968
  });
969
+
970
+ // Collapse tree ( also possible by clicking on the tree icon in the top Nimble bar )
971
+ $('body').on('click', '.sek-close-level-tree' , function(evt) {
972
+ evt.preventDefault();
973
+ self.levelTreeExpanded(false);
974
+ });
975
  },
976
+
977
+ // This method updates the levelTree observable api.Value()
 
 
978
  setLevelTreeValue : function() {
979
  var self = this,
980
+ globalCollSetId = self.getGlobalSectionsSettingId(),
981
+ localCollSetId = self.localSectionsSettingId(),
982
+ globalOptionSetId = sektionsLocalizedData.optNameForGlobalOptions,
983
+ globalColSetValue, localColSetValue,
984
+ globalCollection, localCollection,
985
+ rawGlobalOptionsValue,
986
+ missingDependantSettingId = false;
987
+
988
+ // Check if all dependant settings are registered
989
+ // we won't go further if any of the 3 setting id's is not yet registered
990
+ _.each( [globalCollSetId, localCollSetId, globalOptionSetId ], function( setId ) {
991
+ if ( !api.has(setId) ) {
992
+ missingDependantSettingId = setId;
993
+ return;
994
+ }
995
+ });
996
 
997
+ if ( false !== missingDependantSettingId ) {
998
+ api.errare( '::setLevelTreeValue => a setting id is not registered ');
999
+ return;
1000
+ }
1001
 
1002
+ // Normalizes the setting values
1003
+ globalColSetValue = api(globalCollSetId)();
1004
+ globalCollection = _.isObject( globalColSetValue ) ? $.extend( true, {}, globalColSetValue ) : {};
1005
+ globalCollection = ! _.isEmpty( globalCollection.collection )? globalCollection.collection : [];
1006
+ globalCollection = _.isArray( globalCollection ) ? globalCollection : [];
1007
+
1008
+ localColSetValue = api(localCollSetId)();
1009
+ localColSetValue = _.isObject( localColSetValue ) ? localColSetValue : {};
1010
+ localCollection = $.extend( true, {}, localColSetValue );
1011
+ localCollection = ! _.isEmpty( localCollection.collection ) ? localCollection.collection : [];
1012
+ localCollection = _.isArray( localCollection ) ? localCollection : [];
1013
+
1014
+ var raw_col = _.union( globalCollection, localCollection ),
1015
+ local_header_footer_value,
1016
+ global_header_footer_value,
1017
+ has_local_header_footer = false,
1018
+ has_global_header_footer = false;
1019
+
1020
+ rawGlobalOptionsValue = api( globalOptionSetId )();
1021
+ rawGlobalOptionsValue = _.isObject( rawGlobalOptionsValue ) ? rawGlobalOptionsValue : {};
1022
+
1023
+ // HEADER-FOOTER => do we have a header-footer set, local or global ?
1024
+ // LOCAL
1025
+ if ( localColSetValue.local_options && localColSetValue.local_options.local_header_footer ) {
1026
+ local_header_footer_value = localColSetValue.local_options.local_header_footer['header-footer'];
1027
+ has_local_header_footer = 'nimble_local' === local_header_footer_value;
1028
+ }
1029
+
1030
+ // GLOBAL
1031
+ // there can be a global header footer if
1032
+ // 1) local is not set to 'nimble_local' or 'theme'
1033
+ // and
1034
+ // 2) the global option is set to 'nimble_global'
1035
+ //
1036
+ // OR when
1037
+ // 1) local is set to 'nimble_global'
1038
+ if ( rawGlobalOptionsValue.global_header_footer && !has_local_header_footer && 'theme' !== local_header_footer_value) {
1039
+ global_header_footer_value = rawGlobalOptionsValue.global_header_footer['header-footer'];
1040
+ has_global_header_footer = 'nimble_global' === global_header_footer_value || 'nimble_global' === local_header_footer_value;
1041
+ }
1042
+
1043
+ var filteredCollection = $.extend( true, [], raw_col ),
1044
+ header_loc,
1045
+ footer_loc;
1046
+
1047
+ filteredCollection = _.filter( filteredCollection, function( loc, key ) {
1048
+ return !_.contains( ['nimble_global_header', 'nimble_global_footer', 'nimble_local_header', 'nimble_local_footer'], loc.id );
1049
+ });
1050
+
1051
+ // RE-ORGANIZE LOCATIONS SO THAT WE HAVE
1052
+ // - header
1053
+ // - content loc #1
1054
+ // - content loc #2
1055
+ // - ...
1056
+ // - footer
1057
+ var wrapContentLocationWithHeaderFoooterLocations = function( scope ) {
1058
+ header_loc = _.findWhere(raw_col, {id:'nimble_' + scope + '_header'});
1059
+ footer_loc = _.findWhere(raw_col, {id:'nimble_' + scope + '_footer'});
1060
+ filteredCollection.unshift(header_loc);
1061
+ filteredCollection.push(footer_loc);
1062
+ };
1063
+ if ( has_local_header_footer ) {
1064
+ wrapContentLocationWithHeaderFoooterLocations('local');
1065
+ } else if ( has_global_header_footer ) {
1066
+ wrapContentLocationWithHeaderFoooterLocations('global');
1067
+ }
1068
+
1069
+ // RE-ORDER LOCATIONS IN THE SAME ORDER AS THEY ARE IN THE DOM
1070
+ // @see ::initialize to understand how active locations are updated
1071
+ var contextuallyActiveLocactions = self.activeLocations(),
1072
+ orderedCollection = [],
1073
+ candidate;
1074
+ if ( !_.isEmpty(contextuallyActiveLocactions) ) {
1075
+ _.each( contextuallyActiveLocactions, function( loc ) {
1076
+ candidate = _.findWhere(filteredCollection, {id:loc});
1077
+ if( !_.isUndefined(candidate) ) {
1078
+ orderedCollection.push(candidate);
1079
+ }
1080
+ });
1081
+ } else {
1082
+ orderedCollection = filteredCollection;
1083
+ }
1084
+
1085
+ // Store it now
1086
+ self.levelTree( orderedCollection );
1087
  },
1088
+
1089
+
1090
+ // print the tree
1091
  renderOrRefreshTree : function() {
1092
+ var self = this,
1093
+ _tmpl;
1094
  if( $('#nimble-level-tree').length < 1 ) {
1095
+ // RENDER
1096
+ try {
1097
+ _tmpl = wp.template( 'nimble-level-tree' )( {} );
1098
+ } catch( er ) {
1099
+ api.errare( 'Error when parsing the the nimble-level-tree template', er );
1100
+ return false;
1101
+ }
1102
+ $( '#customize-preview' ).after( $( _tmpl ) );
1103
  }
1104
+ $('#nimble-level-tree').find('.sek-tree-wrap').html( self.getLevelTreeHtml() );
1105
  },
1106
+
1107
+ // recursive helper
1108
+ // return an html string describing the contextually printed sections
1109
  getLevelTreeHtml : function( _col, level ) {
1110
  var self = this;
1111
+ _col = _col || self.levelTree();
1112
+
1113
+ var levelType,
1114
+ levelName,
1115
+ _html,
1116
+ skipLevel = false;
1117
+
1118
  if ( !_.isArray( _col ) || _.isEmpty( _col ) ) {
1119
  api.errare('::buildLevelTree => invalid collection param', _col );
1120
  return _html;
1121
  }
1122
+ var remove_icon_html = '<i class="material-icons sek-remove-level" title="'+ sektionsLocalizedData.i18n['Remove this element'] +'">delete_forever</i>';
1123
  _html = '<ul>';
1124
  _.each( _col, function( _level_param ) {
1125
  if ( _.isUndefined( _level_param.level ) ){
1131
  return;
1132
  }
1133
 
1134
+ // Set some vars now
1135
+ levelType = _level_param.level;
1136
+ levelName = levelType;
1137
+
1138
+ // if the level is a location, is this location contextually active ?
1139
+ // @see ::initialize to understand how active locations are updated
1140
+ if ( 'location' === levelType ) {
1141
+ skipLevel = !_.contains( self.activeLocations(), _level_param.id );
1142
+ }
1143
+
1144
+ if ( !skipLevel ) {
1145
+ //try to get the i18n level name, fall back on the level type
1146
+ if ( sektionsLocalizedData.i18n[levelType] ) {
1147
+ levelName = sektionsLocalizedData.i18n[levelType];
1148
+ }
1149
+ if ( true === _level_param.is_nested ) {
1150
+ levelName = sektionsLocalizedData.i18n['nested section'];
1151
+ }
1152
+
1153
+ remove_icon_html = 'location' !== levelType ? remove_icon_html : '';
1154
+ _html += '<li data-nimb-level="'+levelType+'" data-nimb-id="'+_level_param.id+'">';
1155
+
1156
+ _html += '<div class="sek-level-infos"><div class="sek-inner-level-infos">';
1157
+ // add module type and icon
1158
+ if ( 'module' === levelType ) {
1159
+ _html += [
1160
+ self.getTreeModuleIcon( _level_param.module_type ),
1161
+ self.getTreeModuleTitle( _level_param.module_type )
1162
+ ].join(' ');
1163
+ }
1164
+ // add the rest of the html, common to all elements
1165
+ _html += [
1166
+ ' ',
1167
+ levelName,
1168
+ '( id :',
1169
+ _level_param.id,
1170
+ ')',
1171
+ remove_icon_html
1172
+ ].join(' ');
1173
+ _html += '</div></div>';
1174
+
1175
+ if ( _.isArray( _level_param.collection ) && ! _.isEmpty( _level_param.collection ) ) {
1176
+ _html += self.getLevelTreeHtml( _level_param.collection, level );
1177
+ }
1178
+ _html += '</li>';
1179
+ }//if ( !skipLevel )
1180
+ });//_.each
1181
+
1182
+ _html += '</ul>';
1183
+
1184
+ return _html;
1185
+ },
1186
+
1187
+ // the module icons can be
1188
+ // an svg file like Nimble__divider_icon.svg => in this case we build and return the full url
1189
+ // or a font_icon like '<i class="fab fa-wordpress-simple"></i>'
1190
+ getTreeModuleIcon : function( modType ) {
1191
+ var _icon = {};
1192
+ _.each( sektionsLocalizedData.moduleCollection, function( modData ) {
1193
+ if ( !_.isEmpty( _icon ) )
1194
  return;
1195
+ if ( modType === modData['content-id'] ) {
1196
+ _icon = {
1197
+ svg : modData.icon ? sektionsLocalizedData.moduleIconPath + modData.icon : '',
1198
+ font : modData.font_icon ? modData.font_icon : ''
1199
+ };
1200
  }
 
1201
  });
1202
+ if ( !_.isEmpty( _icon.svg ) ) {
1203
+ return '<img class="sek-svg-mod-icon" src="' + _icon.svg + '"/>';
1204
+ } else if ( !_.isEmpty( _icon.font ) ) {
1205
+ return _icon.font;
1206
+ }
1207
+ },
1208
+
1209
+ getTreeModuleTitle : function( modType ) {
1210
+ var _title = {};
1211
+ _.each( sektionsLocalizedData.moduleCollection, function( modData ) {
1212
+ if ( !_.isEmpty( _title ) )
1213
+ return;
1214
+ if ( modType === modData['content-id'] ) {
1215
+ _title = modData.title;
1216
+ }
1217
+ });
1218
+ return _title;
1219
  }
1220
  });//$.extend()
1221
  })( wp.customize, jQuery );
1222
+ //global sektionsLocalizedData
1223
  var CZRSeksPrototype = CZRSeksPrototype || {};
1224
  (function ( api, $ ) {
1225
  $.extend( CZRSeksPrototype, {
1226
+ // SAVE DIALOG BLOCK
1227
+ // fired in ::initialize()
1228
  setupSaveUI : function() {
1229
  var self = this;
1230
  self.saveUIVisible = new api.Value( false );
1232
  self.toggleSaveUI( to, params ? params.id : null );
1233
  });
1234
  },
1235
+
1236
+
1237
+ // @return void()
1238
+ // self.saveUIVisible.bind( function( visible ){
1239
+ // self.toggleSaveUI( visible );
1240
+ // });
1241
  toggleSaveUI : function( visible, sectionId ) {
1242
  visible = _.isUndefined( visible ) ? true : visible;
1243
  var self = this,
1244
  _renderAndSetup = function() {
1245
  $.when( self.renderAndSetupSaveUITmpl({}) ).done( function( $_el ) {
1246
  self.saveUIContainer = $_el;
1247
+ //display
1248
  _.delay( function() {
1249
  $('body').addClass('nimble-save-ui-visible');
1250
  }, 200 );
1251
+ // set section id input value
1252
  $('#sek-saved-section-id').val( sectionId );
1253
  });
1254
  },
1256
  var dfd = $.Deferred();
1257
  $('body').removeClass('nimble-save-ui-visible');
1258
  if ( $( '#nimble-top-save-ui' ).length > 0 ) {
1259
+ //remove Dom element after slide up
1260
  _.delay( function() {
1261
 
1262
  self.saveUIContainer.remove();
1276
  });
1277
  }
1278
  },
1279
+
1280
+
1281
+ // @return a section model with clean ids
1282
+ // also removes the section properties "id" and "level", which are dynamically set when dragging and dropping
1283
+ // Example of section model before preprocessing
1284
+ // {
1285
+ // collection: [{…}]
1286
+ // id: "" //<= to remove
1287
+ // level: "section" // <= to remove
1288
+ // options: {bg: {…}}
1289
+ // ver_ini: "1.1.8"
1290
+ // }
1291
  preProcessSektion : function( sectionModel ) {
1292
  var self = this, sektionCandidate = self.cleanIds( sectionModel );
1293
  return _.omit( sektionCandidate, function( val, key ) {
1294
  return _.contains( ['id', 'level'], key );
1295
  });
1296
  },
1297
+
1298
+
1299
+ //@param = { }
1300
  renderAndSetupSaveUITmpl : function( params ) {
1301
  if ( $( '#nimble-top-save-ui' ).length > 0 )
1302
  return $( '#nimble-top-save-ui' );
1310
  return false;
1311
  }
1312
  $('#customize-preview').after( $( _tmpl ) );
1313
+
1314
+ // Attach click events
1315
  $('.sek-do-save-section', '#nimble-top-save-ui').on( 'click', function(evt) {
1316
  evt.preventDefault();
1317
  var sectionModel = $.extend( true, {}, self.getLevelModel( $('#sek-saved-section-id').val() ) ),
1345
  sek_data: JSON.stringify( sek_data )
1346
  })
1347
  .done( function( response ) {
1348
+ // response is {section_post_id: 436}
1349
+ //self.saveUIVisible( false );
1350
  api.previewer.trigger('sek-notify', {
1351
  type : 'success',
1352
  duration : 10000,
1380
  }
1381
  });//$.extend()
1382
  })( wp.customize, jQuery );
1383
+ //global sektionsLocalizedData
1384
  var CZRSeksPrototype = CZRSeksPrototype || {};
1385
  (function ( api, $ ) {
1386
  $.extend( CZRSeksPrototype, {
1387
+ // Fired on api 'ready', in reaction to ::setContextualCollectionSettingIdWhenSkopeSet => ::localSectionsSettingId
1388
+ // 1) register the collection setting nimble___[{$skope_id}] ( ex : nimble___[skp__post_page_20] )
1389
+ // 2) validate that the setting is well formed before being changed
1390
+ // 3) schedule reactions on change ?
1391
+ // @return void()
1392
  setupSettingsToBeSaved : function() {
1393
  var self = this,
1394
  serverCollection;
1395
+
1396
+ // maybe register the sektion_collection settings
1397
  var _settingsToRegister_ = {
1398
  'local' : { collectionSettingId : self.localSectionsSettingId() },//<= "nimble___[skp__post_page_10]"
1399
  'global' : { collectionSettingId : self.getGlobalSectionsSettingId() }//<= "nimble___[skp__global]"
1404
  if ( _.isEmpty( settingData.collectionSettingId ) ) {
1405
  throw new Error( 'setupSettingsToBeSaved => the collectionSettingId is invalid' );
1406
  }
1407
+ // if the collection setting is not registered yet
1408
+ // => register it and bind it
1409
+ // => ensure that it will be bound only once, because the setting are never unregistered
1410
  if ( ! api.has( settingData.collectionSettingId ) ) {
1411
  var __collectionSettingInstance__ = api.CZR_Helpers.register({
1412
  what : 'setting',
1417
  track : false,//don't register in the self.registered()
1418
  origin : 'nimble'
1419
  });
1420
+
1421
+
1422
+ //if ( sektionsLocalizedData.isDevMode ) {}
1423
  api( settingData.collectionSettingId, function( sektionSetInstance ) {
1424
+
1425
+ // Schedule reactions to a collection change
1426
  sektionSetInstance.bind( _.debounce( function( newSektionSettingValue, previousValue, params ) {
1427
+ // api.infoLog( 'sektionSettingValue is updated',
1428
+ // {
1429
+ // newValue : newSektionSettingValue,
1430
+ // previousValue : previousValue,
1431
+ // params : params
1432
+ // }
1433
+ // );
1434
  self.trackHistoryLog( sektionSetInstance, params );
1435
 
1436
  }, 1000 ) );
1437
  });//api( settingData.collectionSettingId, function( sektionSetInstance ){}
1438
  }//if ( ! api.has( settingData.collectionSettingId ) ) {
1439
  });//_.each(
1440
+
1441
+ // global options for all collection setting of this skope_id
1442
+ // loop_start, before_content, after_content, loop_end
1443
+
1444
+ // Global Options : section
1445
+ // api.CZR_Helpers.register({
1446
+ // what : 'section',
1447
+ // id : sektionsLocalizedData.optPrefixForSektionGlobalOptsSetting,//'__sektions__'
1448
+ // title: 'Global Options',
1449
+ // priority : 1000,
1450
+ // constructWith : SektionPanelConstructor,
1451
+ // track : false//don't register in the self.registered()
1452
+ // });
1453
+
1454
+ // // => register a control
1455
+ // // Template
1456
+ // api.CZR_Helpers.register({
1457
+ // what : 'control',
1458
+ // id : sektionsLocalizedData.sektionsPanelId,//'__sektions__'
1459
+ // title: 'Main sektions panel',
1460
+ // priority : 1000,
1461
+ // constructWith : SektionPanelConstructor,
1462
+ // track : false//don't register in the self.registered()
1463
+ // });
1464
  },// SetupSettingsToBeSaved()
1465
+
1466
+
1467
+ // React to a local or global setting change api( settingData.collectionSettingId )
1468
  trackHistoryLog : function( sektionSetInstance, params ) {
1469
  var self = this,
1470
  _isGlobal = sektionSetInstance.id === self.getGlobalSectionsSettingId();
1471
+
1472
+ // Track changes, if not currently navigating the logs
1473
+ // Always clean future values if the logs have been previously navigated back
1474
  if ( params && true !== params.navigatingHistoryLogs ) {
1475
  var newHistoryLog = [],
1476
  historyLog = $.extend( true, [], self.historyLog() ),
1481
  } else if ( ! _.isEmpty( params.to_sektion ) ) {// column moved /
1482
  sektionToRefresh = params.to_sektion;
1483
  }
1484
+
1485
+ // Reset all status but 'future' to 'previous'
1486
  _.each( historyLog, function( log ) {
1487
  var newStatus = 'previous';
1488
  if ( 'future' == log.status )
1499
  self.historyLog( newHistoryLog );
1500
  }
1501
  },
1502
+
1503
+
1504
+
1505
+ // Fired in ::initialize(), at api 'ready'
1506
  initializeHistoryLogWhenSettingsRegistered : function() {
1507
  var self = this;
1508
+ // This api.Value() is bound in ::setupTopBar
1509
  self.historyLog = new api.Value([{
1510
  status : 'current',
1511
  value : {
1514
  },
1515
  action : 'initial'
1516
  }]);
1517
+ // LISTEN TO HISTORY LOG CHANGES TO UPDATE THE BUTTON STATE
1518
  self.historyLog.bind( function( newLog ) {
1519
  if ( _.isEmpty( newLog ) )
1520
  return;
1530
  });
1531
  });
1532
  },
1533
+
1534
+ // Fired :
1535
+ // 1) when instantiating the setting
1536
+ // 2) on each setting change, as an override of api.Value::validate( to ) @see customize-base.js
1537
+ // @return {} or null if did not pass the checks
1538
  validateSettingValue : function( valCandidate ) {
1539
  if ( ! _.isObject( valCandidate ) ) {
1540
  api.errare('validation error => the setting should be an object', valCandidate );
1543
  var parentLevel = {},
1544
  errorDetected = false,
1545
  levelIds = [];
1546
+ // walk the collections tree and verify it passes the various consistency checks
1547
  var _errorDetected_ = function( msg ) {
1548
  api.errare( msg , valCandidate );
1549
  api.previewer.trigger('sek-notify', {
1553
  '<span style="font-size:0.95em">',
1554
  '<strong>' + msg + '</strong>',
1555
  '<br>',
1556
+ sektionsLocalizedData.i18n['If this problem locks Nimble Builder, you can try resetting the sections of this page.'],
1557
  '<br>',
1558
  '<span style="text-align:center;display:block">',
1559
  '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n.Reset + '" data-sek-reset="true">' + sektionsLocalizedData.i18n.Reset + '</button>',
1569
  return;
1570
  }
1571
  if ( _.isUndefined( level ) && _.isEmpty( parentLevel ) ) {
1572
+ // we are at the root level
1573
  level = $.extend( true, {}, valCandidate );
1574
  if ( _.isUndefined( level.id ) || _.isUndefined( level.level ) ) {
1575
+ // - there should be no 'level' property or 'id'
1576
+ // - there should be a collection of registered locations
1577
+ // - there should be no parent level defined
1578
  if ( _.isUndefined( level.collection ) ) {
1579
  _errorDetected_( 'validation error => the root level is missing the collection of locations' );
1580
  return;
1583
  _errorDetected_( 'validation error => the root level should not have a "level" or an "id" property' );
1584
  return;
1585
  }
1586
+
1587
+ // Walk the section collection
1588
  _.each( valCandidate.collection, function( _l_ ) {
1589
+ // Set the parent level now
1590
  parentLevel = level;
1591
+ // walk
1592
  _checkWalker_( _l_ );
1593
  });
1594
  }
1595
  } else {
1596
+ // we have a level.
1597
+ // - make sure we have at least the following properties : id, level
1598
+
1599
+ // ID
1600
  if ( _.isEmpty( level.id ) || ! _.isString( level.id )) {
1601
  _errorDetected_('validation error => a ' + level.level + ' level must have a valid id' );
1602
  return;
1606
  } else {
1607
  levelIds.push( level.id );
1608
  }
1609
+
1610
+ // OPTIONS
1611
+ // if ( _.isEmpty( level.options ) || ! _.isObject( level.options )) {
1612
+ // _errorDetected_('validation error => a ' + level.level + ' level must have a valid options property' );
1613
+ // return;
1614
+ // }
1615
+
1616
+ // LEVEL
1617
  if ( _.isEmpty( level.level ) || ! _.isString( level.level ) ) {
1618
  _errorDetected_('validation error => a ' + level.level + ' level must have a level property' );
1619
  return;
1621
  _errorDetected_('validation error => the level "' + level.level + '" is not authorized' );
1622
  return;
1623
  }
1624
+
1625
+ // - Unless we are in a module, there should be a collection property
1626
+ // - make sure a module doesn't have a collection property
1627
  if ( 'module' == level.level ) {
1628
  if ( ! _.isUndefined( level.collection ) ) {
1629
  _errorDetected_('validation error => a module can not have a collection property' );
1635
  return;
1636
  }
1637
  }
1638
+
1639
+ // a level should always have a version "ver_ini" property
1640
  if ( _.isUndefined( level.ver_ini ) ) {
1641
+ //_errorDetected_('validation error => a ' + level.level + ' should have a version property : "ver_ini"' );
1642
+ //return;
1643
  api.errare( 'validateSettingValue() => validation error => a ' + level.level + ' should have a version property : "ver_ini"' );
1644
  }
1645
+
1646
+ // Specific checks by level type
1647
  switch ( level.level ) {
1648
  case 'location' :
1649
  if ( ! _.isEmpty( parentLevel.level ) ) {
1677
  }
1678
  break;
1679
  }
1680
+
1681
+ // If we are not in a module, keep walking the collections
1682
  if ( 'module' != level.level ) {
1683
  _.each( level.collection, function( _l_ ) {
1684
+ // Set the parent level now
1685
  parentLevel = $.extend( true, {}, level );
1686
+ // And walk sub levels
1687
  _checkWalker_( _l_ );
1688
  });
1689
  }
1690
  }
1691
  };
1692
  _checkWalker_();
1693
+
1694
+ //api.infoLog('in ::validateSettingValue', valCandidate );
1695
+ // if null is returned, the setting value is not set @see customize-base.js
1696
  return errorDetected ? null : valCandidate;
1697
  },//validateSettingValue
1698
+
1699
+
1700
+
1701
+ // triggered when clicking on [data-sek-reset="true"]
1702
+ // scheduled in ::initialize()
1703
+ // Note :
1704
+ // 1) this is not a real reset, the customizer setting is set to self.getDefaultSektionSettingValue( 'local' )
1705
+ // @see php function which defines the defaults
1706
+ // function sek_get_default_location_model() {
1707
+ // $defaut_sektions_value = [ 'collection' => [], 'options' => [] ];
1708
+ // foreach( sek_get_locations() as $location ) {
1709
+ // $defaut_sektions_value['collection'][] = [
1710
+ // 'id' => $location,
1711
+ // 'level' => 'location',
1712
+ // 'collection' => [],
1713
+ // 'options' => []
1714
+ // ];
1715
+ // }
1716
+ // return $defaut_sektions_value;
1717
+ // }
1718
+ // 2) a real reset should delete the sektion post ( nimble_post_type, with for example title nimble___skp__post_page_21 ) and its database option storing its id ( for example : nimble___skp__post_page_21 )
1719
  resetCollectionSetting : function() {
1720
  var self = this;
1721
  if ( _.isEmpty( self.localSectionsSettingId() ) ) {
1722
  throw new Error( 'setupSettingsToBeSaved => the collectionSettingId is invalid' );
1723
  }
1724
+ // reset the setting to default
1725
  api( self.localSectionsSettingId() )( self.getDefaultSektionSettingValue( 'local' ) );
1726
+ // refresh the preview
1727
  api.previewer.refresh();
1728
+ // remove any previous notification
1729
  api.notifications.remove( 'sek-notify' );
1730
+ // display a success msg
1731
  api.panel( sektionsLocalizedData.sektionsPanelId, function( __main_panel__ ) {
1732
  api.notifications.add( new api.Notification( 'sek-reset-done', {
1733
  type: 'success',
1734
  message: sektionsLocalizedData.i18n['Reset complete'],
1735
  dismissible: true
1736
  } ) );
1737
+
1738
+ // Removed if not dismissed after 5 seconds
1739
  _.delay( function() {
1740
  api.notifications.remove( 'sek-reset-done' );
1741
  }, 5000 );
1746
  var CZRSeksPrototype = CZRSeksPrototype || {};
1747
  (function ( api, $ ) {
1748
  $.extend( CZRSeksPrototype, {
1749
+ // invoked on api('ready') from self::initialize()
1750
+ // update the main setting OR generate a UI in the panel
1751
+ // AND
1752
+ // always send back a confirmation to the preview, so we can fire the ajax actions
1753
+ // the message sent back is used in particular to
1754
+ // - always pass the location_skope_id, which otherwise would be impossible to get in ajax
1755
+ // - in a duplication case, to pass the the newly generated id of the cloned level
1756
  reactToPreviewMsg : function() {
1757
  var self = this,
1758
  apiParams = {},
1759
  uiParams = {},
1760
  sendToPreview = true, //<= the default behaviour is to send a message to the preview when the setting has been changed
1761
  msgCollection = {
1762
+ // A section can be added in various scenarios :
1763
+ // - when clicking on the ( + ) Insert content => @see preview::scheduleUiClickReactions() => addContentButton
1764
+ // - when adding a nested section to a column
1765
+ // - when dragging a module in a 'between-sections' or 'in-empty-location' drop zone
1766
+ //
1767
+ // Note : if the target location level already has section(s), then the section is appended in ajax, at the right place
1768
+ // Note : if the target location is empty ( is_first_section is true ), nothing is send to the preview when updating the api setting, and we refresh the location level. => this makes sure that we removes the placeholder printed in the previously empty location
1769
  'sek-add-section' : {
1770
  callback : function( params ) {
1771
  sendToPreview = ! _.isUndefined( params.send_to_preview ) ? params.send_to_preview : true;//<= when the level is refreshed when complete, we don't need to send to preview.
1784
  return self.updateAPISetting( apiParams );
1785
  },
1786
  complete : function( params ) {
1787
+ // When a section is created ( not duplicated )
1788
  if ( params.apiParams.is_first_section ) {
1789
  api.previewer.trigger( 'sek-refresh-level', {
1790
  level : 'location',
1792
  });
1793
  }
1794
  api.previewer.trigger( 'sek-pick-content', {
1795
+ // the "id" param is added to set the target for double click insertion
1796
+ // implemented for https://github.com/presscustomizr/nimble-builder/issues/317
1797
  id : params.apiParams ? params.apiParams.id : '',
1798
  content_type : 'section'
1799
  });
1815
  return self.updateAPISetting( apiParams );
1816
  },
1817
  complete : function( params ) {
1818
+ // When adding a section, a nested column is automatically added
1819
+ // We want to focus on the module picker in this case, that's why the autofocus is set to false
1820
+ // @see 'sek-add-section' action description
1821
  if ( false !== params.apiParams.autofocus ) {
1822
  api.previewer.trigger( 'sek-pick-content', {});
1823
  }
1846
  in_sektion : params.apiParams.in_sektion,
1847
  in_column : params.apiParams.in_column
1848
  });
1849
+ // always update the root fonts property after a module addition
1850
+ // because there might be a google font specified in the starting value
1851
  self.updateAPISetting({
1852
  action : 'sek-update-fonts',
1853
  is_global_location : self.isGlobalLocation( params.apiParams )
1854
  });
1855
+
1856
+ // Refresh the stylesheet to generate the css rules of the clone
1857
+ // api.previewer.send( 'sek-refresh-stylesheet', {
1858
+ // location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
1859
+ // });
1860
  api.previewer.trigger('sek-refresh-stylesheet', {
1861
  id : params.apiParams.in_column,
1862
  location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
1906
  },
1907
  complete : function( params ) {
1908
  api.previewer.trigger( 'sek-pick-content', {});
1909
+ // always update the root fonts property after a removal
1910
+ // because the removed level(s) might had registered fonts
1911
  self.updateAPISetting({
1912
  action : 'sek-update-fonts',
1913
  is_global_location : self.isGlobalLocation( params.apiParams )
1914
  });
1915
+
1916
+ // When the last section of a location gets removed, make sure we refresh the location level, to print the sek-empty-location-placeholder
1917
  if ( 'sek-remove-section' === params.apiParams.action ) {
1918
  var locationLevel = self.getLevelModel( params.apiParams.location );
1919
  if ( _.isEmpty( locationLevel.collection ) ) {
1972
  level : 'section',
1973
  in_sektion : params.apiParams.id
1974
  });
1975
+ // refresh location levels if the source and target location are differents
1976
  if ( params.apiParams.from_location != params.apiParams.to_location ) {
1977
  api.previewer.trigger( 'sek-refresh-level', {
1978
  level : 'location',
2046
  });
2047
  }
2048
  },
2049
+
2050
+ // the level will be cloned and walked to replace all ids by new one
2051
+ // then the level clone id will be send back to the preview for the ajax rendering ( this is done in updateAPISetting() promise() )
2052
  'sek-duplicate' : {
2053
  callback : function( params ) {
2054
  sendToPreview = true;
2093
  in_sektion : params.apiParams.id
2094
  });
2095
  idForStyleSheetRefresh = params.apiParams.location;
2096
+ // Focus on the cloned level
2097
  api.previewer.send('sek-animate-to-level', { id : params.apiParams.id });
2098
  break;
2099
  case 'sek-duplicate-column' :
2115
  idForStyleSheetRefresh = params.apiParams.in_column;
2116
  break;
2117
  }
2118
+ // Refresh the stylesheet to generate the css rules of the clone
2119
+ // api.previewer.send( 'sek-refresh-stylesheet', {
2120
+ // location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2121
+ // });
2122
  api.previewer.trigger('sek-refresh-stylesheet', {
2123
  id : idForStyleSheetRefresh,
2124
  location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
2132
  apiParams = params;
2133
  return self.updateAPISetting( apiParams );
2134
  },
2135
+
2136
+ // @params {
2137
+ // drop_target_element : $(this),
2138
+ // position : _position,
2139
+ // before_section : $(this).data('sek-before-section'),
2140
+ // after_section : $(this).data('sek-after-section'),
2141
+ // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ),
2142
+ // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
2143
+ // }
2144
  'sek-add-content-in-new-sektion' : {
2145
  callback : function( params ) {
2146
  sendToPreview = ! _.isUndefined( params.send_to_preview ) ? params.send_to_preview : true;//<= when the level is refreshed when complete, we don't need to send to preview.
2149
  apiParams.action = 'sek-add-content-in-new-sektion';
2150
  apiParams.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();//we set the id here because it will be needed when ajaxing
2151
  switch( params.content_type) {
2152
+ // When a module is dropped in a section + column structure to be generated
2153
  case 'module' :
2154
  apiParams.droppedModuleId = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();//we set the id here because it will be needed when ajaxing
2155
  break;
2156
+
2157
+ // When a preset section is dropped
2158
  case 'preset_section' :
2159
  api.previewer.send( 'sek-maybe-print-loader', { loader_located_in_level_id : params.location });
2160
  api.previewer.send( 'sek-maybe-print-loader', { fullPageLoader : true });
2170
  id : params.apiParams.droppedModuleId
2171
  });
2172
  break;
2173
+ // Clean the full page loader if not autocleaned yet
2174
  case 'preset_section' :
2175
  api.previewer.send( 'sek-clean-loader', { cleanFullPageLoader : true });
2176
  break;
2177
  }
2178
+
2179
+ // Always update the root fonts property after a module addition
2180
+ // => because there might be a google font specified in the starting value or in a preset section
2181
  self.updateAPISetting({
2182
  action : 'sek-update-fonts',
2183
  is_global_location : self.isGlobalLocation( params.apiParams )
2184
  });
2185
+
2186
+ // Refresh the stylesheet to generate the css rules of the clone
2187
+ // api.previewer.send( 'sek-refresh-stylesheet', {
2188
+ // location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2189
+ // });
2190
+
2191
+ // Use the location_skope_id provided if set, otherwise generate it
2192
  var location_skope_id = params.location_skope_id;
2193
  if ( _.isUndefined( location_skope_id ) ) {
2194
  location_skope_id = true === params.is_global_location ? sektionsLocalizedData.globalSkopeId : api.czr_skopeBase.getSkopeProperty( 'skope_id' );
2195
  }
2196
  api.previewer.trigger('sek-refresh-stylesheet', {
2197
+ //id : params.apiParams.location,
2198
  location_skope_id : location_skope_id,//<= send skope id to the preview so we can use it when ajaxing
2199
  is_global_location : self.isGlobalLocation( params.apiParams )
2200
  });
2201
+
2202
+ // Refresh when a section is created ( not duplicated )
2203
  if ( params.apiParams.is_first_section ) {
2204
  api.previewer.trigger( 'sek-refresh-level', {
2205
  level : 'location',
2206
  id : params.apiParams.location
2207
  });
2208
  }
2209
+
2210
+ // Remove the sektion_to_replace when dropping a preset_section in an empty section ( <= the one to replace )
2211
  if ( params.apiParams.sektion_to_replace ) {
2212
  api.previewer.trigger( 'sek-remove', {
2213
  id : params.apiParams.sektion_to_replace,
2216
  level : 'section'
2217
  });
2218
  }
2219
+
2220
+ // Refresh the stylesheet again after a delay
2221
+ // For the moment, some styling, like fonts are not
2222
+ // @todo fix => see why we need to do it.
2223
+ // _.delay( function() {
2224
+ // // Refresh the stylesheet to generate the css rules of the module
2225
+ // api.previewer.send( 'sek-refresh-stylesheet', {
2226
+ // location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2227
+ // });
2228
+ // }, 1000 );
2229
  }
2230
  },
2231
+
2232
+
2233
+ // @params {
2234
+ // drop_target_element : $(this),
2235
+ // position : _position,
2236
+ // before_section : $(this).data('sek-before-section'),
2237
+ // after_section : $(this).data('sek-after-section'),
2238
+ // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ),
2239
+ // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
2240
+ // }
2241
  'sek-add-preset-section-in-new-nested-sektion' : {
2242
  callback : function( params ) {
2243
  sendToPreview = false;//<= when the level is refreshed when complete, we don't need to send to preview.
2249
  return self.updateAPISetting( apiParams );
2250
  },
2251
  complete : function( params ) {
2252
+ // Refresh the stylesheet to generate the css rules of the clone
2253
+ // api.previewer.send( 'sek-refresh-stylesheet', {
2254
+ // location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2255
+ // });
2256
  api.previewer.trigger('sek-refresh-stylesheet', {
2257
  id : params.apiParams.in_sektion,
2258
  location_skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' )//<= send skope id to the preview so we can use it when ajaxing
2259
  });
2260
+
2261
+ // Always update the root fonts property after a module addition
2262
+ // => because there might be a google font specified in the starting value or in a preset section
2263
  self.updateAPISetting({
2264
  action : 'sek-update-fonts',
2265
  is_global_location : self.isGlobalLocation( params.apiParams )
2271
  });
2272
  }
2273
  },
2274
+
2275
+
2276
+
2277
+
2278
+
2279
+
2280
+
2281
+ // GENERATE UI ELEMENTS
2282
  'sek-pick-content' : function( params ) {
2283
  params = _.isObject(params) ? params : {};
2284
+ // Set the active content type here
2285
+ // This is used in api.czrInputMap.content_type_switcher()
2286
+ // Fixes issue https://github.com/presscustomizr/nimble-builder/issues/248
2287
  api.czr_sektions.currentContentPickerType = api.czr_sektions.currentContentPickerType || new api.Value();
2288
  api.czr_sektions.currentContentPickerType( params.content_type || 'module' );
2289
+
2290
+ // Set the last clicked target element id now => will be used for double click insertion of module / section
2291
  if ( _.isObject( params ) && params.id ) {
2292
+ // self reset after a moment.
2293
+ // @see CZRSeksPrototype::initialize
2294
+ // implemented for https://github.com/presscustomizr/nimble-builder/issues/317
2295
  self.lastClickedTargetInPreview( { id : params.id } );
2296
  }
2297
 
2301
  uiParams = {
2302
  action : 'sek-generate-draggable-candidates-picker-ui',
2303
  content_type : params.content_type || 'module',
2304
+ // <= the "was_triggered" param can be used to determine if we need to animate the picker control or not. @see ::generateUI() case 'sek-generate-draggable-candidates-picker-ui'
2305
+ // true by default, because this is the most common scenario ( when adding a section, a column ... )
2306
+ // but false when clicking on the + ui icon in the preview
2307
  was_triggered : _.has( params, 'was_triggered' ) ? params.was_triggered : true,
2308
  focus : _.has( params, 'focus' ) ? params.focus : true
2309
  };
2341
  };
2342
  return self.generateUI( uiParams );
2343
  },
2344
+
2345
+
2346
+ // OTHER MESSAGE TYPES
2347
+ // @params {
2348
+ // type : info, error, success
2349
+ // message : ''
2350
+ // duration : in ms
2351
+ // }
2352
  'sek-notify' : function( params ) {
2353
  sendToPreview = false;
2354
  return $.Deferred(function() {
2358
  message: params.message,
2359
  dismissible: true
2360
  } ) );
2361
+
2362
+ // Removed if not dismissed after 5 seconds
2363
  _.delay( function() {
2364
  api.notifications.remove( 'sek-notify' );
2365
  }, params.duration || 5000 );
2366
  });
2367
+ // always pass the local or global skope of the currently customized location id when resolving the promise.
2368
+ // It will be send to the preview and used when ajaxing
2369
  this.resolve({
2370
  is_global_location : self.isGlobalLocation( params )
2371
  });
2381
  id : params.id
2382
  };
2383
  uiParams = {};
2384
+ // always pass the local or global skope of the currently customized location id when resolving the promise.
2385
+ // It will be send to the preview and used when ajaxing
2386
  _dfd_.resolve({
2387
  is_global_location : self.isGlobalLocation( params )
2388
  });
2395
  return $.Deferred(function(_dfd_) {
2396
  apiParams = {id : params.id};
2397
  uiParams = {};
2398
+ // always pass the local or global skope of the currently customized location id when resolving the promise.
2399
+ // It will be send to the preview and used when ajaxing
2400
  _dfd_.resolve({
2401
  is_global_location : self.isGlobalLocation( params )
2402
  });
2408
  self.saveUIVisible( true, params );
2409
  return $.Deferred(function(_dfd_) {
2410
  apiParams = {
2411
+ // action : 'sek-refresh-level',
2412
+ // level : params.level,
2413
+ // id : params.id
2414
  };
2415
  uiParams = {};
2416
+ // always pass the local or global skope of the currently customized location id when resolving the promise.
2417
+ // It will be send to the preview and used when ajaxing
2418
  _dfd_.resolve({
2419
  is_global_location : self.isGlobalLocation( params )
2420
  });
2421
  });
2422
  }
2423
  };//msgCollection
2424
+
2425
+ // Schedule the reactions
2426
+ // May be send a message to the preview
2427
  _.each( msgCollection, function( callbackFn, msgId ) {
2428
  api.previewer.bind( msgId, function( params ) {
2429
  var _cb_;
2437
  }
2438
 
2439
  try { _cb_( params )
2440
+ // the cloneId is passed when resolving the ::updateAPISetting() promise()
2441
+ // they are needed on level duplication to get the newly generated level id.
2442
  .done( function( promiseParams ) {
2443
  promiseParams = promiseParams || {};
2444
+ // Send to the preview
2445
  if ( sendToPreview ) {
2446
  api.previewer.send(
2447
  msgId,
2454
  }
2455
  );
2456
  } else {
2457
+ // if nothing was sent to the preview, trigger the '*_done' action so we can execute the 'complete' callback
2458
  api.previewer.trigger( [ msgId, 'done' ].join('_'), { apiParams : apiParams, uiParams : uiParams } );
2459
  }
2460
+ // say it
2461
  self.trigger( [ msgId, 'done' ].join('_'), params );
2462
  })
2463
  .fail( function( er ) {
2464
  api.errare( 'reactToPreviewMsg => error when firing ' + msgId, er );
2465
+ // api.panel( sektionsLocalizedData.sektionsPanelId, function( __main_panel__ ) {
2466
+ // api.notifications.add( new api.Notification( 'sek-react-to-preview', {
2467
+ // type: 'info',
2468
+ // message: er,
2469
+ // dismissible: true
2470
+ // } ) );
2471
+
2472
+ // // Removed if not dismissed after 5 seconds
2473
+ // _.delay( function() {
2474
+ // api.notifications.remove( 'sek-react-to-preview' );
2475
+ // }, 5000 );
2476
+ // });
2477
  api.previewer.trigger('sek-notify', {
2478
  type : 'error',
2479
  duration : 30000,
2481
  '<span style="font-size:0.95em">',
2482
  '<strong>' + er + '</strong>',
2483
  '<br>',
2484
+ sektionsLocalizedData.i18n['If this problem locks Nimble Builder, you can try resetting the sections of this page.'],
2485
  '<br>',
2486
  '<span style="text-align:center;display:block">',
2487
  '<button type="button" class="button" aria-label="' + sektionsLocalizedData.i18n.Reset + '" data-sek-reset="true">' + sektionsLocalizedData.i18n.Reset + '</button>',
2495
  }
2496
  });
2497
  });
2498
+
2499
+
2500
+ // Schedule actions when callback done msg is sent by the preview
2501
  _.each( msgCollection, function( callbackFn, msgId ) {
2502
  api.previewer.bind( [ msgId, 'done' ].join('_'), function( params ) {
2503
  if ( _.isFunction( callbackFn.complete ) ) {
2508
  });
2509
  });
2510
  },//reactToPreview();
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+
2517
+ // Fired in initialized on api(ready)
2518
  schedulePrintSectionJson : function() {
2519
  var self = this;
2520
  var popupCenter = function ( content ) {
2521
  w = 400;
2522
  h = 300;
2523
+ // Fixes dual-screen position Most browsers Firefox
2524
  var dualScreenLeft = ! _.isUndefined( window.screenLeft ) ? window.screenLeft : window.screenX;
2525
  var dualScreenTop = ! _.isUndefined( window.screenTop ) ? window.screenTop : window.screenY;
2526
 
2534
  doc.open("text/html");
2535
  doc.write( content );
2536
  doc.close();
2537
+ // Puts focus on the newWindow
2538
  if (window.focus) {
2539
  newWindow.focus();
2540
  }
2543
  api.previewer.bind( 'sek-to-json', function( params ) {
2544
  var sectionModel = $.extend( true, {}, self.getLevelModel( params.id ) );
2545
  console.log( JSON.stringify( self.cleanIds( sectionModel ) ) );
2546
+ //popupCenter( JSON.stringify( cleanIds( sectionModel ) ) );
2547
  });
2548
  }//schedulePrintSectionJson
2549
  });//$.extend()
2551
  var CZRSeksPrototype = CZRSeksPrototype || {};
2552
  (function ( api, $ ) {
2553
  $.extend( CZRSeksPrototype, {
2554
+ // @params = {
2555
+ // action : 'sek-generate-module-ui' / 'sek-generate-level-options-ui'
2556
+ // level : params.level,
2557
+ // id : params.id,
2558
+ // in_sektion : params.in_sektion,
2559
+ // in_column : params.in_column,
2560
+ // options : params.options || []
2561
+ // }
2562
+ // @return promise()
2563
  generateUI : function( params ) {
2564
  var self = this,
2565
  dfd = $.Deferred();
2567
  if ( _.isEmpty( params.action ) ) {
2568
  dfd.reject( 'generateUI => missing action' );
2569
  }
2570
+
2571
+ // REGISTER SETTING AND CONTROL
2572
  switch ( params.action ) {
2573
+ // FRONT AND LEVEL MODULES UI
2574
+ // The registered elements are cleaned (self.cleanRegistered()) in the callbacks,
2575
+ // because we want to check if the requested UI is not the one already rendered, and fire a button-see-me animation if yes.
2576
  case 'sek-generate-module-ui' :
2577
  try{ dfd = self.generateUIforFrontModules( params, dfd ); } catch( er ) {
2578
  api.errare( '::generateUI() => error', er );
2586
  dfd = $.Deferred();
2587
  }
2588
  break;
2589
+
2590
+ // Possible content types :
2591
+ // 1) module
2592
+ // 2) preset_section
2593
  case 'sek-generate-draggable-candidates-picker-ui' :
2594
+ // Clean previously generated UI elements
2595
  self.cleanRegistered();
2596
  try{ dfd = self.generateUIforDraggableContent( params, dfd ); } catch( er ) {
2597
  api.errare( '::generateUI() => error', er );
2598
  dfd = $.Deferred();
2599
  }
2600
  break;
2601
+
2602
+ // Fired in ::initialize()
2603
  case 'sek-generate-local-skope-options-ui' :
2604
+ // Clean previously generated UI elements
2605
  self.cleanRegistered();
2606
  try{ dfd = self.generateUIforLocalSkopeOptions( params, dfd ); } catch( er ) {
2607
  api.errare( '::generateUI() => error', er );
2608
  dfd = $.Deferred();
2609
  }
2610
  break;
2611
+
2612
+ // Fired in ::initialize()
2613
  case 'sek-generate-global-options-ui' :
2614
+ // Clean previously generated UI elements
2615
  self.cleanRegistered();
2616
  try{ dfd = self.generateUIforGlobalOptions( params, dfd ); } catch( er ) {
2617
  api.errare( '::generateUI() => error', er );
2622
 
2623
  return 'pending' == dfd.state() ? dfd.resolve().promise() : dfd.promise();//<= we might want to resolve on focus.completeCallback ?
2624
  },//generateUI()
2625
+
2626
+
2627
+
2628
+
2629
+
2630
+
2631
+
2632
+ // @params = {
2633
+ // uiParams : params,
2634
+ // options_type : 'spacing',
2635
+ // settingParams : {
2636
+ // to : to,
2637
+ // from : from,
2638
+ // args : args
2639
+ // }
2640
+ // }
2641
+ //
2642
+ // @param settingParams.args = {
2643
+ // inputRegistrationParams : {
2644
+ // id :,
2645
+ // type :
2646
+ // refresh_markup : bool
2647
+ // refresh_stylesheet : bool
2648
+ // refresh_fonts : bool
2649
+ // }
2650
+ // input_changed : input_id
2651
+ // input_transport : 'inherit'/'postMessage',
2652
+ // module : { items : [...]}
2653
+ // module_id :
2654
+ // not_preview_sent : bool
2655
+ //}
2656
+ //
2657
+ // Note 1 : this method must handle two types of modules :
2658
+ // 1) mono item modules, for which the settingParams.to is an object, a single item object
2659
+ // 2) multi-items modules, for which the settingParams.to is an array, a collection of item objects
2660
+ // How do we know that we are a in single / multi item module ?
2661
+ //
2662
+ // Note 2 : we must also handle several scenarios of module value update :
2663
+ // 1) mono-items and multi-items module => input change
2664
+ // 2) crud multi item => item added or removed => in this case some args are not passed, like params.settingParams.args.inputRegistrationParams
2665
  updateAPISettingAndExecutePreviewActions : function( params ) {
2666
  if ( _.isEmpty( params.settingParams ) || ! _.has( params.settingParams, 'to' ) ) {
2667
  api.errare( 'updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated', params );
2668
  return;
2669
  }
2670
  var self = this;
2671
+
2672
+ // NORMALIZE THE VALUE WE WANT TO WRITE IN THE MAIN SETTING
2673
+ // 1) We don't want to store the default title and id module properties
2674
+ // 2) We don't want to write in db the properties that are set to their default values
2675
  var rawModuleValue = params.settingParams.to,
2676
  moduleValueCandidate,// {} or [] if mono item of multi-item module
2677
  parentModuleType = null,
2692
  } else {
2693
  api.errare( 'updateAPISettingAndExecutePreviewActions => missing parentModuleInstance', params );
2694
  }
2695
+
2696
+
2697
+
2698
+ // The new module value can be a single item object if monoitem module, or an array of item objects if multi-item crud
2699
+ // Let's normalize it
2700
  if ( ! isMultiItemModule && _.isObject( rawModuleValue ) ) {
2701
  moduleValueCandidate = self.normalizeAndSanitizeSingleItemInputValues( rawModuleValue, parentModuleType );
2702
  } else {
2705
  moduleValueCandidate.push( self.normalizeAndSanitizeSingleItemInputValues( item, parentModuleType ) );
2706
  });
2707
  }
2708
+
2709
+ // WHAT TO REFRESH IN THE PREVIEW ? Markup, stylesheet, font ?
2710
+ // The action to trigger is determined by the changed input
2711
+ // For the options of a level, the default action is to refresh the stylesheet.
2712
+ // But we might need to refresh the markup in some cases. Like for example when a css class is added. @see the boxed-wide layout example
2713
  if ( _.isEmpty( params.defaultPreviewAction ) ) {
2714
  api.errare( 'updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.', params );
2715
  return;
2716
  }
2717
+ // Set the default value
2718
  var refresh_stylesheet = 'refresh_stylesheet' === params.defaultPreviewAction,//<= default action for level options
2719
  refresh_markup = 'refresh_markup' === params.defaultPreviewAction,//<= default action for module options
2720
  refresh_fonts = 'refresh_fonts' === params.defaultPreviewAction,
2721
  refresh_preview = 'refresh_preview' === params.defaultPreviewAction;
2722
+
2723
+ // Maybe set the input based value
2724
  var input_id = params.settingParams.args.input_changed;
2725
  var inputRegistrationParams;
2726
  if ( ! _.isUndefined( input_id ) ) {
2740
  }
2741
 
2742
  var _doUpdateWithRequestedAction = function() {
2743
+ // GLOBAL OPTIONS CASE => SITE WIDE => WRITING IN A SPECIFIC OPTION, SEPARATE FROM THE SEKTION
2744
  if ( true === params.isGlobalOptions ) {
2745
  if ( _.isEmpty( params.options_type ) ) {
2746
  api.errare( 'updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type');
2747
  return;
2748
  }
2749
+ //api( sektionsLocalizedData.optNameForGlobalOptions )() is registered on ::initialize();
2750
  var rawGlobalOptions = api( sektionsLocalizedData.optNameForGlobalOptions )(),
2751
  clonedGlobalOptions = $.extend( true, {}, _.isObject( rawGlobalOptions ) ? rawGlobalOptions : {} ),
2752
  _valueCandidate = {};
2753
+
2754
+ // consider only the non empty settings for db
2755
+ // booleans should bypass this check
2756
  _.each( moduleValueCandidate || {}, function( _val_, _key_ ) {
2757
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
2758
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
2759
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
2760
  return;
2761
  _valueCandidate[ _key_ ] = _val_;
2762
  });
2763
 
2764
  clonedGlobalOptions[ params.options_type ] = _valueCandidate;
2765
+
2766
+ // Set it
2767
  api( sektionsLocalizedData.optNameForGlobalOptions )( clonedGlobalOptions );
2768
  } else {
2769
+ // LEVEL OPTION CASE => LOCAL
2770
  return self.updateAPISetting({
2771
  action : params.uiParams.action,// mandatory : 'sek-generate-level-options-ui', 'sek-generate-local-skope-options-ui',...
2772
  id : params.uiParams.id,
2773
  value : moduleValueCandidate,
2774
  in_column : params.uiParams.in_column,//not mandatory
2775
  in_sektion : params.uiParams.in_sektion,//not mandatory
2776
+
2777
+ // specific for level options and local skope options
2778
  options_type : params.options_type,// mandatory : 'layout', 'spacing', 'bg_border', 'height', ...
2779
 
2780
  settingParams : params.settingParams
2781
  }).done( function( promiseParams ) {
2782
+ // STYLESHEET => default action when modifying the level options
2783
  if ( true === refresh_stylesheet ) {
2784
  api.previewer.send( 'sek-refresh-stylesheet', {
2785
  location_skope_id : true === promiseParams.is_global_location ? sektionsLocalizedData.globalSkopeId : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2791
  },
2792
  });
2793
  }
2794
+
2795
+ // MARKUP
2796
  if ( true === refresh_markup ) {
2797
  api.previewer.send( 'sek-refresh-level', {
2798
  location_skope_id : true === promiseParams.is_global_location ? sektionsLocalizedData.globalSkopeId : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2805
  skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),//<= send skope id to the preview so we can use it when ajaxing
2806
  });
2807
  }
2808
+
2809
+ // REFRESH THE PREVIEW ?
2810
  if ( true === refresh_preview ) {
2811
  api.previewer.refresh();
2812
  }
2813
  });//self.updateAPISetting()
2814
  }
2815
  };//_doUpdateWithRequestedAction
2816
+
2817
+ // if the changed input is a google font modifier ( <=> true === refresh_fonts )
2818
+ // => we want to first refresh the google font collection, and then proceed the requested action
2819
+ // this way we make sure that the customized value used when ajaxing will take into account when writing the google font http request link
2820
  if ( true === refresh_fonts ) {
2821
  var newFontFamily = params.settingParams.args.input_value;
2822
  if ( ! _.isString( newFontFamily ) ) {
2823
  api.errare( 'updateAPISettingAndExecutePreviewActions => font-family must be a string', newFontFamily );
2824
  return;
2825
  }
2826
+
2827
+ // add it only if gfont
2828
  if ( newFontFamily.indexOf('gfont') > -1 ) {
2829
  self.updateAPISetting({
2830
  action : 'sek-update-fonts',
2831
  font_family : newFontFamily,
2832
  is_global_location : self.isGlobalLocation( params.uiParams )
2833
  })
2834
+ // we use always() instead of done here, because the api section setting might not be changed ( and therefore return a reject() promise ).
2835
+ // => this can occur when a user is setting a google font already picked elsewhere
2836
+ // @see case 'sek-update-fonts'
2837
  .always( function() {
2838
  _doUpdateWithRequestedAction().then( function() {
2839
+ // always refresh again after
2840
+ // Why ?
2841
+ // Because the first refresh was done before actually setting the new font family, so based on a previous set of fonts
2842
+ // which leads to have potentially an additional google fonts that we don't need after the first refresh
2843
+ // that's why this second refresh is required. It wont trigger any preview ajax actions. Simply refresh the root fonts property of the main api setting.
2844
  self.updateAPISetting({
2845
  action : 'sek-update-fonts',
2846
  is_global_location : self.isGlobalLocation( params.uiParams )
2854
  _doUpdateWithRequestedAction();
2855
  }
2856
  },//updateAPISettingAndExecutePreviewActions
2857
+
2858
+
2859
+
2860
+
2861
+
2862
+
2863
+
2864
+
2865
+
2866
+
2867
+
2868
+
2869
+ // @return a normalized and sanitized item value
2870
+ // What does this helper do ?
2871
+ // 1) remove title and id properties, we don't need them in db
2872
+ // 2) don't write if is equal to default
2873
  normalizeAndSanitizeSingleItemInputValues : function( _item_, parentModuleType ) {
2874
  var itemNormalized = {},
2875
  itemNormalizedAndSanitized = {},
2888
  } else if ( _.isObject( _val ) && _.isObject( _default ) ) {
2889
  equal = _.isEqual( _val,_default );
2890
  } else if ( _.isArray( _val ) && _.isArray( _default ) ) {
2891
+ //@see https://stackoverflow.com/questions/39517316/check-for-equality-between-two-array
2892
  equal = JSON.stringify(_val.sort()) === JSON.stringify(_default.sort());
2893
  } else {
2894
  equal = _val === _default;
2895
  }
2896
  return equal;
2897
  };
2898
+
2899
+ // NORMALIZE
2900
+ // title, id and module_type don't need to be saved in database
2901
+ // title and id are legacy entries that can be used in multi-items modules to identify and name the item
2902
+ // @see ::getDefaultItemModelFromRegisteredModuleData()
2903
  _.each( _item_, function( _val, input_id ) {
2904
  if ( _.contains( ['title', 'id' ], input_id ) )
2905
  return;
2912
  }
2913
  if ( isEqualToDefault( _val, inputDefaultValue ) ) {
2914
  return;
2915
+ // When the value is a string of an object, no need to write an empty value
2916
  } else if ( ( _.isString( _val ) || _.isObject( _val ) ) && _.isEmpty( _val ) ) {
2917
  return;
2918
  } else {
2919
  itemNormalized[ input_id ] = _val;
2920
  }
2921
  });
2922
+
2923
+
2924
+ // SANITIZE
2925
  _.each( itemNormalized, function( _val, input_id ) {
2926
+ // @see extend_api_base.js
2927
+ // @see sektions::_7_0_sektions_add_inputs_to_api.js
2928
  switch( self.getInputType( input_id, parentModuleType ) ) {
2929
  case 'text' :
2930
  case 'textarea' :
2964
  });
2965
  return itemNormalizedAndSanitized;
2966
  },
2967
+
2968
+
2969
+
2970
+
2971
+
2972
+
2973
+
2974
+
2975
+
2976
+
2977
+
2978
+ // Is the UI currently displayed the one that is being requested ?
2979
+ // If so, don't generate the ui again
2980
+ // @return bool
2981
  isUIControlAlreadyRegistered : function( uiElementId ) {
2982
  var self = this,
2983
  uiCandidate = _.filter( self.registered(), function( registered ) {
2984
  return registered.id == uiElementId && 'control' === registered.what;
2985
  }),
2986
  controlIsAlreadyRegistered = false;
2987
+
2988
+ // If the control is not been tracked in our self.registered(), let's check if it is registered in the api
2989
+ // Typically, the module / section picker will match that case, because we don't keep track of it ( so it's not cleaned )
2990
  if ( _.isEmpty( uiCandidate ) ) {
2991
  controlIsAlreadyRegistered = api.control.has( uiElementId );
2992
  } else {
2993
  controlIsAlreadyRegistered = true;
2994
+ // we should have only one uiCandidate with this very id
2995
  if ( uiCandidate.length > 1 ) {
2996
  api.errare( 'generateUI => why is this control registered more than once ? => ' + uiElementId );
2997
  }
3003
  var CZRSeksPrototype = CZRSeksPrototype || {};
3004
  (function ( api, $ ) {
3005
  $.extend( CZRSeksPrototype, {
3006
+ // @params = {
3007
+ // action : 'sek-generate-module-ui' / 'sek-generate-level-options-ui'
3008
+ // level : params.level,
3009
+ // id : params.id,
3010
+ // in_sektion : params.in_sektion,
3011
+ // in_column : params.in_column,
3012
+ // options : params.options || []
3013
+ // }
3014
+ // @dfd = $.Deferred()
3015
+ // @return the state promise dfd
3016
  generateUIforDraggableContent : function( params, dfd ) {
3017
  var self = this;
3018
+ // Prepare the module map to register
3019
  var registrationParams = {};
3020
 
3021
  $.extend( registrationParams, {
3025
  controlLabel : sektionsLocalizedData.i18n['Select a content type'],
3026
  priority : 0,
3027
  settingValue : { content_type : params.content_type }
3028
+ //icon : '<i class="material-icons sek-level-option-icon">center_focus_weak</i>'
3029
  },
3030
  module_picker : {
3031
  settingControlId : sektionsLocalizedData.optPrefixForSektionsNotSaved + '_sek_draggable_modules_ui',
3073
  icon : '<i class="fas fa-grip-vertical sek-level-option-icon"></i>'
3074
  }
3075
  });
3076
+
3077
+ // Header and footer have been introduced in v1.4.0 but not enabled by default
3078
+ // The header and footer preset sections are on hold until "header and footer" feature is released.
3079
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
3080
  $.extend( registrationParams, {
3081
  sek_header_sec_picker_module : {
3112
  }
3113
  });
3114
  }
3115
+
3116
+
3117
+ // BAIL WITH A SEE-ME ANIMATION IF THIS UI IS CURRENTLY BEING DISPLAYED
3118
+ // Is the UI currently displayed the one that is being requested ?
3119
+ // If so :
3120
+ // 1) visually remind the user that a module should be dragged
3121
+ // 2) pass the content_type param to display the requested content_type
3122
  var firstKey = _.keys( registrationParams )[0],
3123
  firstControlId = registrationParams[firstKey].settingControlId;
3124
 
3127
  _control_.focus({
3128
  completeCallback : function() {
3129
  var $container = _control_.container;
3130
+ // @use button-see-mee css class declared in core in /wp-admin/css/customize-controls.css
3131
  if ( $container.hasClass( 'button-see-me') )
3132
  return;
3133
  $container.addClass('button-see-me');
3140
 
3141
  return dfd;
3142
  }//if
3143
+
3144
+
3145
+ // @return void()
3146
  _do_register_ = function() {
3147
  _.each( registrationParams, function( optionData, optionType ){
3148
  if ( ! api.has( optionData.settingControlId ) ) {
3149
+ // synchronize the module setting with the main collection setting
3150
  api( optionData.settingControlId, function( _setting_ ) {
3151
  _setting_.bind( function( to, from ) {
3152
  api.errare('generateUIforDraggableContent => the setting() should not changed');
3178
  track : false//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
3179
  }).done( function() {
3180
  api.control( optionData.settingControlId, function( _control_ ) {
3181
+ // set the control type property
3182
  _control_.content_type = optionData.content_type;//<= used to handle visibility when switching content type with the "content_type_switcher" control
3183
+
3184
+ // we set the focus to false when firing api.previewer.trigger( 'sek-pick-content', { focus : false }); in ::initialize()
3185
  if ( true === params.focus ) {
3186
  _control_.focus({
3187
  completeCallback : function() {}
3190
 
3191
  var $title = _control_.container.find('label > .customize-control-title'),
3192
  _titleContent = $title.html();
3193
+ // We wrap the original text content in this span.sek-ctrl-accordion-title in order to style it (underlined) independently ( without styling the icons next to it )
3194
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
3195
+
3196
+ // if this level has an icon, let's prepend it to the title
3197
  if ( ! _.isUndefined( optionData.icon ) ) {
3198
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
3199
  }
3200
+
3201
+ // ACCORDION
3202
+ // Setup the accordion only for section content type
3203
  if ( 'section' === _control_.content_type ) {
3204
+ // Hide the item wrapper
3205
  _control_.container.find('.czr-items-wrapper').hide();
3206
+ // prepend the animated arrow
3207
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
3208
+ // setup the initial state + initial click
3209
  _control_.container.attr('data-sek-expanded', "false" );
3210
  if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
3211
  _control_.container.find('.czr-items-wrapper').show();
3219
  });
3220
  });//_.each
3221
  };//_do_register_
3222
+
3223
+
3224
+ // the self.SECTION_ID_FOR_CONTENT_PICKER section is registered on initialize
3225
+ // @fixes https://github.com/presscustomizr/nimble-builder/issues/187
3226
  api.section( self.SECTION_ID_FOR_CONTENT_PICKER, function( _section_ ) {
3227
  _do_register_();
3228
+
3229
+ // Style the section title
3230
  var $sectionTitleEl = _section_.container.find('.accordion-section-title'),
3231
  $panelTitleEl = _section_.container.find('.customize-section-title h3');
3232
+
3233
+ // The default title looks like this : Title <span class="screen-reader-text">Press return or enter to open this section</span>
3234
  if ( 0 < $sectionTitleEl.length && $sectionTitleEl.find('.sek-level-option-icon').length < 1 ) {
3235
  $sectionTitleEl.prepend( '<i class="fas fa-grip-vertical sek-level-option-icon"></i>' );
3236
  }
3237
+
3238
+ // The default title looks like this : <span class="customize-action">Customizing</span> Title
3239
  if ( 0 < $panelTitleEl.length && $panelTitleEl.find('.sek-level-option-icon').length < 1 ) {
3240
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-grip-vertical sek-level-option-icon"></i>' );
3241
  }
3242
+
3243
+ // Schedule the accordion behaviour
3244
  self.scheduleModuleAccordion.call( _section_, { expand_first_control : true } );
3245
+
3246
+ // Fetch the presetSectionCollection from the server now, so we save a few milliseconds when injecting the first preset_section
3247
+ // it populates api.sek_presetSections
3248
  self._maybeFetchSectionsFromServer();
3249
  });
3250
  return dfd;
3254
  var CZRSeksPrototype = CZRSeksPrototype || {};
3255
  (function ( api, $ ) {
3256
  $.extend( CZRSeksPrototype, {
3257
+ // @params = {
3258
+ // action : 'sek-generate-module-ui' / 'sek-generate-level-options-ui'
3259
+ // level : params.level,
3260
+ // id : params.id,
3261
+ // in_sektion : params.in_sektion,
3262
+ // in_column : params.in_column,
3263
+ // options : params.options || []
3264
+ // }
3265
+ // @dfd = $.Deferred()
3266
+ // @return the state promise dfd
3267
  generateUIforFrontModules : function( params, dfd ) {
3268
  var self = this;
3269
  if ( _.isEmpty( params.id ) ) {
3270
  dfd.reject( 'generateUI => missing id' );
3271
  }
3272
+
3273
+ // For modules, we need to generate a UI for the module value
3274
  var moduleValue = self.getLevelProperty({
3275
  property : 'value',
3276
  id : params.id
3286
  if ( _.isEmpty( moduleType ) ) {
3287
  dfd.reject( 'generateUI => module => invalid module_type' );
3288
  }
3289
+
3290
+ // Prepare the module map to register
3291
  var modulesRegistrationParams = {};
3292
 
3293
  if ( true === self.getRegisteredModuleProperty( moduleType, 'is_father' ) ) {
3300
  settingControlId : params.id + '__' + optionType,
3301
  module_type : mod_type,
3302
  controlLabel : self.getRegisteredModuleProperty( mod_type, 'name' )
3303
+ //icon : '<i class="material-icons sek-level-option-icon">code</i>'
3304
  };
3305
  });
3306
  }
3309
  settingControlId : params.id,
3310
  module_type : moduleType,
3311
  controlLabel : moduleName
3312
+ //icon : '<i class="material-icons sek-level-option-icon">code</i>'
3313
  };
3314
  }
3315
+
3316
+ // BAIL WITH A SEE-ME ANIMATION IF THIS UI IS CURRENTLY BEING DISPLAYED
3317
+ // Is the UI currently displayed the one that is being requested ?
3318
+ // Check if the first control of the list is already registered
3319
+ // If so, visually remind the user and break;
3320
  var firstKey = _.keys( modulesRegistrationParams )[0],
3321
  firstControlId = modulesRegistrationParams[firstKey].settingControlId;
3322
 
3324
  api.control( firstControlId ).focus({
3325
  completeCallback : function() {
3326
  var $container = api.control( firstControlId ).container;
3327
+ // @use button-see-mee css class declared in core in /wp-admin/css/customize-controls.css
3328
  if ( $container.hasClass( 'button-see-me') )
3329
  return;
3330
  $container.addClass('button-see-me');
3335
  });
3336
  return dfd;
3337
  }//if
3338
+
3339
+ // Clean previously generated UI elements
3340
  self.cleanRegistered();
3341
 
3342
  _do_register_ = function() {
3343
  _.each( modulesRegistrationParams, function( optionData, optionType ){
3344
+ // Make sure this setting is bound only once !
3345
  if ( ! api.has( optionData.settingControlId ) ) {
3346
  var doUpdate = function( to, from, args ) {
3347
  try { self.updateAPISettingAndExecutePreviewActions({
3357
  api.errare( '::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions', er );
3358
  }
3359
  };
3360
+
3361
+ // Schedule the binding to synchronize the module setting with the main collection setting
3362
+ // Note 1 : unlike control or sections, the setting are not getting cleaned up on each ui generation.
3363
+ // They need to be kept in order to keep track of the changes in the customizer.
3364
+ // => that's why we check if ! api.has( ... )
3365
  api( optionData.settingControlId, function( _setting_ ) {
3366
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
3367
  });
3389
  what : 'control',
3390
  id : optionData.settingControlId,
3391
  label : optionData.controlLabel,
3392
+ //label : sektionsLocalizedData.i18n['Customize the options for module :'] + ' ' + optionData.controlLabel,
3393
  type : 'czr_module',//sekData.controlType,
3394
  module_type : optionData.module_type,
3395
  section : params.id,
3396
  priority : 10,
3397
  settings : { default : optionData.settingControlId }
3398
  }).done( function() {});
3399
+
3400
+ // Implement the animated arrow markup, and the initial state of the module visibility
3401
  api.control( optionData.settingControlId, function( _control_ ) {
3402
  api.control( optionData.settingControlId ).focus({
3403
  completeCallback : function() {}
3404
  });
3405
+ // Hide the item wrapper
3406
  _control_.container.find('.czr-items-wrapper').hide();
3407
  var $title = _control_.container.find('label > .customize-control-title'),
3408
  _titleContent = $title.html();
3409
 
3410
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
3411
+ // if this level has an icon, let's prepend it to the title
3412
  if ( ! _.isUndefined( optionData.icon ) ) {
3413
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
3414
  }
3415
+ // prepend the animated arrow
3416
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
3417
+ // setup the initial state + initial click
3418
  _control_.container.attr('data-sek-expanded', "false" );
3419
  });
3420
  });//each()
3421
  };//_do_register()
3422
+
3423
+
3424
+
3425
+ // Defer the registration when the parent section gets added to the api
3426
  api.section.when( params.id, function() {
3427
  api.section(params.id).focus();
3428
  _do_register_();
3429
  });
3430
+
3431
+
3432
+ // MAIN CONTENT SECTION
3433
  api.CZR_Helpers.register({
3434
  origin : 'nimble',
3435
  what : 'section',
3437
  title: sektionsLocalizedData.i18n['Content for'] + ' ' + moduleName,
3438
  panel : sektionsLocalizedData.sektionsPanelId,
3439
  priority : 1000,
3440
+ //track : false//don't register in the self.registered()
3441
+ //constructWith : MainSectionConstructor,
3442
  }).done( function() {});
3443
 
3444
  api.section( params.id, function( _section_ ) {
3445
+ // don't display the clickable section title in the nimble root panel
3446
  _section_.container.find('.accordion-section-title').first().hide();
3447
+
3448
+ // Style the section title
3449
  var $panelTitleEl = _section_.container.find('.customize-section-title h3');
3450
+
3451
+ // The default title looks like this : <span class="customize-action">Customizing</span> Title
3452
  if ( 0 < $panelTitleEl.length ) {
3453
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-pencil-alt sek-level-option-icon"></i>' );
3454
  }
3455
+
3456
+ // Schedule the accordion behaviour
3457
  self.scheduleModuleAccordion.call( _section_, { expand_first_control : true } );
3458
  });
3459
  return dfd;
3463
  var CZRSeksPrototype = CZRSeksPrototype || {};
3464
  (function ( api, $ ) {
3465
  $.extend( CZRSeksPrototype, {
3466
+ // @params = {
3467
+ // action : 'sek-generate-module-ui' / 'sek-generate-level-options-ui'
3468
+ // level : params.level,
3469
+ // id : params.id,
3470
+ // in_sektion : params.in_sektion,
3471
+ // in_column : params.in_column,
3472
+ // options : params.options || []
3473
+ // }
3474
+ // @dfd = $.Deferred()
3475
+ // @return the state promise dfd
3476
  generateUIforLevelOptions : function( params, dfd ) {
3477
  var self = this;
3478
+ // Get this level options
3479
  var levelOptionValues = self.getLevelProperty({
3480
  property : 'options',
3481
  id : params.id
3482
  });
3483
  levelOptionValues = _.isObject( levelOptionValues ) ? levelOptionValues : {};
3484
+
3485
+
3486
+ // Prepare the module map to register
3487
  var modulesRegistrationParams = {};
3488
 
3489
  $.extend( modulesRegistrationParams, {
3498
  settingControlId : params.id + '__border_options',
3499
  module_type : 'sek_level_border_module',
3500
  controlLabel : sektionsLocalizedData.i18n['Borders settings for the'] + ' ' + sektionsLocalizedData.i18n[params.level],
3501
+ //expandAndFocusOnInit : true,
3502
  icon : '<i class="material-icons sek-level-option-icon">rounded_corner</i>'//'<i class="material-icons sek-level-option-icon">brush</i>'
3503
  },
3504
  spacing : {
3510
  anchor : {
3511
  settingControlId : params.id + '__anchor_options',
3512
  module_type : 'sek_level_anchor_module',
3513
+ controlLabel : sektionsLocalizedData.i18n['Set a custom anchor ( CSS ID ) for the'] + ' ' + sektionsLocalizedData.i18n[params.level],
3514
  icon : '<i class="fas fa-anchor sek-level-option-icon"></i>'
3515
  },
3516
  visibility : {
3536
  icon : '<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'
3537
  }
3538
  });
3539
+ // Deactivated
3540
+ // => replaced by sek_level_width_section
3541
+ // $.extend( modulesRegistrationParams, {
3542
+ // layout : {
3543
+ // settingControlId : params.id + '__sectionLayout_options',
3544
+ // module_type : 'sek_level_section_layout_module',
3545
+ // controlLabel : sektionsLocalizedData.i18n['Layout settings for the'] + ' ' + sektionsLocalizedData.i18n[params.level],
3546
+ // icon : '<i class="material-icons sek-level-option-icon">crop_din</i>'
3547
+ // }
3548
+ // });
3549
  $.extend( modulesRegistrationParams, {
3550
  breakpoint : {
3551
  settingControlId : params.id + '__breakpoint_options',
3565
  }
3566
  });
3567
  }
3568
+
3569
+
3570
+ // BAIL WITH A SEE-ME ANIMATION IF THIS UI IS CURRENTLY BEING DISPLAYED
3571
+ // Is the UI currently displayed the one that is being requested ?
3572
+ // Check if the first control of the list is already registered
3573
+ // If so, visually remind the user and break;
3574
  var firstKey = _.keys( modulesRegistrationParams )[0],
3575
  firstControlId = modulesRegistrationParams[firstKey].settingControlId;
3576
 
3578
  api.control( firstControlId ).focus({
3579
  completeCallback : function() {
3580
  var $container = api.control( firstControlId ).container;
3581
+ // @use button-see-mee css class declared in core in /wp-admin/css/customize-controls.css
3582
  if ( $container.hasClass( 'button-see-me') )
3583
  return;
3584
  $container.addClass('button-see-me');
3589
  });
3590
  return dfd;
3591
  }//if
3592
+
3593
+ // Clean previously generated UI elements
3594
  self.cleanRegistered();
3595
+
3596
+
3597
+ // @return void()
3598
  _do_register_ = function() {
3599
  _.each( modulesRegistrationParams, function( optionData, optionType ){
3600
+ // Is the UI currently displayed the one that is being requested ?
3601
+ // If so, don't generate the ui again, simply focus on the section
3602
  if ( self.isUIControlAlreadyRegistered( optionData.settingControlId ) ) {
3603
  api.section( api.control( optionData.settingControlId ).section() ).expanded( true );
3604
  return;
3618
  api.errare( '::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions', er );
3619
  }
3620
  };
3621
+
3622
+ // Schedule the binding to synchronize the options with the main collection setting
3623
+ // Note 1 : unlike control or sections, the setting are not getting cleaned up on each ui generation.
3624
+ // They need to be kept in order to keep track of the changes in the customizer.
3625
+ // => that's why we check if ! api.has( ... )
3626
  api( optionData.settingControlId, function( _setting_ ) {
3627
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
3628
  });//api( Id, function( _setting_ ) {})
3629
+
3630
+ // Let's add the starting values if provided when registrating the module
3631
  var initialModuleValues = levelOptionValues[ optionType ] || {};
3632
  var startingModuleValue = self.getModuleStartingValue( optionData.module_type );
3633
  if ( 'no_starting_value' !== startingModuleValue && _.isObject( startingModuleValue ) ) {
3634
+ // make sure the starting values are deeped clone now, before being extended
3635
  var clonedStartingModuleValue = $.extend( true, {}, startingModuleValue );
3636
  initialModuleValues = $.extend( clonedStartingModuleValue, initialModuleValues );
3637
  }
3661
  priority : 0,
3662
  settings : { default : optionData.settingControlId }
3663
  }).done( function() {});
3664
+
3665
+ // Implement the animated arrow markup, and the initial state of the module visibility
3666
  api.control( optionData.settingControlId, function( _control_ ) {
3667
  if ( true === optionData.expandAndFocusOnInit ) {
3668
  _control_.focus({
3669
  completeCallback : function() {}
3670
  });
3671
  }
3672
+
3673
+ // Hide the item wrapper
3674
  _control_.container.find('.czr-items-wrapper').hide();
3675
  var $title = _control_.container.find('label > .customize-control-title'),
3676
  _titleContent = $title.html();
3677
+ // We wrap the original text content in this span.sek-ctrl-accordion-title in order to style it (underlined) independently ( without styling the icons next to it )
3678
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
3679
+ // if this level has an icon, let's prepend it to the title
3680
  if ( ! _.isUndefined( optionData.icon ) ) {
3681
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
3682
  }
3683
+ // prepend the animated arrow
3684
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
3685
+ // setup the initial state + initial click
3686
  _control_.container.attr('data-sek-expanded', "false" );
3687
+ // if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
3688
+ // $title.trigger('click');
3689
+ // }
3690
  });
3691
  });//_.each()
3692
  };//_do_register_()
3693
+
3694
+ // The section won't be tracked <= not removed on each ui update
3695
+ // Note : the check on api.section.has( params.id ) is also performd on api.CZR_Helpers.register(), but here we use it to avoid setting up the click listeners more than once.
3696
  if ( ! api.section.has( params.id ) ) {
3697
  api.section( params.id, function( _section_ ) {
3698
+ // Schedule the accordion behaviour
3699
  self.scheduleModuleAccordion.call( _section_, { expand_first_control : true } );
3700
  });
3701
  }
3707
  title: sektionsLocalizedData.i18n['Settings for the'] + ' ' + params.level,
3708
  panel : sektionsLocalizedData.sektionsPanelId,
3709
  priority : 10,
3710
+ //track : false//don't register in the self.registered()
3711
+ //constructWith : MainSectionConstructor,
3712
  }).done( function() {});
3713
+
3714
+ // - Defer the registration when the parent section gets added to the api
3715
+ // - Implement the module visibility
3716
  api.section( params.id, function( _section_ ) {
3717
  _do_register_();
3718
+ // don't display the clickable section title in the nimble root panel
3719
  _section_.container.find('.accordion-section-title').first().hide();
3720
+
3721
+ // Style the section title
3722
  var $panelTitleEl = _section_.container.find('.customize-section-title h3');
3723
+
3724
+ // The default title looks like this : <span class="customize-action">Customizing</span> Title
3725
  if ( 0 < $panelTitleEl.length && $panelTitleEl.find('.sek-level-option-icon').length < 1 ) {
3726
  $panelTitleEl.find('.customize-action').after( '<i class="fas fa-sliders-h sek-level-option-icon"></i>' );
3727
  }
3742
  }
3743
  return sektionsLocalizedData.optPrefixForSektionsNotSaved + skope_id + '__localSkopeOptions';
3744
  },
3745
+ // @params = {
3746
+ // action : 'sek-generate-module-ui' / 'sek-generate-level-options-ui'
3747
+ // level : params.level,
3748
+ // id : params.id,
3749
+ // in_sektion : params.in_sektion,
3750
+ // in_column : params.in_column,
3751
+ // options : params.options || []
3752
+ // }
3753
+ // @dfd = $.Deferred()
3754
+ // @return the state promise dfd
3755
  generateUIforLocalSkopeOptions : function( params, dfd ) {
3756
  var self = this,
3757
  _id_ = self.getLocalSkopeOptionId();
3758
+ // Is the UI currently displayed the one that is being requested ?
3759
+ // If so, visually remind the user that a module should be dragged
3760
  if ( self.isUIControlAlreadyRegistered( _id_ ) ) {
3761
  return dfd;
3762
  }
3763
+
3764
+ // Prepare the module map to register
3765
  var registrationParams = {};
3766
  if ( _.isUndefined( sektionsLocalizedData.localOptionsMap ) || ! _.isObject( sektionsLocalizedData.localOptionsMap ) ) {
3767
  api.errare( '::generateUIforGlobalOptions => missing or invalid localOptionsMap');
3768
  return dfd;
3769
  }
3770
+
3771
+ // Populate the registration params
3772
  _.each( sektionsLocalizedData.localOptionsMap, function( mod_type, opt_name ) {
3773
  switch( opt_name ) {
3774
  case 'template' :
3780
  icon : '<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'
3781
  };
3782
  break;
3783
+ // Header and footer have been introduced in v1.4.0 but not enabled by default.
3784
  case 'local_header_footer':
3785
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
3786
  registrationParams[ opt_name ] = {
3847
  api.errare( '::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions', er );
3848
  }
3849
  };
3850
+
3851
+ // Schedule the binding to synchronize the options with the main collection setting
3852
+ // Note 1 : unlike control or sections, the setting are not getting cleaned up on each ui generation.
3853
+ // They need to be kept in order to keep track of the changes in the customizer.
3854
+ // => that's why we check if ! api.has( ... )
3855
  api( optionData.settingControlId, function( _setting_ ) {
3856
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
3857
  });//api( Id, function( _setting_ ) {})
3858
+
3859
+ // Let's add the starting values if provided when registrating the module
3860
  var startingModuleValue = self.getModuleStartingValue( optionData.module_type ),
3861
  currentSetValue = api( self.localSectionsSettingId() )(),
3862
  allSkopeOptions = $.extend( true, {}, _.isObject( currentSetValue.local_options ) ? currentSetValue.local_options : {} ),
3864
  initialModuleValues = optionTypeValue;
3865
 
3866
  if ( 'no_starting_value' !== startingModuleValue && _.isObject( startingModuleValue ) ) {
3867
+ // make sure the starting values are deeped clone now, before being extended
3868
  var clonedStartingModuleValue = $.extend( true, {}, startingModuleValue );
3869
  initialModuleValues = $.extend( clonedStartingModuleValue, initialModuleValues );
3870
  }
3891
  section : self.SECTION_ID_FOR_LOCAL_OPTIONS,
3892
  priority : 10,
3893
  settings : { default : optionData.settingControlId },
3894
+ //track : false//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
3895
  }).done( function() {
3896
+
3897
+ // if ( true === optionData.expandAndFocusOnInit ) {
3898
+ // api.control( optionData.settingControlId ).focus({
3899
+ // completeCallback : function() {}
3900
+ // });
3901
+ // }
3902
+
3903
+ // Implement the animated arrow markup, and the initial state of the module visibility
3904
  api.control( optionData.settingControlId, function( _control_ ) {
3905
+ // Hide the item wrapper
3906
  _control_.container.find('.czr-items-wrapper').hide();
3907
  var $title = _control_.container.find('label > .customize-control-title'),
3908
  _titleContent = $title.html();
3909
+ // We wrap the original text content in this span.sek-ctrl-accordion-title in order to style it (underlined) independently ( without styling the icons next to it )
3910
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
3911
+
3912
+ // if this level has an icon, let's prepend it to the title
3913
  if ( ! _.isUndefined( optionData.icon ) ) {
3914
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
3915
  }
3916
+ // prepend the animated arrow
3917
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
3918
+ // setup the initial state + initial click
3919
  _control_.container.attr('data-sek-expanded', "false" );
3920
  if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
3921
  $title.trigger('click');
3924
  });
3925
  });//_.each()
3926
  };//_do_register()
3927
+
3928
+ // The parent section has already been added in ::initialize()
3929
  _do_register_();
3930
 
3931
  return dfd;
3935
  var CZRSeksPrototype = CZRSeksPrototype || {};
3936
  (function ( api, $ ) {
3937
  $.extend( CZRSeksPrototype, {
3938
+ // @params = {
3939
+ // action : 'sek-generate-module-ui' / 'sek-generate-level-options-ui'
3940
+ // level : params.level,
3941
+ // id : params.id,
3942
+ // in_sektion : params.in_sektion,
3943
+ // in_column : params.in_column,
3944
+ // options : params.options || []
3945
+ // }
3946
+ // @dfd = $.Deferred()
3947
+ // @return the state promise dfd
3948
  generateUIforGlobalOptions : function( params, dfd ) {
3949
  var self = this,
3950
  _id_ = sektionsLocalizedData.optPrefixForSektionsNotSaved + sektionsLocalizedData.optNameForGlobalOptions;
3951
+
3952
+ // Is the UI currently displayed the one that is being requested ?
3953
+ // If so, visually remind the user that a module should be dragged
3954
  if ( self.isUIControlAlreadyRegistered( _id_ ) ) {
3955
  return dfd;
3956
  }
3957
+
3958
+ // Prepare the module map to register
3959
  var registrationParams = {};
3960
  if ( _.isUndefined( sektionsLocalizedData.globalOptionsMap ) || ! _.isObject( sektionsLocalizedData.globalOptionsMap ) ) {
3961
  api.errare( '::generateUIforGlobalOptions => missing or invalid globalOptionsMap');
3962
  return dfd;
3963
  }
3964
+
3965
+ // Populate the registration params
3966
  _.each( sektionsLocalizedData.globalOptionsMap, function( mod_type, opt_name ) {
3967
  switch( opt_name ) {
3968
+ // Header and footer have been introduced in v1.4.0 but not enabled by default.
3969
  case 'global_header_footer':
3970
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
3971
  registrationParams[ opt_name ] = {
4042
  api.errare( '::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions', er );
4043
  }
4044
  };
4045
+
4046
+ // Schedule the binding to synchronize the options with the main collection setting
4047
+ // Note 1 : unlike control or sections, the setting are not getting cleaned up on each ui generation.
4048
+ // They need to be kept in order to keep track of the changes in the customizer.
4049
+ // => that's why we check if ! api.has( ... )
4050
  api( optionData.settingControlId, function( _setting_ ) {
4051
  _setting_.bind( _.debounce( doUpdate, self.SETTING_UPDATE_BUFFER ) );//_setting_.bind( _.debounce( function( to, from, args ) {}
4052
  });//api( Id, function( _setting_ ) {})
4053
+
4054
+ // Let's add the starting values if provided when registrating the module
4055
  var dbValues = sektionsLocalizedData.globalOptionDBValues,
4056
  startingModuleValue = self.getModuleStartingValue( optionData.module_type ),
4057
  initialModuleValues = ( _.isObject( dbValues ) && ! _.isEmpty( dbValues[ optionType ] ) ) ? dbValues[ optionType ] : {};
4058
 
4059
  if ( 'no_starting_value' !== startingModuleValue && _.isObject( startingModuleValue ) ) {
4060
+ // make sure the starting values are deeped clone now, before being extended
4061
  var clonedStartingModuleValue = $.extend( true, {}, startingModuleValue );
4062
  initialModuleValues = $.extend( clonedStartingModuleValue, initialModuleValues );
4063
  }
4087
  settings : { default : optionData.settingControlId },
4088
  track : false//don't register in the self.registered() => this will prevent this container to be removed when cleaning the registered
4089
  }).done( function() {
4090
+ // if ( true === optionData.expandAndFocusOnInit ) {
4091
+ // api.control( optionData.settingControlId ).focus({
4092
+ // completeCallback : function() {}
4093
+ // });
4094
+ // }
4095
+
4096
+ // Implement the animated arrow markup, and the initial state of the module visibility
4097
  api.control( optionData.settingControlId, function( _control_ ) {
4098
+ // Hide the item wrapper
4099
  _control_.container.find('.czr-items-wrapper').hide();
4100
  var $title = _control_.container.find('label > .customize-control-title'),
4101
  _titleContent = $title.html();
4102
+ // We wrap the original text content in this span.sek-ctrl-accordion-title in order to style it (underlined) independently ( without styling the icons next to it )
4103
  $title.html( ['<span class="sek-ctrl-accordion-title">', _titleContent, '</span>' ].join('') );
4104
+
4105
+ // if this level has an icon, let's prepend it to the title
4106
  if ( ! _.isUndefined( optionData.icon ) ) {
4107
  $title.addClass('sek-flex-vertical-center').prepend( optionData.icon );
4108
  }
4109
+ // prepend the animated arrow
4110
  $title.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>');
4111
+ // setup the initial state + initial click
4112
  _control_.container.attr('data-sek-expanded', "false" );
4113
  if ( true === optionData.expandAndFocusOnInit && "false" == _control_.container.attr('data-sek-expanded' ) ) {
4114
  $title.trigger('click');
4117
  });
4118
  });//_.each();
4119
  };//do register
4120
+
4121
+ // The parent section has already been added in ::initialize()
4122
  _do_register_();
4123
 
4124
  return dfd;
4128
  var CZRSeksPrototype = CZRSeksPrototype || {};
4129
  (function ( api, $ ) {
4130
  $.extend( CZRSeksPrototype, {
4131
+ // user action => this utility must be used to set the main setting value
4132
+ // params = {
4133
+ // action : 'sek-add-section', 'sek-add-column', 'sek-add-module',...
4134
+ // in_sektion
4135
+ // in_column
4136
+ // }
4137
  updateAPISetting : function( params ) {
4138
 
4139
  var self = this,
4140
  __updateAPISettingDeferred__ = $.Deferred();
4141
+
4142
+ // Are we in global location ?
4143
+ // Add the global information to the params
4144
+ // => is used to determine the skope id when resolving the promise in reactToPreviewMsg
4145
  params = params || {};
4146
  params.is_global_location = self.isGlobalLocation( params );
4147
 
4148
  var _collectionSettingId_ = params.is_global_location ? self.getGlobalSectionsSettingId() : self.localSectionsSettingId();
4149
+
4150
+ // Update the sektion collection
4151
  api( _collectionSettingId_, function( sektionSetInstance ) {
4152
+ // sektionSetInstance() = {
4153
+ // collection : [
4154
+ // 'loop_start' : { level : location, collection : [ 'sek124' : { collection : [], level : section, options : {} }], options : {}},
4155
+ // 'loop_end' : { level : location, collection : [], options : {}}
4156
+ // ...
4157
+ // ],
4158
+ // options : {}
4159
+ //
4160
+ // }
4161
  var currentSetValue = sektionSetInstance(),
4162
  newSetValue = _.isObject( currentSetValue ) ? $.extend( true, {}, currentSetValue ) : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ),
4163
  locationCandidate,
4164
  sektionCandidate,
4165
  columnCandidate,
4166
  moduleCandidate,
4167
+ // move variables
4168
  originalCollection,
4169
  reorderedCollection,
4170
+ //duplication variable
4171
  cloneId, //will be passed in resolve()
4172
  startingModuleValue,// will be populated by the optional starting value specificied on module registration
4173
  __presetSectionInjected__ = false,
4174
  parentSektionCandidate;
4175
+
4176
+ // make sure we have a collection array to populate
4177
  newSetValue.collection = _.isArray( newSetValue.collection ) ? newSetValue.collection : self.getDefaultSektionSettingValue( params.is_global_location ? 'global' : 'local' ).collection;
4178
 
4179
  switch( params.action ) {
4180
+ //-------------------------------------------------------------------------------------------------
4181
+ //-- SEKTION
4182
+ //-------------------------------------------------------------------------------------------------
4183
  case 'sek-add-section' :
4184
+ // an id must be provided
4185
  if ( _.isEmpty( params.id ) ) {
4186
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4187
  }
4189
  if ( _.isEmpty( params.location ) ) {
4190
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing location' );
4191
  }
4192
+ // Is this a nested sektion ?
4193
  if ( true === params.is_nested ) {
4194
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
4195
+ // can we add this nested sektion ?
4196
+ // if the parent sektion of the column has is_nested = true, then we can't
4197
  parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
4198
  if ( 'no_match' == parentSektionCandidate ) {
4199
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
4237
  position = index + 1;
4238
  }
4239
  });
4240
+
4241
+ // @see reactToCollectionSettingIdChange
4242
  locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
4243
+ // insert the section in the collection at the right place
4244
  locationCandidate.collection.splice( position, 0, {
4245
  id : params.id,
4246
  level : 'section',
4257
 
4258
 
4259
  case 'sek-duplicate-section' :
4260
+ //api.infoLog('PARAMS IN sek-duplicate-section', params );
4261
+ // an id must be provided
4262
  if ( _.isEmpty( params.id ) ) {
4263
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4264
  }
4273
  }
4274
 
4275
  var _position_ = self.getLevelPositionInCollection( params.id, newSetValue.collection );
4276
+ // Is this a nested sektion ?
4277
  if ( true === params.is_nested ) {
4278
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
4279
  if ( 'no_match' == columnCandidate ) {
4294
  break;
4295
  }
4296
  locationCandidate.collection = _.isArray( locationCandidate.collection ) ? locationCandidate.collection : [];
4297
+ // @see reactToCollectionSettingIdChange
4298
  locationCandidate.collection.splice( parseInt( _position_ + 1, 10 ), 0, deepClonedSektion );
4299
 
4300
  }
4301
  cloneId = deepClonedSektion.id;//will be passed in resolve()
4302
  break;
4303
+
4304
+ // in the case of a nested sektion, we have to remove it from a column
4305
+ // otherwise from the root sektion collection
4306
  case 'sek-remove-section' :
4307
+ //api.infoLog('PARAMS IN sek-remove-sektion', params );
4308
  if ( true === params.is_nested ) {
4309
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
4310
  if ( 'no_match' != columnCandidate ) {
4329
  break;
4330
 
4331
  case 'sek-move-section' :
4332
+ //api.infoLog('PARAMS in sek-move-section', params );
4333
  var toLocationCandidate = self.getLevelModel( params.to_location, newSetValue.collection ),
4334
  movedSektionCandidate,
4335
  copyOfMovedSektionCandidate;
4337
  if ( _.isEmpty( toLocationCandidate ) || 'no_match' == toLocationCandidate ) {
4338
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing target location' );
4339
  }
4340
+
4341
+ // MOVED CROSS LOCATIONS
4342
+ // - make a copy of the moved sektion
4343
+ // - remove the moved sektion from the source location
4344
  if ( params.from_location != params.to_location ) {
4345
+ // Remove the moved sektion from the source location
4346
  var fromLocationCandidate = self.getLevelModel( params.from_location, newSetValue.collection );
4347
  if ( _.isEmpty( fromLocationCandidate ) || 'no_match' == fromLocationCandidate ) {
4348
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing source location' );
4349
  }
4350
 
4351
  fromLocationCandidate.collection = _.isArray( fromLocationCandidate.collection ) ? fromLocationCandidate.collection : [];
4352
+ // Make a copy of the sektion candidate now, before removing it
4353
  movedSektionCandidate = self.getLevelModel( params.id, fromLocationCandidate.collection );
4354
  copyOfMovedSektionCandidate = $.extend( true, {}, movedSektionCandidate );
4355
+ // remove the sektion from its previous sektion
4356
  fromLocationCandidate.collection = _.filter( fromLocationCandidate.collection, function( sektion ) {
4357
  return sektion.id != params.id;
4358
  });
4359
  }
4360
+
4361
+ // UPDATE THE TARGET LOCATION
4362
  toLocationCandidate.collection = _.isArray( toLocationCandidate.collection ) ? toLocationCandidate.collection : [];
4363
  originalCollection = $.extend( true, [], toLocationCandidate.collection );
4364
  reorderedCollection = [];
4365
  _.each( params.newOrder, function( _id_ ) {
4366
+ // in the case of a cross location movement, we need to add the moved sektion to the target location
4367
  if ( params.from_location != params.to_location && _id_ == copyOfMovedSektionCandidate.id ) {
4368
  reorderedCollection.push( copyOfMovedSektionCandidate );
4369
  } else {
4377
  toLocationCandidate.collection = reorderedCollection;
4378
 
4379
  break;
4380
+
4381
+
4382
+ // Fired on click on up / down arrows in the ( not nested ) section ui menu
4383
  case 'sek-move-section-up-down' :
4384
+ //api.infoLog('PARAMS in sek-move-section-up', params );
4385
 
4386
  inLocationCandidate = self.getLevelModel( params.location, newSetValue.collection );
4387
 
4395
  var _indexInOriginal = _.findIndex( originalCollection, function( _sec_ ) {
4396
  return _sec_.id === params.id;
4397
  });
4398
+ // @see https://underscorejs.org/#findIndex
4399
  if ( -1 === _indexInOriginal ) {
4400
  throw new Error( 'updateAPISetting => ' + params.action + ' => invalid index' );
4401
  }
4402
+
4403
+ // Swap up <=> down
4404
  var direction = params.direction || 'up';
4405
  reorderedCollection[ _indexInOriginal ] = originalCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ];
4406
  reorderedCollection[ 'up' === direction ? _indexInOriginal - 1 : _indexInOriginal + 1 ] = originalCollection[ _indexInOriginal ];
4407
 
4408
  inLocationCandidate.collection = reorderedCollection;
4409
  break;
4410
+
4411
+
4412
+
4413
+
4414
+
4415
+
4416
+
4417
+
4418
+ //-------------------------------------------------------------------------------------------------
4419
+ //-- COLUMN
4420
+ //-------------------------------------------------------------------------------------------------
4421
  case 'sek-add-column' :
4422
+ // an id must be provided
4423
  if ( _.isEmpty( params.id ) ) {
4424
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4425
  }
4431
  }
4432
 
4433
  sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
4434
+ // can we add another column ?
4435
  if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
4436
  __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
4437
  break;
4438
  }
4439
+
4440
+ // RESET ALL COLUMNS WIDTH
4441
  _.each( sektionCandidate.collection, function( colModel ) {
4442
  colModel.width = '';
4443
  });
4453
  case 'sek-remove-column' :
4454
  sektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
4455
  if ( 'no_match' != sektionCandidate ) {
4456
+ // can we remove the column ?
4457
  if ( 1 === _.size( sektionCandidate.collection ) ) {
4458
  __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["A section must have at least one column."]);
4459
  break;
4462
  sektionCandidate.collection = _.filter( sektionCandidate.collection, function( column ) {
4463
  return column.id != params.id;
4464
  });
4465
+ // RESET ALL COLUMNS WIDTH
4466
  _.each( sektionCandidate.collection, function( colModel ) {
4467
  colModel.width = '';
4468
  });
4473
  break;
4474
 
4475
  case 'sek-duplicate-column' :
4476
+ // an id must be provided
4477
  if ( _.isEmpty( params.id ) ) {
4478
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4479
  }
4486
  }
4487
 
4488
  sektionCandidate.collection = _.isArray( sektionCandidate.collection ) ? sektionCandidate.collection : [];
4489
+ // can we add another column ?
4490
  if ( ( self.MAX_NUMBER_OF_COLUMNS - 1 ) < _.size( sektionCandidate.collection ) ) {
4491
  __updateAPISettingDeferred__.reject( sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);
4492
  break;
4500
  var _position = self.getLevelPositionInCollection( params.id, newSetValue.collection );
4501
  cloneId = deepClonedColumn.id;//will be passed in resolve()
4502
  sektionCandidate.collection.splice( parseInt( _position + 1, 10 ), 0, deepClonedColumn );
4503
+ // RESET ALL COLUMNS WIDTH
4504
  _.each( sektionCandidate.collection, function( colModel ) {
4505
  colModel.width = '';
4506
  });
4507
  break;
4508
+
4509
+
4510
+ // Note : the css rules are generated in Sek_Dyn_CSS_Builder::sek_add_rules_for_column_width
4511
  case 'sek-resize-columns' :
4512
  if ( params.col_number < 2 )
4513
  break;
4514
 
4515
  var resizedColumn = self.getLevelModel( params.resized_column, newSetValue.collection ),
4516
  sistercolumn = self.getLevelModel( params.sister_column, newSetValue.collection );
4517
+
4518
+ //api.infoLog( 'updateAPISetting => ' + params.action + ' => ', params );
4519
+
4520
+ // SET RESIZED COLUMN WIDTH
4521
  if ( 'no_match' == resizedColumn ) {
4522
  api.errare( 'updateAPISetting => ' + params.action + ' => no resized column matched' );
4523
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no resized column matched');
4525
  }
4526
 
4527
  resizedColumn.width = parseFloat( params.resizedColumnWidthInPercent );
4528
+
4529
+
4530
+ // SET OTHER COLUMNS WIDTH
4531
  var parentSektion = self.getLevelModel( params.in_sektion, newSetValue.collection );
4532
  var otherColumns = _.filter( parentSektion.collection, function( _col_ ) {
4533
  return _col_.id != resizedColumn.id && _col_.id != sistercolumn.id;
4540
  if ( ! _.has( colModel, 'width') || ! _.isNumber( currentColWidth * 1 ) || _.isEmpty( currentColWidth + '' ) || 1 > currentColWidth ) {
4541
  colModel.width = parseFloat( ( 100 / params.col_number ).toFixed(3) );
4542
  }
4543
+ // sum up all other column's width, excluding the resized and sister one.
4544
  otherColumnsWidth = parseFloat( ( otherColumnsWidth + colModel.width ).toFixed(3) );
4545
  });
4546
  }
4547
+
4548
+
4549
+ // SET SISTER COLUMN WIDTH
4550
+
4551
+ // sum up all other column's width, excluding the resized and sister one.
4552
+ // api.infoLog( "resizedColumn.width", resizedColumn.width );
4553
+ // api.infoLog( "otherColumns", otherColumns );
4554
+
4555
+ // then calculate the sistercolumn so we are sure that we feel the entire space of the sektion
4556
  sistercolumn.width = parseFloat( ( 100 - otherColumnsWidth ).toFixed(3) );
4557
+
4558
+ // api.infoLog('otherColumnsWidth', otherColumnsWidth );
4559
+ // api.infoLog("sistercolumn.width", sistercolumn.width );
4560
+ // api.infoLog( "sistercolumn.width + otherColumnsWidth" , Number( sistercolumn.width ) + Number( otherColumnsWidth ) );
4561
+ //api.infoLog('COLLECTION AFTER UPDATE ', parentSektion.collection );
4562
  break;
4563
 
4564
 
4574
  }
4575
 
4576
  if ( params.from_sektion != params.to_sektion ) {
4577
+ // Remove the moved column from the source sektion
4578
  var fromSektionCandidate = self.getLevelModel( params.from_sektion, newSetValue.collection );
4579
  if ( _.isEmpty( fromSektionCandidate ) || 'no_match' == fromSektionCandidate ) {
4580
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing source column' );
4581
  }
4582
 
4583
  fromSektionCandidate.collection = _.isArray( fromSektionCandidate.collection ) ? fromSektionCandidate.collection : [];
4584
+ // Make a copy of the column candidate now, before removing it
4585
  movedColumnCandidate = self.getLevelModel( params.id, fromSektionCandidate.collection );
4586
  copyOfMovedColumnCandidate = $.extend( true, {}, movedColumnCandidate );
4587
+ // remove the column from its previous sektion
4588
  fromSektionCandidate.collection = _.filter( fromSektionCandidate.collection, function( column ) {
4589
  return column.id != params.id;
4590
  });
4591
+ // Reset the column's width in the target sektion
4592
  _.each( fromSektionCandidate.collection, function( colModel ) {
4593
  colModel.width = '';
4594
  });
4595
  }
4596
+
4597
+ // update the target sektion
4598
  toSektionCandidate.collection = _.isArray( toSektionCandidate.collection ) ? toSektionCandidate.collection : [];
4599
  originalCollection = $.extend( true, [], toSektionCandidate.collection );
4600
  reorderedCollection = [];
4601
  _.each( params.newOrder, function( _id_ ) {
4602
+ // in the case of a cross sektion movement, we need to add the moved column to the target sektion
4603
  if ( params.from_sektion != params.to_sektion && _id_ == copyOfMovedColumnCandidate.id ) {
4604
  reorderedCollection.push( copyOfMovedColumnCandidate );
4605
  } else {
4611
  }
4612
  });
4613
  toSektionCandidate.collection = reorderedCollection;
4614
+
4615
+ // Reset the column's width in the target sektion
4616
  _.each( toSektionCandidate.collection, function( colModel ) {
4617
  colModel.width = '';
4618
  });
4619
 
4620
  break;
4621
+
4622
+
4623
+
4624
+
4625
+
4626
+
4627
+
4628
+
4629
+
4630
+
4631
+
4632
+
4633
+ //-------------------------------------------------------------------------------------------------
4634
+ //-- MODULE
4635
+ //-------------------------------------------------------------------------------------------------
4636
  case 'sek-add-module' :
4637
+ // an id must be provided
4638
  if ( _.isEmpty( params.id ) ) {
4639
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4640
  }
4641
+ // a module_type must be provided
4642
  if ( _.isEmpty( params.module_type ) ) {
4643
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing module_type' );
4644
  }
4651
 
4652
  var position = 0;
4653
  columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
4654
+ // get the position of the before or after module
4655
  _.each( columnCandidate.collection, function( moduleModel, index ) {
4656
  if ( params.before_module === moduleModel.id ) {
4657
  position = index;
4667
  module_type : params.module_type,
4668
  ver_ini : sektionsLocalizedData.nimbleVersion
4669
  };
4670
+ // Let's add the starting value if provided when registrating the module
4671
  startingModuleValue = self.getModuleStartingValue( params.module_type );
4672
  if ( 'no_starting_value' !== startingModuleValue ) {
4673
  _moduleParams.value = startingModuleValue;
4677
  break;
4678
 
4679
  case 'sek-duplicate-module' :
4680
+ // an id must be provided
4681
  if ( _.isEmpty( params.id ) ) {
4682
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4683
  }
4703
  break;
4704
 
4705
  case 'sek-remove-module' :
4706
+ // an id must be provided
4707
  if ( _.isEmpty( params.id ) ) {
4708
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4709
  }
4723
  var toColumnCandidate,
4724
  movedModuleCandidate,
4725
  copyOfMovedModuleCandidate;
4726
+
4727
+ // loop on the sektions to find the toColumnCandidate
4728
+ // _.each( newSetValue.collection, function( _sektion_ ) {
4729
+ // _.each( _sektion_.collection, function( _column_ ) {
4730
+ // if ( _column_.id == params.to_column ) {
4731
+ // toColumnCandidate = _column_;
4732
+ // }
4733
+ // });
4734
+ // });
4735
  toColumnCandidate = self.getLevelModel( params.to_column, newSetValue.collection );
4736
 
4737
  if ( _.isEmpty( toColumnCandidate ) || 'no_match' == toColumnCandidate ) {
4738
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing target column' );
4739
  }
4740
+
4741
+ // If the module has been moved to another column
4742
+ // => remove the moved module from the source column
4743
  if ( params.from_column != params.to_column ) {
4744
  var fromColumnCandidate;
4745
  fromColumnCandidate = self.getLevelModel( params.from_column, newSetValue.collection );
4749
  }
4750
 
4751
  fromColumnCandidate.collection = _.isArray( fromColumnCandidate.collection ) ? fromColumnCandidate.collection : [];
4752
+ // Make a copy of the module candidate now, before removing it
4753
  movedModuleCandidate = self.getLevelModel( params.id, newSetValue.collection );
4754
  copyOfMovedModuleCandidate = $.extend( true, {}, movedModuleCandidate );
4755
+ // remove the module from its previous column
4756
  fromColumnCandidate.collection = _.filter( fromColumnCandidate.collection, function( module ) {
4757
  return module.id != params.id;
4758
  });
4759
  }// if params.from_column != params.to_column
4760
+
4761
+ // update the target column
4762
  toColumnCandidate.collection = _.isArray( toColumnCandidate.collection ) ? toColumnCandidate.collection : [];
4763
  originalCollection = $.extend( true, [], toColumnCandidate.collection );
4764
  reorderedCollection = [];
4773
  reorderedCollection.push( moduleCandidate );
4774
  }
4775
  });
4776
+ // Check if we have duplicates ?
4777
  if ( reorderedCollection.length != _.uniq( reorderedCollection ).length ) {
4778
  throw new Error( 'updateAPISetting => ' + params.action + ' => there are duplicated modules in column : ' + toColumnCandidate.id );
4779
  } else {
4786
  moduleCandidate = self.getLevelModel( params.id, newSetValue.collection );
4787
 
4788
  var _value_ = {};
4789
+ // consider only the non empty settings for db
4790
+ // booleans should bypass this check
4791
  _.each( params.value || {}, function( _val_, _key_ ) {
4792
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
4793
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
4794
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
4795
  return;
4796
  _value_[ _key_ ] = _val_;
4805
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => missing options_type');
4806
  break;
4807
  }
4808
+
4809
+ // Is this a father module ?
4810
+ // If yes, the module value is structured by option group, each option group being updated by a child module
4811
+ // If no, the default option type is : '__no_option_group_to_be_updated_by_children_modules__'
4812
  if ( '__no_option_group_to_be_updated_by_children_modules__' === params.options_type ) {
4813
  moduleCandidate.value = _value_;
4814
  } else {
4817
  }
4818
 
4819
  break;
4820
+
4821
+
4822
+
4823
+
4824
+
4825
+
4826
+ //-------------------------------------------------------------------------------------------------
4827
+ //-- LEVEL OPTIONS
4828
+ //-------------------------------------------------------------------------------------------------
4829
  case 'sek-generate-level-options-ui' :
4830
  var _candidate_ = self.getLevelModel( params.id, newSetValue.collection ),
4831
  _valueCandidate = {};
4835
  break;
4836
  }
4837
  _candidate_.options = _candidate_.options || {};
4838
+
4839
+ // consider only the non empty settings for db
4840
+ // booleans should bypass this check
4841
  _.each( params.value || {}, function( _val_, _key_ ) {
4842
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
4843
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
4844
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
4845
  return;
4846
  _valueCandidate[ _key_ ] = _val_;
4850
  }
4851
  _candidate_.options[ params.options_type ] = _valueCandidate;
4852
  break;
4853
+
4854
+
4855
+
4856
+
4857
+
4858
+ //-------------------------------------------------------------------------------------------------
4859
+ //-- LOCAL SKOPE OPTIONS
4860
+ //-------------------------------------------------------------------------------------------------
4861
+ // Note : this is saved in "local_options"
4862
  case 'sek-generate-local-skope-options-ui' :
4863
  _valueCandidate = {};
4864
 
4865
  var _currentOptions = $.extend( true, {}, _.isObject( newSetValue.local_options ) ? newSetValue.local_options : {} );
4866
+ // consider only the non empty settings for db
4867
+ // booleans should bypass this check
4868
  _.each( params.value || {}, function( _val_, _key_ ) {
4869
+ // Note : _.isEmpty( 5 ) returns true when checking an integer,
4870
+ // that's why we need to cast the _val_ to a string when using _.isEmpty()
4871
  if ( ! _.isBoolean( _val_ ) && _.isEmpty( _val_ + "" ) )
4872
  return;
4873
  _valueCandidate[ _key_ ] = _val_;
4880
  newSetValue.local_options = $.extend( _currentOptions, newOptionsValues );
4881
  }
4882
  break;
4883
+
4884
+
4885
+
4886
+
4887
+
4888
+
4889
+
4890
+
4891
+
4892
+ //-------------------------------------------------------------------------------------------------
4893
+ //-- CONTENT IN NEW SEKTION
4894
+ //-------------------------------------------------------------------------------------------------
4895
+ // @params {
4896
+ // drop_target_element : $(this),
4897
+ // position : _position,// <= top or bottom
4898
+ // before_section : $(this).data('sek-before-section'),
4899
+ // after_section : $(this).data('sek-after-section'),
4900
+ // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ), //<= module or preset_section
4901
+ // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
4902
+ // }
4903
  case 'sek-add-content-in-new-sektion' :
4904
+ // api.infoLog('update API Setting => sek-add-content-in-new-sektion => PARAMS', params );
4905
+ // an id must be provided
4906
  if ( _.isEmpty( params.id ) ) {
4907
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
4908
  }
4909
+ // get the position of the before or after section
4910
  position = 0;
4911
  locationCandidate = self.getLevelModel( params.location, newSetValue.collection );
4912
  if ( 'no_match' == locationCandidate ) {
4925
  });
4926
 
4927
  switch( params.content_type) {
4928
+ // When a module is dropped in a section + column structure to be generated
4929
  case 'module' :
4930
+ // Let's add the starting value if provided when registrating the module
4931
+ // Note : params.content_id is the module_type
4932
  startingModuleValue = self.getModuleStartingValue( params.content_id );
4933
+
4934
+ // insert the section in the collection at the right place
4935
  locationCandidate.collection.splice( position, 0, {
4936
  id : params.id,
4937
  level : 'section',
4954
  ver_ini : sektionsLocalizedData.nimbleVersion
4955
  });
4956
  break;
4957
+
4958
+ // When a preset section is dropped
4959
  case 'preset_section' :
4960
+ // insert the section in the collection at the right place
4961
  __presetSectionInjected__ = $.Deferred();//defined at the beginning of the method
4962
 
4963
  var _doWhenPresetSectionCollectionFetched = function( presetColumnCollection ) {
4964
  self.preparePresetSectionForInjection( presetColumnCollection )
4965
  .fail( function( _er_ ){
4966
  __updateAPISettingDeferred__.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
4967
+ // Used when updating the setting
4968
+ // @see end of this method
4969
  __presetSectionInjected__.reject( _er_ );
4970
  })
4971
  .done( function( sectionReadyToInject ) {
4972
+ //api.infoLog( 'sectionReadyToInject', sectionReadyToInject );
4973
+
4974
+ // If the preset_section is inserted in a an empty nested section, add it at the right place in the parent column of the nested section.
4975
+ // Otherwise, add the preset section at the right position in the parent location of the section.
4976
  var insertedInANestedSektion = false;
4977
  if ( ! _.isEmpty( params.sektion_to_replace ) ) {
4978
  var sektionToReplace = self.getLevelModel( params.sektion_to_replace, newSetValue.collection );
4999
  }
5000
 
5001
  columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
5002
+ // get the position of the before or after module
5003
  _.each( columnCandidate.collection, function( moduleOrSectionModel, index ) {
5004
  if ( params.before_section === moduleOrSectionModel.id ) {
5005
  position = index;
5017
  ver_ini : sektionsLocalizedData.nimbleVersion
5018
  });
5019
  }
5020
+
5021
+ // Used when updating the setting
5022
+ // @see end of this method
5023
  __presetSectionInjected__.resolve();
5024
  });// self.preparePresetSectionForInjection.done()
5025
  };//_doWhenPresetSectionCollectionFetched()
5026
+
5027
+
5028
+ // Try to fetch the sections from the server
5029
+ // if sucessfull, resolve __presetSectionInjected__.promise()
5030
  self.getPresetSectionCollection({
5031
  is_user_section : params.is_user_section,
5032
  presetSectionId : params.content_id,
5041
  api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnCollection );
5042
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
5043
  }
5044
+ // OK. time to resolve __presetSectionInjected__.promise()
5045
  _doWhenPresetSectionCollectionFetched( presetColumnCollection );
5046
  });//self.getPresetSectionCollection().done()
5047
  break;
5048
  }//switch( params.content_type)
5049
  break;
5050
+
5051
+
5052
+
5053
+ //-------------------------------------------------------------------------------------------------
5054
+ //-- CONTENT IN NEW NESTED SEKTION
5055
+ //-------------------------------------------------------------------------------------------------
5056
+ // @params {
5057
+ // drop_target_element : $(this),
5058
+ // position : _position,// <= top or bottom
5059
+ // before_section : $(this).data('sek-before-section'),
5060
+ // after_section : $(this).data('sek-after-section'),
5061
+ // content_type : event.originalEvent.dataTransfer.getData( "sek-content-type" ), //<= module or preset_section
5062
+ // content_id : event.originalEvent.dataTransfer.getData( "sek-content-id" )
5063
+ // }
5064
  case 'sek-add-preset-section-in-new-nested-sektion' :
5065
+ // an id must be provided
5066
  if ( _.isEmpty( params.id ) ) {
5067
  throw new Error( 'updateAPISetting => ' + params.action + ' => missing id' );
5068
  }
5069
 
5070
  columnCandidate = self.getLevelModel( params.in_column, newSetValue.collection );
5071
+
5072
+ // can we add this nested sektion ?
5073
+ // if the parent sektion of the column has is_nested = true, then we can't
5074
  parentSektionCandidate = self.getLevelModel( params.in_sektion, newSetValue.collection );
5075
  if ( 'no_match' == parentSektionCandidate ) {
5076
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => no grand parent sektion found');
5086
  break;
5087
  }
5088
  columnCandidate.collection = _.isArray( columnCandidate.collection ) ? columnCandidate.collection : [];
5089
+
5090
+ // insert the section in the collection at the right place
5091
  var presetColumnCollection;
5092
  __presetSectionInjected__ = $.Deferred();//defined at the beginning of the method
5093
 
5095
  self.preparePresetSectionForInjection( presetColumnCollection )
5096
  .fail( function( _er_ ){
5097
  __updateAPISettingDeferred__.reject( 'updateAPISetting => error when preparePresetSectionForInjection => ' + params.action + ' => ' + _er_ );
5098
+ // Used when updating the setting
5099
+ // @see end of this method
5100
  __presetSectionInjected__.reject( _er_ );
5101
  })
5102
  .done( function( sectionReadyToInject ) {
5108
  is_nested : true,
5109
  ver_ini : sektionsLocalizedData.nimbleVersion
5110
  });
5111
+
5112
+ // Used when updating the setting
5113
+ // @see end of this method
5114
  __presetSectionInjected__.resolve();
5115
  });//self.preparePresetSectionForInjection.done()
5116
  };//_doWhenPresetSectionCollectionFetched
5117
+
5118
+
5119
+ // Try to fetch the sections from the server
5120
+ // if sucessfull, resolve __presetSectionInjected__.promise()
5121
  self.getPresetSectionCollection({
5122
  is_user_section : params.is_user_section,
5123
  presetSectionId : params.content_id,
5132
  api.errare( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty : ' + params.content_id, presetColumnCollection );
5133
  __updateAPISettingDeferred__.reject( 'updateAPISetting => ' + params.action + ' => preset section type not found or empty');
5134
  }
5135
+ // OK. time to resolve __presetSectionInjected__.promise()
5136
  _doWhenPresetSectionCollectionFetched( presetColumnCollection );
5137
  });//self.getPresetSectionCollection().done()
5138
  break;
5139
+
5140
+
5141
+
5142
+
5143
+
5144
+
5145
+
5146
+
5147
+
5148
+
5149
+
5150
+
5151
+ //-------------------------------------------------------------------------------------------------
5152
+ //-- POPULATE GOOGLE FONTS
5153
+ //-------------------------------------------------------------------------------------------------
5154
+ //@params {
5155
+ // action : 'sek-update-fonts',
5156
+ // font_family : newFontFamily,
5157
+ // }
5158
  case 'sek-update-fonts' :
5159
+ // Get the gfonts from the level options and modules values
5160
  var currentGfonts = self.sniffGFonts( { is_global_location : params && true === params.is_global_location } );
5161
  if ( ! _.isEmpty( params.font_family ) && _.isString( params.font_family ) && ! _.contains( currentGfonts, params.font_family ) ) {
5162
  if ( params.font_family.indexOf('gfont') < 0 ) {
5166
  }
5167
  currentGfonts.push( params.font_family );
5168
  }
5169
+ // update the global gfonts collection
5170
+ // this is then used server side in Sek_Dyn_CSS_Handler::sek_get_gfont_print_candidates to build the Google Fonts request
5171
  newSetValue.fonts = currentGfonts;
5172
  break;
5173
  }// switch
5174
+
5175
+
5176
+
5177
+ // if we did not already rejected the request, let's check if the setting object has actually been modified
5178
+ // at this point it should have been.
5179
  if ( 'pending' == __updateAPISettingDeferred__.state() ) {
5180
  var mayBeUpdateSektionsSetting = function() {
5181
  if ( _.isEqual( currentSetValue, newSetValue ) ) {
5185
  } else {
5186
  if ( null !== self.validateSettingValue( newSetValue ) ) {
5187
  sektionSetInstance( newSetValue, params );
5188
+ // Add the cloneId to the params when we resolve
5189
+ // the cloneId is only needed in the duplication scenarii
5190
  params.cloneId = cloneId;
5191
  __updateAPISettingDeferred__.resolve( params );
5192
  } else {
5193
  __updateAPISettingDeferred__.reject( 'Validation problem for action ' + params.action );
5194
  }
5195
+ //api.infoLog('COLLECTION SETTING UPDATED => ', _collectionSettingId_, api( _collectionSettingId_ )() );
5196
  }
5197
  };//mayBeUpdateSektionsSetting()
5198
 
5211
  });//api( _collectionSettingId_, function( sektionSetInstance ) {}
5212
  return __updateAPISettingDeferred__.promise();
5213
  },//updateAPISetting
5214
+
5215
+
5216
+
5217
+ // @return a promise()
5218
+ // caches the sections in api.sek_presetSections when api.section( '__content_picker__') is registered
5219
+ // caches the user saved sections on the first drag and drop of a user-saved section
5220
+ // @params {
5221
+ // is_user_section : sectionParams.is_user_section
5222
+ // preset_section_id : '' <= used for user_saved section
5223
+ // }
5224
  _maybeFetchSectionsFromServer : function( params ) {
5225
  var dfd = $.Deferred(),
5226
  _ajaxRequest_;
5241
  api.sek_fetchingUserSavedSections = _ajaxRequest_;
5242
  }
5243
  _ajaxRequest_.done( function( _sectionData_ ) {
5244
+ //api.sek_presetSections = JSON.parse( _collection_ );
5245
  api.sek_userSavedSections[ params.preset_section_id ] = _sectionData_;
5246
  dfd.resolve( api.sek_userSavedSections );
5247
  }).fail( function( _r_ ) {
5259
  api.sek_fetchingPresetSections = _ajaxRequest_;
5260
  }
5261
  _ajaxRequest_.done( function( _collection_ ) {
5262
+ //api.sek_presetSections = JSON.parse( _collection_ );
5263
  api.sek_presetSections = _collection_;
5264
  dfd.resolve( api.sek_presetSections );
5265
  }).fail( function( _r_ ) {
5270
 
5271
  return dfd.promise();
5272
  },
5273
+
5274
+
5275
+
5276
+
5277
+ // First run : fetches the collection from the server
5278
+ // Next runs : uses the cached collection
5279
+ //
5280
+ // @return a JSON parsed string,
5281
+ // + guid() ids for each levels
5282
+ // ready for insertion
5283
+ //
5284
+ // @sectionParams : {
5285
+ // is_user_section : bool, //<= is this section a "saved" section ?
5286
+ // presetSectionId : params.content_id,
5287
+ // section_id : params.id
5288
+ // }
5289
+ // Why is the section_id provided ?
5290
+ // Because this id has been generated ::reactToPreviewMsg, case "sek-add-section", and is the identifier that we'll need when ajaxing ( $_POST['id'])
5291
  getPresetSectionCollection : function( sectionParams ) {
5292
  var self = this,
5293
  __dfd__ = $.Deferred();
5300
  __dfd__.reject( er );
5301
  })
5302
  .done( function( _collection_ ) {
5303
+ //api.infoLog( 'preset_sections fetched', api.sek_presetSections );
5304
  var presetSection,
5305
  allPresets = $.extend( true, {}, _.isObject( _collection_ ) ? _collection_ : {} );
5306
 
5312
  }
5313
  var presetCandidate = allPresets[ sectionParams.presetSectionId ];
5314
 
5315
+ // Ensure we have a string that's JSON.parse-able
5316
+ // if ( typeof presetCandidate !== 'string' || presetCandidate[0] !== '{' ) {
5317
+ // throw new Error( 'getPresetSectionCollection => ' + sectionParams.presetSectionId + ' is not JSON.parse-able');
5318
+ // }
5319
+ // presetCandidate = JSON.parse( presetCandidate );
5320
+
5321
  var setIds = function( collection ) {
5322
  _.each( collection, function( levelData ) {
5323
  levelData.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
5337
  });
5338
  return collection;
5339
  };
5340
+
5341
+ // ID's
5342
+ // set the section id provided.
5343
  presetCandidate.id = sectionParams.section_id;
5344
+ // the other level's id have to be generated
5345
  presetCandidate.collection = setIds( presetCandidate.collection );
5346
+
5347
+ // NIMBLE VERSION
5348
+ // set the section version
5349
  presetCandidate.ver_ini = sektionsLocalizedData.nimbleVersion;
5350
+ // the other level's version have to be added
5351
  presetCandidate.collection = setVersion( presetCandidate.collection );
5352
  __dfd__.resolve( presetCandidate );
5353
  });//_maybeFetchSectionsFromServer.done()
5354
 
5355
  return __dfd__.promise();
5356
  },
5357
+
5358
+
5359
+
5360
+
5361
+ // Walk the column collection of a preset section, and replace '::img-path::*' pattern by image ids that we get from ajax calls
5362
+ // Is designed to handle multiple ajax calls in parallel if the preset_section includes several images
5363
+ // @return a promise()
5364
  preparePresetSectionForInjection : function( columnCollection ) {
5365
  var self = this,
5366
  deferreds = {},
5367
  preparedSection = {},
5368
  _dfd_ = $.Deferred();
5369
+
5370
+ // walk the column collection and populates the deferreds object recursively
5371
  var _sniffImg = function( data ) {
5372
  _.each( data, function( val, key ) {
5373
  if ( _.isObject( val ) || _.isArray( val ) ) {
5374
  _sniffImg( val );
5375
  } else if ( _.isString( val ) && -1 != val.indexOf( '::img-path::' ) ) {
5376
+ // scenario when a section uses an image more than once.
5377
+ // => we don't need to fire a new ajax request for an image already sniffed
5378
  if ( ! _.has( deferreds, val ) ) {
5379
  deferreds[ val ] = self.importAttachment( val.replace( '::img-path::', '' ) );
5380
  }
5382
  });
5383
  return deferreds;
5384
  };
5385
+
5386
+ // walk the column collection and populates the deferreds object recursively
5387
+ // imdList is formed this way :
5388
+ // ::img-path::/assets/img/1.jpg : {id: 2547, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_1.jpg"}
5389
+ // ::img-path::/assets/img/2.jpg : {id: 2548, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_2.jpg"}
5390
+ // ::img-path::/assets/img/3.jpg : {id: 2549, url: "http://customizr-dev.test/wp-content/uploads/2018/09/nimble_asset_3.jpg"}
5391
  var _replaceImgPlaceholderById = function( data, imgList) {
5392
  _.each( data, function( val, key ) {
5393
  if ( _.isObject( val ) || _.isArray( val ) ) {
5415
  var CZRSeksPrototype = CZRSeksPrototype || {};
5416
  (function ( api, $ ) {
5417
  $.extend( CZRSeksPrototype, {
5418
+ //@return void()
5419
+ // clean registered controls, sections, panels
5420
+ // only elements that have a true "track" param on registration are populated in the registered() collection
5421
+ // if the _id_ param is not specified, all registered controls, sections and panels are removed.
5422
+ //
5423
+ // preserve the settings => because this is where the customizer changeset of values is persisted before publishing
5424
+ // typically fired before updating the ui. @see ::generateUI()
5425
  cleanRegistered : function( _id_ ) {
5426
  var self = this,
5427
  registered = $.extend( true, [], self.registered() || [] );
5431
  if ( api[ _reg_.what ].has( _reg_.id ) ) {
5432
  if ( ! _.isEmpty( _id_ ) && _reg_.id !== _id_ )
5433
  return;
5434
+ // fire an event before removal, can be used to clean some jQuery plugin instance for example
5435
  if ( _.isFunction( api[ _reg_.what ]( _reg_.id ).trigger ) ) {//<= Section and Panel constructor are not extended with the Event class, that's why we check if this method exists
5436
  self.trigger( 'sek-ui-pre-removal', { what : _reg_.what, id : _reg_.id } );
5437
  }
5438
  $.when( api[ _reg_.what ]( _reg_.id ).container.remove() ).done( function() {
5439
+ // remove control, section, panel
5440
  api[ _reg_.what ].remove( _reg_.id );
5441
+ // useful event, used to destroy the $ drop plugin instance for the section / module picker
5442
  self.trigger( 'sek-ui-removed', { what : _reg_.what, id : _reg_.id } );
5443
  });
5444
  }
5447
  });
5448
  self.registered( registered );
5449
  },
5450
+
5451
+ // Keep only the settings for global option, local options, content picker
5452
+ // Remove all the other
5453
  cleanRegisteredLevelSettingsAfterHistoryNavigation : function() {
5454
  var self = this,
5455
  registered = $.extend( true, [], self.registered() || [] );
5456
 
5457
  registered = _.filter( registered, function( _reg_ ) {
5458
+ // We check if the level property is set, so we preserve the permanent options like global options, local options, content picker
5459
  if ( ! _.isEmpty( _reg_.level ) && 'setting' === _reg_.what ) {
5460
  if ( api.has( _reg_.id ) ) {
5461
+ // remove setting from the api
5462
  api.remove( _reg_.id );
5463
  }
5464
  }
5472
  var CZRSeksPrototype = CZRSeksPrototype || {};
5473
  (function ( api, $ ) {
5474
  $.extend( CZRSeksPrototype, {
5475
+ // @eturn void()
5476
  rootPanelFocus : function() {
5477
+ //close everything
5478
  if ( api.section.has( api.czr_activeSectionId() ) ) {
5479
  api.section( api.czr_activeSectionId() ).expanded( false );
5480
  } else {
5486
  _p.expanded( false );
5487
  });
5488
  },
5489
+
5490
+ //@return a global unique identifier
5491
  guid : function() {
5492
  function s4() {
5493
  return Math.floor((1 + Math.random()) * 0x10000)
5496
  }
5497
  return s4() + s4() + s4();//s4() + s4() + s4() + s4() + s4() + s4();
5498
  },
5499
+
5500
+ //@return a string "nimble___[skp__global]"
5501
  getGlobalSectionsSettingId : function() {
5502
  return sektionsLocalizedData.settingIdForGlobalSections;
5503
  },
5504
+
5505
+ // @params = { id : '', level : '' }
5506
+ // Recursively walk the level tree until a match is found
5507
+ // @return the level model object
5508
  getLevelModel : function( id, collection ) {
5509
  var self = this, _data_ = 'no_match',
5510
+ // @param id mandatory
5511
+ // @param collection mandatory
5512
+ // @param collectionSettingId optional
5513
+ // @param localOrGlobal optional
5514
  _walk_ = function( id, collection, collectionSettingId, localOrGlobal ) {
5515
+ // do we have a collection ?
5516
+ // if not, let's use the root one
5517
  if ( _.isUndefined( collection ) ) {
5518
  var currentSektionSettingValue = api( collectionSettingId )();
5519
  var sektionSettingValue = _.isObject( currentSektionSettingValue ) ? $.extend( true, {}, currentSektionSettingValue ) : $.extend( true, {}, self.getDefaultSektionSettingValue( localOrGlobal ) );
5520
  collection = _.isArray( sektionSettingValue.collection ) ? sektionSettingValue.collection : [];
5521
  }
5522
  _.each( collection, function( levelData ) {
5523
+ // did we found a match recursively ?
5524
  if ( 'no_match' != _data_ )
5525
  return;
5526
  if ( id === levelData.id ) {
5533
  });
5534
  return _data_;
5535
  };
5536
+
5537
+ // if a collection has been provided in the signature, let's walk it.
5538
+ // Otherwise, let's walk the local and global ones until a match is found.
5539
  if ( ! _.isEmpty( collection ) ) {
5540
  _walk_( id, collection );
5541
  } else {
5551
 
5552
  return _data_;
5553
  },
5554
+
5555
+
5556
+ // used in react to preview or update api settings
5557
+ // @params is an object {
5558
+ //
5559
+ // }
5560
  isGlobalLocation : function( params ) {
5561
  var self = this, is_global_location = false;
5562
  params = params || {};
5571
  }
5572
  return is_global_location;
5573
  },
5574
+
5575
+ // @params = { id : '', level : '' }
5576
+ // Recursively walk the level tree until a match is found
5577
+ // @return the level model object
5578
  isChildOfAGlobalLocation : function( id ) {
5579
  var self = this,
5580
  walkCollection = function( id, collection ) {
5581
  var _data_ = 'no_match';
5582
+ // do we have a collection ?
5583
+ // if not, let's use the root global one
5584
  if ( _.isUndefined( collection ) ) {
5585
  var currentSettingValue = api( self.getGlobalSectionsSettingId() )();
5586
  var sektionSettingValue = _.isObject( currentSettingValue ) ? $.extend( true, {}, currentSettingValue ) : self.getDefaultSektionSettingValue( 'global' );
5587
  collection = _.isArray( sektionSettingValue.collection ) ? sektionSettingValue.collection : [];
5588
  }
5589
  _.each( collection, function( levelData ) {
5590
+ // did we found a match recursively ?
5591
  if ( 'no_match' != _data_ )
5592
  return;
5593
  if ( id === levelData.id ) {
5606
 
5607
  getLevelPositionInCollection : function( id, collection ) {
5608
  var self = this, _position_ = 'no_match',
5609
+ // @param id mandatory
5610
+ // @param collection mandatory
5611
+ // @param collectionSettingId optional
5612
+ // @param localOrGlobal optional
5613
  _walk_ = function( id, collection, collectionSettingId, localOrGlobal ) {
5614
+ // do we have a collection ?
5615
+ // if not, let's use the root one
5616
  if ( _.isUndefined( collection ) ) {
5617
  var currentSektionSettingValue = api( collectionSettingId )();
5618
  var sektionSettingValue = _.isObject( currentSektionSettingValue ) ? $.extend( true, {}, currentSektionSettingValue ) : $.extend( true, {}, self.getDefaultSektionSettingValue( localOrGlobal ) );
5619
  collection = _.isArray( sektionSettingValue.collection ) ? sektionSettingValue.collection : [];
5620
  }
5621
  _.each( collection, function( levelData, _key_ ) {
5622
+ // did we find a match recursively ?
5623
  if ( 'no_match' != _position_ )
5624
  return;
5625
  if ( id === levelData.id ) {
5631
  }
5632
  });
5633
  };
5634
+
5635
+ // if a collection has been provided in the signature, let's walk it.
5636
+ // Otherwise, let's walk the local and global ones until a match is found.
5637
  if ( ! _.isEmpty( collection ) ) {
5638
  _walk_( id, collection );
5639
  } else {
5648
  }
5649
  return _position_;
5650
  },
5651
+
5652
+
5653
+ // @params = { property : 'options', id : }
5654
+ // @return mixed type
5655
  getLevelProperty : function( params ) {
5656
  params = _.extend( {
5657
  id : '',
5674
  }
5675
  return modelCandidate[ params.property ];
5676
  },
5677
+
5678
+ // @return a detached clone of a given level model, with new unique ids
5679
  cloneLevel : function( levelId ) {
5680
  var self = this;
5681
  var levelModelCandidate = self.getLevelModel( levelId );
5683
  throw new Error( 'cloneLevel => no match for level id : ' + levelId );
5684
  }
5685
  var deepClonedLevel = $.extend( true, {}, levelModelCandidate );
5686
+ // recursive
5687
  var newIdWalker = function( level_model ) {
5688
  if ( _.isEmpty( level_model.id ) ) {
5689
  throw new Error( 'cloneLevel => missing level id');
5690
  }
5691
+ // No collection, we've reach the end of a branch
5692
  level_model.id = sektionsLocalizedData.optPrefixForSektionsNotSaved + self.guid();
5693
  if ( ! _.isEmpty( level_model.collection ) ) {
5694
  if ( ! _.isArray( level_model.collection ) ) {
5701
  }
5702
  return level_model;
5703
  };
5704
+ // recursively walk the provided level sub-tree until all collection ids are updated
5705
  return newIdWalker( deepClonedLevel );
5706
  },
5707
+
5708
+ // Extract the default model values from the server localized registered module
5709
+ // Invoked when registrating a module in api.czrModuleMap
5710
+ // For example :
5711
+ // czr_image_module : {
5712
+ // mthds : ImageModuleConstructor,
5713
+ // crud : false,
5714
+ // name : 'Image',
5715
+ // has_mod_opt : false,
5716
+ // ready_on_section_expanded : true,
5717
+ // defaultItemModel : _.extend(
5718
+ // { id : '', title : '' },
5719
+ // api.czr_sektions.getDefaultItemModelFromRegisteredModuleData( 'czr_image_module' )
5720
+ // )
5721
+ // },
5722
+ // @return {}
5723
  getDefaultItemModelFromRegisteredModuleData : function( moduleType ) {
5724
  if ( ! this.isModuleRegistered( moduleType ) ) {
5725
  return {};
5726
  }
5727
+ // This method should normally not be invoked for a father module type
5728
  if ( sektionsLocalizedData.registeredModules[moduleType].is_father ) {
5729
  api.errare( 'getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically' );
5730
  return;
5731
  }
5732
  var data = sektionsLocalizedData.registeredModules[ moduleType ].tmpl['item-inputs'],
5733
+ // title, id are always included in the defaultItemModel but those properties don't need to be saved in database
5734
+ // title and id are legacy entries that can be used in multi-items modules to identify and name the item
5735
  defaultItemModel = {
5736
  id : '',
5737
  title : ''
5754
  });
5755
  return defaultItemModel;
5756
  },
5757
+
5758
+ //@return mixed
5759
  getRegisteredModuleProperty : function( moduleType, property ) {
5760
  if ( ! this.isModuleRegistered( moduleType ) ) {
5761
  return 'not_set';
5762
  }
5763
  return sektionsLocalizedData.registeredModules[ moduleType ][ property ];
5764
  },
5765
+
5766
+ // @return boolean
5767
  isModuleRegistered : function( moduleType ) {
5768
  return sektionsLocalizedData.registeredModules && ! _.isUndefined( sektionsLocalizedData.registeredModules[ moduleType ] );
5769
  },
5770
+
5771
+
5772
+ // Walk the main sektion setting and populate an array of google fonts
5773
+ // This method is used when processing the 'sek-update-fonts' action to update the .fonts property
5774
+ // To be a candidate for sniffing, an input font value should meet those criteria :
5775
+ // 1) be the value of a '{...}_css' input id
5776
+ // 2) this input must be a font modifier ( @see 'refresh_fonts' params set on parent module registration )
5777
+ // 2) the font should start with [gfont]
5778
+ // @param args { is_global_location : bool }
5779
+ // @return array
5780
  sniffGFonts : function( args ) {
5781
  args = args || { is_global_location : false };
5782
  var self = this,
5787
  level = _.isObject( currentSektionSettingValue ) ? $.extend( true, {}, currentSektionSettingValue ) : $.extend( true, {}, self.getDefaultSektionSettingValue( localOrGlobal ) );
5788
  }
5789
  _.each( level, function( levelData, _key_ ) {
5790
+ // example of input_id candidate 'font_family_css'
5791
  if ( _.isString( _key_ ) && '_css' === _key_.substr( _key_.length - 4 ) ) {
5792
  if ( true === self.inputIsAFontFamilyModifier( _key_ ) ) {
5793
  if ( levelData.indexOf('gfont') > -1 && ! _.contains( gfonts, levelData ) ) {
5809
 
5810
  return gfonts;
5811
  },
5812
+
5813
+
5814
+
5815
+
5816
+
5817
+
5818
+
5819
+
5820
+ //-------------------------------------------------------------------------------------------------
5821
+ // <RECURSIVE UTILITIES USING THE sektionsLocalizedData.registeredModules>
5822
+ //-------------------------------------------------------------------------------------------------
5823
+ // Invoked when updating a setting value => in normalizeAndSanitizeSingleItemInputValues(), when doing updateAPISettingAndExecutePreviewActions()
5824
+ // @return a mixed type default value
5825
+ // @param input_id string
5826
+ // @param module_type string
5827
+ // @param level array || object
5828
  getInputDefaultValue : function( input_id, module_type, level ) {
5829
  var self = this;
5830
+
5831
+ // Do we have a cached default value ?
5832
  self.cachedDefaultInputValues = self.cachedDefaultInputValues || {};
5833
  self.cachedDefaultInputValues[ module_type ] = self.cachedDefaultInputValues[ module_type ] || {};
5834
  if ( _.has( self.cachedDefaultInputValues[ module_type ], input_id ) ) {
5842
  api.errare( 'getInputDefaultValue => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
5843
  return;
5844
  }
5845
+ // This method should normally not be invoked for a father module type
5846
  if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
5847
  api.errare( 'getInputDefaultValue => Father modules should be treated specifically' );
5848
  return;
5852
  }
5853
  var _defaultVal_ = 'no_default_value_specified';
5854
  _.each( level, function( levelData, _key_ ) {
5855
+ // we found a match skip next levels
5856
  if ( 'no_default_value_specified' !== _defaultVal_ )
5857
  return;
5858
  if ( input_id === _key_ && ! _.isUndefined( levelData.default ) ) {
5859
  _defaultVal_ = levelData.default;
5860
  }
5861
+ // if we have still no match, and the data are sniffable, let's go ahead recursively
5862
  if ( 'no_default_value_specified' === _defaultVal_ && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
5863
  _defaultVal_ = self.getInputDefaultValue( input_id, module_type, levelData );
5864
  }
5865
  if ( 'no_default_value_specified' !== _defaultVal_ ) {
5866
+ // cache it
5867
  self.cachedDefaultInputValues[ module_type ][ input_id ] = _defaultVal_;
5868
  }
5869
  });
5870
  return _defaultVal_;
5871
  },
5872
+
5873
+
5874
+
5875
+ // @return input_type string
5876
+ // @param input_id string
5877
+ // @param module_type string
5878
+ // @param level array || object
5879
  getInputType : function( input_id, module_type, level ) {
5880
  var self = this;
5881
+
5882
+ // Do we have a cached default value ?
5883
  self.cachedInputTypes = self.cachedInputTypes || {};
5884
  self.cachedInputTypes[ module_type ] = self.cachedInputTypes[ module_type ] || {};
5885
  if ( _.has( self.cachedInputTypes[ module_type ], input_id ) ) {
5902
  }
5903
  var _inputType_ = 'no_input_type_specified';
5904
  _.each( level, function( levelData, _key_ ) {
5905
+ // we found a match skip next levels
5906
  if ( 'no_input_type_specified' !== _inputType_ )
5907
  return;
5908
  if ( input_id === _key_ && ! _.isUndefined( levelData.input_type ) ) {
5909
  _inputType_ = levelData.input_type;
5910
  }
5911
+ // if we have still no match, and the data are sniffable, let's go ahead recursively
5912
  if ( 'no_input_type_specified' === _inputType_ && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
5913
  _inputType_ = self.getInputType( input_id, module_type, levelData );
5914
  }
5915
  if ( 'no_input_type_specified' !== _inputType_ ) {
5916
+ // cache it
5917
  self.cachedInputTypes[ module_type ][ input_id ] = _inputType_;
5918
  }
5919
  });
5920
  return _inputType_;
5921
  },
5922
+
5923
+
5924
+ // Invoked when :
5925
+ // 1) updating a setting value, in ::updateAPISettingAndExecutePreviewActions()
5926
+ // 2) we need to get a registration param like the default value for example, @see spacing input
5927
+ // @return object of registration params
5928
+ // @param input_id string
5929
+ // @param module_type string
5930
+ // @param level array || object
5931
  getInputRegistrationParams : function( input_id, module_type, level ) {
5932
  var self = this;
5933
+
5934
+ // Do we have a cached default value ?
5935
  self.cachedInputRegistrationParams = self.cachedInputRegistrationParams || {};
5936
  self.cachedInputRegistrationParams[ module_type ] = self.cachedInputRegistrationParams[ module_type ] || {};
5937
  if ( _.has( self.cachedInputRegistrationParams[ module_type ], input_id ) ) {
5945
  api.errare( 'getInputRegistrationParams => missing ' + module_type + ' in sektionsLocalizedData.registeredModules' );
5946
  return;
5947
  }
5948
+ // This method should normally not be invoked for a father module type
5949
  if ( sektionsLocalizedData.registeredModules[module_type].is_father ) {
5950
  api.errare( 'getInputRegistrationParams => Father modules should be treated specifically' );
5951
  return;
5955
  }
5956
  var _params_ = {};
5957
  _.each( level, function( levelData, _key_ ) {
5958
+ // we found a match skip next levels
5959
  if ( ! _.isEmpty( _params_ ) )
5960
  return;
5961
  if ( input_id === _key_ && ! _.isUndefined( levelData.input_type ) ) {
5962
  _params_ = levelData;
5963
  }
5964
+ // if we have still no match, and the data are sniffable, let's go ahead recursively
5965
  if ( _.isEmpty( _params_ ) && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
5966
  _params_ = self.getInputRegistrationParams( input_id, module_type, levelData );
5967
  }
5968
  if ( ! _.isEmpty( _params_ ) ) {
5969
+ // cache it
5970
  self.cachedInputRegistrationParams[ module_type ][ input_id ] = _params_;
5971
  }
5972
  });
5973
  return _params_;
5974
  },
5975
+
5976
+
5977
+ // @return bool
5978
+ // @param input_id string
5979
+ // @param module_type string
5980
+ // @param level array || object
5981
  inputIsAFontFamilyModifier : function( input_id, level ) {
5982
  var self = this;
5983
+
5984
+ // Do we have a cached default value ?
5985
  self.cachedFontFamilyModifier = self.cachedFontFamilyModifier || {};
5986
  if ( _.has( self.cachedFontFamilyModifier, input_id ) ) {
5987
  return self.cachedFontFamilyModifier[ input_id ];
5995
  }
5996
  var _bool_ = 'not_set';
5997
  _.each( level, function( levelData, _key_ ) {
5998
+ // we found a match skip next levels
5999
  if ( 'not_set' !== _bool_ )
6000
  return;
6001
  if ( input_id === _key_ && ! _.isUndefined( levelData.input_type ) ) {
6002
  _bool_ = _.isUndefined( levelData.refresh_fonts ) ? false : levelData.refresh_fonts;
6003
  }
6004
+ // if we have still no match, and the data are sniffable, let's go ahead recursively
6005
  if ( 'not_set' === _bool_ && ( _.isArray( levelData ) || _.isObject( levelData ) ) ) {
6006
  _bool_ = self.inputIsAFontFamilyModifier( input_id, levelData );
6007
  }
6008
  if ( 'not_set' !== _bool_ ) {
6009
+ // cache it
6010
  self.cachedFontFamilyModifier[ input_id ] = _bool_;
6011
  }
6012
  });
6013
  return _bool_;
6014
  },
6015
+ //-------------------------------------------------------------------------------------------------
6016
+ // </RECURSIVE UTILITIES USING THE sektionsLocalizedData.registeredModules>
6017
+ //-------------------------------------------------------------------------------------------------
6018
+
6019
+
6020
+
6021
+
6022
+
6023
+
6024
+
6025
+
6026
+
6027
+
6028
+
6029
+
6030
+
6031
+
6032
+
6033
+ // @return the item(s) ( array of items if multi-item module ) that we should use when adding the module to the main setting
6034
  getModuleStartingValue : function( module_type ) {
6035
  if ( ! sektionsLocalizedData.registeredModules ) {
6036
  api.errare( 'getModuleStartingValue => missing sektionsLocalizedData.registeredModules' );
6080
 
6081
  selectables.eq( prevIndex ).focus();
6082
  },
6083
+
6084
+
6085
+
6086
+
6087
+ //-------------------------------------------------------------------------------------------------
6088
+ // GENERIC WAY TO SETUP SELECT INPUTS
6089
+ //-------------------------------------------------------------------------------------------------
6090
+ // used in the module input constructors
6091
+ // "this" is the input
6092
  setupSelectInput : function( selectOptions ) {
6093
  var input = this,
6094
  item = input.input_parent,
6101
  api.errare( 'api.czr_sektions.setupSelectInput => missing select options for input id => ' + input.id + ' in image module');
6102
  return;
6103
  } else {
6104
+ //generates the options
6105
  _.each( selectOptions , function( title, value ) {
6106
  var _attributes = {
6107
  value : value,
6117
  $( 'select[data-czrtype]', input.container ).selecter();
6118
  }
6119
  },
6120
+
6121
+
6122
+ //-------------------------------------------------------------------------------------------------
6123
+ // GENERIC WAY TO SETUP FONT SIZE AND LINE HEIGHT INPUTS
6124
+ // DEPRECATED
6125
+ //-------------------------------------------------------------------------------------------------
6126
+ // "this" is the input
6127
  setupFontSizeAndLineHeightInputs : function( obj ) {
6128
  var input = this,
6129
  $wrapper = $('.sek-font-size-line-height-wrapper', input.container ),
6135
  }
6136
  return unit;
6137
  };
6138
+ // initialize the unit with the value provided in the dom
6139
  input.css_unit = new api.Value( _.isEmpty( initial_unit ) ? 'px' : validateUnit( initial_unit ) );
6140
+ // React to a unit change
6141
  input.css_unit.bind( function( to ) {
6142
  to = _.isEmpty( to ) ? 'px' : to;
6143
  $wrapper.find( 'input[type="number"]').trigger('change');
6144
  });
6145
+
6146
+ // instantiate stepper and schedule change reactions
6147
  $wrapper.find( 'input[type="number"]').on('input change', function( evt ) {
6148
  input( $(this).val() + validateUnit( input.css_unit() ) );
6149
  }).stepper();
6150
+
6151
+
6152
+ // Schedule unit changes on button click
6153
  $wrapper.on( 'click', '[data-sek-unit]', function(evt) {
6154
  evt.preventDefault();
6155
+ // handle the is-selected css class toggling
6156
  $wrapper.find('[data-sek-unit]').removeClass('is-selected').attr( 'aria-pressed', false );
6157
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
6158
+ // update the initial unit ( not mandatory)
6159
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
6160
+ // set the current unit Value
6161
  input.css_unit( $(this).data('sek-unit') );
6162
  });
6163
+
6164
+ // add is-selected button on init to the relevant unit button
6165
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ initial_unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
6166
  },
6167
+
6168
+
6169
+
6170
+ //-------------------------------------------------------------------------------------------------
6171
+ // PREPARE INPUT REGISTERED WITH has_device_switcher set to true
6172
+ //-------------------------------------------------------------------------------------------------
6173
+ // "this" is the input
6174
  maybeSetupDeviceSwitcherForInput : function() {
6175
  var input = this;
6176
+ // render the device switcher before the input title
6177
  var deviceSwitcherHtml = [
6178
  '<span class="sek-input-device-switcher">',
6179
  '<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+ sektionsLocalizedData.i18n['Settings on desktops'] +'"></i>',
6199
  }
6200
  input.previewedDevice( device );
6201
  };
6202
+ // react on device click
6203
  input.container.on( 'click', '[data-sek-device]', syncWithPreviewedDevice );
6204
+
6205
+ // initialize with the currently previewed device
6206
  var $currentDeviceIcon = input.container.find('[data-sek-device="' + api.previewedDevice() + '"]');
6207
  if ( $currentDeviceIcon.length > 0 ) {
6208
  $currentDeviceIcon.trigger('click');
6209
  }
6210
  },
6211
+
6212
+
6213
+
6214
+ //-------------------------------------------------------------------------------------------------
6215
+ // GENERIC WAY TO SETUP ACCORDION BEHAVIOUR OF MODULES IN SECTIONS
6216
+ //-------------------------------------------------------------------------------------------------
6217
+ // "this" is the section
6218
+ // in the content picker section, control's container have the attribute "data-sek-accordion" to selectively enable the accordion
6219
+ // @see ::generateUIforDraggableContent()
6220
+ // @params { expand_first_control : boolean }
6221
  scheduleModuleAccordion : function( params ) {
6222
  params = params || { expand_first_control : true };
6223
  var _section_ = this;
6224
+ // Attach event on click
6225
  $( _section_.container ).on( 'click', '.customize-control label > .customize-control-title', function( evt ) {
6226
+ //evt.preventDefault();
6227
  evt.stopPropagation();
6228
  var $control = $(this).closest( '.customize-control');
6229
 
6240
  duration : 0,
6241
  start : function() {
6242
  $control.attr('data-sek-expanded', "false" == $control.attr('data-sek-expanded') ? "true" : "false" );
6243
+ // this event 'sek-accordion-expanded', is used to defer the instantiation of the code editor
6244
+ // @see api.czrInputMap['code_editor']
6245
+ // @see https://github.com/presscustomizr/nimble-builder/issues/176
6246
  $control.trigger( "true" == $control.attr('data-sek-expanded') ? 'sek-accordion-expanded' : 'sek-accordion-collapsed' );
6247
  }
6248
  });
6249
  });
6250
+
6251
+ // Expand the first module if requested
6252
  if ( params.expand_first_control ) {
6253
  var firstControl = _.first( _section_.controls() );
6254
  if ( _.isObject( firstControl ) && ! _.isEmpty( firstControl.id ) ) {
6259
  }
6260
  }
6261
  },
6262
+
6263
+
6264
+
6265
+ //-------------------------------------------------------------------------------------------------
6266
+ // HELPERS USED WHEN UPLOADING IMAGES FROM PRESET SECTIONS
6267
+ //-------------------------------------------------------------------------------------------------
6268
  isPromise : function (fn) {
6269
  return fn && typeof fn.then === 'function' && String( $.Deferred().then ) === String( fn.then );
6270
  },
6271
+
6272
+ // @param deferreds = { '::img-path::/assets/img/tests/1.jpg' : 'dfd1', '::img-path::/assets/img/tests/2.jpg' : dfd2, ..., '::img-path::/assets/img/tests/n.jpg' : dfdn }
6273
  whenAllPromisesInParallel : function ( deferreds ) {
6274
  var self = this,
6275
  mainDfd = $.Deferred(),
6298
 
6299
  return mainDfd;
6300
  },
6301
+
6302
+ // Run the deferred in sequence, only one asynchronous method at a time
6303
+ // Was an experiment when implementing the img assets upload for preset sections
6304
+ // Abandonned for whenAllPromisesInParallel
6305
  whenAllPromisesInSerie : function ( deferreds, ind, promiseMessages, mainDfd ) {
6306
  ind = ind || 0;
6307
  promiseMessages = promiseMessages || {};
6324
  }//if
6325
  return mainDfd;
6326
  },
6327
+
6328
+
6329
+ // @param relpath = string : '/assets/img/41883.jpg'
6330
+ // @return a promise
6331
  importAttachment : function( relpath ) {
6332
+ // @see php wp_ajax_sek_import_attachment
6333
  return wp.ajax.post( 'sek_import_attachment', {
6334
  rel_path : relpath,
6335
  nonce: api.settings.nonce.save//<= do we need to set a specific nonce to fetch the attachment
6337
  .fail( function( _er_ ) {
6338
  api.errare( 'sek_import_attachment ajax action failed for image ' + relpath, _er_ );
6339
  });
6340
+ // .done( function( data) {
6341
+ // api.infoLog('relpath and DATA ' + relpath , data );
6342
+ // });
6343
  },
6344
+
6345
+
6346
+
6347
+
6348
+
6349
+
6350
+ // recursive helper
6351
+ // used when saving a section
6352
  cleanIds : function( levelData ) {
6353
  levelData.id = "";
6354
  var self = this;
6360
  });
6361
  return levelData;
6362
  },
6363
+
6364
+ // @return { collection[] ... }
6365
  getDefaultSektionSettingValue : function( localOrGlobal ) {
6366
  if ( _.isUndefined( localOrGlobal ) || !_.contains( [ 'local', 'global' ], localOrGlobal ) ) {
6367
  api.errare( 'getDefaultSektionSettingValue => the skope should be set to local or global');
6368
  }
6369
  return 'global' === localOrGlobal ? sektionsLocalizedData.defaultGlobalSektionSettingValue : sektionsLocalizedData.defaultLocalSektionSettingValue;
6370
  },
6371
+
6372
+ // @return void()
6373
+ // input controller instance == this
6374
  scheduleVisibilityOfInputId : function( controlledInputId, visibilityCallBack ) {
6375
  var item = this.input_parent;
6376
  if ( !_.isFunction(visibilityCallBack) || _.isEmpty(controlledInputId) ) {
6377
  throw new Error('::scheduleVisibilityOfInputId => error when firing for input id : ' + this.id );
6378
  }
6379
+ //Fire on init
6380
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
6381
+ //React on change
6382
  this.bind( function( to ) {
6383
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
6384
  });
6385
+ }
 
6386
  });//$.extend()
6387
  })( wp.customize, jQuery );//global sektionsLocalizedData
6388
  /**
6391
  * @https://html.spec.whatwg.org/multipage/dnd.html#dnd
6392
  * @https://caniuse.com/#feat=dragndrop
6393
  */
6394
+ // EVENTS
6395
+
6396
+ // drag => handler : ondrag Fired when an element or text selection is being dragged.
6397
+ // dragend => handler : ondragend Fired when a drag operation is being ended (for example, by releasing a mouse button or hitting the escape key). (See Finishing a Drag.)
6398
+ // dragenter => handler : ondragenter Fired when a dragged element or text selection enters a valid drop target. (See Specifying Drop Targets.)
6399
+ // dragexit => handler : ondragexit Fired when an element is no longer the drag operation's immediate selection target.
6400
+ // dragleave => handler : ondragleave Fired when a dragged element or text selection leaves a valid drop target.
6401
+ // dragover => handler : ondragover Fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds).
6402
+ // dragstart => handler : ondragstart Fired when the user starts dragging an element or text selection. (See Starting a Drag Operation.)
6403
+ // drop => handler : ondrop Fired when an element or text selection is dropped on a valid drop target. (See Performing a Drop.)
6404
+
6405
+ // Drop targets can be rendered statically when the preview is rendered or dynamically on dragstart ( sent to preview with 'sek-drag-start')
6406
+ // Typically, an empty column will be populated with a zek-drop-zone element statically in the preview.
6407
+ // The other drop zones are rendered dynamically in ::schedulePanelMsgReactions case 'sek-drag-start'
6408
+ //
6409
+ // droppable targets are defined server side in sektionsLocalizedData.dropSelectors :
6410
+ // '.sek-drop-zone' <= to pass the ::dnd_canDrop() test, a droppable target should have this css class
6411
+ // 'body' <= body will not be eligible for drop, but setting the body as drop zone allows us to fire dragenter / dragover actions, like toggling the "approaching" or "close" css class to real drop zone
6412
  var CZRSeksPrototype = CZRSeksPrototype || {};
6413
  (function ( api, $ ) {
6414
  $.extend( CZRSeksPrototype, {
6415
+ //-------------------------------------------------------------------------------------------------
6416
+ //-- SETUP DnD
6417
+ //-------------------------------------------------------------------------------------------------
6418
+ //Fired in ::initialize()
6419
+ // INSTANTIATE Dnd ZONES IF SUPPORTED BY THE BROWSER
6420
+ // + SCHEDULE DROP ZONES RE-INSTANTIATION ON PREVIEW REFRESH
6421
+ // + SCHEDULE API REACTION TO *drop event
6422
+ // setup $.sekDrop for $( api.previewer.targetWindow().document ).find( '.sektion-wrapper')
6423
  setupDnd : function() {
6424
  var self = this;
6425
+ // emitted by the module_picker or the section_picker module
6426
+ // @params { type : 'section' || 'module', input_container : input.container }
6427
  self.bind( 'sek-refresh-dragzones', function( params ) {
6428
+ // Detecting HTML5 Drag And Drop support in javascript
6429
+ // https://stackoverflow.com/questions/2856262/detecting-html5-drag-and-drop-support-in-javascript#2856275
6430
  if ( true !== 'draggable' in document.createElement('span') ) {
6431
  api.panel( sektionsLocalizedData.sektionsPanelId, function( __main_panel__ ) {
6432
  api.notifications.add( new api.Notification( 'drag-drop-support', {
6434
  message: sektionsLocalizedData.i18n['This browser does not support drag and drop. You might need to update your browser or use another one.'],
6435
  dismissible: true
6436
  } ) );
6437
+
6438
+ // Removed if not dismissed after 5 seconds
6439
  _.delay( function() {
6440
  api.notifications.remove( 'drag-drop-support' );
6441
  }, 10000 );
6445
 
6446
  self.setupNimbleDragZones( params.input_container );//<= module or section picker
6447
  });
6448
+
6449
+ // on previewer refresh
6450
  api.previewer.bind( 'ready', function() {
6451
  try { self.setupNimbleDropZones();//<= module or section picker
6452
  } catch( er ) {
6453
  api.errare( '::setupDnd => error on self.setupNimbleDropZones()', er );
6454
  }
6455
+ // if the module_picker or the section_picker is currently a registered ui control,
6456
+ // => re-instantiate sekDrop on the new preview frame
6457
+ // the registered() ui levels look like :
6458
+ // [
6459
+ // { what: "control", id: "__nimble___sek_draggable_sections_ui", label: "Section Picker", type: "czr_module", module_type: "sek_intro_sec_picker_module", …}
6460
+ // { what: "setting", id: "__nimble___sek_draggable_sections_ui", dirty: false, value: "", transport: "postMessage", … }
6461
+ // { what: "section", id: "__nimble___sek_draggable_sections_ui", title: "Section Picker", panel: "__sektions__", priority: 30}
6462
+ // ]
6463
  if ( ! _.isUndefined( _.findWhere( self.registered(), { module_type : 'sek_intro_sec_picker_module' } ) ) ) {
6464
  self.rootPanelFocus();
6465
  } else if ( ! _.isUndefined( _.findWhere( self.registered(), { module_type : 'sek_module_picker_module' } ) ) ) {
6466
  self.rootPanelFocus();
6467
  }
6468
  });
6469
+
6470
+ // React to the *-droped event
6471
  self.reactToDrop();
6472
  },
6473
+
6474
+ //-------------------------------------------------------------------------------------------------
6475
+ //--DRAG ZONES SETUP
6476
+ //-------------------------------------------------------------------------------------------------
6477
+ // fired in ::initialize, on 'sek-refresh-nimbleDragDropZones
6478
+ // 'sek-refresh-nimbleDragDropZones' is emitted by the section and the module picker modules with param { type : 'section_picker' || 'module_picker'}
6479
  setupNimbleDragZones : function( $draggableWrapper ) {
6480
  var self = this;
6481
+ //api.infoLog('instantiate', type );
6482
+ // $(this) is the dragged element
6483
  var _onStart = function( evt ) {
6484
+ // Reset the preview target
6485
+ // implemented for double-click insertion https://github.com/presscustomizr/nimble-builder/issues/317
6486
  self.lastClickedTargetInPreview({});
6487
 
6488
  evt.originalEvent.dataTransfer.setData( "sek-content-type", $(this).data('sek-content-type') );
6489
  evt.originalEvent.dataTransfer.setData( "sek-content-id", $(this).data('sek-content-id') );
6490
  evt.originalEvent.dataTransfer.setData( "sek-section-type", $(this).data('sek-section-type') );
6491
  evt.originalEvent.dataTransfer.setData( "sek-is-user-section", $(this).data('sek-is-user-section') );
6492
+
6493
+ // in addition to the dataTransfer storage, store the properties of the dragged object in a static property
6494
+ // => we will need it for example to access the object property when checking if "can drop"
6495
  self.dndData = {
6496
  content_type : evt.originalEvent.dataTransfer.getData( "sek-content-type" ),
6497
  content_id : evt.originalEvent.dataTransfer.getData( "sek-content-id" ),
6498
  section_type : evt.originalEvent.dataTransfer.getData( "sek-section-type" ),
6499
+ // Saved sections
6500
  is_user_section : "true" === evt.originalEvent.dataTransfer.getData( "sek-is-user-section" )
6501
  };
6502
+
6503
+ // evt.originalEvent.dataTransfer.effectAllowed = "move";
6504
+ // evt.originalEvent.dataTransfer.dropEffect = "move";
6505
+ // Notify if not supported : https://caniuse.com/#feat=dragndrop
6506
  try {
6507
  evt.originalEvent.dataTransfer.setData( 'browserSupport', 'browserSupport' );
6508
  evt.originalEvent.dataTransfer.clearData( 'browserSupport' );
6513
  message: sektionsLocalizedData.i18n['This browser does not support drag and drop. You might need to update your browser or use another one.'],
6514
  dismissible: true
6515
  } ) );
6516
+
6517
+ // Removed if not dismissed after 5 seconds
6518
  _.delay( function() {
6519
  api.notifications.remove( 'drag-drop-support' );
6520
  }, 10000 );
6524
  $('body').addClass('sek-dragging');
6525
  api.previewer.send( 'sek-drag-start', { type : self.dndData.content_type } );//fires the rendering of the dropzones
6526
  };
6527
+ // $(this) is the dragged element
6528
  var _onEnd = function( evt ) {
6529
  $('body').removeClass('sek-dragging');
6530
  $(this).removeClass('sek-dragged');
6531
  api.previewer.send( 'sek-drag-stop' );
6532
  };
6533
+ // $(this) is the double clicked element
6534
  var _onDoubleClick = function( evt ) {
6535
  var _targetCandidate = self.lastClickedTargetInPreview();// { id : "__nimble__fb2ab3e47472" }
6536
  var $dropTarget;
6541
  }
6542
 
6543
  if ( $dropTarget && $dropTarget.length > 0 ) {
6544
+ // "Emulate" a drop action
6545
+ // @see ::dnd_onDrop()
6546
  api.czr_sektions.trigger( 'sek-content-dropped', {
6547
  drop_target_element : $dropTarget,
6548
  location : $dropTarget.closest('[data-sek-level="location"]').data('sek-id'),
6549
+ // when inserted between modules
6550
  before_module : $dropTarget.data('drop-zone-before-module-or-nested-section'),
6551
  after_module : $dropTarget.data('drop-zone-after-module-or-nested-section'),
6552
+
6553
+ // When inserted between sections
6554
  before_section : $dropTarget.data('drop-zone-before-section'),
6555
  after_section : $dropTarget.data('drop-zone-after-section'),
6556
 
6558
  content_id : $(this).data('sek-content-id'),
6559
 
6560
  section_type : $(this).data('sek-section-type'),
6561
+ // Saved sections
6562
  is_user_section : "true" === $(this).data('sek-is-user-section')
6563
  });
6564
+ // And reset the preview target
6565
  self.lastClickedTargetInPreview({});
6566
  } else {
6567
  _doubleClickTargetMissingNotif();
6574
  message: sektionsLocalizedData.i18n['You first need to click on a target ( with a + icon ) in the preview.'],
6575
  dismissible: true
6576
  } ) );
6577
+ // Removed if not dismissed after a moment
6578
  _.delay( function() {
6579
  api.notifications.remove( 'missing-injection-target' );
6580
  }, 30000 );
6581
  };
6582
+
6583
+ // Schedule
6584
  $draggableWrapper.find( '[draggable="true"]' ).each( function() {
6585
  $(this)
6586
  .on( 'dragstart', function( evt ) { _onStart.call( $(this), evt ); })
6587
  .on( 'dragend', function( evt ) { _onEnd.call( $(this), evt ); })
6588
+ // double click insertion
6589
+ // implemented for https://github.com/presscustomizr/nimble-builder/issues/317
6590
  .dblclick( function( evt ) { _onDoubleClick.call( $(this), evt ); });
6591
  });
6592
  },//setupNimbleZones()
6593
+
6594
+
6595
+
6596
+
6597
+
6598
+
6599
+
6600
+
6601
+
6602
+
6603
+
6604
+
6605
+ //-------------------------------------------------------------------------------------------------
6606
+ //--DRAG ZONES SETUP
6607
+ //-------------------------------------------------------------------------------------------------
6608
+ // Scheduled on previewer('ready') each time the previewer is refreshed
6609
  setupNimbleDropZones : function() {
6610
  var self = this;
6611
  this.$dropZones = this.dnd_getDropZonesElements();
6619
 
6620
  this.$dropZones.each( function() {
6621
  var $zone = $(this);
6622
+ // Make sure we don't delegate an event twice for a given element
6623
  if ( true === $zone.data('zone-droppable-setup') )
6624
  return;
6625
 
6626
  self.enterOverTimer = null;
6627
+ // Delegated to allow reactions on future modules / sections
6628
  $zone
6629
+ //.on( 'dragenter dragover', sektionsLocalizedData.dropSelectors, )
6630
  .on( 'dragenter dragover', sektionsLocalizedData.dropSelectors, function( evt ) {
6631
+ //api.infoLog( self.enterOverTimer, self.dnd_canDrop( { targetEl : $(this), evt : evt } ) );
6632
  if ( _.isNull( self.enterOverTimer ) ) {
6633
  self.enterOverTimer = true;
6634
  _.delay(function() {
6635
+ // If the mouse did not move, reset the time and do nothing
6636
+ // this will prevent a drop zone to "dance", aka expand collapse, when stoping the mouse close to it
6637
  if ( self.currentMousePosition && ( ( self.currentMousePosition + '' ) == ( evt.clientY + '' + evt.clientX + '') ) ) {
6638
  self.enterOverTimer = null;
6639
  return;
6657
  }
6658
  break;
6659
  case 'drop' :
6660
+ // Reset the this.$cachedDropZoneCandidates now
6661
  this.$cachedDropZoneCandidates = null;//has been declared on enter over
6662
 
6663
  if ( ! self.dnd_canDrop( { targetEl : $(this), evt : evt } ) )
6665
  evt.preventDefault();//@see https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#drop
6666
  self.dnd_onDrop( $(this), evt );
6667
  self.dnd_cleanOnLeaveDrop( $(this), evt );
6668
+ // this event will fire another cleaner
6669
+ // also sent on dragend
6670
  api.previewer.send( 'sek-drag-stop' );
6671
  break;
6672
  }
6686
  isInVertically = yPos >= dzoneRect.top && dzoneRect.bottom >= yPos;
6687
  return isInVertically && isInHorizontally;
6688
  },
6689
+
6690
+ //-------------------------------------------------------------------------------------------------
6691
+ //-- DnD Helpers
6692
+ //-------------------------------------------------------------------------------------------------
6693
+ // Fired on 'dragenter dragover'
6694
+ // toggles the "approaching" and "close" css classes when conditions are met.
6695
+ //
6696
+ // Because this function can be potentially heavy if there are a lot of drop zones, this is fired with a timer
6697
+ //
6698
+ // Note : this is fired before checking if the target is eligible for drop. This way we can calculate an approach, as soon as we start hovering the 'body' ( which is part the drop selector list )
6699
  dnd_toggleDragApproachClassesToDropZones : function( evt ) {
6700
 
6701
  var self = this,
6731
  isInHorizontally = xPos <= dzoneRect.right && dzoneRect.left <= xPos,
6732
  isInVertically = yPos >= dzoneRect.top && dzoneRect.bottom >= yPos;
6733
 
6734
+ // var html = "isApproachingHorizontally : " + isApproachingHorizontally + ' | isCloseHorizontally : ' + isCloseHorizontally + ' | isInHorizontally : ' + isInHorizontally;
6735
+ // html += ' | xPos : ' + xPos + ' | zoneRect.right : ' + dzoneRect.right;
6736
+ // html += "isApproachingVertically : " + isApproachingVertically + ' | isCloseVertically : ' + isCloseVertically + ' | isInVertically : ' + isInVertically;
6737
+ // html += ' | yPos : ' + yPos + ' | zoneRect.top : ' + dzoneRect.top;
6738
+ // $(this).html( '<span style="font-size:10px">' + html + '</span>');
6739
+
6740
+ // var html = '';
6741
+ // html += ' | mouseToBottom : ' + mouseToBottom + ' | mouseToTop : ' + mouseToTop;
6742
+ // html += "isApproachingVertically : " + isApproachingVertically + ' | isCloseVertically : ' + isCloseVertically + ' | isInVertically : ' + isInVertically;
6743
+ // $(this).html( '<span style="font-size:12px">' + html + '</span>');
6744
+
6745
+ // var html = ' | xPos : ' + xPos + ' | zoneRect.right : ' + dzoneRect.right + ' | zoneRect.left : ' + dzoneRect.left;
6746
+ // html += "mouseToYCenter : " + mouseToYCenter + ' | mouseToXCenter : ' + mouseToXCenter;
6747
+ // html += ' | yPos : ' + yPos + ' | zoneRect.top : ' + dzoneRect.top + ' | zoneRect.bottom : ' + dzoneRect.bottom;
6748
+ // $(this).html( '<span style="font-size:10px">' + html + '</span>');
6749
+
6750
  self.distanceTable.push({
6751
  el : $(this),
6752
  dist : ( isInVertically && isInHorizontally ) ? 0 : getHypotenuse( mouseToXCenter, mouseToYCenter )
6753
  });
6754
+
6755
+
6756
+ //var html = '';
6757
+
6758
+ // if ( isInVertically && isInHorizontally ) {
6759
+ // $(this).removeClass( 'sek-drag-is-approaching');
6760
+ // $(this).removeClass( 'sek-drag-is-close' );
6761
+ // $(this).removeClass( 'sek-drag-is-very-close');
6762
+ // $(this).addClass( 'sek-drag-is-in');
6763
+ // //html += 'is IN';
6764
+ // }
6765
+ // else if ( ( isCloseVertically || isInVertically ) && ( isCloseHorizontally || isInHorizontally ) ) {
6766
+ // $(this).removeClass( 'sek-drag-is-approaching');
6767
+ // $(this).addClass( 'sek-drag-is-close' );
6768
+ // $(this).removeClass( 'sek-drag-is-very-close');
6769
+ // $(this).removeClass( 'sek-drag-is-in');
6770
+ // //html += 'is close';
6771
+ // } else if ( ( isApproachingVertically || isInVertically ) && ( isApproachingHorizontally || isInHorizontally ) ) {
6772
+ // $(this).addClass( 'sek-drag-is-approaching');
6773
+ // $(this).removeClass( 'sek-drag-is-close' );
6774
+ // $(this).removeClass( 'sek-drag-is-very-close');
6775
+ // $(this).removeClass( 'sek-drag-is-in');
6776
+ // //html += 'is approaching';
6777
+ //
6778
  $(this).removeClass( 'sek-drag-is-in');
6779
 
6780
  if ( ( isVeryCloseVertically || isInVertically ) && ( isVeryCloseHorizontally || isInHorizontally ) ) {
6782
  $(this).removeClass( 'sek-drag-is-close' );
6783
  $(this).addClass( 'sek-drag-is-very-close');
6784
  $(this).removeClass( 'sek-drag-is-in');
6785
+ //html += 'is very close';
6786
  } else {
6787
  $(this).removeClass( 'sek-drag-is-approaching');
6788
  $(this).removeClass( 'sek-drag-is-close' );
6789
  $(this).removeClass( 'sek-drag-is-very-close');
6790
  $(this).removeClass( 'sek-drag-is-in');
6791
  }
6792
+
6793
+
6794
+ //$(this).html( '<span style="font-size:10px">' + html + '</span>');
6795
  });//$('.sek-drop-zones').each()
6796
 
6797
 
6805
  if ( self.$dropTargetCandidate && self.$dropTargetCandidate.length > 0 && self.dnd_isInTarget( self.$dropTargetCandidate, evt ) ) {
6806
  self.$dropTargetCandidate.addClass('sek-drag-is-in');
6807
  }
6808
+ // Reset the timer
6809
  self.enterOverTimer = null;
6810
  },
6811
+
6812
+ // @return string
6813
  dnd_getPreDropElementContent : function( evt ) {
6814
  var $target = $( evt.currentTarget ),
6815
  html,
6837
  }
6838
  return preDropContent;
6839
  },
6840
+
6841
+ // Scheduled on previewer('ready') each time the previewer is refreshed
6842
  dnd_getDropZonesElements : function() {
6843
  return $( api.previewer.targetWindow().document );
6844
  },
6845
+
6846
+ // @return boolean
6847
+ // @paraps = { targetEl : $(this), evt : evt }
6848
+ // Note : the class "sek-content-preset_section-drop-zone" is dynamically generated in preview::schedulePanelMsgReactions() sek-drag-start case
6849
  dnd_canDrop : function( params ) {
6850
  params = _.extend( { targetEl : {}, evt : {} }, params || {} );
6851
  var self = this, $dropTarget = params.targetEl;
6889
 
6890
  return $dropTarget.hasClass('sek-drop-zone') && ( ( 'preset_section' === self.dndData.content_type && isSectionDropZone ) || ( 'module' === self.dndData.content_type && ! isSectionDropZone ) || ( 'preset_section' === self.dndData.content_type && sectionHasNoModule ) );
6891
  },
6892
+
6893
+ // @return void()
6894
  dnd_OnEnterOver : function( $dropTarget, evt ) {
6895
  evt.preventDefault();//@see :https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#droptargets
6896
+ // Bail here if we are in the currently drag entered element
6897
  if ( true !== $dropTarget.data( 'is-drag-entered' ) ) {
6898
+ // Flag now
6899
  $dropTarget.data( 'is-drag-entered', true );
6900
  $dropTarget.addClass( 'sek-active-drop-zone' );
6901
+ // Flag the dropEl parent element
6902
  this.$dropZones.addClass( 'sek-is-dragging' );
6903
  }
6904
 
6906
  api.errare('Error when trying to insert the preDrop content', er );
6907
  }
6908
  },
6909
+
6910
+ // @return void()
6911
  dnd_cleanOnLeaveDrop : function( $dropTarget, evt ) {
6912
  var self = this;
6913
  this.$dropZones = this.$dropZones || this.dnd_getDropZonesElements();
6918
  self.dnd_cleanSingleDropTarget( $(this) );
6919
  });
6920
  },
6921
+
6922
+ // @return void()
6923
  dnd_cleanSingleDropTarget : function( $dropTarget ) {
6924
  if ( _.isEmpty( $dropTarget ) || $dropTarget.length < 1 )
6925
  return;
6933
 
6934
  $dropTarget.find('.sek-no-drop-possible-message').remove();
6935
  },
6936
+
6937
+
6938
+ // @return string after or before
6939
  dnd_getPosition : function( $dropTarget, evt ) {
6940
  var targetRect = $dropTarget[0].getBoundingClientRect(),
6941
  targetHeight = targetRect.height;
6942
+
6943
+ // if the preDrop is already printed, we have to take it into account when calc. the target height
6944
  if ( 'before' === $dropTarget.data( 'preDrop-position' ) ) {
6945
  targetHeight = targetHeight + this.preDropElement.outerHeight();
6946
  } else if ( 'after' === $dropTarget.data( 'preDrop-position' ) ) {
6949
 
6950
  return evt.originalEvent.clientY - targetRect.top - ( targetHeight / 2 ) > 0 ? 'after' : 'before';
6951
  },
6952
+
6953
+ // @return void()
6954
  dnd_mayBePrintPreDropElement : function( $dropTarget, evt ) {
6955
  var self = this,
6956
  previousPosition = $dropTarget.data( 'preDrop-position' ),
6964
  }
6965
 
6966
  self.isPrintingPreDrop = true;
6967
+
6968
+ // make sure we clean the previous wrapper of the pre drop element
6969
  this.dnd_cleanSingleDropTarget( this.$currentPreDropTarget );
6970
  var inNewSection = 'between-sections' === $dropTarget.data('sek-location') || 'in-empty-location' === $dropTarget.data('sek-location');
6971
  $.when( self.preDropElement.remove() ).done( function(){
6972
  $dropTarget[ 'before' === newPosition ? 'prepend' : 'append' ]( self.preDropElement )
6973
  .find( '.' + sektionsLocalizedData.preDropElementClass ).html( self.dnd_getPreDropElementContent( evt ) );
6974
+ // Flag the preDrop element with class to apply a specific style if inserted in a new sektion of in a column
6975
  $dropTarget.find( '.' + sektionsLocalizedData.preDropElementClass ).toggleClass('in-new-sektion', inNewSection );
6976
  $dropTarget.data( 'preDrop-position', newPosition );
6977
 
6981
  self.$currentPreDropTarget = $dropTarget;
6982
  });
6983
  },
6984
+
6985
+ //@return void()
6986
  dnd_isOveringDropTarget : function( $dropTarget, evt ) {
6987
  var targetRect = $dropTarget[0].getBoundingClientRect(),
6988
  mouseX = evt.clientX,
6995
  isYin = mouseY >= tTop && ( tBottom - tTop ) >= ( mouseY - tTop);
6996
  return isXin && isYin;
6997
  },
6998
+
6999
+ //@return void()
7000
  dnd_onDrop: function( $dropTarget, evt ) {
7001
  evt.stopPropagation();
7002
  var _position = 'after' === this.dnd_getPosition( $dropTarget, evt ) ? $dropTarget.index() + 1 : $dropTarget.index();
7003
+ // api.infoLog('onDropping params', position, evt );
7004
+ // api.infoLog('onDropping element => ', $dropTarget.data('drop-zone-before-section'), $dropTarget );
7005
  api.czr_sektions.trigger( 'sek-content-dropped', {
7006
  drop_target_element : $dropTarget,
7007
  location : $dropTarget.closest('[data-sek-level="location"]').data('sek-id'),
7008
+ // when inserted between modules
7009
  before_module : $dropTarget.data('drop-zone-before-module-or-nested-section'),
7010
  after_module : $dropTarget.data('drop-zone-after-module-or-nested-section'),
7011
+
7012
+ // When inserted between sections
7013
  before_section : $dropTarget.data('drop-zone-before-section'),
7014
  after_section : $dropTarget.data('drop-zone-after-section'),
7015
 
7017
  content_id : evt.originalEvent.dataTransfer.getData( "sek-content-id" ),
7018
 
7019
  section_type : evt.originalEvent.dataTransfer.getData( "sek-section-type" ),
7020
+ // Saved sections
7021
  is_user_section : "true" === evt.originalEvent.dataTransfer.getData( "sek-is-user-section" )
7022
  });
7023
  },
7024
+
7025
+
7026
+
7027
+
7028
+
7029
+
7030
+
7031
+
7032
+
7033
+
7034
+
7035
+
7036
+
7037
+
7038
+ //-------------------------------------------------------------------------------------------------
7039
+ //-- SCHEDULE REACTIONS TO 'sek-content-dropped'
7040
+ //-------------------------------------------------------------------------------------------------
7041
+ // invoked on api('ready') from self::initialize()
7042
  reactToDrop : function() {
7043
  var self = this;
7044
+ // @param {
7045
+ // drop_target_element : $(el) in which the content has been dropped
7046
+ // position : 'bottom' or 'top' compared to the drop-zone
7047
+ // before_section : $(this).data('drop-zone-before-section'),
7048
+ // after_section : $(this).data('drop-zone-after-section'),
7049
+ // content_type : evt.originalEvent.dataTransfer.getData( "sek-content-type" ),
7050
+ // content_id : evt.originalEvent.dataTransfer.getData( "sek-content-id" ),
7051
+ // section_type : evt.originalEvent.dataTransfer.getData( "sek-section-type" ),//<= content, header, footer
7052
+ // is_user_section : true === evt.originalEvent.dataTransfer.getData( "sek-is-user-section" ),
7053
+ // }
7054
  var _do_ = function( params ) {
7055
  if ( ! _.isObject( params ) ) {
7056
  throw new Error( 'Invalid params provided' );
7061
 
7062
  var $dropTarget = params.drop_target_element,
7063
  dropCase = 'content-in-column';
7064
+
7065
+ // If the data('sek-location') is available, let's use it
7066
  switch( $dropTarget.data('sek-location') ) {
7067
  case 'between-sections' :
7068
  dropCase = 'content-in-a-section-to-create';
7076
  dropCase = 'content-in-new-column';
7077
  break;
7078
  }
7079
+
7080
+ // case of a preset_section content_type being added to an existing but empty section
7081
  if ( 'preset_section' === params.content_type ) {
7082
  if ( $dropTarget.hasClass( 'sek-module-drop-zone-for-first-module' ) ) {
7083
  var $parentSektion = $dropTarget.closest('div[data-sek-level="section"]');
7084
+ //calculate the number of column in this section, excluding the columns inside nested sections if any
7085
  var colNumber = $parentSektion.find('.sek-sektion-inner').first().children( '[data-sek-level="column"]' ).length;
7086
+ // if the parent section has more than 1 column, we will need to inject the preset_section inside a nested_section
7087
  if ( colNumber > 1 ) {
7088
  dropCase = 'preset-section-in-a-nested-section-to-create';
7089
  params.is_nested = true;
7090
  params.in_column = $dropTarget.closest('[data-sek-level="column"]').data('sek-id');
7091
  params.in_sektion = $parentSektion.data('sek-id');
7092
+ //params.after_section = params.sektion_to_replace;
7093
  } else {
7094
  params.sektion_to_replace = $parentSektion.data('sek-id');
7095
  params.after_section = params.sektion_to_replace;
7096
+ // if the sektion to replace is nested, we will append the new sektion to the parent column of the nested section
7097
  params.in_column = $parentSektion.closest('[data-sek-level="column"]').data('sek-id');
7098
  dropCase = 'content-in-a-section-to-replace';
7099
  }
7138
  case 'content-in-a-section-to-create' :
7139
  api.previewer.trigger( 'sek-add-content-in-new-sektion', params );
7140
  break;
7141
+ // this case fixes https://github.com/presscustomizr/nimble-builder/issues/139
7142
  case 'content-in-a-section-to-replace' :
7143
  api.previewer.trigger( 'sek-add-content-in-new-sektion', params );
7144
  break;
7152
  default :
7153
  api.errare( 'sek control panel => ::reactToDrop => invalid drop case : ' + dropCase );
7154
  break;
7155
+ // case 'content-in-new-column' :
7156
+
7157
+ // break;
7158
  }
7159
  };
7160
+
7161
+ // @see module picker or section picker modules
7162
+ // api.czr_sektions.trigger( 'sek-content-dropped', {
7163
+ // drop_target_element : $(this),
7164
+ // position : _position,
7165
+ // before_section : $(this).data('drop-zone-before-section'),
7166
+ // after_section : $(this).data('drop-zone-after-section'),
7167
+ // content_type : evt.originalEvent.dataTransfer.getData( "sek-content-type" ),
7168
+ // content_id : evt.originalEvent.dataTransfer.getData( "sek-content-id" ),
7169
+ // is_user_section : true === evt.originalEvent.dataTransfer.getData( "sek-is-user-section" ),
7170
+ // });
7171
  this.bind( 'sek-content-dropped', function( params ) {
7172
+ //api.infoLog('sek-content-dropped', params );
7173
  try { _do_( params ); } catch( er ) {
7174
  api.errare( 'error when reactToDrop', er );
7175
  }
7184
  Credits : xwp, westonruter, valendesigns, sayedwp, utkarshpatel.
7185
  Date of original code modification : July 2018
7186
  */
7187
+ // fired from ::initialize()
7188
  setupTinyMceEditor: function() {
7189
  var self = this;
7190
+ // OBSERVABLE VALUES
7191
  api.sekEditorExpanded = new api.Value( false );
7192
  api.sekEditorSynchronizedInput = new api.Value();
7193
 
7194
  self.editorEventsListenerSetup = false;//this status will help us ensure that we bind the shared tinyMce instance only once
7195
+
7196
+ // Cache the instance and attach
7197
  var mayBeAwakeTinyMceEditor = function() {
7198
  api.sekTinyMceEditor = api.sekTinyMceEditor || tinyMCE.get( 'czr-customize-content_editor' );
7199
 
7203
  self.trigger('sek-tiny-mce-editor-bound-and-instantiated');
7204
  }
7205
  };
7206
+
7207
+
7208
+ // SET THE SYNCHRONIZED INPUT
7209
+ // CASE 1) When user has clicked on a tiny-mce editable content block
7210
+ // CASE 2) when user click on the edit button in the module ui
7211
+ // @see reactToPreviewMsg
7212
+ // Each time a message is received from the preview, the corresponding action are executed
7213
+ // and an event {msgId}_done is triggered on the current instance
7214
+ // This is how we can listen here to 'sek-edit-module_done'
7215
+ // The sek-edit-module is fired when clicking on a .sek-module wrapper @see ::scheduleUiClickReactions
7216
  self.bind( 'sek-edit-module_done', function( params ) {
7217
  params = _.isObject( params ) ? params : {};
7218
  if ( 'tiny_mce_editor' !== params.clicked_input_type && 'czr_tiny_mce_editor_module' !== params.module_type )
7219
  return;
7220
+
7221
+ // @see preview::scheduleUiClickReactions()
7222
+ // Fixes : https://github.com/presscustomizr/nimble-builder/issues/251
7223
  if ( _.isEmpty( params.syncedTinyMceInputId ) )
7224
  return;
7225
 
7226
  var controlId = params.id;
7227
+ // When the module is a father, we need to assign the right child module id
7228
  if ( true === self.getRegisteredModuleProperty( params.module_type, 'is_father' ) ) {
7229
  var _childModules_ = self.getRegisteredModuleProperty( params.module_type, 'children' );
7230
  if ( _.isEmpty( _childModules_ ) ) {
7237
  });
7238
  }
7239
  }
7240
+
7241
+ // Set a new sync input
7242
  api.sekEditorSynchronizedInput({
7243
  control_id : controlId,
7244
  input_id : params.syncedTinyMceInputId
7247
  api.sekEditorExpanded( true );
7248
  api.sekTinyMceEditor.focus();
7249
  });
7250
+
7251
+ // CASE 1)
7252
+ // Toggle the editor visibility
7253
+ // Change the button text
7254
+ // set the clicked input id as the new one
7255
  $('#customize-theme-controls').on('click', '[data-czr-action="open-tinymce-editor"]', function() {
7256
+ //console.log( '[data-czr-action="toggle-tinymce-editor"]', $(this) , api.sekEditorSynchronizedInput() );
7257
+ // Get the control and the input id from the clicked element
7258
+ // => then updated the synchronized input with them
7259
  var control_id = $(this).data('czr-control-id'),
7260
  input_id = $(this).data('czr-input-id');
7261
  if ( _.isEmpty( control_id ) || _.isEmpty( input_id ) ) {
7271
  api.sekEditorExpanded( true );
7272
  api.sekTinyMceEditor.focus();
7273
  });
7274
+
7275
+
7276
+ // CASE 2)
7277
+ // when the synchronized input gets changed by the user
7278
+ // 1) make sure the editor is expanded
7279
+ // 2) refresh the editor content with the input() one
7280
  api.sekEditorSynchronizedInput.bind( function( to, from ) {
7281
  mayBeAwakeTinyMceEditor();
7282
+ //api.sekEditorExpanded( true );
7283
+ //console.log('MODULE VALUE ?', self.getLevelProperty( { property : 'value', id : to.control_id } ) );
7284
+
7285
+ // When initializing the module, its customized value might not be set yet
7286
+ // => defer the setContent action when the api setting is instantiated
7287
  api( to.control_id, function( _setting_ ) {
7288
  var _currentModuleValue_ = _setting_(),
7289
  _currentInputContent_ = ( _.isObject( _currentModuleValue_ ) && ! _.isEmpty( _currentModuleValue_[ to.input_id ] ) ) ? _currentModuleValue_[ to.input_id ] : '';
7290
+
7291
+ // automatically add line breaks when setting the content
7292
+ // simplified version of php wpautop()
7293
+ // fixes https://github.com/presscustomizr/nimble-builder/issues/259
7294
  _currentInputContent_ = _currentInputContent_.replace(/\r?\n/g, '<br/>');
7295
  try { api.sekTinyMceEditor.setContent( _currentInputContent_ ); } catch( er ) {
7296
  api.errare( 'Error when setting the tiny mce editor content in setupTinyMceEditor', er );
7299
  });
7300
 
7301
  });//api.sekEditorSynchronizedInput.bind( function( to, from )
7302
+
7303
+
7304
+
7305
+
7306
+
7307
+
7308
+
7309
+
7310
+ // REACT TO EDITOR VISIBILITY
7311
  api.sekEditorExpanded.bind( function ( expanded, from, params ) {
7312
  mayBeAwakeTinyMceEditor();
7313
+ //api.infoLog('in api.sekEditorExpanded', expanded );
7314
  if ( expanded ) {
7315
  api.sekTinyMceEditor.focus();
7316
  }
7319
  /*
7320
  * Ensure only the latest input is bound
7321
  */
7322
+ // if ( api.sekTinyMceEditor.locker && api.sekTinyMceEditor.locker !== input ) {
7323
+ // //api.sekEditorExpanded.set( false );
7324
+ // api.sekTinyMceEditor.locker = null;
7325
+ // } if ( ! api.sekTinyMceEditor.locker || api.sekTinyMceEditor.locker === input ) {
7326
+ // $(document.body).toggleClass('czr-customize-content_editor-pane-open', expanded);
7327
+ // api.sekTinyMceEditor.locker = input;
7328
+ // }
7329
 
7330
  $( window )[ expanded ? 'on' : 'off' ]('resize', function() {
7331
  if ( ! api.sekEditorExpanded() )
7339
  if ( expanded ) {
7340
  self.czrResizeEditor( window.innerHeight - self.$editorPane.height() );
7341
  } else {
7342
+ //resize reset
7343
+ //self.container.closest( 'ul.accordion-section-content' ).css( 'padding-bottom', '' );
7344
  self.$preview.css( 'bottom', '' );
7345
  self.$collapseSidebar.css( 'bottom', '' );
7346
  }
7347
  });
7348
+
7349
+
7350
+
7351
+
7352
+ // COLLAPSING THE EDITOR
7353
+ // or on click on the icon located on top of the editor
7354
  $('#czr-customize-content_editor-pane' ).on('click', '[data-czr-action="close-tinymce-editor"]', function() {
7355
  api.sekEditorExpanded( false );
7356
  });
7357
+
7358
+ // on click anywhere but on the 'Edit' ( 'open-tinymce-editor' action ) button
7359
  $('#customize-controls' ).on('click', function( evt ) {
7360
  if ( 'open-tinymce-editor' == $( evt.target ).data( 'czr-action') )
7361
  return;
7362
  api.sekEditorExpanded( false, { context : "clicked anywhere"} );
7363
  });
7364
+
7365
+ // Pressing the escape key collapses the editor
7366
+ // both in the customizer panel and the editor frame
7367
  $(document).on( 'keydown', _.throttle( function( evt ) {
7368
  if ( 27 === evt.keyCode ) {
7369
  api.sekEditorExpanded( false );
7409
 
7410
  attachEventsToEditor : function() {
7411
  var self = this;
7412
+ // Cache some dom elements
7413
  self.$editorTextArea = $( '#czr-customize-content_editor' );
7414
  self.$editorPane = $( '#czr-customize-content_editor-pane' );
7415
  self.$editorDragbar = $( '#czr-customize-content_editor-dragbar' );
7420
 
7421
  self.$preview = $( '#customize-preview' );
7422
  self.$collapseSidebar = $( '.collapse-sidebar' );
7423
+
7424
+ // REACT TO EDITOR CHANGES
7425
+ // bind on / off event actions
7426
+ // Problem to solve : we need to attach event to both the visual and the text editor tab ( html editor ), which have different selectors
7427
+ // If we bind only the visual editor, changes made to the simple textual html editor won't be taken into account
7428
+ // VISUAL EDITOR
7429
  api.sekTinyMceEditor.on( 'input change keyup', function( evt ) {
7430
+ //console.log('api.sekTinyMceEditor on input change keyup', evt.type, api.sekTinyMceEditor.getContent() );
7431
+ // set the input value
7432
  if ( api.control.has( api.sekEditorSynchronizedInput().control_id ) ) {
7433
  try { api.control( api.sekEditorSynchronizedInput().control_id )
7434
  .trigger( 'tinyMceEditorUpdated', {
7441
  }
7442
  }
7443
  });
7444
+
7445
+ // TEXT EDITOR
7446
  self.$editorTextArea.on( 'input', function( evt ) {
7447
+ //console.log('self.$editorTextArea EVENT ', evt.type, self.$editorTextArea.val() );
7448
  try { api.control( api.sekEditorSynchronizedInput().control_id )
7449
  .trigger( 'tinyMceEditorUpdated', {
7450
  input_id : api.sekEditorSynchronizedInput().input_id,
7455
  api.errare( 'Error when triggering tinyMceEditorUpdated', er );
7456
  }
7457
  });
7458
+
7459
+
7460
+
7461
+ // LISTEN TO USER DRAG ACTIONS => RESIZE EDITOR
7462
+ // Note : attaching event to the dragbar element was broken => the mouseup event could not be triggered for some reason, probably because adding the class "czr-customize-content_editor-pane-resize", makes us lose access to the dragbar element
7463
+ // => that's why we listen for the mouse events when they have bubbled up to the parent wrapper, and then check if the target is our candidate.
7464
  $('#czr-customize-content_editor-pane').on( 'mousedown mouseup', function( evt ) {
7465
  if ( 'mousedown' === evt.type && 'czr-customize-content_editor-dragbar' !== $(evt.target).attr('id') && ! $(evt.target).hasClass('czr-resize-handle') )
7466
  return;
7491
 
7492
  czrResizeEditor : function( position ) {
7493
  var self = this,
7494
+ //$sectionContent = input.container.closest( 'ul.accordion-section-content' ),
7495
  windowHeight = window.innerHeight,
7496
  windowWidth = window.innerWidth,
7497
  minScroll = 40,
7533
  'bottom',
7534
  collapseMinSpacing > windowHeight - args.height ? self.$mceStatusbar.outerHeight() + collapseBottomInsideEditor : args.height + collapseBottomOutsideEditor
7535
  );
7536
+
7537
+ //$sectionContent.css( 'padding-bottom', windowWidth <= mobileWidth ? args.height : '' );
7538
  }
7539
  });//$.extend()
7540
  })( wp.customize, jQuery );//global sektionsLocalizedData
7541
  var CZRSeksPrototype = CZRSeksPrototype || {};
7542
  (function ( api, $ ) {
7543
+ // Skope
7544
  $.extend( CZRSeksPrototype, api.Events );
7545
  var CZR_SeksConstructor = api.Class.extend( CZRSeksPrototype );
7546
+
7547
+ // Schedule skope instantiation on api ready
7548
+ // api.bind( 'ready' , function() {
7549
+ // api.czr_skopeBase = new api.CZR_SeksConstructor();
7550
+ // });
7551
  try { api.czr_sektions = new CZR_SeksConstructor(); } catch( er ) {
7552
  api.errare( 'api.czr_sektions => problem on instantiation', er );
7553
  }
7554
  })( wp.customize, jQuery );//global sektionsLocalizedData
7555
  ( function ( api, $, _ ) {
7556
+ // all available input type as a map
7557
  api.czrInputMap = api.czrInputMap || {};
7558
+
7559
+
7560
+ // HELPERS USED IN ALL SPACING INPUT TYPES
7561
+ // "this" is input
7562
  var validateUnit = function( unit ) {
7563
  if ( ! _.contains( ['px', 'em', '%'], unit ) ) {
7564
  api.errare( 'error : invalid unit for input ' + this.id, unit );
7571
  },
7572
  unitButtonsSetup = function( $wrapper ) {
7573
  var input = this;
7574
+ // Schedule unit changes on button click
7575
+ // @param params can be { previewed_device_switched : true }
7576
  $wrapper.on( 'click', '.sek-ui-button', function( evt, params ) {
7577
  evt.preventDefault();
7578
+ // handle the is-selected css class toggling
7579
  $wrapper.find('.sek-ui-button').removeClass('is-selected').attr( 'aria-pressed', false );
7580
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
7581
+ // set the current unit Value
7582
  input.css_unit( $(this).data('sek-unit'), params );
7583
  });
7584
+
7585
+ // add is-selected button on init to the relevant unit button
7586
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ ( input.initial_unit || 'px' ) +'"]').addClass('is-selected').attr( 'aria-pressed', true );
7587
  },
7588
  setupResetAction = function( $wrapper, defaultVal ) {
7594
  });
7595
 
7596
  input( defaultVal );
7597
+ // Reset unit to pixels
7598
  $('.sek-unit-wrapper', $wrapper ).find('[data-sek-unit="px"]').trigger('click');
7599
  });
7600
  };
7610
  $wrapper = $('.sek-spacing-wrapper', input.container ),
7611
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
7612
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : [];
7613
+
7614
+ // Listen to user actions on the inputs and set the input value
7615
  $wrapper.on( 'input', 'input[type="number"]', function(evt) {
7616
  var _type_ = $(this).closest('[data-sek-spacing]').data('sek-spacing'),
7617
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
7618
  _rawVal = $(this).val();
7619
+
7620
+ // Validates
7621
+ // @fixes https://github.com/presscustomizr/nimble-builder/issues/26
7622
  if ( ( _.isString( _rawVal ) && ! _.isEmpty( _rawVal ) ) || _.isNumber( _rawVal ) ) {
7623
  _newInputVal[ _type_ ] = _rawVal;
7624
  } else {
7625
+ // this allow users to reset a given padding / margin instead of reseting them all at once with the "reset all spacing" option
7626
  _newInputVal = _.omit( _newInputVal, _type_ );
7627
  }
7628
  input( _newInputVal );
7629
  });
7630
+ // Schedule a reset action
7631
  setupResetAction.call( input, $wrapper, defaultVal );
7632
+
7633
+ // Synchronize on init
7634
  if ( _.isObject( input() ) ) {
7635
  _.each( input(), function( _val_, _key_ ) {
7636
  $( '[data-sek-spacing="' + _key_ +'"]', $wrapper ).find( 'input[type="number"]' ).val( _val_ );
7637
  });
7638
+ // loop on the unit buttons and check which one should be clicked
7639
  var unitToActivate = 'px';
7640
  $('.sek-unit-wrapper .sek-ui-button', input.container ).each( function() {
7641
  var unit = $(this).data('sek-unit');
7642
+ // do we have a unit for the current device ?
7643
  if ( ! _.isEmpty( input() ) ) {
7644
  if ( ! _.isEmpty( input()[ 'unit' ] ) ) {
7645
  if ( unit === input()[ 'unit' ] ) {
7650
  });
7651
  $('.sek-unit-wrapper', input.container ).find('[data-sek-unit="' + validateUnit.call( input, unitToActivate ) + '"]').trigger('click');
7652
  }
7653
+
7654
+ // Set the initial unit
7655
  var initial_value = input();
7656
  input.initial_unit = 'px';
7657
  if ( ! _.isEmpty( initial_value ) ) {
7658
  input.initial_unit = _.isEmpty( initial_value['unit'] ) ? 'px' : initial_value['unit'];
7659
  }
7660
+
7661
+ // initialize the unit with the value provided in the dom
7662
  input.css_unit = new api.Value( validateUnit.call( input, input.initial_unit ) );
7663
+
7664
+ // React to a unit change
7665
  input.css_unit.bind( function( to ) {
7666
  to = _.isEmpty( to ) ? 'px' : to;
7667
  var _newInputVal;
7670
  _newInputVal[ 'unit' ] = to;
7671
  input( _newInputVal );
7672
  });
7673
+
7674
+ // Schedule unit changes on button click
7675
+ // add is-selected button on init to the relevant unit button
7676
  unitButtonsSetup.call( input, $wrapper );
7677
  }
7678
  });//$.extend( api.czrInputMap, {})
7694
  /* ------------------------------------------------------------------------- *
7695
  * SPACING WITH DEVICE SWITCHER
7696
  /* ------------------------------------------------------------------------- */
7697
+ // input_type => callback fn to fire in the Input constructor on initialize
7698
+ // the callback can receive specific params define in each module constructor
7699
+ // For example, a content picker can be given params to display only taxonomies
7700
+ // the default input_event_map can also be overriden in this callback
7701
  $.extend( api.czrInputMap, {
7702
  spacingWithDeviceSwitcher : function( input_options ) {
7703
+ // DEFINITIONS
7704
  var input = this,
7705
  $wrapper = $('.sek-spacing-wrapper', input.container ),
7706
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
7707
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
7708
+
7709
+ // Recursive helper
7710
+ // return the value set for the currently previewed device if exists
7711
+ // OR
7712
+ // return the inherited value from the first parent device for which the value is set
7713
+ // OR
7714
+ // falls back on the module default
7715
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
7716
  var deviceHierarchy = [ 'mobile' , 'tablet', 'desktop' ];
7717
  if ( _.has( inputValues, currentDevice ) ) {
7725
  }
7726
  }
7727
  };
7728
+
7729
+ // Synchronizes on init + refresh on previewed device changes
7730
  var syncWithPreviewedDevice = function( currentDevice ) {
7731
  var inputValues = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
7732
  clonedDefault = $.extend( true, {}, defaultVal );
7733
  inputValues = _.isObject( inputValues ) ? $.extend( clonedDefault, inputValues ) : clonedDefault;
7734
  var _currentDeviceValues = getCurrentDeviceActualOrInheritedValue( inputValues, currentDevice );
7735
+
7736
+ // loop on each sek spacing and check if we find a value to write for this device
7737
  $( '[data-sek-spacing]', $wrapper ).each( function() {
7738
  var spacingType = $(this).data('sek-spacing'),
7739
  _val_ = '';
7740
+ // do we have a val for the current device ?
7741
  if ( ! _.isEmpty( _currentDeviceValues ) ) {
7742
  if ( ! _.isEmpty( _currentDeviceValues[ spacingType ] ) ) {
7743
  _val_ = _currentDeviceValues[ spacingType ];
7745
  }
7746
  $(this).find( 'input[type="number"]' ).val( _val_ );
7747
  });
7748
+
7749
+ // loop on the unit button and check which one should be clicked
7750
  var unitToActivate = 'px';
7751
  $( '.sek-unit-wrapper .sek-ui-button', input.container).each( function() {
7752
  var unit = $(this).data('sek-unit');
7753
+ // do we have a unit for the current device ?
7754
  if ( ! _.isEmpty( _currentDeviceValues ) ) {
7755
  if ( ! _.isEmpty( _currentDeviceValues[ 'unit' ] ) ) {
7756
  if ( unit === _currentDeviceValues[ 'unit' ] ) {
7761
  });
7762
  $('.sek-unit-wrapper', input.container ).find('[data-sek-unit="' + validateUnit.call( input, unitToActivate ) + '"]').trigger('click', { previewed_device_switched : true });// We don't want to update the input();
7763
  };
7764
+
7765
+
7766
+
7767
+
7768
+ // SETUP
7769
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
7770
+
7771
+ // Set the initial unit
7772
  var initial_value = input();
7773
  input.initial_unit = 'px';
7774
  if ( ! _.isEmpty( initial_value ) && ! _.isEmpty( initial_value[ input.previewedDevice() ] ) ) {
7775
  input.initial_unit = _.isEmpty( initial_value[ input.previewedDevice() ]['unit'] ) ? 'px' : initial_value[ input.previewedDevice() ]['unit'];
7776
  }
7777
+
7778
+ // initialize the unit with the value provided in the dom
7779
  input.css_unit = new api.Value( validateUnit.call( input, input.initial_unit ) );
7780
+
7781
+
7782
+
7783
+
7784
+ // SCHEDULE REACTIONS
7785
+ // Listen to user actions on the inputs and set the input value
7786
  $wrapper.on( 'input', 'input[type="number"]', function(evt) {
7787
  var changedSpacingType = $(this).closest('[data-sek-spacing]').data('sek-spacing'),
7788
  changedNumberInputVal = $(this).val(),
7791
 
7792
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
7793
  _newInputVal[ previewedDevice ] = $.extend( true, {}, _newInputVal[ previewedDevice ] || {} );
7794
+ // Validates
7795
+ // @fixes https://github.com/presscustomizr/nimble-builder/issues/26
7796
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) || _.isNumber( changedNumberInputVal ) ) {
7797
  _newInputVal[ previewedDevice ][ changedSpacingType ] = changedNumberInputVal;
7798
  } else {
7799
+ // this allow users to reset a given padding / margin instead of reseting them all at once with the "reset all spacing" option
7800
  _newInputVal[ previewedDevice ] = _.omit( _newInputVal[ previewedDevice ], changedSpacingType );
7801
  }
7802
 
7803
  input( _newInputVal );
7804
  });
7805
+
7806
+ // Schedule a reset action
7807
  setupResetAction.call( input, $wrapper, defaultVal );
7808
+
7809
+ // react to previewed device changes
7810
+ // input.previewedDevice is updated in api.czr_sektions.maybeSetupDeviceSwitcherForInput()
7811
  input.previewedDevice.bind( function( currentDevice ) {
7812
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
7813
  api.errare('Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id ' + input.id , er );
7814
  }
7815
  });
7816
+
7817
+
7818
+ // React to a unit change
7819
+ // Don't move when switching the device
7820
  input.css_unit.bind( function( to, from, params ) {
7821
  if ( _.isObject( params ) && true === params.previewed_device_switched )
7822
  return;
7829
  _newInputVal[ previewedDevice ][ 'unit' ] = to;
7830
  input( _newInputVal );
7831
  });
7832
+
7833
+ // Schedule unit changes on button click
7834
+ // add is-selected button on init to the relevant unit button
7835
  unitButtonsSetup.call( input, $wrapper );
7836
+
7837
+
7838
+
7839
+ // INITIALIZES
7840
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
7841
  api.errare('Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id ' + input.id , er );
7842
  }
7846
 
7847
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
7848
  ( function ( api, $, _ ) {
7849
+ // all available input type as a map
7850
  api.czrInputMap = api.czrInputMap || {};
7851
+
7852
+ // input_type => callback fn to fire in the Input constructor on initialize
7853
+ // the callback can receive specific params define in each module constructor
7854
+ // For example, a content picker can be given params to display only taxonomies
7855
+ // the default input_event_map can also be overriden in this callback
7856
  $.extend( api.czrInputMap, {
7857
  /* ------------------------------------------------------------------------- *
7858
  * BG POSITION SIMPLE
7859
  /* ------------------------------------------------------------------------- */
7860
  bg_position : function( input_options ) {
7861
  var input = this;
7862
+ // Listen to user actions on the inputs and set the input value
7863
  $('.sek-bg-pos-wrapper', input.container ).on( 'change', 'input[type="radio"]', function(evt) {
7864
  input( $(this).val() );
7865
  });
7866
+
7867
+ // Synchronize on init
7868
  if ( ! _.isEmpty( input() ) ) {
7869
  input.container.find('input[value="'+ input() +'"]').attr('checked', true).trigger('click');
7870
  }
7878
  var input = this,
7879
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
7880
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
7881
+
7882
+ // SETUP
7883
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
7884
 
7885
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
7895
  }
7896
  }
7897
  };
7898
+
7899
+ // Synchronizes on init + refresh on previewed device changes
7900
  var syncWithPreviewedDevice = function( currentDevice ) {
7901
  var inputValues = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
7902
  clonedDefault = $.extend( true, {}, defaultVal );
7905
 
7906
  input.container.find('input[value="'+ _currentDeviceValue +'"]').attr('checked', true).trigger('click', { previewed_device_switched : true } );
7907
  };
7908
+
7909
+
7910
+
7911
+ // Listen to user actions on the inputs and set the input value
7912
  $('.sek-bg-pos-wrapper', input.container ).on( 'change', 'input[type="radio"]', function( evt ) {
7913
  var changedRadioVal = $(this).val(),
7914
  _newInputVal;
7918
 
7919
  input( _newInputVal );
7920
  });
7921
+
7922
+
7923
+ // react to previewed device changes
7924
+ // input.previewedDevice is updated in api.czr_sektions.maybeSetupDeviceSwitcherForInput()
7925
  input.previewedDevice.bind( function( currentDevice ) {
7926
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
7927
  api.errare('Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id ' + input.id , er );
7928
  }
7929
  });
7930
+
7931
+ // INITIALIZES
7932
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
7933
  api.errare('Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id ' + input.id , er );
7934
  }
7938
 
7939
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
7940
  ( function ( api, $, _ ) {
7941
+ // all available input type as a map
7942
  api.czrInputMap = api.czrInputMap || {};
7943
+
7944
+ // Generic method to instantiate the following input types :
7945
+ // horizTextAlignmentWithDeviceSwitcher and horizAlignmentWithDeviceSwitcher => tmpl => 3_0_5_sek_input_tmpl_horizontal_alignment.php
7946
+ // verticalAlignWithDeviceSwitcher => tmpl => 3_0_6_sek_input_tmpl_vertical_alignment.php
7947
  var x_or_y_AlignWithDeviceSwitcher = function( params ) {
7948
  var input = this,
7949
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
7950
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {},
7951
  tmplSelector = 'verticalAlignWithDeviceSwitcher' === input.type ? '.sek-v-align-wrapper' : '.sek-h-align-wrapper',// <= because used by 2 different input tmpl
7952
  $wrapper = $( tmplSelector, input.container );
7953
+
7954
+ // SETUP
7955
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
7956
 
7957
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
7967
  }
7968
  }
7969
  };
7970
+
7971
+ // Synchronizes on init + refresh on previewed device changes
7972
  var syncWithPreviewedDevice = function( currentDevice ) {
7973
  var inputValues = $.extend( true, {}, _.isObject( input() ) ? input() : {} ),
7974
  clonedDefault = $.extend( true, {}, defaultVal );
7975
  inputValues = _.isObject( inputValues ) ? $.extend( clonedDefault, inputValues ) : clonedDefault;
7976
  var _currentDeviceValue = getCurrentDeviceActualOrInheritedValue( inputValues, currentDevice );
7977
+
7978
+ //input.container.find('input[value="'+ _currentDeviceValue +'"]').attr('checked', true).trigger('click', { previewed_device_switched : true } );
7979
  $wrapper.find('.selected').removeClass('selected');
7980
  $wrapper.find( 'div[data-sek-align="' + _currentDeviceValue +'"]' ).addClass('selected');
7981
  };
7982
+
7983
+ // on click
7984
  $wrapper.on( 'click', '[data-sek-align]', function(evt) {
7985
  evt.preventDefault();
7986
  var _newInputVal;
7993
  input( _newInputVal );
7994
  });
7995
  });
7996
+
7997
+ // react to previewed device changes
7998
+ // input.previewedDevice is updated in api.czr_sektions.maybeSetupDeviceSwitcherForInput()
7999
  input.previewedDevice.bind( function( currentDevice ) {
8000
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
8001
  api.errare('Error when firing syncWithPreviewedDevice for input type : ' + input.type + ' for input id ' + input.id , er );
8002
  }
8003
  });
8004
+
8005
+ // INITIALIZES
8006
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
8007
  api.errare('Error when firing syncWithPreviewedDevice for input type : ' + input.type + ' for input id ' + input.id , er );
8008
  }
8009
  };
8010
+
8011
+
8012
+ // input_type => callback fn to fire in the Input constructor on initialize
8013
+ // the callback can receive specific params define in each module constructor
8014
+ // For example, a content picker can be given params to display only taxonomies
8015
+ // the default input_event_map can also be overriden in this callback
8016
  $.extend( api.czrInputMap, {
8017
  horizTextAlignmentWithDeviceSwitcher : x_or_y_AlignWithDeviceSwitcher,
8018
  horizAlignmentWithDeviceSwitcher : x_or_y_AlignWithDeviceSwitcher,
8020
  });//$.extend( api.czrInputMap, {})
8021
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8022
  ( function ( api, $, _ ) {
8023
+ // all available input type as a map
8024
  api.czrInputMap = api.czrInputMap || {};
8025
+
8026
+ // input_type => callback fn to fire in the Input constructor on initialize
8027
+ // the callback can receive specific params define in each module constructor
8028
+ // For example, a content picker can be given params to display only taxonomies
8029
+ // the default input_event_map can also be overriden in this callback
8030
  $.extend( api.czrInputMap, {
8031
  font_size : function( params ) {
8032
  api.czr_sektions.setupFontSizeAndLineHeightInputs.call(this);
8037
 
8038
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8039
  ( function ( api, $, _ ) {
8040
+ // all available input type as a map
8041
  api.czrInputMap = api.czrInputMap || {};
8042
+
8043
+ // input_type => callback fn to fire in the Input constructor on initialize
8044
+ // the callback can receive specific params define in each module constructor
8045
+ // For example, a content picker can be given params to display only taxonomies
8046
+ // the default input_event_map can also be overriden in this callback
8047
  $.extend( api.czrInputMap, {
8048
  line_height : function( params ) {
8049
  api.czr_sektions.setupFontSizeAndLineHeightInputs.call(this);
8053
 
8054
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8055
  ( function ( api, $, _ ) {
8056
+ // all available input type as a map
8057
  api.czrInputMap = api.czrInputMap || {};
8058
+
8059
+ // input_type => callback fn to fire in the Input constructor on initialize
8060
+ // the callback can receive specific params define in each module constructor
8061
+ // For example, a content picker can be given params to display only taxonomies
8062
+ // the default input_event_map can also be overriden in this callback
8063
  $.extend( api.czrInputMap, {
8064
+ // FONT PICKER
8065
  font_picker : function( input_options ) {
8066
  var input = this,
8067
  item = input.input_parent;
8075
  if ( ! _.isUndefined( api.sek_fetchingFontCollection ) && 'pending' == api.sek_fetchingFontCollection.state() ) {
8076
  _ajaxRequest_ = api.sek_fetchingFontCollection;
8077
  } else {
8078
+ // This utility handles a cached version of the font_list once fetched the first time
8079
+ // @see api.CZR_Helpers.czr_cachedTmpl
8080
  _ajaxRequest_ = api.CZR_Helpers.getModuleTmpl( {
8081
  tmpl : 'font_list',
8082
  module_type: 'font_picker_input',
8085
  api.sek_fetchingFontCollection = _ajaxRequest_;
8086
  }
8087
  _ajaxRequest_.done( function( _serverTmpl_ ) {
8088
+ // Ensure we have a string that's JSON.parse-able
8089
  if ( typeof _serverTmpl_ !== 'string' || _serverTmpl_[0] !== '{' ) {
8090
  throw new Error( 'font_picker => server list is not JSON.parse-able');
8091
  }
8132
  return selectFocusResults.promise();
8133
 
8134
  };//_preprocessSelect2ForFontFamily
8135
+
8136
+ // @return void();
8137
+ // Instantiates a czrSelect2 select input
8138
+ // http://ivaynberg.github.io/czrSelect2/#documentation
8139
  var _setupSelectForFontFamilySelector = function( customResultsAdapter, fontCollections ) {
8140
  var _model = item(),
8141
  _googleFontsFilteredBySubset = function() {
8152
 
8153
  },
8154
  $fontSelectElement = $( 'select[data-czrtype="' + input.id + '"]', input.container );
8155
+
8156
+ // generates the options
8157
+ // @param type = cfont or gfont
8158
  var _generateFontOptions = function( fontList, type ) {
8159
  var _html_ = '';
8160
  _.each( fontList , function( font_data ) {
8174
  });
8175
  return _html_;
8176
  };
8177
+
8178
+ //add the first option
8179
  if ( _.isNull( input() ) || _.isEmpty( input() ) ) {
8180
  $fontSelectElement.append( '<option value="none" selected="selected">' + sektionsLocalizedData.i18n['Select a font family'] + '</option>' );
8181
  } else {
8182
  $fontSelectElement.append( '<option value="none">' + sektionsLocalizedData.i18n['Select a font family'] + '</option>' );
8183
  }
8184
+
8185
+
8186
+ // generate the cfont and gfont html
8187
  _.each( [
8188
  {
8189
  title : sektionsLocalizedData.i18n['Web Safe Fonts'],
8201
  });
8202
 
8203
  var _fonts_czrSelect2_params = {
8204
+ //minimumResultsForSearch: -1, //no search box needed
8205
+ //templateResult: paintFontOptionElement,
8206
+ //templateSelection: paintFontOptionElement,
8207
  escapeMarkup: function(m) { return m; },
8208
  };
8209
  /*
8215
  closeOnSelect: false,
8216
  } );
8217
  }
8218
+
8219
+ //http://ivaynberg.github.io/czrSelect2/#documentation
8220
+ //FONTS
8221
  $fontSelectElement.czrSelect2( _fonts_czrSelect2_params );
8222
  $( '.czrSelect2-selection__rendered', input.container ).css( getInlineFontStyle( input() ) );
8223
 
8224
  };//_setupSelectForFontFamilySelector
8225
+
8226
+ // @return {} used to set $.css()
8227
+ // @param font {string}.
8228
+ // Example : Aclonica:regular
8229
+ // Example : Helvetica Neue, Helvetica, Arial, sans-serif
8230
  var getInlineFontStyle = function( _fontFamily_ ){
8231
+ // the font is set to 'none' when "Select a font family" option is picked
8232
  if ( ! _.isString( _fontFamily_ ) || _.isEmpty( _fontFamily_ ) )
8233
  return {};
8234
+
8235
+ //always make sure we remove the prefix.
8236
  _fontFamily_ = _fontFamily_.replace('[gfont]', '').replace('[cfont]', '');
8237
 
8238
  var module = this,
8251
  'font-style' : font_style || 'normal'
8252
  };
8253
  };
8254
+
8255
+ // @return the font family name only from a pre Google formated
8256
+ // Example : input is Inknut+Antiqua:regular
8257
+ // Should return Inknut Antiqua
8258
  var getFontFamilyName = function( rawFontFamily ) {
8259
  if ( ! _.isString( rawFontFamily ) || _.isEmpty( rawFontFamily ) )
8260
  return rawFontFamily;
8277
 
8278
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8279
  ( function ( api, $, _ ) {
8280
+ // all available input type as a map
8281
  api.czrInputMap = api.czrInputMap || {};
8282
+ // input_type => callback fn to fire in the Input constructor on initialize
8283
+ // the callback can receive specific params define in each module constructor
8284
+ // For example, a content picker can be given params to display only taxonomies
8285
+ // the default input_event_map can also be overriden in this callback
8286
  $.extend( api.czrInputMap, {
8287
+ // FONT AWESOME ICON PICKER
8288
+ // FONT AWESOME ICON PICKER
8289
  fa_icon_picker : function() {
8290
  var input = this,
8291
  _selected_found = false;
8292
+
8293
+ //generates the options
8294
  var _generateOptions = function( iconCollection ) {
8295
  _.each( iconCollection , function( iconClass ) {
8296
  var _attributes = {
8297
  value: iconClass,
8298
+ //iconClass is in the form "fa(s|b|r) fa-{$name}" so the name starts at position 7
8299
  html: api.CZR_Helpers.capitalize( iconClass.substring( 7 ) )
8300
  };
8301
 
8309
 
8310
  var addIcon = function ( state ) {
8311
  if (! state.id) { return state.text; }
8312
+
8313
+ //two spans here because we cannot wrap the text into the icon span as the solid FA5 font-weight is bold
8314
  var $state = $(
8315
  '<span class="' + state.element.value + '"></span><span class="social-name">&nbsp;&nbsp;' + state.text + '</span>'
8316
  );
8317
  return $state;
8318
  };
8319
+
8320
+ //blank option to allow placeholders
8321
  var $_placeholder;
8322
  if ( _selected_found ) {
8323
  $_placeholder = $('<option>');
8324
  } else {
8325
  $_placeholder = $('<option>', { selected: 'selected' } );
8326
  }
8327
+ //Initialize czrSelect2
8328
  $( 'select[data-czrtype]', input.container )
8329
  .prepend( $_placeholder )
8330
  .czrSelect2({
8341
  if ( ! _.isEmpty( input.sek_faIconCollection ) ) {
8342
  _dfd_.resolve( input.sek_faIconCollection );
8343
  } else {
8344
+ // This utility handles a cached version of the font_list once fetched the first time
8345
+ // @see api.CZR_Helpers.czr_cachedTmpl
8346
  api.CZR_Helpers.getModuleTmpl( {
8347
  tmpl : 'icon_list',
8348
  module_type: 'fa_icon_picker_input',
8349
  module_id : input.module.id
8350
  } ).done( function( _serverTmpl_ ) {
8351
+ // Ensure we have a string that's JSON.parse-able
8352
  if ( typeof _serverTmpl_ !== 'string' || _serverTmpl_[0] !== '[' ) {
8353
  throw new Error( 'fa_icon_picker => server list is not JSON.parse-able');
8354
  }
8358
  _dfd_.reject( _r_ );
8359
  });
8360
  }
8361
+ //return dfd.promise();
8362
  });
8363
  };//_getIconsCollections
8364
+
8365
+ // do
8366
  var _do_ = function( params ) {
8367
  if ( true === input.iconCollectionSet )
8368
  return;
8369
  $.when( _getIconsCollections() ).done( function( iconCollection ) {
8370
  _generateOptions( iconCollection );
8371
  if ( params && true === params.open_on_init ) {
8372
+ // let's open select2 after a delay ( because there's no 'ready' event with select2 )
8373
  _.delay( function() {
8374
  try{ $( 'select[data-czrtype]', input.container ).czrSelect2('open'); }catch(er) {}
8375
  }, 100 );
8379
  });
8380
  input.iconCollectionSet = true;
8381
  };
8382
+
8383
+ // Generate options and open select2
8384
  input.container.on('click', function() {
8385
  _do_();
8386
  });
8387
+
8388
+ // schedule the iconCollectionSet after a delay
8389
  _.delay( function() { _do_( { open_on_init : false } );}, 1000 );
8390
 
8391
  }
8393
 
8394
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8395
  ( function ( api, $, _ ) {
8396
+ // all available input type as a map
8397
  api.czrInputMap = api.czrInputMap || {};
8398
+
8399
+ // input_type => callback fn to fire in the Input constructor on initialize
8400
+ // the callback can receive specific params define in each module constructor
8401
+ // For example, a content picker can be given params to display only taxonomies
8402
+ // the default input_event_map can also be overriden in this callback
8403
  $.extend( api.czrInputMap, {
8404
  code_editor : function( input_options ) {
8405
  var input = this,
8409
  $textarea = input.container.find( 'textarea' ),
8410
  $input_title = input.container.find( '.customize-control-title' ),
8411
  editor_params = $textarea.data( 'editor-params' );
8412
+
8413
+ // // When using blocking notifications (type: error) the following block will append a checkbox to the
8414
+ // // notification message block that once checked will allow to save and publish anyways
8415
+
8416
+ // // Note that rendering is debounced so the props will be used when rendering happens after add event.
8417
+ // control.notifications.bind( 'add', function( notification ) {
8418
+ // // Skip if control notification is not from setting csslint_error notification.
8419
+ // if ( notification.code !== control.setting.id + ':' + input.id ) {
8420
+ // return;
8421
+ // }
8422
+
8423
+ // // Customize the template and behavior of csslint_error notifications.
8424
+ // notification.templateId = 'customize-code-editor-lint-error-notification';
8425
+ // notification.render = (function( render ) {
8426
+ // return function() {
8427
+ // var li = render.call( this );
8428
+ // li.find( 'input[type=checkbox]' ).on( 'click', function() {
8429
+ // control.setting.notifications.remove( input.id );
8430
+ // } );
8431
+ // return li;
8432
+ // };
8433
+ // })( notification.render );
8434
+ // } );
8435
+
8436
+ // Obtain editorSettings for instantiation.
8437
  if ( wp.codeEditor && ( _.isUndefined( editor_params ) || false !== editor_params ) ) {
8438
+ // Obtain this input editor settings (we don't have defaults).
8439
  editorSettings = editor_params;
8440
  }
8441
 
8442
  input.isReady.done( function() {
8443
  var _doInstantiate = function( evt ) {
8444
  var input = this;
8445
+ // Bail if we have an instance
8446
  if ( ! _.isEmpty( input.editor ) )
8447
  return;
8448
+ // Bail if the control is not expanded yet
8449
  if ( _.isEmpty( input.module.control.container.attr('data-sek-expanded') ) || "false" == input.module.control.container.attr('data-sek-expanded') )
8450
  return;
8451
 
8458
  } else {
8459
  initPlainTextareaEditor();
8460
  }
8461
+ //focus the editor
8462
  $input_title.click();
8463
  }, 10 );
8464
  };
8465
+ // Try to instantiate now
8466
  _doInstantiate.call(input);
8467
+
8468
+ // the input should be visible otherwise the code mirror initializes wrongly:
8469
+ // e.g. bad ui (bad inline CSS maths), not visible content until click.
8470
+ // When the code_editor input is rendered in an accordion control ( @see CZRSeksPrototype.scheduleModuleAccordion ), we need to defer the instantiation when the control has been expanded.
8471
+ // fixes @see https://github.com/presscustomizr/nimble-builder/issues/176
8472
  input.module.control.container.on('sek-accordion-expanded', function() {
8473
  _doInstantiate.call( input );
8474
  });
8489
  });
8490
 
8491
  input.editor = wp.codeEditor.initialize( $textarea, settings );
8492
+
8493
+
8494
+ // Improve the editor accessibility.
8495
  $( input.editor.codemirror.display.lineDiv )
8496
  .attr({
8497
  role: 'textbox',
8499
  'aria-label': $input_title.html(),
8500
  'aria-describedby': 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4'
8501
  });
8502
+
8503
+ // Focus the editor when clicking on its title.
8504
  $input_title.on( 'click', function( evt ) {
8505
  evt.stopPropagation();
8506
  input.editor.codemirror.focus();
8518
  });
8519
 
8520
  input.editor.codemirror.setValue( input() );
8521
+
8522
+ // Update CodeMirror when the setting is changed by another plugin.
8523
  /* TODO: check this */
8524
  input.bind( input.id + ':changed', function( value ) {
8525
  if ( ! suspendEditorUpdate ) {
8526
  input.editor.codemirror.setValue( value );
8527
  }
8528
  });
8529
+
8530
+ // Prevent collapsing section when hitting Esc to tab out of editor.
8531
  input.editor.codemirror.on( 'keydown', function onKeydown( codemirror, event ) {
8532
  var escKeyCode = 27;
8533
  if ( escKeyCode === event.keyCode ) {
8558
  }
8559
  return;
8560
  }
8561
+
8562
+ // Short-circuit if tab key is not being pressed or if a modifier key *is* being pressed.
8563
  if ( tabKeyCode !== event.keyCode || event.ctrlKey || event.altKey || event.shiftKey ) {
8564
  return;
8565
  }
8566
+
8567
+ // Prevent capturing Tab characters if Esc was pressed.
8568
  if ( $textarea.data( 'next-tab-blurs' ) ) {
8569
  return;
8570
  }
8608
  });//$.extend( api.czrInputMap, {})
8609
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8610
  ( function ( api, $, _ ) {
8611
+ // all available input type as a map
8612
  api.czrInputMap = api.czrInputMap || {};
8613
+
8614
+ // input_type => callback fn to fire in the Input constructor on initialize
8615
+ // the callback can receive specific params define in each module constructor
8616
+ // For example, a content picker can be given params to display only taxonomies
8617
+ // the default input_event_map can also be overriden in this callback
8618
  $.extend( api.czrInputMap, {
8619
  range_simple : function( params ) {
8620
  var input = this,
8621
  $wrapper = $('.sek-range-with-unit-picker-wrapper', input.container ),
8622
  $numberInput = $wrapper.find( 'input[type="number"]'),
8623
  $rangeInput = $wrapper.find( 'input[type="range"]');
8624
+
8625
+ // synchronizes range input and number input
8626
+ // number is the master => sets the input() val
8627
  $rangeInput.on('input', function( evt ) {
8628
  $numberInput.val( $(this).val() ).trigger('input');
8629
  });
8631
  input( $(this).val() );
8632
  $rangeInput.val( $(this).val() );
8633
  });
8634
+ // trigger a change on init to sync the range input
8635
  $rangeInput.val( $numberInput.val() || 0 );
8636
  },
8637
 
8640
 
8641
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8642
  ( function ( api, $, _ ) {
8643
+ // all available input type as a map
8644
  api.czrInputMap = api.czrInputMap || {};
8645
+
8646
+ // input_type => callback fn to fire in the Input constructor on initialize
8647
+ // the callback can receive specific params define in each module constructor
8648
+ // For example, a content picker can be given params to display only taxonomies
8649
+ // the default input_event_map can also be overriden in this callback
8650
  $.extend( api.czrInputMap, {
8651
  range_with_unit_picker : function( params ) {
8652
  var input = this,
8661
  }
8662
  return unit;
8663
  };
8664
+ // initialize the unit with the value provided in the dom
8665
  input.css_unit = new api.Value( _.isEmpty( initial_unit ) ? 'px' : validateUnit( initial_unit ) );
8666
+ // React to a unit change => trigger a number input change
8667
  input.css_unit.bind( function( to ) {
8668
  to = _.isEmpty( to ) ? 'px' : to;
8669
  $wrapper.find( 'input[type="number"]').trigger('input');
8670
  });
8671
+
8672
+ // synchronizes range input and number input
8673
+ // number is the master => sets the input() val
8674
  $rangeInput.on('input', function( evt ) {
8675
  $numberInput.val( $(this).val() ).trigger('input');
8676
  });
8678
  input( $(this).val() + validateUnit( input.css_unit() ) );
8679
  $rangeInput.val( $(this).val() );
8680
  });
8681
+ // trigger a change on init to sync the range input
8682
  $rangeInput.val( $numberInput.val() || 0 );
8683
+
8684
+ // Schedule unit changes on button click
8685
  $wrapper.on( 'click', '.sek-ui-button', function(evt) {
8686
  evt.preventDefault();
8687
+ // handle the is-selected css class toggling
8688
  $wrapper.find('.sek-ui-button').removeClass('is-selected').attr( 'aria-pressed', false );
8689
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
8690
+ // update the initial unit ( not mandatory)
8691
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
8692
+ // set the current unit Value
8693
  input.css_unit( $(this).data('sek-unit') );
8694
  });
8695
+
8696
+ // add is-selected button on init to the relevant unit button
8697
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ initial_unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
8698
  },
8699
 
8702
 
8703
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8704
  ( function ( api, $, _ ) {
8705
+ // all available input type as a map
8706
  api.czrInputMap = api.czrInputMap || {};
8707
+
8708
+ // input_type => callback fn to fire in the Input constructor on initialize
8709
+ // the callback can receive specific params define in each module constructor
8710
+ // For example, a content picker can be given params to display only taxonomies
8711
+ // the default input_event_map can also be overriden in this callback
8712
  $.extend( api.czrInputMap, {
8713
  range_with_unit_picker_device_switcher : function( params ) {
8714
  var input = this,
8722
  }
8723
  return unit;
8724
  },
8725
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
8726
  _extractNumericVal = function( _rawVal ) {
8727
  return ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) ? '16' : _rawVal.replace(/px|em|%/g,'');
8728
  },
8735
  var getInitialUnit = function() {
8736
  return $wrapper.find('input[data-czrtype]').data('sek-unit') || 'px';
8737
  };
8738
+
8739
+ // Recursive helper
8740
+ // return the value set for the currently previewed device if exists
8741
+ // OR
8742
+ // return the inherited value from the first parent device for which the value is set
8743
+ // OR
8744
+ // falls back on the module default
8745
  var getCurrentDeviceActualOrInheritedValue = function( inputValues, currentDevice ) {
8746
  var deviceHierarchy = [ 'mobile' , 'tablet', 'desktop' ];
8747
  if ( _.has( inputValues, currentDevice ) ) {
8756
  }
8757
  }
8758
  };
8759
+
8760
+ // Synchronizes on init + refresh on previewed device changes
8761
  var syncWithPreviewedDevice = function( currentDevice ) {
8762
+ // initialize the number input with the current input val
8763
+ // for retro-compatibility, we must handle the case when the initial input val is a string instead of an array
8764
+ // in this case, the string value is assigned to the desktop device.
8765
  var inputVal = input(), inputValues = {}, clonedDefault = $.extend( true, {}, defaultVal );
8766
  inputValues = clonedDefault;
8767
  if ( _.isObject( inputVal ) ) {
8769
  } else if ( _.isString( inputVal ) && ! _.isEmpty( inputVal ) ) {
8770
  inputValues = { desktop : inputVal };
8771
  }
8772
+ //inputValues = _.extend( inputValues, clonedDefault );
8773
+ // do we have a val for the current device ?
8774
  var _rawVal = getCurrentDeviceActualOrInheritedValue( inputValues, currentDevice ),
8775
  _unit = _extractUnit( _rawVal ),
8776
  _numberVal = _extractNumericVal( _rawVal );
8777
+
8778
+ // update the unit
8779
  $('.sek-unit-wrapper', $wrapper).find('[data-sek-unit="' + _unit +'"]').trigger('click', { previewed_device_switched : true });// We don't want to update the input()
8780
+ // add is-selected button on init to the relevant unit button
8781
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ _unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
8782
+
8783
+ // update the numeric val
8784
  $numberInput.val( _numberVal ).trigger('input', { previewed_device_switched : true });// We don't want to update the input()
8785
  };
8786
+
8787
+
8788
+
8789
+ // SETUP
8790
+ // setup the device switcher
8791
  api.czr_sektions.maybeSetupDeviceSwitcherForInput.call( input );
8792
+
8793
+ // initialize the unit with the value provided in the dom
8794
  input.css_unit = new api.Value( _.isEmpty( getInitialUnit() ) ? 'px' : validateUnit( getInitialUnit() ) );
8795
+
8796
+ // Append a reset button
8797
  var resetButton = '<button type="button" class="button sek-reset-button sek-float-right">' + sektionsLocalizedData.i18n['Reset'] + '</button>';
8798
  input.container.find('.customize-control-title').append( resetButton );
8799
+
8800
+
8801
+
8802
+
8803
+
8804
+
8805
+ // SCHEDULE REACTIONS
8806
+ // React to a unit change => trigger a number input change
8807
+ // Don't move when switching the device
8808
+ // @param params can be { previewed_device_switched : true }
8809
  input.css_unit.bind( function( to, from, params ) {
8810
  if ( _.isObject( params ) && true === params.previewed_device_switched )
8811
  return;
8812
  $numberInput.trigger('input');
8813
  });
8814
+
8815
+ // synchronizes range input and number input
8816
+ // number is the master => sets the input() val
8817
  $rangeInput.on('input', function( evt ) {
8818
  $numberInput.val( $(this).val() ).trigger('input');
8819
  });
8820
+ // Set the input val
8821
  $numberInput.on('input', function( evt, params ) {
8822
  var previewedDevice = api.previewedDevice() || 'desktop',
8823
  changedNumberInputVal = $(this).val() + validateUnit( input.css_unit() ),
8825
 
8826
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
8827
  _newInputVal[ previewedDevice ] = $.extend( true, {}, _newInputVal[ previewedDevice ] || {} );
8828
+
8829
+ // Validates
8830
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) ) {
8831
  _newInputVal[ previewedDevice ]= changedNumberInputVal;
8832
  }
8833
+
8834
+ // update input if not previewed_device_switched
8835
  if ( _.isEmpty( params ) || ( _.isObject( params ) && true !== params.previewed_device_switched ) ) {
8836
  input( _newInputVal );
8837
  }
8838
  $rangeInput.val( $(this).val() );
8839
  });
8840
+
8841
+ // Schedule unit changes on button click
8842
  $wrapper.on( 'click', '.sek-ui-button', function( evt, params ) {
8843
+ //evt.preventDefault();
8844
  evt.stopPropagation();
8845
+ // handle the is-selected css class toggling
8846
  $wrapper.find('.sek-ui-button').removeClass('is-selected').attr( 'aria-pressed', false );
8847
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
8848
+ // update the initial unit ( not mandatory)
8849
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
8850
+ // set the current unit Value
8851
  input.css_unit( $(this).data('sek-unit'), params );
8852
  });
8853
+
8854
+ // react to previewed device changes
8855
+ // input.previewedDevice is updated in api.czr_sektions.maybeSetupDeviceSwitcherForInput()
8856
  input.previewedDevice.bind( function( currentDevice ) {
8857
  try { syncWithPreviewedDevice( currentDevice ); } catch( er ) {
8858
  api.errare('Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id ' + input.id , er );
8859
  }
8860
  });
8861
+
8862
+ // Schedule the reset of the value for the currently previewed device
8863
  input.container.on( 'click', '.sek-reset-button', function( evt ) {
8864
  var _currentDevice = api.previewedDevice(),
8865
  _newVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
8869
  syncWithPreviewedDevice( api.previewedDevice() );
8870
  }
8871
  });
8872
+
8873
+
8874
+ // INITIALIZES
8875
+ // trigger a change on init to sync the range input
8876
  $rangeInput.val( $numberInput.val() || 0 );
8877
  try { syncWithPreviewedDevice( api.previewedDevice() ); } catch( er ) {
8878
  api.errare('Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id ' + input.id , er );
8884
 
8885
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
8886
  ( function ( api, $, _ ) {
8887
+ // all available input type as a map
8888
  api.czrInputMap = api.czrInputMap || {};
8889
+
8890
+ // input_type => callback fn to fire in the Input constructor on initialize
8891
+ // the callback can receive specific params define in each module constructor
8892
+ // For example, a content picker can be given params to display only taxonomies
8893
+ // the default input_event_map can also be overriden in this callback
8894
  $.extend( api.czrInputMap, {
8895
  borders : function( params ) {
8896
  var input = this,
8905
  }
8906
  return unit;
8907
  },
8908
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
8909
  _extractNumericVal = function( _rawVal ) {
8910
  return ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) ? '16' : _rawVal.replace(/px|em|%/g,'');
8911
  },
8916
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
8917
 
8918
  input.cssBorderTypes = [ 'top', 'left', 'right', 'bottom' ];
8919
+
8920
+ // Return the unit of the _all_ border type
8921
  var getInitialUnit = function() {
8922
  var inputVal = input(), initial_unit = 'px';
8923
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) && _.isObject( inputVal['_all_'] ) && ! _.isEmpty( inputVal['_all_'][ 'wght'] ) ) {
8925
  }
8926
  return initial_unit;
8927
  };
8928
+ // Return the number value of the _all_ border type
8929
  var getInitialWeight = function() {
8930
  var inputVal = input(), initial_weight = 1;
8931
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) && _.isObject( inputVal['_all_'] ) && ! _.isEmpty( inputVal['_all_'][ 'wght'] ) ) {
8938
  }
8939
  return initial_weight;
8940
  };
8941
+ // Return the color of the _all_ border type
8942
  var getInitialColor = function() {
8943
  var inputVal = input(), initial_color = '#000000';
8944
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) && _.isObject( inputVal['_all_'] ) && ! _.isEmpty( inputVal['_all_'][ 'col'] ) ) {
8946
  }
8947
  return initial_color;
8948
  };
8949
+
8950
+ // Recursive helper
8951
+ // _all_ : { wght : 1px, col : #000000 }
8952
+ // falls back on {}
8953
  var getCurrentBorderTypeOrAllValue = function( inputValues, borderType ) {
8954
  var clonedDefaults = $.extend( true, {}, defaultVal ), _all_Value;
8955
  if ( ! _.has( clonedDefaults, '_all_' ) ) {
8963
  return clonedDefaults['_all_'];
8964
  }
8965
  };
8966
+
8967
+ // Synchronizes on init + refresh on border type change
8968
  var syncWithBorderType = function( borderType ) {
8969
  if ( ! _.contains( _.union( input.cssBorderTypes, [ '_all_' ] ) , borderType ) ) {
8970
  throw new Error( "Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'" );
8971
  }
8972
+
8973
+ // initialize the number input with the current input val
8974
+ // for retro-compatibility, we must handle the case when the initial input val is a string instead of an array
8975
+ // in this case, the string value is assigned to the desktop device.
8976
  var inputVal = input(), inputValues = {}, clonedDefault = $.extend( true, {}, defaultVal );
8977
  if ( _.isObject( inputVal ) ) {
8978
  inputValues = $.extend( true, {}, inputVal );
8980
  inputValues = { _all_ : { wght : inputVal } };
8981
  }
8982
  inputValues = $.extend( clonedDefault, inputValues );
8983
+
8984
+ // do we have a val for the current border type ?
8985
  var _rawVal = getCurrentBorderTypeOrAllValue( inputValues, borderType ), _unit, _numberVal;
8986
  if ( _.isEmpty( _rawVal ) || ! _.isObject( _rawVal ) || _.isEmpty( _rawVal.wght ) || _.isEmpty( _rawVal.col ) ) {
8987
  throw new Error( "Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");
8989
 
8990
  _unit = _extractUnit( _rawVal.wght );
8991
  _numberVal = _extractNumericVal( _rawVal.wght );
8992
+
8993
+ // update the unit
8994
  $('.sek-unit-wrapper', $wrapper).find('[data-sek-unit="' + _unit +'"]').trigger('click', { border_type_switched : true });// We don't want to update the input()
8995
+ // add is-selected button on init to the relevant unit button
8996
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ _unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
8997
+ // update the numeric val
8998
  $numberInput.val( _numberVal ).trigger('input', { border_type_switched : true });// We don't want to update the input()
8999
+ // update the color
9000
+ // trigger the change between "border_type_switched" data flags, so we know the api setting don't have to be refreshed
9001
+ // ( there's no easy other way to pass a param when triggering )
9002
  $colorInput.data('border_type_switched', true );
9003
  $colorInput.val( _rawVal.col ).trigger( 'change' );
9004
  $colorInput.data('border_type_switched', false );
9005
  };
9006
+
9007
+
9008
+
9009
+
9010
+
9011
+ // SETUP
9012
  input.borderColor = new api.Value( _.isEmpty( getInitialColor() ) ? '#000000' : getInitialColor() );
9013
+ // initialize the unit
9014
  input.css_unit = new api.Value( _.isEmpty( getInitialUnit() ) ? 'px' : validateUnit( getInitialUnit() ) );
9015
+ // setup the border type switcher. Initialized with all.
9016
  input.borderType = new api.Value( '_all_');
9017
+ // Setup the initial state of the number input
9018
  $numberInput.val( getInitialWeight() );
9019
+ // Setup the color input
9020
  $colorInput.val( input.borderColor() );
9021
  $colorInput.wpColorPicker({
9022
  palettes: true,
9023
+ //hide:false,
9024
  width: window.innerWidth >= 1440 ? 271 : 251,
9025
  change : function( evt, o ) {
9026
+ //if the input val is not updated here, it's not detected right away.
9027
+ //weird
9028
+ //is there a "change complete" kind of event for iris ?
9029
+ //$(this).val($(this).wpColorPicker('color'));
9030
+ //input.container.find('[data-czrtype]').trigger('colorpickerchange');
9031
+
9032
+ //synchronizes with the original input
9033
+ //OLD => $(this).val( $(this).wpColorPicker('color') ).trigger('colorpickerchange').trigger('change');
9034
  $(this).val( o.color.toString() ).trigger('colorpickerchange');
9035
  input.borderColor( o.color.toString(), { border_type_switched : true === $(this).data('border_type_switched') } );
9036
+ //input.borderColor( o.color.toString() );
9037
+ // if ( evt.originalEvent && evt.originalEvent.type && 'external' === evt.originalEvent.type ) {
9038
+ // input.borderColor( o.color.toString(), { border_type_switched : true } );
9039
+ // } else {
9040
+ // input.borderColor( o.color.toString() );
9041
+ // }
9042
  },
9043
  clear : function( e, o ) {
9044
  $(this).val('').trigger('colorpickerchange');
9045
  input.borderColor('');
9046
  }
9047
  });
9048
+
9049
+
9050
+
9051
+
9052
+
9053
+
9054
+ // SCHEDULE REACTIONS
9055
+ // React to a unit change => trigger a number input change
9056
+ // Don't move when switching the border type or initializing unit
9057
+ // @param params can be { border_type_switched : true }
9058
  input.css_unit.bind( function( to, from, params ) {
9059
+ // don't update the main input when switching border types or initializing the unit value
9060
  if ( _.isObject( params ) && ( true === params.border_type_switched || true === params.initializing_the_unit ) )
9061
  return;
9062
  $numberInput.trigger('input', params);
9063
  });
9064
+
9065
+ // React to a color change => trigger a number input change
9066
+ // Don't move when switching the border type or initializing the color
9067
+ // @param params can be { border_type_switched : true }
9068
  input.borderColor.bind( function( to, from, params ) {
9069
+ // don't update the main input when switching border types or initializing the unit value
9070
  if ( _.isObject( params ) && ( true === params.border_type_switched || true === params.initializing_the_color ) )
9071
  return;
9072
  $numberInput.trigger('input', params);
9073
  });
9074
+
9075
+ // react to border type changes
9076
  input.borderType.bind( function( borderType ) {
9077
  try { syncWithBorderType( borderType ); } catch( er ) {
9078
  api.errare('Error when firing syncWithBorderType for input type borders for module type ' + input.module.module_type , er );
9079
  }
9080
  });
9081
+
9082
+ // synchronizes range input and number input
9083
+ // number is the master => sets the input() val
9084
  $rangeInput.on('input', function( evt ) {
9085
  $numberInput.val( $(this).val() ).trigger('input');
9086
  });
9087
+
9088
+ // Set the input val
9089
  $numberInput.on('input', function( evt, params ) {
9090
  var currentBorderType = input.borderType() || '_all_',
9091
  currentColor = input.borderColor(),
9095
 
9096
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : clonedDefaults );
9097
  _newInputVal[ currentBorderType ] = $.extend( true, {}, _newInputVal[ currentBorderType ] || clonedDefaults[ currentBorderType ] );
9098
+
9099
+ // populate the border weight value
9100
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) ) {
9101
  _newInputVal[ currentBorderType ][ 'wght' ] = changedNumberInputVal;
9102
  }
9103
+ // populate the color value
9104
  _newInputVal[ currentBorderType ][ 'col' ] = currentColor;
9105
+
9106
+ // update input if not border_type_switched
9107
+ // if _all_ is changed, removed all other types
9108
  if ( _.isEmpty( params ) || ( _.isObject( params ) && true !== params.border_type_switched ) ) {
9109
  if ( '_all_' === currentBorderType ) {
9110
  _.each( input.cssBorderTypes, function( _type ) {
9113
  }
9114
  input( _newInputVal );
9115
  }
9116
+ // refresh the range slider
9117
  $rangeInput.val( $(this).val() );
9118
  });
9119
+
9120
+
9121
+ // Schedule unit changes on button click
9122
  $wrapper.on( 'click', '[data-sek-unit]', function( evt, params ) {
9123
  evt.preventDefault();
9124
+ // handle the is-selected css class toggling
9125
  $wrapper.find('[data-sek-unit]').removeClass('is-selected').attr( 'aria-pressed', false );
9126
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
9127
+ // update the initial unit ( not mandatory)
9128
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
9129
+ // set the current unit Value
9130
  input.css_unit( $(this).data('sek-unit'), params );
9131
  });
9132
+
9133
+ // Schedule border type changes on button click
9134
  $wrapper.on( 'click', '[data-sek-border-type]', function( evt, params ) {
9135
  evt.preventDefault();
9136
+ // handle the is-selected css class toggling
9137
  $wrapper.find('[data-sek-border-type]').removeClass('is-selected').attr( 'aria-pressed', false );
9138
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
9139
  var border = '_all_';
9142
  }
9143
  input.borderType( border, params );
9144
  });
9145
+
9146
+ // Schedule the reset of the value for the currently previewed device
9147
  input.container.on( 'click', '.sek-reset-button', function( evt ) {
9148
  var currentBorderType = input.borderType() || '_all_',
9149
  _newVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
9153
  syncWithBorderType( currentBorderType );
9154
  }
9155
  });
9156
+
9157
+
9158
+
9159
+
9160
+
9161
+
9162
+
9163
+
9164
+ // INITIALIZES
9165
+ // trigger a change on init to sync the range input
9166
  $rangeInput.val( $numberInput.val() || 0 );
9167
  try { syncWithBorderType( input.borderType() ); } catch( er ) {
9168
  api.errare('Error when firing syncWithBorderType for input type borders for module type ' + input.module.module_type , er );
9169
  }
9170
+ // trigger a click on the initial unit
9171
+ // => the initial unit could be set when fetching the server template but it's more convenient to handle it once the template is rendered
9172
  $( '[data-sek-unit="' + input.css_unit() + '"]', $wrapper ).trigger('click', { initializing_the_unit : true } );
9173
  },
9174
 
9177
 
9178
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
9179
  ( function ( api, $, _ ) {
9180
+ // all available input type as a map
9181
  api.czrInputMap = api.czrInputMap || {};
9182
+
9183
+ // input_type => callback fn to fire in the Input constructor on initialize
9184
+ // the callback can receive specific params define in each module constructor
9185
+ // For example, a content picker can be given params to display only taxonomies
9186
+ // the default input_event_map can also be overriden in this callback
9187
  $.extend( api.czrInputMap, {
9188
  border_radius : function( params ) {
9189
  var input = this,
9197
  }
9198
  return unit;
9199
  },
9200
+ // dev note : value.replace(/\D+/g, '') : ''; not working because remove "." which we might use for em for example
9201
  _extractNumericVal = function( _rawVal ) {
9202
  return ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) ? '16' : _rawVal.replace(/px|em|%/g,'');
9203
  },
9208
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
9209
 
9210
  input.cssRadiusTypes = [ 'top_left','top_right','bottom_right','bottom_left' ];
9211
+
9212
+ // Return the unit of the _all_ border type
9213
  var getInitialUnit = function() {
9214
  var inputVal = input(), initial_unit = 'px';
9215
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) ) {
9217
  }
9218
  return initial_unit;
9219
  };
9220
+ // Return the number value of the _all_ border type
9221
  var getInitialRadius = function() {
9222
  var inputVal = input(), initial_rad = 0;
9223
  if ( _.isObject( inputVal ) && _.has( inputVal, '_all_' ) ) {
9230
  }
9231
  return initial_rad;
9232
  };
9233
+
9234
+
9235
+ // Recursive helper
9236
+ // _all_ : 3px
9237
+ // falls back on {}
9238
  var getCurrentRadiusTypeOrAllValue = function( inputValues, radiusType ) {
9239
  var clonedDefaults = $.extend( true, {}, defaultVal ), _all_Value;
9240
  if ( ! _.has( clonedDefaults, '_all_' ) ) {
9248
  return _all_Value;
9249
  }
9250
  };
9251
+
9252
+ // Synchronizes on init + refresh on border radius change
9253
  var syncWithRadiusType = function( radiusType ) {
9254
  if ( ! _.contains( [ '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left' ], radiusType ) ) {
9255
  throw new Error( "Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => " + radiusType );
9256
  }
9257
+
9258
+ // initialize the number input with the current input val
9259
+ // for retro-compatibility, we must handle the case when the initial input val is a string instead of an array
9260
+ // in this case, the string value is assigned to the desktop device.
9261
  var inputVal = input(), inputValues = {}, clonedDefault = $.extend( true, {}, defaultVal );
9262
  if ( _.isObject( inputVal ) ) {
9263
  inputValues = $.extend( true, {}, inputVal );
9265
  inputValues = { _all_ : '0px' };
9266
  }
9267
  inputValues = $.extend( clonedDefault, inputValues );
9268
+
9269
+ // do we have a val for the current type ?
9270
  var _rawVal = getCurrentRadiusTypeOrAllValue( inputValues, radiusType ), _unit, _numberVal;
9271
  if ( _.isEmpty( _rawVal ) || ! _.isString( _rawVal ) ) {
9272
  throw new Error( "Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");
9274
 
9275
  _unit = _extractUnit( _rawVal );
9276
  _numberVal = _extractNumericVal( _rawVal );
9277
+
9278
+ // update the unit
9279
  $('.sek-unit-wrapper', $wrapper).find('[data-sek-unit="' + _unit +'"]').trigger('click', { radius_type_switched : true });// We don't want to update the input()
9280
+ // add is-selected button on init to the relevant unit button
9281
  $wrapper.find( '.sek-ui-button[data-sek-unit="'+ _unit +'"]').addClass('is-selected').attr( 'aria-pressed', true );
9282
+ // update the numeric val
9283
  $numberInput.val( _numberVal ).trigger('input', { radius_type_switched : true });// We don't want to update the input()
9284
  };
9285
+
9286
+
9287
+
9288
+
9289
+
9290
+
9291
+
9292
+ // SETUP
9293
+ // initialize the unit
9294
  input.css_unit = new api.Value( _.isEmpty( getInitialUnit() ) ? 'px' : validateUnit( getInitialUnit() ) );
9295
+ // setup the border type switcher. Initialized with all.
9296
  input.radiusType = new api.Value('_all_');
9297
+ // Setup the initial state of the number input
9298
  $numberInput.val( getInitialRadius() );
9299
+
9300
+
9301
+
9302
+
9303
+
9304
+
9305
+
9306
+
9307
+ // SCHEDULE REACTIONS
9308
+ // React to a unit change => trigger a number input change
9309
+ // Don't move when switching the border type or initializing unit
9310
+ // @param params can be { radius_type_switched : true }
9311
  input.css_unit.bind( function( to, from, params ) {
9312
+ // don't update the main input when switching border types or initializing the unit value
9313
  if ( _.isObject( params ) && ( true === params.radius_type_switched || true === params.initializing_the_unit ) )
9314
  return;
9315
  $numberInput.trigger('input', params);
9316
  });
9317
+
9318
+ // react to border type changes
9319
  input.radiusType.bind( function( radiusType ) {
9320
  try { syncWithRadiusType( radiusType ); } catch( er ) {
9321
  api.errare('Error when firing syncWithRadiusType for input type border_radius for module type ' + input.module.module_type , er );
9322
  }
9323
  });
9324
+
9325
+ // synchronizes range input and number input
9326
+ // number is the master => sets the input() val
9327
  $rangeInput.on('input', function( evt ) {
9328
  $numberInput.val( $(this).val() ).trigger('input');
9329
  });
9330
+
9331
+ // Set the input val
9332
  $numberInput.on('input', function( evt, params ) {
9333
  var currentRadiusType = input.radiusType() || '_all_',
9334
  changedNumberInputVal = $(this).val() + validateUnit( input.css_unit() ),
9337
 
9338
  _newInputVal = $.extend( true, {}, _.isObject( input() ) ? input() : clonedDefaults );
9339
  _newInputVal[ currentRadiusType ] = $.extend( true, {}, _newInputVal[ currentRadiusType ] || clonedDefaults[ currentRadiusType ] );
9340
+
9341
+ // populate the border weight value
9342
  if ( ( _.isString( changedNumberInputVal ) && ! _.isEmpty( changedNumberInputVal ) ) ) {
9343
  _newInputVal[ currentRadiusType ] = changedNumberInputVal;
9344
  }
9345
+ // update input if not radius_type_switched
9346
+ // if _all_ is changed, removed all other types
9347
  if ( _.isEmpty( params ) || ( _.isObject( params ) && true !== params.radius_type_switched ) ) {
9348
  if ( '_all_' === currentRadiusType ) {
9349
  _.each( input.cssRadiusTypes, function( _type ) {
9352
  }
9353
  input( _newInputVal );
9354
  }
9355
+ // refresh the range slider
9356
  $rangeInput.val( $(this).val() );
9357
  });
9358
+
9359
+
9360
+ // Schedule unit changes on button click
9361
  $wrapper.on( 'click', '[data-sek-unit]', function( evt, params ) {
9362
  evt.preventDefault();
9363
+ // handle the is-selected css class toggling
9364
  $wrapper.find('[data-sek-unit]').removeClass('is-selected').attr( 'aria-pressed', false );
9365
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
9366
+ // update the initial unit ( not mandatory)
9367
  $wrapper.find('input[data-czrtype]').data('sek-unit', $(this).data('sek-unit') );
9368
+ // set the current unit Value
9369
  input.css_unit( $(this).data('sek-unit'), params );
9370
  });
9371
+
9372
+ // Schedule border type changes on button click
9373
  $wrapper.on( 'click', '[data-sek-radius-type]', function( evt, params ) {
9374
  evt.preventDefault();
9375
+ // handle the is-selected css class toggling
9376
  $wrapper.find('[data-sek-radius-type]').removeClass('is-selected').attr( 'aria-pressed', false );
9377
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
9378
  var border = '_all_';
9381
  }
9382
  input.radiusType( border, params );
9383
  });
9384
+
9385
+ // Schedule the reset of the value for the currently previewed device
9386
  input.container.on( 'click', '.sek-reset-button', function( evt ) {
9387
  var currentRadiusType = input.radiusType() || '_all_',
9388
  _newVal = $.extend( true, {}, _.isObject( input() ) ? input() : {} );
9392
  syncWithRadiusType( currentRadiusType );
9393
  }
9394
  });
9395
+
9396
+
9397
+
9398
+
9399
+
9400
+
9401
+
9402
+
9403
+ // INITIALIZES
9404
+ // trigger a change on init to sync the range input
9405
  $rangeInput.val( $numberInput.val() || 0 );
9406
  try { syncWithRadiusType( input.radiusType() ); } catch( er ) {
9407
  api.errare('Error when firing syncWithRadiusType for input type border_radius for module type ' + input.module.module_type , er );
9408
  }
9409
+ // trigger a click on the initial unit
9410
+ // => the initial unit could be set when fetching the server template but it's more convenient to handle it once the template is rendered
9411
  $( '[data-sek-unit="' + input.css_unit() + '"]', $wrapper ).trigger('click', { initializing_the_unit : true } );
9412
  },
9413
 
9416
 
9417
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
9418
  ( function ( api, $, _ ) {
9419
+ // all available input type as a map
9420
  api.czrInputMap = api.czrInputMap || {};
9421
+
9422
+ // input_type => callback fn to fire in the Input constructor on initialize
9423
+ // the callback can receive specific params define in each module constructor
9424
+ // For example, a content picker can be given params to display only taxonomies
9425
+ // the default input_event_map can also be overriden in this callback
9426
  $.extend( api.czrInputMap, {
9427
  buttons_choice : function( params ) {
9428
  var input = this,
9430
  $mainInput = $wrapper.find( 'input[type="number"]'),
9431
  inputRegistrationParams = api.czr_sektions.getInputRegistrationParams( input.id, input.module.module_type ),
9432
  defaultVal = ( ! _.isEmpty( inputRegistrationParams ) && ! _.isEmpty( inputRegistrationParams.default ) ) ? inputRegistrationParams.default : {};
9433
+
9434
+ // SETUP
9435
+ // Setup the initial state of the number input
9436
  $mainInput.val( input() );
9437
+
9438
+ // Schedule choice changes on button click
9439
  $wrapper.on( 'click', '[data-sek-choice]', function( evt, params ) {
9440
  evt.stopPropagation();
9441
+ // handle the is-selected css class toggling
9442
  $wrapper.find('[data-sek-choice]').removeClass('is-selected').attr( 'aria-pressed', false );
9443
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
9444
  var newChoice;
9447
  }
9448
  input( newChoice );
9449
  });
9450
+
9451
+
9452
+ // INITIALIZES
9453
+ // trigger a click on the initial unit
9454
+ // => the initial unit could be set when fetching the server template but it's more convenient to handle it once the template is rendered
9455
  $( '[data-sek-choice="' + input() + '"]', $wrapper ).trigger('click', { initializing_the_unit : true } );
9456
  }
9457
  });//$.extend( api.czrInputMap, {})
9458
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData
9459
  ( function ( api, $, _ ) {
9460
+ // all available input type as a map
9461
  api.czrInputMap = api.czrInputMap || {};
9462
+
9463
+ // input_type => callback fn to fire in the Input constructor on initialize
9464
+ // the callback can receive specific params define in each module constructor
9465
+ // For example, a content picker can be given params to display only taxonomies
9466
+ // the default input_event_map can also be overriden in this callback
9467
  $.extend( api.czrInputMap, {
9468
  reset_button : function( params ) {
9469
  var input = this;
9470
+
9471
+ // Schedule choice changes on button click
9472
  input.container.on( 'click', '[data-sek-reset-scope]', function( evt, params ) {
9473
  evt.stopPropagation();
9474
  var scope = $(this).data( 'sek-reset-scope' );
9481
  }
9482
  });//$.extend( api.czrInputMap, {})
9483
  })( wp.customize, jQuery, _ );//global sektionsLocalizedData, serverControlParams
9484
+ //extends api.CZRDynModule
9485
  /* ------------------------------------------------------------------------- *
9486
  * CONTENT TYPE SWITCHER
9487
  /* ------------------------------------------------------------------------- */
9488
  ( function ( api, $, _ ) {
9489
+ //provides a description of each module
9490
+ //=> will determine :
9491
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
9492
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
9493
+ // , if crud, the item shall be removable
9494
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
9495
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
9496
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
9497
  api.czrModuleMap = api.czrModuleMap || {};
9498
  $.extend( api.czrModuleMap, {
9499
  sek_content_type_switcher_module : {
9500
+ //mthds : SectionPickerModuleConstructor,
9501
  crud : false,
9502
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_content_type_switcher_module', 'name' ),
9503
  has_mod_opt : false,
9510
  });
9511
 
9512
  api.czrInputMap = api.czrInputMap || {};
9513
+ //input_type => callback fn to fire in the Input constructor on initialize
9514
+ //the callback can receive specific params define in each module constructor
9515
+ //For example, a content picker can be given params to display only taxonomies
9516
  $.extend( api.czrInputMap, {
9517
  content_type_switcher : function( input_options ) {
9518
  var input = this,
9523
  throw new Error( 'api.czrInputMap.content_type_switcher => section not registered' );
9524
  }
9525
  _section_ = api.section( input.module.control.section() );
9526
+
9527
+ // attach click event on data-sek-content-type buttons
9528
  input.container.on('click', '[data-sek-content-type]', function( evt ) {
9529
  evt.preventDefault();
9530
+ // handle the is-selected css class toggling
9531
  input.container.find('[data-sek-content-type]').removeClass('is-selected').attr( 'aria-pressed', false );
9532
  $(this).addClass('is-selected').attr( 'aria-pressed', true );
9533
  api.czr_sektions.currentContentPickerType( $(this).data( 'sek-content-type') );
9542
  }
9543
  });
9544
  };
9545
+
9546
+ // Initialize
9547
+ // Fixes issue https://github.com/presscustomizr/nimble-builder/issues/248
9548
  api.czr_sektions.currentContentPickerType = api.czr_sektions.currentContentPickerType || new api.Value( input() );
9549
  _do_( api.czr_sektions.currentContentPickerType() );
9550
+
9551
+ // Schedule a reaction to changes
9552
  api.czr_sektions.currentContentPickerType.bind( function( contentType ) {
9553
  _do_( contentType );
9554
  });
9563
  /* ------------------------------------------------------------------------- *
9564
  * MODULE PICKER MODULE
9565
  /* ------------------------------------------------------------------------- */
9566
+ //global sektionsLocalizedData, serverControlParams
9567
+ //extends api.CZRDynModule
9568
  ( function ( api, $, _ ) {
9569
+ //provides a description of each module
9570
+ //=> will determine :
9571
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
9572
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
9573
+ // , if crud, the item shall be removable
9574
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
9575
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
9576
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
9577
  api.czrModuleMap = api.czrModuleMap || {};
9578
  $.extend( api.czrModuleMap, {
9579
  sek_module_picker_module : {
9580
+ //mthds : ModulePickerModuleConstructor,
9581
  crud : false,
9582
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_module_picker_module', 'name' ),
9583
  has_mod_opt : false,
9590
  });
9591
 
9592
  api.czrInputMap = api.czrInputMap || {};
9593
+
9594
+ //input_type => callback fn to fire in the Input constructor on initialize
9595
+ //the callback can receive specific params define in each module constructor
9596
+ //For example, a content picker can be given params to display only taxonomies
9597
  $.extend( api.czrInputMap, {
9598
  module_picker : function( input_options ) {
9599
  var input = this;
9600
+ // Mouse effect with cursor: -webkit-grab; -webkit-grabbing;
9601
+ // input.container.find('[draggable]').each( function() {
9602
+ // $(this).on( 'mousedown mouseup', function( evt ) {
9603
+ // switch( evt.type ) {
9604
+ // case 'mousedown' :
9605
+ // //$(this).addClass('sek-grabbing');
9606
+ // break;
9607
+ // case 'mouseup' :
9608
+ // //$(this).removeClass('sek-grabbing');
9609
+ // break;
9610
+ // }
9611
+ // });
9612
+ // });
9613
  api.czr_sektions.trigger( 'sek-refresh-dragzones', { type : 'module', input_container : input.container } );
9614
+ //console.log( this.id, input_options );
9615
  }
9616
  });
9617
  })( wp.customize , jQuery, _ );
9622
  * SECTION PICKER MODULES
9623
  /* ------------------------------------------------------------------------- */
9624
  ( function ( api, $, _ ) {
9625
+ //provides a description of each module
9626
+ //=> will determine :
9627
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
9628
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
9629
+ // , if crud, the item shall be removable
9630
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
9631
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
9632
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
9633
  api.czrModuleMap = api.czrModuleMap || {};
9634
  var section_modules = [
9635
  'sek_intro_sec_picker_module',
9637
  'sek_contact_sec_picker_module',
9638
  'sek_column_layouts_sec_picker_module'
9639
  ];
9640
+ // Header and footer have been introduced in v1.4.0 but not enabled by default
9641
+ // The header and footer preset sections are on hold until "header and footer" feature is released.
9642
  if ( sektionsLocalizedData.isNimbleHeaderFooterEnabled ) {
9643
  section_modules = _.union( section_modules, [ 'sek_header_sec_picker_module','sek_footer_sec_picker_module' ] );
9644
  }
9645
  _.each( section_modules, function( module_type ) {
9646
  api.czrModuleMap[ module_type ] = {
9647
+ //mthds : SectionPickerModuleConstructor,
9648
  crud : false,
9649
  name : api.czr_sektions.getRegisteredModuleProperty( module_type, 'name' ),
9650
  has_mod_opt : false,
9665
  /* ------------------------------------------------------------------------- *
9666
  * MY SECTIONS MODULE
9667
  /* ------------------------------------------------------------------------- */
9668
+ //global sektionsLocalizedData, serverControlParams
9669
+ //extends api.CZRDynModule
9670
  ( function ( api, $, _ ) {
9671
  var Constructor = {
9672
  initialize: function( id, options ) {
9673
  var module = this;
9674
+
9675
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
9676
  module.inputConstructor = api.CZRInput.extend({
9677
  initialize : function( name, options ) {
9678
  var input = this;
9689
  html = '',
9690
  $wrapper = input.container.find('.sek-content-type-wrapper'),
9691
  creation_date = '',
9692
+ // https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date
9693
  formatDate = function(date) {
9694
  var monthNames = [
9695
  "January", "February", "March",
9709
  day,
9710
  monthNames[monthIndex],
9711
  year
9712
+ //[hours,minutes,seconds].join(':')
9713
  ].join(' ');
9714
  };
9715
 
9731
  });
9732
  }
9733
  });
9734
+
9735
+ // run the parent initialize
9736
+ // Note : must be always invoked always after the input / item class extension
9737
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
9738
  api.CZRDynModule.prototype.initialize.call( module, id, options );
9739
+
9740
+ // module.embedded.then( function() {
9741
+ // console.log('MODULE READY=> lets dance', module.container, module.container.find('.sek-content-type-wrapper') );
9742
+ // });
9743
  },//initialize
9744
  };
9745
+
9746
+
9747
+ //provides a description of each module
9748
+ //=> will determine :
9749
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
9750
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
9751
+ // , if crud, the item shall be removable
9752
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
9753
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
9754
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
9755
  api.czrModuleMap = api.czrModuleMap || {};
9756
  if ( sektionsLocalizedData.isSavedSectionEnabled ) {
9757
  $.extend( api.czrModuleMap, {
9778
  /* ------------------------------------------------------------------------- */
9779
  ( function ( api, $, _ ) {
9780
  api.czrInputMap = api.czrInputMap || {};
9781
+ //input_type => callback fn to fire in the Input constructor on initialize
9782
+ //the callback can receive specific params define in each module constructor
9783
+ //For example, a content picker can be given params to display only taxonomies
9784
  $.extend( api.czrInputMap, {
9785
  section_picker : function( input_options ) {
9786
  var input = this;
9787
+ // Mouse effect with cursor: -webkit-grab; -webkit-grabbing;
9788
+ // input.container.find('[draggable]').each( function() {
9789
+ // $(this).on( 'mousedown mouseup', function( evt ) {
9790
+ // switch( evt.type ) {
9791
+ // case 'mousedown' :
9792
+ // //$(this).addClass('sek-grabbing');
9793
+ // break;
9794
+ // case 'mouseup' :
9795
+ // //$(this).removeClass('sek-grabbing');
9796
+ // break;
9797
+ // }
9798
+ // });
9799
+ // });
9800
  api.czr_sektions.trigger( 'sek-refresh-dragzones', { type : 'preset_section', input_container : input.container } );
9801
  }
9802
  });
9803
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
9804
+ //extends api.CZRDynModule
9805
  ( function ( api, $, _ ) {
9806
+ //provides a description of each module
9807
+ //=> will determine :
9808
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
9809
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
9810
+ // , if crud, the item shall be removable
9811
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
9812
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
9813
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
9814
  api.czrModuleMap = api.czrModuleMap || {};
9815
  $.extend( api.czrModuleMap, {
9816
  sek_level_anchor_module : {
9817
+ //mthds : Constructor,
9818
  crud : false,
9819
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_level_anchor_module', 'name' ),
9820
  has_mod_opt : false,
9827
  },
9828
  });
9829
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
9830
+ //extends api.CZRDynModule
9831
  ( function ( api, $, _ ) {
9832
  var Constructor = {
9833
  initialize: function( id, options ) {
9834
+ //console.log('INITIALIZING SEKTION OPTIONS', id, options );
9835
  var module = this;
9836
+
9837
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
9838
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
9839
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
9840
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
9841
+
9842
+ //run the parent initialize
9843
  api.CZRDynModule.prototype.initialize.call( module, id, options );
9844
  },//initialize
9845
 
9851
  },//CZRInputMths
9852
 
9853
  CZRItemConstructor : {
9854
+ //overrides the parent ready
9855
  ready : function() {
9856
  var item = this;
9857
+ //wait for the input collection to be populated,
9858
+ //and then set the input visibility dependencies
9859
  item.inputCollection.bind( function( col ) {
9860
  if( _.isEmpty( col ) )
9861
  return;
9863
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
9864
  }
9865
  });//item.inputCollection.bind()
9866
+
9867
+ //fire the parent
9868
  api.CZRItem.prototype.ready.call( item );
9869
  },
9870
+
9871
+
9872
+ //Fired when the input collection is populated
9873
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
9874
  setInputVisibilityDeps : function() {
9875
  var item = this,
9876
  module = item.module;
9877
+ //Internal item dependencies
9878
  item.czr_Input.each( function( input ) {
9879
  switch( input.id ) {
9880
  case 'bg-image' :
9930
  api.errare( module.id + ' => error in setInputVisibilityDeps', er );
9931
  }
9932
  });
9933
+ // uncheck fixed background if needed
9934
  input.bind( function( to ) {
9935
  if ( api.CZR_Helpers.isChecked( input() ) ) {
9936
  if ( api.CZR_Helpers.isChecked( item.czr_Input('bg-attachment')()) ) {
9940
  });
9941
  break;
9942
  case 'bg-attachment' :
9943
+ // uncheck parallax if needed
9944
  input.bind( function( to ) {
9945
  if ( api.CZR_Helpers.isChecked( input() ) ) {
9946
  if ( api.CZR_Helpers.isChecked( item.czr_Input('bg-parallax')()) ) {
9954
  }
9955
  }//CZRItemConstructor
9956
  };
9957
+
9958
+
9959
+ //provides a description of each module
9960
+ //=> will determine :
9961
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
9962
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
9963
+ // , if crud, the item shall be removable
9964
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
9965
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
9966
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
9967
  api.czrModuleMap = api.czrModuleMap || {};
9968
  $.extend( api.czrModuleMap, {
9969
  sek_level_bg_module : {
9980
  },
9981
  });
9982
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
9983
+ //extends api.CZRDynModule
9984
  ( function ( api, $, _ ) {
9985
  var Constructor = {
9986
  initialize: function( id, options ) {
9987
+ //console.log('INITIALIZING SEKTION OPTIONS', id, options );
9988
  var module = this;
9989
+
9990
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
9991
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
9992
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
9993
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
9994
+
9995
+ //run the parent initialize
9996
  api.CZRDynModule.prototype.initialize.call( module, id, options );
9997
  },//initialize
9998
 
10004
  },//CZRInputMths
10005
 
10006
  CZRItemConstructor : {
10007
+ //overrides the parent ready
10008
  ready : function() {
10009
  var item = this;
10010
+ //wait for the input collection to be populated,
10011
+ //and then set the input visibility dependencies
10012
  item.inputCollection.bind( function( col ) {
10013
  if( _.isEmpty( col ) )
10014
  return;
10016
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10017
  }
10018
  });//item.inputCollection.bind()
10019
+
10020
+ //fire the parent
10021
  api.CZRItem.prototype.ready.call( item );
10022
  },
10023
+
10024
+
10025
+ //Fired when the input collection is populated
10026
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10027
  setInputVisibilityDeps : function() {
10028
  var item = this,
10029
  module = item.module;
10030
+ //Internal item dependencies
10031
  item.czr_Input.each( function( input ) {
10032
  switch( input.id ) {
10033
  case 'border-type' :
10044
  }
10045
  }//CZRItemConstructor
10046
  };
10047
+
10048
+
10049
+ //provides a description of each module
10050
+ //=> will determine :
10051
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10052
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10053
+ // , if crud, the item shall be removable
10054
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10055
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10056
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10057
  api.czrModuleMap = api.czrModuleMap || {};
10058
  $.extend( api.czrModuleMap, {
10059
  sek_level_border_module : {
10070
  },
10071
  });
10072
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10073
+ //extends api.CZRDynModule
10074
  ( function ( api, $, _ ) {
10075
  var Constructor = {
10076
  initialize: function( id, options ) {
10077
  var module = this;
10078
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10079
+ // module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
10080
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10081
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10082
+ //run the parent initialize
10083
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10084
 
10085
  },//initialize
10086
 
10087
+ // CZRInputMths : {
10088
+ // setupSelect : function() {
10089
+ // api.czr_sektions.setupSelectInput.call( this );
10090
+ // }
10091
+ // },//CZRInputMths
10092
+
10093
  CZRItemConstructor : {
10094
+ //overrides the parent ready
10095
  ready : function() {
10096
  var item = this;
10097
+ //wait for the input collection to be populated,
10098
+ //and then set the input visibility dependencies
10099
  item.inputCollection.bind( function( col ) {
10100
  if( _.isEmpty( col ) )
10101
  return;
10103
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10104
  }
10105
  });//item.inputCollection.bind()
10106
+
10107
+ //fire the parent
10108
  api.CZRItem.prototype.ready.call( item );
10109
  },
10110
+
10111
+
10112
+ //Fired when the input collection is populated
10113
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10114
  setInputVisibilityDeps : function() {
10115
  var item = this,
10116
  module = item.module;
10117
+ //Internal item dependencies
10118
  item.czr_Input.each( function( input ) {
10119
  switch( input.id ) {
10120
  case 'use-custom-breakpoint' :
10127
  }
10128
  }//CZRItemConstructor
10129
  };
10130
+
10131
+ //provides a description of each module
10132
+ //=> will determine :
10133
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10134
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10135
+ // , if crud, the item shall be removable
10136
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10137
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10138
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10139
  api.czrModuleMap = api.czrModuleMap || {};
10140
  $.extend( api.czrModuleMap, {
10141
  sek_level_breakpoint_module : {
10152
  },
10153
  });
10154
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10155
+ //extends api.CZRDynModule
10156
  ( function ( api, $, _ ) {
10157
  var Constructor = {
10158
  initialize: function( id, options ) {
10159
  var module = this;
10160
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10161
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
10162
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10163
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10164
+ //run the parent initialize
10165
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10166
 
10167
  },//initialize
10173
  },//CZRInputMths
10174
 
10175
  CZRItemConstructor : {
10176
+ //overrides the parent ready
10177
  ready : function() {
10178
  var item = this;
10179
+ //wait for the input collection to be populated,
10180
+ //and then set the input visibility dependencies
10181
  item.inputCollection.bind( function( col ) {
10182
  if( _.isEmpty( col ) )
10183
  return;
10185
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10186
  }
10187
  });//item.inputCollection.bind()
10188
+
10189
+ //fire the parent
10190
  api.CZRItem.prototype.ready.call( item );
10191
  },
10192
+
10193
+
10194
+ //Fired when the input collection is populated
10195
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10196
  setInputVisibilityDeps : function() {
10197
  var item = this,
10198
  module = item.module;
10199
+ //Internal item dependencies
10200
  item.czr_Input.each( function( input ) {
10201
  switch( input.id ) {
10202
  case 'height-type' :
10213
  }
10214
  }//CZRItemConstructor
10215
  };
10216
+
10217
+
10218
+ //provides a description of each module
10219
+ //=> will determine :
10220
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10221
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10222
+ // , if crud, the item shall be removable
10223
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10224
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10225
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10226
  api.czrModuleMap = api.czrModuleMap || {};
10227
  $.extend( api.czrModuleMap, {
10228
  sek_level_height_module : {
10239
  },
10240
  });
10241
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10242
+ //extends api.CZRDynModule
10243
  ( function ( api, $, _ ) {
10244
+ //provides a description of each module
10245
+ //=> will determine :
10246
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10247
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10248
+ // , if crud, the item shall be removable
10249
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10250
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10251
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10252
  api.czrModuleMap = api.czrModuleMap || {};
10253
  $.extend( api.czrModuleMap, {
10254
  sek_level_visibility_module : {
10255
+ //mthds : Constructor,
10256
  crud : false,
10257
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_level_visibility_module', 'name' ),
10258
  has_mod_opt : false,
10265
  },
10266
  });
10267
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10268
+ //extends api.CZRDynModule
10269
  ( function ( api, $, _ ) {
10270
  var Constructor = {
10271
  initialize: function( id, options ) {
10272
  var module = this;
10273
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10274
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
10275
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10276
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10277
+ //run the parent initialize
10278
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10279
 
10280
  },//initialize
10286
  },//CZRInputMths
10287
 
10288
  CZRItemConstructor : {
10289
+ //overrides the parent ready
10290
  ready : function() {
10291
  var item = this;
10292
+ //wait for the input collection to be populated,
10293
+ //and then set the input visibility dependencies
10294
  item.inputCollection.bind( function( col ) {
10295
  if( _.isEmpty( col ) )
10296
  return;
10298
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10299
  }
10300
  });//item.inputCollection.bind()
10301
+
10302
+ //fire the parent
10303
  api.CZRItem.prototype.ready.call( item );
10304
  },
10305
+
10306
+
10307
+ //Fired when the input collection is populated
10308
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10309
  setInputVisibilityDeps : function() {
10310
  var item = this,
10311
  module = item.module;
10312
+
10313
+ //Internal item dependencies
10314
  item.czr_Input.each( function( input ) {
10315
  switch( input.id ) {
10316
  case 'width-type' :
10326
  }
10327
  }//CZRItemConstructor
10328
  };
10329
+
10330
+
10331
+ //provides a description of each module
10332
+ //=> will determine :
10333
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10334
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10335
+ // , if crud, the item shall be removable
10336
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10337
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10338
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10339
  api.czrModuleMap = api.czrModuleMap || {};
10340
  $.extend( api.czrModuleMap, {
10341
  sek_level_width_module : {
10352
  },
10353
  });
10354
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10355
+ //extends api.CZRDynModule
10356
  ( function ( api, $, _ ) {
10357
  var Constructor = {
10358
  initialize: function( id, options ) {
10359
  var module = this;
10360
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10361
  module.inputConstructor = api.CZRInput.extend( module.CZRInputMths || {} );
10362
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10363
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10364
+ //run the parent initialize
10365
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10366
 
10367
  },//initialize
10373
  },//CZRInputMths
10374
 
10375
  CZRItemConstructor : {
10376
+ //overrides the parent ready
10377
  ready : function() {
10378
  var item = this;
10379
+ //wait for the input collection to be populated,
10380
+ //and then set the input visibility dependencies
10381
  item.inputCollection.bind( function( col ) {
10382
  if( _.isEmpty( col ) )
10383
  return;
10385
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10386
  }
10387
  });//item.inputCollection.bind()
10388
+
10389
+ //fire the parent
10390
  api.CZRItem.prototype.ready.call( item );
10391
  },
10392
+
10393
+
10394
+ //Fired when the input collection is populated
10395
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10396
  setInputVisibilityDeps : function() {
10397
  var item = this,
10398
  module = item.module;
10399
+
10400
+ //Internal item dependencies
10401
  item.czr_Input.each( function( input ) {
10402
  switch( input.id ) {
10403
  case 'use-custom-outer-width' :
10415
  }
10416
  }//CZRItemConstructor
10417
  };
10418
+
10419
+
10420
+ //provides a description of each module
10421
+ //=> will determine :
10422
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10423
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10424
+ // , if crud, the item shall be removable
10425
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10426
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10427
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10428
  api.czrModuleMap = api.czrModuleMap || {};
10429
  $.extend( api.czrModuleMap, {
10430
  sek_level_width_section : {
10441
  },
10442
  });
10443
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10444
+ //extends api.CZRDynModule
10445
  ( function ( api, $, _ ) {
10446
+ //provides a description of each module
10447
+ //=> will determine :
10448
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10449
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10450
+ // , if crud, the item shall be removable
10451
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10452
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10453
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10454
  api.czrModuleMap = api.czrModuleMap || {};
10455
  $.extend( api.czrModuleMap, {
10456
  sek_level_spacing_module : {
10467
  },
10468
  });
10469
  })( wp.customize , jQuery, _ );
10470
+ //global sektionsLocalizedData, serverControlParams
10471
+ //extends api.CZRDynModule
10472
  ( function ( api, $, _ ) {
10473
  var Constructor = {
10474
  initialize: function( id, options ) {
10475
  var module = this;
10476
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10477
  module.inputConstructor = api.CZRInput.extend({
10478
  setupSelect : function() {
10479
  api.czr_sektions.setupSelectInput.call( this );
10480
  }
10481
  });
10482
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10483
+ //module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10484
+ //run the parent initialize
10485
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10486
 
10487
  }//initialize
10488
  };
10489
+
10490
+ //provides a description of each module
10491
+ //=> will determine :
10492
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10493
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10494
+ // , if crud, the item shall be removable
10495
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10496
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10497
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10498
  api.czrModuleMap = api.czrModuleMap || {};
10499
  $.extend( api.czrModuleMap, {
10500
  sek_local_template : {
10510
  },
10511
  });
10512
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10513
+ //extends api.CZRDynModule
10514
  ( function ( api, $, _ ) {
10515
  var Constructor = {
10516
  initialize: function( id, options ) {
10517
  var module = this;
10518
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10519
  module.inputConstructor = api.CZRInput.extend({
10520
  setupSelect : function() {
10521
  api.czr_sektions.setupSelectInput.call( this );
10522
  }
10523
  });
10524
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10525
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10526
+ //run the parent initialize
10527
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10528
 
10529
  },//initialize
10530
 
10531
  CZRItemConstructor : {
10532
+ //overrides the parent ready
10533
  ready : function() {
10534
  var item = this;
10535
+ //wait for the input collection to be populated,
10536
+ //and then set the input visibility dependencies
10537
  item.inputCollection.bind( function( col ) {
10538
  if( _.isEmpty( col ) )
10539
  return;
10541
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10542
  }
10543
  });//item.inputCollection.bind()
10544
+
10545
+ //fire the parent
10546
  api.CZRItem.prototype.ready.call( item );
10547
  },
10548
+
10549
+
10550
+ //Fired when the input collection is populated
10551
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10552
  setInputVisibilityDeps : function() {
10553
  var item = this,
10554
  module = item.module;
10555
+
10556
+ //Internal item dependencies
10557
  item.czr_Input.each( function( input ) {
10558
  switch( input.id ) {
10559
  case 'use-custom-outer-width' :
10571
  }
10572
  }//CZRItemConstructor
10573
  };
10574
+
10575
+
10576
+ //provides a description of each module
10577
+ //=> will determine :
10578
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10579
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10580
+ // , if crud, the item shall be removable
10581
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10582
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10583
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10584
  api.czrModuleMap = api.czrModuleMap || {};
10585
  $.extend( api.czrModuleMap, {
10586
  sek_local_widths : {
10596
  },
10597
  });
10598
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10599
+ //extends api.CZRDynModule
10600
  ( function ( api, $, _ ) {
10601
+
10602
+ //provides a description of each module
10603
+ //=> will determine :
10604
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10605
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10606
+ // , if crud, the item shall be removable
10607
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10608
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10609
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10610
  api.czrModuleMap = api.czrModuleMap || {};
10611
  $.extend( api.czrModuleMap, {
10612
  sek_local_custom_css : {
10613
+ //mthds : Constructor,
10614
  crud : false,
10615
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_local_custom_css', 'name' ),
10616
  has_mod_opt : false,
10622
  },
10623
  });
10624
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10625
+ //extends api.CZRDynModule
10626
  ( function ( api, $, _ ) {
10627
+
10628
+ //provides a description of each module
10629
+ //=> will determine :
10630
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10631
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10632
+ // , if crud, the item shall be removable
10633
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10634
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10635
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10636
  api.czrModuleMap = api.czrModuleMap || {};
10637
  $.extend( api.czrModuleMap, {
10638
  sek_local_reset : {
10639
+ //mthds : Constructor,
10640
  crud : false,
10641
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_local_reset', 'name' ),
10642
  has_mod_opt : false,
10648
  },
10649
  });
10650
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10651
+ //extends api.CZRDynModule
10652
  ( function ( api, $, _ ) {
10653
  var Constructor = {
10654
  initialize: function( id, options ) {
10655
  var module = this;
10656
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10657
  module.inputConstructor = api.CZRInput.extend({
10658
  setupSelect : function() {
10659
  api.czr_sektions.setupSelectInput.call( this );
10660
  }
10661
  });
10662
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10663
+ //module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10664
+ //run the parent initialize
10665
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10666
 
10667
  }//initialize
10668
  };
10669
+ //provides a description of each module
10670
+ //=> will determine :
10671
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10672
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10673
+ // , if crud, the item shall be removable
10674
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10675
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10676
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10677
  api.czrModuleMap = api.czrModuleMap || {};
10678
  $.extend( api.czrModuleMap, {
10679
  sek_local_performances : {
10689
  },
10690
  });
10691
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10692
+ //extends api.CZRDynModule
10693
  ( function ( api, $, _ ) {
10694
  var Constructor = {
10695
  initialize: function( id, options ) {
10696
  var module = this;
10697
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10698
  module.inputConstructor = api.CZRInput.extend({
10699
  setupSelect : function() {
10700
  api.czr_sektions.setupSelectInput.call( this );
10701
  }
10702
  });
10703
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10704
+ //module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10705
+ //run the parent initialize
10706
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10707
 
10708
  }//initialize
10709
  };
10710
+
10711
+ //provides a description of each module
10712
+ //=> will determine :
10713
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10714
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10715
+ // , if crud, the item shall be removable
10716
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10717
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10718
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10719
  api.czrModuleMap = api.czrModuleMap || {};
10720
  $.extend( api.czrModuleMap, {
10721
  sek_local_header_footer : {
10731
  },
10732
  });
10733
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10734
+ //extends api.CZRDynModule
10735
  ( function ( api, $, _ ) {
10736
  var Constructor = {
10737
  initialize: function( id, options ) {
10738
  var module = this;
10739
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10740
  module.inputConstructor = api.CZRInput.extend({
10741
  setupSelect : function() {
10742
  api.czr_sektions.setupSelectInput.call( this );
10743
  }
10744
  });
10745
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10746
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10747
+ //run the parent initialize
10748
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10749
 
10750
  },//initialize
10751
 
10752
  CZRItemConstructor : {
10753
+ //overrides the parent ready
10754
  ready : function() {
10755
  var item = this;
10756
+ //wait for the input collection to be populated,
10757
+ //and then set the input visibility dependencies
10758
  item.inputCollection.bind( function( col ) {
10759
  if( _.isEmpty( col ) )
10760
  return;
10762
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10763
  }
10764
  });//item.inputCollection.bind()
10765
+
10766
+ //fire the parent
10767
  api.CZRItem.prototype.ready.call( item );
10768
  },
10769
+
10770
+
10771
+ //Fired when the input collection is populated
10772
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10773
  setInputVisibilityDeps : function() {
10774
  var item = this,
10775
  module = item.module;
10776
+
10777
+ //Internal item dependencies
10778
  item.czr_Input.each( function( input ) {
10779
  switch( input.id ) {
10780
  case 'use-custom-breakpoint' :
10787
  }
10788
  }//CZRItemConstructor
10789
  };
10790
+
10791
+
10792
+ //provides a description of each module
10793
+ //=> will determine :
10794
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10795
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10796
+ // , if crud, the item shall be removable
10797
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10798
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10799
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10800
  api.czrModuleMap = api.czrModuleMap || {};
10801
  $.extend( api.czrModuleMap, {
10802
  sek_global_breakpoint : {
10812
  },
10813
  });
10814
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10815
+ //extends api.CZRDynModule
10816
  ( function ( api, $, _ ) {
10817
  var Constructor = {
10818
  initialize: function( id, options ) {
10819
  var module = this;
10820
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10821
  module.inputConstructor = api.CZRInput.extend({
10822
  setupSelect : function() {
10823
  api.czr_sektions.setupSelectInput.call( this );
10824
  }
10825
  });
10826
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10827
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10828
+ //run the parent initialize
10829
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10830
 
10831
  },//initialize
10832
 
10833
  CZRItemConstructor : {
10834
+ //overrides the parent ready
10835
  ready : function() {
10836
  var item = this;
10837
+ //wait for the input collection to be populated,
10838
+ //and then set the input visibility dependencies
10839
  item.inputCollection.bind( function( col ) {
10840
  if( _.isEmpty( col ) )
10841
  return;
10843
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10844
  }
10845
  });//item.inputCollection.bind()
10846
+
10847
+ //fire the parent
10848
  api.CZRItem.prototype.ready.call( item );
10849
  },
10850
+
10851
+
10852
+ //Fired when the input collection is populated
10853
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
10854
  setInputVisibilityDeps : function() {
10855
  var item = this,
10856
  module = item.module;
10857
+
10858
+ //Internal item dependencies
10859
  item.czr_Input.each( function( input ) {
10860
  switch( input.id ) {
10861
  case 'use-custom-outer-width' :
10873
  }
10874
  }//CZRItemConstructor
10875
  };
10876
+
10877
+
10878
+ //provides a description of each module
10879
+ //=> will determine :
10880
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10881
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10882
+ // , if crud, the item shall be removable
10883
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10884
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10885
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10886
  api.czrModuleMap = api.czrModuleMap || {};
10887
  $.extend( api.czrModuleMap, {
10888
  sek_global_widths : {
10898
  },
10899
  });
10900
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10901
+ //extends api.CZRDynModule
10902
  ( function ( api, $, _ ) {
10903
+ //provides a description of each module
10904
+ //=> will determine :
10905
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10906
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10907
+ // , if crud, the item shall be removable
10908
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10909
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10910
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10911
  api.czrModuleMap = api.czrModuleMap || {};
10912
  $.extend( api.czrModuleMap, {
10913
  sek_global_performances : {
10914
+ //mthds : Constructor,
10915
  crud : false,
10916
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_global_performances', 'name' ),
10917
  has_mod_opt : false,
10923
  },
10924
  });
10925
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10926
+ //extends api.CZRDynModule
10927
  ( function ( api, $, _ ) {
10928
  var Constructor = {
10929
  initialize: function( id, options ) {
10930
  var module = this;
10931
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10932
  module.inputConstructor = api.CZRInput.extend({
10933
  setupSelect : function() {
10934
  api.czr_sektions.setupSelectInput.call( this );
10935
  }
10936
  });
10937
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10938
+ //module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10939
+ //run the parent initialize
10940
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10941
 
10942
  }//initialize
10943
  };
10944
+
10945
+ //provides a description of each module
10946
+ //=> will determine :
10947
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
10948
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
10949
+ // , if crud, the item shall be removable
10950
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
10951
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
10952
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
10953
  api.czrModuleMap = api.czrModuleMap || {};
10954
  $.extend( api.czrModuleMap, {
10955
  sek_global_header_footer : {
10965
  },
10966
  });
10967
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
10968
+ //extends api.CZRDynModule
10969
  ( function ( api, $, _ ) {
10970
  var Constructor = {
10971
  initialize: function( id, options ) {
10972
  var module = this;
10973
+ // // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
10974
+ // module.inputConstructor = api.CZRInput.extend({
10975
+ // setupSelect : function() {
10976
+ // api.czr_sektions.setupSelectInput.call( this );
10977
+ // }
10978
+ // });
10979
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
10980
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
10981
+ //run the parent initialize
10982
  api.CZRDynModule.prototype.initialize.call( module, id, options );
10983
 
10984
  },//initialize
10985
 
10986
  CZRItemConstructor : {
10987
+ //overrides the parent ready
10988
  ready : function() {
10989
  var item = this;
10990
+ //wait for the input collection to be populated,
10991
+ //and then set the input visibility dependencies
10992
  item.inputCollection.bind( function( col ) {
10993
  if( _.isEmpty( col ) )
10994
  return;
10996
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
10997
  }
10998
  });//item.inputCollection.bind()
10999
+
11000
+ //fire the parent
11001
  api.CZRItem.prototype.ready.call( item );
11002
  },
11003
+
11004
+
11005
+ //Fired when the input collection is populated
11006
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11007
  setInputVisibilityDeps : function() {
11008
  var item = this,
11009
  module = item.module;
11010
+
11011
+ //Internal item dependencies
11012
  item.czr_Input.each( function( input ) {
11013
  switch( input.id ) {
11014
  case 'enable' :
11043
  }
11044
  }//CZRItemConstructor
11045
  };
11046
+
11047
+
11048
+ //provides a description of each module
11049
+ //=> will determine :
11050
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11051
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11052
+ // , if crud, the item shall be removable
11053
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11054
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11055
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11056
  api.czrModuleMap = api.czrModuleMap || {};
11057
  $.extend( api.czrModuleMap, {
11058
  sek_global_recaptcha : {
11068
  },
11069
  });
11070
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
11071
+ //extends api.CZRDynModule
11072
  ( function ( api, $, _ ) {
11073
+ //provides a description of each module
11074
+ //=> will determine :
11075
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11076
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11077
+ // , if crud, the item shall be removable
11078
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11079
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11080
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11081
  api.czrModuleMap = api.czrModuleMap || {};
11082
  $.extend( api.czrModuleMap, {
11083
  sek_global_beta_features : {
11084
+ //mthds : Constructor,
11085
  crud : false,
11086
  name : api.czr_sektions.getRegisteredModuleProperty( 'sek_global_beta_features', 'name' ),
11087
  has_mod_opt : false,
11095
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
11096
  * IMAGE MAIN SETTINGS
11097
  /* ------------------------------------------------------------------------- */
11098
+ //global sektionsLocalizedData, serverControlParams
11099
+ //extends api.CZRDynModule
11100
  ( function ( api, $, _ ) {
11101
  var Constructor = {
11102
  initialize: function( id, options ) {
11103
  var module = this;
11104
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11105
  module.inputConstructor = api.CZRInput.extend({
11106
  setupSelect : function() {
11107
  api.czr_sektions.setupSelectInput.call( this );
11108
  }
11109
  });
11110
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11111
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
11112
+
11113
+ // run the parent initialize
11114
+ // Note : must be always invoked always after the input / item class extension
11115
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11116
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11117
+
11118
+ //SET THE CONTENT PICKER DEFAULT OPTIONS
11119
+ //@see ::setupContentPicker()
11120
  module.bind( 'set_default_content_picker_options', function( params ) {
11121
  params.defaultContentPickerOption.defaultOption = {
11122
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
11129
  return params;
11130
  });
11131
  },//initialize
11132
+
11133
+
11134
+ // _isChecked : function( v ) {
11135
+ // return 0 !== v && '0' !== v && false !== v && 'off' !== v;
11136
+ // },
11137
+ //////////////////////////////////////////////////////////
11138
+ /// ITEM CONSTRUCTOR
11139
+ //////////////////////////////////////////
11140
  CZRItemConstructor : {
11141
+ //overrides the parent ready
11142
  ready : function() {
11143
  var item = this;
11144
+ //wait for the input collection to be populated,
11145
+ //and then set the input visibility dependencies
11146
  item.inputCollection.bind( function( col ) {
11147
  if( _.isEmpty( col ) )
11148
  return;
11150
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
11151
  }
11152
  });//item.inputCollection.bind()
11153
+
11154
+ //fire the parent
11155
  api.CZRItem.prototype.ready.call( item );
11156
  },
11157
+
11158
+
11159
+ //Fired when the input collection is populated
11160
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11161
  setInputVisibilityDeps : function() {
11162
  var item = this,
11163
  module = item.module;
11164
+
11165
+ //Internal item dependencies
11166
  item.czr_Input.each( function( input ) {
11167
  switch( input.id ) {
11168
  case 'img' :
11229
  },//CZRItemConstructor
11230
 
11231
  };//Constructor
11232
+
11233
+ //provides a description of each module
11234
+ //=> will determine :
11235
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11236
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11237
+ // , if crud, the item shall be removable
11238
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11239
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11240
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11241
  api.czrModuleMap = api.czrModuleMap || {};
11242
  $.extend( api.czrModuleMap, {
11243
  czr_image_main_settings_child : {
11262
  /* ------------------------------------------------------------------------- *
11263
  * IMAGE BORDERS AND BORDER RADIUS
11264
  /* ------------------------------------------------------------------------- */
11265
+ //global sektionsLocalizedData, serverControlParams
11266
+ //extends api.CZRDynModule
11267
  ( function ( api, $, _ ) {
11268
  var Constructor = {
11269
  initialize: function( id, options ) {
11270
  var module = this;
11271
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11272
  module.inputConstructor = api.CZRInput.extend({
11273
  setupSelect : function() {
11274
  api.czr_sektions.setupSelectInput.call( this );
11275
  }
11276
  });
11277
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11278
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
11279
+
11280
+ // run the parent initialize
11281
+ // Note : must be always invoked always after the input / item class extension
11282
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11283
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11284
  },//initialize
11285
+
11286
+
11287
+ // _isChecked : function( v ) {
11288
+ // return 0 !== v && '0' !== v && false !== v && 'off' !== v;
11289
+ // },
11290
+ //////////////////////////////////////////////////////////
11291
+ /// ITEM CONSTRUCTOR
11292
+ //////////////////////////////////////////
11293
  CZRItemConstructor : {
11294
+ //overrides the parent ready
11295
  ready : function() {
11296
  var item = this;
11297
+ //wait for the input collection to be populated,
11298
+ //and then set the input visibility dependencies
11299
  item.inputCollection.bind( function( col ) {
11300
  if( _.isEmpty( col ) )
11301
  return;
11303
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
11304
  }
11305
  });//item.inputCollection.bind()
11306
+
11307
+ //fire the parent
11308
  api.CZRItem.prototype.ready.call( item );
11309
  },
11310
+
11311
+
11312
+ //Fired when the input collection is populated
11313
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11314
  setInputVisibilityDeps : function() {
11315
  var item = this,
11316
  module = item.module;
11317
+ // input controller instance == this
11318
  var scheduleVisibilityOfInputId = function( controlledInputId, visibilityCallBack ) {
11319
+ //Fire on init
11320
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
11321
+ //React on change
11322
  this.bind( function( to ) {
11323
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
11324
  });
11325
  };
11326
+ //Internal item dependencies
11327
  item.czr_Input.each( function( input ) {
11328
  switch( input.id ) {
11329
  case 'border-type' :
11341
  },//CZRItemConstructor
11342
 
11343
  };//Constructor
11344
+
11345
+ //provides a description of each module
11346
+ //=> will determine :
11347
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11348
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11349
+ // , if crud, the item shall be removable
11350
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11351
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11352
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11353
  api.czrModuleMap = api.czrModuleMap || {};
11354
  $.extend( api.czrModuleMap, {
11355
  czr_image_borders_corners_child : {
11363
  },
11364
  });
11365
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
11366
+ //extends api.CZRDynModule
11367
  ( function ( api, $, _ ) {
11368
  var Constructor = {
11369
  initialize: function( id, options ) {
11370
+ //console.log('INITIALIZING IMAGE MODULE', id, options );
11371
  var module = this;
11372
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11373
  module.inputConstructor = api.CZRInput.extend( module.CZRTextEditorInputMths || {} );
11374
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11375
+ // module.itemConstructor = api.CZRItem.extend( module.CZRSocialsItem || {} );
11376
+
11377
+ // run the parent initialize
11378
+ // Note : must be always invoked always after the input / item class extension
11379
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11380
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11381
  },//initialize
11382
 
11383
  CZRTextEditorInputMths : {
11384
  initialize : function( name, options ) {
11385
  var input = this;
11386
+ // Expand the editor when ready
11387
  if ( 'tiny_mce_editor' == input.type ) {
11388
  input.isReady.then( function() {
11389
  input.container.find('[data-czr-action="open-tinymce-editor"]').trigger('click');
11396
  api.czr_sektions.setupSelectInput.call( this );
11397
  }
11398
  },//CZRTextEditorInputMths
11399
+
11400
+ // CZRSocialsItem : { },//CZRSocialsItem
11401
  };//Constructor
11402
+
11403
+
11404
+ //provides a description of each module
11405
+ //=> will determine :
11406
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11407
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11408
+ // , if crud, the item shall be removable
11409
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11410
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11411
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11412
  api.czrModuleMap = api.czrModuleMap || {};
11413
  $.extend( api.czrModuleMap, {
11414
  czr_tinymce_child : {
11422
  },
11423
  });
11424
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
11425
+ //extends api.CZRDynModule
11426
  ( function ( api, $, _ ) {
11427
+ //provides a description of each module
11428
+ //=> will determine :
11429
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11430
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11431
+ // , if crud, the item shall be removable
11432
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11433
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11434
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11435
  api.czrModuleMap = api.czrModuleMap || {};
11436
  $.extend( api.czrModuleMap, {
11437
  czr_simple_html_module : {
11438
+ //mthds : SimpleHtmlModuleConstructor,
11439
  crud : false,
11440
  name : api.czr_sektions.getRegisteredModuleProperty( 'czr_simple_html_module', 'name' ),
11441
  has_mod_opt : false,
11445
  },
11446
  });
11447
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
11448
+ //extends api.CZRDynModule
11449
  ( function ( api, $, _ ) {
11450
  var FeaturedPagesConstruct = {
11451
  initialize: function( id, options ) {
11452
+ //console.log('INITIALIZING FP MODULE', id, options );
11453
  var module = this;
11454
+
11455
+
11456
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11457
  module.inputConstructor = api.CZRInput.extend({
11458
  setupSelect : function() {
11459
  api.czr_sektions.setupSelectInput.call( this );
11460
  }
11461
  });
11462
+
11463
+ // //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11464
  module.itemConstructor = api.CZRItem.extend( module.CZRFPItemConstructor || {} );
11465
+
11466
+ // run the parent initialize
11467
+ // Note : must be always invoked always after the input / item class extension
11468
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11469
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11470
  },//initialize
11471
+
11472
+ //////////////////////////////////////////////////////////
11473
+ /// ITEM CONSTRUCTOR
11474
+ //////////////////////////////////////////
11475
  CZRFPItemConstructor : {
11476
+ //overrides the parent ready
11477
  ready : function() {
11478
  var item = this;
11479
+ //wait for the input collection to be populated,
11480
+ //and then set the input visibility dependencies
11481
  item.inputCollection.bind( function( col ) {
11482
  if( _.isEmpty( col ) )
11483
  return;
11485
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
11486
  }
11487
  });//item.inputCollection.bind()
11488
+
11489
+ //fire the parent
11490
  api.CZRItem.prototype.ready.call( item );
11491
  },
11492
+ //Fired when the input collection is populated
11493
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11494
  setInputVisibilityDeps : function() {
11495
  var item = this,
11496
  module = item.module;
11497
+
11498
+ //Internal item dependencies
11499
  item.czr_Input.each( function( input ) {
11500
  switch( input.id ) {
11501
  case 'img-type' :
11539
  }
11540
  },//CZRFPItemConstructor
11541
  };//FeaturedPagesConstruct
11542
+
11543
+ //provides a description of each module
11544
+ //=> will determine :
11545
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11546
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11547
+ // , if crud, the item shall be removable
11548
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11549
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11550
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11551
  api.czrModuleMap = api.czrModuleMap || {};
11552
  $.extend( api.czrModuleMap, {
11553
  czr_featured_pages_module : {
11563
  },
11564
  });
11565
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
11566
+ //extends api.CZRDynModule
11567
  ( function ( api, $, _ ) {
11568
+ //ICON MODULE
11569
  var Constructor = {
11570
  initialize: function( id, options ) {
11571
+ //console.log('INITIALIZING IMAGE MODULE', id, options );
11572
  var module = this;
11573
+
11574
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11575
  module.inputConstructor = api.CZRInput.extend({
11576
  setupSelect : function() {
11577
  api.czr_sektions.setupSelectInput.call( this );
11578
  }
11579
  });
11580
+
11581
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11582
  module.itemConstructor = api.CZRItem.extend( module.CZRIconItemConstructor || {} );
11583
+
11584
+
11585
+ //SET THE CONTENT PICKER DEFAULT OPTIONS
11586
+ //@see ::setupContentPicker()
11587
  module.bind( 'set_default_content_picker_options', function( params ) {
11588
  params.defaultContentPickerOption.defaultOption = {
11589
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
11595
  };
11596
  return params;
11597
  });
11598
+
11599
+ // run the parent initialize
11600
+ // Note : must be always invoked always after the input / item class extension
11601
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11602
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11603
 
11604
  },//initialize
11605
 
11606
  /* Helpers */
11607
+
11608
+ //////////////////////////////////////////////////////////
11609
+ /// ITEM CONSTRUCTOR
11610
+ //////////////////////////////////////////
11611
  CZRIconItemConstructor : {
11612
+ //overrides the parent ready
11613
  ready : function() {
11614
  var item = this;
11615
+ //wait for the input collection to be populated,
11616
+ //and then set the input visibility dependencies
11617
  item.inputCollection.bind( function( col ) {
11618
  if( _.isEmpty( col ) )
11619
  return;
11621
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
11622
  }
11623
  });//item.inputCollection.bind()
11624
+
11625
+ //fire the parent
11626
  api.CZRItem.prototype.ready.call( item );
11627
  },
11628
+
11629
+
11630
+ //Fired when the input collection is populated
11631
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11632
  setInputVisibilityDeps : function() {
11633
  var item = this,
11634
  module = item.module;
11635
+
11636
+ //Internal item dependencies
11637
  item.czr_Input.each( function( input ) {
11638
  switch( input.id ) {
11639
  case 'link-to' :
11674
  },//CZRIconItemConstructor
11675
 
11676
  };//Constructor
11677
+
11678
+
11679
+ //provides a description of each module
11680
+ //=> will determine :
11681
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11682
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11683
+ // , if crud, the item shall be removable
11684
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11685
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11686
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11687
  api.czrModuleMap = api.czrModuleMap || {};
11688
  $.extend( api.czrModuleMap, {
11689
  czr_icon_settings_child : {
11697
  },
11698
  });
11699
  })( wp.customize , jQuery, _ );
11700
+
11701
+
11702
+
11703
+
11704
+
11705
+
11706
+
11707
+ //global sektionsLocalizedData, serverControlParams
11708
+ //extends api.CZRDynModule
11709
  ( function ( api, $, _ ) {
11710
+ //BUTTON MODULE
11711
  var Constructor = {
11712
  initialize: function( id, options ) {
11713
  var module = this;
11714
+
11715
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11716
  module.inputConstructor = api.CZRInput.extend({
11717
  setupSelect : function() {
11718
  api.czr_sektions.setupSelectInput.call( this );
11719
  }
11720
  });
11721
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11722
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
11723
+
11724
+ // run the parent initialize
11725
+ // Note : must be always invoked always after the input / item class extension
11726
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11727
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11728
  },//initialize
11729
 
11730
  CZRItemConstructor : {
11731
+ //overrides the parent ready
11732
  ready : function() {
11733
  var item = this;
11734
+ //wait for the input collection to be populated,
11735
+ //and then set the input visibility dependencies
11736
  item.inputCollection.bind( function( col ) {
11737
  if( _.isEmpty( col ) )
11738
  return;
11740
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
11741
  }
11742
  });//item.inputCollection.bind()
11743
+
11744
+ //fire the parent
11745
  api.CZRItem.prototype.ready.call( item );
11746
  },
11747
+
11748
+
11749
+ //Fired when the input collection is populated
11750
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11751
  setInputVisibilityDeps : function() {
11752
  var item = this,
11753
  module = item.module;
11754
+ // input controller instance == this
11755
  var scheduleVisibilityOfInputId = function( controlledInputId, visibilityCallBack ) {
11756
+ //Fire on init
11757
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
11758
+ //React on change
11759
  this.bind( function( to ) {
11760
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
11761
  });
11762
  };
11763
+ //Internal item dependencies
11764
  item.czr_Input.each( function( input ) {
11765
  switch( input.id ) {
11766
  case 'border-type' :
11777
  }
11778
  }//CZRItemConstructor
11779
  };// Constructor
11780
+ //provides a description of each module
11781
+ //=> will determine :
11782
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11783
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11784
+ // , if crud, the item shall be removable
11785
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11786
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11787
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11788
  api.czrModuleMap = api.czrModuleMap || {};
11789
  $.extend( api.czrModuleMap, {
11790
  czr_icon_spacing_border_child: {
11800
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
11801
  * HEADING MAIN CHILD
11802
  /* ------------------------------------------------------------------------- */
11803
+ //global sektionsLocalizedData, serverControlParams
11804
+ //extends api.CZRDynModule
11805
  ( function ( api, $, _ ) {
11806
+ //HEADING MODULE
11807
  var Constructor = {
11808
  initialize: function( id, options ) {
11809
  var module = this;
11810
+
11811
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11812
  module.inputConstructor = api.CZRInput.extend( module.CZRHeadingInputMths || {} );
11813
+
11814
+
11815
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11816
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
11817
+
11818
+ // run the parent initialize
11819
+ // Note : must be always invoked always after the input / item class extension
11820
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11821
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11822
+
11823
+ //SET THE CONTENT PICKER DEFAULT OPTIONS
11824
+ //@see ::setupContentPicker()
11825
  module.bind( 'set_default_content_picker_options', function( params ) {
11826
  params.defaultContentPickerOption.defaultOption = {
11827
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
11840
  api.czr_sektions.setupSelectInput.call( this );
11841
  }
11842
  },//CZRHeadingsInputMths
11843
+
11844
+ // _isChecked : function( v ) {
11845
+ // return 0 !== v && '0' !== v && false !== v && 'off' !== v;
11846
+ // },
11847
+ //////////////////////////////////////////////////////////
11848
+ /// ITEM CONSTRUCTOR
11849
+ //////////////////////////////////////////
11850
  CZRItemConstructor : {
11851
+ //overrides the parent ready
11852
  ready : function() {
11853
  var item = this;
11854
+ //wait for the input collection to be populated,
11855
+ //and then set the input visibility dependencies
11856
  item.inputCollection.bind( function( col ) {
11857
  if( _.isEmpty( col ) )
11858
  return;
11860
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
11861
  }
11862
  });//item.inputCollection.bind()
11863
+
11864
+ //fire the parent
11865
  api.CZRItem.prototype.ready.call( item );
11866
  },
11867
+
11868
+
11869
+ //Fired when the input collection is populated
11870
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
11871
  setInputVisibilityDeps : function() {
11872
  var item = this,
11873
  module = item.module;
11874
+
11875
+ //Internal item dependencies
11876
  item.czr_Input.each( function( input ) {
11877
  switch( input.id ) {
11878
  case 'link-to' :
11906
  }//setInputVisibilityDeps
11907
  },//CZRItemConstructor
11908
  };//Constructor
11909
+
11910
+
11911
+ //provides a description of each module
11912
+ //=> will determine :
11913
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11914
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11915
+ // , if crud, the item shall be removable
11916
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11917
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11918
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11919
  api.czrModuleMap = api.czrModuleMap || {};
11920
  $.extend( api.czrModuleMap, {
11921
  czr_heading_child : {
11934
  * HEADING SPACING
11935
  /* ------------------------------------------------------------------------- */
11936
  ( function ( api, $, _ ) {
11937
+ //HEADING MODULE
11938
  var Constructor = {
11939
  initialize: function( id, options ) {
11940
  var module = this;
11941
+
11942
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11943
  module.inputConstructor = api.CZRInput.extend( module.CZRHeadingInputMths || {} );
11944
+
11945
+
11946
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11947
+ //module.itemConstructor = api.CZRItem.extend( module.CZRItemMethods || {} );
11948
+
11949
+ // run the parent initialize
11950
+ // Note : must be always invoked always after the input / item class extension
11951
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
11952
  api.CZRDynModule.prototype.initialize.call( module, id, options );
11953
  },//initialize
11954
 
11958
  }
11959
  },//CZRHeadingsInputMths
11960
  };//Constructor
11961
+
11962
+
11963
+ //provides a description of each module
11964
+ //=> will determine :
11965
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
11966
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
11967
+ // , if crud, the item shall be removable
11968
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
11969
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
11970
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
11971
  api.czrModuleMap = api.czrModuleMap || {};
11972
  $.extend( api.czrModuleMap, {
11973
  czr_heading_spacing_child : {
11981
  }
11982
  });
11983
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
11984
+ //extends api.CZRDynModule
11985
  ( function ( api, $, _ ) {
11986
+ //DIVIDER MODULE
11987
  var DividerModuleConstructor = {
11988
  initialize: function( id, options ) {
11989
+ //console.log('INITIALIZING IMAGE MODULE', id, options );
11990
  var module = this;
11991
+
11992
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
11993
  module.inputConstructor = api.CZRInput.extend( module.CZRDividerInputMths || {} );
11994
+
11995
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
11996
+ //module.itemConstructor = api.CZRItem.extend( module.CZRItemMethods || {} );
11997
+
11998
+ // run the parent initialize
11999
+ // Note : must be always invoked always after the input / item class extension
12000
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12001
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12002
  },//initialize
12003
 
12008
  }
12009
  },//CZRDividerInputMths
12010
  };//DividerModuleConstructor
12011
+
12012
+
12013
+
12014
+ //provides a description of each module
12015
+ //=> will determine :
12016
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12017
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12018
+ // , if crud, the item shall be removable
12019
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12020
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12021
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12022
  api.czrModuleMap = api.czrModuleMap || {};
12023
  $.extend( api.czrModuleMap, {
12024
  czr_divider_module : {
12032
  }
12033
  });
12034
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12035
+ //extends api.CZRDynModule
12036
  ( function ( api, $, _ ) {
12037
+ //provides a description of each module
12038
+ //=> will determine :
12039
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12040
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12041
+ // , if crud, the item shall be removable
12042
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12043
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12044
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12045
  api.czrModuleMap = api.czrModuleMap || {};
12046
  $.extend( api.czrModuleMap, {
12047
  czr_spacer_module : {
12048
+ //mthds : ModuleConstructor,
12049
  crud : false,
12050
  name : api.czr_sektions.getRegisteredModuleProperty( 'czr_spacer_module', 'name' ),
12051
  has_mod_opt : false,
12055
  }
12056
  });
12057
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12058
+ //extends api.CZRDynModule
12059
  ( function ( api, $, _ ) {
12060
+ //provides a description of each module
12061
+ //=> will determine :
12062
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12063
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12064
+ // , if crud, the item shall be removable
12065
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12066
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12067
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12068
  api.czrModuleMap = api.czrModuleMap || {};
12069
  $.extend( api.czrModuleMap, {
12070
  czr_map_module : {
12071
+ //mthds : ModuleConstructor,
12072
  crud : false,
12073
  name : api.czr_sektions.getRegisteredModuleProperty( 'czr_map_module', 'name' ),
12074
  has_mod_opt : false,
12078
  }
12079
  });
12080
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12081
+ //extends api.CZRDynModule
12082
  /* ------------------------------------------------------------------------- *
12083
  * QUOTE DESIGN
12084
  /* ------------------------------------------------------------------------- */
12085
+ //global sektionsLocalizedData, serverControlParams
12086
+ //extends api.CZRDynModule
12087
  ( function ( api, $, _ ) {
12088
+ //BUTTON MODULE
12089
  var Constructor = {
12090
  initialize: function( id, options ) {
12091
  var module = this;
12092
+
12093
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12094
  module.inputConstructor = api.CZRInput.extend({
12095
  setupSelect : function() {
12096
  api.czr_sektions.setupSelectInput.call( this );
12097
  }
12098
  });
12099
+
12100
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12101
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
12102
+
12103
+ // run the parent initialize
12104
+ // Note : must be always invoked always after the input / item class extension
12105
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12106
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12107
 
12108
  },//initialize
12109
+
12110
+ //////////////////////////////////////////////////////////
12111
+ /// ITEM CONSTRUCTOR
12112
+ //////////////////////////////////////////
12113
  CZRButtonItemConstructor : {
12114
+ //overrides the parent ready
12115
  ready : function() {
12116
  var item = this;
12117
+ //wait for the input collection to be populated,
12118
+ //and then set the input visibility dependencies
12119
  item.inputCollection.bind( function( col ) {
12120
  if( _.isEmpty( col ) )
12121
  return;
12123
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
12124
  }
12125
  });//item.inputCollection.bind()
12126
+
12127
+ //fire the parent
12128
  api.CZRItem.prototype.ready.call( item );
12129
  },
12130
+
12131
+ //Fired when the input collection is populated
12132
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
12133
  setInputVisibilityDeps : function() {
12134
  var item = this,
12135
  module = item.module;
12136
+
12137
+ //Internal item dependencies
12138
  item.czr_Input.each( function( input ) {
12139
  switch( input.id ) {
12140
  case 'quote_design' :
12158
  }
12159
  }
12160
  };
12161
+ //provides a description of each module
12162
+ //=> will determine :
12163
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12164
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12165
+ // , if crud, the item shall be removable
12166
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12167
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12168
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12169
  api.czrModuleMap = api.czrModuleMap || {};
12170
  $.extend( api.czrModuleMap, {
12171
  czr_quote_design_child : {
12192
  /* ------------------------------------------------------------------------- *
12193
  * QUOTE CONTENT
12194
  /* ------------------------------------------------------------------------- */
12195
+ //global sektionsLocalizedData, serverControlParams
12196
+ //extends api.CZRDynModule
12197
  ( function ( api, $, _ ) {
12198
+ //BUTTON MODULE
12199
  var Constructor = {
12200
  initialize: function( id, options ) {
12201
  var module = this;
12202
+
12203
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12204
  module.inputConstructor = api.CZRInput.extend({
12205
  setupSelect : function() {
12206
  api.czr_sektions.setupSelectInput.call( this );
12207
  }
12208
  });
12209
+
12210
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12211
+ //module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
12212
+
12213
+ // run the parent initialize
12214
+ // Note : must be always invoked always after the input / item class extension
12215
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12216
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12217
 
12218
  },//initialize
12219
  };
12220
+ //provides a description of each module
12221
+ //=> will determine :
12222
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12223
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12224
+ // , if crud, the item shall be removable
12225
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12226
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12227
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12228
  api.czrModuleMap = api.czrModuleMap || {};
12229
  $.extend( api.czrModuleMap, {
12230
  czr_quote_quote_child : {
12247
  /* ------------------------------------------------------------------------- *
12248
  * CITE CONTENT
12249
  /* ------------------------------------------------------------------------- */
12250
+ //global sektionsLocalizedData, serverControlParams
12251
+ //extends api.CZRDynModule
12252
  ( function ( api, $, _ ) {
12253
+ //BUTTON MODULE
12254
  var Constructor = {
12255
  initialize: function( id, options ) {
12256
  var module = this;
12257
+
12258
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12259
  module.inputConstructor = api.CZRInput.extend({
12260
  setupSelect : function() {
12261
  api.czr_sektions.setupSelectInput.call( this );
12262
  }
12263
  });
12264
+
12265
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12266
+ //module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
12267
+
12268
+ // run the parent initialize
12269
+ // Note : must be always invoked always after the input / item class extension
12270
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12271
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12272
 
12273
  },//initialize
12274
  };
12275
+ //provides a description of each module
12276
+ //=> will determine :
12277
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12278
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12279
+ // , if crud, the item shall be removable
12280
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12281
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12282
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12283
  api.czrModuleMap = api.czrModuleMap || {};
12284
  $.extend( api.czrModuleMap, {
12285
  czr_quote_cite_child : {
12296
  /* ------------------------------------------------------------------------- *
12297
  * BUTTON CONTENT
12298
  /* ------------------------------------------------------------------------- */
12299
+ //global sektionsLocalizedData, serverControlParams
12300
+ //extends api.CZRDynModule
12301
  ( function ( api, $, _ ) {
12302
+ //BUTTON MODULE
12303
  var Constructor = {
12304
  initialize: function( id, options ) {
12305
  var module = this;
12306
+
12307
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12308
  module.inputConstructor = api.CZRInput.extend({
12309
  setupSelect : function() {
12310
  api.czr_sektions.setupSelectInput.call( this );
12311
  }
12312
  });
12313
+
12314
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12315
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
12316
+
12317
+ //SET THE CONTENT PICKER DEFAULT OPTIONS
12318
+ //@see ::setupContentPicker()
12319
  module.bind( 'set_default_content_picker_options', function( params ) {
12320
  params.defaultContentPickerOption.defaultOption = {
12321
  'title' : '<span style="font-weight:bold">' + sektionsLocalizedData.i18n['Set a custom url'] + '</span>',
12327
  };
12328
  return params;
12329
  });
12330
+
12331
+ // run the parent initialize
12332
+ // Note : must be always invoked always after the input / item class extension
12333
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12334
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12335
 
12336
  },//initialize
12337
+
12338
+ //////////////////////////////////////////////////////////
12339
+ /// ITEM CONSTRUCTOR
12340
+ //////////////////////////////////////////
12341
  CZRButtonItemConstructor : {
12342
+ //overrides the parent ready
12343
  ready : function() {
12344
  var item = this;
12345
+ //wait for the input collection to be populated,
12346
+ //and then set the input visibility dependencies
12347
  item.inputCollection.bind( function( col ) {
12348
  if( _.isEmpty( col ) )
12349
  return;
12351
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
12352
  }
12353
  });//item.inputCollection.bind()
12354
+
12355
+ //fire the parent
12356
  api.CZRItem.prototype.ready.call( item );
12357
  },
12358
+
12359
+ //Fired when the input collection is populated
12360
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
12361
  setInputVisibilityDeps : function() {
12362
  var item = this,
12363
  module = item.module;
12364
+
12365
+ //Internal item dependencies
12366
  item.czr_Input.each( function( input ) {
12367
  switch( input.id ) {
12368
  case 'link-to' :
12398
  }
12399
  }
12400
  };
12401
+ //provides a description of each module
12402
+ //=> will determine :
12403
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12404
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12405
+ // , if crud, the item shall be removable
12406
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12407
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12408
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12409
  api.czrModuleMap = api.czrModuleMap || {};
12410
  $.extend( api.czrModuleMap, {
12411
  czr_btn_content_child : {
12432
  /* ------------------------------------------------------------------------- *
12433
  * BUTTON DESIGN
12434
  /* ------------------------------------------------------------------------- */
12435
+ //global sektionsLocalizedData, serverControlParams
12436
+ //extends api.CZRDynModule
12437
  ( function ( api, $, _ ) {
12438
+ //BUTTON MODULE
12439
  var Constructor = {
12440
  initialize: function( id, options ) {
12441
  var module = this;
12442
+
12443
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12444
  module.inputConstructor = api.CZRInput.extend({
12445
  setupSelect : function() {
12446
  api.czr_sektions.setupSelectInput.call( this );
12447
  }
12448
  });
12449
+
12450
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12451
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
12452
+
12453
+ // run the parent initialize
12454
+ // Note : must be always invoked always after the input / item class extension
12455
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12456
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12457
 
12458
  },//initialize
12459
+
12460
+ //////////////////////////////////////////////////////////
12461
+ /// ITEM CONSTRUCTOR
12462
+ //////////////////////////////////////////
12463
  CZRButtonItemConstructor : {
12464
+ //overrides the parent ready
12465
  ready : function() {
12466
  var item = this;
12467
+ //wait for the input collection to be populated,
12468
+ //and then set the input visibility dependencies
12469
  item.inputCollection.bind( function( col ) {
12470
  if( _.isEmpty( col ) )
12471
  return;
12473
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
12474
  }
12475
  });//item.inputCollection.bind()
12476
+
12477
+ //fire the parent
12478
  api.CZRItem.prototype.ready.call( item );
12479
  },
12480
+
12481
+ //Fired when the input collection is populated
12482
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
12483
  setInputVisibilityDeps : function() {
12484
  var item = this,
12485
  module = item.module;
12486
+ // input controller instance == this
12487
  var scheduleVisibilityOfInputId = function( controlledInputId, visibilityCallBack ) {
12488
+ //Fire on init
12489
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
12490
+ //React on change
12491
  this.bind( function( to ) {
12492
  item.czr_Input( controlledInputId ).visible( visibilityCallBack() );
12493
  });
12494
  };
12495
+ //Internal item dependencies
12496
  item.czr_Input.each( function( input ) {
12497
  switch( input.id ) {
12498
  case 'use_custom_bg_color_on_hover' :
12527
  }
12528
  }
12529
  };
12530
+ //provides a description of each module
12531
+ //=> will determine :
12532
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12533
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12534
+ // , if crud, the item shall be removable
12535
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12536
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12537
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12538
  api.czrModuleMap = api.czrModuleMap || {};
12539
  $.extend( api.czrModuleMap, {
12540
  czr_btn_design_child : {
12550
  })( wp.customize , jQuery, _ );/* ------------------------------------------------------------------------- *
12551
  * MENU CONTENT
12552
  /* ------------------------------------------------------------------------- */
12553
+ //global sektionsLocalizedData, serverControlParams
12554
+ //extends api.CZRDynModule
12555
  ( function ( api, $, _ ) {
12556
  var Constructor = {
12557
  initialize: function( id, options ) {
12558
  var module = this;
12559
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12560
  module.inputConstructor = api.CZRInput.extend({
12561
  setupSelect : function() {
12562
  api.czr_sektions.setupSelectInput.call( this );
12563
  }
12564
  });
12565
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12566
+ //module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
12567
+ // run the parent initialize
12568
+ // Note : must be always invoked always after the input / item class extension
12569
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12570
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12571
  },//initialize
12572
+ };// Constructor
12573
+ //provides a description of each module
12574
+ //=> will determine :
12575
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12576
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12577
+ // , if crud, the item shall be removable
12578
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12579
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12580
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
 
 
 
 
 
 
 
 
 
 
 
 
 
12581
  api.czrModuleMap = api.czrModuleMap || {};
12582
  $.extend( api.czrModuleMap, {
12583
  czr_menu_content_child : {
12590
  defaultItemModel : api.czr_sektions.getDefaultItemModelFromRegisteredModuleData( 'czr_menu_content_child' )
12591
  }
12592
  });
12593
+ })( wp.customize , jQuery, _ );
12594
+
12595
+
12596
+ /* ------------------------------------------------------------------------- *
12597
+ * MENU OPTIONS FOR MOBILE DEVICES
12598
+ /* ------------------------------------------------------------------------- */
12599
+ //global sektionsLocalizedData, serverControlParams
12600
+ //extends api.CZRDynModule
12601
+ ( function ( api, $, _ ) {
12602
+ //provides a description of each module
12603
+ //=> will determine :
12604
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12605
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12606
+ // , if crud, the item shall be removable
12607
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12608
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12609
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12610
+ api.czrModuleMap = api.czrModuleMap || {};
12611
+ $.extend( api.czrModuleMap, {
12612
+ czr_menu_mobile_options : {
12613
+ //mthds : Constructor,
12614
+ crud : false,
12615
+ name : api.czr_sektions.getRegisteredModuleProperty( 'czr_menu_mobile_options', 'name' ),
12616
+ has_mod_opt : false,
12617
+ ready_on_section_expanded : true,
12618
+ ready_on_control_event : 'sek-accordion-expanded',// triggered in ::scheduleModuleAccordion()
12619
+ defaultItemModel : api.czr_sektions.getDefaultItemModelFromRegisteredModuleData( 'czr_menu_mobile_options' )
12620
+ }
12621
+ });
12622
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12623
+ //extends api.CZRDynModule
12624
  ( function ( api, $, _ ) {
12625
+ //BUTTON MODULE
12626
  var Constructor = {
12627
  initialize: function( id, options ) {
12628
  var module = this;
12629
+
12630
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12631
  module.inputConstructor = api.CZRInput.extend({
12632
  setupSelect : function() {
12633
  api.czr_sektions.setupSelectInput.call( this );
12634
  }
12635
  });
12636
+
12637
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12638
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
12639
+
12640
+ // run the parent initialize
12641
+ // Note : must be always invoked always after the input / item class extension
12642
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12643
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12644
 
12645
  },//initialize
12646
+
12647
+ //////////////////////////////////////////////////////////
12648
+ /// ITEM CONSTRUCTOR
12649
+ //////////////////////////////////////////
12650
  CZRItemConstructor : {
12651
+ //overrides the parent ready
12652
  ready : function() {
12653
  var item = this;
12654
+ //wait for the input collection to be populated,
12655
+ //and then set the input visibility dependencies
12656
  item.inputCollection.bind( function( col ) {
12657
  if( _.isEmpty( col ) )
12658
  return;
12660
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
12661
  }
12662
  });//item.inputCollection.bind()
12663
+
12664
+ //fire the parent
12665
  api.CZRItem.prototype.ready.call( item );
12666
  },
12667
+
12668
+ //Fired when the input collection is populated
12669
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
12670
  setInputVisibilityDeps : function() {
12671
  var item = this,
12672
  module = item.module;
12673
+
12674
+ //Internal item dependencies
12675
  item.czr_Input.each( function( input ) {
12676
  switch( input.id ) {
12677
  case 'show_name_field' :
12713
  }
12714
  }
12715
  };
12716
+ //provides a description of each module
12717
+ //=> will determine :
12718
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12719
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12720
+ // , if crud, the item shall be removable
12721
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12722
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12723
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12724
  api.czrModuleMap = api.czrModuleMap || {};
12725
  $.extend( api.czrModuleMap, {
12726
  czr_simple_form_fields_child: {
12734
  }
12735
  });
12736
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12737
+ //extends api.CZRDynModule
12738
  ( function ( api, $, _ ) {
12739
+ //BUTTON MODULE
12740
  var Constructor = {
12741
  initialize: function( id, options ) {
12742
  var module = this;
12743
+
12744
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12745
  module.inputConstructor = api.CZRInput.extend({
12746
  setupSelect : function() {
12747
  api.czr_sektions.setupSelectInput.call( this );
12748
  }
12749
  });
12750
+
12751
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12752
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
12753
+
12754
+ // run the parent initialize
12755
+ // Note : must be always invoked always after the input / item class extension
12756
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12757
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12758
 
12759
  },//initialize
12760
+
12761
+ //////////////////////////////////////////////////////////
12762
+ /// ITEM CONSTRUCTOR
12763
+ //////////////////////////////////////////
12764
  CZRItemConstructor : {
12765
+ //overrides the parent ready
12766
  ready : function() {
12767
  var item = this;
12768
+ //wait for the input collection to be populated,
12769
+ //and then set the input visibility dependencies
12770
  item.inputCollection.bind( function( col ) {
12771
  if( _.isEmpty( col ) )
12772
  return;
12774
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
12775
  }
12776
  });//item.inputCollection.bind()
12777
+
12778
+ //fire the parent
12779
  api.CZRItem.prototype.ready.call( item );
12780
  },
12781
+
12782
+ //Fired when the input collection is populated
12783
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
12784
  setInputVisibilityDeps : function() {
12785
  var item = this,
12786
  module = item.module;
12787
+ //Internal item dependencies
12788
  item.czr_Input.each( function( input ) {
12789
  switch( input.id ) {
12790
  case 'border-type' :
12801
  }
12802
  }
12803
  };
12804
+ //provides a description of each module
12805
+ //=> will determine :
12806
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12807
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12808
+ // , if crud, the item shall be removable
12809
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12810
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12811
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12812
  api.czrModuleMap = api.czrModuleMap || {};
12813
  $.extend( api.czrModuleMap, {
12814
  czr_simple_form_design_child: {
12822
  }
12823
  });
12824
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12825
+ //extends api.CZRDynModule
12826
  ( function ( api, $, _ ) {
12827
+ //BUTTON MODULE
12828
  var Constructor = {
12829
  initialize: function( id, options ) {
12830
  var module = this;
12831
+
12832
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12833
  module.inputConstructor = api.CZRInput.extend({
12834
  setupSelect : function() {
12835
  api.czr_sektions.setupSelectInput.call( this );
12836
  }
12837
  });
12838
+
12839
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12840
  module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
12841
+
12842
+ // run the parent initialize
12843
+ // Note : must be always invoked always after the input / item class extension
12844
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12845
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12846
 
12847
  },//initialize
12848
+
12849
+ //////////////////////////////////////////////////////////
12850
+ /// ITEM CONSTRUCTOR
12851
+ //////////////////////////////////////////
12852
  CZRItemConstructor : {
12853
+ //overrides the parent ready
12854
  ready : function() {
12855
  var item = this;
12856
+ //wait for the input collection to be populated,
12857
+ //and then set the input visibility dependencies
12858
  item.inputCollection.bind( function( col ) {
12859
  if( _.isEmpty( col ) )
12860
  return;
12862
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
12863
  }
12864
  });//item.inputCollection.bind()
12865
+
12866
+ //fire the parent
12867
  api.CZRItem.prototype.ready.call( item );
12868
  },
12869
+
12870
+ //Fired when the input collection is populated
12871
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
12872
  setInputVisibilityDeps : function() {
12873
  var item = this,
12874
  module = item.module;
12875
+ //Internal item dependencies
12876
  item.czr_Input.each( function( input ) {
12877
  switch( input.id ) {
12878
  case 'use_custom_bg_color_on_hover' :
12907
  }
12908
  }
12909
  };
12910
+ //provides a description of each module
12911
+ //=> will determine :
12912
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12913
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12914
+ // , if crud, the item shall be removable
12915
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12916
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12917
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12918
  api.czrModuleMap = api.czrModuleMap || {};
12919
  $.extend( api.czrModuleMap, {
12920
  czr_simple_form_button_child: {
12928
  }
12929
  });
12930
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12931
+ //extends api.CZRDynModule
12932
  ( function ( api, $, _ ) {
12933
+ //BUTTON MODULE
12934
  var Constructor = {
12935
  initialize: function( id, options ) {
12936
  var module = this;
12937
+
12938
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12939
  module.inputConstructor = api.CZRInput.extend({
12940
  setupSelect : function() {
12941
  api.czr_sektions.setupSelectInput.call( this );
12942
  }
12943
  });
12944
+
12945
+ // run the parent initialize
12946
+ // Note : must be always invoked always after the input / item class extension
12947
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12948
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12949
 
12950
  },//initialize
12951
  };
12952
+ //provides a description of each module
12953
+ //=> will determine :
12954
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
12955
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
12956
+ // , if crud, the item shall be removable
12957
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
12958
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
12959
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
12960
  api.czrModuleMap = api.czrModuleMap || {};
12961
  $.extend( api.czrModuleMap, {
12962
  czr_simple_form_fonts_child: {
12970
  }
12971
  });
12972
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
12973
+ //extends api.CZRDynModule
12974
  ( function ( api, $, _ ) {
12975
  var Constructor = {
12976
  initialize: function( id, options ) {
12977
  var module = this;
12978
+ // EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
12979
  module.inputConstructor = api.CZRInput.extend({
12980
  setupSelect : function() {
12981
  api.czr_sektions.setupSelectInput.call( this );
12982
  }
12983
  });
12984
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
12985
+ // module.itemConstructor = api.CZRItem.extend( module.CZRItemConstructor || {} );
12986
+
12987
+ // run the parent initialize
12988
+ // Note : must be always invoked always after the input / item class extension
12989
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
12990
  api.CZRDynModule.prototype.initialize.call( module, id, options );
12991
 
12992
  },//initialize
12993
+
12994
+ //////////////////////////////////////////////////////////
12995
+ /// ITEM CONSTRUCTOR
12996
+ //////////////////////////////////////////
12997
+ // CZRItemConstructor : {
12998
+ // //overrides the parent ready
12999
+ // ready : function() {
13000
+ // var item = this;
13001
+ // //wait for the input collection to be populated,
13002
+ // //and then set the input visibility dependencies
13003
+ // item.inputCollection.bind( function( col ) {
13004
+ // if( _.isEmpty( col ) )
13005
+ // return;
13006
+ // try { item.setInputVisibilityDeps(); } catch( er ) {
13007
+ // api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
13008
+ // }
13009
+ // });//item.inputCollection.bind()
13010
+
13011
+ // //fire the parent
13012
+ // api.CZRItem.prototype.ready.call( item );
13013
+ // },
13014
+
13015
+ // //Fired when the input collection is populated
13016
+ // //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
13017
+ // setInputVisibilityDeps : function() {
13018
+ // var item = this,
13019
+ // module = item.module;
13020
+ // //Internal item dependencies
13021
+ // item.czr_Input.each( function( input ) {
13022
+ // switch( input.id ) {
13023
+ // case 'recaptcha_enabled' :
13024
+ // _.each( [ 'recaptcha_badge' ] , function( _inputId_ ) {
13025
+ // try { api.czr_sektions.scheduleVisibilityOfInputId.call( input, _inputId_, function() {
13026
+ // return 'inherit' === input();
13027
+ // }); } catch( er ) {
13028
+ // api.errare( input.module.module_type + ' => error in setInputVisibilityDeps', er );
13029
+ // }
13030
+ // });
13031
+ // break;
13032
+ // }
13033
+ // });
13034
+ // }
13035
+ // }
13036
  };
13037
+ //provides a description of each module
13038
+ //=> will determine :
13039
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
13040
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
13041
+ // , if crud, the item shall be removable
13042
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
13043
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
13044
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
13045
  api.czrModuleMap = api.czrModuleMap || {};
13046
  $.extend( api.czrModuleMap, {
13047
  czr_simple_form_submission_child: {
13055
  }
13056
  });
13057
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
13058
+ //extends api.CZRDynModule
13059
  ( function ( api, $, _ ) {
13060
+ //BUTTON MODULE
13061
  var Constructor = {
13062
  initialize: function( id, options ) {
13063
  var module = this;
13064
+
13065
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
13066
  module.inputConstructor = api.CZRInput.extend({
13067
  setupSelect : function() {
13068
  api.czr_sektions.setupSelectInput.call( this );
13069
  }
13070
  });
13071
+
13072
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR MONOMODEL
13073
  module.itemConstructor = api.CZRItem.extend( module.CZRButtonItemConstructor || {} );
13074
+
13075
+ // run the parent initialize
13076
+ // Note : must be always invoked always after the input / item class extension
13077
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
13078
  api.CZRDynModule.prototype.initialize.call( module, id, options );
13079
 
13080
  },//initialize
13081
+
13082
+ //////////////////////////////////////////////////////////
13083
+ /// ITEM CONSTRUCTOR
13084
+ //////////////////////////////////////////
13085
  CZRButtonItemConstructor : {
13086
+ //overrides the parent ready
13087
  ready : function() {
13088
  var item = this;
13089
+ //wait for the input collection to be populated,
13090
+ //and then set the input visibility dependencies
13091
  item.inputCollection.bind( function( col ) {
13092
  if( _.isEmpty( col ) )
13093
  return;
13095
  api.errorLog( 'item.setInputVisibilityDeps() : ' + er );
13096
  }
13097
  });//item.inputCollection.bind()
13098
+
13099
+ //fire the parent
13100
  api.CZRItem.prototype.ready.call( item );
13101
  },
13102
+
13103
+ //Fired when the input collection is populated
13104
+ //At this point, the inputs are all ready (input.isReady.state() === 'resolved') and we can use their visible Value ( set to true by default )
13105
  setInputVisibilityDeps : function() {
13106
  var item = this,
13107
  module = item.module;
13108
+
13109
+ //Internal item dependencies
13110
  item.czr_Input.each( function( input ) {
13111
  switch( input.id ) {
13112
  case 'use_custom_bg_color_on_hover' :
13155
  }
13156
  }
13157
  };
13158
+ //provides a description of each module
13159
+ //=> will determine :
13160
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
13161
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
13162
+ // , if crud, the item shall be removable
13163
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
13164
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
13165
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
13166
  api.czrModuleMap = api.czrModuleMap || {};
13167
  $.extend( api.czrModuleMap, {
13168
  czr_font_child : {
13176
  }
13177
  });
13178
  })( wp.customize , jQuery, _ );//global sektionsLocalizedData, serverControlParams
13179
+ //extends api.CZRDynModule
13180
  ( function ( api, $, _ ) {
13181
+ //BUTTON MODULE
13182
  var Constructor = {
13183
  initialize: function( id, options ) {
13184
  var module = this;
13185
+
13186
+ //EXTEND THE DEFAULT CONSTRUCTORS FOR INPUT
13187
  module.inputConstructor = api.CZRInput.extend({
13188
  setupSelect : function() {
13189
  api.czr_sektions.setupSelectInput.call( this, sektionsLocalizedData.registeredWidgetZones );
13190
  }
13191
  });
13192
+
13193
+ // run the parent initialize
13194
+ // Note : must be always invoked always after the input / item class extension
13195
+ // Otherwise the constructor might be extended too early and not taken into account. @see https://github.com/presscustomizr/nimble-builder/issues/37
13196
  api.CZRDynModule.prototype.initialize.call( module, id, options );
13197
 
13198
  },//initialize
13199
  };
13200
+ //provides a description of each module
13201
+ //=> will determine :
13202
+ //1) how to initialize the module model. If not crud, then the initial item(s) model shall be provided
13203
+ //2) which js template(s) to use : if crud, the module template shall include the add new and pre-item elements.
13204
+ // , if crud, the item shall be removable
13205
+ //3) how to render : if multi item, the item content is rendered when user click on edit button.
13206
+ // If not multi item, the single item content is rendered as soon as the item wrapper is rendered.
13207
+ //4) some DOM behaviour. For example, a multi item shall be sortable.
13208
  api.czrModuleMap = api.czrModuleMap || {};
13209
  $.extend( api.czrModuleMap, {
13210
  czr_widget_area_module : {
assets/czr/sek/js/ccat-sek-control.min.js CHANGED
@@ -1 +1 @@
1
- var CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{initialize:function(){var e=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(r.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");e.SECTION_ID_FOR_GLOBAL_OPTIONS="__globalOptionsSectionId",e.SECTION_ID_FOR_LOCAL_OPTIONS="__localOptionsSection",e.SECTION_ID_FOR_CONTENT_PICKER="__content_picker__",e.MAX_NUMBER_OF_COLUMNS=12,e.SETTING_UPDATE_BUFFER=100,e.defaultLocalSektionSettingValue=e.getDefaultSektionSettingValue("local"),e.localSectionsSettingId=new r.Value({}),e.registered=new r.Value([]),r.bind("ready",function(){e.doSektionThinksOnApiReady()}),r.bind("save-request-params",function(e){s.extend(e,{local_skope_id:r.czr_skopeBase.getSkopeProperty("skope_id")})})},doSektionThinksOnApiReady:function(){var o=this;o.registerAndSetupDefaultPanelSectionOptions(),o.localSectionsSettingId.callbacks.add(function(e,t){try{o.setupSettingsToBeSaved()}catch(e){r.errare("Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()",e)}o.initializeHistoryLogWhenSettingsRegistered()});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),r.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){e.deferred.embedded.done(function(){!0!==e.boundForLocalOptionGeneration&&(e.boundForLocalOptionGeneration=!0,e.expanded.bind(function(e){!0===e&&o.generateUI({action:"sek-generate-local-skope-options-ui"})}))})}),r.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){!0!==e.nimbleGlobalOptionGenerated&&(o.generateUI({action:"sek-generate-global-options-ui"}),e.nimbleGlobalOptionGenerated=!0)}),r.trigger("nimble-ready-for-current-skope")};_.isEmpty(r.czr_activeSkopes().local)||i(),r.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),o.bind("sek-ui-removed",function(){r.previewedDevice("desktop")}),r.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){r.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){s(this).trigger("click")})})})}),s("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){o.resetCollectionSetting()}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&r.control(e.id,function(e){e.container.find("[draggable]").each(function(){s(this).off("dragstart dragend")})}),"control"==e.what&&r.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(s(this).data("czrSelect2"))||s(this).czrSelect2("destroy")})})}),r.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=s.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.setupTopBar(),sektionsLocalizedData.isSavedSectionEnabled&&o.setupSaveUI(),o.lastClickedTargetInPreview=new r.Value,o.lastClickedTargetInPreview.bind(function(e,t){_.isObject(e)&&e.id?r.previewer.send("sek-set-double-click-target",e):r.previewer.send("sek-reset-double-click-target"),clearTimeout(s(window).data("_preview_target_timer_")),s(window).data("_preview_target_timer_",setTimeout(function(){o.lastClickedTargetInPreview({}),r.previewer.send("sek-reset-double-click-target")},2e4))}),r.previewer.bind("sek-clean-target-drop-zone",function(){o.lastClickedTargetInPreview({})}),s(document).keydown(function(e){e&&27===e.keyCode&&o.lastClickedTargetInPreview({})})},registerAndSetupDefaultPanelSectionOptions:function(){var n=this,e=r.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});r.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.find("h3.accordion-section-title"),t=(n.container.find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join(""));if(0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}})}),r.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_GLOBAL_OPTIONS,title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_LOCAL_OPTIONS,title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"refresh",type:"option"}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_CONTENT_PICKER,title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_CONTENT_PICKER,function(e){"resolved"!=r.czr_initialSkopeCollectionPopulated.state()?r.czr_initialSkopeCollectionPopulated.done(function(){r.previewer.trigger("sek-pick-content",{focus:!1})}):r.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&r.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&r.previewer.trigger("sek-pick-content"),sektionsData=r.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&r.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.localSectionsSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(o,r){r.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarId="#nimble-top-bar",t.topBarVisible=new o.Value(!1),t.topBarVisible.bind(function(e){t.levelTreeExpanded()||t.toggleTopBar(e)}),t.mouseMovedRecently=new o.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(r(window).data("_scroll_move_timer_")),r(window).data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};r(window).on("mousemove scroll,",_.throttle(e,50)),o.previewer.bind("ready",function(){r(o.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.setupLevelTree()},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?r.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){r("body").addClass("nimble-top-bar-visible")},200)}):(t=r.Deferred(),r("body").removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){var t=this;if(0<r(t.topBarId).length)return r(t.topBarId);try{_tmpl=wp.template("nimble-top-bar")({})}catch(e){return o.errare("Error when parsing the the top note template",e),!1}r("#customize-preview").after(r(_tmpl)),r(document).keydown(function(e){if(e.ctrlKey&&_.contains([89,90],e.keyCode))try{t.navigateHistory(90===e.keyCode?"undo":"redo")}catch(e){o.errare("Error when firing self.navigateHistory",e)}}),r(".sek-add-content",t.topBarId).on("click",function(e){e.preventDefault(),o.previewer.trigger("sek-pick-content",{content_type:"module"})}),r(".sek-level-tree",t.topBarId).on("click",function(e){e.preventDefault(),t.levelTreeExpanded(!t.levelTreeExpanded())}),r("[data-nimble-history]",t.topBarId).on("click",function(e){try{t.navigateHistory(r(this).data("nimble-history"))}catch(e){o.errare("Error when firing self.navigateHistory",e)}}),r(".sek-settings",t.topBarId).on("click",function(e){o.panel(sektionsLocalizedData.sektionsPanelId,function(e){t.rootPanelFocus(),e.focus()})}),r(".sek-nimble-doc",t.topBarId).on("click",function(e){e.preventDefault(),window.open(r(this).data("doc-href"),"_blank")});var n=function(e){r(t.topBarId).length<1||(_.isObject(e)&&e.local_template&&"default"!==e.local_template?r(t.topBarId).find(".sek-notifications").html(['<span class="fas fa-info-circle"></span>',sektionsLocalizedData.i18n["This page uses a custom template."]].join(" ")):r(t.topBarId).find(".sek-notifications").html(""))},i=function(){o(t.localSectionsSettingId(),function(e){var t=e(),i=_.isObject(t)&&t.local_options&&t.local_options.template?t.local_options.template:null;n(i)}),o(t.getLocalSkopeOptionId()+"__template",function(e){e.bind(function(e,t){n(e)})})};return i(),o.bind("nimble-ready-for-current-skope",function(){i()}),r(t.topBarId)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{navigateHistory:function(i){var t,n,o,r,e=this,s=d.extend(!0,[],e.historyLog()),a=[];if(_.each(s,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){_.isEmpty(r.local)||l(e.localSectionsSettingId())(e.validateSettingValue(r.local),{navigatingHistoryLogs:!0}),_.isEmpty(r.global)||l(e.getGlobalSectionsSettingId())(e.validateSettingValue(r.global),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(s,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(s,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":s.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}a.push(newLog)}),e.historyLog(a)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(o,n){n.extend(CZRSeksPrototype,{setupLevelTree:function(){var i=this;i.levelTree=new o.Value([]),i.levelTree.bind(function(e){i.levelTreeExpanded()&&i.renderOrRefreshTree()}),i.levelTreeExpanded=new o.Value(!1),i.levelTreeExpanded.bind(function(e){if(n("body").toggleClass("sek-level-tree-expanded",e),e){if(i.setLevelTreeValue(),_.isEmpty(i.levelTree()))return o.previewer.trigger("sek-notify",{type:"info",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["No sections to navigate"]+"</strong>","</span>"].join("")}),void i.levelTreeExpanded(!1);n("#customize-preview iframe").css("z-index",1),i.renderOrRefreshTree()}else 0<n("#nimble-level-tree").length&&_.delay(function(){n("#nimble-level-tree").remove(),n("#customize-preview iframe").css("z-index","")},300)}),o.previewer.bind("ready",function(){i.localSectionsSettingId.callbacks.add(function(){_.each([i.getGlobalSectionsSettingId(),i.localSectionsSettingId()],function(e){o(e)._isBoundForNimbleLevelTree||(o(e).bind(function(e){i.setLevelTreeValue()}),o(e)._isBoundForNimbleLevelTree=!0)})})}),n("body").on("click","#nimble-level-tree [data-nimb-level]",function(e){e.preventDefault(),e.stopPropagation();var t=n(e.target);o.previewer.send("sek-animate-to-level",{id:t.data("nimb-id")}),o.previewer.send("sek-display-level-ui",{id:t.data("nimb-id")})}),n("body").on("click","#nimble-level-tree .sek-remove-level",function(e){e.preventDefault(),e.stopPropagation();var t=n(e.target).closest("[data-nimb-level]");o.previewer.trigger("sek-remove",{level:t.data("nimb-level"),id:t.data("nimb-id"),location:t.closest('[data-nimb-level="location"]').data("nimb-id"),in_sektion:t.closest('[data-nimb-level="section"]').data("nimb-id"),in_column:t.closest('[data-nimb-level="column"]').data("nimb-id")}),t.fadeOut("slow"),i.renderOrRefreshTree()})},hasLocalHeaderFooter:function(){o.has(self.localSectionsSettingId())},setLevelTreeValue:function(){var e=this.getGlobalSectionsSettingId(),t=this.localSectionsSettingId();_global_col=o(e)(),_global_col=_.isObject(_global_col)&&!_.isEmpty(_global_col.collection)?_global_col.collection:[],_global_col=_.isArray(_global_col)?_global_col:[],_local_col=o(t)(),_local_col=_.isObject(_local_col)&&!_.isEmpty(_local_col.collection)?_local_col.collection:[],_local_col=_.isArray(_local_col)?_local_col:[],this.levelTree(_.union(_global_col,_local_col))},renderOrRefreshTree:function(){n("#nimble-level-tree").length<1&&n("#customize-preview").after(n("<div/>",{id:"nimble-level-tree"})),n("#nimble-level-tree").html(this.getLevelTreeHtml(this.levelTree()))},getLevelTreeHtml:function(e,t){var i=this;if(!_.isArray(e)||_.isEmpty(e))return o.errare("::buildLevelTree => invalid collection param",e),_html;var n='<i class="material-icons sek-remove-level" title="">delete_forever</i>';return _html="<ul>",_.each(e,function(e){_.isUndefined(e.level)?o.errare("::buildLevelTree => missing level property",e):_.isUndefined(e.id)?o.errare("::buildLevelTree => missing id property",e):("module"===e.level||!_.isUndefined(e.collection)&&_.isArray(e.collection)&&!_.isEmpty(e.collection))&&(n="location"!==e.level?n:"",_html=_html+'<li data-nimb-level="'+e.level+'" data-nimb-id="'+e.id+'">',_html+=[e.level," id :",e.id," ",n].join(""),_.isArray(e.collection)&&!_.isEmpty(e.collection)&&(_html+=i.getLevelTreeHtml(e.collection,t)),_html+="</li>")}),_html+="</ul>",_html}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,c){c.extend(CZRSeksPrototype,{setupSaveUI:function(){var n=this;n.saveUIVisible=new a.Value(!1),n.saveUIVisible.bind(function(e,t,i){n.toggleSaveUI(e,i?i.id:null)})},toggleSaveUI:function(e,t){e=!!_.isUndefined(e)||e;var i,n=this;e?c.when(n.renderAndSetupSaveUITmpl({})).done(function(e){n.saveUIContainer=e,_.delay(function(){c("body").addClass("nimble-save-ui-visible")},200),c("#sek-saved-section-id").val(t)}):(i=c.Deferred(),c("body").removeClass("nimble-save-ui-visible"),0<c("#nimble-top-save-ui").length?_.delay(function(){n.saveUIContainer.remove(),i.resolve()},300):i.resolve(),i.promise()).done(function(){n.saveUIVisible(!1)})},preProcessSektion:function(e){var t=this.cleanIds(e);return _.omit(t,function(e,t){return _.contains(["id","level"],t)})},renderAndSetupSaveUITmpl:function(e){if(0<c("#nimble-top-save-ui").length)return c("#nimble-top-save-ui");var s=this;try{_tmpl=wp.template("nimble-top-save-ui")({})}catch(e){return a.errare("Error when parsing the the top note template",e),!1}return c("#customize-preview").after(c(_tmpl)),c(".sek-do-save-section","#nimble-top-save-ui").on("click",function(e){e.preventDefault();var t=c.extend(!0,{},s.getLevelModel(c("#sek-saved-section-id").val())),i=c("#sek-saved-section-title").val(),n=c("#sek-saved-section-description").val(),o=s.guid(),r=s.preProcessSektion(t);if(_.isEmpty(i))return c("#sek-saved-section-title").addClass("error"),void a.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")});c("#sek-saved-section-title").removeClass("error"),wp.ajax.post("sek_save_section",{nonce:a.settings.nonce.save,sek_title:i,sek_description:n,sek_id:o,sek_data:JSON.stringify(r)}).done(function(e){a.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n Your section has been saved.</strong>","</span>"].join("")})}).fail(function(e){a.errorLog("ajax sek_save_section => error",e),a.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")})})}),c(".sek-cancel-save","#nimble-top-save-ui").on("click",function(e){e.preventDefault(),s.saveUIVisible(!1)}),c("#nimble-top-save-ui")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,c){c.extend(CZRSeksPrototype,{setupSettingsToBeSaved:function(){var i,o=this,e={local:{collectionSettingId:o.localSectionsSettingId()},global:{collectionSettingId:o.getGlobalSectionsSettingId()}};_.each(e,function(e,t){if(i=a.czr_skopeBase.getSkopeProperty("sektions",t).db_values,_.isEmpty(e.collectionSettingId))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!a.has(e.collectionSettingId)){a.CZR_Helpers.register({what:"setting",id:e.collectionSettingId,value:o.validateSettingValue(_.isObject(i)?i:o.getDefaultSektionSettingValue(t)),transport:"postMessage",type:"option",track:!1,origin:"nimble"});a(e.collectionSettingId,function(n){n.bind(_.debounce(function(e,t,i){o.trackHistoryLog(n,i)},1e3))})}})},trackHistoryLog:function(e,t){var i=e.id===this.getGlobalSectionsSettingId();if(t&&!0!==t.navigatingHistoryLogs){var n,o=[],r=c.extend(!0,[],this.historyLog());_.isEmpty(t.in_sektion)?_.isEmpty(t.to_sektion)||(n=t.to_sektion):n=t.in_sektion,_.each(r,function(e){"future"!=e.status&&(c.extend(e,{status:"previous"}),o.push(e))}),o.push({status:"current",value:i?{global:e()}:{local:e()},action:_.isObject(t)&&t.action||"",sektionToRefresh:n}),this.historyLog(o)}},initializeHistoryLogWhenSettingsRegistered:function(){this.historyLog=new a.Value([{status:"current",value:{local:a(this.localSectionsSettingId())(),global:a(this.getGlobalSectionsSettingId())()},action:"initial"}]),this.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),c("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===c(this).data("nimble-history")?c(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):c(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},validateSettingValue:function(i){if(!_.isObject(i))return a.errare("validation error => the setting should be an object",i),null;var n={},o=!1,e=[],r=function(e){a.errare(e,i),a.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks the Nimble builder, you might try to reset the sections for this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),o=!0},s=function(t){if(!o)if(_.isUndefined(t)&&_.isEmpty(n)){if(t=c.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void r("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void r('validation error => the root level should not have a "level" or an "id" property');_.each(i.collection,function(e){n=t,s(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void r("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void r("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void r("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void r('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void r("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void r("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&a.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(n.level))return void r("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=n.level)return void r("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=n.level)return void r("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=n.level)return void r("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=n.level)return void r("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){n=c.extend(!0,{},t),s(e)})}};return s(),o?null:i},resetCollectionSetting:function(){if(_.isEmpty(this.localSectionsSettingId()))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");a(this.localSectionsSettingId())(this.getDefaultSektionSettingValue("local")),a.previewer.refresh(),a.notifications.remove("sek-notify"),a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("sek-reset-done",{type:"success",message:sektionsLocalizedData.i18n["Reset complete"],dismissible:!0})),_.delay(function(){a.notifications.remove("sek-reset-done")},5e3)})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,n){n.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},s={},a=!0,e={"sek-add-section":{callback:function(e){return a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{id:e.apiParams?e.apiParams.id:"",content_type:"section"}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module:e.before_module,after_module:e.after_module},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(a=!0,s={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-move-section-up":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"up",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-move-section-down":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"down",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-duplicate":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return a=!0,s={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)});var t=e.location_skope_id;_.isUndefined(t)&&(t=!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id")),c.previewer.trigger("sek-refresh-stylesheet",{location_skope_id:t,is_global_location:o.isGlobalLocation(e.apiParams)}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return a=!1,s={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return e=_.isObject(e)?e:{},c.czr_sektions.currentContentPickerType=c.czr_sektions.currentContentPickerType||new c.Value,c.czr_sektions.currentContentPickerType(e.content_type||"module"),_.isObject(e)&&e.id&&o.lastClickedTargetInPreview({id:e.id}),a=!0,r={},s={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"module",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(s)},"sek-edit-options":function(e){return a=!0,r={},_.isEmpty(e.id)?n.Deferred(function(){this.reject("missing id")}):(s={action:"sek-generate-level-options-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s))},"sek-edit-module":function(e){return a=!0,r={},s={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s)},"sek-notify":function(t){return a=!1,n.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("sek-notify",{type:t.type||"info",message:t.message,dismissible:!0})),_.delay(function(){c.notifications.remove("sek-notify")},t.duration||5e3)}),this.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-level":function(t){return a=!0,n.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-stylesheet":function(t){return a=!0,t=t||{},n.Deferred(function(e){r={id:t.id},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-toggle-save-section-ui":function(t){return a=!1,o.saveUIVisible(!0,t),n.Deferred(function(e){r={},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}try{e(t).done(function(e){e=e||{},a?c.previewer.send(n,{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:s,cloneId:!_.isEmpty(e.cloneId)&&e.cloneId}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:s}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => error when firing "+n,e),c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks the Nimble builder, you might try to reset the sections for this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this;c.previewer.bind("sek-to-json",function(e){var t=n.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(i.cleanIds(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(k,y){y.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=y.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var o,r=this,e=n.settingParams.to,t=null,i=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var s=n.settingParams.args.moduleRegistrationParams.control,a=n.settingParams.args.moduleRegistrationParams.id,c=s.czr_Module(a);if(_.isEmpty(c)?k.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=c.module_type,i=c.isMultiItem()),!i&&_.isObject(e)?o=r.normalizeAndSanitizeSingleItemInputValues(e,t):(o=[],_.each(e,function(e){o.push(r.normalizeAndSanitizeSingleItemInputValues(e,t))})),_.isEmpty(n.defaultPreviewAction))k.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed;_.isUndefined(f)||(l=r.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var g=function(){if(!0!==n.isGlobalOptions)return r.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:o,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(e){!0===d&&k.previewer.send("sek-refresh-stylesheet",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}}),!0===u&&k.previewer.send("sek-refresh-level",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")}),!0===m&&k.previewer.refresh()});if(_.isEmpty(n.options_type))k.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=k(sektionsLocalizedData.optNameForGlobalOptions)(),t=y.extend(!0,{},_.isObject(e)?e:{}),i={};_.each(o||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,k(sektionsLocalizedData.optNameForGlobalOptions)(t)}};if(!0===p){var h=n.settingParams.args.input_value;if(!_.isString(h))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",h);-1<h.indexOf("gfont")?r.updateAPISetting({action:"sek-update-fonts",font_family:h,is_global_location:r.isGlobalLocation(n.uiParams)}).always(function(){g().then(function(){r.updateAPISetting({action:"sek-update-fonts",is_global_location:r.isGlobalLocation(n.uiParams)})})}):g()}else g()}}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},normalizeAndSanitizeSingleItemInputValues:function(e,o){var i,r={},n={},s=null,a=this;return _.each(e,function(e,t){var i,n;_.contains(["title","id"],t)||(null!==o&&"no_default_value_specified"===(s=a.getInputDefaultValue(t,o))&&k.infoLog("::updateAPISettingAndExecutePreviewActions => missing default value for input "+t+" in module "+o),i=e,n=s,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(_.isString(e)||_.isObject(e))&&_.isEmpty(e)||(r[t]=e))}),_.each(r,function(e,t){switch(a.getInputType(t,o)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"tiny_mce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=k.control.has(t):(i=!0,1<e.length&&k.errare("generateUI => why is this control registered more than once ? => "+t)),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(o,e){var r=this,t={};a.extend(t,{content_type_switcher:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:sektionsLocalizedData.i18n["Select a content type"],priority:0,settingValue:{content_type:o.content_type}},module_picker:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:sektionsLocalizedData.i18n["Pick a module"],content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_intro_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_intro_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for an introduction"],content_type:"section",expandAndFocusOnInit:!0,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_features_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_features_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for services and features"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_contact_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_contact_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Contact-us sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_column_layouts_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_column_layouts_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Empty sections with columns layout"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isNimbleHeaderFooterEnabled&&a.extend(t,{sek_header_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_header_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Header sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_footer_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_footer_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Footer sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isSavedSectionEnabled&&a.extend(t,{sek_my_sections_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_my_sections_sec_picker_module",controlLabel:"@missi18n My sections",content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return r.isUIControlAlreadyRegistered(n)?s.control(n,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}})}):(_do_register_=function(){_.each(t,function(n,e){s.has(n.settingControlId)||(s(n.settingControlId,function(e){e.bind(function(e,t){s.errare("generateUIforDraggableContent => the setting() should not changed")})}),s.CZR_Helpers.register({origin:"nimble",level:o.level,what:"setting",id:n.settingControlId,dirty:!1,value:n.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),s.CZR_Helpers.register({origin:"nimble",level:o.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.SECTION_ID_FOR_CONTENT_PICKER,priority:n.priority||10,settings:{default:n.settingControlId},track:!1}).done(function(){s.control(n.settingControlId,function(e){e.content_type=n.content_type,!0===o.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),"section"===e.content_type?(e.container.find(".czr-items-wrapper").hide(),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&(e.container.find(".czr-items-wrapper").show(),t.trigger("click"))):e.container.attr("data-sek-accordion","no")})})})},s.section(r.SECTION_ID_FOR_CONTENT_PICKER,function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),r.scheduleModuleAccordion.call(e,{expand_first_control:!0}),r._maybeFetchSectionsFromServer()})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(r,e){var s=this;_.isEmpty(r.id)&&e.reject("generateUI => missing id");var i=s.getLevelProperty({property:"value",id:r.id}),t=s.getLevelProperty({property:"module_type",id:r.id}),n=s.getRegisteredModuleProperty(t,"name");_.isEmpty(t)&&e.reject("generateUI => module => invalid module_type");var o={};if(!0===s.getRegisteredModuleProperty(t,"is_father")){var a=s.getRegisteredModuleProperty(t,"children");if(_.isEmpty(a))throw new Error("::generateUIforFrontModules => a father module "+t+" is missing children modules ");_.each(a,function(e,t){o[t]={settingControlId:r.id+"__"+t,module_type:e,controlLabel:s.getRegisteredModuleProperty(e,"name")}})}else o.__no_option_group_to_be_updated_by_children_modules__={settingControlId:r.id,module_type:t,controlLabel:n};var c=_.keys(o)[0],l=o[c].settingControlId;return s.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(o,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(r,{action:"sek-set-module-value"}),options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},i);"__no_option_group_to_be_updated_by_children_modules__"!==o&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[o])?e[o]:{}),d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.id,priority:10,settings:{default:n.settingControlId}}).done(function(){}),d.control(n.settingControlId,function(e){d.control(n.settingControlId).focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})},d.section.when(r.id,function(){d.section(r.id).focus(),_do_register_()}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){}),d.section(r.id,function(e){e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),s.scheduleModuleAccordion.call(e,{expand_first_control:!0})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(s,e){var a=this,c=a.getLevelProperty({property:"options",id:s.id});c=_.isObject(c)?c:{};var t={};d.extend(t,{bg:{settingControlId:s.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[s.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'},border:{settingControlId:s.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:s.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:s.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Set a custom anchor for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:s.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:s.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height and vertical alignment for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),"section"===s.level&&(d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),d.extend(t,{breakpoint:{settingControlId:s.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}})),"module"===s.level&&d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return a.isUIControlAlreadyRegistered(n)?l.control(n).focus({completeCallback:function(){var e=l.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(a.cleanRegistered(),_do_register_=function(){_.each(t,function(n,o){if(a.isUIControlAlreadyRegistered(n.settingControlId))l.section(l.control(n.settingControlId).section()).expanded(!0);else{if(!l.has(n.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:s,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=c[o]||{},i=a.getModuleStartingValue(n.module_type);if("no_starting_value"!==i&&_.isObject(i)){var r=d.extend(!0,{},i);e=d.extend(r,e)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,level_id:s.id,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.id,priority:0,settings:{default:n.settingControlId}}).done(function(){}),l.control(n.settingControlId,function(e){!0===n.expandAndFocusOnInit&&e.focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})}})},l.section.has(s.id)||l.section(s.id,function(e){a.scheduleModuleAccordion.call(e,{expand_first_control:!0})}),l.CZR_Helpers.register({origin:"nimble",what:"section",id:s.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+s.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){}),l.section(s.id,function(e){_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>')})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=d.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(d.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(c,e){var l=this,i=l.getLocalSkopeOptionId();if(l.isUIControlAlreadyRegistered(i))return e;var n={};return _.isUndefined(sektionsLocalizedData.localOptionsMap)||!_.isObject(sektionsLocalizedData.localOptionsMap)?d.errare("::generateUIforGlobalOptions => missing or invalid localOptionsMap"):(_.each(sektionsLocalizedData.localOptionsMap,function(e,t){switch(t){case"template":n[t]={settingControlId:i+"__template",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'};break;case"local_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n[t]={settingControlId:i+"__local_header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"custom_css":n[t]={settingControlId:i+"__custom_css",module_type:e,controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'};break;case"local_performances":n[t]={settingControlId:i+"__local_performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"local_reset":n[t]={settingControlId:i+"__local_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Remove the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;default:d.errare("::generateUIforLocalOptions => an option group could not be registered => "+e,t)}}),_do_register_=function(){_.each(n,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{l.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh",uiParams:c,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,l.SETTING_UPDATE_BUFFER))});var e=l.getModuleStartingValue(n.module_type),i=d(l.localSectionsSettingId())(),r=u.extend(!0,{},_.isObject(i.local_options)?i.local_options:{}),s=_.isObject(r[o])?r[o]:{};if("no_starting_value"!==e&&_.isObject(e)){var a=u.extend(!0,{},e);s=u.extend(a,s)}d.CZR_Helpers.register({origin:"nimble",level:c.level,what:"setting",id:n.settingControlId,dirty:!1,value:s,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:c.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:l.SECTION_ID_FOR_LOCAL_OPTIONS,priority:10,settings:{default:n.settingControlId}}).done(function(){d.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_()),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(a,e){var c=this,i=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(c.isUIControlAlreadyRegistered(i))return e;var n={};return _.isUndefined(sektionsLocalizedData.globalOptionsMap)||!_.isObject(sektionsLocalizedData.globalOptionsMap)?l.errare("::generateUIforGlobalOptions => missing or invalid globalOptionsMap"):(_.each(sektionsLocalizedData.globalOptionsMap,function(e,t){switch(t){case"global_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n[t]={settingControlId:i+"__header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"breakpoint":n[t]={settingControlId:i+"__breakpoint",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">devices</i>'};break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"performances":n[t]={settingControlId:i+"__performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"recaptcha":n[t]={settingControlId:i+"__recaptcha",module_type:e,controlLabel:sektionsLocalizedData.i18n["Protect your contact forms with Google reCAPTCHA"],icon:'<i class="material-icons sek-level-option-icon">security</i>'};break;case"beta_features":n[t]={settingControlId:i+"__beta_features",module_type:e,controlLabel:sektionsLocalizedData.i18n["Beta features"],icon:'<i class="material-icons sek-level-option-icon">widgets</i>'};break;default:l.errare("::generateUIforGlobalOptions => an option group could not be registered => "+e,t)}}),_do_register_=function(){_.each(n,function(n,o){if(!l.has(n.settingControlId)){var t=function(e,t,i){try{c.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,c.SETTING_UPDATE_BUFFER))});var e=sektionsLocalizedData.globalOptionDBValues,i=c.getModuleStartingValue(n.module_type),r=_.isObject(e)&&!_.isEmpty(e[o])?e[o]:{};if("no_starting_value"!==i&&_.isObject(i)){var s=d.extend(!0,{},i);r=d.extend(s,r)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:r,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:c.SECTION_ID_FOR_GLOBAL_OPTIONS,priority:20,settings:{default:n.settingControlId},track:!1}).done(function(){l.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_()),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(K,X){X.extend(CZRSeksPrototype,{updateAPISetting:function(q){var Y=this,J=X.Deferred();(q=q||{}).is_global_location=Y.isGlobalLocation(q);var e=q.is_global_location?Y.getGlobalSectionsSettingId():Y.localSectionsSettingId();return K(e,function(e){var n,t,o,i,r,s,a,c,l,d=e(),u=_.isObject(d)?X.extend(!0,{},d):Y.getDefaultSektionSettingValue(q.is_global_location?"global":"local"),p=!1;switch(u.collection=_.isArray(u.collection)?u.collection:Y.getDefaultSektionSettingValue(q.is_global_location?"global":"local").collection,q.action){case"sek-add-section":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(_.isEmpty(q.location))throw new Error("updateAPISetting => "+q.action+" => missing location");if(!0===q.is_nested){if(o=Y.getLevelModel(q.in_column,u.collection),"no_match"==(l=Y.getLevelModel(q.in_sektion,u.collection))){J.reject("updateAPISetting => "+q.action+" => no grand parent sektion found");break}if(!0===l.is_nested){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.push({id:q.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+Y.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){q.before_section===e.id&&(L=t),q.after_section===e.id&&(L=t+1)}),n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(L,0,{id:q.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+Y.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(_.isEmpty(q.location))throw new Error("updateAPISetting => "+q.action+" => missing location");var m;try{m=Y.cloneLevel(q.id)}catch(e){K.errare("updateAPISetting => "+q.action,e);break}var f=Y.getLevelPositionInCollection(q.id,u.collection);if(!0===q.is_nested){if("no_match"==(o=Y.getLevelModel(q.in_column,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(parseInt(f+1,10),0,m)}else{if("no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(parseInt(f+1,10),0,m)}a=m.id;break;case"sek-remove-section":if(!0===q.is_nested)"no_match"!=(o=Y.getLevelModel(q.in_column,u.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=q.id})):K.errare("updateAPISetting => "+q.action+" => no parent column matched");else{if("no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}n.collection=_.filter(n.collection,function(e){return e.id!=q.id})}break;case"sek-move-section":var g,h,k=Y.getLevelModel(q.to_location,u.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+q.action+" => missing target location");if(q.from_location!=q.to_location){var y=Y.getLevelModel(q.from_location,u.collection);if(_.isEmpty(y)||"no_match"==y)throw new Error("updateAPISetting => "+q.action+" => missing source location");y.collection=_.isArray(y.collection)?y.collection:[],g=Y.getLevelModel(q.id,y.collection),h=X.extend(!0,{},g),y.collection=_.filter(y.collection,function(e){return e.id!=q.id})}k.collection=_.isArray(k.collection)?k.collection:[],r=X.extend(!0,[],k.collection),s=[],_.each(q.newOrder,function(e){if(q.from_location!=q.to_location&&e==h.id)s.push(h);else{if(t=Y.getLevelModel(e,r),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => "+q.action+" => missing section candidate");s.push(t)}}),k.collection=s;break;case"sek-move-section-up-down":if(inLocationCandidate=Y.getLevelModel(q.location,u.collection),_.isEmpty(inLocationCandidate)||"no_match"==inLocationCandidate)throw new Error("updateAPISetting => "+q.action+" => missing target location");inLocationCandidate.collection=_.isArray(inLocationCandidate.collection)?inLocationCandidate.collection:[],r=X.extend(!0,[],inLocationCandidate.collection),s=X.extend(!0,[],inLocationCandidate.collection);var v=_.findIndex(r,function(e){return e.id===q.id});if(-1===v)throw new Error("updateAPISetting => "+q.action+" => invalid index");var b=q.direction||"up";s[v]=r["up"===b?v-1:v+1],s["up"===b?v-1:v+1]=r[v],inLocationCandidate.collection=s;break;case"sek-add-column":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if("no_match"==(t=Y.getLevelModel(q.in_sektion,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent sektion matched"),J.reject("updateAPISetting => "+q.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],Y.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}_.each(t.collection,function(e){e.width=""}),t.collection.push({id:q.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=Y.getLevelModel(q.in_sektion,u.collection))){if(1===_.size(t.collection)){J.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=q.id}),_.each(t.collection,function(e){e.width=""})}else K.errare("updateAPISetting => "+q.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if("no_match"==(t=Y.getLevelModel(q.in_sektion,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent sektion matched"),J.reject("updateAPISetting => "+q.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],Y.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var z;try{z=Y.cloneLevel(q.id)}catch(e){K.errare("updateAPISetting => "+q.action,e);break}var I=Y.getLevelPositionInCollection(q.id,u.collection);a=z.id,t.collection.splice(parseInt(I+1,10),0,z),_.each(t.collection,function(e){e.width=""});break;case"sek-resize-columns":if(q.col_number<2)break;var w=Y.getLevelModel(q.resized_column,u.collection),M=Y.getLevelModel(q.sister_column,u.collection);if("no_match"==w){K.errare("updateAPISetting => "+q.action+" => no resized column matched"),J.reject("updateAPISetting => "+q.action+" => no resized column matched");break}w.width=parseFloat(q.resizedColumnWidthInPercent);var C=Y.getLevelModel(q.in_sektion,u.collection),S=_.filter(C.collection,function(e){return e.id!=w.id&&e.id!=M.id}),D=parseFloat(w.width.toFixed(3));_.isEmpty(S)||_.each(S,function(e){currentColWidth=parseFloat(1*e.width),(!_.has(e,"width")||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(e.width=parseFloat((100/q.col_number).toFixed(3))),D=parseFloat((D+e.width).toFixed(3))}),M.width=parseFloat((100-D).toFixed(3));break;case"sek-move-column":var P,x,E=Y.getLevelModel(q.to_sektion,u.collection);if(_.isEmpty(E)||"no_match"==E)throw new Error("updateAPISetting => "+q.action+" => missing target sektion");if(q.from_sektion!=q.to_sektion){var R=Y.getLevelModel(q.from_sektion,u.collection);if(_.isEmpty(R)||"no_match"==R)throw new Error("updateAPISetting => "+q.action+" => missing source column");R.collection=_.isArray(R.collection)?R.collection:[],P=Y.getLevelModel(q.id,R.collection),x=X.extend(!0,{},P),R.collection=_.filter(R.collection,function(e){return e.id!=q.id}),_.each(R.collection,function(e){e.width=""})}E.collection=_.isArray(E.collection)?E.collection:[],r=X.extend(!0,[],E.collection),s=[],_.each(q.newOrder,function(e){if(q.from_sektion!=q.to_sektion&&e==x.id)s.push(x);else{if(o=Y.getLevelModel(e,r),_.isEmpty(o)||"no_match"==o)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");s.push(o)}}),E.collection=s,_.each(E.collection,function(e){e.width=""});break;case"sek-add-module":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(_.isEmpty(q.module_type))throw new Error("updateAPISetting => "+q.action+" => missing module_type");if("no_match"===(o=Y.getLevelModel(q.in_column,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}var L=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){q.before_module===e.id&&(L=t),q.after_module===e.id&&(L=t+1)});var O={id:q.id,level:"module",module_type:q.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(c=Y.getModuleStartingValue(q.module_type))&&(O.value=c),o.collection.splice(L,0,O);break;case"sek-duplicate-module":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if("no_match"==(o=Y.getLevelModel(q.in_column,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}var A;o.collection=_.isArray(o.collection)?o.collection:[];try{A=Y.cloneLevel(q.id)}catch(e){K.errare("updateAPISetting => "+q.action,e),J.reject("updateAPISetting => "+q.action+" => error when cloning the level");break}var Z=Y.getLevelPositionInCollection(q.id,u.collection);a=A.id,o.collection.splice(parseInt(Z+1,10),0,A);break;case"sek-remove-module":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");"no_match"!=(o=Y.getLevelModel(q.in_column,u.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=q.id})):K.errare("updateAPISetting => "+q.action+" => no parent column matched");break;case"sek-move-module":var j,T,V;if(j=Y.getLevelModel(q.to_column,u.collection),_.isEmpty(j)||"no_match"==j)throw new Error("updateAPISetting => "+q.action+" => missing target column");if(q.from_column!=q.to_column){var F;if(F=Y.getLevelModel(q.from_column,u.collection),_.isEmpty(F)||"no_match"==F)throw new Error("updateAPISetting => "+q.action+" => missing source column");F.collection=_.isArray(F.collection)?F.collection:[],T=Y.getLevelModel(q.id,u.collection),V=X.extend(!0,{},T),F.collection=_.filter(F.collection,function(e){return e.id!=q.id})}if(j.collection=_.isArray(j.collection)?j.collection:[],r=X.extend(!0,[],j.collection),s=[],_.each(q.newOrder,function(e){if(q.from_column!=q.to_column&&e==V.id)s.push(V);else{if(i=Y.getLevelModel(e,u.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+q.action+" => missing moduleCandidate");s.push(i)}}),s.length!=_.uniq(s).length)throw new Error("updateAPISetting => "+q.action+" => there are duplicated modules in column : "+j.id);j.collection=s;break;case"sek-set-module-value":i=Y.getLevelModel(q.id,u.collection);var U={};if(_.each(q.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(U[t]=e)}),"no_match"==i){K.errare("updateAPISetting => "+q.action+" => no module matched",q),J.reject("updateAPISetting => "+q.action+" => error no module matched");break}if(_.isEmpty(q.options_type)){K.errare("updateAPISetting => "+q.action+" => missing options_type"),J.reject("updateAPISetting => "+q.action+" => missing options_type");break}"__no_option_group_to_be_updated_by_children_modules__"===q.options_type?i.value=U:(i.value=_.isEmpty(i.value)?{}:i.value,i.value[q.options_type]=U);break;case"sek-generate-level-options-ui":var N=Y.getLevelModel(q.id,u.collection),B={};if("no_match"===N){K.errare("updateAPISetting => "+q.action+" => no parent sektion matched"),J.reject("updateAPISetting => "+q.action+" => no parent sektion matched");break}N.options=N.options||{},_.each(q.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(B[t]=e)}),_.isEmpty(q.options_type)&&K.errare("updateAPISetting => "+q.action+" => missing options_type"),N.options[q.options_type]=B;break;case"sek-generate-local-skope-options-ui":B={};var Q=X.extend(!0,{},_.isObject(u.local_options)?u.local_options:{});if(_.each(q.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(B[t]=e)}),_.isEmpty(q.options_type)||!_.isString(q.options_type))K.errare("updateAPISetting => "+q.action+" => missing options_type");else{var H={};H[q.options_type]=B,u.local_options=X.extend(Q,H)}break;case"sek-add-content-in-new-sektion":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(L=0,"no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}switch(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){q.before_section===e.id&&(L=t),q.after_section===e.id&&(L=t+1)}),q.content_type){case"module":c=Y.getModuleStartingValue(q.content_id),n.collection.splice(L,0,{id:q.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+Y.guid(),level:"column",collection:[{id:q.droppedModuleId,level:"module",module_type:q.content_id,value:"no_starting_value"!==c?c:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":p=X.Deferred();var G=function(e){Y.preparePresetSectionForInjection(e).fail(function(e){J.reject("updateAPISetting => error when preparePresetSectionForInjection => "+q.action+" => "+e),p.reject(e)}).done(function(e){var t=!1;if(!_.isEmpty(q.sektion_to_replace)){var i=Y.getLevelModel(q.sektion_to_replace,u.collection);"no_match"===i&&(K.errare("updateAPISetting => "+q.action+" => no sektionToReplace matched"),J.reject("updateAPISetting => "+q.action+" => no sektionToReplace matched")),t=!0===i.is_nested}t?("no_match"===(o=Y.getLevelModel(q.in_column,u.collection))&&(K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched")),o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){q.before_section===e.id&&(L=t),q.after_section===e.id&&(L=t+1)}),o.collection.splice(L,0,{id:q.id,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):n.collection.splice(L,0,{id:q.id,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion}),p.resolve()})};Y.getPresetSectionCollection({is_user_section:q.is_user_section,presetSectionId:q.content_id,section_id:q.id}).fail(function(e){K.errare("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()",e),J.reject("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(K.errare("updateAPISetting => "+q.action+" => preset section type not found or empty : "+q.content_id,e),J.reject("updateAPISetting => "+q.action+" => preset section type not found or empty")),G(e)})}break;case"sek-add-preset-section-in-new-nested-sektion":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(o=Y.getLevelModel(q.in_column,u.collection),"no_match"==(l=Y.getLevelModel(q.in_sektion,u.collection))){J.reject("updateAPISetting => "+q.action+" => no grand parent sektion found");break}if(!0===l.is_nested){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],p=X.Deferred(),G=function(e){Y.preparePresetSectionForInjection(e).fail(function(e){J.reject("updateAPISetting => error when preparePresetSectionForInjection => "+q.action+" => "+e),p.reject(e)}).done(function(e){o.collection.push({id:q.id,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}),p.resolve()})},Y.getPresetSectionCollection({is_user_section:q.is_user_section,presetSectionId:q.content_id,section_id:q.id}).fail(function(){K.errare("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()",_er_),J.reject("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(K.errare("updateAPISetting => "+q.action+" => preset section type not found or empty : "+q.content_id,e),J.reject("updateAPISetting => "+q.action+" => preset section type not found or empty")),G(e)});break;case"sek-update-fonts":var W=Y.sniffGFonts({is_global_location:q&&!0===q.is_global_location});if(!_.isEmpty(q.font_family)&&_.isString(q.font_family)&&!_.contains(W,q.font_family)){if(q.font_family.indexOf("gfont")<0){K.errare("updateAPISetting => "+q.action+" => error => must be a google font, prefixed gfont"),J.reject("updateAPISetting => "+q.action+" => error => must be a google font, prefixed gfont");break}W.push(q.font_family)}u.fonts=W}if("pending"==J.state()){var $=function(){_.isEqual(d,u)?sektionsLocalizedData.isDevMode&&J.reject("updateAPISetting => the new setting value is unchanged when firing action : "+q.action):null!==Y.validateSettingValue(u)?(e(u,q),q.cloneId=a,J.resolve(q)):J.reject("Validation problem for action "+q.action)};!1===p?$():p.done(function(){$()}).fail(function(e){K.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}}),J.promise()},_maybeFetchSectionsFromServer:function(t){var e,i=X.Deferred();return!0===(t=t||{is_user_section:!1}).is_user_section?_.isEmpty(K.sek_userSavedSections)||_.isEmpty(K.sek_userSavedSections[t.preset_section_id])?(K.sek_userSavedSections=K.sek_userSavedSections||{},_.isUndefined(K.sek_fetchingUserSavedSections)||"pending"!=K.sek_fetchingUserSavedSections.state()?(e=wp.ajax.post("sek_get_user_saved_sections",{nonce:K.settings.nonce.save,preset_section_id:t.preset_section_id}),K.sek_fetchingUserSavedSections=e):e=K.sek_fetchingUserSavedSections,e.done(function(e){K.sek_userSavedSections[t.preset_section_id]=e,i.resolve(K.sek_userSavedSections)}).fail(function(e){i.reject(e)})):i.resolve(K.sek_userSavedSections):_.isEmpty(K.sek_presetSections)?(_.isUndefined(K.sek_fetchingPresetSections)||"pending"!=K.sek_fetchingPresetSections.state()?(e=wp.ajax.post("sek_get_preset_sections",{nonce:K.settings.nonce.save}),K.sek_fetchingPresetSections=e):e=K.sek_fetchingPresetSections,e.done(function(e){K.sek_presetSections=e,i.resolve(K.sek_presetSections)}).fail(function(e){i.reject(e)})):i.resolve(K.sek_presetSections),i.promise()},getPresetSectionCollection:function(r){var s=this,a=X.Deferred();return s._maybeFetchSectionsFromServer({is_user_section:r.is_user_section,preset_section_id:r.presetSectionId}).fail(function(e){a.reject(e)}).done(function(e){var t=X.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[r.presetSectionId]))throw new Error('getPresetSectionCollection => the preset section : "'+r.presetSectionId+'" has not been found in the collection');var i=t[r.presetSectionId],n=function(e){return _.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+s.guid(),_.isArray(e.collection)&&n(e.collection)}),e},o=function(e){return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&o(e.collection)}),e};i.id=r.section_id,i.collection=n(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o(i.collection),a.resolve(i)}),a.promise()},preparePresetSectionForInjection:function(o){var i=this,n={},r=X.Deferred(),s=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?s(e):_.isString(e)&&-1!=e.indexOf("::img-path::")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("::img-path::",""))))}),n},a=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?a(e,n):_.isString(e)&&-1!=e.indexOf("::img-path::")&&_.has(n,e)&&_.isObject(n[e])&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(s(o)).done(function(e){var t=a(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return _.isEmpty(e.level)||"setting"!==e.what||n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"!==e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{rootPanelFocus:function(){l.section.has(l.czr_activeSectionId())?l.section(l.czr_activeSectionId()).expanded(!1):l.section.each(function(e){e.expanded(!1)}),l.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getGlobalSectionsSettingId:function(){return sektionsLocalizedData.settingIdForGlobalSections},getLevelModel:function(i,n){var s=this,a="no_match",c=function(t,e,i,n){if(_.isUndefined(e)){var o=l(i)(),r=_.isObject(o)?d.extend(!0,{},o):d.extend(!0,{},s.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==a&&(t===e.id?a=e:_.isArray(e.collection)&&c(t,e.collection,i,n))}),a};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,n,e,t)}):c(i,n),a},isGlobalLocation:function(e){var t=!1;return e=e||{},_.has(e,"is_global_location")?t=e.is_global_location:_.isEmpty(e.location)?_.isEmpty(e.in_sektion)?_.isEmpty(e.id)||(t=this.isChildOfAGlobalLocation(e.id)):t=this.isChildOfAGlobalLocation(e.in_sektion):t=this.isChildOfAGlobalLocation(e.location),t},isChildOfAGlobalLocation:function(e){var r=this,s=function(t,e){var i="no_match";if(_.isUndefined(e)){var n=l(r.getGlobalSectionsSettingId())(),o=_.isObject(n)?d.extend(!0,{},n):r.getDefaultSektionSettingValue("global");e=_.isArray(o.collection)?o.collection:[]}return _.each(e,function(e){"no_match"==i&&(t===e.id?i=e:_.isArray(e.collection)&&(i=s(t,e.collection)))}),i};return"no_match"!==s(e)},getLevelPositionInCollection:function(i,n){var s=this,a="no_match",c=function(i,e,n,o){if(_.isUndefined(e)){var t=l(n)(),r=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},s.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}_.each(e,function(e,t){"no_match"==a&&(i===e.id?a=t:_.isArray(e.collection)&&c(i,e.collection,n,o))})};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,e,t,n)}):c(i,n),a},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))l.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];l.errare("getLevelProperty => invalid model for id : "+e.id,t)}else l.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=d.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(!sektionsLocalizedData.registeredModules[e].is_father){var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i}l.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically")},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},sniffGFonts:function(e){var o=this,r=[],s=function(i,n,e){if(_.isUndefined(e)){var t=l(i)();e=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},o.getDefaultSektionSettingValue(n))}_.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===o.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(r,e)&&r.push(e),(_.isArray(e)||_.isObject(e))&&s(i,n,e)})};return(e=e||{is_global_location:!1}).is_global_location?s(o.getGlobalSectionsSettingId(),"global"):s(o.localSectionsSettingId(),"local"),r},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}l.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}l.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}l.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}l.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){if(!sektionsLocalizedData.registeredModules)return l.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return l.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t=sektionsLocalizedData.registeredModules[e].starting_value;return _.isEmpty(t)?"no_starting_value":t},selectNextTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(e){var n=this,t=(n.input_parent,n.module,l.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type));e=_.isUndefined(e)?t.choices:e,!_.isEmpty(e)&&_.isObject(e)?(_.each(e,function(e,t){var i={value:t,html:e};t==n()?d.extend(i,{selected:"selected"}):"px"===t&&d.extend(i,{selected:"selected"}),d("select[data-czrtype]",n.container).append(d("<option>",i))}),d("select[data-czrtype]",n.container).selecter()):l.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in image module")},setupFontSizeAndLineHeightInputs:function(e){var t=this,i=d(".sek-font-size-line-height-wrapper",t.container),n=i.find("input[data-czrtype]").data("sek-unit"),o=function(e){return _.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new l.Value(_.isEmpty(n)?"px":o(n)),t.css_unit.bind(function(e){e=_.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("change")}),i.find('input[type="number"]').on("input change",function(e){t(d(this).val()+o(t.css_unit()))}).stepper(),i.on("click","[data-sek-unit]",function(e){e.preventDefault(),i.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",d(this).data("sek-unit")),t.css_unit(d(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0)},maybeSetupDeviceSwitcherForInput:function(){var i=this,e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");i.container.find(".customize-control-title").prepend(e),i.previewedDevice=new l.Value(l.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),i.container.find("[data-sek-device]").removeClass("active"),d(this).addClass("active");var t="desktop";try{t=d(this).data("sek-device")}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{l.previewedDevice(t)}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}i.previewedDevice(t)},i.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=i.container.find('[data-sek-device="'+l.previewedDevice()+'"]');0<t.length&&t.trigger("click")},scheduleModuleAccordion:function(e){e=e||{expand_first_control:!0};var i=this;if(d(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=d(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){d(this).attr("data-sek-accordion")||(d(this).attr("data-sek-expanded","false"),d(this).find(".czr-items-wrapper").stop(!0,!0).slideUp(0))}),t.find(".czr-items-wrapper").stop(!0,!0).slideToggle({duration:0,start:function(){t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),t.trigger("true"==t.attr("data-sek-expanded")?"sek-accordion-expanded":"sek-accordion-collapsed")}}))}),e.expand_first_control){var t=_.first(i.controls());_.isObject(t)&&!_.isEmpty(t.id)&&l.control(t.id,function(e){e.container.trigger("sek-accordion-expanded"),i.container.find(".customize-control").first().find("label > .customize-control-title").trigger("click")})}},isPromise:function(e){return e&&"function"==typeof e.then&&String(d.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=d.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(d.Deferred(function(t){(i.isPromise(e)?e:d.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),d.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||d.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:d.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{rel_path:t,nonce:l.settings.nonce.save}).fail(function(e){l.errare("sek_import_attachment ajax action failed for image "+t,e)})},cleanIds:function(e){e.id="";var t=this;return _.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&t.cleanIds(e)}),e},getDefaultSektionSettingValue:function(e){return!_.isUndefined(e)&&_.contains(["local","global"],e)||l.errare("getDefaultSektionSettingValue => the skope should be set to local or global"),"global"===e?sektionsLocalizedData.defaultGlobalSektionSettingValue:sektionsLocalizedData.defaultLocalSektionSettingValue},scheduleVisibilityOfInputId:function(t,i){var n=this.input_parent;if(!_.isFunction(i)||_.isEmpty(t))throw new Error("::scheduleVisibilityOfInputId => error when firing for input id : "+this.id);n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,m){m.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){!0!="draggable"in document.createElement("span")&&a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)}),t.setupNimbleDragZones(e.input_container)}),a.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){a.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var n=this,o=function(){a.notifications.add(new a.Notification("missing-injection-target",{type:"info",message:sektionsLocalizedData.i18n["You first need to click on a target ( with a + icon ) in the preview."],dismissible:!0})),_.delay(function(){a.notifications.remove("missing-injection-target")},3e4)};e.find('[draggable="true"]').each(function(){m(this).on("dragstart",function(e){(function(e){n.lastClickedTargetInPreview({}),e.originalEvent.dataTransfer.setData("sek-content-type",m(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-content-id",m(this).data("sek-content-id")),e.originalEvent.dataTransfer.setData("sek-section-type",m(this).data("sek-section-type")),e.originalEvent.dataTransfer.setData("sek-is-user-section",m(this).data("sek-is-user-section")),n.dndData={content_type:e.originalEvent.dataTransfer.getData("sek-content-type"),content_id:e.originalEvent.dataTransfer.getData("sek-content-id"),section_type:e.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===e.originalEvent.dataTransfer.getData("sek-is-user-section")};try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)})}m(this).addClass("sek-dragged"),m("body").addClass("sek-dragging"),a.previewer.send("sek-drag-start",{type:n.dndData.content_type})}).call(m(this),e)}).on("dragend",function(e){(function(e){m("body").removeClass("sek-dragging"),m(this).removeClass("sek-dragged"),a.previewer.send("sek-drag-stop")}).call(m(this),e)}).dblclick(function(e){(function(e){var t,i=n.lastClickedTargetInPreview();!_.isEmpty(i)&&i.id?t=n.dnd_getDropZonesElements().find('[data-sek-id="'+i.id+'"]').find(".sek-module-drop-zone-for-first-module").first():o(),t&&0<t.length?(a.czr_sektions.trigger("sek-content-dropped",{drop_target_element:t,location:t.closest('[data-sek-level="location"]').data("sek-id"),before_module:t.data("drop-zone-before-module-or-nested-section"),after_module:t.data("drop-zone-after-module-or-nested-section"),before_section:t.data("drop-zone-before-section"),after_section:t.data("drop-zone-after-section"),content_type:m(this).data("sek-content-type"),content_id:m(this).data("sek-content-id"),section_type:m(this).data("sek-section-type"),is_user_section:"true"===m(this).data("sek-is-user-section")}),n.lastClickedTargetInPreview({})):(o(),a.errare("Double click insertion => the target zone was not found"))}).call(m(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=m("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=m(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.stopPropagation(),t.dnd_OnEnterOver(m(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(m(this),e)||t.dnd_cleanOnLeaveDrop(m(this),e);break;case"drop":if(this.$cachedDropZoneCandidates=null,!t.dnd_canDrop({targetEl:m(this),evt:e}))return;e.preventDefault(),t.dnd_onDrop(m(this),e),t.dnd_cleanOnLeaveDrop(m(this),e),a.previewer.send("sek-drag-stop")}}).data("zone-droppable-setup",!0))})},dnd_isInTarget:function(e,t){var i=t.clientY,n=t.clientX,o=e[0].getBoundingClientRect(),r=n<=o.right&&o.left<=n;return i>=o.top&&o.bottom>=i&&r},dnd_toggleDragApproachClassesToDropZones:function(u){var p=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.distanceTable=[],this.$dropZones.find(".sek-drop-zone").each(function(){var e,t,i=u.clientY,n=u.clientX,o=m(this)[0].getBoundingClientRect(),r=Math.abs(i-(o.bottom-(o.bottom-o.top)/2)),s=(Math.abs(o.top-i),Math.abs(n-(o.right-(o.right-o.left)/2))),a=(o.right,o.left,r<50),c=s<50,l=n<=o.right&&o.left<=n,d=i>=o.top&&o.bottom>=i;p.distanceTable.push({el:m(this),dist:d&&l?0:(e=s,t=r,Math.sqrt(e*e+t*t))}),m(this).removeClass("sek-drag-is-in"),(a||d)&&(c||l)?(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).addClass("sek-drag-is-very-close")):(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).removeClass("sek-drag-is-very-close")),m(this).removeClass("sek-drag-is-in")});var t=_.min(_.pluck(p.distanceTable,"dist"));p.$dropTargetCandidate=null,_.each(p.distanceTable,function(e){_.isNull(p.$dropTargetCandidate)&&t===e.dist&&(p.$dropTargetCandidate=e.el)}),p.$dropTargetCandidate&&0<p.$dropTargetCandidate.length&&p.dnd_isInTarget(p.$dropTargetCandidate,u)&&p.$dropTargetCandidate.addClass("sek-drag-is-in"),p.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=m(e.currentTarget);switch(this.dndData.content_type){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:a.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return m(a.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=this,i=(e=_.extend({targetEl:{},evt:{}},e||{})).targetEl;if(!_.isObject(i)||i.length<1)return!1;var n=i.hasClass("sek-content-preset_section-drop-zone"),o=i.hasClass("sek-module-drop-zone-for-first-module"),r=!0===i.closest('[data-sek-level="location"]').data("sek-is-header-location"),s=!0===i.closest('[data-sek-level="location"]').data("sek-is-footer-location"),a="preset_section"===t.dndData.content_type&&"content"===t.dndData.section_type,c=function(e){m(".sek-no-drop-possible-message",i).length<1&&i.append(['<div class="sek-no-drop-possible-message">','<i class="material-icons">not_interested</i>',e,"</div>"].join(""))};return(r||s)&&a?(c(r?sektionsLocalizedData.i18n["The header location only accepts modules and pre-built header sections"]:sektionsLocalizedData.i18n["The footer location only accepts modules and pre-built footer sections"]),!1):s&&"preset_section"===t.dndData.content_type&&"header"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a header section in the footer location"]),!1):r&&"preset_section"===t.dndData.content_type&&"footer"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a footer section in the header location"]),!1):i.hasClass("sek-drop-zone")&&("preset_section"===t.dndData.content_type&&n||"module"===t.dndData.content_type&&!n||"preset_section"===t.dndData.content_type&&o)},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){a.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),m(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(m(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"),e.find(".sek-no-drop-possible-message").remove())},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");m.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,s=i.right,a=i.top,c=i.bottom;return r<=n&&n-r<=s-r&&(a<=o&&o-a<=c-a)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();a.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module:e.data("drop-zone-before-module-or-nested-section"),after_module:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id"),section_type:t.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===t.originalEvent.dataTransfer.getData("sek-is-user-section")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t=e.drop_target_element,i="content-in-column";switch(t.data("sek-location")){case"between-sections":i="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,i="content-in-empty-location";break;case"between-columns":i="content-in-new-column"}if("preset_section"===e.content_type)if(t.hasClass("sek-module-drop-zone-for-first-module")){var n=t.closest('div[data-sek-level="section"]');1<n.find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(i="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=n.data("sek-id")):(e.sektion_to_replace=n.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=n.closest('[data-sek-level="column"]').data("sek-id"),i="content-in-a-section-to-replace")}else"between-sections"===t.data("sek-location")&&(i="content-in-a-section-to-create");switch(i){case"content-in-column":var o=t.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),s=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(s))throw new Error("No valid level id found");a.previewer.trigger("sek-add-module",{level:r,id:s,in_column:t.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:t.closest('div[data-sek-level="section"]').data("sek-id"),before_module:e.before_module,after_module:e.after_module,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":a.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"content-in-empty-location":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;default:a.errare("sek control panel => ::reactToDrop => invalid drop case : "+i)}}(e)}catch(e){a.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;r.sekEditorExpanded=new r.Value(!1),r.sekEditorSynchronizedInput=new r.Value,n.editorEventsListenerSetup=!1;var o=function(){r.sekTinyMceEditor=r.sekTinyMceEditor||tinyMCE.get("czr-customize-content_editor"),!1===n.editorEventsListenerSetup&&(n.attachEventsToEditor(),n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};n.bind("sek-edit-module_done",function(e){if(("tiny_mce_editor"===(e=_.isObject(e)?e:{}).clicked_input_type||"czr_tiny_mce_editor_module"===e.module_type)&&!_.isEmpty(e.syncedTinyMceInputId)){var i=e.id;if(!0===n.getRegisteredModuleProperty(e.module_type,"is_father")){var t=n.getRegisteredModuleProperty(e.module_type,"children");if(_.isEmpty(t))throw new Error("::generateUIforFrontModules => a father module "+e.module_type+" is missing children modules ");_.each(t,function(e,t){"czr_tinymce_child"===e&&(i=i+"__"+t)})}r.sekEditorSynchronizedInput({control_id:i,input_id:e.syncedTinyMceInputId}),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),s("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=s(this).data("czr-control-id"),t=s(this).data("czr-input-id");if(_.isEmpty(e)||_.isEmpty(t))r.errare("toggle-tinymce-editor => missing input or control id");else{var i=s.extend(!0,{},r.sekEditorSynchronizedInput()),n=_.extend(i,{input_id:t,control_id:e});r.sekEditorSynchronizedInput(n),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),r.sekEditorSynchronizedInput.bind(function(n,e){o(),r(n.control_id,function(e){var t=e(),i=_.isObject(t)&&!_.isEmpty(t[n.input_id])?t[n.input_id]:"";i=i.replace(/\r?\n/g,"<br/>");try{r.sekTinyMceEditor.setContent(i)}catch(e){r.errare("Error when setting the tiny mce editor content in setupTinyMceEditor",e)}r.sekTinyMceEditor.focus()})}),r.sekEditorExpanded.bind(function(e,t,i){o(),e&&r.sekTinyMceEditor.focus(),s(document.body).toggleClass("czr-customize-content_editor-pane-open",e),s(window)[e?"on":"off"]("resize",function(){r.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?n.czrResizeEditor(window.innerHeight-n.$editorPane.height()):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),s("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){r.sekEditorExpanded(!1)}),s("#customize-controls").on("click",function(e){"open-tinymce-editor"!=s(e.target).data("czr-action")&&r.sekEditorExpanded(!1,{context:"clicked anywhere"})}),s(document).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=s(r.sekTinyMceEditor.iframeElement).contents().get(0);s(e).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?r.previewer.bind(e,function(){r.sekEditorExpanded(!1)}):r.previewer.bind(e,function(e){r.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachEventsToEditor:function(){var t=this;t.$editorTextArea=s("#czr-customize-content_editor"),t.$editorPane=s("#czr-customize-content_editor-pane"),t.$editorDragbar=s("#czr-customize-content_editor-dragbar"),t.$editorFrame=s("#czr-customize-content_editor_ifr"),t.$mceTools=s("#wp-czr-customize-content_editor-tools"),t.$mceToolbar=t.$editorPane.find(".mce-toolbar-grp"),t.$mceStatusbar=t.$editorPane.find(".mce-statusbar"),t.$preview=s("#customize-preview"),t.$collapseSidebar=s(".collapse-sidebar"),r.sekTinyMceEditor.on("input change keyup",function(e){if(r.control.has(r.sekEditorSynchronizedInput().control_id))try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:r.sekTinyMceEditor.getContent(),modified_editor_element:r.sekTinyMceEditor})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),t.$editorTextArea.on("input",function(e){try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:t.$editorTextArea.val(),modified_editor_element:t.$editorTextArea})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),s("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===s(e.target).attr("id")||s(e.target).hasClass("czr-resize-handle"))&&r.sekEditorExpanded())switch(e.type){case"mousedown":s(document).on("mousemove.czr-customize-content_editor",function(e){e.preventDefault(),s(document.body).addClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":s(document).off("mousemove.czr-customize-content_editor"),s(document.body).removeClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{});r.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=i.$mceTools.outerHeight()+i.$mceToolbar.outerHeight()+i.$mceStatusbar.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),i.$editorFrame.css("height",o.height-o.components),i.$collapseSidebar.css("bottom",n-o.height<56?i.$mceStatusbar.outerHeight()+4:o.height+8))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var s=o();o.initial_unit="px",u.isEmpty(s)||(o.initial_unit=u.isEmpty(s.unit)?"px":s.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,s=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},a);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",s).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),s.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),r(t)}),m.call(r,s,a),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,s);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,a,c){n.czrInputMap=n.czrInputMap||{},a.extend(n.czrInputMap,{bg_position:function(e){var t=this;a(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(a(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},i=function(e){var t=a.extend(!0,{},c.isObject(o())?o():{}),i=a.extend(!0,{},r);t=c.isObject(t)?a.extend(i,t):i;var n=s(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};a(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=a(this).val();(t=a.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",s=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=a(t,e);s.find(".selected").removeClass("selected"),s.find('div[data-sek-align="'+n+'"]').addClass("selected")};s.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),s.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{font_size:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{line_height:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(i,c,l){i.czrInputMap=i.czrInputMap||{},c.extend(i.czrInputMap,{font_picker:function(e){var a=this,o=a.input_parent,n=function(e,t){o();var n=c('select[data-czrtype="'+a.id+'"]',a.container);l.isNull(a())||l.isEmpty(a())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"),l.each([{title:sektionsLocalizedData.i18n["Web Safe Fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google Fonts"],type:"gfont",list:t.gfonts}],function(e){var t,r,s,i=c("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,s="",l.each(t,function(e){var t,i,n=e.name,o=l.isString(n)?n.replace(/[+|:]/g," "):n;t=n,i=r,(n=l.isString(t)?["[",i,"]",t].join(""):"")==a()?s+='<option selected="selected" value="'+n+'">'+o+"</option>":s+='<option value="'+n+'">'+o+"</option>"}),s)});n.append(i)});var i={escapeMarkup:function(e){return e}};e&&c.extend(i,{resultsAdapter:e,closeOnSelect:!1}),n.czrSelect2(i),c(".czrSelect2-selection__rendered",a.container).css(r(a()))},r=function(e){if(!l.isString(e)||l.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=s(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=l.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},s=function(e){if(!l.isString(e)||l.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return l.isString(t[0])?t[0].replace(/[+|:]/g," "):""};c.when(function(){var e,t=c.Deferred();l.isEmpty(i.sek_fontCollections)?(l.isUndefined(i.sek_fetchingFontCollection)||"pending"!=i.sek_fetchingFontCollection.state()?(e=i.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:a.module.id}),i.sek_fetchingFontCollection=e):e=i.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");i.sek_fontCollections=JSON.parse(e),t.resolve(i.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(i.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=c.Deferred(),void 0!==c.fn.czrSelect2&&void 0!==c.fn.czrSelect2.amd&&"function"==typeof c.fn.czrSelect2.amd.require?c.fn.czrSelect2.amd.require(["czrSelect2/results","czrSelect2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){i.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{fa_icon_picker:function(){var n=this,o=!1,e=function(t){!0!==n.iconCollectionSet&&(s.when(s.Deferred(function(t){a.isEmpty(n.sek_faIconCollection)?r.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection)})).done(function(e){!function(e){a.each(e,function(e){var t={value:e,html:r.CZR_Helpers.capitalize(e.substring(7))};t.value==n()&&(s.extend(t,{selected:"selected"}),o=!0),s("select[data-czrtype]",n.container).append(s("<option>",t))});var t,i=function(e){return e.id?s('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=o?s("<option>"):s("<option>",{selected:"selected"}),s("select[data-czrtype]",n.container).prepend(t).czrSelect2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e),t&&!0===t.open_on_init&&a.delay(function(){try{s("select[data-czrtype]",n.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){r.errare("fa_icon_picker => fail response =>",e)}),n.iconCollectionSet=!0)};n.container.on("click",function(){e()}),a.delay(function(){e({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,t=(n.input_parent(),!1),r=n.container.find("textarea"),o=n.container.find(".customize-control-title"),s=r.data("editor-params");wp.codeEditor&&(p.isUndefined(s)||!1!==s)&&(t=s),n.isReady.done(function(){var e=function(e){p.isEmpty(this.editor)&&(p.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(t)try{a(t)}catch(e){d.errare("error in sek_control => code_editor() input",e),c()}else c();o.click()},10))};e.call(n),n.module.control.container.on("sek-accordion-expanded",function(){e.call(n)})});var a=function(e){var t,i=!1;t=p.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:l}),n.editor=wp.codeEditor.initialize(r,t),u(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":o.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),o.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},c=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},l=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",o.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",o.html()),i.setting.notifications.add(n.id,new d.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),s=function(e){return l.contains(["px","em","%"],e)||(a.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new a.Value(l.isEmpty(r)?"px":s(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+s(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(a,_,m){a.czrInputMap=a.czrInputMap||{},_.extend(a.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),s=function(e){return m.contains(["px","em","%"],e)||(a.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=a.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),s=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),a=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+s+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+s+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(a).trigger("input",{previewed_device_switched:!0})};a.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new a.Value(m.isEmpty(i())?"px":s(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=a.previewedDevice()||"desktop",o=_(this).val()+s(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=a.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(a.previewedDevice()))}),r.val(d.val()||0);try{n(a.previewedDevice())}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(g,h,k){g.czrInputMap=g.czrInputMap||{},h.extend(g.czrInputMap,{borders:function(e){var a=this,c=h(".sek-borders",a.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return k.contains(["px","em","%"],e)||(g.errare("borders => error : invalid unit for input "+a.id,e),e="px"),e},_=function(e){return k.isEmpty(e)||!k.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return k.isEmpty(e)||!k.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=g.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),f=k.isEmpty(t)||k.isEmpty(t.default)?{}:t.default;a.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=a(),t="px";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=a(),t="#000000";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.col)&&(t=e._all_.col),t},s=function(e){if(!k.contains(k.union(a.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=a(),i={},n=h.extend(!0,{},f);k.isObject(t)?i=h.extend(!0,{},t):k.isString(t)&&(i={_all_:{wght:t}});var o,r,s=function(e,t){var i,n=h.extend(!0,{},f);if(!k.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=k.isObject(e)&&k.has(e,"_all_")?k.extend(n._all_,e._all_):n._all_,k.has(e,t)&&k.isObject(e[t])?k.extend(i,e[t]):n._all_}(i=h.extend(n,i),e);if(k.isEmpty(s)||!k.isObject(s)||k.isEmpty(s.wght)||k.isEmpty(s.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(s.wght),r=_(s.wght),h(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(s.col).trigger("change"),u.data("border_type_switched",!1)};a.borderColor=new g.Value(k.isEmpty(r())?"#000000":r()),a.css_unit=new g.Value(k.isEmpty(o())?"px":p(o())),a.borderType=new g.Value("_all_"),l.val((i=a(),n=1,k.isObject(i)&&k.has(i,"_all_")&&k.isObject(i._all_)&&!k.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!k.isNumber(n)||n<0)&&(g.errare("Error in borders input type for module : "+a.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(a.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){h(this).val(t.color.toString()).trigger("colorpickerchange"),a.borderColor(t.color.toString(),{border_type_switched:!0===h(this).data("border_type_switched")})},clear:function(e,t){h(this).val("").trigger("colorpickerchange"),a.borderColor("")}}),a.css_unit.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.borderColor.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),a.borderType.bind(function(e){try{s(e)}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}}),d.on("input",function(e){l.val(h(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.borderType()||"_all_",o=a.borderColor(),r=h(this).val()+p(a.css_unit()),s=h.extend(!0,{},f);(i=h.extend(!0,{},k.isObject(a())?a():s))[n]=h.extend(!0,{},i[n]||s[n]),k.isString(r)&&!k.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(k.isEmpty(t)||k.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&k.each(a.cssBorderTypes,function(e){i=k.omit(i,e)}),a(i)),d.val(h(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",h(this).data("sek-unit")),a.css_unit(h(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=h(this).data("sek-border-type")}catch(e){g.errare("borders input type => error when attaching click event",e)}a.borderType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.borderType()||"_all_",i=h.extend(!0,{},k.isObject(a())?a():{});k.isEmpty(i[t])||(i=k.omit(i,t),a(i),s(t))}),d.val(l.val()||0);try{s(a.borderType())}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}h('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,g){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var a=this,c=f(".sek-borders",a.container),l=c.find('input[type="number"]'),s=c.find('input[type="range"]'),d=function(e){return g.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+a.id,e),e="px"),e},u=function(e){return g.isEmpty(e)||!g.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return g.isEmpty(e)||!g.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),_=g.isEmpty(t)||g.isEmpty(t.default)?{}:t.default;a.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=a(),t="px";return g.isObject(e)&&g.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!g.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=a(),i={},n=f.extend(!0,{},_);g.isObject(t)?i=f.extend(!0,{},t):g.isString(t)&&(i={_all_:"0px"});var o,r,s=function(e,t){var i,n=f.extend(!0,{},_);if(!g.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=g.isObject(e)&&g.has(e,"_all_")?e._all_:n._all_,g.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(g.isEmpty(s)||!g.isString(s))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(s),r=u(s),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};a.css_unit=new m.Value(g.isEmpty(o())?"px":d(o())),a.radiusType=new m.Value("_all_"),l.val((i=a(),n=0,g.isObject(i)&&g.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!g.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+a.module.module_type+" the initial radius is invalid : "+n),n=0),n)),a.css_unit.bind(function(e,t,i){(!g.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}}),s.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.radiusType()||"_all_",o=f(this).val()+d(a.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},g.isObject(a())?a():r))[n]=f.extend(!0,{},i[n]||r[n]),g.isString(o)&&!g.isEmpty(o)&&(i[n]=o),(g.isEmpty(t)||g.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&g.each(a.cssRadiusTypes,function(e){i=g.omit(i,e)}),a(i)),s.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),a.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}a.radiusType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.radiusType()||"_all_",i=f.extend(!0,{},g.isObject(a())?a():{});g.isEmpty(i[t])||(i=g.omit(i,t),a(i),r(t))}),s.val(l.val()||0);try{r(a.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}f('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=s(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);a.isEmpty(i)||a.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),s(this).addClass("is-selected").attr("aria-pressed",!0);try{i=s(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),s('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(i,n,e){i.czrInputMap=i.czrInputMap||{},n.extend(i.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){if(e.stopPropagation(),"local"===n(this).data("sek-reset-scope"))try{i.czr_sektions.resetCollectionSetting()}catch(e){i.errare("reset_button => error when firing resetCollectionSetting() on click event",e)}})}})}(wp.customize,jQuery,_),function(o,r,s){o.czrModuleMap=o.czrModuleMap||{},r.extend(o.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}}),o.czrInputMap=o.czrInputMap||{},r.extend(o.czrInputMap,{content_type_switcher:function(e){var i,n=this;if(!o.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=o.section(n.module.control.section()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault(),n.container.find("[data-sek-content-type]").removeClass("is-selected").attr("aria-pressed",!1),r(this).addClass("is-selected").attr("aria-pressed",!0),o.czr_sektions.currentContentPickerType(r(this).data("sek-content-type"))});var t=function(t){n.container.find('[data-sek-content-type="'+(t||"module")+'"]').trigger("click"),s.each(i.controls(),function(e){s.isUndefined(e.content_type)||e.active(t===e.content_type)})};o.czr_sektions.currentContentPickerType=o.czr_sektions.currentContentPickerType||new o.Value(n()),t(o.czr_sektions.currentContentPickerType()),o.czr_sektions.currentContentPickerType.bind(function(e){t(e)})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},e.extend(t.czrModuleMap,{sek_module_picker_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{};var n=["sek_intro_sec_picker_module","sek_features_sec_picker_module","sek_contact_sec_picker_module","sek_column_layouts_sec_picker_module"];sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n=i.union(n,["sek_header_sec_picker_module","sek_footer_sec_picker_module"])),i.each(n,function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({initialize:function(e,t){var i=this;r.CZRInput.prototype.initialize.call(i,e,t),i.isReady.then(function(){i.renderUserSavedSections(),r.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:i.container})})},renderUserSavedSections:function(){var i="",n=this.container.find(".sek-content-type-wrapper"),o="";s.each(sektionsLocalizedData.userSavedSektions,function(e,t){try{o=function(e){var t=e.getDate(),i=e.getMonth(),n=e.getFullYear();e.getHours(),e.getMinutes(),e.getSeconds();return[t,["January","February","March","April","May","June","July","August","September","October","November","December"][i],n].join(" ")}(new Date(e.creation_date.replace(/-/g,"/")))}catch(e){r.errare("::renderUserSavedSections => formatDate => error",e)}i=['<div class="sek-user-section-wrapper">','<div class="sek-saved-section-title"><i class="sek-remove-user-section far fa-trash-alt"></i>'+e.title+"</div>",'<div draggable="true" data-sek-is-user-section="true" data-sek-section-type="'+e.type+'" data-sek-content-type="preset_section" data-sek-content-id="'+t+'" style="" title="'+e.title+'">','<div class="sek-overlay"></div>','<div class="sek-saved-section-description">'+e.description+"</div>",s.isEmpty(o)?"":'<div class="sek-saved-section-date"><i class="far fa-calendar-alt"></i> @missi18n Created : '+o+"</div>","</div>","</div>"].join(""),n.append(i)})}}),r.CZRDynModule.prototype.initialize.call(this,e,t)}};r.czrModuleMap=r.czrModuleMap||{},sektionsLocalizedData.isSavedSectionEnabled&&e.extend(r.czrModuleMap,{sek_my_sections_sec_picker_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_my_sections_sec_picker_module")}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){var i=this;i.inputConstructor=r.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=r.CZRItem.extend(i.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"bg-image":s.each(["bg-attachment","bg-scale","bg-repeat","bg-apply-overlay","bg-color-overlay","bg-opacity-overlay","bg-parallax","bg-parallax-force"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-color-overlay":case"bg-opacity-overlay":e=!s.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-apply-overlay")());break;case"bg-parallax-force":e=!s.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;case"bg-scale":case"bg-repeat":e=!s.isEmpty(i()+"")&&!r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;default:e=!s.isEmpty(i()+"")}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":s.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return!s.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-parallax":s.each(["bg-parallax-force","bg-scale","bg-repeat"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!s.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i());break;case"bg-repeat":case"bg-scale":e=!s.isEmpty(n.czr_Input("bg-image")()+"")&&!r.CZR_Helpers.isChecked(i())}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}}),i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-attachment")())&&n.czr_Input("bg-attachment").container.find("input[type=checkbox]").trigger("click")});break;case"bg-attachment":i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")())&&n.czr_Input("bg-parallax").container.find("input[type=checkbox]").trigger("click")})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":o.each(["custom-height","overflow_hidden"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"width-type":n.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-width",function(){return"custom"===e()}),n.czr_sektions.scheduleVisibilityOfInputId.call(e,"h_alignment",function(){return"custom"===e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":n.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":n.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_template:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_performances:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_header_footer:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_header_footer"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"global-custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_header_footer:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_header_footer"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"enable":s.each(["public_key","private_key","badge","show_failure_message","failure_message","score"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"failure_message":e=i()&&n.czr_Input("show_failure_message")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_failure_message":s.each(["failure_message"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("enable")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_global_recaptcha:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_global_recaptcha","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_recaptcha"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_beta_features:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_beta_features","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_beta_features"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module;n.czr_Input.each(function(i){switch(i.id){case"img":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"img-size",function(){return!r.isEmpty(i()+"")&&r.isNumber(i())});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!r.contains(["no-link","img-lightbox"],i())}return e})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":r.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"none"!==i()})}catch(e){o.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":r.each(["custom_width"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_title_attr":r.each(["heading_title"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"tiny_mce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)},setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRFPItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRFPItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(i){switch(i.id){case"img-type":o.each(["img-id","img-size"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":o.each(["content-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"custom"===i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":o.each(["btn-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){var i=this;i.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=r.CZRItem.extend(i.CZRIconItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),r.CZRDynModule.prototype.initialize.call(i,e,t)},CZRIconItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":s.each(["color_hover"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend(i.CZRHeadingInputMths||{}),i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRHeadingInputMths:{setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e=i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":case"link-target":e=i()}return e})}catch(e){o.errare("Heading module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&!0===n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_heading_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRHeadingInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRHeadingInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_heading_spacing_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRDividerInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRDividerInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_divider_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"quote_design":n.each(["border_width_css","border_color_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"border-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}}),n.each(["icon_color_css","icon_size_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_quote_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_cite_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=o.CZRItem.extend(i.CZRButtonItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRButtonItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){e.id})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_menu_content_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_menu_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_content_child")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"show_name_field":n.each(["name_field_label","name_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":n.each(["subject_field_label","subject_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":n.each(["message_field_label","message_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,"link-custom-url",function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fonts_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_submission_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRButtonItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"use_custom_bg_color_on_hover":r.each(["bg_color_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":r.each(["push_effect"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_font_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this,sektionsLocalizedData.registeredWidgetZones)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_widget_area_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_widget_area_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_widget_area_module")}})}(wp.customize,jQuery,_);
1
+ var CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{initialize:function(){var e=this;if(_.isUndefined(window.sektionsLocalizedData))throw new Error("CZRSeksPrototype => missing localized server params sektionsLocalizedData");if(!_.isFunction(r.czr_activeSkopes))throw new Error("CZRSeksPrototype => api.czr_activeSkopes");e.SECTION_ID_FOR_GLOBAL_OPTIONS="__globalOptionsSectionId",e.SECTION_ID_FOR_LOCAL_OPTIONS="__localOptionsSection",e.SECTION_ID_FOR_CONTENT_PICKER="__content_picker__",e.MAX_NUMBER_OF_COLUMNS=12,e.SETTING_UPDATE_BUFFER=100,e.defaultLocalSektionSettingValue=e.getDefaultSektionSettingValue("local"),e.localSectionsSettingId=new r.Value({}),e.registered=new r.Value([]),r.bind("ready",function(){e.doSektionThinksOnApiReady()}),r.bind("save-request-params",function(e){s.extend(e,{local_skope_id:r.czr_skopeBase.getSkopeProperty("skope_id")})})},doSektionThinksOnApiReady:function(){var o=this;o.registerAndSetupDefaultPanelSectionOptions(),o.localSectionsSettingId.callbacks.add(function(e,t){try{o.setupSettingsToBeSaved()}catch(e){r.errare("Error in self.localSectionsSettingId.callbacks => self.setupSettingsToBeSaved()",e)}o.initializeHistoryLogWhenSettingsRegistered(),r.previewer.send("sek-request-active-locations")});var i=function(e,t){o.setContextualCollectionSettingIdWhenSkopeSet(e,t),r.section(o.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){e.deferred.embedded.done(function(){!0!==e.boundForLocalOptionGeneration&&(e.boundForLocalOptionGeneration=!0,e.expanded.bind(function(e){!0===e&&o.generateUI({action:"sek-generate-local-skope-options-ui"})}))})}),r.section(o.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){!0!==e.nimbleGlobalOptionGenerated&&(o.generateUI({action:"sek-generate-global-options-ui"}),e.nimbleGlobalOptionGenerated=!0)}),r.trigger("nimble-ready-for-current-skope")};_.isEmpty(r.czr_activeSkopes().local)||i(),r.czr_activeSkopes.callbacks.add(function(e,t){i(e,t)}),o.reactToPreviewMsg(),o.setupDnd(),o.setupTinyMceEditor(),o.schedulePrintSectionJson(),o.bind("sek-ui-removed",function(){r.previewedDevice("desktop")}),r.previewedDevice.bind(function(t){var e=_.filter(o.registered(),function(e){return"control"==e.what});_.each(e||[],function(e){r.control(e.id,function(e){e.container.find('[data-sek-device="'+t+'"]').each(function(){s(this).trigger("click")})})})}),s("#customize-notifications-area").on("click",'[data-sek-reset="true"]',function(){o.resetCollectionSetting()}),o.bind("sek-ui-pre-removal",function(e){"control"==e.what&&-1<e.id.indexOf("draggable")&&r.control(e.id,function(e){e.container.find("[draggable]").each(function(){s(this).off("dragstart dragend")})}),"control"==e.what&&r.control(e.id,function(e){e.container.find("select").each(function(){_.isUndefined(s(this).data("czrSelect2"))||s(this).czrSelect2("destroy")})})}),r.bind("czr-new-registered",function(e){if(_.isUndefined(e.origin))throw new Error("czr-new-registered event => missing params.origin");if("nimble"===e.origin&&!1!==e.track){var t=o.registered(),i=s.extend(!0,[],t),n=_.findWhere(i,{id:e.id});if(!_.isEmpty(n)&&_.isEqual(n,e))throw new Error("register => duplicated element in self.registered() collection "+e.id);i.push(e),o.registered(i)}}),o.activeLocations=new r.Value([]),r.previewer.bind("sek-active-locations-in-preview",function(e){o.activeLocations(_.isObject(e)&&_.isArray(e.active_locations)?e.active_locations:[])}),o.setupTopBar(),sektionsLocalizedData.isSavedSectionEnabled&&o.setupSaveUI(),o.lastClickedTargetInPreview=new r.Value,o.lastClickedTargetInPreview.bind(function(e,t){_.isObject(e)&&e.id?r.previewer.send("sek-set-double-click-target",e):r.previewer.send("sek-reset-double-click-target"),clearTimeout(s(window).data("_preview_target_timer_")),s(window).data("_preview_target_timer_",setTimeout(function(){o.lastClickedTargetInPreview({}),r.previewer.send("sek-reset-double-click-target")},2e4))}),r.previewer.bind("sek-clean-target-drop-zone",function(){o.lastClickedTargetInPreview({})}),s(document).keydown(function(e){e&&27===e.keyCode&&o.lastClickedTargetInPreview({})})},registerAndSetupDefaultPanelSectionOptions:function(){var n=this,e=r.Panel.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}});r.panel(sektionsLocalizedData.sektionsPanelId,function(n){n.deferred.embedded.done(function(){var e=n.container.find("h3.accordion-section-title"),t=(n.container.find(".panel-meta .accordion-section-title"),['<img class="sek-nimble-logo" alt="'+n.params.title+'" src="',sektionsLocalizedData.baseUrl,"/assets/img/nimble/nimble_horizontal.svg?ver="+sektionsLocalizedData.nimbleVersion,'"/>'].join(""));if(0<e.length){var i=e.find("span");e.addClass("sek-side-nimble-logo-wrapper").html(t).append(i)}})}),r.CZR_Helpers.register({origin:"nimble",what:"panel",id:sektionsLocalizedData.sektionsPanelId,title:sektionsLocalizedData.i18n["Nimble Builder"],priority:-1e3,constructWith:e,track:!1}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_GLOBAL_OPTIONS,title:sektionsLocalizedData.i18n["Site wide options"],panel:sektionsLocalizedData.sektionsPanelId,priority:20,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_GLOBAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-globe sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-globe sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_LOCAL_OPTIONS,title:sektionsLocalizedData.i18n["Current page options"],panel:sektionsLocalizedData.sektionsPanelId,priority:10,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_LOCAL_OPTIONS,function(e){var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.prepend('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),0<i.length&&i.find(".customize-action").after('<i class="fas fa-map-marker-alt sek-level-option-icon"></i>'),n.scheduleModuleAccordion.call(e)})}),r.CZR_Helpers.register({origin:"nimble",what:"setting",id:sektionsLocalizedData.optNameForGlobalOptions,dirty:!1,value:sektionsLocalizedData.globalOptionDBValues,transport:"refresh",type:"option"}),r.CZR_Helpers.register({origin:"nimble",what:"section",id:n.SECTION_ID_FOR_CONTENT_PICKER,title:sektionsLocalizedData.i18n["Content Picker"],panel:sektionsLocalizedData.sektionsPanelId,priority:30,track:!1,constructWith:r.Section.extend({isContextuallyActive:function(){return this.active()},_toggleActive:function(){return!0}})}).done(function(){r.section(n.SECTION_ID_FOR_CONTENT_PICKER,function(e){"resolved"!=r.czr_initialSkopeCollectionPopulated.state()?r.czr_initialSkopeCollectionPopulated.done(function(){r.previewer.trigger("sek-pick-content",{focus:!1})}):r.previewer.trigger("sek-pick-content",{focus:!1})})})},setContextualCollectionSettingIdWhenSkopeSet:function(e,t){t=t||{},!_.isEmpty(t.local)&&r.panel(sektionsLocalizedData.sektionsPanelId).expanded()&&r.previewer.trigger("sek-pick-content"),sektionsData=r.czr_skopeBase.getSkopeProperty("sektions","local"),sektionsLocalizedData.isDevMode&&r.infoLog("::setContextualCollectionSettingIdWhenSkopeSet => SEKTIONS DATA ? ",sektionsData),_.isEmpty(sektionsData)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => no sektionsData"),_.isEmpty(sektionsData.setting_id)&&r.errare("::setContextualCollectionSettingIdWhenSkopeSet() => missing setting_id"),this.localSectionsSettingId(sektionsData.setting_id)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTopBar:function(){var t=this;t.topBarId="#nimble-top-bar",t.topBarVisible=new r.Value(!1),t.topBarVisible.bind(function(e){t.levelTreeExpanded()||t.toggleTopBar(e)}),t.mouseMovedRecently=new r.Value({}),t.mouseMovedRecently.bind(function(e){t.topBarVisible(!_.isEmpty(e))});var e=function(e){t.mouseMovedRecently({x:e.clientX,y:e.clientY}),clearTimeout(s(window).data("_scroll_move_timer_")),s(window).data("_scroll_move_timer_",setTimeout(function(){t.mouseMovedRecently.set({})},4e3))};s(window).on("mousemove scroll,",_.throttle(e,50)),r.previewer.bind("ready",function(){s(r.previewer.targetWindow().document).on("mousemove scroll,",_.throttle(e,50))}),t.setupLevelTree()},toggleTopBar:function(e){e=!!_.isUndefined(e)||e;var t,i=this;e?s.when(i.renderAndSetupTopBarTmpl({})).done(function(e){i.topBarContainer=e,_.delay(function(){s("body").addClass("nimble-top-bar-visible")},200)}):(t=s.Deferred(),s("body").removeClass("nimble-top-bar-visible"),i.topBarContainer&&i.topBarContainer.length?_.delay(function(){t.resolve()},300):t.resolve(),t.promise()).done(function(){i.topBarVisible(!1)})},renderAndSetupTopBarTmpl:function(e){var t,i=this;if(0<s(i.topBarId).length)return s(i.topBarId);try{t=wp.template("nimble-top-bar")({})}catch(e){return r.errare("Error when parsing the the top note template",e),!1}s("#customize-preview").after(s(t)),s(document).keydown(function(e){if(e.ctrlKey&&_.contains([89,90],e.keyCode))try{i.navigateHistory(90===e.keyCode?"undo":"redo")}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),s(".sek-add-content",i.topBarId).on("click",function(e){e.preventDefault(),r.previewer.trigger("sek-pick-content",{content_type:"module"})}),s(".sek-level-tree",i.topBarId).on("click",function(e){e.preventDefault(),i.levelTreeExpanded(!i.levelTreeExpanded())}),s("[data-nimble-history]",i.topBarId).on("click",function(e){try{i.navigateHistory(s(this).data("nimble-history"))}catch(e){r.errare("Error when firing self.navigateHistory",e)}}),s(".sek-settings",i.topBarId).on("click",function(e){r.panel(sektionsLocalizedData.sektionsPanelId,function(e){i.rootPanelFocus(),e.focus()})}),s(".sek-nimble-doc",i.topBarId).on("click",function(e){e.preventDefault(),window.open(s(this).data("doc-href"),"_blank")});var n=function(e){s(i.topBarId).length<1||(_.isObject(e)&&e.local_template&&"default"!==e.local_template?s(i.topBarId).find(".sek-notifications").html(['<span class="fas fa-info-circle"></span>',sektionsLocalizedData.i18n["This page uses a custom template."]].join(" ")):s(i.topBarId).find(".sek-notifications").html(""))},o=function(){r(i.localSectionsSettingId(),function(e){var t=e(),i=_.isObject(t)&&t.local_options&&t.local_options.template?t.local_options.template:null;n(i)}),r(i.getLocalSkopeOptionId()+"__template",function(e){e.bind(function(e,t){n(e)})})};return o(),r.bind("nimble-ready-for-current-skope",function(){o()}),s(i.topBarId)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{navigateHistory:function(i){var t,n,o,r,e=this,s=d.extend(!0,[],e.historyLog()),a=[];if(_.each(s,function(e){if(_.isEmpty(r)){switch(e.status){case"previous":t=e;break;case"current":n=e;break;case"future":o=e}switch(i){case"undo":_.isEmpty(n)||_.isEmpty(t)||(r=t.value,n.sektionToRefresh,t.sektionToRefresh);break;case"redo":_.isEmpty(o)||(r=o.value,n.sektionToRefresh,o.sektionToRefresh)}}}),!_.isUndefined(r)){_.isEmpty(r.local)||l(e.localSectionsSettingId())(e.validateSettingValue(r.local),{navigatingHistoryLogs:!0}),_.isEmpty(r.global)||l(e.getGlobalSectionsSettingId())(e.validateSettingValue(r.global),{navigatingHistoryLogs:!0});l.previewer.refresh(),l.previewer.trigger("sek-pick-content",{}),e.cleanRegistered(),e.cleanRegisteredLevelSettingsAfterHistoryNavigation()}var c=_.findKey(s,{status:"current"});c=Number(c),_.isNumber(c)?(_.each(s,function(e,t){switch(newLog=d.extend(!0,{},e),t=Number(t),i){case"undo":0<c&&(t===c-1?newLog.status="current":t===c&&(newLog.status="future"));break;case"redo":s.length>c+1&&(t===c?newLog.status="previous":t===c+1&&(newLog.status="current"))}a.push(newLog)}),e.historyLog(a)):l.errare("Error when navigating the history log, the current key should be a number")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(b,z){z.extend(CZRSeksPrototype,{setupLevelTree:function(){var i=this;i.levelTree=new b.Value([]),i.levelTree.bind(function(){i.levelTreeExpanded()&&i.renderOrRefreshTree()}),i.levelTreeExpanded=new b.Value(!1),i.levelTreeExpanded.bind(function(e){if(z("body").toggleClass("sek-level-tree-expanded",e),e){if(i.setLevelTreeValue(),_.isEmpty(i.levelTree()))return b.previewer.trigger("sek-notify",{type:"info",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>"+sektionsLocalizedData.i18n["No sections to navigate"]+"</strong>","</span>"].join("")}),void i.levelTreeExpanded(!1);z("#customize-preview iframe").css("z-index",1),i.renderOrRefreshTree()}else 0<z("#nimble-level-tree").length&&_.delay(function(){z("#nimble-level-tree").remove(),z("#customize-preview iframe").css("z-index","")},300)}),i.activeLocations.bind(function(){_.isEmpty(i.levelTree())||i.renderOrRefreshTree()}),b.previewer.bind("ready",function(){i.localSectionsSettingId.callbacks.add(function(){i.levelTreeExpanded(!1),_.each([i.getGlobalSectionsSettingId(),i.localSectionsSettingId(),sektionsLocalizedData.optNameForGlobalOptions],function(e){b(e)._isBoundForNimbleLevelTree||(b(e).bind(function(e){i.setLevelTreeValue()}),b(e)._isBoundForNimbleLevelTree=!0)})})}),z("body").on("click","#nimble-level-tree [data-nimb-level]",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.send("sek-animate-to-level",{id:t.data("nimb-id")}),b.previewer.send("sek-display-level-ui",{id:t.data("nimb-id")})}),z("body").on("click","#nimble-level-tree .sek-remove-level",function(e){e.preventDefault(),e.stopPropagation();var t=z(e.target).closest("[data-nimb-level]");b.previewer.trigger("sek-remove",{level:t.data("nimb-level"),id:t.data("nimb-id"),location:t.closest('[data-nimb-level="location"]').data("nimb-id"),in_sektion:t.closest('[data-nimb-level="section"]').data("nimb-id"),in_column:t.closest('[data-nimb-level="column"]').data("nimb-id")}),t.fadeOut("slow"),i.renderOrRefreshTree()}),z("body").on("click",".sek-close-level-tree",function(e){e.preventDefault(),i.levelTreeExpanded(!1)})},setLevelTreeValue:function(){var e,t,i,n,o,r=this.getGlobalSectionsSettingId(),s=this.localSectionsSettingId(),a=sektionsLocalizedData.optNameForGlobalOptions,c=!1;if(_.each([r,s,a],function(e){b.has(e)||(c=e)}),!1===c){e=b(r)(),i=_.isObject(e)?z.extend(!0,{},e):{},i=_.isEmpty(i.collection)?[]:i.collection,i=_.isArray(i)?i:[],t=b(s)(),t=_.isObject(t)?t:{},n=z.extend(!0,{},t),n=_.isEmpty(n.collection)?[]:n.collection,n=_.isArray(n)?n:[];var l,d=_.union(i,n),u=!1,p=!1;o=b(a)(),o=_.isObject(o)?o:{},t.local_options&&t.local_options.local_header_footer&&(u="nimble_local"===(l=t.local_options.local_header_footer["header-footer"])),o.global_header_footer&&!u&&"theme"!==l&&(p="nimble_global"===o.global_header_footer["header-footer"]||"nimble_global"===l);var m,f,g=z.extend(!0,[],d);g=_.filter(g,function(e,t){return!_.contains(["nimble_global_header","nimble_global_footer","nimble_local_header","nimble_local_footer"],e.id)});var h=function(e){m=_.findWhere(d,{id:"nimble_"+e+"_header"}),f=_.findWhere(d,{id:"nimble_"+e+"_footer"}),g.unshift(m),g.push(f)};u?h("local"):p&&h("global");var k,y=this.activeLocations(),v=[];_.isEmpty(y)?v=g:_.each(y,function(e){k=_.findWhere(g,{id:e}),_.isUndefined(k)||v.push(k)}),this.levelTree(v)}else b.errare("::setLevelTreeValue => a setting id is not registered ")},renderOrRefreshTree:function(){var e;if(z("#nimble-level-tree").length<1){try{e=wp.template("nimble-level-tree")({})}catch(e){return b.errare("Error when parsing the the nimble-level-tree template",e),!1}z("#customize-preview").after(z(e))}z("#nimble-level-tree").find(".sek-tree-wrap").html(this.getLevelTreeHtml())},getLevelTreeHtml:function(e,t){var i=this;e=e||i.levelTree();var n,o,r,s=!1;if(!_.isArray(e)||_.isEmpty(e))return b.errare("::buildLevelTree => invalid collection param",e),r;var a='<i class="material-icons sek-remove-level" title="'+sektionsLocalizedData.i18n["Remove this element"]+'">delete_forever</i>';return r="<ul>",_.each(e,function(e){_.isUndefined(e.level)?b.errare("::buildLevelTree => missing level property",e):_.isUndefined(e.id)?b.errare("::buildLevelTree => missing id property",e):(n=e.level,"location"===(o=n)&&(s=!_.contains(i.activeLocations(),e.id)),s||(sektionsLocalizedData.i18n[n]&&(o=sektionsLocalizedData.i18n[n]),!0===e.is_nested&&(o=sektionsLocalizedData.i18n["nested section"]),a="location"!==n?a:"",r+='<li data-nimb-level="'+n+'" data-nimb-id="'+e.id+'">',r+='<div class="sek-level-infos"><div class="sek-inner-level-infos">',"module"===n&&(r+=[i.getTreeModuleIcon(e.module_type),i.getTreeModuleTitle(e.module_type)].join(" ")),r+=[" ",o,"( id :",e.id,")",a].join(" "),r+="</div></div>",_.isArray(e.collection)&&!_.isEmpty(e.collection)&&(r+=i.getLevelTreeHtml(e.collection,t)),r+="</li>"))}),r+="</ul>"},getTreeModuleIcon:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i={svg:e.icon?sektionsLocalizedData.moduleIconPath+e.icon:"",font:e.font_icon?e.font_icon:""})}),_.isEmpty(i.svg)?_.isEmpty(i.font)?void 0:i.font:'<img class="sek-svg-mod-icon" src="'+i.svg+'"/>'},getTreeModuleTitle:function(t){var i={};return _.each(sektionsLocalizedData.moduleCollection,function(e){_.isEmpty(i)&&t===e["content-id"]&&(i=e.title)}),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,c){c.extend(CZRSeksPrototype,{setupSaveUI:function(){var n=this;n.saveUIVisible=new a.Value(!1),n.saveUIVisible.bind(function(e,t,i){n.toggleSaveUI(e,i?i.id:null)})},toggleSaveUI:function(e,t){e=!!_.isUndefined(e)||e;var i,n=this;e?c.when(n.renderAndSetupSaveUITmpl({})).done(function(e){n.saveUIContainer=e,_.delay(function(){c("body").addClass("nimble-save-ui-visible")},200),c("#sek-saved-section-id").val(t)}):(i=c.Deferred(),c("body").removeClass("nimble-save-ui-visible"),0<c("#nimble-top-save-ui").length?_.delay(function(){n.saveUIContainer.remove(),i.resolve()},300):i.resolve(),i.promise()).done(function(){n.saveUIVisible(!1)})},preProcessSektion:function(e){var t=this.cleanIds(e);return _.omit(t,function(e,t){return _.contains(["id","level"],t)})},renderAndSetupSaveUITmpl:function(e){if(0<c("#nimble-top-save-ui").length)return c("#nimble-top-save-ui");var s=this;try{_tmpl=wp.template("nimble-top-save-ui")({})}catch(e){return a.errare("Error when parsing the the top note template",e),!1}return c("#customize-preview").after(c(_tmpl)),c(".sek-do-save-section","#nimble-top-save-ui").on("click",function(e){e.preventDefault();var t=c.extend(!0,{},s.getLevelModel(c("#sek-saved-section-id").val())),i=c("#sek-saved-section-title").val(),n=c("#sek-saved-section-description").val(),o=s.guid(),r=s.preProcessSektion(t);if(_.isEmpty(i))return c("#sek-saved-section-title").addClass("error"),void a.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")});c("#sek-saved-section-title").removeClass("error"),wp.ajax.post("sek_save_section",{nonce:a.settings.nonce.save,sek_title:i,sek_description:n,sek_id:o,sek_data:JSON.stringify(r)}).done(function(e){a.previewer.trigger("sek-notify",{type:"success",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n Your section has been saved.</strong>","</span>"].join("")})}).fail(function(e){a.errorLog("ajax sek_save_section => error",e),a.previewer.trigger("sek-notify",{type:"error",duration:1e4,message:['<span style="font-size:0.95em">',"<strong>@missi18n You need to set a title</strong>","</span>"].join("")})})}),c(".sek-cancel-save","#nimble-top-save-ui").on("click",function(e){e.preventDefault(),s.saveUIVisible(!1)}),c("#nimble-top-save-ui")}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,c){c.extend(CZRSeksPrototype,{setupSettingsToBeSaved:function(){var i,o=this,e={local:{collectionSettingId:o.localSectionsSettingId()},global:{collectionSettingId:o.getGlobalSectionsSettingId()}};_.each(e,function(e,t){if(i=a.czr_skopeBase.getSkopeProperty("sektions",t).db_values,_.isEmpty(e.collectionSettingId))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");if(!a.has(e.collectionSettingId)){a.CZR_Helpers.register({what:"setting",id:e.collectionSettingId,value:o.validateSettingValue(_.isObject(i)?i:o.getDefaultSektionSettingValue(t)),transport:"postMessage",type:"option",track:!1,origin:"nimble"});a(e.collectionSettingId,function(n){n.bind(_.debounce(function(e,t,i){o.trackHistoryLog(n,i)},1e3))})}})},trackHistoryLog:function(e,t){var i=e.id===this.getGlobalSectionsSettingId();if(t&&!0!==t.navigatingHistoryLogs){var n,o=[],r=c.extend(!0,[],this.historyLog());_.isEmpty(t.in_sektion)?_.isEmpty(t.to_sektion)||(n=t.to_sektion):n=t.in_sektion,_.each(r,function(e){"future"!=e.status&&(c.extend(e,{status:"previous"}),o.push(e))}),o.push({status:"current",value:i?{global:e()}:{local:e()},action:_.isObject(t)&&t.action||"",sektionToRefresh:n}),this.historyLog(o)}},initializeHistoryLogWhenSettingsRegistered:function(){this.historyLog=new a.Value([{status:"current",value:{local:a(this.localSectionsSettingId())(),global:a(this.getGlobalSectionsSettingId())()},action:"initial"}]),this.historyLog.bind(function(e){if(!_.isEmpty(e)){var t=_.findKey(e,{status:"current"});t=Number(t),c("#nimble-top-bar").find("[data-nimble-history]").each(function(){"undo"===c(this).data("nimble-history")?c(this).attr("data-nimble-state",t<=0?"disabled":"enabled"):c(this).attr("data-nimble-state",e.length<=t+1?"disabled":"enabled")})}})},validateSettingValue:function(i){if(!_.isObject(i))return a.errare("validation error => the setting should be an object",i),null;var n={},o=!1,e=[],r=function(e){a.errare(e,i),a.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")}),o=!0},s=function(t){if(!o)if(_.isUndefined(t)&&_.isEmpty(n)){if(t=c.extend(!0,{},i),_.isUndefined(t.id)||_.isUndefined(t.level)){if(_.isUndefined(t.collection))return void r("validation error => the root level is missing the collection of locations");if(!_.isEmpty(t.level)||!_.isEmpty(t.id))return void r('validation error => the root level should not have a "level" or an "id" property');_.each(i.collection,function(e){n=t,s(e)})}}else{if(_.isEmpty(t.id)||!_.isString(t.id))return void r("validation error => a "+t.level+" level must have a valid id");if(_.contains(e,t.id))return void r("validation error => duplicated level id : "+t.id);if(e.push(t.id),_.isEmpty(t.level)||!_.isString(t.level))return void r("validation error => a "+t.level+" level must have a level property");if(!_.contains(["location","section","column","module"],t.level))return void r('validation error => the level "'+t.level+'" is not authorized');if("module"==t.level){if(!_.isUndefined(t.collection))return void r("validation error => a module can not have a collection property")}else if(_.isUndefined(t.collection))return void r("validation error => missing collection property for level => "+t.level+" "+t.id);switch(_.isUndefined(t.ver_ini)&&a.errare("validateSettingValue() => validation error => a "+t.level+' should have a version property : "ver_ini"'),t.level){case"location":if(!_.isEmpty(n.level))return void r("validation error => the parent of location "+t.id+" should have no level set");break;case"section":if(t.is_nested&&"column"!=n.level)return void r("validation error => the nested section "+t.id+" must be child of a column");if(!t.is_nested&&"location"!=n.level)return void r("validation error => the section "+t.id+" must be child of a location");break;case"column":if("section"!=n.level)return void r("validation error => the column "+t.id+" must be child of a section");break;case"module":if("column"!=n.level)return void r("validation error => the module "+t.id+" must be child of a column")}"module"!=t.level&&_.each(t.collection,function(e){n=c.extend(!0,{},t),s(e)})}};return s(),o?null:i},resetCollectionSetting:function(){if(_.isEmpty(this.localSectionsSettingId()))throw new Error("setupSettingsToBeSaved => the collectionSettingId is invalid");a(this.localSectionsSettingId())(this.getDefaultSektionSettingValue("local")),a.previewer.refresh(),a.notifications.remove("sek-notify"),a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("sek-reset-done",{type:"success",message:sektionsLocalizedData.i18n["Reset complete"],dismissible:!0})),_.delay(function(){a.notifications.remove("sek-reset-done")},5e3)})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(c,n){n.extend(CZRSeksPrototype,{reactToPreviewMsg:function(){var o=this,r={},s={},a=!0,e={"sek-add-section":{callback:function(e){return a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},r={action:"sek-add-section",id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),before_section:e.before_section,after_section:e.after_section,is_first_section:e.is_first_section},o.updateAPISetting(r)},complete:function(e){e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),c.previewer.trigger("sek-pick-content",{id:e.apiParams?e.apiParams.id:"",content_type:"section"}),c.previewer.send("sek-animate-to-level",{id:e.apiParams.id})}},"sek-add-column":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-column",in_sektion:e.in_sektion,autofocus:e.autofocus},o.updateAPISetting(r)},complete:function(e){!1!==e.apiParams.autofocus&&c.previewer.trigger("sek-pick-content",{})}},"sek-add-module":{callback:function(e){return a=!0,s={},r={id:sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),action:"sek-add-module",in_sektion:e.in_sektion,in_column:e.in_column,module_type:e.content_id,before_module:e.before_module,after_module:e.after_module},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_column,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-remove":{callback:function(e){switch(a=!0,s={},e.level){case"section":var t=o.getLevelModel(e.id);if("no_match"===t){c.errare("reactToPreviewMsg => sek-remove-section => no sektionToRemove matched");break}r={action:"sek-remove-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:t.is_nested};break;case"column":r={action:"sek-remove-column",id:e.id,in_sektion:e.in_sektion};break;case"module":r={action:"sek-remove-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;default:c.errare("::reactToPreviewMsg => sek-remove => missing level ",e)}return o.updateAPISetting(r)},complete:function(e){if(c.previewer.trigger("sek-pick-content",{}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),"sek-remove-section"===e.apiParams.action){var t=o.getLevelModel(e.apiParams.location);_.isEmpty(t.collection)&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}}},"sek-move":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-move-section",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),newOrder:e.newOrder,from_location:e.from_location,to_location:e.to_location};break;case"column":r={action:"sek-move-column",id:e.id,newOrder:e.newOrder,from_sektion:e.from_sektion,to_sektion:e.to_sektion};break;case"module":r={action:"sek-move-module",id:e.id,newOrder:e.newOrder,from_column:e.from_column,to_column:e.to_column,from_sektion:e.from_sektion,to_sektion:e.to_sektion}}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.action){case"sek-move-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),e.apiParams.from_location!=e.apiParams.to_location&&(c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.to_location}),c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.from_location}));break;case"sek-move-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column});break;case"sek-refresh-modules-in-column":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column})}}},"sek-move-section-up":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"up",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-move-section-down":{callback:function(e){return a=!1,s={},r={action:"sek-move-section-up-down",direction:"down",id:e.id,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column),location:e.location},o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location})}},"sek-duplicate":{callback:function(e){switch(a=!0,s={},e.level){case"section":r={action:"sek-duplicate-section",id:e.id,location:e.location,in_sektion:e.in_sektion,in_column:e.in_column,is_nested:!_.isEmpty(e.in_sektion)&&!_.isEmpty(e.in_column)};break;case"column":r={action:"sek-duplicate-column",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column};break;case"module":r={action:"sek-duplicate-module",id:e.id,in_sektion:e.in_sektion,in_column:e.in_column}}return o.updateAPISetting(r)},complete:function(e){var t;switch(e.apiParams.action){case"sek-duplicate-section":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"section",in_sektion:e.apiParams.id}),t=e.apiParams.location,c.previewer.send("sek-animate-to-level",{id:e.apiParams.id});break;case"sek-duplicate-column":c.previewer.trigger("sek-edit-options",{id:e.apiParams.id,level:"column",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_sektion;break;case"sek-duplicate-module":c.previewer.trigger("sek-edit-module",{id:e.apiParams.id,level:"module",in_sektion:e.apiParams.in_sektion,in_column:e.apiParams.in_column}),t=e.apiParams.in_column}c.previewer.trigger("sek-refresh-stylesheet",{id:t,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")})}},"sek-resize-columns":function(e){return a=!0,s={},r=e,o.updateAPISetting(r)},"sek-add-content-in-new-sektion":{callback:function(e){switch(a=!!_.isUndefined(e.send_to_preview)||e.send_to_preview,s={},(r=e).action="sek-add-content-in-new-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),e.content_type){case"module":r.droppedModuleId=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid();break;case"preset_section":c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),c.previewer.send("sek-maybe-print-loader",{fullPageLoader:!0})}return o.updateAPISetting(r)},complete:function(e){switch(e.apiParams.content_type){case"module":c.previewer.trigger("sek-edit-module",{level:"module",id:e.apiParams.droppedModuleId});break;case"preset_section":c.previewer.send("sek-clean-loader",{cleanFullPageLoader:!0})}o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)});var t=e.location_skope_id;_.isUndefined(t)&&(t=!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id")),c.previewer.trigger("sek-refresh-stylesheet",{location_skope_id:t,is_global_location:o.isGlobalLocation(e.apiParams)}),e.apiParams.is_first_section&&c.previewer.trigger("sek-refresh-level",{level:"location",id:e.apiParams.location}),e.apiParams.sektion_to_replace&&c.previewer.trigger("sek-remove",{id:e.apiParams.sektion_to_replace,location:e.apiParams.location,in_column:e.apiParams.in_column,level:"section"})}},"sek-add-preset-section-in-new-nested-sektion":{callback:function(e){return a=!1,s={},(r=e).action="sek-add-preset-section-in-new-nested-sektion",r.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+o.guid(),c.previewer.send("sek-maybe-print-loader",{loader_located_in_level_id:e.location}),o.updateAPISetting(r)},complete:function(e){c.previewer.trigger("sek-refresh-stylesheet",{id:e.apiParams.in_sektion,location_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id")}),o.updateAPISetting({action:"sek-update-fonts",is_global_location:o.isGlobalLocation(e.apiParams)}),c.previewer.trigger("sek-refresh-level",{level:"section",id:e.apiParams.in_sektion})}},"sek-pick-content":function(e){return e=_.isObject(e)?e:{},c.czr_sektions.currentContentPickerType=c.czr_sektions.currentContentPickerType||new c.Value,c.czr_sektions.currentContentPickerType(e.content_type||"module"),_.isObject(e)&&e.id&&o.lastClickedTargetInPreview({id:e.id}),a=!0,r={},s={action:"sek-generate-draggable-candidates-picker-ui",content_type:(e=e||{}).content_type||"module",was_triggered:!_.has(e,"was_triggered")||e.was_triggered,focus:!_.has(e,"focus")||e.focus},o.generateUI(s)},"sek-edit-options":function(e){return a=!0,r={},_.isEmpty(e.id)?n.Deferred(function(){this.reject("missing id")}):(s={action:"sek-generate-level-options-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s))},"sek-edit-module":function(e){return a=!0,r={},s={action:"sek-generate-module-ui",level:e.level,id:e.id,in_sektion:e.in_sektion,in_column:e.in_column,options:e.options||[]},o.generateUI(s)},"sek-notify":function(t){return a=!1,n.Deferred(function(){c.panel(sektionsLocalizedData.sektionsPanelId,function(e){c.notifications.add(new c.Notification("sek-notify",{type:t.type||"info",message:t.message,dismissible:!0})),_.delay(function(){c.notifications.remove("sek-notify")},t.duration||5e3)}),this.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-level":function(t){return a=!0,n.Deferred(function(e){r={action:"sek-refresh-level",level:t.level,id:t.id},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-refresh-stylesheet":function(t){return a=!0,t=t||{},n.Deferred(function(e){r={id:t.id},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})},"sek-toggle-save-section-ui":function(t){return a=!1,o.saveUIVisible(!0,t),n.Deferred(function(e){r={},s={},e.resolve({is_global_location:o.isGlobalLocation(t)})})}};_.each(e,function(i,n){c.previewer.bind(n,function(t){var e;if(_.isFunction(i))e=i;else{if(!_.isFunction(i.callback))return void c.errare("::reactToPreviewMsg => invalid callback for action "+n);e=i.callback}try{e(t).done(function(e){e=e||{},a?c.previewer.send(n,{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:c.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:c.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:r,uiParams:s,cloneId:!_.isEmpty(e.cloneId)&&e.cloneId}):c.previewer.trigger([n,"done"].join("_"),{apiParams:r,uiParams:s}),o.trigger([n,"done"].join("_"),t)}).fail(function(e){c.errare("reactToPreviewMsg => error when firing "+n,e),c.previewer.trigger("sek-notify",{type:"error",duration:3e4,message:['<span style="font-size:0.95em">',"<strong>"+e+"</strong>","<br>",sektionsLocalizedData.i18n["If this problem locks Nimble Builder, you can try resetting the sections of this page."],"<br>",'<span style="text-align:center;display:block">','<button type="button" class="button" aria-label="'+sektionsLocalizedData.i18n.Reset+'" data-sek-reset="true">'+sektionsLocalizedData.i18n.Reset+"</button>","</span>","</span>"].join("")})})}catch(e){c.errare("reactToPreviewMsg => error when receiving "+n,e)}})}),_.each(e,function(t,i){c.previewer.bind([i,"done"].join("_"),function(e){if(_.isFunction(t.complete))try{t.complete(e)}catch(e){c.errare("reactToPreviewMsg done => error when receiving "+[i,"done"].join("_"),e)}})})},schedulePrintSectionJson:function(){var i=this;c.previewer.bind("sek-to-json",function(e){var t=n.extend(!0,{},i.getLevelModel(e.id));console.log(JSON.stringify(i.cleanIds(t)))})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(k,y){y.extend(CZRSeksPrototype,{generateUI:function(e){var t=this,i=y.Deferred();switch(_.isEmpty(e.action)&&i.reject("generateUI => missing action"),e.action){case"sek-generate-module-ui":try{i=t.generateUIforFrontModules(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-level-options-ui":try{i=t.generateUIforLevelOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-draggable-candidates-picker-ui":t.cleanRegistered();try{i=t.generateUIforDraggableContent(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-local-skope-options-ui":t.cleanRegistered();try{i=t.generateUIforLocalSkopeOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}break;case"sek-generate-global-options-ui":t.cleanRegistered();try{i=t.generateUIforGlobalOptions(e,i)}catch(e){k.errare("::generateUI() => error",e),i=y.Deferred()}}return"pending"==i.state()?i.resolve().promise():i.promise()},updateAPISettingAndExecutePreviewActions:function(n){if(!_.isEmpty(n.settingParams)&&_.has(n.settingParams,"to")){var o,r=this,e=n.settingParams.to,t=null,i=!1;if(!_.isEmpty(n.settingParams.args)&&_.has(n.settingParams.args,"moduleRegistrationParams")){var s=n.settingParams.args.moduleRegistrationParams.control,a=n.settingParams.args.moduleRegistrationParams.id,c=s.czr_Module(a);if(_.isEmpty(c)?k.errare("updateAPISettingAndExecutePreviewActions => missing parentModuleInstance",n):(t=c.module_type,i=c.isMultiItem()),!i&&_.isObject(e)?o=r.normalizeAndSanitizeSingleItemInputValues(e,t):(o=[],_.each(e,function(e){o.push(r.normalizeAndSanitizeSingleItemInputValues(e,t))})),_.isEmpty(n.defaultPreviewAction))k.errare("updateAPISettingAndExecutePreviewActions => missing defaultPreviewAction in passed params. No action can be triggered to the api.previewer.",n);else{var l,d="refresh_stylesheet"===n.defaultPreviewAction,u="refresh_markup"===n.defaultPreviewAction,p="refresh_fonts"===n.defaultPreviewAction,m="refresh_preview"===n.defaultPreviewAction,f=n.settingParams.args.input_changed;_.isUndefined(f)||(l=r.getInputRegistrationParams(f,t),_.isUndefined(l.refresh_stylesheet)||(d=Boolean(l.refresh_stylesheet)),_.isUndefined(l.refresh_markup)||(u=Boolean(l.refresh_markup)),_.isUndefined(l.refresh_fonts)||(p=Boolean(l.refresh_fonts)),_.isUndefined(l.refresh_preview)||(m=Boolean(l.refresh_preview)));var g=function(){if(!0!==n.isGlobalOptions)return r.updateAPISetting({action:n.uiParams.action,id:n.uiParams.id,value:o,in_column:n.uiParams.in_column,in_sektion:n.uiParams.in_sektion,options_type:n.options_type,settingParams:n.settingParams}).done(function(e){!0===d&&k.previewer.send("sek-refresh-stylesheet",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-stylesheet",id:n.uiParams.id,level:n.uiParams.level}}),!0===u&&k.previewer.send("sek-refresh-level",{location_skope_id:!0===e.is_global_location?sektionsLocalizedData.globalSkopeId:k.czr_skopeBase.getSkopeProperty("skope_id"),local_skope_id:k.czr_skopeBase.getSkopeProperty("skope_id"),apiParams:{action:"sek-refresh-level",id:n.uiParams.id,level:n.uiParams.level},skope_id:k.czr_skopeBase.getSkopeProperty("skope_id")}),!0===m&&k.previewer.refresh()});if(_.isEmpty(n.options_type))k.errare("updateAPISettingAndExecutePreviewActions => error when updating the global options => missing options_type");else{var e=k(sektionsLocalizedData.optNameForGlobalOptions)(),t=y.extend(!0,{},_.isObject(e)?e:{}),i={};_.each(o||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(i[t]=e)}),t[n.options_type]=i,k(sektionsLocalizedData.optNameForGlobalOptions)(t)}};if(!0===p){var h=n.settingParams.args.input_value;if(!_.isString(h))return void k.errare("updateAPISettingAndExecutePreviewActions => font-family must be a string",h);-1<h.indexOf("gfont")?r.updateAPISetting({action:"sek-update-fonts",font_family:h,is_global_location:r.isGlobalLocation(n.uiParams)}).always(function(){g().then(function(){r.updateAPISetting({action:"sek-update-fonts",is_global_location:r.isGlobalLocation(n.uiParams)})})}):g()}else g()}}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.args.moduleRegistrationParams The api main setting can not be updated",n)}else k.errare("updateAPISettingAndExecutePreviewActions => missing params.settingParams.to. The api main setting can not be updated",n)},normalizeAndSanitizeSingleItemInputValues:function(e,o){var i,r={},n={},s=null,a=this;return _.each(e,function(e,t){var i,n;_.contains(["title","id"],t)||(null!==o&&"no_default_value_specified"===(s=a.getInputDefaultValue(t,o))&&k.infoLog("::updateAPISettingAndExecutePreviewActions => missing default value for input "+t+" in module "+o),i=e,n=s,(_.isBoolean(i)||_.isBoolean(n)?Boolean(i)===Boolean(n):_.isNumber(i)||_.isNumber(n)?Number(i)===Number(n):_.isString(i)||_.isString(n)?i+""==n+"":_.isObject(i)&&_.isObject(n)?_.isEqual(i,n):_.isArray(i)&&_.isArray(n)?JSON.stringify(i.sort())===JSON.stringify(n.sort()):i===n)||(_.isString(e)||_.isObject(e))&&_.isEmpty(e)||(r[t]=e))}),_.each(r,function(e,t){switch(a.getInputType(t,o)){case"text":case"textarea":case"check":case"gutencheck":case"select":case"radio":case"number":case"upload":case"upload_url":case"color":case"wp_color_alpha":case"wp_color":case"content_picker":case"tiny_mce_editor":case"password":case"range":case"range_slider":case"hidden":case"h_alignment":case"h_text_alignment":case"spacing":case"bg_position":case"v_alignment":case"font_size":case"line_height":case"font_picker":default:i=e}n[t]=i}),n},isUIControlAlreadyRegistered:function(t){var e=_.filter(this.registered(),function(e){return e.id==t&&"control"===e.what}),i=!1;return _.isEmpty(e)?i=k.control.has(t):(i=!0,1<e.length&&k.errare("generateUI => why is this control registered more than once ? => "+t)),i}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(s,a){a.extend(CZRSeksPrototype,{generateUIforDraggableContent:function(o,e){var r=this,t={};a.extend(t,{content_type_switcher:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_content_type_switcher_ui",module_type:"sek_content_type_switcher_module",controlLabel:sektionsLocalizedData.i18n["Select a content type"],priority:0,settingValue:{content_type:o.content_type}},module_picker:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+"_sek_draggable_modules_ui",module_type:"sek_module_picker_module",controlLabel:sektionsLocalizedData.i18n["Pick a module"],content_type:"module",priority:20,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_intro_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_intro_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for an introduction"],content_type:"section",expandAndFocusOnInit:!0,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_features_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_features_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Sections for services and features"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_contact_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_contact_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Contact-us sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_column_layouts_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_column_layouts_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Empty sections with columns layout"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isNimbleHeaderFooterEnabled&&a.extend(t,{sek_header_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_header_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Header sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'},sek_footer_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_footer_sec_picker_module",controlLabel:sektionsLocalizedData.i18n["Footer sections"],content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}}),sektionsLocalizedData.isSavedSectionEnabled&&a.extend(t,{sek_my_sections_sec_picker_module:{settingControlId:sektionsLocalizedData.optPrefixForSektionsNotSaved+r.guid()+"_sek_draggable_sections_ui",module_type:"sek_my_sections_sec_picker_module",controlLabel:"@missi18n My sections",content_type:"section",expandAndFocusOnInit:!1,priority:10,icon:'<i class="fas fa-grip-vertical sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return r.isUIControlAlreadyRegistered(n)?s.control(n,function(t){t.focus({completeCallback:function(){var e=t.container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}})}):(_do_register_=function(){_.each(t,function(n,e){s.has(n.settingControlId)||(s(n.settingControlId,function(e){e.bind(function(e,t){s.errare("generateUIforDraggableContent => the setting() should not changed")})}),s.CZR_Helpers.register({origin:"nimble",level:o.level,what:"setting",id:n.settingControlId,dirty:!1,value:n.settingValue||{},transport:"postMessage",type:"_nimble_ui_"})),s.CZR_Helpers.register({origin:"nimble",level:o.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.SECTION_ID_FOR_CONTENT_PICKER,priority:n.priority||10,settings:{default:n.settingControlId},track:!1}).done(function(){s.control(n.settingControlId,function(e){e.content_type=n.content_type,!0===o.focus&&e.focus({completeCallback:function(){}});var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),"section"===e.content_type?(e.container.find(".czr-items-wrapper").hide(),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&(e.container.find(".czr-items-wrapper").show(),t.trigger("click"))):e.container.attr("data-sek-accordion","no")})})})},s.section(r.SECTION_ID_FOR_CONTENT_PICKER,function(e){_do_register_();var t=e.container.find(".accordion-section-title"),i=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.prepend('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),0<i.length&&i.find(".sek-level-option-icon").length<1&&i.find(".customize-action").after('<i class="fas fa-grip-vertical sek-level-option-icon"></i>'),r.scheduleModuleAccordion.call(e,{expand_first_control:!0}),r._maybeFetchSectionsFromServer()})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{generateUIforFrontModules:function(r,e){var s=this;_.isEmpty(r.id)&&e.reject("generateUI => missing id");var i=s.getLevelProperty({property:"value",id:r.id}),t=s.getLevelProperty({property:"module_type",id:r.id}),n=s.getRegisteredModuleProperty(t,"name");_.isEmpty(t)&&e.reject("generateUI => module => invalid module_type");var o={};if(!0===s.getRegisteredModuleProperty(t,"is_father")){var a=s.getRegisteredModuleProperty(t,"children");if(_.isEmpty(a))throw new Error("::generateUIforFrontModules => a father module "+t+" is missing children modules ");_.each(a,function(e,t){o[t]={settingControlId:r.id+"__"+t,module_type:e,controlLabel:s.getRegisteredModuleProperty(e,"name")}})}else o.__no_option_group_to_be_updated_by_children_modules__={settingControlId:r.id,module_type:t,controlLabel:n};var c=_.keys(o)[0],l=o[c].settingControlId;return s.isUIControlAlreadyRegistered(l)?d.control(l).focus({completeCallback:function(){var e=d.control(l).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(s.cleanRegistered(),_do_register_=function(){_.each(o,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{s.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_markup",uiParams:_.extend(r,{action:"sek-set-module-value"}),options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforFrontModules => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,s.SETTING_UPDATE_BUFFER))});var e=u.extend(!0,{},i);"__no_option_group_to_be_updated_by_children_modules__"!==o&&(e=!_.isEmpty(e)&&_.isObject(e)&&_.isObject(e[o])?e[o]:{}),d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:r.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:r.id,priority:10,settings:{default:n.settingControlId}}).done(function(){}),d.control(n.settingControlId,function(e){d.control(n.settingControlId).focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})})},d.section.when(r.id,function(){d.section(r.id).focus(),_do_register_()}),d.CZR_Helpers.register({origin:"nimble",what:"section",id:r.id,title:sektionsLocalizedData.i18n["Content for"]+" "+n,panel:sektionsLocalizedData.sektionsPanelId,priority:1e3}).done(function(){}),d.section(r.id,function(e){e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".customize-action").after('<i class="fas fa-pencil-alt sek-level-option-icon"></i>'),s.scheduleModuleAccordion.call(e,{expand_first_control:!0})})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforLevelOptions:function(s,e){var a=this,c=a.getLevelProperty({property:"options",id:s.id});c=_.isObject(c)?c:{};var t={};d.extend(t,{bg:{settingControlId:s.id+"__bg_options",module_type:"sek_level_bg_module",controlLabel:sektionsLocalizedData.i18n["Background settings for the"]+" "+sektionsLocalizedData.i18n[s.level],expandAndFocusOnInit:!0,icon:'<i class="material-icons sek-level-option-icon">gradient</i>'},border:{settingControlId:s.id+"__border_options",module_type:"sek_level_border_module",controlLabel:sektionsLocalizedData.i18n["Borders settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">rounded_corner</i>'},spacing:{settingControlId:s.id+"__spacing_options",module_type:"sek_level_spacing_module",controlLabel:sektionsLocalizedData.i18n["Padding and margin settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="material-icons sek-level-option-icon">center_focus_weak</i>'},anchor:{settingControlId:s.id+"__anchor_options",module_type:"sek_level_anchor_module",controlLabel:sektionsLocalizedData.i18n["Set a custom anchor ( CSS ID ) for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-anchor sek-level-option-icon"></i>'},visibility:{settingControlId:s.id+"__visibility_options",module_type:"sek_level_visibility_module",controlLabel:sektionsLocalizedData.i18n["Device visibility settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="far fa-eye sek-level-option-icon"></i>'},height:{settingControlId:s.id+"__height_options",module_type:"sek_level_height_module",controlLabel:sektionsLocalizedData.i18n["Height and vertical alignment for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-vertical sek-level-option-icon"></i>'}}),"section"===s.level&&(d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_section",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}}),d.extend(t,{breakpoint:{settingControlId:s.id+"__breakpoint_options",module_type:"sek_level_breakpoint_module",controlLabel:sektionsLocalizedData.i18n["Responsive settings : breakpoint, column direction"],icon:'<i class="material-icons sek-level-option-icon">devices</i>'}})),"module"===s.level&&d.extend(t,{width:{settingControlId:s.id+"__width_options",module_type:"sek_level_width_module",controlLabel:sektionsLocalizedData.i18n["Width settings for the"]+" "+sektionsLocalizedData.i18n[s.level],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'}});var i=_.keys(t)[0],n=t[i].settingControlId;return a.isUIControlAlreadyRegistered(n)?l.control(n).focus({completeCallback:function(){var e=l.control(n).container;e.hasClass("button-see-me")||(e.addClass("button-see-me"),_.delay(function(){e.removeClass("button-see-me")},800))}}):(a.cleanRegistered(),_do_register_=function(){_.each(t,function(n,o){if(a.isUIControlAlreadyRegistered(n.settingControlId))l.section(l.control(n.settingControlId).section()).expanded(!0);else{if(!l.has(n.settingControlId)){var t=function(e,t,i){try{a.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh_stylesheet",uiParams:s,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforLevelOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,a.SETTING_UPDATE_BUFFER))});var e=c[o]||{},i=a.getModuleStartingValue(n.module_type);if("no_starting_value"!==i&&_.isObject(i)){var r=d.extend(!0,{},i);e=d.extend(r,e)}l.CZR_Helpers.register({origin:"nimble",level:s.level,what:"setting",id:n.settingControlId,dirty:!1,value:e,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:s.level,level_id:s.id,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:s.id,priority:0,settings:{default:n.settingControlId}}).done(function(){}),l.control(n.settingControlId,function(e){!0===n.expandAndFocusOnInit&&e.focus({completeCallback:function(){}}),e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false")})}})},l.section.has(s.id)||l.section(s.id,function(e){a.scheduleModuleAccordion.call(e,{expand_first_control:!0})}),l.CZR_Helpers.register({origin:"nimble",what:"section",id:s.id,title:sektionsLocalizedData.i18n["Settings for the"]+" "+s.level,panel:sektionsLocalizedData.sektionsPanelId,priority:10}).done(function(){}),l.section(s.id,function(e){_do_register_(),e.container.find(".accordion-section-title").first().hide();var t=e.container.find(".customize-section-title h3");0<t.length&&t.find(".sek-level-option-icon").length<1&&t.find(".customize-action").after('<i class="fas fa-sliders-h sek-level-option-icon"></i>')})),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(d,u){u.extend(CZRSeksPrototype,{getLocalSkopeOptionId:function(){var e=d.czr_skopeBase.getSkopeProperty("skope_id");return _.isEmpty(e)?(d.errare("czr_sektions::getLocalSkopeOptionId => empty skope_id "),""):sektionsLocalizedData.optPrefixForSektionsNotSaved+e+"__localSkopeOptions"},generateUIforLocalSkopeOptions:function(c,e){var l=this,i=l.getLocalSkopeOptionId();if(l.isUIControlAlreadyRegistered(i))return e;var n={};return _.isUndefined(sektionsLocalizedData.localOptionsMap)||!_.isObject(sektionsLocalizedData.localOptionsMap)?d.errare("::generateUIforGlobalOptions => missing or invalid localOptionsMap"):(_.each(sektionsLocalizedData.localOptionsMap,function(e,t){switch(t){case"template":n[t]={settingControlId:i+"__template",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page template"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">check_box_outline_blank</i>'};break;case"local_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n[t]={settingControlId:i+"__local_header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Inner and outer widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"custom_css":n[t]={settingControlId:i+"__custom_css",module_type:e,controlLabel:sektionsLocalizedData.i18n["Custom CSS"],icon:'<i class="material-icons sek-level-option-icon">code</i>'};break;case"local_performances":n[t]={settingControlId:i+"__local_performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"local_reset":n[t]={settingControlId:i+"__local_reset",module_type:e,controlLabel:sektionsLocalizedData.i18n["Remove the sections in this page"],icon:'<i class="material-icons sek-level-option-icon">cached</i>'};break;default:d.errare("::generateUIforLocalOptions => an option group could not be registered => "+e,t)}}),_do_register_=function(){_.each(n,function(n,o){if(!d.has(n.settingControlId)){var t=function(e,t,i){try{l.updateAPISettingAndExecutePreviewActions({defaultPreviewAction:"refresh",uiParams:c,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){d.errare("::generateUIforLocalSkopeOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};d(n.settingControlId,function(e){e.bind(_.debounce(t,l.SETTING_UPDATE_BUFFER))});var e=l.getModuleStartingValue(n.module_type),i=d(l.localSectionsSettingId())(),r=u.extend(!0,{},_.isObject(i.local_options)?i.local_options:{}),s=_.isObject(r[o])?r[o]:{};if("no_starting_value"!==e&&_.isObject(e)){var a=u.extend(!0,{},e);s=u.extend(a,s)}d.CZR_Helpers.register({origin:"nimble",level:c.level,what:"setting",id:n.settingControlId,dirty:!1,value:s,transport:"postMessage",type:"_nimble_ui_"})}d.CZR_Helpers.register({origin:"nimble",level:c.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:l.SECTION_ID_FOR_LOCAL_OPTIONS,priority:10,settings:{default:n.settingControlId}}).done(function(){d.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_()),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{generateUIforGlobalOptions:function(a,e){var c=this,i=sektionsLocalizedData.optPrefixForSektionsNotSaved+sektionsLocalizedData.optNameForGlobalOptions;if(c.isUIControlAlreadyRegistered(i))return e;var n={};return _.isUndefined(sektionsLocalizedData.globalOptionsMap)||!_.isObject(sektionsLocalizedData.globalOptionsMap)?l.errare("::generateUIforGlobalOptions => missing or invalid globalOptionsMap"):(_.each(sektionsLocalizedData.globalOptionsMap,function(e,t){switch(t){case"global_header_footer":sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n[t]={settingControlId:i+"__header_footer",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide header and footer"],icon:'<i class="material-icons sek-level-option-icon">web</i>'});break;case"breakpoint":n[t]={settingControlId:i+"__breakpoint",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide breakpoint for Nimble sections"],expandAndFocusOnInit:!1,icon:'<i class="material-icons sek-level-option-icon">devices</i>'};break;case"widths":n[t]={settingControlId:i+"__widths",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide inner and outer sections widths"],icon:'<i class="fas fa-ruler-horizontal sek-level-option-icon"></i>'};break;case"performances":n[t]={settingControlId:i+"__performances",module_type:e,controlLabel:sektionsLocalizedData.i18n["Site wide page speed optimizations"],icon:'<i class="fas fa-fighter-jet sek-level-option-icon"></i>'};break;case"recaptcha":n[t]={settingControlId:i+"__recaptcha",module_type:e,controlLabel:sektionsLocalizedData.i18n["Protect your contact forms with Google reCAPTCHA"],icon:'<i class="material-icons sek-level-option-icon">security</i>'};break;case"beta_features":n[t]={settingControlId:i+"__beta_features",module_type:e,controlLabel:sektionsLocalizedData.i18n["Beta features"],icon:'<i class="material-icons sek-level-option-icon">widgets</i>'};break;default:l.errare("::generateUIforGlobalOptions => an option group could not be registered => "+e,t)}}),_do_register_=function(){_.each(n,function(n,o){if(!l.has(n.settingControlId)){var t=function(e,t,i){try{c.updateAPISettingAndExecutePreviewActions({isGlobalOptions:!0,defaultPreviewAction:"refresh",uiParams:a,options_type:o,settingParams:{to:e,from:t,args:i}})}catch(e){l.errare("::generateUIforGlobalOptions => Error in updateAPISettingAndExecutePreviewActions",e)}};l(n.settingControlId,function(e){e.bind(_.debounce(t,c.SETTING_UPDATE_BUFFER))});var e=sektionsLocalizedData.globalOptionDBValues,i=c.getModuleStartingValue(n.module_type),r=_.isObject(e)&&!_.isEmpty(e[o])?e[o]:{};if("no_starting_value"!==i&&_.isObject(i)){var s=d.extend(!0,{},i);r=d.extend(s,r)}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"setting",id:n.settingControlId,dirty:!1,value:r,transport:"postMessage",type:"_nimble_ui_"})}l.CZR_Helpers.register({origin:"nimble",level:a.level,what:"control",id:n.settingControlId,label:n.controlLabel,type:"czr_module",module_type:n.module_type,section:c.SECTION_ID_FOR_GLOBAL_OPTIONS,priority:20,settings:{default:n.settingControlId},track:!1}).done(function(){l.control(n.settingControlId,function(e){e.container.find(".czr-items-wrapper").hide();var t=e.container.find("label > .customize-control-title"),i=t.html();t.html(['<span class="sek-ctrl-accordion-title">',i,"</span>"].join("")),_.isUndefined(n.icon)||t.addClass("sek-flex-vertical-center").prepend(n.icon),t.prepend('<span class="sek-animated-arrow" data-name="icon-chevron-down"><span class="fa fa-chevron-down"></span></span>'),e.container.attr("data-sek-expanded","false"),!0===n.expandAndFocusOnInit&&"false"==e.container.attr("data-sek-expanded")&&t.trigger("click")})})})},_do_register_()),e}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(K,X){X.extend(CZRSeksPrototype,{updateAPISetting:function(q){var Y=this,J=X.Deferred();(q=q||{}).is_global_location=Y.isGlobalLocation(q);var e=q.is_global_location?Y.getGlobalSectionsSettingId():Y.localSectionsSettingId();return K(e,function(e){var n,t,o,i,r,s,a,c,l,d=e(),u=_.isObject(d)?X.extend(!0,{},d):Y.getDefaultSektionSettingValue(q.is_global_location?"global":"local"),p=!1;switch(u.collection=_.isArray(u.collection)?u.collection:Y.getDefaultSektionSettingValue(q.is_global_location?"global":"local").collection,q.action){case"sek-add-section":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(_.isEmpty(q.location))throw new Error("updateAPISetting => "+q.action+" => missing location");if(!0===q.is_nested){if(o=Y.getLevelModel(q.in_column,u.collection),"no_match"==(l=Y.getLevelModel(q.in_sektion,u.collection))){J.reject("updateAPISetting => "+q.action+" => no grand parent sektion found");break}if(!0===l.is_nested){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.push({id:q.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+Y.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion})}else{if("no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){q.before_section===e.id&&(L=t),q.after_section===e.id&&(L=t+1)}),n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(L,0,{id:q.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+Y.guid(),level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion})}break;case"sek-duplicate-section":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(_.isEmpty(q.location))throw new Error("updateAPISetting => "+q.action+" => missing location");var m;try{m=Y.cloneLevel(q.id)}catch(e){K.errare("updateAPISetting => "+q.action,e);break}var f=Y.getLevelPositionInCollection(q.id,u.collection);if(!0===q.is_nested){if("no_match"==(o=Y.getLevelModel(q.in_column,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],o.collection.splice(parseInt(f+1,10),0,m)}else{if("no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}n.collection=_.isArray(n.collection)?n.collection:[],n.collection.splice(parseInt(f+1,10),0,m)}a=m.id;break;case"sek-remove-section":if(!0===q.is_nested)"no_match"!=(o=Y.getLevelModel(q.in_column,u.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=q.id})):K.errare("updateAPISetting => "+q.action+" => no parent column matched");else{if("no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}n.collection=_.filter(n.collection,function(e){return e.id!=q.id})}break;case"sek-move-section":var g,h,k=Y.getLevelModel(q.to_location,u.collection);if(_.isEmpty(k)||"no_match"==k)throw new Error("updateAPISetting => "+q.action+" => missing target location");if(q.from_location!=q.to_location){var y=Y.getLevelModel(q.from_location,u.collection);if(_.isEmpty(y)||"no_match"==y)throw new Error("updateAPISetting => "+q.action+" => missing source location");y.collection=_.isArray(y.collection)?y.collection:[],g=Y.getLevelModel(q.id,y.collection),h=X.extend(!0,{},g),y.collection=_.filter(y.collection,function(e){return e.id!=q.id})}k.collection=_.isArray(k.collection)?k.collection:[],r=X.extend(!0,[],k.collection),s=[],_.each(q.newOrder,function(e){if(q.from_location!=q.to_location&&e==h.id)s.push(h);else{if(t=Y.getLevelModel(e,r),_.isEmpty(t)||"no_match"==t)throw new Error("updateAPISetting => "+q.action+" => missing section candidate");s.push(t)}}),k.collection=s;break;case"sek-move-section-up-down":if(inLocationCandidate=Y.getLevelModel(q.location,u.collection),_.isEmpty(inLocationCandidate)||"no_match"==inLocationCandidate)throw new Error("updateAPISetting => "+q.action+" => missing target location");inLocationCandidate.collection=_.isArray(inLocationCandidate.collection)?inLocationCandidate.collection:[],r=X.extend(!0,[],inLocationCandidate.collection),s=X.extend(!0,[],inLocationCandidate.collection);var v=_.findIndex(r,function(e){return e.id===q.id});if(-1===v)throw new Error("updateAPISetting => "+q.action+" => invalid index");var b=q.direction||"up";s[v]=r["up"===b?v-1:v+1],s["up"===b?v-1:v+1]=r[v],inLocationCandidate.collection=s;break;case"sek-add-column":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if("no_match"==(t=Y.getLevelModel(q.in_sektion,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent sektion matched"),J.reject("updateAPISetting => "+q.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],Y.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}_.each(t.collection,function(e){e.width=""}),t.collection.push({id:q.id,level:"column",collection:[],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"sek-remove-column":if("no_match"!=(t=Y.getLevelModel(q.in_sektion,u.collection))){if(1===_.size(t.collection)){J.reject(sektionsLocalizedData.i18n["A section must have at least one column."]);break}t.collection=_.isArray(t.collection)?t.collection:[],t.collection=_.filter(t.collection,function(e){return e.id!=q.id}),_.each(t.collection,function(e){e.width=""})}else K.errare("updateAPISetting => "+q.action+" => no parent sektion matched");break;case"sek-duplicate-column":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if("no_match"==(t=Y.getLevelModel(q.in_sektion,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent sektion matched"),J.reject("updateAPISetting => "+q.action+" => no parent sektion matched");break}if(t.collection=_.isArray(t.collection)?t.collection:[],Y.MAX_NUMBER_OF_COLUMNS-1<_.size(t.collection)){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of columns allowed in this section."]);break}var z;try{z=Y.cloneLevel(q.id)}catch(e){K.errare("updateAPISetting => "+q.action,e);break}var I=Y.getLevelPositionInCollection(q.id,u.collection);a=z.id,t.collection.splice(parseInt(I+1,10),0,z),_.each(t.collection,function(e){e.width=""});break;case"sek-resize-columns":if(q.col_number<2)break;var w=Y.getLevelModel(q.resized_column,u.collection),M=Y.getLevelModel(q.sister_column,u.collection);if("no_match"==w){K.errare("updateAPISetting => "+q.action+" => no resized column matched"),J.reject("updateAPISetting => "+q.action+" => no resized column matched");break}w.width=parseFloat(q.resizedColumnWidthInPercent);var C=Y.getLevelModel(q.in_sektion,u.collection),S=_.filter(C.collection,function(e){return e.id!=w.id&&e.id!=M.id}),D=parseFloat(w.width.toFixed(3));_.isEmpty(S)||_.each(S,function(e){currentColWidth=parseFloat(1*e.width),(!_.has(e,"width")||!_.isNumber(1*currentColWidth)||_.isEmpty(currentColWidth+"")||currentColWidth<1)&&(e.width=parseFloat((100/q.col_number).toFixed(3))),D=parseFloat((D+e.width).toFixed(3))}),M.width=parseFloat((100-D).toFixed(3));break;case"sek-move-column":var P,x,E=Y.getLevelModel(q.to_sektion,u.collection);if(_.isEmpty(E)||"no_match"==E)throw new Error("updateAPISetting => "+q.action+" => missing target sektion");if(q.from_sektion!=q.to_sektion){var R=Y.getLevelModel(q.from_sektion,u.collection);if(_.isEmpty(R)||"no_match"==R)throw new Error("updateAPISetting => "+q.action+" => missing source column");R.collection=_.isArray(R.collection)?R.collection:[],P=Y.getLevelModel(q.id,R.collection),x=X.extend(!0,{},P),R.collection=_.filter(R.collection,function(e){return e.id!=q.id}),_.each(R.collection,function(e){e.width=""})}E.collection=_.isArray(E.collection)?E.collection:[],r=X.extend(!0,[],E.collection),s=[],_.each(q.newOrder,function(e){if(q.from_sektion!=q.to_sektion&&e==x.id)s.push(x);else{if(o=Y.getLevelModel(e,r),_.isEmpty(o)||"no_match"==o)throw new Error("updateAPISetting => moveColumn => missing columnCandidate");s.push(o)}}),E.collection=s,_.each(E.collection,function(e){e.width=""});break;case"sek-add-module":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(_.isEmpty(q.module_type))throw new Error("updateAPISetting => "+q.action+" => missing module_type");if("no_match"===(o=Y.getLevelModel(q.in_column,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}var L=0;o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){q.before_module===e.id&&(L=t),q.after_module===e.id&&(L=t+1)});var O={id:q.id,level:"module",module_type:q.module_type,ver_ini:sektionsLocalizedData.nimbleVersion};"no_starting_value"!==(c=Y.getModuleStartingValue(q.module_type))&&(O.value=c),o.collection.splice(L,0,O);break;case"sek-duplicate-module":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if("no_match"==(o=Y.getLevelModel(q.in_column,u.collection))){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}var A;o.collection=_.isArray(o.collection)?o.collection:[];try{A=Y.cloneLevel(q.id)}catch(e){K.errare("updateAPISetting => "+q.action,e),J.reject("updateAPISetting => "+q.action+" => error when cloning the level");break}var Z=Y.getLevelPositionInCollection(q.id,u.collection);a=A.id,o.collection.splice(parseInt(Z+1,10),0,A);break;case"sek-remove-module":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");"no_match"!=(o=Y.getLevelModel(q.in_column,u.collection))?(o.collection=_.isArray(o.collection)?o.collection:[],o.collection=_.filter(o.collection,function(e){return e.id!=q.id})):K.errare("updateAPISetting => "+q.action+" => no parent column matched");break;case"sek-move-module":var T,j,V;if(T=Y.getLevelModel(q.to_column,u.collection),_.isEmpty(T)||"no_match"==T)throw new Error("updateAPISetting => "+q.action+" => missing target column");if(q.from_column!=q.to_column){var F;if(F=Y.getLevelModel(q.from_column,u.collection),_.isEmpty(F)||"no_match"==F)throw new Error("updateAPISetting => "+q.action+" => missing source column");F.collection=_.isArray(F.collection)?F.collection:[],j=Y.getLevelModel(q.id,u.collection),V=X.extend(!0,{},j),F.collection=_.filter(F.collection,function(e){return e.id!=q.id})}if(T.collection=_.isArray(T.collection)?T.collection:[],r=X.extend(!0,[],T.collection),s=[],_.each(q.newOrder,function(e){if(q.from_column!=q.to_column&&e==V.id)s.push(V);else{if(i=Y.getLevelModel(e,u.collection),_.isEmpty(i)||"no_match"==i)throw new Error("updateAPISetting => "+q.action+" => missing moduleCandidate");s.push(i)}}),s.length!=_.uniq(s).length)throw new Error("updateAPISetting => "+q.action+" => there are duplicated modules in column : "+T.id);T.collection=s;break;case"sek-set-module-value":i=Y.getLevelModel(q.id,u.collection);var U={};if(_.each(q.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(U[t]=e)}),"no_match"==i){K.errare("updateAPISetting => "+q.action+" => no module matched",q),J.reject("updateAPISetting => "+q.action+" => error no module matched");break}if(_.isEmpty(q.options_type)){K.errare("updateAPISetting => "+q.action+" => missing options_type"),J.reject("updateAPISetting => "+q.action+" => missing options_type");break}"__no_option_group_to_be_updated_by_children_modules__"===q.options_type?i.value=U:(i.value=_.isEmpty(i.value)?{}:i.value,i.value[q.options_type]=U);break;case"sek-generate-level-options-ui":var N=Y.getLevelModel(q.id,u.collection),B={};if("no_match"===N){K.errare("updateAPISetting => "+q.action+" => no parent sektion matched"),J.reject("updateAPISetting => "+q.action+" => no parent sektion matched");break}N.options=N.options||{},_.each(q.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(B[t]=e)}),_.isEmpty(q.options_type)&&K.errare("updateAPISetting => "+q.action+" => missing options_type"),N.options[q.options_type]=B;break;case"sek-generate-local-skope-options-ui":B={};var Q=X.extend(!0,{},_.isObject(u.local_options)?u.local_options:{});if(_.each(q.value||{},function(e,t){!_.isBoolean(e)&&_.isEmpty(e+"")||(B[t]=e)}),_.isEmpty(q.options_type)||!_.isString(q.options_type))K.errare("updateAPISetting => "+q.action+" => missing options_type");else{var H={};H[q.options_type]=B,u.local_options=X.extend(Q,H)}break;case"sek-add-content-in-new-sektion":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(L=0,"no_match"==(n=Y.getLevelModel(q.location,u.collection))){K.errare("updateAPISetting => "+q.action+" => no location matched"),J.reject("updateAPISetting => "+q.action+" => no location matched");break}switch(n.collection=_.isArray(n.collection)?n.collection:[],_.each(n.collection,function(e,t){q.before_section===e.id&&(L=t),q.after_section===e.id&&(L=t+1)}),q.content_type){case"module":c=Y.getModuleStartingValue(q.content_id),n.collection.splice(L,0,{id:q.id,level:"section",collection:[{id:sektionsLocalizedData.optPrefixForSektionsNotSaved+Y.guid(),level:"column",collection:[{id:q.droppedModuleId,level:"module",module_type:q.content_id,value:"no_starting_value"!==c?c:null,ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion}],ver_ini:sektionsLocalizedData.nimbleVersion});break;case"preset_section":p=X.Deferred();var G=function(e){Y.preparePresetSectionForInjection(e).fail(function(e){J.reject("updateAPISetting => error when preparePresetSectionForInjection => "+q.action+" => "+e),p.reject(e)}).done(function(e){var t=!1;if(!_.isEmpty(q.sektion_to_replace)){var i=Y.getLevelModel(q.sektion_to_replace,u.collection);"no_match"===i&&(K.errare("updateAPISetting => "+q.action+" => no sektionToReplace matched"),J.reject("updateAPISetting => "+q.action+" => no sektionToReplace matched")),t=!0===i.is_nested}t?("no_match"===(o=Y.getLevelModel(q.in_column,u.collection))&&(K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched")),o.collection=_.isArray(o.collection)?o.collection:[],_.each(o.collection,function(e,t){q.before_section===e.id&&(L=t),q.after_section===e.id&&(L=t+1)}),o.collection.splice(L,0,{id:q.id,is_nested:!0,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion})):n.collection.splice(L,0,{id:q.id,level:"section",collection:e.collection,options:e.options||{},ver_ini:sektionsLocalizedData.nimbleVersion}),p.resolve()})};Y.getPresetSectionCollection({is_user_section:q.is_user_section,presetSectionId:q.content_id,section_id:q.id}).fail(function(e){K.errare("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()",e),J.reject("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(K.errare("updateAPISetting => "+q.action+" => preset section type not found or empty : "+q.content_id,e),J.reject("updateAPISetting => "+q.action+" => preset section type not found or empty")),G(e)})}break;case"sek-add-preset-section-in-new-nested-sektion":if(_.isEmpty(q.id))throw new Error("updateAPISetting => "+q.action+" => missing id");if(o=Y.getLevelModel(q.in_column,u.collection),"no_match"==(l=Y.getLevelModel(q.in_sektion,u.collection))){J.reject("updateAPISetting => "+q.action+" => no grand parent sektion found");break}if(!0===l.is_nested){J.reject(sektionsLocalizedData.i18n["You've reached the maximum number of allowed nested sections."]);break}if("no_match"==o){K.errare("updateAPISetting => "+q.action+" => no parent column matched"),J.reject("updateAPISetting => "+q.action+" => no parent column matched");break}o.collection=_.isArray(o.collection)?o.collection:[],p=X.Deferred(),G=function(e){Y.preparePresetSectionForInjection(e).fail(function(e){J.reject("updateAPISetting => error when preparePresetSectionForInjection => "+q.action+" => "+e),p.reject(e)}).done(function(e){o.collection.push({id:q.id,level:"section",collection:e.collection,options:e.options||{},is_nested:!0,ver_ini:sektionsLocalizedData.nimbleVersion}),p.resolve()})},Y.getPresetSectionCollection({is_user_section:q.is_user_section,presetSectionId:q.content_id,section_id:q.id}).fail(function(){K.errare("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()",_er_),J.reject("updateAPISetting => "+q.action+" => Error with self.getPresetSectionCollection()")}).done(function(e){_.isObject(e)&&!_.isEmpty(e)||(K.errare("updateAPISetting => "+q.action+" => preset section type not found or empty : "+q.content_id,e),J.reject("updateAPISetting => "+q.action+" => preset section type not found or empty")),G(e)});break;case"sek-update-fonts":var W=Y.sniffGFonts({is_global_location:q&&!0===q.is_global_location});if(!_.isEmpty(q.font_family)&&_.isString(q.font_family)&&!_.contains(W,q.font_family)){if(q.font_family.indexOf("gfont")<0){K.errare("updateAPISetting => "+q.action+" => error => must be a google font, prefixed gfont"),J.reject("updateAPISetting => "+q.action+" => error => must be a google font, prefixed gfont");break}W.push(q.font_family)}u.fonts=W}if("pending"==J.state()){var $=function(){_.isEqual(d,u)?sektionsLocalizedData.isDevMode&&J.reject("updateAPISetting => the new setting value is unchanged when firing action : "+q.action):null!==Y.validateSettingValue(u)?(e(u,q),q.cloneId=a,J.resolve(q)):J.reject("Validation problem for action "+q.action)};!1===p?$():p.done(function(){$()}).fail(function(e){K.errare("updateAPISetting => __presetSectionInjected__ failed",e)})}}),J.promise()},_maybeFetchSectionsFromServer:function(t){var e,i=X.Deferred();return!0===(t=t||{is_user_section:!1}).is_user_section?_.isEmpty(K.sek_userSavedSections)||_.isEmpty(K.sek_userSavedSections[t.preset_section_id])?(K.sek_userSavedSections=K.sek_userSavedSections||{},_.isUndefined(K.sek_fetchingUserSavedSections)||"pending"!=K.sek_fetchingUserSavedSections.state()?(e=wp.ajax.post("sek_get_user_saved_sections",{nonce:K.settings.nonce.save,preset_section_id:t.preset_section_id}),K.sek_fetchingUserSavedSections=e):e=K.sek_fetchingUserSavedSections,e.done(function(e){K.sek_userSavedSections[t.preset_section_id]=e,i.resolve(K.sek_userSavedSections)}).fail(function(e){i.reject(e)})):i.resolve(K.sek_userSavedSections):_.isEmpty(K.sek_presetSections)?(_.isUndefined(K.sek_fetchingPresetSections)||"pending"!=K.sek_fetchingPresetSections.state()?(e=wp.ajax.post("sek_get_preset_sections",{nonce:K.settings.nonce.save}),K.sek_fetchingPresetSections=e):e=K.sek_fetchingPresetSections,e.done(function(e){K.sek_presetSections=e,i.resolve(K.sek_presetSections)}).fail(function(e){i.reject(e)})):i.resolve(K.sek_presetSections),i.promise()},getPresetSectionCollection:function(r){var s=this,a=X.Deferred();return s._maybeFetchSectionsFromServer({is_user_section:r.is_user_section,preset_section_id:r.presetSectionId}).fail(function(e){a.reject(e)}).done(function(e){var t=X.extend(!0,{},_.isObject(e)?e:{});if(_.isEmpty(t))throw new Error("getPresetSectionCollection => Invalid collection");if(_.isEmpty(t[r.presetSectionId]))throw new Error('getPresetSectionCollection => the preset section : "'+r.presetSectionId+'" has not been found in the collection');var i=t[r.presetSectionId],n=function(e){return _.each(e,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+s.guid(),_.isArray(e.collection)&&n(e.collection)}),e},o=function(e){return _.each(e,function(e){e.ver_ini=sektionsLocalizedData.nimbleVersion,_.isArray(e.collection)&&o(e.collection)}),e};i.id=r.section_id,i.collection=n(i.collection),i.ver_ini=sektionsLocalizedData.nimbleVersion,i.collection=o(i.collection),a.resolve(i)}),a.promise()},preparePresetSectionForInjection:function(o){var i=this,n={},r=X.Deferred(),s=function(e){return _.each(e,function(e,t){_.isObject(e)||_.isArray(e)?s(e):_.isString(e)&&-1!=e.indexOf("::img-path::")&&(_.has(n,e)||(n[e]=i.importAttachment(e.replace("::img-path::",""))))}),n},a=function(i,n){return _.each(i,function(e,t){_.isObject(e)||_.isArray(e)?a(e,n):_.isString(e)&&-1!=e.indexOf("::img-path::")&&_.has(n,e)&&_.isObject(n[e])&&(i[t]=n[e].id)}),o};return i.whenAllPromisesInParallel(s(o)).done(function(e){var t=a(o,e);r.resolve(t)}).fail(function(e){r.reject(e)}),r.promise()}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(n,o){o.extend(CZRSeksPrototype,{cleanRegistered:function(t){var i=this,e=o.extend(!0,[],i.registered()||[]);e=_.filter(e,function(e){if("setting"!==e.what&&n[e.what].has(e.id)){if(!_.isEmpty(t)&&e.id!==t)return;_.isFunction(n[e.what](e.id).trigger)&&i.trigger("sek-ui-pre-removal",{what:e.what,id:e.id}),o.when(n[e.what](e.id).container.remove()).done(function(){n[e.what].remove(e.id),i.trigger("sek-ui-removed",{what:e.what,id:e.id})})}return"setting"===e.what}),i.registered(e)},cleanRegisteredLevelSettingsAfterHistoryNavigation:function(){var e=o.extend(!0,[],this.registered()||[]);e=_.filter(e,function(e){return _.isEmpty(e.level)||"setting"!==e.what||n.has(e.id)&&n.remove(e.id),_.isEmpty(e.level)&&"setting"!==e.what}),this.registered(e)}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(l,d){d.extend(CZRSeksPrototype,{rootPanelFocus:function(){l.section.has(l.czr_activeSectionId())?l.section(l.czr_activeSectionId()).expanded(!1):l.section.each(function(e){e.expanded(!1)}),l.panel.each(function(e){e.expanded(!1)})},guid:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()},getGlobalSectionsSettingId:function(){return sektionsLocalizedData.settingIdForGlobalSections},getLevelModel:function(i,n){var s=this,a="no_match",c=function(t,e,i,n){if(_.isUndefined(e)){var o=l(i)(),r=_.isObject(o)?d.extend(!0,{},o):d.extend(!0,{},s.getDefaultSektionSettingValue(n));e=_.isArray(r.collection)?r.collection:[]}return _.each(e,function(e){"no_match"==a&&(t===e.id?a=e:_.isArray(e.collection)&&c(t,e.collection,i,n))}),a};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,n,e,t)}):c(i,n),a},isGlobalLocation:function(e){var t=!1;return e=e||{},_.has(e,"is_global_location")?t=e.is_global_location:_.isEmpty(e.location)?_.isEmpty(e.in_sektion)?_.isEmpty(e.id)||(t=this.isChildOfAGlobalLocation(e.id)):t=this.isChildOfAGlobalLocation(e.in_sektion):t=this.isChildOfAGlobalLocation(e.location),t},isChildOfAGlobalLocation:function(e){var r=this,s=function(t,e){var i="no_match";if(_.isUndefined(e)){var n=l(r.getGlobalSectionsSettingId())(),o=_.isObject(n)?d.extend(!0,{},n):r.getDefaultSektionSettingValue("global");e=_.isArray(o.collection)?o.collection:[]}return _.each(e,function(e){"no_match"==i&&(t===e.id?i=e:_.isArray(e.collection)&&(i=s(t,e.collection)))}),i};return"no_match"!==s(e)},getLevelPositionInCollection:function(i,n){var s=this,a="no_match",c=function(i,e,n,o){if(_.isUndefined(e)){var t=l(n)(),r=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},s.getDefaultSektionSettingValue(o));e=_.isArray(r.collection)?r.collection:[]}_.each(e,function(e,t){"no_match"==a&&(i===e.id?a=t:_.isArray(e.collection)&&c(i,e.collection,n,o))})};return _.isEmpty(n)?_.each({local:s.localSectionsSettingId(),global:s.getGlobalSectionsSettingId()},function(e,t){"no_match"===a&&c(i,e,t,n)}):c(i,n),a},getLevelProperty:function(e){if(e=_.extend({id:"",property:""},e),_.isEmpty(e.id))l.errare("getLevelProperty => invalid id provided");else{var t=this.getLevelModel(e.id);if("no_match"!=t){if(_.isObject(t))return t[e.property];l.errare("getLevelProperty => invalid model for id : "+e.id,t)}else l.errare("getLevelProperty => no level model found for id : "+e.id)}},cloneLevel:function(e){var t=this,i=t.getLevelModel(e);if("no_match"==i)throw new Error("cloneLevel => no match for level id : "+e);var n=d.extend(!0,{},i),o=function(e){if(_.isEmpty(e.id))throw new Error("cloneLevel => missing level id");if(e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),!_.isEmpty(e.collection)){if(!_.isArray(e.collection))throw new Error("cloneLevel => the collection must be an array for level id : "+e.id);_.each(e.collection,function(e){e.id=sektionsLocalizedData.optPrefixForSektionsNotSaved+t.guid(),o(e)})}return e};return o(n)},getDefaultItemModelFromRegisteredModuleData:function(e){if(!this.isModuleRegistered(e))return{};if(!sektionsLocalizedData.registeredModules[e].is_father){var t=sektionsLocalizedData.registeredModules[e].tmpl["item-inputs"],i={id:"",title:""};return _.each(t,function(e,t){switch(t){case"tabs":_.each(e,function(e){_.each(e.inputs,function(e,t){i[t]=e.default||""})});break;default:i[t]=e.default||""}}),i}l.errare("getDefaultItemModelFromRegisteredModuleData => Father modules should be treated specifically")},getRegisteredModuleProperty:function(e,t){return this.isModuleRegistered(e)?sektionsLocalizedData.registeredModules[e][t]:"not_set"},isModuleRegistered:function(e){return sektionsLocalizedData.registeredModules&&!_.isUndefined(sektionsLocalizedData.registeredModules[e])},sniffGFonts:function(e){var o=this,r=[],s=function(i,n,e){if(_.isUndefined(e)){var t=l(i)();e=_.isObject(t)?d.extend(!0,{},t):d.extend(!0,{},o.getDefaultSektionSettingValue(n))}_.each(e,function(e,t){_.isString(t)&&"_css"===t.substr(t.length-4)&&!0===o.inputIsAFontFamilyModifier(t)&&-1<e.indexOf("gfont")&&!_.contains(r,e)&&r.push(e),(_.isArray(e)||_.isObject(e))&&s(i,n,e)})};return(e=e||{is_global_location:!1}).is_global_location?s(o.getGlobalSectionsSettingId(),"global"):s(o.localSectionsSettingId(),"local"),r},getInputDefaultValue:function(i,n,e){var o=this;if(o.cachedDefaultInputValues=o.cachedDefaultInputValues||{},o.cachedDefaultInputValues[n]=o.cachedDefaultInputValues[n]||{},_.has(o.cachedDefaultInputValues[n],i))return o.cachedDefaultInputValues[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputDefaultValue => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputDefaultValue => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_default_value_specified";return _.each(e,function(e,t){"no_default_value_specified"===r&&(i!==t||_.isUndefined(e.default)||(r=e.default),"no_default_value_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputDefaultValue(i,n,e)),"no_default_value_specified"!==r&&(o.cachedDefaultInputValues[n][i]=r))}),r}l.errare("getInputDefaultValue => Father modules should be treated specifically")}},getInputType:function(i,n,e){var o=this;if(o.cachedInputTypes=o.cachedInputTypes||{},o.cachedInputTypes[n]=o.cachedInputTypes[n]||{},_.has(o.cachedInputTypes[n],i))return o.cachedInputTypes[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputType => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputType => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r="no_input_type_specified";return _.each(e,function(e,t){"no_input_type_specified"===r&&(i!==t||_.isUndefined(e.input_type)||(r=e.input_type),"no_input_type_specified"===r&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputType(i,n,e)),"no_input_type_specified"!==r&&(o.cachedInputTypes[n][i]=r))}),r}l.errare("getInputType => Father modules should be treated specifically")}},getInputRegistrationParams:function(i,n,e){var o=this;if(o.cachedInputRegistrationParams=o.cachedInputRegistrationParams||{},o.cachedInputRegistrationParams[n]=o.cachedInputRegistrationParams[n]||{},_.has(o.cachedInputRegistrationParams[n],i))return o.cachedInputRegistrationParams[n][i];if(_.isUndefined(sektionsLocalizedData.registeredModules))l.errare("getInputRegistrationParams => missing sektionsLocalizedData.registeredModules");else if(_.isUndefined(sektionsLocalizedData.registeredModules[n]))l.errare("getInputRegistrationParams => missing "+n+" in sektionsLocalizedData.registeredModules");else{if(!sektionsLocalizedData.registeredModules[n].is_father){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules[n].tmpl);var r={};return _.each(e,function(e,t){_.isEmpty(r)&&(i!==t||_.isUndefined(e.input_type)||(r=e),_.isEmpty(r)&&(_.isArray(e)||_.isObject(e))&&(r=o.getInputRegistrationParams(i,n,e)),_.isEmpty(r)||(o.cachedInputRegistrationParams[n][i]=r))}),r}l.errare("getInputRegistrationParams => Father modules should be treated specifically")}},inputIsAFontFamilyModifier:function(i,e){var n=this;if(n.cachedFontFamilyModifier=n.cachedFontFamilyModifier||{},_.has(n.cachedFontFamilyModifier,i))return n.cachedFontFamilyModifier[i];if(!_.isUndefined(sektionsLocalizedData.registeredModules)){_.isUndefined(e)&&(e=sektionsLocalizedData.registeredModules);var o="not_set";return _.each(e,function(e,t){"not_set"===o&&(i!==t||_.isUndefined(e.input_type)||(o=!_.isUndefined(e.refresh_fonts)&&e.refresh_fonts),"not_set"===o&&(_.isArray(e)||_.isObject(e))&&(o=n.inputIsAFontFamilyModifier(i,e)),"not_set"!==o&&(n.cachedFontFamilyModifier[i]=o))}),o}l.errare("inputIsAFontFamilyModifier => missing sektionsLocalizedData.registeredModules")},getModuleStartingValue:function(e){if(!sektionsLocalizedData.registeredModules)return l.errare("getModuleStartingValue => missing sektionsLocalizedData.registeredModules"),"no_starting_value";if(_.isUndefined(sektionsLocalizedData.registeredModules[e]))return l.errare("getModuleStartingValue => the module type "+e+" is not registered"),"no_starting_value";var t=sektionsLocalizedData.registeredModules[e].starting_value;return _.isEmpty(t)?"no_starting_value":t},selectNextTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=0;if(1===i.length){var o=t.index(i);o+1<t.length&&(n=o+1)}t.eq(n).focus()},selectPrevTabbableOrFocusable:function(e){var t=d(e),i=d(":focus"),n=t.length-1;if(1===i.length){var o=t.index(i);0<o&&(n=o-1)}t.eq(n).focus()},setupSelectInput:function(e){var n=this,t=(n.input_parent,n.module,l.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type));e=_.isUndefined(e)?t.choices:e,!_.isEmpty(e)&&_.isObject(e)?(_.each(e,function(e,t){var i={value:t,html:e};t==n()?d.extend(i,{selected:"selected"}):"px"===t&&d.extend(i,{selected:"selected"}),d("select[data-czrtype]",n.container).append(d("<option>",i))}),d("select[data-czrtype]",n.container).selecter()):l.errare("api.czr_sektions.setupSelectInput => missing select options for input id => "+n.id+" in image module")},setupFontSizeAndLineHeightInputs:function(e){var t=this,i=d(".sek-font-size-line-height-wrapper",t.container),n=i.find("input[data-czrtype]").data("sek-unit"),o=function(e){return _.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new l.Value(_.isEmpty(n)?"px":o(n)),t.css_unit.bind(function(e){e=_.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("change")}),i.find('input[type="number"]').on("input change",function(e){t(d(this).val()+o(t.css_unit()))}).stepper(),i.on("click","[data-sek-unit]",function(e){e.preventDefault(),i.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",d(this).data("sek-unit")),t.css_unit(d(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+n+'"]').addClass("is-selected").attr("aria-pressed",!0)},maybeSetupDeviceSwitcherForInput:function(){var i=this,e=['<span class="sek-input-device-switcher">','<i data-sek-device="desktop" class="sek-switcher preview-desktop active" title="'+sektionsLocalizedData.i18n["Settings on desktops"]+'"></i>','<i data-sek-device="tablet" class="sek-switcher preview-tablet" title="'+sektionsLocalizedData.i18n["Settings on tablets"]+'"></i>','<i data-sek-device="mobile" class="sek-switcher preview-mobile" title="'+sektionsLocalizedData.i18n["Settings on mobiles"]+'"></i>',"</span>"].join(" ");i.container.find(".customize-control-title").prepend(e),i.previewedDevice=new l.Value(l.previewedDevice()),syncWithPreviewedDevice=function(e){e.stopPropagation(),i.container.find("[data-sek-device]").removeClass("active"),d(this).addClass("active");var t="desktop";try{t=d(this).data("sek-device")}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when binding sek-switcher",e)}try{l.previewedDevice(t)}catch(e){l.errare("maybeSetupDeviceSwitcherForInput => error when setting the previewed device",e)}i.previewedDevice(t)},i.container.on("click","[data-sek-device]",syncWithPreviewedDevice);var t=i.container.find('[data-sek-device="'+l.previewedDevice()+'"]');0<t.length&&t.trigger("click")},scheduleModuleAccordion:function(e){e=e||{expand_first_control:!0};var i=this;if(d(i.container).on("click",".customize-control label > .customize-control-title",function(e){e.stopPropagation();var t=d(this).closest(".customize-control");"no"!==t.attr("data-sek-accordion")&&(i.container.find(".customize-control").not(t).each(function(){d(this).attr("data-sek-accordion")||(d(this).attr("data-sek-expanded","false"),d(this).find(".czr-items-wrapper").stop(!0,!0).slideUp(0))}),t.find(".czr-items-wrapper").stop(!0,!0).slideToggle({duration:0,start:function(){t.attr("data-sek-expanded","false"==t.attr("data-sek-expanded")?"true":"false"),t.trigger("true"==t.attr("data-sek-expanded")?"sek-accordion-expanded":"sek-accordion-collapsed")}}))}),e.expand_first_control){var t=_.first(i.controls());_.isObject(t)&&!_.isEmpty(t.id)&&l.control(t.id,function(e){e.container.trigger("sek-accordion-expanded"),i.container.find(".customize-control").first().find("label > .customize-control-title").trigger("click")})}},isPromise:function(e){return e&&"function"==typeof e.then&&String(d.Deferred().then)===String(e.then)},whenAllPromisesInParallel:function(e){var i=this,t=d.Deferred(),n=[],o=_.keys(e);return _.each(e,function(e,t){n.push(d.Deferred(function(t){(i.isPromise(e)?e:d.Deferred()).done(t.resolve).fail(function(e){t.reject(e)})}))}),d.when.apply(this,n).done(function(){var i={},e=Array.prototype.slice.call(arguments);_.each(e,function(e,t){i[o[t]]=e}),t.resolve(i)}).fail(t.reject),t},whenAllPromisesInSerie:function(t,i,n,o){i=i||0,n=n||{},o=o||d.Deferred();var r=this;if(_.isArray(t)){var e=t[i];(r.isPromise(e)?e:d.Deferred(function(e){e.resolve()})).always(function(e){n[i]=e,i+1==t.length?o.resolve(n):i+1<t.length&&r.whenAllPromisesInSerie(t,i+1,n,o)})}return o},importAttachment:function(t){return wp.ajax.post("sek_import_attachment",{rel_path:t,nonce:l.settings.nonce.save}).fail(function(e){l.errare("sek_import_attachment ajax action failed for image "+t,e)})},cleanIds:function(e){e.id="";var t=this;return _.each(e.collection,function(e){e.id="",_.isArray(e.collection)&&t.cleanIds(e)}),e},getDefaultSektionSettingValue:function(e){return!_.isUndefined(e)&&_.contains(["local","global"],e)||l.errare("getDefaultSektionSettingValue => the skope should be set to local or global"),"global"===e?sektionsLocalizedData.defaultGlobalSektionSettingValue:sektionsLocalizedData.defaultLocalSektionSettingValue},scheduleVisibilityOfInputId:function(t,i){var n=this.input_parent;if(!_.isFunction(i)||_.isEmpty(t))throw new Error("::scheduleVisibilityOfInputId => error when firing for input id : "+this.id);n.czr_Input(t).visible(i()),this.bind(function(e){n.czr_Input(t).visible(i())})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(a,m){m.extend(CZRSeksPrototype,{setupDnd:function(){var t=this;t.bind("sek-refresh-dragzones",function(e){!0!="draggable"in document.createElement("span")&&a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)}),t.setupNimbleDragZones(e.input_container)}),a.previewer.bind("ready",function(){try{t.setupNimbleDropZones()}catch(e){a.errare("::setupDnd => error on self.setupNimbleDropZones()",e)}_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_intro_sec_picker_module"}))&&_.isUndefined(_.findWhere(t.registered(),{module_type:"sek_module_picker_module"}))||t.rootPanelFocus()}),t.reactToDrop()},setupNimbleDragZones:function(e){var n=this,o=function(){a.notifications.add(new a.Notification("missing-injection-target",{type:"info",message:sektionsLocalizedData.i18n["You first need to click on a target ( with a + icon ) in the preview."],dismissible:!0})),_.delay(function(){a.notifications.remove("missing-injection-target")},3e4)};e.find('[draggable="true"]').each(function(){m(this).on("dragstart",function(e){(function(e){n.lastClickedTargetInPreview({}),e.originalEvent.dataTransfer.setData("sek-content-type",m(this).data("sek-content-type")),e.originalEvent.dataTransfer.setData("sek-content-id",m(this).data("sek-content-id")),e.originalEvent.dataTransfer.setData("sek-section-type",m(this).data("sek-section-type")),e.originalEvent.dataTransfer.setData("sek-is-user-section",m(this).data("sek-is-user-section")),n.dndData={content_type:e.originalEvent.dataTransfer.getData("sek-content-type"),content_id:e.originalEvent.dataTransfer.getData("sek-content-id"),section_type:e.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===e.originalEvent.dataTransfer.getData("sek-is-user-section")};try{e.originalEvent.dataTransfer.setData("browserSupport","browserSupport"),e.originalEvent.dataTransfer.clearData("browserSupport")}catch(e){a.panel(sektionsLocalizedData.sektionsPanelId,function(e){a.notifications.add(new a.Notification("drag-drop-support",{type:"error",message:sektionsLocalizedData.i18n["This browser does not support drag and drop. You might need to update your browser or use another one."],dismissible:!0})),_.delay(function(){a.notifications.remove("drag-drop-support")},1e4)})}m(this).addClass("sek-dragged"),m("body").addClass("sek-dragging"),a.previewer.send("sek-drag-start",{type:n.dndData.content_type})}).call(m(this),e)}).on("dragend",function(e){(function(e){m("body").removeClass("sek-dragging"),m(this).removeClass("sek-dragged"),a.previewer.send("sek-drag-stop")}).call(m(this),e)}).dblclick(function(e){(function(e){var t,i=n.lastClickedTargetInPreview();!_.isEmpty(i)&&i.id?t=n.dnd_getDropZonesElements().find('[data-sek-id="'+i.id+'"]').find(".sek-module-drop-zone-for-first-module").first():o(),t&&0<t.length?(a.czr_sektions.trigger("sek-content-dropped",{drop_target_element:t,location:t.closest('[data-sek-level="location"]').data("sek-id"),before_module:t.data("drop-zone-before-module-or-nested-section"),after_module:t.data("drop-zone-after-module-or-nested-section"),before_section:t.data("drop-zone-before-section"),after_section:t.data("drop-zone-after-section"),content_type:m(this).data("sek-content-type"),content_id:m(this).data("sek-content-id"),section_type:m(this).data("sek-section-type"),is_user_section:"true"===m(this).data("sek-is-user-section")}),n.lastClickedTargetInPreview({})):(o(),a.errare("Double click insertion => the target zone was not found"))}).call(m(this),e)})})},setupNimbleDropZones:function(){var t=this;if(this.$dropZones=this.dnd_getDropZonesElements(),this.preDropElement=m("<div>",{class:sektionsLocalizedData.preDropElementClass,html:""}),this.$dropZones.length<1)throw new Error("::setupNimbleDropZones => invalid Dom element");this.$dropZones.each(function(){var e=m(this);!0!==e.data("zone-droppable-setup")&&(t.enterOverTimer=null,e.on("dragenter dragover",sektionsLocalizedData.dropSelectors,function(e){_.isNull(t.enterOverTimer)&&(t.enterOverTimer=!0,_.delay(function(){t.currentMousePosition&&t.currentMousePosition+""==e.clientY+""+e.clientX?t.enterOverTimer=null:(t.currentMousePosition=e.clientY+""+e.clientX,t.dnd_toggleDragApproachClassesToDropZones(e))},100)),t.dnd_canDrop({targetEl:m(this),evt:e})&&(e.stopPropagation(),t.dnd_OnEnterOver(m(this),e))}).on("dragleave drop",sektionsLocalizedData.dropSelectors,function(e){switch(e.type){case"dragleave":t.dnd_isOveringDropTarget(m(this),e)||t.dnd_cleanOnLeaveDrop(m(this),e);break;case"drop":if(this.$cachedDropZoneCandidates=null,!t.dnd_canDrop({targetEl:m(this),evt:e}))return;e.preventDefault(),t.dnd_onDrop(m(this),e),t.dnd_cleanOnLeaveDrop(m(this),e),a.previewer.send("sek-drag-stop")}}).data("zone-droppable-setup",!0))})},dnd_isInTarget:function(e,t){var i=t.clientY,n=t.clientX,o=e[0].getBoundingClientRect(),r=n<=o.right&&o.left<=n;return i>=o.top&&o.bottom>=i&&r},dnd_toggleDragApproachClassesToDropZones:function(u){var p=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.$cachedDropZoneCandidates=_.isEmpty(this.$cachedDropZoneCandidates)?this.$dropZones.find(".sek-drop-zone"):this.$cachedDropZoneCandidates,this.distanceTable=[],this.$dropZones.find(".sek-drop-zone").each(function(){var e,t,i=u.clientY,n=u.clientX,o=m(this)[0].getBoundingClientRect(),r=Math.abs(i-(o.bottom-(o.bottom-o.top)/2)),s=(Math.abs(o.top-i),Math.abs(n-(o.right-(o.right-o.left)/2))),a=(o.right,o.left,r<50),c=s<50,l=n<=o.right&&o.left<=n,d=i>=o.top&&o.bottom>=i;p.distanceTable.push({el:m(this),dist:d&&l?0:(e=s,t=r,Math.sqrt(e*e+t*t))}),m(this).removeClass("sek-drag-is-in"),(a||d)&&(c||l)?(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).addClass("sek-drag-is-very-close")):(m(this).removeClass("sek-drag-is-approaching"),m(this).removeClass("sek-drag-is-close"),m(this).removeClass("sek-drag-is-very-close")),m(this).removeClass("sek-drag-is-in")});var t=_.min(_.pluck(p.distanceTable,"dist"));p.$dropTargetCandidate=null,_.each(p.distanceTable,function(e){_.isNull(p.$dropTargetCandidate)&&t===e.dist&&(p.$dropTargetCandidate=e.el)}),p.$dropTargetCandidate&&0<p.$dropTargetCandidate.length&&p.dnd_isInTarget(p.$dropTargetCandidate,u)&&p.$dropTargetCandidate.addClass("sek-drag-is-in"),p.enterOverTimer=null},dnd_getPreDropElementContent:function(e){var t,i,n=m(e.currentTarget);switch(this.dndData.content_type){case"module":t=sektionsLocalizedData.i18n["Insert here"],0<n.length&&("between-sections"!==n.data("sek-location")&&"in-empty-location"!==n.data("sek-location")||(t=sektionsLocalizedData.i18n["Insert in a new section"])),i='<div class="sek-module-placeholder-content"><p>'+t+"</p></div>";break;case"preset_section":i='<div class="sek-module-placeholder-content"><p>'+(t=sektionsLocalizedData.i18n["Insert a new section here"])+"</p></div>";break;default:a.errare("::dnd_getPreDropElementContent => invalid content type provided")}return i},dnd_getDropZonesElements:function(){return m(a.previewer.targetWindow().document)},dnd_canDrop:function(e){var t=this,i=(e=_.extend({targetEl:{},evt:{}},e||{})).targetEl;if(!_.isObject(i)||i.length<1)return!1;var n=i.hasClass("sek-content-preset_section-drop-zone"),o=i.hasClass("sek-module-drop-zone-for-first-module"),r=!0===i.closest('[data-sek-level="location"]').data("sek-is-header-location"),s=!0===i.closest('[data-sek-level="location"]').data("sek-is-footer-location"),a="preset_section"===t.dndData.content_type&&"content"===t.dndData.section_type,c=function(e){m(".sek-no-drop-possible-message",i).length<1&&i.append(['<div class="sek-no-drop-possible-message">','<i class="material-icons">not_interested</i>',e,"</div>"].join(""))};return(r||s)&&a?(c(r?sektionsLocalizedData.i18n["The header location only accepts modules and pre-built header sections"]:sektionsLocalizedData.i18n["The footer location only accepts modules and pre-built footer sections"]),!1):s&&"preset_section"===t.dndData.content_type&&"header"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a header section in the footer location"]),!1):r&&"preset_section"===t.dndData.content_type&&"footer"===t.dndData.section_type?(c(sektionsLocalizedData.i18n["You can't drop a footer section in the header location"]),!1):i.hasClass("sek-drop-zone")&&("preset_section"===t.dndData.content_type&&n||"module"===t.dndData.content_type&&!n||"preset_section"===t.dndData.content_type&&o)},dnd_OnEnterOver:function(e,t){t.preventDefault(),!0!==e.data("is-drag-entered")&&(e.data("is-drag-entered",!0),e.addClass("sek-active-drop-zone"),this.$dropZones.addClass("sek-is-dragging"));try{this.dnd_mayBePrintPreDropElement(e,t)}catch(e){a.errare("Error when trying to insert the preDrop content",e)}},dnd_cleanOnLeaveDrop:function(e,t){var i=this;this.$dropZones=this.$dropZones||this.dnd_getDropZonesElements(),this.preDropElement.remove(),this.$dropZones.removeClass("sek-is-dragging"),m(sektionsLocalizedData.dropSelectors,this.$dropZones).each(function(){i.dnd_cleanSingleDropTarget(m(this))})},dnd_cleanSingleDropTarget:function(e){_.isEmpty(e)||e.length<1||(e.data("is-drag-entered",!1),e.data("preDrop-position",!1),e.removeClass("sek-active-drop-zone"),e.find(".sek-drop-zone").removeClass("sek-drag-is-close"),e.find(".sek-drop-zone").removeClass("sek-drag-is-approaching"),e.removeClass("sek-feed-me-seymore"),e.find(".sek-no-drop-possible-message").remove())},dnd_getPosition:function(e,t){var i=e[0].getBoundingClientRect(),n=i.height;return"before"===e.data("preDrop-position")?n+=this.preDropElement.outerHeight():"after"===e.data("preDrop-position")&&(n-=this.preDropElement.outerHeight()),0<t.originalEvent.clientY-i.top-n/2?"after":"before"},dnd_mayBePrintPreDropElement:function(e,t){var i=this,n=e.data("preDrop-position"),o=this.dnd_getPosition(e,t);if(n!==o&&!0!==i.isPrintingPreDrop){i.isPrintingPreDrop=!0,this.dnd_cleanSingleDropTarget(this.$currentPreDropTarget);var r="between-sections"===e.data("sek-location")||"in-empty-location"===e.data("sek-location");m.when(i.preDropElement.remove()).done(function(){e["before"===o?"prepend":"append"](i.preDropElement).find("."+sektionsLocalizedData.preDropElementClass).html(i.dnd_getPreDropElementContent(t)),e.find("."+sektionsLocalizedData.preDropElementClass).toggleClass("in-new-sektion",r),e.data("preDrop-position",o),e.addClass("sek-feed-me-seymore"),i.isPrintingPreDrop=!1,i.$currentPreDropTarget=e})}},dnd_isOveringDropTarget:function(e,t){var i=e[0].getBoundingClientRect(),n=t.clientX,o=t.clientY,r=i.left,s=i.right,a=i.top,c=i.bottom;return r<=n&&n-r<=s-r&&(a<=o&&o-a<=c-a)},dnd_onDrop:function(e,t){t.stopPropagation();this.dnd_getPosition(e,t),e.index();a.czr_sektions.trigger("sek-content-dropped",{drop_target_element:e,location:e.closest('[data-sek-level="location"]').data("sek-id"),before_module:e.data("drop-zone-before-module-or-nested-section"),after_module:e.data("drop-zone-after-module-or-nested-section"),before_section:e.data("drop-zone-before-section"),after_section:e.data("drop-zone-after-section"),content_type:t.originalEvent.dataTransfer.getData("sek-content-type"),content_id:t.originalEvent.dataTransfer.getData("sek-content-id"),section_type:t.originalEvent.dataTransfer.getData("sek-section-type"),is_user_section:"true"===t.originalEvent.dataTransfer.getData("sek-is-user-section")})},reactToDrop:function(){this.bind("sek-content-dropped",function(e){try{!function(e){if(!_.isObject(e))throw new Error("Invalid params provided");if(e.drop_target_element.length<1)throw new Error("Invalid drop_target_element");var t=e.drop_target_element,i="content-in-column";switch(t.data("sek-location")){case"between-sections":i="content-in-a-section-to-create";break;case"in-empty-location":e.is_first_section=!0,e.send_to_preview=!1,i="content-in-empty-location";break;case"between-columns":i="content-in-new-column"}if("preset_section"===e.content_type)if(t.hasClass("sek-module-drop-zone-for-first-module")){var n=t.closest('div[data-sek-level="section"]');1<n.find(".sek-sektion-inner").first().children('[data-sek-level="column"]').length?(i="preset-section-in-a-nested-section-to-create",e.is_nested=!0,e.in_column=t.closest('[data-sek-level="column"]').data("sek-id"),e.in_sektion=n.data("sek-id")):(e.sektion_to_replace=n.data("sek-id"),e.after_section=e.sektion_to_replace,e.in_column=n.closest('[data-sek-level="column"]').data("sek-id"),i="content-in-a-section-to-replace")}else"between-sections"===t.data("sek-location")&&(i="content-in-a-section-to-create");switch(i){case"content-in-column":var o=t.closest("div[data-sek-level]");if(o.length<1)throw new Error("No valid level dom element found");var r=o.data("sek-level"),s=o.data("sek-id");if(_.isEmpty(r)||_.isEmpty(s))throw new Error("No valid level id found");a.previewer.trigger("sek-add-module",{level:r,id:s,in_column:t.closest('div[data-sek-level="column"]').data("sek-id"),in_sektion:t.closest('div[data-sek-level="section"]').data("sek-id"),before_module:e.before_module,after_module:e.after_module,content_type:e.content_type,content_id:e.content_id});break;case"content-in-a-section-to-create":case"content-in-a-section-to-replace":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;case"preset-section-in-a-nested-section-to-create":a.previewer.trigger("sek-add-preset-section-in-new-nested-sektion",e);break;case"content-in-empty-location":a.previewer.trigger("sek-add-content-in-new-sektion",e);break;default:a.errare("sek control panel => ::reactToDrop => invalid drop case : "+i)}}(e)}catch(e){a.errare("error when reactToDrop",e)}})}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(r,s){s.extend(CZRSeksPrototype,{setupTinyMceEditor:function(){var n=this;r.sekEditorExpanded=new r.Value(!1),r.sekEditorSynchronizedInput=new r.Value,n.editorEventsListenerSetup=!1;var o=function(){r.sekTinyMceEditor=r.sekTinyMceEditor||tinyMCE.get("czr-customize-content_editor"),!1===n.editorEventsListenerSetup&&(n.attachEventsToEditor(),n.editorEventsListenerSetup=!0,n.trigger("sek-tiny-mce-editor-bound-and-instantiated"))};n.bind("sek-edit-module_done",function(e){if(("tiny_mce_editor"===(e=_.isObject(e)?e:{}).clicked_input_type||"czr_tiny_mce_editor_module"===e.module_type)&&!_.isEmpty(e.syncedTinyMceInputId)){var i=e.id;if(!0===n.getRegisteredModuleProperty(e.module_type,"is_father")){var t=n.getRegisteredModuleProperty(e.module_type,"children");if(_.isEmpty(t))throw new Error("::generateUIforFrontModules => a father module "+e.module_type+" is missing children modules ");_.each(t,function(e,t){"czr_tinymce_child"===e&&(i=i+"__"+t)})}r.sekEditorSynchronizedInput({control_id:i,input_id:e.syncedTinyMceInputId}),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),s("#customize-theme-controls").on("click",'[data-czr-action="open-tinymce-editor"]',function(){var e=s(this).data("czr-control-id"),t=s(this).data("czr-input-id");if(_.isEmpty(e)||_.isEmpty(t))r.errare("toggle-tinymce-editor => missing input or control id");else{var i=s.extend(!0,{},r.sekEditorSynchronizedInput()),n=_.extend(i,{input_id:t,control_id:e});r.sekEditorSynchronizedInput(n),r.sekEditorExpanded(!0),r.sekTinyMceEditor.focus()}}),r.sekEditorSynchronizedInput.bind(function(n,e){o(),r(n.control_id,function(e){var t=e(),i=_.isObject(t)&&!_.isEmpty(t[n.input_id])?t[n.input_id]:"";i=i.replace(/\r?\n/g,"<br/>");try{r.sekTinyMceEditor.setContent(i)}catch(e){r.errare("Error when setting the tiny mce editor content in setupTinyMceEditor",e)}r.sekTinyMceEditor.focus()})}),r.sekEditorExpanded.bind(function(e,t,i){o(),e&&r.sekTinyMceEditor.focus(),s(document.body).toggleClass("czr-customize-content_editor-pane-open",e),s(window)[e?"on":"off"]("resize",function(){r.sekEditorExpanded()&&_.delay(function(){n.czrResizeEditor(window.innerHeight-n.$editorPane.height())},50)}),e?n.czrResizeEditor(window.innerHeight-n.$editorPane.height()):(n.$preview.css("bottom",""),n.$collapseSidebar.css("bottom",""))}),s("#czr-customize-content_editor-pane").on("click",'[data-czr-action="close-tinymce-editor"]',function(){r.sekEditorExpanded(!1)}),s("#customize-controls").on("click",function(e){"open-tinymce-editor"!=s(e.target).data("czr-action")&&r.sekEditorExpanded(!1,{context:"clicked anywhere"})}),s(document).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50)),n.bind("sek-tiny-mce-editor-bound-and-instantiated",function(){var e=s(r.sekTinyMceEditor.iframeElement).contents().get(0);s(e).on("keydown",_.throttle(function(e){27===e.keyCode&&r.sekEditorExpanded(!1)},50))}),_.each(["sek-click-on-inactive-zone","sek-add-section","sek-add-column","sek-add-module","sek-remove","sek-move","sek-duplicate","sek-resize-columns","sek-add-content-in-new-sektion","sek-pick-content","sek-edit-options","sek-edit-module","sek-notify"],function(e){"sek-edit-module"!=e?r.previewer.bind(e,function(){r.sekEditorExpanded(!1)}):r.previewer.bind(e,function(e){r.sekEditorExpanded("czr_tiny_mce_editor_module"===e.module_type)})})},attachEventsToEditor:function(){var t=this;t.$editorTextArea=s("#czr-customize-content_editor"),t.$editorPane=s("#czr-customize-content_editor-pane"),t.$editorDragbar=s("#czr-customize-content_editor-dragbar"),t.$editorFrame=s("#czr-customize-content_editor_ifr"),t.$mceTools=s("#wp-czr-customize-content_editor-tools"),t.$mceToolbar=t.$editorPane.find(".mce-toolbar-grp"),t.$mceStatusbar=t.$editorPane.find(".mce-statusbar"),t.$preview=s("#customize-preview"),t.$collapseSidebar=s(".collapse-sidebar"),r.sekTinyMceEditor.on("input change keyup",function(e){if(r.control.has(r.sekEditorSynchronizedInput().control_id))try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:r.sekTinyMceEditor.getContent(),modified_editor_element:r.sekTinyMceEditor})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),t.$editorTextArea.on("input",function(e){try{r.control(r.sekEditorSynchronizedInput().control_id).trigger("tinyMceEditorUpdated",{input_id:r.sekEditorSynchronizedInput().input_id,html_content:t.$editorTextArea.val(),modified_editor_element:t.$editorTextArea})}catch(e){r.errare("Error when triggering tinyMceEditorUpdated",e)}}),s("#czr-customize-content_editor-pane").on("mousedown mouseup",function(e){if(("mousedown"!==e.type||"czr-customize-content_editor-dragbar"===s(e.target).attr("id")||s(e.target).hasClass("czr-resize-handle"))&&r.sekEditorExpanded())switch(e.type){case"mousedown":s(document).on("mousemove.czr-customize-content_editor",function(e){e.preventDefault(),s(document.body).addClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","none"),t.czrResizeEditor(e.pageY)});break;case"mouseup":s(document).off("mousemove.czr-customize-content_editor"),s(document.body).removeClass("czr-customize-content_editor-pane-resize"),t.$editorFrame.css("pointer-events","")}})},czrResizeEditor:function(e){var t,i=this,n=window.innerHeight,o=(window.innerWidth,{});r.sekEditorExpanded()&&(_.isNaN(e)||(t=n-e),o.height=t,o.components=i.$mceTools.outerHeight()+i.$mceToolbar.outerHeight()+i.$mceStatusbar.outerHeight(),t<40&&(o.height=40),n-1<t&&(o.height=n-1),n<i.$editorPane.outerHeight()&&(o.height=n),i.$preview.css("bottom",o.height),i.$editorPane.css("height",o.height),i.$editorFrame.css("height",o.height-o.components),i.$collapseSidebar.css("bottom",n-o.height<56?i.$mceStatusbar.outerHeight()+4:o.height+8))}})}(wp.customize,jQuery);CZRSeksPrototype=CZRSeksPrototype||{};!function(t,e){jQuery.extend(CZRSeksPrototype,t.Events);var i=t.Class.extend(CZRSeksPrototype);try{t.czr_sektions=new i}catch(e){t.errare("api.czr_sektions => problem on instantiation",e)}}(wp.customize),function(l,d,u){l.czrInputMap=l.czrInputMap||{};var p=function(e){return u.contains(["px","em","%"],e)||(l.errare("error : invalid unit for input "+this.id,e),e="px"),e},_=function(i){var n=this;i.on("click",".sek-ui-button",function(e,t){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),d(this).addClass("is-selected").attr("aria-pressed",!0),n.css_unit(d(this).data("sek-unit"),t)}),i.find('.sek-ui-button[data-sek-unit="'+(n.initial_unit||"px")+'"]').addClass("is-selected").attr("aria-pressed",!0)},m=function(t,i){var n=this;t.on("click",".reset-spacing-wrap",function(e){e.preventDefault(),t.find('input[type="number"]').each(function(){d(this).val("")}),n(i),d(".sek-unit-wrapper",t).find('[data-sek-unit="px"]').trigger("click")})};d.extend(l.czrInputMap,{spacing:function(e){var o=this,i=d(".sek-spacing-wrapper",o.container),t=l.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),n=u.isEmpty(t)||u.isEmpty(t.default)?[]:t.default;if(i.on("input",'input[type="number"]',function(e){var t=d(this).closest("[data-sek-spacing]").data("sek-spacing"),i=d.extend(!0,{},u.isObject(o())?o():{}),n=d(this).val();u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?i[t]=n:i=u.omit(i,t),o(i)}),m.call(o,i,n),u.isObject(o())){u.each(o(),function(e,t){d('[data-sek-spacing="'+t+'"]',i).find('input[type="number"]').val(e)});var r="px";d(".sek-unit-wrapper .sek-ui-button",o.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(o())||u.isEmpty(o().unit)||e===o().unit&&(r=e)}),d(".sek-unit-wrapper",o.container).find('[data-sek-unit="'+p.call(o,r)+'"]').trigger("click")}var s=o();o.initial_unit="px",u.isEmpty(s)||(o.initial_unit=u.isEmpty(s.unit)?"px":s.unit),o.css_unit=new l.Value(p.call(o,o.initial_unit)),o.css_unit.bind(function(e){var t;e=u.isEmpty(e)?"px":e,(t=d.extend(!0,{},u.isObject(o())?o():{})).unit=e,o(t)}),_.call(o,i)}}),d.extend(l.czrInputMap,{spacingWithDeviceSwitcher:function(e){var r=this,s=d(".sek-spacing-wrapper",r.container),t=l.czr_sektions.getInputRegistrationParams(r.id,r.module.module_type),a=u.isEmpty(t)||u.isEmpty(t.default)?{}:t.default,c=function(e,t){var i=["mobile","tablet","desktop"];if(u.has(e,t))return e[t];var n=u.findIndex(i,function(e){return t===e});return!u.isEmpty(t)&&n<i.length?c(e,i[n+1]):{}},i=function(e){var t=d.extend(!0,{},u.isObject(r())?r():{}),i=d.extend(!0,{},a);t=u.isObject(t)?d.extend(i,t):i;var n=c(t,e);d("[data-sek-spacing]",s).each(function(){var e=d(this).data("sek-spacing"),t="";u.isEmpty(n)||u.isEmpty(n[e])||(t=n[e]),d(this).find('input[type="number"]').val(t)});var o="px";d(".sek-unit-wrapper .sek-ui-button",r.container).each(function(){var e=d(this).data("sek-unit");u.isEmpty(n)||u.isEmpty(n.unit)||e===n.unit&&(o=e)}),d(".sek-unit-wrapper",r.container).find('[data-sek-unit="'+p.call(r,o)+'"]').trigger("click",{previewed_device_switched:!0})};l.czr_sektions.maybeSetupDeviceSwitcherForInput.call(r);var n=r();r.initial_unit="px",u.isEmpty(n)||u.isEmpty(n[r.previewedDevice()])||(r.initial_unit=u.isEmpty(n[r.previewedDevice()].unit)?"px":n[r.previewedDevice()].unit),r.css_unit=new l.Value(p.call(r,r.initial_unit)),s.on("input",'input[type="number"]',function(e){var t,i=d(this).closest("[data-sek-spacing]").data("sek-spacing"),n=d(this).val(),o=l.previewedDevice()||"desktop";(t=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},t[o]||{}),u.isString(n)&&!u.isEmpty(n)||u.isNumber(n)?t[o][i]=n:t[o]=u.omit(t[o],i),r(t)}),m.call(r,s,a),r.previewedDevice.bind(function(e){try{i(e)}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}),r.css_unit.bind(function(e,t,i){if(!u.isObject(i)||!0!==i.previewed_device_switched){e=u.isEmpty(e)?"px":e;var n,o=r.previewedDevice()||"desktop";(n=d.extend(!0,{},u.isObject(r())?r():{}))[o]=d.extend(!0,{},n[o]||{}),n[o].unit=e,r(n)}}),_.call(r,s);try{i(l.previewedDevice())}catch(e){l.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+r.id,e)}}})}(wp.customize,jQuery,_),function(n,a,c){n.czrInputMap=n.czrInputMap||{},a.extend(n.czrInputMap,{bg_position:function(e){var t=this;a(".sek-bg-pos-wrapper",t.container).on("change",'input[type="radio"]',function(e){t(a(this).val())}),c.isEmpty(t())||t.container.find('input[value="'+t()+'"]').attr("checked",!0).trigger("click")},bgPositionWithDeviceSwitcher:function(e){var o=this,t=n.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=c.isEmpty(t)||c.isEmpty(t.default)?{}:t.default;n.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var s=function(e,t){var i=["mobile","tablet","desktop"];if(c.has(e,t))return e[t];var n=c.findIndex(i,function(e){return t===e});return!c.isEmpty(t)&&n<i.length?s(e,i[n+1]):{}},i=function(e){var t=a.extend(!0,{},c.isObject(o())?o():{}),i=a.extend(!0,{},r);t=c.isObject(t)?a.extend(i,t):i;var n=s(t,e);o.container.find('input[value="'+n+'"]').attr("checked",!0).trigger("click",{previewed_device_switched:!0})};a(".sek-bg-pos-wrapper",o.container).on("change",'input[type="radio"]',function(e){var t,i=a(this).val();(t=a.extend(!0,{},c.isObject(o())?o():{}))[n.previewedDevice()||"desktop"]=i,o(t)}),o.previewedDevice.bind(function(e){try{i(e)}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type spacingWithDeviceSwitcher for input id "+o.id,e)}});try{i(n.previewedDevice())}catch(e){n.errare("Error when firing syncWithPreviewedDevice for input type bgPositionWithDeviceSwitcher for input id "+o.id,e)}}})}(wp.customize,jQuery,_),function(c,l,d){c.czrInputMap=c.czrInputMap||{};var e=function(e){var o=this,t=c.czr_sektions.getInputRegistrationParams(o.id,o.module.module_type),r=d.isEmpty(t)||d.isEmpty(t.default)?{}:t.default,i="verticalAlignWithDeviceSwitcher"===o.type?".sek-v-align-wrapper":".sek-h-align-wrapper",s=l(i,o.container);c.czr_sektions.maybeSetupDeviceSwitcherForInput.call(o);var a=function(e,t){var i=["mobile","tablet","desktop"];if(d.has(e,t))return e[t];var n=d.findIndex(i,function(e){return t===e});return!d.isEmpty(t)&&n<i.length?a(e,i[n+1]):{}},n=function(e){var t=l.extend(!0,{},d.isObject(o())?o():{}),i=l.extend(!0,{},r);t=d.isObject(t)?l.extend(i,t):i;var n=a(t,e);s.find(".selected").removeClass("selected"),s.find('div[data-sek-align="'+n+'"]').addClass("selected")};s.on("click","[data-sek-align]",function(e){var t;e.preventDefault(),(t=l.extend(!0,{},d.isObject(o())?o():{}))[c.previewedDevice()||"desktop"]=l(this).data("sek-align"),s.find(".selected").removeClass("selected"),l.when(l(this).addClass("selected")).done(function(){o(t)})}),o.previewedDevice.bind(function(e){try{n(e)}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}});try{n(c.previewedDevice())}catch(e){c.errare("Error when firing syncWithPreviewedDevice for input type : "+o.type+" for input id "+o.id,e)}};l.extend(c.czrInputMap,{horizTextAlignmentWithDeviceSwitcher:e,horizAlignmentWithDeviceSwitcher:e,verticalAlignWithDeviceSwitcher:e})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{font_size:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{line_height:function(e){t.czr_sektions.setupFontSizeAndLineHeightInputs.call(this)}})}(wp.customize,jQuery,_),function(i,c,l){i.czrInputMap=i.czrInputMap||{},c.extend(i.czrInputMap,{font_picker:function(e){var a=this,o=a.input_parent,n=function(e,t){o();var n=c('select[data-czrtype="'+a.id+'"]',a.container);l.isNull(a())||l.isEmpty(a())?n.append('<option value="none" selected="selected">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"):n.append('<option value="none">'+sektionsLocalizedData.i18n["Select a font family"]+"</option>"),l.each([{title:sektionsLocalizedData.i18n["Web Safe Fonts"],type:"cfont",list:t.cfonts},{title:sektionsLocalizedData.i18n["Google Fonts"],type:"gfont",list:t.gfonts}],function(e){var t,r,s,i=c("<optgroup>",{label:e.title,html:(t=e.list,r=e.type,s="",l.each(t,function(e){var t,i,n=e.name,o=l.isString(n)?n.replace(/[+|:]/g," "):n;t=n,i=r,(n=l.isString(t)?["[",i,"]",t].join(""):"")==a()?s+='<option selected="selected" value="'+n+'">'+o+"</option>":s+='<option value="'+n+'">'+o+"</option>"}),s)});n.append(i)});var i={escapeMarkup:function(e){return e}};e&&c.extend(i,{resultsAdapter:e,closeOnSelect:!1}),n.czrSelect2(i),c(".czrSelect2-selection__rendered",a.container).css(r(a()))},r=function(e){if(!l.isString(e)||l.isEmpty(e))return{};var t,i,n,o=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return t=s(e),i=o[1]?o[1].replace(/[^0-9.]+/g,""):400,i=l.isNumber(i)?i:400,n=o[1]&&-1!=o[1].indexOf("italic")?"italic":"",{"font-family":"none"==t?"inherit":t.replace(/[+|:]/g," "),"font-weight":i||400,"font-style":n||"normal"}},s=function(e){if(!l.isString(e)||l.isEmpty(e))return e;var t=(e=e.replace("[gfont]","").replace("[cfont]","")).split(":");return l.isString(t[0])?t[0].replace(/[+|:]/g," "):""};c.when(function(){var e,t=c.Deferred();l.isEmpty(i.sek_fontCollections)?(l.isUndefined(i.sek_fetchingFontCollection)||"pending"!=i.sek_fetchingFontCollection.state()?(e=i.CZR_Helpers.getModuleTmpl({tmpl:"font_list",module_type:"font_picker_input",module_id:a.module.id}),i.sek_fetchingFontCollection=e):e=i.sek_fetchingFontCollection,e.done(function(e){if("string"!=typeof e||"{"!==e[0])throw new Error("font_picker => server list is not JSON.parse-able");i.sek_fontCollections=JSON.parse(e),t.resolve(i.sek_fontCollections)}).fail(function(e){t.reject(e)})):t.resolve(i.sek_fontCollections);return t.promise()}()).done(function(t){var i;(i=c.Deferred(),void 0!==c.fn.czrSelect2&&void 0!==c.fn.czrSelect2.amd&&"function"==typeof c.fn.czrSelect2.amd.require?c.fn.czrSelect2.amd.require(["czrSelect2/results","czrSelect2/utils"],function(e,t){var n=function(e,t,i){n.__super__.constructor.call(this,e,t,i)};t.Extend(n,e),n.prototype.bind=function(e,t){var i=this;e.on("results:focus",function(e){"true"!=e.element.attr("aria-selected")&&i.trigger("select",{data:e.data})}),n.__super__.bind.call(this,e,t)},i.resolve(n)}):i.resolve(!1),i.promise()).done(function(e){n(e,t)})}).fail(function(e){i.errare("font_picker => fail response =>",e)})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{fa_icon_picker:function(){var n=this,o=!1,e=function(t){!0!==n.iconCollectionSet&&(s.when(s.Deferred(function(t){a.isEmpty(n.sek_faIconCollection)?r.CZR_Helpers.getModuleTmpl({tmpl:"icon_list",module_type:"fa_icon_picker_input",module_id:n.module.id}).done(function(e){if("string"!=typeof e||"["!==e[0])throw new Error("fa_icon_picker => server list is not JSON.parse-able");n.sek_faIconCollection=JSON.parse(e),t.resolve(n.sek_faIconCollection)}).fail(function(e){t.reject(e)}):t.resolve(n.sek_faIconCollection)})).done(function(e){!function(e){a.each(e,function(e){var t={value:e,html:r.CZR_Helpers.capitalize(e.substring(7))};t.value==n()&&(s.extend(t,{selected:"selected"}),o=!0),s("select[data-czrtype]",n.container).append(s("<option>",t))});var t,i=function(e){return e.id?s('<span class="'+e.element.value+'"></span><span class="social-name">&nbsp;&nbsp;'+e.text+"</span>"):e.text};t=o?s("<option>"):s("<option>",{selected:"selected"}),s("select[data-czrtype]",n.container).prepend(t).czrSelect2({templateResult:i,templateSelection:i,placeholder:sektionsLocalizedData.i18n["Select an icon"],allowClear:!0})}(e),t&&!0===t.open_on_init&&a.delay(function(){try{s("select[data-czrtype]",n.container).czrSelect2("open")}catch(e){}},100)}).fail(function(e){r.errare("fa_icon_picker => fail response =>",e)}),n.iconCollectionSet=!0)};n.container.on("click",function(){e()}),a.delay(function(){e({open_on_init:!1})},1e3)}})}(wp.customize,jQuery,_),function(d,u,p){d.czrInputMap=d.czrInputMap||{},u.extend(d.czrInputMap,{code_editor:function(e){var n=this,i=this.module.control,t=(n.input_parent(),!1),r=n.container.find("textarea"),o=n.container.find(".customize-control-title"),s=r.data("editor-params");wp.codeEditor&&(p.isUndefined(s)||!1!==s)&&(t=s),n.isReady.done(function(){var e=function(e){p.isEmpty(this.editor)&&(p.isEmpty(this.module.control.container.attr("data-sek-expanded"))||"false"==this.module.control.container.attr("data-sek-expanded")||setTimeout(function(){if(t)try{a(t)}catch(e){d.errare("error in sek_control => code_editor() input",e),c()}else c();o.click()},10))};e.call(n),n.module.control.container.on("sek-accordion-expanded",function(){e.call(n)})});var a=function(e){var t,i=!1;t=p.extend({},e,{onTabNext:CZRSeksPrototype.selectNextTabbableOrFocusable(":tabbable"),onTabPrevious:CZRSeksPrototype.selectPrevTabbableOrFocusable(":tabbable"),onUpdateErrorNotice:l}),n.editor=wp.codeEditor.initialize(r,t),u(n.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":o.html(),"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),o.on("click",function(e){e.stopPropagation(),n.editor.codemirror.focus()}),n.editor.codemirror.on("change",function(e){i=!0,r.val(e.getValue()).trigger("change"),i=!1}),n.editor.codemirror.setValue(n()),n.bind(n.id+":changed",function(e){i||n.editor.codemirror.setValue(e)}),n.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()})},c=function(){var o=r[0];n.editor=o,r.on("blur",function(){r.data("next-tab-blurs",!1)}),r.on("keydown",function(e){var t,i,n;27!==e.keyCode?9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||r.data("next-tab-blurs")||(t=o.selectionStart,i=o.selectionEnd,n=o.value,0<=t&&(o.value=n.substring(0,t).concat("\t",n.substring(i)),r.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault()):r.data("next-tab-blurs")||(r.data("next-tab-blurs",!0),e.stopPropagation())})},l=function(e){var t;i.setting.notifications.remove(n.id),0!==e.length&&(t=1===e.length?sektionsLocalizedData.i18n.codeEditorSingular.replace("%d","1").replace("%s",o.html()):sektionsLocalizedData.i18n.codeEditorPlural.replace("%d",String(e.length)).replace("%s",o.html()),i.setting.notifications.add(n.id,new d.Notification(n.id,{message:t,type:"warning"})))}}})}(wp.customize,jQuery,_),function(e,r,t){e.czrInputMap=e.czrInputMap||{},r.extend(e.czrInputMap,{range_simple:function(e){var t=this,i=r(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]');o.on("input",function(e){n.val(r(this).val()).trigger("input")}),n.on("input",function(e){t(r(this).val()),o.val(r(this).val())}),o.val(n.val()||0)}})}(wp.customize,jQuery,_),function(a,c,l){a.czrInputMap=a.czrInputMap||{},c.extend(a.czrInputMap,{range_with_unit_picker:function(e){var t=this,i=c(".sek-range-with-unit-picker-wrapper",t.container),n=i.find('input[type="number"]'),o=i.find('input[type="range"]'),r=i.find("input[data-czrtype]").data("sek-unit"),s=function(e){return l.contains(["px","em","%"],e)||(a.errare("error : invalid unit for input "+t.id,e),e="px"),e};t.css_unit=new a.Value(l.isEmpty(r)?"px":s(r)),t.css_unit.bind(function(e){e=l.isEmpty(e)?"px":e,i.find('input[type="number"]').trigger("input")}),o.on("input",function(e){n.val(c(this).val()).trigger("input")}),n.on("input",function(e){t(c(this).val()+s(t.css_unit())),o.val(c(this).val())}),o.val(n.val()||0),i.on("click",".sek-ui-button",function(e){e.preventDefault(),i.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),c(this).addClass("is-selected").attr("aria-pressed",!0),i.find("input[data-czrtype]").data("sek-unit",c(this).data("sek-unit")),t.css_unit(c(this).data("sek-unit"))}),i.find('.sek-ui-button[data-sek-unit="'+r+'"]').addClass("is-selected").attr("aria-pressed",!0)}})}(wp.customize,jQuery,_),function(a,_,m){a.czrInputMap=a.czrInputMap||{},_.extend(a.czrInputMap,{range_with_unit_picker_device_switcher:function(e){var c=this,l=_(".sek-range-with-unit-picker-wrapper",c.container),d=l.find('input[type="number"]'),r=l.find('input[type="range"]'),s=function(e){return m.contains(["px","em","%"],e)||(a.errare("range_with_unit_picker_device_switcher => error : invalid unit for input "+c.id,e),e="px"),e},t=a.czr_sektions.getInputRegistrationParams(c.id,c.module.module_type),u=m.isEmpty(t)||m.isEmpty(t.default)?{}:t.default,i=function(){return l.find("input[data-czrtype]").data("sek-unit")||"px"},p=function(e,t){var i=["mobile","tablet","desktop"];if(m.has(e,t))return e[t];var n=m.findIndex(i,function(e){return t===e});return!m.isEmpty(t)&&n<i.length?p(e,i[n+1]):_.extend(!0,{desktop:""},u).desktop},n=function(e){var t=c(),i={};i=_.extend(!0,{},u),m.isObject(t)?i=_.extend(!0,{},t):m.isString(t)&&!m.isEmpty(t)&&(i={desktop:t});var n,o,r=p(i,e),s=(o=r,m.isEmpty(o)||!m.isString(o)?"px":o.replace(/[0-9]|\.|,/g,"")),a=(n=r,m.isEmpty(n)||!m.isString(n)?"16":n.replace(/px|em|%/g,""));_(".sek-unit-wrapper",l).find('[data-sek-unit="'+s+'"]').trigger("click",{previewed_device_switched:!0}),l.find('.sek-ui-button[data-sek-unit="'+s+'"]').addClass("is-selected").attr("aria-pressed",!0),d.val(a).trigger("input",{previewed_device_switched:!0})};a.czr_sektions.maybeSetupDeviceSwitcherForInput.call(c),c.css_unit=new a.Value(m.isEmpty(i())?"px":s(i()));var o='<button type="button" class="button sek-reset-button sek-float-right">'+sektionsLocalizedData.i18n.Reset+"</button>";c.container.find(".customize-control-title").append(o),c.css_unit.bind(function(e,t,i){m.isObject(i)&&!0===i.previewed_device_switched||d.trigger("input")}),r.on("input",function(e){d.val(_(this).val()).trigger("input")}),d.on("input",function(e,t){var i,n=a.previewedDevice()||"desktop",o=_(this).val()+s(c.css_unit());(i=_.extend(!0,{},m.isObject(c())?c():{}))[n]=_.extend(!0,{},i[n]||{}),m.isString(o)&&!m.isEmpty(o)&&(i[n]=o),(m.isEmpty(t)||m.isObject(t)&&!0!==t.previewed_device_switched)&&c(i),r.val(_(this).val())}),l.on("click",".sek-ui-button",function(e,t){e.stopPropagation(),l.find(".sek-ui-button").removeClass("is-selected").attr("aria-pressed",!1),_(this).addClass("is-selected").attr("aria-pressed",!0),l.find("input[data-czrtype]").data("sek-unit",_(this).data("sek-unit")),c.css_unit(_(this).data("sek-unit"),t)}),c.previewedDevice.bind(function(e){try{n(e)}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}),c.container.on("click",".sek-reset-button",function(e){var t=a.previewedDevice(),i=_.extend(!0,{},m.isObject(c())?c():{});m.isEmpty(i[t])||(i=m.omit(i,t),c(i),n(a.previewedDevice()))}),r.val(d.val()||0);try{n(a.previewedDevice())}catch(e){a.errare("Error when firing syncWithPreviewedDevice for input type range_with_unit_picker_device_switcher for input id "+c.id,e)}}})}(wp.customize,jQuery,_),function(g,h,k){g.czrInputMap=g.czrInputMap||{},h.extend(g.czrInputMap,{borders:function(e){var a=this,c=h(".sek-borders",a.container),l=c.find('input[type="number"]'),d=c.find('input[type="range"]'),u=c.find(".sek-alpha-color-input"),p=function(e){return k.contains(["px","em","%"],e)||(g.errare("borders => error : invalid unit for input "+a.id,e),e="px"),e},_=function(e){return k.isEmpty(e)||!k.isString(e)?"16":e.replace(/px|em|%/g,"")},m=function(e){return k.isEmpty(e)||!k.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=g.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),f=k.isEmpty(t)||k.isEmpty(t.default)?{}:t.default;a.cssBorderTypes=["top","left","right","bottom"];var i,n,o=function(){var e=a(),t="px";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.wght)&&(t=p(m(e._all_.wght))),t},r=function(){var e=a(),t="#000000";return k.isObject(e)&&k.has(e,"_all_")&&k.isObject(e._all_)&&!k.isEmpty(e._all_.col)&&(t=e._all_.col),t},s=function(e){if(!k.contains(k.union(a.cssBorderTypes,["_all_"]),e))throw new Error("Error in syncWithBorderType : the border type must be one of those values '_all_', 'top', 'left', 'right', 'bottom'");var t=a(),i={},n=h.extend(!0,{},f);k.isObject(t)?i=h.extend(!0,{},t):k.isString(t)&&(i={_all_:{wght:t}});var o,r,s=function(e,t){var i,n=h.extend(!0,{},f);if(!k.has(n,"_all_"))throw new Error("Error when firing getCurrentBorderTypeOrAllValue : the default value of the borders input must be php registered as an array formed : array( 'wght' => '1px', 'col' => '#000000' )");return i=k.isObject(e)&&k.has(e,"_all_")?k.extend(n._all_,e._all_):n._all_,k.has(e,t)&&k.isObject(e[t])?k.extend(i,e[t]):n._all_}(i=h.extend(n,i),e);if(k.isEmpty(s)||!k.isObject(s)||k.isEmpty(s.wght)||k.isEmpty(s.col))throw new Error("Error in syncWithBorderType : getCurrentBorderTypeOrAllValue must return an object formed : array( 'wght' => '1px', 'col' => '#000000' )");o=m(s.wght),r=_(s.wght),h(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{border_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{border_type_switched:!0}),u.data("border_type_switched",!0),u.val(s.col).trigger("change"),u.data("border_type_switched",!1)};a.borderColor=new g.Value(k.isEmpty(r())?"#000000":r()),a.css_unit=new g.Value(k.isEmpty(o())?"px":p(o())),a.borderType=new g.Value("_all_"),l.val((i=a(),n=1,k.isObject(i)&&k.has(i,"_all_")&&k.isObject(i._all_)&&!k.isEmpty(i._all_.wght)&&(n=_(i._all_.wght)),n=parseInt(n,10),(!k.isNumber(n)||n<0)&&(g.errare("Error in borders input type for module : "+a.module.module_type+" the initial border width is invalid : "+n),n=1),n)),u.val(a.borderColor()),u.wpColorPicker({palettes:!0,width:1440<=window.innerWidth?271:251,change:function(e,t){h(this).val(t.color.toString()).trigger("colorpickerchange"),a.borderColor(t.color.toString(),{border_type_switched:!0===h(this).data("border_type_switched")})},clear:function(e,t){h(this).val("").trigger("colorpickerchange"),a.borderColor("")}}),a.css_unit.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.borderColor.bind(function(e,t,i){(!k.isObject(i)||!0!==i.border_type_switched&&!0!==i.initializing_the_color)&&l.trigger("input",i)}),a.borderType.bind(function(e){try{s(e)}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}}),d.on("input",function(e){l.val(h(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.borderType()||"_all_",o=a.borderColor(),r=h(this).val()+p(a.css_unit()),s=h.extend(!0,{},f);(i=h.extend(!0,{},k.isObject(a())?a():s))[n]=h.extend(!0,{},i[n]||s[n]),k.isString(r)&&!k.isEmpty(r)&&(i[n].wght=r),i[n].col=o,(k.isEmpty(t)||k.isObject(t)&&!0!==t.border_type_switched)&&("_all_"===n&&k.each(a.cssBorderTypes,function(e){i=k.omit(i,e)}),a(i)),d.val(h(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",h(this).data("sek-unit")),a.css_unit(h(this).data("sek-unit"),t)}),c.on("click","[data-sek-border-type]",function(e,t){e.preventDefault(),c.find("[data-sek-border-type]").removeClass("is-selected").attr("aria-pressed",!1),h(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=h(this).data("sek-border-type")}catch(e){g.errare("borders input type => error when attaching click event",e)}a.borderType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.borderType()||"_all_",i=h.extend(!0,{},k.isObject(a())?a():{});k.isEmpty(i[t])||(i=k.omit(i,t),a(i),s(t))}),d.val(l.val()||0);try{s(a.borderType())}catch(e){g.errare("Error when firing syncWithBorderType for input type borders for module type "+a.module.module_type,e)}h('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(m,f,g){m.czrInputMap=m.czrInputMap||{},f.extend(m.czrInputMap,{border_radius:function(e){var a=this,c=f(".sek-borders",a.container),l=c.find('input[type="number"]'),s=c.find('input[type="range"]'),d=function(e){return g.contains(["px","em","%"],e)||(m.errare("border_radius => error : invalid unit for input "+a.id,e),e="px"),e},u=function(e){return g.isEmpty(e)||!g.isString(e)?"16":e.replace(/px|em|%/g,"")},p=function(e){return g.isEmpty(e)||!g.isString(e)?"px":e.replace(/[0-9]|\.|,/g,"")},t=m.czr_sektions.getInputRegistrationParams(a.id,a.module.module_type),_=g.isEmpty(t)||g.isEmpty(t.default)?{}:t.default;a.cssRadiusTypes=["top_left","top_right","bottom_right","bottom_left"];var i,n,o=function(){var e=a(),t="px";return g.isObject(e)&&g.has(e,"_all_")&&(t=d(p(e._all_))),t},r=function(e){if(!g.contains(["_all_","top_left","top_right","bottom_right","bottom_left"],e))throw new Error("Error in syncWithRadiusType : the radius type must be one of those values '_all_', 'top_left', 'top_right', 'bottom_right', 'bottom_left', => radius type => "+e);var t=a(),i={},n=f.extend(!0,{},_);g.isObject(t)?i=f.extend(!0,{},t):g.isString(t)&&(i={_all_:"0px"});var o,r,s=function(e,t){var i,n=f.extend(!0,{},_);if(!g.has(n,"_all_"))throw new Error("Error when firing getCurrentRadiusTypeOrAllValue : the default value of the border_radius input must be php registered as an array");return i=g.isObject(e)&&g.has(e,"_all_")?e._all_:n._all_,g.has(e,t)?e[t]:i}(i=f.extend(n,i),e);if(g.isEmpty(s)||!g.isString(s))throw new Error("Error in syncWithRadiusType : getCurrentRadiusTypeOrAllValue must return a string like 3em");o=p(s),r=u(s),f(".sek-unit-wrapper",c).find('[data-sek-unit="'+o+'"]').trigger("click",{radius_type_switched:!0}),c.find('.sek-ui-button[data-sek-unit="'+o+'"]').addClass("is-selected").attr("aria-pressed",!0),l.val(r).trigger("input",{radius_type_switched:!0})};a.css_unit=new m.Value(g.isEmpty(o())?"px":d(o())),a.radiusType=new m.Value("_all_"),l.val((i=a(),n=0,g.isObject(i)&&g.has(i,"_all_")&&(n=u(i._all_)),n=parseInt(n,10),(!g.isNumber(n)||n<0)&&(m.errare("Error in border_radius input type for module : "+a.module.module_type+" the initial radius is invalid : "+n),n=0),n)),a.css_unit.bind(function(e,t,i){(!g.isObject(i)||!0!==i.radius_type_switched&&!0!==i.initializing_the_unit)&&l.trigger("input",i)}),a.radiusType.bind(function(e){try{r(e)}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}}),s.on("input",function(e){l.val(f(this).val()).trigger("input")}),l.on("input",function(e,t){var i,n=a.radiusType()||"_all_",o=f(this).val()+d(a.css_unit()),r=f.extend(!0,{},_);(i=f.extend(!0,{},g.isObject(a())?a():r))[n]=f.extend(!0,{},i[n]||r[n]),g.isString(o)&&!g.isEmpty(o)&&(i[n]=o),(g.isEmpty(t)||g.isObject(t)&&!0!==t.radius_type_switched)&&("_all_"===n&&g.each(a.cssRadiusTypes,function(e){i=g.omit(i,e)}),a(i)),s.val(f(this).val())}),c.on("click","[data-sek-unit]",function(e,t){e.preventDefault(),c.find("[data-sek-unit]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0),c.find("input[data-czrtype]").data("sek-unit",f(this).data("sek-unit")),a.css_unit(f(this).data("sek-unit"),t)}),c.on("click","[data-sek-radius-type]",function(e,t){e.preventDefault(),c.find("[data-sek-radius-type]").removeClass("is-selected").attr("aria-pressed",!1),f(this).addClass("is-selected").attr("aria-pressed",!0);var i="_all_";try{i=f(this).data("sek-radius-type")}catch(e){m.errare("border_radius input type => error when attaching click event",e)}a.radiusType(i,t)}),a.container.on("click",".sek-reset-button",function(e){var t=a.radiusType()||"_all_",i=f.extend(!0,{},g.isObject(a())?a():{});g.isEmpty(i[t])||(i=g.omit(i,t),a(i),r(t))}),s.val(l.val()||0);try{r(a.radiusType())}catch(e){m.errare("Error when firing syncWithRadiusType for input type border_radius for module type "+a.module.module_type,e)}f('[data-sek-unit="'+a.css_unit()+'"]',c).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(r,s,a){r.czrInputMap=r.czrInputMap||{},s.extend(r.czrInputMap,{buttons_choice:function(e){var n=this,o=s(".sek-button-choice-wrapper",n.container),t=o.find('input[type="number"]'),i=r.czr_sektions.getInputRegistrationParams(n.id,n.module.module_type);a.isEmpty(i)||a.isEmpty(i.default)||i.default;t.val(n()),o.on("click","[data-sek-choice]",function(e,t){var i;e.stopPropagation(),o.find("[data-sek-choice]").removeClass("is-selected").attr("aria-pressed",!1),s(this).addClass("is-selected").attr("aria-pressed",!0);try{i=s(this).data("sek-choice")}catch(e){r.errare("buttons_choice input type => error when attaching click event",e)}n(i)}),s('[data-sek-choice="'+n()+'"]',o).trigger("click",{initializing_the_unit:!0})}})}(wp.customize,jQuery,_),function(i,n,e){i.czrInputMap=i.czrInputMap||{},n.extend(i.czrInputMap,{reset_button:function(e){this.container.on("click","[data-sek-reset-scope]",function(e,t){if(e.stopPropagation(),"local"===n(this).data("sek-reset-scope"))try{i.czr_sektions.resetCollectionSetting()}catch(e){i.errare("reset_button => error when firing resetCollectionSetting() on click event",e)}})}})}(wp.customize,jQuery,_),function(o,r,s){o.czrModuleMap=o.czrModuleMap||{},r.extend(o.czrModuleMap,{sek_content_type_switcher_module:{crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("sek_content_type_switcher_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.extend({id:"",title:""},o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_content_type_switcher_module"))}}),o.czrInputMap=o.czrInputMap||{},r.extend(o.czrInputMap,{content_type_switcher:function(e){var i,n=this;if(!o.section.has(n.module.control.section()))throw new Error("api.czrInputMap.content_type_switcher => section not registered");i=o.section(n.module.control.section()),n.container.on("click","[data-sek-content-type]",function(e){e.preventDefault(),n.container.find("[data-sek-content-type]").removeClass("is-selected").attr("aria-pressed",!1),r(this).addClass("is-selected").attr("aria-pressed",!0),o.czr_sektions.currentContentPickerType(r(this).data("sek-content-type"))});var t=function(t){n.container.find('[data-sek-content-type="'+(t||"module")+'"]').trigger("click"),s.each(i.controls(),function(e){s.isUndefined(e.content_type)||e.active(t===e.content_type)})};o.czr_sektions.currentContentPickerType=o.czr_sektions.currentContentPickerType||new o.Value(n()),t(o.czr_sektions.currentContentPickerType()),o.czr_sektions.currentContentPickerType.bind(function(e){t(e)})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{},e.extend(t.czrModuleMap,{sek_module_picker_module:{crud:!1,name:t.czr_sektions.getRegisteredModuleProperty("sek_module_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_module_picker_module"))}}),t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{module_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"module",input_container:this.container})}})}(wp.customize,jQuery,_),function(t,e,i){t.czrModuleMap=t.czrModuleMap||{};var n=["sek_intro_sec_picker_module","sek_features_sec_picker_module","sek_contact_sec_picker_module","sek_column_layouts_sec_picker_module"];sektionsLocalizedData.isNimbleHeaderFooterEnabled&&(n=i.union(n,["sek_header_sec_picker_module","sek_footer_sec_picker_module"])),i.each(n,function(e){t.czrModuleMap[e]={crud:!1,name:t.czr_sektions.getRegisteredModuleProperty(e,"name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},t.czr_sektions.getDefaultItemModelFromRegisteredModuleData(e))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.inputConstructor=r.CZRInput.extend({initialize:function(e,t){var i=this;r.CZRInput.prototype.initialize.call(i,e,t),i.isReady.then(function(){i.renderUserSavedSections(),r.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:i.container})})},renderUserSavedSections:function(){var i="",n=this.container.find(".sek-content-type-wrapper"),o="";s.each(sektionsLocalizedData.userSavedSektions,function(e,t){try{o=function(e){var t=e.getDate(),i=e.getMonth(),n=e.getFullYear();e.getHours(),e.getMinutes(),e.getSeconds();return[t,["January","February","March","April","May","June","July","August","September","October","November","December"][i],n].join(" ")}(new Date(e.creation_date.replace(/-/g,"/")))}catch(e){r.errare("::renderUserSavedSections => formatDate => error",e)}i=['<div class="sek-user-section-wrapper">','<div class="sek-saved-section-title"><i class="sek-remove-user-section far fa-trash-alt"></i>'+e.title+"</div>",'<div draggable="true" data-sek-is-user-section="true" data-sek-section-type="'+e.type+'" data-sek-content-type="preset_section" data-sek-content-id="'+t+'" style="" title="'+e.title+'">','<div class="sek-overlay"></div>','<div class="sek-saved-section-description">'+e.description+"</div>",s.isEmpty(o)?"":'<div class="sek-saved-section-date"><i class="far fa-calendar-alt"></i> @missi18n Created : '+o+"</div>","</div>","</div>"].join(""),n.append(i)})}}),r.CZRDynModule.prototype.initialize.call(this,e,t)}};r.czrModuleMap=r.czrModuleMap||{},sektionsLocalizedData.isSavedSectionEnabled&&e.extend(r.czrModuleMap,{sek_my_sections_sec_picker_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_my_sections_sec_picker_module","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_my_sections_sec_picker_module")}})}(wp.customize,jQuery,_),function(t,e,i){t.czrInputMap=t.czrInputMap||{},e.extend(t.czrInputMap,{section_picker:function(e){t.czr_sektions.trigger("sek-refresh-dragzones",{type:"preset_section",input_container:this.container})}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_anchor_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_anchor_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_anchor_module"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){var i=this;i.inputConstructor=r.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=r.CZRItem.extend(i.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"bg-image":s.each(["bg-attachment","bg-scale","bg-repeat","bg-apply-overlay","bg-color-overlay","bg-opacity-overlay","bg-parallax","bg-parallax-force"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-color-overlay":case"bg-opacity-overlay":e=!s.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-apply-overlay")());break;case"bg-parallax-force":e=!s.isEmpty(i()+"")&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;case"bg-scale":case"bg-repeat":e=!s.isEmpty(i()+"")&&!r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")());break;default:e=!s.isEmpty(i()+"")}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-apply-overlay":s.each(["bg-color-overlay","bg-opacity-overlay"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return!s.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i())})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}});break;case"bg-parallax":s.each(["bg-parallax-force","bg-scale","bg-repeat"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"bg-parallax-force":e=!s.isEmpty(n.czr_Input("bg-image")()+"")&&r.CZR_Helpers.isChecked(i());break;case"bg-repeat":case"bg-scale":e=!s.isEmpty(n.czr_Input("bg-image")()+"")&&!r.CZR_Helpers.isChecked(i())}return e})}catch(e){r.errare(o.id+" => error in setInputVisibilityDeps",e)}}),i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-attachment")())&&n.czr_Input("bg-attachment").container.find("input[type=checkbox]").trigger("click")});break;case"bg-attachment":i.bind(function(e){r.CZR_Helpers.isChecked(i())&&r.CZR_Helpers.isChecked(n.czr_Input("bg-parallax")())&&n.czr_Input("bg-parallax").container.find("input[type=checkbox]").trigger("click")})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_level_bg_module:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_level_bg_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_bg_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_border_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_border_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_border_module"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_level_breakpoint_module:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_level_breakpoint_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_breakpoint_module"))}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"height-type":o.each(["custom-height","overflow_hidden"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"custom"===t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_height_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_height_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_height_module"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_visibility_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_visibility_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_visibility_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"width-type":n.czr_sektions.scheduleVisibilityOfInputId.call(e,"custom-width",function(){return"custom"===e()}),n.czr_sektions.scheduleVisibilityOfInputId.call(e,"h_alignment",function(){return"custom"===e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_module:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_module"))}})}(wp.customize,jQuery,_),function(n,e,i){var t={initialize:function(e,t){var i=this;i.inputConstructor=n.CZRInput.extend(i.CZRInputMths||{}),i.itemConstructor=n.CZRItem.extend(i.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(i,e,t)},CZRInputMths:{setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!i.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":n.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":n.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{sek_level_width_section:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("sek_level_width_section","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_width_section"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_level_spacing_module:{mthds:"",crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_level_spacing_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_level_spacing_module"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_template:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_template","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_template"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_custom_css:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_custom_css","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_custom_css"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_local_reset:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_local_reset","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_reset"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_performances:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_performances"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_local_header_footer:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_local_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_local_header_footer"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-breakpoint":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"global-custom-breakpoint",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_breakpoint:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_breakpoint","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_breakpoint"))}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(e){switch(e.id){case"use-custom-outer-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"outer-section-width",function(){return e()});break;case"use-custom-inner-width":i.czr_sektions.scheduleVisibilityOfInputId.call(e,"inner-section-width",function(){return e()})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_widths:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_widths","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:n.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_widths"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_performances:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_performances","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_performances"))}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{sek_global_header_footer:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("sek_global_header_footer","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:t.extend({id:"",title:""},i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_header_footer"))}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){this.itemConstructor=r.CZRItem.extend(this.CZRItemConstructor||{}),r.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"enable":s.each(["public_key","private_key","badge","show_failure_message","failure_message","score"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"failure_message":e=i()&&n.czr_Input("show_failure_message")();break;default:e=i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_failure_message":s.each(["failure_message"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()&&n.czr_Input("enable")()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{sek_global_recaptcha:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("sek_global_recaptcha","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:s.extend({id:"",title:""},r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_recaptcha"))}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{sek_global_beta_features:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("sek_global_beta_features","name"),has_mod_opt:!1,ready_on_section_expanded:!0,defaultItemModel:i.extend({id:"",title:""},e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("sek_global_beta_features"))}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,t=n.module;n.czr_Input.each(function(i){switch(i.id){case"img":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"img-size",function(){return!r.isEmpty(i()+"")&&r.isNumber(i())});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"===i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":e="url"===i();break;case"link-target":e=!r.contains(["no-link","img-lightbox"],i())}return e})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"border-type":r.each(["borders"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"none"!==i()})}catch(e){o.errare(t.id+" => error in setInputVisibilityDeps",e)}});break;case"use_custom_width":r.each(["custom_width"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}});break;case"use_custom_title_attr":r.each(["heading_title"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Image module => error in setInputVisibilityDeps",e)}})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_image_main_settings_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_image_main_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_main_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_image_borders_corners_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_image_borders_corners_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_image_borders_corners_child")}})}(wp.customize,jQuery,_),function(n,e,t){var i={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend(this.CZRTextEditorInputMths||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRTextEditorInputMths:{initialize:function(e,t){var i=this;"tiny_mce_editor"==i.type&&i.isReady.then(function(){i.container.find('[data-czr-action="open-tinymce-editor"]').trigger("click")}),n.CZRInput.prototype.initialize.call(i,e,t)},setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_tinymce_child:{mthds:i,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_tinymce_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_tinymce_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_simple_html_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_simple_html_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_html_module")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRFPItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRFPItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(i){switch(i.id){case"img-type":o.each(["img-id","img-size"],function(t){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"img-id":e="custom"===i();break;default:e="none"!==i()}return e})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"content-type":o.each(["content-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return"custom"===i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}});break;case"btn-display":o.each(["btn-custom-text"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){n.errare("Featured pages module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_featured_pages_module:{mthds:t,crud:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","is_crud"),hasPreItem:!1,refresh_on_add_item:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_featured_pages_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_featured_pages_module")}})}(wp.customize,jQuery,_),function(r,e,s){var t={initialize:function(e,t){var i=this;i.inputConstructor=r.CZRInput.extend({setupSelect:function(){r.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=r.CZRItem.extend(i.CZRIconItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),r.CZRDynModule.prototype.initialize.call(i,e,t)},CZRIconItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!s.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){r.errorLog("item.setInputVisibilityDeps() : "+e)}}),r.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this,o=n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":s.each(["link-pick-url","link-custom-url","link-target"],function(t){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":r.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"use_custom_color_on_hover":s.each(["color_hover"],function(e){try{r.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){r.errare(o.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};r.czrModuleMap=r.czrModuleMap||{},e.extend(r.czrModuleMap,{czr_icon_settings_child:{mthds:t,crud:!1,name:r.czr_sektions.getRegisteredModuleProperty("czr_icon_settings_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:r.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_settings_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_icon_spacing_border_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_icon_spacing_border_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_icon_spacing_border_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend(i.CZRHeadingInputMths||{}),i.itemConstructor=o.CZRItem.extend(i.CZRItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(i,e,t),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e})},CZRHeadingInputMths:{setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e=i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;case"link-pick-url":case"link-target":e=i()}return e})}catch(e){o.errare("Heading module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&!0===n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_heading_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_heading_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRHeadingInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRHeadingInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_heading_spacing_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_heading_spacing_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_heading_spacing_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend(this.CZRDividerInputMths||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRDividerInputMths:{setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_divider_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_divider_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_divider_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_spacer_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_spacer_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_spacer_module")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_map_module:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_map_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_map_module")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRButtonItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"quote_design":n.each(["border_width_css","border_color_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"border-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}}),n.each(["icon_color_css","icon_size_css"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"quote-icon-before"==t()})}catch(e){i.errare("Quote module => error in setInputVisibilityDeps",e)}})}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_design_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_design_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_quote_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_quote_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_quote_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_quote_cite_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_quote_cite_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_quote_cite_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){var i=this;i.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),i.itemConstructor=o.CZRItem.extend(i.CZRButtonItemConstructor||{}),i.bind("set_default_content_picker_options",function(e){return e.defaultContentPickerOption.defaultOption={title:'<span style="font-weight:bold">'+sektionsLocalizedData.i18n["Set a custom url"]+"</span>",type:"",type_label:"",object:"",id:"_custom_",url:""},e}),o.CZRDynModule.prototype.initialize.call(i,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()});break;case"icon":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"icon-side",function(){return!r.isEmpty(i())})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_btn_content_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_btn_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_content_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRButtonItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var e=this,i=e.module;e.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare("Button module => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_btn_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_btn_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_btn_design_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_menu_content_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_menu_content_child","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_content_child")}})}(wp.customize,jQuery,_),function(e,t,i){e.czrModuleMap=e.czrModuleMap||{},t.extend(e.czrModuleMap,{czr_menu_mobile_options:{crud:!1,name:e.czr_sektions.getRegisteredModuleProperty("czr_menu_mobile_options","name"),has_mod_opt:!1,ready_on_section_expanded:!0,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:e.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_menu_mobile_options")}})}(wp.customize,jQuery,_),function(i,e,n){var t={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=i.CZRItem.extend(this.CZRItemConstructor||{}),i.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!n.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){i.errorLog("item.setInputVisibilityDeps() : "+e)}}),i.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){this.module;this.czr_Input.each(function(t){switch(t.id){case"show_name_field":n.each(["name_field_label","name_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_subject_field":n.each(["subject_field_label","subject_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"show_message_field":n.each(["message_field_label","message_field_required"],function(e){try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":try{i.czr_sektions.scheduleVisibilityOfInputId.call(t,"link-custom-url",function(){return t()})}catch(e){i.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}}})}}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fields_child:{mthds:t,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fields_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fields_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_design_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_design_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_design_child")}})}(wp.customize,jQuery,_),function(n,e,o){var t={initialize:function(e,t){this.inputConstructor=n.CZRInput.extend({setupSelect:function(){n.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=n.CZRItem.extend(this.CZRItemConstructor||{}),n.CZRDynModule.prototype.initialize.call(this,e,t)},CZRItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!o.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){n.errorLog("item.setInputVisibilityDeps() : "+e)}}),n.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var i=this.module;this.czr_Input.each(function(t){switch(t.id){case"use_custom_bg_color_on_hover":o.each(["bg_color_hover"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}});break;case"border-type":o.each(["borders"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return"none"!==t()})}catch(e){n.errare(i.id+" => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":o.each(["push_effect"],function(e){try{n.czr_sektions.scheduleVisibilityOfInputId.call(t,e,function(){return t()})}catch(e){n.errare(t.module.module_type+" => error in setInputVisibilityDeps",e)}})}})}}};n.czrModuleMap=n.czrModuleMap||{},e.extend(n.czrModuleMap,{czr_simple_form_button_child:{mthds:t,crud:!1,name:n.czr_sektions.getRegisteredModuleProperty("czr_simple_form_button_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:n.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_button_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_fonts_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_fonts_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_fonts_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_simple_form_submission_child:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_simple_form_submission_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_simple_form_submission_child")}})}(wp.customize,jQuery,_),function(o,e,r){var t={initialize:function(e,t){this.inputConstructor=o.CZRInput.extend({setupSelect:function(){o.czr_sektions.setupSelectInput.call(this)}}),this.itemConstructor=o.CZRItem.extend(this.CZRButtonItemConstructor||{}),o.CZRDynModule.prototype.initialize.call(this,e,t)},CZRButtonItemConstructor:{ready:function(){var t=this;t.inputCollection.bind(function(e){if(!r.isEmpty(e))try{t.setInputVisibilityDeps()}catch(e){o.errorLog("item.setInputVisibilityDeps() : "+e)}}),o.CZRItem.prototype.ready.call(t)},setInputVisibilityDeps:function(){var n=this;n.module;n.czr_Input.each(function(i){switch(i.id){case"use_custom_bg_color_on_hover":r.each(["bg_color_hover"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"use_box_shadow":r.each(["push_effect"],function(e){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,e,function(){return i()})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-to":r.each(["link-pick-url","link-custom-url","link-target"],function(t){try{o.czr_sektions.scheduleVisibilityOfInputId.call(i,t,function(){var e=!1;switch(t){case"link-custom-url":e="url"==i()&&"_custom_"==n.czr_Input("link-pick-url")().id;break;default:e="url"==i()}return e})}catch(e){o.errare("Button module => error in setInputVisibilityDeps",e)}});break;case"link-pick-url":o.czr_sektions.scheduleVisibilityOfInputId.call(i,"link-custom-url",function(){return"_custom_"==i().id&&"url"==n.czr_Input("link-to")()})}})}}};o.czrModuleMap=o.czrModuleMap||{},e.extend(o.czrModuleMap,{czr_font_child:{mthds:t,crud:!1,name:o.czr_sektions.getRegisteredModuleProperty("czr_font_child","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:o.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_font_child")}})}(wp.customize,jQuery,_),function(i,e,t){var n={initialize:function(e,t){this.inputConstructor=i.CZRInput.extend({setupSelect:function(){i.czr_sektions.setupSelectInput.call(this,sektionsLocalizedData.registeredWidgetZones)}}),i.CZRDynModule.prototype.initialize.call(this,e,t)}};i.czrModuleMap=i.czrModuleMap||{},e.extend(i.czrModuleMap,{czr_widget_area_module:{mthds:n,crud:!1,name:i.czr_sektions.getRegisteredModuleProperty("czr_widget_area_module","name"),has_mod_opt:!1,ready_on_section_expanded:!1,ready_on_control_event:"sek-accordion-expanded",defaultItemModel:i.czr_sektions.getDefaultItemModelFromRegisteredModuleData("czr_widget_area_module")}})}(wp.customize,jQuery,_);
assets/czr/sek/js/ccat-sek-preview.js CHANGED
@@ -1,15 +1,23 @@
1
-
2
  var SekPreviewPrototype = SekPreviewPrototype || {};
3
  ( function( api, $, _ ) {
4
  $.extend( SekPreviewPrototype, {
5
  initialize: function() {
6
  var self = this;
 
 
7
  try { this.skope_id = _.findWhere( _wpCustomizeSettings.czr_new_skopes, { skope : 'local' }).skope_id; } catch( _er_ ) {
8
  this.errare('Preview => error when storing the skope_id', _er_ );
9
  return;
10
  }
 
 
11
  this.scheduleHighlightActiveLevel();
 
 
12
  self.setupLoader();
 
 
13
  $( function() {
14
  self.setupSortable();
15
  self.setupResizable();
@@ -18,12 +26,19 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
18
 
19
  self.schedulePanelMsgReactions();
20
  });
 
 
 
 
 
21
  $('body').on('sek-columns-refreshed sek-modules-refreshed', function( evt, params ) {
22
  if ( !_.isUndefined( params ) && !_.isUndefined( params.in_sektion ) && $('[data-sek-id="' + params.in_sektion +'"]').length > 0 ) {
23
  var $updatedSektion = $('[data-sek-id="' + params.in_sektion +'"]');
24
  $updatedSektion.toggleClass( 'sek-has-modules', $updatedSektion.find('[data-sek-level="module"]').length > 0 );
25
  }
26
  });
 
 
27
  self.deactivateLinks();
28
 
29
  $('body').on([
@@ -35,13 +50,36 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
35
  ].join(' '), function( evt ) {
36
  self.deactivateLinks(evt);
37
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  },
 
 
 
39
  deactivateLinks : function( evt ) {
40
  evt = evt || {};
41
  var _doSafe_ = function() {
42
  if ( "yes" === $(this).data('sek-unlinked') )
43
  return;
 
 
 
 
44
  var isJavascriptProtocol = _.isString( $(this)[0].protocol ) && -1 !== $(this)[0].protocol.indexOf('javascript');
 
45
  if ( ! isJavascriptProtocol && api.isLinkPreviewable( $(this)[0] ) ) {
46
  $(this).addClass('nimble-shift-clickable');
47
  $(this).data('sek-unlinked', "yes").attr('data-nimble-href', $(this).attr('href') ).attr('href', 'javascript:void(0)');
@@ -76,8 +114,14 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
76
  });
77
  });
78
  },
 
 
 
 
 
79
  scheduleHighlightActiveLevel : function() {
80
  var self = this;
 
81
  this.activeLevelUI = new api.Value('');
82
  this.activeUIChangedRecently = new api.Value( false );
83
 
@@ -92,13 +136,25 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
92
  }
93
  self.activeUIChangedRecently( Date.now() );
94
  });
 
 
 
 
 
 
 
95
  _.each( [ 'sek-refresh-stylesheet', 'sek-refresh-level' ], function( msgId ) {
96
  api.preview.bind( msgId, function( params ) {
97
  self.activeUIChangedRecently( Date.now() );
98
  });
99
  });
 
 
 
 
100
  this.activeUIChangedRecently.bind( function( hasChangedRecently ) {
101
  var $newActiveLevel = $('[data-sek-id="' + self.activeLevelUI() +'"]');
 
102
  if ( $('.sek-highlight-active-ui').length ) {
103
  $('.sek-highlight-active-ui').removeClass('sek-highlight-active-ui');
104
  }
@@ -117,38 +173,57 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
117
  var SekPreviewPrototype = SekPreviewPrototype || {};
118
  ( function( api, $, _ ) {
119
  $.extend( SekPreviewPrototype, {
 
120
  setupSortable: function() {
121
  var self = this;
122
  this.sortableDefaultParams = {
 
 
123
  placeholder: "sortable-placeholder",
124
  over: function( event, ui ) {},
125
  cursorAt: { top:0, left: 0 },//@fixes https://github.com/presscustomizr/nimble-builder/issues/114
126
  tolerance: "pointer",//@fixes https://github.com/presscustomizr/nimble-builder/issues/114
127
  };
 
 
 
128
  $('[data-sek-level="location"]').each( function() {
129
  self.makeSektionsSortableInLocation( $(this).data('sek-id') );
130
  });
 
 
131
  $( 'body').on( 'sek-section-added sek-level-refreshed', '[data-sek-level="location"]', function( evt, params ) {
132
  self.makeSektionsSortableInLocation( $(this).data('sek-id') );
133
  });
 
 
 
 
134
  $('[data-sek-level="location"]').each( function() {
135
  $(this).find( '[data-sek-level="section"]' ).each( function() {
136
  self.makeColumnsSortableInSektion( $(this).data('sek-id') );
137
  });
138
  });
 
139
  $('body').on( 'sek-columns-refreshed sek-section-added', '[data-sek-level="section"]', function( evt ) {
140
  self.makeColumnsSortableInSektion( $(this).data('sek-id') );
141
  });
 
142
  $( 'body').on( 'sek-level-refreshed', '[data-sek-level="location"]', function( evt, params ) {
143
  $(this).find( '[data-sek-level="section"]' ).each( function() {
144
  self.makeColumnsSortableInSektion( $(this).data('sek-id') );
145
  });
146
  });
 
 
 
 
147
  $('[data-sek-level="location"]').each( function() {
148
  $(this).find( '[data-sek-level="column"]' ).each( function() {
149
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
150
  });
151
  });
 
152
  $('body').on( 'sek-modules-refreshed', '[data-sek-level="column"]', function() {
153
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
154
  });
@@ -157,6 +232,7 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
157
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
158
  });
159
  });
 
160
  $( 'body').on( 'sek-level-refreshed', '[data-sek-level="location"]', function( evt, params ) {
161
  $(this).find( '[data-sek-level="column"]' ).each( function() {
162
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
@@ -168,6 +244,43 @@ var SekPreviewPrototype = SekPreviewPrototype || {};
168
  });
169
  });
170
 
 
1
+ //global sekPreviewLocalized
2
  var SekPreviewPrototype = SekPreviewPrototype || {};
3
  ( function( api, $, _ ) {
4
  $.extend( SekPreviewPrototype, {
5
  initialize: function() {
6
  var self = this;
7
+
8
+ // Set the skope_id
9
  try { this.skope_id = _.findWhere( _wpCustomizeSettings.czr_new_skopes, { skope : 'local' }).skope_id; } catch( _er_ ) {
10
  this.errare('Preview => error when storing the skope_id', _er_ );
11
  return;
12
  }
13
+
14
+ // Active UI
15
  this.scheduleHighlightActiveLevel();
16
+
17
+ // The loading icon when a level is refreshed
18
  self.setupLoader();
19
+
20
+ // DOM READY
21
  $( function() {
22
  self.setupSortable();
23
  self.setupResizable();
26
 
27
  self.schedulePanelMsgReactions();
28
  });
29
+
30
+ // Make sure we don't force a minimum height to empty columns when a section has at least one module
31
+ // => allow a better previewing experience and more realistic spacing adjustments
32
+ // The css class .sek-has-modules is also printed server side
33
+ // @see php SEK_Front_Render::render()
34
  $('body').on('sek-columns-refreshed sek-modules-refreshed', function( evt, params ) {
35
  if ( !_.isUndefined( params ) && !_.isUndefined( params.in_sektion ) && $('[data-sek-id="' + params.in_sektion +'"]').length > 0 ) {
36
  var $updatedSektion = $('[data-sek-id="' + params.in_sektion +'"]');
37
  $updatedSektion.toggleClass( 'sek-has-modules', $updatedSektion.find('[data-sek-level="module"]').length > 0 );
38
  }
39
  });
40
+
41
+ // Deactivates the links
42
  self.deactivateLinks();
43
 
44
  $('body').on([
50
  ].join(' '), function( evt ) {
51
  self.deactivateLinks(evt);
52
  });
53
+
54
+
55
+ // Send the contextually active locations
56
+ // 1) on init
57
+ // 2) and when requested by the control panel
58
+ // introduced for the level tree, https://github.com/presscustomizr/nimble-builder/issues/359
59
+ var sendActiveLocations = function() {
60
+ var active_locs = [];
61
+ $('[data-sek-level="location"]').each( function() {
62
+ active_locs.push( $(this).data('sek-id') );
63
+ });
64
+ api.preview.send('sek-active-locations-in-preview', { active_locations : active_locs } );
65
+ };
66
+ api.preview.bind('sek-request-active-locations', sendActiveLocations );
67
+ sendActiveLocations();
68
  },
69
+
70
+ // Fired on initialize()
71
+ // and on user generated events
72
  deactivateLinks : function( evt ) {
73
  evt = evt || {};
74
  var _doSafe_ = function() {
75
  if ( "yes" === $(this).data('sek-unlinked') )
76
  return;
77
+ // Several cases :
78
+ // 1- internal link ( <=> api.isLinkPreviewable(... ) = true ) : we allow navigation with shift + click
79
+ // 2- extenal link => navigation is disabled.
80
+ // 3- server disabled links, with href attribute set to "javascript:void(0)", this case is checked isJavascriptProtocol
81
  var isJavascriptProtocol = _.isString( $(this)[0].protocol ) && -1 !== $(this)[0].protocol.indexOf('javascript');
82
+ // the check on isJavascriptProtocol fixes issue https://github.com/presscustomizr/nimble-builder/issues/255
83
  if ( ! isJavascriptProtocol && api.isLinkPreviewable( $(this)[0] ) ) {
84
  $(this).addClass('nimble-shift-clickable');
85
  $(this).data('sek-unlinked', "yes").attr('data-nimble-href', $(this).attr('href') ).attr('href', 'javascript:void(0)');
114
  });
115
  });
116
  },
117
+
118
+ // Hightlight the currently level in the preview, corresponding to the active ui in the panel
119
+ //
120
+ // When a new ui is generated, the activeLevelUI is set @see ::schedulePanelMsgReactions()
121
+ // When the level options are modidied ( 'sek-refresh-stylesheet', 'sek-refresh-level' ),
122
  scheduleHighlightActiveLevel : function() {
123
  var self = this;
124
+ // Stores the currently edited level
125
  this.activeLevelUI = new api.Value('');
126
  this.activeUIChangedRecently = new api.Value( false );
127
 
136
  }
137
  self.activeUIChangedRecently( Date.now() );
138
  });
139
+
140
+ // apiParams : {
141
+ // action : 'sek-refresh-level',
142
+ // id : params.uiParams.id,
143
+ // level : params.uiParams.level
144
+ // },
145
+ // skope_id : api.czr_skopeBase.getSkopeProperty( 'skope_id' ),
146
  _.each( [ 'sek-refresh-stylesheet', 'sek-refresh-level' ], function( msgId ) {
147
  api.preview.bind( msgId, function( params ) {
148
  self.activeUIChangedRecently( Date.now() );
149
  });
150
  });
151
+
152
+
153
+ // This api.Value() is updated with Date.now() when something just happened and false after 3000 ms of inactivity
154
+ // so we can always react to changes, and refresh the timeOut
155
  this.activeUIChangedRecently.bind( function( hasChangedRecently ) {
156
  var $newActiveLevel = $('[data-sek-id="' + self.activeLevelUI() +'"]');
157
+ // remove the highlight class if it was previously set to another level
158
  if ( $('.sek-highlight-active-ui').length ) {
159
  $('.sek-highlight-active-ui').removeClass('sek-highlight-active-ui');
160
  }
173
  var SekPreviewPrototype = SekPreviewPrototype || {};
174
  ( function( api, $, _ ) {
175
  $.extend( SekPreviewPrototype, {
176
+ // Fired on Dom Ready, in ::initialize()
177
  setupSortable: function() {
178
  var self = this;
179
  this.sortableDefaultParams = {
180
+ //forcePlaceholderSize: true,
181
+ //handle: '.fa-arrows-alt',<= set by level
182
  placeholder: "sortable-placeholder",
183
  over: function( event, ui ) {},
184
  cursorAt: { top:0, left: 0 },//@fixes https://github.com/presscustomizr/nimble-builder/issues/114
185
  tolerance: "pointer",//@fixes https://github.com/presscustomizr/nimble-builder/issues/114
186
  };
187
+
188
+ // SEKTIONS
189
+ // On dom ready
190
  $('[data-sek-level="location"]').each( function() {
191
  self.makeSektionsSortableInLocation( $(this).data('sek-id') );
192
  });
193
+
194
+ // Schedule with delegation
195
  $( 'body').on( 'sek-section-added sek-level-refreshed', '[data-sek-level="location"]', function( evt, params ) {
196
  self.makeSektionsSortableInLocation( $(this).data('sek-id') );
197
  });
198
+
199
+
200
+ // COLUMNS
201
+ // On dom ready
202
  $('[data-sek-level="location"]').each( function() {
203
  $(this).find( '[data-sek-level="section"]' ).each( function() {
204
  self.makeColumnsSortableInSektion( $(this).data('sek-id') );
205
  });
206
  });
207
+ // Schedule with delegation
208
  $('body').on( 'sek-columns-refreshed sek-section-added', '[data-sek-level="section"]', function( evt ) {
209
  self.makeColumnsSortableInSektion( $(this).data('sek-id') );
210
  });
211
+ // this case occurs when moving a section from one location to another for example
212
  $( 'body').on( 'sek-level-refreshed', '[data-sek-level="location"]', function( evt, params ) {
213
  $(this).find( '[data-sek-level="section"]' ).each( function() {
214
  self.makeColumnsSortableInSektion( $(this).data('sek-id') );
215
  });
216
  });
217
+
218
+
219
+ // MODULES
220
+ // On dom ready
221
  $('[data-sek-level="location"]').each( function() {
222
  $(this).find( '[data-sek-level="column"]' ).each( function() {
223
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
224
  });
225
  });
226
+ // Schedule with delegation
227
  $('body').on( 'sek-modules-refreshed', '[data-sek-level="column"]', function() {
228
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
229
  });
232
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
233
  });
234
  });
235
+ // this case occurs when moving a section from one location to another for example
236
  $( 'body').on( 'sek-level-refreshed', '[data-sek-level="location"]', function( evt, params ) {
237
  $(this).find( '[data-sek-level="column"]' ).each( function() {
238
  self.makeModulesSortableInColumn( $(this).data('sek-id') );
244
  });
245
  });
246
 
247
+ /