mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
7 lines
219 KiB
JavaScript
7 lines
219 KiB
JavaScript
function um_conditional(){jQuery(".um-field.um-is-conditional").each(function(){for(var e=0,t=jQuery(this).data("key"),i=0;5>i;i++){var a=jQuery(this).data("cond-"+i+"-action"),n=jQuery(this).data("cond-"+i+"-field"),r=jQuery(this).data("cond-"+i+"-operator"),o=jQuery(this).data("cond-"+i+"-value");"show"==a&&n==live_field&&"undefined"!=typeof o&&("empty"==r&&(!live_value||""==live_value||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]"))),"not empty"==r&&(live_value&&""!=live_value||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]"))),"equals to"==r&&(o==live_value||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]"))),"not equals"==r&&(jQuery.isNumeric(o)&&parseInt(live_value)!=parseInt(o)&&live_value||e>0?(jQuery(this).fadeIn(),e++):!jQuery.isNumeric(o)&&o!=live_value||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]"))),"greater than"==r&&(jQuery.isNumeric(o)&&parseInt(live_value)>parseInt(o)||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]"))),"less than"==r&&(jQuery.isNumeric(o)&&parseInt(live_value)<parseInt(o)&&live_value||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]"))),"contains"==r&&(live_value&&live_value.indexOf(o)>=0||e>0?(jQuery(this).fadeIn(),e++):(jQuery(this).hide(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").hide(),um_reset_field("div.um-field[data-cond-"+i+"-field="+t+"]")))),"hide"==a&&n==live_field&&"undefined"!=typeof o&&("empty"==r&&(live_value&&""!=live_value?jQuery(this).fadeIn():(jQuery(this).hide(),e++)),"not empty"==r&&(live_value&&""!=live_value?(jQuery(this).hide(),e++):(jQuery(this).fadeIn(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").show())),"equals to"==r&&(o==live_value?(jQuery(this).hide(),e++):(jQuery(this).fadeIn(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").show())),"not equals"==r&&(jQuery.isNumeric(o)&&parseInt(live_value)!=parseInt(o)&&live_value?(jQuery(this).hide(),e++):jQuery.isNumeric(o)||o==live_value?(jQuery(this).fadeIn(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").show()):(jQuery(this).hide(),e++)),"greater than"==r&&(jQuery.isNumeric(o)&&parseInt(live_value)>parseInt(o)?(jQuery(this).hide(),e++):(jQuery(this).fadeIn(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").show())),"less than"==r&&(jQuery.isNumeric(o)&&parseInt(live_value)<parseInt(o)&&live_value?(jQuery(this).hide(),e++):(jQuery(this).fadeIn(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").show())),"contains"==r&&(live_value&&live_value.indexOf(o)>=0?(jQuery(this).hide(),e++):(jQuery(this).fadeIn(),jQuery("div.um-field[data-cond-"+i+"-field="+t+"]").show())))}})}function UM_check_password_matched(){jQuery(document).on("keyup","input[data-key=user_password],input[data-key=confirm_user_password]",function(e){var t=jQuery("input[data-key=user_password]").val(),i=jQuery("input[data-key=confirm_user_password]").val(),a=jQuery("input[data-key=user_password],input[data-key=confirm_user_password]");t||i?t!==i?a.removeClass("um-validate-matched").addClass("um-validate-not-matched"):a.removeClass("um-validate-not-matched").addClass("um-validate-matched"):a.removeClass("um-validate-matched").removeClass("um-validate-not-matched")})}function UM_check_username(){jQuery(document).on("keyup","input[data-key=user_login]:not([disabled=disabled])",function(){var e=jQuery("input[data-key=user_login]"),t=e.val();if(e.parents(".um-field").find(".um-field-error").length)var i=e.parents(".um-field").find(".um-field-error");else var i=jQuery('<div class="um-field-error"><span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span>Your username is already taken</div>');return xhrValidateUsername&&xhrValidateUsername.abort(),t?(e.addClass("um-searching-username"),void(xhrValidateUsername=jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_check_username_exists",username:t},complete:function(){e.removeClass("um-searching-username")},success:function(t){parseInt(t)>0?(e.removeClass("um-validate-username-unique").addClass("um-validate-username-exists"),e.parents(".um-field").find(".um-field-error").length||e.parents(".um-field").append(i),i.show()):(e.removeClass("um-validate-username-exists").addClass("um-validate-username-unique"),i.hide())}}))):void e.removeClass("um-searching-username")})}function UM_hide_menus(){menu=jQuery(".um-dropdown"),menu.parents("div").find("a").removeClass("active"),menu.hide()}function UM_domenus(){jQuery(".um-dropdown").each(function(){var e=jQuery(this),t=jQuery(this).attr("data-element"),i=jQuery(this).attr("data-position");jQuery(t).addClass("um-trigger-menu-on-"+e.attr("data-trigger")),jQuery(window).width()<=1200&&"div.um-profile-edit"==t&&(i="lc"),"lc"==i&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),gap_right=jQuery(t).width()+17,e.css({top:0,width:200,left:"auto",right:gap_right+"px","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-right-b"),e.find(".um-dropdown-arr").css({top:"4px",left:"auto",right:"-17px"})),"bc"==i&&(200>jQuery(t).find("img").width()?left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2+(jQuery(t).find("img").width()-200)/2:left_p=(jQuery(t).width()-jQuery(t).find("img").width())/2,top_=parseInt(jQuery(t).find("a").css("top")),top_?(top_p=jQuery(t).find("img").height()+4+top_,left_gap=4):(top_p=jQuery(t).find("img").height()+4,left_gap=0),4==top_p&&"div.um-cover"==t?top_p=jQuery(t).height()/2+e.height()/2:4==top_p&&(top_p=jQuery(t).height()+20),e.css({top:top_p,width:200,left:left_p+left_gap,right:"auto","text-align":"center"}),e.find(".um-dropdown-arr").find("i").removeClass().addClass("um-icon-arrow-up-b"),e.find(".um-dropdown-arr").css({top:"-17px",left:e.width()/2-12,right:"auto"}))})}function um_responsive(){jQuery(".um").each(function(){element_width=jQuery(this).width(),element_width<=340?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob340")):element_width<=500?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob500")):element_width<=800?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob800")):element_width<=960?(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960"),jQuery(this).addClass("uimob960")):element_width>960&&(jQuery(this).removeClass("uimob340"),jQuery(this).removeClass("uimob500"),jQuery(this).removeClass("uimob800"),jQuery(this).removeClass("uimob960")),jQuery(".um-account-nav").length>0&&jQuery(".um-account-side").is(":visible")&&0==jQuery(".um-account-tab:visible").length&&jQuery(".um-account-side li a.current").trigger("click"),jQuery(this).css("opacity",1)}),jQuery(".um-cover, .um-member-cover").each(function(){var e=jQuery(this),t=e.data("ratio"),i=e.width(),a=t.split(":");calcHeight=Math.round(i/a[0])+"px",e.height(calcHeight),e.find(".um-cover-add").height(calcHeight)}),jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),UM_domenus()}function UM_Member_Grid(e){e.masonry({itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"})}function initImageUpload_UM(e){e.data("upload_help_text")?upload_help_text='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":upload_text="",e.uploadFile({url:um_scripts.imageupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,i,a){e.selectedFiles=0,i=jQuery.parseJSON(i),i.error&&""!=i.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+i.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):jQuery.each(i,function(t,i){var a=e.parents(".um-modal-body").find(".um-single-image-preview img"),n=e.parents(".um-modal-body").find(".um-single-image-preview");a.attr("src",i),a.load(function(){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),n.show(0),um_modal_responsive()})})}})}function initFileUpload_UM(e){e.data("upload_help_text")?upload_help_text='<span class="help">'+e.data("upload_help_text")+"</span>":upload_help_text="",e.data("icon")?icon='<span class="icon"><i class="'+e.data("icon")+'"></i></span>':icon="",e.data("upload_text")?upload_text='<span class="str">'+e.data("upload_text")+"</span>":upload_text="",e.uploadFile({url:um_scripts.fileupload,method:"POST",multiple:!1,formData:{key:e.data("key"),set_id:e.data("set_id"),set_mode:e.data("set_mode")},fileName:e.data("key"),allowedTypes:e.data("allowed_types"),maxFileSize:e.data("max_size"),dragDropStr:icon+upload_text+upload_help_text,sizeErrorStr:e.data("max_size_error"),extErrorStr:e.data("extension_error"),maxFileCountErrorStr:e.data("max_files_error"),maxFileCount:1,showDelete:!1,showAbort:!1,showDone:!1,showFileCounter:!1,showStatusAfterSuccess:!0,onSubmit:function(t){e.parents(".um-modal-body").find(".um-error-block").remove()},onSuccess:function(t,i,a){e.selectedFiles=0,i=jQuery.parseJSON(i),i.error&&""!=i.error?(e.parents(".um-modal-body").append('<div class="um-error-block">'+i.error+"</div>"),e.parents(".um-modal-body").find(".upload-statusbar").hide(0),um_modal_responsive()):(jQuery.each(i,function(t,i){e.parents(".um-modal-body").find(".um-modal-btn.um-finish-upload.disabled").removeClass("disabled"),e.parents(".um-modal-body").find(".ajax-upload-dragdrop,.upload-statusbar").hide(0),e.parents(".um-modal-body").find(".um-single-file-preview").show(0),"icon"==t?e.parents(".um-modal-body").find(".um-single-fileinfo i").removeClass().addClass(i):"icon_bg"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.icon").css({"background-color":i}):"filename"==t?e.parents(".um-modal-body").find(".um-single-fileinfo span.filename").html(i):e.parents(".um-modal-body").find(".um-single-fileinfo a").attr("href",i)}),um_modal_responsive())}})}function initCrop_UM(){var e=jQuery(".um-modal:visible .um-single-image-preview img"),t=jQuery(".um-modal:visible .um-single-image-preview"),i=e.parent().attr("data-crop"),a=e.parent().attr("data-min_width"),n=e.parent().attr("data-min_height"),r=e.parent().attr("data-ratio");if(jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"))var r=jQuery(".um-modal").find("#um_upload_single").attr("data-ratio"),o=r.split(":"),r=o[0];if(e.length&&""!=e.attr("src")){var s=jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height();if(e.css({height:"auto"}),t.css({height:"auto"}),jQuery(window).height()<=400?(t.css({height:s+"px","max-height":s+"px"}),e.css({height:"auto"})):(e.css({height:"auto","max-height":s+"px"}),t.css({height:e.height(),"max-height":s+"px"})),"square"==i)var l={minWidth:a,minHeight:n,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};else if("cover"==i)var l={minWidth:a,minHeight:Math.round(a/r),dragCrop:!1,aspectRatio:r,zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};else if("user"==i)var l={minWidth:a,minHeight:n,dragCrop:!0,aspectRatio:"auto",zoomable:!1,rotatable:!1,dashed:!1,done:function(t){e.parent().attr("data-coord",Math.round(t.x)+","+Math.round(t.y)+","+Math.round(t.width)+","+Math.round(t.height))}};0!=i&&e.cropper(l)}}function um_new_modal(e,t,i,a){var n=jQuery("body").find(".um-modal-overlay");if(0==n.length)if(jQuery(".tipsy").hide(),UM_hide_menus(),jQuery("body,html,textarea").css("overflow","hidden"),jQuery(document).bind("touchmove",function(e){e.preventDefault()}),jQuery(".um-modal").on("touchmove",function(e){e.stopPropagation()}),i?jQuery("body").append('<div class="um-modal-overlay" /><div class="um-modal is-photo" />'):jQuery("body").append('<div class="um-modal-overlay" /><div class="um-modal no-photo" />'),jQuery("#"+e).prependTo(".um-modal"),i){jQuery(".um-modal").find(".um-modal-photo").html("<img />");var r=jQuery(".um-modal-photo img"),o=jQuery(window).width()-60,s=jQuery(window).height()-.25*jQuery(window).height();r.attr("src",a),r.load(function(){jQuery("#"+e).show(),jQuery(".um-modal").show(),r.css({opacity:0}),r.css({"max-width":o}),r.css({"max-height":s}),jQuery(".um-modal").css({width:r.width(),"margin-left":"-"+r.width()/2+"px"}),r.animate({opacity:1},1e3),um_modal_responsive()})}else jQuery("#"+e).show(),jQuery(".um-modal").show(),um_modal_size(t),initImageUpload_UM(jQuery(".um-modal:visible").find(".um-single-image-upload")),initFileUpload_UM(jQuery(".um-modal:visible").find(".um-single-file-upload")),um_modal_responsive()}function um_modal_responsive(){var e=jQuery(".um-modal:visible"),t=jQuery(".um-modal-body.photo:visible");if(t.length){e.removeClass("uimob340"),e.removeClass("uimob500");var i=jQuery(".um-modal-photo img"),a=jQuery(window).width()-60,n=jQuery(window).height()-.25*jQuery(window).height();i.css({opacity:0}),i.css({"max-width":a}),i.css({"max-height":n}),jQuery(".um-modal").css({width:i.width(),"margin-left":"-"+i.width()/2+"px"}),i.animate({opacity:1},1e3);var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(e.length){var o=jQuery(window).width();if(e.removeClass("uimob340"),e.removeClass("uimob500"),340>=o)e.addClass("uimob340"),initCrop_UM(),e.animate({bottom:0},300);else if(500>=o)e.addClass("uimob500"),initCrop_UM(),e.animate({bottom:0},300);else if(800>=o){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(960>=o){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}else if(o>960){initCrop_UM();var r=(jQuery(window).height()-e.innerHeight())/2+"px";e.animate({bottom:r},300)}}}function um_remove_modal(){jQuery("img.cropper-hidden").cropper("destroy"),jQuery("body,html,textarea").css("overflow","auto"),jQuery(document).unbind("touchmove"),jQuery('.um-modal div[id^="um_"]').hide().appendTo("body"),jQuery(".um-modal,.um-modal-overlay").remove()}function um_modal_size(e){jQuery(".um-modal:visible").addClass(e)}function um_modal_add_attr(e,t){jQuery(".um-modal:visible").data(e,t)}function prepare_Modal(){0==jQuery(".um-popup-overlay").length&&(jQuery("body").append('<div class="um-popup-overlay"></div>'),jQuery("body").append('<div class="um-popup"></div>'),jQuery(".um-popup").addClass("loading"),jQuery("body,html").css({overflow:"hidden"}))}function remove_Modal(){jQuery(".um-popup-overlay").length&&(jQuery(".tipsy").remove(),jQuery(".um-popup").empty().remove(),jQuery(".um-popup-overlay").empty().remove(),jQuery("body,html").css({overflow:"auto"}))}function show_Modal(e){jQuery(".um-popup-overlay").length&&(jQuery(".um-popup").removeClass("loading").html(e),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,offset:3}))}function responsive_Modal(){jQuery(".um-popup-overlay").length&&(ag_height=jQuery(window).height()-jQuery(".um-popup um-popup-header").outerHeight()-jQuery(".um-popup .um-popup-footer").outerHeight()-80,ag_height>350&&(ag_height=350),jQuery(".um-popup-autogrow:visible").length?(jQuery(".um-popup-autogrow:visible").css({height:ag_height+"px"}),jQuery(".um-popup-autogrow:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500}).mCustomScrollbar("scrollTo","bottom",{scrollInertia:0})):jQuery(".um-popup-autogrow2:visible").length&&(jQuery(".um-popup-autogrow2:visible").css({"max-height":ag_height+"px"}),jQuery(".um-popup-autogrow2:visible").mCustomScrollbar({theme:"dark-3",mouseWheelPixels:500})))}function um_reset_field(e){jQuery(e).find("div.um-field-area").find("input,textarea,select").not(":button, :submit, :reset, :hidden").val("").removeAttr("checked").removeAttr("selected")}!function(e){"undefined"==typeof e.fn.each2&&e.extend(e.fn,{each2:function(t){for(var i=e([0]),a=-1,n=this.length;++a<n&&(i.context=i[0]=this[a])&&t.call(i[0],a,i)!==!1;);return this}})}(jQuery),function(e,t){"use strict";function i(t){var i=e(document.createTextNode(""));t.before(i),i.before(t),i.remove()}function a(e){function t(e){return B[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function n(e,t){for(var i=0,a=t.length;a>i;i+=1)if(o(e,t[i]))return i;return-1}function r(){var t=e(L);t.appendTo("body");var i={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),i}function o(e,i){return e===i?!0:e===t||i===t?!1:null===e||null===i?!1:e.constructor===String?e+""==i+"":i.constructor===String?i+""==e+"":!1}function s(t,i){var a,n,r;if(null===t||t.length<1)return[];for(a=t.split(i),n=0,r=a.length;r>n;n+=1)a[n]=e.trim(a[n]);return a}function l(e){return e.outerWidth(!1)-e.width()}function c(i){var a="keyup-change-value";i.on("keydown",function(){e.data(i,a)===t&&e.data(i,a,i.val())}),i.on("keyup",function(){var n=e.data(i,a);n!==t&&i.val()!==n&&(e.removeData(i,a),i.trigger("keyup-change"))})}function u(i){i.on("mousemove",function(i){var a=F;(a===t||a.x!==i.pageX||a.y!==i.pageY)&&e(i.target).trigger("mousemove-filtered",i)})}function d(e,i,a){a=a||t;var n;return function(){var t=arguments;window.clearTimeout(n),n=window.setTimeout(function(){i.apply(a,t)},e)}}function h(e,t){var i=d(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){n(e.target,t.get())>=0&&i(e)})}function p(e){e[0]!==document.activeElement&&window.setTimeout(function(){var t,i=e[0],a=e.val().length;e.focus();var n=i.offsetWidth>0||i.offsetHeight>0;n&&i===document.activeElement&&(i.setSelectionRange?i.setSelectionRange(a,a):i.createTextRange&&(t=i.createTextRange(),t.collapse(!1),t.select()))},0)}function f(t){t=e(t)[0];var i=0,a=0;if("selectionStart"in t)i=t.selectionStart,a=t.selectionEnd-i;else if("selection"in document){t.focus();var n=document.selection.createRange();a=document.selection.createRange().text.length,n.moveStart("character",-t.value.length),i=n.text.length-a}return{offset:i,length:a}}function m(e){e.preventDefault(),e.stopPropagation()}function g(e){e.preventDefault(),e.stopImmediatePropagation()}function v(t){if(!P){var i=t[0].currentStyle||window.getComputedStyle(t[0],null);P=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:i.fontSize,fontFamily:i.fontFamily,fontStyle:i.fontStyle,fontWeight:i.fontWeight,letterSpacing:i.letterSpacing,textTransform:i.textTransform,whiteSpace:"nowrap"}),P.attr("class","select2-sizer"),e("body").append(P)}return P.text(t.val()),P.width()}function y(t,i,a){var n,r,o=[];n=t.attr("class"),n&&(n=""+n,e(n.split(" ")).each2(function(){0===this.indexOf("select2-")&&o.push(this)})),n=i.attr("class"),n&&(n=""+n,e(n.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(r=a(this),r&&o.push(r))})),t.attr("class",o.join(" "))}function b(e,t,i,n){var r=a(e.toUpperCase()).indexOf(a(t.toUpperCase())),o=t.length;return 0>r?void i.push(n(e)):(i.push(n(e.substring(0,r))),i.push("<span class='select2-match'>"),i.push(n(e.substring(r,r+o))),i.push("</span>"),void i.push(n(e.substring(r+o,e.length))))}function w(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function x(i){var a,n=null,r=i.quietMillis||100,o=i.url,s=this;return function(l){window.clearTimeout(a),a=window.setTimeout(function(){var a=i.data,r=o,c=i.transport||e.fn.select2.ajaxDefaults.transport,u={type:i.type||"GET",cache:i.cache||!1,jsonpCallback:i.jsonpCallback||t,dataType:i.dataType||"json"},d=e.extend({},e.fn.select2.ajaxDefaults.params,u);a=a?a.call(s,l.term,l.page,l.context):null,r="function"==typeof r?r.call(s,l.term,l.page,l.context):r,n&&"function"==typeof n.abort&&n.abort(),i.params&&(e.isFunction(i.params)?e.extend(d,i.params.call(s)):e.extend(d,i.params)),e.extend(d,{url:r,dataType:i.dataType,data:a,success:function(e){var t=i.results(e,l.page);l.callback(t)}}),n=c.call(s,d)},r)}}function _(t){var i,a,n=t,r=function(e){return""+e.text};e.isArray(n)&&(a=n,n={results:a}),e.isFunction(n)===!1&&(a=n,n=function(){return a});var o=n();return o.text&&(r=o.text,e.isFunction(r)||(i=o.text,r=function(e){return e[i]})),function(t){var i,a=t.term,o={results:[]};return""===a?void t.callback(n()):(i=function(n,o){var s,l;if(n=n[0],n.children){s={};for(l in n)n.hasOwnProperty(l)&&(s[l]=n[l]);s.children=[],e(n.children).each2(function(e,t){i(t,s.children)}),(s.children.length||t.matcher(a,r(s),n))&&o.push(s)}else t.matcher(a,r(n),n)&&o.push(n)},e(n().results).each2(function(e,t){i(t,o.results)}),void t.callback(o))}}function C(i){var a=e.isFunction(i);return function(n){var r=n.term,o={results:[]},s=a?i(n):i;e.isArray(s)&&(e(s).each(function(){var e=this.text!==t,i=e?this.text:this;(""===r||n.matcher(r,i))&&o.results.push(e?this:{id:this,text:this})}),n.callback(o))}}function S(t,i){if(e.isFunction(t))return!0;if(!t)return!1;if("string"==typeof t)return!0;throw new Error(i+" must be a string, function, or falsy value")}function j(t){if(e.isFunction(t)){var i=Array.prototype.slice.call(arguments,1);return t.apply(null,i)}return t}function k(t){var i=0;return e.each(t,function(e,t){t.children?i+=k(t.children):i++}),i}function Q(e,i,a,n){var r,s,l,c,u,d=e,h=!1;if(!n.createSearchChoice||!n.tokenSeparators||n.tokenSeparators.length<1)return t;for(;;){for(s=-1,l=0,c=n.tokenSeparators.length;c>l&&(u=n.tokenSeparators[l],s=e.indexOf(u),!(s>=0));l++);if(0>s)break;if(r=e.substring(0,s),e=e.substring(s+u.length),r.length>0&&(r=n.createSearchChoice.call(this,r,i),r!==t&&null!==r&&n.id(r)!==t&&null!==n.id(r))){for(h=!1,l=0,c=i.length;c>l;l++)if(o(n.id(r),n.id(i[l]))){h=!0;break}h||a(r)}}return d!==e?e:void 0}function T(){var e=this;Array.prototype.forEach.call(arguments,function(t){e[t].remove(),e[t]=null})}function D(t,i){var a=function(){};return a.prototype=new t,a.prototype.constructor=a,a.prototype.parent=t.prototype,a.prototype=e.extend(a.prototype,i),a}if(window.Select2===t){var O,E,M,I,A,P,R,H,F={x:0,y:0},O={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case O.LEFT:case O.RIGHT:case O.UP:case O.DOWN:return!0}return!1},isControl:function(e){var t=e.which;switch(t){case O.SHIFT:case O.CTRL:case O.ALT:return!0}return e.metaKey?!0:!1},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e}},L="<div class='select2-measure-scrollbar'></div>",B={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};R=e(document),A=function(){var e=1;return function(){return e++}}(),R.on("mousemove",function(e){F.x=e.pageX,F.y=e.pageY}),E=D(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(i){var a,n,o=".select2-results";this.opts=i=this.prepareOpts(i),this.id=i.id,i.element.data("select2")!==t&&null!==i.element.data("select2")&&i.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(i.element.attr("id")||"autogen"+A()),
|
||
this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",i.element.attr("title")),this.body=e("body"),y(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",i.element.attr("style")),this.container.css(j(i.containerCss)),this.container.addClass(j(i.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",m),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),y(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(j(i.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",m),this.results=a=this.container.find(o),this.search=n=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",m),u(this.results),this.dropdown.on("mousemove-filtered",o,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",o,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",o,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",o,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),h(80,this.results),this.dropdown.on("scroll-debounced",o,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),e.fn.mousewheel&&a.mousewheel(function(e,t,i,n){var r=a.scrollTop();n>0&&0>=r-n?(a.scrollTop(0),m(e)):0>n&&a.get(0).scrollHeight-a.scrollTop()+n<=a.height()&&(a.scrollTop(a.get(0).scrollHeight-a.height()),m(e))}),c(n),n.on("keyup-change input paste",this.bind(this.updateResults)),n.on("focus",function(){n.addClass("select2-focused")}),n.on("blur",function(){n.removeClass("select2-focused")}),this.dropdown.on("mouseup",o,this.bind(function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=t,e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==i.maximumInputLength&&this.search.attr("maxlength",i.maximumInputLength);var s=i.element.prop("disabled");s===t&&(s=!1),this.enable(!s);var l=i.element.prop("readonly");l===t&&(l=!1),this.readonly(l),H=H||r(),this.autofocus=i.element.prop("autofocus"),i.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",i.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,i=e.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),i!==t&&(i.container.remove(),i.liveRegion.remove(),i.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),T.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:o(e.attr("locked"),"locked")||o(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(i){var a,n,r,l,c=this;if(a=i.element,"select"===a.get(0).tagName.toLowerCase()&&(this.select=n=i.element),n&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in i)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),i=e.extend({},{populateResults:function(a,n,r){var o,s=this.opts.id,l=this.liveRegion;(o=function(a,n,u){var d,h,p,f,m,g,v,y,b,w;for(a=i.sortResults(a,n,r),d=0,h=a.length;h>d;d+=1)p=a[d],m=p.disabled===!0,f=!m&&s(p)!==t,g=p.children&&p.children.length>0,v=e("<li></li>"),v.addClass("select2-results-dept-"+u),v.addClass("select2-result"),v.addClass(f?"select2-result-selectable":"select2-result-unselectable"),m&&v.addClass("select2-disabled"),g&&v.addClass("select2-result-with-children"),v.addClass(c.opts.formatResultCssClass(p)),v.attr("role","presentation"),y=e(document.createElement("div")),y.addClass("select2-result-label"),y.attr("id","select2-result-label-"+A()),y.attr("role","option"),w=i.formatResult(p,y,r,c.opts.escapeMarkup),w!==t&&(y.html(w),v.append(y)),g&&(b=e("<ul></ul>"),b.addClass("select2-result-sub"),o(p.children,b,u+1),v.append(b)),v.data("select2-data",p),n.append(v);l.text(i.formatMatches(a.length))})(n,a,0)}},e.fn.select2.defaults,i),"function"!=typeof i.id&&(r=i.id,i.id=function(e){return e[r]}),e.isArray(i.element.data("select2Tags"))){if("tags"in i)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+i.element.attr("id");i.tags=i.element.data("select2Tags")}if(n?(i.query=this.bind(function(e){var i,n,r,o={results:[],more:!1},s=e.term;r=function(t,i){var a;t.is("option")?e.matcher(s,t.text(),t)&&i.push(c.optionToData(t)):t.is("optgroup")&&(a=c.optionToData(t),t.children().each2(function(e,t){r(t,a.children)}),a.children.length>0&&i.push(a))},i=a.children(),this.getPlaceholder()!==t&&i.length>0&&(n=this.getPlaceholderOption(),n&&(i=i.not(n))),i.each2(function(e,t){r(t,o.results)}),e.callback(o)}),i.id=function(e){return e.id}):"query"in i||("ajax"in i?(l=i.element.data("ajax-url"),l&&l.length>0&&(i.ajax.url=l),i.query=x.call(i.element,i.ajax)):"data"in i?i.query=_(i.data):"tags"in i&&(i.query=C(i.tags),i.createSearchChoice===t&&(i.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}),i.initSelection===t&&(i.initSelection=function(t,a){var n=[];e(s(t.val(),i.separator)).each(function(){var t={id:this,text:this},a=i.tags;e.isFunction(a)&&(a=a()),e(a).each(function(){return o(this.id,t.id)?(t=this,!1):void 0}),n.push(t)}),a(n)}))),"function"!=typeof i.query)throw"query function not defined for Select2 "+i.element.attr("id");if("top"===i.createSearchChoicePosition)i.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===i.createSearchChoicePosition)i.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof i.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return i},monitorSource:function(){var e,i,a=this.opts.element;a.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),e=this.bind(function(){var e=a.prop("disabled");e===t&&(e=!1),this.enable(!e);var i=a.prop("readonly");i===t&&(i=!1),this.readonly(i),y(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(j(this.opts.containerCssClass)),y(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(j(this.opts.dropdownCssClass))}),a.length&&a[0].attachEvent&&a.each(function(){this.attachEvent("onpropertychange",e)}),i=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,i!==t&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new i(function(t){t.forEach(e)}),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var i=e.Event("select2-selecting",{val:this.id(t),object:t});return this.opts.element.trigger(i),!i.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===t&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===t&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,i,a,n,r,o=this.dropdown,s=this.container.offset(),l=this.container.outerHeight(!1),c=this.container.outerWidth(!1),u=o.outerHeight(!1),d=e(window),h=d.width(),p=d.height(),f=d.scrollLeft()+h,m=d.scrollTop()+p,g=s.top+l,v=s.left,y=m>=g+u,b=s.top-u>=d.scrollTop(),w=o.outerWidth(!1),x=f>=v+w,_=o.hasClass("select2-drop-above");_?(i=!0,!b&&y&&(a=!0,i=!1)):(i=!1,!y&&b&&(a=!0,i=!0)),a&&(o.hide(),s=this.container.offset(),l=this.container.outerHeight(!1),c=this.container.outerWidth(!1),u=o.outerHeight(!1),f=d.scrollLeft()+h,m=d.scrollTop()+p,g=s.top+l,v=s.left,w=o.outerWidth(!1),x=f>=v+w,o.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(r=e(".select2-results",o)[0],o.addClass("select2-drop-auto-width"),o.css("width",""),w=o.outerWidth(!1)+(r.scrollHeight===r.clientHeight?0:H.width),w>c?c=w:w=c,u=o.outerHeight(!1),x=f>=v+w):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(t=this.body.offset(),g-=t.top,v-=t.left),x||(v=s.left+this.container.outerWidth(!1)-w),n={left:v,width:c},i?(n.top=s.top-u,n.bottom="auto",this.container.addClass("select2-drop-above"),o.addClass("select2-drop-above")):(n.top=g,n.bottom="auto",this.container.removeClass("select2-drop-above"),o.removeClass("select2-drop-above")),n=e.extend(n,j(this.opts.dropdownCss)),o.css(n)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=e.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var t,a=this.containerEventName,n="scroll."+a,r="resize."+a,o="orientationchange."+a;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),t=e("#select2-drop-mask"),0==t.length&&(t=e(document.createElement("div")),t.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body),t.on("mousedown touchstart click",function(a){i(t);var n,r=e("#select2-drop");r.length>0&&(n=r.data("select2"),n.opts.selectOnBlur&&n.selectHighlighted({noFocus:!0}),n.close(),a.preventDefault(),a.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),e("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var s=this;this.container.parents().add(window).each(function(){e(this).on(r+" "+n+" "+o,function(){s.opened()&&s.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerEventName,i="scroll."+t,a="resize."+t,n="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(i).off(a).off(n)}),this.clearDropdownAlignmentPreference(),e("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(e.Event("select2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return j(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var t,i,a,n,r,o,s,l=this.results;if(i=this.highlight(),!(0>i)){if(0==i)return void l.scrollTop(0);t=this.findHighlightableChoices().find(".select2-result-label"),a=e(t[i]),n=a.offset().top+a.outerHeight(!0),i===t.length-1&&(s=l.find("li.select2-more-results"),s.length>0&&(n=s.offset().top+s.outerHeight(!0))),r=l.offset().top+l.outerHeight(!0),n>r&&l.scrollTop(l.scrollTop()+(n-r)),o=a.offset().top-l.offset().top,0>o&&"none"!=a.css("display")&&l.scrollTop(l.scrollTop()+o)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){for(var i=this.findHighlightableChoices(),a=this.highlight();a>-1&&a<i.length;){a+=t;var n=e(i[a]);if(n.hasClass("select2-result-selectable")&&!n.hasClass("select2-disabled")&&!n.hasClass("select2-selected")){this.highlight(a);break}}},highlight:function(t){var i,a,r=this.findHighlightableChoices();return 0===arguments.length?n(r.filter(".select2-highlighted")[0],r.get()):(t>=r.length&&(t=r.length-1),0>t&&(t=0),this.removeHighlight(),i=e(r[t]),i.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",i.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(i.text()),a=i.data("select2-data"),void(a&&this.opts.element.trigger({type:"select2-highlight",val:this.id(a),choice:a})))},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var i=e(t.target).closest(".select2-result-selectable");if(i.length>0&&!i.is(".select2-highlighted")){var a=this.findHighlightableChoices();this.highlight(a.index(i))}else 0==i.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var e,t=this.results,i=t.find("li.select2-more-results"),a=this.resultsPage+1,n=this,r=this.search.val(),o=this.context;0!==i.length&&(e=i.offset().top-t.offset().top-t.height(),e<=this.opts.loadMorePadding&&(i.addClass("select2-active"),this.opts.query({element:this.opts.element,term:r,page:a,context:o,matcher:this.opts.matcher,callback:this.bind(function(e){n.opened()&&(n.opts.populateResults.call(this,t,e.results,{term:r,page:a,context:o}),n.postprocessResults(e,!1,!1),e.more===!0?(i.detach().appendTo(t).text(j(n.opts.formatLoadMore,a+1)),window.setTimeout(function(){n.loadMoreIfNeeded()},10)):i.remove(),n.positionDropdown(),n.resultsPage=a,n.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})})))},tokenize:function(){},updateResults:function(i){function a(){c.removeClass("select2-active"),h.positionDropdown(),u.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(u.text()):h.liveRegion.text(h.opts.formatMatches(u.find(".select2-result-selectable").length))}function n(e){u.html(e),a()}var r,s,l,c=this.search,u=this.results,d=this.opts,h=this,p=c.val(),f=e.data(this.container,"select2-last-term");if((i===!0||!f||!o(p,f))&&(e.data(this.container,"select2-last-term",p),i===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var m=this.getMaximumSelectionSize();if(m>=1&&(r=this.data(),e.isArray(r)&&r.length>=m&&S(d.formatSelectionTooBig,"formatSelectionTooBig")))return void n("<li class='select2-selection-limit'>"+j(d.formatSelectionTooBig,m)+"</li>");if(c.val().length<d.minimumInputLength)return n(S(d.formatInputTooShort,"formatInputTooShort")?"<li class='select2-no-results'>"+j(d.formatInputTooShort,c.val(),d.minimumInputLength)+"</li>":""),void(i&&this.showSearch&&this.showSearch(!0));if(d.maximumInputLength&&c.val().length>d.maximumInputLength)return void n(S(d.formatInputTooLong,"formatInputTooLong")?"<li class='select2-no-results'>"+j(d.formatInputTooLong,c.val(),d.maximumInputLength)+"</li>":"");d.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+j(d.formatSearching)+"</li>"),c.addClass("select2-active"),this.removeHighlight(),s=this.tokenize(),s!=t&&null!=s&&c.val(s),this.resultsPage=1,d.query({element:d.element,term:c.val(),page:this.resultsPage,context:null,matcher:d.matcher,callback:this.bind(function(r){var s;if(l==this.queryCount){if(!this.opened())return void this.search.removeClass("select2-active");if(this.context=r.context===t?null:r.context,this.opts.createSearchChoice&&""!==c.val()&&(s=this.opts.createSearchChoice.call(h,c.val(),r.results),s!==t&&null!==s&&h.id(s)!==t&&null!==h.id(s)&&0===e(r.results).filter(function(){return o(h.id(this),h.id(s))}).length&&this.opts.createSearchChoicePosition(r.results,s)),0===r.results.length&&S(d.formatNoMatches,"formatNoMatches"))return void n("<li class='select2-no-results'>"+j(d.formatNoMatches,c.val())+"</li>");u.empty(),h.opts.populateResults.call(this,u,r.results,{term:c.val(),page:this.resultsPage,context:null}),r.more===!0&&S(d.formatLoadMore,"formatLoadMore")&&(u.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(j(d.formatLoadMore,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(r,i),a(),this.opts.element.trigger({type:"select2-loaded",items:r})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){p(this.search)},selectHighlighted:function(e){if(this._touchMoved)return void this.clearTouchMoved();var t=this.highlight(),i=this.results.find(".select2-highlighted"),a=i.closest(".select2-result").data("select2-data");a?(this.highlight(t),this.onSelect(a,e)):e&&e.noFocus&&this.close()},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==t?e.text():t)},getPlaceholderOption:function(){if(this.select){var i=this.select.children("option").first();if(this.opts.placeholderOption!==t)return"first"===this.opts.placeholderOption&&i||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===e.trim(i.text())&&""===i.val())return i}},initContainerWidth:function(){function i(){var i,a,n,r,o,s;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(i=this.opts.element.attr("style"),i!==t)for(a=i.split(";"),r=0,o=a.length;o>r;r+=1)if(s=a[r].replace(/\s/g,""),n=s.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==n&&n.length>=1)return n[1];return"resolve"===this.opts.width?(i=this.opts.element.css("width"),i.indexOf("%")>0?i:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}var a=i.call(this);null!==a&&this.container.css("width",a)}}),M=D(E,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return t},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var i,a,n;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),i=this.search.get(0),i.createTextRange?(a=i.createTextRange(),a.collapse(!1),a.select()):i.setSelectionRange&&(n=this.search.val().length,i.setSelectionRange(n,n))),""===this.search.val()&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){e("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),T.call(this,"selection","focusser")},initContainer:function(){var t,a,n=this.container,r=this.dropdown,o=A();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=n.find(".select2-choice"),this.focusser=n.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+o),this.focusser.attr("aria-labelledby","select2-chosen-"+o),this.results.attr("id","select2-results-"+o),this.search.attr("aria-owns","select2-results-"+o),this.focusser.attr("id","s2id_autogen"+o),a=e("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(a.text()).attr("for",this.focusser.attr("id"));var s=this.opts.element.attr("title");this.opts.element.attr("title",s||a.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(e("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){if(e.which===O.PAGE_UP||e.which===O.PAGE_DOWN)return void m(e);switch(e.which){case O.UP:case O.DOWN:return this.moveHighlight(e.which===O.UP?-1:1),void m(e);case O.ENTER:return this.selectHighlighted(),void m(e);case O.TAB:return void this.selectHighlighted({noFocus:!0});case O.ESC:return this.cancel(e),void m(e)}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==O.TAB&&!O.isControl(e)&&!O.isFunctionKey(e)&&e.which!==O.ESC){if(this.opts.openOnEnter===!1&&e.which===O.ENTER)return void m(e);if(e.which==O.DOWN||e.which==O.UP||e.which==O.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void m(e)}return e.which==O.DELETE||e.which==O.BACKSPACE?(this.opts.allowClear&&this.clear(),void m(e)):void 0}})),c(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){this.isInterfaceEnabled()&&(this.clear(),g(e),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(a){i(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),m(a)})),r.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){m(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(e.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(t){var i=this.selection.data("select2-data");if(i){var a=e.Event("select2-clearing");if(this.opts.element.trigger(a),a.isDefaultPrevented())return;var n=this.getPlaceholderOption();this.opts.element.val(n?n.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),t!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(i),choice:i}),this.triggerChange({removed:i}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.setPlaceholder(),e.nextSearchTerm=e.opts.nextSearchTerm(i,e.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()===t?!1:(e=this.getPlaceholderOption())!==t&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===t||null===this.opts.element.val()},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var a=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(a))}:"data"in t&&(t.initSelection=t.initSelection||function(i,a){var n=i.val(),r=null;t.query({matcher:function(e,i,a){var s=o(n,t.id(a));return s&&(r=a),s},callback:e.isFunction(a)?function(){a(r)}:e.noop})}),t},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===t?t:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,i){var a=0,n=this;if(this.findHighlightableChoices().each2(function(e,t){return o(n.id(t.data("select2-data")),n.opts.element.val())?(a=e,!1):void 0}),i!==!1&&(t===!0&&a>=0?this.highlight(a):this.highlight(0)),t===!0){var r=this.opts.minimumResultsForSearch;r>=0&&this.showSearch(k(e.results)>=r)}},showSearch:function(t){this.showSearchInput!==t&&(this.showSearchInput=t,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t),e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t))},onSelect:function(e,t){if(this.triggerSelect(e)){var i=this.opts.element.val(),a=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),t&&t.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),o(i,this.id(e))||this.triggerChange({added:e,removed:a})}},updateSelection:function(e){var i,a,n=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),n.empty(),null!==e&&(i=this.opts.formatSelection(e,n,this.opts.escapeMarkup)),i!==t&&n.append(i),a=this.opts.formatSelectionCssClass(e,n),a!==t&&n.addClass(a),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,i=!1,a=null,n=this,r=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],arguments.length>1&&(i=arguments[1]),this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return a=n.optionToData(t),!1}),this.updateSelection(a),this.setPlaceholder(),i&&this.triggerChange({added:a,removed:r});else{if(!e&&0!==e)return void this.clear(i);if(this.opts.initSelection===t)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){n.opts.element.val(e?n.id(e):""),n.updateSelection(e),n.setPlaceholder(),i&&n.triggerChange({added:e,removed:r})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var i,a=!1;return 0===arguments.length?(i=this.selection.data("select2-data"),i==t&&(i=null),i):(arguments.length>1&&(a=arguments[1]),void(e?(i=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),a&&this.triggerChange({added:e,removed:i})):this.clear(a)))}}),I=D(E,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return t},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var a=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){a.push(i.optionToData(t))}),t(a)}:"data"in t&&(t.initSelection=t.initSelection||function(i,a){var n=s(i.val(),t.separator),r=[];t.query({matcher:function(i,a,s){var l=e.grep(n,function(e){return o(e,t.id(s))}).length;return l&&r.push(s),l},callback:e.isFunction(a)?function(){for(var e=[],i=0;i<n.length;i++)for(var s=n[i],l=0;l<r.length;l++){var c=r[l];if(o(s,t.id(c))){e.push(c),r.splice(l,1);break}}a(e)}:e.noop})}),t},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");t.length&&e&&e[0]==t[0]||(t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),e&&e.length&&(this.close(),e.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",e)))},destroy:function(){e("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),T.call(this,"searchContainer","selection")},initContainer:function(){var t,i=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=t=this.container.find(i);
|
||
var a=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){a.search[0].focus(),a.selectChoice(e(this))}),this.search.attr("id","s2id_autogen"+A()),this.search.prev().text(e("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){++this.keydowns;var i=t.find(".select2-search-choice-focus"),a=i.prev(".select2-search-choice:not(.select2-locked)"),n=i.next(".select2-search-choice:not(.select2-locked)"),r=f(this.search);if(i.length&&(e.which==O.LEFT||e.which==O.RIGHT||e.which==O.BACKSPACE||e.which==O.DELETE||e.which==O.ENTER)){var o=i;return e.which==O.LEFT&&a.length?o=a:e.which==O.RIGHT?o=n.length?n:null:e.which===O.BACKSPACE?this.unselect(i.first())&&(this.search.width(10),o=a.length?a:n):e.which==O.DELETE?this.unselect(i.first())&&(this.search.width(10),o=n.length?n:null):e.which==O.ENTER&&(o=null),this.selectChoice(o),m(e),void(o&&o.length||this.open())}if((e.which===O.BACKSPACE&&1==this.keydowns||e.which==O.LEFT)&&0==r.offset&&!r.length)return this.selectChoice(t.find(".select2-search-choice:not(.select2-locked)").last()),void m(e);if(this.selectChoice(null),this.opened())switch(e.which){case O.UP:case O.DOWN:return this.moveHighlight(e.which===O.UP?-1:1),void m(e);case O.ENTER:return this.selectHighlighted(),void m(e);case O.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case O.ESC:return this.cancel(e),void m(e)}if(e.which!==O.TAB&&!O.isControl(e)&&!O.isFunctionKey(e)&&e.which!==O.BACKSPACE&&e.which!==O.ESC){if(e.which===O.ENTER){if(this.opts.openOnEnter===!1)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),(e.which===O.PAGE_UP||e.which===O.PAGE_DOWN)&&m(e),e.which===O.ENTER&&m(e)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(t){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),t.stopImmediatePropagation(),this.opts.element.trigger(e.Event("select2-blur"))})),this.container.on("click",i,this.bind(function(t){this.isInterfaceEnabled()&&(e(t.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.open(),this.focusSearch(),t.preventDefault()))})),this.container.on("focus",i,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),i=this.getMaxSearchWidth();e!==t&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(e).addClass("select2-default"),this.search.width(i>0?i:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var i=[],a=[],r=this;e(t).each(function(){n(r.id(this),i)<0&&(i.push(r.id(this)),a.push(this))}),t=a,this.selection.find(".select2-search-choice").remove(),e(t).each(function(){r.addSelectedChoice(this)}),r.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts),null!=e&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e,i){this.triggerSelect(e)&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(e,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=t&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),i&&i.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(i){var a,n,r=!i.locked,o=e("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),s=e("<li class='select2-search-choice select2-locked'><div></div></li>"),l=r?o:s,c=this.id(i),u=this.getVal();a=this.opts.formatSelection(i,l.find("div"),this.opts.escapeMarkup),a!=t&&l.find("div").replaceWith("<div>"+a+"</div>"),n=this.opts.formatSelectionCssClass(i,l.find("div")),n!=t&&l.addClass(n),r&&l.find(".select2-search-choice-close").on("mousedown",m).on("click dblclick",this.bind(function(t){this.isInterfaceEnabled()&&(this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),m(t),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),l.data("select2-data",i),l.insertBefore(this.searchContainer),u.push(c),this.setVal(u)},unselect:function(t){var i,a,r=this.getVal();if(t=t.closest(".select2-search-choice"),0===t.length)throw"Invalid argument: "+t+". Must be .select2-search-choice";if(i=t.data("select2-data")){var o=e.Event("select2-removing");if(o.val=this.id(i),o.choice=i,this.opts.element.trigger(o),o.isDefaultPrevented())return!1;for(;(a=n(this.id(i),r))>=0;)r.splice(a,1),this.setVal(r),this.select&&this.postprocessResults();return t.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(i),choice:i}),this.triggerChange({removed:i}),!0}},postprocessResults:function(e,t,i){var a=this.getVal(),r=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),s=this;r.each2(function(e,t){var i=s.id(t.data("select2-data"));n(i,a)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),-1==this.highlight()&&i!==!1&&s.highlight(0),!this.opts.createSearchChoice&&!r.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&S(s.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+j(s.opts.formatNoMatches,s.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-l(this.search)},resizeSearch:function(){var e,t,i,a,n,r=l(this.search);e=v(this.search)+10,t=this.search.offset().left,i=this.selection.width(),a=this.selection.offset().left,n=i-(t-a)-r,e>n&&(n=i-r),40>n&&(n=i-r),0>=n&&(n=e),this.search.width(Math.floor(n))},getVal:function(){var e;return this.select?(e=this.select.val(),null===e?[]:e):(e=this.opts.element.val(),s(e,this.opts.separator))},setVal:function(t){var i;this.select?this.select.val(t):(i=[],e(t).each(function(){n(this,i)<0&&i.push(this)}),this.opts.element.val(0===i.length?"":i.join(this.opts.separator)))},buildChangeDetails:function(e,t){for(var t=t.slice(0),e=e.slice(0),i=0;i<t.length;i++)for(var a=0;a<e.length;a++)o(this.opts.id(t[i]),this.opts.id(e[a]))&&(t.splice(i,1),i>0&&i--,e.splice(a,1),a--);return{added:t,removed:e}},val:function(i,a){var n,r=this;if(0===arguments.length)return this.getVal();if(n=this.data(),n.length||(n=[]),!i&&0!==i)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(a&&this.triggerChange({added:this.data(),removed:n}));if(this.setVal(i),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),a&&this.triggerChange(this.buildChangeDetails(n,this.data()));else{if(this.opts.initSelection===t)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(t){var i=e.map(t,r.id);r.setVal(i),r.updateSelection(t),r.clearSearch(),a&&r.triggerChange(r.buildChangeDetails(n,r.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var t=[],i=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(i.opts.id(e(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(t,i){var a,n,r=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get():(n=this.data(),t||(t=[]),a=e.map(t,function(e){return r.opts.id(e)}),this.setVal(a),this.updateSelection(t),this.clearSearch(),void(i&&this.triggerChange(this.buildChangeDetails(n,this.data()))))}}),e.fn.select2=function(){var i,a,r,o,s,l=Array.prototype.slice.call(arguments,0),c=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],u=["opened","isFocused","container","dropdown"],d=["val","data"],h={search:"externalSearch"};return this.each(function(){if(0===l.length||"object"==typeof l[0])i=0===l.length?{}:e.extend({},l[0]),i.element=e(this),"select"===i.element.get(0).tagName.toLowerCase()?s=i.element.prop("multiple"):(s=i.multiple||!1,"tags"in i&&(i.multiple=s=!0)),a=s?new window.Select2["class"].multi:new window.Select2["class"].single,a.init(i);else{if("string"!=typeof l[0])throw"Invalid arguments to select2 plugin: "+l;if(n(l[0],c)<0)throw"Unknown method: "+l[0];if(o=t,a=e(this).data("select2"),a===t)return;if(r=l[0],"container"===r?o=a.container:"dropdown"===r?o=a.dropdown:(h[r]&&(r=h[r]),o=a[r].apply(a,l.slice(1))),n(l[0],u)>=0||n(l[0],d)>=0&&1==l.length)return!1}}),o===t?this:o},e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,i,a){var n=[];return b(e.text,i.term,n,a),n.join("")},formatSelection:function(e,i,a){return e?a(e.text):t},sortResults:function(e){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(){return t},formatMatches:function(e){return e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(e,t){var i=t-e.length;return"Please enter "+i+" or more character"+(1==i?"":"s")},formatInputTooLong:function(e,t){var i=e.length-t;return"Please delete "+i+" character"+(1==i?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(){return"Loading more results…"},formatSearching:function(){return"Searching…"},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==t?null:e.id},matcher:function(e,t){return a(""+t).toUpperCase().indexOf(a(""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:Q,escapeMarkup:w,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return t},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){var t="ontouchstart"in window||navigator.msMaxTouchPoints>0;return t&&e.opts.minimumResultsForSearch<0?!1:!0}},e.fn.select2.ajaxDefaults={transport:e.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:x,local:_,tags:C},util:{debounce:d,markMatch:b,escapeMarkup:w,stripDiacritics:a},"class":{"abstract":E,single:M,multi:I}}}}(jQuery),jQuery(document).ready(function(){jQuery(document).on("click",".um-popup-overlay",function(){remove_Modal()}),jQuery(document).on("click",'.um-modal-overlay, a[data-action="um_remove_modal"]',function(){um_remove_modal()}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"], .um-modal a',function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-modal .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-modal-body"),i=jQuery(this).parents(".um-modal-body").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".ajax-upload-dragdrop").show(),t.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um-modal .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-modal-body"),i=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview img").attr("src");return jQuery("img.cropper-hidden").cropper("destroy"),t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".ajax-upload-dragdrop").show(),t.find(".um-modal-btn.um-finish-upload").addClass("disabled"),um_modal_responsive(),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um-finish-upload.file",function(){var e=jQuery(this).attr("data-key"),t=jQuery(this).parents(".um-modal-body").find(".um-single-file-preview").html();um_remove_modal(),jQuery(".um-single-file-preview[data-key="+e+"]").fadeIn().html(t),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-btn-auto-width").html(jQuery(this).attr("data-change")),jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find("input[type=hidden]").val(jQuery(".um-single-file-preview[data-key="+e+"]").parents(".um-field").find(".um-single-fileinfo a").attr("href"))}),jQuery(document).on("click",".um-finish-upload.image",function(){var e=jQuery(this),t=jQuery(this).attr("data-key"),i=jQuery(this).parents(".um-modal-body").find(".um-single-image-preview"),a=i.find("img").attr("src"),n=i.attr("data-coord");if(jQuery(this).parents("#um_upload_single").attr("data-user_id"))var r=jQuery(this).parents("#um_upload_single").attr("data-user_id");else var r=0;n?(jQuery(this).html(jQuery(this).attr("data-processing")).addClass("disabled"),jQuery.ajax({url:um_scripts.ajaxurl,type:"POST",data:{action:"ultimatemember_resize_image",src:a,coord:n,user_id:r,key:t},success:function(i){d=new Date,"profile_photo"==t&&jQuery(".um-profile-photo-img img").attr("src",i+"?"+d.getTime()),"cover_photo"==t&&(jQuery(".um-cover-e").empty().html('<img src="'+i+"?"+d.getTime()+'" alt="" />'),jQuery(".um").hasClass("um-editing")&&jQuery(".um-cover-overlay").show()),jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",i+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(e.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find("input[type=hidden]").val(i)}})):(d=new Date,jQuery(".um-single-image-preview[data-key="+t+"]").fadeIn().find("img").attr("src",a+"?"+d.getTime()),um_remove_modal(),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find(".um-btn-auto-width").html(e.attr("data-change")),jQuery(".um-single-image-preview[data-key="+t+"]").parents(".um-field").find("input[type=hidden]").val(a))}),jQuery(document).on("click",'a[data-modal^="um_"], span[data-modal^="um_"]',function(e){var t=jQuery(this).attr("data-modal");if(jQuery(this).data("modal-size"))var i=jQuery(this).data("modal-size");else var i="normal";jQuery(this).data("modal-copy")?(jQuery("#"+t).html(jQuery(this).parents(".um-field").find(".um-modal-hidden-content").html()),jQuery(this).parents(".um-profile-photo").attr("data-user_id")&&jQuery("#"+t).attr("data-user_id",jQuery(this).parents(".um-profile-photo").attr("data-user_id")),jQuery(this).parents(".um-cover").attr("data-ratio")&&jQuery("#"+t).attr("data-ratio",jQuery(this).parents(".um-cover").attr("data-ratio")),jQuery(this).parents(".um-cover").attr("data-user_id")&&jQuery("#"+t).attr("data-user_id",jQuery(this).parents(".um-cover").attr("data-user_id")),um_new_modal(t,i)):um_new_modal(t,i)})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var i=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(i))}function i(t){var i=t.target,a=e(i);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;i=n[0]}var r=this;if(r.clk=i,"image"==i.type)if(void 0!==t.offsetX)r.clk_x=t.offsetX,r.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var o=a.offset();r.clk_x=t.pageX-o.left,r.clk_y=t.pageY-o.top}else r.clk_x=t.pageX-i.offsetLeft,r.clk_y=t.pageY-i.offsetTop;setTimeout(function(){r.clk=r.clk_x=r.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var r=!!e.fn.prop;e.fn.attr2=function(){if(!r)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function i(i){var a,n,r=e.param(i,t.traditional).split("&"),o=r.length,s=[];for(a=0;o>a;a++)r[a]=r[a].replace(/\+/g," "),n=r[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function o(a){for(var n=new FormData,r=0;r<a.length;r++)n.append(a[r].name,a[r].value);if(t.extraData){var o=i(t.extraData);for(r=0;r<o.length;r++)o[r]&&n.append(o[r][0],o[r][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:l||"POST"});t.uploadProgress&&(s.xhr=function(){var i=e.ajaxSettings.xhr();return i.upload&&i.upload.addEventListener("progress",function(e){var i=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(i=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,i)},!1),i}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,i){t.formData?i.data=t.formData:i.data=n,c&&c.call(this,e,i)},e.ajax(s)}function s(i){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(i){a("cannot get iframe.contentWindow document: "+i)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(i){a("cannot get iframe.contentDocument: "+i),t=e.document}return t}function o(){function t(){try{var e=n(v).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(i){a("Server abort: ",i," (",i.name,")"),s(k),_&&clearTimeout(_),_=void 0}}var i=d.attr2("target"),r=d.attr2("action"),o="multipart/form-data",c=d.attr("enctype")||d.attr("encoding")||o;C.setAttribute("target",f),(!l||/post/i.test(l))&&C.setAttribute("method","POST"),r!=h.url&&C.setAttribute("action",h.url),h.skipEncodingOverride||l&&!/post/i.test(l)||d.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),h.timeout&&(_=setTimeout(function(){x=!0,s(j)},h.timeout));var u=[];try{if(h.extraData)for(var p in h.extraData)h.extraData.hasOwnProperty(p)&&(e.isPlainObject(h.extraData[p])&&h.extraData[p].hasOwnProperty("name")&&h.extraData[p].hasOwnProperty("value")?u.push(e('<input type="hidden" name="'+h.extraData[p].name+'">').val(h.extraData[p].value).appendTo(C)[0]):u.push(e('<input type="hidden" name="'+p+'">').val(h.extraData[p]).appendTo(C)[0]));h.iframeTarget||g.appendTo("body"),v.attachEvent?v.attachEvent("onload",s):v.addEventListener("load",s,!1),setTimeout(t,15);try{C.submit()}catch(m){var y=document.createElement("form").submit;y.apply(C)}}finally{C.setAttribute("action",r),C.setAttribute("enctype",c),i?C.setAttribute("target",i):d.removeAttr("target"),e(u).remove()}}function s(t){if(!y.aborted&&!E){if(O=n(v),O||(a("cannot access response document"),t=k),t===j&&y)return y.abort("timeout"),void S.reject(y,"timeout");if(t==k&&y)return y.abort("server abort"),void S.reject(y,"error","server abort");if(O&&O.location.href!=h.iframeSrc||x){v.detachEvent?v.detachEvent("onload",s):v.removeEventListener("load",s,!1);var i,r="success";try{if(x)throw"timeout";var o="xml"==h.dataType||O.XMLDocument||e.isXMLDoc(O);if(a("isXml="+o),!o&&window.opera&&(null===O.body||!O.body.innerHTML)&&--M)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var l=O.body?O.body:O.documentElement;y.responseText=l?l.innerHTML:null,y.responseXML=O.XMLDocument?O.XMLDocument:O,o&&(h.dataType="xml"),y.getResponseHeader=function(e){var t={"content-type":h.dataType};return t[e.toLowerCase()]},l&&(y.status=Number(l.getAttribute("status"))||y.status,y.statusText=l.getAttribute("statusText")||y.statusText);var c=(h.dataType||"").toLowerCase(),u=/(json|script|text)/.test(c);if(u||h.textarea){var d=O.getElementsByTagName("textarea")[0];if(d)y.responseText=d.value,y.status=Number(d.getAttribute("status"))||y.status,y.statusText=d.getAttribute("statusText")||y.statusText;else if(u){var f=O.getElementsByTagName("pre")[0],m=O.getElementsByTagName("body")[0];f?y.responseText=f.textContent?f.textContent:f.innerText:m&&(y.responseText=m.textContent?m.textContent:m.innerText)}}else"xml"==c&&!y.responseXML&&y.responseText&&(y.responseXML=I(y.responseText));try{D=P(y,c,h)}catch(b){r="parsererror",y.error=i=b||r}}catch(b){a("error caught: ",b),r="error",y.error=i=b||r}y.aborted&&(a("upload aborted"),r=null),y.status&&(r=y.status>=200&&y.status<300||304===y.status?"success":"error"),"success"===r?(h.success&&h.success.call(h.context,D,"success",y),S.resolve(y.responseText,"success",y),p&&e.event.trigger("ajaxSuccess",[y,h])):r&&(void 0===i&&(i=y.statusText),h.error&&h.error.call(h.context,y,r,i),S.reject(y,"error",i),p&&e.event.trigger("ajaxError",[y,h,i])),p&&e.event.trigger("ajaxComplete",[y,h]),p&&!--e.active&&e.event.trigger("ajaxStop"),h.complete&&h.complete.call(h.context,y,r),E=!0,h.timeout&&clearTimeout(_),setTimeout(function(){h.iframeTarget?g.attr("src",h.iframeSrc):g.remove(),y.responseXML=null},100)}}}var c,u,h,p,f,g,v,y,b,w,x,_,C=d[0],S=e.Deferred();if(S.abort=function(e){y.abort(e)},i)for(u=0;u<m.length;u++)c=e(m[u]),r?c.prop("disabled",!1):c.removeAttr("disabled");if(h=e.extend(!0,{},e.ajaxSettings,t),h.context=h.context||h,f="jqFormIO"+(new Date).getTime(),h.iframeTarget?(g=e(h.iframeTarget),w=g.attr2("name"),w?f=w:g.attr2("name",f)):(g=e('<iframe name="'+f+'" src="'+h.iframeSrc+'" />'),g.css({position:"absolute",top:"-1000px",left:"-1000px"})),v=g[0],y={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var i="timeout"===t?"timeout":"aborted";a("aborting upload... "+i),this.aborted=1;try{v.contentWindow.document.execCommand&&v.contentWindow.document.execCommand("Stop")}catch(n){}g.attr("src",h.iframeSrc),y.error=i,h.error&&h.error.call(h.context,y,i,t),p&&e.event.trigger("ajaxError",[y,h,i]),h.complete&&h.complete.call(h.context,y,i)}},p=h.global,p&&0===e.active++&&e.event.trigger("ajaxStart"),p&&e.event.trigger("ajaxSend",[y,h]),h.beforeSend&&h.beforeSend.call(h.context,y,h)===!1)return h.global&&e.active--,S.reject(),S;if(y.aborted)return S.reject(),S;b=C.clk,b&&(w=b.name,w&&!b.disabled&&(h.extraData=h.extraData||{},h.extraData[w]=b.value,"image"==b.type&&(h.extraData[w+".x"]=C.clk_x,h.extraData[w+".y"]=C.clk_y)));var j=1,k=2,Q=e("meta[name=csrf-token]").attr("content"),T=e("meta[name=csrf-param]").attr("content");T&&Q&&(h.extraData=h.extraData||{},h.extraData[T]=Q),h.forceSync?o():setTimeout(o,10);var D,O,E,M=50,I=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},A=e.parseJSON||function(e){return window.eval("("+e+")")},P=function(t,i,a){var n=t.getResponseHeader("content-type")||"",r="xml"===i||!i&&n.indexOf("xml")>=0,o=r?t.responseXML:t.responseText;return r&&"parsererror"===o.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(o=a.dataFilter(o,i)),"string"==typeof o&&("json"===i||!i&&n.indexOf("json")>=0?o=A(o):("script"===i||!i&&n.indexOf("javascript")>=0)&&e.globalEval(o)),o};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var l,c,u,d=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),l=t.type||this.attr2("method"),c=t.url||this.attr2("action"),u="string"==typeof c?e.trim(c):"",u=u||window.location.href||"",u&&(u=(u.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:u,success:e.ajaxSettings.success,type:l||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var h={};if(this.trigger("form-pre-serialize",[this,t,h]),h.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var p=t.traditional;void 0===p&&(p=e.ajaxSettings.traditional);var f,m=[],g=this.formToArray(t.semantic,m);if(t.data&&(t.extraData=t.data,f=e.param(t.data,p)),t.beforeSubmit&&t.beforeSubmit(g,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[g,this,t,h]),h.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var v=e.param(g,p);f&&(v=v?v+"&"+f:f),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+v,t.data=null):t.data=v;var y=[];if(t.resetForm&&y.push(function(){d.resetForm()}),t.clearForm&&y.push(function(){d.clearForm(t.includeHidden)}),!t.dataType&&t.target){var b=t.success||function(){};y.push(function(i){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](i).each(b,arguments)})}else t.success&&y.push(t.success);if(t.success=function(e,i,a){for(var n=t.context||this,r=0,o=y.length;o>r;r++)y[r].apply(n,[e,i,a||d,d])},t.error){var w=t.error;t.error=function(e,i,a){var n=t.context||this;w.apply(n,[e,i,a,d])}}if(t.complete){var x=t.complete;t.complete=function(e,i){var a=t.context||this;x.apply(a,[e,i,d])}}var _=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),C=_.length>0,S="multipart/form-data",j=d.attr("enctype")==S||d.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var Q,T=(C||j)&&!k;t.iframe!==!1&&(t.iframe||T)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){Q=s(g)}):Q=s(g):Q=(C||j)&&k?o(g):e.ajax(t),d.removeData("jqxhr").data("jqxhr",Q);for(var D=0;D<m.length;D++)m[D]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var r={s:this.selector,c:this.context};return!e.isReady&&r.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(r.s,r.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,i).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,i),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,i)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,i){var a=[];if(0===this.length)return a;var r,o=this[0],s=this.attr("id"),l=t?o.getElementsByTagName("*"):o.elements;if(l&&!/MSIE [678]/.test(navigator.userAgent)&&(l=e(l).get()),s&&(r=e(':input[form="'+s+'"]').get(),r.length&&(l=(l||[]).concat(r))),!l||!l.length)return a;var c,u,d,h,p,f,m;for(c=0,f=l.length;f>c;c++)if(p=l[c],d=p.name,d&&!p.disabled)if(t&&o.clk&&"image"==p.type)o.clk==p&&(a.push({name:d,value:e(p).val(),type:p.type}),a.push({name:d+".x",value:o.clk_x},{name:d+".y",value:o.clk_y}));else if(h=e.fieldValue(p,!0),h&&h.constructor==Array)for(i&&i.push(p),u=0,m=h.length;m>u;u++)a.push({name:d,value:h[u]});else if(n.fileapi&&"file"==p.type){i&&i.push(p);var g=p.files;if(g.length)for(u=0;u<g.length;u++)a.push({name:d,value:g[u],type:p.type});else a.push({name:d,value:"",type:p.type})}else null!==h&&"undefined"!=typeof h&&(i&&i.push(p),a.push({name:d,value:h,type:p.type,required:p.required}));if(!t&&o.clk){var v=e(o.clk),y=v[0];d=y.name,d&&!y.disabled&&"image"==y.type&&(a.push({name:d,value:v.val()}),a.push({name:d+".x",value:o.clk_x},{name:d+".y",value:o.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var i=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var r=0,o=n.length;o>r;r++)i.push({name:a,value:n[r]});else null!==n&&"undefined"!=typeof n&&i.push({name:this.name,value:n})}}),e.param(i)},e.fn.fieldValue=function(t){for(var i=[],a=0,n=this.length;n>a;a++){var r=this[a],o=e.fieldValue(r,t);null===o||"undefined"==typeof o||o.constructor==Array&&!o.length||(o.constructor==Array?e.merge(i,o):i.push(o))}return i},e.fieldValue=function(t,i){var a=t.name,n=t.type,r=t.tagName.toLowerCase();if(void 0===i&&(i=!0),i&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==r&&-1==t.selectedIndex))return null;if("select"==r){var o=t.selectedIndex;if(0>o)return null;for(var s=[],l=t.options,c="select-one"==n,u=c?o+1:l.length,d=c?o:0;u>d;d++){var h=l[d];if(h.selected){var p=h.value;if(p||(p=h.attributes&&h.attributes.value&&!h.attributes.value.specified?h.text:h.value),c)return p;s.push(p)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){
|
||
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 & 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){
|
||
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(" ").prepend(i):this.self.append(" ").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?" ":"")}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>");
|
||
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&&M.call(this),I.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)})},M=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),M.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],I,n,"y","all",!0),S.overflowed[1]&&l(b[1],I,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=[],M=[]}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],M[M.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=[],M=[],I=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)})})})},I=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,M=function(e){return"number"==typeof e},I=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=I(arguments,2);return function(){return e.apply(t,i.concat(I(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),
|
||
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),M(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),M(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?M(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):M(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(M(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),M(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=I(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"),i=i.length?new Date(i.split(",")):null,a=a.length?new Date(a.split(",")):null;elem.pickadate({selectYears:t,min:i,max:a,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})}); |