Ultimate Member – User Profile & Membership Plugin - Version 1.3.47

Version Description

Download this release

Release Info

Developer champsupertramp
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 1.3.47
Comparing to
See all releases

Code changes from version 1.3.44 to 1.3.47

admin/assets/js/um-admin-scripts.js CHANGED
@@ -85,10 +85,12 @@ jQuery(document).ready(function() {
85
  Tooltips
86
  **/
87
 
88
- jQuery('.um-admin-tipsy-n,#redux-share a').tipsy({gravity: 'n', opacity: 1, live: 'a.live' });
89
- jQuery('.um-admin-tipsy-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live' });
90
- jQuery('.um-admin-tipsy-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live' });
91
- jQuery('.um-admin-tipsy-s').tipsy({gravity: 's', opacity: 1, live: 'a.live' });
 
 
92
 
93
  /**
94
  Conditional fields
85
  Tooltips
86
  **/
87
 
88
+ if( typeof tipsy !== 'undefined' ){
89
+ jQuery('.um-admin-tipsy-n,#redux-share a').tipsy({gravity: 'n', opacity: 1, live: 'a.live' });
90
+ jQuery('.um-admin-tipsy-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live' });
91
+ jQuery('.um-admin-tipsy-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live' });
92
+ jQuery('.um-admin-tipsy-s').tipsy({gravity: 's', opacity: 1, live: 'a.live' });
93
+ }
94
 
95
  /**
96
  Conditional fields
admin/core/um-admin-dragdrop.php CHANGED
@@ -26,13 +26,15 @@ class UM_Admin_DragDrop {
26
 
27
  $this->row_data = get_option('um_form_rowdata_'. $form_id );
28
 
29
- foreach( $fields as $key => $array ) {
30
- if ( $array['type'] == 'row' ) {
31
- $this->row_data[$key] = $array;
32
- unset( $fields[$key] );
 
 
33
  }
34
  }
35
-
36
  foreach( $_POST as $key => $value ) {
37
 
38
  // adding rows
26
 
27
  $this->row_data = get_option('um_form_rowdata_'. $form_id );
28
 
29
+ if( isset( $fields ) ){
30
+ foreach( $fields as $key => $array ) {
31
+ if ( $array['type'] == 'row' ) {
32
+ $this->row_data[$key] = $array;
33
+ unset( $fields[$key] );
34
+ }
35
  }
36
  }
37
+
38
  foreach( $_POST as $key => $value ) {
39
 
40
  // adding rows
admin/templates/directory/general.php CHANGED
@@ -6,55 +6,55 @@
6
  //print "'$k' => '" . $v[0] . "',<br />";
7
  }
8
  }
9
-
10
  $show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
11
  if ( $show_these_users ) {
12
  $show_these_users = implode("\n", str_replace("\r", "", $show_these_users));
13
  }
14
-
15
  ?>
16
 
17
  <div class="um-admin-metabox">
18
 
19
  <div class="">
20
-
21
  <input type="hidden" name="_um_mode" id="_um_mode" value="directory" />
22
-
23
  <p>
24
  <label class="um-admin-half"><?php _e('User Roles to Display','ultimatemember'); ?> <?php $this->tooltip('If you do not want to show all members, select only user roles to appear in this directory'); ?></label>
25
  <span class="um-admin-half">
26
-
27
  <select multiple="multiple" name="_um_roles[]" id="_um_roles" class="umaf-selectjs" style="width: 300px">
28
  <?php foreach($ultimatemember->query->get_roles() as $key => $value) { ?>
29
  <option value="<?php echo $key; ?>" <?php selected($key, $ultimatemember->query->get_meta_value('_um_roles', $key ) ); ?>><?php echo $value; ?></option>
30
- <?php } ?>
31
  </select>
32
-
33
  </span>
34
  </p><div class="um-admin-clear"></div>
35
-
36
  <p>
37
  <label class="um-admin-half"><?php _e('Only show members who have uploaded a profile photo','ultimatemember'); ?><?php $this->tooltip('If \'Use Gravatars\' as profile photo is enabled, this option is ignored'); ?></label>
38
  <span class="um-admin-half">
39
-
40
  <?php $this->ui_on_off('_um_has_profile_photo'); ?>
41
-
42
  </span>
43
  </p><div class="um-admin-clear"></div>
44
 
45
  <p>
46
  <label class="um-admin-half"><?php _e('Only show members who have uploaded a cover photo','ultimatemember'); ?></label>
47
  <span class="um-admin-half">
48
-
49
  <?php $this->ui_on_off('_um_has_cover_photo'); ?>
50
-
51
  </span>
52
  </p><div class="um-admin-clear"></div>
53
-
54
  <p>
55
  <label class="um-admin-half"><?php _e('Sort users by','ultimatemember'); ?> <?php $this->tooltip('Sort users by a specific parameter in the directory'); ?></label>
56
  <span class="um-admin-half">
57
-
58
  <select name="_um_sortby" id="_um_sortby" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
59
  <option value="user_registered_desc" <?php selected('user_registered_desc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('New users first','ultimatemember'); ?></option>
60
  <option value="user_registered_asc" <?php selected('user_registered_asc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Old users first','ultimatemember'); ?></option>
@@ -62,35 +62,36 @@
62
  <option value="display_name" <?php selected('display_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Display Name','ultimatemember'); ?></option>
63
  <option value="first_name" <?php selected('first_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('First Name','ultimatemember'); ?></option>
64
  <option value="last_name" <?php selected('last_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Last Name','ultimatemember'); ?></option>
 
65
  <option value="other" <?php selected('other', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Other (custom field)','ultimatemember'); ?></option>
66
  <?php do_action('um_admin_directory_sort_users_select', '_um_sortby'); ?>
67
  </select>
68
-
69
  </span>
70
  </p><div class="um-admin-clear"></div>
71
-
72
  <p class="custom-field">
73
  <label class="um-admin-half"><?php _e('Meta key','ultimatemember'); ?> <?php $this->tooltip('To sort by a custom field, enter the meta key of field here'); ?></label>
74
  <span class="um-admin-half">
75
-
76
  <input type="text" name="_um_sortby_custom" id="_um_sortby_custom" value="<?php echo $ultimatemember->query->get_meta_value('_um_sortby_custom', null, 'na' ); ?>" />
77
-
78
  </span>
79
  </p><div class="um-admin-clear"></div>
80
-
81
  <p>
82
  <label class="um-admin-half"><?php _e('Only show specific users (Enter one username per line)','ultimatemember'); ?></label>
83
  <span class="um-admin-half">
84
-
85
  <textarea name="_um_show_these_users" id="_um_show_these_users"><?php echo $show_these_users; ?></textarea>
86
-
87
  </span>
88
  </p><div class="um-admin-clear"></div>
89
-
90
  <?php do_action('um_admin_extend_directory_options_general', $this); ?>
91
-
92
  </div>
93
-
94
  <div class="um-admin-clear"></div>
95
-
96
- </div>
6
  //print "'$k' => '" . $v[0] . "',<br />";
7
  }
8
  }
9
+
10
  $show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
11
  if ( $show_these_users ) {
12
  $show_these_users = implode("\n", str_replace("\r", "", $show_these_users));
13
  }
14
+
15
  ?>
16
 
17
  <div class="um-admin-metabox">
18
 
19
  <div class="">
20
+
21
  <input type="hidden" name="_um_mode" id="_um_mode" value="directory" />
22
+
23
  <p>
24
  <label class="um-admin-half"><?php _e('User Roles to Display','ultimatemember'); ?> <?php $this->tooltip('If you do not want to show all members, select only user roles to appear in this directory'); ?></label>
25
  <span class="um-admin-half">
26
+
27
  <select multiple="multiple" name="_um_roles[]" id="_um_roles" class="umaf-selectjs" style="width: 300px">
28
  <?php foreach($ultimatemember->query->get_roles() as $key => $value) { ?>
29
  <option value="<?php echo $key; ?>" <?php selected($key, $ultimatemember->query->get_meta_value('_um_roles', $key ) ); ?>><?php echo $value; ?></option>
30
+ <?php } ?>
31
  </select>
32
+
33
  </span>
34
  </p><div class="um-admin-clear"></div>
35
+
36
  <p>
37
  <label class="um-admin-half"><?php _e('Only show members who have uploaded a profile photo','ultimatemember'); ?><?php $this->tooltip('If \'Use Gravatars\' as profile photo is enabled, this option is ignored'); ?></label>
38
  <span class="um-admin-half">
39
+
40
  <?php $this->ui_on_off('_um_has_profile_photo'); ?>
41
+
42
  </span>
43
  </p><div class="um-admin-clear"></div>
44
 
45
  <p>
46
  <label class="um-admin-half"><?php _e('Only show members who have uploaded a cover photo','ultimatemember'); ?></label>
47
  <span class="um-admin-half">
48
+
49
  <?php $this->ui_on_off('_um_has_cover_photo'); ?>
50
+
51
  </span>
52
  </p><div class="um-admin-clear"></div>
53
+
54
  <p>
55
  <label class="um-admin-half"><?php _e('Sort users by','ultimatemember'); ?> <?php $this->tooltip('Sort users by a specific parameter in the directory'); ?></label>
56
  <span class="um-admin-half">
57
+
58
  <select name="_um_sortby" id="_um_sortby" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
59
  <option value="user_registered_desc" <?php selected('user_registered_desc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('New users first','ultimatemember'); ?></option>
60
  <option value="user_registered_asc" <?php selected('user_registered_asc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Old users first','ultimatemember'); ?></option>
62
  <option value="display_name" <?php selected('display_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Display Name','ultimatemember'); ?></option>
63
  <option value="first_name" <?php selected('first_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('First Name','ultimatemember'); ?></option>
64
  <option value="last_name" <?php selected('last_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Last Name','ultimatemember'); ?></option>
65
+ <option value="random" <?php selected('random', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Random','ultimatemember'); ?></option>
66
  <option value="other" <?php selected('other', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Other (custom field)','ultimatemember'); ?></option>
67
  <?php do_action('um_admin_directory_sort_users_select', '_um_sortby'); ?>
68
  </select>
69
+
70
  </span>
71
  </p><div class="um-admin-clear"></div>
72
+
73
  <p class="custom-field">
74
  <label class="um-admin-half"><?php _e('Meta key','ultimatemember'); ?> <?php $this->tooltip('To sort by a custom field, enter the meta key of field here'); ?></label>
75
  <span class="um-admin-half">
76
+
77
  <input type="text" name="_um_sortby_custom" id="_um_sortby_custom" value="<?php echo $ultimatemember->query->get_meta_value('_um_sortby_custom', null, 'na' ); ?>" />
78
+
79
  </span>
80
  </p><div class="um-admin-clear"></div>
81
+
82
  <p>
83
  <label class="um-admin-half"><?php _e('Only show specific users (Enter one username per line)','ultimatemember'); ?></label>
84
  <span class="um-admin-half">
85
+
86
  <textarea name="_um_show_these_users" id="_um_show_these_users"><?php echo $show_these_users; ?></textarea>
87
+
88
  </span>
89
  </p><div class="um-admin-clear"></div>
90
+
91
  <?php do_action('um_admin_extend_directory_options_general', $this); ?>
92
+
93
  </div>
94
+
95
  <div class="um-admin-clear"></div>
96
+
97
+ </div>
admin/templates/form/profile_customize.php CHANGED
@@ -139,7 +139,15 @@
139
 
140
  </select>
141
  </p>
142
-
 
 
 
 
 
 
 
 
143
  <p><label for="_um_profile_header_bg"><?php _e('Header Background Color','ultimatemember'); ?></label>
144
  <input type="text" value="<?php echo $ultimatemember->query->get_meta_value('_um_profile_header_bg', null, um_get_option('profile_header_bg') ); ?>" class="um-admin-colorpicker" name="_um_profile_header_bg" id="_um_profile_header_bg" data-default-color="<?php echo um_get_option('profile_header_bg'); ?>" />
145
  </p>
139
 
140
  </select>
141
  </p>
142
+
143
+ <p><label for="_um_profile_photo_required"><?php _e('Make Profile Photo Required','ultimatemember'); ?><?php $this->tooltip('Require user to update a profile photo when updating their profile', 'e'); ?></label>
144
+ <span>
145
+
146
+ <?php $this->ui_on_off('_um_profile_photo_required'); ?>
147
+
148
+ </span>
149
+ </p>
150
+
151
  <p><label for="_um_profile_header_bg"><?php _e('Header Background Color','ultimatemember'); ?></label>
152
  <input type="text" value="<?php echo $ultimatemember->query->get_meta_value('_um_profile_header_bg', null, um_get_option('profile_header_bg') ); ?>" class="um-admin-colorpicker" name="_um_profile_header_bg" id="_um_profile_header_bg" data-default-color="<?php echo um_get_option('profile_header_bg'); ?>" />
153
  </p>
assets/css/um-styles.css CHANGED
@@ -765,3 +765,18 @@ small.um-max-filesize span{
765
  background-repeat: no-repeat;
766
  background-size: 24px 24px;
767
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765
  background-repeat: no-repeat;
766
  background-size: 24px 24px;
767
  }
768
+
769
+ .um-search-area {
770
+ position: relative;
771
+ max-width: 300px;
772
+ }
773
+
774
+ .um-search-area .um-search-field {
775
+ width: 100%;
776
+ }
777
+
778
+ .um-search-area .um-search-icon {
779
+ position: absolute;
780
+ top: 7px;
781
+ right: 10px;
782
+ }
assets/js/um-scripts.js CHANGED
@@ -288,4 +288,8 @@ jQuery(document).ready(function() {
288
  return false;
289
  });
290
 
 
 
 
 
291
  });
288
  return false;
289
  });
290
 
291
+ jQuery(document).on('click', '#um-search-button', function() {
292
+ jQuery(this).parents('form').submit();
293
+ });
294
+
295
  });
assets/js/um.min.js CHANGED
@@ -4,4 +4,4 @@ var a=this;this.selection.on("click",".select2-search-choice:not(.select2-locked
4
  var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();i.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),function(e){void 0==e.fn.ajaxForm;var t={};t.fileapi=void 0!==e("<input type='file'/>").get(0).files,t.formdata=void 0!==window.FormData,e.fn.uploadFile=function(i){function a(){h.afterUploadAll&&!g&&(g=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(h.afterUploadAll(f),g=!1):window.setTimeout(e,100)}())}function n(t,i,a){a.on("dragenter",function(t){t.stopPropagation(),t.preventDefault(),e(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(a){e(this).css("border","2px dashed #ddd"),a.preventDefault(),t.errorLog.html("");var n=a.originalEvent.dataTransfer.files;return!i.multiple&&n.length>1?void(i.showError&&e("<div class='um-error-block'>"+i.multiDragErrorStr+"</div>").appendTo(t.errorLog)):void(0!=i.onSelect(n)&&o(i,t,n))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}function r(t){var i=[];i="string"==jQuery.type(t)?t.split("&"):e.param(t).split("&");var a,n,r=i.length,o=[];for(a=0;r>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),o.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return o}function o(t,i,a){for(var n=0;n<a.length;n++)if(s(i,t,a[n].name))if(-1!=t.maxFileSize&&a[n].size>t.maxFileSize)t.showError&&e("<div class='um-error-block'>"+t.sizeErrorStr+"</div>").appendTo(i.errorLog);else if(-1!=t.maxFileCount&&i.selectedFiles>=t.maxFileCount)t.showError&&e("<div class='um-error-block'>"+t.maxFileCountErrorStr+"</div>").appendTo(i.errorLog);else{i.selectedFiles++;var o=t,l=new FormData,c=t.fileName.replace("[]","");l.append(c,a[n]);var h=t.formData;if(h)for(var p=r(h),f=0;f<p.length;f++)p[f]&&l.append(p[f][0],p[f][1]);o.fileData=l;var m=new u(i,t),g="";g=t.showFileCounter?i.fileCounter+t.fileCounterStyle+a[n].name:a[n].name,m.filename.html(g);var v=e("<form style='display:block; position:absolute;left: 150px;' class='"+i.formGroup+"' method='"+t.method+"' action='"+t.url+"' enctype='"+t.enctype+"'></form>");v.appendTo("body");var y=[];y.push(a[n].name),d(v,o,m,y,i),i.fileCounter++}else t.showError&&e("<div class='um-error-block'>"+t.extErrorStr+"</div>").appendTo(i.errorLog)}function s(e,t,i){var a=t.allowedTypes.toLowerCase().split(","),n=i.split(".").pop().toLowerCase();return"*"!=t.allowedTypes&&jQuery.inArray(n,a)<0?!1:!0}function l(t,i){if(t.showFileCounter){var a=e(".upload-filename").length;i.fileCounter=a+1,e(".upload-filename").each(function(i,n){var r=e(this).html().split(t.fileCounterStyle),o=(parseInt(r[0])-1,a+t.fileCounterStyle+r[1]);e(this).html(o),a--})}}function c(i,a,n,r){var h="ajax-upload-id-"+(new Date).getTime(),p=e("<form method='"+n.method+"' action='"+n.url+"' enctype='"+n.enctype+"'></form>"),f="<input type='file' id='"+h+"' name='"+n.fileName+"'/>";n.multiple&&(n.fileName.indexOf("[]")!=n.fileName.length-2&&(n.fileName+="[]"),f="<input type='file' id='"+h+"' name='"+n.fileName+"' multiple/>");var m=e(f).appendTo(p);m.change(function(){i.errorLog.html("");var h=(n.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(y=0;y<this.files.length;y++)h.push(this.files[y].name);if(0==n.onSelect(this.files))return}else{var f=e(this).val(),m=[];if(h.push(f),!s(i,n,f))return void(n.showError&&e("<div class='um-error-block'>"+n.extErrorStr+"</div>").appendTo(i.errorLog));if(m.push({name:f,size:"NA"}),0==n.onSelect(m))return}if(l(n,i),r.unbind("click"),p.hide(),c(i,a,n,r),p.addClass(a),t.fileapi&&t.formdata){p.removeClass(a);var g=this.files;o(n,i,g)}else{for(var v="",y=0;y<h.length;y++)v+=n.showFileCounter?i.fileCounter+n.fileCounterStyle+h[y]+"<br>":h[y]+"<br>",i.fileCounter++;if(-1!=n.maxFileCount&&i.selectedFiles+h.length>n.maxFileCount)return void(n.showError&&e("<div class='um-error-block'>"+n.maxFileCountErrorStr+"</div>").appendTo(i.errorLog));i.selectedFiles+=h.length;var b=new u(i,n);b.filename.html(v),d(p,n,b,h,i)}}),p.css({margin:0,padding:0});var g=e(r).width()+10;10==g&&(g=120);var v=r.height()+10;10==v&&(v=35),r.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),p.appendTo(r)}function u(t,i){return this.statusbar=e("<div class='upload-statusbar'></div>"),this.filename=e("<div class='upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='upload-bar "+t.formGroup+"'></div>").appendTo(this.progressDiv),this.abort=e("<div class='upload-red "+t.formGroup+"'>"+i.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div class='upload-red'>"+i.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div class='upload-green'>"+i.doneStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div class='upload-red'>"+i.deletelStr+"</div>").appendTo(this.statusbar).hide(),t.errorLog.after(this.statusbar),this}function d(e,i,n,o,s){var c={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:i.formData,formData:i.fileData,dataType:i.returnType,beforeSubmit:function(t,l,c){if(0!=i.onSubmit.call(this,o)){var u=i.dynamicFormData();if(u){var d=r(u);if(d)for(var h=0;h<d.length;h++)d[h]&&(void 0!=i.fileData?c.formData.append(d[h][0],d[h][1]):c.data[d[h][0]]=d[h][1])}return s.tCounter+=o.length,a(),!0}return n.statusbar.append("<div class='um-error-block'>"+i.uploadErrorStr+"</div>"),n.cancel.show(),e.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,a){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),i.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),s.selectedFiles-=o.length})),t.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,t,a,r){r>98&&(r=98);var o=r+"%";r>1&&n.progressbar.width(o),i.showProgress&&(n.progressbar.html(o),n.progressbar.css("text-align","center"))},success:function(t,a,r){s.responses.push(t),n.progressbar.width("100%"),i.showProgress&&(n.progressbar.html("100%"),n.progressbar.css("text-align","center")),n.abort.hide(),i.onSuccess.call(this,o,t,r),i.showStatusAfterSuccess?(i.showDone?(n.done.show(),n.done.click(function(){n.statusbar.hide("slow"),n.statusbar.remove()})):n.done.hide(),i.showDelete?(n.del.show(),n.del.click(function(){n.statusbar.hide().remove(),i.deleteCallback&&i.deleteCallback.call(this,t,n),s.selectedFiles-=o.length,l(i,s)})):n.del.hide()):(n.statusbar.hide("slow"),n.statusbar.remove()),e.remove(),s.sCounter+=o.length},error:function(t,a,r){n.abort.hide(),"abort"==t.statusText?(n.statusbar.hide("slow").remove(),l(i,s)):(i.onError.call(this,o,a,r),i.showStatusAfterError?(n.progressDiv.hide(),n.statusbar.append("<span class='um-error-block'>ERROR: "+r+"</span>")):(n.statusbar.hide(),n.statusbar.remove()),s.selectedFiles-=o.length),e.remove(),s.fCounter+=o.length}};i.autoSubmit?e.ajaxSubmit(c):(i.showCancel&&(n.cancel.show(),n.cancel.click(function(){e.remove(),n.statusbar.remove(),s.selectedFiles-=o.length,l(i,s)})),e.ajaxForm(c))}var h=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,t){},onSuccess:function(e,t,i){},onError:function(e,t,i){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag &amp; Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},i);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var p="upload-"+(new Date).getTime();this.formGroup=p,this.hide(),this.errorLog=e("<div></div>"),this.after(this.errorLog),this.responses=[],t.formdata||(h.dragDrop=!1),t.formdata||(h.multiple=!1);var f=this,m=e("<div>"+e(this).html()+"</div>");e(m).addClass(h.uploadButtonClass),function v(){if(e.fn.ajaxForm){if(h.dragDrop){var t=e('<div class="ajax-upload-dragdrop" style="vertical-align:top;"></div>');e(f).before(t),e(t).append(m),e(t).prepend(e(h.dragDropStr)),n(f,h,t)}else e(f).before(m);c(f,p,h,m)}else window.setTimeout(v,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(t,i){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(t,i){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var g=!1;return this}}(jQuery),function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(r,o,l,h){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",Q.component.nodes(_.open),S.box),S.wrap),S.frame),S.holder,'tabindex="-1"')}function f(){j.data(o,Q).addClass(S.input).val(j.data("value")?Q.get("select",C.format):r.value),C.editable||j.on("focus."+_.id+" click."+_.id,function(e){e.preventDefault(),Q.open()}).on("keydown."+_.id,w),n(r,{haspopup:!0,expanded:!1,readonly:!1,owns:r.id+"_root"})}function m(){n(Q.$root[0],"hidden",!0)}function g(){Q.$holder.on({keydown:w,"focus.toOpen":b,blur:function(){j.removeClass(S.target)},focusin:function(e){Q.$root.removeClass(S.focused),e.stopPropagation()},"mousedown click":function(t){var i=t.target;i!=Q.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(i).is("input, select, textarea, button, option")||(t.preventDefault(),Q.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),i=t.data(),a=t.hasClass(S.navDisabled)||t.hasClass(S.disabled),n=s();n=n&&(n.type||n.href),(a||n&&!e.contains(Q.$root[0],n))&&Q.$holder[0].focus(),!a&&i.nav?Q.set("highlight",Q.component.item.highlight,{nav:i.nav}):!a&&"pick"in i?(Q.set("select",i.pick),C.closeOnSelect&&Q.close(!0)):i.clear?(Q.clear(),C.closeOnClear&&Q.close(!0)):i.close&&Q.close(!0)})}function v(){var t;C.hiddenName===!0?(t=r.name,r.name=""):(t=["string"==typeof C.hiddenPrefix?C.hiddenPrefix:"","string"==typeof C.hiddenSuffix?C.hiddenSuffix:"_submit"],t=t[0]+r.name+t[1]),Q._hidden=e('<input type=hidden name="'+t+'"'+(j.data("value")||r.value?' value="'+Q.get("select",C.formatSubmit)+'"':"")+">")[0],j.on("change."+_.id,function(){Q._hidden.value=r.value?Q.get("select",C.formatSubmit):""})}function y(){x&&d?Q.$holder.find("."+S.frame).one("transitionend",function(){Q.$holder[0].focus()}):Q.$holder[0].focus()}function b(e){e.stopPropagation(),j.addClass(S.target),Q.$root.addClass(S.focused),Q.open()}function w(e){var t=e.keyCode,i=/^(8|46)$/.test(t);return 27==t?(Q.close(!0),!1):void((32==t||i||!_.open&&Q.component.key[t])&&(e.preventDefault(),e.stopPropagation(),i?Q.clear().close():Q.open()))}if(!r)return t;var x=!1,_={id:r.id||"P"+Math.abs(~~(Math.random()*new Date))},C=l?e.extend(!0,{},l.defaults,h):h||{},S=e.extend({},t.klasses(),C.klass),j=e(r),k=function(){return this.start()},Q=k.prototype={constructor:k,$node:j,start:function(){return _&&_.start?Q:(_.methods={},_.start=!0,_.open=!1,_.type=r.type,r.autofocus=r==s(),r.readOnly=!C.editable,r.id=r.id||_.id,"text"!=r.type&&(r.type="text"),Q.component=new l(Q,C),Q.$root=e('<div class="'+S.picker+'" id="'+r.id+'_root" />'),m(),Q.$holder=e(p()).appendTo(Q.$root),g(),C.formatSubmit&&v(),f(),C.containerHidden?e(C.containerHidden).append(Q._hidden):j.after(Q._hidden),C.container?e(C.container).append(Q.$root):j.after(Q.$root),Q.on({start:Q.component.onStart,render:Q.component.onRender,stop:Q.component.onStop,open:Q.component.onOpen,close:Q.component.onClose,set:Q.component.onSet}).on({start:C.onStart,render:C.onRender,stop:C.onStop,open:C.onOpen,close:C.onClose,set:C.onSet}),x=i(Q.$holder[0]),r.autofocus&&Q.open(),Q.trigger("start").trigger("render"))},render:function(t){return t?(Q.$holder=e(p()),g(),Q.$root.html(Q.$holder)):Q.$root.find("."+S.box).html(Q.component.nodes(_.open)),Q.trigger("render")},stop:function(){return _.start?(Q.close(),Q._hidden&&Q._hidden.parentNode.removeChild(Q._hidden),Q.$root.remove(),j.removeClass(S.input).removeData(o),setTimeout(function(){j.off("."+_.id)},0),r.type=_.type,r.readOnly=!1,Q.trigger("stop"),_.methods={},_.start=!1,Q):Q},open:function(i){return _.open?Q:(j.addClass(S.active),n(r,"expanded",!0),setTimeout(function(){Q.$root.addClass(S.opened),n(Q.$root[0],"hidden",!1)},0),i!==!1&&(_.open=!0,x&&u.css("overflow","hidden").css("padding-right","+="+a()),y(),c.on("click."+_.id+" focusin."+_.id,function(e){var t=e.target;t!=r&&t!=document&&3!=e.which&&Q.close(t===Q.$holder[0])}).on("keydown."+_.id,function(i){var a=i.keyCode,n=Q.component.key[a],r=i.target;27==a?Q.close(!0):r!=Q.$holder[0]||!n&&13!=a?e.contains(Q.$root[0],r)&&13==a&&(i.preventDefault(),r.click()):(i.preventDefault(),n?t._.trigger(Q.component.key.go,Q,[t._.trigger(n)]):Q.$root.find("."+S.highlighted).hasClass(S.disabled)||(Q.set("select",Q.component.item.highlight),C.closeOnSelect&&Q.close(!0)))})),Q.trigger("open"))},close:function(e){return e&&(C.editable?r.focus():(Q.$holder.off("focus.toOpen").focus(),setTimeout(function(){Q.$holder.on("focus.toOpen",b)},0))),j.removeClass(S.active),n(r,"expanded",!1),setTimeout(function(){Q.$root.removeClass(S.opened+" "+S.focused),n(Q.$root[0],"hidden",!0)},0),_.open?(_.open=!1,x&&u.css("overflow","").css("padding-right","-="+a()),c.off("."+_.id),Q.trigger("close")):Q},clear:function(e){return Q.set("clear",null,e)},set:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(a=o&&e.isPlainObject(i)?i:a||{},t){o||(s[t]=i);for(n in s)r=s[n],n in Q.component.item&&(void 0===r&&(r=null),Q.component.set(n,r,a)),("select"==n||"clear"==n)&&j.val("clear"==n?"":Q.get(n,C.format)).trigger("change");Q.render()}return a.muted?Q:Q.trigger("set",s)},get:function(e,i){if(e=e||"value",null!=_[e])return _[e];if("valueSubmit"==e){if(Q._hidden)return Q._hidden.value;e="value"}if("value"==e)return r.value;if(e in Q.component.item){if("string"==typeof i){var a=Q.component.get(e);return a?t._.trigger(Q.component.formats.toString,Q.component,[i,a]):""}return Q.component.get(e)}},on:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(t){o||(s[t]=i);for(n in s)r=s[n],a&&(n="_"+n),_.methods[n]=_.methods[n]||[],_.methods[n].push(r)}return Q},off:function(){var e,t,i=arguments;for(e=0,namesCount=i.length;e<namesCount;e+=1)t=i[e],t in _.methods&&delete _.methods[t];return Q},trigger:function(e,i){var a=function(e){var a=_.methods[e];a&&a.map(function(e){t._.trigger(e,Q,[i])})};return a("_"+e),a(e),Q}};return new k}function i(e){var t,i="position";return e.currentStyle?t=e.currentStyle[i]:window.getComputedStyle&&(t=getComputedStyle(e)[i]),"fixed"==t}function a(){if(u.height()<=l.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=t[0].offsetWidth;t.css("overflow","scroll");var a=e('<div style="width:100%" />').appendTo(t),n=a[0].offsetWidth;return t.remove(),i-n}function n(t,i,a){if(e.isPlainObject(i))for(var n in i)r(t,n,i[n]);else r(t,i,a)}function r(e,t,i){e.setAttribute(("role"==t?"":"aria-")+t,i)}function o(t,i){e.isPlainObject(t)||(t={attribute:i}),i="";for(var a in t){var n=("role"==a?"":"aria-")+a,r=t[a];i+=null==r?"":n+'="'+t[a]+'"'}return i}function s(){try{return document.activeElement}catch(e){}}var l=e(window),c=e(document),u=e(document.documentElement),d=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var i,a="",n=t._.trigger(e.min,e);n<=t._.trigger(e.max,e,[n]);n+=e.i)i=t._.trigger(e.item,e,[n]),a+=t._.node(e.node,i[0],i[1],i[2]);return a},node:function(t,i,a,n){return i?(i=e.isArray(i)?i.join(""):i,a=a?' class="'+a+'"':"",n=n?" "+n:"","<"+t+a+n+">"+i+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,i){return"function"==typeof e?e.apply(t,i||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:o},t.extend=function(i,a){e.fn[i]=function(n,r){var o=this.data(i);return"picker"==n?o:o&&"string"==typeof n?t._.trigger(o[n],o,[r]):this.each(function(){var r=e(this);r.data(i)||new t(this,i,a,n)})},e.fn[i].defaults=a.defaults},t}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0],n=a.value,r=e.$node.data("value"),o=r||n,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};i.settings=t,i.$node=e.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),o?i.set("select",o,{format:s,defaultValue:!0}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=i.item.highlight,a=new Date(t.year,t.month,t.date+e);i.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var i=this.value;i&&(e.set("highlight",[e.get("view").year,i,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var i=this.value;i&&(e.set("highlight",[i,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";i.disabled(i.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,n=6,r=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",n.select,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",n.highlight,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,a){var n,o=this;return i=void 0===i?e:i,i==-(1/0)||i==1/0?n=i:t.isPlainObject(i)&&r.isInteger(i.pick)?i=i.obj:t.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=r.isDate(i)?i:o.create().obj):i=r.isInteger(i)||r.isDate(i)?o.normalize(new Date(i),a):o.now(e,i,a),{year:n||i.getFullYear(),month:n||i.getMonth(),date:n||i.getDate(),day:n||i.getDay(),obj:n||i,pick:n||i.getTime()}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=n(e)),r.isInteger(i)||(i=n(i)),r.isInteger(e)&&t.isPlainObject(i)?e=[i.year,i.month,i.date+e]:r.isInteger(i)&&t.isPlainObject(e)&&(i=[e.year,e.month,e.date+i]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t,i){return t=new Date,i&&i.rel&&t.setDate(t.getDate()+i.rel),this.normalize(t,i)},i.prototype.navigate=function(e,i,a){var n,r,o,s,l=t.isArray(i),c=t.isPlainObject(i),u=this.item.view;if(l||c){for(c?(r=i.year,o=i.month,s=i.date):(r=+i[0],o=+i[1],s=+i[2]),a&&a.nav&&u&&u.month!==o&&(r=u.year,o=u.month),n=new Date(r,o+(a&&a.nav?a.nav:0),1),r=n.getFullYear(),o=n.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;i=[r,o,s]}return i},i.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},i.prototype.measure=function(e,t){var i=this;return t?"string"==typeof t?t=i.parse(e,t):r.isInteger(t)&&(t=i.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},i.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},i.prototype.validate=function(e,i,a){var n,o,s,l,c=this,u=i,d=a&&a.interval?a.interval:1,h=-1===c.item.enable,p=c.item.min,f=c.item.max,m=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<i.pick?n=!0:a>i.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(i)||h&&c.disabled(i)&&(m||n||o)||!h&&(i.pick<=p.pick||i.pick>=f.pick)))for(h&&!m&&(!o&&d>0||!n&&0>d)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=p.pick?(s=!0,d=1,i=c.create([p.year,p.month,p.date+(i.pick===p.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return r.isInteger(a)?e.day===(i.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.parse=function(e,t,i){var a=this,n={};return t&&"string"==typeof t?(i&&i.format||(i=i||{},i.format=a.settings.format),a.formats.toArray(i.format).map(function(e){var i=a.formats[e],o=i?r.trigger(i,a,[t,n]):e.replace(/^!/,"").length;i&&(n[e]=t.substr(0,o)),t=t.substr(o)}),[n.yyyy||n.yy,+(n.mm||n.m)-1,n.dd||n.d]):t},i.prototype.formats=function(){function e(e,t,i){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return i.mm||i.m||(i.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,i){return e?t(e):this.settings.weekdaysShort[i.day]},dddd:function(e,i){return e?t(e):this.settings.weekdaysFull[i.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,i){var a=this.settings.monthsShort;return t?e(t,a,i):a[i.month]},mmmm:function(t,i){var a=this.settings.monthsFull;return t?e(t,a,i):a[i.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return r.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(e,i){var a=this;return r.isInteger(e)&&r.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(r.isDate(e)||t.isArray(e))&&(r.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isDateExact(e.from,i.from)&&a.isDateExact(e.to,i.to):!1},i.prototype.isDateOverlap=function(e,i){var a=this,n=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(i)||t.isArray(i))?(e=e%7+n,e===a.create(i).day+1):r.isInteger(i)&&(r.isDate(e)||t.isArray(e))?(i=i%7+n,i===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,o=0;o<n.length;o+=1)if(a.isDateExact(e,n[o])){i=!0;break}i||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,o=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,s,l,c;for(l=0;o>l;l+=1){if(s=n[l],a.isDateExact(s,e)){i=n[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[3]||i.push("inverted")):r.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;o>l;l+=1)if(a.isDateExact(n[l],e)){n[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.nodes=function(e){var t=this,i=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,u=o.view,d=o.disable,h=o.min,p=o.max,f=function(e,t){return i.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],i.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),m=function(e){return r.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&u.year>=p.year&&u.month>=p.month||!e&&u.year<=h.year&&u.month<=h.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(u.month==e?" selected":"")+(u.year==h.year&&e<h.month||u.year==p.year&&e>p.month?" disabled":"")]}}),i.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):r.node("div",a[u.month],i.klass.month)},v=function(){var a=u.year,n=i.selectYears===!0?5:~~(i.selectYears/2);if(n){var o=h.year,s=p.year,l=a-n,c=a+n;if(o>l&&(c+=o-l,l=o),c>s){var d=l-o,f=c-s;l-=d>f?f:d,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),i.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return r.node("div",a,i.klass.year)};return r.node("div",(i.selectYears?v()+g():g()+v())+m()+m(1),i.klass.header)+r.node("table",f+r.node("tbody",r.group({min:0,max:n-1,i:1,node:"tr",item:function(e){var n=i.firstDay&&0===t.create([u.year,u.month,1]).day?-7:0;return[r.group({min:a*e-u.day+n+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([u.year,u.month,e+(i.firstDay?1:0)]);var a=l&&l.pick==e.pick,n=c&&c.pick==e.pick,o=d&&t.disabled(e)||e.pick<h.pick||e.pick>p.pick,f=r.trigger(t.formats.toString,t,[i.format,e]);return[r.node("div",e.date,function(t){return t.push(u.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),a&&t.push(i.klass.selected),n&&t.push(i.klass.highlighted),o&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:f,selected:a&&t.$node.val()===f?!0:null,activedescendant:n?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),i.klass.footer)},i.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",i)}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0].value,n=e.$node.data("value"),r=n||a,o=n?t.formatSubmit:t.format;i.settings=t,i.$node=e.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=t.interval||30,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),r?i.set("select",r,{format:o}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(e){i.set("highlight",i.item.highlight.pick+e*i.item.interval,{interval:e*i.item.interval}),this.render()}},e.on("render",function(){var i=e.$root.children(),a=i.find("."+t.klass.viewset),n=function(e){return["webkit","moz","ms","o",""].map(function(t){
5
  return(t?"-"+t+"-":"")+e})},r=function(e,t){n("transform").map(function(i){e.css(i,t)}),n("transition").map(function(i){e.css(i,t)})};a.length&&(r(i,"none"),i[0].scrollTop=~~a.position().top-2*a[0].clientHeight,r(i,""))},1).on("open",function(){e.$root.find("button").attr("disabled",!1)},1).on("close",function(){e.$root.find("button").attr("disabled",!0)},1)}var a=24,n=60,r=12,o=a*n,s=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):"interval"==e?a.set("min",n.min,i).set("max",n.max,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",t,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",t,i),"min"==e&&a.set("max",n.max,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,r){var l=this;return i=void 0===i?e:i,s.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),t.isPlainObject(i)&&s.isInteger(i.pick)?i=i.pick:t.isArray(i)?i=+i[0]*n+ +i[1]:s.isInteger(i)||(i=l.now(e,i,r)),"max"==e&&i<l.item.min.pick&&(i+=o),"min"!=e&&"max"!=e&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(e,i,r),{hour:~~(a+i/n)%a,mins:(n+i%n)%n,time:(o+i)%o,pick:i%o}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||s.isDate(e)?a.create(e):e};return s.isInteger(e)||(e=n(e)),s.isInteger(i)||(i=n(i)),s.isInteger(e)&&t.isPlainObject(i)?e=[i.hour,i.mins+e*a.settings.interval]:s.isInteger(i)&&t.isPlainObject(e)&&(i=[e.hour,e.mins+i*a.settings.interval]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t){var i,a=this.item.interval,r=new Date,o=r.getHours()*n+r.getMinutes(),l=s.isInteger(t);return o-=o%a,i=0>t&&-a>=a*t+o,o+="min"==e&&i?0:a,l&&(o+=a*(i&&"max"!=e?t+1:t)),o},i.prototype.normalize=function(e,t){var i=this.item.interval,a=this.item.min&&this.item.min.pick||0;return t-="min"==e?0:(t-a)%i},i.prototype.measure=function(e,i,r){var o=this;return i||(i="min"==e?[0,0]:[a-1,n-1]),"string"==typeof i?i=o.parse(e,i):i===!0||s.isInteger(i)?i=o.now(e,i,r):t.isPlainObject(i)&&s.isInteger(i.pick)&&(i=o.normalize(e,i.pick,r)),i},i.prototype.validate=function(e,t,i){var a=this,n=i&&i.interval?i.interval:a.item.interval;return a.disabled(t)&&(t=a.shift(t,n)),t=a.scope(t),a.disabled(t)&&(t=a.shift(t,-1*n)),t},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return s.isInteger(a)?e.hour==a:t.isArray(a)||s.isDate(a)?e.pick==i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[2]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.shift=function(e,t){var i=this,a=i.item.min.pick,n=i.item.max.pick;for(t=t||i.item.interval;i.disabled(e)&&(e=i.create(e.pick+=t),!(e.pick<=a||e.pick>=n)););return e},i.prototype.scope=function(e){var t=this.item.min.pick,i=this.item.max.pick;return this.create(e.pick>i?i:e.pick<t?t:e)},i.prototype.parse=function(e,t,i){var a,r,o,l,c,u=this,d={};if(!t||"string"!=typeof t)return t;i&&i.format||(i=i||{},i.format=u.settings.format),u.formats.toArray(i.format).map(function(e){var i,a=u.formats[e],n=a?s.trigger(a,u,[t,d]):e.replace(/^!/,"").length;a&&(i=t.substr(0,n),d[e]=i.match(/^\d+$/)?+i:i),t=t.substr(n)});for(l in d)c=d[l],s.isInteger(c)?l.match(/^(h|hh)$/i)?(a=c,("h"==l||"hh"==l)&&(a%=12)):"i"==l&&(r=c):l.match(/^a$/i)&&c.match(/^p/i)&&("h"in d||"hh"in d)&&(o=!0);return(o?a+12:a)*n+r},i.prototype.formats={h:function(e,t){return e?s.digits(e):t.hour%r||r},hh:function(e,t){return e?2:s.lead(t.hour%r||r)},H:function(e,t){return e?s.digits(e):""+t.hour%24},HH:function(e,t){return e?s.digits(e):s.lead(t.hour%24)},i:function(e,t){return e?2:s.lead(t.mins)},a:function(e,t){return e?4:o/2>t.time%o?"a.m.":"p.m."},A:function(e,t){return e?2:o/2>t.time%o?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return s.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(e,i){var a=this;return s.isInteger(e)&&s.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(s.isDate(e)||t.isArray(e))&&(s.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isTimeExact(e.from,i.from)&&a.isTimeExact(e.to,i.to):!1},i.prototype.isTimeOverlap=function(e,i){var a=this;return s.isInteger(e)&&(s.isDate(i)||t.isArray(i))?e===a.create(i).hour:s.isInteger(i)&&(s.isDate(e)||t.isArray(e))?i===a.create(e).hour:t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,r=0;r<n.length;r+=1)if(a.isTimeExact(e,n[r])){i=!0;break}i||(s.isInteger(e)||s.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,r=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,o,l,c;for(l=0;r>l;l+=1){if(o=n[l],a.isTimeExact(o,e)){i=n[l]=null,c=!0;break}if(a.isTimeOverlap(o,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[2]||i.push("inverted")):s.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;r>l;l+=1)if(a.isTimeExact(n[l],e)){n[l]=null;break}if(c)for(l=0;r>l;l+=1)if(a.isTimeOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.i=function(e,t){return s.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,i=t.settings,a=t.item.select,n=t.item.highlight,r=t.item.view,o=t.item.disable;return s.node("ul",s.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){e=t.create(e);var l=e.pick,c=a&&a.pick==l,u=n&&n.pick==l,d=o&&t.disabled(e),h=s.trigger(t.formats.toString,t,[i.format,e]);return[s.trigger(t.formats.toString,t,[s.trigger(i.formatLabel,t,[e])||i.format,e]),function(e){return c&&e.push(i.klass.selected),u&&e.push(i.klass.highlighted),r&&r.pick==l&&e.push(i.klass.viewset),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.listItem]),"data-pick="+e.pick+" "+s.ariaAttr({role:"option",label:h,selected:c&&t.$node.val()===h?!0:null,activedescendant:u?!0:null,disabled:d?!0:null})]}})+s.node("li",s.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+s.ariaAttr({controls:t.$node[0].id})),"",s.ariaAttr({role:"presentation"})),i.klass.list,s.ariaAttr({role:"listbox",controls:t.$node[0].id}))},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(e.klasses().picker),e.extend("pickatime",i)}),[].map||(Array.prototype.map=function(e,t){for(var i=this,a=i.length,n=new Array(a),r=0;a>r;r++)r in i&&(n[r]=e.call(t,i[r],r,i));return n}),[].filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var a=[],n=arguments[1],r=0;i>r;r++)if(r in t){var o=t[r];e.call(n,o,r,t)&&a.push(o)}return a}),[].indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if(0===i)return-1;var a=0;if(arguments.length>1&&(a=Number(arguments[1]),a!=a?a=0:0!==a&&a!=1/0&&a!=-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a)))),a>=i)return-1;for(var n=a>=0?a:Math.max(i-Math.abs(a),0);i>n;n++)if(n in t&&t[n]===e)return n;return-1});var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(e,t){var i=this;if("[object RegExp]"!==Object.prototype.toString.call(e))return nativeSplit.call(i,e,t);var a,n,r,o,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),c=0;for(e=new RegExp(e.source,l+"g"),i+="",compliantExecNpcg||(a=new RegExp("^"+e.source+"$(?!\\s)",l)),t=void 0===t?-1>>>0:t>>>0;(n=e.exec(i))&&(r=n.index+n[0].length,!(r>c&&(s.push(i.slice(c,n.index)),!compliantExecNpcg&&n.length>1&&n[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(n[e]=void 0)}),n.length>1&&n.index<i.length&&Array.prototype.push.apply(s,n.slice(1)),o=n[0].length,c=r,s.length>=t)));)e.lastIndex===n.index&&e.lastIndex++;return c===i.length?(o||!e.test(""))&&s.push(""):s.push(i.slice(c)),s.length>t?s.slice(0,t):s},function(e){"use strict";var t={init:function(i){return this.each(function(){this.self=e(this),t.destroy.call(this.self),this.opt=e.extend(!0,{},e.fn.raty.defaults,i),t._adjustCallback.call(this),t._adjustNumber.call(this),"img"!==this.opt.starType&&t._adjustStarType.call(this),t._adjustPath.call(this),t._createStars.call(this),this.opt.cancel&&t._createCancel.call(this),this.opt.precision&&t._adjustPrecision.call(this),t._createScore.call(this),t._apply.call(this,this.opt.score),t._target.call(this,this.opt.score),this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var e=["number","readOnly","score","scoreName","target"],t=0;t<e.length;t++)"function"==typeof this.opt[e[t]]&&(this.opt[e[t]]=this.opt[e[t]].call(this))},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var e=["cancelOff","cancelOn","starHalf","starOff","starOn"],t=0;t<e.length;t++)this.opt[e[t]]=this.opt[e[t]].replace(".","-")},_apply:function(e){t._fill.call(this,e),e&&(e>0&&this.score.val(t._between(e,0,this.opt.number)),t._roundStars.call(this,e))},_between:function(e,t,i){return Math.min(Math.max(parseFloat(e),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this)),t._bindOver.call(this),t._bindClick.call(this),t._bindOut.call(this)},_bindClick:function(){var t=this;t.stars.on("click.raty",function(i){var a=e(this);t.score.val(t.opt.half||t.opt.precision?t.self.data("score"):this.alt||a.data("alt")),t.opt.click&&t.opt.click.call(t,+t.score.val(),i)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var e=this;e.self.on("mouseleave.raty",function(i){var a=+e.score.val()||void 0;t._apply.call(e,a),t._target.call(e,a,i),e.opt.mouseout&&e.opt.mouseout.call(e,a,i)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(i){var a=e.opt.cancelOff;if("img"!==e.opt.starType&&(a=e.opt.cancelClass+" "+a),t._setIcon.call(e,this,a),e.opt.mouseout){var n=+e.score.val()||void 0;e.opt.mouseout.call(e,n,i)}})},_bindOver:function(){var e=this,i=e.opt.half?"mousemove.raty":"mouseover.raty";e.stars.on(i,function(i){var a=t._getScoreByPosition.call(e,i,this);t._fill.call(e,a),e.opt.half&&(t._roundStars.call(e,a),e.self.data("score",a)),t._target.call(e,a,i),e.opt.mouseover&&e.opt.mouseover.call(e,a,i)})},_bindOverCancel:function(){var e=this;e.cancel.on("mouseover.raty",function(i){var a=e.opt.path+e.opt.starOff,n=e.opt.cancelOn;"img"===e.opt.starType?e.stars.attr("src",a):(n=e.opt.cancelClass+" "+n,e.stars.attr("class",a)),t._setIcon.call(e,this,n),t._target.call(e,null,i),e.opt.mouseover&&e.opt.mouseover.call(e,null)})},_buildScoreField:function(){return e("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,i=e("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});"img"===this.opt.starType?i.attr({src:t,alt:"x"}):i.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend("&#160;").prepend(i):this.self.append("&#160;").append(i),this.cancel=i},_createScore:function(){var i=e(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var i=1;i<=this.opt.number;i++){var a=t._nameForIndex.call(this,i),n={alt:i,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(n={"data-alt":i,"class":n.src}),n.title=t._getHint.call(this,i),e("<"+this.opt.starType+" />",n).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?"&#160;":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){e(this).text(t),e.error(t)},_fill:function(e){for(var i=0,a=1;a<=this.stars.length;a++){var n,r=this.stars[a-1],o=t._turnOn.call(this,a,e);if(this.opt.iconRange&&this.opt.iconRange.length>i){var s=this.opt.iconRange[i];n=t._getRangeIcon.call(this,s,o),a<=s.range&&t._setIcon.call(this,r,n),a===s.range&&i++}else n=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,r,n)}},_getRangeIcon:function(e,t){return t?e.on||this.opt.starOn:e.off||this.opt.starOff},_getScoreByPosition:function(i,a){var n=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var r=t._getSize.call(this),o=parseFloat((i.pageX-e(a).offset().left)/r);n=this.opt.precision?n-1+o:n-1+(o>.5?1:.5)}return n},_getSize:function(){var e;return e="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),e||t._error.call(this,"Could not be possible get the icon size!"),e},_turnOn:function(e,t){return this.opt.single?e===t:t>=e},_getHint:function(e){var t=this.opt.hints[e-1];return""===t?"":t||e},_lock:function(){var e=parseInt(this.score.val(),10),i=e?t._getHint.call(this,e):this.opt.noRatedMsg;this.style.cursor="",this.title=i,this.score.prop("readonly",!0),this.stars.prop("title",i),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(e){return this.opt.score&&this.opt.score>=e?"starOn":"starOff"},_roundStars:function(e){var i=(e%1).toFixed(2);if(i>this.opt.round.down){var a="starOn";this.opt.halfShow&&i<this.opt.round.up?a="starHalf":i<this.opt.round.full&&(a="starOff");var n=this.opt[a],r=this.stars[Math.ceil(e)-1];t._setIcon.call(this,r,n)}},_setIcon:function(e,t){e["img"===this.opt.starType?"src":"className"]=this.opt.path+t},_setTarget:function(e,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t)),e.is(":input")?e.val(t):e.html(t)},_target:function(i,a){if(this.opt.target){var n=e(this.opt.target);n.length||t._error.call(this,"Target selector invalid or missing!");var r=a&&"mouseover"===a.type;if(void 0===i)i=this.opt.targetText;else if(null===i)i=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?i=t._getHint.call(this,Math.ceil(i)):this.opt.precision&&(i=parseFloat(i).toFixed(1));var o=a&&"mousemove"===a.type;r||o||this.opt.targetKeep||(i=this.opt.targetText)}t._setTarget.call(this,n,i)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var e=0;e<this.opt.number;e++)this.stars[e].title=t._getHint.call(this,e+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==!0&&(t[i?"click":"score"].call(a,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,e.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=e(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var e,t=[];return this.each(function(){e=this.score.val(),t.push(e?+e:void 0)}),t.length>1?t:t[0]},move:function(i){return this.each(function(){var a=parseInt(i,10),n=e(this).data("options"),r=(+i).toFixed(1).split(".")[1];a>=n.number&&(a=n.number-1,r=10);var o=t._getSize.call(this),s=o/10,l=e(this.stars[a]),c=l.offset().left+s*parseInt(r,10),u=e.Event("mousemove",{pageX:c});l.trigger(u)})},readOnly:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==i&&(i?(a.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),a.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=e(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){var i=e(this),a=i.data("options"),n=e.extend({},a,t);i.raty(n)})},setScore:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),t._target.call(this,i))})}};e.fn.raty=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exist!"):t.init.apply(this,arguments)},e.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";function t(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function i(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var a=e.scrollTo=function(t,i,a){return e(window).scrollTo(t,i,a)};return a.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(n,r,o){"object"==typeof r&&(o=r,r=0),"function"==typeof o&&(o={onAfter:o}),"max"===n&&(n=9e9),o=e.extend({},a.defaults,o),r=r||o.duration;var s=o.queue&&o.axis.length>1;return s&&(r/=2),o.offset=i(o.offset),o.over=i(o.over),this.each(function(){function l(t){var i=e.extend({},o,{queue:!0,duration:r,complete:t&&function(){t.call(d,p,o)}});h.animate(f,i)}if(null!==n){var c,u=t(this),d=u?this.contentWindow||window:this,h=e(d),p=n,f={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(p)){p=i(p);break}if(p=u?e(p):e(p,d),!p.length)return;case"object":(p.is||p.style)&&(c=(p=e(p)).offset())}var m=e.isFunction(o.offset)&&o.offset(d,p)||o.offset;e.each(o.axis.split(""),function(e,t){var i="x"===t?"Left":"Top",n=i.toLowerCase(),r="scroll"+i,g=h[r](),v=a.max(d,t);if(c)f[r]=c[n]+(u?0:g-h.offset()[n]),o.margin&&(f[r]-=parseInt(p.css("margin"+i),10)||0,f[r]-=parseInt(p.css("border"+i+"Width"),10)||0),f[r]+=m[n]||0,o.over[n]&&(f[r]+=p["x"===t?"width":"height"]()*o.over[n]);else{var y=p[n];f[r]=y.slice&&"%"===y.slice(-1)?parseFloat(y)/100*v:y}o.limit&&/^\d+$/.test(f[r])&&(f[r]=f[r]<=0?0:Math.min(f[r],v)),!e&&o.axis.length>1&&(g===f[r]?f={}:s&&(l(o.onAfterFirst),f={}))}),l(o.onAfter)}})},a.max=function(i,a){var n="x"===a?"Width":"Height",r="scroll"+n;if(!t(i))return i[r]-e(i)[n.toLowerCase()]();var o="client"+n,s=i.ownerDocument||i.document,l=s.documentElement,c=s.body;return Math.max(l[r],c[r])-Math.min(l[o],c[o])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var i=this.get(t);if(t.options.interrupt&&t._last&&t._last!==i)return e(t.elem).stop();var a=Math.round(t.now);i!==a&&(e(t.elem)[t.prop](a),t._last=this.get(t))}},a}),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=l.call(arguments,1),c=0,d=0,h=0,p=0,f=0,m=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(d=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in o&&(h=-1*o.deltaY,c=h),"deltaX"in o&&(d=o.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,d*=g}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,h*=v,d*=v}if(p=Math.max(Math.abs(h),Math.abs(d)),(!r||r>p)&&(r=p,a(o,p)&&(r/=40)),a(o,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/r),d=Math[d>=1?"floor":"ceil"](d/r),h=Math[h>=1?"floor":"ceil"](h/r),u.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();f=t.clientX-y.left,m=t.clientY-y.top}return t.deltaX=d,t.deltaY=h,t.deltaFactor=r,t.offsetX=f,t.offsetY=m,t.deltaMode=0,s.unshift(t,c,d,h),n&&clearTimeout(n),n=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){r=null}function a(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var n,r,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=o.length;c;)e.event.fixHooks[o[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=s.length;i;)this.removeEventListener(s[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e){"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var i="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",r="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";i||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+r+"%3E%3C/script%3E"))),t()}(function(){var t,i="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",r={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},o=0,s={},l=window.attachEvent&&!window.addEventListener?1:0,c=!1,u=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],d={init:function(t){var t=e.extend(!0,{},r,t),i=h.call(this);if(t.live){var l=t.liveSelector||this.selector||n,c=e(l);if("off"===t.live)return void f(l);s[l]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&f(l)},500)}else f(l);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":m(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),p(t),e(i).each(function(){var i=e(this);if(!i.data(a)){i.data(a,{idx:++o,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:i.css("direction"),cbOffsets:null,trigger:null});var n=i.data(a),r=n.opt,s=i.data("mcs-axis"),l=i.data("mcs-scrollbar-position"),c=i.data("mcs-theme");s&&(r.axis=s),l&&(r.scrollbarPosition=l),c&&(r.theme=c,p(r)),v.call(this),e("#mCSB_"+n.idx+"_container img:not(."+u[2]+")").addClass(u[2]),d.update.call(null,i)}})},update:function(t,i){var n=t||h.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!o.length)return;n.tweenRunning&&Y(t),t.hasClass(u[3])&&t.removeClass(u[3]),t.hasClass(u[4])&&t.removeClass(u[4]),x.call(this),b.call(this),"y"===r.axis||r.advanced.autoExpandHorizontalScroll||o.css("width",y(o.children())),n.overflowed=j.call(this),D.call(this),r.autoDraggerLength&&_.call(this),C.call(this),Q.call(this);var l=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==r.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?k.call(this):(X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(k.call(this),"y"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[1]&&X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==r.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?k.call(this):(X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(k.call(this),"x"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[0]&&X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),i&&n&&(2===i&&r.callbacks.onImageLoad&&"function"==typeof r.callbacks.onImageLoad?r.callbacks.onImageLoad.call(this):3===i&&r.callbacks.onSelectorChange&&"function"==typeof r.callbacks.onSelectorChange?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&"function"==typeof r.callbacks.onUpdate&&r.callbacks.onUpdate.call(this)),U.call(this)}})},scrollTo:function(t,i){if("undefined"!=typeof t&&null!=t){var n=h.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=e.extend(!0,{},s,i),c=z.call(this,t),u=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=N.call(this,c[0],"y"),c[1]=N.call(this,c[1],"x"),l.moveDragger&&(c[0]*=r.scrollRatio.y,c[1]*=r.scrollRatio.x),l.dur=u,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==o.axis&&r.overflowed[0]&&(l.dir="y",l.overwrite="all",X(n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==o.axis&&r.overflowed[1]&&(l.dir="x",l.overwrite="none",X(n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Y(t)})},disable:function(t){var i=h.call(this);return e(i).each(function(){var i=e(this);i.data(a)&&(i.data(a),U.call(this,"remove"),T.call(this),t&&k.call(this),D.call(this,!0),i.addClass(u[3]))})},destroy:function(){var t=h.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx),l=e("#mCSB_"+r.idx+"_container"),c=e(".mCSB_"+r.idx+"_scrollbar");o.live&&f(o.liveSelector||e(t).selector),U.call(this,"remove"),T.call(this),k.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),l.find("img."+u[2]).removeClass(u[2]),s.replaceWith(l.contents()),n.removeClass(i+" _"+a+"_"+r.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addClass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},p=function(t){var i=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],r=["minimal","minimal-dark"],o=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,i)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,r)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,o)>-1?"outside":t.scrollbarPosition},f=function(e){s[e]&&(clearTimeout(s[e]),Z(s,e))},m=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),r=n.opt,o=r.autoExpandScrollbar?" "+u[1]+"_expand":"",s=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],l="yx"===r.axis?"mCSB_vertical_horizontal":"x"===r.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===r.axis?s[0]+s[1]:"x"===r.axis?s[1]:s[0],d="yx"===r.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",h=r.autoHideScrollbar?" "+u[6]:"",p="x"!==r.axis&&"rtl"===n.langDir?" "+u[7]:"";r.setWidth&&t.css("width",r.setWidth),r.setHeight&&t.css("height",r.setHeight),r.setLeft="y"!==r.axis&&"rtl"===n.langDir?"989999px":r.setLeft,t.addClass(i+" _"+a+"_"+n.idx+h+p).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+l+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir="+n.langDir+" /></div>");
6
  var f=e("#mCSB_"+n.idx),m=e("#mCSB_"+n.idx+"_container");"y"===r.axis||r.advanced.autoExpandHorizontalScroll||m.css("width",y(m.children())),"outside"===r.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),m.wrap(d)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},y=function(t){return Math.max.apply(Math,t.map(function(){return e(this).outerWidth(!0)}).get())},b=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(r[0].getBoundingClientRect().right+.4)-Math.floor(r[0].getBoundingClientRect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),i=t.data(a),n=i.opt,r=e(".mCSB_"+i.idx+"_scrollbar:first"),o=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",s=["<a href='#' class='"+u[13]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[14]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[15]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[16]+"' oncontextmenu='return false;' "+o+" />"],l=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&r.prepend(l[0]).append(l[1]).next(".mCSB_scrollTools").prepend(l[2]).append(l[3])},x=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=t.css("max-height")||"none",o=-1!==r.indexOf("%"),s=t.css("box-sizing");if("none"!==r){var l=o?t.parent().height()*parseInt(r)/100:parseInt(r);"border-box"===s&&(l-=t.innerHeight()-t.height()+(t.outerHeight()-t.innerHeight())),n.css("max-height",Math.round(l))}},_=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[n.height()/r.outerHeight(!1),n.width()/r.outerWidth(!1)],c=[parseInt(o[0].css("min-height")),Math.round(s[0]*o[0].parent().height()),parseInt(o[1].css("min-width")),Math.round(s[1]*o[1].parent().width())],u=l&&c[1]<c[0]?c[0]:c[1],d=l&&c[3]<c[2]?c[2]:c[3];o[0].css({height:u,"max-height":o[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),o[1].css({width:d,"max-width":o[1].parent().width()-10})},C=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[r.outerHeight(!1)-n.height(),r.outerWidth(!1)-n.width()],l=[s[0]/(o[0].parent().height()-o[0].height()),s[1]/(o[1].parent().width()-o[1].width())];i.scrollRatio={y:l[0],x:l[1]}},S=function(e,t,i){var a=i?u[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(u[0]+" "+a),n.toggleClass(u[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(u[0]),n.removeClass(u[1])):(e.addClass(u[0]),n.addClass(u[1])))},j=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=null==i.overflowed?r.height():r.outerHeight(!1),s=null==i.overflowed?r.width():r.outerWidth(!1);return[o>n.height(),s>n.width()]},k=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx),o=e("#mCSB_"+i.idx+"_container"),s=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")];if(Y(t),("x"!==n.axis&&!i.overflowed[0]||"y"===n.axis&&i.overflowed[0])&&(s[0].add(o).css("top",0),X(t,"_resetY")),"y"!==n.axis&&!i.overflowed[1]||"x"===n.axis&&i.overflowed[1]){var l=dx=0;"rtl"===i.langDir&&(l=r.width()-o.outerWidth(!1),dx=Math.abs(l/i.scrollRatio.x)),o.css("left",l),s[1].css("left",dx),X(t,"_resetX")}},Q=function(){function t(){o=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(o),A.call(i[0])):t()},100)}var i=e(this),n=i.data(a),r=n.opt;if(!n.bindEvents){if(E.call(this),r.contentTouchScroll&&I.call(this),M.call(this),r.mouseWheel.enable){var o;t()}H.call(this),L.call(this),r.advanced.autoScrollOnFocus&&F.call(this),r.scrollButtons.enable&&B.call(this),r.keyboard.enable&&W.call(this),n.bindEvents=!0}},T=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=".mCSB_"+i.idx+"_scrollbar",s=e("#mCSB_"+i.idx+",#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,"+o+" ."+u[12]+",#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal,"+o+">a"),l=e("#mCSB_"+i.idx+"_container");n.advanced.releaseDraggableSelectors&&s.add(e(n.advanced.releaseDraggableSelectors)),i.bindEvents&&(e(document).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(i.sequential.step),Z(i.sequential,"step"),clearTimeout(l[0].onCompleteTimeout),Z(l[0],"onCompleteTimeout"),i.bindEvents=!1)},D=function(t){var i=e(this),n=i.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container_wrapper"),s=o.length?o:e("#mCSB_"+n.idx+"_container"),l=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==r.axis&&(n.overflowed[0]&&!t?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),s.removeClass(u[8]+" "+u[10])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[0].css("display","none"),s.removeClass(u[10])):(l[0].css("display","none"),s.addClass(u[10])),s.addClass(u[8]))),"y"!==r.axis&&(n.overflowed[1]&&!t?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),s.removeClass(u[9]+" "+u[11])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[1].css("display","none"),s.removeClass(u[11])):(l[1].css("display","none"),s.addClass(u[11])),s.addClass(u[9]))),n.overflowed[0]||n.overflowed[1]?i.removeClass(u[5]):i.addClass(u[5])},O=function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return e.target.ownerDocument!==document?[e.originalEvent.screenY,e.originalEvent.screenX,!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[i.screenY,i.screenX,a>1]:[i.pageY,i.pageX,a>1];default:return[e.pageY,e.pageX,!1]}},E=function(){function t(e){var t=f.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function i(e,t,i,a){if(f[0].idleTimer=d.scrollInertia<233?250:0,n.attr("id")===p[1])var r="x",o=(n[0].offsetLeft-t+a)*u.scrollRatio.x;else var r="y",o=(n[0].offsetTop-e+i)*u.scrollRatio.y;X(s,o.toString(),{dir:r,drag:!0})}var n,r,o,s=e(this),u=s.data(a),d=u.opt,h=a+"_"+u.idx,p=["mCSB_"+u.idx+"_dragger_vertical","mCSB_"+u.idx+"_dragger_horizontal"],f=e("#mCSB_"+u.idx+"_container"),m=e("#"+p[0]+",#"+p[1]),g=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m;m.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,function(i){if(i.stopImmediatePropagation(),i.preventDefault(),J(i)){c=!0,l&&(document.onselectstart=function(){return!1}),t(!1),Y(s),n=e(this);var a=n.offset(),u=O(i)[0]-a.top,h=O(i)[1]-a.left,p=n.height()+a.top,f=n.width()+a.left;p>u&&u>0&&f>h&&h>0&&(r=u,o=h),S(n,"active",d.autoExpandScrollbar)}}).bind("touchmove."+h,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;i(r,o,a,s)}),e(document).bind("mousemove."+h+" pointermove."+h+" MSPointerMove."+h,function(e){if(n){var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;if(r===a)return;i(r,o,a,s)}}).add(g).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" MSPointerUp."+h,function(){n&&(S(n,"active",d.autoExpandScrollbar),n=null),c=!1,l&&(document.onselectstart=null),t(!0)})},I=function(){function i(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,x=0,_=0;var i=T.offset();u=O(e)[0]-i.top,d=O(e)[1]-i.left,R=[O(e)[0],O(e)[1]]}function n(e){if(ee(e)&&!c&&!O(e)[2]&&(e.stopImmediatePropagation(),!_||x)){m=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(i),I.push(a),R[2]=Math.abs(O(e)[0]-R[0]),R[3]=Math.abs(O(e)[1]-R[1]),S.overflowed[0])var r=D[0].parent().height()-D[0].height(),o=u-i>0&&i-u>-(r*S.scrollRatio.y)&&(2*R[3]<R[2]||"yx"===j.axis);if(S.overflowed[1])var s=D[1].parent().width()-D[1].width(),h=d-a>0&&a-d>-(s*S.scrollRatio.x)&&(2*R[2]<R[3]||"yx"===j.axis);o||h?(e.preventDefault(),x=1):_=1,b="yx"===j.axis?[u-i,d-a]:"x"===j.axis?[null,d-a]:[u-i,null],T[0].idleTimer=250,S.overflowed[0]&&l(b[0],M,n,"y","all",!0),S.overflowed[1]&&l(b[1],M,n,"x",A,!0)}}function r(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Y(C),f=G();var i=Q.offset();h=O(e)[0]-i.top,p=O(e)[1]-i.left,E=[],I=[]}function o(e){if(ee(e)&&!c&&!O(e)[2]){e.stopImmediatePropagation(),x=0,_=0,g=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(g-m>30)){y=1e3/(g-f);var n="mcsEaseOut",r=2.5>y,o=r?[E[E.length-2],I[I.length-2]]:[0,0];v=r?[i-o[0],a-o[1]]:[i-h,a-p];var u=[Math.abs(v[0]),Math.abs(v[1])];y=r?[Math.abs(v[0]/4),Math.abs(v[1]/4)]:[y,y];var d=[Math.abs(T[0].offsetTop)-v[0]*s(u[0]/y[0],y[0]),Math.abs(T[0].offsetLeft)-v[1]*s(u[1]/y[1],y[1])];b="yx"===j.axis?[d[0],d[1]]:"x"===j.axis?[null,d[1]]:[d[0],null],w=[4*u[0]+j.scrollInertia,4*u[1]+j.scrollInertia];var C=parseInt(j.contentTouchScroll)||0;b[0]=u[0]>C?b[0]:0,b[1]=u[1]>C?b[1]:0,S.overflowed[0]&&l(b[0],w[0],n,"y",A,!1),S.overflowed[1]&&l(b[1],w[1],n,"x",A,!1)}}}function s(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function l(e,t,i,a,n,r){e&&X(C,e.toString(),{dur:t,scrollEasing:i,dir:a,overwrite:n,drag:r})}var u,d,h,p,f,m,g,v,y,b,w,x,_,C=e(this),S=C.data(a),j=S.opt,k=a+"_"+S.idx,Q=e("#mCSB_"+S.idx),T=e("#mCSB_"+S.idx+"_container"),D=[e("#mCSB_"+S.idx+"_dragger_vertical"),e("#mCSB_"+S.idx+"_dragger_horizontal")],E=[],I=[],M=0,A="yx"===j.axis?"none":"all",R=[],H=T.find("iframe"),F=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k];T.bind(F[0],function(e){i(e)}).bind(F[1],function(e){n(e)}),Q.bind(F[0],function(e){r(e)}).bind(F[2],function(e){o(e)}),H.length&&H.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(F[0],function(e){i(e),r(e)}).bind(F[1],function(e){n(e)}).bind(F[2],function(e){o(e)})})})},M=function(){function i(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,i){u.type=i&&r?"stepped":"stepless",u.scrollAmount=10,$(o,e,t,"mcsLinearOut",i?60:null)}var r,o=e(this),s=o.data(a),l=s.opt,u=s.sequential,d=a+"_"+s.idx,h=e("#mCSB_"+s.idx+"_container"),p=h.parent();h.bind("mousedown."+d,function(){t||r||(r=1,c=!0)}).add(document).bind("mousemove."+d,function(e){if(!t&&r&&i()){var a=h.offset(),o=O(e)[0]-a.top+h[0].offsetTop,c=O(e)[1]-a.left+h[0].offsetLeft;o>0&&o<p.height()&&c>0&&c<p.width()?u.step&&n("off",null,"stepped"):("x"!==l.axis&&s.overflowed[0]&&(0>o?n("on",38):o>p.height()&&n("on",40)),"y"!==l.axis&&s.overflowed[1]&&(0>c?n("on",37):c>p.width()&&n("on",39)))}}).bind("mouseup."+d,function(){t||(r&&(r=0,n("off",null)),c=!1)})},A=function(){function t(t,a){if(Y(i),!R(i,t.target)){var o="auto"!==r.mouseWheel.deltaFactor?parseInt(r.mouseWheel.deltaFactor):l&&t.deltaFactor<100?100:t.deltaFactor||100;if("x"===r.axis||"x"===r.mouseWheel.axis)var u="x",d=[Math.round(o*n.scrollRatio.x),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.width()?.9*s.width():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),f=c[1][0].offsetLeft,m=c[1].parent().width()-c[1].width(),g=t.deltaX||t.deltaY||a;else var u="y",d=[Math.round(o*n.scrollRatio.y),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.height()?.9*s.height():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),f=c[0][0].offsetTop,m=c[0].parent().height()-c[0].height(),g=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||(r.mouseWheel.invert&&(g=-g),r.mouseWheel.normalizeDelta&&(g=0>g?-1:1),(g>0&&0!==f||0>g&&f!==m||r.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),X(i,(p-g*h).toString(),{dir:u}))}}var i=e(this),n=i.data(a),r=n.opt,o=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],u=e("#mCSB_"+n.idx+"_container").find("iframe");n&&(u.length&&u.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+o,function(e,i){t(e,i)})})}),s.bind("mousewheel."+o,function(e,i){t(e,i)}))},P=function(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(a){}return null!==t},R=function(t,i){var n=i.nodeName.toLowerCase(),r=t.data(a).opt.mouseWheel.disableOver,o=["select","textarea"];return e.inArray(n,r)>-1&&!(e.inArray(n,o)>-1&&!e(i).is(":focus"))},H=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container"),o=r.parent(),s=e(".mCSB_"+i.idx+"_scrollbar ."+u[12]);s.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(){c=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(){c=!1}).bind("click."+n,function(a){if(e(a.target).hasClass(u[12])||e(a.target).hasClass("mCSB_draggerRail")){Y(t);var n=e(this),s=n.find(".mCSB_dragger");if(n.parent(".mCSB_scrollTools_horizontal").length>0){if(!i.overflowed[1])return;var l="x",c=a.pageX>s.offset().left?-1:1,d=Math.abs(r[0].offsetLeft)-.9*c*o.width()}else{if(!i.overflowed[0])return;var l="y",c=a.pageY>s.offset().top?-1:1,d=Math.abs(r[0].offsetTop)-.9*c*o.height()}X(t,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},F=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=e("#mCSB_"+i.idx+"_container"),s=o.parent();o.bind("focusin."+r,function(){var i=e(document.activeElement),a=o.find(".mCustomScrollBox").length,r=0;i.is(n.advanced.autoScrollOnFocus)&&(Y(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(r+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ie(i)[0],ie(i)[1]],a=[o[0].offsetTop,o[0].offsetLeft],l=[a[0]+e[0]>=0&&a[0]+e[0]<s.height()-i.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<s.width()-i.outerWidth(!1)],c="yx"!==n.axis||l[0]||l[1]?"all":"none";"x"===n.axis||l[0]||X(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r}),"y"===n.axis||l[1]||X(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r})},t[0]._focusTimer))})},L=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+n,function(){(0!==r.scrollTop()||0!==r.scrollLeft())&&e(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},B=function(){var t=e(this),i=t.data(a),n=i.opt,r=i.sequential,o=a+"_"+i.idx,s=".mCSB_"+i.idx+"_scrollbar",l=e(s+">a");l.bind("mousedown."+o+" touchstart."+o+" pointerdown."+o+" MSPointerDown."+o+" mouseup."+o+" touchend."+o+" pointerup."+o+" MSPointerUp."+o+" mouseout."+o+" pointerout."+o+" MSPointerOut."+o+" click."+o,function(a){function o(e,i){r.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,$(t,e,i)}if(a.preventDefault(),J(a)){var s=e(this).attr("class");switch(r.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;c=!0,i.tweenRunning=!1,o("on",s);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;c=!1,r.dir&&o("off",s);break;case"click":if("stepped"!==r.type||i.tweenRunning)return;o("on",s)}}})},W=function(){function t(t){function a(e,t){o.type=r.keyboard.scrollType,o.scrollAmount=r.snapAmount||r.keyboard.scrollAmount,"stepped"===o.type&&n.tweenRunning||$(i,e,t)}switch(t.type){case"blur":n.tweenRunning&&o.dir&&a("off",null);break;case"keydown":case"keyup":var s=t.keyCode?t.keyCode:t.which,l="on";if("x"!==r.axis&&(38===s||40===s)||"y"!==r.axis&&(37===s||39===s)){if((38===s||40===s)&&!n.overflowed[0]||(37===s||39===s)&&!n.overflowed[1])return;"keyup"===t.type&&(l="off"),e(document.activeElement).is(d)||(t.preventDefault(),t.stopImmediatePropagation(),a(l,s))}else if(33===s||34===s){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Y(i);var h=34===s?-1:1;if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=Math.abs(c[0].offsetLeft)-.9*h*u.width();else var p="y",f=Math.abs(c[0].offsetTop)-.9*h*u.height();X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}else if((35===s||36===s)&&!e(document.activeElement).is(d)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=35===s?Math.abs(u.width()-c.outerWidth(!1)):0;else var p="y",f=35===s?Math.abs(u.height()-c.outerHeight(!1)):0;X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}}var i=e(this),n=i.data(a),r=n.opt,o=n.sequential,s=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),u=c.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",h=c.find("iframe"),p=["blur."+s+" keydown."+s+" keyup."+s];h.length&&h.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(p[0],function(e){t(e)})})}),l.attr("tabindex","0").bind(p[0],function(e){t(e)})},$=function(t,i,n,r,o){function s(e){var i="stepped"!==h.type,a=o?o:e?i?m/1.5:g:1e3/60,n=e?i?7.5:40:2.5,l=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],u=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],d="x"===h.dir[0]?l[1]+h.dir[1]*u[1]*n:l[0]+h.dir[1]*u[0]*n,f="x"===h.dir[0]?l[1]+h.dir[1]*parseInt(h.scrollAmount):l[0]+h.dir[1]*parseInt(h.scrollAmount),v="auto"!==h.scrollAmount?f:d,y=r?r:e?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",b=e?!0:!1;return e&&17>a&&(v="x"===h.dir[0]?l[1]:l[0]),X(t,v.toString(),{dir:h.dir[0],scrollEasing:y,dur:a,onComplete:b}),e?void(h.dir=!1):(clearTimeout(h.step),void(h.step=setTimeout(function(){s()},a)))}function l(){clearTimeout(h.step),Z(h,"step"),Y(t)}var c=t.data(a),d=c.opt,h=c.sequential,p=e("#mCSB_"+c.idx+"_container"),f="stepped"===h.type?!0:!1,m=d.scrollInertia<26?26:d.scrollInertia,g=d.scrollInertia<1?17:d.scrollInertia;switch(i){case"on":if(h.dir=[n===u[16]||n===u[15]||39===n||37===n?"x":"y",n===u[13]||n===u[15]||38===n||37===n?-1:1],Y(t),te(n)&&"stepped"===h.type)return;s(f);break;case"off":l(),(f||c.tweenRunning&&h.dir)&&s(!0)}},z=function(t){var i=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===i.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===i.axis?null:t,n[1]=t.x?t.x:t.y||"y"===i.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},N=function(t,i){if(null!=t&&"undefined"!=typeof t){var n=e(this),r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx+"_container"),l=s.parent(),c=typeof t;i||(i="x"===o.axis?"x":"y");var u="x"===i?s.outerWidth(!1):s.outerHeight(!1),h="x"===i?s[0].offsetLeft:s[0].offsetTop,p="x"===i?"left":"top";switch(c){case"function":return t();case"object":var f=t.jquery?t:e(t);if(!f.length)return;return"x"===i?ie(f)[1]:ie(f)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(u*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(h-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var m=h+parseInt(t.split("+=")[1]);return m>=0?0:Math.abs(m)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(l.height()-s.outerHeight(!1));if("right"===t)return Math.abs(l.width()-s.outerWidth(!1));if("first"===t||"last"===t){var f=s.find(":"+t);return"x"===i?ie(f)[1]:ie(f)[0]}return e(t).length?"x"===i?ie(e(t))[1]:ie(e(t))[0]:(s.css(p,t),void d.update.call(null,n[0]))}}},U=function(t){function i(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return h.advanced.updateOnSelectorChange&&(f=o(),f!==w)?(s(3),void(w=f)):(h.advanced.updateOnContentResize&&(m=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(m[0]!==x[0]||m[1]!==x[1]||m[2]!==x[2]||m[3]!==x[3]||m[4]!==x[4]||m[5]!==x[5])&&(s(m[0]!==x[0]||m[1]!==x[1]),x=m)),h.advanced.updateOnImageLoad&&(g=n(),g!==_&&(p.find("img").each(function(){r(this)}),_=g)),void((h.advanced.updateOnSelectorChange||h.advanced.updateOnContentResize||h.advanced.updateOnImageLoad)&&i()))},60)}function n(){var e=0;return h.advanced.updateOnImageLoad&&(e=p.find("img").length),e}function r(t){function i(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(u[2]),s(2)}if(e(t).hasClass(u[2]))return void s();var n=new Image;n.onload=i(n,a),n.src=t.src}function o(){h.advanced.updateOnSelectorChange===!0&&(h.advanced.updateOnSelectorChange="*");var t=0,i=p.find(h.advanced.updateOnSelectorChange);return h.advanced.updateOnSelectorChange&&i.length>0&&i.each(function(){t+=e(this).height()+e(this).width()}),t}function s(e){clearTimeout(p[0].autoUpdate),d.update.call(null,l[0],e)}var l=e(this),c=l.data(a),h=c.opt,p=e("#mCSB_"+c.idx+"_container");if(t)return clearTimeout(p[0].autoUpdate),void Z(p[0],"autoUpdate");var f,m,g,v=p.parent(),y=[e("#mCSB_"+c.idx+"_scrollbar_vertical"),e("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[y[0].is(":visible")?y[0].outerHeight(!0):0,y[1].is(":visible")?y[1].outerWidth(!0):0]},w=o(),x=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],_=n();i()},q=function(e,t,i){return Math.round(e/t)*t-i},Y=function(t){var i=t.data(a),n=e("#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},X=function(t,i,n){function r(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function o(){return[c.callbacks.alwaysTriggerOffsets||b>=w[0]+_,c.callbacks.alwaysTriggerOffsets||-C>=b]}function s(){var e=[p[0].offsetTop,p[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[p.outerHeight(!1),p.outerWidth(!1)],r=[h.height(),h.width()];t[0].mcs={content:p,top:e[0],left:e[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-r[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-r[1])),direction:n.dir}}var l=t.data(a),c=l.opt,u={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(u,n),d=[n.dur,n.drag?0:n.dur],h=e("#mCSB_"+l.idx),p=e("#mCSB_"+l.idx+"_container"),f=p.parent(),m=c.callbacks.onTotalScrollOffset?z.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?z.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,(0!==f.scrollTop()||0!==f.scrollLeft())&&(e(".mCSB_"+l.idx+"_scrollbar").css("visibility","visible"),f.scrollTop(0).scrollLeft(0)),"_resetY"!==i||l.contentReset.y||(r("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),l.contentReset.y=1),"_resetX"!==i||l.contentReset.x||(r("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),l.contentReset.x=1),"_resetY"!==i&&"_resetX"!==i){switch(!l.contentReset.y&&t[0].mcs||!l.overflowed[0]||(r("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),l.contentReset.x=null),!l.contentReset.x&&t[0].mcs||!l.overflowed[1]||(r("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),l.contentReset.x=null),c.snapAmount&&(i=q(i,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=e("#mCSB_"+l.idx+"_dragger_horizontal"),y="left",b=p[0].offsetLeft,w=[h.width()-p.outerWidth(!1),v.parent().width()-v.width()],x=[i,0===i?0:i/l.scrollRatio.x],_=m[1],C=g[1],j=_>0?_/l.scrollRatio.x:0,k=C>0?C/l.scrollRatio.x:0;break;case"y":var v=e("#mCSB_"+l.idx+"_dragger_vertical"),y="top",b=p[0].offsetTop,w=[h.height()-p.outerHeight(!1),v.parent().height()-v.height()],x=[i,0===i?0:i/l.scrollRatio.y],_=m[0],C=g[0],j=_>0?_/l.scrollRatio.y:0,k=C>0?C/l.scrollRatio.y:0}x[1]<0||0===x[0]&&0===x[1]?x=[0,0]:x[1]>=w[1]?x=[w[0],w[1]]:x[0]=-x[0],t[0].mcs||(s(),r("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(p[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&x[0]>=0||b===w[0]&&x[0]<=w[0]))&&(V(v[0],y,Math.round(x[1]),d[1],n.scrollEasing),V(p[0],y,Math.round(x[0]),d[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(r("onScrollStart")&&(s(),c.callbacks.onScrollStart.call(t[0])),l.tweenRunning=!0,S(v),l.cbOffsets=o())},onUpdate:function(){n.callbacks&&n.onUpdate&&r("whileScrolling")&&(s(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(p[0].onCompleteTimeout);var e=p[0].idleTimer||0;p[0].onCompleteTimeout=setTimeout(function(){r("onScroll")&&(s(),c.callbacks.onScroll.call(t[0])),r("onTotalScroll")&&x[1]>=w[1]-j&&l.cbOffsets[0]&&(s(),c.callbacks.onTotalScroll.call(t[0])),r("onTotalScrollBack")&&x[1]<=k&&l.cbOffsets[1]&&(s(),c.callbacks.onTotalScrollBack.call(t[0])),l.tweenRunning=!1,p[0].idleTimer=0,S(v,"hide")},e)}}}))}},V=function(e,t,i,a,n,r,o){function s(){x.stop||(y||f.call(),y=G()-v,l(),y>=x.time&&(x.time=y>x.time?y+h-(y-x.time):y+h-1,x.time<y+1&&(x.time=y+1)),x.time<a?x.id=p(s):g.call())}function l(){a>0?(x.currVal=d(x.time,b,_,a,n),w[t]=Math.round(x.currVal)+"px"):w[t]=i+"px",m.call()}function c(){h=1e3/60,x.time=y+h,p=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return l(),setTimeout(e,.01)},x.id=p(s)}function u(){null!=x.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(x.id):clearTimeout(x.id),x.id=null)}function d(e,t,i,a,n){switch(n){case"linear":case"mcsLinear":return i*e/a+t;case"mcsLinearOut":return e/=a,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var r=(e/=a)*e,o=r*e;return t+i*(.499999999999997*o*r+-2.5*r*r+5.5*o+-6.5*r+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var h,p,o=o||{},f=o.onStart||function(){},m=o.onUpdate||function(){},g=o.onComplete||function(){},v=G(),y=0,b=e.offsetTop,w=e.style,x=e._mTween[t];"left"===t&&(b=e.offsetLeft);var _=i-b;x.stop=0,"none"!==r&&u(),c()},G=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],i=0;i<t.length;i++){var a=t[i];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(i){e[t]=null}},J=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ie=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]};e.fn[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i].defaults=r,window[i]=!0,e(window).load(function(){e(n)[i](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var i,a,n=e(t),r=n.parents(".mCSB_container");return r.length?(i=r.parent(),a=[r[0].offsetTop,r[0].offsetLeft],a[0]+ie(n)[0]>=0&&a[0]+ie(n)[0]<i.height()-n.outerHeight(!1)&&a[1]+ie(n)[1]>=0&&a[1]+ie(n)[1]<i.width()-n.outerWidth(!1)):void 0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var i=e(t).data(a);return i?i.overflowed[0]||i.overflowed[1]:void 0}})})})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";var t=e(window),i=e(document),a=window.location,n=!0,r=!1,o=null,s=NaN,l=1/0,c="undefined",u="directive",d=".cropper",h=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,p=/^(x|y|width|height)$/,f=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,m="cropper-modal",g="cropper-hidden",v="cropper-invisible",y="cropper-move",b="cropper-crop",w="cropper-disabled",x="mousedown touchstart",_="mousemove touchmove",C="mouseup mouseleave touchend touchleave touchcancel",S="wheel mousewheel DOMMouseScroll",j="resize"+d,k="dblclick",Q="build"+d,T="built"+d,D="dragstart"+d,O="dragmove"+d,E="dragend"+d,I=function(e){return"number"==typeof e},M=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=M(arguments,2);return function(){return e.apply(t,i.concat(M(arguments)))}},P=function(t,i){this.element=t,this.$element=e(t),this.defaults=e.extend({},P.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=o,this.ready=r,this.built=r,this.cropped=r,this.rotated=r,this.disabled=r,this.replaced=r,this.init()},R=Math.sqrt,H=Math.min,F=Math.max,L=Math.abs,B=Math.sin,W=Math.cos,$=parseFloat;P.prototype={constructor:P,support:{canvas:e.isFunction(e("<canvas>")[0].getContext)},init:function(){var t=this.defaults;e.each(t,function(e,i){switch(e){case"aspectRatio":t[e]=L($(i))||s;break;case"autoCropArea":t[e]=L($(i))||.8;break;case"minWidth":case"minHeight":t[e]=L($(i))||0;break;case"maxWidth":case"maxHeight":t[e]=L($(i))||l}}),this.image={rotate:0},this.load()},load:function(){var t,i,a=this,r=this.$element,o=this.element,s=this.image,l="";r.is("img")?i=r.prop("src"):r.is("canvas")&&this.support.canvas&&(i=o.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(r.prop("crossOrigin")||this.isCrossOriginURL(i))&&(l=" crossOrigin"),this.$clone=t=e("<img"+l+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,a.url=i,a.ready=n,a.build()}),t.addClass(v).prependTo("body"))},isCrossOriginURL:function(e){var t=e.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===a.protocol&&t[2]===a.hostname&&t[3]===a.port?r:n},build:function(){var t,i,a=this.$element,o=this.defaults;this.ready&&(this.built&&this.unbuild(),a.one(Q,o.build),t=e.Event(Q),a.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=e(P.TEMPLATE),a.addClass(g),this.$clone.removeClass(v).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(g).prependTo(this.$cropper),this.originalImage=e.extend({},this.image)),this.$container=a.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),o.autoCrop?this.cropped=n:this.$dragger.addClass(g),o.dragCrop&&this.setDragMode("crop"),o.modal&&this.$canvas.addClass(m),!o.dashed&&this.$dragger.find(".cropper-dashed").addClass(g),!o.movable&&this.$dragger.find(".cropper-face").data(u,"move"),!o.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(g),
7
- this.addListeners(),this.initPreview(),this.built=n,this.update(),this.replaced=r,a.one(T,o.built),a.trigger(T)))},unbuild:function(){this.built&&(this.built=r,this.removeListeners(),this.$preview.empty(),this.$preview=o,this.$dragger=o,this.$canvas=o,this.$container=o,this.$cropper.remove(),this.$cropper=o)},update:function(e){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),e?(this.setData(e,n),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(e.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,i=this.dragger,a=t.width,n=t.height,r=i.left-t.left,o=i.top-t.top;this.$viewer.find("img").css({width:a,height:n,marginLeft:-r,marginTop:-o}),this.$preview.each(function(){var t=e(this),s=t.width()/i.width;t.find("img").css({width:a*s,height:n*s,marginLeft:-r*s,marginTop:-o*s})})},addListeners:function(){var a=this.defaults;this.$element.on(D,a.dragstart).on(O,a.dragmove).on(E,a.dragend),this.$cropper.on(x,e.proxy(this.dragstart,this)).on(k,e.proxy(this.dblclick,this)),a.zoomable&&this.$cropper.on(S,e.proxy(this.wheel,this)),a.multiple?this.$cropper.on(_,e.proxy(this.dragmove,this)).on(C,e.proxy(this.dragend,this)):i.on(_,this._dragmove=A(this.dragmove,this)).on(C,this._dragend=A(this.dragend,this)),t.on(j,this._resize=A(this.resize,this))},removeListeners:function(){var e=this.defaults;this.$element.off(D,e.dragstart).off(O,e.dragmove).off(E,e.dragend),this.$cropper.off(x,this.dragstart).off(k,this.dblclick),e.zoomable&&this.$cropper.off(S,this.wheel),e.multiple?this.$cropper.off(_,this.dragmove).off(C,this.dragend):i.off(_,this._dragmove).off(C,this._dragend),t.off(j,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=e(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var e=this.$container;e!==o&&(this.container={width:F(e.width(),300),height:F(e.height(),150)})},initCropper:function(){var e,t=this.container,i=this.image;i.naturalWidth*t.height/i.naturalHeight-t.width>=0?(e={width:t.width,height:t.width/i.aspectRatio,left:0},e.top=(t.height-e.height)/2):(e={width:t.height*i.aspectRatio,height:t.height,top:0},e.left=(t.width-e.width)/2),this.$cropper.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.cropper=e},initImage:function(){var t=this.image,i=this.cropper,a={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=e.extend({},t,a),t._width!==i.width||t._height!==i.height?e.extend(t,a):(t=e.extend({},a,t),this.replaced&&(t.ratio=a.ratio)),this.image=t,this.renderImage()},renderImage:function(e){var t=this.image;"zoom"===e&&(t.left-=(t.width-t.oldWidth)/2,t.top-=(t.height-t.oldHeight)/2),t.left=H(F(t.left,t._width-t.width),0),t.top=H(F(t.top,t._height-t.height),0),this.$clone.css({width:t.width,height:t.height,marginLeft:t.left,marginTop:t.top}),e&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,a=this.cropper,n=i.aspectRatio||this.image.aspectRatio,r=this.image.ratio;t=a.height*n-a.width>=0?{height:a.width/n,width:a.width,left:0,top:(a.height-a.width/n)/2,maxWidth:a.width,maxHeight:a.width/n}:{height:a.height,width:a.height*n,left:(a.width-a.height*n)/2,top:0,maxWidth:a.height*n,maxHeight:a.height},t.minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=t.maxWidth/n):isFinite(i.maxHeight)&&(t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.maxWidth=t.maxHeight*n),i.minWidth>0?(t.minWidth=F(0,i.minWidth*r),t.minHeight=t.minWidth/n):i.minHeight>0&&(t.minHeight=F(0,i.minHeight*r),t.minWidth=t.minHeight*n)):(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.minWidth=F(0,i.minWidth*r),t.minHeight=F(0,i.minHeight*r)),t.minWidth=H(t.maxWidth,t.minWidth),t.minHeight=H(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(a.width-t.width)/2,t.top=(a.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=e.extend({},t)},renderDragger:function(){var e=this.dragger,t=this.cropper;e.width>e.maxWidth?(e.width=e.maxWidth,e.left=e.oldLeft):e.width<e.minWidth&&(e.width=e.minWidth,e.left=e.oldLeft),e.height>e.maxHeight?(e.height=e.maxHeight,e.top=e.oldTop):e.height<e.minHeight&&(e.height=e.minHeight,e.top=e.oldTop),e.left=H(F(e.left,0),t.width-e.width),e.top=H(F(e.top,0),t.height-e.height),e.oldLeft=e.left,e.oldTop=e.top,this.dragger=e,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=e.extend({},this.defaultImage),this.renderImage(),this.dragger=e.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=r,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(m),this.$dragger.addClass(g))},destroy:function(){var e=this.$element;this.ready&&(this.unbuild(),e.removeClass(g).removeData("cropper"),this.rotated&&e.attr("src",this.$original.attr("src")))},replace:function(t,i){var a,o=this,s=this.$element,l=this.element;t&&t!==this.url&&t!==s.attr("src")&&(i||(this.rotated=r,this.replaced=n),s.is("img")?(s.attr("src",t),this.load()):s.is("canvas")&&this.support.canvas&&(a=l.getContext("2d"),e('<img src="'+t+'">').one("load",function(){l.width=this.width,l.height=this.height,a.clearRect(0,0,l.width,l.height),a.drawImage(this,0,0),o.load()})))},setData:function(t,i){var a=this.cropper,n=this.dragger,r=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==c&&((t===o||e.isEmptyObject(t))&&(n=e.extend({},this.defaultDragger)),e.isPlainObject(t)&&!e.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),I(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),I(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height))),this.dragger=n,this.renderDragger())},getData:function(e){var t=this.dragger,i=this.image,a={};return this.built&&(a={x:t.left-i.left,y:t.top-i.top,width:t.width,height:t.height},a=this.transformData(a,n,e)),a},transformData:function(t,i,a){var n=this.image.ratio,r={};return e.each(t,function(e,t){t=$(t),p.test(e)&&!isNaN(t)&&(r[e]=i?a?Math.round(t/n):t/n:t*n)}),r},setAspectRatio:function(e){var t="auto"===e;e=$(e),(t||!isNaN(e)&&e>0)&&(this.defaults.aspectRatio=t?s:e,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var t={};return this.ready&&e.each(this.image,function(e,i){f.test(e)&&(t[e]=i)}),t},getDataURL:function(t,i,a){var n,r=e("<canvas>")[0],o=this.getData(),s="";return e.isPlainObject(t)||(a=i,i=t,t={}),t=e.extend({width:o.width,height:o.height},t),this.cropped&&this.support.canvas&&(r.width=t.width,r.height=t.height,n=r.getContext("2d"),"image/jpeg"===i&&(n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height)),n.drawImage(this.$clone[0],o.x,o.y,o.width,o.height,0,0,t.width,t.height),s=r.toDataURL(i,a)),s},setDragMode:function(e){var t=this.$canvas,i=this.defaults,a=r,o=r;if(this.built&&!this.disabled){switch(e){case"crop":i.dragCrop&&(a=n,t.data(u,e));break;case"move":o=n,t.data(u,e);break;default:t.removeData(u)}t.toggleClass(b,a).toggleClass(y,o)}},enable:function(){this.built&&(this.disabled=r,this.$cropper.removeClass(w))},disable:function(){this.built&&(this.disabled=n,this.$cropper.addClass(w))},rotate:function(e){var t=this.image;e=$(e)||0,this.built&&0!==e&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=n,e=t.rotate=(t.rotate+e)%360,this.replace(this.getRotatedDataURL(e),!0))},getRotatedDataURL:function(t){var i=e("<canvas>")[0],a=i.getContext("2d"),n=t*Math.PI/180,r=L(t)%180,o=r>90?180-r:r,s=o*Math.PI/180,l=this.originalImage,c=l.naturalWidth,u=l.naturalHeight,d=L(c*W(s)+u*B(s)),h=L(c*B(s)+u*W(s));return i.width=d,i.height=h,a.save(),a.translate(d/2,h/2),a.rotate(n),a.drawImage(this.$original[0],-c/2,-u/2,c,u),a.restore(),i.toDataURL()},zoom:function(e){var t,i,a,n=this.image;e=$(e),this.built&&e&&!this.disabled&&this.defaults.zoomable&&(t=n.width*(1+e),i=n.height*(1+e),a=t/n._width,a>10||(1>a&&(t=n._width,i=n._height),1>=a?this.setDragMode("crop"):this.setDragMode("move"),n.oldWidth=n.width,n.oldHeight=n.height,n.width=t,n.height=i,n.ratio=n.width/n.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(b)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(e){var t,i=e.originalEvent,a=117.25,n=5,r=166.66665649414062,o=.1;this.disabled||(e.preventDefault(),i.deltaY?(t=i.deltaY,t=t%n===0?t/n:t%a===0?t/a:t/r):t=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(t*o))},dragstart:function(t){var i,a,o,s=t.originalEvent.touches,l=t;if(!this.disabled){if(s){if(o=s.length,o>1){if(!this.defaults.zoomable||2!==o)return;l=s[1],this.startX2=l.pageX,this.startY2=l.pageY,i="zoom"}l=s[0]}if(i=i||e(l.target).data(u),h.test(i)){if(t.preventDefault(),a=e.Event(D),this.$element.trigger(a),a.isDefaultPrevented())return;this.directive=i,this.cropping=r,this.startX=l.pageX,this.startY=l.pageY,"crop"===i&&(this.cropping=n,this.$canvas.addClass(m))}}},dragmove:function(t){var i,a,n=t.originalEvent.touches,r=t;if(!this.disabled){if(n){if(a=n.length,a>1){if(!this.defaults.zoomable||2!==a)return;r=n[1],this.endX2=r.pageX,this.endY2=r.pageY}r=n[0]}if(this.directive){if(t.preventDefault(),i=e.Event(O),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=r.pageX,this.endY=r.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=e.Event(E),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=r,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var e,t=this.directive,i=this.image,a=this.cropper,o=a.width,s=a.height,l=this.dragger,c=l.width,u=l.height,d=l.left,h=l.top,p=d+c,f=h+u,m=n,v=this.defaults,y=v.aspectRatio,b={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&(b.X=b.y*y,b.Y=b.x/y),t){case"all":d+=b.x,h+=b.y;break;case"e":if(b.x>=0&&(p>=o||y&&(0>=h||f>=s))){m=r;break}c+=b.x,y&&(u=c/y,h-=b.Y/2),0>c&&(t="w",c=0);break;case"n":if(b.y<=0&&(0>=h||y&&(0>=d||p>=o))){m=r;break}u-=b.y,h+=b.y,y&&(c=u*y,d+=b.X/2),0>u&&(t="s",u=0);break;case"w":if(b.x<=0&&(0>=d||y&&(0>=h||f>=s))){m=r;break}c-=b.x,d+=b.x,y&&(u=c/y,h+=b.Y/2),0>c&&(t="e",c=0);break;case"s":if(b.y>=0&&(f>=s||y&&(0>=d||p>=o))){m=r;break}u+=b.y,y&&(c=u*y,d-=b.X/2),0>u&&(t="n",u=0);break;case"ne":if(y){if(b.y<=0&&(0>=h||p>=o)){m=r;break}u-=b.y,h+=b.y,c=u*y}else b.x>=0?o>p?c+=b.x:b.y<=0&&0>=h&&(m=r):c+=b.x,b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="sw",u=0,c=0);break;case"nw":if(y){if(b.y<=0&&(0>=h||0>=d)){m=r;break}u-=b.y,h+=b.y,c=u*y,d+=b.X}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y<=0&&0>=h&&(m=r):(c-=b.x,d+=b.x),b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="se",u=0,c=0);break;case"sw":if(y){if(b.x<=0&&(0>=d||f>=s)){m=r;break}c-=b.x,d+=b.x,u=c/y}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y>=0&&f>=s&&(m=r):(c-=b.x,d+=b.x),b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="ne",u=0,c=0);break;case"se":if(y){if(b.x>=0&&(p>=o||f>=s)){m=r;break}c+=b.x,u=c/y}else b.x>=0?o>p?c+=b.x:b.y>=0&&f>=s&&(m=r):c+=b.x,b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="nw",u=0,c=0);break;case"move":i.left+=b.x,i.top+=b.y,this.renderImage("move"),m=r;break;case"zoom":v.zoomable&&(this.zoom(function(e,t,i,a,n,r){return(R(n*n+r*r)-R(i*i+a*a))/R(e*e+t*t)}(i.width,i.height,L(this.startX-this.startX2),L(this.startY-this.startY2),L(this.endX-this.endX2),L(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":b.x&&b.y&&(e=this.$cropper.offset(),d=this.startX-e.left,h=this.startY-e.top,c=l.minWidth,u=l.minHeight,b.x>0?b.y>0?t="se":(t="ne",h-=u):b.y>0?(t="sw",d-=c):(t="nw",d-=c,h-=u),this.cropped||(this.cropped=n,this.$dragger.removeClass(g)))}m&&(l.width=c,l.height=u,l.left=d,l.top=h,this.directive=t,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},P.TEMPLATE=function(e,t){return t=t.split(","),e.replace(/\d+/g,function(e){return t[e]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),P.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:e.noop,preview:"",multiple:r,autoCrop:n,dragCrop:n,dashed:n,modal:n,movable:n,resizable:n,zoomable:n,rotatable:n,checkImageOrigin:n,minWidth:0,minHeight:0,maxWidth:l,maxHeight:l,build:o,built:o,dragstart:o,dragmove:o,dragend:o},P.setDefaults=function(t){e.extend(P.DEFAULTS,t)},P.other=e.fn.cropper,e.fn.cropper=function(t){var i,a=M(arguments,1);return this.each(function(){var n,r=e(this),o=r.data("cropper");o||r.data("cropper",o=new P(this,t)),"string"==typeof t&&e.isFunction(n=o[t])&&(i=n.apply(o,a))}),typeof i!==c?i:this},e.fn.cropper.Constructor=P,e.fn.cropper.setDefaults=P.setDefaults,e.fn.cropper.noConflict=function(){return e.fn.cropper=P.other,this}}),function(e){function t(e,t){return"function"==typeof e?e.call(t):e}function i(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}function a(t,i){this.$element=e(t),this.options=i,this.enabled=!0,this.fixTitle()}a.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var a=this.tip();a.find(".tipsy-inner")[this.options.html?"html":"text"](i),a[0].className="tipsy",a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,r=e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=a[0].offsetWidth,s=a[0].offsetHeight,l=t(this.options.gravity,this.$element[0]);switch(l.charAt(0)){case"n":n={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-o/2};break;case"s":n={top:r.top-s-this.options.offset,left:r.left+r.width/2-o/2};break;case"e":n={top:r.top+r.height/2-s/2,left:r.left-o-this.options.offset};break;case"w":extra_gap=0,e("body").css("position").length>0&&"relative"==e("body").css("position")&&e("#wpadminbar").length&&(extra_gap=e("#wpadminbar").height()),n={top:r.top+r.height/2-s/2-extra_gap,left:r.left+r.width+this.options.offset}}2==l.length&&("w"==l.charAt(1)?n.left=r.left+r.width/2-15:n.left=r.left+r.width/2-o+15),a.css(n).addClass("tipsy-"+l),a.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+l.charAt(0),this.options.className&&a.addClass(t(this.options.className,this.$element[0])),this.options.fade?a.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):a.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){e(this).remove()}):this.tip().remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("original-title"))&&e.attr("original-title",e.attr("title")||"").removeAttr("title")},getTitle:function(){var e,t=this.$element,i=this.options;this.fixTitle();var e,i=this.options;return"string"==typeof i.title?e=t.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(e=i.title.call(t[0])),e=(""+e).replace(/(^\s*|\s*$)/,""),e||i.fallback},tip:function(){return this.$tip||(this.$tip=e('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},e.fn.tipsy=function(t){function i(i){var n=e.data(i,"tipsy");return n||(n=new a(i,e.fn.tipsy.elementOptions(i,t)),e.data(i,"tipsy",n)),n}function n(){var e=i(this);e.hoverState="in",0==t.delayIn?e.show():(e.fixTitle(),setTimeout(function(){"in"==e.hoverState&&e.show()},t.delayIn))}function r(){var e=i(this);e.hoverState="out",0==t.delayOut?e.hide():setTimeout(function(){"out"==e.hoverState&&e.hide()},t.delayOut)}if(t===!0)return this.data("tipsy");if("string"==typeof t){var o=this.data("tipsy");return o&&o[t](),this}if(t=e.extend({},e.fn.tipsy.defaults,t),t.live||this.each(function(){i(this)}),"manual"!=t.trigger){var s="hover"==t.trigger?"mouseenter":"focus",l="hover"==t.trigger?"mouseleave":"blur";t.live?e(document).on(s,this.selector,n).on(l,this.selector,r):this.bind(s,n).bind(l,r)}return this},e.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},e.fn.tipsy.revalidate=function(){e(".tipsy").each(function(){var t=e.data(this,"tipsy-pointee");t&&i(t)||e(this).remove()})},e.fn.tipsy.elementOptions=function(t,i){return e.metadata?e.extend({},i,e(t).metadata()):i},e.fn.tipsy.autoNS=function(){return e(this).offset().top>e(document).scrollTop()+e(window).height()/2?"s":"n"},e.fn.tipsy.autoWE=function(){return e(this).offset().left>e(document).scrollLeft()+e(window).width()/2?"e":"w"},e.fn.tipsy.autoBounds=function(t,i){return function(){var a={ns:i[0],ew:i.length>1?i[1]:!1},n=e(document).scrollTop()+t,r=e(document).scrollLeft()+t,o=e(this);return o.offset().top<n&&(a.ns="n"),o.offset().left<r&&(a.ew="w"),e(window).width()+e(document).scrollLeft()-o.offset().left<t&&(a.ew="e"),e(window).height()+e(document).scrollTop()-o.offset().top<t&&(a.ns="s"),a.ns+(a.ew?a.ew:"")}}}(jQuery);var live_field,live_value,xhrValidateUsername=!1;jQuery(document).ready(function(){2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()}),jQuery(function(){jQuery(".um-search form *").keypress(function(e){return 13==e.which?(jQuery(".um-search form").submit(),!1):void 0}),jQuery(document).on("touchend",function(){jQuery(".select2-search, .select2-focusser").remove()})}),jQuery(window).load(function(){um_responsive(),um_modal_responsive()}),jQuery(window).resize(function(){responsive_Modal(),jQuery("img.cropper-hidden").cropper("destroy"),um_responsive(),um_modal_responsive()}),jQuery(document).ready(function(){jQuery(document).on("input change",".um-field input[type=text]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),um_conditional()}),jQuery(".um-field input[type=text]").trigger("input"),jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),jQuery(this).is(":checkbox")&&(jQuery(this).parents(".um-field").find("input:checked").length>1?(live_value="",jQuery(this).parents(".um-field").find("input:checked").each(function(){live_value=live_value+jQuery(this).val()+" "})):live_value=jQuery(this).parents(".um-field").find("input:checked").val()),jQuery(this).is(":radio")&&(live_value=jQuery(this).parents(".um-field").find("input[type=radio]:checked").val()),um_conditional()}),jQuery(".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]").trigger("change")}),jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeClass().addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeClass().addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){var e=(jQuery(this).parents(".um-field-area"),jQuery(this).parents("label"));e.hasClass("active")?(e.removeClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else var e=!1;var t=elem.attr("data-years"),i=elem.attr("data-date_min"),a=elem.attr("data-date_max"),n=i.split(","),r=a.split(","),o=n.length?new Date(n):null,s=n.length?new Date(r):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var l=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(l))}if(s&&"Invalid Date"==s.toString()&&3==r.length){var c=r[1]+"/"+r[2]+"/"+r[0];s=new Date(Date.parse(c))}elem.pickadate({selectYears:t,min:o,max:s,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(".um-s1").select2({allowClear:!0,minimumResultsForSearch:10}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),t>0&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),i=t.data("max_entries");return t.find(".um-field-group-body").length>1?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),i>0&&t.find(".um-field-group-body").length<i&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this).parent();t.addClass("loading");var i=jQuery(this).data("args"),a=jQuery(this).data("hook"),n=jQuery(this).parents(".um").find(".um-ajax-items");return jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_ajax_paginate",hook:a,args:i},complete:function(){t.removeClass("loading")},success:function(e){t.remove(),n.append(e)}}),!1}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),i=jQuery(this).data("user_id"),a=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_muted_action",hook:t,user_id:i,arguments:a},success:function(e){}}),!1})}),jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-more").hide(),t.find(".um-member-meta").slideDown(function(){UM_Member_Grid(i)}),t.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(i)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-less").hide(),t.find(".um-member-meta").slideUp(function(){t.find(".um-member-more").fadeIn(),UM_Member_Grid(i)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").submit(),!1})}),jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),5>t?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_profile_photo",metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_cover_photo",metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e)}),jQuery(document).ready(function(){var e=jQuery(".um-account-main").attr("data-current_tab");e&&jQuery(".um-account-tab[data-tab="+e+"]").show(),jQuery(document).on("click",".um-account-side li a",function(e){e.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var i=jQuery(this).attr("href"),a=jQuery(this).attr("data-tab");return window.history.pushState("","",i),jQuery(".um-account-tab").hide(),jQuery(".um-account-tab[data-tab="+a+"]").fadeIn(),jQuery(".um-account-nav a").removeClass("current"),jQuery(".um-account-nav a[data-tab="+a+"]").addClass("current"),!1}),jQuery(document).on("click",".um-account-nav a",function(e){e.preventDefault();var t=jQuery(this).attr("data-tab"),i=jQuery(this).parents("div"),a=jQuery(this);return jQuery(".um-account-tab").hide(),a.hasClass("current")?(i.next(".um-account-tab").slideUp(),a.removeClass("current")):(i.next(".um-account-tab").slideDown(),a.parents("div").find("a").removeClass("current"),a.addClass("current")),jQuery(".um-account-side li a").removeClass("current"),jQuery(".um-account-side li a[data-tab="+t+"]").addClass("current"),!1})});
4
  var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();i.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),function(e){void 0==e.fn.ajaxForm;var t={};t.fileapi=void 0!==e("<input type='file'/>").get(0).files,t.formdata=void 0!==window.FormData,e.fn.uploadFile=function(i){function a(){h.afterUploadAll&&!g&&(g=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(h.afterUploadAll(f),g=!1):window.setTimeout(e,100)}())}function n(t,i,a){a.on("dragenter",function(t){t.stopPropagation(),t.preventDefault(),e(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(a){e(this).css("border","2px dashed #ddd"),a.preventDefault(),t.errorLog.html("");var n=a.originalEvent.dataTransfer.files;return!i.multiple&&n.length>1?void(i.showError&&e("<div class='um-error-block'>"+i.multiDragErrorStr+"</div>").appendTo(t.errorLog)):void(0!=i.onSelect(n)&&o(i,t,n))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}function r(t){var i=[];i="string"==jQuery.type(t)?t.split("&"):e.param(t).split("&");var a,n,r=i.length,o=[];for(a=0;r>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),o.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return o}function o(t,i,a){for(var n=0;n<a.length;n++)if(s(i,t,a[n].name))if(-1!=t.maxFileSize&&a[n].size>t.maxFileSize)t.showError&&e("<div class='um-error-block'>"+t.sizeErrorStr+"</div>").appendTo(i.errorLog);else if(-1!=t.maxFileCount&&i.selectedFiles>=t.maxFileCount)t.showError&&e("<div class='um-error-block'>"+t.maxFileCountErrorStr+"</div>").appendTo(i.errorLog);else{i.selectedFiles++;var o=t,l=new FormData,c=t.fileName.replace("[]","");l.append(c,a[n]);var h=t.formData;if(h)for(var p=r(h),f=0;f<p.length;f++)p[f]&&l.append(p[f][0],p[f][1]);o.fileData=l;var m=new u(i,t),g="";g=t.showFileCounter?i.fileCounter+t.fileCounterStyle+a[n].name:a[n].name,m.filename.html(g);var v=e("<form style='display:block; position:absolute;left: 150px;' class='"+i.formGroup+"' method='"+t.method+"' action='"+t.url+"' enctype='"+t.enctype+"'></form>");v.appendTo("body");var y=[];y.push(a[n].name),d(v,o,m,y,i),i.fileCounter++}else t.showError&&e("<div class='um-error-block'>"+t.extErrorStr+"</div>").appendTo(i.errorLog)}function s(e,t,i){var a=t.allowedTypes.toLowerCase().split(","),n=i.split(".").pop().toLowerCase();return"*"!=t.allowedTypes&&jQuery.inArray(n,a)<0?!1:!0}function l(t,i){if(t.showFileCounter){var a=e(".upload-filename").length;i.fileCounter=a+1,e(".upload-filename").each(function(i,n){var r=e(this).html().split(t.fileCounterStyle),o=(parseInt(r[0])-1,a+t.fileCounterStyle+r[1]);e(this).html(o),a--})}}function c(i,a,n,r){var h="ajax-upload-id-"+(new Date).getTime(),p=e("<form method='"+n.method+"' action='"+n.url+"' enctype='"+n.enctype+"'></form>"),f="<input type='file' id='"+h+"' name='"+n.fileName+"'/>";n.multiple&&(n.fileName.indexOf("[]")!=n.fileName.length-2&&(n.fileName+="[]"),f="<input type='file' id='"+h+"' name='"+n.fileName+"' multiple/>");var m=e(f).appendTo(p);m.change(function(){i.errorLog.html("");var h=(n.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(y=0;y<this.files.length;y++)h.push(this.files[y].name);if(0==n.onSelect(this.files))return}else{var f=e(this).val(),m=[];if(h.push(f),!s(i,n,f))return void(n.showError&&e("<div class='um-error-block'>"+n.extErrorStr+"</div>").appendTo(i.errorLog));if(m.push({name:f,size:"NA"}),0==n.onSelect(m))return}if(l(n,i),r.unbind("click"),p.hide(),c(i,a,n,r),p.addClass(a),t.fileapi&&t.formdata){p.removeClass(a);var g=this.files;o(n,i,g)}else{for(var v="",y=0;y<h.length;y++)v+=n.showFileCounter?i.fileCounter+n.fileCounterStyle+h[y]+"<br>":h[y]+"<br>",i.fileCounter++;if(-1!=n.maxFileCount&&i.selectedFiles+h.length>n.maxFileCount)return void(n.showError&&e("<div class='um-error-block'>"+n.maxFileCountErrorStr+"</div>").appendTo(i.errorLog));i.selectedFiles+=h.length;var b=new u(i,n);b.filename.html(v),d(p,n,b,h,i)}}),p.css({margin:0,padding:0});var g=e(r).width()+10;10==g&&(g=120);var v=r.height()+10;10==v&&(v=35),r.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),p.appendTo(r)}function u(t,i){return this.statusbar=e("<div class='upload-statusbar'></div>"),this.filename=e("<div class='upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='upload-bar "+t.formGroup+"'></div>").appendTo(this.progressDiv),this.abort=e("<div class='upload-red "+t.formGroup+"'>"+i.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div class='upload-red'>"+i.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div class='upload-green'>"+i.doneStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div class='upload-red'>"+i.deletelStr+"</div>").appendTo(this.statusbar).hide(),t.errorLog.after(this.statusbar),this}function d(e,i,n,o,s){var c={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:i.formData,formData:i.fileData,dataType:i.returnType,beforeSubmit:function(t,l,c){if(0!=i.onSubmit.call(this,o)){var u=i.dynamicFormData();if(u){var d=r(u);if(d)for(var h=0;h<d.length;h++)d[h]&&(void 0!=i.fileData?c.formData.append(d[h][0],d[h][1]):c.data[d[h][0]]=d[h][1])}return s.tCounter+=o.length,a(),!0}return n.statusbar.append("<div class='um-error-block'>"+i.uploadErrorStr+"</div>"),n.cancel.show(),e.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,a){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),i.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),s.selectedFiles-=o.length})),t.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,t,a,r){r>98&&(r=98);var o=r+"%";r>1&&n.progressbar.width(o),i.showProgress&&(n.progressbar.html(o),n.progressbar.css("text-align","center"))},success:function(t,a,r){s.responses.push(t),n.progressbar.width("100%"),i.showProgress&&(n.progressbar.html("100%"),n.progressbar.css("text-align","center")),n.abort.hide(),i.onSuccess.call(this,o,t,r),i.showStatusAfterSuccess?(i.showDone?(n.done.show(),n.done.click(function(){n.statusbar.hide("slow"),n.statusbar.remove()})):n.done.hide(),i.showDelete?(n.del.show(),n.del.click(function(){n.statusbar.hide().remove(),i.deleteCallback&&i.deleteCallback.call(this,t,n),s.selectedFiles-=o.length,l(i,s)})):n.del.hide()):(n.statusbar.hide("slow"),n.statusbar.remove()),e.remove(),s.sCounter+=o.length},error:function(t,a,r){n.abort.hide(),"abort"==t.statusText?(n.statusbar.hide("slow").remove(),l(i,s)):(i.onError.call(this,o,a,r),i.showStatusAfterError?(n.progressDiv.hide(),n.statusbar.append("<span class='um-error-block'>ERROR: "+r+"</span>")):(n.statusbar.hide(),n.statusbar.remove()),s.selectedFiles-=o.length),e.remove(),s.fCounter+=o.length}};i.autoSubmit?e.ajaxSubmit(c):(i.showCancel&&(n.cancel.show(),n.cancel.click(function(){e.remove(),n.statusbar.remove(),s.selectedFiles-=o.length,l(i,s)})),e.ajaxForm(c))}var h=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,t){},onSuccess:function(e,t,i){},onError:function(e,t,i){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag &amp; Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},i);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var p="upload-"+(new Date).getTime();this.formGroup=p,this.hide(),this.errorLog=e("<div></div>"),this.after(this.errorLog),this.responses=[],t.formdata||(h.dragDrop=!1),t.formdata||(h.multiple=!1);var f=this,m=e("<div>"+e(this).html()+"</div>");e(m).addClass(h.uploadButtonClass),function v(){if(e.fn.ajaxForm){if(h.dragDrop){var t=e('<div class="ajax-upload-dragdrop" style="vertical-align:top;"></div>');e(f).before(t),e(t).append(m),e(t).prepend(e(h.dragDropStr)),n(f,h,t)}else e(f).before(m);c(f,p,h,m)}else window.setTimeout(v,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(t,i){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(t,i){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var g=!1;return this}}(jQuery),function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(r,o,l,h){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",Q.component.nodes(_.open),S.box),S.wrap),S.frame),S.holder,'tabindex="-1"')}function f(){j.data(o,Q).addClass(S.input).val(j.data("value")?Q.get("select",C.format):r.value),C.editable||j.on("focus."+_.id+" click."+_.id,function(e){e.preventDefault(),Q.open()}).on("keydown."+_.id,w),n(r,{haspopup:!0,expanded:!1,readonly:!1,owns:r.id+"_root"})}function m(){n(Q.$root[0],"hidden",!0)}function g(){Q.$holder.on({keydown:w,"focus.toOpen":b,blur:function(){j.removeClass(S.target)},focusin:function(e){Q.$root.removeClass(S.focused),e.stopPropagation()},"mousedown click":function(t){var i=t.target;i!=Q.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(i).is("input, select, textarea, button, option")||(t.preventDefault(),Q.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),i=t.data(),a=t.hasClass(S.navDisabled)||t.hasClass(S.disabled),n=s();n=n&&(n.type||n.href),(a||n&&!e.contains(Q.$root[0],n))&&Q.$holder[0].focus(),!a&&i.nav?Q.set("highlight",Q.component.item.highlight,{nav:i.nav}):!a&&"pick"in i?(Q.set("select",i.pick),C.closeOnSelect&&Q.close(!0)):i.clear?(Q.clear(),C.closeOnClear&&Q.close(!0)):i.close&&Q.close(!0)})}function v(){var t;C.hiddenName===!0?(t=r.name,r.name=""):(t=["string"==typeof C.hiddenPrefix?C.hiddenPrefix:"","string"==typeof C.hiddenSuffix?C.hiddenSuffix:"_submit"],t=t[0]+r.name+t[1]),Q._hidden=e('<input type=hidden name="'+t+'"'+(j.data("value")||r.value?' value="'+Q.get("select",C.formatSubmit)+'"':"")+">")[0],j.on("change."+_.id,function(){Q._hidden.value=r.value?Q.get("select",C.formatSubmit):""})}function y(){x&&d?Q.$holder.find("."+S.frame).one("transitionend",function(){Q.$holder[0].focus()}):Q.$holder[0].focus()}function b(e){e.stopPropagation(),j.addClass(S.target),Q.$root.addClass(S.focused),Q.open()}function w(e){var t=e.keyCode,i=/^(8|46)$/.test(t);return 27==t?(Q.close(!0),!1):void((32==t||i||!_.open&&Q.component.key[t])&&(e.preventDefault(),e.stopPropagation(),i?Q.clear().close():Q.open()))}if(!r)return t;var x=!1,_={id:r.id||"P"+Math.abs(~~(Math.random()*new Date))},C=l?e.extend(!0,{},l.defaults,h):h||{},S=e.extend({},t.klasses(),C.klass),j=e(r),k=function(){return this.start()},Q=k.prototype={constructor:k,$node:j,start:function(){return _&&_.start?Q:(_.methods={},_.start=!0,_.open=!1,_.type=r.type,r.autofocus=r==s(),r.readOnly=!C.editable,r.id=r.id||_.id,"text"!=r.type&&(r.type="text"),Q.component=new l(Q,C),Q.$root=e('<div class="'+S.picker+'" id="'+r.id+'_root" />'),m(),Q.$holder=e(p()).appendTo(Q.$root),g(),C.formatSubmit&&v(),f(),C.containerHidden?e(C.containerHidden).append(Q._hidden):j.after(Q._hidden),C.container?e(C.container).append(Q.$root):j.after(Q.$root),Q.on({start:Q.component.onStart,render:Q.component.onRender,stop:Q.component.onStop,open:Q.component.onOpen,close:Q.component.onClose,set:Q.component.onSet}).on({start:C.onStart,render:C.onRender,stop:C.onStop,open:C.onOpen,close:C.onClose,set:C.onSet}),x=i(Q.$holder[0]),r.autofocus&&Q.open(),Q.trigger("start").trigger("render"))},render:function(t){return t?(Q.$holder=e(p()),g(),Q.$root.html(Q.$holder)):Q.$root.find("."+S.box).html(Q.component.nodes(_.open)),Q.trigger("render")},stop:function(){return _.start?(Q.close(),Q._hidden&&Q._hidden.parentNode.removeChild(Q._hidden),Q.$root.remove(),j.removeClass(S.input).removeData(o),setTimeout(function(){j.off("."+_.id)},0),r.type=_.type,r.readOnly=!1,Q.trigger("stop"),_.methods={},_.start=!1,Q):Q},open:function(i){return _.open?Q:(j.addClass(S.active),n(r,"expanded",!0),setTimeout(function(){Q.$root.addClass(S.opened),n(Q.$root[0],"hidden",!1)},0),i!==!1&&(_.open=!0,x&&u.css("overflow","hidden").css("padding-right","+="+a()),y(),c.on("click."+_.id+" focusin."+_.id,function(e){var t=e.target;t!=r&&t!=document&&3!=e.which&&Q.close(t===Q.$holder[0])}).on("keydown."+_.id,function(i){var a=i.keyCode,n=Q.component.key[a],r=i.target;27==a?Q.close(!0):r!=Q.$holder[0]||!n&&13!=a?e.contains(Q.$root[0],r)&&13==a&&(i.preventDefault(),r.click()):(i.preventDefault(),n?t._.trigger(Q.component.key.go,Q,[t._.trigger(n)]):Q.$root.find("."+S.highlighted).hasClass(S.disabled)||(Q.set("select",Q.component.item.highlight),C.closeOnSelect&&Q.close(!0)))})),Q.trigger("open"))},close:function(e){return e&&(C.editable?r.focus():(Q.$holder.off("focus.toOpen").focus(),setTimeout(function(){Q.$holder.on("focus.toOpen",b)},0))),j.removeClass(S.active),n(r,"expanded",!1),setTimeout(function(){Q.$root.removeClass(S.opened+" "+S.focused),n(Q.$root[0],"hidden",!0)},0),_.open?(_.open=!1,x&&u.css("overflow","").css("padding-right","-="+a()),c.off("."+_.id),Q.trigger("close")):Q},clear:function(e){return Q.set("clear",null,e)},set:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(a=o&&e.isPlainObject(i)?i:a||{},t){o||(s[t]=i);for(n in s)r=s[n],n in Q.component.item&&(void 0===r&&(r=null),Q.component.set(n,r,a)),("select"==n||"clear"==n)&&j.val("clear"==n?"":Q.get(n,C.format)).trigger("change");Q.render()}return a.muted?Q:Q.trigger("set",s)},get:function(e,i){if(e=e||"value",null!=_[e])return _[e];if("valueSubmit"==e){if(Q._hidden)return Q._hidden.value;e="value"}if("value"==e)return r.value;if(e in Q.component.item){if("string"==typeof i){var a=Q.component.get(e);return a?t._.trigger(Q.component.formats.toString,Q.component,[i,a]):""}return Q.component.get(e)}},on:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(t){o||(s[t]=i);for(n in s)r=s[n],a&&(n="_"+n),_.methods[n]=_.methods[n]||[],_.methods[n].push(r)}return Q},off:function(){var e,t,i=arguments;for(e=0,namesCount=i.length;e<namesCount;e+=1)t=i[e],t in _.methods&&delete _.methods[t];return Q},trigger:function(e,i){var a=function(e){var a=_.methods[e];a&&a.map(function(e){t._.trigger(e,Q,[i])})};return a("_"+e),a(e),Q}};return new k}function i(e){var t,i="position";return e.currentStyle?t=e.currentStyle[i]:window.getComputedStyle&&(t=getComputedStyle(e)[i]),"fixed"==t}function a(){if(u.height()<=l.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=t[0].offsetWidth;t.css("overflow","scroll");var a=e('<div style="width:100%" />').appendTo(t),n=a[0].offsetWidth;return t.remove(),i-n}function n(t,i,a){if(e.isPlainObject(i))for(var n in i)r(t,n,i[n]);else r(t,i,a)}function r(e,t,i){e.setAttribute(("role"==t?"":"aria-")+t,i)}function o(t,i){e.isPlainObject(t)||(t={attribute:i}),i="";for(var a in t){var n=("role"==a?"":"aria-")+a,r=t[a];i+=null==r?"":n+'="'+t[a]+'"'}return i}function s(){try{return document.activeElement}catch(e){}}var l=e(window),c=e(document),u=e(document.documentElement),d=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var i,a="",n=t._.trigger(e.min,e);n<=t._.trigger(e.max,e,[n]);n+=e.i)i=t._.trigger(e.item,e,[n]),a+=t._.node(e.node,i[0],i[1],i[2]);return a},node:function(t,i,a,n){return i?(i=e.isArray(i)?i.join(""):i,a=a?' class="'+a+'"':"",n=n?" "+n:"","<"+t+a+n+">"+i+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,i){return"function"==typeof e?e.apply(t,i||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:o},t.extend=function(i,a){e.fn[i]=function(n,r){var o=this.data(i);return"picker"==n?o:o&&"string"==typeof n?t._.trigger(o[n],o,[r]):this.each(function(){var r=e(this);r.data(i)||new t(this,i,a,n)})},e.fn[i].defaults=a.defaults},t}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0],n=a.value,r=e.$node.data("value"),o=r||n,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};i.settings=t,i.$node=e.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),o?i.set("select",o,{format:s,defaultValue:!0}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=i.item.highlight,a=new Date(t.year,t.month,t.date+e);i.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var i=this.value;i&&(e.set("highlight",[e.get("view").year,i,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var i=this.value;i&&(e.set("highlight",[i,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";i.disabled(i.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,n=6,r=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",n.select,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",n.highlight,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,a){var n,o=this;return i=void 0===i?e:i,i==-(1/0)||i==1/0?n=i:t.isPlainObject(i)&&r.isInteger(i.pick)?i=i.obj:t.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=r.isDate(i)?i:o.create().obj):i=r.isInteger(i)||r.isDate(i)?o.normalize(new Date(i),a):o.now(e,i,a),{year:n||i.getFullYear(),month:n||i.getMonth(),date:n||i.getDate(),day:n||i.getDay(),obj:n||i,pick:n||i.getTime()}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=n(e)),r.isInteger(i)||(i=n(i)),r.isInteger(e)&&t.isPlainObject(i)?e=[i.year,i.month,i.date+e]:r.isInteger(i)&&t.isPlainObject(e)&&(i=[e.year,e.month,e.date+i]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t,i){return t=new Date,i&&i.rel&&t.setDate(t.getDate()+i.rel),this.normalize(t,i)},i.prototype.navigate=function(e,i,a){var n,r,o,s,l=t.isArray(i),c=t.isPlainObject(i),u=this.item.view;if(l||c){for(c?(r=i.year,o=i.month,s=i.date):(r=+i[0],o=+i[1],s=+i[2]),a&&a.nav&&u&&u.month!==o&&(r=u.year,o=u.month),n=new Date(r,o+(a&&a.nav?a.nav:0),1),r=n.getFullYear(),o=n.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;i=[r,o,s]}return i},i.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},i.prototype.measure=function(e,t){var i=this;return t?"string"==typeof t?t=i.parse(e,t):r.isInteger(t)&&(t=i.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},i.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},i.prototype.validate=function(e,i,a){var n,o,s,l,c=this,u=i,d=a&&a.interval?a.interval:1,h=-1===c.item.enable,p=c.item.min,f=c.item.max,m=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<i.pick?n=!0:a>i.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(i)||h&&c.disabled(i)&&(m||n||o)||!h&&(i.pick<=p.pick||i.pick>=f.pick)))for(h&&!m&&(!o&&d>0||!n&&0>d)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=p.pick?(s=!0,d=1,i=c.create([p.year,p.month,p.date+(i.pick===p.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return r.isInteger(a)?e.day===(i.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.parse=function(e,t,i){var a=this,n={};return t&&"string"==typeof t?(i&&i.format||(i=i||{},i.format=a.settings.format),a.formats.toArray(i.format).map(function(e){var i=a.formats[e],o=i?r.trigger(i,a,[t,n]):e.replace(/^!/,"").length;i&&(n[e]=t.substr(0,o)),t=t.substr(o)}),[n.yyyy||n.yy,+(n.mm||n.m)-1,n.dd||n.d]):t},i.prototype.formats=function(){function e(e,t,i){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return i.mm||i.m||(i.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,i){return e?t(e):this.settings.weekdaysShort[i.day]},dddd:function(e,i){return e?t(e):this.settings.weekdaysFull[i.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,i){var a=this.settings.monthsShort;return t?e(t,a,i):a[i.month]},mmmm:function(t,i){var a=this.settings.monthsFull;return t?e(t,a,i):a[i.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return r.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(e,i){var a=this;return r.isInteger(e)&&r.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(r.isDate(e)||t.isArray(e))&&(r.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isDateExact(e.from,i.from)&&a.isDateExact(e.to,i.to):!1},i.prototype.isDateOverlap=function(e,i){var a=this,n=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(i)||t.isArray(i))?(e=e%7+n,e===a.create(i).day+1):r.isInteger(i)&&(r.isDate(e)||t.isArray(e))?(i=i%7+n,i===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,o=0;o<n.length;o+=1)if(a.isDateExact(e,n[o])){i=!0;break}i||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,o=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,s,l,c;for(l=0;o>l;l+=1){if(s=n[l],a.isDateExact(s,e)){i=n[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[3]||i.push("inverted")):r.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;o>l;l+=1)if(a.isDateExact(n[l],e)){n[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.nodes=function(e){var t=this,i=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,u=o.view,d=o.disable,h=o.min,p=o.max,f=function(e,t){return i.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],i.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),m=function(e){return r.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&u.year>=p.year&&u.month>=p.month||!e&&u.year<=h.year&&u.month<=h.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(u.month==e?" selected":"")+(u.year==h.year&&e<h.month||u.year==p.year&&e>p.month?" disabled":"")]}}),i.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):r.node("div",a[u.month],i.klass.month)},v=function(){var a=u.year,n=i.selectYears===!0?5:~~(i.selectYears/2);if(n){var o=h.year,s=p.year,l=a-n,c=a+n;if(o>l&&(c+=o-l,l=o),c>s){var d=l-o,f=c-s;l-=d>f?f:d,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),i.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return r.node("div",a,i.klass.year)};return r.node("div",(i.selectYears?v()+g():g()+v())+m()+m(1),i.klass.header)+r.node("table",f+r.node("tbody",r.group({min:0,max:n-1,i:1,node:"tr",item:function(e){var n=i.firstDay&&0===t.create([u.year,u.month,1]).day?-7:0;return[r.group({min:a*e-u.day+n+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([u.year,u.month,e+(i.firstDay?1:0)]);var a=l&&l.pick==e.pick,n=c&&c.pick==e.pick,o=d&&t.disabled(e)||e.pick<h.pick||e.pick>p.pick,f=r.trigger(t.formats.toString,t,[i.format,e]);return[r.node("div",e.date,function(t){return t.push(u.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),a&&t.push(i.klass.selected),n&&t.push(i.klass.highlighted),o&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:f,selected:a&&t.$node.val()===f?!0:null,activedescendant:n?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),i.klass.footer)},i.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",i)}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0].value,n=e.$node.data("value"),r=n||a,o=n?t.formatSubmit:t.format;i.settings=t,i.$node=e.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=t.interval||30,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),r?i.set("select",r,{format:o}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(e){i.set("highlight",i.item.highlight.pick+e*i.item.interval,{interval:e*i.item.interval}),this.render()}},e.on("render",function(){var i=e.$root.children(),a=i.find("."+t.klass.viewset),n=function(e){return["webkit","moz","ms","o",""].map(function(t){
5
  return(t?"-"+t+"-":"")+e})},r=function(e,t){n("transform").map(function(i){e.css(i,t)}),n("transition").map(function(i){e.css(i,t)})};a.length&&(r(i,"none"),i[0].scrollTop=~~a.position().top-2*a[0].clientHeight,r(i,""))},1).on("open",function(){e.$root.find("button").attr("disabled",!1)},1).on("close",function(){e.$root.find("button").attr("disabled",!0)},1)}var a=24,n=60,r=12,o=a*n,s=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):"interval"==e?a.set("min",n.min,i).set("max",n.max,i):e.match(/^(flip|min|max|disable|enable)$/)&&(n.select&&a.disabled(n.select)&&a.set("select",t,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",t,i),"min"==e&&a.set("max",n.max,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,r){var l=this;return i=void 0===i?e:i,s.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),t.isPlainObject(i)&&s.isInteger(i.pick)?i=i.pick:t.isArray(i)?i=+i[0]*n+ +i[1]:s.isInteger(i)||(i=l.now(e,i,r)),"max"==e&&i<l.item.min.pick&&(i+=o),"min"!=e&&"max"!=e&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(e,i,r),{hour:~~(a+i/n)%a,mins:(n+i%n)%n,time:(o+i)%o,pick:i%o}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||s.isDate(e)?a.create(e):e};return s.isInteger(e)||(e=n(e)),s.isInteger(i)||(i=n(i)),s.isInteger(e)&&t.isPlainObject(i)?e=[i.hour,i.mins+e*a.settings.interval]:s.isInteger(i)&&t.isPlainObject(e)&&(i=[e.hour,e.mins+i*a.settings.interval]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t){var i,a=this.item.interval,r=new Date,o=r.getHours()*n+r.getMinutes(),l=s.isInteger(t);return o-=o%a,i=0>t&&-a>=a*t+o,o+="min"==e&&i?0:a,l&&(o+=a*(i&&"max"!=e?t+1:t)),o},i.prototype.normalize=function(e,t){var i=this.item.interval,a=this.item.min&&this.item.min.pick||0;return t-="min"==e?0:(t-a)%i},i.prototype.measure=function(e,i,r){var o=this;return i||(i="min"==e?[0,0]:[a-1,n-1]),"string"==typeof i?i=o.parse(e,i):i===!0||s.isInteger(i)?i=o.now(e,i,r):t.isPlainObject(i)&&s.isInteger(i.pick)&&(i=o.normalize(e,i.pick,r)),i},i.prototype.validate=function(e,t,i){var a=this,n=i&&i.interval?i.interval:a.item.interval;return a.disabled(t)&&(t=a.shift(t,n)),t=a.scope(t),a.disabled(t)&&(t=a.shift(t,-1*n)),t},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return s.isInteger(a)?e.hour==a:t.isArray(a)||s.isDate(a)?e.pick==i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[2]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.shift=function(e,t){var i=this,a=i.item.min.pick,n=i.item.max.pick;for(t=t||i.item.interval;i.disabled(e)&&(e=i.create(e.pick+=t),!(e.pick<=a||e.pick>=n)););return e},i.prototype.scope=function(e){var t=this.item.min.pick,i=this.item.max.pick;return this.create(e.pick>i?i:e.pick<t?t:e)},i.prototype.parse=function(e,t,i){var a,r,o,l,c,u=this,d={};if(!t||"string"!=typeof t)return t;i&&i.format||(i=i||{},i.format=u.settings.format),u.formats.toArray(i.format).map(function(e){var i,a=u.formats[e],n=a?s.trigger(a,u,[t,d]):e.replace(/^!/,"").length;a&&(i=t.substr(0,n),d[e]=i.match(/^\d+$/)?+i:i),t=t.substr(n)});for(l in d)c=d[l],s.isInteger(c)?l.match(/^(h|hh)$/i)?(a=c,("h"==l||"hh"==l)&&(a%=12)):"i"==l&&(r=c):l.match(/^a$/i)&&c.match(/^p/i)&&("h"in d||"hh"in d)&&(o=!0);return(o?a+12:a)*n+r},i.prototype.formats={h:function(e,t){return e?s.digits(e):t.hour%r||r},hh:function(e,t){return e?2:s.lead(t.hour%r||r)},H:function(e,t){return e?s.digits(e):""+t.hour%24},HH:function(e,t){return e?s.digits(e):s.lead(t.hour%24)},i:function(e,t){return e?2:s.lead(t.mins)},a:function(e,t){return e?4:o/2>t.time%o?"a.m.":"p.m."},A:function(e,t){return e?2:o/2>t.time%o?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return s.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(e,i){var a=this;return s.isInteger(e)&&s.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(s.isDate(e)||t.isArray(e))&&(s.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isTimeExact(e.from,i.from)&&a.isTimeExact(e.to,i.to):!1},i.prototype.isTimeOverlap=function(e,i){var a=this;return s.isInteger(e)&&(s.isDate(i)||t.isArray(i))?e===a.create(i).hour:s.isInteger(i)&&(s.isDate(e)||t.isArray(e))?i===a.create(e).hour:t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,r=0;r<n.length;r+=1)if(a.isTimeExact(e,n[r])){i=!0;break}i||(s.isInteger(e)||s.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,r=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,o,l,c;for(l=0;r>l;l+=1){if(o=n[l],a.isTimeExact(o,e)){i=n[l]=null,c=!0;break}if(a.isTimeOverlap(o,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[2]||i.push("inverted")):s.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;r>l;l+=1)if(a.isTimeExact(n[l],e)){n[l]=null;break}if(c)for(l=0;r>l;l+=1)if(a.isTimeOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.i=function(e,t){return s.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,i=t.settings,a=t.item.select,n=t.item.highlight,r=t.item.view,o=t.item.disable;return s.node("ul",s.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){e=t.create(e);var l=e.pick,c=a&&a.pick==l,u=n&&n.pick==l,d=o&&t.disabled(e),h=s.trigger(t.formats.toString,t,[i.format,e]);return[s.trigger(t.formats.toString,t,[s.trigger(i.formatLabel,t,[e])||i.format,e]),function(e){return c&&e.push(i.klass.selected),u&&e.push(i.klass.highlighted),r&&r.pick==l&&e.push(i.klass.viewset),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.listItem]),"data-pick="+e.pick+" "+s.ariaAttr({role:"option",label:h,selected:c&&t.$node.val()===h?!0:null,activedescendant:u?!0:null,disabled:d?!0:null})]}})+s.node("li",s.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+s.ariaAttr({controls:t.$node[0].id})),"",s.ariaAttr({role:"presentation"})),i.klass.list,s.ariaAttr({role:"listbox",controls:t.$node[0].id}))},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(e.klasses().picker),e.extend("pickatime",i)}),[].map||(Array.prototype.map=function(e,t){for(var i=this,a=i.length,n=new Array(a),r=0;a>r;r++)r in i&&(n[r]=e.call(t,i[r],r,i));return n}),[].filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var a=[],n=arguments[1],r=0;i>r;r++)if(r in t){var o=t[r];e.call(n,o,r,t)&&a.push(o)}return a}),[].indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if(0===i)return-1;var a=0;if(arguments.length>1&&(a=Number(arguments[1]),a!=a?a=0:0!==a&&a!=1/0&&a!=-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a)))),a>=i)return-1;for(var n=a>=0?a:Math.max(i-Math.abs(a),0);i>n;n++)if(n in t&&t[n]===e)return n;return-1});var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(e,t){var i=this;if("[object RegExp]"!==Object.prototype.toString.call(e))return nativeSplit.call(i,e,t);var a,n,r,o,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),c=0;for(e=new RegExp(e.source,l+"g"),i+="",compliantExecNpcg||(a=new RegExp("^"+e.source+"$(?!\\s)",l)),t=void 0===t?-1>>>0:t>>>0;(n=e.exec(i))&&(r=n.index+n[0].length,!(r>c&&(s.push(i.slice(c,n.index)),!compliantExecNpcg&&n.length>1&&n[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(n[e]=void 0)}),n.length>1&&n.index<i.length&&Array.prototype.push.apply(s,n.slice(1)),o=n[0].length,c=r,s.length>=t)));)e.lastIndex===n.index&&e.lastIndex++;return c===i.length?(o||!e.test(""))&&s.push(""):s.push(i.slice(c)),s.length>t?s.slice(0,t):s},function(e){"use strict";var t={init:function(i){return this.each(function(){this.self=e(this),t.destroy.call(this.self),this.opt=e.extend(!0,{},e.fn.raty.defaults,i),t._adjustCallback.call(this),t._adjustNumber.call(this),"img"!==this.opt.starType&&t._adjustStarType.call(this),t._adjustPath.call(this),t._createStars.call(this),this.opt.cancel&&t._createCancel.call(this),this.opt.precision&&t._adjustPrecision.call(this),t._createScore.call(this),t._apply.call(this,this.opt.score),t._target.call(this,this.opt.score),this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var e=["number","readOnly","score","scoreName","target"],t=0;t<e.length;t++)"function"==typeof this.opt[e[t]]&&(this.opt[e[t]]=this.opt[e[t]].call(this))},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var e=["cancelOff","cancelOn","starHalf","starOff","starOn"],t=0;t<e.length;t++)this.opt[e[t]]=this.opt[e[t]].replace(".","-")},_apply:function(e){t._fill.call(this,e),e&&(e>0&&this.score.val(t._between(e,0,this.opt.number)),t._roundStars.call(this,e))},_between:function(e,t,i){return Math.min(Math.max(parseFloat(e),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this)),t._bindOver.call(this),t._bindClick.call(this),t._bindOut.call(this)},_bindClick:function(){var t=this;t.stars.on("click.raty",function(i){var a=e(this);t.score.val(t.opt.half||t.opt.precision?t.self.data("score"):this.alt||a.data("alt")),t.opt.click&&t.opt.click.call(t,+t.score.val(),i)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var e=this;e.self.on("mouseleave.raty",function(i){var a=+e.score.val()||void 0;t._apply.call(e,a),t._target.call(e,a,i),e.opt.mouseout&&e.opt.mouseout.call(e,a,i)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(i){var a=e.opt.cancelOff;if("img"!==e.opt.starType&&(a=e.opt.cancelClass+" "+a),t._setIcon.call(e,this,a),e.opt.mouseout){var n=+e.score.val()||void 0;e.opt.mouseout.call(e,n,i)}})},_bindOver:function(){var e=this,i=e.opt.half?"mousemove.raty":"mouseover.raty";e.stars.on(i,function(i){var a=t._getScoreByPosition.call(e,i,this);t._fill.call(e,a),e.opt.half&&(t._roundStars.call(e,a),e.self.data("score",a)),t._target.call(e,a,i),e.opt.mouseover&&e.opt.mouseover.call(e,a,i)})},_bindOverCancel:function(){var e=this;e.cancel.on("mouseover.raty",function(i){var a=e.opt.path+e.opt.starOff,n=e.opt.cancelOn;"img"===e.opt.starType?e.stars.attr("src",a):(n=e.opt.cancelClass+" "+n,e.stars.attr("class",a)),t._setIcon.call(e,this,n),t._target.call(e,null,i),e.opt.mouseover&&e.opt.mouseover.call(e,null)})},_buildScoreField:function(){return e("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,i=e("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});"img"===this.opt.starType?i.attr({src:t,alt:"x"}):i.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend("&#160;").prepend(i):this.self.append("&#160;").append(i),this.cancel=i},_createScore:function(){var i=e(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var i=1;i<=this.opt.number;i++){var a=t._nameForIndex.call(this,i),n={alt:i,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(n={"data-alt":i,"class":n.src}),n.title=t._getHint.call(this,i),e("<"+this.opt.starType+" />",n).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?"&#160;":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){e(this).text(t),e.error(t)},_fill:function(e){for(var i=0,a=1;a<=this.stars.length;a++){var n,r=this.stars[a-1],o=t._turnOn.call(this,a,e);if(this.opt.iconRange&&this.opt.iconRange.length>i){var s=this.opt.iconRange[i];n=t._getRangeIcon.call(this,s,o),a<=s.range&&t._setIcon.call(this,r,n),a===s.range&&i++}else n=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,r,n)}},_getRangeIcon:function(e,t){return t?e.on||this.opt.starOn:e.off||this.opt.starOff},_getScoreByPosition:function(i,a){var n=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var r=t._getSize.call(this),o=parseFloat((i.pageX-e(a).offset().left)/r);n=this.opt.precision?n-1+o:n-1+(o>.5?1:.5)}return n},_getSize:function(){var e;return e="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),e||t._error.call(this,"Could not be possible get the icon size!"),e},_turnOn:function(e,t){return this.opt.single?e===t:t>=e},_getHint:function(e){var t=this.opt.hints[e-1];return""===t?"":t||e},_lock:function(){var e=parseInt(this.score.val(),10),i=e?t._getHint.call(this,e):this.opt.noRatedMsg;this.style.cursor="",this.title=i,this.score.prop("readonly",!0),this.stars.prop("title",i),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(e){return this.opt.score&&this.opt.score>=e?"starOn":"starOff"},_roundStars:function(e){var i=(e%1).toFixed(2);if(i>this.opt.round.down){var a="starOn";this.opt.halfShow&&i<this.opt.round.up?a="starHalf":i<this.opt.round.full&&(a="starOff");var n=this.opt[a],r=this.stars[Math.ceil(e)-1];t._setIcon.call(this,r,n)}},_setIcon:function(e,t){e["img"===this.opt.starType?"src":"className"]=this.opt.path+t},_setTarget:function(e,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t)),e.is(":input")?e.val(t):e.html(t)},_target:function(i,a){if(this.opt.target){var n=e(this.opt.target);n.length||t._error.call(this,"Target selector invalid or missing!");var r=a&&"mouseover"===a.type;if(void 0===i)i=this.opt.targetText;else if(null===i)i=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?i=t._getHint.call(this,Math.ceil(i)):this.opt.precision&&(i=parseFloat(i).toFixed(1));var o=a&&"mousemove"===a.type;r||o||this.opt.targetKeep||(i=this.opt.targetText)}t._setTarget.call(this,n,i)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var e=0;e<this.opt.number;e++)this.stars[e].title=t._getHint.call(this,e+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==!0&&(t[i?"click":"score"].call(a,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,e.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=e(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var e,t=[];return this.each(function(){e=this.score.val(),t.push(e?+e:void 0)}),t.length>1?t:t[0]},move:function(i){return this.each(function(){var a=parseInt(i,10),n=e(this).data("options"),r=(+i).toFixed(1).split(".")[1];a>=n.number&&(a=n.number-1,r=10);var o=t._getSize.call(this),s=o/10,l=e(this.stars[a]),c=l.offset().left+s*parseInt(r,10),u=e.Event("mousemove",{pageX:c});l.trigger(u)})},readOnly:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==i&&(i?(a.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),a.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=e(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){var i=e(this),a=i.data("options"),n=e.extend({},a,t);i.raty(n)})},setScore:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),t._target.call(this,i))})}};e.fn.raty=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exist!"):t.init.apply(this,arguments)},e.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";function t(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function i(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var a=e.scrollTo=function(t,i,a){return e(window).scrollTo(t,i,a)};return a.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(n,r,o){"object"==typeof r&&(o=r,r=0),"function"==typeof o&&(o={onAfter:o}),"max"===n&&(n=9e9),o=e.extend({},a.defaults,o),r=r||o.duration;var s=o.queue&&o.axis.length>1;return s&&(r/=2),o.offset=i(o.offset),o.over=i(o.over),this.each(function(){function l(t){var i=e.extend({},o,{queue:!0,duration:r,complete:t&&function(){t.call(d,p,o)}});h.animate(f,i)}if(null!==n){var c,u=t(this),d=u?this.contentWindow||window:this,h=e(d),p=n,f={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(p)){p=i(p);break}if(p=u?e(p):e(p,d),!p.length)return;case"object":(p.is||p.style)&&(c=(p=e(p)).offset())}var m=e.isFunction(o.offset)&&o.offset(d,p)||o.offset;e.each(o.axis.split(""),function(e,t){var i="x"===t?"Left":"Top",n=i.toLowerCase(),r="scroll"+i,g=h[r](),v=a.max(d,t);if(c)f[r]=c[n]+(u?0:g-h.offset()[n]),o.margin&&(f[r]-=parseInt(p.css("margin"+i),10)||0,f[r]-=parseInt(p.css("border"+i+"Width"),10)||0),f[r]+=m[n]||0,o.over[n]&&(f[r]+=p["x"===t?"width":"height"]()*o.over[n]);else{var y=p[n];f[r]=y.slice&&"%"===y.slice(-1)?parseFloat(y)/100*v:y}o.limit&&/^\d+$/.test(f[r])&&(f[r]=f[r]<=0?0:Math.min(f[r],v)),!e&&o.axis.length>1&&(g===f[r]?f={}:s&&(l(o.onAfterFirst),f={}))}),l(o.onAfter)}})},a.max=function(i,a){var n="x"===a?"Width":"Height",r="scroll"+n;if(!t(i))return i[r]-e(i)[n.toLowerCase()]();var o="client"+n,s=i.ownerDocument||i.document,l=s.documentElement,c=s.body;return Math.max(l[r],c[r])-Math.min(l[o],c[o])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var i=this.get(t);if(t.options.interrupt&&t._last&&t._last!==i)return e(t.elem).stop();var a=Math.round(t.now);i!==a&&(e(t.elem)[t.prop](a),t._last=this.get(t))}},a}),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=l.call(arguments,1),c=0,d=0,h=0,p=0,f=0,m=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(d=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in o&&(h=-1*o.deltaY,c=h),"deltaX"in o&&(d=o.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,d*=g}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,h*=v,d*=v}if(p=Math.max(Math.abs(h),Math.abs(d)),(!r||r>p)&&(r=p,a(o,p)&&(r/=40)),a(o,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/r),d=Math[d>=1?"floor":"ceil"](d/r),h=Math[h>=1?"floor":"ceil"](h/r),u.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();f=t.clientX-y.left,m=t.clientY-y.top}return t.deltaX=d,t.deltaY=h,t.deltaFactor=r,t.offsetX=f,t.offsetY=m,t.deltaMode=0,s.unshift(t,c,d,h),n&&clearTimeout(n),n=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){r=null}function a(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var n,r,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=o.length;c;)e.event.fixHooks[o[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=s.length;i;)this.removeEventListener(s[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e){"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var i="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",r="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";i||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+r+"%3E%3C/script%3E"))),t()}(function(){var t,i="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",r={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},o=0,s={},l=window.attachEvent&&!window.addEventListener?1:0,c=!1,u=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],d={init:function(t){var t=e.extend(!0,{},r,t),i=h.call(this);if(t.live){var l=t.liveSelector||this.selector||n,c=e(l);if("off"===t.live)return void f(l);s[l]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&f(l)},500)}else f(l);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":m(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),p(t),e(i).each(function(){var i=e(this);if(!i.data(a)){i.data(a,{idx:++o,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:i.css("direction"),cbOffsets:null,trigger:null});var n=i.data(a),r=n.opt,s=i.data("mcs-axis"),l=i.data("mcs-scrollbar-position"),c=i.data("mcs-theme");s&&(r.axis=s),l&&(r.scrollbarPosition=l),c&&(r.theme=c,p(r)),v.call(this),e("#mCSB_"+n.idx+"_container img:not(."+u[2]+")").addClass(u[2]),d.update.call(null,i)}})},update:function(t,i){var n=t||h.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!o.length)return;n.tweenRunning&&Y(t),t.hasClass(u[3])&&t.removeClass(u[3]),t.hasClass(u[4])&&t.removeClass(u[4]),x.call(this),b.call(this),"y"===r.axis||r.advanced.autoExpandHorizontalScroll||o.css("width",y(o.children())),n.overflowed=j.call(this),D.call(this),r.autoDraggerLength&&_.call(this),C.call(this),Q.call(this);var l=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==r.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?k.call(this):(X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(k.call(this),"y"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[1]&&X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==r.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?k.call(this):(X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(k.call(this),"x"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[0]&&X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),i&&n&&(2===i&&r.callbacks.onImageLoad&&"function"==typeof r.callbacks.onImageLoad?r.callbacks.onImageLoad.call(this):3===i&&r.callbacks.onSelectorChange&&"function"==typeof r.callbacks.onSelectorChange?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&"function"==typeof r.callbacks.onUpdate&&r.callbacks.onUpdate.call(this)),U.call(this)}})},scrollTo:function(t,i){if("undefined"!=typeof t&&null!=t){var n=h.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=e.extend(!0,{},s,i),c=z.call(this,t),u=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=N.call(this,c[0],"y"),c[1]=N.call(this,c[1],"x"),l.moveDragger&&(c[0]*=r.scrollRatio.y,c[1]*=r.scrollRatio.x),l.dur=u,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==o.axis&&r.overflowed[0]&&(l.dir="y",l.overwrite="all",X(n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==o.axis&&r.overflowed[1]&&(l.dir="x",l.overwrite="none",X(n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Y(t)})},disable:function(t){var i=h.call(this);return e(i).each(function(){var i=e(this);i.data(a)&&(i.data(a),U.call(this,"remove"),T.call(this),t&&k.call(this),D.call(this,!0),i.addClass(u[3]))})},destroy:function(){var t=h.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx),l=e("#mCSB_"+r.idx+"_container"),c=e(".mCSB_"+r.idx+"_scrollbar");o.live&&f(o.liveSelector||e(t).selector),U.call(this,"remove"),T.call(this),k.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),l.find("img."+u[2]).removeClass(u[2]),s.replaceWith(l.contents()),n.removeClass(i+" _"+a+"_"+r.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addClass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},p=function(t){var i=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],r=["minimal","minimal-dark"],o=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,i)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,r)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,o)>-1?"outside":t.scrollbarPosition},f=function(e){s[e]&&(clearTimeout(s[e]),Z(s,e))},m=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),r=n.opt,o=r.autoExpandScrollbar?" "+u[1]+"_expand":"",s=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],l="yx"===r.axis?"mCSB_vertical_horizontal":"x"===r.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===r.axis?s[0]+s[1]:"x"===r.axis?s[1]:s[0],d="yx"===r.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",h=r.autoHideScrollbar?" "+u[6]:"",p="x"!==r.axis&&"rtl"===n.langDir?" "+u[7]:"";r.setWidth&&t.css("width",r.setWidth),r.setHeight&&t.css("height",r.setHeight),r.setLeft="y"!==r.axis&&"rtl"===n.langDir?"989999px":r.setLeft,t.addClass(i+" _"+a+"_"+n.idx+h+p).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+l+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir="+n.langDir+" /></div>");
6
  var f=e("#mCSB_"+n.idx),m=e("#mCSB_"+n.idx+"_container");"y"===r.axis||r.advanced.autoExpandHorizontalScroll||m.css("width",y(m.children())),"outside"===r.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),m.wrap(d)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},y=function(t){return Math.max.apply(Math,t.map(function(){return e(this).outerWidth(!0)}).get())},b=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(r[0].getBoundingClientRect().right+.4)-Math.floor(r[0].getBoundingClientRect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),i=t.data(a),n=i.opt,r=e(".mCSB_"+i.idx+"_scrollbar:first"),o=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",s=["<a href='#' class='"+u[13]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[14]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[15]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[16]+"' oncontextmenu='return false;' "+o+" />"],l=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&r.prepend(l[0]).append(l[1]).next(".mCSB_scrollTools").prepend(l[2]).append(l[3])},x=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=t.css("max-height")||"none",o=-1!==r.indexOf("%"),s=t.css("box-sizing");if("none"!==r){var l=o?t.parent().height()*parseInt(r)/100:parseInt(r);"border-box"===s&&(l-=t.innerHeight()-t.height()+(t.outerHeight()-t.innerHeight())),n.css("max-height",Math.round(l))}},_=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[n.height()/r.outerHeight(!1),n.width()/r.outerWidth(!1)],c=[parseInt(o[0].css("min-height")),Math.round(s[0]*o[0].parent().height()),parseInt(o[1].css("min-width")),Math.round(s[1]*o[1].parent().width())],u=l&&c[1]<c[0]?c[0]:c[1],d=l&&c[3]<c[2]?c[2]:c[3];o[0].css({height:u,"max-height":o[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),o[1].css({width:d,"max-width":o[1].parent().width()-10})},C=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[r.outerHeight(!1)-n.height(),r.outerWidth(!1)-n.width()],l=[s[0]/(o[0].parent().height()-o[0].height()),s[1]/(o[1].parent().width()-o[1].width())];i.scrollRatio={y:l[0],x:l[1]}},S=function(e,t,i){var a=i?u[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(u[0]+" "+a),n.toggleClass(u[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(u[0]),n.removeClass(u[1])):(e.addClass(u[0]),n.addClass(u[1])))},j=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=null==i.overflowed?r.height():r.outerHeight(!1),s=null==i.overflowed?r.width():r.outerWidth(!1);return[o>n.height(),s>n.width()]},k=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx),o=e("#mCSB_"+i.idx+"_container"),s=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")];if(Y(t),("x"!==n.axis&&!i.overflowed[0]||"y"===n.axis&&i.overflowed[0])&&(s[0].add(o).css("top",0),X(t,"_resetY")),"y"!==n.axis&&!i.overflowed[1]||"x"===n.axis&&i.overflowed[1]){var l=dx=0;"rtl"===i.langDir&&(l=r.width()-o.outerWidth(!1),dx=Math.abs(l/i.scrollRatio.x)),o.css("left",l),s[1].css("left",dx),X(t,"_resetX")}},Q=function(){function t(){o=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(o),A.call(i[0])):t()},100)}var i=e(this),n=i.data(a),r=n.opt;if(!n.bindEvents){if(E.call(this),r.contentTouchScroll&&I.call(this),M.call(this),r.mouseWheel.enable){var o;t()}H.call(this),L.call(this),r.advanced.autoScrollOnFocus&&F.call(this),r.scrollButtons.enable&&B.call(this),r.keyboard.enable&&W.call(this),n.bindEvents=!0}},T=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=".mCSB_"+i.idx+"_scrollbar",s=e("#mCSB_"+i.idx+",#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,"+o+" ."+u[12]+",#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal,"+o+">a"),l=e("#mCSB_"+i.idx+"_container");n.advanced.releaseDraggableSelectors&&s.add(e(n.advanced.releaseDraggableSelectors)),i.bindEvents&&(e(document).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(i.sequential.step),Z(i.sequential,"step"),clearTimeout(l[0].onCompleteTimeout),Z(l[0],"onCompleteTimeout"),i.bindEvents=!1)},D=function(t){var i=e(this),n=i.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container_wrapper"),s=o.length?o:e("#mCSB_"+n.idx+"_container"),l=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==r.axis&&(n.overflowed[0]&&!t?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),s.removeClass(u[8]+" "+u[10])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[0].css("display","none"),s.removeClass(u[10])):(l[0].css("display","none"),s.addClass(u[10])),s.addClass(u[8]))),"y"!==r.axis&&(n.overflowed[1]&&!t?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),s.removeClass(u[9]+" "+u[11])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[1].css("display","none"),s.removeClass(u[11])):(l[1].css("display","none"),s.addClass(u[11])),s.addClass(u[9]))),n.overflowed[0]||n.overflowed[1]?i.removeClass(u[5]):i.addClass(u[5])},O=function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return e.target.ownerDocument!==document?[e.originalEvent.screenY,e.originalEvent.screenX,!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[i.screenY,i.screenX,a>1]:[i.pageY,i.pageX,a>1];default:return[e.pageY,e.pageX,!1]}},E=function(){function t(e){var t=f.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function i(e,t,i,a){if(f[0].idleTimer=d.scrollInertia<233?250:0,n.attr("id")===p[1])var r="x",o=(n[0].offsetLeft-t+a)*u.scrollRatio.x;else var r="y",o=(n[0].offsetTop-e+i)*u.scrollRatio.y;X(s,o.toString(),{dir:r,drag:!0})}var n,r,o,s=e(this),u=s.data(a),d=u.opt,h=a+"_"+u.idx,p=["mCSB_"+u.idx+"_dragger_vertical","mCSB_"+u.idx+"_dragger_horizontal"],f=e("#mCSB_"+u.idx+"_container"),m=e("#"+p[0]+",#"+p[1]),g=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m;m.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,function(i){if(i.stopImmediatePropagation(),i.preventDefault(),J(i)){c=!0,l&&(document.onselectstart=function(){return!1}),t(!1),Y(s),n=e(this);var a=n.offset(),u=O(i)[0]-a.top,h=O(i)[1]-a.left,p=n.height()+a.top,f=n.width()+a.left;p>u&&u>0&&f>h&&h>0&&(r=u,o=h),S(n,"active",d.autoExpandScrollbar)}}).bind("touchmove."+h,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;i(r,o,a,s)}),e(document).bind("mousemove."+h+" pointermove."+h+" MSPointerMove."+h,function(e){if(n){var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;if(r===a)return;i(r,o,a,s)}}).add(g).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" MSPointerUp."+h,function(){n&&(S(n,"active",d.autoExpandScrollbar),n=null),c=!1,l&&(document.onselectstart=null),t(!0)})},I=function(){function i(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,x=0,_=0;var i=T.offset();u=O(e)[0]-i.top,d=O(e)[1]-i.left,R=[O(e)[0],O(e)[1]]}function n(e){if(ee(e)&&!c&&!O(e)[2]&&(e.stopImmediatePropagation(),!_||x)){m=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(i),I.push(a),R[2]=Math.abs(O(e)[0]-R[0]),R[3]=Math.abs(O(e)[1]-R[1]),S.overflowed[0])var r=D[0].parent().height()-D[0].height(),o=u-i>0&&i-u>-(r*S.scrollRatio.y)&&(2*R[3]<R[2]||"yx"===j.axis);if(S.overflowed[1])var s=D[1].parent().width()-D[1].width(),h=d-a>0&&a-d>-(s*S.scrollRatio.x)&&(2*R[2]<R[3]||"yx"===j.axis);o||h?(e.preventDefault(),x=1):_=1,b="yx"===j.axis?[u-i,d-a]:"x"===j.axis?[null,d-a]:[u-i,null],T[0].idleTimer=250,S.overflowed[0]&&l(b[0],M,n,"y","all",!0),S.overflowed[1]&&l(b[1],M,n,"x",A,!0)}}function r(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Y(C),f=G();var i=Q.offset();h=O(e)[0]-i.top,p=O(e)[1]-i.left,E=[],I=[]}function o(e){if(ee(e)&&!c&&!O(e)[2]){e.stopImmediatePropagation(),x=0,_=0,g=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(g-m>30)){y=1e3/(g-f);var n="mcsEaseOut",r=2.5>y,o=r?[E[E.length-2],I[I.length-2]]:[0,0];v=r?[i-o[0],a-o[1]]:[i-h,a-p];var u=[Math.abs(v[0]),Math.abs(v[1])];y=r?[Math.abs(v[0]/4),Math.abs(v[1]/4)]:[y,y];var d=[Math.abs(T[0].offsetTop)-v[0]*s(u[0]/y[0],y[0]),Math.abs(T[0].offsetLeft)-v[1]*s(u[1]/y[1],y[1])];b="yx"===j.axis?[d[0],d[1]]:"x"===j.axis?[null,d[1]]:[d[0],null],w=[4*u[0]+j.scrollInertia,4*u[1]+j.scrollInertia];var C=parseInt(j.contentTouchScroll)||0;b[0]=u[0]>C?b[0]:0,b[1]=u[1]>C?b[1]:0,S.overflowed[0]&&l(b[0],w[0],n,"y",A,!1),S.overflowed[1]&&l(b[1],w[1],n,"x",A,!1)}}}function s(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function l(e,t,i,a,n,r){e&&X(C,e.toString(),{dur:t,scrollEasing:i,dir:a,overwrite:n,drag:r})}var u,d,h,p,f,m,g,v,y,b,w,x,_,C=e(this),S=C.data(a),j=S.opt,k=a+"_"+S.idx,Q=e("#mCSB_"+S.idx),T=e("#mCSB_"+S.idx+"_container"),D=[e("#mCSB_"+S.idx+"_dragger_vertical"),e("#mCSB_"+S.idx+"_dragger_horizontal")],E=[],I=[],M=0,A="yx"===j.axis?"none":"all",R=[],H=T.find("iframe"),F=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k];T.bind(F[0],function(e){i(e)}).bind(F[1],function(e){n(e)}),Q.bind(F[0],function(e){r(e)}).bind(F[2],function(e){o(e)}),H.length&&H.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(F[0],function(e){i(e),r(e)}).bind(F[1],function(e){n(e)}).bind(F[2],function(e){o(e)})})})},M=function(){function i(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,i){u.type=i&&r?"stepped":"stepless",u.scrollAmount=10,$(o,e,t,"mcsLinearOut",i?60:null)}var r,o=e(this),s=o.data(a),l=s.opt,u=s.sequential,d=a+"_"+s.idx,h=e("#mCSB_"+s.idx+"_container"),p=h.parent();h.bind("mousedown."+d,function(){t||r||(r=1,c=!0)}).add(document).bind("mousemove."+d,function(e){if(!t&&r&&i()){var a=h.offset(),o=O(e)[0]-a.top+h[0].offsetTop,c=O(e)[1]-a.left+h[0].offsetLeft;o>0&&o<p.height()&&c>0&&c<p.width()?u.step&&n("off",null,"stepped"):("x"!==l.axis&&s.overflowed[0]&&(0>o?n("on",38):o>p.height()&&n("on",40)),"y"!==l.axis&&s.overflowed[1]&&(0>c?n("on",37):c>p.width()&&n("on",39)))}}).bind("mouseup."+d,function(){t||(r&&(r=0,n("off",null)),c=!1)})},A=function(){function t(t,a){if(Y(i),!R(i,t.target)){var o="auto"!==r.mouseWheel.deltaFactor?parseInt(r.mouseWheel.deltaFactor):l&&t.deltaFactor<100?100:t.deltaFactor||100;if("x"===r.axis||"x"===r.mouseWheel.axis)var u="x",d=[Math.round(o*n.scrollRatio.x),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.width()?.9*s.width():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),f=c[1][0].offsetLeft,m=c[1].parent().width()-c[1].width(),g=t.deltaX||t.deltaY||a;else var u="y",d=[Math.round(o*n.scrollRatio.y),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.height()?.9*s.height():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),f=c[0][0].offsetTop,m=c[0].parent().height()-c[0].height(),g=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||(r.mouseWheel.invert&&(g=-g),r.mouseWheel.normalizeDelta&&(g=0>g?-1:1),(g>0&&0!==f||0>g&&f!==m||r.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),X(i,(p-g*h).toString(),{dir:u}))}}var i=e(this),n=i.data(a),r=n.opt,o=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],u=e("#mCSB_"+n.idx+"_container").find("iframe");n&&(u.length&&u.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+o,function(e,i){t(e,i)})})}),s.bind("mousewheel."+o,function(e,i){t(e,i)}))},P=function(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(a){}return null!==t},R=function(t,i){var n=i.nodeName.toLowerCase(),r=t.data(a).opt.mouseWheel.disableOver,o=["select","textarea"];return e.inArray(n,r)>-1&&!(e.inArray(n,o)>-1&&!e(i).is(":focus"))},H=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container"),o=r.parent(),s=e(".mCSB_"+i.idx+"_scrollbar ."+u[12]);s.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(){c=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(){c=!1}).bind("click."+n,function(a){if(e(a.target).hasClass(u[12])||e(a.target).hasClass("mCSB_draggerRail")){Y(t);var n=e(this),s=n.find(".mCSB_dragger");if(n.parent(".mCSB_scrollTools_horizontal").length>0){if(!i.overflowed[1])return;var l="x",c=a.pageX>s.offset().left?-1:1,d=Math.abs(r[0].offsetLeft)-.9*c*o.width()}else{if(!i.overflowed[0])return;var l="y",c=a.pageY>s.offset().top?-1:1,d=Math.abs(r[0].offsetTop)-.9*c*o.height()}X(t,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},F=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=e("#mCSB_"+i.idx+"_container"),s=o.parent();o.bind("focusin."+r,function(){var i=e(document.activeElement),a=o.find(".mCustomScrollBox").length,r=0;i.is(n.advanced.autoScrollOnFocus)&&(Y(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(r+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ie(i)[0],ie(i)[1]],a=[o[0].offsetTop,o[0].offsetLeft],l=[a[0]+e[0]>=0&&a[0]+e[0]<s.height()-i.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<s.width()-i.outerWidth(!1)],c="yx"!==n.axis||l[0]||l[1]?"all":"none";"x"===n.axis||l[0]||X(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r}),"y"===n.axis||l[1]||X(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r})},t[0]._focusTimer))})},L=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+n,function(){(0!==r.scrollTop()||0!==r.scrollLeft())&&e(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},B=function(){var t=e(this),i=t.data(a),n=i.opt,r=i.sequential,o=a+"_"+i.idx,s=".mCSB_"+i.idx+"_scrollbar",l=e(s+">a");l.bind("mousedown."+o+" touchstart."+o+" pointerdown."+o+" MSPointerDown."+o+" mouseup."+o+" touchend."+o+" pointerup."+o+" MSPointerUp."+o+" mouseout."+o+" pointerout."+o+" MSPointerOut."+o+" click."+o,function(a){function o(e,i){r.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,$(t,e,i)}if(a.preventDefault(),J(a)){var s=e(this).attr("class");switch(r.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;c=!0,i.tweenRunning=!1,o("on",s);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;c=!1,r.dir&&o("off",s);break;case"click":if("stepped"!==r.type||i.tweenRunning)return;o("on",s)}}})},W=function(){function t(t){function a(e,t){o.type=r.keyboard.scrollType,o.scrollAmount=r.snapAmount||r.keyboard.scrollAmount,"stepped"===o.type&&n.tweenRunning||$(i,e,t)}switch(t.type){case"blur":n.tweenRunning&&o.dir&&a("off",null);break;case"keydown":case"keyup":var s=t.keyCode?t.keyCode:t.which,l="on";if("x"!==r.axis&&(38===s||40===s)||"y"!==r.axis&&(37===s||39===s)){if((38===s||40===s)&&!n.overflowed[0]||(37===s||39===s)&&!n.overflowed[1])return;"keyup"===t.type&&(l="off"),e(document.activeElement).is(d)||(t.preventDefault(),t.stopImmediatePropagation(),a(l,s))}else if(33===s||34===s){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Y(i);var h=34===s?-1:1;if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=Math.abs(c[0].offsetLeft)-.9*h*u.width();else var p="y",f=Math.abs(c[0].offsetTop)-.9*h*u.height();X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}else if((35===s||36===s)&&!e(document.activeElement).is(d)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=35===s?Math.abs(u.width()-c.outerWidth(!1)):0;else var p="y",f=35===s?Math.abs(u.height()-c.outerHeight(!1)):0;X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}}var i=e(this),n=i.data(a),r=n.opt,o=n.sequential,s=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),u=c.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",h=c.find("iframe"),p=["blur."+s+" keydown."+s+" keyup."+s];h.length&&h.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(p[0],function(e){t(e)})})}),l.attr("tabindex","0").bind(p[0],function(e){t(e)})},$=function(t,i,n,r,o){function s(e){var i="stepped"!==h.type,a=o?o:e?i?m/1.5:g:1e3/60,n=e?i?7.5:40:2.5,l=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],u=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],d="x"===h.dir[0]?l[1]+h.dir[1]*u[1]*n:l[0]+h.dir[1]*u[0]*n,f="x"===h.dir[0]?l[1]+h.dir[1]*parseInt(h.scrollAmount):l[0]+h.dir[1]*parseInt(h.scrollAmount),v="auto"!==h.scrollAmount?f:d,y=r?r:e?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",b=e?!0:!1;return e&&17>a&&(v="x"===h.dir[0]?l[1]:l[0]),X(t,v.toString(),{dir:h.dir[0],scrollEasing:y,dur:a,onComplete:b}),e?void(h.dir=!1):(clearTimeout(h.step),void(h.step=setTimeout(function(){s()},a)))}function l(){clearTimeout(h.step),Z(h,"step"),Y(t)}var c=t.data(a),d=c.opt,h=c.sequential,p=e("#mCSB_"+c.idx+"_container"),f="stepped"===h.type?!0:!1,m=d.scrollInertia<26?26:d.scrollInertia,g=d.scrollInertia<1?17:d.scrollInertia;switch(i){case"on":if(h.dir=[n===u[16]||n===u[15]||39===n||37===n?"x":"y",n===u[13]||n===u[15]||38===n||37===n?-1:1],Y(t),te(n)&&"stepped"===h.type)return;s(f);break;case"off":l(),(f||c.tweenRunning&&h.dir)&&s(!0)}},z=function(t){var i=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===i.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===i.axis?null:t,n[1]=t.x?t.x:t.y||"y"===i.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},N=function(t,i){if(null!=t&&"undefined"!=typeof t){var n=e(this),r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx+"_container"),l=s.parent(),c=typeof t;i||(i="x"===o.axis?"x":"y");var u="x"===i?s.outerWidth(!1):s.outerHeight(!1),h="x"===i?s[0].offsetLeft:s[0].offsetTop,p="x"===i?"left":"top";switch(c){case"function":return t();case"object":var f=t.jquery?t:e(t);if(!f.length)return;return"x"===i?ie(f)[1]:ie(f)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(u*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(h-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var m=h+parseInt(t.split("+=")[1]);return m>=0?0:Math.abs(m)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(l.height()-s.outerHeight(!1));if("right"===t)return Math.abs(l.width()-s.outerWidth(!1));if("first"===t||"last"===t){var f=s.find(":"+t);return"x"===i?ie(f)[1]:ie(f)[0]}return e(t).length?"x"===i?ie(e(t))[1]:ie(e(t))[0]:(s.css(p,t),void d.update.call(null,n[0]))}}},U=function(t){function i(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return h.advanced.updateOnSelectorChange&&(f=o(),f!==w)?(s(3),void(w=f)):(h.advanced.updateOnContentResize&&(m=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(m[0]!==x[0]||m[1]!==x[1]||m[2]!==x[2]||m[3]!==x[3]||m[4]!==x[4]||m[5]!==x[5])&&(s(m[0]!==x[0]||m[1]!==x[1]),x=m)),h.advanced.updateOnImageLoad&&(g=n(),g!==_&&(p.find("img").each(function(){r(this)}),_=g)),void((h.advanced.updateOnSelectorChange||h.advanced.updateOnContentResize||h.advanced.updateOnImageLoad)&&i()))},60)}function n(){var e=0;return h.advanced.updateOnImageLoad&&(e=p.find("img").length),e}function r(t){function i(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(u[2]),s(2)}if(e(t).hasClass(u[2]))return void s();var n=new Image;n.onload=i(n,a),n.src=t.src}function o(){h.advanced.updateOnSelectorChange===!0&&(h.advanced.updateOnSelectorChange="*");var t=0,i=p.find(h.advanced.updateOnSelectorChange);return h.advanced.updateOnSelectorChange&&i.length>0&&i.each(function(){t+=e(this).height()+e(this).width()}),t}function s(e){clearTimeout(p[0].autoUpdate),d.update.call(null,l[0],e)}var l=e(this),c=l.data(a),h=c.opt,p=e("#mCSB_"+c.idx+"_container");if(t)return clearTimeout(p[0].autoUpdate),void Z(p[0],"autoUpdate");var f,m,g,v=p.parent(),y=[e("#mCSB_"+c.idx+"_scrollbar_vertical"),e("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[y[0].is(":visible")?y[0].outerHeight(!0):0,y[1].is(":visible")?y[1].outerWidth(!0):0]},w=o(),x=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],_=n();i()},q=function(e,t,i){return Math.round(e/t)*t-i},Y=function(t){var i=t.data(a),n=e("#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},X=function(t,i,n){function r(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function o(){return[c.callbacks.alwaysTriggerOffsets||b>=w[0]+_,c.callbacks.alwaysTriggerOffsets||-C>=b]}function s(){var e=[p[0].offsetTop,p[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[p.outerHeight(!1),p.outerWidth(!1)],r=[h.height(),h.width()];t[0].mcs={content:p,top:e[0],left:e[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-r[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-r[1])),direction:n.dir}}var l=t.data(a),c=l.opt,u={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(u,n),d=[n.dur,n.drag?0:n.dur],h=e("#mCSB_"+l.idx),p=e("#mCSB_"+l.idx+"_container"),f=p.parent(),m=c.callbacks.onTotalScrollOffset?z.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?z.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,(0!==f.scrollTop()||0!==f.scrollLeft())&&(e(".mCSB_"+l.idx+"_scrollbar").css("visibility","visible"),f.scrollTop(0).scrollLeft(0)),"_resetY"!==i||l.contentReset.y||(r("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),l.contentReset.y=1),"_resetX"!==i||l.contentReset.x||(r("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),l.contentReset.x=1),"_resetY"!==i&&"_resetX"!==i){switch(!l.contentReset.y&&t[0].mcs||!l.overflowed[0]||(r("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),l.contentReset.x=null),!l.contentReset.x&&t[0].mcs||!l.overflowed[1]||(r("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),l.contentReset.x=null),c.snapAmount&&(i=q(i,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=e("#mCSB_"+l.idx+"_dragger_horizontal"),y="left",b=p[0].offsetLeft,w=[h.width()-p.outerWidth(!1),v.parent().width()-v.width()],x=[i,0===i?0:i/l.scrollRatio.x],_=m[1],C=g[1],j=_>0?_/l.scrollRatio.x:0,k=C>0?C/l.scrollRatio.x:0;break;case"y":var v=e("#mCSB_"+l.idx+"_dragger_vertical"),y="top",b=p[0].offsetTop,w=[h.height()-p.outerHeight(!1),v.parent().height()-v.height()],x=[i,0===i?0:i/l.scrollRatio.y],_=m[0],C=g[0],j=_>0?_/l.scrollRatio.y:0,k=C>0?C/l.scrollRatio.y:0}x[1]<0||0===x[0]&&0===x[1]?x=[0,0]:x[1]>=w[1]?x=[w[0],w[1]]:x[0]=-x[0],t[0].mcs||(s(),r("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(p[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&x[0]>=0||b===w[0]&&x[0]<=w[0]))&&(V(v[0],y,Math.round(x[1]),d[1],n.scrollEasing),V(p[0],y,Math.round(x[0]),d[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(r("onScrollStart")&&(s(),c.callbacks.onScrollStart.call(t[0])),l.tweenRunning=!0,S(v),l.cbOffsets=o())},onUpdate:function(){n.callbacks&&n.onUpdate&&r("whileScrolling")&&(s(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(p[0].onCompleteTimeout);var e=p[0].idleTimer||0;p[0].onCompleteTimeout=setTimeout(function(){r("onScroll")&&(s(),c.callbacks.onScroll.call(t[0])),r("onTotalScroll")&&x[1]>=w[1]-j&&l.cbOffsets[0]&&(s(),c.callbacks.onTotalScroll.call(t[0])),r("onTotalScrollBack")&&x[1]<=k&&l.cbOffsets[1]&&(s(),c.callbacks.onTotalScrollBack.call(t[0])),l.tweenRunning=!1,p[0].idleTimer=0,S(v,"hide")},e)}}}))}},V=function(e,t,i,a,n,r,o){function s(){x.stop||(y||f.call(),y=G()-v,l(),y>=x.time&&(x.time=y>x.time?y+h-(y-x.time):y+h-1,x.time<y+1&&(x.time=y+1)),x.time<a?x.id=p(s):g.call())}function l(){a>0?(x.currVal=d(x.time,b,_,a,n),w[t]=Math.round(x.currVal)+"px"):w[t]=i+"px",m.call()}function c(){h=1e3/60,x.time=y+h,p=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return l(),setTimeout(e,.01)},x.id=p(s)}function u(){null!=x.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(x.id):clearTimeout(x.id),x.id=null)}function d(e,t,i,a,n){switch(n){case"linear":case"mcsLinear":return i*e/a+t;case"mcsLinearOut":return e/=a,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var r=(e/=a)*e,o=r*e;return t+i*(.499999999999997*o*r+-2.5*r*r+5.5*o+-6.5*r+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var h,p,o=o||{},f=o.onStart||function(){},m=o.onUpdate||function(){},g=o.onComplete||function(){},v=G(),y=0,b=e.offsetTop,w=e.style,x=e._mTween[t];"left"===t&&(b=e.offsetLeft);var _=i-b;x.stop=0,"none"!==r&&u(),c()},G=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],i=0;i<t.length;i++){var a=t[i];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(i){e[t]=null}},J=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ie=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]};e.fn[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i].defaults=r,window[i]=!0,e(window).load(function(){e(n)[i](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var i,a,n=e(t),r=n.parents(".mCSB_container");return r.length?(i=r.parent(),a=[r[0].offsetTop,r[0].offsetLeft],a[0]+ie(n)[0]>=0&&a[0]+ie(n)[0]<i.height()-n.outerHeight(!1)&&a[1]+ie(n)[1]>=0&&a[1]+ie(n)[1]<i.width()-n.outerWidth(!1)):void 0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var i=e(t).data(a);return i?i.overflowed[0]||i.overflowed[1]:void 0}})})})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";var t=e(window),i=e(document),a=window.location,n=!0,r=!1,o=null,s=NaN,l=1/0,c="undefined",u="directive",d=".cropper",h=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,p=/^(x|y|width|height)$/,f=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,m="cropper-modal",g="cropper-hidden",v="cropper-invisible",y="cropper-move",b="cropper-crop",w="cropper-disabled",x="mousedown touchstart",_="mousemove touchmove",C="mouseup mouseleave touchend touchleave touchcancel",S="wheel mousewheel DOMMouseScroll",j="resize"+d,k="dblclick",Q="build"+d,T="built"+d,D="dragstart"+d,O="dragmove"+d,E="dragend"+d,I=function(e){return"number"==typeof e},M=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=M(arguments,2);return function(){return e.apply(t,i.concat(M(arguments)))}},P=function(t,i){this.element=t,this.$element=e(t),this.defaults=e.extend({},P.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=o,this.ready=r,this.built=r,this.cropped=r,this.rotated=r,this.disabled=r,this.replaced=r,this.init()},R=Math.sqrt,H=Math.min,F=Math.max,L=Math.abs,B=Math.sin,W=Math.cos,$=parseFloat;P.prototype={constructor:P,support:{canvas:e.isFunction(e("<canvas>")[0].getContext)},init:function(){var t=this.defaults;e.each(t,function(e,i){switch(e){case"aspectRatio":t[e]=L($(i))||s;break;case"autoCropArea":t[e]=L($(i))||.8;break;case"minWidth":case"minHeight":t[e]=L($(i))||0;break;case"maxWidth":case"maxHeight":t[e]=L($(i))||l}}),this.image={rotate:0},this.load()},load:function(){var t,i,a=this,r=this.$element,o=this.element,s=this.image,l="";r.is("img")?i=r.prop("src"):r.is("canvas")&&this.support.canvas&&(i=o.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(r.prop("crossOrigin")||this.isCrossOriginURL(i))&&(l=" crossOrigin"),this.$clone=t=e("<img"+l+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,a.url=i,a.ready=n,a.build()}),t.addClass(v).prependTo("body"))},isCrossOriginURL:function(e){var t=e.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===a.protocol&&t[2]===a.hostname&&t[3]===a.port?r:n},build:function(){var t,i,a=this.$element,o=this.defaults;this.ready&&(this.built&&this.unbuild(),a.one(Q,o.build),t=e.Event(Q),a.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=e(P.TEMPLATE),a.addClass(g),this.$clone.removeClass(v).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(g).prependTo(this.$cropper),this.originalImage=e.extend({},this.image)),this.$container=a.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),o.autoCrop?this.cropped=n:this.$dragger.addClass(g),o.dragCrop&&this.setDragMode("crop"),o.modal&&this.$canvas.addClass(m),!o.dashed&&this.$dragger.find(".cropper-dashed").addClass(g),!o.movable&&this.$dragger.find(".cropper-face").data(u,"move"),!o.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(g),
7
+ this.addListeners(),this.initPreview(),this.built=n,this.update(),this.replaced=r,a.one(T,o.built),a.trigger(T)))},unbuild:function(){this.built&&(this.built=r,this.removeListeners(),this.$preview.empty(),this.$preview=o,this.$dragger=o,this.$canvas=o,this.$container=o,this.$cropper.remove(),this.$cropper=o)},update:function(e){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),e?(this.setData(e,n),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(e.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,i=this.dragger,a=t.width,n=t.height,r=i.left-t.left,o=i.top-t.top;this.$viewer.find("img").css({width:a,height:n,marginLeft:-r,marginTop:-o}),this.$preview.each(function(){var t=e(this),s=t.width()/i.width;t.find("img").css({width:a*s,height:n*s,marginLeft:-r*s,marginTop:-o*s})})},addListeners:function(){var a=this.defaults;this.$element.on(D,a.dragstart).on(O,a.dragmove).on(E,a.dragend),this.$cropper.on(x,e.proxy(this.dragstart,this)).on(k,e.proxy(this.dblclick,this)),a.zoomable&&this.$cropper.on(S,e.proxy(this.wheel,this)),a.multiple?this.$cropper.on(_,e.proxy(this.dragmove,this)).on(C,e.proxy(this.dragend,this)):i.on(_,this._dragmove=A(this.dragmove,this)).on(C,this._dragend=A(this.dragend,this)),t.on(j,this._resize=A(this.resize,this))},removeListeners:function(){var e=this.defaults;this.$element.off(D,e.dragstart).off(O,e.dragmove).off(E,e.dragend),this.$cropper.off(x,this.dragstart).off(k,this.dblclick),e.zoomable&&this.$cropper.off(S,this.wheel),e.multiple?this.$cropper.off(_,this.dragmove).off(C,this.dragend):i.off(_,this._dragmove).off(C,this._dragend),t.off(j,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=e(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var e=this.$container;e!==o&&(this.container={width:F(e.width(),300),height:F(e.height(),150)})},initCropper:function(){var e,t=this.container,i=this.image;i.naturalWidth*t.height/i.naturalHeight-t.width>=0?(e={width:t.width,height:t.width/i.aspectRatio,left:0},e.top=(t.height-e.height)/2):(e={width:t.height*i.aspectRatio,height:t.height,top:0},e.left=(t.width-e.width)/2),this.$cropper.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.cropper=e},initImage:function(){var t=this.image,i=this.cropper,a={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=e.extend({},t,a),t._width!==i.width||t._height!==i.height?e.extend(t,a):(t=e.extend({},a,t),this.replaced&&(t.ratio=a.ratio)),this.image=t,this.renderImage()},renderImage:function(e){var t=this.image;"zoom"===e&&(t.left-=(t.width-t.oldWidth)/2,t.top-=(t.height-t.oldHeight)/2),t.left=H(F(t.left,t._width-t.width),0),t.top=H(F(t.top,t._height-t.height),0),this.$clone.css({width:t.width,height:t.height,marginLeft:t.left,marginTop:t.top}),e&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,a=this.cropper,n=i.aspectRatio||this.image.aspectRatio,r=this.image.ratio;t=a.height*n-a.width>=0?{height:a.width/n,width:a.width,left:0,top:(a.height-a.width/n)/2,maxWidth:a.width,maxHeight:a.width/n}:{height:a.height,width:a.height*n,left:(a.width-a.height*n)/2,top:0,maxWidth:a.height*n,maxHeight:a.height},t.minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=t.maxWidth/n):isFinite(i.maxHeight)&&(t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.maxWidth=t.maxHeight*n),i.minWidth>0?(t.minWidth=F(0,i.minWidth*r),t.minHeight=t.minWidth/n):i.minHeight>0&&(t.minHeight=F(0,i.minHeight*r),t.minWidth=t.minHeight*n)):(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.minWidth=F(0,i.minWidth*r),t.minHeight=F(0,i.minHeight*r)),t.minWidth=H(t.maxWidth,t.minWidth),t.minHeight=H(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(a.width-t.width)/2,t.top=(a.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=e.extend({},t)},renderDragger:function(){var e=this.dragger,t=this.cropper;e.width>e.maxWidth?(e.width=e.maxWidth,e.left=e.oldLeft):e.width<e.minWidth&&(e.width=e.minWidth,e.left=e.oldLeft),e.height>e.maxHeight?(e.height=e.maxHeight,e.top=e.oldTop):e.height<e.minHeight&&(e.height=e.minHeight,e.top=e.oldTop),e.left=H(F(e.left,0),t.width-e.width),e.top=H(F(e.top,0),t.height-e.height),e.oldLeft=e.left,e.oldTop=e.top,this.dragger=e,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=e.extend({},this.defaultImage),this.renderImage(),this.dragger=e.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=r,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(m),this.$dragger.addClass(g))},destroy:function(){var e=this.$element;this.ready&&(this.unbuild(),e.removeClass(g).removeData("cropper"),this.rotated&&e.attr("src",this.$original.attr("src")))},replace:function(t,i){var a,o=this,s=this.$element,l=this.element;t&&t!==this.url&&t!==s.attr("src")&&(i||(this.rotated=r,this.replaced=n),s.is("img")?(s.attr("src",t),this.load()):s.is("canvas")&&this.support.canvas&&(a=l.getContext("2d"),e('<img src="'+t+'">').one("load",function(){l.width=this.width,l.height=this.height,a.clearRect(0,0,l.width,l.height),a.drawImage(this,0,0),o.load()})))},setData:function(t,i){var a=this.cropper,n=this.dragger,r=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==c&&((t===o||e.isEmptyObject(t))&&(n=e.extend({},this.defaultDragger)),e.isPlainObject(t)&&!e.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),I(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),I(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(I(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),I(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height))),this.dragger=n,this.renderDragger())},getData:function(e){var t=this.dragger,i=this.image,a={};return this.built&&(a={x:t.left-i.left,y:t.top-i.top,width:t.width,height:t.height},a=this.transformData(a,n,e)),a},transformData:function(t,i,a){var n=this.image.ratio,r={};return e.each(t,function(e,t){t=$(t),p.test(e)&&!isNaN(t)&&(r[e]=i?a?Math.round(t/n):t/n:t*n)}),r},setAspectRatio:function(e){var t="auto"===e;e=$(e),(t||!isNaN(e)&&e>0)&&(this.defaults.aspectRatio=t?s:e,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var t={};return this.ready&&e.each(this.image,function(e,i){f.test(e)&&(t[e]=i)}),t},getDataURL:function(t,i,a){var n,r=e("<canvas>")[0],o=this.getData(),s="";return e.isPlainObject(t)||(a=i,i=t,t={}),t=e.extend({width:o.width,height:o.height},t),this.cropped&&this.support.canvas&&(r.width=t.width,r.height=t.height,n=r.getContext("2d"),"image/jpeg"===i&&(n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height)),n.drawImage(this.$clone[0],o.x,o.y,o.width,o.height,0,0,t.width,t.height),s=r.toDataURL(i,a)),s},setDragMode:function(e){var t=this.$canvas,i=this.defaults,a=r,o=r;if(this.built&&!this.disabled){switch(e){case"crop":i.dragCrop&&(a=n,t.data(u,e));break;case"move":o=n,t.data(u,e);break;default:t.removeData(u)}t.toggleClass(b,a).toggleClass(y,o)}},enable:function(){this.built&&(this.disabled=r,this.$cropper.removeClass(w))},disable:function(){this.built&&(this.disabled=n,this.$cropper.addClass(w))},rotate:function(e){var t=this.image;e=$(e)||0,this.built&&0!==e&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=n,e=t.rotate=(t.rotate+e)%360,this.replace(this.getRotatedDataURL(e),!0))},getRotatedDataURL:function(t){var i=e("<canvas>")[0],a=i.getContext("2d"),n=t*Math.PI/180,r=L(t)%180,o=r>90?180-r:r,s=o*Math.PI/180,l=this.originalImage,c=l.naturalWidth,u=l.naturalHeight,d=L(c*W(s)+u*B(s)),h=L(c*B(s)+u*W(s));return i.width=d,i.height=h,a.save(),a.translate(d/2,h/2),a.rotate(n),a.drawImage(this.$original[0],-c/2,-u/2,c,u),a.restore(),i.toDataURL()},zoom:function(e){var t,i,a,n=this.image;e=$(e),this.built&&e&&!this.disabled&&this.defaults.zoomable&&(t=n.width*(1+e),i=n.height*(1+e),a=t/n._width,a>10||(1>a&&(t=n._width,i=n._height),1>=a?this.setDragMode("crop"):this.setDragMode("move"),n.oldWidth=n.width,n.oldHeight=n.height,n.width=t,n.height=i,n.ratio=n.width/n.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(b)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(e){var t,i=e.originalEvent,a=117.25,n=5,r=166.66665649414062,o=.1;this.disabled||(e.preventDefault(),i.deltaY?(t=i.deltaY,t=t%n===0?t/n:t%a===0?t/a:t/r):t=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(t*o))},dragstart:function(t){var i,a,o,s=t.originalEvent.touches,l=t;if(!this.disabled){if(s){if(o=s.length,o>1){if(!this.defaults.zoomable||2!==o)return;l=s[1],this.startX2=l.pageX,this.startY2=l.pageY,i="zoom"}l=s[0]}if(i=i||e(l.target).data(u),h.test(i)){if(t.preventDefault(),a=e.Event(D),this.$element.trigger(a),a.isDefaultPrevented())return;this.directive=i,this.cropping=r,this.startX=l.pageX,this.startY=l.pageY,"crop"===i&&(this.cropping=n,this.$canvas.addClass(m))}}},dragmove:function(t){var i,a,n=t.originalEvent.touches,r=t;if(!this.disabled){if(n){if(a=n.length,a>1){if(!this.defaults.zoomable||2!==a)return;r=n[1],this.endX2=r.pageX,this.endY2=r.pageY}r=n[0]}if(this.directive){if(t.preventDefault(),i=e.Event(O),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=r.pageX,this.endY=r.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=e.Event(E),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=r,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var e,t=this.directive,i=this.image,a=this.cropper,o=a.width,s=a.height,l=this.dragger,c=l.width,u=l.height,d=l.left,h=l.top,p=d+c,f=h+u,m=n,v=this.defaults,y=v.aspectRatio,b={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&(b.X=b.y*y,b.Y=b.x/y),t){case"all":d+=b.x,h+=b.y;break;case"e":if(b.x>=0&&(p>=o||y&&(0>=h||f>=s))){m=r;break}c+=b.x,y&&(u=c/y,h-=b.Y/2),0>c&&(t="w",c=0);break;case"n":if(b.y<=0&&(0>=h||y&&(0>=d||p>=o))){m=r;break}u-=b.y,h+=b.y,y&&(c=u*y,d+=b.X/2),0>u&&(t="s",u=0);break;case"w":if(b.x<=0&&(0>=d||y&&(0>=h||f>=s))){m=r;break}c-=b.x,d+=b.x,y&&(u=c/y,h+=b.Y/2),0>c&&(t="e",c=0);break;case"s":if(b.y>=0&&(f>=s||y&&(0>=d||p>=o))){m=r;break}u+=b.y,y&&(c=u*y,d-=b.X/2),0>u&&(t="n",u=0);break;case"ne":if(y){if(b.y<=0&&(0>=h||p>=o)){m=r;break}u-=b.y,h+=b.y,c=u*y}else b.x>=0?o>p?c+=b.x:b.y<=0&&0>=h&&(m=r):c+=b.x,b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="sw",u=0,c=0);break;case"nw":if(y){if(b.y<=0&&(0>=h||0>=d)){m=r;break}u-=b.y,h+=b.y,c=u*y,d+=b.X}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y<=0&&0>=h&&(m=r):(c-=b.x,d+=b.x),b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="se",u=0,c=0);break;case"sw":if(y){if(b.x<=0&&(0>=d||f>=s)){m=r;break}c-=b.x,d+=b.x,u=c/y}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y>=0&&f>=s&&(m=r):(c-=b.x,d+=b.x),b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="ne",u=0,c=0);break;case"se":if(y){if(b.x>=0&&(p>=o||f>=s)){m=r;break}c+=b.x,u=c/y}else b.x>=0?o>p?c+=b.x:b.y>=0&&f>=s&&(m=r):c+=b.x,b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="nw",u=0,c=0);break;case"move":i.left+=b.x,i.top+=b.y,this.renderImage("move"),m=r;break;case"zoom":v.zoomable&&(this.zoom(function(e,t,i,a,n,r){return(R(n*n+r*r)-R(i*i+a*a))/R(e*e+t*t)}(i.width,i.height,L(this.startX-this.startX2),L(this.startY-this.startY2),L(this.endX-this.endX2),L(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":b.x&&b.y&&(e=this.$cropper.offset(),d=this.startX-e.left,h=this.startY-e.top,c=l.minWidth,u=l.minHeight,b.x>0?b.y>0?t="se":(t="ne",h-=u):b.y>0?(t="sw",d-=c):(t="nw",d-=c,h-=u),this.cropped||(this.cropped=n,this.$dragger.removeClass(g)))}m&&(l.width=c,l.height=u,l.left=d,l.top=h,this.directive=t,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},P.TEMPLATE=function(e,t){return t=t.split(","),e.replace(/\d+/g,function(e){return t[e]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),P.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:e.noop,preview:"",multiple:r,autoCrop:n,dragCrop:n,dashed:n,modal:n,movable:n,resizable:n,zoomable:n,rotatable:n,checkImageOrigin:n,minWidth:0,minHeight:0,maxWidth:l,maxHeight:l,build:o,built:o,dragstart:o,dragmove:o,dragend:o},P.setDefaults=function(t){e.extend(P.DEFAULTS,t)},P.other=e.fn.cropper,e.fn.cropper=function(t){var i,a=M(arguments,1);return this.each(function(){var n,r=e(this),o=r.data("cropper");o||r.data("cropper",o=new P(this,t)),"string"==typeof t&&e.isFunction(n=o[t])&&(i=n.apply(o,a))}),typeof i!==c?i:this},e.fn.cropper.Constructor=P,e.fn.cropper.setDefaults=P.setDefaults,e.fn.cropper.noConflict=function(){return e.fn.cropper=P.other,this}}),function(e){function t(e,t){return"function"==typeof e?e.call(t):e}function i(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}function a(t,i){this.$element=e(t),this.options=i,this.enabled=!0,this.fixTitle()}a.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var a=this.tip();a.find(".tipsy-inner")[this.options.html?"html":"text"](i),a[0].className="tipsy",a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,r=e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=a[0].offsetWidth,s=a[0].offsetHeight,l=t(this.options.gravity,this.$element[0]);switch(l.charAt(0)){case"n":n={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-o/2};break;case"s":n={top:r.top-s-this.options.offset,left:r.left+r.width/2-o/2};break;case"e":n={top:r.top+r.height/2-s/2,left:r.left-o-this.options.offset};break;case"w":extra_gap=0,e("body").css("position").length>0&&"relative"==e("body").css("position")&&e("#wpadminbar").length&&(extra_gap=e("#wpadminbar").height()),n={top:r.top+r.height/2-s/2-extra_gap,left:r.left+r.width+this.options.offset}}2==l.length&&("w"==l.charAt(1)?n.left=r.left+r.width/2-15:n.left=r.left+r.width/2-o+15),a.css(n).addClass("tipsy-"+l),a.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+l.charAt(0),this.options.className&&a.addClass(t(this.options.className,this.$element[0])),this.options.fade?a.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):a.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){e(this).remove()}):this.tip().remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("original-title"))&&e.attr("original-title",e.attr("title")||"").removeAttr("title")},getTitle:function(){var e,t=this.$element,i=this.options;this.fixTitle();var e,i=this.options;return"string"==typeof i.title?e=t.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(e=i.title.call(t[0])),e=(""+e).replace(/(^\s*|\s*$)/,""),e||i.fallback},tip:function(){return this.$tip||(this.$tip=e('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},e.fn.tipsy=function(t){function i(i){var n=e.data(i,"tipsy");return n||(n=new a(i,e.fn.tipsy.elementOptions(i,t)),e.data(i,"tipsy",n)),n}function n(){var e=i(this);e.hoverState="in",0==t.delayIn?e.show():(e.fixTitle(),setTimeout(function(){"in"==e.hoverState&&e.show()},t.delayIn))}function r(){var e=i(this);e.hoverState="out",0==t.delayOut?e.hide():setTimeout(function(){"out"==e.hoverState&&e.hide()},t.delayOut)}if(t===!0)return this.data("tipsy");if("string"==typeof t){var o=this.data("tipsy");return o&&o[t](),this}if(t=e.extend({},e.fn.tipsy.defaults,t),t.live||this.each(function(){i(this)}),"manual"!=t.trigger){var s="hover"==t.trigger?"mouseenter":"focus",l="hover"==t.trigger?"mouseleave":"blur";t.live?e(document).on(s,this.selector,n).on(l,this.selector,r):this.bind(s,n).bind(l,r)}return this},e.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},e.fn.tipsy.revalidate=function(){e(".tipsy").each(function(){var t=e.data(this,"tipsy-pointee");t&&i(t)||e(this).remove()})},e.fn.tipsy.elementOptions=function(t,i){return e.metadata?e.extend({},i,e(t).metadata()):i},e.fn.tipsy.autoNS=function(){return e(this).offset().top>e(document).scrollTop()+e(window).height()/2?"s":"n"},e.fn.tipsy.autoWE=function(){return e(this).offset().left>e(document).scrollLeft()+e(window).width()/2?"e":"w"},e.fn.tipsy.autoBounds=function(t,i){return function(){var a={ns:i[0],ew:i.length>1?i[1]:!1},n=e(document).scrollTop()+t,r=e(document).scrollLeft()+t,o=e(this);return o.offset().top<n&&(a.ns="n"),o.offset().left<r&&(a.ew="w"),e(window).width()+e(document).scrollLeft()-o.offset().left<t&&(a.ew="e"),e(window).height()+e(document).scrollTop()-o.offset().top<t&&(a.ns="s"),a.ns+(a.ew?a.ew:"")}}}(jQuery);var live_field,live_value,xhrValidateUsername=!1;jQuery(document).ready(function(){2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()}),jQuery(function(){jQuery(".um-search form *").keypress(function(e){return 13==e.which?(jQuery(".um-search form").submit(),!1):void 0}),jQuery(document).on("touchend",function(){jQuery(".select2-search, .select2-focusser").remove()})}),jQuery(window).load(function(){um_responsive(),um_modal_responsive()}),jQuery(window).resize(function(){responsive_Modal(),jQuery("img.cropper-hidden").cropper("destroy"),um_responsive(),um_modal_responsive()}),jQuery(document).ready(function(){jQuery(document).on("input change",".um-field input[type=text]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),um_conditional()}),jQuery(".um-field input[type=text]").trigger("input"),jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),jQuery(this).is(":checkbox")&&(jQuery(this).parents(".um-field").find("input:checked").length>1?(live_value="",jQuery(this).parents(".um-field").find("input:checked").each(function(){live_value=live_value+jQuery(this).val()+" "})):live_value=jQuery(this).parents(".um-field").find("input:checked").val()),jQuery(this).is(":radio")&&(live_value=jQuery(this).parents(".um-field").find("input[type=radio]:checked").val()),um_conditional()}),jQuery(".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]").trigger("change")}),jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeClass().addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeClass().addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){var e=(jQuery(this).parents(".um-field-area"),jQuery(this).parents("label"));e.hasClass("active")?(e.removeClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else var e=!1;var t=elem.attr("data-years"),i=elem.attr("data-date_min"),a=elem.attr("data-date_max"),n=i.split(","),r=a.split(","),o=n.length?new Date(n):null,s=n.length?new Date(r):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var l=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(l))}if(s&&"Invalid Date"==s.toString()&&3==r.length){var c=r[1]+"/"+r[2]+"/"+r[0];s=new Date(Date.parse(c))}elem.pickadate({selectYears:t,min:o,max:s,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(".um-s1").select2({allowClear:!0,minimumResultsForSearch:10}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),t>0&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),i=t.data("max_entries");return t.find(".um-field-group-body").length>1?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),i>0&&t.find(".um-field-group-body").length<i&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this).parent();t.addClass("loading");var i=jQuery(this).data("args"),a=jQuery(this).data("hook"),n=jQuery(this).parents(".um").find(".um-ajax-items");return jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_ajax_paginate",hook:a,args:i},complete:function(){t.removeClass("loading")},success:function(e){t.remove(),n.append(e)}}),!1}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),i=jQuery(this).data("user_id"),a=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_muted_action",hook:t,user_id:i,arguments:a},success:function(e){}}),!1}),jQuery(document).on("click","#um-search-button",function(){jQuery(this).parents("form").submit()})}),jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-more").hide(),t.find(".um-member-meta").slideDown(function(){UM_Member_Grid(i)}),t.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(i)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-less").hide(),t.find(".um-member-meta").slideUp(function(){t.find(".um-member-more").fadeIn(),UM_Member_Grid(i)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").submit(),!1})}),jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),5>t?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_profile_photo",metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_cover_photo",metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e)}),jQuery(document).ready(function(){var e=jQuery(".um-account-main").attr("data-current_tab");e&&jQuery(".um-account-tab[data-tab="+e+"]").show(),jQuery(document).on("click",".um-account-side li a",function(e){e.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var i=jQuery(this).attr("href"),a=jQuery(this).attr("data-tab");return window.history.pushState("","",i),jQuery(".um-account-tab").hide(),jQuery(".um-account-tab[data-tab="+a+"]").fadeIn(),jQuery(".um-account-nav a").removeClass("current"),jQuery(".um-account-nav a[data-tab="+a+"]").addClass("current"),!1}),jQuery(document).on("click",".um-account-nav a",function(e){e.preventDefault();var t=jQuery(this).attr("data-tab"),i=jQuery(this).parents("div"),a=jQuery(this);return jQuery(".um-account-tab").hide(),a.hasClass("current")?(i.next(".um-account-tab").slideUp(),a.removeClass("current")):(i.next(".um-account-tab").slideDown(),a.parents("div").find("a").removeClass("current"),a.addClass("current")),jQuery(".um-account-side li a").removeClass("current"),jQuery(".um-account-side li a[data-tab="+t+"]").addClass("current"),!1})});
core/lib/upload/um-image-upload.php CHANGED
@@ -33,7 +33,7 @@ if(isset($_FILES[$id]['name'])) {
33
 
34
  } else {
35
  $file = "stream_photo_".md5($file)."_".uniqid().".".$ext;
36
- $ret[] = $ultimatemember->files->new_image_upload_temp( $temp, $file, um_get_option('image_compression') );
37
 
38
  }
39
 
33
 
34
  } else {
35
  $file = "stream_photo_".md5($file)."_".uniqid().".".$ext;
36
+ $ret[ ] = $ultimatemember->files->new_image_upload_temp( $temp, $file, um_get_option('image_compression') );
37
 
38
  }
39
 
core/um-actions-form.php CHANGED
@@ -152,6 +152,10 @@
152
  $form_id = $args['form_id'];
153
  $mode = $args['mode'];
154
  $fields = unserialize( $args['custom_fields'] );
 
 
 
 
155
 
156
  if( isset( $fields ) && ! empty( $fields ) ){
157
  foreach( $fields as $key => $array ) {
@@ -162,6 +166,10 @@
162
  $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
163
  }
164
 
 
 
 
 
165
  if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
166
  $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
167
  }
@@ -350,7 +358,9 @@
350
 
351
  if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
352
  $ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
353
- } else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
 
 
354
  $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
355
  } else if ( !is_email( $args[$key] ) ) {
356
  $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
@@ -364,6 +374,17 @@
364
  $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
365
  } else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
366
  $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
 
 
 
 
 
 
 
 
 
 
 
367
  }
368
 
369
  }
152
  $form_id = $args['form_id'];
153
  $mode = $args['mode'];
154
  $fields = unserialize( $args['custom_fields'] );
155
+
156
+ if ( get_post_meta( $form_id, '_um_profile_photo_required', true ) && empty( $args['profile_photo'] ) ) {
157
+ $ultimatemember->form->add_error('profile_photo', sprintf(__('%s is required.','ultimatemember'), 'Profile Photo' ) );
158
+ }
159
 
160
  if( isset( $fields ) && ! empty( $fields ) ){
161
  foreach( $fields as $key => $array ) {
166
  $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
167
  }
168
 
169
+ if ( isset( $array['type'] ) && $array['type'] == 'user_tags' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) ) {
170
+ $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
171
+ }
172
+
173
  if ( isset( $array['type'] ) && $array['type'] == 'radio' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
174
  $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
175
  }
358
 
359
  if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
360
  $ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
361
+ } else if ( in_array( $mode, array('register') ) && email_exists( $args[$key] ) ) {
362
+ $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
363
+ } else if ( in_array( $mode, array('profile') ) && email_exists( $args[$key] ) != $args['user_id'] ) {
364
  $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
365
  } else if ( !is_email( $args[$key] ) ) {
366
  $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
374
  $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
375
  } else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
376
  $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
377
+ } else if ( $args[$key] != '' ) {
378
+
379
+ $users = get_users('meta_value='.$args[ $key ]);
380
+
381
+ foreach ( $users as $user ) {
382
+ if( $user->ID != $args['user_id'] ){
383
+ $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
384
+ }
385
+ }
386
+
387
+
388
  }
389
 
390
  }
core/um-actions-login.php CHANGED
@@ -6,24 +6,24 @@
6
  add_action('um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login', 10);
7
  function um_submit_form_errors_hook_login( $args ){
8
  global $ultimatemember;
9
-
10
  $is_email = false;
11
-
12
  $form_id = $args['form_id'];
13
  $mode = $args['mode'];
14
 
15
  if ( isset( $args['username'] ) && $args['username'] == '' ) {
16
  $ultimatemember->form->add_error( 'username', __('Please enter your username or email','ultimatemember') );
17
  }
18
-
19
  if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
20
  $ultimatemember->form->add_error( 'user_login', __('Please enter your username','ultimatemember') );
21
  }
22
-
23
  if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
24
  $ultimatemember->form->add_error( 'user_email', __('Please enter your email','ultimatemember') );
25
  }
26
-
27
  if ( isset( $args['username'] ) ) {
28
  $field = 'username';
29
  if ( is_email( $args['username'] ) ) {
@@ -42,7 +42,7 @@
42
  $field = 'user_login';
43
  $user_name = $args['user_login'];
44
  }
45
-
46
  if ( !username_exists( $user_name ) ) {
47
  if ( $is_email ) {
48
  $ultimatemember->form->add_error( $field, __(' Sorry, we can\'t find an account with that email address','ultimatemember') );
@@ -54,23 +54,52 @@
54
  $ultimatemember->form->add_error( 'user_password', __('Please enter your password','ultimatemember') );
55
  }
56
  }
57
-
58
  $user = get_user_by( 'login', $user_name );
59
  if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID) ) {
60
  $ultimatemember->login->auth_id = username_exists( $user_name );
61
  } else {
62
  $ultimatemember->form->add_error( 'user_password', __('Password is incorrect. Please try again.','ultimatemember') );
63
  }
64
-
 
 
 
 
 
 
 
 
65
  }
66
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  /***
68
  *** @login checks thru the frontend login
69
  ***/
70
  add_action('um_submit_form_errors_hook_logincheck', 'um_submit_form_errors_hook_logincheck', 9999 );
71
  function um_submit_form_errors_hook_logincheck($args){
72
  global $ultimatemember;
73
-
74
  // Logout if logged in
75
  if ( is_user_logged_in() ) {
76
  wp_logout();
@@ -78,10 +107,10 @@
78
 
79
  $user_id = ( isset( $ultimatemember->login->auth_id ) ) ? $ultimatemember->login->auth_id : '';
80
  um_fetch_user( $user_id );
81
-
82
  $status = um_user('account_status'); // account status
83
  switch( $status ) {
84
-
85
  // If user can't login to site...
86
  case 'inactive':
87
  case 'awaiting_admin_review':
@@ -90,15 +119,15 @@
90
  um_reset_user();
91
  exit( wp_redirect( add_query_arg( 'err', esc_attr( $status ), $ultimatemember->permalinks->get_current_url() ) ) );
92
  break;
93
-
94
  }
95
-
96
  if ( isset( $args['form_id'] ) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset( $_POST[ $ultimatemember->honeypot ] ) ) {
97
  exit( wp_redirect( um_get_core_page('login') ) );
98
  }
99
-
100
  }
101
-
102
  /***
103
  *** @store last login timestamp
104
  ***/
@@ -107,7 +136,7 @@
107
  delete_user_meta( $user_id, '_um_last_login' );
108
  update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
109
  }
110
-
111
  add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );
112
  function um_store_lastlogin_timestamp_( $login ) {
113
  $user = get_user_by('login',$login);
@@ -115,7 +144,7 @@
115
  delete_user_meta( $user_id, '_um_last_login' );
116
  update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
117
  }
118
-
119
  /***
120
  *** @login user
121
  ***/
@@ -125,57 +154,57 @@
125
  extract( $args );
126
 
127
  $rememberme = ( isset($args['rememberme']) ) ? 1 : 0;
128
-
129
  if ( um_get_option('deny_admin_frontend_login') && strstr( um_user('wp_roles' ), 'administrator' ) )
130
  wp_die( __('This action has been prevented for security measures.','ultimatemember') );
131
-
132
  $ultimatemember->user->auto_login( um_user('ID'), $rememberme );
133
-
134
  // Hook that runs after successful login and before user is redirected
135
  do_action('um_on_login_before_redirect', um_user('ID') );
136
-
137
  // Priority redirect
138
  if ( isset( $args['redirect_to'] ) && ! empty( $args['redirect_to'] ) ) {
139
  exit( wp_redirect( urldecode( $args['redirect_to'] ) ) );
140
  }
141
-
142
  // Role redirect
143
  $after = um_user('after_login');
144
  switch( $after ) {
145
-
146
  case 'redirect_admin':
147
  exit( wp_redirect( admin_url() ) );
148
  break;
149
-
150
  case 'redirect_profile':
151
  exit( wp_redirect( um_user_profile_url() ) );
152
  break;
153
-
154
  case 'redirect_url':
155
  exit( wp_redirect( um_user('login_redirect_url') ) );
156
  break;
157
-
158
  case 'refresh':
159
  exit( wp_redirect( $ultimatemember->permalinks->get_current_url() ) );
160
  break;
161
-
162
  }
163
-
164
  }
165
-
166
  /***
167
  *** @form processing
168
  ***/
169
  add_action('um_submit_form_login', 'um_submit_form_login', 10);
170
  function um_submit_form_login($args){
171
  global $ultimatemember;
172
-
173
  if ( !isset($ultimatemember->form->errors) ) {
174
  do_action( 'um_user_login', $args );
175
  }
176
-
177
  do_action('um_user_login_extra_hook', $args );
178
-
179
  }
180
 
181
  /***
@@ -187,18 +216,18 @@
187
 
188
  // DO NOT add when reviewing user's details
189
  if ( $ultimatemember->user->preview == true && is_admin() ) return;
190
-
191
  $primary_btn_word = $args['primary_btn_word'];
192
  $primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word, $args );
193
-
194
  $secondary_btn_word = $args['secondary_btn_word'];
195
  $secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word, $args );
196
-
197
  $secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
198
  $secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args );
199
-
200
  ?>
201
-
202
  <div class="um-col-alt">
203
 
204
  <?php if ( isset( $args['show_rememberme'] ) && $args['show_rememberme'] ) {
@@ -207,20 +236,20 @@
207
  } ?>
208
 
209
  <?php if ( isset($args['secondary_btn']) && $args['secondary_btn'] != 0 ) { ?>
210
-
211
  <div class="um-left um-half"><input type="submit" value="<?php echo $primary_btn_word; ?>" class="um-button" /></div>
212
  <div class="um-right um-half"><a href="<?php echo $secondary_btn_url; ?>" class="um-button um-alt"><?php echo $secondary_btn_word; ?></a></div>
213
-
214
  <?php } else { ?>
215
-
216
  <div class="um-center"><input type="submit" value="<?php echo $args['primary_btn_word']; ?>" class="um-button" /></div>
217
-
218
  <?php } ?>
219
-
220
  <div class="um-clear"></div>
221
-
222
  </div>
223
-
224
  <?php
225
  }
226
 
@@ -228,27 +257,27 @@
228
  *** @Display a forgot password link
229
  ***/
230
  add_action('um_after_login_fields', 'um_after_login_submit', 1001);
231
- function um_after_login_submit( $args ){
232
  global $ultimatemember;
233
 
234
  if ( $args['forgot_pass_link'] == 0 ) return;
235
-
236
  ?>
237
-
238
  <div class="um-col-alt-b">
239
  <a href="<?php echo um_get_core_page('password-reset'); ?>" class="um-link-alt"><?php _e('Forgot your password?','ultimatemember'); ?></a>
240
  </div>
241
-
242
  <?php
243
  }
244
-
245
  /***
246
  *** @Show Fields
247
  ***/
248
  add_action('um_main_login_fields', 'um_add_login_fields', 100);
249
  function um_add_login_fields($args){
250
  global $ultimatemember;
251
-
252
  echo $ultimatemember->fields->display( 'login', $args );
253
-
254
- }
6
  add_action('um_submit_form_errors_hook_login', 'um_submit_form_errors_hook_login', 10);
7
  function um_submit_form_errors_hook_login( $args ){
8
  global $ultimatemember;
9
+
10
  $is_email = false;
11
+
12
  $form_id = $args['form_id'];
13
  $mode = $args['mode'];
14
 
15
  if ( isset( $args['username'] ) && $args['username'] == '' ) {
16
  $ultimatemember->form->add_error( 'username', __('Please enter your username or email','ultimatemember') );
17
  }
18
+
19
  if ( isset( $args['user_login'] ) && $args['user_login'] == '' ) {
20
  $ultimatemember->form->add_error( 'user_login', __('Please enter your username','ultimatemember') );
21
  }
22
+
23
  if ( isset( $args['user_email'] ) && $args['user_email'] == '' ) {
24
  $ultimatemember->form->add_error( 'user_email', __('Please enter your email','ultimatemember') );
25
  }
26
+
27
  if ( isset( $args['username'] ) ) {
28
  $field = 'username';
29
  if ( is_email( $args['username'] ) ) {
42
  $field = 'user_login';
43
  $user_name = $args['user_login'];
44
  }
45
+
46
  if ( !username_exists( $user_name ) ) {
47
  if ( $is_email ) {
48
  $ultimatemember->form->add_error( $field, __(' Sorry, we can\'t find an account with that email address','ultimatemember') );
54
  $ultimatemember->form->add_error( 'user_password', __('Please enter your password','ultimatemember') );
55
  }
56
  }
57
+
58
  $user = get_user_by( 'login', $user_name );
59
  if ( $user && wp_check_password( $args['user_password'], $user->data->user_pass, $user->ID) ) {
60
  $ultimatemember->login->auth_id = username_exists( $user_name );
61
  } else {
62
  $ultimatemember->form->add_error( 'user_password', __('Password is incorrect. Please try again.','ultimatemember') );
63
  }
64
+
65
+ // add a way for other plugins like wp limit login
66
+ // to limit the login attempts
67
+ $user = apply_filters( 'authenticate', null, $user_name, $args['user_password'] );
68
+
69
+ // if there is an error notify wp
70
+ if( $ultimatemember->form->has_error( $field ) || $ultimatemember->form->has_error( $user_password ) ) {
71
+ do_action( 'wp_login_failed', $user_name );
72
+ }
73
  }
74
+
75
+ /**
76
+ * Display the login errors from other plugins
77
+ */
78
+ add_action( 'um_before_login_fields', 'um_display_login_errors' );
79
+ function um_display_login_errors( $args ) {
80
+ global $ultimatemember;
81
+
82
+ if( $ultimatemember->form->count_errors() > 0 ) {
83
+ $error = array_values( $ultimatemember->form->errors );
84
+ $error = array_shift( $error );
85
+ }
86
+
87
+ // hook for other plugins to display error
88
+ $errors = trim( apply_filters( 'login_errors', $error ) );
89
+
90
+ if( trim( $errors ) )
91
+ {
92
+ echo '<p class="um-notice err"><i class="um-icon-ios-close-empty" onclick="jQuery(this).parent().fadeOut();"></i>' . $errors . '</p>';
93
+ }
94
+ }
95
+
96
  /***
97
  *** @login checks thru the frontend login
98
  ***/
99
  add_action('um_submit_form_errors_hook_logincheck', 'um_submit_form_errors_hook_logincheck', 9999 );
100
  function um_submit_form_errors_hook_logincheck($args){
101
  global $ultimatemember;
102
+
103
  // Logout if logged in
104
  if ( is_user_logged_in() ) {
105
  wp_logout();
107
 
108
  $user_id = ( isset( $ultimatemember->login->auth_id ) ) ? $ultimatemember->login->auth_id : '';
109
  um_fetch_user( $user_id );
110
+
111
  $status = um_user('account_status'); // account status
112
  switch( $status ) {
113
+
114
  // If user can't login to site...
115
  case 'inactive':
116
  case 'awaiting_admin_review':
119
  um_reset_user();
120
  exit( wp_redirect( add_query_arg( 'err', esc_attr( $status ), $ultimatemember->permalinks->get_current_url() ) ) );
121
  break;
122
+
123
  }
124
+
125
  if ( isset( $args['form_id'] ) && $args['form_id'] == $ultimatemember->shortcodes->core_login_form() && $ultimatemember->form->errors && !isset( $_POST[ $ultimatemember->honeypot ] ) ) {
126
  exit( wp_redirect( um_get_core_page('login') ) );
127
  }
128
+
129
  }
130
+
131
  /***
132
  *** @store last login timestamp
133
  ***/
136
  delete_user_meta( $user_id, '_um_last_login' );
137
  update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
138
  }
139
+
140
  add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );
141
  function um_store_lastlogin_timestamp_( $login ) {
142
  $user = get_user_by('login',$login);
144
  delete_user_meta( $user_id, '_um_last_login' );
145
  update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
146
  }
147
+
148
  /***
149
  *** @login user
150
  ***/
154
  extract( $args );
155
 
156
  $rememberme = ( isset($args['rememberme']) ) ? 1 : 0;
157
+
158
  if ( um_get_option('deny_admin_frontend_login') && strstr( um_user('wp_roles' ), 'administrator' ) )
159
  wp_die( __('This action has been prevented for security measures.','ultimatemember') );
160
+
161
  $ultimatemember->user->auto_login( um_user('ID'), $rememberme );
162
+
163
  // Hook that runs after successful login and before user is redirected
164
  do_action('um_on_login_before_redirect', um_user('ID') );
165
+
166
  // Priority redirect
167
  if ( isset( $args['redirect_to'] ) && ! empty( $args['redirect_to'] ) ) {
168
  exit( wp_redirect( urldecode( $args['redirect_to'] ) ) );
169
  }
170
+
171
  // Role redirect
172
  $after = um_user('after_login');
173
  switch( $after ) {
174
+
175
  case 'redirect_admin':
176
  exit( wp_redirect( admin_url() ) );
177
  break;
178
+
179
  case 'redirect_profile':
180
  exit( wp_redirect( um_user_profile_url() ) );
181
  break;
182
+
183
  case 'redirect_url':
184
  exit( wp_redirect( um_user('login_redirect_url') ) );
185
  break;
186
+
187
  case 'refresh':
188
  exit( wp_redirect( $ultimatemember->permalinks->get_current_url() ) );
189
  break;
190
+
191
  }
192
+
193
  }
194
+
195
  /***
196
  *** @form processing
197
  ***/
198
  add_action('um_submit_form_login', 'um_submit_form_login', 10);
199
  function um_submit_form_login($args){
200
  global $ultimatemember;
201
+
202
  if ( !isset($ultimatemember->form->errors) ) {
203
  do_action( 'um_user_login', $args );
204
  }
205
+
206
  do_action('um_user_login_extra_hook', $args );
207
+
208
  }
209
 
210
  /***
216
 
217
  // DO NOT add when reviewing user's details
218
  if ( $ultimatemember->user->preview == true && is_admin() ) return;
219
+
220
  $primary_btn_word = $args['primary_btn_word'];
221
  $primary_btn_word = apply_filters('um_login_form_button_one', $primary_btn_word, $args );
222
+
223
  $secondary_btn_word = $args['secondary_btn_word'];
224
  $secondary_btn_word = apply_filters('um_login_form_button_two', $secondary_btn_word, $args );
225
+
226
  $secondary_btn_url = ( isset( $args['secondary_btn_url'] ) && $args['secondary_btn_url'] ) ? $args['secondary_btn_url'] : um_get_core_page('register');
227
  $secondary_btn_url = apply_filters('um_login_form_button_two_url', $secondary_btn_url, $args );
228
+
229
  ?>
230
+
231
  <div class="um-col-alt">
232
 
233
  <?php if ( isset( $args['show_rememberme'] ) && $args['show_rememberme'] ) {
236
  } ?>
237
 
238
  <?php if ( isset($args['secondary_btn']) && $args['secondary_btn'] != 0 ) { ?>
239
+
240
  <div class="um-left um-half"><input type="submit" value="<?php echo $primary_btn_word; ?>" class="um-button" /></div>
241
  <div class="um-right um-half"><a href="<?php echo $secondary_btn_url; ?>" class="um-button um-alt"><?php echo $secondary_btn_word; ?></a></div>
242
+
243
  <?php } else { ?>
244
+
245
  <div class="um-center"><input type="submit" value="<?php echo $args['primary_btn_word']; ?>" class="um-button" /></div>
246
+
247
  <?php } ?>
248
+
249
  <div class="um-clear"></div>
250
+
251
  </div>
252
+
253
  <?php
254
  }
255
 
257
  *** @Display a forgot password link
258
  ***/
259
  add_action('um_after_login_fields', 'um_after_login_submit', 1001);
260
+ function um_after_login_submit( $args ){
261
  global $ultimatemember;
262
 
263
  if ( $args['forgot_pass_link'] == 0 ) return;
264
+
265
  ?>
266
+
267
  <div class="um-col-alt-b">
268
  <a href="<?php echo um_get_core_page('password-reset'); ?>" class="um-link-alt"><?php _e('Forgot your password?','ultimatemember'); ?></a>
269
  </div>
270
+
271
  <?php
272
  }
273
+
274
  /***
275
  *** @Show Fields
276
  ***/
277
  add_action('um_main_login_fields', 'um_add_login_fields', 100);
278
  function um_add_login_fields($args){
279
  global $ultimatemember;
280
+
281
  echo $ultimatemember->fields->display( 'login', $args );
282
+
283
+ }
core/um-actions-password.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
-
3
  /***
4
  *** @process a new request
5
  ***/
@@ -8,7 +8,7 @@
8
  global $ultimatemember;
9
 
10
  $user = $_POST['username_b'];
11
-
12
  if ( !is_email( $user ) ) {
13
  $data = get_user_by( 'login', $user );
14
  $user_email = $data->user_email;
@@ -19,15 +19,15 @@
19
 
20
  $ultimatemember->password->reset_request['user_id'] = $data->ID;
21
  $ultimatemember->password->reset_request['user_email'] = $user_email;
22
-
23
  um_fetch_user( $data->ID );
24
-
25
  $ultimatemember->user->password_reset();
26
 
27
  um_reset_user();
28
-
29
  }
30
-
31
  /***
32
  *** @process a change request
33
  ***/
@@ -37,32 +37,32 @@
37
  extract( $args );
38
 
39
  wp_set_password( $args['user_password'], $args['user_id'] );
40
-
41
  delete_user_meta( $args['user_id'], 'reset_pass_hash');
42
  delete_user_meta( $args['user_id'], 'reset_pass_hash_token');
43
  delete_user_meta( $args['user_id'], 'password_rst_attempts');
44
 
45
  do_action('um_after_changing_user_password', $args['user_id'] );
46
-
47
-
48
  if ( is_user_logged_in() ) {
49
  wp_logout();
50
  }
51
-
52
  exit( wp_redirect( um_get_core_page('login', 'password_changed') ) );
53
-
54
  }
55
-
56
  /**
57
  * Overrides password changed notification
58
- *
59
  */
60
  function um_send_password_change_email( $args ){
61
 
62
  global $ultimatemember;
63
 
64
  um_fetch_user( $user_id );
65
-
66
  $ultimatemember->user->password_changed();
67
 
68
  um_reset_user();
@@ -70,7 +70,7 @@
70
 
71
  return false;
72
  }
73
-
74
  /***
75
  *** @This is executed after changing password
76
  ***/
@@ -79,20 +79,20 @@
79
  global $ultimatemember;
80
 
81
  }
82
-
83
  /***
84
  *** @Error handler: reset password
85
  ***/
86
  add_action('um_reset_password_errors_hook','um_reset_password_errors_hook');
87
  function um_reset_password_errors_hook( $args ) {
88
  global $ultimatemember;
89
-
90
  if ( $_POST[ $ultimatemember->honeypot ] != '' )
91
  wp_die('Hello, spam bot!');
92
 
93
  $form_timestamp = trim($_POST['timestamp']);
94
  $live_timestamp = current_time( 'timestamp' );
95
-
96
  if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
97
  wp_die( __('Hello, spam bot!') );
98
 
@@ -102,9 +102,9 @@
102
  if ( strlen(trim( $_POST['username_b'] ) ) == 0 ) {
103
  $ultimatemember->form->add_error('username_b', __('Please provide your username or email','ultimatemember') );
104
  }
105
-
106
  $user = $_POST['username_b'];
107
-
108
  if ( ( !is_email( $user ) && !username_exists( $user ) ) || ( is_email( $user ) && !email_exists( $user ) ) ) {
109
  $ultimatemember->form->add_error('username_b', __('We can\'t find an account registered with that address or username','ultimatemember') );
110
  } else {
@@ -120,38 +120,38 @@
120
  update_user_meta( $user_id, 'password_rst_attempts', $attempts + 1 );
121
  }
122
  }
123
-
124
  }
125
-
126
  /***
127
  *** @Error handler: changing password
128
  ***/
129
  add_action('um_change_password_errors_hook','um_change_password_errors_hook');
130
  function um_change_password_errors_hook( $args ) {
131
  global $ultimatemember;
132
-
133
  if ( $_POST[ $ultimatemember->honeypot ] != '' )
134
  wp_die('Hello, spam bot!');
135
 
136
  $form_timestamp = trim($_POST['timestamp']);
137
  $live_timestamp = current_time( 'timestamp' );
138
-
139
  if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
140
  wp_die( __('Hello, spam bot!') );
141
 
142
  if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 )
143
  wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
144
-
145
  if ( !$args['user_password'] ) {
146
  $ultimatemember->form->add_error('user_password', __('You must enter a new password','ultimatemember') );
147
  }
148
 
149
  if ( um_get_option('reset_require_strongpass') ) {
150
-
151
  if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) {
152
  $ultimatemember->form->add_error('user_password', __('Your password must contain at least 8 characters','ultimatemember') );
153
  }
154
-
155
  if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) {
156
  $ultimatemember->form->add_error('user_password', __('Your password must contain less than 30 characters','ultimatemember') );
157
  }
@@ -159,99 +159,101 @@
159
  if ( !$ultimatemember->validation->strong_pass( $args['user_password'] ) ) {
160
  $ultimatemember->form->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimatemember') );
161
  }
162
-
163
  }
164
 
165
  if ( !$args['confirm_user_password'] ) {
166
  $ultimatemember->form->add_error('confirm_user_password', __('You must confirm your new password','ultimatemember') );
167
  }
168
-
169
  if ( $args['user_password'] != $args['confirm_user_password'] ) {
170
  $ultimatemember->form->add_error('confirm_user_password', __('Your passwords do not match','ultimatemember') );
171
  }
172
 
173
  }
174
-
175
  /***
176
  *** @hidden fields
177
  ***/
178
  add_action('um_change_password_page_hidden_fields','um_change_password_page_hidden_fields');
179
  function um_change_password_page_hidden_fields( $args ) {
180
-
181
  ?>
182
-
183
  <input type="hidden" name="_um_password_change" id="_um_password_change" value="1" />
184
-
185
  <input type="hidden" name="user_id" id="user_id" value="<?php echo $args['user_id']; ?>" />
186
-
187
  <?php
188
-
189
  }
190
-
191
  /***
192
  *** @hidden fields
193
  ***/
194
  add_action('um_reset_password_page_hidden_fields','um_reset_password_page_hidden_fields');
195
  function um_reset_password_page_hidden_fields( $args ) {
196
-
197
  ?>
198
-
199
  <input type="hidden" name="_um_password_reset" id="_um_password_reset" value="1" />
200
-
201
  <?php
202
-
203
  }
204
-
205
  /***
206
  *** @form content
207
  ***/
208
  add_action('um_reset_password_form', 'um_reset_password_form');
209
- function um_reset_password_form() {
210
-
211
  global $ultimatemember;
212
 
213
  $fields = $ultimatemember->builtin->get_specific_fields('password_reset_text,username_b'); ?>
214
-
215
  <?php $output = null;
216
  foreach( $fields as $key => $data ) {
217
  $output .= $ultimatemember->fields->edit_field( $key, $data );
218
  }echo $output; ?>
219
-
 
 
220
  <div class="um-col-alt um-col-alt-b">
221
-
222
  <div class="um-center"><input type="submit" value="<?php _e('Reset my password','ultimatemember'); ?>" class="um-button" /></div>
223
-
224
  <div class="um-clear"></div>
225
-
226
  </div>
227
-
228
  <?php
229
-
230
  }
231
-
232
  /***
233
  *** @change password form
234
  ***/
235
  add_action('um_change_password_form', 'um_change_password_form');
236
  function um_change_password_form() {
237
-
238
  global $ultimatemember;
239
 
240
  $fields = $ultimatemember->builtin->get_specific_fields('user_password'); ?>
241
-
242
  <?php $output = null;
243
  foreach( $fields as $key => $data ) {
244
  $output .= $ultimatemember->fields->edit_field( $key, $data );
245
  }echo $output; ?>
246
-
247
  <div class="um-col-alt um-col-alt-b">
248
-
249
  <div class="um-center"><input type="submit" value="<?php _e('Change my password','ultimatemember'); ?>" class="um-button" /></div>
250
-
251
  <div class="um-clear"></div>
252
-
253
  </div>
254
-
255
  <?php
256
-
257
- }
1
  <?php
2
+
3
  /***
4
  *** @process a new request
5
  ***/
8
  global $ultimatemember;
9
 
10
  $user = $_POST['username_b'];
11
+
12
  if ( !is_email( $user ) ) {
13
  $data = get_user_by( 'login', $user );
14
  $user_email = $data->user_email;
19
 
20
  $ultimatemember->password->reset_request['user_id'] = $data->ID;
21
  $ultimatemember->password->reset_request['user_email'] = $user_email;
22
+
23
  um_fetch_user( $data->ID );
24
+
25
  $ultimatemember->user->password_reset();
26
 
27
  um_reset_user();
28
+
29
  }
30
+
31
  /***
32
  *** @process a change request
33
  ***/
37
  extract( $args );
38
 
39
  wp_set_password( $args['user_password'], $args['user_id'] );
40
+
41
  delete_user_meta( $args['user_id'], 'reset_pass_hash');
42
  delete_user_meta( $args['user_id'], 'reset_pass_hash_token');
43
  delete_user_meta( $args['user_id'], 'password_rst_attempts');
44
 
45
  do_action('um_after_changing_user_password', $args['user_id'] );
46
+
47
+
48
  if ( is_user_logged_in() ) {
49
  wp_logout();
50
  }
51
+
52
  exit( wp_redirect( um_get_core_page('login', 'password_changed') ) );
53
+
54
  }
55
+
56
  /**
57
  * Overrides password changed notification
58
+ *
59
  */
60
  function um_send_password_change_email( $args ){
61
 
62
  global $ultimatemember;
63
 
64
  um_fetch_user( $user_id );
65
+
66
  $ultimatemember->user->password_changed();
67
 
68
  um_reset_user();
70
 
71
  return false;
72
  }
73
+
74
  /***
75
  *** @This is executed after changing password
76
  ***/
79
  global $ultimatemember;
80
 
81
  }
82
+
83
  /***
84
  *** @Error handler: reset password
85
  ***/
86
  add_action('um_reset_password_errors_hook','um_reset_password_errors_hook');
87
  function um_reset_password_errors_hook( $args ) {
88
  global $ultimatemember;
89
+
90
  if ( $_POST[ $ultimatemember->honeypot ] != '' )
91
  wp_die('Hello, spam bot!');
92
 
93
  $form_timestamp = trim($_POST['timestamp']);
94
  $live_timestamp = current_time( 'timestamp' );
95
+
96
  if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
97
  wp_die( __('Hello, spam bot!') );
98
 
102
  if ( strlen(trim( $_POST['username_b'] ) ) == 0 ) {
103
  $ultimatemember->form->add_error('username_b', __('Please provide your username or email','ultimatemember') );
104
  }
105
+
106
  $user = $_POST['username_b'];
107
+
108
  if ( ( !is_email( $user ) && !username_exists( $user ) ) || ( is_email( $user ) && !email_exists( $user ) ) ) {
109
  $ultimatemember->form->add_error('username_b', __('We can\'t find an account registered with that address or username','ultimatemember') );
110
  } else {
120
  update_user_meta( $user_id, 'password_rst_attempts', $attempts + 1 );
121
  }
122
  }
123
+
124
  }
125
+
126
  /***
127
  *** @Error handler: changing password
128
  ***/
129
  add_action('um_change_password_errors_hook','um_change_password_errors_hook');
130
  function um_change_password_errors_hook( $args ) {
131
  global $ultimatemember;
132
+
133
  if ( $_POST[ $ultimatemember->honeypot ] != '' )
134
  wp_die('Hello, spam bot!');
135
 
136
  $form_timestamp = trim($_POST['timestamp']);
137
  $live_timestamp = current_time( 'timestamp' );
138
+
139
  if ( $form_timestamp == '' && um_get_option('enable_timebot') == 1 )
140
  wp_die( __('Hello, spam bot!') );
141
 
142
  if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 )
143
  wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
144
+
145
  if ( !$args['user_password'] ) {
146
  $ultimatemember->form->add_error('user_password', __('You must enter a new password','ultimatemember') );
147
  }
148
 
149
  if ( um_get_option('reset_require_strongpass') ) {
150
+
151
  if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) {
152
  $ultimatemember->form->add_error('user_password', __('Your password must contain at least 8 characters','ultimatemember') );
153
  }
154
+
155
  if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) {
156
  $ultimatemember->form->add_error('user_password', __('Your password must contain less than 30 characters','ultimatemember') );
157
  }
159
  if ( !$ultimatemember->validation->strong_pass( $args['user_password'] ) ) {
160
  $ultimatemember->form->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimatemember') );
161
  }
162
+
163
  }
164
 
165
  if ( !$args['confirm_user_password'] ) {
166
  $ultimatemember->form->add_error('confirm_user_password', __('You must confirm your new password','ultimatemember') );
167
  }
168
+
169
  if ( $args['user_password'] != $args['confirm_user_password'] ) {
170
  $ultimatemember->form->add_error('confirm_user_password', __('Your passwords do not match','ultimatemember') );
171
  }
172
 
173
  }
174
+
175
  /***
176
  *** @hidden fields
177
  ***/
178
  add_action('um_change_password_page_hidden_fields','um_change_password_page_hidden_fields');
179
  function um_change_password_page_hidden_fields( $args ) {
180
+
181
  ?>
182
+
183
  <input type="hidden" name="_um_password_change" id="_um_password_change" value="1" />
184
+
185
  <input type="hidden" name="user_id" id="user_id" value="<?php echo $args['user_id']; ?>" />
186
+
187
  <?php
188
+
189
  }
190
+
191
  /***
192
  *** @hidden fields
193
  ***/
194
  add_action('um_reset_password_page_hidden_fields','um_reset_password_page_hidden_fields');
195
  function um_reset_password_page_hidden_fields( $args ) {
196
+
197
  ?>
198
+
199
  <input type="hidden" name="_um_password_reset" id="_um_password_reset" value="1" />
200
+
201
  <?php
202
+
203
  }
204
+
205
  /***
206
  *** @form content
207
  ***/
208
  add_action('um_reset_password_form', 'um_reset_password_form');
209
+ function um_reset_password_form($args) {
210
+
211
  global $ultimatemember;
212
 
213
  $fields = $ultimatemember->builtin->get_specific_fields('password_reset_text,username_b'); ?>
214
+
215
  <?php $output = null;
216
  foreach( $fields as $key => $data ) {
217
  $output .= $ultimatemember->fields->edit_field( $key, $data );
218
  }echo $output; ?>
219
+
220
+ <?php do_action( 'um_after_password_reset_fields', $args ); ?>
221
+
222
  <div class="um-col-alt um-col-alt-b">
223
+
224
  <div class="um-center"><input type="submit" value="<?php _e('Reset my password','ultimatemember'); ?>" class="um-button" /></div>
225
+
226
  <div class="um-clear"></div>
227
+
228
  </div>
229
+
230
  <?php
231
+
232
  }
233
+
234
  /***
235
  *** @change password form
236
  ***/
237
  add_action('um_change_password_form', 'um_change_password_form');
238
  function um_change_password_form() {
239
+
240
  global $ultimatemember;
241
 
242
  $fields = $ultimatemember->builtin->get_specific_fields('user_password'); ?>
243
+
244
  <?php $output = null;
245
  foreach( $fields as $key => $data ) {
246
  $output .= $ultimatemember->fields->edit_field( $key, $data );
247
  }echo $output; ?>
248
+
249
  <div class="um-col-alt um-col-alt-b">
250
+
251
  <div class="um-center"><input type="submit" value="<?php _e('Change my password','ultimatemember'); ?>" class="um-button" /></div>
252
+
253
  <div class="um-clear"></div>
254
+
255
  </div>
256
+
257
  <?php
258
+
259
+ }
core/um-actions-profile.php CHANGED
@@ -120,7 +120,8 @@
120
  do_action('um_user_after_updating_profile', $to_update );
121
 
122
  if ( !isset( $args['is_signup'] ) ) {
123
- exit( wp_redirect( um_edit_my_profile_cancel_uri() ) );
 
124
  }
125
 
126
  }
@@ -406,6 +407,12 @@
406
  <?php do_action('um_after_header_meta', um_user('ID'), $args ); ?>
407
 
408
  </div><div class="um-clear"></div>
 
 
 
 
 
 
409
 
410
  <?php do_action('um_after_header_info', um_user('ID'), $args); ?>
411
 
120
  do_action('um_user_after_updating_profile', $to_update );
121
 
122
  if ( !isset( $args['is_signup'] ) ) {
123
+ $url = $ultimatemember->permalinks->profile_url();
124
+ exit( wp_redirect( um_edit_my_profile_cancel_uri( $url ) ) );
125
  }
126
 
127
  }
407
  <?php do_action('um_after_header_meta', um_user('ID'), $args ); ?>
408
 
409
  </div><div class="um-clear"></div>
410
+
411
+ <?php
412
+ if ( $ultimatemember->fields->is_error( 'profile_photo' ) ) {
413
+ echo $ultimatemember->fields->field_error( $ultimatemember->fields->show_error('profile_photo'), 'force_show' );
414
+ }
415
+ ?>
416
 
417
  <?php do_action('um_after_header_info', um_user('ID'), $args); ?>
418
 
core/um-builtin.php CHANGED
@@ -649,6 +649,16 @@ class UM_Builtin {
649
  'label' => __('E-mail Address','ultimatemember'),
650
  'required' => 0,
651
  'public' => 1,
 
 
 
 
 
 
 
 
 
 
652
  'editable' => 1,
653
  'validate' => 'unique_email',
654
  ),
649
  'label' => __('E-mail Address','ultimatemember'),
650
  'required' => 0,
651
  'public' => 1,
652
+ 'validate' => 'unique_email',
653
+ ),
654
+
655
+ 'secondary_user_email' => array(
656
+ 'title' => __('Secondary E-mail Address','ultimatemember'),
657
+ 'metakey' => 'secondary_user_email',
658
+ 'type' => 'text',
659
+ 'label' => __('Secondary E-mail Address','ultimatemember'),
660
+ 'required' => 0,
661
+ 'public' => 1,
662
  'editable' => 1,
663
  'validate' => 'unique_email',
664
  ),
core/um-fields.php CHANGED
@@ -298,18 +298,18 @@ class UM_Fields {
298
  $label = apply_filters("um_edit_label_all_fields", $label, $data );
299
  }
300
 
301
- $output .= '<label for="'.$key.$ultimatemember->form->form_suffix.'">'.$label.'</label>';
302
 
303
  if ( isset( $data['help'] ) && !empty( $data['help'] ) && $this->viewing == false && !strstr($key, 'confirm_user_pass') ) {
304
 
305
  if ( !$ultimatemember->mobile->isMobile() ) {
306
  if ( !isset( $this->disable_tooltips ) ) {
307
- $output .= '<span class="um-tip um-tip-w" title="'.$data['help'].'"><i class="um-icon-help-circled"></i></span>';
308
  }
309
  }
310
 
311
  if ( $ultimatemember->mobile->isMobile() || isset( $this->disable_tooltips ) ) {
312
- $output .= '<span class="um-tip-text">'. $data['help'] . '</span>';
313
  }
314
 
315
  }
@@ -909,7 +909,13 @@ class UM_Fields {
909
  if ( !um_can_edit_field( $data ) ) return;
910
 
911
  // fields that need to be disabled in edit mode (profile)
912
- if ( in_array( $key, array('user_email','username','user_login','user_password') ) && $this->editing == true && $this->set_mode == 'profile' ) {
 
 
 
 
 
 
913
  return;
914
  }
915
 
@@ -1573,8 +1579,11 @@ class UM_Fields {
1573
  if ( isset( $options_pair ) ) {
1574
  $option_value = $k;
1575
  }
 
 
 
1576
 
1577
- $output .= '<option value="' . htmlentities($option_value) . '" ';
1578
  if ( $this->is_selected($form_key, $option_value, $data) ) {
1579
  $output.= 'selected';
1580
  }
298
  $label = apply_filters("um_edit_label_all_fields", $label, $data );
299
  }
300
 
301
+ $output .= '<label for="'.$key.$ultimatemember->form->form_suffix.'">'.__( $label, UM_TEXTDOMAIN ).'</label>';
302
 
303
  if ( isset( $data['help'] ) && !empty( $data['help'] ) && $this->viewing == false && !strstr($key, 'confirm_user_pass') ) {
304
 
305
  if ( !$ultimatemember->mobile->isMobile() ) {
306
  if ( !isset( $this->disable_tooltips ) ) {
307
+ $output .= '<span class="um-tip um-tip-w" title="'.__( $data['help'], UM_TEXTDOMAIN ).'"><i class="um-icon-help-circled"></i></span>';
308
  }
309
  }
310
 
311
  if ( $ultimatemember->mobile->isMobile() || isset( $this->disable_tooltips ) ) {
312
+ $output .= '<span class="um-tip-text">'.__( $data['help'], UM_TEXTDOMAIN ). '</span>';
313
  }
314
 
315
  }
909
  if ( !um_can_edit_field( $data ) ) return;
910
 
911
  // fields that need to be disabled in edit mode (profile)
912
+ $arr_restricted_fields = array('user_email','username','user_login','user_password');
913
+
914
+ if( um_get_option('editable_primary_email_in_profile') == 1 ){
915
+ unset( $arr_restricted_fields[0] ); // remove user_email
916
+ }
917
+
918
+ if ( in_array( $key, $arr_restricted_fields ) && $this->editing == true && $this->set_mode == 'profile' ) {
919
  return;
920
  }
921
 
1579
  if ( isset( $options_pair ) ) {
1580
  $option_value = $k;
1581
  }
1582
+
1583
+ $option_value = htmlentities($option_value);
1584
+ $option_value = apply_filters('um_select_dropdown_dynamic_option_value', $option_value);
1585
 
1586
+ $output .= '<option value="' . $option_value . '" ';
1587
  if ( $this->is_selected($form_key, $option_value, $data) ) {
1588
  $output.= 'selected';
1589
  }
core/um-files.php CHANGED
@@ -192,15 +192,15 @@ class UM_Files {
192
 
193
  if ($info['mime'] == 'image/jpeg'){
194
 
195
- $image = imagecreatefromjpeg($source);
196
 
197
  } else if ($info['mime'] == 'image/gif'){
198
 
199
- $image = imagecreatefromgif($source);
200
 
201
  } else if ($info['mime'] == 'image/png'){
202
 
203
- $image = imagecreatefrompng($source);
204
 
205
  }
206
 
@@ -211,41 +211,75 @@ class UM_Files {
211
  $new_w = um_get_option('image_max_width');
212
  $new_h = round( $new_w / $ratio, 2 );
213
 
214
- $image_p = imagecreatetruecolor( $new_w, $new_h );
215
- imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
216
- $image_p = $this->fix_image_orientation($image_p, $source);
217
- imagejpeg( $image_p, $destination, $quality);
218
 
219
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
- $image = $this->fix_image_orientation($image, $source);
222
- imagejpeg( $image, $destination, $quality);
 
 
 
 
 
 
 
 
 
 
223
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
 
 
 
 
226
  }
227
 
228
  /***
229
  *** @Process a file
230
  ***/
231
- function upload_temp_file($source, $destination) {
232
 
233
- move_uploaded_file($source, $destination);
234
 
235
  }
236
 
237
  /***
238
  *** @Process a temp upload
239
  ***/
240
- function new_image_upload_temp($source, $destination, $quality = 100){
241
 
242
  $unique_dir = $this->unique_dir();
243
 
244
  $this->make_dir( $unique_dir['dir'] );
245
 
246
- $this->create_and_copy_image($source, $unique_dir['dir'] . $destination, $quality);
247
 
248
- $url = $unique_dir['url'] . $destination;
249
 
250
  return $url;
251
 
@@ -254,13 +288,13 @@ class UM_Files {
254
  /***
255
  *** @Process a temp upload for files
256
  ***/
257
- function new_file_upload_temp($source, $destination ){
258
 
259
  $unique_dir = $this->unique_dir();
260
 
261
  $this->make_dir( $unique_dir['dir'] );
262
 
263
- $this->upload_temp_file($source, $unique_dir['dir'] . $destination);
264
 
265
  $url = $unique_dir['url'] . $destination;
266
 
@@ -275,24 +309,24 @@ class UM_Files {
275
 
276
  $old = umask(0);
277
  @mkdir( $dir, 0755, true);
278
- umask($old);
279
 
280
  }
281
 
282
  /***
283
  *** @Get extension by mime type
284
  ***/
285
- function get_extension_by_mime_type($mime){
286
- $split = explode('/',$mime);
287
  return $split[1];
288
  }
289
 
290
  /***
291
  *** @Get file data
292
  ***/
293
- function get_file_data($file){
294
 
295
- $array['size'] = filesize($file);
296
 
297
  return $array;
298
  }
@@ -300,17 +334,17 @@ class UM_Files {
300
  /***
301
  *** @Get image data
302
  ***/
303
- function get_image_data($file){
304
 
305
- $array['size'] = filesize($file);
306
 
307
- $array['image'] = @getimagesize($file);
308
 
309
  if ( $array['image'] > 0 ) {
310
 
311
  $array['invalid_image'] = false;
312
 
313
- list($width, $height, $type, $attr) = @getimagesize($file);
314
 
315
  $array['width'] = $width;
316
  $array['height'] = $height;
@@ -330,12 +364,12 @@ class UM_Files {
330
  /***
331
  *** @Check image upload and handle errors
332
  ***/
333
- function check_image_upload($file, $field) {
334
  global $ultimatemember;
335
  $error = null;
336
 
337
- $fileinfo = $this->get_image_data($file);
338
- $data = $ultimatemember->fields->get_field($field);
339
 
340
  if ( $data == null ) {
341
  $data = apply_filters("um_custom_image_handle_{$field}", '' );
@@ -362,12 +396,12 @@ class UM_Files {
362
  /***
363
  *** @Check file upload and handle errors
364
  ***/
365
- function check_file_upload($file, $extension, $field) {
366
  global $ultimatemember;
367
  $error = null;
368
 
369
- $fileinfo = $this->get_file_data($file);
370
- $data = $ultimatemember->fields->get_field($field);
371
 
372
  if ( !$this->in_array( $extension, $data['allowed_types'] ) ) {
373
  $error = ( isset( $data['extension_error'] ) && !empty( $data['extension_error'] ) ) ? $data['extension_error'] : 'not allowed';
@@ -381,9 +415,12 @@ class UM_Files {
381
  /***
382
  *** @If a value exists in comma seperated list
383
  ***/
384
- function in_array($value, $array){
385
- if (in_array($value, explode(',',$array)))
 
386
  return true;
 
 
387
  return false;
388
  }
389
 
@@ -402,8 +439,8 @@ class UM_Files {
402
  unlink( $is_temp );
403
  rmdir( dirname( $is_temp ) );
404
  } else {
405
- die('Not a valid temp file');
406
- }
407
  }
408
 
409
  /***
@@ -442,13 +479,35 @@ class UM_Files {
442
  $targ_x2 = $crop[2];
443
  $targ_y2 = $crop[3];
444
 
445
- $img_r = imagecreatefromjpeg($file);
446
- $dst_r = imagecreatetruecolor( $targ_x2, $targ_y2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
 
448
- imagecopy( $dst_r, $img_r, 0, 0, $targ_x1, $targ_y1, $targ_x2, $targ_y2 );
449
- imagejpeg( $dst_r, $this->path_only( $file ) . basename( $file ), 100);
450
 
451
- $split = explode('/ultimatemember/temp/', $file);
452
  return $this->upload_temp_url . $split[1];
453
 
454
  }
@@ -480,19 +539,8 @@ class UM_Files {
480
  wp_die( __('Unauthorized to do this attempt.','ultimatemember') );
481
  }
482
 
483
- // name and extension stuff
484
- $source_name = basename( $source );
485
-
486
- if ( $key == 'profile_photo' ) {
487
- $source_name = 'profile_photo.jpg';
488
- }
489
-
490
- if ( $key == 'cover_photo' ) {
491
- $source_name = 'cover_photo.jpg';
492
- }
493
-
494
- $ext = '.' . pathinfo($source_name, PATHINFO_EXTENSION);
495
- $name = str_replace( $ext, '', $source_name );
496
  $filename = $name . $ext;
497
 
498
  // copy & overwrite file
@@ -501,25 +549,46 @@ class UM_Files {
501
  }
502
  copy( $source, $this->upload_basedir . $user_id . '/' . $filename );
503
 
 
 
504
  // thumbs
505
  if ( $key == 'profile_photo' ) {
506
 
507
  list($w, $h) = @getimagesize( $source );
 
508
 
509
  $sizes = um_get_option('photo_thumb_sizes');
510
  foreach( $sizes as $size ) {
 
 
 
511
 
512
  if ( file_exists( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext ) ) {
513
  unlink( $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext );
514
  }
515
 
516
  if ( $size < $w ) {
517
-
518
- $thumb_s = imagecreatefromjpeg( $source );
519
- $thumb = imagecreatetruecolor( $size, $size );
520
- imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $size, $w, $h );
521
- imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
522
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
  }
524
 
525
  }
@@ -545,11 +614,24 @@ class UM_Files {
545
 
546
  if ( $size < $w ) {
547
 
548
- $thumb_s = imagecreatefromjpeg( $source );
549
- $thumb = imagecreatetruecolor( $size, $height );
550
- imagecopyresampled( $thumb, $thumb_s, 0, 0, 0, 0, $size, $height, $w, $h );
551
- imagejpeg( $thumb, $this->upload_basedir . $user_id . '/' . $name . '-' . $size . $ext, 100);
552
-
 
 
 
 
 
 
 
 
 
 
 
 
 
553
  }
554
 
555
  }
192
 
193
  if ($info['mime'] == 'image/jpeg'){
194
 
195
+ $image = imagecreatefromjpeg( $source );
196
 
197
  } else if ($info['mime'] == 'image/gif'){
198
 
199
+ $image = imagecreatefromgif( $source );
200
 
201
  } else if ($info['mime'] == 'image/png'){
202
 
203
+ $image = imagecreatefrompng( $source );
204
 
205
  }
206
 
211
  $new_w = um_get_option('image_max_width');
212
  $new_h = round( $new_w / $ratio, 2 );
213
 
214
+ if ( $info['mime'] == 'image/jpeg' || $info['mime'] == 'image/gif' ){
 
 
 
215
 
216
+ $image_p = imagecreatetruecolor( $new_w, $new_h );
217
+ imagecopyresampled( $image_p, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
218
+ $image_p = $this->fix_image_orientation( $image_p, $source );
219
+
220
+ }else if( $info['mime'] == 'image/png' ){
221
+
222
+ $srcImage = $image;
223
+ $targetImage = imagecreatetruecolor( $new_w, $new_h );
224
+ imagealphablending( $targetImage, false );
225
+ imagesavealpha( $targetImage, true );
226
+ imagecopyresampled( $targetImage, $srcImage, 0, 0, 0, 0, $new_w, $new_h, $w, $h );
227
+
228
+ }
229
 
230
+ if ( $info['mime'] == 'image/jpeg' ){
231
+ $has_copied = imagejpeg( $image_p, $destination, $quality );
232
+ }else if ( $info['mime'] == 'image/gif' ){
233
+ $has_copied = imagegif( $image_p, $destination );
234
+ }else if ( $info['mime'] == 'image/png' ){
235
+ $has_copied = imagepng( $targetImage, $destination, 0 ,PNG_ALL_FILTERS);
236
+ }
237
+
238
+ $info['um_has_max_width'] = 'custom';
239
+ $info['um_has_copied'] = $has_copied ? 'yes':'no';
240
+
241
+ } else {
242
 
243
+ $image = $this->fix_image_orientation( $image, $source );
244
+
245
+ if ( $info['mime'] == 'image/jpeg' ){
246
+ $has_copied = imagejpeg( $image, $destination, $quality );
247
+ }else if ( $info['mime'] == 'image/gif' ){
248
+ $has_copied = imagegif( $image, $destination );
249
+ }else if ( $info['mime'] == 'image/png' ){
250
+ $has_copied = imagepng( $image , $destination , 0 ,PNG_ALL_FILTERS);
251
+ }
252
+
253
+ $info['um_has_max_width'] = 'default';
254
+ $info['um_has_copied'] = $has_copied ? 'yes':'no';
255
  }
256
 
257
+
258
+
259
+ return $info;
260
  }
261
 
262
  /***
263
  *** @Process a file
264
  ***/
265
+ function upload_temp_file( $source, $destination ) {
266
 
267
+ move_uploaded_file( $source, $destination );
268
 
269
  }
270
 
271
  /***
272
  *** @Process a temp upload
273
  ***/
274