From 16ec63748304d0acef127fdca115532b2108cfc0 Mon Sep 17 00:00:00 2001 From: andrewshuba Date: Wed, 17 Oct 2018 13:56:44 +0300 Subject: [PATCH] add condition logic and/or in admin, fix logic in front, fix condition required fields in edit profile --- .gitignore | 3 + assets/js/um-conditional.js | 9 +- assets/js/um-conditional.min.js | 2 +- assets/js/um-fileupload.min.js | 2 +- assets/js/um-jquery-form.min.js | 2 +- assets/js/um-scrollbar.min.js | 2 +- assets/js/um-select.min.js | 2 +- includes/admin/assets/css/um-admin-modal.css | 12 +- includes/admin/assets/js/um-admin-modal.js | 111 +++++-- includes/admin/core/class-admin-builder.php | 79 +++-- includes/admin/core/class-admin-metabox.php | 23 ++ includes/core/class-fields.php | 4 + includes/core/um-actions-form.php | 30 +- includes/um-short-functions.php | 333 +++++++++++++------ package.json | 5 + 15 files changed, 423 insertions(+), 196 deletions(-) diff --git a/.gitignore b/.gitignore index c83515ec..8af93ce6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ tmp/ *~.nib local.properties .classpath +.ideanpg .settings/ .loadpath @@ -217,3 +218,5 @@ pip-log.txt node_modules/ assets/vendor/ +package-lock.json +.idea \ No newline at end of file diff --git a/assets/js/um-conditional.js b/assets/js/um-conditional.js index 11a58835..f33144d2 100644 --- a/assets/js/um-conditional.js +++ b/assets/js/um-conditional.js @@ -322,25 +322,30 @@ jQuery(document).ready( function (){ */ function um_field_apply_action($dom, condition, is_true) { var child_dom = jQuery('div.um-field[data-key="' + condition.owner + '"]'); + var child_dom_input = jQuery('div.um-field[data-key="' + condition.owner + '"] input'); if (condition.action == 'show' && is_true /*&& child_dom.is(':hidden')*/) { child_dom.show(); + child_dom_input.removeAttr('disabled'); _show_in_ie( child_dom ); um_field_restore_default_value(child_dom); } if (condition.action == 'show' && !is_true /*&& child_dom.is(':visible') */) { child_dom.hide(); + child_dom_input.attr('disabled','disabled'); _hide_in_ie( child_dom ); } if (condition.action == 'hide' && is_true /*&& child_dom.is(':visible')*/) { child_dom.hide(); - _hide_in_ie( child_dom ); - } + child_dom_input.attr('disabled','disabled'); + _hide_in_ie( child_dom ); + } if (condition.action == 'hide' && !is_true /*&& child_dom.is(':hidden')*/) { child_dom.show(); + child_dom_input.removeAttr('disabled'); _show_in_ie( child_dom ); um_field_restore_default_value( child_dom ); diff --git a/assets/js/um-conditional.min.js b/assets/js/um-conditional.min.js index 4b9c8602..0973ad03 100644 --- a/assets/js/um-conditional.min.js +++ b/assets/js/um-conditional.min.js @@ -1 +1 @@ -jQuery(document).ready(function(){var e,t=[],d={},o={};function r(e){switch(s(e)){case"text":case"number":case"date":case"textarea":case"select":case"multiselect":case"radio":case"checkbox":return e.find("input,textarea,select")}return""}function s(e){var n="",i=e.attr("class");return jQuery.each(i.split(" "),function(e,i){-1!=i.indexOf("um-field-type")&&(n=i.split("_")[1])}),n}function l(e,i,n){var a,t=!1;n=!!n;for(a in i)if(n&&i[a]===e||!n&&i[a]==e){t=!0;break}return t}function i(n,e){var i,a=n.parents(".um-field[data-key]").data("key"),t=d[a],c=(i=n,um_live_field=i.parents(".um-field").data("key"),um_live_value=i.val(),i.is(":checkbox")&&(um_live_value="",1parseInt(i.value)?o[i.owner][e]=!0:o[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(c)parseInt(i.value)?r[i.owner][e]=!0:r[i.owner][e]=!1),"less than"==i.operator&&(jQuery.isNumeric(i.value)&&parseInt(c)").get(0).files,C.formdata=void 0!==window.FormData,S.fn.uploadFile=function(e){var p=S.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,r){},onSuccess:function(e,r,t){},onError:function(e,r,t){},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:""},e);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var s="upload-"+(new Date).getTime();this.formGroup=s,this.hide(),this.errorLog=S("
"),this.after(this.errorLog),this.responses=[],C.formdata||(p.dragDrop=!1),C.formdata||(p.multiple=!1);var c=this,i=S("
"+S(this).html()+"
");S(i).addClass(p.uploadButtonClass),function e(){if(S.fn.ajaxForm){if(p.dragDrop){var r=S('
');S(c).before(r),S(r).append(i),S(r).prepend(S(p.dragDropStr)),t=c,o=p,(a=r).on("dragenter",function(e){e.stopPropagation(),e.preventDefault(),S(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(e){S(this).css("border","2px dashed #ddd"),e.preventDefault(),t.errorLog.html("");var r=e.originalEvent.dataTransfer.files;!o.multiple&&1"+o.multiDragErrorStr+"").appendTo(t.errorLog):0!=o.onSelect(r)&&m(o,t,r)}),S(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),S(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),S(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}else S(c).before(i);!function l(n,d,u,p){var e="ajax-upload-id-"+(new Date).getTime();var c=S("
");var r="";u.multiple&&(u.fileName.indexOf("[]")!=u.fileName.length-2&&(u.fileName+="[]"),r="");var t=S(r).appendTo(c);t.change(function(){n.errorLog.html("");u.allowedTypes.toLowerCase().split(",");var e=[];if(this.files){for(s=0;s"+u.extErrorStr+"").appendTo(n.errorLog));if(t.push({name:r,size:"NA"}),0==u.onSelect(t))return}if(g(u,n),p.unbind("click"),c.hide(),l(n,d,u,p),c.addClass(d),C.fileapi&&C.formdata){c.removeClass(d);var o=this.files;m(u,n,o)}else{for(var a="",s=0;s":a+=e[s]+"
",n.fileCounter++;if(-1!=u.maxFileCount&&n.selectedFiles+e.length>u.maxFileCount)return void(u.showError&&S("
"+u.maxFileCountErrorStr+"
").appendTo(n.errorLog));n.selectedFiles+=e.length;var i=new b(n,u);i.filename.html(a),w(c,u,i,e,n)}});c.css({margin:0,padding:0});var o=S(p).width()+10;10==o&&(o=120);var a=p.height()+10;10==a&&(a=35);p.css({position:"relative",overflow:"hidden",cursor:"default"});t.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"});c.appendTo(p)}(c,s,p,i)}else window.setTimeout(e,10);var t,o,a}(),this.startUpload=function(){S("."+this.formGroup).each(function(e,r){S(this).is("form")&&S(this).submit()})},this.stopUpload=function(){S(".upload-red").each(function(e,r){S(this).hasClass(c.formGroup)&&S(this).click()})};var h=!(this.getResponses=function(){return this.responses});function f(e){var r,t,o=[],a=(o="string"==jQuery.type(e)?e.split("&"):S.param(e).split("&")).length,s=[];for(r=0;re.maxFileSize)e.showError&&S("
"+e.sizeErrorStr+"
").appendTo(r.errorLog);else if(-1!=e.maxFileCount&&r.selectedFiles>=e.maxFileCount)e.showError&&S("
"+e.maxFileCountErrorStr+"
").appendTo(r.errorLog);else{r.selectedFiles++;var a=e,s=new FormData,i=e.fileName.replace("[]","");s.append(i,t[o]);var l=e.formData;if(l)for(var n=f(l),d=0;d");c.appendTo("body");var h=[];h.push(t[o].name),w(c,a,u,h,r),r.fileCounter++}else e.showError&&S("
"+e.extErrorStr+"
").appendTo(r.errorLog)}function v(e,r,t){var o=r.allowedTypes.toLowerCase().split(","),a=t.split(".").pop().toLowerCase();return!("*"!=r.allowedTypes&&jQuery.inArray(a,o)<0)}function g(a,e){if(a.showFileCounter){var s=S(".upload-filename").length;e.fileCounter=s+1,S(".upload-filename").each(function(e,r){var t=S(this).html().split(a.fileCounterStyle),o=(parseInt(t[0]),s+a.fileCounterStyle+t[1]);S(this).html(o),s--})}}function b(e,r){return this.statusbar=S("
"),this.filename=S("
").appendTo(this.statusbar),this.progressDiv=S("
").appendTo(this.statusbar).hide(),this.progressbar=S("
").appendTo(this.progressDiv),this.abort=S("
"+r.abortStr+"
").appendTo(this.statusbar).hide(),this.cancel=S("
"+r.cancelStr+"
").appendTo(this.statusbar).hide(),this.done=S("
"+r.doneStr+"
").appendTo(this.statusbar).hide(),this.del=S("
"+r.deletelStr+"
").appendTo(this.statusbar).hide(),e.errorLog.after(this.statusbar),this}function w(i,l,n,d,u){var e={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:l.formData,formData:l.fileData,dataType:l.returnType,beforeSubmit:function(e,r,t){if(0!=l.onSubmit.call(this,d)){var o=l.dynamicFormData();if(o){var a=f(o);if(a)for(var s=0;s"+l.uploadErrorStr+"
"),n.cancel.show(),i.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,r){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),l.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),u.selectedFiles-=d.length})),C.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,r,t,o){98ERROR: "+t+"")):(n.statusbar.hide(),n.statusbar.remove()),u.selectedFiles-=d.length),i.remove(),u.fCounter+=d.length}};l.autoSubmit?i.ajaxSubmit(e):(l.showCancel&&(n.cancel.show(),n.cancel.click(function(){i.remove(),n.statusbar.remove(),u.selectedFiles-=d.length,g(l,u)})),i.ajaxForm(e))}return this}}(jQuery); \ No newline at end of file +!function(S){S.fn.ajaxForm;var C={};C.fileapi=void 0!==S("").get(0).files,C.formdata=void 0!==window.FormData,S.fn.uploadFile=function(e){var p=S.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,r){},onSuccess:function(e,r,t){},onError:function(e,r,t){},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:""},e);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var s="upload-"+(new Date).getTime();this.formGroup=s,this.hide(),this.errorLog=S("
"),this.after(this.errorLog),this.responses=[],C.formdata||(p.dragDrop=!1),C.formdata||(p.multiple=!1);var c=this,i=S("
"+S(this).html()+"
");S(i).addClass(p.uploadButtonClass),function e(){if(S.fn.ajaxForm){if(p.dragDrop){var r=S('
');S(c).before(r),S(r).append(i),S(r).prepend(S(p.dragDropStr)),t=c,o=p,(a=r).on("dragenter",function(e){e.stopPropagation(),e.preventDefault(),S(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(e){S(this).css("border","2px dashed #ddd"),e.preventDefault(),t.errorLog.html("");var r=e.originalEvent.dataTransfer.files;!o.multiple&&1"+o.multiDragErrorStr+"").appendTo(t.errorLog):0!=o.onSelect(r)&&m(o,t,r)}),S(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),S(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),S(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}else S(c).before(i);!function l(n,d,u,p){var e="ajax-upload-id-"+(new Date).getTime();var c=S("
");var r="";u.multiple&&(u.fileName.indexOf("[]")!=u.fileName.length-2&&(u.fileName+="[]"),r="");var t=S(r).appendTo(c);t.change(function(){n.errorLog.html("");u.allowedTypes.toLowerCase().split(",");var e=[];if(this.files){for(s=0;s"+u.extErrorStr+"").appendTo(n.errorLog));if(t.push({name:r,size:"NA"}),0==u.onSelect(t))return}if(g(u,n),p.unbind("click"),c.hide(),l(n,d,u,p),c.addClass(d),C.fileapi&&C.formdata){c.removeClass(d);var o=this.files;m(u,n,o)}else{for(var a="",s=0;s":a+=e[s]+"
",n.fileCounter++;if(-1!=u.maxFileCount&&n.selectedFiles+e.length>u.maxFileCount)return void(u.showError&&S("
"+u.maxFileCountErrorStr+"
").appendTo(n.errorLog));n.selectedFiles+=e.length;var i=new b(n,u);i.filename.html(a),w(c,u,i,e,n)}});c.css({margin:0,padding:0});var o=S(p).width()+10;10==o&&(o=120);var a=p.height()+10;10==a&&(a=35);p.css({position:"relative",overflow:"hidden",cursor:"default"});t.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"});c.appendTo(p)}(c,s,p,i)}else window.setTimeout(e,10);var t,o,a}(),this.startUpload=function(){S("."+this.formGroup).each(function(e,r){S(this).is("form")&&S(this).submit()})},this.stopUpload=function(){S(".upload-red").each(function(e,r){S(this).hasClass(c.formGroup)&&S(this).click()})};var h=!(this.getResponses=function(){return this.responses});function f(e){var r,t,o=[],a=(o="string"==jQuery.type(e)?e.split("&"):S.param(e).split("&")).length,s=[];for(r=0;re.maxFileSize)e.showError&&S("
"+e.sizeErrorStr+"
").appendTo(r.errorLog);else if(-1!=e.maxFileCount&&r.selectedFiles>=e.maxFileCount)e.showError&&S("
"+e.maxFileCountErrorStr+"
").appendTo(r.errorLog);else{r.selectedFiles++;var a=e,s=new FormData,i=e.fileName.replace("[]","");s.append(i,t[o]);var l=e.formData;if(l)for(var n=f(l),d=0;d");c.appendTo("body");var h=[];h.push(t[o].name),w(c,a,u,h,r),r.fileCounter++}else e.showError&&S("
"+e.extErrorStr+"
").appendTo(r.errorLog)}function v(e,r,t){var o=r.allowedTypes.toLowerCase().split(","),a=t.split(".").pop().toLowerCase();return!("*"!=r.allowedTypes&&jQuery.inArray(a,o)<0)}function g(a,e){if(a.showFileCounter){var s=S(".upload-filename").length;e.fileCounter=s+1,S(".upload-filename").each(function(e,r){var t=S(this).html().split(a.fileCounterStyle),o=(parseInt(t[0]),s+a.fileCounterStyle+t[1]);S(this).html(o),s--})}}function b(e,r){return this.statusbar=S("
"),this.filename=S("
").appendTo(this.statusbar),this.progressDiv=S("
").appendTo(this.statusbar).hide(),this.progressbar=S("
").appendTo(this.progressDiv),this.abort=S("
"+r.abortStr+"
").appendTo(this.statusbar).hide(),this.cancel=S("
"+r.cancelStr+"
").appendTo(this.statusbar).hide(),this.done=S("
"+r.doneStr+"
").appendTo(this.statusbar).hide(),this.del=S("
"+r.deletelStr+"
").appendTo(this.statusbar).hide(),e.errorLog.after(this.statusbar),this}function w(i,l,n,d,u){var e={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:l.formData,formData:l.fileData,dataType:l.returnType,beforeSubmit:function(e,r,t){if(0==l.onSubmit.call(this,d))return n.statusbar.append("
"+l.uploadErrorStr+"
"),n.cancel.show(),i.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1;var o=l.dynamicFormData();if(o){var a=f(o);if(a)for(var s=0;sERROR: "+t+"")):(n.statusbar.hide(),n.statusbar.remove()),u.selectedFiles-=d.length),i.remove(),u.fCounter+=d.length}};l.autoSubmit?i.ajaxSubmit(e):(l.showCancel&&(n.cancel.show(),n.cancel.click(function(){i.remove(),n.statusbar.remove(),u.selectedFiles-=d.length,g(l,u)})),i.ajaxForm(e))}return this}}(jQuery); \ No newline at end of file diff --git a/assets/js/um-jquery-form.min.js b/assets/js/um-jquery-form.min.js index bdef9d18..ec3b11c9 100644 --- a/assets/js/um-jquery-form.min.js +++ b/assets/js/um-jquery-form.min.js @@ -1 +1 @@ -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(X){"use strict";var b={};b.fileapi=void 0!==X("").get(0).files,b.formdata=void 0!==window.FormData;var C=!!X.fn.prop;function r(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),X(e.target).ajaxSubmit(t))}function a(e){var t=e.target,r=X(t);if(!r.is("[type=submit],[type=image]")){var a=r.closest("[type=submit]");if(0===a.length)return;t=a[0]}var n=this;if("image"==(n.clk=t).type)if(void 0!==e.offsetX)n.clk_x=e.offsetX,n.clk_y=e.offsetY;else if("function"==typeof X.fn.offset){var i=r.offset();n.clk_x=e.pageX-i.left,n.clk_y=e.pageY-i.top}else n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop;setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function _(){if(X.fn.ajaxSubmit.debug){var e="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e)}}X.fn.attr2=function(){if(!C)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)},X.fn.ajaxSubmit=function(E){if(!this.length)return _("ajaxSubmit: skipping submit process - no element selected"),this;var M,e,t,F=this;"function"==typeof E?E={success:E}:void 0===E&&(E={}),M=E.type||this.attr2("method"),(t=(t="string"==typeof(e=E.url||this.attr2("action"))?X.trim(e):"")||window.location.href||"")&&(t=(t.match(/^([^#]+)/)||[])[1]),E=X.extend(!0,{url:t,success:X.ajaxSettings.success,type:M||X.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},E);var r={};if(this.trigger("form-pre-serialize",[this,E,r]),r.veto)return _("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(E.beforeSerialize&&!1===E.beforeSerialize(this,E))return _("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var a=E.traditional;void 0===a&&(a=X.ajaxSettings.traditional);var n,O=[],i=this.formToArray(E.semantic,O);if(E.data&&(E.extraData=E.data,n=X.param(E.data,a)),E.beforeSubmit&&!1===E.beforeSubmit(i,this,E))return _("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[i,this,E,r]),r.veto)return _("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var o=X.param(i,a);n&&(o=o?o+"&"+n:n),"GET"==E.type.toUpperCase()?(E.url+=(0<=E.url.indexOf("?")?"&":"?")+o,E.data=null):E.data=o;var s=[];if(E.resetForm&&s.push(function(){F.resetForm()}),E.clearForm&&s.push(function(){F.clearForm(E.includeHidden)}),!E.dataType&&E.target){var u=E.success||function(){};s.push(function(e){var t=E.replaceTarget?"replaceWith":"html";X(E.target)[t](e).each(u,arguments)})}else E.success&&s.push(E.success);if(E.success=function(e,t,r){for(var a=E.context||this,n=0,i=s.length;n')).css({position:"absolute",top:"-1000px",left:"-1000px"}),p=m[0],d={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";_("aborting upload... "+t),this.aborted=1;try{p.contentWindow.document.execCommand&&p.contentWindow.document.execCommand("Stop")}catch(e){}m.attr("src",l.iframeSrc),d.error=t,l.error&&l.error.call(l.context,d,t,e),f&&X.event.trigger("ajaxError",[d,l,t]),l.complete&&l.complete.call(l.context,d,t)}},(f=l.global)&&0==X.active++&&X.event.trigger("ajaxStart"),f&&X.event.trigger("ajaxSend",[d,l]),l.beforeSend&&!1===l.beforeSend.call(l.context,d,l))return l.global&&X.active--,g.reject(),g;if(d.aborted)return g.reject(),g;(a=o.clk)&&(n=a.name)&&!a.disabled&&(l.extraData=l.extraData||{},l.extraData[n]=a.value,"image"==a.type&&(l.extraData[n+".x"]=o.clk_x,l.extraData[n+".y"]=o.clk_y));var x=1,b=2;function y(t){var r=null;try{t.contentWindow&&(r=t.contentWindow.document)}catch(e){_("cannot get iframe.contentWindow document: "+e)}if(r)return r;try{r=t.contentDocument?t.contentDocument:t.document}catch(e){_("cannot get iframe.contentDocument: "+e),r=t.document}return r}var s=X("meta[name=csrf-token]").attr("content"),u=X("meta[name=csrf-param]").attr("content");function c(){var e=F.attr2("target"),t=F.attr2("action"),r=F.attr("enctype")||F.attr("encoding")||"multipart/form-data";o.setAttribute("target",i),M&&!/post/i.test(M)||o.setAttribute("method","POST"),t!=l.url&&o.setAttribute("action",l.url),l.skipEncodingOverride||M&&!/post/i.test(M)||F.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),l.timeout&&(v=setTimeout(function(){h=!0,D(x)},l.timeout));var a=[];try{if(l.extraData)for(var n in l.extraData)l.extraData.hasOwnProperty(n)&&(X.isPlainObject(l.extraData[n])&&l.extraData[n].hasOwnProperty("name")&&l.extraData[n].hasOwnProperty("value")?a.push(X('').val(l.extraData[n].value).appendTo(o)[0]):a.push(X('').val(l.extraData[n]).appendTo(o)[0]));l.iframeTarget||m.appendTo("body"),p.attachEvent?p.attachEvent("onload",D):p.addEventListener("load",D,!1),setTimeout(function e(){try{var t=y(p).readyState;_("state = "+t),t&&"uninitialized"==t.toLowerCase()&&setTimeout(e,50)}catch(e){_("Server abort: ",e," (",e.name,")"),D(b),v&&clearTimeout(v),v=void 0}},15);try{o.submit()}catch(e){document.createElement("form").submit.apply(o)}}finally{o.setAttribute("action",t),o.setAttribute("enctype",r),e?o.setAttribute("target",e):F.removeAttr("target"),X(a).remove()}}u&&s&&(l.extraData=l.extraData||{},l.extraData[u]=s),l.forceSync?c():setTimeout(c,10);var T,j,w,S=50;function D(e){if(!d.aborted&&!w){if((j=y(p))||(_("cannot access response document"),e=b),e===x&&d)return d.abort("timeout"),void g.reject(d,"timeout");if(e==b&&d)return d.abort("server abort"),void g.reject(d,"error","server abort");if(j&&j.location.href!=l.iframeSrc||h){p.detachEvent?p.detachEvent("onload",D):p.removeEventListener("load",D,!1);var t,r="success";try{if(h)throw"timeout";var a="xml"==l.dataType||j.XMLDocument||X.isXMLDoc(j);if(_("isXml="+a),!a&&window.opera&&(null===j.body||!j.body.innerHTML)&&--S)return _("requeing onLoad callback, DOM not available"),void setTimeout(D,250);var n=j.body?j.body:j.documentElement;d.responseText=n?n.innerHTML:null,d.responseXML=j.XMLDocument?j.XMLDocument:j,a&&(l.dataType="xml"),d.getResponseHeader=function(e){return{"content-type":l.dataType}[e.toLowerCase()]},n&&(d.status=Number(n.getAttribute("status"))||d.status,d.statusText=n.getAttribute("statusText")||d.statusText);var i=(l.dataType||"").toLowerCase(),o=/(json|script|text)/.test(i);if(o||l.textarea){var s=j.getElementsByTagName("textarea")[0];if(s)d.responseText=s.value,d.status=Number(s.getAttribute("status"))||d.status,d.statusText=s.getAttribute("statusText")||d.statusText;else if(o){var u=j.getElementsByTagName("pre")[0],c=j.getElementsByTagName("body")[0];u?d.responseText=u.textContent?u.textContent:u.innerText:c&&(d.responseText=c.textContent?c.textContent:c.innerText)}}else"xml"==i&&!d.responseXML&&d.responseText&&(d.responseXML=k(d.responseText));try{T=L(d,i,l)}catch(e){r="parsererror",d.error=t=e||r}}catch(e){_("error caught: ",e),r="error",d.error=t=e||r}d.aborted&&(_("upload aborted"),r=null),d.status&&(r=200<=d.status&&d.status<300||304===d.status?"success":"error"),"success"===r?(l.success&&l.success.call(l.context,T,"success",d),g.resolve(d.responseText,"success",d),f&&X.event.trigger("ajaxSuccess",[d,l])):r&&(void 0===t&&(t=d.statusText),l.error&&l.error.call(l.context,d,r,t),g.reject(d,"error",t),f&&X.event.trigger("ajaxError",[d,l,t])),f&&X.event.trigger("ajaxComplete",[d,l]),f&&!--X.active&&X.event.trigger("ajaxStop"),l.complete&&l.complete.call(l.context,d,r),w=!0,l.timeout&&clearTimeout(v),setTimeout(function(){l.iframeTarget?m.attr("src",l.iframeSrc):m.remove(),d.responseXML=null},100)}}}var k=X.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},A=X.parseJSON||function(e){return window.eval("("+e+")")},L=function(e,t,r){var a=e.getResponseHeader("content-type")||"",n="xml"===t||!t&&0<=a.indexOf("xml"),i=n?e.responseXML:e.responseText;return n&&"parsererror"===i.documentElement.nodeName&&X.error&&X.error("parsererror"),r&&r.dataFilter&&(i=r.dataFilter(i,t)),"string"==typeof i&&("json"===t||!t&&0<=a.indexOf("json")?i=A(i):("script"===t||!t&&0<=a.indexOf("javascript"))&&X.globalEval(i)),i};return g}},X.fn.ajaxForm=function(e){if((e=e||{}).delegation=e.delegation&&X.isFunction(X.fn.on),!e.delegation&&0===this.length){var t={s:this.selector,c:this.context};return!X.isReady&&t.s?(_("DOM not ready, queuing ajaxForm"),X(function(){X(t.s,t.c).ajaxForm(e)})):_("terminating; zero elements found by selector"+(X.isReady?"":" (DOM not ready)")),this}return e.delegation?(X(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,e,r).on("click.form-plugin",this.selector,e,a),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,r).bind("click.form-plugin",e,a)},X.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},X.fn.formToArray=function(e,t){var r=[];if(0===this.length)return r;var a,n,i,o,s,u,c,l,f=this[0],m=this.attr("id"),p=e?f.getElementsByTagName("*"):f.elements;if(p&&!/MSIE [678]/.test(navigator.userAgent)&&(p=X(p).get()),m&&(a=X(':input[form="'+m+'"]').get()).length&&(p=(p||[]).concat(a)),!p||!p.length)return r;for(n=0,c=p.length;n").get(0).files,b.formdata=void 0!==window.FormData;var C=!!X.fn.prop;function r(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),X(e.target).ajaxSubmit(t))}function a(e){var t=e.target,r=X(t);if(!r.is("[type=submit],[type=image]")){var a=r.closest("[type=submit]");if(0===a.length)return;t=a[0]}var n=this;if("image"==(n.clk=t).type)if(void 0!==e.offsetX)n.clk_x=e.offsetX,n.clk_y=e.offsetY;else if("function"==typeof X.fn.offset){var i=r.offset();n.clk_x=e.pageX-i.left,n.clk_y=e.pageY-i.top}else n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop;setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function _(){if(X.fn.ajaxSubmit.debug){var e="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e)}}X.fn.attr2=function(){if(!C)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)},X.fn.ajaxSubmit=function(E){if(!this.length)return _("ajaxSubmit: skipping submit process - no element selected"),this;var M,e,t,F=this;"function"==typeof E?E={success:E}:void 0===E&&(E={}),M=E.type||this.attr2("method"),(t=(t="string"==typeof(e=E.url||this.attr2("action"))?X.trim(e):"")||window.location.href||"")&&(t=(t.match(/^([^#]+)/)||[])[1]),E=X.extend(!0,{url:t,success:X.ajaxSettings.success,type:M||X.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},E);var r={};if(this.trigger("form-pre-serialize",[this,E,r]),r.veto)return _("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(E.beforeSerialize&&!1===E.beforeSerialize(this,E))return _("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var a=E.traditional;void 0===a&&(a=X.ajaxSettings.traditional);var n,O=[],i=this.formToArray(E.semantic,O);if(E.data&&(E.extraData=E.data,n=X.param(E.data,a)),E.beforeSubmit&&!1===E.beforeSubmit(i,this,E))return _("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[i,this,E,r]),r.veto)return _("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var o=X.param(i,a);n&&(o=o?o+"&"+n:n),"GET"==E.type.toUpperCase()?(E.url+=(0<=E.url.indexOf("?")?"&":"?")+o,E.data=null):E.data=o;var s=[];if(E.resetForm&&s.push(function(){F.resetForm()}),E.clearForm&&s.push(function(){F.clearForm(E.includeHidden)}),!E.dataType&&E.target){var u=E.success||function(){};s.push(function(e){var t=E.replaceTarget?"replaceWith":"html";X(E.target)[t](e).each(u,arguments)})}else E.success&&s.push(E.success);if(E.success=function(e,t,r){for(var a=E.context||this,n=0,i=s.length;n')).css({position:"absolute",top:"-1000px",left:"-1000px"}),p=m[0],d={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(e){var t="timeout"===e?"timeout":"aborted";_("aborting upload... "+t),this.aborted=1;try{p.contentWindow.document.execCommand&&p.contentWindow.document.execCommand("Stop")}catch(e){}m.attr("src",l.iframeSrc),d.error=t,l.error&&l.error.call(l.context,d,t,e),f&&X.event.trigger("ajaxError",[d,l,t]),l.complete&&l.complete.call(l.context,d,t)}},(f=l.global)&&0==X.active++&&X.event.trigger("ajaxStart"),f&&X.event.trigger("ajaxSend",[d,l]),l.beforeSend&&!1===l.beforeSend.call(l.context,d,l))return l.global&&X.active--,g.reject(),g;if(d.aborted)return g.reject(),g;(a=o.clk)&&(n=a.name)&&!a.disabled&&(l.extraData=l.extraData||{},l.extraData[n]=a.value,"image"==a.type&&(l.extraData[n+".x"]=o.clk_x,l.extraData[n+".y"]=o.clk_y));var x=1,b=2;function y(t){var r=null;try{t.contentWindow&&(r=t.contentWindow.document)}catch(e){_("cannot get iframe.contentWindow document: "+e)}if(r)return r;try{r=t.contentDocument?t.contentDocument:t.document}catch(e){_("cannot get iframe.contentDocument: "+e),r=t.document}return r}var s=X("meta[name=csrf-token]").attr("content"),u=X("meta[name=csrf-param]").attr("content");function c(){var e=F.attr2("target"),t=F.attr2("action"),r=F.attr("enctype")||F.attr("encoding")||"multipart/form-data";o.setAttribute("target",i),M&&!/post/i.test(M)||o.setAttribute("method","POST"),t!=l.url&&o.setAttribute("action",l.url),l.skipEncodingOverride||M&&!/post/i.test(M)||F.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),l.timeout&&(v=setTimeout(function(){h=!0,D(x)},l.timeout));var a=[];try{if(l.extraData)for(var n in l.extraData)l.extraData.hasOwnProperty(n)&&(X.isPlainObject(l.extraData[n])&&l.extraData[n].hasOwnProperty("name")&&l.extraData[n].hasOwnProperty("value")?a.push(X('').val(l.extraData[n].value).appendTo(o)[0]):a.push(X('').val(l.extraData[n]).appendTo(o)[0]));l.iframeTarget||m.appendTo("body"),p.attachEvent?p.attachEvent("onload",D):p.addEventListener("load",D,!1),setTimeout(function e(){try{var t=y(p).readyState;_("state = "+t),t&&"uninitialized"==t.toLowerCase()&&setTimeout(e,50)}catch(e){_("Server abort: ",e," (",e.name,")"),D(b),v&&clearTimeout(v),v=void 0}},15);try{o.submit()}catch(e){document.createElement("form").submit.apply(o)}}finally{o.setAttribute("action",t),o.setAttribute("enctype",r),e?o.setAttribute("target",e):F.removeAttr("target"),X(a).remove()}}u&&s&&(l.extraData=l.extraData||{},l.extraData[u]=s),l.forceSync?c():setTimeout(c,10);var T,j,w,S=50;function D(e){if(!d.aborted&&!w){if((j=y(p))||(_("cannot access response document"),e=b),e===x&&d)return d.abort("timeout"),void g.reject(d,"timeout");if(e==b&&d)return d.abort("server abort"),void g.reject(d,"error","server abort");if(j&&j.location.href!=l.iframeSrc||h){p.detachEvent?p.detachEvent("onload",D):p.removeEventListener("load",D,!1);var t,r="success";try{if(h)throw"timeout";var a="xml"==l.dataType||j.XMLDocument||X.isXMLDoc(j);if(_("isXml="+a),!a&&window.opera&&(null===j.body||!j.body.innerHTML)&&--S)return _("requeing onLoad callback, DOM not available"),void setTimeout(D,250);var n=j.body?j.body:j.documentElement;d.responseText=n?n.innerHTML:null,d.responseXML=j.XMLDocument?j.XMLDocument:j,a&&(l.dataType="xml"),d.getResponseHeader=function(e){return{"content-type":l.dataType}[e.toLowerCase()]},n&&(d.status=Number(n.getAttribute("status"))||d.status,d.statusText=n.getAttribute("statusText")||d.statusText);var i=(l.dataType||"").toLowerCase(),o=/(json|script|text)/.test(i);if(o||l.textarea){var s=j.getElementsByTagName("textarea")[0];if(s)d.responseText=s.value,d.status=Number(s.getAttribute("status"))||d.status,d.statusText=s.getAttribute("statusText")||d.statusText;else if(o){var u=j.getElementsByTagName("pre")[0],c=j.getElementsByTagName("body")[0];u?d.responseText=u.textContent?u.textContent:u.innerText:c&&(d.responseText=c.textContent?c.textContent:c.innerText)}}else"xml"==i&&!d.responseXML&&d.responseText&&(d.responseXML=k(d.responseText));try{T=L(d,i,l)}catch(e){r="parsererror",d.error=t=e||r}}catch(e){_("error caught: ",e),r="error",d.error=t=e||r}d.aborted&&(_("upload aborted"),r=null),d.status&&(r=200<=d.status&&d.status<300||304===d.status?"success":"error"),"success"===r?(l.success&&l.success.call(l.context,T,"success",d),g.resolve(d.responseText,"success",d),f&&X.event.trigger("ajaxSuccess",[d,l])):r&&(void 0===t&&(t=d.statusText),l.error&&l.error.call(l.context,d,r,t),g.reject(d,"error",t),f&&X.event.trigger("ajaxError",[d,l,t])),f&&X.event.trigger("ajaxComplete",[d,l]),f&&!--X.active&&X.event.trigger("ajaxStop"),l.complete&&l.complete.call(l.context,d,r),w=!0,l.timeout&&clearTimeout(v),setTimeout(function(){l.iframeTarget?m.attr("src",l.iframeSrc):m.remove(),d.responseXML=null},100)}}}var k=X.parseXML||function(e,t){return window.ActiveXObject?((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},A=X.parseJSON||function(e){return window.eval("("+e+")")},L=function(e,t,r){var a=e.getResponseHeader("content-type")||"",n="xml"===t||!t&&0<=a.indexOf("xml"),i=n?e.responseXML:e.responseText;return n&&"parsererror"===i.documentElement.nodeName&&X.error&&X.error("parsererror"),r&&r.dataFilter&&(i=r.dataFilter(i,t)),"string"==typeof i&&("json"===t||!t&&0<=a.indexOf("json")?i=A(i):("script"===t||!t&&0<=a.indexOf("javascript"))&&X.globalEval(i)),i};return g}},X.fn.ajaxForm=function(e){if((e=e||{}).delegation=e.delegation&&X.isFunction(X.fn.on),e.delegation||0!==this.length)return e.delegation?(X(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,e,r).on("click.form-plugin",this.selector,e,a),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,r).bind("click.form-plugin",e,a);var t={s:this.selector,c:this.context};return!X.isReady&&t.s?(_("DOM not ready, queuing ajaxForm"),X(function(){X(t.s,t.c).ajaxForm(e)})):_("terminating; zero elements found by selector"+(X.isReady?"":" (DOM not ready)")),this},X.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},X.fn.formToArray=function(e,t){var r=[];if(0===this.length)return r;var a,n,i,o,s,u,c,l,f=this[0],m=this.attr("id"),p=e?f.getElementsByTagName("*"):f.elements;if(p&&!/MSIE [678]/.test(navigator.userAgent)&&(p=X(p).get()),m&&(a=X(':input[form="'+m+'"]').get()).length&&(p=(p||[]).concat(a)),!p||!p.length)return r;for(n=0,c=p.length;nn[0].parent().height()?B.call(this):(G(e,i[0].toString(),{dir:"y",dur:0,overwrite:"none"}),t.contentReset.y=null):(B.call(this),"y"===o.axis?k.call(this):"yx"===o.axis&&t.overflowed[1]&&G(e,i[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==o.axis&&(t.overflowed[1]?n[1].width()>n[1].parent().width()?B.call(this):(G(e,i[1].toString(),{dir:"x",dur:0,overwrite:"none"}),t.contentReset.x=null):(B.call(this),"x"===o.axis?k.call(this):"yx"===o.axis&&t.overflowed[0]&&G(e,i[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),r&&t&&(2===r&&o.callbacks.onImageLoad&&"function"==typeof o.callbacks.onImageLoad?o.callbacks.onImageLoad.call(this):3===r&&o.callbacks.onSelectorChange&&"function"==typeof o.callbacks.onSelectorChange?o.callbacks.onSelectorChange.call(this):o.callbacks.onUpdate&&"function"==typeof o.callbacks.onUpdate&&o.callbacks.onUpdate.call(this)),Q.call(this)}})},scrollTo:function(l,s){if(void 0!==l&&null!=l){var e=c.call(this);return E(e).each(function(){var e=E(this);if(e.data(W)){var t=e.data(W),o=t.opt,a={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=E.extend(!0,{},a,s),i=N.call(this,l),r=0
","
"],i="yx"===o.axis?"mCSB_vertical_horizontal":"x"===o.axis?"mCSB_horizontal":"mCSB_vertical",r="yx"===o.axis?n[0]+n[1]:"x"===o.axis?n[1]:n[0],l="yx"===o.axis?"
":"",s=o.autoHideScrollbar?" "+w[6]:"",c="x"!==o.axis&&"rtl"===t.langDir?" "+w[7]:"";o.setWidth&&e.css("width",o.setWidth),o.setHeight&&e.css("height",o.setHeight),o.setLeft="y"!==o.axis&&"rtl"===t.langDir?"989999px":o.setLeft,e.addClass(f+" _"+W+"_"+t.idx+s+c).wrapInner("
");var d=E("#mCSB_"+t.idx),u=E("#mCSB_"+t.idx+"_container");"y"===o.axis||o.advanced.autoExpandHorizontalScroll||u.css("width",g(u.children())),"outside"===o.scrollbarPosition?("static"===e.css("position")&&e.css("position","relative"),e.css("overflow","visible"),d.addClass("mCSB_outside").after(r)):(d.addClass("mCSB_inside").append(r),u.wrap(l)),_.call(this);var h=[E("#mCSB_"+t.idx+"_dragger_vertical"),E("#mCSB_"+t.idx+"_dragger_horizontal")];h[0].css("min-height",h[0].height()),h[1].css("min-width",h[1].width())},g=function(e){return Math.max.apply(Math,e.map(function(){return E(this).outerWidth(!0)}).get())},x=function(){var e=E(this),t=e.data(W),o=t.opt,a=E("#mCSB_"+t.idx+"_container");o.advanced.autoExpandHorizontalScroll&&"y"!==o.axis&&a.css({position:"absolute",width:"auto"}).wrap("
").css({width:Math.ceil(a[0].getBoundingClientRect().right+.4)-Math.floor(a[0].getBoundingClientRect().left),position:"relative"}).unwrap()},_=function(){var e=E(this),t=e.data(W),o=t.opt,a=E(".mCSB_"+t.idx+"_scrollbar:first"),n=ae(o.scrollButtons.tabindex)?"tabindex='"+o.scrollButtons.tabindex+"'":"",i=["","","",""],r=["x"===o.axis?i[2]:i[0],"x"===o.axis?i[3]:i[1],i[2],i[3]];o.scrollButtons.enable&&a.prepend(r[0]).append(r[1]).next(".mCSB_scrollTools").prepend(r[2]).append(r[3])},S=function(){var e=E(this),t=e.data(W),o=E("#mCSB_"+t.idx),a=e.css("max-height")||"none",n=-1!==a.indexOf("%"),i=e.css("box-sizing");if("none"!==a){var r=n?e.parent().height()*parseInt(a)/100:parseInt(a);"border-box"===i&&(r-=e.innerHeight()-e.height()+(e.outerHeight()-e.innerHeight())),o.css("max-height",Math.round(r))}},b=function(){var e=E(this),t=e.data(W),o=E("#mCSB_"+t.idx),a=E("#mCSB_"+t.idx+"_container"),n=[E("#mCSB_"+t.idx+"_dragger_vertical"),E("#mCSB_"+t.idx+"_dragger_horizontal")],i=[o.height()/a.outerHeight(!1),o.width()/a.outerWidth(!1)],r=[parseInt(n[0].css("min-height")),Math.round(i[0]*n[0].parent().height()),parseInt(n[1].css("min-width")),Math.round(i[1]*n[1].parent().width())],l=p&&r[1]o.height(),i>o.width()]},B=function(){var e=E(this),t=e.data(W),o=t.opt,a=E("#mCSB_"+t.idx),n=E("#mCSB_"+t.idx+"_container"),i=[E("#mCSB_"+t.idx+"_dragger_vertical"),E("#mCSB_"+t.idx+"_dragger_horizontal")];if(Z(e),("x"!==o.axis&&!t.overflowed[0]||"y"===o.axis&&t.overflowed[0])&&(i[0].add(n).css("top",0),G(e,"_resetY")),"y"!==o.axis&&!t.overflowed[1]||"x"===o.axis&&t.overflowed[1]){var r=dx=0;"rtl"===t.langDir&&(r=a.width()-n.outerWidth(!1),dx=Math.abs(r/t.scrollRatio.x)),n.css("left",r),i[1].css("left",dx),G(e,"_resetX")}},M=function(){var t,o=E(this),e=o.data(W),a=e.opt;e.bindEvents||(r.call(this),a.contentTouchScroll&&I.call(this),D.call(this),a.mouseWheel.enable&&function e(){t=setTimeout(function(){E.event.special.mousewheel?(clearTimeout(t),R.call(o[0])):e()},100)}(),X.call(this),U.call(this),a.advanced.autoScrollOnFocus&&Y.call(this),a.scrollButtons.enable&&j.call(this),a.keyboard.enable&&q.call(this),e.bindEvents=!0)},k=function(){var e=E(this),t=e.data(W),o=t.opt,a=W+"_"+t.idx,n=".mCSB_"+t.idx+"_scrollbar",i=E("#mCSB_"+t.idx+",#mCSB_"+t.idx+"_container,#mCSB_"+t.idx+"_container_wrapper,"+n+" ."+w[12]+",#mCSB_"+t.idx+"_dragger_vertical,#mCSB_"+t.idx+"_dragger_horizontal,"+n+">a"),r=E("#mCSB_"+t.idx+"_container");o.advanced.releaseDraggableSelectors&&i.add(E(o.advanced.releaseDraggableSelectors)),t.bindEvents&&(E(document).unbind("."+a),i.each(function(){E(this).unbind("."+a)}),clearTimeout(e[0]._focusTimeout),ee(e[0],"_focusTimeout"),clearTimeout(t.sequential.step),ee(t.sequential,"step"),clearTimeout(r[0].onCompleteTimeout),ee(r[0],"onCompleteTimeout"),t.bindEvents=!1)},O=function(e){var t=E(this),o=t.data(W),a=o.opt,n=E("#mCSB_"+o.idx+"_container_wrapper"),i=n.length?n:E("#mCSB_"+o.idx+"_container"),r=[E("#mCSB_"+o.idx+"_scrollbar_vertical"),E("#mCSB_"+o.idx+"_scrollbar_horizontal")],l=[r[0].find(".mCSB_dragger"),r[1].find(".mCSB_dragger")];"x"!==a.axis&&(o.overflowed[0]&&!e?(r[0].add(l[0]).add(r[0].children("a")).css("display","block"),i.removeClass(w[8]+" "+w[10])):(a.alwaysShowScrollbar?(2!==a.alwaysShowScrollbar&&l[0].css("display","none"),i.removeClass(w[10])):(r[0].css("display","none"),i.addClass(w[10])),i.addClass(w[8]))),"y"!==a.axis&&(o.overflowed[1]&&!e?(r[1].add(l[1]).add(r[1].children("a")).css("display","block"),i.removeClass(w[9]+" "+w[11])):(a.alwaysShowScrollbar?(2!==a.alwaysShowScrollbar&&l[1].css("display","none"),i.removeClass(w[11])):(r[1].css("display","none"),i.addClass(w[11])),i.addClass(w[9]))),o.overflowed[0]||o.overflowed[1]?t.removeClass(w[5]):t.addClass(w[5])},P=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 o=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[o.screenY,o.screenX,1-i*y.scrollRatio.y&&(2*R[3]-l*y.scrollRatio.x&&(2*R[2]d.height()&&n("on",40)),"y"!==l.axis&&r.overflowed[1]&&(a<0?n("on",37):a>d.width()&&n("on",39)))}}).bind("mouseup."+e,function(){L||(i&&(i=0,n("off",null)),A=!1)})},R=function(){function o(e,t){if(Z(d),!H(d,e.target)){var o="auto"!==h.mouseWheel.deltaFactor?parseInt(h.mouseWheel.deltaFactor):p&&e.deltaFactor<100?100:e.deltaFactor||100;if("x"===h.axis||"x"===h.mouseWheel.axis)var a="x",n=[Math.round(o*u.scrollRatio.x),parseInt(h.mouseWheel.scrollAmount)],i="auto"!==h.mouseWheel.scrollAmount?n[1]:n[0]>=f.width()?.9*f.width():n[0],r=Math.abs(E("#mCSB_"+u.idx+"_container")[0].offsetLeft),l=m[1][0].offsetLeft,s=m[1].parent().width()-m[1].width(),c=e.deltaX||e.deltaY||t;else var a="y",n=[Math.round(o*u.scrollRatio.y),parseInt(h.mouseWheel.scrollAmount)],i="auto"!==h.mouseWheel.scrollAmount?n[1]:n[0]>=f.height()?.9*f.height():n[0],r=Math.abs(E("#mCSB_"+u.idx+"_container")[0].offsetTop),l=m[0][0].offsetTop,s=m[0].parent().height()-m[0].height(),c=e.deltaY||t;"y"===a&&!u.overflowed[0]||"x"===a&&!u.overflowed[1]||(h.mouseWheel.invert&&(c=-c),h.mouseWheel.normalizeDelta&&(c=c<0?-1:1),(0o.offset().left?-1:1,i=Math.abs(s[0].offsetLeft)-.9*n*c.width()}else{if(!l.overflowed[0])return;var a="y",n=e.pageY>o.offset().top?-1:1,i=Math.abs(s[0].offsetTop)-.9*n*c.height()}G(r,i.toString(),{dir:a,scrollEasing:"mcsEaseInOut"})}})},Y=function(){var i=E(this),e=i.data(W),r=e.opt,t=W+"_"+e.idx,l=E("#mCSB_"+e.idx+"_container"),s=l.parent();l.bind("focusin."+t,function(){var n=E(document.activeElement),e=l.find(".mCustomScrollBox").length;n.is(r.advanced.autoScrollOnFocus)&&(Z(i),clearTimeout(i[0]._focusTimeout),i[0]._focusTimer=e?17*e:0,i[0]._focusTimeout=setTimeout(function(){var e=[ne(n)[0],ne(n)[1]],t=[l[0].offsetTop,l[0].offsetLeft],o=[0<=t[0]+e[0]&&t[0]+e[0]a");o.bind("mousedown."+e+" touchstart."+e+" pointerdown."+e+" MSPointerDown."+e+" mouseup."+e+" touchend."+e+" pointerup."+e+" MSPointerUp."+e+" mouseout."+e+" pointerout."+e+" MSPointerOut."+e+" click."+e,function(e){function t(e,t){r.scrollAmount=i.snapAmount||i.scrollButtons.scrollAmount,F(a,e,t)}if(e.preventDefault(),te(e)){var o=E(this).attr("class");switch(r.type=i.scrollButtons.scrollType,e.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;A=!0,n.tweenRunning=!1,t("on",o);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;A=!1,r.dir&&t("off",o);break;case"click":if("stepped"!==r.type||n.tweenRunning)return;t("on",o)}}})},q=function(){function t(e){function t(e,t){d.type=c.keyboard.scrollType,d.scrollAmount=c.snapAmount||c.keyboard.scrollAmount,"stepped"===d.type&&s.tweenRunning||F(l,e,t)}switch(e.type){case"blur":s.tweenRunning&&d.dir&&t("off",null);break;case"keydown":case"keyup":var o=e.keyCode?e.keyCode:e.which,a="on";if("x"!==c.axis&&(38===o||40===o)||"y"!==c.axis&&(37===o||39===o)){if((38===o||40===o)&&!s.overflowed[0]||(37===o||39===o)&&!s.overflowed[1])return;"keyup"===e.type&&(a="off"),E(document.activeElement).is(f)||(e.preventDefault(),e.stopImmediatePropagation(),t(a,o))}else if(33===o||34===o){if((s.overflowed[0]||s.overflowed[1])&&(e.preventDefault(),e.stopImmediatePropagation()),"keyup"===e.type){Z(l);var n=34===o?-1:1;if("x"===c.axis||"yx"===c.axis&&s.overflowed[1]&&!s.overflowed[0])var i="x",r=Math.abs(u[0].offsetLeft)-.9*n*h.width();else var i="y",r=Math.abs(u[0].offsetTop)-.9*n*h.height();G(l,r.toString(),{dir:i,scrollEasing:"mcsEaseInOut"})}}else if((35===o||36===o)&&!E(document.activeElement).is(f)&&((s.overflowed[0]||s.overflowed[1])&&(e.preventDefault(),e.stopImmediatePropagation()),"keyup"===e.type)){if("x"===c.axis||"yx"===c.axis&&s.overflowed[1]&&!s.overflowed[0])var i="x",r=35===o?Math.abs(h.width()-u.outerWidth(!1)):0;else var i="y",r=35===o?Math.abs(h.height()-u.outerHeight(!1)):0;G(l,r.toString(),{dir:i,scrollEasing:"mcsEaseInOut"})}}}var l=E(this),s=l.data(W),c=s.opt,d=s.sequential,e=W+"_"+s.idx,o=E("#mCSB_"+s.idx),u=E("#mCSB_"+s.idx+"_container"),h=u.parent(),f="input,textarea,select,datalist,keygen,[contenteditable='true']",a=u.find("iframe"),n=["blur."+e+" keydown."+e+" keyup."+e];a.length&&a.each(function(){E(this).load(function(){z(this)&&E(this.contentDocument||this.contentWindow.document).bind(n[0],function(e){t(e)})})}),o.attr("tabindex","0").bind(n[0],function(e){t(e)})},F=function(u,e,t,h,f){function m(e){var t="stepped"!==g.type,o=f||(e?t?x/1.5:_:1e3/60),a=e?t?7.5:40:2.5,n=[Math.abs(v[0].offsetTop),Math.abs(v[0].offsetLeft)],i=[10=w[1]?S=[w[0],w[1]]:S[0]=-S[0],n[0].mcs||(o(),t("onInit")&&c.callbacks.onInit.call(n[0])),clearTimeout(f[0].onCompleteTimeout),(s.tweenRunning||!(0===_&&0<=S[0]||_===w[0]&&S[0]<=w[0]))&&(J(v[0],x,Math.round(S[1]),u[1],i.scrollEasing),J(f[0],x,Math.round(S[0]),u[0],i.scrollEasing,i.overwrite,{onStart:function(){i.callbacks&&i.onStart&&!s.tweenRunning&&(t("onScrollStart")&&(o(),c.callbacks.onScrollStart.call(n[0])),s.tweenRunning=!0,T(v),s.cbOffsets=[c.callbacks.alwaysTriggerOffsets||_>=w[0]+b,c.callbacks.alwaysTriggerOffsets||_<=-C])},onUpdate:function(){i.callbacks&&i.onUpdate&&t("whileScrolling")&&(o(),c.callbacks.whileScrolling.call(n[0]))},onComplete:function(){if(i.callbacks&&i.onComplete){"yx"===c.axis&&clearTimeout(f[0].onCompleteTimeout);var e=f[0].idleTimer||0;f[0].onCompleteTimeout=setTimeout(function(){t("onScroll")&&(o(),c.callbacks.onScroll.call(n[0])),t("onTotalScroll")&&S[1]>=w[1]-y&&s.cbOffsets[0]&&(o(),c.callbacks.onTotalScroll.call(n[0])),t("onTotalScrollBack")&&S[1]<=B&&s.cbOffsets[1]&&(o(),c.callbacks.onTotalScrollBack.call(n[0])),s.tweenRunning=!1,f[0].idleTimer=0,T(v,"hide")},e)}}}))}},J=function(e,t,o,a,n,i,r){function l(){x.stop||(p||u.call(),p=K()-m,s(),p>=x.time&&(x.time=p>x.time?p+c-(p-x.time):p+c-1,x.timen[0].parent().height()?B.call(this):(G(e,i[0].toString(),{dir:"y",dur:0,overwrite:"none"}),t.contentReset.y=null):(B.call(this),"y"===o.axis?k.call(this):"yx"===o.axis&&t.overflowed[1]&&G(e,i[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==o.axis&&(t.overflowed[1]?n[1].width()>n[1].parent().width()?B.call(this):(G(e,i[1].toString(),{dir:"x",dur:0,overwrite:"none"}),t.contentReset.x=null):(B.call(this),"x"===o.axis?k.call(this):"yx"===o.axis&&t.overflowed[0]&&G(e,i[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),r&&t&&(2===r&&o.callbacks.onImageLoad&&"function"==typeof o.callbacks.onImageLoad?o.callbacks.onImageLoad.call(this):3===r&&o.callbacks.onSelectorChange&&"function"==typeof o.callbacks.onSelectorChange?o.callbacks.onSelectorChange.call(this):o.callbacks.onUpdate&&"function"==typeof o.callbacks.onUpdate&&o.callbacks.onUpdate.call(this)),Q.call(this)}})},scrollTo:function(l,s){if(void 0!==l&&null!=l){var e=c.call(this);return L(e).each(function(){var e=L(this);if(e.data(A)){var t=e.data(A),o=t.opt,a={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=L.extend(!0,{},a,s),i=N.call(this,l),r=0
","
"],i="yx"===o.axis?"mCSB_vertical_horizontal":"x"===o.axis?"mCSB_horizontal":"mCSB_vertical",r="yx"===o.axis?n[0]+n[1]:"x"===o.axis?n[1]:n[0],l="yx"===o.axis?"
":"",s=o.autoHideScrollbar?" "+w[6]:"",c="x"!==o.axis&&"rtl"===t.langDir?" "+w[7]:"";o.setWidth&&e.css("width",o.setWidth),o.setHeight&&e.css("height",o.setHeight),o.setLeft="y"!==o.axis&&"rtl"===t.langDir?"989999px":o.setLeft,e.addClass(f+" _"+A+"_"+t.idx+s+c).wrapInner("
");var d=L("#mCSB_"+t.idx),u=L("#mCSB_"+t.idx+"_container");"y"===o.axis||o.advanced.autoExpandHorizontalScroll||u.css("width",g(u.children())),"outside"===o.scrollbarPosition?("static"===e.css("position")&&e.css("position","relative"),e.css("overflow","visible"),d.addClass("mCSB_outside").after(r)):(d.addClass("mCSB_inside").append(r),u.wrap(l)),_.call(this);var h=[L("#mCSB_"+t.idx+"_dragger_vertical"),L("#mCSB_"+t.idx+"_dragger_horizontal")];h[0].css("min-height",h[0].height()),h[1].css("min-width",h[1].width())},g=function(e){return Math.max.apply(Math,e.map(function(){return L(this).outerWidth(!0)}).get())},v=function(){var e=L(this),t=e.data(A),o=t.opt,a=L("#mCSB_"+t.idx+"_container");o.advanced.autoExpandHorizontalScroll&&"y"!==o.axis&&a.css({position:"absolute",width:"auto"}).wrap("
").css({width:Math.ceil(a[0].getBoundingClientRect().right+.4)-Math.floor(a[0].getBoundingClientRect().left),position:"relative"}).unwrap()},_=function(){var e=L(this),t=e.data(A),o=t.opt,a=L(".mCSB_"+t.idx+"_scrollbar:first"),n=ae(o.scrollButtons.tabindex)?"tabindex='"+o.scrollButtons.tabindex+"'":"",i=["","","",""],r=["x"===o.axis?i[2]:i[0],"x"===o.axis?i[3]:i[1],i[2],i[3]];o.scrollButtons.enable&&a.prepend(r[0]).append(r[1]).next(".mCSB_scrollTools").prepend(r[2]).append(r[3])},S=function(){var e=L(this),t=e.data(A),o=L("#mCSB_"+t.idx),a=e.css("max-height")||"none",n=-1!==a.indexOf("%"),i=e.css("box-sizing");if("none"!==a){var r=n?e.parent().height()*parseInt(a)/100:parseInt(a);"border-box"===i&&(r-=e.innerHeight()-e.height()+(e.outerHeight()-e.innerHeight())),o.css("max-height",Math.round(r))}},b=function(){var e=L(this),t=e.data(A),o=L("#mCSB_"+t.idx),a=L("#mCSB_"+t.idx+"_container"),n=[L("#mCSB_"+t.idx+"_dragger_vertical"),L("#mCSB_"+t.idx+"_dragger_horizontal")],i=[o.height()/a.outerHeight(!1),o.width()/a.outerWidth(!1)],r=[parseInt(n[0].css("min-height")),Math.round(i[0]*n[0].parent().height()),parseInt(n[1].css("min-width")),Math.round(i[1]*n[1].parent().width())],l=p&&r[1]o.height(),i>o.width()]},B=function(){var e=L(this),t=e.data(A),o=t.opt,a=L("#mCSB_"+t.idx),n=L("#mCSB_"+t.idx+"_container"),i=[L("#mCSB_"+t.idx+"_dragger_vertical"),L("#mCSB_"+t.idx+"_dragger_horizontal")];if(Z(e),("x"!==o.axis&&!t.overflowed[0]||"y"===o.axis&&t.overflowed[0])&&(i[0].add(n).css("top",0),G(e,"_resetY")),"y"!==o.axis&&!t.overflowed[1]||"x"===o.axis&&t.overflowed[1]){var r=dx=0;"rtl"===t.langDir&&(r=a.width()-n.outerWidth(!1),dx=Math.abs(r/t.scrollRatio.x)),n.css("left",r),i[1].css("left",dx),G(e,"_resetX")}},M=function(){var t,o=L(this),e=o.data(A),a=e.opt;e.bindEvents||(r.call(this),a.contentTouchScroll&&I.call(this),D.call(this),a.mouseWheel.enable&&function e(){t=setTimeout(function(){L.event.special.mousewheel?(clearTimeout(t),R.call(o[0])):e()},100)}(),X.call(this),U.call(this),a.advanced.autoScrollOnFocus&&Y.call(this),a.scrollButtons.enable&&j.call(this),a.keyboard.enable&&q.call(this),e.bindEvents=!0)},k=function(){var e=L(this),t=e.data(A),o=t.opt,a=A+"_"+t.idx,n=".mCSB_"+t.idx+"_scrollbar",i=L("#mCSB_"+t.idx+",#mCSB_"+t.idx+"_container,#mCSB_"+t.idx+"_container_wrapper,"+n+" ."+w[12]+",#mCSB_"+t.idx+"_dragger_vertical,#mCSB_"+t.idx+"_dragger_horizontal,"+n+">a"),r=L("#mCSB_"+t.idx+"_container");o.advanced.releaseDraggableSelectors&&i.add(L(o.advanced.releaseDraggableSelectors)),t.bindEvents&&(L(document).unbind("."+a),i.each(function(){L(this).unbind("."+a)}),clearTimeout(e[0]._focusTimeout),ee(e[0],"_focusTimeout"),clearTimeout(t.sequential.step),ee(t.sequential,"step"),clearTimeout(r[0].onCompleteTimeout),ee(r[0],"onCompleteTimeout"),t.bindEvents=!1)},O=function(e){var t=L(this),o=t.data(A),a=o.opt,n=L("#mCSB_"+o.idx+"_container_wrapper"),i=n.length?n:L("#mCSB_"+o.idx+"_container"),r=[L("#mCSB_"+o.idx+"_scrollbar_vertical"),L("#mCSB_"+o.idx+"_scrollbar_horizontal")],l=[r[0].find(".mCSB_dragger"),r[1].find(".mCSB_dragger")];"x"!==a.axis&&(o.overflowed[0]&&!e?(r[0].add(l[0]).add(r[0].children("a")).css("display","block"),i.removeClass(w[8]+" "+w[10])):(a.alwaysShowScrollbar?(2!==a.alwaysShowScrollbar&&l[0].css("display","none"),i.removeClass(w[10])):(r[0].css("display","none"),i.addClass(w[10])),i.addClass(w[8]))),"y"!==a.axis&&(o.overflowed[1]&&!e?(r[1].add(l[1]).add(r[1].children("a")).css("display","block"),i.removeClass(w[9]+" "+w[11])):(a.alwaysShowScrollbar?(2!==a.alwaysShowScrollbar&&l[1].css("display","none"),i.removeClass(w[11])):(r[1].css("display","none"),i.addClass(w[11])),i.addClass(w[9]))),o.overflowed[0]||o.overflowed[1]?t.removeClass(w[5]):t.addClass(w[5])},z=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 o=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[o.screenY,o.screenX,1-i*y.scrollRatio.y&&(2*E[3]-l*y.scrollRatio.x&&(2*E[2]d.height()&&n("on",40)),"y"!==l.axis&&r.overflowed[1]&&(a<0?n("on",37):a>d.width()&&n("on",39)))}}).bind("mouseup."+e,function(){W||(i&&(i=0,n("off",null)),P=!1)})},R=function(){function o(e,t){if(Z(d),!E(d,e.target)){var o="auto"!==h.mouseWheel.deltaFactor?parseInt(h.mouseWheel.deltaFactor):p&&e.deltaFactor<100?100:e.deltaFactor||100;if("x"===h.axis||"x"===h.mouseWheel.axis)var a="x",n=[Math.round(o*u.scrollRatio.x),parseInt(h.mouseWheel.scrollAmount)],i="auto"!==h.mouseWheel.scrollAmount?n[1]:n[0]>=f.width()?.9*f.width():n[0],r=Math.abs(L("#mCSB_"+u.idx+"_container")[0].offsetLeft),l=m[1][0].offsetLeft,s=m[1].parent().width()-m[1].width(),c=e.deltaX||e.deltaY||t;else var a="y",n=[Math.round(o*u.scrollRatio.y),parseInt(h.mouseWheel.scrollAmount)],i="auto"!==h.mouseWheel.scrollAmount?n[1]:n[0]>=f.height()?.9*f.height():n[0],r=Math.abs(L("#mCSB_"+u.idx+"_container")[0].offsetTop),l=m[0][0].offsetTop,s=m[0].parent().height()-m[0].height(),c=e.deltaY||t;"y"===a&&!u.overflowed[0]||"x"===a&&!u.overflowed[1]||(h.mouseWheel.invert&&(c=-c),h.mouseWheel.normalizeDelta&&(c=c<0?-1:1),(0o.offset().left?-1:1,i=Math.abs(s[0].offsetLeft)-.9*n*c.width()}else{if(!l.overflowed[0])return;var a="y",n=e.pageY>o.offset().top?-1:1,i=Math.abs(s[0].offsetTop)-.9*n*c.height()}G(r,i.toString(),{dir:a,scrollEasing:"mcsEaseInOut"})}})},Y=function(){var i=L(this),e=i.data(A),r=e.opt,t=A+"_"+e.idx,l=L("#mCSB_"+e.idx+"_container"),s=l.parent();l.bind("focusin."+t,function(){var n=L(document.activeElement),e=l.find(".mCustomScrollBox").length;n.is(r.advanced.autoScrollOnFocus)&&(Z(i),clearTimeout(i[0]._focusTimeout),i[0]._focusTimer=e?17*e:0,i[0]._focusTimeout=setTimeout(function(){var e=[ne(n)[0],ne(n)[1]],t=[l[0].offsetTop,l[0].offsetLeft],o=[0<=t[0]+e[0]&&t[0]+e[0]a");o.bind("mousedown."+e+" touchstart."+e+" pointerdown."+e+" MSPointerDown."+e+" mouseup."+e+" touchend."+e+" pointerup."+e+" MSPointerUp."+e+" mouseout."+e+" pointerout."+e+" MSPointerOut."+e+" click."+e,function(e){function t(e,t){r.scrollAmount=i.snapAmount||i.scrollButtons.scrollAmount,F(a,e,t)}if(e.preventDefault(),te(e)){var o=L(this).attr("class");switch(r.type=i.scrollButtons.scrollType,e.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;P=!0,n.tweenRunning=!1,t("on",o);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;P=!1,r.dir&&t("off",o);break;case"click":if("stepped"!==r.type||n.tweenRunning)return;t("on",o)}}})},q=function(){function t(e){function t(e,t){d.type=c.keyboard.scrollType,d.scrollAmount=c.snapAmount||c.keyboard.scrollAmount,"stepped"===d.type&&s.tweenRunning||F(l,e,t)}switch(e.type){case"blur":s.tweenRunning&&d.dir&&t("off",null);break;case"keydown":case"keyup":var o=e.keyCode?e.keyCode:e.which,a="on";if("x"!==c.axis&&(38===o||40===o)||"y"!==c.axis&&(37===o||39===o)){if((38===o||40===o)&&!s.overflowed[0]||(37===o||39===o)&&!s.overflowed[1])return;"keyup"===e.type&&(a="off"),L(document.activeElement).is(f)||(e.preventDefault(),e.stopImmediatePropagation(),t(a,o))}else if(33===o||34===o){if((s.overflowed[0]||s.overflowed[1])&&(e.preventDefault(),e.stopImmediatePropagation()),"keyup"===e.type){Z(l);var n=34===o?-1:1;if("x"===c.axis||"yx"===c.axis&&s.overflowed[1]&&!s.overflowed[0])var i="x",r=Math.abs(u[0].offsetLeft)-.9*n*h.width();else var i="y",r=Math.abs(u[0].offsetTop)-.9*n*h.height();G(l,r.toString(),{dir:i,scrollEasing:"mcsEaseInOut"})}}else if((35===o||36===o)&&!L(document.activeElement).is(f)&&((s.overflowed[0]||s.overflowed[1])&&(e.preventDefault(),e.stopImmediatePropagation()),"keyup"===e.type)){if("x"===c.axis||"yx"===c.axis&&s.overflowed[1]&&!s.overflowed[0])var i="x",r=35===o?Math.abs(h.width()-u.outerWidth(!1)):0;else var i="y",r=35===o?Math.abs(h.height()-u.outerHeight(!1)):0;G(l,r.toString(),{dir:i,scrollEasing:"mcsEaseInOut"})}}}var l=L(this),s=l.data(A),c=s.opt,d=s.sequential,e=A+"_"+s.idx,o=L("#mCSB_"+s.idx),u=L("#mCSB_"+s.idx+"_container"),h=u.parent(),f="input,textarea,select,datalist,keygen,[contenteditable='true']",a=u.find("iframe"),n=["blur."+e+" keydown."+e+" keyup."+e];a.length&&a.each(function(){L(this).load(function(){H(this)&&L(this.contentDocument||this.contentWindow.document).bind(n[0],function(e){t(e)})})}),o.attr("tabindex","0").bind(n[0],function(e){t(e)})},F=function(u,e,t,h,f){function m(e){var t="stepped"!==g.type,o=f||(e?t?x/1.5:_:1e3/60),a=e?t?7.5:40:2.5,n=[Math.abs(v[0].offsetTop),Math.abs(v[0].offsetLeft)],i=[10=w[1]?S=[w[0],w[1]]:S[0]=-S[0],n[0].mcs||(o(),t("onInit")&&c.callbacks.onInit.call(n[0])),clearTimeout(f[0].onCompleteTimeout),(s.tweenRunning||!(0===_&&0<=S[0]||_===w[0]&&S[0]<=w[0]))&&(J(v[0],x,Math.round(S[1]),u[1],i.scrollEasing),J(f[0],x,Math.round(S[0]),u[0],i.scrollEasing,i.overwrite,{onStart:function(){i.callbacks&&i.onStart&&!s.tweenRunning&&(t("onScrollStart")&&(o(),c.callbacks.onScrollStart.call(n[0])),s.tweenRunning=!0,T(v),s.cbOffsets=[c.callbacks.alwaysTriggerOffsets||_>=w[0]+b,c.callbacks.alwaysTriggerOffsets||_<=-C])},onUpdate:function(){i.callbacks&&i.onUpdate&&t("whileScrolling")&&(o(),c.callbacks.whileScrolling.call(n[0]))},onComplete:function(){if(i.callbacks&&i.onComplete){"yx"===c.axis&&clearTimeout(f[0].onCompleteTimeout);var e=f[0].idleTimer||0;f[0].onCompleteTimeout=setTimeout(function(){t("onScroll")&&(o(),c.callbacks.onScroll.call(n[0])),t("onTotalScroll")&&S[1]>=w[1]-y&&s.cbOffsets[0]&&(o(),c.callbacks.onTotalScroll.call(n[0])),t("onTotalScrollBack")&&S[1]<=B&&s.cbOffsets[1]&&(o(),c.callbacks.onTotalScrollBack.call(n[0])),s.tweenRunning=!1,f[0].idleTimer=0,T(v,"hide")},e)}}}))}},J=function(e,t,o,a,n,i,r){function l(){x.stop||(p||u.call(),p=K()-m,s(),p>=x.time&&(x.time=p>x.time?p+c-(p-x.time):p+c-1,x.time"),s.push(i(e.substring(n,n+o))),s.push(""),void s.push(i(e.substring(n+o,e.length))))}function e(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function i(a){var e,r=null,t=a.quietMillis||100,c=a.url,l=this;return function(o){window.clearTimeout(e),e=window.setTimeout(function(){var e=a.data,t=c,s=a.transport||S.fn.select2.ajaxDefaults.transport,i={type:a.type||"GET",cache:a.cache||!1,jsonpCallback:a.jsonpCallback||b,dataType:a.dataType||"json"},n=S.extend({},S.fn.select2.ajaxDefaults.params,i);e=e?e.call(l,o.term,o.page,o.context):null,t="function"==typeof t?t.call(l,o.term,o.page,o.context):t,r&&"function"==typeof r.abort&&r.abort(),a.params&&(S.isFunction(a.params)?S.extend(n,a.params.call(l)):S.extend(n,a.params)),S.extend(n,{url:t,dataType:a.dataType,data:e,success:function(e){var t=a.results(e,o.page);o.callback(t)}}),r=s.call(l,n)},t)}}function g(e){var t,s,i=e,r=function(e){return""+e.text};S.isArray(i)&&(i={results:s=i}),!1===S.isFunction(i)&&(s=i,i=function(){return s});var n=i();return n.text&&(r=n.text,S.isFunction(r)||(t=n.text,r=function(e){return e[t]})),function(n){var o,a=n.term,s={results:[]};return""===a?void n.callback(i()):(o=function(e,t){var s,i;if((e=e[0]).children){for(i in s={},e)e.hasOwnProperty(i)&&(s[i]=e[i]);s.children=[],S(e.children).each2(function(e,t){o(t,s.children)}),(s.children.length||n.matcher(a,r(s),e))&&t.push(s)}else n.matcher(a,r(e),e)&&t.push(e)},S(i().results).each2(function(e,t){o(t,s.results)}),void n.callback(s))}}function m(t){var o=S.isFunction(t);return function(s){var i=s.term,n={results:[]},e=o?t(s):t;S.isArray(e)&&(S(e).each(function(){var e=this.text!==b,t=e?this.text:this;(""===i||s.matcher(i,t))&&n.results.push(e?this:{id:this,text:this})}),s.callback(n))}}function v(e,t){if(S.isFunction(e))return!0;if(!e)return!1;if("string"==typeof e)return!0;throw new Error(t+" must be a string, function, or falsy value")}function y(e){if(S.isFunction(e)){var t=Array.prototype.slice.call(arguments,1);return e.apply(null,t)}return e}function s(){var t=this;Array.prototype.forEach.call(arguments,function(e){t[e].remove(),t[e]=null})}function t(e,t){var s=function(){};return((s.prototype=new e).constructor=s).prototype.parent=e.prototype,s.prototype=S.extend(s.prototype,t),s}if(window.Select2===b){var w,C,E,x,T,O,P,I={x:0,y:0},k={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 k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(e){switch(e.which){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return 112<=(e=e.which?e.which:e)&&e<=123}},A={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};O=S(document),R=1,x=function(){return R++},O.on("mousemove",function(e){I.x=e.pageX,I.y=e.pageY}),C=t(w=t(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(e){var o,t,s,i,n,a=".select2-results";this.opts=e=this.prepareOpts(e),this.id=e.id,e.element.data("select2")!==b&&null!==e.element.data("select2")&&e.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=S("",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(e.element.attr("id")||"autogen"+x()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",e.element.attr("title")),this.body=S("body"),f(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",e.element.attr("style")),this.container.css(y(e.containerCss)),this.container.addClass(y(e.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",u),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),f(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(y(e.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",u),this.results=o=this.container.find(a),this.search=t=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",u),this.results.on("mousemove",function(e){var t=I;(t===b||t.x!==e.pageX||t.y!==e.pageY)&&S(e.target).trigger("mousemove-filtered",e)}),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),s=80,i=this.results,n=d(s,function(e){i.trigger("scroll-debounced",e)}),i.on("scroll",function(e){0<=h(e.target,i.get())&&n(e)}),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),S(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),S(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),S.fn.mousewheel&&o.mousewheel(function(e,t,s,i){var n=o.scrollTop();0
");e.appendTo("body");var t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),t}(),this.autofocus=e.element.prop("autofocus"),e.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",e.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,t=e.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),t!==b&&(t.container.remove(),t.liveRegion.remove(),t.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()),s.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:p(e.attr("locked"),"locked")||p(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(v){var a,e,t,s,w=this;if("select"===(a=v.element).get(0).tagName.toLowerCase()&&(this.select=e=v.element),e&&S.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in v)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
"," ","
    ","
","
"].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var e,t,s;0<=this.opts.minimumResultsForSearch&&this.showSearch(!0),this.parent.opening.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),(e=this.search.get(0)).createTextRange?((t=e.createTextRange()).collapse(!1),t.select()):e.setSelectionRange&&(s=this.search.val().length,e.setSelectionRange(s,s))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(S.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(){S("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),s.call(this,"selection","focusser")},initContainer:function(){var t,e,s=this.container,i=this.dropdown,n=x();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=s.find(".select2-choice"),this.focusser=s.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+n),this.focusser.attr("aria-labelledby","select2-chosen-"+n),this.results.attr("id","select2-results-"+n),this.search.attr("aria-owns","select2-results-"+n),this.focusser.attr("id","s2id_autogen"+n),e=S("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(e.text()).attr("for",this.focusser.attr("id"));var o=this.opts.element.attr("title");this.opts.element.attr("title",o||e.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(S("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===k.PAGE_UP||e.which===k.PAGE_DOWN)return void u(e);switch(e.which){case k.UP:case k.DOWN:return this.moveHighlight(e.which===k.UP?-1:1),void u(e);case k.ENTER:return this.selectHighlighted(),void u(e);case k.TAB:return void this.selectHighlighted({noFocus:!0});case k.ESC:return this.cancel(e),void u(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!==k.TAB&&!k.isControl(e)&&!k.isFunctionKey(e)&&e.which!==k.ESC){if(!1===this.opts.openOnEnter&&e.which===k.ENTER)return void u(e);if(e.which==k.DOWN||e.which==k.UP||e.which==k.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void u(e)}return e.which==k.DELETE||e.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),void u(e)):void 0}})),l(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(0<=this.opts.minimumResultsForSearch){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){var t;this.isInterfaceEnabled()&&(this.clear(),(t=e).preventDefault(),t.stopImmediatePropagation(),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(e){a(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),u(e)})),i.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){u(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.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(S.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var t=this.selection.data("select2-data");if(t){var s=S.Event("select2-clearing");if(this.opts.element.trigger(s),s.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==e&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==b&&null!==e&&(t.updateSelection(e),t.close(),t.setPlaceholder(),t.nextSearchTerm=t.opts.nextSearchTerm(e,t.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==b&&((e=this.getPlaceholderOption())!==b&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val())},prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===a.element.get(0).tagName.toLowerCase()?a.initSelection=function(e,t){var s=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(s))}:"data"in a&&(a.initSelection=a.initSelection||function(e,t){var n=e.val(),o=null;a.query({matcher:function(e,t,s){var i=p(n,a.id(s));return i&&(o=s),i},callback:S.isFunction(t)?function(){t(o)}:S.noop})}),a},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==b){if(this.select&&this.getPlaceholderOption()===b)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,s){var i=0,n=this;if(this.findHighlightableChoices().each2(function(e,t){return p(n.id(t.data("select2-data")),n.opts.element.val())?(i=e,!1):void 0}),!1!==s&&(!0===t&&0<=i?this.highlight(i):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;0<=o&&this.showSearch(function s(e){var i=0;return S.each(e,function(e,t){t.children?i+=s(t.children):i++}),i}(e.results)>=o)}},showSearch:function(e){this.showSearchInput!==e&&(this.showSearchInput=e,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!e),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!e),S(this.dropdown,this.container).toggleClass("select2-with-searchbox",e))},onSelect:function(e,t){if(this.triggerSelect(e)){var s=this.opts.element.val(),i=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(),p(s,this.id(e))||this.triggerChange({added:e,removed:i})}},updateSelection:function(e){var t,s,i=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),i.empty(),null!==e&&(t=this.opts.formatSelection(e,i,this.opts.escapeMarkup)),t!==b&&i.append(t),(s=this.opts.formatSelectionCssClass(e,i))!==b&&i.addClass(s),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var e,t=!1,s=null,i=this,n=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],1","
  • "," "," ","
  • ","","
    ","
      ","
    ","
    "].join(""))},prepareOpts:function(){var c=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===c.element.get(0).tagName.toLowerCase()?c.initSelection=function(e,t){var s=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){s.push(i.optionToData(t))}),t(s)}:"data"in c&&(c.initSelection=c.initSelection||function(e,o){var a=n(e.val(),c.separator),r=[];c.query({matcher:function(e,t,s){var i=S.grep(a,function(e){return p(e,c.id(s))}).length;return i&&r.push(s),i},callback:S.isFunction(o)?function(){for(var e=[],t=0;t=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(e){var t,s,i=!e.locked,n=S("
  • "),o=S("
  • "),a=i?n:o,r=this.id(e),c=this.getVal();(t=this.opts.formatSelection(e,a.find("div"),this.opts.escapeMarkup))!=b&&a.find("div").replaceWith("
    "+t+"
    "),(s=this.opts.formatSelectionCssClass(e,a.find("div")))!=b&&a.addClass(s),i&&a.find(".select2-search-choice-close").on("mousedown",u).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(this.unselect(S(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),u(e),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),a.data("select2-data",e),a.insertBefore(this.searchContainer),c.push(r),this.setVal(c)},unselect:function(e){var t,s,i=this.getVal();if(0===(e=e.closest(".select2-search-choice")).length)throw"Invalid argument: "+e+". Must be .select2-search-choice";if(t=e.data("select2-data")){var n=S.Event("select2-removing");if(n.val=this.id(t),n.choice=t,this.opts.element.trigger(n),n.isDefaultPrevented())return!1;for(;0<=(s=h(this.id(t),i));)i.splice(s,1),this.setVal(i),this.select&&this.postprocessResults();return e.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}),!0}},postprocessResults:function(e,t,s){var i=this.getVal(),n=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),a=this;n.each2(function(e,t){0<=h(a.id(t.data("select2-data")),i)&&(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()&&!1!==s&&a.highlight(0),!this.opts.createSearchChoice&&0"+y(a.opts.formatNoMatches,a.search.val())+"")},getMaxSearchWidth:function(){return this.selection.width()-o(this.search)},resizeSearch:function(){var e,t,s,i,n=o(this.search);e=function(e){if(!T){var t=e[0].currentStyle||window.getComputedStyle(e[0],null);(T=S(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,textTransform:t.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),S("body").append(T)}return T.text(e.val()),T.width()}(this.search)+10,t=this.search.offset().left,(i=(s=this.selection.width())-(t-this.selection.offset().left)-n). Attach to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var e=[],t=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){e.push(t.opts.id(S(this).data("select2-data")))}),this.setVal(e),this.triggerChange()},data:function(e,t){var s,i,n=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return S(this).data("select2-data")}).get():(i=this.data(),e||(e=[]),s=S.map(e,function(e){return n.opts.id(e)}),this.setVal(s),this.updateSelection(e),this.clearSearch(),void(t&&this.triggerChange(this.buildChangeDetails(i,this.data()))))}}),S.fn.select2=function(){var e,t,s,i,n,o=Array.prototype.slice.call(arguments,0),a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],r=["opened","isFocused","container","dropdown"],c=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===o.length||"object"==typeof o[0])(e=0===o.length?{}:S.extend({},o[0])).element=S(this),"select"===e.element.get(0).tagName.toLowerCase()?n=e.element.prop("multiple"):(n=e.multiple||!1,"tags"in e&&(e.multiple=n=!0)),(t=n?new window.Select2.class.multi:new window.Select2.class.single).init(e);else{if("string"!=typeof o[0])throw"Invalid arguments to select2 plugin: "+o;if(h(o[0],a)<0)throw"Unknown method: "+o[0];if(i=b,(t=S(this).data("select2"))===b)return;if("container"===(s=o[0])?i=t.container:"dropdown"===s?i=t.dropdown:(l[s]&&(s=l[s]),i=t[s].apply(t,o.slice(1))),0<=h(o[0],r)||0<=h(o[0],c)&&1==o.length)return!1}}),i===b?this:i},S.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,s,i){var n=[];return c(e.text,s.term,n,i),n.join("")},formatSelection:function(e,t,s){return e?s(e.text):b},sortResults:function(e){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(){return b},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 s=t-e.length;return"Please enter "+s+" or more character"+(1==s?"":"s")},formatInputTooLong:function(e,t){var s=e.length-t;return"Please delete "+s+" character"+(1==s?"":"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==b?null:e.id},matcher:function(e,t){return 0<=r(""+t).toUpperCase().indexOf(r(""+e).toUpperCase())},separator:",",tokenSeparators:[],tokenizer:function(e,t,s,i){var n,o,a,r,c,l=e,h=!1;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return b;for(;;){for(o=-1,a=0,r=i.tokenSeparators.length;a"),s.push(i(e.substring(n,n+o))),s.push(""),void s.push(i(e.substring(n+o,e.length))))}function e(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function i(a){var e,r=null,t=a.quietMillis||100,c=a.url,l=this;return function(o){window.clearTimeout(e),e=window.setTimeout(function(){var e=a.data,t=c,s=a.transport||S.fn.select2.ajaxDefaults.transport,i={type:a.type||"GET",cache:a.cache||!1,jsonpCallback:a.jsonpCallback||b,dataType:a.dataType||"json"},n=S.extend({},S.fn.select2.ajaxDefaults.params,i);e=e?e.call(l,o.term,o.page,o.context):null,t="function"==typeof t?t.call(l,o.term,o.page,o.context):t,r&&"function"==typeof r.abort&&r.abort(),a.params&&(S.isFunction(a.params)?S.extend(n,a.params.call(l)):S.extend(n,a.params)),S.extend(n,{url:t,dataType:a.dataType,data:e,success:function(e){var t=a.results(e,o.page);o.callback(t)}}),r=s.call(l,n)},t)}}function g(e){var t,s,i=e,r=function(e){return""+e.text};S.isArray(i)&&(i={results:s=i}),!1===S.isFunction(i)&&(s=i,i=function(){return s});var n=i();return n.text&&(r=n.text,S.isFunction(r)||(t=n.text,r=function(e){return e[t]})),function(n){var o,a=n.term,s={results:[]};return""===a?void n.callback(i()):(o=function(e,t){var s,i;if((e=e[0]).children){for(i in s={},e)e.hasOwnProperty(i)&&(s[i]=e[i]);s.children=[],S(e.children).each2(function(e,t){o(t,s.children)}),(s.children.length||n.matcher(a,r(s),e))&&t.push(s)}else n.matcher(a,r(e),e)&&t.push(e)},S(i().results).each2(function(e,t){o(t,s.results)}),void n.callback(s))}}function m(t){var o=S.isFunction(t);return function(s){var i=s.term,n={results:[]},e=o?t(s):t;S.isArray(e)&&(S(e).each(function(){var e=this.text!==b,t=e?this.text:this;(""===i||s.matcher(i,t))&&n.results.push(e?this:{id:this,text:this})}),s.callback(n))}}function v(e,t){if(S.isFunction(e))return!0;if(!e)return!1;if("string"==typeof e)return!0;throw new Error(t+" must be a string, function, or falsy value")}function y(e){if(S.isFunction(e)){var t=Array.prototype.slice.call(arguments,1);return e.apply(null,t)}return e}function s(){var t=this;Array.prototype.forEach.call(arguments,function(e){t[e].remove(),t[e]=null})}function t(e,t){var s=function(){};return((s.prototype=new e).constructor=s).prototype.parent=e.prototype,s.prototype=S.extend(s.prototype,t),s}if(window.Select2===b){var w,C,E,x,T,O,P,I={x:0,y:0},k={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 k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(e){switch(e.which){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return 112<=(e=e.which?e.which:e)&&e<=123}},A={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};O=S(document),R=1,x=function(){return R++},O.on("mousemove",function(e){I.x=e.pageX,I.y=e.pageY}),C=t(w=t(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(e){var o,t,s,i,n,a=".select2-results";this.opts=e=this.prepareOpts(e),this.id=e.id,e.element.data("select2")!==b&&null!==e.element.data("select2")&&e.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=S("",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(e.element.attr("id")||"autogen"+x()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",e.element.attr("title")),this.body=S("body"),f(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",e.element.attr("style")),this.container.css(y(e.containerCss)),this.container.addClass(y(e.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",u),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),f(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(y(e.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",u),this.results=o=this.container.find(a),this.search=t=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",u),this.results.on("mousemove",function(e){var t=I;(t===b||t.x!==e.pageX||t.y!==e.pageY)&&S(e.target).trigger("mousemove-filtered",e)}),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),s=80,i=this.results,n=d(s,function(e){i.trigger("scroll-debounced",e)}),i.on("scroll",function(e){0<=h(e.target,i.get())&&n(e)}),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),S(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),S(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),S.fn.mousewheel&&o.mousewheel(function(e,t,s,i){var n=o.scrollTop();0
    ");e.appendTo("body");var t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),t}(),this.autofocus=e.element.prop("autofocus"),e.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",e.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,t=e.data("select2");this.close(),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),t!==b&&(t.container.remove(),t.liveRegion.remove(),t.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()),s.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:p(e.attr("locked"),"locked")||p(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(v){var a,e,t,s,w=this;if("select"===(a=v.element).get(0).tagName.toLowerCase()&&(this.select=e=v.element),e&&S.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in v)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
    "," ","
      ","
    ","
    "].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var e,t,s;0<=this.opts.minimumResultsForSearch&&this.showSearch(!0),this.parent.opening.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),(e=this.search.get(0)).createTextRange?((t=e.createTextRange()).collapse(!1),t.select()):e.setSelectionRange&&(s=this.search.val().length,e.setSelectionRange(s,s))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(S.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(){S("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),s.call(this,"selection","focusser")},initContainer:function(){var t,e,s=this.container,i=this.dropdown,n=x();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=s.find(".select2-choice"),this.focusser=s.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+n),this.focusser.attr("aria-labelledby","select2-chosen-"+n),this.results.attr("id","select2-results-"+n),this.search.attr("aria-owns","select2-results-"+n),this.focusser.attr("id","s2id_autogen"+n),e=S("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(e.text()).attr("for",this.focusser.attr("id"));var o=this.opts.element.attr("title");this.opts.element.attr("title",o||e.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(S("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===k.PAGE_UP||e.which===k.PAGE_DOWN)return void u(e);switch(e.which){case k.UP:case k.DOWN:return this.moveHighlight(e.which===k.UP?-1:1),void u(e);case k.ENTER:return this.selectHighlighted(),void u(e);case k.TAB:return void this.selectHighlighted({noFocus:!0});case k.ESC:return this.cancel(e),void u(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!==k.TAB&&!k.isControl(e)&&!k.isFunctionKey(e)&&e.which!==k.ESC){if(!1===this.opts.openOnEnter&&e.which===k.ENTER)return void u(e);if(e.which==k.DOWN||e.which==k.UP||e.which==k.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void u(e)}return e.which==k.DELETE||e.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),void u(e)):void 0}})),l(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(0<=this.opts.minimumResultsForSearch){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){var t;this.isInterfaceEnabled()&&(this.clear(),(t=e).preventDefault(),t.stopImmediatePropagation(),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(e){a(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),u(e)})),i.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){u(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.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(S.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var t=this.selection.data("select2-data");if(t){var s=S.Event("select2-clearing");if(this.opts.element.trigger(s),s.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==e&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==b&&null!==e&&(t.updateSelection(e),t.close(),t.setPlaceholder(),t.nextSearchTerm=t.opts.nextSearchTerm(e,t.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==b&&((e=this.getPlaceholderOption())!==b&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val())},prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===a.element.get(0).tagName.toLowerCase()?a.initSelection=function(e,t){var s=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(s))}:"data"in a&&(a.initSelection=a.initSelection||function(e,t){var n=e.val(),o=null;a.query({matcher:function(e,t,s){var i=p(n,a.id(s));return i&&(o=s),i},callback:S.isFunction(t)?function(){t(o)}:S.noop})}),a},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==b){if(this.select&&this.getPlaceholderOption()===b)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,s){var i=0,n=this;if(this.findHighlightableChoices().each2(function(e,t){return p(n.id(t.data("select2-data")),n.opts.element.val())?(i=e,!1):void 0}),!1!==s&&(!0===t&&0<=i?this.highlight(i):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;0<=o&&this.showSearch(function s(e){var i=0;return S.each(e,function(e,t){t.children?i+=s(t.children):i++}),i}(e.results)>=o)}},showSearch:function(e){this.showSearchInput!==e&&(this.showSearchInput=e,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!e),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!e),S(this.dropdown,this.container).toggleClass("select2-with-searchbox",e))},onSelect:function(e,t){if(this.triggerSelect(e)){var s=this.opts.element.val(),i=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(),p(s,this.id(e))||this.triggerChange({added:e,removed:i})}},updateSelection:function(e){var t,s,i=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),i.empty(),null!==e&&(t=this.opts.formatSelection(e,i,this.opts.escapeMarkup)),t!==b&&i.append(t),(s=this.opts.formatSelectionCssClass(e,i))!==b&&i.addClass(s),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var e,t=!1,s=null,i=this,n=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],1","
  • "," "," ","
  • ","","
    ","
      ","
    ","
    "].join(""))},prepareOpts:function(){var c=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===c.element.get(0).tagName.toLowerCase()?c.initSelection=function(e,t){var s=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){s.push(i.optionToData(t))}),t(s)}:"data"in c&&(c.initSelection=c.initSelection||function(e,o){var a=n(e.val(),c.separator),r=[];c.query({matcher:function(e,t,s){var i=S.grep(a,function(e){return p(e,c.id(s))}).length;return i&&r.push(s),i},callback:S.isFunction(o)?function(){for(var e=[],t=0;t=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(e){var t,s,i=!e.locked,n=S("
  • "),o=S("
  • "),a=i?n:o,r=this.id(e),c=this.getVal();(t=this.opts.formatSelection(e,a.find("div"),this.opts.escapeMarkup))!=b&&a.find("div").replaceWith("
    "+t+"
    "),(s=this.opts.formatSelectionCssClass(e,a.find("div")))!=b&&a.addClass(s),i&&a.find(".select2-search-choice-close").on("mousedown",u).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(this.unselect(S(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),u(e),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),a.data("select2-data",e),a.insertBefore(this.searchContainer),c.push(r),this.setVal(c)},unselect:function(e){var t,s,i=this.getVal();if(0===(e=e.closest(".select2-search-choice")).length)throw"Invalid argument: "+e+". Must be .select2-search-choice";if(t=e.data("select2-data")){var n=S.Event("select2-removing");if(n.val=this.id(t),n.choice=t,this.opts.element.trigger(n),n.isDefaultPrevented())return!1;for(;0<=(s=h(this.id(t),i));)i.splice(s,1),this.setVal(i),this.select&&this.postprocessResults();return e.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}),!0}},postprocessResults:function(e,t,s){var i=this.getVal(),n=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),a=this;n.each2(function(e,t){0<=h(a.id(t.data("select2-data")),i)&&(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()&&!1!==s&&a.highlight(0),!this.opts.createSearchChoice&&0"+y(a.opts.formatNoMatches,a.search.val())+"")},getMaxSearchWidth:function(){return this.selection.width()-o(this.search)},resizeSearch:function(){var e,t,s,i,n=o(this.search);e=function(e){if(!T){var t=e[0].currentStyle||window.getComputedStyle(e[0],null);(T=S(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,textTransform:t.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),S("body").append(T)}return T.text(e.val()),T.width()}(this.search)+10,t=this.search.offset().left,(i=(s=this.selection.width())-(t-this.selection.offset().left)-n). Attach to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var e=[],t=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){e.push(t.opts.id(S(this).data("select2-data")))}),this.setVal(e),this.triggerChange()},data:function(e,t){var s,i,n=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return S(this).data("select2-data")}).get():(i=this.data(),e||(e=[]),s=S.map(e,function(e){return n.opts.id(e)}),this.setVal(s),this.updateSelection(e),this.clearSearch(),void(t&&this.triggerChange(this.buildChangeDetails(i,this.data()))))}}),S.fn.select2=function(){var e,t,s,i,n,o=Array.prototype.slice.call(arguments,0),a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],r=["opened","isFocused","container","dropdown"],c=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===o.length||"object"==typeof o[0])(e=0===o.length?{}:S.extend({},o[0])).element=S(this),"select"===e.element.get(0).tagName.toLowerCase()?n=e.element.prop("multiple"):(n=e.multiple||!1,"tags"in e&&(e.multiple=n=!0)),(t=n?new window.Select2.class.multi:new window.Select2.class.single).init(e);else{if("string"!=typeof o[0])throw"Invalid arguments to select2 plugin: "+o;if(h(o[0],a)<0)throw"Unknown method: "+o[0];if(i=b,(t=S(this).data("select2"))===b)return;if(s=o[0],i="container"===s?t.container:"dropdown"===s?t.dropdown:(l[s]&&(s=l[s]),t[s].apply(t,o.slice(1))),0<=h(o[0],r)||0<=h(o[0],c)&&1==o.length)return!1}}),i===b?this:i},S.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,s,i){var n=[];return c(e.text,s.term,n,i),n.join("")},formatSelection:function(e,t,s){return e?s(e.text):b},sortResults:function(e){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(){return b},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 s=t-e.length;return"Please enter "+s+" or more character"+(1==s?"":"s")},formatInputTooLong:function(e,t){var s=e.length-t;return"Please delete "+s+" character"+(1==s?"":"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==b?null:e.id},matcher:function(e,t){return 0<=r(""+t).toUpperCase().indexOf(r(""+e).toUpperCase())},separator:",",tokenSeparators:[],tokenizer:function(e,t,s,i){var n,o,a,r,c,l=e,h=!1;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return b;for(;;){for(o=-1,a=0,r=i.tokenSeparators.length;a" ).insertBefore( jQuery(this) ); + template.insertBefore( jQuery(this) ); + button.insertBefore( jQuery(this) ); + + } + + jQuery(template).removeClass("um-admin-cur-condition-template"); + jQuery(template).addClass("um-admin-cur-condition"); + + um_admin_live_update_scripts(); + um_admin_modal_responsive(); + } else { + jQuery(this).addClass('disabled'); + alert( 'You already have 5 rules' ); + } + //need fields refactor var conditions = jQuery('.um-admin-cur-condition'); - jQuery(conditions).each( function ( i ) { - id = i === 0 ? '' : i; - jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id); - jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id); - jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id); - jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id); - jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id); - jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id); - jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id); - jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id); + + jQuery(conditions).each( function ( i ) { + // var value = jQuery( this ) + + id = i === 0 ? '' : i; + jQuery( this ).find('[id^="_conditional_action"]').attr('name', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_action"]').attr('id', '_conditional_action' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('name', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_field"]').attr('id', '_conditional_field' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('name', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id); + jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id); + jQuery( this ).find('[id^="_conditional_compare"]').attr('name', '_conditional_compare' + id); + jQuery( this ).find('[id^="_conditional_compare"]').attr('id', '_conditional_compare' + id); + jQuery( this ).find('[id^="_conditional_group"]').attr('name', '_conditional_group' + id); + jQuery( this ).find('[id^="_conditional_group"]').attr('id', '_conditional_group' + id); } ); }); @@ -255,10 +282,20 @@ jQuery(document).ready(function() { remove a condition **/ jQuery(document).on('click', '.um-admin-remove-condition', function(){ - var condition = jQuery(this).parents('.um-admin-cur-condition'); - jQuery('.um-admin-new-condition').removeClass('disabled'); - jQuery('.tipsy').remove(); - condition.remove(); + var condition = jQuery(this).parents('.um-admin-cur-condition'); + jQuery('.um-admin-new-condition').removeClass('disabled'); + jQuery('.tipsy').remove(); + var compare = condition.find('input[type=hidden]').val(); + if( compare == 'or' ){ + condition.next().find('input[type=hidden]').val(compare); + } + + if( condition.prev().is('hr') && condition.next().is('.um-admin-new-condition-compare-and') ){ + condition.next().remove(); + condition.prev().remove(); + } + condition.remove(); + //need fields refactor var conditions = jQuery('.um-admin-cur-condition'); jQuery(conditions).each( function ( i ) { @@ -271,9 +308,13 @@ jQuery(document).ready(function() { jQuery( this ).find('[id^="_conditional_operator"]').attr('id', '_conditional_operator' + id); jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id); jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id); + jQuery( this ).find('[id^="_conditional_compare"]').attr('name', '_conditional_compare' + id); + jQuery( this ).find('[id^="_conditional_compare"]').attr('id', '_conditional_compare' + id); + jQuery( this ).find('[id^="_conditional_group"]').attr('name', '_conditional_group' + id); + jQuery( this ).find('[id^="_conditional_group"]').attr('id', '_conditional_group' + id); } ); - um_admin_live_update_scripts(); - um_admin_modal_responsive(); + um_admin_live_update_scripts(); + um_admin_modal_responsive(); }); /** diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index 366e52e3..ec4ba069 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -168,27 +168,27 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) { unset( $array['conditions'] ); if ( isset($array['conditional_field']) && !empty( $array['conditional_action'] ) && !empty( $array['conditional_operator'] ) ) { $array['conditional_value'] = isset( $array['conditional_value'] ) ? $array['conditional_value'] : ''; - $array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] ); + $array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'], $array['conditional_compare'], $array['conditional_group'] ); } if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) { $array['conditional_value1'] = isset( $array['conditional_value1'] ) ? $array['conditional_value1'] : ''; - $array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] ); + $array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'], $array['conditional_compare1'], $array['conditional_group1'] ); } if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) { $array['conditional_value2'] = isset( $array['conditional_value2'] ) ? $array['conditional_value2'] : ''; - $array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] ); + $array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'], $array['conditional_compare2'], $array['conditional_group2'] ); } if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) { $array['conditional_value3'] = isset( $array['conditional_value3'] ) ? $array['conditional_value3'] : ''; - $array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] ); + $array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'], $array['conditional_compare3'], $array['conditional_group3'] ); } if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) { $array['conditional_value4'] = isset( $array['conditional_value4'] ) ? $array['conditional_value4'] : ''; - $array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] ); + $array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'], $array['conditional_compare4'], $array['conditional_group4'] ); } return $array; @@ -236,6 +236,8 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) { field_input( '_conditional_field', $form_id ); ?> field_input( '_conditional_operator', $form_id ); ?> field_input( '_conditional_value', $form_id ); ?> + field_input( '_conditional_compare', $form_id ); ?> + field_input( '_conditional_group', $form_id ); ?>

    @@ -244,44 +246,55 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {

    +
    + $arr ) { - foreach ( $edit_array['conditions'] as $k => $arr ) { + if ( $k == 0 ) $k = ''; ?> + + - if ( $k == 0 ) $k = ''; ?> +
    + +
    -
    + field_input( '_conditional_action' . $k, $form_id ); ?> + field_input( '_conditional_field' . $k , $form_id ); ?> + field_input( '_conditional_operator' . $k, $form_id ); ?> + field_input( '_conditional_value' . $k, $form_id ); ?> + field_input( '_conditional_compare' . $k, $form_id ); ?> + field_input( '_conditional_group' . $k, $form_id ); ?> - field_input( '_conditional_action' . $k, $form_id ); ?> - field_input( '_conditional_field' . $k , $form_id ); ?> - field_input( '_conditional_operator' . $k, $form_id ); ?> - field_input( '_conditional_value' . $k, $form_id ); ?> +

    + +
    +
    + + +
    + + field_input( '_conditional_action', $form_id ); ?> + field_input( '_conditional_field', $form_id ); ?> + field_input( '_conditional_operator', $form_id ); ?> + field_input( '_conditional_value', $form_id ); ?> + field_input( '_conditional_compare', $form_id ); ?> + field_input( '_conditional_group', $form_id ); ?>

    -
    -
    +
    +
    - + + - } else { ?> - -
    - - field_input( '_conditional_action', $form_id ); ?> - field_input( '_conditional_field', $form_id ); ?> - field_input( '_conditional_operator', $form_id ); ?> - field_input( '_conditional_value', $form_id ); ?> - -

    - -
    -
    - - -
    +
    +

    + +

    + +

    + +

    + +

    $parent_value ) { - continue 2; + continue; } } elseif ( $op == 'less than' ) { if ( $cond_value < $parent_value ) { - continue 2; + continue; } } elseif ( $op == 'contains' ) { if ( is_string( $cond_value ) && strstr( $cond_value, $parent_value ) ) { - continue 2; + continue; } if( is_array( $cond_value ) && in_array( $parent_value, $cond_value ) ) { - continue 2; + continue; } } } elseif ( $visibility == 'show' ) { if ( $op == 'empty' ) { if ( ! empty( $cond_value ) ) { - continue 2; + continue; } } elseif ( $op == 'not empty' ) { if ( empty( $cond_value ) ) { - continue 2; + continue; } } elseif ( $op == 'equals to' ) { if ( $cond_value != $parent_value ) { - continue 2; + continue; } } elseif ( $op == 'not equals' ) { if ( $cond_value == $parent_value ) { - continue 2; + continue; } } elseif ( $op == 'greater than' ) { if ( $cond_value <= $parent_value ) { - continue 2; + continue; } } elseif ( $op == 'less than' ) { if ( $cond_value >= $parent_value ) { - continue 2; + continue; } } elseif ( $op == 'contains' ) { if ( is_string( $cond_value ) && ! strstr( $cond_value, $parent_value ) ) { - continue 2; + continue; } if( is_array( $cond_value ) && !in_array( $parent_value, $cond_value ) ) { - continue 2; + continue; } } } diff --git a/includes/um-short-functions.php b/includes/um-short-functions.php index 18da3bdb..90c4784e 100644 --- a/includes/um-short-functions.php +++ b/includes/um-short-functions.php @@ -288,142 +288,265 @@ function um_user_ip() { * @return bool */ function um_field_conditions_are_met( $data ) { - if (!isset( $data['conditions'] )) return true; + if (!isset( $data['conditions'] )) return true; - $state = 1; + $state = ( $data['conditional_action'] == 'show' ) ? 1 : 0; - foreach ($data['conditions'] as $k => $arr) { - if ($arr[0] == 'show') { + $first_group = 0; + $state_array = array(); + $count = count($state_array); + foreach ($data['conditions'] as $k => $arr){ - $val = $arr[3]; - $op = $arr[2]; + $val = $arr[3]; + $op = $arr[2]; - if (strstr( $arr[1], 'role_' )) - $arr[1] = 'role'; + if (strstr($arr[1], 'role_')) + $arr[1] = 'role'; - $field = um_profile( $arr[1] ); + $field = um_profile($arr[1]); - switch ($op) { - case 'equals to': - $field = maybe_unserialize( $field ); + if( $arr[5] != $first_group ){ - if (is_array( $field )) - $state = in_array( $val, $field ) ? 1 : 0; - else - $state = ( $field == $val ) ? 1 : 0; - break; - case 'not equals': + if ($arr[0] == 'show') { - $field = maybe_unserialize( $field ); + switch ($op) { + case 'equals to': - if (is_array( $field )) - $state = !in_array( $val, $field ) ? 1 : 0; - else - $state = ( $field != $val ) ? 1 : 0; + $field = maybe_unserialize( $field ); - break; - case 'empty': + if (is_array( $field )) + $state = in_array( $val, $field ) ? 1 : 0; + else + $state = ( $field == $val ) ? 1 : 0; - $state = ( !$field ) ? 1 : 0; + break; + case 'not equals': - break; - case 'not empty': + $field = maybe_unserialize( $field ); - $state = ( $field ) ? 1 : 0; + if (is_array( $field )) + $state = !in_array( $val, $field ) ? 1 : 0; + else + $state = ( $field != $val ) ? 1 : 0; - break; - case 'greater than': - if ($field > $val) { - $state = 1; - } else { - $state = 0; - } - break; - case 'less than': - if ($field < $val) { - $state = 1; - } else { - $state = 0; - } - break; - case 'contains': - if (strstr( $field, $val )) { - $state = 1; - } else { - $state = 0; - } - break; - } - } else if ($arr[0] == 'hide') { + break; + case 'empty': - $state = 1; - $val = $arr[3]; - $op = $arr[2]; + $state = ( !$field ) ? 1 : 0; - if (strstr( $arr[1], 'role_' )) - $arr[1] = 'role'; + break; + case 'not empty': - $field = um_profile( $arr[1] ); + $state = ( $field ) ? 1 : 0; - switch ($op) { - case 'equals to': + break; + case 'greater than': + if ($field > $val) { + $state = 1; + } else { + $state = 0; + } + break; + case 'less than': + if ($field < $val) { + $state = 1; + } else { + $state = 0; + } + break; + case 'contains': + if (strstr( $field, $val )) { + $state = 1; + } else { + $state = 0; + } + break; + } + } else if ($arr[0] == 'hide') { - $field = maybe_unserialize( $field ); + switch ($op) { + case 'equals to': - if (is_array( $field )) - $state = in_array( $val, $field ) ? 0 : 1; - else - $state = ( $field == $val ) ? 0 : 1; + $field = maybe_unserialize( $field ); - break; - case 'not equals': + if (is_array( $field )) + $state = in_array( $val, $field ) ? 0 : 1; + else + $state = ( $field == $val ) ? 0 : 1; - $field = maybe_unserialize( $field ); + break; + case 'not equals': - if (is_array( $field )) - $state = !in_array( $val, $field ) ? 0 : 1; - else - $state = ( $field != $val ) ? 0 : 1; + $field = maybe_unserialize( $field ); - break; - case 'empty': + if (is_array( $field )) + $state = !in_array( $val, $field ) ? 0 : 1; + else + $state = ( $field != $val ) ? 0 : 1; - $state = ( !$field ) ? 0 : 1; + break; + case 'empty': - break; - case 'not empty': + $state = ( !$field ) ? 0 : 1; - $state = ( $field ) ? 0 : 1; + break; + case 'not empty': - break; - case 'greater than': - if ($field <= $val) { - $state = 0; - } else { - $state = 1; - } - break; - case 'less than': - if ($field >= $val) { - $state = 0; - } else { - $state = 1; - } - break; - case 'contains': - if (strstr( $field, $val )) { - $state = 0; - } else { - $state = 1; - } - break; - } - } - } + $state = ( $field ) ? 0 : 1; - return ( $state ) ? true : false; + break; + case 'greater than': + if ($field <= $val) { + $state = 0; + } else { + $state = 1; + } + break; + case 'less than': + if ($field >= $val) { + $state = 0; + } else { + $state = 1; + } + break; + case 'contains': + if (strstr( $field, $val )) { + $state = 0; + } else { + $state = 1; + } + break; + } + } + $first_group++; + array_push($state_array, $state); + } else { + + if ($arr[0] == 'show') { + + switch ($op) { + case 'equals to': + + $field = maybe_unserialize( $field ); + + if (is_array( $field )) + $state = in_array( $val, $field ) ? 1 : 0; + else + $state = ( $field == $val ) ? 1 : 0; + + break; + case 'not equals': + + $field = maybe_unserialize( $field ); + + if (is_array( $field )) + $state = !in_array( $val, $field ) ? 1 : 0; + else + $state = ( $field != $val ) ? 1 : 0; + + break; + case 'empty': + + $state = ( !$field ) ? 1 : 0; + + break; + case 'not empty': + + $state = ( $field ) ? 1 : 0; + + break; + case 'greater than': + if ($field > $val) { + $state = 1; + } else { + $state = 0; + } + break; + case 'less than': + if ($field < $val) { + $state = 1; + } else { + $state = 0; + } + break; + case 'contains': + if (strstr( $field, $val )) { + $state = 1; + } else { + $state = 0; + } + break; + } + } else if ($arr[0] == 'hide') { + + switch ($op) { + case 'equals to': + + $field = maybe_unserialize( $field ); + + if (is_array( $field )) + $state = in_array( $val, $field ) ? 0 : 1; + else + $state = ( $field == $val ) ? 0 : 1; + + break; + case 'not equals': + + $field = maybe_unserialize( $field ); + + if (is_array( $field )) + $state = !in_array( $val, $field ) ? 0 : 1; + else + $state = ( $field != $val ) ? 0 : 1; + + break; + case 'empty': + + $state = ( !$field ) ? 0 : 1; + + break; + case 'not empty': + + $state = ( $field ) ? 0 : 1; + + break; + case 'greater than': + if ($field <= $val) { + $state = 0; + } else { + $state = 1; + } + break; + case 'less than': + if ($field >= $val) { + $state = 0; + } else { + $state = 1; + } + break; + case 'contains': + if (strstr( $field, $val )) { + $state = 0; + } else { + $state = 1; + } + break; + } + } + + $state_array[$count] = $state; + } + + + } + $result = array_unique($state_array); + if( !in_array("1", $result) ){ + return $state = false; + } else { + return $state = true; + } } diff --git a/package.json b/package.json index eb279a8e..84fe1409 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,13 @@ "grunt-contrib-watch": "~0.6.1", "grunt-modernizr": "~0.6.0", "grunt-wp-assets": "~0.2.6", + "gulp": "^3.9.1", "gulp-rename": "^1.2.2", + "gulp-uglify": "^3.0.1", "load-grunt-tasks": "~1.0.0", "time-grunt": "~1.0.0" + }, + "dependencies": { + "gulp-install": "^1.1.0" } }