(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}function i(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function s(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=n(t("
"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,o)}function o(){t.datepicker._isDisabledDatepicker(u.inline?u.dpDiv.parent()[0]:u.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function a(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.ui=t.ui||{},t.ui.version="1.12.1";var r=0,l=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=l.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=l.call(arguments,1),r=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(r=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):r=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),r}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=r++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(h)?(r=!i.disabled,r&&(l=t(i).closest("fieldset")[0],l&&(r=!l.disabled))):r="a"===h?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var h=!1;t(document).on("mouseup",function(){h=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!h){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),h=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,h=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0) },_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.droppable",{version:"1.12.1",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(s)?s:function(t){return t.is(s)},this.proportions=function(){return arguments.length?(e=arguments[0],void 0):e?e:e={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this._addClass("ui-droppable")},_addToManager:function(e){t.ui.ddmanager.droppables[e]=t.ui.ddmanager.droppables[e]||[],t.ui.ddmanager.droppables[e].push(this)},_splice:function(t){for(var e=0;t.length>e;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var e=t.ui.ddmanager.droppables[this.options.scope];this._splice(e)},_setOption:function(e,i){if("accept"===e)this.accept=t.isFunction(i)?i:function(t){return t.is(i)};else if("scope"===e){var s=t.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(e,i)},_activate:function(e){var i=t.ui.ddmanager.current;this._addActiveClass(),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this._removeActiveClass(),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._addHoverClass(),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeHoverClass(),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var s=i||t.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=t(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&c(s,t.extend(i,{offset:i.element.offset()}),i.options.tolerance,e)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(s)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}});var c=t.ui.intersect=function(){function t(t,e,i){return t>=e&&e+i>t}return function(e,i,s,n){if(!i.offset)return!1;var o=(e.positionAbs||e.position.absolute).left+e.margins.left,a=(e.positionAbs||e.position.absolute).top+e.margins.top,r=o+e.helperProportions.width,l=a+e.helperProportions.height,h=i.offset.left,c=i.offset.top,u=h+i.proportions().width,d=c+i.proportions().height;switch(s){case"fit":return o>=h&&u>=r&&a>=c&&d>=l;case"intersect":return o+e.helperProportions.width/2>h&&u>r-e.helperProportions.width/2&&a+e.helperProportions.height/2>c&&d>l-e.helperProportions.height/2;case"pointer":return t(n.pageY,c,i.proportions().height)&&t(n.pageX,h,i.proportions().width);case"touch":return(a>=c&&d>=a||l>=c&&d>=l||c>a&&l>d)&&(o>=h&&u>=o||r>=h&&u>=r||h>o&&r>u);default:return!1}}}();t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var s,n,o=t.ui.ddmanager.droppables[e.options.scope]||[],a=i?i.type:null,r=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(s=0;o.length>s;s++)if(!(o[s].options.disabled||e&&!o[s].accept.call(o[s].element[0],e.currentItem||e.element))){for(n=0;r.length>n;n++)if(r[n]===o[s].element[0]){o[s].proportions().height=0;continue t}o[s].visible="none"!==o[s].element.css("display"),o[s].visible&&("mousedown"===a&&o[s]._activate.call(o[s],i),o[s].offset=o[s].element.offset(),o[s].proportions({width:o[s].element[0].offsetWidth,height:o[s].element[0].offsetHeight}))}},drop:function(e,i){var s=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&c(e,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(e,i){e.element.parentsUntil("body").on("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,o,a=c(e,this,this.options.tolerance,i),r=!a&&this.isover?"isout":a&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,o=this.element.parents(":data(ui-droppable)").filter(function(){return t(this).droppable("instance").options.scope===n}),o.length&&(s=t(o[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").off("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}},t.uiBackCompat!==!1&&t.widget("ui.droppable",t.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}}),t.ui.droppable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
"),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),l?(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,l=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
"),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0}; t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.selectable",t.ui.mouse,{version:"1.12.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e.elementPos=t(e.element[0]).offset(),e.selectees=t(e.options.filter,e.element[0]),e._addClass(e.selectees,"ui-selectee"),e.selectees.each(function(){var i=t(this),s=i.offset(),n={left:s.left-e.elementPos.left,top:s.top-e.elementPos.top};t.data(this,"selectable-item",{element:this,$element:i,left:n.left,top:n.top,right:n.left+i.outerWidth(),bottom:n.top+i.outerHeight(),startselected:!1,selected:i.hasClass("ui-selected"),selecting:i.hasClass("ui-selecting"),unselecting:i.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=t("
"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(e){var i=this,s=this.options;this.opos=[e.pageX,e.pageY],this.elementPos=t(this.element[0]).offset(),this.options.disabled||(this.selectees=t(s.filter,this.element[0]),this._trigger("start",e),t(s.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=t.data(this,"selectable-item");s.startselected=!0,e.metaKey||e.ctrlKey||(i._removeClass(s.$element,"ui-selected"),s.selected=!1,i._addClass(s.$element,"ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",e,{unselecting:s.element}))}),t(e.target).parents().addBack().each(function(){var s,n=t.data(this,"selectable-item");return n?(s=!e.metaKey&&!e.ctrlKey||!n.$element.hasClass("ui-selected"),i._removeClass(n.$element,s?"ui-unselecting":"ui-selected")._addClass(n.$element,s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",e,{selecting:n.element}):i._trigger("unselecting",e,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,o=this.opos[0],a=this.opos[1],r=e.pageX,l=e.pageY;return o>r&&(i=r,r=o,o=i),a>l&&(i=l,l=a,a=i),this.helper.css({left:o,top:a,width:r-o,height:l-a}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),h=!1,c={};i&&i.element!==s.element[0]&&(c.left=i.left+s.elementPos.left,c.right=i.right+s.elementPos.left,c.top=i.top+s.elementPos.top,c.bottom=i.bottom+s.elementPos.top,"touch"===n.tolerance?h=!(c.left>r||o>c.right||c.top>l||a>c.bottom):"fit"===n.tolerance&&(h=c.left>o&&r>c.right&&c.top>a&&l>c.bottom),h?(i.selected&&(s._removeClass(i.$element,"ui-selected"),i.selected=!1),i.unselecting&&(s._removeClass(i.$element,"ui-unselecting"),i.unselecting=!1),i.selecting||(s._addClass(i.$element,"ui-selecting"),i.selecting=!0,s._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,s._addClass(i.$element,"ui-selected"),i.selected=!0):(s._removeClass(i.$element,"ui-selecting"),i.selecting=!1,i.startselected&&(s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(s._removeClass(i.$element,"ui-selected"),i.selected=!1,s._addClass(i.$element,"ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",e,{unselected:s.element})}),t(".ui-selecting",this.element[0]).each(function(){var s=t.data(this,"selectable-item");i._removeClass(s.$element,"ui-selecting")._addClass(s.$element,"ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",e,{selected:s.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}}),t.widget("ui.menu",{version:"1.12.1",defaultElement:"
    ",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0); e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,l=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=l.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=l.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("
      ").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("
      ").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("
      ",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length").append(t("
      ").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("
      ").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var u;t.extend(s.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return a(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("
      ")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t(""+a+""),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("").addClass(this._triggerClass).html(o?t("").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,o){var r,l,h,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t(""),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),a(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(l=document.documentElement.clientWidth,h=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+c,h/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),u===n&&(u=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,o,r,l,h=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):h?"all"===i?t.extend({},h.settings):this._get(h,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),h&&(this._curInst===h&&this._hideDatepicker(),o=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(h,"min"),l=this._getMinMaxDate(h,"max"),a(h.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(h.settings.minDate=this._formatDate(h,r)),null!==l&&void 0!==n.dateFormat&&void 0===n.maxDate&&(h.settings.maxDate=this._formatDate(h,l)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),h),this._autoSize(h),this._setDate(h,o),this._updateAlternate(h),this._updateDatepicker(h)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var s,n,o,r,l,h,c;s=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),o=n?n.apply(e,[e,s]):{},o!==!1&&(a(s.settings,o),s.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),l={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),l=t.datepicker._checkOffset(s,l,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:l.left+"px",top:l.top+"px"}),s.inline||(h=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",i(t(e))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?s.dpDiv.show(h,t.datepicker._get(s,"showOptions"),c):s.dpDiv[h||"show"](h?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))}},_updateDatepicker:function(e){this.maxRows=4,u=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),n=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,l=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),h=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>l&&l>n?Math.abs(i.left+n-l):0),i.top-=Math.min(i.top,i.top+o>h&&h>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null) },_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,l=0,h=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof h?h:(new Date).getFullYear()%100+parseInt(h,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(l).match(o);if(!a)throw"Missing number at position "+l;return l+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(l,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],l+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+l},x=function(){if(i.charAt(l)!==e.charAt(n))throw"Unexpected literal at position "+l;l++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>l&&(a=i.substr(l),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,l=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},h=function(t,e,i){var s=""+e;if(l(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return l(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||l("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=h("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=h("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=h("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=l("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,h=l.exec(i);h;){switch(h[2]||"d"){case"d":case"D":r+=parseInt(h[1],10);break;case"w":case"W":r+=7*parseInt(h[1],10);break;case"m":case"M":a+=parseInt(h[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(h[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}h=l.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,T,I,M,P,S,N,H,A,z,O,E,W,F,L,R=new Date,Y=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),B=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),X=this._get(t,"stepMonths"),$=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(t,"min"),Q=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),Q)for(e=this._daylightSavingAdjust(new Date(Q.getFullYear(),Q.getMonth()-U[0]*U[1]+1,Q.getDate())),e=J&&J>e?J:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-X,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?""+i+"":q?"":""+i+"",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+X,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?""+n+"":q?"":""+n+"",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:Y,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,l=t.inline?"":"",h=j?"
      "+(B?l:"")+(this._isInRange(t,r)?"":"")+(B?"":l)+"
      ":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),T=" ui-corner-all",I="",$){if(I+="
      "}for(I+="
      "+(/all|left/.test(T)&&0===k?B?o:s:"")+(/all|right/.test(T)&&0===k?B?s:o:"")+this._generateMonthYearHeader(t,Z,te,J,Q,k>0||C>0,f,g)+"
      "+"",M=u?"":"",w=0;7>w;w++)P=(w+c)%7,M+="";for(I+=M+"",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),N=(this._getFirstDayOfMonth(te,Z)-c+7)%7,H=Math.ceil((N+S)/7),A=$?this.maxRows>H?this.maxRows:H:H,this.maxRows=A,z=this._daylightSavingAdjust(new Date(te,Z,1-N)),O=0;A>O;O++){for(I+="",E=u?"":"",w=0;7>w;w++)W=m?m.apply(t.input?t.input[0]:null,[z]):[!0,""],F=z.getMonth()!==Z,L=F&&!v||!W[0]||J&&J>z||Q&&z>Q,E+="",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);I+=E+""}Z++,Z>11&&(Z=0,te++),I+="
      "+this._get(t,"weekHeader")+"=5?" class='ui-datepicker-week-end'":"")+">"+""+p[P]+"
      "+this._get(t,"calculateWeek")(z)+""+(F&&!_?" ":L?""+z.getDate()+"":""+z.getDate()+"")+"
      "+($?"
      "+(U[0]>0&&C===U[1]-1?"
      ":""):""),x+=I}y+=x}return y+=h,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="
      ",y="";if(o||!m)y+=""+a[e]+"";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+=""}if(v||(b+=y+(!o&&m&&_?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!_)b+=""+i+"";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":" ")+y),b+="
      "},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,l=this._get(t,"yearRange");return l&&(i=l.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new s,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker}); !function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(F){"use strict";var e,c,t,i=document.createElement("_");if(i.classList.toggle("c3",!1),i.classList.contains("c3")){var s=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:s.call(this,e)}}function E(e){var t,i=[],s=e&&e.options;if(e.multiple)for(var n=0,o=s.length;n]+>/g,"")),s&&(a=m(a)),a=a.toUpperCase(),o="contains"===i?0<=a.indexOf(t):a.startsWith(t)))break}return o}function z(e){return parseInt(e,10)||0}F.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(o?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var l={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},r=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,a=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function d(e){return l[e]}function m(e){return(e=e.toString())&&e.replace(r,d).replace(a,"")}var h=function(t){var i=function(e){return t[e]},e="(?:"+Object.keys(t).join("|")+")",s=RegExp(e),n=RegExp(e,"g");return function(e){return e=null==e?"":""+e,s.test(e)?e.replace(n,i):e}},G=h({"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"}),f=h({"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"}),S={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},C=27,O=13,T=32,D=9,H=38,A=40,_={success:!1,major:"3"};try{_.full=(F.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),_.major=_.full[0],_.success=!0}catch(e){console.warn("There was an issue retrieving Bootstrap's version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.",e)}var p=0,L=".bs.select",q={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title"},N={MENU:"."+q.MENU};"4"===_.major&&(q.DIVIDER="dropdown-divider",q.SHOW="show",q.BUTTONCLASS="btn-light",q.POPOVERHEADER="popover-header");var P=new RegExp(H+"|"+A),R=new RegExp("^"+D+"$|"+C),u=(new RegExp(O+"|"+T),function(e,t){var i=this;n.useDefault||(F.valHooks.select.set=n._set,n.useDefault=!0),this.$element=F(e),this.$newElement=null,this.$button=null,this.$menu=null,this.options=t,this.selectpicker={main:{map:{newIndex:{},originalIndex:{}}},current:{map:{}},search:{map:{}},view:{},keydown:{keyHistory:"",resetKeyHistory:{start:function(){return setTimeout(function(){i.selectpicker.keydown.keyHistory=""},800)}}}},null===this.options.title&&(this.options.title=this.$element.attr("title"));var s=this.options.windowPadding;"number"==typeof s&&(this.options.windowPadding=[s,s,s,s]),this.val=u.prototype.val,this.render=u.prototype.render,this.refresh=u.prototype.refresh,this.setStyle=u.prototype.setStyle,this.selectAll=u.prototype.selectAll,this.deselectAll=u.prototype.deselectAll,this.destroy=u.prototype.destroy,this.remove=u.prototype.remove,this.show=u.prototype.show,this.hide=u.prototype.hide,this.init()});function v(e){var o,l=arguments,r=e;if([].shift.apply(l),!_.success){try{_.full=(F.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".")}catch(e){_.full=u.BootstrapVersion.split(" ")[0].split(".")}_.major=_.full[0],_.success=!0,"4"===_.major&&(q.DIVIDER="dropdown-divider",q.SHOW="show",q.BUTTONCLASS="btn-light",u.DEFAULTS.style=q.BUTTONCLASS="btn-light",q.POPOVERHEADER="popover-header")}var t=this.each(function(){var e=F(this);if(e.is("select")){var t=e.data("selectpicker"),i="object"==typeof r&&r;if(t){if(i)for(var s in i)i.hasOwnProperty(s)&&(t.options[s]=i[s])}else{var n=F.extend({},u.DEFAULTS,F.fn.selectpicker.defaults||{},e.data(),i);n.template=F.extend({},u.DEFAULTS.template,F.fn.selectpicker.defaults?F.fn.selectpicker.defaults.template:{},e.data().template,i.template),e.data("selectpicker",t=new u(this,n))}"string"==typeof r&&(o=t[r]instanceof Function?t[r].apply(t,l):t.options[r])}});return void 0!==o?o:t}u.VERSION="1.13.3",u.BootstrapVersion=_.major,u.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(e,t){return 1==e?"{0} item selected":"{0} items selected"},maxOptionsText:function(e,t){return[1==e?"Limit reached ({n} item max)":"Limit reached ({n} items max)",1==t?"Group limit reached ({n} item max)":"Group limit reached ({n} items max)"]},selectAllText:"Select All",deselectAllText:"Deselect All",doneButton:!1,doneButtonText:"Close",multipleSeparator:", ",styleBase:"btn",style:q.BUTTONCLASS,size:"auto",title:null,selectedTextFormat:"values",width:!1,container:!1,hideDisabled:!1,showSubtext:!1,showIcon:!0,showContent:!0,dropupAuto:!0,header:!1,liveSearch:!1,liveSearchPlaceholder:null,liveSearchNormalize:!1,liveSearchStyle:"contains",actionsBox:!1,iconBase:"glyphicon",tickIcon:"glyphicon-ok",showTick:!1,template:{caret:''},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1},"4"===_.major&&(u.DEFAULTS.style="btn-light",u.DEFAULTS.iconBase="",u.DEFAULTS.tickIcon="bs-ok-default"),u.prototype={constructor:u,init:function(){var i=this,e=this.$element.attr("id");this.selectId=p++,this.$element.addClass("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$newElement=this.createDropdown(),this.createLi(),this.$element.after(this.$newElement).prependTo(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(N.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.$element.removeClass("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu.addClass(q.MENURIGHT),void 0!==e&&this.$button.attr("data-id",e),this.checkDisabled(),this.clickListener(),this.options.liveSearch&&this.liveSearchListener(),this.render(),this.setStyle(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide"+L,function(){if(i.isVirtual()){var e=i.$menuInner[0],t=e.firstChild.cloneNode(!1);e.replaceChild(t,e.firstChild),e.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(e){i.$menuInner.attr("aria-expanded",!1),i.$element.trigger("hide"+L,e)},"hidden.bs.dropdown":function(e){i.$element.trigger("hidden"+L,e)},"show.bs.dropdown":function(e){i.$menuInner.attr("aria-expanded",!0),i.$element.trigger("show"+L,e)},"shown.bs.dropdown":function(e){i.$element.trigger("shown"+L,e)}}),i.$element[0].hasAttribute("required")&&this.$element.on("invalid",function(){i.$button.addClass("bs-invalid"),i.$element.on("shown"+L+".invalid",function(){i.$element.val(i.$element.val()).off("shown"+L+".invalid")}).on("rendered"+L,function(){this.validity.valid&&i.$button.removeClass("bs-invalid"),i.$element.off("rendered"+L)}),i.$button.on("blur"+L,function(){i.$element.focus().blur(),i.$button.off("blur"+L)})}),setTimeout(function(){i.$element.trigger("loaded"+L)})},createDropdown:function(){var e,t=this.multiple||this.options.showTick?" show-tick":"",i=this.autofocus?" autofocus":"",s="",n="",o="",l="";return this.options.header&&(s='
      '+this.options.header+"
      "),this.options.liveSearch&&(n=''),this.multiple&&this.options.actionsBox&&(o='
      "),this.multiple&&this.options.doneButton&&(l='
      "),e='",F(e)},setPositionData:function(){this.selectpicker.view.canHighlight=[];for(var e=0;e=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(C,e){e=e||0;var O=this;this.selectpicker.current=C?this.selectpicker.search:this.selectpicker.main;var z,T,D=[];function i(e,t){var i,s,n,o,l,r,a,c,d,h=O.selectpicker.current.elements.length,p=[],u=void 0,f=!0,m=O.isVirtual();O.selectpicker.view.scrollTop=e,!0===m&&O.sizeInfo.hasScrollBar&&O.$menu[0].offsetWidth>O.sizeInfo.totalMenuWidth&&(O.sizeInfo.menuWidth=O.$menu[0].offsetWidth,O.sizeInfo.totalMenuWidth=O.sizeInfo.menuWidth+O.sizeInfo.scrollBarWidth,O.$menu.css("min-width",O.sizeInfo.menuWidth)),i=Math.ceil(O.sizeInfo.menuInnerHeight/O.sizeInfo.liHeight*1.5),s=Math.round(h/i)||1;for(var v=0;vh-1?0:O.selectpicker.current.data[h-1].position-O.selectpicker.current.data[O.selectpicker.view.position1-1].position,I.firstChild.style.marginTop=b+"px",I.firstChild.style.marginBottom=w+"px"),I.firstChild.appendChild(x)}if(O.prevActiveIndex=O.activeIndex,O.options.liveSearch){if(C&&t){var E,y=0;O.selectpicker.view.canHighlight[y]||(y=1+O.selectpicker.view.canHighlight.slice(1).indexOf(!0)),E=O.selectpicker.view.visibleElements[y],O.selectpicker.view.currentActive&&(O.selectpicker.view.currentActive.classList.remove("active"),O.selectpicker.view.currentActive.firstChild&&O.selectpicker.view.currentActive.firstChild.classList.remove("active")),E&&(E.classList.add("active"),E.firstChild&&E.firstChild.classList.add("active")),O.activeIndex=O.selectpicker.current.map.originalIndex[y]}}else O.$menuInner.focus()}this.setPositionData(),i(e,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(e,t){O.noScroll||i(this.scrollTop,t),O.noScroll=!1}),F(window).off("resize"+L+"."+this.selectId+".createView").on("resize"+L+"."+this.selectId+".createView",function(){O.$newElement.hasClass(q.SHOW)&&i(O.$menuInner[0].scrollTop)})},createLi:function(){var z,T=this,D=[],H=0,A=0,L=[],N=0,P=0,R=-1;this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option"));var e,W={span:document.createElement("span"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode("\xa0")},B=document.createDocumentFragment();(T.options.showTick||T.multiple)&&((e=W.span.cloneNode(!1)).className=T.options.iconBase+" "+T.options.tickIcon+" check-mark",W.a.appendChild(e)),W.a.setAttribute("role","option"),W.subtext.className="text-muted",W.text=W.span.cloneNode(!1),W.text.className="text";var M=function(e,t,i){var s=W.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},U=function(e,t,i){var s=W.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&""!==t&&(s.className=t),"4"===_.major&&s.classList.add("dropdown-item"),i&&s.setAttribute("style",i),s},V=function(e){var t,i,s=W.text.cloneNode(!1);if(e.optionContent)s.innerHTML=e.optionContent;else{if(s.textContent=e.text,e.optionIcon){var n=W.whitespace.cloneNode(!1);(i=W.span.cloneNode(!1)).className=T.options.iconBase+" "+e.optionIcon,B.appendChild(i),B.appendChild(n)}e.optionSubtext&&((t=W.subtext.cloneNode(!1)).innerHTML=e.optionSubtext,s.appendChild(t))}return B.appendChild(s),B};if(this.options.title&&!this.multiple){R--;var t=this.$element[0],i=!1,s=!this.selectpicker.view.titleOption.parentNode;if(s)this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",i=void 0===F(t.options[t.selectedIndex]).attr("selected")&&void 0===this.$element.data("selected");(s||0!==this.selectpicker.view.titleOption.index)&&t.insertBefore(this.selectpicker.view.titleOption,t.firstChild),i&&(t.selectedIndex=0)}var j=this.$element.find("option");j.each(function(e){var t=F(this);if(R++,!t.hasClass("bs-title-option")){var i,s,n=t.data(),o=this.className||"",l=G(this.style.cssText),r=n.content,a=this.textContent,c=n.tokens,d=n.subtext,h=n.icon,p=t.parent(),u=p[0],f="OPTGROUP"===u.tagName,m=f&&u.disabled,v=this.disabled||m,g=this.previousElementSibling&&"OPTGROUP"===this.previousElementSibling.tagName,b=p.data();if(!0===n.hidden||T.options.hideDisabled&&(v&&!f||m)){i=n.prevHiddenIndex,t.next().data("prevHiddenIndex",void 0!==i?i:e),R--,g||void 0!==i&&(y=j[i].previousElementSibling)&&"OPTGROUP"===y.tagName&&!y.disabled&&(g=!0),g&&"divider"!==L[L.length-1].type&&(R++,D.push(M(!1,q.DIVIDER,N+"div")),L.push({type:"divider",optID:N}))}else{if(f&&!0!==n.divider){if(T.options.hideDisabled&&v){if(void 0===b.allOptionsDisabled){var w=p.children();p.data("allOptionsDisabled",w.filter(":disabled").length===w.length)}if(p.data("allOptionsDisabled"))return void R--}var I=" "+u.className||"";if(!this.previousElementSibling){N+=1;var x=u.label,k=G(x),$=b.subtext,S=b.icon;0!==e&&0 li")},render:function(){var e=this,t=this.$element.find("option"),i=[],s=[];this.togglePlaceholder(),this.tabIndex();for(var n=0,o=this.selectpicker.main.elements.length;n ':"";r=e.options.showSubtext&&c.subtext&&!e.multiple?' '+c.subtext+"":"",a=l.title?l.title:c.content&&e.options.showContent?c.content.toString():d+l.innerHTML.trim()+r,s.push(a)}}var h=this.multiple?s.join(this.options.multipleSeparator):s[0];if(50");if(1p[1]||1===p.length&&2<=i.length){var u=this.selectpicker.view.availableOptionsCount;h=("function"==typeof this.options.countSelectedText?this.options.countSelectedText(i.length,u):this.options.countSelectedText).replace("{0}",i.length.toString()).replace("{1}",u.toString())}}null==this.options.title&&(this.options.title=this.$element.attr("title")),"static"==this.options.selectedTextFormat&&(h=this.options.title),h||(h=void 0!==this.options.title?this.options.title:this.options.noneSelectedText),this.$button[0].title=f(h.replace(/<[^>]*>?/g,"").trim()),this.$button.find(".filter-option-inner-inner")[0].innerHTML=h,this.$element.trigger("rendered"+L)},setStyle:function(e,t){this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,""));var i=e||this.options.style;"add"==t?this.$button.addClass(i):"remove"==t?this.$button.removeClass(i):(this.$button.removeClass(this.options.style),this.$button.addClass(i))},liHeight:function(e){if(e||!1!==this.options.size&&!this.sizeInfo){this.sizeInfo||(this.sizeInfo={});var t=document.createElement("div"),i=document.createElement("div"),s=document.createElement("div"),n=document.createElement("ul"),o=document.createElement("li"),l=document.createElement("li"),r=document.createElement("li"),a=document.createElement("a"),c=document.createElement("span"),d=this.options.header&&0this.sizeInfo.menuExtras.vert&&r+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot)),"auto"===this.options.size)n=3this.options.size){for(var g=0;gthis.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRightthis.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth,this.$menu.css("min-width",this.sizeInfo.totalMenuWidth)),this.dropdown&&this.dropdown._popper&&this.dropdown._popper.update()},setSize:function(e){if(this.liHeight(e),this.options.header&&this.$menu.css("padding-top",0),!1!==this.options.size){var t,i=this,s=F(window),n=0;this.setMenuSize(),"auto"===this.options.size?(this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",function(){return i.setMenuSize()}),s.off("resize"+L+"."+this.selectId+".setMenuSize scroll"+L+"."+this.selectId+".setMenuSize").on("resize"+L+"."+this.selectId+".setMenuSize scroll"+L+"."+this.selectId+".setMenuSize",function(){return i.setMenuSize()})):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&(this.$searchbox.off("input.setMenuSize propertychange.setMenuSize"),s.off("resize"+L+"."+this.selectId+".setMenuSize scroll"+L+"."+this.selectId+".setMenuSize")),e?n=this.$menuInner[0].scrollTop:i.multiple||"number"==typeof(t=i.selectpicker.main.map.newIndex[i.$element[0].selectedIndex])&&!1!==i.options.size&&(n=(n=i.sizeInfo.liHeight*t)-i.sizeInfo.menuInnerHeight/2+i.sizeInfo.liHeight/2),i.createView(!1,n)}},setWidth:function(){var i=this;"auto"===this.options.width?requestAnimationFrame(function(){i.$menu.css("min-width","0"),i.liHeight(),i.setMenuSize();var e=i.$newElement.clone().appendTo("body"),t=e.css("width","auto").children("button").outerWidth();e.remove(),i.sizeInfo.selectWidth=Math.max(i.sizeInfo.totalMenuWidth,t),i.$newElement.css("width",i.sizeInfo.selectWidth+"px")}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement.removeClass("fit-width")},selectPosition:function(){this.$bsContainer=F('
      ');var s,n,o,l=this,r=F(this.options.container),e=function(e){var t={},i=l.options.display||!!F.fn.dropdown.Constructor.Default&&F.fn.dropdown.Constructor.Default.display;l.$bsContainer.addClass(e.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(q.DROPUP,e.hasClass(q.DROPUP)),s=e.offset(),r.is("body")?n={top:0,left:0}:((n=r.offset()).top+=parseInt(r.css("borderTopWidth"))-r.scrollTop(),n.left+=parseInt(r.css("borderLeftWidth"))-r.scrollLeft()),o=e.hasClass(q.DROPUP)?0:e[0].offsetHeight,(_.major<4||"static"===i)&&(t.top=s.top-n.top+o,t.left=s.left-n.left),t.width=e[0].offsetWidth,l.$bsContainer.css(t)};this.$button.on("click.bs.dropdown.data-api",function(){l.isDisabled()||(e(l.$newElement),l.$bsContainer.appendTo(l.options.container).toggleClass(q.SHOW,!l.$button.hasClass(q.SHOW)).append(l.$menu))}),F(window).off("resize"+L+"."+this.selectId+" scroll"+L+"."+this.selectId).on("resize"+L+"."+this.selectId+" scroll"+L+"."+this.selectId,function(){l.$newElement.hasClass(q.SHOW)&&e(l.$newElement)}),this.$element.on("hide"+L,function(){l.$menu.data("height",l.$menu.height()),l.$bsContainer.detach()})},setOptionStatus:function(){var e=this,t=this.$element.find("option");if(e.noScroll=!1,e.selectpicker.view.visibleElements&&e.selectpicker.view.visibleElements.length)for(var i=0;i
      ');I[2]&&(x=x.replace("{var}",I[2][1"+x+"
      ")),r=!1,S.$element.trigger("maxReached"+L)),f&&v&&($.append(F("
      "+k+"
      ")),r=!1,S.$element.trigger("maxReachedGrp"+L)),setTimeout(function(){S.setSelected(n,!1)},10),$.delay(750).fadeOut(300,function(){F(this).remove()})}}}else a.prop("selected",!1),c.prop("selected",!0),S.setSelected(n,!0);!S.multiple||S.multiple&&1===S.options.maxOptions?S.$button.focus():S.options.liveSearch&&S.$searchbox.focus(),r&&(o!=E(S.$element[0])&&S.multiple||l!=S.$element.prop("selectedIndex")&&!S.multiple)&&(y=[n,c.prop("selected"),o],S.$element.triggerNative("change"))}}),this.$menu.on("click","li."+q.DISABLED+" a, ."+q.POPOVERHEADER+", ."+q.POPOVERHEADER+" :not(.close)",function(e){e.currentTarget==this&&(e.preventDefault(),e.stopPropagation(),S.options.liveSearch&&!F(e.target).hasClass("close")?S.$searchbox.focus():S.$button.focus())}),this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault(),e.stopPropagation(),S.options.liveSearch?S.$searchbox.focus():S.$button.focus()}),this.$menu.on("click","."+q.POPOVERHEADER+" .close",function(){S.$button.click()}),this.$searchbox.on("click",function(e){e.stopPropagation()}),this.$menu.on("click",".actions-btn",function(e){S.options.liveSearch?S.$searchbox.focus():S.$button.focus(),e.preventDefault(),e.stopPropagation(),F(this).hasClass("bs-select-all")?S.selectAll():S.deselectAll()}),this.$element.on({change:function(){S.render(),S.$element.trigger("changed"+L,y),y=null},focus:function(){S.options.mobile||S.$button.focus()}})},liveSearchListener:function(){var u=this,f=document.createElement("li");this.$button.on("click.bs.dropdown.data-api",function(){u.$searchbox.val()&&u.$searchbox.val("")}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(e){e.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var e=u.$searchbox.val();if(u.selectpicker.search.map.newIndex={},u.selectpicker.search.map.originalIndex={},u.selectpicker.search.elements=[],u.selectpicker.search.data=[],e){var t=[],i=e.toUpperCase(),s={},n=[],o=u._searchStyle(),l=u.options.liveSearchNormalize;l&&(i=m(i)),u._$lisSelected=u.$menuInner.find(".selected");for(var r=0;r=a.selectpicker.view.canHighlight.length&&(t=0),a.selectpicker.view.canHighlight[t+m]||(t=t+1+a.selectpicker.view.canHighlight.slice(t+m+1).indexOf(!0))),e.preventDefault();var v=m+t;e.which===H?0===m&&t===c.length-1?(a.$menuInner[0].scrollTop=a.$menuInner[0].scrollHeight,v=a.selectpicker.current.elements.length-1):d=(o=(n=a.selectpicker.current.data[v]).position-n.height)u+a.sizeInfo.menuInnerHeight),(s=a.selectpicker.current.elements[g]).classList.add("active"),s.firstChild&&s.firstChild.classList.add("active"),a.activeIndex=w[k],s.firstChild.focus(),d&&(a.$menuInner[0].scrollTop=o),l.focus()}}i&&(e.which===T&&!a.selectpicker.keydown.keyHistory||e.which===O||e.which===D&&a.options.selectOnTab)&&(e.which!==T&&e.preventDefault(),a.options.liveSearch&&e.which===T||(a.$menuInner.find(".active a").trigger("click",!0),l.focus(),a.options.liveSearch||(e.preventDefault(),F(document).data("spaceSelect",!0))))},mobile:function(){this.$element.addClass("mobile-device")},refresh:function(){var e=F.extend({},this.options,this.$element.data());this.options=e,this.selectpicker.main.map.newIndex={},this.selectpicker.main.map.originalIndex={},this.createLi(),this.checkDisabled(),this.render(),this.setStyle(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed"+L)},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.$element.off(L).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),F(window).off(L+"."+this.selectId)}};var g=F.fn.selectpicker;F.fn.selectpicker=v,F.fn.selectpicker.Constructor=u,F.fn.selectpicker.noConflict=function(){return F.fn.selectpicker=g,this},F(document).off("keydown.bs.dropdown.data-api").on("keydown"+L,'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',u.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(e){e.stopPropagation()}),F(window).on("load"+L+".data-api",function(){F(".selectpicker").each(function(){var e=F(this);v.call(e,e.data())})})}(e)}); //# sourceMappingURL=bootstrap-select.js.map  (function(){var j=false;window.JQClass=function(){};JQClass.classes={};JQClass.extend=function extender(f){var g=this.prototype;j=true;var h=new this();j=false;for(var i in f){h[i]=typeof f[i]=='function'&&typeof g[i]=='function'?(function(d,e){return function(){var b=this._super;this._super=function(a){return g[d].apply(this,a||[])};var c=e.apply(this,arguments);this._super=b;return c}})(i,f[i]):f[i]}function JQClass(){if(!j&&this._init){this._init.apply(this,arguments)}}JQClass.prototype=h;JQClass.prototype.constructor=JQClass;JQClass.extend=extender;return JQClass}})();(function($){JQClass.classes.JQPlugin=JQClass.extend({name:'plugin',defaultOptions:{},regionalOptions:{},_getters:[],_getMarker:function(){return'is-'+this.name},_init:function(){$.extend(this.defaultOptions,(this.regionalOptions&&this.regionalOptions[''])||{});var c=camelCase(this.name);$[c]=this;$.fn[c]=function(a){var b=Array.prototype.slice.call(arguments,1);if($[c]._isNotChained(a,b)){return $[c][a].apply($[c],[this[0]].concat(b))}return this.each(function(){if(typeof a==='string'){if(a[0]==='_'||!$[c][a]){throw'Unknown method: '+a;}$[c][a].apply($[c],[this].concat(b))}else{$[c]._attach(this,a)}})}},setDefaults:function(a){$.extend(this.defaultOptions,a||{})},_isNotChained:function(a,b){if(a==='option'&&(b.length===0||(b.length===1&&typeof b[0]==='string'))){return true}return $.inArray(a,this._getters)>-1},_attach:function(a,b){a=$(a);if(a.hasClass(this._getMarker())){return}a.addClass(this._getMarker());b=$.extend({},this.defaultOptions,this._getMetadata(a),b||{});var c=$.extend({name:this.name,elem:a,options:b},this._instSettings(a,b));a.data(this.name,c);this._postAttach(a,c);this.option(a,b)},_instSettings:function(a,b){return{}},_postAttach:function(a,b){},_getMetadata:function(d){try{var f=d.data(this.name.toLowerCase())||'';f=f.replace(/'/g,'"');f=f.replace(/([a-zA-Z0-9]+):/g,function(a,b,i){var c=f.substring(0,i).match(/"/g);return(!c||c.length%2===0?'"'+b+'":':b+':')});f=$.parseJSON('{'+f+'}');for(var g in f){var h=f[g];if(typeof h==='string'&&h.match(/^new Date\((.*)\)$/)){f[g]=eval(h)}}return f}catch(e){return{}}},_getInst:function(a){return $(a).data(this.name)||{}},option:function(a,b,c){a=$(a);var d=a.data(this.name);if(!b||(typeof b==='string'&&c==null)){var e=(d||{}).options;return(e&&b?e[b]:e)}if(!a.hasClass(this._getMarker())){return}var e=b||{};if(typeof b==='string'){e={};e[b]=c}this._optionsChanged(a,d,e);$.extend(d.options,e)},_optionsChanged:function(a,b,c){},destroy:function(a){a=$(a);if(!a.hasClass(this._getMarker())){return}this._preDestroy(a,this._getInst(a));a.removeData(this.name).removeClass(this._getMarker())},_preDestroy:function(a,b){}});function camelCase(c){return c.replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})}$.JQPlugin={createPlugin:function(a,b){if(typeof a==='object'){b=a;a='JQPlugin'}a=camelCase(a);var c=camelCase(b.name);JQClass.classes[c]=JQClass.classes[a].extend(b);new JQClass.classes[c]()}}})(jQuery); (function(d){function l(a){for(var c=5381,b=0;b');setTimeout(function(){h.find('input[name="'+b+'"]').remove()},0)});a.prevAll("."+this._challengeClass+",."+this._hashClass).remove().end().before(this._generateHTML(c,g)).prevAll("div."+this._challengeClass).click(function(){d(this).hasClass(e._disabledClass)||d(this).nextAll("."+ e._getMarker()).realperson("option",{})})},enable:function(a){a=d(a);a.hasClass(this._getMarker())&&a.removeClass(this._disabledClass).prop("disabled",!1).prevAll("."+this._challengeClass).removeClass(this._disabledClass)},disable:function(a){a=d(a);a.hasClass(this._getMarker())&&a.addClass(this._disabledClass).prop("disabled",!0).prevAll("."+this._challengeClass).addClass(this._disabledClass)},_generateHTML:function(a,c){for(var b='
      ',d=0;d'+a.options.regenerate+"
      "},_preDestroy:function(a,c){a.closest("form").off("."+c.name);a.prevAll("."+this._challengeClass+",."+this._hashClass).remove()}});var f=d.salt||"#salt";delete d.salt;d(function(){var a=d(f);a.length&&(f= a.text(),a.remove());"#salt"===f&&(f="")})})(jQuery); !function(t){var a=function(){var a='
      #
      R
      G
      B
      H
      S
      B
      ',e={showEvent:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},colorScheme:"light",color:"3289c7",livePreview:!0,flat:!1,layout:"full",submit:1,submitText:"OK",height:156},l=function(a,e){var i=c(a);t(e).data("colpick").fields.eq(1).val(i.r).end().eq(2).val(i.g).end().eq(3).val(i.b).end()},r=function(a,e){t(e).data("colpick").fields.eq(4).val(Math.round(a.h)).end().eq(5).val(Math.round(a.s)).end().eq(6).val(Math.round(a.b)).end()},n=function(a,e){t(e).data("colpick").fields.eq(0).val(d(a))},s=function(a,e){t(e).data("colpick").selector.css("backgroundColor","#"+d({h:a.h,s:100,b:100})),t(e).data("colpick").selectorIndic.css({left:parseInt(t(e).data("colpick").height*a.s/100,10),top:parseInt(t(e).data("colpick").height*(100-a.b)/100,10)})},p=function(a,e){t(e).data("colpick").hue.css("top",parseInt(t(e).data("colpick").height-t(e).data("colpick").height*a.h/360,10))},h=function(a,e){t(e).data("colpick").currentColor.css("backgroundColor","#"+d(a))},u=function(a,e){t(e).data("colpick").newColor.css("backgroundColor","#"+d(a))},f=function(a){var e,h=t(this).parent().parent();this.parentNode.className.indexOf("_hex")>0?(h.data("colpick").color=e=i(L(this.value)),l(e,h.get(0)),r(e,h.get(0))):this.parentNode.className.indexOf("_hsb")>0?(h.data("colpick").color=e=X({h:parseInt(h.data("colpick").fields.eq(4).val(),10),s:parseInt(h.data("colpick").fields.eq(5).val(),10),b:parseInt(h.data("colpick").fields.eq(6).val(),10)}),l(e,h.get(0)),n(e,h.get(0))):(h.data("colpick").color=e=o(E({r:parseInt(h.data("colpick").fields.eq(1).val(),10),g:parseInt(h.data("colpick").fields.eq(2).val(),10),b:parseInt(h.data("colpick").fields.eq(3).val(),10)})),n(e,h.get(0)),r(e,h.get(0))),s(e,h.get(0)),p(e,h.get(0)),u(e,h.get(0)),h.data("colpick").onChange.apply(h.parent(),[e,d(e),c(e),h.data("colpick").el,0])},v=function(a){t(this).parent().removeClass("colpick_focus")},g=function(){t(this).parent().parent().data("colpick").fields.parent().removeClass("colpick_focus"),t(this).parent().addClass("colpick_focus")},k=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1;var e=t(this).parent().find("input").focus(),i={el:t(this).parent().addClass("colpick_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:a.pageY,field:e,val:parseInt(e.val(),10),preview:t(this).parent().parent().data("colpick").livePreview};t(document).mouseup(i,m),t(document).mousemove(i,_)},_=function(t){return t.data.field.val(Math.max(0,Math.min(t.data.max,parseInt(t.data.val-t.pageY+t.data.y,10)))),t.data.preview&&f.apply(t.data.field.get(0),[!0]),!1},m=function(a){return f.apply(a.data.field.get(0),[!0]),a.data.el.removeClass("colpick_slider").find("input").focus(),t(document).off("mouseup",m),t(document).off("mousemove",_),!1},b=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1;var e={cal:t(this).parent(),y:t(this).offset().top};t(document).on("mouseup touchend",e,y),t(document).on("mousemove touchmove",e,x);var i="touchstart"==a.type?a.originalEvent.changedTouches[0].pageY:a.pageY;return f.apply(e.cal.data("colpick").fields.eq(4).val(parseInt(360*(e.cal.data("colpick").height-(i-e.y))/e.cal.data("colpick").height,10)).get(0),[e.cal.data("colpick").livePreview]),!1},x=function(t){var a="touchmove"==t.type?t.originalEvent.changedTouches[0].pageY:t.pageY;return f.apply(t.data.cal.data("colpick").fields.eq(4).val(parseInt(360*(t.data.cal.data("colpick").height-Math.max(0,Math.min(t.data.cal.data("colpick").height,a-t.data.y)))/t.data.cal.data("colpick").height,10)).get(0),[t.data.preview]),!1},y=function(a){return l(a.data.cal.data("colpick").color,a.data.cal.get(0)),n(a.data.cal.data("colpick").color,a.data.cal.get(0)),t(document).off("mouseup touchend",y),t(document).off("mousemove touchmove",x),!1},w=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1;var e={cal:t(this).parent(),pos:t(this).offset()};e.preview=e.cal.data("colpick").livePreview,t(document).on("mouseup touchend",e,I),t(document).on("mousemove touchmove",e,M);var i;return"touchstart"==a.type?(pageX=a.originalEvent.changedTouches[0].pageX,i=a.originalEvent.changedTouches[0].pageY):(pageX=a.pageX,i=a.pageY),f.apply(e.cal.data("colpick").fields.eq(6).val(parseInt(100*(e.cal.data("colpick").height-(i-e.pos.top))/e.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*(pageX-e.pos.left)/e.cal.data("colpick").height,10)).get(0),[e.preview]),!1},M=function(t){var a;return"touchmove"==t.type?(pageX=t.originalEvent.changedTouches[0].pageX,a=t.originalEvent.changedTouches[0].pageY):(pageX=t.pageX,a=t.pageY),f.apply(t.data.cal.data("colpick").fields.eq(6).val(parseInt(100*(t.data.cal.data("colpick").height-Math.max(0,Math.min(t.data.cal.data("colpick").height,a-t.data.pos.top)))/t.data.cal.data("colpick").height,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(t.data.cal.data("colpick").height,pageX-t.data.pos.left))/t.data.cal.data("colpick").height,10)).get(0),[t.data.preview]),!1},I=function(a){return l(a.data.cal.data("colpick").color,a.data.cal.get(0)),n(a.data.cal.data("colpick").color,a.data.cal.get(0)),t(document).off("mouseup touchend",I),t(document).off("mousemove touchmove",M),!1},C=function(a){var e=t(this).parent(),i=e.data("colpick").color;e.data("colpick").origColor=i,h(i,e.get(0)),e.data("colpick").onSubmit(i,d(i),c(i),e.data("colpick").el)},T=function(a){a.stopPropagation();var e=t("#"+t(this).data("colpickId"));e.data("colpick").onBeforeShow.apply(this,[e.get(0)]);var i=t(this).offset(),o=i.top+this.offsetHeight,c=i.left,l=S(),d=e.width();c+d>l.l+l.w&&(c-=d),e.css({left:c+"px",top:o+"px"}),0!=e.data("colpick").onShow.apply(this,[e.get(0)])&&e.show(),t("html").mousedown({cal:e},q),e.mousedown(function(t){t.stopPropagation()})},q=function(a){0!=a.data.cal.data("colpick").onHide.apply(this,[a.data.cal.get(0)])&&a.data.cal.hide(),t("html").off("mousedown",q)},S=function(){var t="CSS1Compat"==document.compatMode;return{l:window.pageXOffset||(t?document.documentElement.scrollLeft:document.body.scrollLeft),w:window.innerWidth||(t?document.documentElement.clientWidth:document.body.clientWidth)}},X=function(t){return{h:Math.min(360,Math.max(0,t.h)),s:Math.min(100,Math.max(0,t.s)),b:Math.min(100,Math.max(0,t.b))}},E=function(t){return{r:Math.min(255,Math.max(0,t.r)),g:Math.min(255,Math.max(0,t.g)),b:Math.min(255,Math.max(0,t.b))}},L=function(t){var a=6-t.length;if(a>0){for(var e=[],i=0;a>i;i++)e.push("0");e.push(t),t=e.join("")}return t},P=function(){var a=t(this).parent(),e=a.data("colpick").origColor;a.data("colpick").color=e,l(e,a.get(0)),n(e,a.get(0)),r(e,a.get(0)),s(e,a.get(0)),p(e,a.get(0)),u(e,a.get(0))};return{init:function(c){if(c=t.extend({},e,c||{}),"string"==typeof c.color)c.color=i(c.color);else if(void 0!=c.color.r&&void 0!=c.color.g&&void 0!=c.color.b)c.color=o(c.color);else{if(void 0==c.color.h||void 0==c.color.s||void 0==c.color.b)return this;c.color=X(c.color)}return this.each(function(){if(!t(this).data("colpickId")){var e=t.extend({},c);e.origColor=c.color;var i="collorpicker_"+parseInt(1e3*Math.random());t(this).data("colpickId",i);var o=t(a).attr("id",i);o.addClass("colpick_"+e.layout+(e.submit?"":" colpick_"+e.layout+"_ns")),"light"!=e.colorScheme&&o.addClass("colpick_"+e.colorScheme),o.find("div.colpick_submit").html(e.submitText).click(C),e.fields=o.find("input").change(f).blur(v).focus(g),o.find("div.colpick_field_arrs").mousedown(k).end().find("div.colpick_current_color").click(P),e.selector=o.find("div.colpick_color").on("mousedown touchstart",w),e.selectorIndic=e.selector.find("div.colpick_selector_outer"),e.el=this,e.hue=o.find("div.colpick_hue_arrs"),huebar=e.hue.parent();var d=navigator.userAgent.toLowerCase(),_="Microsoft Internet Explorer"===navigator.appName,m=_?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,x=_&&10>m,y=["#ff0000","#ff0080","#ff00ff","#8000ff","#0000ff","#0080ff","#00ffff","#00ff80","#00ff00","#80ff00","#ffff00","#ff8000","#ff0000"];if(x){var M,I;for(M=0;11>=M;M++)I=t("
      ").attr("style","height:8.333333%; filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr="+y[M]+", endColorstr="+y[M+1]+'); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='+y[M]+", endColorstr="+y[M+1]+')";'),huebar.append(I)}else stopList=y.join(","),huebar.attr("style","background:-webkit-linear-gradient(top,"+stopList+"); background: -o-linear-gradient(top,"+stopList+"); background: -ms-linear-gradient(top,"+stopList+"); background:-moz-linear-gradient(top,"+stopList+"); -webkit-linear-gradient(top,"+stopList+"); background:linear-gradient(to bottom,"+stopList+"); ");o.find("div.colpick_hue").on("mousedown touchstart",b),e.newColor=o.find("div.colpick_new_color"),e.currentColor=o.find("div.colpick_current_color"),o.data("colpick",e),l(e.color,o.get(0)),r(e.color,o.get(0)),n(e.color,o.get(0)),p(e.color,o.get(0)),s(e.color,o.get(0)),h(e.color,o.get(0)),u(e.color,o.get(0)),e.flat?(o.appendTo(this).show(),o.css({position:"relative",display:"block"})):(o.appendTo(document.body),t(this).on(e.showEvent,T),o.css({position:"absolute"}))}})},showPicker:function(){return this.each(function(){t(this).data("colpickId")&&T.apply(this)})},hidePicker:function(){return this.each(function(){t(this).data("colpickId")&&t("#"+t(this).data("colpickId")).hide()})},setColor:function(a,e){if(e="undefined"==typeof e?1:e,"string"==typeof a)a=i(a);else if(void 0!=a.r&&void 0!=a.g&&void 0!=a.b)a=o(a);else{if(void 0==a.h||void 0==a.s||void 0==a.b)return this;a=X(a)}return this.each(function(){if(t(this).data("colpickId")){var i=t("#"+t(this).data("colpickId"));i.data("colpick").color=a,i.data("colpick").origColor=a,l(a,i.get(0)),r(a,i.get(0)),n(a,i.get(0)),p(a,i.get(0)),s(a,i.get(0)),u(a,i.get(0)),i.data("colpick").onChange.apply(i.parent(),[a,d(a),c(a),i.data("colpick").el,1]),e&&h(a,i.get(0))}})}}}(),e=function(t){var t=parseInt(t.indexOf("#")>-1?t.substring(1):t,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},i=function(t){return o(e(t))},o=function(t){var a={h:0,s:0,b:0},e=Math.min(t.r,t.g,t.b),i=Math.max(t.r,t.g,t.b),o=i-e;return a.b=i,a.s=0!=i?255*o/i:0,0!=a.s?t.r==i?a.h=(t.g-t.b)/o:t.g==i?a.h=2+(t.b-t.r)/o:a.h=4+(t.r-t.g)/o:a.h=-1,a.h*=60,a.h<0&&(a.h+=360),a.s*=100/255,a.b*=100/255,a},c=function(t){var a={},e=t.h,i=255*t.s/100,o=255*t.b/100;if(0==i)a.r=a.g=a.b=o;else{var c=o,l=(255-i)*o/255,d=(c-l)*(e%60)/60;360==e&&(e=0),60>e?(a.r=c,a.b=l,a.g=l+d):120>e?(a.g=c,a.b=l,a.r=c-d):180>e?(a.g=c,a.r=l,a.b=l+d):240>e?(a.b=c,a.r=l,a.g=c-d):300>e?(a.b=c,a.g=l,a.r=l+d):360>e?(a.r=c,a.g=l,a.b=c-d):(a.r=0,a.g=0,a.b=0)}return{r:Math.round(a.r),g:Math.round(a.g),b:Math.round(a.b)}},l=function(a){var e=[a.r.toString(16),a.g.toString(16),a.b.toString(16)];return t.each(e,function(t,a){1==a.length&&(e[t]="0"+a)}),e.join("")},d=function(t){return l(c(t))};t.fn.extend({colpick:a.init,colpickHide:a.hidePicker,colpickShow:a.showPicker,colpickSetColor:a.setColor}),t.extend({colpick:{rgbToHex:l,rgbToHsb:o,hsbToHex:d,hsbToRgb:c,hexToHsb:i,hexToRgb:e}})}(jQuery); !function(e){e.fn.dependentFields=function(a){var s=e.extend({wrapperClass:"hidden-wrapper",showClass:"on",hideClass:"off",parentData:"data-parent",showValuesData:"data-show-values",inverseData:"data-inverse"},a);e(this).each(function(){var a=e(this).attr(s.parentData).replace("[]",""),t=e(this).attr(s.showValuesData),i=e(this).attr(s.inverseData),h=this;t=t.replace("\\,","{comma}"),t=t.split(/,\s*/);for(var n=0;n0,e('*[name^="'+a+'"]:not(.'+a+"-child)").on("change ifChanged changed.bs.select",function(){var r,l=e(this).is(":radio"),d=e(this).is(":checkbox");if(i!==!0){if(l?r=e("input[name^="+a+"]:checked").val():d?(r=[],e("input[name^="+a+"]:checked").each(function(){r.push(e(this).val())}),r.length<1&&(r=void 0)):r=e(this).val(),"object"==typeof r&null!==r)for(n=r.length-1;n>=0;n--)e.inArray(r[n],t)>-1&&(r=r[n],n=-1)}else r=void 0,l?e.inArray(e("input[name^="+a+"]:checked").val(),t)<0&&(r=e("input[name^="+a+"]:checked").val()):d?(r=[],e("input[name^="+a+"]:checked").each(function(){e.inArray(e(this).val(),t)<0&&r.push(e(this).val())}),r.length<1&&(r=void 0)):e.inArray(e(this).val(),t)<0&&(r=e(this).val()),"object"==typeof r&&(r=r[0]);e.inArray(r,t)>-1?i!==!0&&(e(h).removeClass(s.hideClass).addClass(s.showClass),e(h).children().not(".hidden-wrapper").prop("disabled",!1)):i===!0&&void 0!==r?(e(h).removeClass(s.hideClass).addClass(s.showClass),e(h).children().not(".hidden-wrapper").prop("disabled",!1)):(e(h).removeClass(s.showClass).addClass(s.hideClass),e(h).children().not(".hidden-wrapper").prop("disabled",!0))});var r=[],l=e('*[name^="'+a+'"]');l.each(function(){-1===e.inArray(a,r)&&(e(this).next(".iCheck-helper").length>0&&e(this).is(":checked")?(e(this).trigger("ifChanged"),r.push(a)):e(this).parent(".bootstrap-select").length>0&&""!==e(this).val()?(e(this).trigger("changed.bs.select"),r.push(a)):(e(this).is(":checked")||""!==e(this).val()&&!e(this).is(":checkbox")&&!e(this).is(":radio"))&&(e(this).trigger("change"),r.push(a)))})})}}(jQuery); !function($){"use strict";$.fn.fileuploader=function(q){return this.each(function(t,r){var s=$(r),p=null,o=null,l=null,sl=[],n=$.extend(!0,{},$.fn.fileuploader.defaults,q),f={init:function(){return s.closest(".fileuploader").length||s.wrap('
      '),p=s.closest(".fileuploader"),f.set("attrOpts"),f.isSupported()?(!n.beforeRender||!$.isFunction(n.beforeRender)||!1!==n.beforeRender(p,s))&&(f.redesign(),n.files&&f.files.append(n.files),f.rendered=!0,n.afterRender&&$.isFunction(n.afterRender)&&n.afterRender(l,p,o,s),void(f.disabled||f.bindUnbindEvents(!0))):(n.onSupportError&&$.isFunction(n.onSupportError)&&n.onSupportError(p,s),!1)},bindUnbindEvents:function(e){e&&f.bindUnbindEvents(!1),s[e?"on":"off"](f._assets.getAllEvents(),f.onEvent),n.changeInput&&o!==s&&o[e?"on":"off"]("click",f.clickHandler),f.isUploadMode()&&n.dragDrop&&n.dragDrop.container.length&&(n.dragDrop.container[e?"on":"off"]("drag dragstart dragend dragover dragenter dragleave drop",function(e){e.preventDefault()}),n.dragDrop.container[e?"on":"off"]("drop",f.dragDrop.onDrop),n.dragDrop.container[e?"on":"off"]("dragover",f.dragDrop.onDragEnter),n.dragDrop.container[e?"on":"off"]("dragleave",f.dragDrop.onDragLeave)),f.isUploadMode()&&n.clipboardPaste&&$(window)[e?"on":"off"]("paste",f.clipboard.paste),n.sorter&&n.thumbnails&&n.thumbnails._selectors.sorter&&f.sorter[e?"init":"destroy"](),s.closest("form")[e?"on":"off"]("reset",f.reset)},redesign:function(){if(o=s,n.theme&&p.addClass("fileuploader-theme-"+n.theme),n.changeInput){switch((typeof n.changeInput).toLowerCase()){case"boolean":o=$('
      '+f._assets.textParse(n.captions.feedback)+'
      '+f._assets.textParse(n.captions.button)+"
      ");break;case"string":" "!=n.changeInput&&(o=$(f._assets.textParse(n.changeInput,n)));break;case"object":o=$(n.changeInput);break;case"function":o=$(n.changeInput(s,p,n,f._assets.textParse))}s.after(o),s.css({position:"absolute","z-index":"-9999",height:"0",width:"0",padding:"0",margin:"0","line-height":"0",outline:"0",border:"0",opacity:"0"})}n.thumbnails&&f.thumbnails.create(),n.dragDrop&&(n.dragDrop="object"!=typeof n.dragDrop?{container:null}:n.dragDrop,n.dragDrop.container=n.dragDrop.container?$(n.dragDrop.container):o)},clickHandler:function(e){e.preventDefault(),f.clipboard._timer?f.clipboard.clean():s.click()},onEvent:function(e){switch(e.type){case"focus":p&&p.addClass("fileuploader-focused");break;case"blur":p&&p.removeClass("fileuploader-focused");break;case"change":f.onChange.call(this)}n.listeners&&$.isFunction(n.listeners[e.type])&&n.listeners[e.type].call(s,p)},set:function(e,t){switch(e){case"attrOpts":for(var r=["limit","maxSize","fileMaxSize","extensions","changeInput","theme","addMore","listInput","files"],i=0;i-1?"true"==s.attr(a):s.attr(a);break;case"extensions":n[r[i]]=s.attr(a).replace(/ /g,"").split(",");break;case"files":n[r[i]]=JSON.parse(s.attr(a));break;default:n[r[i]]=s.attr(a)}s.removeAttr(a)}null==s.attr("disabled")&&null==s.attr("readonly")&&0!==n.limit||(f.disabled=!0),(!n.limit||n.limit&&n.limit>=2)&&(s.attr("multiple","multiple"),n.inputNameBrackets&&"[]"!=s.attr("name").slice(-2)&&s.attr("name",s.attr("name")+"[]")),!0===n.listInput&&(n.listInput=$('').insertBefore(s)),"string"==typeof n.listInput&&0==$(n.listInput).length&&(n.listInput=$('').insertBefore(s)),f.set("disabled",f.disabled),!n.fileMaxSize&&n.maxSize&&(n.fileMaxSize=n.maxSize);break;case"disabled":f.disabled=t,p[f.disabled?"addClass":"removeClass"]("fileuploader-disabled"),s[f.disabled?"attr":"removeAttr"]("disabled","disabled"),f.rendered&&f.bindUnbindEvents(!t);break;case"feedback":t||(t=f._assets.textParse(f._itFl.length>0?n.captions.feedback2:n.captions.feedback,{length:f._itFl.length})),$(!o.is(":file"))&&o.find(".fileuploader-input-caption span").html(t);break;case"input":l=f._assets.copyAllAttributes($(''),s,!0);f.bindUnbindEvents(!1),s.after(s=l).remove(),f.bindUnbindEvents(!0);break;case"prevInput":sl.length>0&&(f.bindUnbindEvents(!1),sl[t].remove(),sl.splice(t,1),s=sl[sl.length-1],f.bindUnbindEvents(!0));break;case"nextInput":var l=f._assets.copyAllAttributes($(''),s);f.bindUnbindEvents(!1),sl.length>0&&0==sl[sl.length-1].get(0).files.length?s=sl[sl.length-1]:(-1==sl.indexOf(s)&&sl.push(s),sl.push(l),s.after(s=l)),f.bindUnbindEvents(!0);break;case"listInput":n.listInput&&n.listInput.val(f.files.list(!0,null,!1,t))}},onChange:function(e,t){var r=s.get(0).files;if(t){if(!t.length)return f.set("input",""),f.files.clear(),!1;r=t}if(f.clipboard._timer&&f.clipboard.clean(),!f.isDefaultMode()||(f.reset(),0!=r.length)){if(n.beforeSelect&&$.isFunction(n.beforeSelect)&&0==n.beforeSelect(r,l,p,o,s))return!1;for(var i=0,a=0;a0&&f.set("input",""),f.set("feedback",null),f.isAddMoreMode()&&i>0&&f.set("nextInput"),f.set("listInput",null),n.afterSelect&&$.isFunction(n.afterSelect)&&n.afterSelect(l,p,o,s)}},thumbnails:{create:function(){null!=n.thumbnails.beforeShow&&$.isFunction(n.thumbnails.beforeShow)&&n.thumbnails.beforeShow(p,o,s);var e=$(f._assets.textParse(n.thumbnails.box)).appendTo(n.thumbnails.boxAppendTo?n.thumbnails.boxAppendTo:p);l=e.is(n.thumbnails._selectors.list)?e:e.find(n.thumbnails._selectors.list),n.thumbnails._selectors.popup_open&&l.on("click",n.thumbnails._selectors.popup_open,function(e){e.preventDefault();var t=$(this).closest(n.thumbnails._selectors.item),o=f.files.find(t);o&&o.html.hasClass("file-has-popup")&&f.thumbnails.popup(o)}),f.isUploadMode()&&n.thumbnails._selectors.start&&l.on("click",n.thumbnails._selectors.start,function(e){if(e.preventDefault(),f.locked)return!1;var t=$(this).closest(n.thumbnails._selectors.item),o=f.files.find(t);o&&f.upload.send(o,!0)}),f.isUploadMode()&&n.thumbnails._selectors.retry&&l.on("click",n.thumbnails._selectors.retry,function(e){if(e.preventDefault(),f.locked)return!1;var t=$(this).closest(n.thumbnails._selectors.item),o=f.files.find(t);o&&f.upload.retry(o)}),n.thumbnails._selectors.remove&&l.on("click",n.thumbnails._selectors.remove,function(e){if(e.preventDefault(),f.locked)return!1;var t=$(this).closest(n.thumbnails._selectors.item),o=f.files.find(t),r=function(e){f.files.remove(o)};o&&(o.upload&&"successful"!=o.upload.status?f.upload.cancel(o):n.thumbnails.removeConfirmation?n.dialogs.confirm(f._assets.textParse(n.captions.removeConfirmation,o),r):r())})},clear:function(){l&&l.html("")},item:function(e){e.icon=f.thumbnails.generateFileIcon(e.format,e.extension),e.image='
      ',e.progressBar=f.isUploadMode()?'
      ':"",e.html=$(f._assets.textParse(e.appended&&n.thumbnails.item2?n.thumbnails.item2:n.thumbnails.item,e)),e.progressBar=e.html.find(".fileuploader-progressbar"),e.html.addClass("file-type-"+(e.format?e.format:"no")+" file-ext-"+(e.extension?e.extension:"no")),e.html[n.thumbnails.itemPrepend?"prependTo":"appendTo"](l),f.thumbnails.renderThumbnail(e),e.renderThumbnail=function(t){f.thumbnails.renderThumbnail(e,!0,t)},e.popup={open:function(){f.thumbnails.popup(e)}},null!=n.thumbnails.onItemShow&&$.isFunction(n.thumbnails.onItemShow)&&n.thumbnails.onItemShow(e,l,p,o,s)},generateFileIcon:function(e,t){var o='
      '+(t||"")+"
      ",n=f._assets.textToColor(t);return n&&(f._assets.isBrightColor(n)&&(o=o.replace("${class}"," is-bright-color")),o=o.replace("${style}","background-color: "+n)),o.replace("${style}","").replace("${class}","")},renderThumbnail:function(e,t,r){var i=e.html.find(".fileuploader-item-image"),a=e.data&&e.data.readerSkip,d=function(t){var r=$(t);i.removeClass("fileuploader-no-thumbnail fileuploader-loading").html(r),r.is("img")&&r.attr("draggable","false").on("load error",function(t){"error"==t.type&&u(!0),c(),null!=n.thumbnails.onImageLoaded&&$.isFunction(n.thumbnails.onImageLoaded)&&n.thumbnails.onImageLoaded(e,l,p,o,s)}),r.is("canvas")&&null!=n.thumbnails.onImageLoaded&&$.isFunction(n.thumbnails.onImageLoaded)&&n.thumbnails.onImageLoaded(e,l,p,o,s)},u=function(t){i.addClass("fileuploader-no-thumbnail"),i.removeClass("fileuploader-loading").html(e.icon),t&&null!=n.thumbnails.onImageLoaded&&$.isFunction(n.thumbnails.onImageLoaded)&&n.thumbnails.onImageLoaded(e,l,p,o,s)},c=function(){var t=0;if(e&&f._pfrL.indexOf(e)>-1)for(f._pfrL.splice(f._pfrL.indexOf(e),1);t-1){f.thumbnails.renderThumbnail(f._pfrL[t],!0);break}f._pfrL.splice(t,1),t++}};if(i.length){if(e.image=i,["image","video","audio","astext"].indexOf(e.format)>-1&&f.isFileReaderSupported()&&!a&&(e.appended||n.thumbnails.startImageRenderer||t)){if(n.thumbnails.synchronImages&&(-1!=f._pfrL.indexOf(e)||t||f._pfrL.push(e),f._pfrL.length>1&&!t))return;var h=function(t,o){var r=t.nodeName&&"img"==t.nodeName.toLocaleLowerCase(),a=r?t.src:t;if(n.thumbnails.canvasImage){var l=document.createElement("canvas"),s=r?t:new Image,p=function(){f.editor.resize(s,l,n.thumbnails.canvasImage.width?n.thumbnails.canvasImage.width:i.width(),n.thumbnails.canvasImage.height?n.thumbnails.canvasImage.height:i.height(),!1,!0),f._assets.isBlankCanvas(l)?u():d(l),c()},h=function(e){u(!0),c(),s=null};if("image"==e.format&&o&&e.reader.node)return s=e.reader.node,p();if(!a)return h();if(r)return p.call(t);s.onload=p,s.onerror=h,e.data&&e.data.readerCrossOrigin&&s.setAttribute("crossOrigin",e.data.readerCrossOrigin),s.src=a}else d(r?t:'')};return r?h(r):f.files.read(e,function(){var t="image"==e.format||"video"==e.format;e.reader.node&&n.thumbnails.popup&&e.html.addClass("file-has-popup"),e.reader.node&&t?h(e.reader.frame||e.reader.src,!0):(u(t),c())})}u()}else c()},popup:function(e){if(n.thumbnails.popup&&n.thumbnails._selectors.popup){p.find(n.thumbnails._selectors.popup).length&&$.each(f._itFl,function(e,t){t.popup&&t.popup.close&&t.popup.close()});var t=e.popup.html||$(f._assets.textParse(n.thumbnails.popup.template,e)),r=e.popup.html!==t,i=function(){var t=e.popup.html.find(".fileuploader-popup-preview"),o=t.find(".node"),n=t.find(".tools"),r=o.find("> *"),i=t.height()-n.outerHeight(!0);o.css({height:"100%"}),r&&i>r.outerHeight()&&(i=r.outerHeight()),o.css({height:i})},a=function(t){27==(t.which||t.keyCode)&&e.popup&&e.popup.close&&e.popup.close()};t.show().appendTo(p),e.popup.html=t,e.popup.close=function(){e.reader.node&&e.reader.node.pause&&e.reader.node.pause(),$(window).off("keyup",a),$(window).off("resize",i),e.popup.editor&&e.popup.editor.cropper&&e.popup.editor.cropper.hide(),e.popup.html&&n.thumbnails.popup.onHide&&$.isFunction(n.thumbnails.popup.onHide)?n.thumbnails.popup.onHide(e,l,p,o,s):e.popup.html&&e.popup.html.remove(),delete e.popup.close},e.reader.node&&(r&&t.find(".fileuploader-popup-preview .node").html(e.reader.node),e.reader.node.controls=!0,e.reader.node.currentTime=0,e.reader.node.play&&e.reader.node.play()),$(window).on("keyup",a),$(window).on("resize",i),i.call(),setTimeout(function(){i.call()},10),e.editor&&e.popup.editor&&e.popup.editor.hasChanges?(e.popup.editor&&e.popup.editor.rotation&&f.editor.rotate(e,e.editor.rotation||0,!0),e.popup.editor&&e.popup.editor.cropper&&(e.popup.editor.cropper.hide(!0),setTimeout(function(){f.editor.crop(e,e.editor.crop?$.extend({},e.editor.crop):e.popup.editor.cropper.setDefaultData())},100))):e.popup.editor={},n.thumbnails.popup.onShow&&$.isFunction(n.thumbnails.popup.onShow)&&n.thumbnails.popup.onShow(e,l,p,o,s)}}},editor:{rotate:function(e,t,o){if(!(e.popup&&void 0!==e.popup.html)){var n=e.editor.rotation||0;return e.editor.rotation=t||n+90}if(!e.popup.editor.isAnimating){e.popup.editor.isAnimating=!0;var r=e.popup.html.find(".node"),i=r.find("> img"),a={rotation:n=e.popup.editor.rotation||0,scale:e.popup.editor.scale||1};e.popup.editor.cropper&&e.popup.editor.cropper.$template.hide(),e.popup.editor.rotation=o?t:n+90,e.popup.editor.scale=(r.height()/i[[90,270].indexOf(e.popup.editor.rotation)>-1?"width":"height"]()).toFixed(3),i.height()*e.popup.editor.scale>r.width()&&[90,270].indexOf(e.popup.editor.rotation)>-1&&(e.popup.editor.scale=r.width()/i.height()),e.popup.editor.scale>1&&(e.popup.editor.scale=1),$(a).animate({rotation:e.popup.editor.rotation,scale:e.popup.editor.scale},{duration:o?1:300,easing:"swing",step:function(e,t){var o=i.css("-webkit-transform")||i.css("-moz-transform")||i.css("transform")||"none",n=0,r=1,a=t.prop;if("none"!==o){var l=o.split("(")[1].split(")")[0].split(","),s=l[0],p=l[1];n="rotation"==a?e:Math.round(Math.atan2(p,s)*(180/Math.PI)),r="scale"==a?e:Math.round(10*Math.sqrt(s*s+p*p))/10}i.css({"-webkit-transform":"rotate("+n+"deg) scale("+r+")","-moz-transform":"rotate("+n+"deg) scale("+r+")",transform:"rotate("+n+"deg) scale("+r+")"})},always:function(){delete e.popup.editor.isAnimating,e.popup.editor.cropper&&!o&&(e.popup.editor.cropper.setDefaultData(),e.popup.editor.cropper.init("rotation"))}}),e.popup.editor.rotation>=360&&(e.popup.editor.rotation=0),e.popup.editor.rotation!=e.editor.rotation&&(e.popup.editor.hasChanges=!0)}},crop:function(e,t){if(!(e.popup&&void 0!==e.popup.html))return e.editor.crop=t||e.editor.crop;if(e.popup.editor.cropper)t&&(e.popup.editor.cropper.crop=t),e.popup.editor.cropper.init(t);else{var o=e.popup.html.find(".node > img"),r=$('
      '),i=r.find(".fileuploader-cropper-area");e.popup.editor.cropper={$imageEl:o,$template:r,$editor:i,isCropping:!1,crop:t||null,init:function(t){var o=e.popup.editor.cropper,i=o.$imageEl.position(),a=o.$imageEl[0].getBoundingClientRect().width,l=o.$imageEl[0].getBoundingClientRect().height,s=e.popup.editor.rotation&&[90,270].indexOf(e.popup.editor.rotation)>-1?e.popup.editor.scale:1;if(o.hide(),o.crop||o.setDefaultData(),0==a||0==l)return o.hide(!0);o.isCropping||(o.$imageEl.clone().appendTo(o.$template.find(".area-image")),o.$imageEl.parent().append(r)),o.$template.hide().css({left:i.left,top:i.top,width:a,height:l}).fadeIn(150),o.$editor.hide(),clearTimeout(o._editorAnimationTimeout),o._editorAnimationTimeout=setTimeout(function(){if(delete o._editorAnimationTimeout,o.$editor.fadeIn(250),e.editor.crop&&$.isPlainObject(t)&&(o.resize(),o.crop.left=o.crop.left*o.crop.cfWidth*s,o.crop.width=o.crop.width*o.crop.cfWidth*s,o.crop.top=o.crop.top*o.crop.cfHeight*s,o.crop.height=o.crop.height*o.crop.cfHeight*s),(!e.editor.crop||"rotation"==t)&&n.editor.cropper&&n.editor.cropper.ratio&&"resize"!=t){var r=n.editor.cropper.ratio,i=f._assets.ratioToPx(o.crop.width,o.crop.height,r);i&&(o.crop.width=Math.min(o.crop.width,i[0]),o.crop.left=(o.$template.width()-o.crop.width)/2,o.crop.height=Math.min(o.crop.height,i[1]),o.crop.top=(o.$template.height()-o.crop.height)/2)}o.drawPlaceHolder(o.crop)},400),o.isCropping||o.$template.on("drop dragend dragleave dragover dragenter dragstart touchstart touchmove touchend touchcancel",function(e){e.preventDefault()}),n.editor.cropper&&n.editor.cropper.showGrid&&o.$editor.addClass("has-grid"),o.$imageEl.attr("draggable","false"),o.$template.on("mousedown touchstart",o.mousedown),$(window).on("resize",o.resize),o.isCropping=!0,e.popup.editor.hasChanges=!0},setDefaultData:function(){var t=e.popup.editor.cropper,o=t.$imageEl,n=o.width(),r=o.height(),i=e.popup.editor.rotation&&[90,270].indexOf(e.popup.editor.rotation)>-1,a=e.popup.editor.scale||1;return t.crop={left:0,top:0,width:i?r*a:n,height:i?n*a:r,cfWidth:n/t.$imageEl.prop("naturalWidth"),cfHeight:r/t.$imageEl.prop("naturalHeight")},null},hide:function(t){var o=e.popup.editor.cropper;t&&(o.$template.hide(),o.$editor.hide()),o.$imageEl.attr("draggable",""),o.$template.off("mousedown touchstart",o.mousedown),$(window).off("resize",o.resize)},resize:function(t){var o=e.popup.editor.cropper,n=o.$imageEl;n.width()>0&&(t?(o.$template.hide(),clearTimeout(o._resizeTimeout),o._resizeTimeout=setTimeout(function(){delete o._resizeTimeout;var e=n.width()/n.prop("naturalWidth"),t=n.height()/n.prop("naturalHeight");o.crop.left=o.crop.left/o.crop.cfWidth*e,o.crop.width=o.crop.width/o.crop.cfWidth*e,o.crop.top=o.crop.top/o.crop.cfHeight*t,o.crop.height=o.crop.height/o.crop.cfHeight*t,o.crop.cfWidth=e,o.crop.cfHeight=t,o.init("resize")},400)):(o.crop.cfWidth=n.width()/n.prop("naturalWidth"),o.crop.cfHeight=n.height()/n.prop("naturalHeight")))},drawPlaceHolder:function(t){var o=e.popup.editor.cropper,n=e.popup.editor.rotation||0,r=e.popup.editor.scale||1,i=[0,0];t&&(t=$.extend({},t),n&&(i=[180==n||270==n?-100:0,90==n||180==n?-100:0]),o.$editor.css(t),o.$editor.find(".area-image img").removeAttr("style").css({width:o.$imageEl.width(),height:o.$imageEl.height(),left:-1*o.$editor.position().left,top:-1*o.$editor.position().top,"-webkit-transform":"rotate("+n+"deg) scale("+r+") translateX("+i[0]+"%) translateY("+i[1]+"%)","-moz-transform":"rotate("+n+"deg) scale("+r+") translateX("+i[0]+"%) translateY("+i[1]+"%)",transform:"rotate("+n+"deg) scale("+r+") translateX("+i[0]+"%) translateY("+i[1]+"%)"}))},mousedown:function(t){var o=t.originalEvent.touches&&t.originalEvent.touches[0]?"touchstart":"mousedown",n=$(t.target),r=e.popup.editor.cropper,i={x:("mousedown"==o?t.pageX:t.originalEvent.touches[0].pageX)-r.$template.offset().left,y:("mousedown"==o?t.pageY:t.originalEvent.touches[0].pageY)-r.$template.offset().top},a=function(){r.pointData={el:n,x:i.x,y:i.y,xEditor:i.x-r.crop.left,yEditor:i.y-r.crop.top,left:r.crop.left,top:r.crop.top,width:r.crop.width,height:r.crop.height},n.is(".area-move")&&(r.isMoving=!0),n.is(".point")&&(r.isResizing=!0),(r.isMoving||r.isResizing)&&(r.$editor.addClass("moving"),$("body").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),$(window).on("mousemove touchmove",r.mousemove))};"mousedown"==o&&a(),"touchstart"==o&&(r.isTouchLongPress=!0,setTimeout(function(){r.isTouchLongPress&&(delete r.isTouchLongPress,a())},500)),$(window).on("mouseup touchend",r.mouseup)},mousemove:function(t){var o=t.originalEvent.touches&&t.originalEvent.touches[0]?"touchstart":"mousedown",r=($(t.target),e.popup.editor.cropper),i={x:("mousedown"==o?t.pageX:t.originalEvent.touches[0].pageX)-r.$template.offset().left,y:("mousedown"==o?t.pageY:t.originalEvent.touches[0].pageY)-r.$template.offset().top};if(r.isMoving){var a=i.x-r.pointData.xEditor,l=i.y-r.pointData.yEditor;a+r.crop.width>r.$template.width()&&(a=r.$template.width()-r.crop.width),a<0&&(a=0),l+r.crop.height>r.$template.height()&&(l=r.$template.height()-r.crop.height),l<0&&(l=0),r.crop.left=a,r.crop.top=l}if(r.isResizing){var s,p=r.pointData.el.attr("class").substr("point point-".length),d=r.crop.left+r.crop.width,u=r.crop.top+r.crop.height,c=(n.editor.cropper&&n.editor.cropper.minWidth||0)*r.crop.cfWidth,h=(n.editor.cropper&&n.editor.cropper.minHeight||0)*r.crop.cfHeight,m=n.editor.cropper?n.editor.cropper.ratio:null;if(c>r.$template.width()&&(c=r.$template.width()),h>r.$template.height()&&(h=r.$template.height()),("a"==p||"b"==p||"c"==p)&&!s&&(r.crop.top=i.y,r.crop.top<0&&(r.crop.top=0),r.crop.height=u-r.crop.top,r.crop.top>r.crop.top+r.crop.height&&(r.crop.top=u,r.crop.height=0),r.crop.heightr.$template.width()))){g=r.$template.width()-r.crop.left;r.crop.width=g,r.crop.height=g/s[2]*s[3],r.crop.top=u-r.crop.height}if(("e"==p||"f"==p||"g"==p)&&!s&&(r.crop.height=i.y-r.crop.top,r.crop.height+r.crop.top>r.$template.height()&&(r.crop.height=r.$template.height()-r.crop.top),r.crop.heightr.$template.width()))){var g=r.$template.width()-r.crop.left;r.crop.width=g,r.crop.height=g/s[2]*s[3]}if(("c"==p||"d"==p||"e"==p)&&!s&&(r.crop.width=i.x-r.crop.left,r.crop.width+r.crop.left>r.$template.width()&&(r.crop.width=r.$template.width()-r.crop.left),r.crop.widthr.$template.height()))){v=r.$template.height()-r.crop.top;r.crop.height=v,r.crop.width=v/s[3]*s[2]}if(("a"==p||"g"==p||"h"==p)&&!s&&(r.crop.left=i.x,r.crop.left>r.$template.width()&&(r.crop.left=r.$template.width()),r.crop.left<0&&(r.crop.left=0),r.crop.width=d-r.crop.left,r.crop.left>r.crop.left+r.crop.width&&(r.crop.left=d,r.crop.width=0),r.crop.widthr.$template.height()))){var v=r.$template.height()-r.crop.top;r.crop.height=v,r.crop.width=v/s[3]*s[2],r.crop.left=d-r.crop.width}}r.drawPlaceHolder(r.crop)},mouseup:function(t){var o=e.popup.editor.cropper;0!=o.$editor.width()&&0!=o.$editor.height()||o.init(o.setDefaultData()),delete o.isTouchLongPress,delete o.isMoving,delete o.isResizing,o.$editor.removeClass("moving"),$("body").css({"-webkit-user-select":"","-moz-user-select":"","-ms-user-select":"","user-select":""}),$(window).off("mousemove touchmove",o.mousemove),$(window).off("mouseup touchend",o.mouseup)}},e.popup.editor.cropper.init()}},resize:function(e,t,o,n,r,i){var a=t.getContext("2d"),o=!o&&n?n*e.width/e.height:o,n=!n&&o?o*e.height/e.width:n,l=e.width/e.height,s=l>=1?o:n*l,p=l<1?n:o/l;i&&s2;){var g=m+2,v=e.width/m,b=e.height/m;v>f.width&&(v=f.width),b>f.height&&(b=f.height),h.drawImage(f,0,0,v,b,0,0,e.width/g,e.height/g),m=g,d--}var v=e.width/m,b=e.height/m;v>f.width&&(v=f.width),b>f.height&&(b=f.height),a.drawImage(f,0,0,v,b,0,0,s,p),f=h=null}a=null},save:function(e,t,r,i,a){var d=e.popup&&void 0!==e.popup.html;if(d){if(!e.popup.editor.hasChanges)return;var u=e.popup.editor.scale||1;e.editor.rotation=e.popup.editor.rotation||0,e.popup.editor.cropper&&(e.editor.crop=e.popup.editor.cropper.crop,e.editor.crop.width=e.editor.crop.width/e.popup.editor.cropper.crop.cfWidth/u,e.editor.crop.left=e.editor.crop.left/e.popup.editor.cropper.crop.cfWidth/u,e.editor.crop.height=e.editor.crop.height/e.popup.editor.cropper.crop.cfHeight/u,e.editor.crop.top=e.editor.crop.top/e.popup.editor.cropper.crop.cfHeight/u)}var c=document.createElement("canvas"),h=c.getContext("2d"),m=e.reader.node,g=[0,180];if(c.width=m.naturalWidth,c.height=m.naturalHeight,h.drawImage(m,0,0),void 0!==e.editor.rotation){c.width=g.indexOf(e.editor.rotation)>-1?m.naturalWidth:m.naturalHeight,c.height=g.indexOf(e.editor.rotation)>-1?m.naturalHeight:m.naturalWidth;var v=e.editor.rotation*Math.PI/180,b=.5*c.width,w=.5*c.height;h.clearRect(0,0,c.width,c.height),h.translate(b,w),h.rotate(v),h.translate(.5*-m.naturalWidth,.5*-m.naturalHeight),h.drawImage(m,0,0),h.setTransform(1,0,0,1,0,0)}if(e.editor.crop){var x=h.getImageData(e.editor.crop.left,e.editor.crop.top,e.editor.crop.width,e.editor.crop.height);c.width=e.editor.crop.width,c.height=e.editor.crop.height,h.putImageData(x,0,0)}var $=r||e.type||"image/jpeg",_=n.editor.quality||90,y=c.toDataURL($,_/100),k=function(r,u){var c=t?f._assets.dataURItoBlob(r,$):r;d&&!a&&f.thumbnails.renderThumbnail(e,!0,u||r),i&&i(c,e,l,p,o,s),null!=n.editor.onSave&&"function"==typeof n.editor.onSave&&n.editor.onSave(c,e,l,p,o,s),f.set("listInput",null)};if(n.editor.maxWidth||n.editor.maxHeight){var F=new Image;F.src=y,F.onload=function(){var e=document.createElement("canvas");f.editor.resize(F,e,n.editor.maxWidth,n.editor.maxHeight,!0,!1),y=e.toDataURL($,_/100),c=h=e=null,k(y,F)}}else c=h=null,k(y)}},sorter:{init:function(){p.on("mousedown touchstart",n.thumbnails._selectors.sorter,f.sorter.mousedown)},destroy:function(){p.off("mousedown touchstart",n.thumbnails._selectors.sorter,f.sorter.mousedown)},prevent:function(e){if(!0===e)return"click drop dragend dragleave dragover dragenter dragstart touchstart touchmove touchend touchcancel";e.preventDefault()},mousedown:function(e){var t=e.originalEvent.touches&&e.originalEvent.touches[0]?"touchstart":"mousedown",o=$(e.target),r=o.closest(n.thumbnails._selectors.item),i=f.files.find(r),a={x:"mousedown"!=t&&r.length?e.originalEvent.touches[0].pageX:e.pageX,y:"mousedown"!=t&&r.length?e.originalEvent.touches[0].pageY:e.pageY},s=function(){f.sorter.sort={el:o,item:i,items:l.find(n.thumbnails._selectors.item),x:a.x,y:a.y,xItem:a.x-r.offset().left,yItem:a.y-r.offset().top,left:r.position().left,top:r.position().top,width:r.outerWidth(),height:r.outerHeight(),placeholder:n.sorter.placeholder?$(n.sorter.placeholder):i.html.clone().addClass("fileuploader-sorter-placeholder").html("")},$("body").css({"-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"}),$(window).on("mousemove touchmove",f.sorter.mousemove)};f.sorter.sort&&f.sorter.mouseup(),i&&(n.sorter.selectorExclude&&(o.is(n.sorter.selectorExclude)||o.closest(n.sorter.selectorExclude).length)||(p.on(f.sorter.prevent(!0),n.thumbnails._selectors.sorter,f.sorter.prevent),"mousedown"==t&&s(),"touchstart"==t&&(f.sorter.isTouchLongPress=!0,setTimeout(function(){f.sorter.isTouchLongPress&&(delete f.sorter.isTouchLongPress,s())},500)),$(window).on("mouseup touchend",f.sorter.mouseup)))},findItemAtPos:function(e){var t=f.sorter.sort,o=null;return t.items.not(t.item.html).each(function(t,n){var r=$(n);if(e.x>r.offset().left&&e.xr.offset().top&&e.ya.width()&&(d=a.width()-o.xItem),d<0-o.xItem&&(d=0-o.xItem),u+o.yItem>a.height()&&(u=a.height()-o.yItem),u<0-o.yItem&&(u=0-o.yItem),r.html.addClass("sorting").css({position:"fixed",left:d,top:u,width:f.sorter.sort.width,height:f.sorter.sort.height}),l.find(o.placeholder).length||r.html.after(o.placeholder),o.placeholder.css({width:f.sorter.sort.width,height:f.sorter.sort.height});var c=f.sorter.findItemAtPos({x:d+o.xItem+s.left,y:u+o.yItem+s.top});if(c){var h=o.placeholder.offset().left!=c.offset().left,m=o.placeholder.offset().top!=c.offset().top;if(f.sorter.sort.lastHover&&f.sorter.sort.lastHover.el==c[0]){if(m&&"before"==f.sorter.sort.lastHover.direction&&p.yf.sorter.sort.lastHover.y)return;if(h&&"before"==f.sorter.sort.lastHover.direction&&p.xf.sorter.sort.lastHover.x)return}var g=i.index(r.html)>i.index(c)?"before":"after";c[g](o.placeholder),c[g](r.html),f.sorter.sort.lastHover={el:c[0],x:p.x,y:p.y,direction:g},a.scrollLeft(s.left),a.scrollTop(s.top)}},mouseup:function(){var e=f.sorter.sort,t=e.item;$("body").css({"-webkit-user-select":"","-moz-user-select":"","-ms-user-select":"","user-select":""}),t.html.removeClass("sorting").css({position:"",left:"",top:"",width:"",height:""}),e.placeholder.remove(),delete f.sorter.sort,p.off(f.sorter.prevent(!0),n.thumbnails._selectors.sorter,f.sorter.prevent),$(window).off("mousemove touchmove",f.sorter.mousemove),$(window).off("mouseup touchend",f.sorter.mouseup),f.sorter.save()},save:function(e){var t=0,r=[],i=f.rendered&&e;$.each(e?f._itFl:l.children(),function(e,o){var n=o.file?o:f.files.find($(o));if(n){if(n.upload&&!n.uploaded)return i=!1,!1;f.rendered&&n.index!=t&&(i=!0),n.index=t,r.push(n),t++}}),i&&r.length==f._itFl.length&&(f._itFl=r),e||f.set("listInput","ignoreSorter"),i&&null!=n.sorter.onSort&&"function"==typeof n.sorter.onSort&&n.sorter.onSort(r,l,p,o,s)}},upload:{prepare:function(e,t){e.upload={url:n.upload.url,data:n.upload.data||{},formData:new FormData,type:n.upload.type||"POST",enctype:n.upload.enctype||"multipart/form-data",cache:!1,contentType:!1,processData:!1,status:null,send:function(){f.upload.send(e,!0)},cancel:function(t){f.upload.cancel(e,t)},retry:function(){f.upload.retry(e)}},e.upload.formData.append(s.attr("name"),e.file,!!e.name&&e.name),(n.upload.start||t)&&f.upload.send(e,t)},send:function(e,t){if(e.upload){var r=function(t){e.html.removeClass("upload-pending upload-loading upload-cancelled upload-failed upload-success").addClass("upload-"+(t||e.upload.status))},i=function(){var t=0;if(f._pfuL.length>0)for(f._pfuL.indexOf(e)>-1&&f._pfuL.splice(f._pfuL.indexOf(e),1);t-1&&f._pfuL[t].upload&&!f._pfuL[t].upload.$ajax){f.upload.send(f._pfuL[t],!0);break}f._pfuL.splice(t,1),t++}};if(n.upload.synchron&&!e.upload.chunk)if(e.upload.status="pending",e.html&&r(),t)f._pfuL.indexOf(e)>-1&&f._pfuL.splice(f._pfuL.indexOf(e),1);else if(-1==f._pfuL.indexOf(e)&&f._pfuL.push(e),f._pfuL.length>1)return;if(n.upload.chunk&&e.file.slice){var a=1e6*n.upload.chunk,d=Math.ceil(e.size/a,a);if(d>1&&!e.upload.chunk&&(e.upload.chunk={name:e.name,size:e.file.size,type:e.file.type,chunkSize:a,temp_name:e.name,loaded:0,total:d,i:-1}),e.upload.chunk)if(e.upload.chunk.i++,delete e.upload.chunk.isFirst,delete e.upload.chunk.isLast,0==e.upload.chunk.i&&(e.upload.chunk.isFirst=!0),e.upload.chunk.i==e.upload.chunk.total-1&&(e.upload.chunk.isLast=!0),e.upload.chunk.i<=e.upload.chunk.total-1){var u=e.upload.chunk.i*e.upload.chunk.chunkSize,c=e.file.slice(u,u+e.upload.chunk.chunkSize);e.upload.data=n.upload.data||{},e.upload.formData=new FormData,e.upload.formData.append(s.attr("name"),c),e.upload.data._chunkedd=JSON.stringify(e.upload.chunk)}else delete e.upload.chunk}if(n.upload.beforeSend&&$.isFunction(n.upload.beforeSend)&&!1===n.upload.beforeSend(e,l,p,o,s))return delete e.upload.chunk,r(),void i();if(p.addClass("fileuploader-is-uploading"),e.upload.$ajax&&e.upload.$ajax.abort(),delete e.upload.$ajax,delete e.upload.send,e.upload.status="loading",e.html&&(n.thumbnails._selectors.start&&e.html.find(n.thumbnails._selectors.start).remove(),r()),e.upload.data)for(var h in e.upload.data)e.upload.formData.append(h,e.upload.data[h]);e.upload.data=e.upload.formData,e.upload.xhr=function(){var t=$.ajaxSettings.xhr(),o=e.upload.chunk&&e.upload.chunk.xhrStartedAt?e.upload.chunk.xhrStartedAt:new Date;return t.upload&&t.upload.addEventListener("progress",function(t){e.upload.$ajax&&(e.upload.$ajax.total=e.upload.chunk?e.upload.chunk.size:t.total,e.upload.$ajax.xhrStartedAt=o),f.upload.progressHandling(t,e,o)},!1),t},e.upload.complete=function(t,r){if(e.upload.chunk&&!e.upload.chunk.isLast&&"success"==r)return f.upload.send(e);i();var a=!0;$.each(f._itFl,function(e,t){t.upload&&t.upload.$ajax&&(a=!1)}),a&&(p.removeClass("fileuploader-is-uploading"),null!=n.upload.onComplete&&"function"==typeof n.upload.onComplete&&n.upload.onComplete(l,p,o,s,t,r))},e.upload.success=function(t,i,a){if(!e.upload.chunk||e.upload.chunk.isLast)delete e.upload.chunk,f.upload.progressHandling(null,e,e.upload.$ajax.xhrStartedAt,!0),e.uploaded=!0,delete e.upload,e.upload={status:"successful",resend:function(){f.upload.retry(e)}},e.html&&r(),null!=n.upload.onSuccess&&$.isFunction(n.upload.onSuccess)&&n.upload.onSuccess(t,e,l,p,o,s,i,a),f.set("listInput",null);else try{var d=JSON.parse(t);e.upload.chunk.temp_name=d.fileuploader.temp_name}catch(e){}},e.upload.error=function(t,i,a){e.uploaded=!1,e.upload.status="cancelled"==e.upload.status?e.upload.status:"failed",delete e.upload.$ajax,e.html&&r(),null!=n.upload.onError&&$.isFunction(n.upload.onError)&&n.upload.onError(e,l,p,o,s,t,i,a)},e.upload.$ajax=$.ajax(e.upload)}},cancel:function(e,t){e&&e.upload&&(e.upload.status="cancelled",delete e.upload.chunk,e.upload.$ajax&&e.upload.$ajax.abort(),delete e.upload.$ajax,t||f.files.remove(e))},retry:function(e){e&&e.upload&&(e.html&&n.thumbnails._selectors.retry&&e.html.find(n.thumbnails._selectors.retry).remove(),f.upload.prepare(e,!0))},progressHandling:function(e,t,r,i){if(!e&&i&&t.upload.$ajax&&(e={total:t.upload.$ajax.total,loaded:t.upload.$ajax.total,lengthComputable:!0}),e.lengthComputable){var a=e.loaded+(t.upload.chunk?t.upload.chunk.loaded:0),d=t.upload.chunk?t.upload.chunk.size:e.total,u=Math.round(100*a/d),c=t.upload.chunk&&t.upload.chunk.xhrStartedAt?t.upload.chunk.xhrStartedAt:r,h=((new Date).getTime()-c.getTime())/1e3,m=h?a/h:0,g=Math.max(0,d-a),v=Math.max(0,h?g/m:0),b={loaded:a,loadedInFormat:f._assets.bytesToText(a),total:d,totalInFormat:f._assets.bytesToText(d),percentage:u,secondsElapsed:h,secondsElapsedInFormat:f._assets.secondsToText(h,!0),bytesPerSecond:m,bytesPerSecondInFormat:f._assets.bytesToText(m)+"/s",remainingBytes:g,remainingBytesInFormat:f._assets.bytesToText(g),secondsRemaining:v,secondsRemainingInFormat:f._assets.secondsToText(v,!0)};t.upload.chunk&&(t.upload.chunk.isFirst&&(t.upload.chunk.xhrStartedAt=r),e.loaded!=e.total||t.upload.chunk.isLast||(t.upload.chunk.loaded+=Math.max(e.total,t.upload.chunk.total/t.upload.chunk.chunkSize))),b.percentage>99&&!i&&(b.percentage=99),n.upload.onProgress&&$.isFunction(n.upload.onProgress)&&n.upload.onProgress(b,t,l,p,o,s)}}},dragDrop:{onDragEnter:function(e){clearTimeout(f.dragDrop._timer),n.dragDrop.container.addClass("fileuploader-dragging"),f.set("feedback",f._assets.textParse(n.captions.drop)),null!=n.dragDrop.onDragEnter&&$.isFunction(n.dragDrop.onDragEnter)&&n.dragDrop.onDragEnter(e,l,p,o,s)},onDragLeave:function(e){clearTimeout(f.dragDrop._timer),f.dragDrop._timer=setTimeout(function(e){if(!f.dragDrop._dragLeaveCheck(e))return!1;n.dragDrop.container.removeClass("fileuploader-dragging"),f.set("feedback",null),null!=n.dragDrop.onDragLeave&&$.isFunction(n.dragDrop.onDragLeave)&&n.dragDrop.onDragLeave(e,l,p,o,s)},100,e)},onDrop:function(e){clearTimeout(f.dragDrop._timer),n.dragDrop.container.removeClass("fileuploader-dragging"),f.set("feedback",null),e&&e.originalEvent&&e.originalEvent.dataTransfer&&e.originalEvent.dataTransfer.files&&e.originalEvent.dataTransfer.files.length&&(f.isUploadMode()?f.onChange(e,e.originalEvent.dataTransfer.files):s.prop("files",e.originalEvent.dataTransfer.files)),null!=n.dragDrop.onDrop&&$.isFunction(n.dragDrop.onDrop)&&n.dragDrop.onDrop(e,l,p,o,s)},_dragLeaveCheck:function(e){var t=$(e.currentTarget);return!(!t.is(n.dragDrop.container)&&n.dragDrop.container.find(t).length)}},clipboard:{paste:function(e){if(f._assets.isIntoView(o)&&e.originalEvent.clipboardData&&e.originalEvent.clipboardData.items&&e.originalEvent.clipboardData.items.length){var t=e.originalEvent.clipboardData.items;f.clipboard.clean();for(var r=0;r1?n.clipboardPaste:2e3;i&&(i._name=f._assets.generateFileName(-1!=i.type.indexOf("/")?i.type.split("/")[1].toString().toLowerCase():"png","Clipboard "),f.set("feedback",f._assets.textParse(n.captions.paste,{ms:a/1e3})),f.clipboard._timer=setTimeout(function(){f.set("feedback",null),f.onChange(e,[i])},a-2))}}},clean:function(){f.clipboard._timer&&(clearTimeout(f.clipboard._timer),delete f.clipboard._timer,f.set("feedback",null))}},files:{add:function(e,t){var o,r,i=e._name||e.name,a=e.size,l=f._assets.bytesToText(a),p=e.type,d=p?p.split("/",1).toString().toLowerCase():"",u=-1!=i.indexOf(".")?i.split(".").pop().toLowerCase():"",c=i.substr(0,i.length-(-1!=i.indexOf(".")?u.length+1:u.length)),h=e.data||{},e=e.file||e,m=Date.now();return f._itFl.push({name:i,title:c,size:a,size2:l,type:p,format:d,extension:u,data:h,file:e,reader:{read:function(e,t,o){return f.files.read(r,e,t,o)}},id:m,input:"choosed"==t?s:null,html:null,choosed:"choosed"==t,appended:"appended"==t,uploaded:"uploaded"==t}),o=f._itFl.length-1,r=f._itFl[o],r.remove=function(){f.files.remove(r)},n.editor&&"image"==d&&(r.editor={rotate:function(e){f.editor.rotate(r,e)},cropper:function(e){f.editor.crop(r,e)},save:function(e,t,o,n){f.editor.save(r,t,o,e,n)}}),o},read:function(e,t,r,i){if(f.isFileReaderSupported()){var a=new FileReader,d=e.choosed,u=function(){var t=e.reader._callbacks;delete e.reader._callbacks,delete e.reader._FileReader;for(var r=0;r1))return;if("astext"==e.format)a.onload=function(t){var o=document.createElement("div");e.reader.node=o,e.reader.src=t.target.result,e.reader.length=t.target.result.length,o.innerHTML=e.reader.src.replace(/&/g,"&").replace(//g,">"),u()},a.onerror=function(){u(),e.reader={read:e.reader.read}},d?a.readAsText(e.file):$.ajax({url:e.file,success:function(e){a.onload({target:{result:e}})},error:function(){a.onerror()}});else if("image"==e.format)a.onload=function(t){var o=new Image;e.data&&e.data.readerCrossOrigin&&o.setAttribute("crossOrigin",e.data.readerCrossOrigin),o.src=t.target.result+(i&&!d?(-1==t.target.result.indexOf("?")?"?":"&")+"d="+Date.now():""),o.onload=function(){e.reader.node=o,e.reader.src=o.src,e.reader.width=o.width,e.reader.height=o.height,e.reader.ratio=f._assets.pxToRatio(e.reader.width,e.reader.height),u()},o.onerror=function(){u(),e.reader={read:e.reader.read}}},a.onerror=function(){u(),e.reader={read:e.reader.read}},d?a.readAsDataURL(e.file):a.onload({target:{result:e.file}});else if("video"==e.format||"audio"==e.format){var c,h=document.createElement(e.format),m=h.canPlayType(e.type);URL&&""!==m?(c=d?URL.createObjectURL(e.file):e.file,h.onloadedmetadata=function(){e.reader.node=h,e.reader.src=h.src,e.reader.duration=h.duration,e.reader.duration2=f._assets.secondsToText(h.duration),"video"==e.format&&(e.reader.width=h.videoWidth,e.reader.height=h.videoHeight,e.reader.ratio=f._assets.pxToRatio(e.reader.width,e.reader.height))},h.onerror=function(){u(),e.reader={read:e.reader.read}},h.onloadeddata=function(){if("video"==e.format){var t=document.createElement("canvas"),o=t.getContext("2d");t.width=h.videoWidth,t.height=h.videoHeight,o.drawImage(h,0,0,t.width,t.height),e.reader.frame=f._assets.isBlankCanvas(t)?null:t.toDataURL(),t=o=null}u()},setTimeout(function(){e.data&&e.data.readerCrossOrigin&&h.setAttribute("crossOrigin",e.data.readerCrossOrigin),h.src=c},100)):(u(),e.reader={read:e.reader.read})}else a.onload=function(t){e.reader.src=t.target.result,e.reader.length=t.target.result.length,u()},a.onerror=function(t){u(),e.reader={read:e.reader.read}},d?a[r||"readAsBinaryString"](e.file):u()}else t&&t(e,l,p,o,s);return null},list:function(e,t,r,i){var a=[];return!n.sorter||r||i&&"ignoreSorter"==i||f.sorter.save(!0),$.each(f._itFl,function(o,n){if(n.upload&&!n.uploaded)return!0;var r=n;if((t||e)&&(r=(r.choosed?"0:/":"")+(t&&null!==f.files.getItemAttr(n,t)?f.files.getItemAttr(n,t):n["string"==typeof n.file?"file":"name"])),e&&(r={file:r},n.editor&&(n.editor.crop||n.editor.rotation)&&(r.editor={},n.editor.rotation&&(r.editor.rotation=n.editor.rotation),n.editor.crop&&(r.editor.crop=n.editor.crop)),void 0!==n.index&&(r.index=n.index),n.data&&n.data.listProps))for(var i in n.data.listProps)r[i]=n.data.listProps[i];a.push(r)}),a=n.onListInput&&$.isFunction(n.onListInput)?n.onListInput(a,f._itFl,n.listInput,l,p,o,s):a,e?JSON.stringify(a):a},check:function(e,t,r){var i=["warning",null,!1,!1];if(null!=n.limit&&r&&t.length+f._itFl.length-1>n.limit)return i[1]=f._assets.textParse(n.captions.errors.filesLimit),i[3]=!0,i;if(null!=n.maxSize&&r){a=0;if($.each(f._itFl,function(e,t){a+=t.size}),a-=e.size,$.each(t,function(e,t){a+=t.size}),a>Math.round(1e6*n.maxSize))return i[1]=f._assets.textParse(n.captions.errors.filesSizeAll),i[3]=!0,i}if(null!=n.onFilesCheck&&$.isFunction(n.onFilesCheck)&&r&&!1===n.onFilesCheck(t,n,l,p,o,s))return i[3]=!0,i;if(null!=n.extensions&&-1==$.inArray(e.extension,n.extensions)&&-1==$.inArray(e.type,n.extensions))return i[1]=f._assets.textParse(n.captions.errors.filesType,e),i;if(null!=n.fileMaxSize&&e.size>1e6*n.fileMaxSize)return i[1]=f._assets.textParse(n.captions.errors.fileSize,e),i;if(4096==e.size&&""==e.type)return i[1]=f._assets.textParse(n.captions.errors.folderUpload,e),i;if(!n.skipFileNameCheck){var a=!1;if($.each(f._itFl,function(o,r){if(r!=e&&1==r.choosed&&r.file&&r.name==e.name)return a=!0,r.file.size!=e.size||r.file.type!=e.type||e.file.lastModified&&r.file.lastModified&&r.file.lastModified!=e.file.lastModified||!(t.length>1)?(i[1]=f._assets.textParse(n.captions.errors.fileName,e),i[2]=!1):i[2]=!0,!1}),a)return i}return!0},append:function(e){if((e=$.isArray(e)?e:[e]).length){for(var t,r=0;r1))return r=!1,!1}),r&&(f.isAddMoreMode()&&sl.length>1?(f.set("nextInput"),sl.splice(sl.indexOf(e.input),1),e.input.remove()):f.set("input",""))}f._pfrL.indexOf(e)>-1&&f._pfrL.splice(f._pfrL.indexOf(e),1),f._pfuL.indexOf(e)>-1&&f._pfuL.splice(f._pfuL.indexOf(e),1),f._itFl.indexOf(e)>-1&&f._itFl.splice(f._itFl.indexOf(e),1),e=null,0==f._itFl.length&&f.reset(),f.set("feedback",null),f.set("listInput",null)}},getItemAttr:function(e,t){var o=null;return e&&(void 0!==e[t]?o=e[t]:e.data&&void 0!==e.data[t]&&(o=e.data[t])),o},clear:function(e){for(var t=0;t0||!t)&&(r+=(o<10?"0":"")+o+(t?"h ":":")),(n>0||!t)&&(r+=(n<10&&!t?"0":"")+n+(t?"m ":":")),r+=(e<10&&!t?"0":"")+e+(t?"s":"")},pxToRatio:function(e,t){var o=function(e,t){return 0==t?e:o(t,e%t)},n=o(e,t);return[e/n,t/n]},ratioToPx:function(e,t,o){return(o=(o+"").split(":")).length<2?null:[t/o[1]*o[0],e/o[0]*o[1],o[0],o[1]]},hasAttr:function(e,t){var o=(t=t||s).attr(e);return!(!o||void 0===o)},copyAllAttributes:function(e,t){return $.each(t.get(0).attributes,function(){"required"!=this.name&&"type"!=this.name&&e.attr(this.name,this.value)}),t.get(0).FileUploader&&(e.get(0).FileUploader=t.get(0).FileUploader),e},getAllEvents:function(e){var t=[];e=(e=e||s).get?e.get(0):e;for(var o in e)0===o.indexOf("on")&&t.push(o.slice(2));return-1==t.indexOf("change")&&t.push("change"),t.join(" ")},isIntoView:function(e){var t=$(window).scrollTop(),o=t+window.innerHeight,n=e.offset().top,r=n+e.outerHeight();return tr},isBlankCanvas:function(e){var t=document.createElement("canvas"),o=!1;return t.width=e.width,t.height=e.height,o=e.toDataURL()==t.toDataURL(),t=null,o},generateFileName:function(e,t){var o=new Date,n=function(e){return e<10&&(e="0"+e),e},t=t||"",e=e?"."+e:"";return t+o.getFullYear()+"-"+n(o.getMonth()+1)+"-"+n(o.getDate())+" "+n(o.getHours())+"-"+n(o.getMinutes())+"-"+n(o.getSeconds())+e},dataURItoBlob:function(e,t){for(var o=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(o.length),i=new Uint8Array(r),a=0;a-1||a.indexOf("[]")>-1){var x=a.substr(0,a.indexOf(".")>-1?a.indexOf("."):a.indexOf("[")>-1?a.indexOf("["):a.length),y=a.substring(x.length);if(opts[x])try{r=eval('opts["'+x+'"]'+y)}catch(e){r=""}}return(r=$.isFunction(r)?f._assets.textParse(r):r)||""});break;case"function":text=f._assets.textParse(text(opts,l,p,o,s,f._assets.textParse),opts,noOptions)}return opts=null,text},textToColor:function(e){if(!e||0==e.length)return!1;for(var t=0,o=0;t>2*t++&255).toString(16)).slice(-2));return n},isBrightColor:function(e){var t=function(e){var t;return e&&e.constructor==Array&&3==e.length?e:(t=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:(t=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))?[2.55*parseFloat(t[1]),2.55*parseFloat(t[2]),2.55*parseFloat(t[3])]:(t=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:(t=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))?[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]:"undefined"!=typeof colors?colors[$.trim(e).toLowerCase()]:null};return function(e){var o=t(e);return o?.2126*o[0]+.7152*o[1]+.0722*o[2]:null}(e)>194}},isSupported:function(){return s&&s.get(0).files},isFileReaderSupported:function(){return window.File&&window.FileList&&window.FileReader},isDefaultMode:function(){return!n.upload&&!n.addMore},isAddMoreMode:function(){return!n.upload&&n.addMore},isUploadMode:function(){return n.upload},_itFl:[],_pfuL:[],_pfrL:[],disabled:!1,locked:!1,rendered:!1};return n.enableApi&&s.prop("FileUploader",{open:function(){s.trigger("click")},getOptions:function(){return n},getParentEl:function(){return p},getInputEl:function(){return s},getNewInputEl:function(){return o},getListEl:function(){return l},getListInputEl:function(){return n.listInput},getFiles:function(){return f._itFl},getChoosedFiles:function(){return f._itFl.filter(function(e){return e.choosed})},getAppendedFiles:function(){return f._itFl.filter(function(e){return e.appended})},getUploadedFiles:function(){return f._itFl.filter(function(e){return e.uploaded})},getFileList:function(e,t){return f.files.list(e,t,!0)},updateFileList:function(){return f.set("listInput",null),!0},setOption:function(e,t){return n[e]=t,!0},findFile:function(e){return f.files.find(e)},add:function(e,t,o){if(!f.isUploadMode())return!1;var n;if(e instanceof Blob)n=e;else{var r=/data:[a-z]+\/[a-z]+\;base64\,/.test(e)?e:"data:"+t+";base64,"+btoa(e);n=f._assets.dataURItoBlob(r,t)}return n._name=o||f._assets.generateFileName(-1!=n.type.indexOf("/")?n.type.split("/")[1].toString().toLowerCase():"File "),f.onChange(null,[n]),!0},append:function(e){return f.files.append(e)},remove:function(e){return e=e.jquery?f.files.find(e):e,f._itFl.indexOf(e)>-1&&(f.files.remove(e),!0)},uploadStart:function(){var e=this.getChoosedFiles()||[];if(f.isUploadMode()&&e.length>0&&!e[0].uploaded)for(var t=0;t
        ',boxAppendTo:null,item:'
      • ${image}
        ${name}
        ${size2}
        ${progressBar}
      • ',item2:'
      • ',popup:{template:function(e){return'
        ${reader.node}
        • ${captions.name}:
          ${name}
        • ${captions.type}:
          ${extension.toUpperCase()}
        • ${captions.size}:
          ${size2}
        • '+(e.reader&&e.reader.width?"
        • ${captions.dimensions}:
          ${reader.width}x${reader.height}px
        • ":"")+(e.reader&&e.reader.duration?"
        • ${captions.duration}:
          ${reader.duration2}
        • ":"")+'
        • '+("image"==e.format&&e.reader.src&&e.editor?'
        • ${captions.crop}
        • ${captions.rotate}
        • ':"")+'
        • ${captions.remove}
        '},onShow:function(e){e.popup.html.on("click",'[data-action="crop"]',function(t){e.editor&&e.editor.cropper()}).on("click",'[data-action="rotate-cw"]',function(t){e.editor&&e.editor.rotate()}).on("click",'[data-action="remove"]',function(t){e.popup.close(),e.remove()}).on("click",'[data-action="cancel"]',function(t){e.popup.close()}).on("click",'[data-action="save"]',function(t){e.editor&&e.editor.save(),e.popup.close&&e.popup.close()})},onHide:function(e){var t=e.popup.html;t.fadeOut(200,function(){t.remove()})}},itemPrepend:!1,removeConfirmation:!0,startImageRenderer:!0,synchronImages:!0,canvasImage:!0,_selectors:{list:".fileuploader-items-list",item:".fileuploader-item",start:".fileuploader-action-start",retry:".fileuploader-action-retry",remove:".fileuploader-action-remove",sorter:".fileuploader-action-sort",popup:".fileuploader-popup",popup_open:".fileuploader-action-popup"},beforeShow:null,onItemShow:null,onItemRemove:function(e){e.children().animate({opacity:0},200,function(){setTimeout(function(){e.slideUp(200,function(){e.remove()})},100)})},onImageLoaded:null},editor:!1,sorter:!1,files:null,upload:null,dragDrop:!0,addMore:!1,skipFileNameCheck:!1,clipboardPaste:!0,listInput:!0,enableApi:!1,listeners:null,onSupportError:null,beforeRender:null,afterRender:null,beforeSelect:null,onFilesCheck:null,onFileRead:null,onSelect:null,afterSelect:null,onListInput:null,onRemove:null,onEmpty:null,dialogs:{alert:function(e){return alert(e)},confirm:function(e,t){confirm(e)&&t()}},captions:{button:function(e){return"Choose "+(1==e.limit?"File":"Files")},feedback:function(e){return"Choose "+(1==e.limit?"file":"files")+" to upload"},feedback2:function(e){return e.length+" "+(e.length>1?" files were":" file was")+" chosen"},confirm:"Confirm",cancel:"Cancel",name:"Name",type:"Type",size:"Size",dimensions:"Dimensions",duration:"Duration",crop:"Crop",rotate:"Rotate",sort:"Sort",download:"Download",remove:"Remove",drop:"Drop the files here to Upload",paste:'
        Pasting a file, click here to cancel.',removeConfirmation:"Are you sure you want to remove this file?",errors:{filesLimit:"Only ${limit} files are allowed to be uploaded.",filesType:"Only ${extensions} files are allowed to be uploaded.",fileSize:"${name} is too large! Please choose a file up to ${fileMaxSize}MB.",filesSizeAll:"Files that you chose are too large! Please upload files up to ${maxSize} MB.",fileName:"File with the name ${name} is already selected.",folderUpload:"You are not allowed to upload folders."}}}}(jQuery); (function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate, v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true"); g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap(); f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i"; _add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c= f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this, b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='
        ")[_callback]("ifCreated").parent().append(e.insert);d=f('').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return; A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d= b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto); // Image Picker // by Rodrigo Vera // // Version 0.3.1 // Full source at https://github.com/rvera/image-picker // MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE // Image Picker // by Rodrigo Vera // // Version 0.3.0 // Full source at https://github.com/rvera/image-picker // MIT License, https://github.com/rvera/image-picker/blob/master/LICENSE (function(){var ImagePicker,ImagePickerOption,both_array_are_equal,sanitized_options,bind=function(fn,me){return function(){return fn.apply(me,arguments)}},indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i
      ");this.picker_options=[];this.recursively_parse_option_groups(this.select,this.picker);return this.picker};ImagePicker.prototype.recursively_parse_option_groups=function(scoped_dom,target_container){var container,j,k,len,len1,option,option_group,ref,ref1,results;ref=scoped_dom.children("optgroup");for(j=0,len=ref.length;j
    ");container.append(jQuery("
  • "+option_group.attr("label")+"
  • "));target_container.append(jQuery("
  • ").append(container));this.recursively_parse_option_groups(option_group,container)}ref1=function(){var l,len1,ref1,results1;ref1=scoped_dom.children("option");results1=[];for(l=0,len1=ref1.length;l0};ImagePicker.prototype.selected_values=function(){if(this.multiple){return this.select.val()||[]}else{return[this.select.val()]}};ImagePicker.prototype.toggle=function(imagepicker_option,original_event){var new_values,old_values,selected_value;old_values=this.selected_values();selected_value=imagepicker_option.value().toString();if(this.multiple){if(indexOf.call(this.selected_values(),selected_value)>=0){new_values=this.selected_values();new_values.splice(jQuery.inArray(selected_value,old_values),1);this.select.val([]);this.select.val(new_values)}else{if(this.opts.limit!=null&&this.selected_values().length>=this.opts.limit){if(this.opts.limit_reached!=null){this.opts.limit_reached.call(this.select)}}else{this.select.val(this.selected_values().concat(selected_value))}}}else{if(this.has_implicit_blanks()&&imagepicker_option.is_selected()){this.select.val("")}else{this.select.val(selected_value)}}if(!both_array_are_equal(old_values,this.selected_values())){this.select.change();if(this.opts.changed!=null){return this.opts.changed.call(this.select,old_values,this.selected_values(),original_event)}}};return ImagePicker}();ImagePickerOption=function(){function ImagePickerOption(option_element,picker,opts1){this.picker=picker;this.opts=opts1!=null?opts1:{};this.clicked=bind(this.clicked,this);this.option=jQuery(option_element);this.create_node()}ImagePickerOption.prototype.destroy=function(){return this.node.find(".thumbnail").off("click",this.clicked)};ImagePickerOption.prototype.has_image=function(){return this.option.data("img-src")!=null};ImagePickerOption.prototype.is_blank=function(){return!(this.value()!=null&&this.value()!=="")};ImagePickerOption.prototype.is_selected=function(){var select_value;select_value=this.picker.select.val();if(this.picker.multiple){return jQuery.inArray(this.value(),select_value)>=0}else{return this.value()===select_value}};ImagePickerOption.prototype.mark_as_selected=function(){return this.node.find(".thumbnail").addClass("selected")};ImagePickerOption.prototype.unmark_as_selected=function(){return this.node.find(".thumbnail").removeClass("selected")};ImagePickerOption.prototype.value=function(){return this.option.val()};ImagePickerOption.prototype.label=function(){if(this.option.data("img-label")){return this.option.data("img-label")}else{return this.option.text()}};ImagePickerOption.prototype.clicked=function(event){this.picker.toggle(this,event);if(this.opts.clicked!=null){this.opts.clicked.call(this.picker.select,this,event)}if(this.opts.selected!=null&&this.is_selected()){return this.opts.selected.call(this.picker.select,this,event)}};ImagePickerOption.prototype.create_node=function(){var image,imgAlt,imgClass,thumbnail;this.node=jQuery("
  • ");if(this.option.data("font_awesome")){image=jQuery("");image.attr("class","fa-fw "+this.option.data("img-src"))}else{image=jQuery("");image.attr("src",this.option.data("img-src"))}thumbnail=jQuery("
    ");imgClass=this.option.data("img-class");if(imgClass){this.node.addClass(imgClass);image.addClass(imgClass);thumbnail.addClass(imgClass)}imgAlt=this.option.data("img-alt");if(imgAlt){image.attr("alt",imgAlt)}thumbnail.on("click",this.clicked);thumbnail.append(image);if(this.opts.show_label){thumbnail.append(jQuery("

    ").html(this.label()))}this.node.append(thumbnail);return this.node};return ImagePickerOption}()}).call(this); !function(a){var b=function(a,b,c){"use strict";return function(){function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(a,b){for(var c=0;c-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=f.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=f}},{key:"_d0",value:function(){for(var a=0;a"),c+="

    "),c+="".concat(e.name,""),c+="+".concat(e.dialCode,""),c+="
  • "}this.m.insertAdjacentHTML("beforeend",c)}},{key:"_h",value:function(){var a=this.a.value,b=this._5(a),c=this._w(a),d=this.d,e=d.initialCountry,f=d.nationalMode,g=d.autoHideDialCode,h=d.separateDialCode;b&&!c?this._v(a):"auto"!==e&&(e?this._z(e.toLowerCase()):b&&c?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,a||this._z(this.j)),a||f||g||h||(this.a.value="+".concat(this.s.dialCode))),a&&this._u(a)}},{key:"_i",value:function(){this._j(),this.d.autoHideDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("hide")&&-1!==["ArrowUp","ArrowDown"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var b=this;this.d.utilsScript&&!a.intlTelInputUtils?a.intlTelInputGlobals.windowLoaded?a.intlTelInputGlobals.loadUtils(this.d.utilsScript):a.addEventListener("load",function(){a.intlTelInputGlobals.loadUtils(b.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){a.intlTelInputGlobals.autoCountry?this.handleAutoCountry():a.intlTelInputGlobals.startedLoadingAutoCountry||(a.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(b){a.intlTelInputGlobals.autoCountry=b.toLowerCase(),setTimeout(function(){return m("handleAutoCountry")})},function(){return m("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._8()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a5=function(c){a.a===b.activeElement||a.a.value||(c.preventDefault(),a.a.focus())},this.a.addEventListener("mousedown",this._a5),this._a6=function(b){"+"===b.key&&(a.a.value="")},this._a7=function(){a.a.value||a.a.readOnly||!a.s.dialCode||(a.a.value="+".concat(a.s.dialCode),a.a.addEventListener("keypress",a._a6),setTimeout(function(){var b=a.a.value.length;a.a.setSelectionRange(b,b)}))},this.a.addEventListener("focus",this._a7),this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}this.a.removeEventListener("keypress",this._a6)}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var c=b.createEvent("Event");c.initEvent(a,!0,!0),this.a.dispatchEvent(c)}},{key:"_n",value:function(){this.m.classList.remove("hide"),this.m.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b),this._3(this.b)),this._p(),this.u.classList.add("up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var c=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var d=this.a.getBoundingClientRect(),e=a.pageYOffset||b.documentElement.scrollTop,f=d.top+e,g=this.m.offsetHeight,h=f+this.a.offsetHeight+ge;if(this._n2(this.m,"dropup",!h&&i),this.d.dropdownContainer){var j=!h&&i?0:this.a.offsetHeight;this.dropdown.style.top="".concat(f+j,"px"),this.dropdown.style.left="".concat(d.left+b.body.scrollLeft,"px"),this._a4=function(){return c._2()},a.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var c=!0;this._a2=function(){c||a._2(),c=!1},b.documentElement.addEventListener("click",this._a2);var d="",e=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"ArrowDown"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿ ]$/.test(b.key)&&(e&&clearTimeout(e),d+=b.key.toLowerCase(),a._s(d),e=setTimeout(function(){d=""},1e3))},b.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("divider")&&(b="ArrowUp"===a?b.previousElementSibling:b.nextElementSibling),this._x(b),this._3(b))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;b=4;if(!("1"===this.s.dialCode&&this._w(e))&&(!h||i))for(var j=0;ji){d&&(m+=n);var o=g-j;e.scrollTop=m-o}}},{key:"_4",value:function(a,b){var c,d=this.a.value,e="+".concat(a);if("+"===d.charAt(0)){var f=this._5(d);c=f?d.replace(f,e):e}else{if(this.d.nationalMode||this.d.separateDialCode)return;if(d)c=e+d;else{if(!b&&this.d.autoHideDialCode)return;c=e}}this.a.value=c}},{key:"_5",value:function(a){var b="";if("+"===a.charAt(0))for(var c="",d=0;dc?Math.max(0,a.length+c):c;if(k(a))return k(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?1:aa.length?!1:O(Fa,a)}function Ja(a){return O(Da,a)?P(a,ya):P(a,xa)}function Ka(a){var b=Ja(a.toString());a.c="";a.a(b)}function La(a){return null!=a&&(1!=A(a,9)||-1!=w(a,9)[0])}function P(a,b){for(var c=new F,d,e=a.length,f=0;fb?2:f[f.length-1]=b.c.length)throw Error("Phone number too short after IDD"); a:{a=b.toString();if(0!=a.length&&"0"!=a.charAt(0))for(e=a.length,b=1;3>=b&&b<=e;++b)if(c=parseInt(a.substring(0,b),10),c in K){d.a(a.substring(b));d=c;break a}d=0}if(0!=d)return u(f,1,d),d;throw Error("Invalid country calling code");}if(null!=c&&(g=y(c,10),h=""+g,l=b.toString(),0==l.lastIndexOf(h,0)&&(h=new F(l.substring(h.length)),l=t(c,1),l=new RegExp(y(l,2)),Ra(h,c,null),h=h.toString(),!O(l,b.toString())&&O(l,h)||3==Y(a,b.toString(),c,-1))))return d.a(h),e&&u(f,6,10),u(f,1,g),g;u(f,1,0);return 0} function Ra(a,b,c){var d=a.toString(),e=d.length,f=t(b,15);if(0!=e&&null!=f&&0!=f.length){var g=new RegExp("^(?:"+f+")");if(e=g.exec(d)){f=new RegExp(y(t(b,1),2));var h=O(f,d),l=e.length-1;b=t(b,16);if(null==b||0==b.length||null==e[l]||0==e[l].length){if(!h||O(f,d.substring(e[0].length)))null!=c&&0b.c.length)throw Error("The string supplied is too short to be a phone number");null!=g&&(c=new F,e=new F(b.toString()),Ra(e,g,c),a=Y(a,e.toString(),g,-1),2!=a&&4!=a&&5!=a&&(b=e,d&&0a)throw Error("The string supplied is too short to be a phone number");if(17 0; } function mod11And10(value) { var length = value.length; var check = 5; for (var i = 0; i < length; i++) { check = (((check || 10) * 2) % 11 + parseInt(value.charAt(i), 10)) % 10; } return check === 1; } function mod37And36(value) { var alphabet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; var length = value.length; var modulus = alphabet.length; var check = Math.floor(modulus / 2); for (var i = 0; i < length; i++) { check = (((check || modulus) * 2) % (modulus + 1) + alphabet.indexOf(value.charAt(i))) % modulus; } return check === 1; } var index = { luhn: luhn, mod11And10: mod11And10, mod37And36: mod37And36 }; function emitter() { return { fns: {}, clear: function clear() { this.fns = {}; }, emit: function emit(event) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } (this.fns[event] || []).map(function(handler) { return handler.apply(handler, args); }); }, off: function off(event, func) { if (this.fns[event]) { var index = this.fns[event].indexOf(func); if (index >= 0) { this.fns[event].splice(index, 1); } } }, on: function on(event, func) { (this.fns[event] = this.fns[event] || []).push(func); } }; } function filter() { return { filters: {}, add: function add(name, func) { (this.filters[name] = this.filters[name] || []).push(func); }, clear: function clear() { this.filters = {}; }, execute: function execute(name, defaultValue, args) { if (!this.filters[name] || !this.filters[name].length) { return defaultValue; } var result = defaultValue; var filters = this.filters[name]; var count = filters.length; for (var i = 0; i < count; i++) { result = filters[i].apply(result, args); } return result; }, remove: function remove(name, func) { if (this.filters[name]) { this.filters[name] = this.filters[name].filter(function(f) { return f !== func; }); } } }; } var Status; (function(Status) { Status['Ignored'] = 'Ignored'; Status['Invalid'] = 'Invalid'; Status['NotValidated'] = 'NotValidated'; Status['Valid'] = 'Valid'; Status['Validating'] = 'Validating'; })(Status || (Status = {})); var Status$1 = Status; function getFieldValue(form, field, element, elements) { var type = (element.getAttribute('type') || '').toLowerCase(); var tagName = element.tagName.toLowerCase(); switch (tagName) { case 'textarea': return element.value; case 'select': var select = element; var index = select.selectedIndex; return index >= 0 ? select.options.item(index).value : ''; case 'input': if ('radio' === type || 'checkbox' === type) { var checked = elements.filter(function(ele) { return ele.checked; }).length; return checked === 0 ? '' : checked + ''; } else { return element.value; } default: return ''; } } function format(message, parameters) { var params = Array.isArray(parameters) ? parameters : [parameters]; var output = message; params.forEach(function(p) { output = output.replace('%s', p); }); return output; } function between() { var formatValue = function formatValue(value) { return parseFloat(('' + value).replace(',', '.')); }; return { validate: function validate(input) { var value = input.value; if (value === '') { return { valid: true }; } var opts = Object.assign({}, { inclusive: true }, input.options); var minValue = formatValue(opts.min); var maxValue = formatValue(opts.max); return opts.inclusive ? { message: input.l10n ? format(opts.message || input.l10n.between.default, ['' + minValue, '' + maxValue]) : opts.message, valid: parseFloat(value) >= minValue && parseFloat(value) <= maxValue } : { message: input.l10n ? format(opts.message || input.l10n.between.notInclusive, ['' + minValue, '' + maxValue]) : opts.message, valid: parseFloat(value) > minValue && parseFloat(value) < maxValue }; } }; } function blank() { return { validate: function validate(input) { return { valid: true }; } }; } function call(functionName, args) { if ('function' === typeof functionName) { return functionName.apply(this, args); } else if ('string' === typeof functionName) { var name = functionName; if ('()' === name.substring(name.length - 2)) { name = name.substring(0, name.length - 2); } var ns = name.split('.'); var func = ns.pop(); var context = window; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = ns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var t = _step.value; context = context[t]; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return typeof context[func] === 'undefined' ? null : context[func].apply(this, args); } } function callback() { return { validate: function validate(input) { var response = call(input.options.callback, [input]); return 'boolean' === typeof response ? { valid: response } : response; } }; } function choice() { return { validate: function validate(input) { var numChoices = 'select' === input.element.tagName.toLowerCase() ? input.element.querySelectorAll('option:checked').length : input.elements.filter(function(ele) { return ele.checked; }).length; var min = input.options.min ? '' + input.options.min : ''; var max = input.options.max ? '' + input.options.max : ''; var msg = input.l10n ? input.options.message || input.l10n.choice.default : input.options.message; var isValid = !((min && numChoices < parseInt(min, 10)) || (max && numChoices > parseInt(max, 10))); switch (true) { case !!min && !!max: msg = format(input.l10n ? input.l10n.choice.between : input.options.message, [min, max]); break; case !!min: msg = format(input.l10n ? input.l10n.choice.more : input.options.message, min); break; case !!max: msg = format(input.l10n ? input.l10n.choice.less : input.options.message, max); break; default: break; } return { message: msg, valid: isValid }; } }; } var CREDIT_CARD_TYPES = { AMERICAN_EXPRESS: { length: [15], prefix: ['34', '37'] }, DANKORT: { length: [16], prefix: ['5019'] }, DINERS_CLUB: { length: [14], prefix: ['300', '301', '302', '303', '304', '305', '36'] }, DINERS_CLUB_US: { length: [16], prefix: ['54', '55'] }, DISCOVER: { length: [16], prefix: [ '6011', '622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925', '644', '645', '646', '647', '648', '649', '65' ] }, ELO: { length: [16], prefix: ['4011', '4312', '4389', '4514', '4573', '4576', '5041', '5066', '5067', '509', '6277', '6362', '6363', '650', '6516', '6550'] }, FORBRUGSFORENINGEN: { length: [16], prefix: ['600722'] }, JCB: { length: [16], prefix: ['3528', '3529', '353', '354', '355', '356', '357', '358'] }, LASER: { length: [16, 17, 18, 19], prefix: ['6304', '6706', '6771', '6709'] }, MAESTRO: { length: [12, 13, 14, 15, 16, 17, 18, 19], prefix: ['5018', '5020', '5038', '5868', '6304', '6759', '6761', '6762', '6763', '6764', '6765', '6766'] }, MASTERCARD: { length: [16], prefix: ['51', '52', '53', '54', '55'] }, SOLO: { length: [16, 18, 19], prefix: ['6334', '6767'] }, UNIONPAY: { length: [16, 17, 18, 19], prefix: [ '622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925' ] }, VISA: { length: [16], prefix: ['4'] }, VISA_ELECTRON: { length: [16], prefix: ['4026', '417500', '4405', '4508', '4844', '4913', '4917'] } }; function creditCard() { return { validate: function validate(input) { if (input.value === '') { return { meta: { type: null }, valid: true }; } if (/[^0-9-\s]+/.test(input.value)) { return { meta: { type: null }, valid: false }; } var v = input.value.replace(/\D/g, ''); if (!luhn(v)) { return { meta: { type: null }, valid: false }; } var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = Object.keys(CREDIT_CARD_TYPES)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var tpe = _step.value; for (var i in CREDIT_CARD_TYPES[tpe].prefix) { if (input.value.substr(0, CREDIT_CARD_TYPES[tpe].prefix[i].length) === CREDIT_CARD_TYPES[tpe].prefix[i] && CREDIT_CARD_TYPES[tpe].length.indexOf(v.length) !== -1) { return { meta: { type: tpe }, valid: true }; } } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return { meta: { type: null }, valid: false }; } }; } function isValidDate(year, month, day, notInFuture) { if (isNaN(year) || isNaN(month) || isNaN(day)) { return false; } if (year < 1000 || year > 9999 || month <= 0 || month > 12) { return false; } var numDays = [31, year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (day <= 0 || day > numDays[month - 1]) { return false; } if (notInFuture === true) { var currentDate = new Date(); var currentYear = currentDate.getFullYear(); var currentMonth = currentDate.getMonth(); var currentDay = currentDate.getDate(); return year < currentYear || (year === currentYear && month - 1 < currentMonth) || (year === currentYear && month - 1 === currentMonth && day < currentDay); } return true; } function date() { var parseDate = function parseDate(input, inputFormat, separator) { var yearIndex = inputFormat.indexOf('YYYY'); var monthIndex = inputFormat.indexOf('MM'); var dayIndex = inputFormat.indexOf('DD'); if (yearIndex === -1 || monthIndex === -1 || dayIndex === -1) { return null; } var sections = input.split(' '); var dateSection = sections[0].split(separator); if (dateSection.length < 3) { return null; } var d = new Date(parseInt(dateSection[yearIndex], 10), parseInt(dateSection[monthIndex], 10) - 1, parseInt(dateSection[dayIndex], 10)); if (sections.length > 1) { var timeSection = sections[1].split(':'); d.setHours(timeSection.length > 0 ? parseInt(timeSection[0], 10) : 0); d.setMinutes(timeSection.length > 1 ? parseInt(timeSection[1], 10) : 0); d.setSeconds(timeSection.length > 2 ? parseInt(timeSection[2], 10) : 0); } return d; }; var formatDate = function formatDate(input, inputFormat) { var dateFormat = inputFormat .replace(/Y/g, 'y') .replace(/M/g, 'm') .replace(/D/g, 'd') .replace(/:m/g, ':M') .replace(/:mm/g, ':MM') .replace(/:S/, ':s') .replace(/:SS/, ':ss'); var d = input.getDate(); var dd = d < 10 ? '0' + d : d; var m = input.getMonth() + 1; var mm = m < 10 ? '0' + m : m; var yy = ('' + input.getFullYear()).substr(2); var yyyy = input.getFullYear(); var h = input.getHours() % 12 || 12; var hh = h < 10 ? '0' + h : h; var H = input.getHours(); var HH = H < 10 ? '0' + H : H; var M = input.getMinutes(); var MM = M < 10 ? '0' + M : M; var s = input.getSeconds(); var ss = s < 10 ? '0' + s : s; var replacer = { H: '' + H, HH: '' + HH, M: '' + M, MM: '' + MM, d: '' + d, dd: '' + dd, h: '' + h, hh: '' + hh, m: '' + m, mm: '' + mm, s: '' + s, ss: '' + ss, yy: '' + yy, yyyy: '' + yyyy }; return dateFormat.replace(/d{1,4}|m{1,4}|yy(?:yy)?|([HhMs])\1?|"[^"]*"|'[^']*'/g, function(match) { return replacer[match] ? replacer[match] : match.slice(1, match.length - 1); }); }; return { validate: function validate(input) { if (input.value === '') { return { meta: { date: null }, valid: true }; } var opts = Object.assign( {}, { format: input.element && input.element.getAttribute('type') === 'date' ? 'YYYY-MM-DD' : 'MM/DD/YYYY', message: '' }, input.options ); var message = input.l10n ? input.l10n.date.default : opts.message; var invalidResult = { message: '' + message, meta: { date: null }, valid: false }; var formats = opts.format.split(' '); var timeFormat = formats.length > 1 ? formats[1] : null; var amOrPm = formats.length > 2 ? formats[2] : null; var sections = input.value.split(' '); var dateSection = sections[0]; var timeSection = sections.length > 1 ? sections[1] : null; if (formats.length !== sections.length) { return invalidResult; } var separator = opts.separator || (dateSection.indexOf('/') !== -1 ? '/' : dateSection.indexOf('-') !== -1 ? '-' : dateSection.indexOf('.') !== -1 ? '.' : '/'); if (separator === null || dateSection.indexOf(separator) === -1) { return invalidResult; } var dateStr = dateSection.split(separator); var dateFormat = formats[0].split(separator); if (dateStr.length !== dateFormat.length) { return invalidResult; } var yearStr = dateStr[dateFormat.indexOf('YYYY')]; var monthStr = dateStr[dateFormat.indexOf('MM')]; var dayStr = dateStr[dateFormat.indexOf('DD')]; if (!/^\d+$/.test(yearStr) || !/^\d+$/.test(monthStr) || !/^\d+$/.test(dayStr) || yearStr.length > 4 || monthStr.length > 2 || dayStr.length > 2) { return invalidResult; } var year = parseInt(yearStr, 10); var month = parseInt(monthStr, 10); var day = parseInt(dayStr, 10); if (!isValidDate(year, month, day)) { return invalidResult; } var d = new Date(year, month - 1, day); if (timeFormat) { var hms = timeSection.split(':'); if (timeFormat.split(':').length !== hms.length) { return invalidResult; } var h = hms.length > 0 ? (hms[0].length <= 2 && /^\d+$/.test(hms[0]) ? parseInt(hms[0], 10) : -1) : 0; var m = hms.length > 1 ? (hms[1].length <= 2 && /^\d+$/.test(hms[1]) ? parseInt(hms[1], 10) : -1) : 0; var s = hms.length > 2 ? (hms[2].length <= 2 && /^\d+$/.test(hms[2]) ? parseInt(hms[2], 10) : -1) : 0; if (h === -1 || m === -1 || s === -1) { return invalidResult; } if (s < 0 || s > 60) { return invalidResult; } if (h < 0 || h >= 24 || (amOrPm && h > 12)) { return invalidResult; } if (m < 0 || m > 59) { return invalidResult; } d.setHours(h); d.setMinutes(m); d.setSeconds(s); } var minOption = typeof opts.min === 'function' ? opts.min() : opts.min; var min = minOption instanceof Date ? minOption : minOption ? parseDate(minOption, dateFormat, separator) : d; var maxOption = typeof opts.max === 'function' ? opts.max() : opts.max; var max = maxOption instanceof Date ? maxOption : maxOption ? parseDate(maxOption, dateFormat, separator) : d; var minOptionStr = minOption instanceof Date ? formatDate(min, opts.format) : minOption; var maxOptionStr = maxOption instanceof Date ? formatDate(max, opts.format) : maxOption; switch (true) { case !!minOptionStr && !maxOptionStr: return { message: format(input.l10n ? input.l10n.date.min : message, minOptionStr), meta: { date: d }, valid: d.getTime() >= min.getTime() }; case !!maxOptionStr && !minOptionStr: return { message: format(input.l10n ? input.l10n.date.max : message, maxOptionStr), meta: { date: d }, valid: d.getTime() <= max.getTime() }; case !!maxOptionStr && !!minOptionStr: return { message: format(input.l10n ? input.l10n.date.range : message, [minOptionStr, maxOptionStr]), meta: { date: d }, valid: d.getTime() <= max.getTime() && d.getTime() >= min.getTime() }; default: return { message: '' + message, meta: { date: d }, valid: true }; } } }; } function different() { return { validate: function validate(input) { var compareWith = 'function' === typeof input.options.compare ? input.options.compare.call(this) : input.options.compare; return { valid: compareWith === '' || input.value !== compareWith }; } }; } function digits() { return { validate: function validate(input) { return { valid: input.value === '' || /^\d+$/.test(input.value) }; } }; } function emailAddress() { var splitEmailAddresses = function splitEmailAddresses(emailAddresses, separator) { var quotedFragments = emailAddresses.split(/"/); var quotedFragmentCount = quotedFragments.length; var emailAddressArray = []; var nextEmailAddress = ''; for (var i = 0; i < quotedFragmentCount; i++) { if (i % 2 === 0) { var splitEmailAddressFragments = quotedFragments[i].split(separator); var splitEmailAddressFragmentCount = splitEmailAddressFragments.length; if (splitEmailAddressFragmentCount === 1) { nextEmailAddress += splitEmailAddressFragments[0]; } else { emailAddressArray.push(nextEmailAddress + splitEmailAddressFragments[0]); for (var j = 1; j < splitEmailAddressFragmentCount - 1; j++) { emailAddressArray.push(splitEmailAddressFragments[j]); } nextEmailAddress = splitEmailAddressFragments[splitEmailAddressFragmentCount - 1]; } } else { nextEmailAddress += '"' + quotedFragments[i]; if (i < quotedFragmentCount - 1) { nextEmailAddress += '"'; } } } emailAddressArray.push(nextEmailAddress); return emailAddressArray; }; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign( {}, { multiple: false, separator: /[,;]/ }, input.options ); var emailRegExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; var allowMultiple = opts.multiple === true || '' + opts.multiple === 'true'; if (allowMultiple) { var separator = opts.separator || /[,;]/; var addresses = splitEmailAddresses(input.value, separator); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = addresses[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var reg = _step.value; if (!emailRegExp.test(reg)) { return { valid: false }; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return { valid: true }; } else { return { valid: emailRegExp.test(input.value) }; } } }; } function file() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var extension = void 0; var extensions = input.options.extension ? input.options.extension.toLowerCase().split(',') : null; var types = input.options.type ? input.options.type.toLowerCase().split(',') : null; var html5 = window['File'] && window['FileList'] && window['FileReader']; if (html5) { var files = input.element.files; var total = files.length; var allSize = 0; if (input.options.maxFiles && total > parseInt('' + input.options.maxFiles, 10)) { return { meta: { error: 'INVALID_MAX_FILES' }, valid: false }; } if (input.options.minFiles && total < parseInt('' + input.options.minFiles, 10)) { return { meta: { error: 'INVALID_MIN_FILES' }, valid: false }; } var metaData = {}; for (var i = 0; i < total; i++) { allSize += files[i].size; extension = files[i].name.substr(files[i].name.lastIndexOf('.') + 1); metaData = { ext: extension, file: files[i], size: files[i].size, type: files[i].type }; if (input.options.minSize && files[i].size < parseInt('' + input.options.minSize, 10)) { return { meta: Object.assign({}, { error: 'INVALID_MIN_SIZE' }, metaData), valid: false }; } if (input.options.maxSize && files[i].size > parseInt('' + input.options.maxSize, 10)) { return { meta: Object.assign({}, { error: 'INVALID_MAX_SIZE' }, metaData), valid: false }; } if (extensions && extensions.indexOf(extension.toLowerCase()) === -1) { return { meta: Object.assign({}, { error: 'INVALID_EXTENSION' }, metaData), valid: false }; } if (files[i].type && types && types.indexOf(files[i].type.toLowerCase()) === -1) { return { meta: Object.assign({}, { error: 'INVALID_TYPE' }, metaData), valid: false }; } } if (input.options.maxTotalSize && allSize > parseInt('' + input.options.maxTotalSize, 10)) { return { meta: Object.assign( {}, { error: 'INVALID_MAX_TOTAL_SIZE', totalSize: allSize }, metaData ), valid: false }; } if (input.options.minTotalSize && allSize < parseInt('' + input.options.minTotalSize, 10)) { return { meta: Object.assign( {}, { error: 'INVALID_MIN_TOTAL_SIZE', totalSize: allSize }, metaData ), valid: false }; } } else { extension = input.value.substr(input.value.lastIndexOf('.') + 1); if (extensions && extensions.indexOf(extension.toLowerCase()) === -1) { return { meta: { error: 'INVALID_EXTENSION', ext: extension }, valid: false }; } } return { valid: true }; } }; } function greaterThan() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, { inclusive: true }, input.options); var minValue = parseFloat(('' + opts.min).replace(',', '.')); return opts.inclusive ? { message: input.l10n ? format(opts.message || input.l10n.greaterThan.default, '' + minValue) : opts.message, valid: parseFloat(input.value) >= minValue } : { message: input.l10n ? format(opts.message || input.l10n.greaterThan.notInclusive, '' + minValue) : opts.message, valid: parseFloat(input.value) > minValue }; } }; } function identical() { return { validate: function validate(input) { var compareWith = 'function' === typeof input.options.compare ? input.options.compare.call(this) : input.options.compare; return { valid: compareWith === '' || input.value === compareWith }; } }; } function integer() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign( {}, { decimalSeparator: '.', thousandsSeparator: '' }, input.options ); var decimalSeparator = opts.decimalSeparator === '.' ? '\\.' : opts.decimalSeparator; var thousandsSeparator = opts.thousandsSeparator === '.' ? '\\.' : opts.thousandsSeparator; var testRegexp = new RegExp('^-?[0-9]{1,3}(' + thousandsSeparator + '[0-9]{3})*(' + decimalSeparator + '[0-9]+)?$'); var thousandsReplacer = new RegExp(thousandsSeparator, 'g'); var v = '' + input.value; if (!testRegexp.test(v)) { return { valid: false }; } if (thousandsSeparator) { v = v.replace(thousandsReplacer, ''); } if (decimalSeparator) { v = v.replace(decimalSeparator, '.'); } var n = parseFloat(v); return { valid: !isNaN(n) && isFinite(n) && Math.floor(n) === n }; } }; } function ip() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign( {}, { ipv4: true, ipv6: true }, input.options ); var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[1-2][0-9]|3[0-2]))?$/; var ipv6Regex = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*(\/(\d|\d\d|1[0-1]\d|12[0-8]))?$/; switch (true) { case opts.ipv4 && !opts.ipv6: return { message: input.l10n ? opts.message || input.l10n.ip.ipv4 : opts.message, valid: ipv4Regex.test(input.value) }; case !opts.ipv4 && opts.ipv6: return { message: input.l10n ? opts.message || input.l10n.ip.ipv6 : opts.message, valid: ipv6Regex.test(input.value) }; case opts.ipv4 && opts.ipv6: default: return { message: input.l10n ? opts.message || input.l10n.ip.default : opts.message, valid: ipv4Regex.test(input.value) || ipv6Regex.test(input.value) }; } } }; } function lessThan() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, { inclusive: true }, input.options); var maxValue = parseFloat(('' + opts.max).replace(',', '.')); return opts.inclusive ? { message: input.l10n ? format(opts.message || input.l10n.lessThan.default, '' + maxValue) : opts.message, valid: parseFloat(input.value) <= maxValue } : { message: input.l10n ? format(opts.message || input.l10n.lessThan.notInclusive, '' + maxValue) : opts.message, valid: parseFloat(input.value) < maxValue }; } }; } function notEmpty() { return { validate: function validate(input) { return { valid: input.value !== '' }; } }; } function numeric() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign( {}, { decimalSeparator: '.', thousandsSeparator: '' }, input.options ); var v = '' + input.value; if (v.substr(0, 1) === opts.decimalSeparator) { v = '0' + opts.decimalSeparator + v.substr(1); } else if (v.substr(0, 2) === '-' + opts.decimalSeparator) { v = '-0' + opts.decimalSeparator + v.substr(2); } var decimalSeparator = opts.decimalSeparator === '.' ? '\\.' : opts.decimalSeparator; var thousandsSeparator = opts.thousandsSeparator === '.' ? '\\.' : opts.thousandsSeparator; var testRegexp = new RegExp('^-?[0-9]{1,3}(' + thousandsSeparator + '[0-9]{3})*(' + decimalSeparator + '[0-9]+)?$'); var thousandsReplacer = new RegExp(thousandsSeparator, 'g'); if (!testRegexp.test(v)) { return { valid: false }; } if (thousandsSeparator) { v = v.replace(thousandsReplacer, ''); } if (decimalSeparator) { v = v.replace(decimalSeparator, '.'); } var n = parseFloat(v); return { valid: !isNaN(n) && isFinite(n) }; } }; } function promise() { return { validate: function validate(input) { return call(input.options.promise, [input]); } }; } function regexp() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var reg = input.options.regexp; if (reg instanceof RegExp) { return { valid: reg.test(input.value) }; } else { var pattern = reg.toString(); var exp = input.options.flags ? new RegExp(pattern, input.options.flags) : new RegExp(pattern); return { valid: exp.test(input.value) }; } } }; } function fetch(url, options) { var toQuery = function toQuery(obj) { return Object.keys(obj) .map(function(k) { return encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]); }) .join('&'); }; return new Promise(function(resolve, reject) { var opts = Object.assign( {}, { crossDomain: false, headers: {}, method: 'GET', params: {} }, options ); var params = Object.keys(opts.params) .map(function(k) { return encodeURIComponent(k) + '=' + encodeURIComponent(opts.params[k]); }) .join('&'); var hasQuery = url.indexOf('?'); var requestUrl = 'GET' === opts.method ? '' + url + (hasQuery ? '?' : '&') + params : url; if (opts.crossDomain) { var script = document.createElement('script'); var callback = '___fetch' + Date.now() + '___'; window[callback] = function(data) { delete window[callback]; resolve(data); }; script.src = '' + requestUrl + (hasQuery ? '&' : '?') + 'callback=' + callback; script.async = true; script.addEventListener('load', function() { script.parentNode.removeChild(script); }); script.addEventListener('error', function() { return reject; }); document.head.appendChild(script); } else { var request = new XMLHttpRequest(); request.open(opts.method, requestUrl); request.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); if ('POST' === opts.method) { request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); } Object.keys(opts.headers).forEach(function(k) { return request.setRequestHeader(k, opts.headers[k]); }); request.addEventListener('load', function() { resolve(JSON.parse(this.responseText)); }); request.addEventListener('error', function() { return reject; }); request.send(toQuery(opts.params)); } }); } function remote() { var DEFAULT_OPTIONS = { crossDomain: false, data: {}, headers: {}, method: 'GET', validKey: 'valid' }; return { validate: function validate(input) { if (input.value === '') { return Promise.resolve({ valid: true }); } var opts = Object.assign({}, DEFAULT_OPTIONS, input.options); var data = opts.data; if ('function' === typeof opts.data) { data = opts.data.call(this, input); } if ('string' === typeof data) { data = JSON.parse(data); } data[opts.name || input.field] = input.value; var url = 'function' === typeof opts.url ? opts.url.call(this, input) : opts.url; return fetch(url, { crossDomain: opts.crossDomain, headers: opts.headers, method: opts.method, params: data }) .then(function(response) { return Promise.resolve({ message: response.message, meta: response, valid: '' + response[opts.validKey] === 'true' }); }) .catch(function(reason) { return Promise.reject({ valid: false }); }); } }; } function stringCase() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, { case: 'lower' }, input.options); var caseOpt = (opts.case || 'lower').toLowerCase(); return { message: opts.message || (input.l10n ? ('upper' === caseOpt ? input.l10n.stringCase.upper : input.l10n.stringCase.default) : opts.message), valid: 'upper' === caseOpt ? input.value === input.value.toUpperCase() : input.value === input.value.toLowerCase() }; } }; } function stringLength() { var utf8Length = function utf8Length(str) { var s = str.length; for (var i = str.length - 1; i >= 0; i--) { var code = str.charCodeAt(i); if (code > 0x7f && code <= 0x7ff) { s++; } else if (code > 0x7ff && code <= 0xffff) { s += 2; } if (code >= 0xdc00 && code <= 0xdfff) { i--; } } return '' + s; }; return { validate: function validate(input) { var opts = Object.assign( {}, { trim: false, utf8Bytes: false }, input.options ); var v = opts.trim === true || '' + opts.trim === 'true' ? input.value.trim() : input.value; if (v === '') { return { valid: true }; } var min = opts.min ? '' + opts.min : ''; var max = opts.max ? '' + opts.max : ''; var length = opts.utf8Bytes ? utf8Length(v) : v.length; var isValid = true; var msg = input.l10n ? opts.message || input.l10n.stringLength.default : opts.message; if ((min && length < parseInt(min, 10)) || (max && length > parseInt(max, 10))) { isValid = false; } switch (true) { case !!min && !!max: msg = input.l10n ? format(opts.message || input.l10n.stringLength.between, [min, max]) : opts.message; break; case !!min: msg = input.l10n ? format(opts.message || input.l10n.stringLength.more, parseInt(min, 10) - 1 + '') : opts.message; break; case !!max: msg = input.l10n ? format(opts.message || input.l10n.stringLength.less, parseInt(max, 10) + 1 + '') : opts.message; break; default: break; } return { message: msg, valid: isValid }; } }; } function uri() { var DEFAULT_OPTIONS = { allowEmptyProtocol: false, allowLocal: false, protocol: 'http, https, ftp' }; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, DEFAULT_OPTIONS, input.options); var allowLocal = opts.allowLocal === true || '' + opts.allowLocal === 'true'; var allowEmptyProtocol = opts.allowEmptyProtocol === true || '' + opts.allowEmptyProtocol === 'true'; var protocol = opts.protocol .split(',') .join('|') .replace(/\s/g, ''); var urlExp = new RegExp( '^' + '(?:(?:' + protocol + ')://)' + (allowEmptyProtocol ? '?' : '') + '(?:\\S+(?::\\S*)?@)?' + '(?:' + (allowLocal ? '' : '(?!(?:10|127)(?:\\.\\d{1,3}){3})' + '(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})' + '(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})') + '(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])' + '(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}' + '(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))' + '|' + '(?:(?:[a-z\\u00a1-\\uffff0-9]-?)*[a-z\\u00a1-\\uffff0-9]+)' + '(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-?)*[a-z\\u00a1-\\uffff0-9])*' + '(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))' + (allowLocal ? '?' : '') + ')' + '(?::\\d{2,5})?' + '(?:/[^\\s]*)?$', 'i' ); return { valid: urlExp.test(input.value) }; } }; } function base64() { return { validate: function validate(input) { return { valid: input.value === '' || /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(input.value) }; } }; } function bic() { return { validate: function validate(input) { return { valid: input.value === '' || /^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$/.test(input.value) }; } }; } function color() { var SUPPORTED_TYPES = ['hex', 'rgb', 'rgba', 'hsl', 'hsla', 'keyword']; var KEYWORD_COLORS = [ 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'transparent', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen' ]; var hex = function hex(value) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(value); }; var hsl = function hsl(value) { return /^hsl\((\s*(-?\d+)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*)\)$/.test(value); }; var hsla = function hsla(value) { return /^hsla\((\s*(-?\d+)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*,){2}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(value); }; var keyword = function keyword(value) { return KEYWORD_COLORS.indexOf(value) >= 0; }; var rgb = function rgb(value) { return ( /^rgb\((\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*,){2}(\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*)\)$/.test(value) || /^rgb\((\s*(\b(0?\d{1,2}|100)\b%)\s*,){2}(\s*(\b(0?\d{1,2}|100)\b%)\s*)\)$/.test(value) ); }; var rgba = function rgba(value) { return ( /^rgba\((\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*,){3}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(value) || /^rgba\((\s*(\b(0?\d{1,2}|100)\b%)\s*,){3}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(value) ); }; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var types = typeof input.options.type === 'string' ? input.options.type .toString() .replace(/s/g, '') .split(',') : input.options.type || SUPPORTED_TYPES; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = types[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var type = _step.value; var tpe = type.toLowerCase(); if (SUPPORTED_TYPES.indexOf(tpe) === -1) { continue; } var result = true; switch (tpe) { case 'hex': result = hex(input.value); break; case 'hsl': result = hsl(input.value); break; case 'hsla': result = hsla(input.value); break; case 'keyword': result = keyword(input.value); break; case 'rgb': result = rgb(input.value); break; case 'rgba': result = rgba(input.value); break; } if (result) { return { valid: true }; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return { valid: false }; } }; } function cusip() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var v = input.value.toUpperCase(); if (!/^[0-9A-Z]{9}$/.test(v)) { return { valid: false }; } var converted = v.split('').map(function(item) { var code = item.charCodeAt(0); return code >= 'A'.charCodeAt(0) && code <= 'Z'.charCodeAt(0) ? code - 'A'.charCodeAt(0) + 10 + '' : item; }); var length = converted.length; var sum = 0; for (var i = 0; i < length - 1; i++) { var num = parseInt(converted[i], 10); if (i % 2 !== 0) { num *= 2; } if (num > 9) { num -= 9; } sum += num; } sum = (10 - sum % 10) % 10; return { valid: sum === parseInt(converted[length - 1], 10) }; } }; } function ean() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } if (!/^(\d{8}|\d{12}|\d{13})$/.test(input.value)) { return { valid: false }; } var length = input.value.length; var sum = 0; var weight = length === 8 ? [3, 1] : [1, 3]; for (var i = 0; i < length - 1; i++) { sum += parseInt(input.value.charAt(i), 10) * weight[i % 2]; } sum = (10 - sum % 10) % 10; return { valid: '' + sum === input.value.charAt(length - 1) }; } }; } function ein() { var CAMPUS = { ANDOVER: ['10', '12'], ATLANTA: ['60', '67'], AUSTIN: ['50', '53'], BROOKHAVEN: ['01', '02', '03', '04', '05', '06', '11', '13', '14', '16', '21', '22', '23', '25', '34', '51', '52', '54', '55', '56', '57', '58', '59', '65'], CINCINNATI: ['30', '32', '35', '36', '37', '38', '61'], FRESNO: ['15', '24'], INTERNET: ['20', '26', '27', '45', '46', '47'], KANSAS_CITY: ['40', '44'], MEMPHIS: ['94', '95'], OGDEN: ['80', '90'], PHILADELPHIA: [ '33', '39', '41', '42', '43', '48', '62', '63', '64', '66', '68', '71', '72', '73', '74', '75', '76', '77', '81', '82', '83', '84', '85', '86', '87', '88', '91', '92', '93', '98', '99' ], SMALL_BUSINESS_ADMINISTRATION: ['31'] }; return { validate: function validate(input) { if (input.value === '') { return { meta: null, valid: true }; } if (!/^[0-9]{2}-?[0-9]{7}$/.test(input.value)) { return { meta: null, valid: false }; } var campus = '' + input.value.substr(0, 2); for (var key in CAMPUS) { if (CAMPUS[key].indexOf(campus) !== -1) { return { meta: { campus: key }, valid: true }; } } return { meta: null, valid: false }; } }; } function grid() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var v = input.value.toUpperCase(); if (!/^[GRID:]*([0-9A-Z]{2})[-\s]*([0-9A-Z]{5})[-\s]*([0-9A-Z]{10})[-\s]*([0-9A-Z]{1})$/g.test(v)) { return { valid: false }; } v = v.replace(/\s/g, '').replace(/-/g, ''); if ('GRID:' === v.substr(0, 5)) { v = v.substr(5); } return { valid: mod37And36(v) }; } }; } function hex() { return { validate: function validate(input) { return { valid: input.value === '' || /^[0-9a-fA-F]+$/.test(input.value) }; } }; } function iban() { var IBAN_PATTERNS = { AD: 'AD[0-9]{2}[0-9]{4}[0-9]{4}[A-Z0-9]{12}', AE: 'AE[0-9]{2}[0-9]{3}[0-9]{16}', AL: 'AL[0-9]{2}[0-9]{8}[A-Z0-9]{16}', AO: 'AO[0-9]{2}[0-9]{21}', AT: 'AT[0-9]{2}[0-9]{5}[0-9]{11}', AZ: 'AZ[0-9]{2}[A-Z]{4}[A-Z0-9]{20}', BA: 'BA[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{8}[0-9]{2}', BE: 'BE[0-9]{2}[0-9]{3}[0-9]{7}[0-9]{2}', BF: 'BF[0-9]{2}[0-9]{23}', BG: 'BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}', BH: 'BH[0-9]{2}[A-Z]{4}[A-Z0-9]{14}', BI: 'BI[0-9]{2}[0-9]{12}', BJ: 'BJ[0-9]{2}[A-Z]{1}[0-9]{23}', BR: 'BR[0-9]{2}[0-9]{8}[0-9]{5}[0-9]{10}[A-Z][A-Z0-9]', CH: 'CH[0-9]{2}[0-9]{5}[A-Z0-9]{12}', CI: 'CI[0-9]{2}[A-Z]{1}[0-9]{23}', CM: 'CM[0-9]{2}[0-9]{23}', CR: 'CR[0-9]{2}[0-9]{3}[0-9]{14}', CV: 'CV[0-9]{2}[0-9]{21}', CY: 'CY[0-9]{2}[0-9]{3}[0-9]{5}[A-Z0-9]{16}', CZ: 'CZ[0-9]{2}[0-9]{20}', DE: 'DE[0-9]{2}[0-9]{8}[0-9]{10}', DK: 'DK[0-9]{2}[0-9]{14}', DO: 'DO[0-9]{2}[A-Z0-9]{4}[0-9]{20}', DZ: 'DZ[0-9]{2}[0-9]{20}', EE: 'EE[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{11}[0-9]{1}', ES: 'ES[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{1}[0-9]{1}[0-9]{10}', FI: 'FI[0-9]{2}[0-9]{6}[0-9]{7}[0-9]{1}', FO: 'FO[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}', FR: 'FR[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}', GB: 'GB[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}', GE: 'GE[0-9]{2}[A-Z]{2}[0-9]{16}', GI: 'GI[0-9]{2}[A-Z]{4}[A-Z0-9]{15}', GL: 'GL[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}', GR: 'GR[0-9]{2}[0-9]{3}[0-9]{4}[A-Z0-9]{16}', GT: 'GT[0-9]{2}[A-Z0-9]{4}[A-Z0-9]{20}', HR: 'HR[0-9]{2}[0-9]{7}[0-9]{10}', HU: 'HU[0-9]{2}[0-9]{3}[0-9]{4}[0-9]{1}[0-9]{15}[0-9]{1}', IE: 'IE[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}', IL: 'IL[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{13}', IR: 'IR[0-9]{2}[0-9]{22}', IS: 'IS[0-9]{2}[0-9]{4}[0-9]{2}[0-9]{6}[0-9]{10}', IT: 'IT[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}', JO: 'JO[0-9]{2}[A-Z]{4}[0-9]{4}[0]{8}[A-Z0-9]{10}', KW: 'KW[0-9]{2}[A-Z]{4}[0-9]{22}', KZ: 'KZ[0-9]{2}[0-9]{3}[A-Z0-9]{13}', LB: 'LB[0-9]{2}[0-9]{4}[A-Z0-9]{20}', LI: 'LI[0-9]{2}[0-9]{5}[A-Z0-9]{12}', LT: 'LT[0-9]{2}[0-9]{5}[0-9]{11}', LU: 'LU[0-9]{2}[0-9]{3}[A-Z0-9]{13}', LV: 'LV[0-9]{2}[A-Z]{4}[A-Z0-9]{13}', MC: 'MC[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}', MD: 'MD[0-9]{2}[A-Z0-9]{20}', ME: 'ME[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', MG: 'MG[0-9]{2}[0-9]{23}', MK: 'MK[0-9]{2}[0-9]{3}[A-Z0-9]{10}[0-9]{2}', ML: 'ML[0-9]{2}[A-Z]{1}[0-9]{23}', MR: 'MR13[0-9]{5}[0-9]{5}[0-9]{11}[0-9]{2}', MT: 'MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}', MU: 'MU[0-9]{2}[A-Z]{4}[0-9]{2}[0-9]{2}[0-9]{12}[0-9]{3}[A-Z]{3}', MZ: 'MZ[0-9]{2}[0-9]{21}', NL: 'NL[0-9]{2}[A-Z]{4}[0-9]{10}', NO: 'NO[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{1}', PK: 'PK[0-9]{2}[A-Z]{4}[A-Z0-9]{16}', PL: 'PL[0-9]{2}[0-9]{8}[0-9]{16}', PS: 'PS[0-9]{2}[A-Z]{4}[A-Z0-9]{21}', PT: 'PT[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{11}[0-9]{2}', QA: 'QA[0-9]{2}[A-Z]{4}[A-Z0-9]{21}', RO: 'RO[0-9]{2}[A-Z]{4}[A-Z0-9]{16}', RS: 'RS[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', SA: 'SA[0-9]{2}[0-9]{2}[A-Z0-9]{18}', SE: 'SE[0-9]{2}[0-9]{3}[0-9]{16}[0-9]{1}', SI: 'SI[0-9]{2}[0-9]{5}[0-9]{8}[0-9]{2}', SK: 'SK[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{10}', SM: 'SM[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}', SN: 'SN[0-9]{2}[A-Z]{1}[0-9]{23}', TL: 'TL38[0-9]{3}[0-9]{14}[0-9]{2}', TN: 'TN59[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}', TR: 'TR[0-9]{2}[0-9]{5}[A-Z0-9]{1}[A-Z0-9]{16}', VG: 'VG[0-9]{2}[A-Z]{4}[0-9]{16}', XK: 'XK[0-9]{2}[0-9]{4}[0-9]{10}[0-9]{2}' }; var SEPA_COUNTRIES = [ 'AT', 'BE', 'BG', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'HR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'SM' ]; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, input.options); var v = input.value.replace(/[^a-zA-Z0-9]/g, '').toUpperCase(); var country = opts.country || v.substr(0, 2); if (!IBAN_PATTERNS[country]) { return { message: opts.message, valid: false }; } if (opts.sepa !== undefined) { var isSepaCountry = SEPA_COUNTRIES.indexOf(country) !== -1; if (((opts.sepa === 'true' || opts.sepa === true) && !isSepaCountry) || ((opts.sepa === 'false' || opts.sepa === false) && isSepaCountry)) { return { message: opts.message, valid: false }; } } var msg = input.l10n ? format(opts.message || input.l10n.iban.country, input.l10n.iban.countries[country]) : opts.message; if (!new RegExp('^' + IBAN_PATTERNS[country] + '$').test(input.value)) { return { message: msg, valid: false }; } v = '' + v.substr(4) + v.substr(0, 4); v = v .split('') .map(function(n) { var code = n.charCodeAt(0); return code >= 'A'.charCodeAt(0) && code <= 'Z'.charCodeAt(0) ? code - 'A'.charCodeAt(0) + 10 : n; }) .join(''); var temp = parseInt(v.substr(0, 1), 10); var length = v.length; for (var i = 1; i < length; ++i) { temp = (temp * 10 + parseInt(v.substr(i, 1), 10)) % 97; } return { message: msg, valid: temp === 1 }; } }; } function id() { var COUNTRY_CODES = [ 'BA', 'BG', 'BR', 'CH', 'CL', 'CN', 'CZ', 'DK', 'EE', 'ES', 'FI', 'HR', 'IE', 'IS', 'LT', 'LV', 'ME', 'MK', 'NL', 'PL', 'RO', 'RS', 'SE', 'SI', 'SK', 'SM', 'TH', 'TR', 'ZA' ]; var validateJMBG = function validateJMBG(value, countryCode) { if (!/^\d{13}$/.test(value)) { return false; } var day = parseInt(value.substr(0, 2), 10); var month = parseInt(value.substr(2, 2), 10); var rr = parseInt(value.substr(7, 2), 10); var k = parseInt(value.substr(12, 1), 10); if (day > 31 || month > 12) { return false; } var sum = 0; for (var i = 0; i < 6; i++) { sum += (7 - i) * (parseInt(value.charAt(i), 10) + parseInt(value.charAt(i + 6), 10)); } sum = 11 - sum % 11; if (sum === 10 || sum === 11) { sum = 0; } if (sum !== k) { return false; } switch (countryCode.toUpperCase()) { case 'BA': return 10 <= rr && rr <= 19; case 'MK': return 41 <= rr && rr <= 49; case 'ME': return 20 <= rr && rr <= 29; case 'RS': return 70 <= rr && rr <= 99; case 'SI': return 50 <= rr && rr <= 59; default: return true; } }; var ba = function ba(value) { return validateJMBG(value, 'BA'); }; var me = function me(value) { return validateJMBG(value, 'ME'); }; var mk = function mk(value) { return validateJMBG(value, 'MK'); }; var rs = function rs(value) { return validateJMBG(value, 'RS'); }; var si = function si(value) { return validateJMBG(value, 'SI'); }; var bg = function bg(value) { if (!/^\d{10}$/.test(value) && !/^\d{6}\s\d{3}\s\d{1}$/.test(value)) { return false; } var v = value.replace(/\s/g, ''); var year = parseInt(v.substr(0, 2), 10) + 1900; var month = parseInt(v.substr(2, 2), 10); var day = parseInt(v.substr(4, 2), 10); if (month > 40) { year += 100; month -= 40; } else if (month > 20) { year -= 100; month -= 20; } if (!isValidDate(year, month, day)) { return false; } var sum = 0; var weight = [2, 4, 8, 5, 10, 9, 7, 3, 6]; for (var i = 0; i < 9; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = (sum % 11) % 10; return '' + sum === v.substr(9, 1); }; var br = function br(value) { var v = value.replace(/\D/g, ''); if (!/^\d{11}$/.test(v) || /^1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11}|0{11}$/.test(v)) { return false; } var d1 = 0; var i = void 0; for (i = 0; i < 9; i++) { d1 += (10 - i) * parseInt(v.charAt(i), 10); } d1 = 11 - d1 % 11; if (d1 === 10 || d1 === 11) { d1 = 0; } if ('' + d1 !== v.charAt(9)) { return false; } var d2 = 0; for (i = 0; i < 10; i++) { d2 += (11 - i) * parseInt(v.charAt(i), 10); } d2 = 11 - d2 % 11; if (d2 === 10 || d2 === 11) { d2 = 0; } return '' + d2 === v.charAt(10); }; var ch = function ch(value) { if (!/^756[\.]{0,1}[0-9]{4}[\.]{0,1}[0-9]{4}[\.]{0,1}[0-9]{2}$/.test(value)) { return false; } var v = value.replace(/\D/g, '').substr(3); var length = v.length; var weight = length === 8 ? [3, 1] : [1, 3]; var sum = 0; for (var i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * weight[i % 2]; } sum = 10 - sum % 10; return '' + sum === v.charAt(length - 1); }; var cl = function cl(value) { if (!/^\d{7,8}[-]{0,1}[0-9K]$/i.test(value)) { return false; } var v = value.replace(/\-/g, ''); while (v.length < 9) { v = '0' + v; } var weight = [3, 2, 7, 6, 5, 4, 3, 2]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = 11 - sum % 11; var cd = '' + sum; if (sum === 11) { cd = '0'; } else if (sum === 10) { cd = 'K'; } return cd === v.charAt(8).toUpperCase(); }; var cn = function cn(value) { var v = value.trim(); if (!/^\d{15}$/.test(v) && !/^\d{17}[\dXx]{1}$/.test(v)) { return false; } var adminDivisionCodes = { 11: { 0: [0], 1: [[0, 9], [11, 17]], 2: [0, 28, 29] }, 12: { 0: [0], 1: [[0, 16]], 2: [0, 21, 23, 25] }, 13: { 0: [0], 1: [[0, 5], 7, 8, 21, [23, 33], [81, 85]], 2: [[0, 5], [7, 9], [23, 25], 27, 29, 30, 81, 83], 3: [[0, 4], [21, 24]], 4: [[0, 4], 6, 21, [23, 35], 81], 5: [[0, 3], [21, 35], 81, 82], 6: [[0, 4], [21, 38], [81, 84]], 7: [[0, 3], 5, 6, [21, 33]], 8: [[0, 4], [21, 28]], 9: [[0, 3], [21, 30], [81, 84]], 10: [[0, 3], [22, 26], 28, 81, 82], 11: [[0, 2], [21, 28], 81, 82] }, 14: { 0: [0], 1: [0, 1, [5, 10], [21, 23], 81], 2: [[0, 3], 11, 12, [21, 27]], 3: [[0, 3], 11, 21, 22], 4: [[0, 2], 11, 21, [23, 31], 81], 5: [[0, 2], 21, 22, 24, 25, 81], 6: [[0, 3], [21, 24]], 7: [[0, 2], [21, 29], 81], 8: [[0, 2], [21, 30], 81, 82], 9: [[0, 2], [21, 32], 81], 10: [[0, 2], [21, 34], 81, 82], 11: [[0, 2], [21, 30], 81, 82], 23: [[0, 3], 22, 23, [25, 30], 32, 33] }, 15: { 0: [0], 1: [[0, 5], [21, 25]], 2: [[0, 7], [21, 23]], 3: [[0, 4]], 4: [[0, 4], [21, 26], [28, 30]], 5: [[0, 2], [21, 26], 81], 6: [[0, 2], [21, 27]], 7: [[0, 3], [21, 27], [81, 85]], 8: [[0, 2], [21, 26]], 9: [[0, 2], [21, 29], 81], 22: [[0, 2], [21, 24]], 25: [[0, 2], [22, 31]], 26: [[0, 2], [24, 27], [29, 32], 34], 28: [0, 1, [22, 27]], 29: [0, [21, 23]] }, 21: { 0: [0], 1: [[0, 6], [11, 14], [22, 24], 81], 2: [[0, 4], [11, 13], 24, [81, 83]], 3: [[0, 4], 11, 21, 23, 81], 4: [[0, 4], 11, [21, 23]], 5: [[0, 5], 21, 22], 6: [[0, 4], 24, 81, 82], 7: [[0, 3], 11, 26, 27, 81, 82], 8: [[0, 4], 11, 81, 82], 9: [[0, 5], 11, 21, 22], 10: [[0, 5], 11, 21, 81], 11: [[0, 3], 21, 22], 12: [[0, 2], 4, 21, 23, 24, 81, 82], 13: [[0, 3], 21, 22, 24, 81, 82], 14: [[0, 4], 21, 22, 81] }, 22: { 0: [0], 1: [[0, 6], 12, 22, [81, 83]], 2: [[0, 4], 11, 21, [81, 84]], 3: [[0, 3], 22, 23, 81, 82], 4: [[0, 3], 21, 22], 5: [[0, 3], 21, 23, 24, 81, 82], 6: [[0, 2], 4, 5, [21, 23], 25, 81], 7: [[0, 2], [21, 24], 81], 8: [[0, 2], 21, 22, 81, 82], 24: [[0, 6], 24, 26] }, 23: { 0: [0], 1: [[0, 12], 21, [23, 29], [81, 84]], 2: [[0, 8], 21, [23, 25], 27, [29, 31], 81], 3: [[0, 7], 21, 81, 82], 4: [[0, 7], 21, 22], 5: [[0, 3], 5, 6, [21, 24]], 6: [[0, 6], [21, 24]], 7: [[0, 16], 22, 81], 8: [[0, 5], 11, 22, 26, 28, 33, 81, 82], 9: [[0, 4], 21], 10: [[0, 5], 24, 25, 81, [83, 85]], 11: [[0, 2], 21, 23, 24, 81, 82], 12: [[0, 2], [21, 26], [81, 83]], 27: [[0, 4], [21, 23]] }, 31: { 0: [0], 1: [0, 1, [3, 10], [12, 20]], 2: [0, 30] }, 32: { 0: [0], 1: [[0, 7], 11, [13, 18], 24, 25], 2: [[0, 6], 11, 81, 82], 3: [[0, 5], 11, 12, [21, 24], 81, 82], 4: [[0, 2], 4, 5, 11, 12, 81, 82], 5: [[0, 9], [81, 85]], 6: [[0, 2], 11, 12, 21, 23, [81, 84]], 7: [0, 1, 3, 5, 6, [21, 24]], 8: [[0, 4], 11, 26, [29, 31]], 9: [[0, 3], [21, 25], 28, 81, 82], 10: [[0, 3], 11, 12, 23, 81, 84, 88], 11: [[0, 2], 11, 12, [81, 83]], 12: [[0, 4], [81, 84]], 13: [[0, 2], 11, [21, 24]] }, 33: { 0: [0], 1: [[0, 6], [8, 10], 22, 27, 82, 83, 85], 2: [0, 1, [3, 6], 11, 12, 25, 26, [81, 83]], 3: [[0, 4], 22, 24, [26, 29], 81, 82], 4: [[0, 2], 11, 21, 24, [81, 83]], 5: [[0, 3], [21, 23]], 6: [[0, 2], 21, 24, [81, 83]], 7: [[0, 3], 23, 26, 27, [81, 84]], 8: [[0, 3], 22, 24, 25, 81], 9: [[0, 3], 21, 22], 10: [[0, 4], [21, 24], 81, 82], 11: [[0, 2], [21, 27], 81] }, 34: { 0: [0], 1: [[0, 4], 11, [21, 24], 81], 2: [[0, 4], 7, 8, [21, 23], 25], 3: [[0, 4], 11, [21, 23]], 4: [[0, 6], 21], 5: [[0, 4], 6, [21, 23]], 6: [[0, 4], 21], 7: [[0, 3], 11, 21], 8: [[0, 3], 11, [22, 28], 81], 10: [[0, 4], [21, 24]], 11: [[0, 3], 22, [24, 26], 81, 82], 12: [[0, 4], 21, 22, 25, 26, 82], 13: [[0, 2], [21, 24]], 14: [[0, 2], [21, 24]], 15: [[0, 3], [21, 25]], 16: [[0, 2], [21, 23]], 17: [[0, 2], [21, 23]], 18: [[0, 2], [21, 25], 81] }, 35: { 0: [0], 1: [[0, 5], 11, [21, 25], 28, 81, 82], 2: [[0, 6], [11, 13]], 3: [[0, 5], 22], 4: [[0, 3], 21, [23, 30], 81], 5: [[0, 5], 21, [24, 27], [81, 83]], 6: [[0, 3], [22, 29], 81], 7: [[0, 2], [21, 25], [81, 84]], 8: [[0, 2], [21, 25], 81], 9: [[0, 2], [21, 26], 81, 82] }, 36: { 0: [0], 1: [[0, 5], 11, [21, 24]], 2: [[0, 3], 22, 81], 3: [[0, 2], 13, [21, 23]], 4: [[0, 3], 21, [23, 30], 81, 82], 5: [[0, 2], 21], 6: [[0, 2], 22, 81], 7: [[0, 2], [21, 35], 81, 82], 8: [[0, 3], [21, 30], 81], 9: [[0, 2], [21, 26], [81, 83]], 10: [[0, 2], [21, 30]], 11: [[0, 2], [21, 30], 81] }, 37: { 0: [0], 1: [[0, 5], 12, 13, [24, 26], 81], 2: [[0, 3], 5, [11, 14], [81, 85]], 3: [[0, 6], [21, 23]], 4: [[0, 6], 81], 5: [[0, 3], [21, 23]], 6: [[0, 2], [11, 13], 34, [81, 87]], 7: [[0, 5], 24, 25, [81, 86]], 8: [[0, 2], 11, [26, 32], [81, 83]], 9: [[0, 3], 11, 21, 23, 82, 83], 10: [[0, 2], [81, 83]], 11: [[0, 3], 21, 22], 12: [[0, 3]], 13: [[0, 2], 11, 12, [21, 29]], 14: [[0, 2], [21, 28], 81, 82], 15: [[0, 2], [21, 26], 81], 16: [[0, 2], [21, 26]], 17: [[0, 2], [21, 28]] }, 41: { 0: [0], 1: [[0, 6], 8, 22, [81, 85]], 2: [[0, 5], 11, [21, 25]], 3: [[0, 7], 11, [22, 29], 81], 4: [[0, 4], 11, [21, 23], 25, 81, 82], 5: [[0, 3], 5, 6, 22, 23, 26, 27, 81], 6: [[0, 3], 11, 21, 22], 7: [[0, 4], 11, 21, [24, 28], 81, 82], 8: [[0, 4], 11, [21, 23], 25, [81, 83]], 9: [[0, 2], 22, 23, [26, 28]], 10: [[0, 2], [23, 25], 81, 82], 11: [[0, 4], [21, 23]], 12: [[0, 2], 21, 22, 24, 81, 82], 13: [[0, 3], [21, 30], 81], 14: [[0, 3], [21, 26], 81], 15: [[0, 3], [21, 28]], 16: [[0, 2], [21, 28], 81], 17: [[0, 2], [21, 29]], 90: [0, 1] }, 42: { 0: [0], 1: [[0, 7], [11, 17]], 2: [[0, 5], 22, 81], 3: [[0, 3], [21, 25], 81], 5: [[0, 6], [25, 29], [81, 83]], 6: [[0, 2], 6, 7, [24, 26], [82, 84]], 7: [[0, 4]], 8: [[0, 2], 4, 21, 22, 81], 9: [[0, 2], [21, 23], 81, 82, 84], 10: [[0, 3], [22, 24], 81, 83, 87], 11: [[0, 2], [21, 27], 81, 82], 12: [[0, 2], [21, 24], 81], 13: [[0, 3], 21, 81], 28: [[0, 2], 22, 23, [25, 28]], 90: [0, [4, 6], 21] }, 43: { 0: [0], 1: [[0, 5], 11, 12, 21, 22, 24, 81], 2: [[0, 4], 11, 21, [23, 25], 81], 3: [[0, 2], 4, 21, 81, 82], 4: [0, 1, [5, 8], 12, [21, 24], 26, 81, 82], 5: [[0, 3], 11, [21, 25], [27, 29], 81], 6: [[0, 3], 11, 21, 23, 24, 26, 81, 82], 7: [[0, 3], [21, 26], 81], 8: [[0, 2], 11, 21, 22], 9: [[0, 3], [21, 23], 81], 10: [[0, 3], [21, 28], 81], 11: [[0, 3], [21, 29]], 12: [[0, 2], [21, 30], 81], 13: [[0, 2], 21, 22, 81, 82], 31: [0, 1, [22, 27], 30] }, 44: { 0: [0], 1: [[0, 7], [11, 16], 83, 84], 2: [[0, 5], 21, 22, 24, 29, 32, 33, 81, 82], 3: [0, 1, [3, 8]], 4: [[0, 4]], 5: [0, 1, [6, 15], 23, 82, 83], 6: [0, 1, [4, 8]], 7: [0, 1, [3, 5], 81, [83, 85]], 8: [[0, 4], 11, 23, 25, [81, 83]], 9: [[0, 3], 23, [81, 83]], 12: [[0, 3], [23, 26], 83, 84], 13: [[0, 3], [22, 24], 81], 14: [[0, 2], [21, 24], 26, 27, 81], 15: [[0, 2], 21, 23, 81], 16: [[0, 2], [21, 25]], 17: [[0, 2], 21, 23, 81], 18: [[0, 3], 21, 23, [25, 27], 81, 82], 19: [0], 20: [0], 51: [[0, 3], 21, 22], 52: [[0, 3], 21, 22, 24, 81], 53: [[0, 2], [21, 23], 81] }, 45: { 0: [0], 1: [[0, 9], [21, 27]], 2: [[0, 5], [21, 26]], 3: [[0, 5], 11, 12, [21, 32]], 4: [0, 1, [3, 6], 11, [21, 23], 81], 5: [[0, 3], 12, 21], 6: [[0, 3], 21, 81], 7: [[0, 3], 21, 22], 8: [[0, 4], 21, 81], 9: [[0, 3], [21, 24], 81], 10: [[0, 2], [21, 31]], 11: [[0, 2], [21, 23]], 12: [[0, 2], [21, 29], 81], 13: [[0, 2], [21, 24], 81], 14: [[0, 2], [21, 25], 81] }, 46: { 0: [0], 1: [0, 1, [5, 8]], 2: [0, 1], 3: [0, [21, 23]], 90: [[0, 3], [5, 7], [21, 39]] }, 50: { 0: [0], 1: [[0, 19]], 2: [0, [22, 38], [40, 43]], 3: [0, [81, 84]] }, 51: { 0: [0], 1: [0, 1, [4, 8], [12, 15], [21, 24], 29, 31, 32, [81, 84]], 3: [[0, 4], 11, 21, 22], 4: [[0, 3], 11, 21, 22], 5: [[0, 4], 21, 22, 24, 25], 6: [0, 1, 3, 23, 26, [81, 83]], 7: [0, 1, 3, 4, [22, 27], 81], 8: [[0, 2], 11, 12, [21, 24]], 9: [[0, 4], [21, 23]], 10: [[0, 2], 11, 24, 25, 28], 11: [[0, 2], [11, 13], 23, 24, 26, 29, 32, 33, 81], 13: [[0, 4], [21, 25], 81], 14: [[0, 2], [21, 25]], 15: [[0, 3], [21, 29]], 16: [[0, 3], [21, 23], 81], 17: [[0, 3], [21, 25], 81], 18: [[0, 3], [21, 27]], 19: [[0, 3], [21, 23]], 20: [[0, 2], 21, 22, 81], 32: [0, [21, 33]], 33: [0, [21, 38]], 34: [0, 1, [22, 37]] }, 52: { 0: [0], 1: [[0, 3], [11, 15], [21, 23], 81], 2: [0, 1, 3, 21, 22], 3: [[0, 3], [21, 30], 81, 82], 4: [[0, 2], [21, 25]], 5: [[0, 2], [21, 27]], 6: [[0, 3], [21, 28]], 22: [0, 1, [22, 30]], 23: [0, 1, [22, 28]], 24: [0, 1, [22, 28]], 26: [0, 1, [22, 36]], 27: [[0, 2], 22, 23, [25, 32]] }, 53: { 0: [0], 1: [[0, 3], [11, 14], 21, 22, [24, 29], 81], 3: [[0, 2], [21, 26], 28, 81], 4: [[0, 2], [21, 28]], 5: [[0, 2], [21, 24]], 6: [[0, 2], [21, 30]], 7: [[0, 2], [21, 24]], 8: [[0, 2], [21, 29]], 9: [[0, 2], [21, 27]], 23: [0, 1, [22, 29], 31], 25: [[0, 4], [22, 32]], 26: [0, 1, [21, 28]], 27: [0, 1, [22, 30]], 28: [0, 1, 22, 23], 29: [0, 1, [22, 32]], 31: [0, 2, 3, [22, 24]], 34: [0, [21, 23]], 33: [0, 21, [23, 25]], 35: [0, [21, 28]] }, 54: { 0: [0], 1: [[0, 2], [21, 27]], 21: [0, [21, 29], 32, 33], 22: [0, [21, 29], [31, 33]], 23: [0, 1, [22, 38]], 24: [0, [21, 31]], 25: [0, [21, 27]], 26: [0, [21, 27]] }, 61: { 0: [0], 1: [[0, 4], [11, 16], 22, [24, 26]], 2: [[0, 4], 22], 3: [[0, 4], [21, 24], [26, 31]], 4: [[0, 4], [22, 31], 81], 5: [[0, 2], [21, 28], 81, 82], 6: [[0, 2], [21, 32]], 7: [[0, 2], [21, 30]], 8: [[0, 2], [21, 31]], 9: [[0, 2], [21, 29]], 10: [[0, 2], [21, 26]] }, 62: { 0: [0], 1: [[0, 5], 11, [21, 23]], 2: [0, 1], 3: [[0, 2], 21], 4: [[0, 3], [21, 23]], 5: [[0, 3], [21, 25]], 6: [[0, 2], [21, 23]], 7: [[0, 2], [21, 25]], 8: [[0, 2], [21, 26]], 9: [[0, 2], [21, 24], 81, 82], 10: [[0, 2], [21, 27]], 11: [[0, 2], [21, 26]], 12: [[0, 2], [21, 28]], 24: [0, 21, [24, 29]], 26: [0, 21, [23, 30]], 29: [0, 1, [21, 27]], 30: [0, 1, [21, 27]] }, 63: { 0: [0], 1: [[0, 5], [21, 23]], 2: [0, 2, [21, 25]], 21: [0, [21, 23], [26, 28]], 22: [0, [21, 24]], 23: [0, [21, 24]], 25: [0, [21, 25]], 26: [0, [21, 26]], 27: [0, 1, [21, 26]], 28: [[0, 2], [21, 23]] }, 64: { 0: [0], 1: [0, 1, [4, 6], 21, 22, 81], 2: [[0, 3], 5, [21, 23]], 3: [[0, 3], [21, 24], 81], 4: [[0, 2], [21, 25]], 5: [[0, 2], 21, 22] }, 65: { 0: [0], 1: [[0, 9], 21], 2: [[0, 5]], 21: [0, 1, 22, 23], 22: [0, 1, 22, 23], 23: [[0, 3], [23, 25], 27, 28], 28: [0, 1, [22, 29]], 29: [0, 1, [22, 29]], 30: [0, 1, [22, 24]], 31: [0, 1, [21, 31]], 32: [0, 1, [21, 27]], 40: [0, 2, 3, [21, 28]], 42: [[0, 2], 21, [23, 26]], 43: [0, 1, [21, 26]], 90: [[0, 4]], 27: [[0, 2], 22, 23] }, 71: { 0: [0] }, 81: { 0: [0] }, 82: { 0: [0] } }; var provincial = parseInt(v.substr(0, 2), 10); var prefectural = parseInt(v.substr(2, 2), 10); var county = parseInt(v.substr(4, 2), 10); if (!adminDivisionCodes[provincial] || !adminDivisionCodes[provincial][prefectural]) { return false; } var inRange = false; var rangeDef = adminDivisionCodes[provincial][prefectural]; var i = void 0; for (i = 0; i < rangeDef.length; i++) { if ((Array.isArray(rangeDef[i]) && rangeDef[i][0] <= county && county <= rangeDef[i][1]) || (!Array.isArray(rangeDef[i]) && county === rangeDef[i])) { inRange = true; break; } } if (!inRange) { return false; } var dob = void 0; if (v.length === 18) { dob = v.substr(6, 8); } else { dob = '19' + v.substr(6, 6); } var year = parseInt(dob.substr(0, 4), 10); var month = parseInt(dob.substr(4, 2), 10); var day = parseInt(dob.substr(6, 2), 10); if (!isValidDate(year, month, day)) { return false; } if (v.length === 18) { var weight = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; var sum = 0; for (i = 0; i < 17; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = (12 - sum % 11) % 11; var checksum = v.charAt(17).toUpperCase() !== 'X' ? parseInt(v.charAt(17), 10) : 10; return checksum === sum; } return true; }; var cz = function cz(value) { if (!/^\d{9,10}$/.test(value)) { return false; } var year = 1900 + parseInt(value.substr(0, 2), 10); var month = (parseInt(value.substr(2, 2), 10) % 50) % 20; var day = parseInt(value.substr(4, 2), 10); if (value.length === 9) { if (year >= 1980) { year -= 100; } if (year > 1953) { return false; } } else if (year < 1954) { year += 100; } if (!isValidDate(year, month, day)) { return false; } if (value.length === 10) { var check = parseInt(value.substr(0, 9), 10) % 11; if (year < 1985) { check = check % 10; } return '' + check === value.substr(9, 1); } return true; }; var dk = function dk(value) { if (!/^[0-9]{6}[-]{0,1}[0-9]{4}$/.test(value)) { return false; } var v = value.replace(/-/g, ''); var day = parseInt(v.substr(0, 2), 10); var month = parseInt(v.substr(2, 2), 10); var year = parseInt(v.substr(4, 2), 10); switch (true) { case '5678'.indexOf(v.charAt(6)) !== -1 && year >= 58: year += 1800; break; case '0123'.indexOf(v.charAt(6)) !== -1: case '49'.indexOf(v.charAt(6)) !== -1 && year >= 37: year += 1900; break; default: year += 2000; break; } return isValidDate(year, month, day); }; var ee = function ee(value) { return lt(value); }; var es = function es(value) { var isDNI = /^[0-9]{8}[-]{0,1}[A-HJ-NP-TV-Z]$/.test(value); var isNIE = /^[XYZ][-]{0,1}[0-9]{7}[-]{0,1}[A-HJ-NP-TV-Z]$/.test(value); var isCIF = /^[A-HNPQS][-]{0,1}[0-9]{7}[-]{0,1}[0-9A-J]$/.test(value); if (!isDNI && !isNIE && !isCIF) { return { meta: null, valid: false }; } var v = value.replace(/-/g, ''); var check = void 0; var tpe = void 0; var isValid = true; if (isDNI || isNIE) { tpe = 'DNI'; var index = 'XYZ'.indexOf(v.charAt(0)); if (index !== -1) { v = index + v.substr(1) + ''; tpe = 'NIE'; } check = parseInt(v.substr(0, 8), 10); check = 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23]; return { meta: { type: tpe }, valid: check === v.substr(8, 1) }; } else { check = v.substr(1, 7); tpe = 'CIF'; var letter = v[0]; var control = v.substr(-1); var sum = 0; for (var i = 0; i < check.length; i++) { if (i % 2 !== 0) { sum += parseInt(check[i], 10); } else { var tmp = '' + parseInt(check[i], 10) * 2; sum += parseInt(tmp[0], 10); if (tmp.length === 2) { sum += parseInt(tmp[1], 10); } } } var lastDigit = sum - Math.floor(sum / 10) * 10; if (lastDigit !== 0) { lastDigit = 10 - lastDigit; } if ('KQS'.indexOf(letter) !== -1) { isValid = control === 'JABCDEFGHI'[lastDigit]; } else if ('ABEH'.indexOf(letter) !== -1) { isValid = control === '' + lastDigit; } else { isValid = control === '' + lastDigit || control === 'JABCDEFGHI'[lastDigit]; } return { meta: { type: tpe }, valid: isValid }; } }; var fi = function fi(value) { if (!/^[0-9]{6}[-+A][0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/.test(value)) { return false; } var day = parseInt(value.substr(0, 2), 10); var month = parseInt(value.substr(2, 2), 10); var year = parseInt(value.substr(4, 2), 10); var centuries = { '+': 1800, '-': 1900, A: 2000 }; year = centuries[value.charAt(6)] + year; if (!isValidDate(year, month, day)) { return false; } var individual = parseInt(value.substr(7, 3), 10); if (individual < 2) { return false; } var n = parseInt(value.substr(0, 6) + value.substr(7, 3) + '', 10); return '0123456789ABCDEFHJKLMNPRSTUVWXY'.charAt(n % 31) === value.charAt(10); }; var hr = function hr(value) { return /^[0-9]{11}$/.test(value) && mod11And10(value); }; var ie = function ie(value) { if (!/^\d{7}[A-W][AHWTX]?$/.test(value)) { return false; } var getCheckDigit = function getCheckDigit(v) { var input = v; while (input.length < 7) { input = '0' + input; } var alphabet = 'WABCDEFGHIJKLMNOPQRSTUV'; var sum = 0; for (var i = 0; i < 7; i++) { sum += parseInt(input.charAt(i), 10) * (8 - i); } sum += 9 * alphabet.indexOf(input.substr(7)); return alphabet[sum % 23]; }; if (value.length === 9 && ('A' === value.charAt(8) || 'H' === value.charAt(8))) { return value.charAt(7) === getCheckDigit(value.substr(0, 7) + value.substr(8) + ''); } else { return value.charAt(7) === getCheckDigit(value.substr(0, 7)); } }; var is = function is(value) { if (!/^[0-9]{6}[-]{0,1}[0-9]{4}$/.test(value)) { return false; } var v = value.replace(/-/g, ''); var day = parseInt(v.substr(0, 2), 10); var month = parseInt(v.substr(2, 2), 10); var year = parseInt(v.substr(4, 2), 10); var century = parseInt(v.charAt(9), 10); year = century === 9 ? 1900 + year : (20 + century) * 100 + year; if (!isValidDate(year, month, day, true)) { return false; } var weight = [3, 2, 7, 6, 5, 4, 3, 2]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = 11 - sum % 11; return '' + sum === v.charAt(8); }; var lt = function lt(value) { if (!/^[0-9]{11}$/.test(value)) { return false; } var gender = parseInt(value.charAt(0), 10); var year = parseInt(value.substr(1, 2), 10); var month = parseInt(value.substr(3, 2), 10); var day = parseInt(value.substr(5, 2), 10); var century = gender % 2 === 0 ? 17 + gender / 2 : 17 + (gender + 1) / 2; year = century * 100 + year; if (!isValidDate(year, month, day, true)) { return false; } var weight = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]; var sum = 0; var i = void 0; for (i = 0; i < 10; i++) { sum += parseInt(value.charAt(i), 10) * weight[i]; } sum = sum % 11; if (sum !== 10) { return '' + sum === value.charAt(10); } sum = 0; weight = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3]; for (i = 0; i < 10; i++) { sum += parseInt(value.charAt(i), 10) * weight[i]; } sum = sum % 11; if (sum === 10) { sum = 0; } return '' + sum === value.charAt(10); }; var lv = function lv(value) { if (!/^[0-9]{6}[-]{0,1}[0-9]{5}$/.test(value)) { return false; } var v = value.replace(/\D/g, ''); var day = parseInt(v.substr(0, 2), 10); var month = parseInt(v.substr(2, 2), 10); var year = parseInt(v.substr(4, 2), 10); year = year + 1800 + parseInt(v.charAt(6), 10) * 100; if (!isValidDate(year, month, day, true)) { return false; } var sum = 0; var weight = [10, 5, 8, 4, 2, 1, 6, 3, 7, 9]; for (var i = 0; i < 10; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = ((sum + 1) % 11) % 10; return '' + sum === v.charAt(10); }; var nl = function nl(value) { if (value.length < 8) { return false; } var v = value; if (v.length === 8) { v = '0' + v; } if (!/^[0-9]{4}[.]{0,1}[0-9]{2}[.]{0,1}[0-9]{3}$/.test(v)) { return false; } v = v.replace(/\./g, ''); if (parseInt(v, 10) === 0) { return false; } var sum = 0; var length = v.length; for (var i = 0; i < length - 1; i++) { sum += (9 - i) * parseInt(v.charAt(i), 10); } sum = sum % 11; if (sum === 10) { sum = 0; } return '' + sum === v.charAt(length - 1); }; var pl = function pl(value) { if (!/^[0-9]{11}$/.test(value)) { return false; } var sum = 0; var length = value.length; var weight = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 7]; for (var i = 0; i < length - 1; i++) { sum += weight[i] * parseInt(value.charAt(i), 10); } sum = sum % 10; if (sum === 0) { sum = 10; } sum = 10 - sum; return '' + sum === value.charAt(length - 1); }; var ro = function ro(value) { if (!/^[0-9]{13}$/.test(value)) { return false; } var gender = parseInt(value.charAt(0), 10); if (gender === 0 || gender === 7 || gender === 8) { return false; } var year = parseInt(value.substr(1, 2), 10); var month = parseInt(value.substr(3, 2), 10); var day = parseInt(value.substr(5, 2), 10); var centuries = { 1: 1900, 2: 1900, 3: 1800, 4: 1800, 5: 2000, 6: 2000 }; if (day > 31 && month > 12) { return false; } if (gender !== 9) { year = centuries[gender + ''] + year; if (!isValidDate(year, month, day)) { return false; } } var sum = 0; var weight = [2, 7, 9, 1, 4, 6, 3, 5, 8, 2, 7, 9]; var length = value.length; for (var i = 0; i < length - 1; i++) { sum += parseInt(value.charAt(i), 10) * weight[i]; } sum = sum % 11; if (sum === 10) { sum = 1; } return '' + sum === value.charAt(length - 1); }; var se = function se(value) { if (!/^[0-9]{10}$/.test(value) && !/^[0-9]{6}[-|+][0-9]{4}$/.test(value)) { return false; } var v = value.replace(/[^0-9]/g, ''); var year = parseInt(v.substr(0, 2), 10) + 1900; var month = parseInt(v.substr(2, 2), 10); var day = parseInt(v.substr(4, 2), 10); if (!isValidDate(year, month, day)) { return false; } return luhn(v); }; var sk = function sk(value) { return cz(value); }; var sm = function sm(value) { return /^\d{5}$/.test(value); }; var th = function th(value) { if (value.length !== 13) { return false; } var sum = 0; for (var i = 0; i < 12; i++) { sum += parseInt(value.charAt(i), 10) * (13 - i); } return (11 - sum % 11) % 10 === parseInt(value.charAt(12), 10); }; var tr = function tr(value) { if (value.length !== 11) { return false; } var sum = 0; for (var i = 0; i < 10; i++) { sum += parseInt(value.charAt(i), 10); } return sum % 10 === parseInt(value.charAt(10), 10); }; var za = function za(value) { if (!/^[0-9]{10}[0|1][8|9][0-9]$/.test(value)) { return false; } var year = parseInt(value.substr(0, 2), 10); var currentYear = new Date().getFullYear() % 100; var month = parseInt(value.substr(2, 2), 10); var day = parseInt(value.substr(4, 2), 10); year = year >= currentYear ? year + 1900 : year + 2000; if (!isValidDate(year, month, day)) { return false; } return luhn(value); }; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, input.options); var country = input.value.substr(0, 2); if ('function' === typeof opts.country) { country = opts.country.call(this); } else { country = opts.country; } if (COUNTRY_CODES.indexOf(country) === -1) { return { valid: true }; } var result = { meta: {}, valid: true }; switch (country.toLowerCase()) { case 'ba': result.valid = ba(input.value); break; case 'bg': result.valid = bg(input.value); break; case 'br': result.valid = br(input.value); break; case 'ch': result.valid = ch(input.value); break; case 'cl': result.valid = cl(input.value); break; case 'cn': result.valid = cn(input.value); break; case 'cz': result.valid = cz(input.value); break; case 'dk': result.valid = dk(input.value); break; case 'ee': result.valid = ee(input.value); break; case 'es': result = es(input.value); break; case 'fi': result.valid = fi(input.value); break; case 'hr': result.valid = hr(input.value); break; case 'ie': result.valid = ie(input.value); break; case 'is': result.valid = is(input.value); break; case 'lt': result.valid = lt(input.value); break; case 'lv': result.valid = lv(input.value); break; case 'me': result.valid = me(input.value); break; case 'mk': result.valid = mk(input.value); break; case 'nl': result.valid = nl(input.value); break; case 'pl': result.valid = pl(input.value); break; case 'ro': result.valid = ro(input.value); break; case 'rs': result.valid = rs(input.value); break; case 'se': result.valid = se(input.value); break; case 'si': result.valid = si(input.value); break; case 'sk': result.valid = sk(input.value); break; case 'sm': result.valid = sm(input.value); break; case 'th': result.valid = th(input.value); break; case 'tr': result.valid = tr(input.value); break; case 'za': result.valid = za(input.value); break; } var message = input.l10n ? format(opts.message || input.l10n.id.country, input.l10n.id.countries[country.toUpperCase()]) : opts.message; return Object.assign({}, { message: message }, result); } }; } function imei() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } switch (true) { case /^\d{15}$/.test(input.value): case /^\d{2}-\d{6}-\d{6}-\d{1}$/.test(input.value): case /^\d{2}\s\d{6}\s\d{6}\s\d{1}$/.test(input.value): var v = input.value.replace(/[^0-9]/g, ''); return { valid: luhn(v) }; case /^\d{14}$/.test(input.value): case /^\d{16}$/.test(input.value): case /^\d{2}-\d{6}-\d{6}(|-\d{2})$/.test(input.value): case /^\d{2}\s\d{6}\s\d{6}(|\s\d{2})$/.test(input.value): return { valid: true }; default: return { valid: false }; } } }; } function imo() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } if (!/^IMO \d{7}$/i.test(input.value)) { return { valid: false }; } var digits = input.value.replace(/^.*(\d{7})$/, '$1'); var sum = 0; for (var i = 6; i >= 1; i--) { sum += parseInt(digits.slice(6 - i, -i), 10) * (i + 1); } return { valid: sum % 10 === parseInt(digits.charAt(6), 10) }; } }; } function isbn() { return { validate: function validate(input) { if (input.value === '') { return { meta: { type: null }, valid: true }; } var tpe = void 0; switch (true) { case /^\d{9}[\dX]$/.test(input.value): case input.value.length === 13 && /^(\d+)-(\d+)-(\d+)-([\dX])$/.test(input.value): case input.value.length === 13 && /^(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(input.value): tpe = 'ISBN10'; break; case /^(978|979)\d{9}[\dX]$/.test(input.value): case input.value.length === 17 && /^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/.test(input.value): case input.value.length === 17 && /^(978|979)\s(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(input.value): tpe = 'ISBN13'; break; default: return { meta: { type: null }, valid: false }; } var chars = input.value.replace(/[^0-9X]/gi, '').split(''); var length = chars.length; var sum = 0; var i = void 0; var checksum = void 0; switch (tpe) { case 'ISBN10': sum = 0; for (i = 0; i < length - 1; i++) { sum += parseInt(chars[i], 10) * (10 - i); } checksum = 11 - sum % 11; if (checksum === 11) { checksum = 0; } else if (checksum === 10) { checksum = 'X'; } return { meta: { type: tpe }, valid: '' + checksum === chars[length - 1] }; case 'ISBN13': sum = 0; for (i = 0; i < length - 1; i++) { sum += i % 2 === 0 ? parseInt(chars[i], 10) : parseInt(chars[i], 10) * 3; } checksum = 10 - sum % 10; if (checksum === 10) { checksum = '0'; } return { meta: { type: tpe }, valid: '' + checksum === chars[length - 1] }; } } }; } function isin() { var COUNTRY_CODES = 'AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|' + 'BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|' + 'SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|' + 'IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|' + 'MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|' + 'PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|' + 'SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|' + 'YE|ZM|ZW'; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var v = input.value.toUpperCase(); var regex = new RegExp('^(' + COUNTRY_CODES + ')[0-9A-Z]{10}$'); if (!regex.test(input.value)) { return { valid: false }; } var length = v.length; var converted = ''; var i = void 0; for (i = 0; i < length - 1; i++) { var c = v.charCodeAt(i); converted += c > 57 ? (c - 55).toString() : v.charAt(i); } var digits = ''; var n = converted.length; var group = n % 2 !== 0 ? 0 : 1; for (i = 0; i < n; i++) { digits += parseInt(converted[i], 10) * (i % 2 === group ? 2 : 1) + ''; } var sum = 0; for (i = 0; i < digits.length; i++) { sum += parseInt(digits.charAt(i), 10); } sum = (10 - sum % 10) % 10; return { valid: '' + sum === v.charAt(length - 1) }; } }; } function ismn() { return { validate: function validate(input) { if (input.value === '') { return { meta: null, valid: true }; } var tpe = void 0; switch (true) { case /^M\d{9}$/.test(input.value): case /^M-\d{4}-\d{4}-\d{1}$/.test(input.value): case /^M\s\d{4}\s\d{4}\s\d{1}$/.test(input.value): tpe = 'ISMN10'; break; case /^9790\d{9}$/.test(input.value): case /^979-0-\d{4}-\d{4}-\d{1}$/.test(input.value): case /^979\s0\s\d{4}\s\d{4}\s\d{1}$/.test(input.value): tpe = 'ISMN13'; break; default: return { meta: null, valid: false }; } var v = input.value; if ('ISMN10' === tpe) { v = '9790' + v.substr(1); } v = v.replace(/[^0-9]/gi, ''); var sum = 0; var length = v.length; var weight = [1, 3]; for (var i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * weight[i % 2]; } sum = 10 - sum % 10; return { meta: { type: tpe }, valid: '' + sum === v.charAt(length - 1) }; } }; } function issn() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } if (!/^\d{4}\-\d{3}[\dX]$/.test(input.value)) { return { valid: false }; } var chars = input.value.replace(/[^0-9X]/gi, '').split(''); var length = chars.length; var sum = 0; if (chars[7] === 'X') { chars[7] = '10'; } for (var i = 0; i < length; i++) { sum += parseInt(chars[i], 10) * (8 - i); } return { valid: sum % 11 === 0 }; } }; } function mac() { return { validate: function validate(input) { return { valid: input.value === '' || /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(input.value) || /^([0-9A-Fa-f]{4}\.){2}([0-9A-Fa-f]{4})$/.test(input.value) }; } }; } function meid() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var v = input.value; switch (true) { case /^[0-9A-F]{15}$/i.test(v): case /^[0-9A-F]{2}[- ][0-9A-F]{6}[- ][0-9A-F]{6}[- ][0-9A-F]$/i.test(v): case /^\d{19}$/.test(v): case /^\d{5}[- ]\d{5}[- ]\d{4}[- ]\d{4}[- ]\d$/.test(v): var cd = v.charAt(v.length - 1); v = v.replace(/[- ]/g, ''); if (v.match(/^\d*$/i)) { return { valid: luhn(v) }; } v = v.slice(0, -1); var checkDigit = ''; var i = void 0; for (i = 1; i <= 13; i += 2) { checkDigit += (parseInt(v.charAt(i), 16) * 2).toString(16); } var sum = 0; for (i = 0; i < checkDigit.length; i++) { sum += parseInt(checkDigit.charAt(i), 16); } return { valid: sum % 10 === 0 ? cd === '0' : cd === ((Math.floor((sum + 10) / 10) * 10 - sum) * 2).toString(16) }; case /^[0-9A-F]{14}$/i.test(v): case /^[0-9A-F]{2}[- ][0-9A-F]{6}[- ][0-9A-F]{6}$/i.test(v): case /^\d{18}$/.test(v): case /^\d{5}[- ]\d{5}[- ]\d{4}[- ]\d{4}$/.test(v): return { valid: true }; default: return { valid: false }; } } }; } function phone() { var COUNTRY_CODES = ['AE', 'BG', 'BR', 'CN', 'CZ', 'DE', 'DK', 'ES', 'FR', 'GB', 'IN', 'MA', 'NL', 'PK', 'RO', 'RU', 'SK', 'TH', 'US', 'VE']; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, input.options); var v = input.value.trim(); var country = v.substr(0, 2); if ('function' === typeof opts.country) { country = opts.country.call(this); } else { country = opts.country; } if (!country || COUNTRY_CODES.indexOf(country.toUpperCase()) === -1) { return { valid: true }; } var isValid = true; switch (country.toUpperCase()) { case 'AE': isValid = /^(((\+|00)?971[\s\.-]?(\(0\)[\s\.-]?)?|0)(\(5(0|2|5|6)\)|5(0|2|5|6)|2|3|4|6|7|9)|60)([\s\.-]?[0-9]){7}$/.test(v); break; case 'BG': isValid = /^(0|359|00)(((700|900)[0-9]{5}|((800)[0-9]{5}|(800)[0-9]{4}))|(87|88|89)([0-9]{7})|((2[0-9]{7})|(([3-9][0-9])(([0-9]{6})|([0-9]{5})))))$/.test( v.replace(/\+|\s|-|\/|\(|\)/gi, '') ); break; case 'BR': isValid = /^(([\d]{4}[-.\s]{1}[\d]{2,3}[-.\s]{1}[\d]{2}[-.\s]{1}[\d]{2})|([\d]{4}[-.\s]{1}[\d]{3}[-.\s]{1}[\d]{4})|((\(?\+?[0-9]{2}\)?\s?)?(\(?\d{2}\)?\s?)?\d{4,5}[-.\s]?\d{4}))$/.test( v ); break; case 'CN': isValid = /^((00|\+)?(86(?:-| )))?((\d{11})|(\d{3}[- ]{1}\d{4}[- ]{1}\d{4})|((\d{2,4}[- ]){1}(\d{7,8}|(\d{3,4}[- ]{1}\d{4}))([- ]{1}\d{1,4})?))$/.test(v); break; case 'CZ': isValid = /^(((00)([- ]?)|\+)(420)([- ]?))?((\d{3})([- ]?)){2}(\d{3})$/.test(v); break; case 'DE': isValid = /^(((((((00|\+)49[ \-/]?)|0)[1-9][0-9]{1,4})[ \-/]?)|((((00|\+)49\()|\(0)[1-9][0-9]{1,4}\)[ \-/]?))[0-9]{1,7}([ \-/]?[0-9]{1,5})?)$/.test(v); break; case 'DK': isValid = /^(\+45|0045|\(45\))?\s?[2-9](\s?\d){7}$/.test(v); break; case 'ES': isValid = /^(?:(?:(?:\+|00)34\D?))?(?:5|6|7|8|9)(?:\d\D?){8}$/.test(v); break; case 'FR': isValid = /^(?:(?:(?:\+|00)33[ ]?(?:\(0\)[ ]?)?)|0){1}[1-9]{1}([ .-]?)(?:\d{2}\1?){3}\d{2}$/.test(v); break; case 'GB': isValid = /^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/.test( v ); break; case 'IN': isValid = /((\+?)((0[ -]+)*|(91 )*)(\d{12}|\d{10}))|\d{5}([- ]*)\d{6}/.test(v); break; case 'MA': isValid = /^(?:(?:(?:\+|00)212[\s]?(?:[\s]?\(0\)[\s]?)?)|0){1}(?:5[\s.-]?[2-3]|6[\s.-]?[13-9]){1}[0-9]{1}(?:[\s.-]?\d{2}){3}$/.test(v); break; case 'NL': isValid = /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9])((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]$/gm.test( v ); break; case 'PK': isValid = /^0?3[0-9]{2}[0-9]{7}$/.test(v); break; case 'RO': isValid = /^(\+4|)?(07[0-8]{1}[0-9]{1}|02[0-9]{2}|03[0-9]{2}){1}?(\s|\.|\-)?([0-9]{3}(\s|\.|\-|)){2}$/g.test(v); break; case 'RU': isValid = /^((8|\+7|007)[\-\.\/ ]?)?([\(\/\.]?\d{3}[\)\/\.]?[\-\.\/ ]?)?[\d\-\.\/ ]{7,10}$/g.test(v); break; case 'SK': isValid = /^(((00)([- ]?)|\+)(421)([- ]?))?((\d{3})([- ]?)){2}(\d{3})$/.test(v); break; case 'TH': isValid = /^0\(?([6|8-9]{2})*-([0-9]{3})*-([0-9]{4})$/.test(v); break; case 'VE': isValid = /^0(?:2(?:12|4[0-9]|5[1-9]|6[0-9]|7[0-8]|8[1-35-8]|9[1-5]|3[45789])|4(?:1[246]|2[46]))\d{7}$/.test(v); break; case 'US': default: isValid = /^(?:(1\-?)|(\+1 ?))?\(?\d{3}\)?[\-\.\s]?\d{3}[\-\.\s]?\d{4}$/.test(v); break; } return { message: input.l10n ? format(opts.message || input.l10n.phone.country, input.l10n.phone.countries[country]) : opts.message, valid: isValid }; } }; } function rtn() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } if (!/^\d{9}$/.test(input.value)) { return { valid: false }; } var sum = 0; for (var i = 0; i < input.value.length; i += 3) { sum += parseInt(input.value.charAt(i), 10) * 3 + parseInt(input.value.charAt(i + 1), 10) * 7 + parseInt(input.value.charAt(i + 2), 10); } return { valid: sum !== 0 && sum % 10 === 0 }; } }; } function sedol() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var v = input.value.toUpperCase(); if (!/^[0-9A-Z]{7}$/.test(v)) { return { valid: false }; } var weight = [1, 3, 1, 7, 3, 9, 1]; var length = v.length; var sum = 0; for (var i = 0; i < length - 1; i++) { sum += weight[i] * parseInt(v.charAt(i), 36); } sum = (10 - sum % 10) % 10; return { valid: '' + sum === v.charAt(length - 1) }; } }; } function siren() { return { validate: function validate(input) { return { valid: input.value === '' || (/^\d{9}$/.test(input.value) && luhn(input.value)) }; } }; } function siret() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var length = input.value.length; var sum = 0; var tmp = void 0; for (var i = 0; i < length; i++) { tmp = parseInt(input.value.charAt(i), 10); if (i % 2 === 0) { tmp = tmp * 2; if (tmp > 9) { tmp -= 9; } } sum += tmp; } return { valid: sum % 10 === 0 }; } }; } function step() { var round = function round(input, precision) { var m = Math.pow(10, precision); var x = input * m; var sign = void 0; switch (true) { case x === 0: sign = 0; break; case x > 0: sign = 1; break; case x < 0: sign = -1; break; } var isHalf = x % 1 === 0.5 * sign; return isHalf ? (Math.floor(x) + (sign > 0 ? 1 : 0)) / m : Math.round(x) / m; }; var floatMod = function floatMod(x, y) { if (y === 0.0) { return 1.0; } var dotX = ('' + x).split('.'); var dotY = ('' + y).split('.'); var precision = (dotX.length === 1 ? 0 : dotX[1].length) + (dotY.length === 1 ? 0 : dotY[1].length); return round(x - y * Math.floor(x / y), precision); }; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var v = parseFloat(input.value); if (isNaN(v) || !isFinite(v)) { return { valid: false }; } var opts = Object.assign( {}, { baseValue: 0, step: 1 }, input.options ); var mod = floatMod(v - opts.baseValue, opts.step); return { message: input.l10n ? format(opts.message || input.l10n.step.default, '' + opts.step) : opts.message, valid: mod === 0.0 || mod === opts.step }; } }; } function uuid() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, input.options); var patterns = { 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i }; var version = opts.version ? '' + opts.version : 'all'; return { message: opts.version ? (input.l10n ? format(opts.message || input.l10n.uuid.version, opts.version) : opts.message) : input.l10n ? input.l10n.uuid.default : opts.message, valid: null === patterns[version] ? true : patterns[version].test(input.value) }; } }; } function vat() { var _this = this; var validateVat = function validateVat() { return { at: function at(value) { var v = value; if (/^ATU[0-9]{8}$/.test(v)) { v = v.substr(2); } if (!/^U[0-9]{8}$/.test(v)) { return false; } v = v.substr(1); var weight = [1, 2, 1, 2, 1, 2, 1]; var sum = 0; var temp = 0; for (var i = 0; i < 7; i++) { temp = parseInt(v.charAt(i), 10) * weight[i]; if (temp > 9) { temp = Math.floor(temp / 10) + temp % 10; } sum += temp; } sum = 10 - (sum + 4) % 10; if (sum === 10) { sum = 0; } return '' + sum === v.substr(7, 1); }, be: function be(value) { var v = value; if (/^BE[0]?[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0]?[0-9]{9}$/.test(v)) { return false; } if (v.length === 9) { v = '0' + v; } if (v.substr(1, 1) === '0') { return false; } var sum = parseInt(v.substr(0, 8), 10) + parseInt(v.substr(8, 2), 10); return sum % 97 === 0; }, bg: function bg(value) { var v = value; if (/^BG[0-9]{9,10}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9,10}$/.test(v)) { return false; } var sum = 0; var i = 0; if (v.length === 9) { for (i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * (i + 1); } sum = sum % 11; if (sum === 10) { sum = 0; for (i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * (i + 3); } } sum = sum % 10; return '' + sum === v.substr(8); } else if (v.length === 10) { var isEgn = function isEgn(input) { var year = parseInt(input.substr(0, 2), 10) + 1900; var month = parseInt(input.substr(2, 2), 10); var day = parseInt(input.substr(4, 2), 10); if (month > 40) { year += 100; month -= 40; } else if (month > 20) { year -= 100; month -= 20; } if (!isValidDate(year, month, day)) { return false; } var weight = [2, 4, 8, 5, 10, 9, 7, 3, 6]; var s = 0; for (var j = 0; j < 9; j++) { s += parseInt(input.charAt(j), 10) * weight[j]; } s = (s % 11) % 10; return '' + s === input.substr(9, 1); }; var isPnf = function isPnf(input) { var weight = [21, 19, 17, 13, 11, 9, 7, 3, 1]; var s = 0; for (var j = 0; j < 9; j++) { s += parseInt(input.charAt(j), 10) * weight[j]; } s = s % 10; return '' + s === input.substr(9, 1); }; var isVat = function isVat(input) { var weight = [4, 3, 2, 7, 6, 5, 4, 3, 2]; var s = 0; for (var j = 0; j < 9; j++) { s += parseInt(input.charAt(j), 10) * weight[j]; } s = 11 - s % 11; if (s === 10) { return false; } if (s === 11) { s = 0; } return '' + s === input.substr(9, 1); }; return isEgn(v) || isPnf(v) || isVat(v); } return false; }, br: function br(value) { if (value === '') { return true; } var cnpj = value.replace(/[^\d]+/g, ''); if (cnpj === '' || cnpj.length !== 14) { return false; } if ( cnpj === '00000000000000' || cnpj === '11111111111111' || cnpj === '22222222222222' || cnpj === '33333333333333' || cnpj === '44444444444444' || cnpj === '55555555555555' || cnpj === '66666666666666' || cnpj === '77777777777777' || cnpj === '88888888888888' || cnpj === '99999999999999' ) { return false; } var length = cnpj.length - 2; var numbers = cnpj.substring(0, length); var digits = cnpj.substring(length); var sum = 0; var pos = length - 7; var i = void 0; for (i = length; i >= 1; i--) { sum += parseInt(numbers.charAt(length - i), 10) * pos--; if (pos < 2) { pos = 9; } } var result = sum % 11 < 2 ? 0 : 11 - sum % 11; if (result !== parseInt(digits.charAt(0), 10)) { return false; } length = length + 1; numbers = cnpj.substring(0, length); sum = 0; pos = length - 7; for (i = length; i >= 1; i--) { sum += parseInt(numbers.charAt(length - i), 10) * pos--; if (pos < 2) { pos = 9; } } result = sum % 11 < 2 ? 0 : 11 - sum % 11; return result === parseInt(digits.charAt(1), 10); }, ch: function ch(value) { var v = value; if (/^CHE[0-9]{9}(MWST)?$/.test(v)) { v = v.substr(2); } if (!/^E[0-9]{9}(MWST)?$/.test(v)) { return false; } v = v.substr(1); var weight = [5, 4, 3, 2, 7, 6, 5, 4]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = 11 - sum % 11; if (sum === 10) { return false; } if (sum === 11) { sum = 0; } return '' + sum === v.substr(8, 1); }, cy: function cy(value) { var v = value; if (/^CY[0-5|9][0-9]{7}[A-Z]$/.test(v)) { v = v.substr(2); } if (!/^[0-5|9][0-9]{7}[A-Z]$/.test(v)) { return false; } if (v.substr(0, 2) === '12') { return false; } var sum = 0; var translation = { 0: 1, 1: 0, 2: 5, 3: 7, 4: 9, 5: 13, 6: 15, 7: 17, 8: 19, 9: 21 }; for (var i = 0; i < 8; i++) { var temp = parseInt(v.charAt(i), 10); if (i % 2 === 0) { temp = translation['' + temp]; } sum += temp; } return '' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[sum % 26] === v.substr(8, 1); }, cz: function cz(value) { var v = value; if (/^CZ[0-9]{8,10}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{8,10}$/.test(v)) { return false; } var sum = 0; var i = 0; if (v.length === 8) { if ('' + v.charAt(0) === '9') { return false; } sum = 0; for (i = 0; i < 7; i++) { sum += parseInt(v.charAt(i), 10) * (8 - i); } sum = 11 - sum % 11; if (sum === 10) { sum = 0; } if (sum === 11) { sum = 1; } return '' + sum === v.substr(7, 1); } else if (v.length === 9 && '' + v.charAt(0) === '6') { sum = 0; for (i = 0; i < 7; i++) { sum += parseInt(v.charAt(i + 1), 10) * (8 - i); } sum = 11 - sum % 11; if (sum === 10) { sum = 0; } if (sum === 11) { sum = 1; } sum = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 10][sum - 1]; return '' + sum === v.substr(8, 1); } else if (v.length === 9 || v.length === 10) { var year = 1900 + parseInt(v.substr(0, 2), 10); var month = (parseInt(v.substr(2, 2), 10) % 50) % 20; var day = parseInt(v.substr(4, 2), 10); if (v.length === 9) { if (year >= 1980) { year -= 100; } if (year > 1953) { return false; } } else if (year < 1954) { year += 100; } if (!isValidDate(year, month, day)) { return false; } if (v.length === 10) { var check = parseInt(v.substr(0, 9), 10) % 11; if (year < 1985) { check = check % 10; } return '' + check === v.substr(9, 1); } return true; } return false; }, de: function de(value) { var v = value; if (/^DE[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v)) { return false; } return mod11And10(v); }, dk: function dk(value) { var v = value; if (/^DK[0-9]{8}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{8}$/.test(v)) { return false; } var sum = 0; var weight = [2, 7, 6, 5, 4, 3, 2, 1]; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } return sum % 11 === 0; }, ee: function ee(value) { var v = value; if (/^EE[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v)) { return false; } var sum = 0; var weight = [3, 7, 1, 3, 7, 1, 3, 7, 1]; for (var i = 0; i < 9; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } return sum % 10 === 0; }, es: function es(value) { var v = value; if (/^ES[0-9A-Z][0-9]{7}[0-9A-Z]$/.test(v)) { v = v.substr(2); } if (!/^[0-9A-Z][0-9]{7}[0-9A-Z]$/.test(v)) { return { meta: null, valid: false }; } var dni = function dni(input) { var check = parseInt(input.substr(0, 8), 10); return '' + 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23] === input.substr(8, 1); }; var nie = function nie(input) { var check = ['XYZ'.indexOf(input.charAt(0)), input.substr(1)].join(''); var cd = 'TRWAGMYFPDXBNJZSQVHLCKE'[parseInt(check, 10) % 23]; return '' + cd === input.substr(8, 1); }; var cif = function cif(input) { var firstChar = input.charAt(0); var check = void 0; if ('KLM'.indexOf(firstChar) !== -1) { check = parseInt(input.substr(1, 8), 10); check = 'TRWAGMYFPDXBNJZSQVHLCKE'[check % 23]; return '' + check === input.substr(8, 1); } else if ('ABCDEFGHJNPQRSUVW'.indexOf(firstChar) !== -1) { var weight = [2, 1, 2, 1, 2, 1, 2]; var sum = 0; var temp = 0; for (var i = 0; i < 7; i++) { temp = parseInt(input.charAt(i + 1), 10) * weight[i]; if (temp > 9) { temp = Math.floor(temp / 10) + temp % 10; } sum += temp; } sum = 10 - sum % 10; if (sum === 10) { sum = 0; } return '' + sum === input.substr(8, 1) || 'JABCDEFGHI'[sum] === input.substr(8, 1); } return false; }; var first = v.charAt(0); if (/^[0-9]$/.test(first)) { return { meta: { type: 'DNI' }, valid: dni(v) }; } else if (/^[XYZ]$/.test(first)) { return { meta: { type: 'NIE' }, valid: nie(v) }; } else { return { meta: { type: 'CIF' }, valid: cif(v) }; } }, fi: function fi(value) { var v = value; if (/^FI[0-9]{8}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{8}$/.test(v)) { return false; } var weight = [7, 9, 10, 5, 8, 4, 2, 1]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } return sum % 11 === 0; }, fr: function fr(value) { var v = value; if (/^FR[0-9A-Z]{2}[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9A-Z]{2}[0-9]{9}$/.test(v)) { return false; } if (!luhn(v.substr(2))) { return false; } if (/^[0-9]{2}$/.test(v.substr(0, 2))) { return v.substr(0, 2) === '' + parseInt(v.substr(2) + '12', 10) % 97; } else { var alphabet = '0123456789ABCDEFGHJKLMNPQRSTUVWXYZ'; var check = void 0; if (/^[0-9]$/.test(v.charAt(0))) { check = alphabet.indexOf(v.charAt(0)) * 24 + alphabet.indexOf(v.charAt(1)) - 10; } else { check = alphabet.indexOf(v.charAt(0)) * 34 + alphabet.indexOf(v.charAt(1)) - 100; } return (parseInt(v.substr(2), 10) + 1 + Math.floor(check / 11)) % 11 === check % 11; } }, gb: function gb(value) { var v = value; if (/^GB[0-9]{9}$/.test(v) || /^GB[0-9]{12}$/.test(v) || /^GBGD[0-9]{3}$/.test(v) || /^GBHA[0-9]{3}$/.test(v) || /^GB(GD|HA)8888[0-9]{5}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v) && !/^[0-9]{12}$/.test(v) && !/^GD[0-9]{3}$/.test(v) && !/^HA[0-9]{3}$/.test(v) && !/^(GD|HA)8888[0-9]{5}$/.test(v)) { return false; } var length = v.length; if (length === 5) { var firstTwo = v.substr(0, 2); var lastThree = parseInt(v.substr(2), 10); return ('GD' === firstTwo && lastThree < 500) || ('HA' === firstTwo && lastThree >= 500); } else if (length === 11 && ('GD8888' === v.substr(0, 6) || 'HA8888' === v.substr(0, 6))) { if (('GD' === v.substr(0, 2) && parseInt(v.substr(6, 3), 10) >= 500) || ('HA' === v.substr(0, 2) && parseInt(v.substr(6, 3), 10) < 500)) { return false; } return parseInt(v.substr(6, 3), 10) % 97 === parseInt(v.substr(9, 2), 10); } else if (length === 9 || length === 12) { var weight = [8, 7, 6, 5, 4, 3, 2, 10, 1]; var sum = 0; for (var i = 0; i < 9; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = sum % 97; if (parseInt(v.substr(0, 3), 10) >= 100) { return sum === 0 || sum === 42 || sum === 55; } else { return sum === 0; } } return true; }, gr: function gr(value) { var v = value; if (/^(GR|EL)[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v)) { return false; } if (v.length === 8) { v = '0' + v; } var weight = [256, 128, 64, 32, 16, 8, 4, 2]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = (sum % 11) % 10; return '' + sum === v.substr(8, 1); }, el: function el(value) { return _this.gr(value); }, hu: function hu(value) { var v = value; if (/^HU[0-9]{8}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{8}$/.test(v)) { return false; } var weight = [9, 7, 3, 1, 9, 7, 3, 1]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } return sum % 10 === 0; }, hr: function hr(value) { var v = value; if (/^HR[0-9]{11}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{11}$/.test(v)) { return false; } return mod11And10(v); }, ie: function ie(value) { var v = value; if (/^IE[0-9][0-9A-Z\*\+][0-9]{5}[A-Z]{1,2}$/.test(v)) { v = v.substr(2); } if (!/^[0-9][0-9A-Z\*\+][0-9]{5}[A-Z]{1,2}$/.test(v)) { return false; } var getCheckDigit = function getCheckDigit(inp) { var input = inp; while (input.length < 7) { input = '0' + input; } var alphabet = 'WABCDEFGHIJKLMNOPQRSTUV'; var sum = 0; for (var i = 0; i < 7; i++) { sum += parseInt(input.charAt(i), 10) * (8 - i); } sum += 9 * alphabet.indexOf(input.substr(7)); return alphabet[sum % 23]; }; if (/^[0-9]+$/.test(v.substr(0, 7))) { return v.charAt(7) === getCheckDigit('' + v.substr(0, 7) + v.substr(8)); } else if ('ABCDEFGHIJKLMNOPQRSTUVWXYZ+*'.indexOf(v.charAt(1)) !== -1) { return v.charAt(7) === getCheckDigit('' + v.substr(2, 5) + v.substr(0, 1)); } return true; }, is: function is(value) { var v = value; if (/^IS[0-9]{5,6}$/.test(v)) { v = v.substr(2); } return /^[0-9]{5,6}$/.test(v); }, it: function it(value) { var v = value; if (/^IT[0-9]{11}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{11}$/.test(v)) { return false; } if (parseInt(v.substr(0, 7), 10) === 0) { return false; } var lastThree = parseInt(v.substr(7, 3), 10); if (lastThree < 1 || (lastThree > 201 && lastThree !== 999 && lastThree !== 888)) { return false; } return luhn(v); }, lt: function lt(value) { var v = value; if (/^LT([0-9]{7}1[0-9]|[0-9]{10}1[0-9])$/.test(v)) { v = v.substr(2); } if (!/^([0-9]{7}1[0-9]|[0-9]{10}1[0-9])$/.test(v)) { return false; } var length = v.length; var sum = 0; var i = void 0; for (i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * (1 + i % 9); } var check = sum % 11; if (check === 10) { sum = 0; for (i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * (1 + (i + 2) % 9); } } check = (check % 11) % 10; return '' + check === v.charAt(length - 1); }, lu: function lu(value) { var v = value; if (/^LU[0-9]{8}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{8}$/.test(v)) { return false; } return '' + parseInt(v.substr(0, 6), 10) % 89 === v.substr(6, 2); }, lv: function lv(value) { var v = value; if (/^LV[0-9]{11}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{11}$/.test(v)) { return false; } var first = parseInt(v.charAt(0), 10); var length = v.length; var sum = 0; var weight = []; var i = void 0; if (first > 3) { sum = 0; weight = [9, 1, 4, 8, 3, 10, 2, 5, 7, 6, 1]; for (i = 0; i < length; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = sum % 11; return sum === 3; } else { var day = parseInt(v.substr(0, 2), 10); var month = parseInt(v.substr(2, 2), 10); var year = parseInt(v.substr(4, 2), 10); year = year + 1800 + parseInt(v.charAt(6), 10) * 100; if (!isValidDate(year, month, day)) { return false; } sum = 0; weight = [10, 5, 8, 4, 2, 1, 6, 3, 7, 9]; for (i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = ((sum + 1) % 11) % 10; return '' + sum === v.charAt(length - 1); } }, mt: function mt(value) { var v = value; if (/^MT[0-9]{8}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{8}$/.test(v)) { return false; } var weight = [3, 4, 6, 7, 8, 9, 10, 1]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } return sum % 37 === 0; }, nl: function nl(value) { var v = value; if (/^NL[0-9]{9}B[0-9]{2}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}B[0-9]{2}$/.test(v)) { return false; } var weight = [9, 8, 7, 6, 5, 4, 3, 2]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = sum % 11; if (sum > 9) { sum = 0; } return '' + sum === v.substr(8, 1); }, no: function no(value) { var v = value; if (/^NO[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v)) { return false; } var weight = [3, 2, 7, 6, 5, 4, 3, 2]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = 11 - sum % 11; if (sum === 11) { sum = 0; } return '' + sum === v.substr(8, 1); }, pl: function pl(value) { var v = value; if (/^PL[0-9]{10}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{10}$/.test(v)) { return false; } var weight = [6, 5, 7, 2, 3, 4, 5, 6, 7, -1]; var sum = 0; for (var i = 0; i < 10; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } return sum % 11 === 0; }, pt: function pt(value) { var v = value; if (/^PT[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v)) { return false; } var weight = [9, 8, 7, 6, 5, 4, 3, 2]; var sum = 0; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = 11 - sum % 11; if (sum > 9) { sum = 0; } return '' + sum === v.substr(8, 1); }, ro: function ro(value) { var v = value; if (/^RO[1-9][0-9]{1,9}$/.test(v)) { v = v.substr(2); } if (!/^[1-9][0-9]{1,9}$/.test(v)) { return false; } var length = v.length; var weight = [7, 5, 3, 2, 1, 7, 5, 3, 2].slice(10 - length); var sum = 0; for (var i = 0; i < length - 1; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = ((10 * sum) % 11) % 10; return '' + sum === v.substr(length - 1, 1); }, ru: function ru(value) { var v = value; if (/^RU([0-9]{10}|[0-9]{12})$/.test(v)) { v = v.substr(2); } if (!/^([0-9]{10}|[0-9]{12})$/.test(v)) { return false; } var i = 0; if (v.length === 10) { var weight = [2, 4, 10, 3, 5, 9, 4, 6, 8, 0]; var sum = 0; for (i = 0; i < 10; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = sum % 11; if (sum > 9) { sum = sum % 10; } return '' + sum === v.substr(9, 1); } else if (v.length === 12) { var weight1 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0]; var weight2 = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0]; var sum1 = 0; var sum2 = 0; for (i = 0; i < 11; i++) { sum1 += parseInt(v.charAt(i), 10) * weight1[i]; sum2 += parseInt(v.charAt(i), 10) * weight2[i]; } sum1 = sum1 % 11; if (sum1 > 9) { sum1 = sum1 % 10; } sum2 = sum2 % 11; if (sum2 > 9) { sum2 = sum2 % 10; } return '' + sum1 === v.substr(10, 1) && '' + sum2 === v.substr(11, 1); } return false; }, rs: function rs(value) { var v = value; if (/^RS[0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{9}$/.test(v)) { return false; } var sum = 10; var temp = 0; for (var i = 0; i < 8; i++) { temp = (parseInt(v.charAt(i), 10) + sum) % 10; if (temp === 0) { temp = 10; } sum = (2 * temp) % 11; } return (sum + parseInt(v.substr(8, 1), 10)) % 10 === 1; }, se: function se(value) { var v = value; if (/^SE[0-9]{10}01$/.test(v)) { v = v.substr(2); } if (!/^[0-9]{10}01$/.test(v)) { return false; } v = v.substr(0, 10); return luhn(v); }, si: function si(value) { var res = value.match(/^(SI)?([1-9][0-9]{7})$/); if (!res) { return false; } var v = res[1] ? value.substr(2) : value; var weight = [8, 7, 6, 5, 4, 3, 2]; var sum = 0; for (var i = 0; i < 7; i++) { sum += parseInt(v.charAt(i), 10) * weight[i]; } sum = 11 - sum % 11; if (sum === 10) { sum = 0; } return '' + sum === v.substr(7, 1); }, sk: function sk(value) { var v = value; if (/^SK[1-9][0-9][(2-4)|(6-9)][0-9]{7}$/.test(v)) { v = v.substr(2); } if (!/^[1-9][0-9][(2-4)|(6-9)][0-9]{7}$/.test(v)) { return false; } return parseInt(v, 10) % 11 === 0; }, ve: function ve(value) { var v = value; if (/^VE[VEJPG][0-9]{9}$/.test(v)) { v = v.substr(2); } if (!/^[VEJPG][0-9]{9}$/.test(v)) { return false; } var types = { E: 8, G: 20, J: 12, P: 16, V: 4 }; var weight = [3, 2, 7, 6, 5, 4, 3, 2]; var sum = types[v.charAt(0)]; for (var i = 0; i < 8; i++) { sum += parseInt(v.charAt(i + 1), 10) * weight[i]; } sum = 11 - sum % 11; if (sum === 11 || sum === 10) { sum = 0; } return '' + sum === v.substr(9, 1); }, za: function za(value) { var v = value; if (/^ZA4[0-9]{9}$/.test(v)) { v = v.substr(2); } return /^4[0-9]{9}$/.test(v); } }; }; return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } var opts = Object.assign({}, input.options); var country = input.value.substr(0, 2); if ('function' === typeof opts.country) { country = opts.country.call(this); } else { country = opts.country; } var result = validateVat()[country.toLowerCase()](input.value); var output = result === true || result === false ? { valid: result } : result; output.message = input.l10n ? format(opts.message || input.l10n.vat.country, input.l10n.vat.countries[country.toUpperCase()]) : opts.message; return output; } }; } function vin() { return { validate: function validate(input) { if (input.value === '') { return { valid: true }; } if (!/^[a-hj-npr-z0-9]{8}[0-9xX][a-hj-npr-z0-9]{8}$/i.test(input.value)) { return { valid: false }; } var v = input.value.toUpperCase(); var chars = { A: 1, B: 2, C: 3, D: 4, E: 5, F: 6, G: 7, H: 8, J: 1, K: 2, L: 3, M: 4, N: 5, P: 7, R: 9, S: 2, T: 3, U: 4, V: 5, W: 6, X: 7, Y: 8, Z: 9, 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9 }; var weights = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2]; var length = v.length; var sum = 0; for (var i = 0; i < length; i++) { sum += chars['' + v.charAt(i)] * weights[i]; } var reminder = '' + sum % 11; if (reminder === '10') { reminder = 'X'; } return { valid: reminder === v.charAt(8) }; } }; } function zipCode() { var COUNTRY_CODES = ['AT', 'BG', 'BR', 'CA', 'CH', 'CZ', 'DE', 'DK', 'ES', 'FR', 'GB', 'IE', 'IN', 'IT', 'MA', 'NL', 'PL', 'PT', 'RO', 'RU', 'SE', 'SG', 'SK', 'US']; var gb = function gb(value) { var firstChar = '[ABCDEFGHIJKLMNOPRSTUWYZ]'; var secondChar = '[ABCDEFGHKLMNOPQRSTUVWXY]'; var thirdChar = '[ABCDEFGHJKPMNRSTUVWXY]'; var fourthChar = '[ABEHMNPRVWXY]'; var fifthChar = '[ABDEFGHJLNPQRSTUWXYZ]'; var regexps = [ new RegExp('^(' + firstChar + '{1}' + secondChar + '?[0-9]{1,2})(\\s*)([0-9]{1}' + fifthChar + '{2})$', 'i'), new RegExp('^(' + firstChar + '{1}[0-9]{1}' + thirdChar + '{1})(\\s*)([0-9]{1}' + fifthChar + '{2})$', 'i'), new RegExp('^(' + firstChar + '{1}' + secondChar + '{1}?[0-9]{1}' + fourthChar + '{1})(\\s*)([0-9]{1}' + fifthChar + '{2})$', 'i'), new RegExp('^(BF1)(\\s*)([0-6]{1}[ABDEFGHJLNPQRST]{1}[ABDEFGHJLNPQRSTUWZYZ]{1})$', 'i'), /^(GIR)(\s*)(0AA)$/i, /^(BFPO)(\s*)([0-9]{1,4})$/i, /^(BFPO)(\s*)(c\/o\s*[0-9]{1,3})$/i, /^([A-Z]{4})(\s*)(1ZZ)$/i, /^(AI-2640)$/i ]; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = regexps[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var reg = _step.value; if (reg.test(value)) { return true; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return false; }; return { validate: function validate(input) { var opts = Object.assign({}, input.options); if (input.value === '' || !opts.country) { return { valid: true }; } var country = input.value.substr(0, 2); if ('function' === typeof opts.country) { country = opts.country.call(this); } else { country = opts.country; } if (!country || COUNTRY_CODES.indexOf(country.toUpperCase()) === -1) { return { valid: true }; } var isValid = false; country = country.toUpperCase(); switch (country) { case 'AT': isValid = /^([1-9]{1})(\d{3})$/.test(input.value); break; case 'BG': isValid = /^([1-9]{1}[0-9]{3})$/.test(input.value); break; case 'BR': isValid = /^(\d{2})([\.]?)(\d{3})([\-]?)(\d{3})$/.test(input.value); break; case 'CA': isValid = /^(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|X|Y){1}[0-9]{1}(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|W|X|Y|Z){1}\s?[0-9]{1}(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|W|X|Y|Z){1}[0-9]{1}$/i.test( input.value ); break; case 'CH': isValid = /^([1-9]{1})(\d{3})$/.test(input.value); break; case 'CZ': isValid = /^(\d{3})([ ]?)(\d{2})$/.test(input.value); break; case 'DE': isValid = /^(?!01000|99999)(0[1-9]\d{3}|[1-9]\d{4})$/.test(input.value); break; case 'DK': isValid = /^(DK(-|\s)?)?\d{4}$/i.test(input.value); break; case 'ES': isValid = /^(?:0[1-9]|[1-4][0-9]|5[0-2])\d{3}$/.test(input.value); break; case 'FR': isValid = /^[0-9]{5}$/i.test(input.value); break; case 'GB': isValid = gb(input.value); break; case 'IN': isValid = /^\d{3}\s?\d{3}$/.test(input.value); break; case 'IE': isValid = /^(D6W|[ACDEFHKNPRTVWXY]\d{2})\s[0-9ACDEFHKNPRTVWXY]{4}$/.test(input.value); break; case 'IT': isValid = /^(I-|IT-)?\d{5}$/i.test(input.value); break; case 'MA': isValid = /^[1-9][0-9]{4}$/i.test(input.value); break; case 'NL': isValid = /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(input.value); break; case 'PL': isValid = /^[0-9]{2}\-[0-9]{3}$/.test(input.value); break; case 'PT': isValid = /^[1-9]\d{3}-\d{3}$/.test(input.value); break; case 'RO': isValid = /^(0[1-8]{1}|[1-9]{1}[0-5]{1})?[0-9]{4}$/i.test(input.value); break; case 'RU': isValid = /^[0-9]{6}$/i.test(input.value); break; case 'SE': isValid = /^(S-)?\d{3}\s?\d{2}$/i.test(input.value); break; case 'SG': isValid = /^([0][1-9]|[1-6][0-9]|[7]([0-3]|[5-9])|[8][0-2])(\d{4})$/i.test(input.value); break; case 'SK': isValid = /^(\d{3})([ ]?)(\d{2})$/.test(input.value); break; case 'US': default: isValid = /^\d{4,5}([\-]?\d{4})?$/.test(input.value); break; } return { message: input.l10n ? format(opts.message || input.l10n.zipCode.country, input.l10n.zipCode.countries[country]) : opts.message, valid: isValid }; } }; } var validators = { between: between, blank: blank, callback: callback, choice: choice, creditCard: creditCard, date: date, different: different, digits: digits, emailAddress: emailAddress, file: file, greaterThan: greaterThan, identical: identical, integer: integer, ip: ip, lessThan: lessThan, notEmpty: notEmpty, numeric: numeric, promise: promise, regexp: regexp, remote: remote, stringCase: stringCase, stringLength: stringLength, uri: uri, base64: base64, bic: bic, color: color, cusip: cusip, ean: ean, ein: ein, grid: grid, hex: hex, iban: iban, id: id, imei: imei, imo: imo, isbn: isbn, isin: isin, ismn: ismn, issn: issn, mac: mac, meid: meid, phone: phone, rtn: rtn, sedol: sedol, siren: siren, siret: siret, step: step, uuid: uuid, vat: vat, vin: vin, zipCode: zipCode }; var classCallCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; var createClass = (function() { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function(Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var defineProperty = function(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }; var inherits = function(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : (subClass.__proto__ = superClass); }; var possibleConstructorReturn = function(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === 'object' || typeof call === 'function') ? call : self; }; var Core = (function() { function Core(form, fields) { classCallCheck(this, Core); this.elements = {}; this.ee = emitter(); this.filter = filter(); this.plugins = {}; this.results = new Map(); this.validators = {}; this.form = form; this.fields = fields; } createClass(Core, [ { key: 'on', value: function on(event, func) { this.ee.on(event, func); return this; } }, { key: 'off', value: function off(event, func) { this.ee.off(event, func); return this; } }, { key: 'emit', value: function emit(event) { var _ee; for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } (_ee = this.ee).emit.apply(_ee, [event].concat(args)); return this; } }, { key: 'registerPlugin', value: function registerPlugin(name, plugin) { if (this.plugins[name]) { throw new Error('The plguin ' + name + ' is registered'); } plugin.setCore(this); plugin.install(); this.plugins[name] = plugin; return this; } }, { key: 'deregisterPlugin', value: function deregisterPlugin(name) { var plugin = this.plugins[name]; if (plugin) { plugin.uninstall(); } delete this.plugins[name]; return this; } }, { key: 'registerValidator', value: function registerValidator(name, func) { if (this.validators[name]) { throw new Error('The validator ' + name + ' is registered'); } this.validators[name] = func; return this; } }, { key: 'registerFilter', value: function registerFilter(name, func) { this.filter.add(name, func); return this; } }, { key: 'deregisterFilter', value: function deregisterFilter(name, func) { this.filter.remove(name, func); return this; } }, { key: 'executeFilter', value: function executeFilter(name, defaultValue, args) { return this.filter.execute(name, defaultValue, args); } }, { key: 'addField', value: function addField(field, options) { var opts = Object.assign( {}, { selector: '', validators: {} }, options ); this.fields[field] = this.fields[field] ? { selector: opts.selector || this.fields[field].selector, validators: Object.assign({}, this.fields[field].validators, opts.validators) } : opts; this.elements[field] = this.queryElements(field); this.emit('core.field.added', { elements: this.elements[field], field: field, options: this.fields[field] }); return this; } }, { key: 'removeField', value: function removeField(field) { if (!this.fields[field]) { throw new Error('The field ' + field + ' validators are not defined. Please ensure the field is added first'); } var elements = this.elements[field]; var options = this.fields[field]; delete this.elements[field]; delete this.fields[field]; this.emit('core.field.removed', { elements: elements, field: field, options: options }); return this; } }, { key: 'validate', value: function validate() { var _this = this; this.emit('core.form.validating'); return this.filter.execute('validate-pre', Promise.resolve(), []).then(function() { return Promise.all( Object.keys(_this.fields).map(function(field) { return _this.validateField(field); }) ).then(function(results) { switch (true) { case results.indexOf(Status$1.Invalid) !== -1: _this.emit('core.form.invalid'); return Promise.resolve(Status$1.Invalid); case results.indexOf(Status$1.NotValidated) !== -1: _this.emit('core.form.notvalidated'); return Promise.resolve(Status$1.NotValidated); default: _this.emit('core.form.valid'); return Promise.resolve(Status$1.Valid); } }); }); } }, { key: 'validateField', value: function validateField(field) { var _this2 = this; var result = this.results.get(field); if (result === Status$1.Valid || result === Status$1.Invalid) { return Promise.resolve(result); } this.emit('core.field.validating', field); var elements = this.elements[field]; if (elements.length === 0) { this.emit('core.field.valid', field); return Promise.resolve(Status$1.Valid); } var type = elements[0].getAttribute('type'); if ('radio' === type || 'checkbox' === type || elements.length === 1) { return this.validateElement(field, elements[0]); } else { return Promise.all( elements.map(function(ele) { return _this2.validateElement(field, ele); }) ).then(function(results) { switch (true) { case results.indexOf(Status$1.Invalid) !== -1: _this2.emit('core.field.invalid', field); _this2.results.set(field, Status$1.Invalid); return Promise.resolve(Status$1.Invalid); case results.indexOf(Status$1.NotValidated) !== -1: _this2.emit('core.field.notvalidated', field); _this2.results.delete(field); return Promise.resolve(Status$1.NotValidated); default: _this2.emit('core.field.valid', field); _this2.results.set(field, Status$1.Valid); return Promise.resolve(Status$1.Valid); } }); } } }, { key: 'validateElement', value: function validateElement(field, ele) { var _this3 = this; this.results.delete(field); var elements = this.elements[field]; var ignored = this.filter.execute('element-ignored', false, [field, ele, elements]); if (ignored) { this.emit('core.element.ignored', { element: ele, elements: elements, field: field }); return Promise.resolve(Status$1.Ignored); } var validatorList = this.fields[field].validators; this.emit('core.element.validating', { element: ele, elements: elements, field: field }); var promises = Object.keys(validatorList).map(function(v) { return function() { return _this3.executeValidator(field, ele, v, validatorList[v]); }; }); return this.waterfall(promises) .then(function(results) { var isValid = results.indexOf(Status$1.Invalid) === -1; _this3.emit('core.element.validated', { element: ele, elements: elements, field: field, valid: isValid }); var type = ele.getAttribute('type'); if ('radio' === type || 'checkbox' === type || elements.length === 1) { _this3.emit(isValid ? 'core.field.valid' : 'core.field.invalid', field); } return Promise.resolve(isValid ? Status$1.Valid : Status$1.Invalid); }) .catch(function(reason) { _this3.emit('core.element.notvalidated', { element: ele, elements: elements, field: field }); return Promise.resolve(reason); }); } }, { key: 'executeValidator', value: function executeValidator(field, ele, v, opts) { var _this4 = this; var elements = this.elements[field]; var name = this.filter.execute('validator-name', v, [v, field]); opts.message = this.filter.execute('validator-message', opts.message, [this.locale, field, name]); if (!this.validators[name] || opts.enabled === false) { this.emit('core.validator.validated', { element: ele, elements: elements, field: field, result: this.normalizeResult(field, name, { valid: true }), validator: name }); return Promise.resolve(Status$1.Valid); } var validator = this.validators[name]; var value = this.getElementValue(field, ele, name); var willValidate = this.filter.execute('field-should-validate', true, [field, ele, value, v]); if (!willValidate) { this.emit('core.validator.notvalidated', { element: ele, elements: elements, field: field, validator: v }); return Promise.resolve(Status$1.NotValidated); } this.emit('core.validator.validating', { element: ele, elements: elements, field: field, validator: v }); var result = validator().validate({ element: ele, elements: elements, field: field, l10n: this.localization, options: opts, value: value }); var isPromise = 'function' === typeof result['then']; if (isPromise) { return result.then(function(r) { var data = _this4.normalizeResult(field, v, r); _this4.emit('core.validator.validated', { element: ele, elements: elements, field: field, result: data, validator: v }); return data.valid ? Status$1.Valid : Status$1.Invalid; }); } else { var data = this.normalizeResult(field, v, result); this.emit('core.validator.validated', { element: ele, elements: elements, field: field, result: data, validator: v }); return Promise.resolve(data.valid ? Status$1.Valid : Status$1.Invalid); } } }, { key: 'getElementValue', value: function getElementValue(field, ele, validator) { var defaultValue = getFieldValue(this.form, field, ele, this.elements[field]); return this.filter.execute('field-value', defaultValue, [defaultValue, field, ele, validator]); } }, { key: 'getElements', value: function getElements(field) { return this.elements[field]; } }, { key: 'getFields', value: function getFields() { return this.fields; } }, { key: 'getFormElement', value: function getFormElement() { return this.form; } }, { key: 'getPlugin', value: function getPlugin(name) { return this.plugins[name]; } }, { key: 'updateFieldStatus', value: function updateFieldStatus(field, status, validator) { var _this5 = this; var elements = this.elements[field]; var type = elements[0].getAttribute('type'); var list = 'radio' === type || 'checkbox' === type ? [elements[0]] : elements; list.forEach(function(ele) { return _this5.updateElementStatus(field, ele, status, validator); }); if (!validator) { switch (status) { case Status$1.NotValidated: this.emit('core.field.notvalidated', field); this.results.delete(field); break; case Status$1.Validating: this.emit('core.field.validating', field); this.results.delete(field); break; case Status$1.Valid: this.emit('core.field.valid', field); this.results.set(field, Status$1.Valid); break; case Status$1.Invalid: this.emit('core.field.invalid', field); this.results.set(field, Status$1.Invalid); break; } } return this; } }, { key: 'updateElementStatus', value: function updateElementStatus(field, ele, status, validator) { var _this6 = this; var elements = this.elements[field]; var fieldValidators = this.fields[field].validators; var validatorArr = validator ? [validator] : Object.keys(fieldValidators); switch (status) { case Status$1.NotValidated: validatorArr.forEach(function(v) { return _this6.emit('core.validator.notvalidated', { element: ele, elements: elements, field: field, validator: v }); }); this.emit('core.element.notvalidated', { element: ele, elements: elements, field: field }); break; case Status$1.Validating: validatorArr.forEach(function(v) { return _this6.emit('core.validator.validating', { element: ele, elements: elements, field: field, validator: v }); }); this.emit('core.element.validating', { element: ele, elements: elements, field: field }); break; case Status$1.Valid: validatorArr.forEach(function(v) { return _this6.emit('core.validator.validated', { element: ele, field: field, result: { message: fieldValidators[v].message, valid: true }, validator: v }); }); this.emit('core.element.validated', { element: ele, elements: elements, field: field, valid: true }); break; case Status$1.Invalid: validatorArr.forEach(function(v) { return _this6.emit('core.validator.validated', { element: ele, field: field, result: { message: fieldValidators[v].message, valid: false }, validator: v }); }); this.emit('core.element.validated', { element: ele, elements: elements, field: field, valid: false }); break; } return this; } }, { key: 'resetForm', value: function resetForm(reset) { var _this7 = this; Object.keys(this.fields).forEach(function(field) { return _this7.resetField(field, reset); }); this.emit('core.form.reset', { reset: reset }); return this; } }, { key: 'resetField', value: function resetField(field, reset) { if (reset) { var elements = this.elements[field]; var type = elements[0].getAttribute('type'); elements.forEach(function(ele) { if ('radio' === type || 'checkbox' === type) { ele.removeAttribute('selected'); ele.removeAttribute('checked'); ele.checked = false; } else { ele.setAttribute('value', ''); if (ele instanceof HTMLInputElement || ele instanceof HTMLTextAreaElement) { ele.value = ''; } } }); } this.updateFieldStatus(field, Status$1.NotValidated); this.emit('core.field.reset', { field: field, reset: reset }); return this; } }, { key: 'revalidateField', value: function revalidateField(field) { this.updateFieldStatus(field, Status$1.NotValidated); return this.validateField(field); } }, { key: 'disableValidator', value: function disableValidator(field, validator) { return this.toggleValidator(false, field, validator); } }, { key: 'enableValidator', value: function enableValidator(field, validator) { return this.toggleValidator(true, field, validator); } }, { key: 'updateValidatorOption', value: function updateValidatorOption(field, validator, name, value) { if (this.fields[field] && this.fields[field].validators && this.fields[field].validators[validator]) { this.fields[field].validators[validator][name] = value; } return this; } }, { key: 'destroy', value: function destroy() { var _this8 = this; Object.keys(this.plugins).forEach(function(id) { return _this8.plugins[id].uninstall(); }); this.ee.clear(); this.filter.clear(); this.results.clear(); this.plugins = {}; return this; } }, { key: 'setLocale', value: function setLocale(locale, localization) { this.locale = locale; this.localization = localization; return this; } }, { key: 'waterfall', value: function waterfall(promises) { return promises.reduce(function(p, c, i, a) { return p.then(function(res) { return c().then(function(result) { res.push(result); return res; }); }); }, Promise.resolve([])); } }, { key: 'queryElements', value: function queryElements(field) { var selector = this.fields[field].selector ? '#' === this.fields[field].selector.charAt(0) ? '[id="' + this.fields[field].selector.substring(1) + '"]' : this.fields[field].selector : '[name="' + field + '"]'; return [].slice.call(this.form.querySelectorAll(selector)); } }, { key: 'normalizeResult', value: function normalizeResult(field, validator, result) { var opts = this.fields[field].validators[validator]; return Object.assign({}, result, { message: result.message || opts.message || (this.localization && this.localization[validator] && this.localization[validator].default ? this.localization[validator].default : '') || 'The field ' + field + ' is not valid' }); } }, { key: 'toggleValidator', value: function toggleValidator(enabled, field, validator) { var _this9 = this; var validatorArr = this.fields[field].validators; if (validator && validatorArr && validatorArr[validator]) { this.fields[field].validators[validator].enabled = enabled; } else if (!validator) { Object.keys(validatorArr).forEach(function(v) { return (_this9.fields[field].validators[v].enabled = enabled); }); } return this.updateFieldStatus(field, Status$1.NotValidated, validator); } } ]); return Core; })(); function formValidation(form, options) { var opts = Object.assign( {}, { fields: {}, locale: 'en_US', plugins: {} }, options ); var core = new Core(form, opts.fields); core.setLocale(opts.locale, opts.localization); Object.keys(opts.plugins).forEach(function(name) { return core.registerPlugin(name, opts.plugins[name]); }); Object.keys(validators).forEach(function(name) { return core.registerValidator(name, validators[name]); }); Object.keys(opts.fields).forEach(function(field) { return core.addField(field, opts.fields[field]); }); return core; } var Plugin = (function() { function Plugin(opts) { classCallCheck(this, Plugin); this.opts = opts; } createClass(Plugin, [ { key: 'setCore', value: function setCore(core) { this.core = core; return this; } }, { key: 'install', value: function install() {} }, { key: 'uninstall', value: function uninstall() {} } ]); return Plugin; })(); var index$1 = { getFieldValue: getFieldValue }; var Alias = (function(_Plugin) { inherits(Alias, _Plugin); function Alias(opts) { classCallCheck(this, Alias); var _this = possibleConstructorReturn(this, (Alias.__proto__ || Object.getPrototypeOf(Alias)).call(this, opts)); _this.opts = opts || {}; _this.validatorNameFilter = _this.getValidatorName.bind(_this); return _this; } createClass(Alias, [ { key: 'install', value: function install() { this.core.registerFilter('validator-name', this.validatorNameFilter); } }, { key: 'uninstall', value: function uninstall() { this.core.deregisterFilter('validator-name', this.validatorNameFilter); } }, { key: 'getValidatorName', value: function getValidatorName(alias, field) { return this.opts[alias] || alias; } } ]); return Alias; })(Plugin); var Aria = (function(_Plugin) { inherits(Aria, _Plugin); function Aria() { classCallCheck(this, Aria); var _this = possibleConstructorReturn(this, (Aria.__proto__ || Object.getPrototypeOf(Aria)).call(this, {})); _this.elementValidatedHandler = _this.onElementValidated.bind(_this); _this.fieldValidHandler = _this.onFieldValid.bind(_this); _this.fieldInvalidHandler = _this.onFieldInvalid.bind(_this); _this.messageDisplayedHandler = _this.onMessageDisplayed.bind(_this); return _this; } createClass(Aria, [ { key: 'install', value: function install() { this.core .on('core.field.valid', this.fieldValidHandler) .on('core.field.invalid', this.fieldInvalidHandler) .on('core.element.validated', this.elementValidatedHandler) .on('plugins.message.displayed', this.messageDisplayedHandler); } }, { key: 'uninstall', value: function uninstall() { this.core .off('core.field.valid', this.fieldValidHandler) .off('core.field.invalid', this.fieldInvalidHandler) .off('core.element.validated', this.elementValidatedHandler) .off('plugins.message.displayed', this.messageDisplayedHandler); } }, { key: 'onElementValidated', value: function onElementValidated(e) { if (e.valid) { e.element.setAttribute('aria-invalid', 'false'); e.element.removeAttribute('aria-describedby'); } } }, { key: 'onFieldValid', value: function onFieldValid(field) { var elements = this.core.getElements(field); if (elements) { elements.forEach(function(ele) { ele.setAttribute('aria-invalid', 'false'); ele.removeAttribute('aria-describedby'); }); } } }, { key: 'onFieldInvalid', value: function onFieldInvalid(field) { var elements = this.core.getElements(field); if (elements) { elements.forEach(function(ele) { return ele.setAttribute('aria-invalid', 'true'); }); } } }, { key: 'onMessageDisplayed', value: function onMessageDisplayed(e) { e.messageElement.setAttribute('role', 'alert'); e.messageElement.setAttribute('aria-hidden', 'false'); var elements = this.core.getElements(e.field); var index = elements.indexOf(e.element); var id = 'js-fv-' + e.field + '-' + index + '-' + Date.now() + '-message'; e.messageElement.setAttribute('id', id); e.element.setAttribute('aria-describedby', id); var type = e.element.getAttribute('type'); if ('radio' === type || 'checkbox' === type) { elements.forEach(function(ele) { return ele.setAttribute('aria-describedby', id); }); } } } ]); return Aria; })(Plugin); var AutoFocus = (function(_Plugin) { inherits(AutoFocus, _Plugin); function AutoFocus(opts) { classCallCheck(this, AutoFocus); var _this = possibleConstructorReturn(this, (AutoFocus.__proto__ || Object.getPrototypeOf(AutoFocus)).call(this, opts)); _this.invalidElements = []; _this.opts = Object.assign( {}, { onPrefocus: function onPrefocus() {} }, opts ); _this.invalidFormHandler = _this.onFormInvalid.bind(_this); _this.elementValidatedHandler = _this.onElementValidated.bind(_this); _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_this); return _this; } createClass(AutoFocus, [ { key: 'install', value: function install() { this.core .on('core.form.invalid', this.invalidFormHandler) .on('core.element.validated', this.elementValidatedHandler) .on('core.element.notvalidated', this.elementNotValidatedHandler); } }, { key: 'uninstall', value: function uninstall() { this.invalidElements = []; this.core .off('core.form.invalid', this.invalidFormHandler) .off('core.element.validated', this.elementValidatedHandler) .off('core.element.notvalidated', this.elementNotValidatedHandler); } }, { key: 'onElementValidated', value: function onElementValidated(e) { var index = this.invalidElements.indexOf(e.element); if (e.valid && index >= 0) { this.invalidElements.splice(index, 1); } else if (!e.valid && index === -1) { this.invalidElements.push(e.element); } } }, { key: 'onElementNotValidated', value: function onElementNotValidated(e) { this.invalidElements.splice(this.invalidElements.indexOf(e.element), 1); } }, { key: 'onFormInvalid', value: function onFormInvalid() { if (this.invalidElements.length) { var firstElement = this.invalidElements[0]; var e = { firstElement: firstElement }; this.core.emit('plugins.autofocus.prefocus', e); this.opts.onPrefocus(e); firstElement.focus(); } } } ]); return AutoFocus; })(Plugin); var Declarative = (function(_Plugin) { inherits(Declarative, _Plugin); function Declarative(opts) { classCallCheck(this, Declarative); var _this = possibleConstructorReturn(this, (Declarative.__proto__ || Object.getPrototypeOf(Declarative)).call(this, opts)); _this.opts = Object.assign( {}, { html5Input: false, prefix: 'data-fv-' }, opts ); return _this; } createClass(Declarative, [ { key: 'install', value: function install() { var _this2 = this; var opts = this.parseOptions(); Object.keys(opts).forEach(function(field) { return _this2.core.addField(field, opts[field]); }); } }, { key: 'parseOptions', value: function parseOptions() { var _this3 = this; var prefix = this.opts.prefix; var opts = {}; var fields = this.core.getFields(); var form = this.core.getFormElement(); var elements = [].slice.call(form.querySelectorAll('[name], [' + prefix + 'field]')); elements.forEach(function(ele) { var validators = _this3.parseElement(ele); if (!_this3.isEmptyOption(validators)) { var field = ele.getAttribute('name') || ele.getAttribute(prefix + 'field'); opts[field] = Object.assign({}, opts[field], validators); } }); Object.keys(opts).forEach(function(field) { Object.keys(opts[field].validators).forEach(function(v) { opts[field].validators[v].enabled = opts[field].validators[v].enabled || false; if (fields[field] && fields[field].validators && fields[field].validators[v]) { Object.assign(opts[field].validators[v], fields[field].validators[v]); } }); }); return Object.assign({}, fields, opts); } }, { key: 'isEmptyOption', value: function isEmptyOption(opts) { var validators = opts.validators; return Object.keys(validators).length === 0 && validators.constructor === Object; } }, { key: 'parseElement', value: function parseElement(ele) { var reg = new RegExp('^' + this.opts.prefix + '([a-z0-9-]+)(___)*([a-z0-9-]+)*$'); var numAttributes = ele.attributes.length; var opts = {}; var type = ele.getAttribute('type'); for (var i = 0; i < numAttributes; i++) { var name = ele.attributes[i].name; var value = ele.attributes[i].value; if (this.opts.html5Input) { switch (true) { case 'minlength' === name: opts['stringLength'] = Object.assign( {}, { enabled: true, min: parseInt(value, 10) }, opts['stringLength'] ); break; case 'maxlength' === name: opts['stringLength'] = Object.assign( {}, { enabled: true, max: parseInt(value, 10) }, opts['stringLength'] ); break; case 'pattern' === name: opts['regexp'] = Object.assign( {}, { enabled: true, regexp: value }, opts['regexp'] ); break; case 'required' === name: opts['notEmpty'] = Object.assign( {}, { enabled: true }, opts['notEmpty'] ); break; case 'type' === name && 'color' === value: opts['color'] = Object.assign( {}, { enabled: true, type: 'hex' }, opts['color'] ); break; case 'type' === name && 'email' === value: opts['emailAddress'] = Object.assign( {}, { enabled: true }, opts['emailAddress'] ); break; case 'type' === name && 'url' === value: opts['uri'] = Object.assign( {}, { enabled: true }, opts['uri'] ); break; case 'type' === name && 'range' === value: opts['between'] = Object.assign( {}, { enabled: true, max: parseFloat(ele.getAttribute('max')), min: parseFloat(ele.getAttribute('min')) }, opts['between'] ); break; case 'min' === name && type !== 'date' && type !== 'range': opts['greaterThan'] = Object.assign( {}, { enabled: true, min: parseFloat(value) }, opts['greaterThan'] ); break; case 'max' === name && type !== 'date' && type !== 'range': opts['lessThan'] = Object.assign( {}, { enabled: true, max: parseFloat(value) }, opts['lessThan'] ); break; default: break; } } var items = reg.exec(name); if (items && items.length === 4) { var v = this.toCamelCase(items[1]); opts[v] = Object.assign({}, items[3] ? defineProperty({}, this.toCamelCase(items[3]), value) : { enabled: '' === value || 'true' === value }, opts[v]); } } return { validators: opts }; } }, { key: 'toUpperCase', value: function toUpperCase(input) { return input.charAt(1).toUpperCase(); } }, { key: 'toCamelCase', value: function toCamelCase(input) { return input.replace(/-./g, this.toUpperCase); } } ]); return Declarative; })(Plugin); var DefaultSubmit = (function(_Plugin) { inherits(DefaultSubmit, _Plugin); function DefaultSubmit() { classCallCheck(this, DefaultSubmit); var _this = possibleConstructorReturn(this, (DefaultSubmit.__proto__ || Object.getPrototypeOf(DefaultSubmit)).call(this, {})); _this.onValidHandler = _this.onFormValid.bind(_this); return _this; } createClass(DefaultSubmit, [ { key: 'install', value: function install() { var form = this.core.getFormElement(); if (form.querySelectorAll('[type="submit"][name="submit"]').length) { throw new Error('Do not use `submit` for the name attribute of submit button'); } this.core.on('core.form.valid', this.onValidHandler); } }, { key: 'uninstall', value: function uninstall() { this.core.off('core.form.valid', this.onValidHandler); } }, { key: 'onFormValid', value: function onFormValid() { var form = this.core.getFormElement(); if (form instanceof HTMLFormElement) { form.submit(); } } } ]); return DefaultSubmit; })(Plugin); var Dependency = (function(_Plugin) { inherits(Dependency, _Plugin); function Dependency(opts) { classCallCheck(this, Dependency); var _this = possibleConstructorReturn(this, (Dependency.__proto__ || Object.getPrototypeOf(Dependency)).call(this, opts)); _this.opts = opts || {}; _this.triggerExecutedHandler = _this.onTriggerExecuted.bind(_this); return _this; } createClass(Dependency, [ { key: 'install', value: function install() { this.core.on('plugins.trigger.executed', this.triggerExecutedHandler); } }, { key: 'uninstall', value: function uninstall() { this.core.off('plugins.trigger.executed', this.triggerExecutedHandler); } }, { key: 'onTriggerExecuted', value: function onTriggerExecuted(e) { if (this.opts[e.field]) { var dependencies = this.opts[e.field].split(' '); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = dependencies[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var d = _step.value; var dependentField = d.trim(); if (this.opts[dependentField]) { this.core.revalidateField(dependentField); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } } } ]); return Dependency; })(Plugin); var Excluded = (function(_Plugin) { inherits(Excluded, _Plugin); createClass(Excluded, null, [ { key: 'defaultIgnore', value: function defaultIgnore(field, element, elements) { var isVisible = !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length); var disabled = element.getAttribute('disabled'); return disabled === '' || disabled === 'disabled' || element.getAttribute('type') === 'hidden' || !isVisible; } } ]); function Excluded(opts) { classCallCheck(this, Excluded); var _this = possibleConstructorReturn(this, (Excluded.__proto__ || Object.getPrototypeOf(Excluded)).call(this, opts)); _this.opts = Object.assign({}, { excluded: Excluded.defaultIgnore }, opts); _this.ignoreValidationFilter = _this.ignoreValidation.bind(_this); return _this; } createClass(Excluded, [ { key: 'install', value: function install() { this.core.registerFilter('element-ignored', this.ignoreValidationFilter); } }, { key: 'uninstall', value: function uninstall() { this.core.deregisterFilter('element-ignored', this.ignoreValidationFilter); } }, { key: 'ignoreValidation', value: function ignoreValidation(field, element, elements) { return this.opts.excluded.apply(this, [field, element, elements]); } } ]); return Excluded; })(Plugin); function addClass(element, classes) { classes.split(' ').forEach(function(clazz) { if (element.classList) { element.classList.add(clazz); } else if ((' ' + element.className + ' ').indexOf(' ' + clazz + ' ')) { element.className += ' ' + clazz; } }); } function removeClass(element, classes) { classes.split(' ').forEach(function(clazz) { element.classList ? element.classList.remove(clazz) : (element.className = element.className.replace(clazz, '')); }); } function classSet(element, classes) { var adding = []; var removing = []; Object.keys(classes).forEach(function(clazz) { if (clazz) { classes[clazz] ? adding.push(clazz) : removing.push(clazz); } }); removing.forEach(function(clazz) { return removeClass(element, clazz); }); adding.forEach(function(clazz) { return addClass(element, clazz); }); } function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element['mozMatchesSelector'] || element['msMatchesSelector']; if (nativeMatches) { return nativeMatches.call(element, selector); } var nodes = [].slice.call(element.parentElement.querySelectorAll(selector)); return nodes.indexOf(element) >= 0; } function closest(element, selector) { var ele = element; while (ele) { if (matches(ele, selector)) { break; } ele = ele.parentElement; } return ele; } var Message = (function(_Plugin) { inherits(Message, _Plugin); function Message(opts) { classCallCheck(this, Message); var _this = possibleConstructorReturn(this, (Message.__proto__ || Object.getPrototypeOf(Message)).call(this, opts)); _this.messages = new Map(); _this.defaultContainer = document.createElement('div'); _this.opts = Object.assign( {}, { container: function container(field, element) { return _this.defaultContainer; } }, opts ); _this.elementIgnoredHandler = _this.onElementIgnored.bind(_this); _this.fieldAddedHandler = _this.onFieldAdded.bind(_this); _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_this); _this.validatorValidatedHandler = _this.onValidatorValidated.bind(_this); _this.validatorNotValidatedHandler = _this.onValidatorNotValidated.bind(_this); return _this; } createClass( Message, [ { key: 'install', value: function install() { this.core.getFormElement().appendChild(this.defaultContainer); this.core .on('core.element.ignored', this.elementIgnoredHandler) .on('core.field.added', this.fieldAddedHandler) .on('core.field.removed', this.fieldRemovedHandler) .on('core.validator.validated', this.validatorValidatedHandler) .on('core.validator.notvalidated', this.validatorNotValidatedHandler); } }, { key: 'uninstall', value: function uninstall() { this.core.getFormElement().removeChild(this.defaultContainer); this.messages.forEach(function(message) { return message.parentNode.removeChild(message); }); this.messages.clear(); this.core .off('core.element.ignored', this.elementIgnoredHandler) .off('core.field.added', this.fieldAddedHandler) .off('core.field.removed', this.fieldRemovedHandler) .off('core.validator.validated', this.validatorValidatedHandler) .off('core.validator.notvalidated', this.validatorNotValidatedHandler); } }, { key: 'onFieldAdded', value: function onFieldAdded(e) { var _this2 = this; var elements = e.elements; if (elements) { elements.forEach(function(ele) { var msg = _this2.messages.get(ele); if (msg) { msg.parentNode.removeChild(msg); _this2.messages.delete(ele); } }); this.prepareFieldContainer(e.field, elements); } } }, { key: 'onFieldRemoved', value: function onFieldRemoved(e) { var _this3 = this; if (!e.elements.length || !e.field) { return; } var type = e.elements[0].getAttribute('type'); var elements = 'radio' === type || 'checkbox' === type ? [e.elements[0]] : e.elements; elements.forEach(function(ele) { if (_this3.messages.has(ele)) { var container = _this3.messages.get(ele); container.parentNode.removeChild(container); _this3.messages.delete(ele); } }); } }, { key: 'prepareFieldContainer', value: function prepareFieldContainer(field, elements) { var _this4 = this; if (elements.length) { var type = elements[0].getAttribute('type'); if ('radio' === type || 'checkbox' === type) { this.prepareElementContainer(field, elements[0], elements); } else { elements.forEach(function(ele) { return _this4.prepareElementContainer(field, ele, elements); }); } } } }, { key: 'prepareElementContainer', value: function prepareElementContainer(field, element, elements) { var container = void 0; switch (true) { case 'string' === typeof this.opts.container: var selector = this.opts.container; selector = '#' === selector.charAt(0) ? '[id="' + selector.substring(1) + '"]' : selector; container = this.core.getFormElement().querySelector(selector); break; default: container = this.opts.container(field, element); break; } var message = document.createElement('div'); container.appendChild(message); classSet(message, { 'fv-plugins-message-container': true }); this.core.emit('plugins.message.placed', { element: element, elements: elements, field: field, messageElement: message }); this.messages.set(element, message); } }, { key: 'onValidatorValidated', value: function onValidatorValidated(e) { var elements = e.elements; var type = e.element.getAttribute('type'); var element = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; if (this.messages.has(element)) { var container = this.messages.get(element); var messageEle = container.querySelector('[data-field="' + e.field + '"][data-validator="' + e.validator + '"]'); if (!messageEle && !e.result.valid) { var ele = document.createElement('div'); ele.innerHTML = e.result.message; ele.setAttribute('data-field', e.field); ele.setAttribute('data-validator', e.validator); if (this.opts.clazz) { classSet(ele, defineProperty({}, this.opts.clazz, true)); } container.appendChild(ele); this.core.emit('plugins.message.displayed', { element: e.element, field: e.field, message: e.result.message, messageElement: ele, meta: e.result.meta, validator: e.validator }); } else if (messageEle && !e.result.valid) { messageEle.innerHTML = e.result.message; this.core.emit('plugins.message.displayed', { element: e.element, field: e.field, message: e.result.message, messageElement: messageEle, meta: e.result.meta, validator: e.validator }); } else if (messageEle && e.result.valid) { container.removeChild(messageEle); } } } }, { key: 'onValidatorNotValidated', value: function onValidatorNotValidated(e) { var elements = e.elements; var type = e.element.getAttribute('type'); var element = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; if (this.messages.has(element)) { var container = this.messages.get(element); var messageEle = container.querySelector('[data-field="' + e.field + '"][data-validator="' + e.validator + '"]'); if (messageEle) { container.removeChild(messageEle); } } } }, { key: 'onElementIgnored', value: function onElementIgnored(e) { var elements = e.elements; var type = e.element.getAttribute('type'); var element = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; if (this.messages.has(element)) { var container = this.messages.get(element); container.querySelectorAll('[data-field="' + e.field + '"]').forEach(function(messageEle) { container.removeChild(messageEle); }); } } } ], [ { key: 'getClosestContainer', value: function getClosestContainer(element, upper, pattern) { var ele = element; while (ele) { if (ele === upper) { break; } ele = ele.parentElement; if (pattern.test(ele.className)) { break; } } return ele; } } ] ); return Message; })(Plugin); var Framework = (function(_Plugin) { inherits(Framework, _Plugin); function Framework(opts) { classCallCheck(this, Framework); var _this = possibleConstructorReturn(this, (Framework.__proto__ || Object.getPrototypeOf(Framework)).call(this, opts)); _this.results = new Map(); _this.containers = new Map(); _this.opts = Object.assign( {}, { defaultMessageContainer: true, eleInvalidClass: '', eleValidClass: '', rowClasses: '', rowValidatingClass: '' }, opts ); _this.elementIgnoredHandler = _this.onElementIgnored.bind(_this); _this.elementValidatingHandler = _this.onElementValidating.bind(_this); _this.elementValidatedHandler = _this.onElementValidated.bind(_this); _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_this); _this.iconPlacedHandler = _this.onIconPlaced.bind(_this); _this.fieldAddedHandler = _this.onFieldAdded.bind(_this); _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_this); return _this; } createClass(Framework, [ { key: 'install', value: function install() { var _classSet, _this2 = this; classSet(this.core.getFormElement(), ((_classSet = {}), defineProperty(_classSet, this.opts.formClass, true), defineProperty(_classSet, 'fv-plugins-framework', true), _classSet)); this.core .on('core.element.ignored', this.elementIgnoredHandler) .on('core.element.validating', this.elementValidatingHandler) .on('core.element.validated', this.elementValidatedHandler) .on('core.element.notvalidated', this.elementNotValidatedHandler) .on('plugins.icon.placed', this.iconPlacedHandler) .on('core.field.added', this.fieldAddedHandler) .on('core.field.removed', this.fieldRemovedHandler); if (this.opts.defaultMessageContainer) { this.core.registerPlugin( '___frameworkMessage', new Message({ clazz: this.opts.messageClass, container: function container(field, element) { var selector = 'string' === typeof _this2.opts.rowSelector ? _this2.opts.rowSelector : _this2.opts.rowSelector(field, element); var groupEle = closest(element, selector); return Message.getClosestContainer(element, groupEle, _this2.opts.rowPattern); } }) ); } } }, { key: 'uninstall', value: function uninstall() { var _classSet2; this.results.clear(); this.containers.clear(); classSet( this.core.getFormElement(), ((_classSet2 = {}), defineProperty(_classSet2, this.opts.formClass, false), defineProperty(_classSet2, 'fv-plugins-framework', false), _classSet2) ); this.core .off('core.element.ignored', this.elementIgnoredHandler) .off('core.element.validating', this.elementValidatingHandler) .off('core.element.validated', this.elementValidatedHandler) .off('core.element.notvalidated', this.elementNotValidatedHandler) .off('plugins.icon.placed', this.iconPlacedHandler) .off('core.field.added', this.fieldAddedHandler) .off('core.field.removed', this.fieldRemovedHandler); } }, { key: 'onIconPlaced', value: function onIconPlaced(e) {} }, { key: 'onFieldAdded', value: function onFieldAdded(e) { var _this3 = this; var elements = e.elements; if (elements) { elements.forEach(function(ele) { var groupEle = _this3.containers.get(ele); if (groupEle) { var _classSet3; classSet( groupEle, ((_classSet3 = {}), defineProperty(_classSet3, _this3.opts.rowInvalidClass, false), defineProperty(_classSet3, _this3.opts.rowValidatingClass, false), defineProperty(_classSet3, _this3.opts.rowValidClass, false), defineProperty(_classSet3, 'fv-plugins-icon-container', false), _classSet3) ); _this3.containers.delete(ele); } }); this.prepareFieldContainer(e.field, elements); } } }, { key: 'onFieldRemoved', value: function onFieldRemoved(e) { var _this4 = this; e.elements.forEach(function(ele) { var groupEle = _this4.containers.get(ele); if (groupEle) { var _classSet4; classSet( groupEle, ((_classSet4 = {}), defineProperty(_classSet4, _this4.opts.rowInvalidClass, false), defineProperty(_classSet4, _this4.opts.rowValidatingClass, false), defineProperty(_classSet4, _this4.opts.rowValidClass, false), _classSet4) ); } }); } }, { key: 'prepareFieldContainer', value: function prepareFieldContainer(field, elements) { var _this5 = this; if (elements.length) { var type = elements[0].getAttribute('type'); if ('radio' === type || 'checkbox' === type) { this.prepareElementContainer(field, elements[0]); } else { elements.forEach(function(ele) { return _this5.prepareElementContainer(field, ele); }); } } } }, { key: 'prepareElementContainer', value: function prepareElementContainer(field, element) { var selector = 'string' === typeof this.opts.rowSelector ? this.opts.rowSelector : this.opts.rowSelector(field, element); var groupEle = closest(element, selector); if (groupEle !== element) { var _classSet5; classSet(groupEle, ((_classSet5 = {}), defineProperty(_classSet5, this.opts.rowClasses, true), defineProperty(_classSet5, 'fv-plugins-icon-container', true), _classSet5)); this.containers.set(element, groupEle); } } }, { key: 'onElementValidating', value: function onElementValidating(e) { var elements = e.elements; var type = e.element.getAttribute('type'); var element = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; var groupEle = this.containers.get(element); if (groupEle) { var _classSet6; classSet( groupEle, ((_classSet6 = {}), defineProperty(_classSet6, this.opts.rowInvalidClass, false), defineProperty(_classSet6, this.opts.rowValidatingClass, true), defineProperty(_classSet6, this.opts.rowValidClass, false), _classSet6) ); } } }, { key: 'onElementNotValidated', value: function onElementNotValidated(e) { this.removeClasses(e.element, e.elements); } }, { key: 'onElementIgnored', value: function onElementIgnored(e) { this.removeClasses(e.element, e.elements); } }, { key: 'removeClasses', value: function removeClasses(element, elements) { var _classSet7; var type = element.getAttribute('type'); var ele = 'radio' === type || 'checkbox' === type ? elements[0] : element; classSet(ele, ((_classSet7 = {}), defineProperty(_classSet7, this.opts.eleValidClass, false), defineProperty(_classSet7, this.opts.eleInvalidClass, false), _classSet7)); var groupEle = this.containers.get(ele); if (groupEle) { var _classSet8; classSet( groupEle, ((_classSet8 = {}), defineProperty(_classSet8, this.opts.rowInvalidClass, false), defineProperty(_classSet8, this.opts.rowValidatingClass, false), defineProperty(_classSet8, this.opts.rowValidClass, false), _classSet8) ); } } }, { key: 'onElementValidated', value: function onElementValidated(e) { var _classSet9, _this6 = this; var elements = e.elements; var type = e.element.getAttribute('type'); var element = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; classSet(element, ((_classSet9 = {}), defineProperty(_classSet9, this.opts.eleValidClass, e.valid), defineProperty(_classSet9, this.opts.eleInvalidClass, !e.valid), _classSet9)); var groupEle = this.containers.get(element); if (groupEle) { if (!e.valid) { var _classSet10; this.results.set(element, false); classSet( groupEle, ((_classSet10 = {}), defineProperty(_classSet10, this.opts.rowInvalidClass, true), defineProperty(_classSet10, this.opts.rowValidatingClass, false), defineProperty(_classSet10, this.opts.rowValidClass, false), _classSet10) ); } else { this.results.delete(element); var isValid = true; this.containers.forEach(function(value, key) { if (value === groupEle && _this6.results.get(key) === false) { isValid = false; } }); if (isValid) { var _classSet11; classSet( groupEle, ((_classSet11 = {}), defineProperty(_classSet11, this.opts.rowInvalidClass, false), defineProperty(_classSet11, this.opts.rowValidatingClass, false), defineProperty(_classSet11, this.opts.rowValidClass, true), _classSet11) ); } } } } } ]); return Framework; })(Plugin); var Icon = (function(_Plugin) { inherits(Icon, _Plugin); function Icon(opts) { classCallCheck(this, Icon); var _this = possibleConstructorReturn(this, (Icon.__proto__ || Object.getPrototypeOf(Icon)).call(this, opts)); _this.icons = new Map(); _this.opts = Object.assign( {}, { invalid: 'fv-plugins-icon--invalid', onPlaced: function onPlaced() {}, onSet: function onSet() {}, valid: 'fv-plugins-icon--valid', validating: 'fv-plugins-icon--validating' }, opts ); _this.elementValidatingHandler = _this.onElementValidating.bind(_this); _this.elementValidatedHandler = _this.onElementValidated.bind(_this); _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_this); _this.elementIgnoredHandler = _this.onElementIgnored.bind(_this); _this.fieldAddedHandler = _this.onFieldAdded.bind(_this); return _this; } createClass(Icon, [ { key: 'install', value: function install() { this.core .on('core.element.validating', this.elementValidatingHandler) .on('core.element.validated', this.elementValidatedHandler) .on('core.element.notvalidated', this.elementNotValidatedHandler) .on('core.element.ignored', this.elementIgnoredHandler) .on('core.field.added', this.fieldAddedHandler); } }, { key: 'uninstall', value: function uninstall() { this.icons.forEach(function(icon) { return icon.parentNode.removeChild(icon); }); this.icons.clear(); this.core .off('core.element.validating', this.elementValidatingHandler) .off('core.element.validated', this.elementValidatedHandler) .off('core.element.notvalidated', this.elementNotValidatedHandler) .off('core.element.ignored', this.elementIgnoredHandler) .off('core.field.added', this.fieldAddedHandler); } }, { key: 'onFieldAdded', value: function onFieldAdded(e) { var _this2 = this; var elements = e.elements; if (elements) { elements.forEach(function(ele) { var icon = _this2.icons.get(ele); if (icon) { icon.parentNode.removeChild(icon); _this2.icons.delete(ele); } }); this.prepareFieldIcon(e.field, elements); } } }, { key: 'prepareFieldIcon', value: function prepareFieldIcon(field, elements) { var _this3 = this; if (elements.length) { var type = elements[0].getAttribute('type'); if ('radio' === type || 'checkbox' === type) { this.prepareElementIcon(field, elements[0]); } else { elements.forEach(function(ele) { return _this3.prepareElementIcon(field, ele); }); } } } }, { key: 'prepareElementIcon', value: function prepareElementIcon(field, ele) { var i = document.createElement('i'); i.setAttribute('data-field', field); ele.parentNode.insertBefore(i, ele.nextSibling); classSet(i, { 'fv-plugins-icon': true }); var e = { classes: { invalid: this.opts.invalid, valid: this.opts.valid, validating: this.opts.validating }, element: ele, field: field, iconElement: i }; this.core.emit('plugins.icon.placed', e); this.opts.onPlaced(e); this.icons.set(ele, i); } }, { key: 'onElementValidating', value: function onElementValidating(e) { var _setClasses; var icon = this.setClasses( e.field, e.element, e.elements, ((_setClasses = {}), defineProperty(_setClasses, this.opts.invalid, false), defineProperty(_setClasses, this.opts.valid, false), defineProperty(_setClasses, this.opts.validating, true), _setClasses) ); var evt = { element: e.element, field: e.field, iconElement: icon, status: Status$1.Validating }; this.core.emit('plugins.icon.set', evt); this.opts.onSet(evt); } }, { key: 'onElementValidated', value: function onElementValidated(e) { var _setClasses2; var icon = this.setClasses( e.field, e.element, e.elements, ((_setClasses2 = {}), defineProperty(_setClasses2, this.opts.invalid, !e.valid), defineProperty(_setClasses2, this.opts.valid, e.valid), defineProperty(_setClasses2, this.opts.validating, false), _setClasses2) ); var evt = { element: e.element, field: e.field, iconElement: icon, status: e.valid ? Status$1.Valid : Status$1.Invalid }; this.core.emit('plugins.icon.set', evt); this.opts.onSet(evt); } }, { key: 'onElementNotValidated', value: function onElementNotValidated(e) { var _setClasses3; var icon = this.setClasses( e.field, e.element, e.elements, ((_setClasses3 = {}), defineProperty(_setClasses3, this.opts.invalid, false), defineProperty(_setClasses3, this.opts.valid, false), defineProperty(_setClasses3, this.opts.validating, false), _setClasses3) ); var evt = { element: e.element, field: e.field, iconElement: icon, status: Status$1.NotValidated }; this.core.emit('plugins.icon.set', evt); this.opts.onSet(evt); } }, { key: 'onElementIgnored', value: function onElementIgnored(e) { var _setClasses4; var icon = this.setClasses( e.field, e.element, e.elements, ((_setClasses4 = {}), defineProperty(_setClasses4, this.opts.invalid, false), defineProperty(_setClasses4, this.opts.valid, false), defineProperty(_setClasses4, this.opts.validating, false), _setClasses4) ); var evt = { element: e.element, field: e.field, iconElement: icon, status: Status$1.Ignored }; this.core.emit('plugins.icon.set', evt); this.opts.onSet(evt); } }, { key: 'setClasses', value: function setClasses(field, element, elements, classes) { var type = element.getAttribute('type'); var ele = 'radio' === type || 'checkbox' === type ? elements[0] : element; if (this.icons.has(ele)) { var icon = this.icons.get(ele); classSet(icon, classes); return icon; } else { return null; } } } ]); return Icon; })(Plugin); var Sequence = (function(_Plugin) { inherits(Sequence, _Plugin); function Sequence(opts) { classCallCheck(this, Sequence); var _this = possibleConstructorReturn(this, (Sequence.__proto__ || Object.getPrototypeOf(Sequence)).call(this, opts)); _this.invalidFields = new Map(); _this.opts = Object.assign({}, { enabled: true }, opts); _this.validatorHandler = _this.onValidatorValidated.bind(_this); _this.shouldValidateFilter = _this.shouldValidate.bind(_this); _this.fieldAddedHandler = _this.onFieldAdded.bind(_this); _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_this); _this.elementValidatingHandler = _this.onElementValidating.bind(_this); return _this; } createClass(Sequence, [ { key: 'install', value: function install() { this.core .on('core.validator.validated', this.validatorHandler) .on('core.field.added', this.fieldAddedHandler) .on('core.element.notvalidated', this.elementNotValidatedHandler) .on('core.element.validating', this.elementValidatingHandler) .registerFilter('field-should-validate', this.shouldValidateFilter); } }, { key: 'uninstall', value: function uninstall() { this.invalidFields.clear(); this.core .off('core.validator.validated', this.validatorHandler) .off('core.field.added', this.fieldAddedHandler) .off('core.element.notvalidated', this.elementNotValidatedHandler) .off('core.element.validating', this.elementValidatingHandler) .deregisterFilter('field-should-validate', this.shouldValidateFilter); } }, { key: 'shouldValidate', value: function shouldValidate(field, element, value, validator) { var stop = (this.opts.enabled === true || this.opts.enabled[field] === true) && this.invalidFields.has(element) && !!this.invalidFields.get(element).length && this.invalidFields.get(element).indexOf(validator) === -1; return !stop; } }, { key: 'onValidatorValidated', value: function onValidatorValidated(e) { var validators = this.invalidFields.has(e.element) ? this.invalidFields.get(e.element) : []; var index = validators.indexOf(e.validator); if (e.result.valid && index >= 0) { validators.splice(index, 1); } else if (!e.result.valid && index === -1) { validators.push(e.validator); } this.invalidFields.set(e.element, validators); } }, { key: 'onFieldAdded', value: function onFieldAdded(e) { if (e.elements) { this.clearInvalidFields(e.elements); } } }, { key: 'onElementNotValidated', value: function onElementNotValidated(e) { this.clearInvalidFields(e.elements); } }, { key: 'onElementValidating', value: function onElementValidating(e) { this.clearInvalidFields(e.elements); } }, { key: 'clearInvalidFields', value: function clearInvalidFields(elements) { var _this2 = this; elements.forEach(function(ele) { return _this2.invalidFields.delete(ele); }); } } ]); return Sequence; })(Plugin); var SubmitButton = (function(_Plugin) { inherits(SubmitButton, _Plugin); function SubmitButton(opts) { classCallCheck(this, SubmitButton); var _this = possibleConstructorReturn(this, (SubmitButton.__proto__ || Object.getPrototypeOf(SubmitButton)).call(this, opts)); _this.opts = Object.assign( {}, { selector: '[type="submit"]:not([formnovalidate])' }, opts ); _this.submitHandler = _this.submitHandle.bind(_this); return _this; } createClass(SubmitButton, [ { key: 'install', value: function install() { var _this2 = this; if (!(this.core.getFormElement() instanceof HTMLFormElement)) { return; } var form = this.core.getFormElement(); form.setAttribute('novalidate', 'novalidate'); form.addEventListener('submit', this.submitHandler); var hiddenButton = document.createElement('button'); hiddenButton.setAttribute('type', 'submit'); Object.assign(hiddenButton.style, { display: 'none', height: '0', width: '0' }); form.appendChild(hiddenButton); var selectorButtons = [].slice.call(form.querySelectorAll(this.opts.selector)); var submitButtons = [].slice.call(form.querySelectorAll('[type="submit"]')); submitButtons.forEach(function(button) { button.addEventListener('click', function(e) { var target = e.currentTarget; if (!e.defaultPrevented && target instanceof HTMLElement && selectorButtons.indexOf(target) === -1 && target !== hiddenButton) { form.removeEventListener('submit', _this2.submitHandler); form.submit(); return false; } }); }); } }, { key: 'uninstall', value: function uninstall() { var form = this.core.getFormElement(); if (form instanceof HTMLFormElement) { form.removeEventListener('submit', this.submitHandler); } } }, { key: 'submitHandle', value: function submitHandle(e) { e.preventDefault(); this.core.validate(); } } ]); return SubmitButton; })(Plugin); var Tooltip = (function(_Plugin) { inherits(Tooltip, _Plugin); function Tooltip(opts) { classCallCheck(this, Tooltip); var _this = possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, opts)); _this.messages = new Map(); _this.opts = Object.assign( {}, { placement: 'top', trigger: 'click' }, opts ); _this.iconPlacedHandler = _this.onIconPlaced.bind(_this); _this.validatorValidatedHandler = _this.onValidatorValidated.bind(_this); _this.elementValidatedHandler = _this.onElementValidated.bind(_this); _this.documentClickHandler = _this.onDocumentClicked.bind(_this); return _this; } createClass(Tooltip, [ { key: 'install', value: function install() { this.tip = document.createElement('div'); classSet( this.tip, defineProperty( { 'fv-plugins-tooltip': true }, 'fv-plugins-tooltip--' + this.opts.placement, true ) ); document.body.appendChild(this.tip); this.core .on('plugins.icon.placed', this.iconPlacedHandler) .on('core.validator.validated', this.validatorValidatedHandler) .on('core.element.validated', this.elementValidatedHandler); if ('click' === this.opts.trigger) { document.addEventListener('click', this.documentClickHandler); } } }, { key: 'uninstall', value: function uninstall() { this.messages.clear(); document.body.removeChild(this.tip); this.core .off('plugins.icon.placed', this.iconPlacedHandler) .off('core.validator.validated', this.validatorValidatedHandler) .off('core.element.validated', this.elementValidatedHandler); if ('click' === this.opts.trigger) { document.removeEventListener('click', this.documentClickHandler); } } }, { key: 'onIconPlaced', value: function onIconPlaced(e) { var _this2 = this; classSet(e.iconElement, { 'fv-plugins-tooltip-icon': true }); switch (this.opts.trigger) { case 'hover': e.iconElement.addEventListener('mouseenter', function(evt) { return _this2.show(e.element, evt); }); e.iconElement.addEventListener('mouseleave', function(evt) { return _this2.hide(); }); break; case 'click': default: e.iconElement.addEventListener('click', function(evt) { return _this2.show(e.element, evt); }); break; } } }, { key: 'onValidatorValidated', value: function onValidatorValidated(e) { if (!e.result.valid) { var elements = e.elements; var type = e.element.getAttribute('type'); var ele = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; this.messages.set(ele, e.result.message); } } }, { key: 'onElementValidated', value: function onElementValidated(e) { if (e.valid) { var elements = e.elements; var type = e.element.getAttribute('type'); var ele = 'radio' === type || 'checkbox' === type ? elements[0] : e.element; this.messages.delete(ele); } } }, { key: 'onDocumentClicked', value: function onDocumentClicked(e) { this.hide(); } }, { key: 'show', value: function show(ele, e) { e.preventDefault(); e.stopPropagation(); if (!this.messages.has(ele)) { return; } classSet(this.tip, { 'fv-plugins-tooltip--hide': false }); this.tip.innerHTML = '' + this.messages.get(ele) + ''; var icon = e.target; var rect = icon.getBoundingClientRect(); var top = 0; var left = 0; switch (this.opts.placement) { case 'top': default: top = rect.top - rect.height; left = rect.left + rect.width / 2 - this.tip.clientWidth / 2; break; case 'top-left': top = rect.top - rect.height; left = rect.left; break; case 'top-right': top = rect.top - rect.height; left = rect.left + rect.width - this.tip.clientWidth; break; case 'bottom': top = rect.top + rect.height; left = rect.left + rect.width / 2 - this.tip.clientWidth / 2; break; case 'bottom-left': top = rect.top + rect.height; left = rect.left; break; case 'bottom-right': top = rect.top + rect.height; left = rect.left + rect.width - this.tip.clientWidth; break; case 'left': top = rect.top + rect.height / 2 - this.tip.clientHeight / 2; left = rect.left - this.tip.clientWidth; break; case 'right': top = rect.top + rect.height / 2 - this.tip.clientHeight / 2; left = rect.left + rect.width; break; } top = top + document.body.scrollTop; left = left + document.body.scrollLeft; this.tip.setAttribute('style', 'top: ' + top + 'px; left: ' + left + 'px'); } }, { key: 'hide', value: function hide() { classSet(this.tip, { 'fv-plugins-tooltip--hide': true }); } } ]); return Tooltip; })(Plugin); var Trigger = (function(_Plugin) { inherits(Trigger, _Plugin); function Trigger(opts) { classCallCheck(this, Trigger); var _this = possibleConstructorReturn(this, (Trigger.__proto__ || Object.getPrototypeOf(Trigger)).call(this, opts)); _this.handlers = []; _this.timers = new Map(); _this.ieVersion = (function() { var v = 3; var div = document.createElement('div'); var a = div['all'] || []; while (((div.innerHTML = ''), a[0])) {} return v > 4 ? v : document['documentMode']; })(); var ele = document.createElement('div'); _this.defaultEvent = _this.ieVersion === 9 || !('oninput' in ele) ? 'keyup' : 'input'; _this.opts = Object.assign( {}, { delay: 0, event: _this.defaultEvent, threshold: 0 }, opts ); _this.fieldAddedHandler = _this.onFieldAdded.bind(_this); _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_this); return _this; } createClass(Trigger, [ { key: 'install', value: function install() { this.core.on('core.field.added', this.fieldAddedHandler).on('core.field.removed', this.fieldRemovedHandler); } }, { key: 'uninstall', value: function uninstall() { this.handlers.forEach(function(item) { return item.element.removeEventListener(item.event, item.handler); }); this.handlers = []; this.timers.forEach(function(t) { return window.clearTimeout(t); }); this.timers.clear(); this.core.off('core.field.added', this.fieldAddedHandler).off('core.field.removed', this.fieldRemovedHandler); } }, { key: 'prepareHandler', value: function prepareHandler(field, elements) { var _this2 = this; elements.forEach(function(ele) { var events = []; switch (true) { case !!_this2.opts.event && _this2.opts.event[field] === false: events = []; break; case !!_this2.opts.event && !!_this2.opts.event[field]: events = _this2.opts.event[field].split(' '); break; case 'string' === typeof _this2.opts.event && _this2.opts.event !== _this2.defaultEvent: events = _this2.opts.event.split(' '); break; default: var type = ele.getAttribute('type'); var tagName = ele.tagName.toLowerCase(); var event = 'radio' === type || 'checkbox' === type || 'file' === type || 'select' === tagName ? 'change' : _this2.ieVersion >= 10 && ele.getAttribute('placeholder') ? 'keyup' : _this2.defaultEvent; events = [event]; break; } events.forEach(function(evt) { var evtHandler = function evtHandler(e) { return _this2.handleEvent(e, field, ele); }; _this2.handlers.push({ element: ele, event: evt, field: field, handler: evtHandler }); ele.addEventListener(evt, evtHandler); }); }); } }, { key: 'handleEvent', value: function handleEvent(e, field, ele) { var _this3 = this; if (this.exceedThreshold(field, ele)) { var handler = function handler() { return _this3.core.validateElement(field, ele).then(function(resolve) { _this3.core.emit('plugins.trigger.executed', { element: ele, event: e, field: field }); }); }; var delay = this.opts.delay[field] || this.opts.delay; if (delay === 0) { handler(); } else { var timer = this.timers.get(ele); if (timer) { window.clearTimeout(timer); } this.timers.set(ele, window.setTimeout(handler, delay * 1000)); } } } }, { key: 'onFieldAdded', value: function onFieldAdded(e) { this.handlers .filter(function(item) { return item.field === e.field; }) .forEach(function(item) { return item.element.removeEventListener(item.event, item.handler); }); this.prepareHandler(e.field, e.elements); } }, { key: 'onFieldRemoved', value: function onFieldRemoved(e) { this.handlers .filter(function(item) { return item.field === e.field && e.elements.indexOf(item.element) >= 0; }) .forEach(function(item) { return item.element.removeEventListener(item.event, item.handler); }); } }, { key: 'exceedThreshold', value: function exceedThreshold(field, element) { var threshold = this.opts.threshold[field] === 0 || this.opts.threshold === 0 ? false : this.opts.threshold[field] || this.opts.threshold; if (!threshold) { return true; } var type = element.getAttribute('type'); if (['button', 'checkbox', 'file', 'hidden', 'image', 'radio', 'reset', 'submit'].indexOf(type) !== -1) { return true; } var value = this.core.getElementValue(field, element); return value.length >= threshold; } } ]); return Trigger; })(Plugin); var index$2 = { Alias: Alias, Aria: Aria, AutoFocus: AutoFocus, Declarative: Declarative, DefaultSubmit: DefaultSubmit, Dependency: Dependency, Excluded: Excluded, Framework: Framework, Icon: Icon, Message: Message, Sequence: Sequence, SubmitButton: SubmitButton, Tooltip: Tooltip, Trigger: Trigger }; function hasClass(element, clazz) { return element.classList ? element.classList.contains(clazz) : new RegExp('(^| )' + clazz + '( |$)', 'gi').test(element.className); } var index$3 = { call: call, classSet: classSet, closest: closest, fetch: fetch, format: format, hasClass: hasClass, isValidDate: isValidDate }; var locales = {}; exports.algorithms = index; exports.formValidation = formValidation; exports.filters = index$1; exports.locales = locales; exports.plugins = index$2; exports.utils = index$3; exports.validators = validators; exports.Plugin = Plugin; exports.Status = Status$1; Object.defineProperty(exports, '__esModule', { value: true }); }); !function(e,a){typeof exports==='object'&&typeof module!=='undefined'?module.exports=a():typeof define==='function'&&define.amd?define(a):(e.FormValidation=e.FormValidation||{}, e.FormValidation.locales=e.FormValidation.locales||{}, e.FormValidation.locales.en_US=a())}(this,(function(){"use strict";var e={base64:{default:'Please enter a valid base 64 encoded'},between:{default:'Please enter a value between %s and %s',notInclusive:'Please enter a value between %s and %s strictly'},bic:{default:'Please enter a valid BIC number'},callback:{default:'Please enter a valid value'},choice:{between:'Please choose %s - %s options',default:'Please enter a valid value',less:'Please choose %s options at minimum',more:'Please choose %s options at maximum'},color:{default:'Please enter a valid color'},creditCard:{default:'Please enter a valid credit card number'},cusip:{default:'Please enter a valid CUSIP number'},date:{default:'Please enter a valid date',max:'Please enter a date before %s',min:'Please enter a date after %s',range:'Please enter a date in the range %s - %s'},different:{default:'Please enter a different value'},digits:{default:'Please enter only digits'},ean:{default:'Please enter a valid EAN number'},ein:{default:'Please enter a valid EIN number'},emailAddress:{default:'Please enter a valid email address'},file:{default:'Please choose a valid file'},greaterThan:{default:'Please enter a value greater than or equal to %s',notInclusive:'Please enter a value greater than %s'},grid:{default:'Please enter a valid GRId number'},hex:{default:'Please enter a valid hexadecimal number'},iban:{countries:{AD:'Andorra',AE:'United Arab Emirates',AL:'Albania',AO:'Angola',AT:'Austria',AZ:'Azerbaijan',BA:'Bosnia and Herzegovina',BE:'Belgium',BF:'Burkina Faso',BG:'Bulgaria',BH:'Bahrain',BI:'Burundi',BJ:'Benin',BR:'Brazil',CH:'Switzerland',CI:'Ivory Coast',CM:'Cameroon',CR:'Costa Rica',CV:'Cape Verde',CY:'Cyprus',CZ:'Czech Republic',DE:'Germany',DK:'Denmark',DO:'Dominican Republic',DZ:'Algeria',EE:'Estonia',ES:'Spain',FI:'Finland',FO:'Faroe Islands',FR:'France',GB:'United Kingdom',GE:'Georgia',GI:'Gibraltar',GL:'Greenland',GR:'Greece',GT:'Guatemala',HR:'Croatia',HU:'Hungary',IE:'Ireland',IL:'Israel',IR:'Iran',IS:'Iceland',IT:'Italy',JO:'Jordan',KW:'Kuwait',KZ:'Kazakhstan',LB:'Lebanon',LI:'Liechtenstein',LT:'Lithuania',LU:'Luxembourg',LV:'Latvia',MC:'Monaco',MD:'Moldova',ME:'Montenegro',MG:'Madagascar',MK:'Macedonia',ML:'Mali',MR:'Mauritania',MT:'Malta',MU:'Mauritius',MZ:'Mozambique',NL:'Netherlands',NO:'Norway',PK:'Pakistan',PL:'Poland',PS:'Palestine',PT:'Portugal',QA:'Qatar',RO:'Romania',RS:'Serbia',SA:'Saudi Arabia',SE:'Sweden',SI:'Slovenia',SK:'Slovakia',SM:'San Marino',SN:'Senegal',TL:'East Timor',TN:'Tunisia',TR:'Turkey',VG:'Virgin Islands, British',XK:'Republic of Kosovo'},country:'Please enter a valid IBAN number in %s',default:'Please enter a valid IBAN number'},id:{countries:{BA:'Bosnia and Herzegovina',BG:'Bulgaria',BR:'Brazil',CH:'Switzerland',CL:'Chile',CN:'China',CZ:'Czech Republic',DK:'Denmark',EE:'Estonia',ES:'Spain',FI:'Finland',HR:'Croatia',IE:'Ireland',IS:'Iceland',LT:'Lithuania',LV:'Latvia',ME:'Montenegro',MK:'Macedonia',NL:'Netherlands',PL:'Poland',RO:'Romania',RS:'Serbia',SE:'Sweden',SI:'Slovenia',SK:'Slovakia',SM:'San Marino',TH:'Thailand',TR:'Turkey',ZA:'South Africa'},country:'Please enter a valid identification number in %s',default:'Please enter a valid identification number'},identical:{default:'Please enter the same value'},imei:{default:'Please enter a valid IMEI number'},imo:{default:'Please enter a valid IMO number'},integer:{default:'Please enter a valid number'},ip:{default:'Please enter a valid IP address',ipv4:'Please enter a valid IPv4 address',ipv6:'Please enter a valid IPv6 address'},isbn:{default:'Please enter a valid ISBN number'},isin:{default:'Please enter a valid ISIN number'},ismn:{default:'Please enter a valid ISMN number'},issn:{default:'Please enter a valid ISSN number'},lessThan:{default:'Please enter a value less than or equal to %s',notInclusive:'Please enter a value less than %s'},mac:{default:'Please enter a valid MAC address'},meid:{default:'Please enter a valid MEID number'},notEmpty:{default:'Please enter a value'},numeric:{default:'Please enter a valid float number'},phone:{countries:{AE:'United Arab Emirates',BG:'Bulgaria',BR:'Brazil',CN:'China',CZ:'Czech Republic',DE:'Germany',DK:'Denmark',ES:'Spain',FR:'France',GB:'United Kingdom',IN:'India',MA:'Morocco',NL:'Netherlands',PK:'Pakistan',RO:'Romania',RU:'Russia',SK:'Slovakia',TH:'Thailand',US:'USA',VE:'Venezuela'},country:'Please enter a valid phone number in %s',default:'Please enter a valid phone number'},promise:{default:'Please enter a valid value'},regexp:{default:'Please enter a value matching the pattern'},remote:{default:'Please enter a valid value'},rtn:{default:'Please enter a valid RTN number'},sedol:{default:'Please enter a valid SEDOL number'},siren:{default:'Please enter a valid SIREN number'},siret:{default:'Please enter a valid SIRET number'},step:{default:'Please enter a valid step of %s'},stringCase:{default:'Please enter only lowercase characters',upper:'Please enter only uppercase characters'},stringLength:{between:'Please enter value between %s and %s characters long',default:'Please enter a value with valid length',less:'Please enter less than %s characters',more:'Please enter more than %s characters'},uri:{default:'Please enter a valid URI'},uuid:{default:'Please enter a valid UUID number',version:'Please enter a valid UUID version %s number'},vat:{countries:{AT:'Austria',BE:'Belgium',BG:'Bulgaria',BR:'Brazil',CH:'Switzerland',CY:'Cyprus',CZ:'Czech Republic',DE:'Germany',DK:'Denmark',EE:'Estonia',EL:'Greece',ES:'Spain',FI:'Finland',FR:'France',GB:'United Kingdom',GR:'Greece',HR:'Croatia',HU:'Hungary',IE:'Ireland',IS:'Iceland',IT:'Italy',LT:'Lithuania',LU:'Luxembourg',LV:'Latvia',MT:'Malta',NL:'Netherlands',NO:'Norway',PL:'Poland',PT:'Portugal',RO:'Romania',RS:'Serbia',RU:'Russia',SE:'Sweden',SI:'Slovenia',SK:'Slovakia',VE:'Venezuela',ZA:'South Africa'},country:'Please enter a valid VAT number in %s',default:'Please enter a valid VAT number'},vin:{default:'Please enter a valid VIN number'},zipCode:{countries:{AT:'Austria',BG:'Bulgaria',BR:'Brazil',CA:'Canada',CH:'Switzerland',CZ:'Czech Republic',DE:'Germany',DK:'Denmark',ES:'Spain',FR:'France',GB:'United Kingdom',IE:'Ireland',IN:'India',IT:'Italy',MA:'Morocco',NL:'Netherlands',PL:'Poland',PT:'Portugal',RO:'Romania',RU:'Russia',SE:'Sweden',SG:'Singapore',SK:'Slovakia',US:'USA'},country:'Please enter a valid postal code in %s',default:'Please enter a valid postal code'}};return e})) !function(t,i){"object"==typeof exports?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Spinner=i()}(this,function(){"use strict";function t(t,i){var e,o=document.createElement(t||"div");for(e in i)o[e]=i[e];return o}function i(t){for(var i=1,e=arguments.length;i>1)+"px"})}for(var c,d=0,p=(r.lines-1)*(1-r.direction)/2;d',e)}p.addRule(".spin-vml","behavior:url(#default#VML)"),a.prototype.lines=function(t,o){function r(){return n(e("group",{coordsize:d+" "+d,coordorigin:-c+" "+-c}),{width:d,height:d})}function a(t,a,l){i(u,i(n(r(),{rotation:360/o.lines*t+"deg",left:~~a}),i(n(e("roundrect",{arcsize:o.corners}),{width:c,height:o.width,left:o.radius,top:-o.width>>1,filter:l}),e("fill",{color:s(o.color,t),opacity:o.opacity}),e("stroke",{opacity:0}))))}var l,c=o.length+o.width,d=2*c,p=2*-(o.width+o.length)+"px",u=n(r(),{position:"absolute",top:p,left:p});if(o.shadow)for(l=1;l<=o.lines;l++)a(l,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(l=1;l<=o.lines;l++)a(l);return i(t,u)},a.prototype.opacity=function(t,i,e,o){var n=t.firstChild;o=o.shadow&&o.lines||0,n&&i+o32&&(r*=.8),e.hasAttribute("data-spinner-size")&&(r=parseInt(e.getAttribute("data-spinner-size"),10)),e.hasAttribute("data-spinner-color")&&(a=e.getAttribute("data-spinner-color")),e.hasAttribute("data-spinner-lines")&&(n=parseInt(e.getAttribute("data-spinner-lines"),10));var i=.2*r,o=.6*i,s=i<7?2:3;return new t({color:a||"#fff",lines:n||12,radius:i,length:o,width:s,zIndex:"auto",top:"auto",left:"auto",className:""})}function i(t,e){var a=document.createRange();a.selectNodeContents(t),a.surroundContents(e),t.appendChild(e)}var o=[];return{bind:function(t,r){r=r||{};var i=[];"string"==typeof t?i=document.querySelectorAll(t):"object"==typeof t&&"string"==typeof t.nodeName&&(i=[t]);for(var o=0;o' + ckd_on_txt + '
    ' : ''; var off_label = ckd_off_txt ? '
    ' + ckd_off_txt + '
    ' : ''; // default states var disabled = $(this).is(':disabled') ? true : false; var active = $(this).is(':checked') ? true : false; var status_classes = ''; status_classes += active ? ' lcs_on' : ' lcs_off'; if (disabled) { status_classes += ' lcs_disabled'; } // wrap and append var structure = '
    ' + '
    ' + on_label + off_label + '
    '; if ($(this).is(':input') && ($(this).attr('type') == 'checkbox' || $(this).attr('type') == 'radio')) { $(this).wrap('
    '); $(this) .parent() .append(structure); $(this) .parent() .find('.lcs_switch') .addClass('lcs_' + $(this).attr('type') + '_switch'); // Trigger Events $(this) .parent() .find('.lcs_switch:not(.lcs_disabled)') .on('change click tap', function(e) { if ($(this).hasClass('lcs_on')) { if (!$(this).hasClass('lcs_radio_switch')) { // not for radio $(this).lcs_off(); } } else { $(this).lcs_on(); } }); if ( $(this) .parent('.lcs_wrap') .parent('label')[0] ) { $(this) .parent('.lcs_wrap') .parent('label') .addClass('lcs_label_wrap'); } // if no container for each radio|checkbox if ($('.lcs_wrap ~ label')[0]) { $('.lcs_wrap').each(function() { if ( $(this) .parent() .find('.lcs_wrap ~ label').length > 0 || $(this).prev('.lcs_main_wrap').length > 0 ) { if ($(this).parent('.lcs_main_wrap').length != 1) { $(this) .next('label') .addBack() .wrapAll('
    '); } } }); } } } }); }; })(jQuery); (function (factory) { window.cash = factory(); })(function () { var doc = document, win = window, ArrayProto = Array.prototype, slice = ArrayProto.slice, filter = ArrayProto.filter, push = ArrayProto.push; var noop = function () {}, isFunction = function (item) { // @see https://crbug.com/568448 return typeof item === typeof noop && item.call; }, isString = function (item) { return typeof item === typeof ""; }; var idMatch = /^#[\w-]*$/, classMatch = /^\.[\w-]*$/, htmlMatch = /<.+>/, singlet = /^\w+$/; function find(selector, context) { context = context || doc; var elems = (classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector)); return elems; } var frag; function parseHTML(str) { if (!frag) { frag = doc.implementation.createHTMLDocument(null); var base = frag.createElement("base"); base.href = doc.location.href; frag.head.appendChild(base); } frag.body.innerHTML = str; return frag.body.childNodes; } function onReady(fn) { if (doc.readyState !== "loading") { fn(); } else { doc.addEventListener("DOMContentLoaded", fn); } } function Init(selector, context) { if (!selector) { return this; } // If already a cash collection, don't do any further processing if (selector.cash && selector !== win) { return selector; } var elems = selector, i = 0, length; if (isString(selector)) { elems = (idMatch.test(selector) ? // If an ID use the faster getElementById check doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? // If HTML, parse it into real elements parseHTML(selector) : // else use `find` find(selector, context)); // If function, use as shortcut for DOM ready } else if (isFunction(selector)) { onReady(selector);return this; } if (!elems) { return this; } // If a single DOM element is passed in or received via ID, return the single element if (elems.nodeType || elems === win) { this[0] = elems; this.length = 1; } else { // Treat like an array and loop through each item. length = this.length = elems.length; for (; i < length; i++) { this[i] = elems[i]; } } return this; } function cash(selector, context) { return new Init(selector, context); } var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line cash: true, length: 0, push: push, splice: ArrayProto.splice, map: ArrayProto.map, init: Init }; Object.defineProperty(fn, "constructor", { value: cash }); cash.parseHTML = parseHTML; cash.noop = noop; cash.isFunction = isFunction; cash.isString = isString; cash.extend = fn.extend = function (target) { target = target || {}; var args = slice.call(arguments), length = args.length, i = 1; if (args.length === 1) { target = this; i = 0; } for (; i < length; i++) { if (!args[i]) { continue; } for (var key in args[i]) { if (args[i].hasOwnProperty(key)) { target[key] = args[i][key]; } } } return target; }; function each(collection, callback) { var l = collection.length, i = 0; for (; i < l; i++) { if (callback.call(collection[i], collection[i], i, collection) === false) { break; } } } function matches(el, selector) { var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector); return !!m && m.call(el, selector); } function getCompareFunction(selector) { return ( isString(selector) ? matches : selector.cash ? function (el) { return selector.is(el); } : function (el, selector) { return el === selector; }); } function unique(collection) { return cash(slice.call(collection).filter(function (item, index, self) { return self.indexOf(item) === index; })); } cash.extend({ merge: function (first, second) { var len = +second.length, i = first.length, j = 0; for (; j < len; i++, j++) { first[i] = second[j]; } first.length = i; return first; }, each: each, matches: matches, unique: unique, isArray: Array.isArray, isNumeric: function (n) { return !isNaN(parseFloat(n)) && isFinite(n); } }); var uid = cash.uid = "_cash" + Date.now(); function getDataCache(node) { return (node[uid] = node[uid] || {}); } function setData(node, key, value) { return (getDataCache(node)[key] = value); } function getData(node, key) { var c = getDataCache(node); if (c[key] === undefined) { c[key] = node.dataset ? node.dataset[key] : cash(node).attr("data-" + key); } return c[key]; } function removeData(node, key) { var c = getDataCache(node); if (c) { delete c[key]; } else if (node.dataset) { delete node.dataset[key]; } else { cash(node).removeAttr("data-" + name); } } fn.extend({ data: function (name, value) { if (isString(name)) { return (value === undefined ? getData(this[0], name) : this.each(function (v) { return setData(v, name, value); })); } for (var key in name) { this.data(key, name[key]); } return this; }, removeData: function (key) { return this.each(function (v) { return removeData(v, key); }); } }); var notWhiteMatch = /\S+/g; function getClasses(c) { return isString(c) && c.match(notWhiteMatch); } function hasClass(v, c) { return (v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className)); } function addClass(v, c, spacedName) { if (v.classList) { v.classList.add(c); } else if (spacedName.indexOf(" " + c + " ")) { v.className += " " + c; } } function removeClass(v, c) { if (v.classList) { v.classList.remove(c); } else { v.className = v.className.replace(c, ""); } } fn.extend({ addClass: function (c) { var classes = getClasses(c); return (classes ? this.each(function (v) { var spacedName = " " + v.className + " "; each(classes, function (c) { addClass(v, c, spacedName); }); }) : this); }, attr: function (name, value) { if (!name) { return undefined; } if (isString(name)) { if (value === undefined) { return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; } return this.each(function (v) { if (v.setAttribute) { v.setAttribute(name, value); } else { v[name] = value; } }); } for (var key in name) { this.attr(key, name[key]); } return this; }, hasClass: function (c) { var check = false, classes = getClasses(c); if (classes && classes.length) { this.each(function (v) { check = hasClass(v, classes[0]); return !check; }); } return check; }, prop: function (name, value) { if (isString(name)) { return (value === undefined ? this[0][name] : this.each(function (v) { v[name] = value; })); } for (var key in name) { this.prop(key, name[key]); } return this; }, removeAttr: function (name) { return this.each(function (v) { if (v.removeAttribute) { v.removeAttribute(name); } else { delete v[name]; } }); }, removeClass: function (c) { if (!arguments.length) { return this.attr("class", ""); } var classes = getClasses(c); return (classes ? this.each(function (v) { each(classes, function (c) { removeClass(v, c); }); }) : this); }, removeProp: function (name) { return this.each(function (v) { delete v[name]; }); }, toggleClass: function (c, state) { if (state !== undefined) { return this[state ? "addClass" : "removeClass"](c); } var classes = getClasses(c); return (classes ? this.each(function (v) { var spacedName = " " + v.className + " "; each(classes, function (c) { if (hasClass(v, c)) { removeClass(v, c); } else { addClass(v, c, spacedName); } }); }) : this); } }); fn.extend({ add: function (selector, context) { return unique(cash.merge(this, cash(selector, context))); }, each: function (callback) { each(this, callback); return this; }, eq: function (index) { return cash(this.get(index)); }, filter: function (selector) { if (!selector) { return this; } var comparator = (isFunction(selector) ? selector : getCompareFunction(selector)); return cash(filter.call(this, function (e) { return comparator(e, selector); })); }, first: function () { return this.eq(0); }, get: function (index) { if (index === undefined) { return slice.call(this); } return (index < 0 ? this[index + this.length] : this[index]); }, index: function (elem) { var child = elem ? cash(elem)[0] : this[0], collection = elem ? this : cash(child).parent().children(); return slice.call(collection).indexOf(child); }, last: function () { return this.eq(-1); } }); var camelCase = (function () { var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, whiteSpace = /[\s-_]+/g; return function (str) { return str.replace(camelRegex, function (letter, index) { return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); }).replace(whiteSpace, ""); }; }()); var getPrefixedProp = (function () { var cache = {}, doc = document, div = doc.createElement("div"), style = div.style; return function (prop) { prop = camelCase(prop); if (cache[prop]) { return cache[prop]; } var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), prefixes = ["webkit", "moz", "ms", "o"], props = (prop + " " + (prefixes).join(ucProp + " ") + ucProp).split(" "); each(props, function (p) { if (p in style) { cache[p] = prop = cache[prop] = p; return false; } }); return cache[prop]; }; }()); cash.prefixedProp = getPrefixedProp; cash.camelCase = camelCase; fn.extend({ css: function (prop, value) { if (isString(prop)) { prop = getPrefixedProp(prop); return (arguments.length > 1 ? this.each(function (v) { return v.style[prop] = value; }) : win.getComputedStyle(this[0])[prop]); } for (var key in prop) { this.css(key, prop[key]); } return this; } }); function compute(el, prop) { return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; } each(["Width", "Height"], function (v) { var lower = v.toLowerCase(); fn[lower] = function () { return this[0].getBoundingClientRect()[lower]; }; fn["inner" + v] = function () { return this[0]["client" + v]; }; fn["outer" + v] = function (margins) { return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); }; }); function registerEvent(node, eventName, callback) { var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); eventCache[eventName] = eventCache[eventName] || []; eventCache[eventName].push(callback); node.addEventListener(eventName, callback); } function removeEvent(node, eventName, callback) { var events = getData(node, "_cashEvents"), eventCache = (events && events[eventName]), index; if (!eventCache) { return; } if (callback) { node.removeEventListener(eventName, callback); index = eventCache.indexOf(callback); if (index >= 0) { eventCache.splice(index, 1); } } else { each(eventCache, function (event) { node.removeEventListener(eventName, event); }); eventCache = []; } } fn.extend({ off: function (eventName, callback) { return this.each(function (v) { return removeEvent(v, eventName, callback); }); }, on: function (eventName, delegate, callback, runOnce) { // jshint ignore:line var originalCallback; if (!isString(eventName)) { for (var key in eventName) { this.on(key, delegate, eventName[key]); } return this; } if (isFunction(delegate)) { callback = delegate; delegate = null; } if (eventName === "ready") { onReady(callback); return this; } if (delegate) { originalCallback = callback; callback = function (e) { var t = e.target; while (!matches(t, delegate)) { if (t === this || t === null) { return (t = false); } t = t.parentNode; } if (t) { originalCallback.call(t, e); } }; } return this.each(function (v) { var finalCallback = callback; if (runOnce) { finalCallback = function () { callback.apply(this, arguments); removeEvent(v, eventName, finalCallback); }; } registerEvent(v, eventName, finalCallback); }); }, one: function (eventName, delegate, callback) { return this.on(eventName, delegate, callback, true); }, ready: onReady, trigger: function (eventName, data) { if (document.createEvent) { let evt = document.createEvent('HTMLEvents'); evt.initEvent(eventName, true, false); evt = this.extend(evt, data); return this.each(function (v) { return v.dispatchEvent(evt); }); } } }); function encode(name, value) { return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); } function getSelectMultiple_(el) { var values = []; each(el.options, function (o) { if (o.selected) { values.push(o.value); } }); return values.length ? values : null; } function getSelectSingle_(el) { var selectedIndex = el.selectedIndex; return selectedIndex >= 0 ? el.options[selectedIndex].value : null; } function getValue(el) { var type = el.type; if (!type) { return null; } switch (type.toLowerCase()) { case "select-one": return getSelectSingle_(el); case "select-multiple": return getSelectMultiple_(el); case "radio": return (el.checked) ? el.value : null; case "checkbox": return (el.checked) ? el.value : null; default: return el.value ? el.value : null; } } fn.extend({ serialize: function () { var query = ""; each(this[0].elements || this, function (el) { if (el.disabled || el.tagName === "FIELDSET") { return; } var name = el.name; switch (el.type.toLowerCase()) { case "file": case "reset": case "submit": case "button": break; case "select-multiple": var values = getValue(el); if (values !== null) { each(values, function (value) { query += encode(name, value); }); } break; default: var value = getValue(el); if (value !== null) { query += encode(name, value); } } }); return query.substr(1); }, val: function (value) { if (value === undefined) { return getValue(this[0]); } return this.each(function (v) { return v.value = value; }); } }); function insertElement(el, child, prepend) { if (prepend) { var first = el.childNodes[0]; el.insertBefore(child, first); } else { el.appendChild(child); } } function insertContent(parent, child, prepend) { var str = isString(child); if (!str && child.length) { each(child, function (v) { return insertContent(parent, v, prepend); }); return; } each(parent, str ? function (v) { return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); } : function (v, i) { return insertElement(v, (i === 0 ? child : child.cloneNode(true)), prepend); }); } fn.extend({ after: function (selector) { cash(selector).insertAfter(this); return this; }, append: function (content) { insertContent(this, content); return this; }, appendTo: function (parent) { insertContent(cash(parent), this); return this; }, before: function (selector) { cash(selector).insertBefore(this); return this; }, clone: function () { return cash(this.map(function (v) { return v.cloneNode(true); })); }, empty: function () { this.html(""); return this; }, html: function (content) { if (content === undefined) { return this[0].innerHTML; } var source = (content.nodeType ? content[0].outerHTML : content); return this.each(function (v) { return v.innerHTML = source; }); }, insertAfter: function (selector) { var _this = this; cash(selector).each(function (el, i) { var parent = el.parentNode, sibling = el.nextSibling; _this.each(function (v) { parent.insertBefore((i === 0 ? v : v.cloneNode(true)), sibling); }); }); return this; }, insertBefore: function (selector) { var _this2 = this; cash(selector).each(function (el, i) { var parent = el.parentNode; _this2.each(function (v) { parent.insertBefore((i === 0 ? v : v.cloneNode(true)), el); }); }); return this; }, prepend: function (content) { insertContent(this, content, true); return this; }, prependTo: function (parent) { insertContent(cash(parent), this, true); return this; }, remove: function () { return this.each(function (v) { if (!!v.parentNode) { return v.parentNode.removeChild(v); } }); }, text: function (content) { if (content === undefined) { return this[0].textContent; } return this.each(function (v) { return v.textContent = content; }); } }); var docEl = doc.documentElement; fn.extend({ position: function () { var el = this[0]; return { left: el.offsetLeft, top: el.offsetTop }; }, offset: function () { var rect = this[0].getBoundingClientRect(); return { top: rect.top + win.pageYOffset - docEl.clientTop, left: rect.left + win.pageXOffset - docEl.clientLeft }; }, offsetParent: function () { return cash(this[0].offsetParent); } }); fn.extend({ children: function (selector) { var elems = []; this.each(function (el) { push.apply(elems, el.children); }); elems = unique(elems); return (!selector ? elems : elems.filter(function (v) { return matches(v, selector); })); }, closest: function (selector) { if (!selector || this.length < 1) { return cash(); } if (this.is(selector)) { return this.filter(selector); } return this.parent().closest(selector); }, is: function (selector) { if (!selector) { return false; } var match = false, comparator = getCompareFunction(selector); this.each(function (el) { match = comparator(el, selector); return !match; }); return match; }, find: function (selector) { if (!selector || selector.nodeType) { return cash(selector && this.has(selector).length ? selector : null); } var elems = []; this.each(function (el) { push.apply(elems, find(selector, el)); }); return unique(elems); }, has: function (selector) { var comparator = (isString(selector) ? function (el) { return find(selector, el).length !== 0; } : function (el) { return el.contains(selector); }); return this.filter(comparator); }, next: function () { return cash(this[0].nextElementSibling); }, not: function (selector) { if (!selector) { return this; } var comparator = getCompareFunction(selector); return this.filter(function (el) { return !comparator(el, selector); }); }, parent: function () { var result = []; this.each(function (item) { if (item && item.parentNode) { result.push(item.parentNode); } }); return unique(result); }, parents: function (selector) { var last, result = []; this.each(function (item) { last = item; while (last && last.parentNode && last !== doc.body.parentNode) { last = last.parentNode; if (!selector || (selector && matches(last, selector))) { result.push(last); } } }); return unique(result); }, prev: function () { return cash(this[0].previousElementSibling); }, siblings: function (selector) { var collection = this.parent().children(selector), el = this[0]; return collection.filter(function (i) { return i !== el; }); } }); return cash; }); class Component { constructor(classDef, el, options) { // Display error if el is valid HTML Element if (!(el instanceof Element)) { console.error(Error(el + ' is not an HTML Element')); } // If exists, destroy and reinitialize in child let ins = classDef.getInstance(el); if (!!ins) { ins.destroy(); } this.el = el; this.$el = cash(el); } static init(classDef, els, options) { let instances = null; if (els instanceof Element) { instances = new classDef(els, options); } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { let instancesArr = []; for (let i = 0; i < els.length; i++) { instancesArr.push(new classDef(els[i], options)); } instances = instancesArr; } return instances; } } // Required for Meteor package, the use of window prevents export by Meteor (function(window) { if (window.Package) { M = {}; } else { window.M = {}; } // Check for jQuery M.jQueryLoaded = !!window.jQuery; })(window); // AMD if (typeof define === 'function' && define.amd) { define('M', [], function() { return M; }); // Common JS } else if (typeof exports !== 'undefined' && !exports.nodeType) { if (typeof module !== 'undefined' && !module.nodeType && module.exports) { exports = module.exports = M; } exports.default = M; } M.version = '1.0.0'; M.keys = { TAB: 9, ENTER: 13, ESC: 27, ARROW_UP: 38, ARROW_DOWN: 40 }; M.tabPressed = false; M.keyDown = false; let docHandleKeydown = function(e) { M.keyDown = true; if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { M.tabPressed = true; } }; let docHandleKeyup = function(e) { M.keyDown = false; if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) { M.tabPressed = false; } }; let docHandleFocus = function(e) { if (M.keyDown) { document.body.classList.add('keyboard-focused'); } }; let docHandleBlur = function(e) { document.body.classList.remove('keyboard-focused'); }; document.addEventListener('keydown', docHandleKeydown, true); document.addEventListener('keyup', docHandleKeyup, true); document.addEventListener('focus', docHandleFocus, true); document.addEventListener('blur', docHandleBlur, true); M.initializeJqueryWrapper = function(plugin, pluginName, classRef) { jQuery.fn[pluginName] = function(methodOrOptions) { // Call plugin method if valid method name is passed in if (plugin.prototype[methodOrOptions]) { let params = Array.prototype.slice.call(arguments, 1); // Getter methods if (methodOrOptions.slice(0, 3) === 'get') { let instance = this.first()[0][classRef]; return instance[methodOrOptions].apply(instance, params); } // Void methods return this.each(function() { let instance = this[classRef]; instance[methodOrOptions].apply(instance, params); }); // Initialize plugin if options or no argument is passed in } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { plugin.init(this, arguments[0]); return this; } // Return error if an unrecognized method name is passed in jQuery.error(`Method ${methodOrOptions} does not exist on jQuery.${pluginName}`); }; }; M.AutoInit = function(context) { // Use document.body if no context is given let root = !!context ? context : document.body; let registry = { // Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), // Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), // Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), // Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), // Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), // Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), // Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), // ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), // Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), // Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)') // Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)') // Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), // FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') }; for (let pluginName in registry) { let plugin = M[pluginName]; plugin.init(registry[pluginName]); } }; M.objectSelectorString = function(obj) { let tagStr = obj.prop('tagName') || ''; let idStr = obj.attr('id') || ''; let classStr = obj.attr('class') || ''; return (tagStr + idStr + classStr).replace(/\s/g, ''); }; // Unique Random ID M.guid = (function() { function s4() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } return function() { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }; })(); M.escapeHash = function(hash) { return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); }; M.elementOrParentIsFixed = function(element) { let $element = $(element); let $checkElements = $element.add($element.parents()); let isFixed = false; $checkElements.each(function() { if ($(this).css('position') === 'fixed') { isFixed = true; return false; } }); return isFixed; }; M.checkWithinContainer = function(container, bounding, offset) { let edges = { top: false, right: false, bottom: false, left: false }; let containerRect = container.getBoundingClientRect(); // If body element is smaller than viewport, use viewport height instead. let containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom; let scrollLeft = container.scrollLeft; let scrollTop = container.scrollTop; let scrolledX = bounding.left - scrollLeft; let scrolledY = bounding.top - scrollTop; // Check for container and viewport for each edge if (scrolledX < containerRect.left + offset || scrolledX < offset) { edges.left = true; } if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { edges.right = true; } if (scrolledY < containerRect.top + offset || scrolledY < offset) { edges.top = true; } if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { edges.bottom = true; } return edges; }; M.checkPossibleAlignments = function(el, container, bounding, offset) { let canAlign = { top: true, right: true, bottom: true, left: true, spaceOnTop: null, spaceOnRight: null, spaceOnBottom: null, spaceOnLeft: null }; let containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; let containerRect = container.getBoundingClientRect(); let containerHeight = Math.min(containerRect.height, window.innerHeight); let containerWidth = Math.min(containerRect.width, window.innerWidth); let elOffsetRect = el.getBoundingClientRect(); let scrollLeft = container.scrollLeft; let scrollTop = container.scrollTop; let scrolledX = bounding.left - scrollLeft; let scrolledYTopEdge = bounding.top - scrollTop; let scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; // Check for container and viewport for left canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); if (canAlign.spaceOnRight < 0) { canAlign.left = false; } // Check for container and viewport for Right canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; if (canAlign.spaceOnLeft < 0) { canAlign.right = false; } // Check for container and viewport for Top canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); if (canAlign.spaceOnBottom < 0) { canAlign.top = false; } // Check for container and viewport for Bottom canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); if (canAlign.spaceOnTop < 0) { canAlign.bottom = false; } return canAlign; }; M.getOverflowParent = function(element) { if (element == null) { return null; } if (element === document.body || getComputedStyle(element).overflow !== 'visible') { return element; } return M.getOverflowParent(element.parentElement); }; M.getIdFromTrigger = function(trigger) { let id = trigger.getAttribute('data-target'); if (!id) { id = trigger.getAttribute('href'); if (id) { id = id.slice(1); } else { id = ''; } } return id; }; M.getDocumentScrollTop = function() { return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; }; M.getDocumentScrollLeft = function() { return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; }; let getTime = Date.now || function() { return new Date().getTime(); }; M.throttle = function(func, wait, options) { let context, args, result; let timeout = null; let previous = 0; options || (options = {}); let later = function() { previous = options.leading === false ? 0 : getTime(); timeout = null; result = func.apply(context, args); context = args = null; }; return function() { let now = getTime(); if (!previous && options.leading === false) previous = now; let remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(context, args); context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; }; var $jscomp = { scope: {} }; $jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function(e, r, p) { if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters."); e != Array.prototype && e != Object.prototype && (e[r] = p.value); }; $jscomp.getGlobal = function(e) { return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; }; $jscomp.global = $jscomp.getGlobal(this); $jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; $jscomp.initSymbol = function() { $jscomp.initSymbol = function() {}; $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); }; $jscomp.symbolCounter_ = 0; $jscomp.Symbol = function(e) { return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; }; $jscomp.initSymbolIterator = function() { $jscomp.initSymbol(); var e = $jscomp.global.Symbol.iterator; e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")); "function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { configurable: !0, writable: !0, value: function() { return $jscomp.arrayIterator(this); } }); $jscomp.initSymbolIterator = function() {}; }; $jscomp.arrayIterator = function(e) { var r = 0; return $jscomp.iteratorPrototype(function() { return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; }); }; $jscomp.iteratorPrototype = function(e) { $jscomp.initSymbolIterator(); e = { next: e }; e[$jscomp.global.Symbol.iterator] = function() { return this; }; return e; }; $jscomp.array = $jscomp.array || {}; $jscomp.iteratorFromArray = function(e, r) { $jscomp.initSymbolIterator(); e instanceof String && (e += ""); var p = 0, m = { next: function() { if (p < e.length) { var u = p++; return { value: r(u, e[u]), done: !1 }; } m.next = function() { return { done: !0, value: void 0 }; }; return m.next(); } }; m[Symbol.iterator] = function() { return m; }; return m; }; $jscomp.polyfill = function(e, r, p, m) { if (r) { p = $jscomp.global; e = e.split("."); for (m = 0; m < e.length - 1; m++) { var u = e[m]; u in p || (p[u] = {}); p = p[u]; } e = e[e.length - 1]; m = p[e]; r = r(m); r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); } }; $jscomp.polyfill("Array.prototype.keys", function(e) { return e ? e : function() { return $jscomp.iteratorFromArray(this, function(e) { return e; }); }; }, "es6-impl", "es3"); var $jscomp$this = this; (function(r) { M.anime = r(); })(function() { function e(a) { if (!h.col(a)) try { return document.querySelectorAll(a); } catch (c) {} } function r(a, c) { for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) if (n in a) { var k = a[n]; c.call(b, k, n, a) && f.push(k); } return f; } function p(a) { return a.reduce(function(a, d) { return a.concat(h.arr(d) ? p(d) : d); }, []); } function m(a) { if (h.arr(a)) return a; h.str(a) && (a = e(a) || a); return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [ a ]; } function u(a, c) { return a.some(function(a) { return a === c; }); } function C(a) { var c = {}, d; for (d in a) c[d] = a[d]; return c; } function D(a, c) { var d = C(a), b; for (b in a) d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; return d; } function z(a, c) { var d = C(a), b; for (b in c) d[b] = h.und(a[b]) ? c[b] : a[b]; return d; } function T(a) { a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function(a, c, d, k) { return c + c + d + d + k + k; }); var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); a = parseInt(c[1], 16); var d = parseInt(c[2], 16), c = parseInt(c[3], 16); return "rgba(" + a + "," + d + "," + c + ",1)"; } function U(a) { function c(a, c, b) { 0 > b && (b += 1); 1 < b && --b; return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; } var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a); a = parseInt(d[1]) / 360; var b = parseInt(d[2]) / 100, f = parseInt(d[3]) / 100, d = d[4] || 1; if (0 == b) f = b = a = f; else { var n = .5 > f ? f * (1 + b) : f + b - f * b, k = 2 * f - n, f = c(k, n, a + 1 / 3), b = c(k, n, a); a = c(k, n, a - 1 / 3); } return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; } function y(a) { if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; } function V(a) { if (-1 < a.indexOf("translate") || "perspective" === a) return "px"; if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; } function I(a, c) { return h.fnc(a) ? a(c.target, c.id, c.total) : a; } function E(a, c) { if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; } function J(a, c) { if (h.dom(a) && u(W, c)) return "transform"; if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute"; if (h.dom(a) && "transform" !== c && E(a, c)) return "css"; if (null != a[c]) return "object"; } function X(a, c) { var d = V(c), d = -1 < c.indexOf("scale") ? 1 : 0 + d; a = a.style.transform; if (!a) return d; for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a); ) f.push(b[1]), n.push(b[2]); a = r(n, function(a, b) { return f[b] === c; }); return a.length ? a[0] : d; } function K(a, c) { switch (J(a, c)) { case "transform": return X(a, c); case "css": return E(a, c); case "attribute": return a.getAttribute(c); } return a[c] || 0; } function L(a, c) { var d = /^(\*=|\+=|-=)/.exec(a); if (!d) return a; var b = y(a) || 0; c = parseFloat(c); a = parseFloat(a.replace(d[0], "")); switch (d[0][0]) { case "+": return c + a + b; case "-": return c - a + b; case "*": return c * a + b; } } function F(a, c) { return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); } function M(a) { a = a.points; for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { var f = a.getItem(b); 0 < b && (c += F(d, f)); d = f; } return c; } function N(a) { if (a.getTotalLength) return a.getTotalLength(); switch (a.tagName.toLowerCase()) { case "circle": return 2 * Math.PI * a.getAttribute("r"); case "rect": return 2 * a.getAttribute("width") + 2 * a.getAttribute("height"); case "line": return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") }); case "polyline": return M(a); case "polygon": var c = a.points; return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0)); } } function Y(a, c) { function d(b) { b = void 0 === b ? 0 : b; return a.el.getPointAtLength(1 <= c + b ? c + b : 0); } var b = d(), f = d(-1), n = d(1); switch (a.property) { case "x": return b.x; case "y": return b.y; case "angle": return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI; } } function O(a, c) { var d = /-?\d*\.?\d+/g, b; b = h.pth(a) ? a.totalLength : a; if (h.col(b)) if (h.rgb(b)) { var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b); b = f ? "rgba(" + f[1] + ",1)" : b; } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f; b += ""; return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [ 0 ], strings: h.str(a) || c ? b.split(d) : [] }; } function P(a) { a = a ? p(h.arr(a) ? a.map(m) : m(a)) : []; return r(a, function(a, d, b) { return b.indexOf(a) === d; }); } function Z(a) { var c = P(a); return c.map(function(a, b) { return { target: a, id: b, total: c.length }; }); } function aa(a, c) { var d = C(c); if (h.arr(a)) { var b = a.length; 2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; } return m(a).map(function(a, b) { b = b ? 0 : c.delay; a = h.obj(a) && !h.pth(a) ? a : { value: a }; h.und(a.delay) && (a.delay = b); return a; }).map(function(a) { return z(a, d); }); } function ba(a, c) { var d = {}, b; for (b in a) { var f = I(a[b], c); h.arr(f) && (f = f.map(function(a) { return I(a, c); }), 1 === f.length && (f = f[0])); d[b] = f; } d.duration = parseFloat(d.duration); d.delay = parseFloat(d.delay); return d; } function ca(a) { return h.arr(a) ? A.apply(this, a) : Q[a]; } function da(a, c) { var d; return a.tweens.map(function(b) { b = ba(b, c); var f = b.value, e = K(c.target, a.name), k = d ? d.to.original : e, k = h.arr(f) ? f[0] : k, w = L(h.arr(f) ? f[1] : f, k), e = y(w) || y(k) || y(e); b.from = O(k, e); b.to = O(w, e); b.start = d ? d.end : a.offset; b.end = b.start + b.delay + b.duration; b.easing = ca(b.easing); b.elasticity = (1e3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1e3; b.isPath = h.pth(f); b.isColor = h.col(b.from.original); b.isColor && (b.round = 1); return d = b; }); } function ea(a, c) { return r(p(a.map(function(a) { return c.map(function(b) { var c = J(a.target, b.name); if (c) { var d = da(b, a); b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; } else b = void 0; return b; }); })), function(a) { return !h.und(a); }); } function R(a, c, d, b) { var f = "delay" === a; return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function(b) { return b[a]; })) : f ? b.delay : d.offset + b.delay + b.duration; } function fa(a) { var c = D(ga, a), d = D(S, a), b = Z(a.targets), f = [], e = z(c, d), k; for (k in a) e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); a = ea(b, f); return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); } function q(a) { function c() { return window.Promise && new Promise(function(a) { return p = a; }); } function d(a) { return g.reversed ? g.duration - a : a; } function b(a) { for (var b = 0, c = {}, d = g.animations, f = d.length; b < f; ) { var e = d[b], k = e.animatable, h = e.tweens, n = h.length - 1, l = h[n]; n && (l = r(h, function(b) { return a < b.end; })[0] || l); for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { var x = void 0, x = l.to.numbers[t], q = l.from.numbers[t], x = l.isPath ? Y(l.value, w * x) : q + w * (x - q); p && (l.isColor && 2 < t || (x = Math.round(x * p) / p)); n.push(x); } if (l = h.length) for (m = h[0], w = 0; w < l; w++) p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " ")); else m = n[0]; ha[e.type](k.target, e.property, m, c, k.id); e.currentValue = m; b++; } if (b = Object.keys(c).length) for (d = 0; d < b; d++) H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" "); g.currentTime = a; g.progress = a / g.duration * 100; } function f(a) { if (g[a]) g[a](g); } function e() { g.remaining && !0 !== g.remaining && g.remaining--; } function k(a) { var k = g.duration, n = g.offset, w = n + g.delay, r = g.currentTime, x = g.reversed, q = d(a); if (g.children.length) { var u = g.children, v = u.length; if (q >= g.currentTime) for (var G = 0; G < v; G++) u[G].seek(q); else for (;v--; ) u[v].seek(q); } if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run"); if (q > n && q < k) b(q); else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e(); f("update"); a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0); } a = void 0 === a ? {} : a; var h, t, l = 0, p = null, m = c(), g = fa(a); g.reset = function() { var a = g.direction, c = g.loop; g.currentTime = 0; g.progress = 0; g.paused = !0; g.began = !1; g.completed = !1; g.reversed = "reverse" === a; g.remaining = "alternate" === a && 1 === c ? 2 : c; b(0); for (a = g.children.length; a--; ) g.children[a].reset(); }; g.tick = function(a) { h = a; t || (t = h); k((l + h - t) * q.speed); }; g.seek = function(a) { k(d(a)); }; g.pause = function() { var a = v.indexOf(g); -1 < a && v.splice(a, 1); g.paused = !0; }; g.play = function() { g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); }; g.reverse = function() { g.reversed = !g.reversed; t = 0; l = d(g.currentTime); }; g.restart = function() { g.pause(); g.reset(); g.play(); }; g.finished = m; g.reset(); g.autoplay && g.play(); return g; } var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 }, S = { duration: 1e3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 }, W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), H, h = { arr: function(a) { return Array.isArray(a); }, obj: function(a) { return -1 < Object.prototype.toString.call(a).indexOf("Object"); }, pth: function(a) { return h.obj(a) && a.hasOwnProperty("totalLength"); }, svg: function(a) { return a instanceof SVGElement; }, dom: function(a) { return a.nodeType || h.svg(a); }, str: function(a) { return "string" === typeof a; }, fnc: function(a) { return "function" === typeof a; }, und: function(a) { return "undefined" === typeof a; }, hex: function(a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); }, rgb: function(a) { return /^rgb/.test(a); }, hsl: function(a) { return /^hsl/.test(a); }, col: function(a) { return h.hex(a) || h.rgb(a) || h.hsl(a); } }, A = function() { function a(a, d, b) { return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; } return function(c, d, b, f) { if (0 <= c && 1 >= c && 0 <= b && 1 >= b) { var e = new Float32Array(11); if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) e[k] = a(.1 * k, c, b); return function(k) { if (c === d && b === f) return k; if (0 === k) return 0; if (1 === k) return 1; for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) h += .1; --l; var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1, n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c; if (.001 <= n) { for (h = 0; 4 > h; ++h) { n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c; if (0 === n) break; var m = a(l, c, b) - k, l = l - m / n; } k = l; } else if (0 === n) k = l; else { var l = h, h = h + .1, g = 0; do { m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m; } while (1e-7 < Math.abs(n) && 10 > ++g); k = m; } return a(k, d, f); }; } }; }(), Q = function() { function a(a, b) { return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); } var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), d = { In: [ [ .55, .085, .68, .53 ], [ .55, .055, .675, .19 ], [ .895, .03, .685, .22 ], [ .755, .05, .855, .06 ], [ .47, 0, .745, .715 ], [ .95, .05, .795, .035 ], [ .6, .04, .98, .335 ], [ .6, -.28, .735, .045 ], a ], Out: [ [ .25, .46, .45, .94 ], [ .215, .61, .355, 1 ], [ .165, .84, .44, 1 ], [ .23, 1, .32, 1 ], [ .39, .575, .565, 1 ], [ .19, 1, .22, 1 ], [ .075, .82, .165, 1 ], [ .175, .885, .32, 1.275 ], function(b, c) { return 1 - a(1 - b, c); } ], InOut: [ [ .455, .03, .515, .955 ], [ .645, .045, .355, 1 ], [ .77, 0, .175, 1 ], [ .86, 0, .07, 1 ], [ .445, .05, .55, .95 ], [ 1, 0, 0, 1 ], [ .785, .135, .15, .86 ], [ .68, -.55, .265, 1.55 ], function(b, c) { return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; } ] }, b = { linear: A(.25, .25, .75, .75) }, f = {}, e; for (e in d) f.type = e, d[f.type].forEach(function(a) { return function(d, f) { b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); }; }(f)), f = { type: f.type }; return b; }(), ha = { css: function(a, c, d) { return a.style[c] = d; }, attribute: function(a, c, d) { return a.setAttribute(c, d); }, object: function(a, c, d) { return a[c] = d; }, transform: function(a, c, d, b, f) { b[f] || (b[f] = []); b[f].push(c + "(" + d + ")"); } }, v = [], B = 0, ia = function() { function a() { B = requestAnimationFrame(c); } function c(c) { var b = v.length; if (b) { for (var d = 0; d < b; ) v[d] && v[d].tick(c), d++; a(); } else cancelAnimationFrame(B), B = 0; } return a; }(); q.version = "2.2.0"; q.speed = 1; q.running = v; q.remove = function(a) { a = P(a); for (var c = v.length; c--; ) for (var d = v[c], b = d.animations, f = b.length; f--; ) u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); }; q.getValue = K; q.path = function(a, c) { var d = h.str(a) ? e(a)[0] : a, b = c || 100; return function(a) { return { el: d, property: a, totalLength: N(d) * (b / 100) }; }; }; q.setDashoffset = function(a) { var c = N(a); a.setAttribute("stroke-dasharray", c); return c; }; q.bezier = A; q.easings = Q; q.timeline = function(a) { var c = q(a); c.pause(); c.duration = 0; c.add = function(d) { c.children.forEach(function(a) { a.began = !0; a.completed = !0; }); m(d).forEach(function(b) { var d = z(b, D(S, a || {})); d.targets = d.targets || a.targets; b = c.duration; var e = d.offset; d.autoplay = !1; d.direction = c.direction; d.offset = h.und(e) ? b : L(e, b); c.began = !0; c.completed = !0; c.seek(d.offset); d = q(d); d.began = !0; d.completed = !0; d.duration > b && (c.duration = d.duration); c.children.push(d); }); c.seek(0); c.reset(); c.autoplay && c.restart(); return c; }; return c; }; q.random = function(a, c) { return Math.floor(Math.random() * (c - a + 1)) + a; }; return q; }); (function($, anim) { 'use strict'; let _defaults = { accordion: true, onOpenStart: undefined, onOpenEnd: undefined, onCloseStart: undefined, onCloseEnd: undefined, inDuration: 300, outDuration: 300 }; class Collapsible extends Component { constructor(el, options) { super(Collapsible, el, options); this.el.M_Collapsible = this; this.options = $.extend({}, Collapsible.defaults, options); // Setup tab indices this.$headers = this.$el.children('li').children('.collapsible-header'); this.$headers.attr('tabindex', 0); this._setupEventHandlers(); // Open first active let $activeBodies = this.$el.children('li.active').children('.collapsible-body'); if (this.options.accordion) { // Handle Accordion $activeBodies.first().css('display', 'block'); } else { // Handle Expandables $activeBodies.css('display', 'block'); } } static get defaults() { return _defaults; } static init(els, options) { return super.init(this, els, options); } static getInstance(el) { let domElem = !!el.jquery ? el[0] : el; return domElem.M_Collapsible; } destroy() { this._removeEventHandlers(); this.el.M_Collapsible = undefined; } _setupEventHandlers() { this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); this.el.addEventListener('click', this._handleCollapsibleClickBound); this.$headers.each((header) => { header.addEventListener('keydown', this._handleCollapsibleKeydownBound); }); } _removeEventHandlers() { this.el.removeEventListener('click', this._handleCollapsibleClickBound); this.$headers.each((header) => { header.removeEventListener('keydown', this._handleCollapsibleKeydownBound); }); } _handleCollapsibleClick(e) { let $header = $(e.target).closest('.collapsible-header'); if (e.target && $header.length) { let $collapsible = $header.closest('.collapsible'); if ($collapsible[0] === this.el) { let $collapsibleLi = $header.closest('li'); let $collapsibleLis = $collapsible.children('li'); let isActive = $collapsibleLi[0].classList.contains('active'); let index = $collapsibleLis.index($collapsibleLi); if (isActive) { this.close(index); } else { this.open(index); } } } } _handleCollapsibleKeydown(e) { if (e.keyCode === 13) { this._handleCollapsibleClickBound(e); } } _animateIn(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length) { let $body = $collapsibleLi.children('.collapsible-body'); anim.remove($body[0]); $body.css({ display: 'block', overflow: 'hidden', height: 0, paddingTop: '', paddingBottom: '' }); let pTop = $body.css('padding-top'); let pBottom = $body.css('padding-bottom'); let finalHeight = $body[0].scrollHeight; $body.css({ paddingTop: 0, paddingBottom: 0 }); anim({ targets: $body[0], height: finalHeight, paddingTop: pTop, paddingBottom: pBottom, duration: this.options.inDuration, easing: 'easeInOutCubic', complete: (anim) => { $body.css({ overflow: '', paddingTop: '', paddingBottom: '', height: '' }); // onOpenEnd callback if (typeof this.options.onOpenEnd === 'function') { this.options.onOpenEnd.call(this, $collapsibleLi[0]); } } }); } } _animateOut(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length) { let $body = $collapsibleLi.children('.collapsible-body'); anim.remove($body[0]); $body.css('overflow', 'hidden'); anim({ targets: $body[0], height: 0, paddingTop: 0, paddingBottom: 0, duration: this.options.outDuration, easing: 'easeInOutCubic', complete: () => { $body.css({ height: '', overflow: '', padding: '', display: '' }); // onCloseEnd callback if (typeof this.options.onCloseEnd === 'function') { this.options.onCloseEnd.call(this, $collapsibleLi[0]); } } }); } } open(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { // onOpenStart callback if (typeof this.options.onOpenStart === 'function') { this.options.onOpenStart.call(this, $collapsibleLi[0]); } // Handle accordion behavior if (this.options.accordion) { let $collapsibleLis = this.$el.children('li'); let $activeLis = this.$el.children('li.active'); $activeLis.each((el) => { let index = $collapsibleLis.index($(el)); this.close(index); }); } // Animate in $collapsibleLi[0].classList.add('active'); this._animateIn(index); } } close(index) { let $collapsibleLi = this.$el.children('li').eq(index); if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { // onCloseStart callback if (typeof this.options.onCloseStart === 'function') { this.options.onCloseStart.call(this, $collapsibleLi[0]); } // Animate out $collapsibleLi[0].classList.remove('active'); this._animateOut(index); } } } M.Collapsible = Collapsible; if (M.jQueryLoaded) { M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); } })(cash, M.anime); (function($, anim) { 'use strict'; let _defaults = { alignment: 'left', autoFocus: true, constrainWidth: true, container: null, coverTrigger: true, closeOnClick: true, hover: false, inDuration: 150, outDuration: 250, onOpenStart: null, onOpenEnd: null, onCloseStart: null, onCloseEnd: null, onItemClick: null }; class Dropdown extends Component { constructor(el, options) { super(Dropdown, el, options); this.el.M_Dropdown = this; Dropdown._dropdowns.push(this); this.id = M.getIdFromTrigger(el); this.dropdownEl = document.getElementById(this.id); this.$dropdownEl = $(this.dropdownEl); this.options = $.extend({}, Dropdown.defaults, options); this.isOpen = false; this.isScrollable = false; this.isTouchMoving = false; this.focusedIndex = -1; this.filterQuery = []; // Move dropdown-content after dropdown-trigger if (!!this.options.container) { $(this.options.container).append(this.dropdownEl); } else { this.$el.after(this.dropdownEl); } this._makeDropdownFocusable(); this._resetFilterQueryBound = this._resetFilterQuery.bind(this); this._handleDocumentClickBound = this._handleDocumentClick.bind(this); this._handleDocumentTouchmoveBound = this._handleDocumentTouchmove.bind(this); this._handleDropdownClickBound = this._handleDropdownClick.bind(this); this._handleDropdownKeydownBound = this._handleDropdownKeydown.bind(this); this._handleTriggerKeydownBound = this._handleTriggerKeydown.bind(this); this._setupEventHandlers(); } static get defaults() { return _defaults; } static init(els, options) { return super.init(this, els, options); } static getInstance(el) { let domElem = !!el.jquery ? el[0] : el; return domElem.M_Dropdown; } destroy() { this._resetDropdownStyles(); this._removeEventHandlers(); Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); this.el.M_Dropdown = undefined; } _setupEventHandlers() { // Trigger keydown handler this.el.addEventListener('keydown', this._handleTriggerKeydownBound); // Item click handler this.dropdownEl.addEventListener('click', this._handleDropdownClickBound); // Hover event handlers if (this.options.hover) { this._handleMouseEnterBound = this._handleMouseEnter.bind(this); this.el.addEventListener('mouseenter', this._handleMouseEnterBound); this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); // Click event handlers } else { this._handleClickBound = this._handleClick.bind(this); this.el.addEventListener('click', this._handleClickBound); } } _removeEventHandlers() { this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound); if (this.options.hover) { this.el.removeEventListener('mouseenter', this._handleMouseEnterBound); this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound); this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound); } else { this.el.removeEventListener('click', this._handleClickBound); } } _setupTemporaryEventHandlers() { // Use capture phase event handler to prevent click document.body.addEventListener('click', this._handleDocumentClickBound, true); document.body.addEventListener('touchend', this._handleDocumentClickBound); document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); } _removeTemporaryEventHandlers() { // Use capture phase event handler to prevent click document.body.removeEventListener('click', this._handleDocumentClickBound, true); document.body.removeEventListener('touchend', this._handleDocumentClickBound); document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); } _handleClick(e) { e.preventDefault(); this.open(); } _handleMouseEnter() { this.open(); } _handleMouseLeave(e) { let toEl = e.toElement || e.relatedTarget; let leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; let leaveToActiveDropdownTrigger = false; let $closestTrigger = $(toEl).closest('.dropdown-trigger'); if ( $closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen ) { leaveToActiveDropdownTrigger = true; } // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { this.close(); } } _handleDocumentClick(e) { let $target = $(e.target); if ( this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving ) { // isTouchMoving to check if scrolling on mobile. setTimeout(() => { this.close(); }, 0); } else if ( $target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length ) { setTimeout(() => { this.close(); }, 0); } this.isTouchMoving = false; } _handleTriggerKeydown(e) { // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { e.preventDefault(); this.open(); } } _handleDocumentTouchmove(e) { let $target = $(e.target); if ($target.closest('.dropdown-content').length) { this.isTouchMoving = true; } } _handleDropdownClick(e) { // onItemClick callback if (typeof this.options.onItemClick === 'function') { let itemEl = $(e.target).closest('li')[0]; this.options.onItemClick.call(this, itemEl); } } _handleDropdownKeydown(e) { if (e.which === M.keys.TAB) { e.preventDefault(); this.close(); // Navigate down dropdown list } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) { e.preventDefault(); let direction = e.which === M.keys.ARROW_DOWN ? 1 : -1; let newFocusedIndex = this.focusedIndex; let foundNewIndex = false; do { newFocusedIndex = newFocusedIndex + direction; if ( !!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1 ) { foundNewIndex = true; break; } } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0); if (foundNewIndex) { this.focusedIndex = newFocusedIndex; this._focusFocusedItem(); } // ENTER selects choice on focused item } else if (e.which === M.keys.ENTER && this.isOpen) { // Search for and ` + '' ); } renderRow(days, isRTL, isRowSelected) { return ( '' + (isRTL ? days.reverse() : days).join('') + '' ); } renderTable(opts, data, randId) { return ( '
    ' + this.renderHead(opts) + this.renderBody(data) + '
    ' ); } renderHead(opts) { let i, arr = []; for (i = 0; i < 7; i++) { arr.push( `${this.renderDayName( opts, i, true )}` ); } return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; } renderBody(rows) { return '' + rows.join('') + ''; } renderTitle(instance, c, year, month, refYear, randId) { let i, j, arr, opts = this.options, isMinYear = year === opts.minYear, isMaxYear = year === opts.maxYear, html = '
    ', monthHtml, yearHtml, prev = true, next = true; for (arr = [], i = 0; i < 12; i++) { arr.push( '' ); } monthHtml = ''; if ($.isArray(opts.yearRange)) { i = opts.yearRange[0]; j = opts.yearRange[1] + 1; } else { i = year - opts.yearRange; j = 1 + year + opts.yearRange; } for (arr = []; i < j && i <= opts.maxYear; i++) { if (i >= opts.minYear) { arr.push(``); } } yearHtml = ``; let leftArrow = ''; html += ``; html += '
    '; if (opts.showMonthAfterYear) { html += yearHtml + monthHtml; } else { html += monthHtml + yearHtml; } html += '
    '; if (isMinYear && (month === 0 || opts.minMonth >= month)) { prev = false; } if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { next = false; } let rightArrow = ''; html += ``; return (html += '
    '); } draw(force) { if (!this.isOpen && !force) { return; } let opts = this.options, minYear = opts.minYear, maxYear = opts.maxYear, minMonth = opts.minMonth, maxMonth = opts.maxMonth, html = '', randId; if (this._y <= minYear) { this._y = minYear; if (!isNaN(minMonth) && this._m < minMonth) { this._m = minMonth; } } if (this._y >= maxYear) { this._y = maxYear; if (!isNaN(maxMonth) && this._m > maxMonth) { this._m = maxMonth; } } randId = 'datepicker-title-' + Math.random() .toString(36) .replace(/[^a-z]+/g, '') .substr(0, 2); for (let c = 0; c < 1; c++) { this._renderDateDisplay(); html += this.renderTitle( this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId ) + this.render(this.calendars[c].year, this.calendars[c].month, randId); } this.destroySelects(); this.calendarEl.innerHTML = html; // Init Materialize Select let yearSelect = this.calendarEl.querySelector('.orig-select-year'); let monthSelect = this.calendarEl.querySelector('.orig-select-month'); M.FormSelect.init(yearSelect, { classes: 'select-year', dropdownOptions: { container: document.body, constrainWidth: false } }); M.FormSelect.init(monthSelect, { classes: 'select-month', dropdownOptions: { container: document.body, constrainWidth: false } }); // Add change handlers for select yearSelect.addEventListener('change', this._handleYearChange.bind(this)); monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); if (typeof this.options.onDraw === 'function') { this.options.onDraw(this); } } _setupEventHandlers() { this._handleInputKeydownBound = this._handleInputKeydown.bind(this); this._handleInputClickBound = this._handleInputClick.bind(this); this._handleInputChangeBound = this._handleInputChange.bind(this); this._handleCalendarClickBound = this._handleCalendarClick.bind(this); this._finishSelectionBound = this._finishSelection.bind(this); this._handleMonthChange = this._handleMonthChange.bind(this); this._closeBound = this.close.bind(this); this.el.addEventListener('click', this._handleInputClickBound); this.el.addEventListener('keydown', this._handleInputKeydownBound); this.el.addEventListener('change', this._handleInputChangeBound); this.calendarEl.addEventListener('click', this._handleCalendarClickBound); this.doneBtn.addEventListener('click', this._finishSelectionBound); this.cancelBtn.addEventListener('click', this._closeBound); if (this.options.showClearBtn) { this._handleClearClickBound = this._handleClearClick.bind(this); this.clearBtn.addEventListener('click', this._handleClearClickBound); } } _setupVariables() { this.$modalEl = $(Datepicker._template); this.modalEl = this.$modalEl[0]; this.calendarEl = this.modalEl.querySelector('.datepicker-calendar'); this.yearTextEl = this.modalEl.querySelector('.year-text'); this.dateTextEl = this.modalEl.querySelector('.date-text'); if (this.options.showClearBtn) { this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); } this.doneBtn = this.modalEl.querySelector('.datepicker-done'); this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); this.formats = { d: () => { return this.date.getDate(); }, dd: () => { let d = this.date.getDate(); return (d < 10 ? '0' : '') + d; }, ddd: () => { return this.options.i18n.weekdaysShort[this.date.getDay()]; }, dddd: () => { return this.options.i18n.weekdays[this.date.getDay()]; }, m: () => { return this.date.getMonth() + 1; }, mm: () => { let m = this.date.getMonth() + 1; return (m < 10 ? '0' : '') + m; }, mmm: () => { return this.options.i18n.monthsShort[this.date.getMonth()]; }, mmmm: () => { return this.options.i18n.months[this.date.getMonth()]; }, yy: () => { return ('' + this.date.getFullYear()).slice(2); }, yyyy: () => { return this.date.getFullYear(); } }; } _removeEventHandlers() { this.el.removeEventListener('click', this._handleInputClickBound); this.el.removeEventListener('keydown', this._handleInputKeydownBound); this.el.removeEventListener('change', this._handleInputChangeBound); this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); } _handleInputClick() { this.open(); } _handleInputKeydown(e) { if (e.which === M.keys.ENTER) { e.preventDefault(); this.open(); } } _handleCalendarClick(e) { if (!this.isOpen) { return; } let $target = $(e.target); if (!$target.hasClass('is-disabled')) { if ( $target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled') ) { this.setDate( new Date( e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day') ) ); if (this.options.autoClose) { this._finishSelection(); } } else if ($target.closest('.month-prev').length) { this.prevMonth(); } else if ($target.closest('.month-next').length) { this.nextMonth(); } } } _handleClearClick() { this.date = null; this.setInputValue(); this.close(); } _handleMonthChange(e) { this.gotoMonth(e.target.value); } _handleYearChange(e) { this.gotoYear(e.target.value); } gotoMonth(month) { if (!isNaN(month)) { this.calendars[0].month = parseInt(month, 10); this.adjustCalendars(); } } gotoYear(year) { if (!isNaN(year)) { this.calendars[0].year = parseInt(year, 10); this.adjustCalendars(); } } _handleInputChange(e) { let date; // Prevent change event from being fired when triggered by the plugin if (e.firedBy === this) { return; } if (this.options.parse) { date = this.options.parse(this.el.value, this.options.format); } else { date = new Date(Date.parse(this.el.value)); } if (Datepicker._isDate(date)) { this.setDate(date); } } renderDayName(opts, day, abbr) { day += opts.firstDay; while (day >= 7) { day -= 7; } return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; } _finishSelection() { this.setInputValue(); this.close(); } open() { if (this.isOpen) { return; } this.isOpen = true; if (typeof this.options.onOpen === 'function') { this.options.onOpen.call(this); } this.draw(); this.modal.open(); return this; } close() { if (!this.isOpen) { return; } this.isOpen = false; if (typeof this.options.onClose === 'function') { this.options.onClose.call(this); } this.modal.close(); return this; } } Datepicker._template = [ '' ].join(''); M.Datepicker = Datepicker; if (M.jQueryLoaded) { M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); } })(cash); const materialDateI18n = { labelMonthNext: 'Next Month', labelMonthPrev: 'Last Month', labelMonthSelect: 'Select Month', labelYearSelect: 'Select Year', monthsFull: ['January', 'February', 'March', 'April', 'March', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Mar', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], weekdaysLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'], today: 'Today', clear: 'Clear', close: 'Close', format: 'dd/mm/yyyy' }; (function($) { 'use strict'; let _defaults = { dialRadius: 135, outerRadius: 105, innerRadius: 70, tickRadius: 20, duration: 350, container: null, defaultTime: 'now', // default time, 'now' or '13:14' e.g. fromNow: 0, // Millisecond offset from the defaultTime showClearBtn: false, // internationalization i18n: { cancel: 'Cancel', clear: 'Clear', done: 'Ok' }, autoClose: false, // auto close when minute is selected twelveHour: true, // change to 12 hour AM/PM clock from 24 hour vibrate: true, // vibrate the device when dragging clock hand // Callbacks onOpenStart: null, onOpenEnd: null, onCloseStart: null, onCloseEnd: null, onSelect: null }; class Timepicker extends Component { constructor(el, options) { super(Timepicker, el, options); this.el.M_Timepicker = this; this.options = $.extend({}, Timepicker.defaults, options); this.id = M.guid(); this._insertHTMLIntoDOM(); this._setupModal(); this._setupVariables(); this._setupEventHandlers(); this._clockSetup(); this._pickerSetup(); } static get defaults() { return _defaults; } static init(els, options) { return super.init(this, els, options); } static _addLeadingZero(num) { return (num < 10 ? '0' : '') + num; } static _createSVGEl(name) { let svgNS = 'http://www.w3.org/2000/svg'; return document.createElementNS(svgNS, name); } static _Pos(e) { if (e.targetTouches && e.targetTouches.length >= 1) { return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; } // mouse event return { x: e.clientX, y: e.clientY }; } static getInstance(el) { let domElem = !!el.jquery ? el[0] : el; return domElem.M_Timepicker; } destroy() { this._removeEventHandlers(); this.modal.destroy(); $(this.modalEl).remove(); this.el.M_Timepicker = undefined; } _setupEventHandlers() { this._handleInputKeydownBound = this._handleInputKeydown.bind(this); this._handleInputClickBound = this._handleInputClick.bind(this); this._handleClockClickStartBound = this._handleClockClickStart.bind(this); this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); this.el.addEventListener('click', this._handleInputClickBound); this.el.addEventListener('keydown', this._handleInputKeydownBound); this.plate.addEventListener('mousedown', this._handleClockClickStartBound); this.plate.addEventListener('touchstart', this._handleClockClickStartBound); $(this.spanHours).on('click', this.showView.bind(this, 'hours')); $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); } _removeEventHandlers() { this.el.removeEventListener('click', this._handleInputClickBound); this.el.removeEventListener('keydown', this._handleInputKeydownBound); } _handleInputClick() { this.open(); } _handleInputKeydown(e) { if (e.which === M.keys.ENTER) { e.preventDefault(); this.open(); } } _handleClockClickStart(e) { e.preventDefault(); let clockPlateBR = this.plate.getBoundingClientRect(); let offset = { x: clockPlateBR.left, y: clockPlateBR.top }; this.x0 = offset.x + this.options.dialRadius; this.y0 = offset.y + this.options.dialRadius; this.moved = false; let clickPos = Timepicker._Pos(e); this.dx = clickPos.x - this.x0; this.dy = clickPos.y - this.y0; // Set clock hands this.setHand(this.dx, this.dy, false); // Mousemove on document document.addEventListener('mousemove', this._handleDocumentClickMoveBound); document.addEventListener('touchmove', this._handleDocumentClickMoveBound); // Mouseup on document document.addEventListener('mouseup', this._handleDocumentClickEndBound); document.addEventListener('touchend', this._handleDocumentClickEndBound); } _handleDocumentClickMove(e) { e.preventDefault(); let clickPos = Timepicker._Pos(e); let x = clickPos.x - this.x0; let y = clickPos.y - this.y0; this.moved = true; this.setHand(x, y, false, true); } _handleDocumentClickEnd(e) { e.preventDefault(); document.removeEventListener('mouseup', this._handleDocumentClickEndBound); document.removeEventListener('touchend', this._handleDocumentClickEndBound); let clickPos = Timepicker._Pos(e); let x = clickPos.x - this.x0; let y = clickPos.y - this.y0; if (this.moved && x === this.dx && y === this.dy) { this.setHand(x, y); } if (this.currentView === 'hours') { this.showView('minutes', this.options.duration / 2); } else if (this.options.autoClose) { $(this.minutesView).addClass('timepicker-dial-out'); setTimeout(() => { this.done(); }, this.options.duration / 2); } if (typeof this.options.onSelect === 'function') { this.options.onSelect.call(this, this.hours, this.minutes); } // Unbind mousemove event document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); } _insertHTMLIntoDOM() { this.$modalEl = $(Timepicker._template); this.modalEl = this.$modalEl[0]; this.modalEl.id = 'modal-' + this.id; // Append popover to input by default let containerEl = document.querySelector(this.options.container); if (this.options.container && !!containerEl) { this.$modalEl.appendTo(containerEl); } else { this.$modalEl.insertBefore(this.el); } } _setupModal() { this.modal = M.Modal.init(this.modalEl, { onOpenStart: this.options.onOpenStart, onOpenEnd: this.options.onOpenEnd, onCloseStart: this.options.onCloseStart, onCloseEnd: () => { if (typeof this.options.onCloseEnd === 'function') { this.options.onCloseEnd.call(this); } this.isOpen = false; } }); } _setupVariables() { this.currentView = 'hours'; this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; this._canvas = this.modalEl.querySelector('.timepicker-canvas'); this.plate = this.modalEl.querySelector('.timepicker-plate'); this.hoursView = this.modalEl.querySelector('.timepicker-hours'); this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); this.footer = this.modalEl.querySelector('.timepicker-footer'); this.amOrPm = 'PM'; } _pickerSetup() { let $clearBtn = $( `` ) .appendTo(this.footer) .on('click', this.clear.bind(this)); if (this.options.showClearBtn) { $clearBtn.css({ visibility: '' }); } let confirmationBtnsContainer = $('
    '); $( '' ) .appendTo(confirmationBtnsContainer) .on('click', this.close.bind(this)); $( '' ) .appendTo(confirmationBtnsContainer) .on('click', this.done.bind(this)); confirmationBtnsContainer.appendTo(this.footer); } _clockSetup() { if (this.options.twelveHour) { this.$amBtn = $('
    AM
    '); this.$pmBtn = $('
    PM
    '); this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); } this._buildHoursView(); this._buildMinutesView(); this._buildSVGClock(); } _buildSVGClock() { // Draw clock hands and others let dialRadius = this.options.dialRadius; let tickRadius = this.options.tickRadius; let diameter = dialRadius * 2; let svg = Timepicker._createSVGEl('svg'); svg.setAttribute('class', 'timepicker-svg'); svg.setAttribute('width', diameter); svg.setAttribute('height', diameter); let g = Timepicker._createSVGEl('g'); g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); let bearing = Timepicker._createSVGEl('circle'); bearing.setAttribute('class', 'timepicker-canvas-bearing'); bearing.setAttribute('cx', 0); bearing.setAttribute('cy', 0); bearing.setAttribute('r', 4); let hand = Timepicker._createSVGEl('line'); hand.setAttribute('x1', 0); hand.setAttribute('y1', 0); let bg = Timepicker._createSVGEl('circle'); bg.setAttribute('class', 'timepicker-canvas-bg'); bg.setAttribute('r', tickRadius); g.appendChild(hand); g.appendChild(bg); g.appendChild(bearing); svg.appendChild(g); this._canvas.appendChild(svg); this.hand = hand; this.bg = bg; this.bearing = bearing; this.g = g; } _buildHoursView() { let $tick = $('
    '); // Hours view if (this.options.twelveHour) { for (let i = 1; i < 13; i += 1) { let tick = $tick.clone(); let radian = i / 6 * Math.PI; let radius = this.options.outerRadius; tick.css({ left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' }); tick.html(i === 0 ? '00' : i); this.hoursView.appendChild(tick[0]); // tick.on(mousedownEvent, mousedown); } } else { for (let i = 0; i < 24; i += 1) { let tick = $tick.clone(); let radian = i / 6 * Math.PI; let inner = i > 0 && i < 13; let radius = inner ? this.options.innerRadius : this.options.outerRadius; tick.css({ left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' }); tick.html(i === 0 ? '00' : i); this.hoursView.appendChild(tick[0]); // tick.on(mousedownEvent, mousedown); } } } _buildMinutesView() { let $tick = $('
    '); // Minutes view for (let i = 0; i < 60; i += 5) { let tick = $tick.clone(); let radian = i / 30 * Math.PI; tick.css({ left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px' }); tick.html(Timepicker._addLeadingZero(i)); this.minutesView.appendChild(tick[0]); } } _handleAmPmClick(e) { let $btnClicked = $(e.target); this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; this._updateAmPmView(); } _updateAmPmView() { if (this.options.twelveHour) { this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); } } _updateTimeFromInput() { // Get the time let value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { if (value[1].toUpperCase().indexOf('AM') > 0) { this.amOrPm = 'AM'; } else { this.amOrPm = 'PM'; } value[1] = value[1].replace('AM', '').replace('PM', ''); } if (value[0] === 'now') { let now = new Date(+new Date() + this.options.fromNow); value = [now.getHours(), now.getMinutes()]; if (this.options.twelveHour) { this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; } } this.hours = +value[0] || 0; this.minutes = +value[1] || 0; this.spanHours.innerHTML = this.hours; this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); this._updateAmPmView(); } showView(view, delay) { if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') { // raiseCallback(this.options.beforeHourSelect); } let isHours = view === 'hours', nextView = isHours ? this.hoursView : this.minutesView, hideView = isHours ? this.minutesView : this.hoursView; this.currentView = view; $(this.spanHours).toggleClass('text-primary', isHours); $(this.spanMinutes).toggleClass('text-primary', !isHours); // Transition view hideView.classList.add('timepicker-dial-out'); $(nextView) .css('visibility', 'visible') .removeClass('timepicker-dial-out'); // Reset clock hand this.resetClock(delay); // After transitions ended clearTimeout(this.toggleViewTimer); this.toggleViewTimer = setTimeout(() => { $(hideView).css('visibility', 'hidden'); }, this.options.duration); } resetClock(delay) { let view = this.currentView, value = this[view], isHours = view === 'hours', unit = Math.PI / (isHours ? 6 : 30), radian = value * unit, radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, x = Math.sin(radian) * radius, y = -Math.cos(radian) * radius, self = this; if (delay) { $(this.canvas).addClass('timepicker-canvas-out'); setTimeout(() => { $(self.canvas).removeClass('timepicker-canvas-out'); self.setHand(x, y); }, delay); } else { this.setHand(x, y); } } setHand(x, y, roundBy5) { let radian = Math.atan2(x, -y), isHours = this.currentView === 'hours', unit = Math.PI / (isHours || roundBy5 ? 6 : 30), z = Math.sqrt(x * x + y * y), inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, radius = inner ? this.options.innerRadius : this.options.outerRadius; if (this.options.twelveHour) { radius = this.options.outerRadius; } // Radian should in range [0, 2PI] if (radian < 0) { radian = Math.PI * 2 + radian; } // Get the round value let value = Math.round(radian / unit); // Get the round radian radian = value * unit; // Correct the hours or minutes if (this.options.twelveHour) { if (isHours) { if (value === 0) value = 12; } else { if (roundBy5) value *= 5; if (value === 60) value = 0; } } else { if (isHours) { if (value === 12) { value = 0; } value = inner ? (value === 0 ? 12 : value) : value === 0 ? 0 : value + 12; } else { if (roundBy5) { value *= 5; } if (value === 60) { value = 0; } } } // Once hours or minutes changed, vibrate the device if (this[this.currentView] !== value) { if (this.vibrate && this.options.vibrate) { // Do not vibrate too frequently if (!this.vibrateTimer) { navigator[this.vibrate](10); this.vibrateTimer = setTimeout(() => { this.vibrateTimer = null; }, 100); } } } this[this.currentView] = value; if (isHours) { this['spanHours'].innerHTML = value; } else { this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); } // Set clock hand and others' position let cx1 = Math.sin(radian) * (radius - this.options.tickRadius), cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), cx2 = Math.sin(radian) * radius, cy2 = -Math.cos(radian) * radius; this.hand.setAttribute('x2', cx1); this.hand.setAttribute('y2', cy1); this.bg.setAttribute('cx', cx2); this.bg.setAttribute('cy', cy2); } open() { if (this.isOpen) { return; } this.isOpen = true; this._updateTimeFromInput(); this.showView('hours'); this.modal.open(); } close() { if (!this.isOpen) { return; } this.isOpen = false; this.modal.close(); } done(e, clearValue) { // Set input value let last = this.el.value; let value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); this.time = value; if (!clearValue && this.options.twelveHour) { value = `${value} ${this.amOrPm}`; } this.el.value = value; // Trigger change event if (value !== last) { this.$el.trigger('change'); } this.close(); this.el.focus(); } clear() { this.done(null, true); } } Timepicker._template = [ '' ].join(''); M.Timepicker = Timepicker; if (M.jQueryLoaded) { M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); } })(cash); const materialTimeI18n = { cancel: 'Cancel', clear: 'Clear', done: 'Ok' }; !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return b(a,c)}):"object"==typeof exports?b(a,require("jquery")):b(a,a.jQuery||a.Zepto)}(this,function(a,b){"use strict";function c(a){if(w&&"none"===a.css("animation-name")&&"none"===a.css("-webkit-animation-name")&&"none"===a.css("-moz-animation-name")&&"none"===a.css("-o-animation-name")&&"none"===a.css("-ms-animation-name"))return 0;var b,c,d,e,f=a.css("animation-duration")||a.css("-webkit-animation-duration")||a.css("-moz-animation-duration")||a.css("-o-animation-duration")||a.css("-ms-animation-duration")||"0s",g=a.css("animation-delay")||a.css("-webkit-animation-delay")||a.css("-moz-animation-delay")||a.css("-o-animation-delay")||a.css("-ms-animation-delay")||"0s",h=a.css("animation-iteration-count")||a.css("-webkit-animation-iteration-count")||a.css("-moz-animation-iteration-count")||a.css("-o-animation-iteration-count")||a.css("-ms-animation-iteration-count")||"1";for(f=f.split(", "),g=g.split(", "),h=h.split(", "),e=0,c=f.length,b=Number.NEGATIVE_INFINITY;eb&&(b=d);return b}function d(){if(b(document).height()<=b(window).height())return 0;var a,c,d=document.createElement("div"),e=document.createElement("div");return d.style.visibility="hidden",d.style.width="100px",document.body.appendChild(d),a=d.offsetWidth,d.style.overflow="scroll",e.style.width="100%",d.appendChild(e),c=e.offsetWidth,d.parentNode.removeChild(d),a-c}function e(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)||(c=b(document.body),a=parseInt(c.css("padding-right"),10)+d(),c.css("padding-right",a+"px"),e.addClass(f))}}function f(){if(!x){var a,c,e=b("html"),f=k("is-locked");e.hasClass(f)&&(c=b(document.body),a=parseInt(c.css("padding-right"),10)-d(),c.css("padding-right",a+"px"),e.removeClass(f))}}function g(a,b,c,d){var e=k("is",b),f=[k("is",u.CLOSING),k("is",u.OPENING),k("is",u.CLOSED),k("is",u.OPENED)].join(" ");a.$bg.removeClass(f).addClass(e),a.$overlay.removeClass(f).addClass(e),a.$wrapper.removeClass(f).addClass(e),a.$modal.removeClass(f).addClass(e),a.state=b,!c&&a.$modal.trigger({type:b,reason:d},[{reason:d}])}function h(a,d,e){var f=0,g=function(a){a.target===this&&f++},h=function(a){a.target===this&&0===--f&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())};b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].on(r,g).on(s,h)}),a(),0===c(e.$bg)&&0===c(e.$overlay)&&0===c(e.$wrapper)&&0===c(e.$modal)&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(a,b){e[b].off(r+" "+s)}),d())}function i(a){a.state!==u.CLOSED&&(b.each(["$bg","$overlay","$wrapper","$modal"],function(b,c){a[c].off(r+" "+s)}),a.$bg.removeClass(a.settings.modifier),a.$overlay.removeClass(a.settings.modifier).hide(),a.$wrapper.hide(),f(),g(a,u.CLOSED,!0))}function j(a){var b,c,d,e,f={};for(a=a.replace(/\s*:\s*/g,":").replace(/\s*,\s*/g,","),b=a.split(","),e=0,c=b.length;e").addClass(k("overlay")+" "+k("is",u.CLOSED)).hide(),e.append(f.$overlay)),f.$bg=b("."+k("bg")).addClass(k("is",u.CLOSED)),f.$modal=a.addClass(q+" "+k("is-initialized")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).attr("tabindex","-1"),f.$wrapper=b("
    ").addClass(k("wrapper")+" "+f.settings.modifier+" "+k("is",u.CLOSED)).hide().append(f.$modal),e.append(f.$wrapper),f.$wrapper.on("click."+q,'[data-remodal-action="close"]',function(a){a.preventDefault(),f.close()}),f.$wrapper.on("click."+q,'[data-remodal-action="cancel"]',function(a){a.preventDefault(),f.$modal.trigger(v.CANCELLATION),f.settings.closeOnCancel&&f.close(v.CANCELLATION)}),f.$wrapper.on("click."+q,'[data-remodal-action="confirm"]',function(a){a.preventDefault(),f.$modal.trigger(v.CONFIRMATION),f.settings.closeOnConfirm&&f.close(v.CONFIRMATION)}),f.$wrapper.on("click."+q,function(a){var c=b(a.target);c.hasClass(k("wrapper"))&&f.settings.closeOnOutsideClick&&f.close()})}var n,o,p="remodal",q=a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.NAMESPACE||p,r=b.map(["animationstart","webkitAnimationStart","MSAnimationStart","oAnimationStart"],function(a){return a+"."+q}).join(" "),s=b.map(["animationend","webkitAnimationEnd","MSAnimationEnd","oAnimationEnd"],function(a){return a+"."+q}).join(" "),t=b.extend({hashTracking:!0,closeOnConfirm:!0,closeOnCancel:!0,closeOnEscape:!0,closeOnOutsideClick:!0,modifier:"",appendTo:null},a.REMODAL_GLOBALS&&a.REMODAL_GLOBALS.DEFAULTS),u={CLOSING:"closing",CLOSED:"closed",OPENING:"opening",OPENED:"opened"},v={CONFIRMATION:"confirmation",CANCELLATION:"cancellation"},w=function(){var a=document.createElement("div").style;return void 0!==a.animationName||void 0!==a.WebkitAnimationName||void 0!==a.MozAnimationName||void 0!==a.msAnimationName||void 0!==a.OAnimationName}(),x=/iPad|iPhone|iPod/.test(navigator.platform);m.prototype.open=function(){var a,c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&(a=c.$modal.attr("data-remodal-id"),a&&c.settings.hashTracking&&(o=b(window).scrollTop(),location.hash=a),n&&n!==c&&i(n),n=c,e(),c.$bg.addClass(c.settings.modifier),c.$overlay.addClass(c.settings.modifier).show(),c.$wrapper.show().scrollTop(0),c.$modal.focus(),h(function(){g(c,u.OPENING)},function(){g(c,u.OPENED)},c))},m.prototype.close=function(a){var c=this;c.state!==u.OPENING&&c.state!==u.CLOSING&&c.state!==u.CLOSED&&(c.settings.hashTracking&&c.$modal.attr("data-remodal-id")===location.hash.substr(1)&&(location.hash="",b(window).scrollTop(o)),h(function(){g(c,u.CLOSING,!1,a)},function(){c.$bg.removeClass(c.settings.modifier),c.$overlay.removeClass(c.settings.modifier).hide(),c.$wrapper.hide(),f(),g(c,u.CLOSED,!1,a)},c))},m.prototype.getState=function(){return this.state},m.prototype.destroy=function(){var a,c=b[p].lookup;i(this),this.$wrapper.remove(),delete c[this.index],a=b.grep(c,function(a){return!!a}).length,0===a&&(this.$overlay.remove(),this.$bg.removeClass(k("is",u.CLOSING)+" "+k("is",u.OPENING)+" "+k("is",u.CLOSED)+" "+k("is",u.OPENED)))},b[p]={lookup:[]},b.fn[p]=function(a){var c,d;return this.each(function(e,f){d=b(f),null==d.data(p)?(c=new m(d,a),d.data(p,c.index),c.settings.hashTracking&&d.attr("data-remodal-id")===location.hash.substr(1)&&c.open()):c=b[p].lookup[d.data(p)]}),c},b(document).ready(function(){b(document).on("click","[data-remodal-target]",function(a){a.preventDefault();var c=a.currentTarget,d=c.getAttribute("data-remodal-target"),e=b('[data-remodal-id="'+d+'"]');b[p].lookup[e.data(p)].open()}),b(document).find("."+q).each(function(a,c){var d=b(c),e=d.data("remodal-options");e?("string"==typeof e||e instanceof String)&&(e=j(e)):e={},d[p](e)}),b(document).on("keydown."+q,function(a){n&&n.settings.closeOnEscape&&n.state===u.OPENED&&27===a.keyCode&&n.close()}),b(window).on("hashchange."+q,l)})}); !function(a){a.fn.niceCheck=function(c){var e=a.extend({checkClassName:"check"},c),n=a("").addClass(e.checkClassName);a(this).find('input[type="checkbox"], input[type="radio"]').not('[class*="lc-"]').each(function(){n=a("").addClass(e.checkClassName),a('label[for="'+a(this).attr("id")+'"]').append(n)})}}(jQuery); !function(s,e,a){"use strict";var t=a.PassField=a.PassField||{};t.Config=t.Config||{},t.Config.locales={en:{lower:!0,msg:{pass:"password",and:"and",showPass:"Show password",hidePass:"Hide password",genPass:"Random password",passTooShort:"password is too short (min. length: {})",noCharType:"password must contain {}",digits:"digits",letters:"letters",letters_up:"letters in UPPER case",symbols:"symbols",inBlackList:"password is in list of top used passwords",passRequired:"password is required",equalTo:"password is equal to login",repeat:"password consists of repeating characters",badChars:"password contains bad characters: “{}”",weakWarn:"weak",invalidPassWarn:"*",weakTitle:"This password is weak",generateMsg:"To generate a strong password, click {} button."}},de:{lower:!1,msg:{pass:"Passwort",and:"und",showPass:"Passwort anzeigen",hidePass:"Passwort verbergen",genPass:"Zufallspasswort",passTooShort:"Passwort ist zu kurz (Mindestlänge: {})",noCharType:"Passwort muss {} enthalten",digits:"Ziffern",letters:"Buchstaben",letters_up:"Buchstaben in GROSSSCHRIFT",symbols:"Symbole",inBlackList:"Passwort steht auf der Liste der beliebtesten Passwörter",passRequired:"Passwort wird benötigt",equalTo:"Passwort ist wie Anmeldung",repeat:"Passwort besteht aus sich wiederholenden Zeichen",badChars:"Passwort enthält ungültige Zeichen: “{}”",weakWarn:"Schwach",invalidPassWarn:"*",weakTitle:"Dieses Passwort ist schwach",generateMsg:"Klicken Sie auf den {}-Button, um ein starkes Passwort zu generieren."}},fr:{lower:!0,msg:{pass:"mot de passe",and:"et",showPass:"Montrer le mot de passe",hidePass:"Cacher le mot de passe",genPass:"Mot de passe aléatoire",passTooShort:"le mot de passe est trop court (min. longueur: {})",noCharType:"le mot de passe doit contenir des {}",digits:"chiffres",letters:"lettres",letters_up:"lettres en MAJUSCULES",symbols:"symboles",inBlackList:"le mot de passe est dans la liste des plus utilisés",passRequired:"le mot de passe est requis",equalTo:"le mot de passe est le même que l'identifiant",repeat:"le mot de passe est une répétition de caractères",badChars:"le mot de passe contient des caractères incorrects: “{}”",weakWarn:"faible",invalidPassWarn:"*",weakTitle:"Ce mot de passe est faible",generateMsg:"Pour créer un mot de passe fort cliquez sur le bouton {}."}},it:{lower:!1,msg:{pass:"password",and:"e",showPass:"Mostra password",hidePass:"Nascondi password",genPass:"Password casuale",passTooShort:"la password è troppo breve (lunghezza min.: {})",noCharType:"la password deve contenere {}",digits:"numeri",letters:"lettere",letters_up:"lettere in MAIUSCOLO",symbols:"simboli",inBlackList:"la password è nella lista delle password più usate",passRequired:"è necessaria una password",equalTo:"la password è uguale al login",repeat:"la password è composta da caratteri che si ripetono",badChars:"la password contiene caratteri non accettati: “{}”",weakWarn:"debole",invalidPassWarn:"*",weakTitle:"Questa password è debole",generateMsg:"Per generare una password forte, clicca sul tasto {}."}},ru:{lower:!0,msg:{pass:"пароль",and:"и",showPass:"Показать пароль",hidePass:"Скрыть пароль",genPass:"Случайный пароль",passTooShort:"пароль слишком короткий (мин. длина: {})",noCharType:"в пароле должны быть {}",digits:"цифры",letters:"буквы",letters_up:"буквы в ВЕРХНЕМ регистре",symbols:"символы",inBlackList:"этот пароль часто используется в Интернете",passRequired:"пароль обязателен",equalTo:"пароль совпадает с логином",repeat:"пароль состоит из повторяющихся символов",badChars:"в пароле есть недопустимые символы: «{}»",weakWarn:"слабый",invalidPassWarn:"*",weakTitle:"Пароль слабый, его легко взломать",generateMsg:"Чтобы сгенерировать пароль, нажмите кнопку {}."}},ua:{lower:!0,msg:{pass:"пароль",and:"i",showPass:"Показати пароль",hidePass:"Сховати пароль",genPass:"Випадковий пароль",passTooShort:"пароль є занадто коротким (мiн. довжина: {})",noCharType:"пароль повинен містити {}",digits:"цифри",letters:"букви",letters_up:"букви у ВЕРХНЬОМУ регістрі",symbols:"cимволи",inBlackList:"пароль входить до списку паролей, що використовуються найчастіше",passRequired:"пароль є обов'язковим",equalTo:"пароль та логін однакові",repeat:"пароль містить повторювані символи",badChars:"пароль містить неприпустимі символи: «{}»",weakWarn:"слабкий",invalidPassWarn:"*",weakTitle:"Цей пароль є слабким",generateMsg:"Щоб ​​створити надійний пароль, натисніть кнопку {}."}},es:{lower:!0,msg:{pass:"contraseña",and:"y",showPass:"Mostrar contraseña",hidePass:"Ocultar contraseña",genPass:"Contraseña aleatoria",passTooShort:"contraseña demasiado corta (longitud mín.: {})",noCharType:"la contraseña debe contener {}",digits:"dígitos",letters:"letras",letters_up:"letras en MAYÚSCULAS",symbols:"símbolos",inBlackList:"la contraseña está en la lista de las contraseñas más usadas",passRequired:"se requiere contraseña",equalTo:"la contraseña es igual al inicio de sesión",repeat:"la contraseña tiene caracteres repetidos",badChars:"la contraseña contiene caracteres no permitidos: “{}”",weakWarn:"débil",invalidPassWarn:"*",weakTitle:"Esta contraseña es débil",generateMsg:"Para generar una contraseña segura, haga clic en el botón de {}."}},el:{lower:!0,msg:{pass:"πρόσβασης",and:"και",showPass:"Προβολή κωδικού πρόσβασης",hidePass:"Απόκρυψη κωδικού πρόσβασης",genPass:"Τυχαίος κωδικός πρόσβασης",passTooShort:"ο κωδικός πρόσβασης είναι πολύ μικρός (ελάχιστο μήκος: {})",noCharType:"ο κωδικός πρόσβασης πρέπει να περιέχει {}",digits:"ψηφία",letters:"λατινικά γράμματα",letters_up:"λατινικά γράμματα με ΚΕΦΑΛΑΙΑ",symbols:"σύμβολα",inBlackList:"ο κωδικός πρόσβασης βρίσκεται σε κατάλογο δημοφιλέστερων κωδικών",passRequired:"απαιτείται κωδικός πρόσβασης",equalTo:"ο κωδικός είναι όμοιος με το όνομα χρήστη",repeat:"ο κωδικός αποτελείται από επαναλαμβανόμενους χαρακτήρες",badChars:"ο κωδικός περιέχει μη επιτρεπτούς χαρακτήρες: “{}”",weakWarn:"αδύναμος",invalidPassWarn:"*",weakTitle:"Αυτός ο κωδικός πρόσβασης είναι αδύναμος",generateMsg:"Για να δημιουργήσετε δυνατό κωδικό πρόσβασης, κάντε κλικ στο κουμπί {}."}},pt:{lower:!0,msg:{pass:"senha",and:"e",showPass:"Mostrar senha",hidePass:"Ocultar senha",genPass:"Senha aleatória",passTooShort:"senha muito curta (tamanho mínimo: {})",noCharType:"Senha deve conter {}",digits:"dígito",letters:"letras",letters_up:"letras maiúsculas",symbols:"símbolos",inBlackList:"senha está na lista das senhas mais usadas",passRequired:"senha é obrigatória",equalTo:"senha igual ao login",repeat:"senha consiste em uma repetição de caracteres",badChars:"senha tem caracteres inválidos: “{}”",weakWarn:"fraca",invalidPassWarn:"*",weakTitle:"Esta senha é fraca",generateMsg:"Para gerar uma senha forte, clique no botão {}."}}}}(window.jQuery,document,window); // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. (function($, document, window, undefined) { "use strict"; // ========================== definitions ========================== var PassField = window.PassField = window.PassField || {}; PassField.CharTypes = { DIGIT: "digits", LETTER: "letters", LETTER_UP: "letters_up", SYMBOL: "symbols", UNKNOWN: "unknown" }; PassField.CheckModes = { MODERATE: 0, STRICT: 1 }; // ========================== defaults ========================== PassField.Config = { defaults: { pattern: "abcdef12", // pattern for password (for strength calculation) acceptRate: 0.8, // threshold (of strength conformity with pattern) under which the password is considered weak allowEmpty: true, // allow empty password (will show validation errors if not) isMasked: true, // is the password masked by default showToggle: true, // show toggle password masking button showGenerate: true, // show generation button showWarn: true, // show short password validation warning showTip: true, // show password validation tooltips tipPopoverStyle: {}, // if tooltip is shown and Twitter Bootstrap is present, this style will be used. null = use own tips, {} = bootstrap tip options strengthCheckTimeout: 500, // timeout before automatic strength checking if no key is pressed (in ms; 0 = disable this feature) validationCallback: null, // function which will be called when password strength is validated blackList: [], // well-known bad passwords (very weak), e.g. qwerty or 12345 locale: "", // selected locale (null to auto-detect) localeMsg: {}, // overriden locale messages warnMsgClassName: "help-inline form-control-static", // class name added to the waring control (empty or null to disable the feature) errorWrapClassName: "error", // class name added to wrapping control when validation fails (empty or null to disable the feature) allowAnyChars: true, // suppress validation errors if password contains characters not from list (chars param) checkMode: PassField.CheckModes.MODERATE, // password checking mode (how the strength is calculated) chars: { // symbol sequences for generation and checking digits: "1234567890", letters: "abcdefghijklmnopqrstuvwxyzßабвгедёжзийклмнопрстуфхцчшщъыьэюяґєåäâáàãéèêëíìîїóòôõöüúùûýñçøåæþðαβγδεζηθικλμνξοπρσςτυφχψω", letters_up: "ABCDEFGHIJKLMNOPQRSTUVWXYZАБВГЕДЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯҐЄÅÄÂÁÀÃÉÈÊËÍÌÎЇÓÒÔÕÖÜÚÙÛÝÑÇØÅÆÞÐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ", symbols: "@#$%^&*()-_=+[]{};:<>/?!" }, events: { generated: null, switched: null }, nonMatchField: null, // login field (to compare password with - should not be equal) length: { // strict length checking rules min: null, max: null }, maskBtn : { textMasked : "abc", textUnmasked: "•••", className: false, classMasked: false, classUnmasked: false } }, locales: PassField.Config ? PassField.Config.locales : {}, // locales are defined in locales.js blackList: [ "password", "123456", "12345678", "abc123", "qwerty", "monkey", "letmein", "dragon", "111111", "baseball", "iloveyou", "trustno1", "1234567", "sunshine", "master", "123123", "welcome", "shadow", "ashley", "football", "jesus", "michael", "ninja", "mustang", "password1", "p@ssw0rd", "miss", "root", "secret" ], generationChars: { digits: "1234567890", letters: "abcdefghijklmnopqrstuvwxyz", letters_up: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, dataAttr: "PassField.Field" }; // ========================== initialization ========================== PassField.Field = function(el, opts) { var _conf = PassField.Config; var _dom = {}; var _opts = utils.extend({}, _conf.defaults, opts); var _isMasked = true; var _locale; var _id; var _validateTimer; var _blurTimer; var _blurMaskTimer; var _warningShown = false; var _validationResult = null; var _features; var _is_input_group = false; var _isInputHover = false; var _isInputFocused = false; var _passHidesGenBtn = false; var _passHidesMaskBtn = false; var _bootstrapPopoverShownText = false; var _tipHtml = null; var ELEMENTS_PREFIX = "a_pf-"; var JQUERY_EVENT_PREFIX = "pass:"; var BUTTONS_PADDING_RIGHT = 5; var KEY_DELETE = 46; var KEY_BACKSPACE = 8; var BOOTSTRAP_INPUT_GROUP_CLASS = "input-group"; // exports this.toggleMasking = function(isMasked) { toggleMasking(isMasked); }; this.setPass = setPass; this.validatePass = validatePassword; this.getPassValidationMessage = getPassValidationMessage; this.getPassStrength = getPassStrength; init.call(this); function init() { fixErrorsAndFillOptions(); if (!setMainEl()) return; setLocale(); defineId(); detectFeatures(); createNodes(); bindEvents(); toggleMasking(_opts.isMasked, false); doAutofocus(); assignDataObject(PassField.Config.dataAttr, this); } // ========================== logic ========================== function fixErrorsAndFillOptions() { _opts.blackList = (_opts.blackList || []).concat(PassField.Config.blackList); } function setMainEl() { if (typeof el == "string") { //noinspection JSValidateTypes el = document.getElementById(el); } _dom.mainInput = el; if(hasClass(el.parentNode, BOOTSTRAP_INPUT_GROUP_CLASS, true)) { _is_input_group = true; } return !!_dom.mainInput; } function setLocale() { var neutralLocale = "en"; var loc = _opts.locale; if (!loc && navigator.language) loc = navigator.language.replace(/\-.*/g, ""); if (loc) _locale = _conf.locales[loc]; if (_locale) _locale = utils.extend({}, _conf.locales[neutralLocale], _locale); if (!_locale) _locale = utils.extend({}, _conf.locales[neutralLocale]); if (_opts.localeMsg) utils.extend(_locale.msg, _opts.localeMsg); } function setPass(val) { _dom.mainInput.value = val; if (_dom.clearInput) { _dom.clearInput.value = val; } handleInputKeyup(); } function defineId() { _id = _dom.mainInput.id; if (!_id) { _id = ("i" + Math.round(Math.random() * 100000)); _dom.mainInput.id = _id; } } function createNodes() { var mainInputRect = getRect(_dom.mainInput); mainInputRect.top += cssFloat(_dom.mainInput, "marginTop"); setupWrapper(); setInputAttrs(); createClearInput(); createWarnLabel(); createMaskBtn(); createGenBtn(); createTip(mainInputRect); createFakePlaceholder(mainInputRect); createPassLengthChecker(); setTimeout(resizeControls, 0); } function setupWrapper() { _dom.wrapper = _dom.mainInput.parentNode; addClass(_dom.wrapper, "wrap"); if (!_features.hasInlineBlock) { addClass(_dom.wrapper, "wrap-no-ib"); } if (css(_dom.wrapper, "position") == "static") { _dom.wrapper.style.position = "relative"; } } function setInputAttrs() { if (_opts.length && _opts.length.max) _dom.mainInput.setAttribute("maxLength", _opts.length.max.toString()); } function createClearInput() { if (!_features.changeType) { // IE < 9 don't support input type changing _dom.clearInput = newEl("input", { type: "text", id: "txt-clear", className: "txt-clear", value: _dom.mainInput.value }, { display: "none" }); var cls = _dom.mainInput.className; if (cls) { addClass(_dom.clearInput, cls, true); } var inputStyle = _dom.mainInput.style.cssText; if (inputStyle) { _dom.clearInput.style.cssText = inputStyle; } utils.each(["maxLength", "size", "placeholder"], function(attr) { var value = _dom.mainInput.getAttribute(attr); if (value) { _dom.clearInput.setAttribute(attr, value); } }); insertAfter(_dom.mainInput, _dom.clearInput); } addClass(_dom.mainInput, "txt-pass"); } function createWarnLabel() { if (_opts.showWarn) { _dom.warnMsg = newEl("p", { id: "warn", className: "warn" }, { margin: "0 0 0 3px" }); addClass(_dom.warnMsg, "empty"); if (_opts.warnMsgClassName) addClass(_dom.warnMsg, _opts.warnMsgClassName, true); var insertAfterNode = _dom.clearInput || _dom.mainInput; if (hasClass(el.parentNode, BOOTSTRAP_INPUT_GROUP_CLASS, true)) { insertAfterNode = insertAfterNode.parentNode; } insertAfter(insertAfterNode, _dom.warnMsg); } } function createMaskBtn() { if (_opts.showToggle) { var zIndex = css(_dom.mainInput, 'z-index'); _dom.maskBtn = newEl("div", { id: "btn-mask", className: "btn-mask", title: _locale.msg.showPass }, { position: "absolute", margin: "0", padding: "0", 'z-index': zIndex ? zIndex + 1 : null }); addClass(_dom.maskBtn, "btn"); if (_opts.maskBtn.className) { addClass(_dom.maskBtn, _opts.maskBtn.className, true); } if (_opts.maskBtn.classMasked) { addClass(_dom.maskBtn, _opts.maskBtn.classMasked, true); } setHtml(_dom.maskBtn, _opts.maskBtn.textMasked); insertBefore(_dom.mainInput, _dom.maskBtn); } } function createGenBtn() { if (_opts.showGenerate) { var zIndex = css(_dom.mainInput, "z-index"); _dom.genBtn = newEl("div", { id: "btn-gen", className: "btn-gen", title: _locale.msg.genPass }, { position: "absolute", margin: "0", padding: "0", "z-index": zIndex ? zIndex + 1 : null }); addClass(_dom.genBtn, "btn"); insertBefore(_dom.mainInput, _dom.genBtn); _dom.genBtnInner = newEl("div", { id: "btn-gen-i", className: "btn-gen-i", title: _locale.msg.genPass }); _dom.genBtn.appendChild(_dom.genBtnInner); } } function createTip(mainInputRect) { if (_opts.showTip) { if (_opts.tipPopoverStyle && $ && typeof $.fn.popover === "function") { // using Twitter Bootstrap $(_dom.mainInput).popover(utils.extend({ // popover defaults (overridable) title: '', placement: _opts.tipPopoverStyle.placement || function(pop, el) { //noinspection JSValidateTypes var top = $(el).position().top - $(window).scrollTop(); var spaceBelow = $(window).height() - top; return spaceBelow > 300 || spaceBelow > top ? "bottom" : "top"; }, animation: false }, _opts.tipPopoverStyle, { // popovers properties (non-overridable) trigger: "manual", html: true, content: function() { return _tipHtml; } })); } else { // not using Twitter Bootstrap _dom.tip = newEl("div", { id: "tip", className: "tip" }, { position: "absolute", margin: "0", padding: "0", width: mainInputRect.width + "px" }); insertBefore(_dom.mainInput, _dom.tip); var arrWrap = newEl("div", { id: "tip-arr-wrap", className: "tip-arr-wrap" }); _dom.tip.appendChild(arrWrap); arrWrap.appendChild(newEl("div", { id: "tip-arr", className: "tip-arr" })); arrWrap.appendChild(newEl("div", { id: "tip-arr-in", className: "tip-arr-in" })); _dom.tipBody = newEl("div", { id: "tip-body", className: "tip-body" }); _dom.tip.appendChild(_dom.tipBody); } } } function createFakePlaceholder(mainInputRect) { if (!_features.placeholders) { var placeholderText = _dom.mainInput.getAttribute("placeholder") || _dom.mainInput.getAttribute("data-placeholder"); if (placeholderText) { _dom.placeholder = newEl("div", { id: "placeholder", className: "placeholder" }, { position: "absolute", margin: "0", padding: "0", height: mainInputRect.height + "px", lineHeight: mainInputRect.height + "px" }); setHtml(_dom.placeholder, placeholderText); insertBefore(_dom.mainInput, _dom.placeholder); } } else if (!_dom.mainInput.getAttribute("placeholder") && _dom.mainInput.getAttribute("data-placeholder")) { _dom.mainInput.setAttribute("placeholder", _dom.mainInput.getAttribute("data-placeholder")); } } function createPassLengthChecker() { if (_features.passSymbol) { _dom.passLengthChecker = newEl("div", { id: "len" }, { position: "absolute", height: css(_dom.mainInput, "height"), top: "-10000px", left: "-10000px", display: "block", color: "transparent", border: "none" }); insertBefore(_dom.mainInput, _dom.passLengthChecker); setTimeout(function() { utils.each(["marginLeft", "fontFamily", "fontSize", "fontWeight", "fontStyle", "fontVariant"], function(attr) { var value = css(_dom.mainInput, attr); if (value) { _dom.passLengthChecker.style[attr] = value; } }); }, 50); } } function resizeControls() { toggleButtons(); toggleTip(); var rect = getRect(getActiveInput()); var left = getRightBtnPadding(); if (_dom.maskBtn && _dom.maskBtn.style.display != "none") { left += cssFloat(_dom.maskBtn, "width"); setRect(_dom.maskBtn, { top: rect.top, left: rect.left + rect.width - left, height: rect.height }); } if (_dom.genBtn && _dom.genBtn.style.display != "none") { left += cssFloat(_dom.genBtn, "width"); setRect(_dom.genBtn, { top: rect.top, left: rect.left + rect.width - left, height: rect.height }); _dom.genBtnInner.style.marginTop = Math.max(0, Math.round((rect.height - 19) / 2)) + "px"; } if (_dom.placeholder && _dom.placeholder.style.display != "none") { setRect(_dom.placeholder, { top: rect.top, left: rect.left + 7, height: rect.height }); } if (_dom.tip && _dom.tip.style.display != "none") { setRect(_dom.tip, { left: rect.left, top: rect.top + rect.height, width: rect.width }); } } function getRightBtnPadding() { var paddingRight = cssFloat(getActiveInput(), "paddingRight"); return Math.max(BUTTONS_PADDING_RIGHT, paddingRight); } function toggleButtons() { if (_dom.genBtn) { _dom.genBtn.style.display = _isInputHover || _isInputFocused && !_passHidesGenBtn ? "block" : "none"; } if (_dom.maskBtn) { _dom.maskBtn.style.display = _isInputHover || _isInputFocused && !_passHidesMaskBtn ? "block" : "none"; } } function toggleTip() { if (!_opts.showTip) { return; } if (_dom.tip) { _dom.tip.style.display = (_warningShown && _isInputFocused) ? "block" : "none"; } else { if (_warningShown && _isInputFocused) { if (!_bootstrapPopoverShownText || (_tipHtml != _bootstrapPopoverShownText)) { var data = $(_dom.mainInput).data("popover") || $(_dom.mainInput).data("bs.popover"); var opts = data.options; var animationBackup = opts.animation; if (_bootstrapPopoverShownText) opts.animation = false; // set popover width (Bootstrap popovers doesn't support width setting, so we'll apply a hack) var width = getActiveInput().offsetWidth - 2; var el = data.$tip; if (el) { el.width(width); } else if (data.options.template) { data.options.template = data.options.template.replace("class=\"popover\"", "class=\"popover\" style=\"width: " + width + "px\""); } if (_dom.clearInput) { data.$element = $(getActiveInput()); } $(_dom.mainInput).popover("show"); _bootstrapPopoverShownText = _tipHtml; opts.animation = animationBackup; } } else { if (_bootstrapPopoverShownText) { _bootstrapPopoverShownText = null; $(_dom.mainInput).popover("hide"); } } } } function detectFeatures() { var supportsPlaceholder = true; var changeType = true; var test = document.createElement("input"); if (!("placeholder" in test)) { supportsPlaceholder = false; } test.setAttribute("style", "position:absolute;left:-10000px;top:-10000px;"); document.body.appendChild(test); try { test.setAttribute("type", "password"); } catch (err) { changeType = false; } document.body.removeChild(test); var box = document.createElement("div"); box.setAttribute("style", "display:inline-block"); box.style.paddingLeft = box.style.width = "1px"; document.body.appendChild(box); var isBoxModel = box.offsetWidth == 2; var hasInlineBlock = css(box, "display") === "inline-block"; document.body.removeChild(box); var passSymbol = navigator.userAgent.indexOf("AppleWebKit") >= 0 || navigator.userAgent.indexOf("Opera") >= 0 || navigator.userAgent.indexOf("Firefox") >= 0 && navigator.platform.indexOf("Mac") >= 0 ? "\u2022" : "\u25cf"; _features = { placeholders: supportsPlaceholder, changeType: changeType, boxModel: isBoxModel, hasInlineBlock: hasInlineBlock, passSymbol: passSymbol }; } function getActiveInput() { return _isMasked ? _dom.mainInput : _dom.clearInput || _dom.mainInput; } function bindEvents() { utils.each(_dom.clearInput ? [_dom.mainInput, _dom.clearInput] : [_dom.mainInput], function (el) { utils.attachEvent(el, "onkeyup", handleInputKeyup); utils.attachEvent(el, "onfocus", handleInputFocus); utils.attachEvent(el, "onblur", handleInputBlur); utils.attachEvent(el, "onmouseover", handleMouseEvent); utils.attachEvent(el, "onmouseout", handleMouseEvent); if (_dom.placeholder) { utils.attachEvent(el, "onkeydown", handleInputKeydown); } }); utils.attachEvent(window, "onresize", resizeControls); if (_dom.maskBtn) { utils.attachEvent(_dom.maskBtn, "onclick", function() { toggleMasking(); }); utils.attachEvent(_dom.maskBtn, "onmouseover", handleMouseEvent); utils.attachEvent(_dom.maskBtn, "onmouseout", handleMouseEvent); } if (_dom.genBtn) { utils.attachEvent(_dom.genBtn, "onclick", function() { generatePassword(); }); utils.attachEvent(_dom.genBtn, "onmouseover", handleMouseEvent); utils.attachEvent(_dom.genBtn, "onmouseout", handleMouseEvent); } if (_dom.placeholder) { utils.attachEvent(_dom.placeholder, "onclick", handlePlaceholderClicked); } if (_opts.nonMatchField) { var el = getEl(_opts.nonMatchField); if (el) { utils.attachEvent(el, "onkeyup", handleLoginChanged); } } } function handlePlaceholderClicked() { getActiveInput().focus(); } function handleMouseEvent(e) { var isInside = e.type === "mouseover"; var el = e.relatedTarget ? e.relatedTarget : isInside ? e.fromElement : e.toElement; if (el && el.id && (el.id.indexOf(ELEMENTS_PREFIX + "btn") === 0 || el === _dom.mainInput || el === _dom.clearInput)) return; _isInputHover = isInside; resizeControls(); } function handleInputKeyup(e) { var keyCode = e ? e.which || e.keyCode : null; var isDelete = keyCode === KEY_BACKSPACE || keyCode === KEY_DELETE; var val; if (_dom.clearInput) { if (_isMasked) { val = _dom.clearInput.value = _dom.mainInput.value; } else { val = _dom.mainInput.value = _dom.clearInput.value; } } else { val = _dom.mainInput.value; } if (_opts.strengthCheckTimeout > 0 && !_warningShown && !isDelete) { if (_validateTimer) { clearTimeout(_validateTimer); } _validateTimer = setTimeout(validatePassword, _opts.strengthCheckTimeout); } else { validatePassword(); } if (_dom.placeholder && !val) { _dom.placeholder.style.display = "block"; } hideButtonsByPassLength(); } function hideButtonsByPassLength() { if (!_dom.passLengthChecker) return; var pass = getActiveInput().value; if (_isMasked) pass = pass.replace(/./g, _features.passSymbol); setHtml(_dom.passLengthChecker, pass); var passWidth = _dom.passLengthChecker.offsetWidth; passWidth += cssFloat(_dom.mainInput, "paddingLeft"); var maskBtnWidth = 0, genBtnWidth = 0; var fieldBounds = getBounds(getActiveInput()); var fieldWidth = fieldBounds.width; var changed = false; var btnPadding = getRightBtnPadding(); if (_dom.maskBtn) { maskBtnWidth = cssFloat(_dom.maskBtn, "width"); var maskBtnLeft = fieldWidth - maskBtnWidth - btnPadding; var passHidesMaskBtn = passWidth > maskBtnLeft; if (_passHidesMaskBtn != passHidesMaskBtn) { changed = true; _passHidesMaskBtn = passHidesMaskBtn; } } if (_dom.genBtn) { genBtnWidth = cssFloat(_dom.genBtn, "width"); var genBtnLeft = fieldWidth - maskBtnWidth - genBtnWidth - btnPadding; var passHidesGenBtn = passWidth > genBtnLeft; if (_passHidesGenBtn != passHidesGenBtn) { changed = true; _passHidesGenBtn = passHidesGenBtn; } } if (changed) { resizeControls(); } } function handleInputKeydown() { // Here we support old browsers and remove placeholder if (_dom.placeholder) { _dom.placeholder.style.display = "none"; } } function handleInputFocus() { if (_blurTimer) { clearTimeout(_blurTimer); _blurTimer = null; } if (_blurMaskTimer) { clearTimeout(_blurMaskTimer); _blurMaskTimer = null; } _isInputFocused = true; resizeControls(); } function handleInputBlur() { _blurTimer = setTimeout(function() { _blurTimer = null; _isInputFocused = false; resizeControls(); // if the password has not been masked my default, toggle mode after inactivity if (_opts.isMasked && !_blurMaskTimer) { _blurMaskTimer = setTimeout(function() { _blurMaskTimer = null; toggleMasking(true, false); }, 1500); } }, 100); } function handleLoginChanged() { if (_warningShown) { validatePassword(); } } function toggleMasking(isMasked, needFocus) { if (needFocus === undefined) needFocus = true; var eventHappened = isMasked != _isMasked; if (isMasked === undefined) isMasked = !_isMasked; else isMasked = !!isMasked; if (_features.changeType) { var el = getActiveInput(); var sel = getSelection(el); el.setAttribute("type", isMasked ? "password" : "text"); if (needFocus) { setSelection(el, sel); el.focus(); } } else { var currentDisplayMode = css(getActiveInput(), "display") || "block"; var currentInput = isMasked ? _dom.clearInput : _dom.mainInput; var nextInput = isMasked ? _dom.mainInput : _dom.clearInput; if (_isMasked != isMasked) { // LastPass could insert style attributes here: we'll copy them to clear input (if any) utils.each(["paddingRight", "width", "backgroundImage", "backgroundPosition", "backgroundRepeat", "backgroundAttachment", "border"], function (prop) { var cur = currentInput.style[prop]; if (cur) { nextInput.style[prop] = cur; } }); } var selection = getSelection(currentInput); nextInput.style.display = currentDisplayMode; currentInput.style.display = "none"; nextInput.value = currentInput.value; if (needFocus) { setSelection(nextInput, selection); nextInput.focus(); } // jQuery.validation can insert error label right after our input, so we'll handle it here if (_dom.mainInput.nextSibling != _dom.clearInput) { insertAfter(_dom.mainInput, _dom.clearInput); } } if (_dom.maskBtn) { setHtml(_dom.maskBtn, isMasked ? _opts.maskBtn.textMasked : _opts.maskBtn.textUnmasked); if (isMasked) { if (_opts.maskBtn.classUnmasked) removeClass(_dom.maskBtn, _opts.maskBtn.classUnmasked, true); if (_opts.maskBtn.classMasked) addClass(_dom.maskBtn, _opts.maskBtn.classMasked, true); } else { if (_opts.maskBtn.classMasked) removeClass(_dom.maskBtn, _opts.maskBtn.classMasked, true); if (_opts.maskBtn.classUnmasked) addClass(_dom.maskBtn, _opts.maskBtn.classUnmasked, true); } _dom.maskBtn.title = isMasked ? _locale.msg.showPass : _locale.msg.hidePass; } _isMasked = isMasked; hideButtonsByPassLength(); resizeControls(); if (eventHappened) { triggerEvent("switched", _isMasked); } } function getSelection(el) { if (typeof el.selectionStart === "number" && typeof el.selectionEnd === "number") { return { start: el.selectionStart, end: el.selectionEnd }; } return null; } function setSelection(el, selection) { if (!selection) return; if (typeof el.selectionStart === "number" && typeof el.selectionEnd === "number") { el.selectionStart = selection.start; el.selectionEnd = selection.end; } } function doAutofocus() { if (typeof _dom.mainInput.hasAttribute === "function" && _dom.mainInput.hasAttribute("autofocus") || _dom.mainInput.getAttribute("autofocus")) { _dom.mainInput.focus(); handleInputFocus(); } } function generatePassword() { var pass = createRandomPassword(); _dom.mainInput.value = pass; if (_dom.clearInput) { _dom.clearInput.value = pass; } triggerEvent("generated", pass); toggleMasking(false); if (_validateTimer) { clearTimeout(_validateTimer); _validateTimer = null; } validatePassword(); if (_dom.placeholder) { _dom.placeholder.style.display = "none"; } } function validatePassword() { if (_validateTimer) { clearTimeout(_validateTimer); _validateTimer = null; } var pass = getActiveInput().value; var checkResult = calculateStrength(pass); if (pass.length === 0) { checkResult = { strength: _opts.allowEmpty ? 0 : null, messages: [_locale.msg.passRequired] }; } else { // check: contains bad chars if (!_opts.allowAnyChars && checkResult.charTypes[PassField.CharTypes.UNKNOWN]) { checkResult = { strength: null, messages: [_locale.msg.badChars.replace("{}", checkResult.charTypes[PassField.CharTypes.UNKNOWN])] }; } delete checkResult.charTypes; // check: blacklist var isInBlackList = false; utils.each(_opts.blackList, function(el) { if (el == pass) { isInBlackList = true; return false; } return true; }); if (isInBlackList) { checkResult = { strength: 0, messages: [_locale.msg.inBlackList] }; } // check equal to login if (pass && pass === getNonMatchingFieldValue()) { checkResult = { strength: 0, messages: [_locale.msg.equalTo] }; } } // check: external (if present) if (typeof _opts.validationCallback === "function") { var externalResult = _opts.validationCallback(_dom.mainInput, checkResult); var returnedMessages; var returnedStrength; if (externalResult && externalResult.messages && utils.isArray(externalResult.messages)) { returnedMessages = externalResult.messages; } if (externalResult && Object.prototype.hasOwnProperty.call(externalResult, "strength") && ((typeof externalResult.strength === "number") || (externalResult.strength === null))) { returnedStrength = externalResult.strength; } if (returnedMessages && returnedMessages.length) { // both messages and strength are replaced with custom messages checkResult.messages = returnedMessages; checkResult.strength = returnedStrength; } else { // no message is provided; strength can only be increased if (returnedStrength && returnedStrength > checkResult.strength) { checkResult.strength = returnedStrength; } // else: // We have been told: "the password is invalid/weak". // But why? There's no explanation given (in messages) and we can't guess the reason. // We'll not show such unknown errors to the user and disregard returned strength. } } if (pass.length === 0 && _opts.allowEmpty) { // empty but ok hidePasswordWarning(); _validationResult = { strength: 0 }; return true; } else if (checkResult.strength === null || checkResult.strength < _opts.acceptRate) { showPasswordWarning(checkResult.strength, checkResult.messages); return false; } else { // ok hidePasswordWarning(); _validationResult = { strength: checkResult.strength }; return true; } } function calculateStrength(pass) { var charTypesPattern = splitToCharTypes(_opts.pattern, PassField.CharTypes.SYMBOL); var charTypesPass = splitToCharTypes(pass, _opts.allowAnyChars ? PassField.CharTypes.SYMBOL : PassField.CharTypes.UNKNOWN); var messages = []; var charTypesPatternCount = 0; utils.each(charTypesPattern, function(charType) { charTypesPatternCount++; if (!charTypesPass[charType]) { var msg = _locale.msg[charType]; if (charType == PassField.CharTypes.SYMBOL) { // we should give example of symbols; for other types this is not required var symbolsCount = 4; var charsExample = _opts.chars[charType]; if (charsExample.length > symbolsCount) charsExample = charsExample.substring(0, symbolsCount); msg = msg + " (" + charsExample + ")"; } messages.push(msg); } }); var strength = 1 - messages.length / charTypesPatternCount; if (messages.length) { messages = [joinMessagesForCharTypes(messages)]; } if (_opts.checkMode == PassField.CheckModes.MODERATE) { var extraCharTypesCount = 0; utils.each(charTypesPass, function(charType) { if (!charTypesPattern[charType]) { // cool: the user entered char of type which was not in pattern; +strength! extraCharTypesCount++; } }); strength += extraCharTypesCount / charTypesPatternCount; } var minPassLength = _opts.pattern.length; var lengthRatio = pass.length / minPassLength - 1; if (_opts.length && _opts.length.min && pass.length < _opts.length.min) { lengthRatio = -10; if (_opts.length.min > minPassLength) minPassLength = _opts.length.min; } if (lengthRatio < 0) { strength += lengthRatio; messages.push(_locale.msg.passTooShort.replace("{}", minPassLength.toString())); } else { if (_opts.checkMode == PassField.CheckModes.MODERATE) { strength += lengthRatio / charTypesPatternCount; } } if (pass.length > 2) { var firstChar = pass.charAt(0); var allEqual = true; for (var i = 0; i < pass.length; i++) { if (pass.charAt(i) != firstChar) { allEqual = false; break; } } if (allEqual) { strength = 0; messages = [_locale.msg.repeat]; } } if (strength < 0) { strength = 0; } // MODERATE checking mode could produce positive results for extra long passwords if (strength > 1) { strength = 1; } return { strength: strength, messages: messages, charTypes: charTypesPass }; } function joinMessagesForCharTypes(messages) { var replacement = messages[0]; for (var i = 1; i < messages.length; i++) { if (i == messages.length - 1) replacement += " " + _locale.msg.and + " "; else replacement += ", "; replacement += messages[i]; } return _locale.msg.noCharType.replace("{}", replacement); } function showPasswordWarning(strength, messages) { var shortErrorText = ""; var errorText = ""; if (strength === null) { shortErrorText = _locale.msg.invalidPassWarn; errorText = messages[0].charAt(0).toUpperCase() + messages[0].substring(1); } else { shortErrorText = _locale.msg.weakWarn; errorText = ""; if (messages) { for (var i = 0; i < messages.length; i++) { var firstLetter = messages[i].charAt(0); if (i === 0) { errorText += _locale.msg.weakTitle + ": "; if (_locale.lower) firstLetter = firstLetter.toLowerCase(); } else { errorText += "
    "; firstLetter = firstLetter.toUpperCase(); } errorText += firstLetter + messages[i].substring(1); if (errorText && (errorText.charAt(errorText.length - 1) != ".")) errorText += "."; } } } if (errorText && (errorText.charAt(errorText.length - 1) != ".")) errorText += "."; _validationResult = { strength: strength, message: errorText }; if (_dom.warnMsg) { setHtml(_dom.warnMsg, shortErrorText); _dom.warnMsg.title = errorText; if (_opts.errorWrapClassName) { addClass(_dom.wrapper, _opts.errorWrapClassName, true); } if (shortErrorText) removeClass(_dom.warnMsg, "empty"); else addClass(_dom.warnMsg, "empty"); } if (_opts.showTip) { var html = errorText; if (_dom.genBtn) { html += "
    " + _locale.msg.generateMsg.replace("{}", "
    "); } _tipHtml = html; if (_dom.tipBody) { setHtml(_dom.tipBody, html); } } _warningShown = true; resizeControls(); } function hidePasswordWarning() { if (_dom.warnMsg) { setHtml(_dom.warnMsg, ""); _dom.warnMsg.title = ""; if (_opts.errorWrapClassName) { removeClass(_dom.wrapper, _opts.errorWrapClassName, true); } addClass(_dom.warnMsg, "empty"); } _tipHtml = null; _warningShown = false; resizeControls(); } function getNonMatchingFieldValue() { if (!_opts.nonMatchField) return null; var field = getEl(_opts.nonMatchField); if (!field) return null; return field.value; } function getPassValidationMessage() { return _validationResult ? _validationResult.message : null; } function getPassStrength() { return _validationResult ? _validationResult.strength : -1; } function createRandomPassword() { var result = ""; var charTypes = splitToCharTypes(_opts.pattern, PassField.CharTypes.SYMBOL); // We're creating an array of charTypes and shuffling it. // In such way, generated password will contain exactly the same number of character types as was defined in pattern var charTypesSeq = []; utils.each(charTypes, function(charType, chars) { for (var j = 0; j < chars.length; j++) { charTypesSeq.push(charType); } }); charTypesSeq.sort(function() { return 0.7 - Math.random(); }); utils.each(charTypesSeq, function(charType) { var sequence = _conf.generationChars[charType]; if (sequence) { if (_opts.chars[charType] && _opts.chars[charType].indexOf(sequence) < 0) sequence = _opts.chars[charType]; // overriden without default letters - ok, generate from given chars } else { sequence = _opts.chars[charType]; } result += utils.selectRandom(sequence); }); return result; } function splitToCharTypes(str, defaultCharType) { var result = {}; for (var i = 0; i < str.length; i++) { var ch = str.charAt(i); var type = defaultCharType; utils.each(_opts.chars, function(charType, seq) { if (seq.indexOf(ch) >= 0) { type = charType; return false; } return true; }); result[type] = (result[type] || "") + ch; } return result; } // ========================== DOM-related functions ========================== function formatId(id) { return ELEMENTS_PREFIX + id + "-" + _id; } function formatClass(cls) { return ELEMENTS_PREFIX + cls; } function newEl(tagName, attr, css) { if (attr.id) attr.id = formatId(attr.id); if (attr.className) attr.className = formatClass(attr.className); return utils.newEl(tagName, attr, css); } function getBoundingRect(el) { try { return el.getBoundingClientRect(); } catch (err) { return { top: 0, left: 0 }; } } function offset(el) { var doc = el.ownerDocument; if (!doc) { return { top: 0, left: 0 }; } var box = getBoundingRect(el); return { top: box.top + (window.pageYOffset || 0) - (doc.documentElement.clientTop || 0), left: box.left + (window.pageXOffset || 0) - (doc.documentElement.clientLeft || 0) }; } function offsetParent(el) { var op; try { op = el.offsetParent; } catch (e) { } if (!op) op = document.documentElement; while (op && (op.nodeName.toLowerCase() != "html") && css(op, "position") === "static") { op = op.offsetParent; } return op || document.documentElement; } function position(el) { var offs, parentOffset = { top: 0, left: 0 }; if (css(el, "position") === "fixed") { offs = getBoundingRect(el); } else { var op = offsetParent(el); offs = offset(el); if (op.nodeName.toLowerCase() != "html") { parentOffset = offset(op); } parentOffset.top += cssFloat(op, "borderTopWidth"); parentOffset.left += cssFloat(op, "borderLeftWidth"); } return { top: offs.top - parentOffset.top - cssFloat(el, "marginTop"), left: offs.left - parentOffset.left - cssFloat(el, "marginLeft") }; } function getBounds(el) { return { width: el.offsetWidth, height: el.offsetHeight }; } function getRect(el) { return utils.extend(offset(el), getBounds(el)); } function setRect(el, rect) { if (rect.height && !isNaN(rect.height)) { el.style.height = rect.height + "px"; el.style.lineHeight = rect.height + "px"; } if (rect.width && !isNaN(rect.width)) { el.style.width = rect.width + "px"; } if (rect.top || rect.left) { if (css(el, "display") == "none") { el.style.top = rect.top + "px"; el.style.left = rect.left + "px"; return; } var curLeft, curTop, curOffset; curOffset = offset(el); curTop = css(el, "top") || 0; curLeft = css(el, "left") || 0; if ((curTop + curLeft + "").indexOf("auto") > -1) { var pos = position(el); curTop = pos.top; curLeft = pos.left; } else { curTop = parseFloat(curTop) || 0; curLeft = parseFloat(curLeft) || 0; } if (rect.top) { el.style.top = ((rect.top - curOffset.top) + curTop) + "px"; } if (rect.left) { el.style.left = ((rect.left - curOffset.left) + curLeft) + "px"; } } } function css(el, prop) { var st = typeof window.getComputedStyle === "function" ? window.getComputedStyle(el, null) : el.currentStyle; return st ? st[prop] : null; } function cssFloat(el, prop) { var v = css(el, prop); if (!v) return 0; var parsed = parseFloat(v); return isNaN(parsed) ? 0 : parsed; } function insertAfter(target, el) { if (target.parentNode) target.parentNode.insertBefore(el, target.nextSibling); } function insertBefore(target, el) { if (target.parentNode) target.parentNode.insertBefore(el, target); } function setHtml(el, html) { try { el.innerHTML = html; } catch (err) { // browser doesn't support innerHTML or it's readonly var newNode = document.createElement("c"); newNode.innerHTML = html; while (el.firstChild) { el.removeChild(el.firstChild); } el.appendChild(newNode); } } function getEl(el) { if (typeof el === "string") { return document.getElementById(el); } if (el.jquery) { return el[0]; } return el; } function addClass(el, cls, raw) { if (hasClass(el, cls, raw)) return; el.className = el.className + (el.className ? " " : "") + (raw === true ? cls : formatClass(cls)); } function removeClass(el, cls, raw) { if (!hasClass(el, cls, raw)) return; el.className = (" " + el.className + " ").replace((raw === true ? cls : formatClass(cls)) + " ", "").replace(/^\s+|\s+$/g, ""); } function hasClass(el, cls, raw) { cls = " " + (raw === true ? cls : formatClass(cls)) + " "; return (" " + el.className + " ").replace(/[\n\t]/g, " ").indexOf(cls) > -1; } function triggerEvent(name, arg) { if ($) { try { $(_dom.mainInput).trigger(JQUERY_EVENT_PREFIX + name, arg); } catch (err) {} } if (_opts.events && typeof _opts.events[name] === "function") { try { _opts.events[name].call(_dom.mainInput, arg); } catch (err) {} } } function assignDataObject(prop, obj) { if ($) { $(_dom.mainInput).data(prop, obj); } } }; // ========================== utility ========================== var utils = {}; utils.extend = function() { var arg = arguments; for (var i = 1; i < arg.length; i++) { utils.each(arg[i], function (key, value) { if (utils.isArray(arg[0][key]) || utils.isArray(value)) { arg[0][key] = arg[0][key] ? arg[0][key].concat(value || []) : value; } else if (utils.isElement(value)) { arg[0][key] = value; } else if (typeof arg[0][key] === "object" && typeof value === "object" && value !== null) { arg[0][key] = utils.extend({}, arg[0][key], value); } else if (typeof value === "object" && value !== null) { arg[0][key] = utils.extend({}, value); } else { arg[0][key] = value; } }); } return arg[0]; }; utils.newEl = function(tagName, attr, css) { var el = document.createElement(tagName); if (attr) { utils.each(attr, function(key, value) { if (value) el[key] = value; }); } if (css) { utils.each(css, function(key, value) { if (value) el.style[key] = value; }); } return el; }; utils.attachEvent = function(el, event, handler) { var oldHandler = el[event]; el[event] = function(e) { if (!e) e = window.event; handler(e); if (typeof oldHandler === "function") { oldHandler(e); } }; }; utils.each = function(obj, fn) { if (utils.isArray(obj)) { for (var i = 0; i < obj.length; i++) { if (fn(obj[i]) === false) return; } } else { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { if (fn(key, obj[key]) === false) return; } } } }; utils.isArray = function(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; }; utils.isElement = function(obj) { if (!obj) return false; try { return obj instanceof HTMLElement || $ && obj instanceof jQuery; } catch (err) { return typeof obj === "object" && obj.nodeType || obj.jquery; } }; utils.selectRandom = function(arr) { var pos = Math.floor(Math.random() * arr.length); return utils.isArray(arr) ? arr[pos] : arr.charAt(pos); }; utils.contains = function(arr, item) { if (!arr) return false; var result = false; utils.each(arr, function (el) { if (el === item) { result = true; return false; } return true; }); return result; }; // ========================== jQuery plugin ========================== if ($) { $.fn.passField = function(opts) { return this.each(function() { new PassField.Field(this, opts); }); }; $.fn.togglePassMasking = function(isMasked) { return this.each(function() { var pf = $(this).data(PassField.Config.dataAttr); if (pf) { pf.toggleMasking(isMasked); } }); }; $.fn.setPass = function(val) { return this.each(function() { var pf = $(this).data(PassField.Config.dataAttr); if (pf) { pf.setPass(val); } }); }; $.fn.validatePass = function() { var isValid = true; this.each(function() { var pf = $(this).data(PassField.Config.dataAttr); if (pf && !pf.validatePass()) { isValid = false; } }); return isValid; }; $.fn.getPassValidationMessage = function() { var el = this.first(); if (el) { var pf = el.data(PassField.Config.dataAttr); if (pf) { return pf.getPassValidationMessage(); } } return null; }; $.fn.getPassStrength = function () { var el = this.first(); if (el) { var pf = el.data(PassField.Config.dataAttr); if (pf) { return pf.getPassStrength(); } } return null; }; } // ========================== jQuery.Validation plugin ========================== if ($ && $.validator) { jQuery.validator.addMethod("passfield", function(val, el) { return $(el).validatePass(); // this will set validation message }, function(val, el) { return $(el).getPassValidationMessage(); }); } })(window.jQuery, document, window); !function(a){"function"==typeof define&&define.amd?define("picker",["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):this.Picker=a(jQuery)}(function(a){function b(f,g,i,m){function n(){return b._.node("div",b._.node("div",b._.node("div",b._.node("div",B.component.nodes(w.open),y.box),y.wrap),y.frame),y.holder,'tabindex="-1"')}function o(){z.data(g,B).addClass(y.input).val(z.data("value")?B.get("select",x.format):f.value),x.editable||z.on("focus."+w.id+" click."+w.id,function(a){a.preventDefault(),B.open()}).on("keydown."+w.id,u),e(f,{haspopup:!0,expanded:!1,readonly:!1,owns:f.id+"_root"})}function p(){e(B.$root[0],"hidden",!0)}function q(){B.$holder.on({keydown:u,"focus.toOpen":t,blur:function(){z.removeClass(y.target)},focusin:function(a){B.$root.removeClass(y.focused),a.stopPropagation()},"mousedown click":function(b){var c=b.target;c!=B.$holder[0]&&(b.stopPropagation(),"mousedown"!=b.type||a(c).is("input, select, textarea, button, option")||(b.preventDefault(),B.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var b=a(this),c=b.data(),d=b.hasClass(y.navDisabled)||b.hasClass(y.disabled),e=h();e=e&&(e.type||e.href),(d||e&&!a.contains(B.$root[0],e))&&B.$holder[0].focus(),!d&&c.nav?B.set("highlight",B.component.item.highlight,{nav:c.nav}):!d&&"pick"in c?(B.set("select",c.pick),x.closeOnSelect&&B.close(!0)):c.clear?(B.clear(),x.closeOnClear&&B.close(!0)):c.close&&B.close(!0)})}function r(){var b;x.hiddenName===!0?(b=f.name,f.name=""):(b=["string"==typeof x.hiddenPrefix?x.hiddenPrefix:"","string"==typeof x.hiddenSuffix?x.hiddenSuffix:"_submit"],b=b[0]+f.name+b[1]),B._hidden=a('")[0],z.on("change."+w.id,function(){B._hidden.value=f.value?B.get("select",x.formatSubmit):""})}function s(){v&&l?B.$holder.find("."+y.frame).one("transitionend",function(){B.$holder[0].focus()}):B.$holder[0].focus()}function t(a){a.stopPropagation(),z.addClass(y.target),B.$root.addClass(y.focused),B.open()}function u(a){var b=a.keyCode,c=/^(8|46)$/.test(b);return 27==b?(B.close(!0),!1):void((32==b||c||!w.open&&B.component.key[b])&&(a.preventDefault(),a.stopPropagation(),c?B.clear().close():B.open()))}if(!f)return b;var v=!1,w={id:f.id||"P"+Math.abs(~~(Math.random()*new Date))},x=i?a.extend(!0,{},i.defaults,m):m||{},y=a.extend({},b.klasses(),x.klass),z=a(f),A=function(){return this.start()},B=A.prototype={constructor:A,$node:z,start:function(){return w&&w.start?B:(w.methods={},w.start=!0,w.open=!1,w.type=f.type,f.autofocus=f==h(),f.readOnly=!x.editable,f.id=f.id||w.id,"text"!=f.type&&(f.type="text"),B.component=new i(B,x),B.$root=a('
    '),p(),B.$holder=a(n()).appendTo(B.$root),q(),x.formatSubmit&&r(),o(),x.containerHidden?a(x.containerHidden).append(B._hidden):z.after(B._hidden),x.container?a(x.container).append(B.$root):z.after(B.$root),B.on({start:B.component.onStart,render:B.component.onRender,stop:B.component.onStop,open:B.component.onOpen,close:B.component.onClose,set:B.component.onSet}).on({start:x.onStart,render:x.onRender,stop:x.onStop,open:x.onOpen,close:x.onClose,set:x.onSet}),v=c(B.$holder[0]),f.autofocus&&B.open(),B.trigger("start").trigger("render"))},render:function(b){return b?(B.$holder=a(n()),q(),B.$root.html(B.$holder)):B.$root.find("."+y.box).html(B.component.nodes(w.open)),B.trigger("render")},stop:function(){return w.start?(B.close(),B._hidden&&B._hidden.parentNode.removeChild(B._hidden),B.$root.remove(),z.removeClass(y.input).removeData(g),setTimeout(function(){z.off("."+w.id)},0),f.type=w.type,f.readOnly=!1,B.trigger("stop"),w.methods={},w.start=!1,B):B},open:function(c){return w.open?B:(z.addClass(y.active),e(f,"expanded",!0),setTimeout(function(){B.$root.addClass(y.opened),e(B.$root[0],"hidden",!1)},0),c!==!1&&(w.open=!0,v&&k.css("overflow","hidden").css("padding-right","+="+d()),s(),j.on("click."+w.id+" focusin."+w.id,function(a){var b=a.target;b!=f&&b!=document&&3!=a.which&&B.close(b===B.$holder[0])}).on("keydown."+w.id,function(c){var d=c.keyCode,e=B.component.key[d],f=c.target;27==d?B.close(!0):f!=B.$holder[0]||!e&&13!=d?a.contains(B.$root[0],f)&&13==d&&(c.preventDefault(),f.click()):(c.preventDefault(),e?b._.trigger(B.component.key.go,B,[b._.trigger(e)]):B.$root.find("."+y.highlighted).hasClass(y.disabled)||(B.set("select",B.component.item.highlight),x.closeOnSelect&&B.close(!0)))})),B.trigger("open"))},close:function(a){return a&&(x.editable?f.focus():(B.$holder.off("focus.toOpen").focus(),setTimeout(function(){B.$holder.on("focus.toOpen",t)},0))),z.removeClass(y.active),e(f,"expanded",!1),setTimeout(function(){B.$root.removeClass(y.opened+" "+y.focused),e(B.$root[0],"hidden",!0)},0),w.open?(w.open=!1,v&&k.css("overflow","").css("padding-right","-="+d()),j.off("."+w.id),B.trigger("close")):B},clear:function(a){return B.set("clear",null,a)},set:function(b,c,d){var e,f,g=a.isPlainObject(b),h=g?b:{};if(d=g&&a.isPlainObject(c)?c:d||{},b){g||(h[b]=c);for(e in h)f=h[e],e in B.component.item&&(void 0===f&&(f=null),B.component.set(e,f,d)),("select"==e||"clear"==e)&&z.val("clear"==e?"":B.get(e,x.format)).trigger("change");B.render()}return d.muted?B:B.trigger("set",h)},get:function(a,c){if(a=a||"value",null!=w[a])return w[a];if("valueSubmit"==a){if(B._hidden)return B._hidden.value;a="value"}if("value"==a)return f.value;if(a in B.component.item){if("string"==typeof c){var d=B.component.get(a);return d?b._.trigger(B.component.formats.toString,B.component,[c,d]):""}return B.component.get(a)}},on:function(b,c,d){var e,f,g=a.isPlainObject(b),h=g?b:{};if(b){g||(h[b]=c);for(e in h)f=h[e],d&&(e="_"+e),w.methods[e]=w.methods[e]||[],w.methods[e].push(f)}return B},off:function(){var a,b,c=arguments;for(a=0,namesCount=c.length;a').appendTo("body"),c=b[0].offsetWidth;b.css("overflow","scroll");var d=a('
    ').appendTo(b),e=d[0].offsetWidth;return b.remove(),c-e}function e(b,c,d){if(a.isPlainObject(c))for(var e in c)f(b,e,c[e]);else f(b,c,d)}function f(a,b,c){a.setAttribute(("role"==b?"":"aria-")+b,c)}function g(b,c){a.isPlainObject(b)||(b={attribute:c}),c="";for(var d in b){var e=("role"==d?"":"aria-")+d,f=b[d];c+=null==f?"":e+'="'+b[d]+'"'}return c}function h(){try{return document.activeElement}catch(a){}}var i=a(window),j=a(document),k=a(document.documentElement),l=null!=document.documentElement.style.transition;return b.klasses=function(a){return a=a||"picker",{picker:a,opened:a+"--opened",focused:a+"--focused",input:a+"__input",active:a+"__input--active",target:a+"__input--target",holder:a+"__holder",frame:a+"__frame",wrap:a+"__wrap",box:a+"__box"}},b._={group:function(a){for(var c,d="",e=b._.trigger(a.min,a);e<=b._.trigger(a.max,a,[e]);e+=a.i)c=b._.trigger(a.item,a,[e]),d+=b._.node(a.node,c[0],c[1],c[2]);return d},node:function(b,c,d,e){return c?(c=a.isArray(c)?c.join(""):c,d=d?' class="'+d+'"':"",e=e?" "+e:"","<"+b+d+e+">"+c+""):""},lead:function(a){return(10>a?"0":"")+a},trigger:function(a,b,c){return"function"==typeof a?a.apply(b,c||[]):a},digits:function(a){return/\d/.test(a[1])?2:1},isDate:function(a){return{}.toString.call(a).indexOf("Date")>-1&&this.isInteger(a.getDate())},isInteger:function(a){return{}.toString.call(a).indexOf("Number")>-1&&a%1===0},ariaAttr:g},b.extend=function(c,d){a.fn[c]=function(e,f){var g=this.data(c);return"picker"==e?g:g&&"string"==typeof e?b._.trigger(g[e],g,[f]):this.each(function(){var f=a(this);f.data(c)||new b(this,c,d,e)})},a.fn[c].defaults=d.defaults},b}); !function(a){"function"==typeof define&&define.amd?define(["picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0],e=d.value,f=a.$node.data("value"),g=f||e,h=f?b.formatSubmit:b.format,i=function(){return d.currentStyle?"rtl"==d.currentStyle.direction:"rtl"==getComputedStyle(a.$root[0]).direction};c.settings=b,c.$node=a.$node,c.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return a[0]===!0?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),g?c.set("select",g,{format:h,defaultValue:!0}):c.set("select",null).set("highlight",c.item.now),c.key={40:7,38:-7,39:function(){return i()?-1:1},37:function(){return i()?1:-1},go:function(a){var b=c.item.highlight,d=new Date(b.year,b.month,b.date+a);c.set("highlight",d,{interval:a}),this.render()}},a.on("render",function(){a.$root.find("."+b.klass.selectMonth).on("change",function(){var c=this.value;c&&(a.set("highlight",[a.get("view").year,c,a.get("highlight").date]),a.$root.find("."+b.klass.selectMonth).trigger("focus"))}),a.$root.find("."+b.klass.selectYear).on("change",function(){var c=this.value;c&&(a.set("highlight",[c,a.get("view").month,a.get("highlight").date]),a.$root.find("."+b.klass.selectYear).trigger("focus"))})},1).on("open",function(){var d="";c.disabled(c.get("now"))&&(d=":not(."+b.klass.buttonToday+")"),a.$root.find("button"+d+", select").attr("disabled",!1)},1).on("close",function(){a.$root.find("button, select").attr("disabled",!0)},1)}var d=7,e=6,f=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",e.select,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",e.highlight,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,d){var e,g=this;return c=void 0===c?a:c,c==-(1/0)||c==1/0?e=c:b.isPlainObject(c)&&f.isInteger(c.pick)?c=c.obj:b.isArray(c)?(c=new Date(c[0],c[1],c[2]),c=f.isDate(c)?c:g.create().obj):c=f.isInteger(c)||f.isDate(c)?g.normalize(new Date(c),d):g.now(a,c,d),{year:e||c.getFullYear(),month:e||c.getMonth(),date:e||c.getDate(),day:e||c.getDay(),obj:e||c,pick:e||c.getTime()}},c.prototype.createRange=function(a,c){var d=this,e=function(a){return a===!0||b.isArray(a)||f.isDate(a)?d.create(a):a};return f.isInteger(a)||(a=e(a)),f.isInteger(c)||(c=e(c)),f.isInteger(a)&&b.isPlainObject(c)?a=[c.year,c.month,c.date+a]:f.isInteger(c)&&b.isPlainObject(a)&&(c=[a.year,a.month,a.date+c]),{from:e(a),to:e(c)}},c.prototype.withinRange=function(a,b){return a=this.createRange(a.from,a.to),b.pick>=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b,c){return b=new Date,c&&c.rel&&b.setDate(b.getDate()+c.rel),this.normalize(b,c)},c.prototype.navigate=function(a,c,d){var e,f,g,h,i=b.isArray(c),j=b.isPlainObject(c),k=this.item.view;if(i||j){for(j?(f=c.year,g=c.month,h=c.date):(f=+c[0],g=+c[1],h=+c[2]),d&&d.nav&&k&&k.month!==g&&(f=k.year,g=k.month),e=new Date(f,g+(d&&d.nav?d.nav:0),1),f=e.getFullYear(),g=e.getMonth();new Date(f,g,h).getMonth()!==g;)h-=1;c=[f,g,h]}return c},c.prototype.normalize=function(a){return a.setHours(0,0,0,0),a},c.prototype.measure=function(a,b){var c=this;return b?"string"==typeof b?b=c.parse(a,b):f.isInteger(b)&&(b=c.now(a,b,{rel:b})):b="min"==a?-(1/0):1/0,b},c.prototype.viewset=function(a,b){return this.create([b.year,b.month,1])},c.prototype.validate=function(a,c,d){var e,g,h,i,j=this,k=c,l=d&&d.interval?d.interval:1,m=-1===j.item.enable,n=j.item.min,o=j.item.max,p=m&&j.item.disable.filter(function(a){if(b.isArray(a)){var d=j.create(a).pick;dc.pick&&(g=!0)}return f.isInteger(a)}).length;if((!d||!d.nav&&!d.defaultValue)&&(!m&&j.disabled(c)||m&&j.disabled(c)&&(p||e||g)||!m&&(c.pick<=n.pick||c.pick>=o.pick)))for(m&&!p&&(!g&&l>0||!e&&0>l)&&(l*=-1);j.disabled(c)&&(Math.abs(l)>1&&(c.monthk.month)&&(c=k,l=l>0?1:-1),c.pick<=n.pick?(h=!0,l=1,c=j.create([n.year,n.month,n.date+(c.pick===n.pick?0:-1)])):c.pick>=o.pick&&(i=!0,l=-1,c=j.create([o.year,o.month,o.date+(c.pick===o.pick?0:1)])),!h||!i);)c=j.create([c.year,c.month,c.date+l]);return c},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return f.isInteger(d)?a.day===(c.settings.firstDay?d:d-1)%7:b.isArray(d)||f.isDate(d)?a.pick===c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[3]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pickc.item.max.pick},c.prototype.parse=function(a,b,c){var d=this,e={};return b&&"string"==typeof b?(c&&c.format||(c=c||{},c.format=d.settings.format),d.formats.toArray(c.format).map(function(a){var c=d.formats[a],g=c?f.trigger(c,d,[b,e]):a.replace(/^!/,"").length;c&&(e[a]=b.substr(0,g)),b=b.substr(g)}),[e.yyyy||e.yy,+(e.mm||e.m)-1,e.dd||e.d]):b},c.prototype.formats=function(){function a(a,b,c){var d=a.match(/[^\x00-\x7F]+|\w+/)[0];return c.mm||c.m||(c.m=b.indexOf(d)+1),d.length}function b(a){return a.match(/\w+/)[0].length}return{d:function(a,b){return a?f.digits(a):b.date},dd:function(a,b){return a?2:f.lead(b.date)},ddd:function(a,c){return a?b(a):this.settings.weekdaysShort[c.day]},dddd:function(a,c){return a?b(a):this.settings.weekdaysFull[c.day]},m:function(a,b){return a?f.digits(a):b.month+1},mm:function(a,b){return a?2:f.lead(b.month+1)},mmm:function(b,c){var d=this.settings.monthsShort;return b?a(b,d,c):d[c.month]},mmmm:function(b,c){var d=this.settings.monthsFull;return b?a(b,d,c):d[c.month]},yy:function(a,b){return a?2:(""+b.year).slice(2)},yyyy:function(a,b){return a?4:b.year},toArray:function(a){return a.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return f.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}}}(),c.prototype.isDateExact=function(a,c){var d=this;return f.isInteger(a)&&f.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(f.isDate(a)||b.isArray(a))&&(f.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:b.isPlainObject(a)&&b.isPlainObject(c)?d.isDateExact(a.from,c.from)&&d.isDateExact(a.to,c.to):!1},c.prototype.isDateOverlap=function(a,c){var d=this,e=d.settings.firstDay?1:0;return f.isInteger(a)&&(f.isDate(c)||b.isArray(c))?(a=a%7+e,a===d.create(c).day+1):f.isInteger(c)&&(f.isDate(a)||b.isArray(a))?(c=c%7+e,c===d.create(a).day+1):b.isPlainObject(a)&&b.isPlainObject(c)?d.overlapRanges(a,c):!1},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,e=d.item.disable.slice(0);return"flip"==c?d.flipEnable():c===!1?(d.flipEnable(1),e=[]):c===!0?(d.flipEnable(-1),e=[]):c.map(function(a){for(var c,g=0;gi;i+=1){if(h=e[i],d.isDateExact(h,a)){c=e[i]=null,j=!0;break}if(d.isDateOverlap(h,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[3]||c.push("inverted")):f.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;g>i;i+=1)if(d.isDateExact(e[i],a)){e[i]=null;break}if(j)for(i=0;g>i;i+=1)if(d.isDateOverlap(e[i],a)){e[i]=null;break}c&&e.push(c)}),e.filter(function(a){return null!=a})},c.prototype.nodes=function(a){var b=this,c=b.settings,g=b.item,h=g.now,i=g.select,j=g.highlight,k=g.view,l=g.disable,m=g.min,n=g.max,o=function(a,b){return c.firstDay&&(a.push(a.shift()),b.push(b.shift())),f.node("thead",f.node("tr",f.group({min:0,max:d-1,i:1,node:"th",item:function(d){return[a[d],c.klass.weekdays,'scope=col title="'+b[d]+'"']}})))}((c.showWeekdaysFull?c.weekdaysFull:c.weekdaysShort).slice(0),c.weekdaysFull.slice(0)),p=function(a){return f.node("div"," ",c.klass["nav"+(a?"Next":"Prev")]+(a&&k.year>=n.year&&k.month>=n.month||!a&&k.year<=m.year&&k.month<=m.month?" "+c.klass.navDisabled:""),"data-nav="+(a||-1)+" "+f.ariaAttr({role:"button",controls:b.$node[0].id+"_table"})+' title="'+(a?c.labelMonthNext:c.labelMonthPrev)+'"')},q=function(){var d=c.showMonthsShort?c.monthsShort:c.monthsFull;return c.selectMonths?f.node("select",f.group({min:0,max:11,i:1,node:"option",item:function(a){return[d[a],0,"value="+a+(k.month==a?" selected":"")+(k.year==m.year&&an.month?" disabled":"")]}}),c.klass.selectMonth,(a?"":"disabled")+" "+f.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelMonthSelect+'"'):f.node("div",d[k.month],c.klass.month)},r=function(){var d=k.year,e=c.selectYears===!0?5:~~(c.selectYears/2);if(e){var g=m.year,h=n.year,i=d-e,j=d+e;if(g>i&&(j+=g-i,i=g),j>h){var l=i-g,o=j-h;i-=l>o?o:l,j=h}return f.node("select",f.group({min:i,max:j,i:1,node:"option",item:function(a){return[a,0,"value="+a+(d==a?" selected":"")]}}),c.klass.selectYear,(a?"":"disabled")+" "+f.ariaAttr({controls:b.$node[0].id+"_table"})+' title="'+c.labelYearSelect+'"')}return f.node("div",d,c.klass.year)};return f.node("div",(c.selectYears?r()+q():q()+r())+p()+p(1),c.klass.header)+f.node("table",o+f.node("tbody",f.group({min:0,max:e-1,i:1,node:"tr",item:function(a){var e=c.firstDay&&0===b.create([k.year,k.month,1]).day?-7:0;return[f.group({min:d*a-k.day+e+1,max:function(){return this.min+d-1},i:1,node:"td",item:function(a){a=b.create([k.year,k.month,a+(c.firstDay?1:0)]);var d=i&&i.pick==a.pick,e=j&&j.pick==a.pick,g=l&&b.disabled(a)||a.pickn.pick,o=f.trigger(b.formats.toString,b,[c.format,a]);return[f.node("div",a.date,function(b){return b.push(k.month==a.month?c.klass.infocus:c.klass.outfocus),h.pick==a.pick&&b.push(c.klass.now),d&&b.push(c.klass.selected),e&&b.push(c.klass.highlighted),g&&b.push(c.klass.disabled),b.join(" ")}([c.klass.day]),"data-pick="+a.pick+" "+f.ariaAttr({role:"gridcell",label:o,selected:d&&b.$node.val()===o?!0:null,activedescendant:e?!0:null,disabled:g?!0:null})),"",f.ariaAttr({role:"presentation"})]}})]}})),c.klass.table,'id="'+b.$node[0].id+'_table" '+f.ariaAttr({role:"grid",controls:b.$node[0].id,readonly:!0}))+f.node("div",f.node("button",c.today,c.klass.buttonToday,"type=button data-pick="+h.pick+(a&&!b.disabled(h)?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id}))+f.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id}))+f.node("button",c.close,c.klass.buttonClose,"type=button data-close=true "+(a?"":" disabled")+" "+f.ariaAttr({controls:b.$node[0].id})),c.klass.footer)},c.defaults=function(a){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:a+"table",header:a+"header",navPrev:a+"nav--prev",navNext:a+"nav--next",navDisabled:a+"nav--disabled",month:a+"month",year:a+"year",selectMonth:a+"select--month",selectYear:a+"select--year",weekdays:a+"weekday",day:a+"day",disabled:a+"day--disabled",selected:a+"day--selected",highlighted:a+"day--highlighted",now:a+"day--today",infocus:a+"day--infocus",outfocus:a+"day--outfocus",footer:a+"footer",buttonClear:a+"button--clear",buttonToday:a+"button--today",buttonClose:a+"button--close"}}}(a.klasses().picker+"__"),a.extend("pickadate",c)}); // English jQuery.extend(jQuery.fn.pickadate.defaults, { monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], today: 'Today', clear: 'Clear', close: 'Close', firstDay: 1, format: 'd mmmm, yyyy', formatSubmit: undefined, labelMonthNext: 'Next month', labelMonthPrev: 'Previous month', labelMonthSelect: 'Select a month', labelYearSelect: 'Select a year' }); if (typeof jQuery.fn.pickatime != 'undefined') { jQuery.extend(jQuery.fn.pickatime.defaults, { clear: 'Clear' }); } !function(a){"function"==typeof define&&define.amd?define(["picker","jquery"],a):"object"==typeof exports?module.exports=a(require("./picker.js"),require("jquery")):a(Picker,jQuery)}(function(a,b){function c(a,b){var c=this,d=a.$node[0].value,e=a.$node.data("value"),f=e||d,g=e?b.formatSubmit:b.format;c.settings=b,c.$node=a.$node,c.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},c.item={},c.item.clear=null,c.item.interval=b.interval||30,c.item.disable=(b.disable||[]).slice(0),c.item.enable=-function(a){return a[0]===!0?a.shift():-1}(c.item.disable),c.set("min",b.min).set("max",b.max).set("now"),f?c.set("select",f,{format:g}):c.set("select",null).set("highlight",c.item.now),c.key={40:1,38:-1,39:1,37:-1,go:function(a){c.set("highlight",c.item.highlight.pick+a*c.item.interval,{interval:a*c.item.interval}),this.render()}},a.on("render",function(){var c=a.$root.children(),d=c.find("."+b.klass.viewset),e=function(a){return["webkit","moz","ms","o",""].map(function(b){return(b?"-"+b+"-":"")+a})},f=function(a,b){e("transform").map(function(c){a.css(c,b)}),e("transition").map(function(c){a.css(c,b)})};d.length&&(f(c,"none"),c[0].scrollTop=~~d.position().top-2*d[0].clientHeight,f(c,""))},1).on("open",function(){a.$root.find("button").attr("disabled",!1)},1).on("close",function(){a.$root.find("button").attr("disabled",!0)},1)}var d=24,e=60,f=12,g=d*e,h=a._;c.prototype.set=function(a,b,c){var d=this,e=d.item;return null===b?("clear"==a&&(a="select"),e[a]=b,d):(e["enable"==a?"disable":"flip"==a?"enable":a]=d.queue[a].split(" ").map(function(e){return b=d[e](a,b,c)}).pop(),"select"==a?d.set("highlight",e.select,c):"highlight"==a?d.set("view",e.highlight,c):"interval"==a?d.set("min",e.min,c).set("max",e.max,c):a.match(/^(flip|min|max|disable|enable)$/)&&(e.select&&d.disabled(e.select)&&d.set("select",b,c),e.highlight&&d.disabled(e.highlight)&&d.set("highlight",b,c),"min"==a&&d.set("max",e.max,c)),d)},c.prototype.get=function(a){return this.item[a]},c.prototype.create=function(a,c,f){var i=this;return c=void 0===c?a:c,h.isDate(c)&&(c=[c.getHours(),c.getMinutes()]),b.isPlainObject(c)&&h.isInteger(c.pick)?c=c.pick:b.isArray(c)?c=+c[0]*e+ +c[1]:h.isInteger(c)||(c=i.now(a,c,f)),"max"==a&&c=a.from.pick&&b.pick<=a.to.pick},c.prototype.overlapRanges=function(a,b){var c=this;return a=c.createRange(a.from,a.to),b=c.createRange(b.from,b.to),c.withinRange(a,b.from)||c.withinRange(a,b.to)||c.withinRange(b,a.from)||c.withinRange(b,a.to)},c.prototype.now=function(a,b){var c,d=this.item.interval,f=new Date,g=f.getHours()*e+f.getMinutes(),i=h.isInteger(b);return g-=g%d,c=0>b&&-d>=d*b+g,g+="min"==a&&c?0:d,i&&(g+=d*(c&&"max"!=a?b+1:b)),g},c.prototype.normalize=function(a,b){var c=this.item.interval,d=this.item.min&&this.item.min.pick||0;return b-="min"==a?0:(b-d)%c},c.prototype.measure=function(a,c,f){var g=this;return c||(c="min"==a?[0,0]:[d-1,e-1]),"string"==typeof c?c=g.parse(a,c):c===!0||h.isInteger(c)?c=g.now(a,c,f):b.isPlainObject(c)&&h.isInteger(c.pick)&&(c=g.normalize(a,c.pick,f)),c},c.prototype.validate=function(a,b,c){var d=this,e=c&&c.interval?c.interval:d.item.interval;return d.disabled(b)&&(b=d.shift(b,e)),b=d.scope(b),d.disabled(b)&&(b=d.shift(b,-1*e)),b},c.prototype.disabled=function(a){var c=this,d=c.item.disable.filter(function(d){return h.isInteger(d)?a.hour==d:b.isArray(d)||h.isDate(d)?a.pick==c.create(d).pick:b.isPlainObject(d)?c.withinRange(d,a):void 0});return d=d.length&&!d.filter(function(a){return b.isArray(a)&&"inverted"==a[2]||b.isPlainObject(a)&&a.inverted}).length,-1===c.item.enable?!d:d||a.pickc.item.max.pick},c.prototype.shift=function(a,b){var c=this,d=c.item.min.pick,e=c.item.max.pick;for(b=b||c.item.interval;c.disabled(a)&&(a=c.create(a.pick+=b),!(a.pick<=d||a.pick>=e)););return a},c.prototype.scope=function(a){var b=this.item.min.pick,c=this.item.max.pick;return this.create(a.pick>c?c:a.pickb.time%g?"a.m.":"p.m."},A:function(a,b){return a?2:g/2>b.time%g?"AM":"PM"},toArray:function(a){return a.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(a,b){var c=this;return c.formats.toArray(a).map(function(a){return h.trigger(c.formats[a],c,[0,b])||a.replace(/^!/,"")}).join("")}},c.prototype.isTimeExact=function(a,c){var d=this;return h.isInteger(a)&&h.isInteger(c)||"boolean"==typeof a&&"boolean"==typeof c?a===c:(h.isDate(a)||b.isArray(a))&&(h.isDate(c)||b.isArray(c))?d.create(a).pick===d.create(c).pick:b.isPlainObject(a)&&b.isPlainObject(c)?d.isTimeExact(a.from,c.from)&&d.isTimeExact(a.to,c.to):!1},c.prototype.isTimeOverlap=function(a,c){var d=this;return h.isInteger(a)&&(h.isDate(c)||b.isArray(c))?a===d.create(c).hour:h.isInteger(c)&&(h.isDate(a)||b.isArray(a))?c===d.create(a).hour:b.isPlainObject(a)&&b.isPlainObject(c)?d.overlapRanges(a,c):!1},c.prototype.flipEnable=function(a){var b=this.item;b.enable=a||(-1==b.enable?1:-1)},c.prototype.deactivate=function(a,c){var d=this,e=d.item.disable.slice(0);return"flip"==c?d.flipEnable():c===!1?(d.flipEnable(1),e=[]):c===!0?(d.flipEnable(-1),e=[]):c.map(function(a){for(var c,f=0;fi;i+=1){if(g=e[i],d.isTimeExact(g,a)){c=e[i]=null,j=!0;break}if(d.isTimeOverlap(g,a)){b.isPlainObject(a)?(a.inverted=!0,c=a):b.isArray(a)?(c=a,c[2]||c.push("inverted")):h.isDate(a)&&(c=[a.getFullYear(),a.getMonth(),a.getDate(),"inverted"]);break}}if(c)for(i=0;f>i;i+=1)if(d.isTimeExact(e[i],a)){e[i]=null;break}if(j)for(i=0;f>i;i+=1)if(d.isTimeOverlap(e[i],a)){e[i]=null;break}c&&e.push(c)}),e.filter(function(a){return null!=a})},c.prototype.i=function(a,b){return h.isInteger(b)&&b>0?b:this.item.interval},c.prototype.nodes=function(a){var b=this,c=b.settings,d=b.item.select,e=b.item.highlight,f=b.item.view,g=b.item.disable;return h.node("ul",h.group({min:b.item.min.pick,max:b.item.max.pick,i:b.item.interval,node:"li",item:function(a){a=b.create(a);var i=a.pick,j=d&&d.pick==i,k=e&&e.pick==i,l=g&&b.disabled(a),m=h.trigger(b.formats.toString,b,[c.format,a]);return[h.trigger(b.formats.toString,b,[h.trigger(c.formatLabel,b,[a])||c.format,a]),function(a){return j&&a.push(c.klass.selected),k&&a.push(c.klass.highlighted),f&&f.pick==i&&a.push(c.klass.viewset),l&&a.push(c.klass.disabled),a.join(" ")}([c.klass.listItem]),"data-pick="+a.pick+" "+h.ariaAttr({role:"option",label:m,selected:j&&b.$node.val()===m?!0:null,activedescendant:k?!0:null,disabled:l?!0:null})]}})+h.node("li",h.node("button",c.clear,c.klass.buttonClear,"type=button data-clear=1"+(a?"":" disabled")+" "+h.ariaAttr({controls:b.$node[0].id})),"",h.ariaAttr({role:"presentation"})),c.klass.list,h.ariaAttr({role:"listbox",controls:b.$node[0].id}))},c.defaults=function(a){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:a+" "+a+"--time",holder:a+"__holder",list:a+"__list",listItem:a+"__list-item",disabled:a+"__list-item--disabled",selected:a+"__list-item--selected",highlighted:a+"__list-item--highlighted",viewset:a+"__list-item--viewset",now:a+"__list-item--now",buttonClear:a+"__button--clear"}}}(a.klasses().picker),a.extend("pickatime",c)}); !function(a,b,c){"use strict";!function(b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(function(d){function e(a,b){return this.$element=d(a),b&&("string"===d.type(b.delay)||"number"===d.type(b.delay))&&(b.delay={show:b.delay,hide:b.delay}),this.options=d.extend({},i,b),this._defaults=i,this._name=f,this._targetclick=!1,this.init(),k.push(this.$element),this}var f="webuiPopover",g="webui-popover",h="webui.popover",i={placement:"auto",container:null,width:"auto",height:"auto",trigger:"click",style:"",selector:!1,delay:{show:null,hide:300},async:{type:"GET",before:null,success:null,error:null},cache:!0,multi:!1,arrow:!0,title:"",content:"",closeable:!1,padding:!0,url:"",type:"html",direction:"",animation:null,template:'

     

    ',backdrop:!1,dismissible:!0,onShow:null,onHide:null,abortXHR:!0,autoHide:!1,offsetTop:0,offsetLeft:0,iframeOptions:{frameborder:"0",allowtransparency:"true",id:"",name:"",scrolling:"",onload:"",height:"",width:""},hideEmpty:!1},j=g+"-rtl",k=[],l=d('
    '),m=0,n=!1,o=-2e3,p=d(b),q=function(a,b){return isNaN(a)?b||0:Number(a)},r=function(a){return a.data("plugin_"+f)},s=function(){for(var a=null,b=0;b").attr("src",this.getUrl()),b=this;return d.each(this._defaults.iframeOptions,function(c){"undefined"!=typeof b.options.iframeOptions[c]&&a.attr(c,b.options.iframeOptions[c])}),a},getContent:function(){if(this.getUrl())switch(this.options.type){case"iframe":this.content=this.getIframe();break;case"html":try{this.content=d(this.getUrl()),this.content.is(":visible")||this.content.show()}catch(a){throw new Error("Unable to get popover content. Invalid selector specified.")}}else if(!this.content){var b="";if(b=d.isFunction(this.options.content)?this.options.content.apply(this.$element[0],[this]):this.options.content,this.content=this.$element.attr("data-content")||b,!this.content){var c=this.$element.next();c&&c.hasClass(g+"-content")&&(this.content=c)}}return this.content},setContent:function(a){var b=this.getTarget(),c=this.getContentElement();"string"==typeof a?c.html(a):a instanceof d&&(c.html(""),this.options.cache?a.removeClass(g+"-content").appendTo(c):a.clone(!0,!0).removeClass(g+"-content").appendTo(c)),this.$target=b},isAsync:function(){return"async"===this.options.type},setContentASync:function(a){var b=this;this.xhr||(this.xhr=d.ajax({url:this.getUrl(),type:this.options.async.type,cache:this.getCache(),beforeSend:function(a,c){b.options.async.before&&b.options.async.before(b,a,c)},success:function(c){b.bindBodyEvents(),a&&d.isFunction(a)?b.content=a.apply(b.$element[0],[c]):b.content=c,b.setContent(b.content);var e=b.getContentElement();e.removeAttr("style"),b.displayContent(),b.options.async.success&&b.options.async.success(b,c)},complete:function(){b.xhr=null},error:function(a,c){b.options.async.error&&b.options.async.error(b,a,c)}}))},bindBodyEvents:function(){n||(this.options.dismissible&&"click"===this.getTrigger()?u?p.off("touchstart.webui-popover").on("touchstart.webui-popover",d.proxy(this.bodyTouchStartHandler,this)):(p.off("keyup.webui-popover").on("keyup.webui-popover",d.proxy(this.escapeHandler,this)),p.off("click.webui-popover").on("click.webui-popover",d.proxy(this.bodyClickHandler,this))):"hover"===this.getTrigger()&&p.off("touchend.webui-popover").on("touchend.webui-popover",d.proxy(this.bodyClickHandler,this)))},mouseenterHandler:function(a){var b=this;a&&this.options.selector&&(b=this.delegate(a.currentTarget)),b._timeout&&clearTimeout(b._timeout),b._enterTimeout=setTimeout(function(){b.getTarget().is(":visible")||b.show()},this.getDelayShow())},mouseleaveHandler:function(){var a=this;clearTimeout(a._enterTimeout),a._timeout=setTimeout(function(){a.hide()},this.getHideDelay())},escapeHandler:function(a){27===a.keyCode&&this.hideAll()},bodyTouchStartHandler:function(a){var b=this,c=d(a.currentTarget);c.on("touchend",function(a){b.bodyClickHandler(a),c.off("touchend")}),c.on("touchmove",function(){c.off("touchend")})},bodyClickHandler:function(a){n=!0;for(var b=!0,c=0;c=f&&j.x<=h&&j.y>=g&&j.y<=i;if(l){b=!1;break}}}b&&s()},initTargetEvents:function(){"hover"===this.getTrigger()&&this.$target.off("mouseenter mouseleave").on("mouseenter",d.proxy(this.mouseenterHandler,this)).on("mouseleave",d.proxy(this.mouseleaveHandler,this)),this.$target.find(".close").off("click").on("click",d.proxy(this.hide,this,!0))},getPlacement:function(a){var b,c=this.options.container,d=c.innerWidth(),e=c.innerHeight(),f=c.scrollTop(),g=c.scrollLeft(),h=Math.max(0,a.left-g),i=Math.max(0,a.top-f);b="function"==typeof this.options.placement?this.options.placement.call(this,this.getTarget()[0],this.$element[0]):this.$element.data("placement")||this.options.placement;var j="horizontal"===b,k="vertical"===b,l="auto"===b||j||k;return l?b=d/3>h?e/3>i?j?"right-bottom":"bottom-right":2*e/3>i?k?e/2>=i?"bottom-right":"top-right":"right":j?"right-top":"top-right":2*d/3>h?e/3>i?j?d/2>=h?"right-bottom":"left-bottom":"bottom":2*e/3>i?j?d/2>=h?"right":"left":e/2>=i?"bottom":"top":j?d/2>=h?"right-top":"left-top":"top":e/3>i?j?"left-bottom":"bottom-left":2*e/3>i?k?e/2>=i?"bottom-left":"top-left":"left":j?"left-top":"top-left":"auto-top"===b?b=d/3>h?"top-right":2*d/3>h?"top":"top-left":"auto-bottom"===b?b=d/3>h?"bottom-right":2*d/3>h?"bottom":"bottom-left":"auto-left"===b?b=e/3>i?"left-top":2*e/3>i?"left":"left-bottom":"auto-right"===b&&(b=e/3>i?"right-bottom":2*e/3>i?"right":"right-top"),b},getElementPosition:function(){var a=this.$element[0].getBoundingClientRect(),c=this.options.container,e=c.css("position");if(c.is(b.body)||"static"===e)return d.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth||a.width,height:this.$element[0].offsetHeight||a.height});if("fixed"===e){var f=c[0].getBoundingClientRect();return{top:a.top-f.top+c.scrollTop(),left:a.left-f.left+c.scrollLeft(),width:a.width,height:a.height}}return"relative"===e?{top:this.$element.offset().top-c.offset().top,left:this.$element.offset().left-c.offset().left,width:this.$element[0].offsetWidth||a.width,height:this.$element[0].offsetHeight||a.height}:void 0},getTargetPositin:function(a,c,d,e){var f=a,g=this.options.container,h=this.$element.outerWidth(),i=this.$element.outerHeight(),j=b.documentElement.scrollTop+g.scrollTop(),k=b.documentElement.scrollLeft+g.scrollLeft(),l={},m=null,n=this.options.arrow?20:0,p=10,q=n+p>h?n:0,r=n+p>i?n:0,s=0,t=b.documentElement.clientHeight+j,u=b.documentElement.clientWidth+k,v=f.left+f.width/2-q>0,w=f.left+f.width/2+q0,y=f.top+f.height/2+re){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); function scaleCaptcha(t){jQuery(".g-recaptcha").each(function(t){var e=jQuery(this).parent(".recaptcha-wrapper"),i=1,h=e.width(),a=e.height();h<200?(h=200,e.css({"min-width":"200px","min-height":"60px"})):a<78&&(a=78,e.css("min-height","78px")),304>h?(i=h/304,jQuery(this).css({position:"absolute",width:h,height:78,transform:"scale("+i+")"})):jQuery(".g-recaptcha").css({position:"inherit",width:"auto",height:"auto",transform:"scale(1)"}),e.css({"min-height":78*i})})}jQuery(document).ready(function(t){t(window).resize(t.throttle(100,scaleCaptcha))}); !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('
      ');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('
    • '),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[aria-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("aria-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&b.data("element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html(''),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('
        '),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('
      • ×
      • ')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e0||0===c.length)){var d=a('×');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var b=e.$searchContainer.prev(".select2-selection__choice");if(b.length>0){var d=b.data("data");e.searchRemoveChoice(d),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(g)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('
      • '),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a(""),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.topf.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c}); (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})(); (function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})(); !function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i0&&(c=j().get(d[0].id)))return c.getContent()},c=function(a){var b=null;return a&&a.id&&h.tinymce&&(b=j().get(a.id)),b},e=function(a){return!!(a&&a.length&&h.tinymce&&a.is(":tinymce"))},f={};g.each(["text","html","val"],function(a,h){var i=f[h]=g.fn[h],j="text"===h;g.fn[h]=function(a){var f=this;if(!e(f))return i.apply(f,arguments);if(a!==d)return b.call(f.filter(":tinymce"),a),i.apply(f.not(":tinymce"),arguments),f;var h="",k=arguments;return(j?f:f.eq(0)).each(function(a,b){var d=c(b);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(g(b),k)}),h}}),g.each(["append","prepend"],function(a,b){var h=f[b]=g.fn[b],i="prepend"===b;g.fn[b]=function(a){var b=this;return e(b)?a!==d?("string"==typeof a&&b.filter(":tinymce").each(function(b,d){var e=c(d);e&&e.setContent(i?a+e.getContent():e.getContent()+a)}),h.apply(b.not(":tinymce"),arguments),b):void 0:h.apply(b,arguments)}}),g.each(["remove","replaceWith","replaceAll","empty"],function(b,c){var d=f[c]=g.fn[c];g.fn[c]=function(){return a.call(this,c),d.apply(this,arguments)}}),f.attr=g.fn.attr,g.fn.attr=function(a,h){var i=this,j=arguments;if(!a||"value"!==a||!e(i))return h!==d?f.attr.apply(i,j):f.attr.apply(i,j);if(h!==d)return b.call(i.filter(":tinymce"),h),f.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=c(k);return l?l.getContent({save:!0}):f.attr.apply(g(k),j)}}}}),d("0")()}(); !function(t){t.fn.wordCharCountTinyMce=function(e,r){var a=t.extend({wordCount:!0,characterCount:!0,maxAuthorized:200,wordText:"word(s)",characterText:"character(s)",className:"text-primary",errorClassName:"text-danger"},r),n=t(e,window.parent.document).attr("ID"),o='

        ';a.wordCount===!0&&(o+='0 '+a.wordText,a.characterCount===!0&&(o+=" | ")),a.characterCount===!0&&(o+='0 '+a.characterText),o+=" / "+a.maxAuthorized,t('

        ').html(o).insertAfter(t(e,window.parent.document)),t(this).keyup(function(e){var r=t(this).text().length,o=jQuery.trim(t(this).text()).split(" ").length;""===t(this).text()&&(o=0),t("#word-count"+n,window.parent.document)[0]&&t("#word-count"+n,window.parent.document).text(o),t("#char-count"+n,window.parent.document)[0]&&t("#char-count"+n,window.parent.document).text(r),a.characterCount===!1?o>a.maxAuthorized?t("#p-"+n,window.parent.document).addClass(a.errorClassName):t("#p-"+n,window.parent.document).hasClass(a.errorClassName)&&t("#p-"+n,window.parent.document).removeClass(a.errorClassName):r>a.maxAuthorized?t("#p-"+n,window.parent.document).addClass(a.errorClassName):t("#p-"+n,window.parent.document).hasClass(a.errorClassName)&&t("#p-"+n,window.parent.document).removeClass(a.errorClassName)}),t(this).trigger("keyup")}}(jQuery); !function(a,b,c){!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)}(function(d){"use strict";function e(a,b,c,e){this.id=c,this.target=a,this.tooltip=D,this.elements={target:a},this._id=Q+"-"+c,this.timers={img:{}},this.options=b,this.plugins={},this.cache={event:{},target:d(),disabled:C,attr:e,onTooltip:C,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=C}function f(a){return a===D||"object"!==d.type(a)}function g(a){return!(d.isFunction(a)||a&&a.attr||a.length||"object"===d.type(a)&&(a.jquery||a.then))}function h(a){var b,c,e,h;return f(a)?C:(f(a.metadata)&&(a.metadata={type:a.metadata}),"content"in a&&(b=a.content,f(b)||b.jquery||b.done?(c=g(b)?C:b,b=a.content={text:c}):c=b.text,"ajax"in b&&(e=b.ajax,h=e&&e.once!==C,delete b.ajax,b.text=function(a,b){var f=c||d(this).attr(b.options.content.attr)||"Loading...",g=d.ajax(d.extend({},e,{context:b})).then(e.success,D,e.error).then(function(a){return a&&h&&b.set("content.text",a),a},function(a,c,d){b.destroyed||0===a.status||b.set("content.text",c+": "+d)});return h?f:(b.set("content.text",f),g)}),"title"in b&&(d.isPlainObject(b.title)&&(b.button=b.title.button,b.title=b.title.text),g(b.title||C)&&(b.title=C))),"position"in a&&f(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&f(a.show)&&(a.show=a.show.jquery?{target:a.show}:a.show===B?{ready:B}:{event:a.show}),"hide"in a&&f(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&f(a.style)&&(a.style={classes:a.style}),d.each(P,function(){this.sanitize&&this.sanitize(a)}),a)}function i(a,b){for(var c,d=0,e=a,f=b.split(".");e=e[f[d++]];)d0?setTimeout(d.proxy(a,this),b):void a.call(this)}function m(a){this.tooltip.hasClass($)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=l.call(this,function(){this.toggle(B,a)},this.options.show.delay))}function n(a){if(!this.tooltip.hasClass($)&&!this.destroyed){var b=d(a.relatedTarget),c=b.closest(U)[0]===this.tooltip[0],e=b[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==b[0]&&"mouse"===this.options.position.target&&c||this.options.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(c||e))try{a.preventDefault(),a.stopImmediatePropagation()}catch(f){}else this.timers.hide=l.call(this,function(){this.toggle(C,a)},this.options.hide.delay,this)}}function o(a){!this.tooltip.hasClass($)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=l.call(this,function(){this.hide(a)},this.options.hide.inactive))}function p(a){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(a)}function q(a,c,e){d(b.body).delegate(a,(c.split?c:c.join("."+Q+" "))+"."+Q,function(){var a=w.api[d.attr(this,S)];a&&!a.disabled&&e.apply(a,arguments)})}function r(a,c,f){var g,i,j,k,l,m=d(b.body),n=a[0]===b?m:a,o=a.metadata?a.metadata(f.metadata):D,p="html5"===f.metadata.type&&o?o[f.metadata.name]:D,q=a.data(f.metadata.name||"qtipopts");try{q="string"==typeof q?d.parseJSON(q):q}catch(r){}if(k=d.extend(B,{},w.defaults,f,"object"==typeof q?h(q):D,h(p||o)),i=k.position,k.id=c,"boolean"==typeof k.content.text){if(j=a.attr(k.content.attr),k.content.attr===C||!j)return C;k.content.text=j}if(i.container.length||(i.container=m),i.target===C&&(i.target=n),k.show.target===C&&(k.show.target=n),k.show.solo===B&&(k.show.solo=i.container.closest("body")),k.hide.target===C&&(k.hide.target=n),k.position.viewport===B&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new y(i.at,B),i.my=new y(i.my),a.data(Q))if(k.overwrite)a.qtip("destroy",!0);else if(k.overwrite===C)return C;return a.attr(R,c),k.suppress&&(l=a.attr("title"))&&a.removeAttr("title").attr(aa,l).attr("title",""),g=new e(a,k,c,!!j),a.data(Q,g),g}function s(a){return a.charAt(0).toUpperCase()+a.slice(1)}function t(a,b){var d,e,f=b.charAt(0).toUpperCase()+b.slice(1),g=(b+" "+ta.join(f+" ")+f).split(" "),h=0;if(sa[b])return a.css(sa[b]);for(;d=g[h++];)if((e=a.css(d))!==c)return sa[b]=d,e}function u(a,b){return Math.ceil(parseFloat(t(a,b)))}function v(a,b){this._ns="tip",this.options=b,this.offset=b.offset,this.size=[b.width,b.height],this.qtip=a,this.init(a)}var w,x,y,z,A,B=!0,C=!1,D=null,E="x",F="y",G="width",H="height",I="top",J="left",K="bottom",L="right",M="center",N="flipinvert",O="shift",P={},Q="qtip",R="data-hasqtip",S="data-qtip-id",T=["ui-widget","ui-tooltip"],U="."+Q,V="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),W=Q+"-fixed",X=Q+"-default",Y=Q+"-focus",Z=Q+"-hover",$=Q+"-disabled",_="_replacedByqTip",aa="oldtitle",ba={ie:function(){var a,c;for(a=4,c=b.createElement("div");(c.innerHTML="")&&c.getElementsByTagName("i")[0];a+=1);return a>4?a:NaN}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||C};x=e.prototype,x._when=function(a){return d.when.apply(d,a)},x.render=function(a){if(this.rendered||this.destroyed)return this;var b=this,c=this.options,e=this.cache,f=this.elements,g=c.content.text,h=c.content.title,i=c.content.button,j=c.position,k=[];return d.attr(this.target[0],"aria-describedby",this._id),e.posClass=this._createPosClass((this.position={my:j.my,at:j.at}).my),this.tooltip=f.tooltip=d("
        ",{id:this._id,"class":[Q,X,c.style.classes,e.posClass].join(" "),width:c.style.width||"",height:c.style.height||"",tracking:"mouse"===j.target&&j.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":C,"aria-describedby":this._id+"-content","aria-hidden":B}).toggleClass($,this.disabled).attr(S,this.id).data(Q,this).appendTo(j.container).append(f.content=d("
        ",{"class":Q+"-content",id:this._id+"-content","aria-atomic":B})),this.rendered=-1,this.positioning=B,h&&(this._createTitle(),d.isFunction(h)||k.push(this._updateTitle(h,C))),i&&this._createButton(),d.isFunction(g)||k.push(this._updateContent(g,C)),this.rendered=B,this._setWidget(),d.each(P,function(a){var c;"render"===this.initialize&&(c=this(b))&&(b.plugins[a]=c)}),this._unassignEvents(),this._assignEvents(),this._when(k).then(function(){b._trigger("render"),b.positioning=C,b.hiddenDuringWait||!c.show.ready&&!a||b.toggle(B,e.event,C),b.hiddenDuringWait=C}),w.api[this.id]=this,this},x.destroy=function(a){function b(){if(!this.destroyed){this.destroyed=B;var a,b=this.target,c=b.attr(aa);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),d.each(this.plugins,function(){this.destroy&&this.destroy()});for(a in this.timers)this.timers.hasOwnProperty(a)&&clearTimeout(this.timers[a]);b.removeData(Q).removeAttr(S).removeAttr(R).removeAttr("aria-describedby"),this.options.suppress&&c&&b.attr("title",c).removeAttr(aa),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=D,delete w.api[this.id]}}return this.destroyed?this.target:(a===B&&"hide"!==this.triggering||!this.rendered?b.call(this):(this.tooltip.one("tooltiphidden",d.proxy(b,this)),!this.triggering&&this.hide()),this.target)},z=x.checks={builtin:{"^id$":function(a,b,c,e){var f=c===B?w.nextid:c,g=Q+"-"+f;f!==C&&f.length>0&&!d("#"+g).length?(this._id=g,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):a[b]=e},"^prerender":function(a,b,c){c&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(a,b,c){this._updateContent(c)},"^content.attr$":function(a,b,c,d){this.options.content.text===this.target.attr(d)&&this._updateContent(this.target.attr(c))},"^content.title$":function(a,b,c){return c?(c&&!this.elements.title&&this._createTitle(),void this._updateTitle(c)):this._removeTitle()},"^content.button$":function(a,b,c){this._updateButton(c)},"^content.title.(text|button)$":function(a,b,c){this.set("content."+b,c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(this.position[b]=a[b]=new y(c,"at"===b))},"^position.container$":function(a,b,c){this.rendered&&this.tooltip.appendTo(c)},"^show.ready$":function(a,b,c){c&&(!this.rendered&&this.render(B)||this.toggle(B))},"^style.classes$":function(a,b,c,d){this.rendered&&this.tooltip.removeClass(d).addClass(c)},"^style.(width|height)":function(a,b,c){this.rendered&&this.tooltip.css(b,c)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(a,b,c){this.rendered&&this.tooltip.toggleClass(X,!!c)},"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){this.rendered&&this.tooltip[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var a=this.options.position;this.tooltip.attr("tracking","mouse"===a.target&&a.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},x.get=function(a){if(this.destroyed)return this;var b=i(this.options,a.toLowerCase()),c=b[0][b[1]];return c.precedance?c.string():c};var ca=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,da=/^prerender|show\.ready/i;x.set=function(a,b){if(this.destroyed)return this;var c,e=this.rendered,f=C,g=this.options;return"string"==typeof a?(c=a,a={},a[c]=b):a=d.extend({},a),d.each(a,function(b,c){if(e&&da.test(b))return void delete a[b];var h,j=i(g,b.toLowerCase());h=j[0][j[1]],j[0][j[1]]=c&&c.nodeType?d(c):c,f=ca.test(b)||f,a[b]=[j[0],j[1],c,h]}),h(g),this.positioning=B,d.each(a,d.proxy(j,this)),this.positioning=C,this.rendered&&this.tooltip[0].offsetWidth>0&&f&&this.reposition("mouse"===g.position.target?D:this.cache.event),this},x._update=function(a,b){var c=this,e=this.cache;return this.rendered&&a?(d.isFunction(a)&&(a=a.call(this.elements.target,e.event,this)||""),d.isFunction(a.then)?(e.waiting=B,a.then(function(a){return e.waiting=C,c._update(a,b)},D,function(a){return c._update(a,b)})):a===C||!a&&""!==a?C:(a.jquery&&a.length>0?b.empty().append(a.css({display:"block",visibility:"visible"})):b.html(a),this._waitForContent(b).then(function(a){c.rendered&&c.tooltip[0].offsetWidth>0&&c.reposition(e.event,!a.length)}))):C},x._waitForContent=function(a){var b=this.cache;return b.waiting=B,(d.fn.imagesLoaded?a.imagesLoaded():(new d.Deferred).resolve([])).done(function(){b.waiting=C}).promise()},x._updateContent=function(a,b){this._update(a,this.elements.content,b)},x._updateTitle=function(a,b){this._update(a,this.elements.title,b)===C&&this._removeTitle(C)},x._createTitle=function(){var a=this.elements,b=this._id+"-title";a.titlebar&&this._removeTitle(),a.titlebar=d("
        ",{"class":Q+"-titlebar "+(this.options.style.widget?k("header"):"")}).append(a.title=d("
        ",{id:b,"class":Q+"-title","aria-atomic":B})).insertBefore(a.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus","down"===a.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover","mouseover"===a.type)}),this.options.content.button&&this._createButton()},x._removeTitle=function(a){var b=this.elements;b.title&&(b.titlebar.remove(),b.titlebar=b.title=b.button=D,a!==C&&this.reposition())},x._createPosClass=function(a){return Q+"-pos-"+(a||this.options.position.my).abbrev()},x.reposition=function(c,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=B;var f,g,h,i,j=this.cache,k=this.tooltip,l=this.options.position,m=l.target,n=l.my,o=l.at,p=l.viewport,q=l.container,r=l.adjust,s=r.method.split(" "),t=k.outerWidth(C),u=k.outerHeight(C),v=0,w=0,x=k.css("position"),y={left:0,top:0},z=k[0].offsetWidth>0,A=c&&"scroll"===c.type,D=d(a),E=q[0].ownerDocument,F=this.mouse;if(d.isArray(m)&&2===m.length)o={x:J,y:I},y={left:m[0],top:m[1]};else if("mouse"===m)o={x:J,y:I},(!r.mouse||this.options.hide.distance)&&j.origin&&j.origin.pageX?c=j.origin:!c||c&&("resize"===c.type||"scroll"===c.type)?c=j.event:F&&F.pageX&&(c=F),"static"!==x&&(y=q.offset()),E.body.offsetWidth!==(a.innerWidth||E.documentElement.clientWidth)&&(g=d(b.body).offset()),y={left:c.pageX-y.left+(g&&g.left||0),top:c.pageY-y.top+(g&&g.top||0)},r.mouse&&A&&F&&(y.left-=(F.scrollX||0)-D.scrollLeft(),y.top-=(F.scrollY||0)-D.scrollTop());else{if("event"===m?c&&c.target&&"scroll"!==c.type&&"resize"!==c.type?j.target=d(c.target):c.target||(j.target=this.elements.target):"event"!==m&&(j.target=d(m.jquery?m:this.elements.target)),m=j.target,m=d(m).eq(0),0===m.length)return this;m[0]===b||m[0]===a?(v=ba.iOS?a.innerWidth:m.width(),w=ba.iOS?a.innerHeight:m.height(),m[0]===a&&(y={top:(p||m).scrollTop(),left:(p||m).scrollLeft()})):P.imagemap&&m.is("area")?f=P.imagemap(this,m,o,P.viewport?s:C):P.svg&&m&&m[0].ownerSVGElement?f=P.svg(this,m,o,P.viewport?s:C):(v=m.outerWidth(C),w=m.outerHeight(C),y=m.offset()),f&&(v=f.width,w=f.height,g=f.offset,y=f.position),y=this.reposition.offset(m,y,q),(ba.iOS>3.1&&ba.iOS<4.1||ba.iOS>=4.3&&ba.iOS<4.33||!ba.iOS&&"fixed"===x)&&(y.left-=D.scrollLeft(),y.top-=D.scrollTop()),(!f||f&&f.adjustable!==C)&&(y.left+=o.x===L?v:o.x===M?v/2:0,y.top+=o.y===K?w:o.y===M?w/2:0)}return y.left+=r.x+(n.x===L?-t:n.x===M?-t/2:0),y.top+=r.y+(n.y===K?-u:n.y===M?-u/2:0),P.viewport?(h=y.adjusted=P.viewport(this,y,l,v,w,t,u),g&&h.left&&(y.left+=g.left),g&&h.top&&(y.top+=g.top),h.my&&(this.position.my=h.my)):y.adjusted={left:0,top:0},j.posClass!==(i=this._createPosClass(this.position.my))&&(j.posClass=i,k.removeClass(j.posClass).addClass(i)),this._trigger("move",[y,p.elem||p],c)?(delete y.adjusted,e===C||!z||isNaN(y.left)||isNaN(y.top)||"mouse"===m||!d.isFunction(l.effect)?k.css(y):d.isFunction(l.effect)&&(l.effect.call(k,this,d.extend({},y)),k.queue(function(a){d(this).css({opacity:"",height:""}),ba.ie&&this.style.removeAttribute("filter"),a()})),this.positioning=C,this):this},x.reposition.offset=function(a,c,e){function f(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}if(!e[0])return c;var g,h,i,j,k=d(a[0].ownerDocument),l=!!ba.ie&&"CSS1Compat"!==b.compatMode,m=e[0];do"static"!==(h=d.css(m,"position"))&&("fixed"===h?(i=m.getBoundingClientRect(),f(k,-1)):(i=d(m).position(),i.left+=parseFloat(d.css(m,"borderLeftWidth"))||0,i.top+=parseFloat(d.css(m,"borderTopWidth"))||0),c.left-=i.left+(parseFloat(d.css(m,"marginLeft"))||0),c.top-=i.top+(parseFloat(d.css(m,"marginTop"))||0),g||"hidden"===(j=d.css(m,"overflow"))||"visible"===j||(g=d(m)));while(m=m.offsetParent);return g&&(g[0]!==k[0]||l)&&f(g,1),c};var ea=(y=x.reposition.Corner=function(a,b){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,M).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!b;var c=a.charAt(0);this.precedance="t"===c||"b"===c?F:E}).prototype;ea.invert=function(a,b){this[a]=this[a]===J?L:this[a]===L?J:b||this[a]},ea.string=function(a){var b=this.x,c=this.y,d=b!==c?"center"===b||"center"!==c&&(this.precedance===F||this.forceY)?[c,b]:[b,c]:[b];return a!==!1?d.join(" "):d},ea.abbrev=function(){var a=this.string(!1);return a[0].charAt(0)+(a[1]&&a[1].charAt(0)||"")},ea.clone=function(){return new y(this.string(),this.forceY)},x.toggle=function(a,c){var e=this.cache,f=this.options,g=this.tooltip;if(c){if(/over|enter/.test(c.type)&&e.event&&/out|leave/.test(e.event.type)&&f.show.target.add(c.target).length===f.show.target.length&&g.has(c.relatedTarget).length)return this;e.event=d.event.fix(c)}if(this.waiting&&!a&&(this.hiddenDuringWait=B),!this.rendered)return a?this.render(1):this;if(this.destroyed||this.disabled)return this;var h,i,j,k=a?"show":"hide",l=this.options[k],m=this.options.position,n=this.options.content,o=this.tooltip.css("width"),p=this.tooltip.is(":visible"),q=a||1===l.target.length,r=!c||l.target.length<2||e.target[0]===c.target;return(typeof a).search("boolean|number")&&(a=!p),h=!g.is(":animated")&&p===a&&r,i=h?D:!!this._trigger(k,[90]),this.destroyed?this:(i!==C&&a&&this.focus(c),!i||h?this:(d.attr(g[0],"aria-hidden",!a),a?(this.mouse&&(e.origin=d.event.fix(this.mouse)),d.isFunction(n.text)&&this._updateContent(n.text,C),d.isFunction(n.title)&&this._updateTitle(n.title,C),!A&&"mouse"===m.target&&m.adjust.mouse&&(d(b).bind("mousemove."+Q,this._storeMouse),A=B),o||g.css("width",g.outerWidth(C)),this.reposition(c,arguments[2]),o||g.css("width",""),l.solo&&("string"==typeof l.solo?d(l.solo):d(U,l.solo)).not(g).not(l.target).qtip("hide",new d.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete e.origin,A&&!d(U+'[tracking="true"]:visible',l.solo).not(g).length&&(d(b).unbind("mousemove."+Q),A=C),this.blur(c)),j=d.proxy(function(){a?(ba.ie&&g[0].style.removeAttribute("filter"),g.css("overflow",""),"string"==typeof l.autofocus&&d(this.options.show.autofocus,g).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):g.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(a?"visible":"hidden")},this),l.effect===C||q===C?(g[k](),j()):d.isFunction(l.effect)?(g.stop(1,1),l.effect.call(g,this),g.queue("fx",function(a){j(),a()})):g.fadeTo(90,a?1:0,j),a&&l.target.trigger("qtip-"+this.id+"-inactive"),this))},x.show=function(a){return this.toggle(B,a)},x.hide=function(a){return this.toggle(C,a)},x.focus=function(a){if(!this.rendered||this.destroyed)return this;var b=d(U),c=this.tooltip,e=parseInt(c[0].style.zIndex,10),f=w.zindex+b.length;return c.hasClass(Y)||this._trigger("focus",[f],a)&&(e!==f&&(b.each(function(){this.style.zIndex>e&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+Y).qtip("blur",a)),c.addClass(Y)[0].style.zIndex=f),this},x.blur=function(a){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(Y),this._trigger("blur",[this.tooltip.css("zIndex")],a),this)},x.disable=function(a){return this.destroyed?this:("toggle"===a?a=!(this.rendered?this.tooltip.hasClass($):this.disabled):"boolean"!=typeof a&&(a=B),this.rendered&&this.tooltip.toggleClass($,a).attr("aria-disabled",a),this.disabled=!!a,this)},x.enable=function(){return this.disable(C)},x._createButton=function(){var a=this,b=this.elements,c=b.tooltip,e=this.options.content.button,f="string"==typeof e,g=f?e:"Close tooltip";b.button&&b.button.remove(),e.jquery?b.button=e:b.button=d("",{"class":"qtip-close "+(this.options.style.widget?"":Q+"-icon"),title:g,"aria-label":g}).prepend(d("",{"class":"ui-icon ui-icon-close",html:"×"})),b.button.appendTo(b.titlebar||c).attr("role","button").click(function(b){return c.hasClass($)||a.hide(b),C})},x._updateButton=function(a){if(!this.rendered)return C;var b=this.elements.button;a?this._createButton():b.remove()},x._setWidget=function(){var a=this.options.style.widget,b=this.elements,c=b.tooltip,d=c.hasClass($);c.removeClass($),$=a?"ui-state-disabled":"qtip-disabled",c.toggleClass($,d),c.toggleClass("ui-helper-reset "+k(),a).toggleClass(X,this.options.style.def&&!a),b.content&&b.content.toggleClass(k("content"),a),b.titlebar&&b.titlebar.toggleClass(k("header"),a),b.button&&b.button.toggleClass(Q+"-icon",!a)},x._storeMouse=function(a){return(this.mouse=d.event.fix(a)).type="mousemove",this},x._bind=function(a,b,c,e,f){if(a&&c&&b.length){var g="."+this._id+(e?"-"+e:"");return d(a).bind((b.split?b:b.join(g+" "))+g,d.proxy(c,f||this)),this}},x._unbind=function(a,b){return a&&d(a).unbind("."+this._id+(b?"-"+b:"")),this},x._trigger=function(a,b,c){var e=new d.Event("tooltip"+a);return e.originalEvent=c&&d.extend({},c)||this.cache.event||D,this.triggering=a,this.tooltip.trigger(e,[this].concat(b||[])),this.triggering=C,!e.isDefaultPrevented()},x._bindEvents=function(a,b,c,e,f,g){var h=c.filter(e).add(e.filter(c)),i=[];h.length&&(d.each(b,function(b,c){var e=d.inArray(c,a);e>-1&&i.push(a.splice(e,1)[0])}),i.length&&(this._bind(h,i,function(a){var b=this.rendered?this.tooltip[0].offsetWidth>0:!1;(b?g:f).call(this,a)}),c=c.not(h),e=e.not(h))),this._bind(c,a,f),this._bind(e,b,g)},x._assignInitialEvents=function(a){function b(a){return this.disabled||this.destroyed?C:(this.cache.event=a&&d.event.fix(a),this.cache.target=a&&d(a.target),clearTimeout(this.timers.show),void(this.timers.show=l.call(this,function(){this.render("object"==typeof a||c.show.ready)},c.prerender?0:c.show.delay)))}var c=this.options,e=c.show.target,f=c.hide.target,g=c.show.event?d.trim(""+c.show.event).split(" "):[],h=c.hide.event?d.trim(""+c.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(c.show.event)&&!/mouse(out|leave)/i.test(c.hide.event)&&h.push("mouseleave"),this._bind(e,"mousemove",function(a){this._storeMouse(a),this.cache.onTarget=B}),this._bindEvents(g,h,e,f,b,function(){return this.timers?void clearTimeout(this.timers.show):C}),(c.show.ready||c.prerender)&&b.call(this,a)},x._assignEvents=function(){var c=this,e=this.options,f=e.position,g=this.tooltip,h=e.show.target,i=e.hide.target,j=f.container,k=f.viewport,l=d(b),q=d(a),r=e.show.event?d.trim(""+e.show.event).split(" "):[],s=e.hide.event?d.trim(""+e.hide.event).split(" "):[];d.each(e.events,function(a,b){c._bind(g,"toggle"===a?["tooltipshow","tooltiphide"]:["tooltip"+a],b,null,g)}),/mouse(out|leave)/i.test(e.hide.event)&&"window"===e.hide.leave&&this._bind(l,["mouseout","blur"],function(a){/select|option/.test(a.target.nodeName)||a.relatedTarget||this.hide(a)}),e.hide.fixed?i=i.add(g.addClass(W)):/mouse(over|enter)/i.test(e.show.event)&&this._bind(i,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+e.hide.event).indexOf("unfocus")>-1&&this._bind(j.closest("html"),["mousedown","touchstart"],function(a){var b=d(a.target),c=this.rendered&&!this.tooltip.hasClass($)&&this.tooltip[0].offsetWidth>0,e=b.parents(U).filter(this.tooltip[0]).length>0;b[0]===this.target[0]||b[0]===this.tooltip[0]||e||this.target.has(b[0]).length||!c||this.hide(a)}),"number"==typeof e.hide.inactive&&(this._bind(h,"qtip-"+this.id+"-inactive",o,"inactive"),this._bind(i.add(g),w.inactiveEvents,o)),this._bindEvents(r,s,h,i,m,n),this._bind(h.add(g),"mousemove",function(a){if("number"==typeof e.hide.distance){var b=this.cache.origin||{},c=this.options.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&this.hide(a)}this._storeMouse(a)}),"mouse"===f.target&&f.adjust.mouse&&(e.hide.event&&this._bind(h,["mouseenter","mouseleave"],function(a){return this.cache?void(this.cache.onTarget="mouseenter"===a.type):C}),this._bind(l,"mousemove",function(a){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass($)&&this.tooltip[0].offsetWidth>0&&this.reposition(a)})),(f.adjust.resize||k.length)&&this._bind(d.event.special.resize?k:q,"resize",p),f.adjust.scroll&&this._bind(q.add(f.container),"scroll",p)},x._unassignEvents=function(){var c=this.options,e=c.show.target,f=c.hide.target,g=d.grep([this.elements.target[0],this.rendered&&this.tooltip[0],c.position.container[0],c.position.viewport[0],c.position.container.closest("html")[0],a,b],function(a){return"object"==typeof a});e&&e.toArray&&(g=g.concat(e.toArray())),f&&f.toArray&&(g=g.concat(f.toArray())),this._unbind(g)._unbind(g,"destroy")._unbind(g,"inactive")},d(function(){q(U,["mouseenter","mouseleave"],function(a){var b="mouseenter"===a.type,c=d(a.currentTarget),e=d(a.relatedTarget||a.target),f=this.options;b?(this.focus(a),c.hasClass(W)&&!c.hasClass($)&&clearTimeout(this.timers.hide)):"mouse"===f.position.target&&f.position.adjust.mouse&&f.hide.event&&f.show.target&&!e.closest(f.show.target[0]).length&&this.hide(a),c.toggleClass(Z,b)}),q("["+S+"]",V,o)}),w=d.fn.qtip=function(a,b,e){var f=(""+a).toLowerCase(),g=D,i=d.makeArray(arguments).slice(1),j=i[i.length-1],k=this[0]?d.data(this[0],Q):D;return!arguments.length&&k||"api"===f?k:"string"==typeof a?(this.each(function(){var a=d.data(this,Q);if(!a)return B;if(j&&j.timeStamp&&(a.cache.event=j),!b||"option"!==f&&"options"!==f)a[f]&&a[f].apply(a,i);else{if(e===c&&!d.isPlainObject(b))return g=a.get(b),C;a.set(b,e)}}),g!==D?g:this):"object"!=typeof a&&arguments.length?void 0:(k=h(d.extend(B,{},a)),this.each(function(a){var b,c;return c=d.isArray(k.id)?k.id[a]:k.id,c=!c||c===C||c.length<1||w.api[c]?w.nextid++:c,b=r(d(this),c,k),b===C?B:(w.api[c]=b,d.each(P,function(){"initialize"===this.initialize&&this(b)}),void b._assignInitialEvents(j))}))},d.qtip=e,w.api={},d.each({attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&f.options&&"object"==typeof f&&"object"==typeof f.options&&f.options.suppress)return arguments.length<2?d.attr(c,aa):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(aa,b))}return d.fn["attr"+_].apply(this,arguments)},clone:function(a){var b=d.fn["clone"+_].apply(this,arguments);return a||b.filter("["+aa+"]").attr("title",function(){return d.attr(this,aa)}).removeAttr(aa),b}},function(a,b){if(!b||d.fn[a+_])return B;var c=d.fn[a+_]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+_]=d.cleanData,d.cleanData=function(a){for(var b,c=0;(b=d(a[c])).length;c++)if(b.attr(R))try{b.triggerHandler("removeqtip")}catch(e){}d["cleanData"+_].apply(this,arguments)}),w.version="3.0.3",w.nextid=0,w.inactiveEvents=V,w.zindex=15e3,w.defaults={prerender:C,id:C,overwrite:B,suppress:B,content:{text:B,attr:"title",title:C,button:C},position:{my:"top left",at:"bottom right",target:C,container:C,viewport:C,adjust:{x:0,y:0,mouse:B,scroll:B,resize:B,method:"flipinvert flipinvert"},effect:function(a,b){d(this).animate(b,{duration:200,queue:C})}},show:{target:C,event:"mouseenter",effect:B,delay:90,solo:C,ready:C,autofocus:C},hide:{target:C,event:"mouseleave",effect:B,delay:0,fixed:C,inactive:C,leave:"window",distance:C},style:{classes:"",widget:C,width:C,height:C,def:B},events:{render:D,move:D,show:D,hide:D,toggle:D,visible:D,hidden:D,focus:D,blur:D}};var fa,ga,ha,ia,ja,ka="margin",la="border",ma="color",na="background-color",oa="transparent",pa=" !important",qa=!!b.createElement("canvas").getContext,ra=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,sa={},ta=["Webkit","O","Moz","ms"];qa?(ia=a.devicePixelRatio||1,ja=function(){var a=b.createElement("canvas").getContext("2d");return a.backingStorePixelRatio||a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||1}(),ha=ia/ja):ga=function(a,b,c){return"'},d.extend(v.prototype,{init:function(a){var b,c;c=this.element=a.elements.tip=d("
        ",{"class":Q+"-tip"}).prependTo(a.tooltip),qa?(b=d("").appendTo(this.element)[0].getContext("2d"),b.lineJoin="miter",b.miterLimit=1e5,b.save()):(b=ga("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(b+b),a._bind(d("*",c).add(c),["click","mousedown"],function(a){a.stopPropagation()},this._ns)),a._bind(a.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(a){var b=this.qtip.elements.titlebar;return b&&(a.y===I||a.y===M&&this.element.position().top+this.size[1]/2+this.options.offsetl&&!ra.test(e[1])&&(e[0]=e[1]),this.border=l=p.border!==B?p.border:l):this.border=l=0,k=this.size=this._calculateSize(b),n.css({width:k[0],height:k[1],lineHeight:k[1]+"px"}),j=b.precedance===F?[s(r.x===J?l:r.x===L?k[0]-q[0]-l:(k[0]-q[0])/2),s(r.y===I?k[1]-q[1]:0)]:[s(r.x===J?k[0]-q[0]:0),s(r.y===I?l:r.y===K?k[1]-q[1]-l:(k[1]-q[1])/2)],qa?(g=o[0].getContext("2d"),g.restore(),g.save(),g.clearRect(0,0,6e3,6e3),h=this._calculateTip(r,q,ha),i=this._calculateTip(r,this.size,ha),o.attr(G,k[0]*ha).attr(H,k[1]*ha),o.css(G,k[0]).css(H,k[1]),this._drawCoords(g,i),g.fillStyle=e[1],g.fill(),g.translate(j[0]*ha,j[1]*ha),this._drawCoords(g,h),g.fillStyle=e[0],g.fill()):(h=this._calculateTip(r),h="m"+h[0]+","+h[1]+" l"+h[2]+","+h[3]+" "+h[4]+","+h[5]+" xe",j[2]=l&&/^(r|b)/i.test(b.string())?8===ba.ie?2:1:0,o.css({coordsize:k[0]+l+" "+k[1]+l,antialias:""+(r.string().indexOf(M)>-1),left:j[0]-j[2]*Number(f===E),top:j[1]-j[2]*Number(f===F),width:k[0]+l,height:k[1]+l}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k[0]+l+" "+k[1]+l,path:h,fillcolor:e[0],filled:!!a,stroked:!a}).toggle(!(!l&&!a)),!a&&b.html(ga("stroke",'weight="'+2*l+'px" color="'+e[1]+'" miterlimit="1000" joinstyle="miter"'))})),a.opera&&setTimeout(function(){m.tip.css({display:"inline-block",visibility:"visible"})},1),c!==C&&this.calculate(b,k)},calculate:function(a,b){if(!this.enabled)return C;var c,e,f=this,g=this.qtip.elements,h=this.element,i=this.options.offset,j={};return a=a||this.corner,c=a.precedance,b=b||this._calculateSize(a),e=[a.x,a.y],c===E&&e.reverse(), d.each(e,function(d,e){var h,k,l;e===M?(h=c===F?J:I,j[h]="50%",j[ka+"-"+h]=-Math.round(b[c===F?0:1]/2)+i):(h=f._parseWidth(a,e,g.tooltip),k=f._parseWidth(a,e,g.content),l=f._parseRadius(a),j[e]=Math.max(-f.border,d?k:i+(l>h?l:-h)))}),j[a[c]]-=b[c===E?0:1],h.css({margin:"",top:"",bottom:"",left:"",right:""}).css(j),j},reposition:function(a,b,d){function e(a,b,c,d,e){a===O&&j.precedance===b&&k[d]&&j[c]!==M?j.precedance=j.precedance===E?F:E:a!==O&&k[d]&&(j[b]=j[b]===M?k[d]>0?d:e:j[b]===d?e:d)}function f(a,b,e){j[a]===M?p[ka+"-"+b]=o[a]=g[ka+"-"+b]-k[b]:(h=g[e]!==c?[k[b],-g[b]]:[-k[b],g[b]],(o[a]=Math.max(h[0],h[1]))>h[0]&&(d[b]-=k[b],o[b]=C),p[g[e]!==c?e:b]=o[a])}if(this.enabled){var g,h,i=b.cache,j=this.corner.clone(),k=d.adjusted,l=b.options.position.adjust.method.split(" "),m=l[0],n=l[1]||l[0],o={left:C,top:C,x:0,y:0},p={};this.corner.fixed!==B&&(e(m,E,F,J,L),e(n,F,E,I,K),j.string()===i.corner.string()&&i.cornerTop===k.top&&i.cornerLeft===k.left||this.update(j,C)),g=this.calculate(j),g.right!==c&&(g.left=-g.right),g.bottom!==c&&(g.top=-g.bottom),g.user=this.offset,o.left=m===O&&!!k.left,o.left&&f(E,J,L),o.top=n===O&&!!k.top,o.top&&f(F,I,K),this.element.css(p).toggle(!(o.x&&o.y||j.x===M&&o.y||j.y===M&&o.x)),d.left-=g.left.charAt?g.user:m!==O||o.top||!o.left&&!o.top?g.left+this.border:0,d.top-=g.top.charAt?g.user:n!==O||o.left||!o.left&&!o.top?g.top+this.border:0,i.cornerLeft=k.left,i.cornerTop=k.top,i.corner=j.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),fa=P.tip=function(a){return new v(a,a.options.style.tip)},fa.initialize="render",fa.sanitize=function(a){if(a.style&&"tip"in a.style){var b=a.style.tip;"object"!=typeof b&&(b=a.style.tip={corner:b}),/string|boolean/i.test(typeof b.corner)||(b.corner=B)}},z.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(a){this.size=[a.width,a.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},d.extend(B,w.defaults,{style:{tip:{corner:B,mimic:C,width:6,height:6,border:B,offset:0}}}),P.viewport=function(c,d,e,f,g,h,i){function j(a,b,c,e,f,g,h,i,j){var k=d[f],s=u[a],t=v[a],w=c===O,x=s===f?j:s===g?-j:-j/2,y=t===f?i:t===g?-i:-i/2,z=q[f]+r[f]-(n?0:m[f]),A=z-k,B=k+j-(h===G?o:p)-z,C=x-(u.precedance===a||s===u[b]?y:0)-(t===M?i/2:0);return w?(C=(s===f?1:-1)*x,d[f]+=A>0?A:B>0?-B:0,d[f]=Math.max(-m[f]+r[f],k-C,Math.min(Math.max(-m[f]+r[f]+(h===G?o:p),k+C),d[f],"center"===s?k-x:1e9))):(e*=c===N?2:0,A>0&&(s!==f||B>0)?(d[f]-=C+e,l.invert(a,f)):B>0&&(s!==g||A>0)&&(d[f]-=(s===M?-C:C)+e,l.invert(a,g)),d[f]B&&(d[f]=k,l=u.clone())),d[f]-k}var k,l,m,n,o,p,q,r,s=e.target,t=c.elements.tooltip,u=e.my,v=e.at,w=e.adjust,x=w.method.split(" "),y=x[0],z=x[1]||x[0],A=e.viewport,B=e.container,D={left:0,top:0};return A.jquery&&s[0]!==a&&s[0]!==b.body&&"none"!==w.method?(m=B.offset()||D,n="static"===B.css("position"),k="fixed"===t.css("position"),o=A[0]===a?A.width():A.outerWidth(C),p=A[0]===a?A.height():A.outerHeight(C),q={left:k?0:A.scrollLeft(),top:k?0:A.scrollTop()},r=A.offset()||D,"shift"===y&&"shift"===z||(l=u.clone()),D={left:"none"!==y?j(E,F,y,w.x,J,L,G,f,h):0,top:"none"!==z?j(F,E,z,w.y,I,K,H,g,i):0,my:l}):D}})}(window,document); //# sourceMappingURL=jquery.qtip.min.map !function(r){r.fn.wordCharCount=function(a){var t=r.extend({wordCount:!0,characterCount:!0,maxAuthorized:200,wordText:"word(s)",characterText:"character(s)",className:"text-primary",errorClassName:"text-danger"},a),e=r(this).attr("ID"),s='

        ';t.wordCount===!0&&(s+='0 '+t.wordText,t.characterCount===!0&&(s+=" | ")),t.characterCount===!0&&(s+='0 '+t.characterText),s+=" / "+t.maxAuthorized,r('

        ').html(s).insertAfter(this),r(this).keyup(function(a){var s=r(this).val().length,o=jQuery.trim(r(this).val()).split(" ").length;""===r(this).val()&&(o=0),r("#word-count"+e)[0]&&r("#word-count"+e).text(o),r("#char-count"+e)[0]&&r("#char-count"+e).text(s),t.characterCount===!1?o>t.maxAuthorized?r("#p-"+e).addClass(t.errorClassName):r("#p-"+e).hasClass(t.errorClassName)&&r("#p-"+e).removeClass(t.errorClassName):s>t.maxAuthorized?r("#p-"+e).addClass(t.errorClassName):r("#p-"+e).hasClass(t.errorClassName)&&r("#p-"+e).removeClass(t.errorClassName)}),r(this).trigger("keyup")}}(jQuery);