/*!
 * Simcify.js
 * Version 1.0 - built Sat, Oct 6th 2018, 01:12 pm
 * https://simcycreative.com
 * Simcy Creative - <hello@simcycreative.com>
 * Private License
 */
/**
 * Import libraries
 */
function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}("function"==typeof define&&define.amd?define:function(e,t){"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):window.toastr=t(window.jQuery)})(["jquery"],function(e){return function(){function t(t,i){return t||(t=r()),(a=e("#"+t.containerId)).length?a:(i&&(n=t,(a=e("<div/>").attr("id",n.containerId).addClass(n.positionClass)).appendTo(e(n.target)),a=a),a);var n}function i(t,i,n){var s=!(!n||!n.force)&&n.force;return!(!t||!s&&0!==e(":focus",t).length||(t[i.hideMethod]({duration:i.hideDuration,easing:i.hideEasing,complete:function(){o(t)}}),0))}function n(e){l&&l(e)}function s(i){function s(e){return null==e&&(e=""),e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function l(t){var i=t&&!1!==f.closeMethod?f.closeMethod:f.hideMethod,s=t&&!1!==f.closeDuration?f.closeDuration:f.hideDuration,r=t&&!1!==f.closeEasing?f.closeEasing:f.hideEasing;if(!e(":focus",v).length||t)return clearTimeout(C.intervalId),v[i]({duration:s,easing:r,complete:function(){o(v),clearTimeout(g),f.onHidden&&"hidden"!==x.state&&f.onHidden(),x.state="hidden",x.endTime=new Date,n(x)}})}function h(){(f.timeOut>0||f.extendedTimeOut>0)&&(g=setTimeout(l,f.extendedTimeOut),C.maxHideTime=parseFloat(f.extendedTimeOut),C.hideEta=(new Date).getTime()+C.maxHideTime)}function d(){clearTimeout(g),C.hideEta=0,v.stop(!0,!0)[f.showMethod]({duration:f.showDuration,easing:f.showEasing})}function p(){var e=(C.hideEta-(new Date).getTime())/C.maxHideTime*100;b.width(e+"%")}var f=r(),m=i.iconClass||f.iconClass;if(void 0!==i.optionsOverride&&(f=e.extend(f,i.optionsOverride),m=i.optionsOverride.iconClass||m),!function(e,t){if(e.preventDuplicates){if(t.message===u)return!0;u=t.message}return!1}(f,i)){c++,a=t(f,!0);var g=null,v=e("<div/>"),y=e("<div/>"),w=e("<div/>"),b=e("<div/>"),_=e(f.closeHtml),C={intervalId:null,hideEta:null,maxHideTime:null},x={toastId:c,state:"visible",startTime:new Date,options:f,map:i};return i.iconClass&&v.addClass(f.toastClass).addClass(m),function(){if(i.title){var e=i.title;f.escapeHtml&&(e=s(i.title)),y.append(e).addClass(f.titleClass),v.append(y)}}(),function(){if(i.message){var e=i.message;f.escapeHtml&&(e=s(i.message)),w.append(e).addClass(f.messageClass),v.append(w)}}(),f.closeButton&&(_.addClass(f.closeClass).attr("role","button"),v.prepend(_)),f.progressBar&&(b.addClass(f.progressClass),v.prepend(b)),f.rtl&&v.addClass("rtl"),f.newestOnTop?a.prepend(v):a.append(v),function(){var e="";switch(i.iconClass){case"toast-success":case"toast-info":e="polite";break;default:e="assertive"}v.attr("aria-live",e)}(),v.hide(),v[f.showMethod]({duration:f.showDuration,easing:f.showEasing,complete:f.onShown}),f.timeOut>0&&(g=setTimeout(l,f.timeOut),C.maxHideTime=parseFloat(f.timeOut),C.hideEta=(new Date).getTime()+C.maxHideTime,f.progressBar&&(C.intervalId=setInterval(p,10))),f.closeOnHover&&v.hover(d,h),!f.onclick&&f.tapToDismiss&&v.click(l),f.closeButton&&_&&_.click(function(e){e.stopPropagation?e.stopPropagation():void 0!==e.cancelBubble&&!0!==e.cancelBubble&&(e.cancelBubble=!0),f.onCloseClick&&f.onCloseClick(e),l(!0)}),f.onclick&&v.click(function(e){f.onclick(e),l()}),n(x),f.debug&&console&&console.log(x),v}}function r(){return e.extend({},{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">&times;</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1},d.options)}function o(e){a||(a=t()),e.is(":visible")||(e.remove(),e=null,0===a.children().length&&(a.remove(),u=void 0))}var a,l,u,c=0,h={error:"error",info:"info",success:"success",warning:"warning"},d={clear:function(n,s){var o=r();a||t(o),i(n,o,s)||function(t){for(var n=a.children(),s=n.length-1;s>=0;s--)i(e(n[s]),t)}(o)},remove:function(i){var n=r();return a||t(n),i&&0===e(":focus",i).length?void o(i):void(a.children().length&&a.remove())},error:function(e,t,i){return s({type:h.error,iconClass:r().iconClasses.error,message:e,optionsOverride:i,title:t})},getContainer:t,info:function(e,t,i){return s({type:h.info,iconClass:r().iconClasses.info,message:e,optionsOverride:i,title:t})},options:{},subscribe:function(e){l=e},success:function(e,t,i){return s({type:h.success,iconClass:r().iconClasses.success,message:e,optionsOverride:i,title:t})},version:"2.1.3",warning:function(e,t,i){return s({type:h.warning,iconClass:r().iconClasses.warning,message:e,optionsOverride:i,title:t})}};return d}()}),function(){function e(t){var i=e.modules[t];if(!i)throw new Error('failed to require "'+t+'"');return"exports"in i||"function"!=typeof i.definition||(i.client=i.component=!0,i.definition.call(this,i.exports={},i),delete i.definition),i.exports}e.loader="component",e.helper={},e.helper.semVerSort=function(e,t){for(var i=e.version.split("."),n=t.version.split("."),s=0;s<i.length;++s){var r=parseInt(i[s],10),o=parseInt(n[s],10);if(r!==o)return r>o?1:-1;var a=i[s].substr((""+r).length),l=n[s].substr((""+o).length);if(""===a&&""!==l)return 1;if(""!==a&&""===l)return-1;if(""!==a&&""!==l)return a>l?1:-1}return 0},e.latest=function(t,i){function n(e){throw new Error('failed to find latest module of "'+e+'"')}var s=/(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;/(.*)~(.*)/.test(t)||n(t);for(var r=Object.keys(e.modules),o=[],a=[],l=0;l<r.length;l++){var u=r[l];if(new RegExp(t+"@").test(u)){var c=u.substr(t.length+1);null!=s.exec(u)?o.push({version:c,name:u}):a.push({version:c,name:u})}}if(0===o.concat(a).length&&n(t),o.length>0){var h=o.sort(e.helper.semVerSort).pop().name;return!0===i?h:e(h)}h=a.sort(function(e,t){return e.name>t.name})[0].name;return!0===i?h:e(h)},e.modules={},e.register=function(t,i){e.modules[t]={definition:i}},e.define=function(t,i){e.modules[t]={exports:i}},e.register("abpetkov~transitionize@0.0.3",function(e,t){function i(e,t){if(!(this instanceof i))return new i(e,t);this.element=e,this.props=t||{},this.init()}t.exports=i,i.prototype.isSafari=function(){return/Safari/.test(navigator.userAgent)&&/Apple Computer/.test(navigator.vendor)},i.prototype.init=function(){var e=[];for(var t in this.props)e.push(t+" "+this.props[t]);this.element.style.transition=e.join(", "),this.isSafari()&&(this.element.style.webkitTransition=e.join(", "))}}),e.register("ftlabs~fastclick@v0.6.11",function(e,t){function i(e){"use strict";var t,n=this;if(this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=10,this.layer=e,!e||!e.nodeType)throw new TypeError("Layer must be a document node");this.onClick=function(){return i.prototype.onClick.apply(n,arguments)},this.onMouse=function(){return i.prototype.onMouse.apply(n,arguments)},this.onTouchStart=function(){return i.prototype.onTouchStart.apply(n,arguments)},this.onTouchMove=function(){return i.prototype.onTouchMove.apply(n,arguments)},this.onTouchEnd=function(){return i.prototype.onTouchEnd.apply(n,arguments)},this.onTouchCancel=function(){return i.prototype.onTouchCancel.apply(n,arguments)},i.notNeeded(e)||(this.deviceIsAndroid&&(e.addEventListener("mouseover",this.onMouse,!0),e.addEventListener("mousedown",this.onMouse,!0),e.addEventListener("mouseup",this.onMouse,!0)),e.addEventListener("click",this.onClick,!0),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchmove",this.onTouchMove,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(e.removeEventListener=function(t,i,n){var s=Node.prototype.removeEventListener;"click"===t?s.call(e,t,i.hijacked||i,n):s.call(e,t,i,n)},e.addEventListener=function(t,i,n){var s=Node.prototype.addEventListener;"click"===t?s.call(e,t,i.hijacked||(i.hijacked=function(e){e.propagationStopped||i(e)}),n):s.call(e,t,i,n)}),"function"==typeof e.onclick&&(t=e.onclick,e.addEventListener("click",function(e){t(e)},!1),e.onclick=null))}i.prototype.deviceIsAndroid=navigator.userAgent.indexOf("Android")>0,i.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent),i.prototype.deviceIsIOS4=i.prototype.deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),i.prototype.deviceIsIOSWithBadTarget=i.prototype.deviceIsIOS&&/OS ([6-9]|\d{2})_\d/.test(navigator.userAgent),i.prototype.needsClick=function(e){"use strict";switch(e.nodeName.toLowerCase()){case"button":case"select":case"textarea":if(e.disabled)return!0;break;case"input":if(this.deviceIsIOS&&"file"===e.type||e.disabled)return!0;break;case"label":case"video":return!0}return/\bneedsclick\b/.test(e.className)},i.prototype.needsFocus=function(e){"use strict";switch(e.nodeName.toLowerCase()){case"textarea":return!0;case"select":return!this.deviceIsAndroid;case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!e.disabled&&!e.readOnly;default:return/\bneedsfocus\b/.test(e.className)}},i.prototype.sendClick=function(e,t){"use strict";var i,n;document.activeElement&&document.activeElement!==e&&document.activeElement.blur(),n=t.changedTouches[0],(i=document.createEvent("MouseEvents")).initMouseEvent(this.determineEventType(e),!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),i.forwardedTouchEvent=!0,e.dispatchEvent(i)},i.prototype.determineEventType=function(e){"use strict";return this.deviceIsAndroid&&"select"===e.tagName.toLowerCase()?"mousedown":"click"},i.prototype.focus=function(e){"use strict";var t;this.deviceIsIOS&&e.setSelectionRange&&0!==e.type.indexOf("date")&&"time"!==e.type?(t=e.value.length,e.setSelectionRange(t,t)):e.focus()},i.prototype.updateScrollParent=function(e){"use strict";var t,i;if(!(t=e.fastClickScrollParent)||!t.contains(e)){i=e;do{if(i.scrollHeight>i.offsetHeight){t=i,e.fastClickScrollParent=i;break}i=i.parentElement}while(i)}t&&(t.fastClickLastScrollTop=t.scrollTop)},i.prototype.getTargetElementFromEventTarget=function(e){"use strict";return e.nodeType===Node.TEXT_NODE?e.parentNode:e},i.prototype.onTouchStart=function(e){"use strict";var t,i,n;if(e.targetTouches.length>1)return!0;if(t=this.getTargetElementFromEventTarget(e.target),i=e.targetTouches[0],this.deviceIsIOS){if((n=window.getSelection()).rangeCount&&!n.isCollapsed)return!0;if(!this.deviceIsIOS4){if(i.identifier===this.lastTouchIdentifier)return e.preventDefault(),!1;this.lastTouchIdentifier=i.identifier,this.updateScrollParent(t)}}return this.trackingClick=!0,this.trackingClickStart=e.timeStamp,this.targetElement=t,this.touchStartX=i.pageX,this.touchStartY=i.pageY,e.timeStamp-this.lastClickTime<200&&e.preventDefault(),!0},i.prototype.touchHasMoved=function(e){"use strict";var t=e.changedTouches[0],i=this.touchBoundary;return Math.abs(t.pageX-this.touchStartX)>i||Math.abs(t.pageY-this.touchStartY)>i},i.prototype.onTouchMove=function(e){"use strict";return!this.trackingClick||((this.targetElement!==this.getTargetElementFromEventTarget(e.target)||this.touchHasMoved(e))&&(this.trackingClick=!1,this.targetElement=null),!0)},i.prototype.findControl=function(e){"use strict";return void 0!==e.control?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},i.prototype.onTouchEnd=function(e){"use strict";var t,i,n,s,r,o=this.targetElement;if(!this.trackingClick)return!0;if(e.timeStamp-this.lastClickTime<200)return this.cancelNextClick=!0,!0;if(this.cancelNextClick=!1,this.lastClickTime=e.timeStamp,i=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,this.deviceIsIOSWithBadTarget&&(r=e.changedTouches[0],(o=document.elementFromPoint(r.pageX-window.pageXOffset,r.pageY-window.pageYOffset)||o).fastClickScrollParent=this.targetElement.fastClickScrollParent),"label"===(n=o.tagName.toLowerCase())){if(t=this.findControl(o)){if(this.focus(o),this.deviceIsAndroid)return!1;o=t}}else if(this.needsFocus(o))return e.timeStamp-i>100||this.deviceIsIOS&&window.top!==window&&"input"===n?(this.targetElement=null,!1):(this.focus(o),this.deviceIsIOS4&&"select"===n||(this.targetElement=null,e.preventDefault()),!1);return!(!this.deviceIsIOS||this.deviceIsIOS4||!(s=o.fastClickScrollParent)||s.fastClickLastScrollTop===s.scrollTop)||(this.needsClick(o)||(e.preventDefault(),this.sendClick(o,e)),!1)},i.prototype.onTouchCancel=function(){"use strict";this.trackingClick=!1,this.targetElement=null},i.prototype.onMouse=function(e){"use strict";return!this.targetElement||(!!e.forwardedTouchEvent||(!e.cancelable||(!(!this.needsClick(this.targetElement)||this.cancelNextClick)||(e.stopImmediatePropagation?e.stopImmediatePropagation():e.propagationStopped=!0,e.stopPropagation(),e.preventDefault(),!1))))},i.prototype.onClick=function(e){"use strict";var t;return this.trackingClick?(this.targetElement=null,this.trackingClick=!1,!0):"submit"===e.target.type&&0===e.detail||((t=this.onMouse(e))||(this.targetElement=null),t)},i.prototype.destroy=function(){"use strict";var e=this.layer;this.deviceIsAndroid&&(e.removeEventListener("mouseover",this.onMouse,!0),e.removeEventListener("mousedown",this.onMouse,!0),e.removeEventListener("mouseup",this.onMouse,!0)),e.removeEventListener("click",this.onClick,!0),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchcancel",this.onTouchCancel,!1)},i.notNeeded=function(e){"use strict";var t,n;if(void 0===window.ontouchstart)return!0;if(n=+(/Chrome\/([0-9]+)/.exec(navigator.userAgent)||[,0])[1]){if(!i.prototype.deviceIsAndroid)return!0;if(t=document.querySelector("meta[name=viewport]")){if(-1!==t.content.indexOf("user-scalable=no"))return!0;if(n>31&&window.innerWidth<=window.screen.width)return!0}}return"none"===e.style.msTouchAction},i.attach=function(e){"use strict";return new i(e)},"undefined"!=typeof define&&define.amd?define(function(){"use strict";return i}):void 0!==t&&t.exports?(t.exports=i.attach,t.exports.FastClick=i):window.FastClick=i}),e.register("component~indexof@0.0.3",function(e,t){t.exports=function(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0;i<e.length;++i)if(e[i]===t)return i;return-1}}),e.register("component~classes@1.2.1",function(t,i){var n=e("component~indexof@0.0.3"),s=/\s+/,r=Object.prototype.toString;function o(e){if(!e)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}i.exports=function(e){return new o(e)},o.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~n(t,e)||t.push(e),this.el.className=t.join(" "),this},o.prototype.remove=function(e){if("[object RegExp]"==r.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),i=n(t,e);return~i&&t.splice(i,1),this.el.className=t.join(" "),this},o.prototype.removeMatching=function(e){for(var t=this.array(),i=0;i<t.length;i++)e.test(t[i])&&this.remove(t[i]);return this},o.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},o.prototype.array=function(){var e=this.el.className.replace(/^\s+|\s+$/g,"").split(s);return""===e[0]&&e.shift(),e},o.prototype.has=o.prototype.contains=function(e){return this.list?this.list.contains(e):!!~n(this.array(),e)}}),e.register("component~event@0.1.4",function(e,t){var i=window.addEventListener?"addEventListener":"attachEvent",n=window.removeEventListener?"removeEventListener":"detachEvent",s="addEventListener"!==i?"on":"";e.bind=function(e,t,n,r){return e[i](s+t,n,r||!1),n},e.unbind=function(e,t,i,r){return e[n](s+t,i,r||!1),i}}),e.register("component~query@0.0.3",function(e,t){function i(e,t){return t.querySelector(e)}(e=t.exports=function(e,t){return i(e,t=t||document)}).all=function(e,t){return(t=t||document).querySelectorAll(e)},e.engine=function(t){if(!t.one)throw new Error(".one callback required");if(!t.all)throw new Error(".all callback required");return i=t.one,e.all=t.all,e}}),e.register("component~matches-selector@0.1.5",function(t,i){var n=e("component~query@0.0.3"),s=Element.prototype,r=s.matches||s.webkitMatchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector;i.exports=function(e,t){if(!e||1!==e.nodeType)return!1;if(r)return r.call(e,t);for(var i=n.all(t,e.parentNode),s=0;s<i.length;++s)if(i[s]==e)return!0;return!1}}),e.register("component~closest@0.1.4",function(t,i){var n=e("component~matches-selector@0.1.5");i.exports=function(e,t,i,s){for(e=i?{parentNode:e}:e,s=s||document;(e=e.parentNode)&&e!==document;){if(n(e,t))return e;if(e===s)return}}}),e.register("component~delegate@0.2.3",function(t,i){var n=e("component~closest@0.1.4"),s=e("component~event@0.1.4");t.bind=function(e,t,i,r,o){return s.bind(e,i,function(i){var s=i.target||i.srcElement;i.delegateTarget=n(s,t,!0,e),i.delegateTarget&&r.call(e,i)},o)},t.unbind=function(e,t,i,n){s.unbind(e,t,i,n)}}),e.register("component~events@1.0.9",function(t,i){var n=e("component~event@0.1.4"),s=e("component~delegate@0.2.3");function r(e,t){if(!(this instanceof r))return new r(e,t);if(!e)throw new Error("element required");if(!t)throw new Error("object required");this.el=e,this.obj=t,this._events={}}i.exports=r,r.prototype.sub=function(e,t,i){this._events[e]=this._events[e]||{},this._events[e][t]=i},r.prototype.bind=function(e,t){var i,r={name:(i=e.split(/ +/)).shift(),selector:i.join(" ")},o=this.el,a=this.obj,l=r.name,u=(t=t||"on"+l,[].slice.call(arguments,2));function c(){var e=[].slice.call(arguments).concat(u);a[t].apply(a,e)}return r.selector?c=s.bind(o,r.selector,l,c):n.bind(o,l,c),this.sub(l,t,c),c},r.prototype.unbind=function(e,t){if(0==arguments.length)return this.unbindAll();if(1==arguments.length)return this.unbindAllOf(e);var i=this._events[e];if(i){var s=i[t];s&&n.unbind(this.el,e,s)}},r.prototype.unbindAll=function(){for(var e in this._events)this.unbindAllOf(e)},r.prototype.unbindAllOf=function(e){var t=this._events[e];if(t)for(var i in t)this.unbind(e,i)}}),e.register("switchery",function(t,i){var n=e("abpetkov~transitionize@0.0.3"),s=e("ftlabs~fastclick@v0.6.11"),r=e("component~classes@1.2.1"),o=e("component~events@1.0.9");i.exports=l;var a={color:"#64bd63",secondaryColor:"#dfdfdf",jackColor:"#fff",jackSecondaryColor:null,className:"switchery",disabled:!1,disabledOpacity:.5,speed:"0.4s",size:"default"};function l(e,t){if(!(this instanceof l))return new l(e,t);this.element=e,this.options=t||{};for(var i in a)null==this.options[i]&&(this.options[i]=a[i]);null!=this.element&&"checkbox"==this.element.type&&this.init(),!0===this.isDisabled()&&this.disable()}l.prototype.hide=function(){this.element.style.display="none"},l.prototype.show=function(){var e=this.create();this.insertAfter(this.element,e)},l.prototype.create=function(){return this.switcher=document.createElement("span"),this.jack=document.createElement("small"),this.switcher.appendChild(this.jack),this.switcher.className=this.options.className,this.events=o(this.switcher,this),this.switcher},l.prototype.insertAfter=function(e,t){e.parentNode.insertBefore(t,e.nextSibling)},l.prototype.setPosition=function(e){var t=this.isChecked(),i=this.switcher,n=this.jack;e&&t?t=!1:e&&!t&&(t=!0),!0===t?(this.element.checked=!0,window.getComputedStyle?n.style.left=parseInt(window.getComputedStyle(i).width)-parseInt(window.getComputedStyle(n).width)+"px":n.style.left=parseInt(i.currentStyle.width)-parseInt(n.currentStyle.width)+"px",this.options.color&&this.colorize(),this.setSpeed()):(n.style.left=0,this.element.checked=!1,this.switcher.style.boxShadow="inset 0 0 0 0 "+this.options.secondaryColor,this.switcher.style.borderColor=this.options.secondaryColor,this.switcher.style.backgroundColor=this.options.secondaryColor!==a.secondaryColor?this.options.secondaryColor:"#fff",this.jack.style.backgroundColor=this.options.jackSecondaryColor!==this.options.jackColor?this.options.jackSecondaryColor:this.options.jackColor,this.setSpeed())},l.prototype.setSpeed=function(){var e={},t={"background-color":this.options.speed,left:this.options.speed.replace(/[a-z]/,"")/2+"s"};e=this.isChecked()?{border:this.options.speed,"box-shadow":this.options.speed,"background-color":3*this.options.speed.replace(/[a-z]/,"")+"s"}:{border:this.options.speed,"box-shadow":this.options.speed},n(this.switcher,e),n(this.jack,t)},l.prototype.setSize=function(){switch(this.options.size){case"small":r(this.switcher).add("switchery-small");break;case"large":r(this.switcher).add("switchery-large");break;default:r(this.switcher).add("switchery-default")}},l.prototype.colorize=function(){var e=this.switcher.offsetHeight/2;this.switcher.style.backgroundColor=this.options.color,this.switcher.style.borderColor=this.options.color,this.switcher.style.boxShadow="inset 0 0 0 "+e+"px "+this.options.color,this.jack.style.backgroundColor=this.options.jackColor},l.prototype.handleOnchange=function(e){if(document.dispatchEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!0),this.element.dispatchEvent(t)}else this.element.fireEvent("onchange")},l.prototype.handleChange=function(){var e=this,t=this.element;t.addEventListener?t.addEventListener("change",function(){e.setPosition()}):t.attachEvent("onchange",function(){e.setPosition()})},l.prototype.handleClick=function(){var e=this.switcher;s(e),this.events.bind("click","bindClick")},l.prototype.bindClick=function(){var e="label"!==this.element.parentNode.tagName.toLowerCase();this.setPosition(e),this.handleOnchange(this.element.checked)},l.prototype.markAsSwitched=function(){this.element.setAttribute("data-switchery",!0)},l.prototype.markedAsSwitched=function(){return this.element.getAttribute("data-switchery")},l.prototype.init=function(){this.hide(),this.show(),this.setSize(),this.setPosition(),this.markAsSwitched(),this.handleChange(),this.handleClick()},l.prototype.isChecked=function(){return this.element.checked},l.prototype.isDisabled=function(){return this.options.disabled||this.element.disabled||this.element.readOnly},l.prototype.destroy=function(){this.events.unbind()},l.prototype.enable=function(){this.options.disabled&&(this.options.disabled&&(this.options.disabled=!1),this.element.disabled&&(this.element.disabled=!1),this.element.readOnly&&(this.element.readOnly=!1),this.switcher.style.opacity=1,this.events.bind("click","bindClick"))},l.prototype.disable=function(){this.options.disabled||(this.options.disabled||(this.options.disabled=!0),this.element.disabled||(this.element.disabled=!0),this.element.readOnly||(this.element.readOnly=!0),this.switcher.style.opacity=this.options.disabledOpacity,this.destroy())}}),"object"==typeof exports?module.exports=e("switchery"):"function"==typeof define&&define.amd?define("Switchery",[],function(){return e("switchery")}):(this||window).Switchery=e("switchery")}(),function(e,t,i){"use strict";!function e(t,i,n){function s(o,a){if(!i[o]){if(!t[o]){var l="function"==typeof require&&require;if(!a&&l)return l(o,!0);if(r)return r(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[o]={exports:{}};t[o][0].call(c.exports,function(e){var i=t[o][1][e];return s(i||e)},c,c.exports,e,t,i,n)}return i[o].exports}for(var r="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(n,s,r){function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var a,l,u,c,h=n("./modules/handle-dom"),d=n("./modules/utils"),p=n("./modules/handle-swal-dom"),f=n("./modules/handle-click"),m=o(n("./modules/handle-key")),g=o(n("./modules/default-params")),v=o(n("./modules/set-params"));r.default=u=c=function(){function n(e){var t=s;return t[e]===i?g.default[e]:t[e]}var s=arguments[0];if((0,h.addClass)(t.body,"stop-scrolling"),(0,p.resetInput)(),s===i)return(0,d.logStr)("SweetAlert expects at least 1 attribute!"),!1;var r=(0,d.extend)({},g.default);switch(typeof s){case"string":r.title=s,r.text=arguments[1]||"",r.type=arguments[2]||"";break;case"object":if(s.title===i)return(0,d.logStr)('Missing "title" argument!'),!1;r.title=s.title;for(var o in g.default)r[o]=n(o);r.confirmButtonText=r.showCancelButton?"Confirm":g.default.confirmButtonText,r.confirmButtonText=n("confirmButtonText"),r.doneFunction=arguments[1]||null;break;default:return(0,d.logStr)('Unexpected type of argument! Expected "string" or "object", got '+typeof s),!1}(0,v.default)(r),(0,p.fixVerticalPosition)(),(0,p.openModal)(arguments[1]);for(var u=(0,p.getModal)(),y=u.querySelectorAll("button"),w=["onclick","onmouseover","onmouseout","onmousedown","onmouseup","onfocus"],b=function(e){return(0,f.handleButton)(e,r,u)},_=0;_<y.length;_++)for(var C=0;C<w.length;C++){var x=w[C];y[_][x]=b}(0,p.getOverlay)().onclick=b,a=e.onkeydown;e.onkeydown=function(e){return(0,m.default)(e,r,u)},e.onfocus=function(){setTimeout(function(){l!==i&&(l.focus(),l=i)},0)},c.enableButtons()},u.setDefaults=c.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");(0,d.extend)(g.default,e)},u.close=c.close=function(){var n=(0,p.getModal)();(0,h.fadeOut)((0,p.getOverlay)(),5),(0,h.fadeOut)(n,5),(0,h.removeClass)(n,"showSweetAlert"),(0,h.addClass)(n,"hideSweetAlert"),(0,h.removeClass)(n,"visible");var s=n.querySelector(".sa-icon.sa-success");(0,h.removeClass)(s,"animate"),(0,h.removeClass)(s.querySelector(".sa-tip"),"animateSuccessTip"),(0,h.removeClass)(s.querySelector(".sa-long"),"animateSuccessLong");var r=n.querySelector(".sa-icon.sa-error");(0,h.removeClass)(r,"animateErrorIcon"),(0,h.removeClass)(r.querySelector(".sa-x-mark"),"animateXMark");var o=n.querySelector(".sa-icon.sa-warning");return(0,h.removeClass)(o,"pulseWarning"),(0,h.removeClass)(o.querySelector(".sa-body"),"pulseWarningIns"),(0,h.removeClass)(o.querySelector(".sa-dot"),"pulseWarningIns"),setTimeout(function(){var e=n.getAttribute("data-custom-class");(0,h.removeClass)(n,e)},300),(0,h.removeClass)(t.body,"stop-scrolling"),e.onkeydown=a,e.previousActiveElement&&e.previousActiveElement.focus(),l=i,clearTimeout(n.timeout),!0},u.showInputError=c.showInputError=function(e){var t=(0,p.getModal)(),i=t.querySelector(".sa-input-error");(0,h.addClass)(i,"show");var n=t.querySelector(".sa-error-container");(0,h.addClass)(n,"show"),n.querySelector("p").innerHTML=e,setTimeout(function(){u.enableButtons()},1),t.querySelector("input").focus()},u.resetInputError=c.resetInputError=function(e){if(e&&13===e.keyCode)return!1;var t=(0,p.getModal)(),i=t.querySelector(".sa-input-error");(0,h.removeClass)(i,"show");var n=t.querySelector(".sa-error-container");(0,h.removeClass)(n,"show")},u.disableButtons=c.disableButtons=function(e){var t=(0,p.getModal)(),i=t.querySelector("button.confirm"),n=t.querySelector("button.cancel");i.disabled=!0,n.disabled=!0},u.enableButtons=c.enableButtons=function(e){var t=(0,p.getModal)(),i=t.querySelector("button.confirm"),n=t.querySelector("button.cancel");i.disabled=!1,n.disabled=!1},void 0!==e?e.sweetAlert=e.swal=u:(0,d.logStr)("SweetAlert is a frontend module!"),s.exports=r.default},{"./modules/default-params":2,"./modules/handle-click":3,"./modules/handle-dom":4,"./modules/handle-key":5,"./modules/handle-swal-dom":6,"./modules/set-params":8,"./modules/utils":9}],2:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});i.default={title:"",text:"",type:null,allowOutsideClick:!1,showConfirmButton:!0,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#8CD4F5",cancelButtonText:CancelButton,imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0,inputType:"text",inputPlaceholder:"",inputValue:"",showLoaderOnConfirm:!1},t.exports=i.default},{}],3:[function(t,i,n){Object.defineProperty(n,"__esModule",{value:!0});var s=t("./utils"),r=(t("./handle-swal-dom"),t("./handle-dom")),o=function(e,t){var i=!0;(0,r.hasClass)(e,"show-input")&&((i=e.querySelector("input").value)||(i="")),t.doneFunction(i),t.closeOnConfirm&&sweetAlert.close(),t.showLoaderOnConfirm&&sweetAlert.disableButtons()},a=function(e,t){var i=String(t.doneFunction).replace(/\s/g,"");"function("===i.substring(0,9)&&")"!==i.substring(9,10)&&t.doneFunction(!1),t.closeOnCancel&&sweetAlert.close()};n.default={handleButton:function(t,i,n){function l(e){f&&i.confirmButtonColor&&(p.style.backgroundColor=e)}var u,c,h,d=t||e.event,p=d.target||d.srcElement,f=-1!==p.className.indexOf("confirm"),m=-1!==p.className.indexOf("sweet-overlay"),g=(0,r.hasClass)(n,"visible"),v=i.doneFunction&&"true"===n.getAttribute("data-has-done-function");switch(f&&i.confirmButtonColor&&(u=i.confirmButtonColor,c=(0,s.colorLuminance)(u,-.04),h=(0,s.colorLuminance)(u,-.14)),d.type){case"mouseover":l(c);break;case"mouseout":l(u);break;case"mousedown":l(h);break;case"mouseup":l(c);break;case"focus":var y=n.querySelector("button.confirm"),w=n.querySelector("button.cancel");f?w.style.boxShadow="none":y.style.boxShadow="none";break;case"click":var b=n===p,_=(0,r.isDescendant)(n,p);if(!b&&!_&&g&&!i.allowOutsideClick)break;f&&v&&g?o(n,i):v&&g||m?a(n,i):(0,r.isDescendant)(n,p)&&"BUTTON"===p.tagName&&sweetAlert.close()}},handleConfirm:o,handleCancel:a},i.exports=n.default},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],4:[function(i,n,s){Object.defineProperty(s,"__esModule",{value:!0});var r=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},o=function(e){e.style.opacity="",e.style.display="block"},a=function(e){e.style.opacity="",e.style.display="none"};s.hasClass=r,s.addClass=function(e,t){r(e,t)||(e.className+=" "+t)},s.removeClass=function(e,t){var i=" "+e.className.replace(/[\t\r\n]/g," ")+" ";if(r(e,t)){for(;i.indexOf(" "+t+" ")>=0;)i=i.replace(" "+t+" "," ");e.className=i.replace(/^\s+|\s+$/g,"")}},s.escapeHtml=function(e){var i=t.createElement("div");return i.appendChild(t.createTextNode(e)),i.innerHTML},s._show=o,s.show=function(e){if(e&&!e.length)return o(e);for(var t=0;t<e.length;++t)o(e[t])},s._hide=a,s.hide=function(e){if(e&&!e.length)return a(e);for(var t=0;t<e.length;++t)a(e[t])},s.isDescendant=function(e,t){for(var i=t.parentNode;null!==i;){if(i===e)return!0;i=i.parentNode}return!1},s.getTopMargin=function(e){e.style.left="-9999px",e.style.display="block";var t,i=e.clientHeight;return t="undefined"!=typeof getComputedStyle?parseInt(getComputedStyle(e).getPropertyValue("padding-top"),10):parseInt(e.currentStyle.padding),e.style.left="",e.style.display="none","-"+parseInt((i+t)/2)+"px"},s.fadeIn=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var i=+new Date;!function n(){e.style.opacity=+e.style.opacity+(new Date-i)/100,i=+new Date,+e.style.opacity<1&&setTimeout(n,t)}()}e.style.display="block"},s.fadeOut=function(e,t){t=t||16,e.style.opacity=1;var i=+new Date;!function n(){e.style.opacity=+e.style.opacity-(new Date-i)/100,i=+new Date,+e.style.opacity>0?setTimeout(n,t):e.style.display="none"}()},s.fireClick=function(i){if("function"==typeof MouseEvent){var n=new MouseEvent("click",{view:e,bubbles:!1,cancelable:!0});i.dispatchEvent(n)}else if(t.createEvent){var s=t.createEvent("MouseEvents");s.initEvent("click",!1,!1),i.dispatchEvent(s)}else t.createEventObject?i.fireEvent("onclick"):"function"==typeof i.onclick&&i.onclick()},s.stopEventPropagation=function(t){"function"==typeof t.stopPropagation?(t.stopPropagation(),t.preventDefault()):e.event&&e.event.hasOwnProperty("cancelBubble")&&(e.event.cancelBubble=!0)}},{}],5:[function(t,n,s){Object.defineProperty(s,"__esModule",{value:!0});var r=t("./handle-dom"),o=t("./handle-swal-dom");s.default=function(t,n,s){var a=t||e.event,l=a.keyCode||a.which,u=s.querySelector("button.confirm"),c=s.querySelector("button.cancel"),h=s.querySelectorAll("button[tabindex]");if(-1!==[9,13,32,27].indexOf(l)){for(var d=a.target||a.srcElement,p=-1,f=0;f<h.length;f++)if(d===h[f]){p=f;break}9===l?(d=-1===p?u:p===h.length-1?h[0]:h[p+1],(0,r.stopEventPropagation)(a),d.focus(),n.confirmButtonColor&&(0,o.setFocusStyle)(d,n.confirmButtonColor)):13===l?("INPUT"===d.tagName&&(d=u,u.focus()),d=-1===p?u:i):27===l&&!0===n.allowEscapeKey?(d=c,(0,r.fireClick)(d,a)):d=i}},n.exports=s.default},{"./handle-dom":4,"./handle-swal-dom":6}],6:[function(i,n,s){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(s,"__esModule",{value:!0});var o=i("./utils"),a=i("./handle-dom"),l=r(i("./default-params")),u=r(i("./injected-html")),c=function(){var e=t.createElement("div");for(e.innerHTML=u.default;e.firstChild;)t.body.appendChild(e.firstChild)},h=function e(){var i=t.querySelector(".sweet-alert");return i||(c(),i=e()),i},d=function(){var e=h();return e?e.querySelector("input"):void 0},p=function(){return t.querySelector(".sweet-overlay")},f=function(e){if(e&&13===e.keyCode)return!1;var t=h(),i=t.querySelector(".sa-input-error");(0,a.removeClass)(i,"show");var n=t.querySelector(".sa-error-container");(0,a.removeClass)(n,"show")};s.sweetAlertInitialize=c,s.getModal=h,s.getOverlay=p,s.getInput=d,s.setFocusStyle=function(e,t){var i=(0,o.hexToRgb)(t);e.style.boxShadow="0 0 2px rgba("+i+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"},s.openModal=function(i){var n=h();(0,a.fadeIn)(p(),10),(0,a.show)(n),(0,a.addClass)(n,"showSweetAlert"),(0,a.removeClass)(n,"hideSweetAlert"),e.previousActiveElement=t.activeElement,n.querySelector("button.confirm").focus(),setTimeout(function(){(0,a.addClass)(n,"visible")},500);var s=n.getAttribute("data-timer");if("null"!==s&&""!==s){var r=i;n.timeout=setTimeout(function(){r&&"true"===n.getAttribute("data-has-done-function")?r(null):sweetAlert.close()},s)}},s.resetInput=function(){var e=h(),t=d();(0,a.removeClass)(e,"show-input"),t.value=l.default.inputValue,t.setAttribute("type",l.default.inputType),t.setAttribute("placeholder",l.default.inputPlaceholder),f()},s.resetInputError=f,s.fixVerticalPosition=function(){h().style.marginTop=(0,a.getTopMargin)(h())}},{"./default-params":2,"./handle-dom":4,"./injected-html":7,"./utils":9}],7:[function(e,t,i){Object.defineProperty(i,"__esModule",{value:!0});i.default='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error">\n      <span class="sa-x-mark">\n        <span class="sa-line sa-left"></span>\n        <span class="sa-line sa-right"></span>\n      </span>\n    </div><div class="sa-icon sa-warning">\n      <span class="sa-body"></span>\n      <span class="sa-dot"></span>\n    </div><div class="sa-icon sa-info"></div><div class="sa-icon sa-success">\n      <span class="sa-line sa-tip"></span>\n      <span class="sa-line sa-long"></span>\n\n      <div class="sa-placeholder"></div>\n      <div class="sa-fix"></div>\n    </div><div class="sa-icon sa-custom"></div><h2>Title</h2>\n    <p>Text</p>\n    <fieldset>\n      <input type="text" tabIndex="3" />\n      <div class="sa-input-error"></div>\n    </fieldset><div class="sa-error-container">\n      <div class="icon">!</div>\n      <p>Not valid!</p>\n    </div><div class="sa-button-container">\n      <button class="cancel" tabIndex="2">Cancel</button>\n      <div class="sa-confirm-button-container">\n        <button class="confirm" tabIndex="1">OK</button><div class="la-ball-fall">\n          <div></div>\n          <div></div>\n          <div></div>\n        </div>\n      </div>\n    </div></div>',t.exports=i.default},{}],8:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var s=e("./utils"),r=e("./handle-swal-dom"),o=e("./handle-dom"),a=["error","warning","info","success","input","prompt"];n.default=function(e){var t=(0,r.getModal)(),n=t.querySelector("h2"),l=t.querySelector("p"),u=t.querySelector("button.cancel"),c=t.querySelector("button.confirm");if(n.innerHTML=e.html?e.title:(0,o.escapeHtml)(e.title).split("\n").join("<br>"),l.innerHTML=e.html?e.text:(0,o.escapeHtml)(e.text||"").split("\n").join("<br>"),e.text&&(0,o.show)(l),e.customClass)(0,o.addClass)(t,e.customClass),t.setAttribute("data-custom-class",e.customClass);else{var h=t.getAttribute("data-custom-class");(0,o.removeClass)(t,h),t.setAttribute("data-custom-class","")}if((0,o.hide)(t.querySelectorAll(".sa-icon")),e.type&&!(0,s.isIE8)()){var d=function(){for(var n=!1,s=0;s<a.length;s++)if(e.type===a[s]){n=!0;break}if(!n)return logStr("Unknown alert type: "+e.type),{v:!1};var l=i;-1!==["success","error","warning","info"].indexOf(e.type)&&(l=t.querySelector(".sa-icon.sa-"+e.type),(0,o.show)(l));var u=(0,r.getInput)();switch(e.type){case"success":(0,o.addClass)(l,"animate"),(0,o.addClass)(l.querySelector(".sa-tip"),"animateSuccessTip"),(0,o.addClass)(l.querySelector(".sa-long"),"animateSuccessLong");break;case"error":(0,o.addClass)(l,"animateErrorIcon"),(0,o.addClass)(l.querySelector(".sa-x-mark"),"animateXMark");break;case"warning":(0,o.addClass)(l,"pulseWarning"),(0,o.addClass)(l.querySelector(".sa-body"),"pulseWarningIns"),(0,o.addClass)(l.querySelector(".sa-dot"),"pulseWarningIns");break;case"input":case"prompt":u.setAttribute("type",e.inputType),u.value=e.inputValue,u.setAttribute("placeholder",e.inputPlaceholder),(0,o.addClass)(t,"show-input"),setTimeout(function(){u.focus(),u.addEventListener("keyup",swal.resetInputError)},400)}}();if("object"==typeof d)return d.v}if(e.imageUrl){var p=t.querySelector(".sa-icon.sa-custom");p.style.backgroundImage="url("+e.imageUrl+")",(0,o.show)(p);var f=80,m=80;if(e.imageSize){var g=e.imageSize.toString().split("x"),v=g[0],y=g[1];v&&y?(f=v,m=y):logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+e.imageSize)}p.setAttribute("style",p.getAttribute("style")+"width:"+f+"px; height:"+m+"px")}t.setAttribute("data-has-cancel-button",e.showCancelButton),e.showCancelButton?u.style.display="inline-block":(0,o.hide)(u),t.setAttribute("data-has-confirm-button",e.showConfirmButton),e.showConfirmButton?c.style.display="inline-block":(0,o.hide)(c),e.cancelButtonText&&(u.innerHTML=(0,o.escapeHtml)(e.cancelButtonText)),e.confirmButtonText&&(c.innerHTML=(0,o.escapeHtml)(e.confirmButtonText)),e.confirmButtonColor&&(c.style.backgroundColor=e.confirmButtonColor,c.style.borderLeftColor=e.confirmLoadingButtonColor,c.style.borderRightColor=e.confirmLoadingButtonColor,(0,r.setFocusStyle)(c,e.confirmButtonColor)),t.setAttribute("data-allow-outside-click",e.allowOutsideClick);var w=!!e.doneFunction;t.setAttribute("data-has-done-function",w),e.animation?"string"==typeof e.animation?t.setAttribute("data-animation",e.animation):t.setAttribute("data-animation","pop"):t.setAttribute("data-animation","none"),t.setAttribute("data-timer",e.timer)},t.exports=n.default},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],9:[function(t,i,n){Object.defineProperty(n,"__esModule",{value:!0});n.extend=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},n.hexToRgb=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16):null},n.isIE8=function(){return e.attachEvent&&!e.addEventListener},n.logStr=function(t){void 0!==e&&e.console&&e.console.log("SweetAlert: "+t)},n.colorLuminance=function(e,t){(e=String(e).replace(/[^0-9a-f]/gi,"")).length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;var i,n,s="#";for(n=0;3>n;n++)i=parseInt(e.substr(2*n,2),16),i=Math.round(Math.min(Math.max(0,i+i*t),255)).toString(16),s+=("00"+i).substr(i.length);return s}},{}]},{},[1]),"function"==typeof define&&define.amd?define(function(){return sweetAlert}):"undefined"!=typeof module&&module.exports&&(module.exports=sweetAlert)}(window,document),function(e){var t;if("function"==typeof define&&define.amd&&(define(e),t=!0),"object"==typeof exports&&(module.exports=e(),t=!0),!t){var i=window.Cookies,n=window.Cookies=e();n.noConflict=function(){return window.Cookies=i,n}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var i=arguments[e];for(var n in i)t[n]=i[n]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(n){function s(){}function r(t,i,r){if("undefined"!=typeof document){"number"==typeof(r=e({path:"/"},s.defaults,r)).expires&&(r.expires=new Date(1*new Date+864e5*r.expires)),r.expires=r.expires?r.expires.toUTCString():"";try{var o=JSON.stringify(i);/^[\{\[]/.test(o)&&(i=o)}catch(e){}i=n.write?n.write(i,t):encodeURIComponent(String(i)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var l in r)r[l]&&(a+="; "+l,!0!==r[l]&&(a+="="+r[l].split(";")[0]));return document.cookie=t+"="+i+a}}function o(e,i){if("undefined"!=typeof document){for(var s={},r=document.cookie?document.cookie.split("; "):[],o=0;o<r.length;o++){var a=r[o].split("="),l=a.slice(1).join("=");i||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var u=t(a[0]);if(l=(n.read||n)(l,u)||t(l),i)try{l=JSON.parse(l)}catch(e){}if(s[u]=l,e===u)break}catch(e){}}return e?s[e]:s}}return s.set=r,s.get=function(e){return o(e,!1)},s.getJSON=function(e){return o(e,!0)},s.remove=function(t,i){r(t,"",e(i,{expires:-1}))},s.defaults={},s.withConverter=i,s}(function(){})}),function(e,t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):e.Dropify=t(e.jQuery)}(this,function(e){var t="dropify";function i(t,i){if(window.File&&window.FileReader&&window.FileList&&window.Blob){this.element=t,this.input=e(this.element),this.wrapper=null,this.preview=null,this.filenameWrapper=null,this.settings=e.extend(!0,{defaultFile:"",maxFileSize:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,showRemove:!0,showLoader:!0,showErrors:!0,errorsPosition:"overlay",allowedFormats:["portrait","square","landscape"],messages:{default:"Drag and drop a file here or click",replace:"Drag and drop or click to replace",remove:"Remove",error:"Ooops, something wrong appended."},error:{fileSize:"The file size is too big ({{ value }} max).",minWidth:"The image width is too small ({{ value }}}px min).",maxWidth:"The image width is too big ({{ value }}}px max).",minHeight:"The image height is too small ({{ value }}}px min).",maxHeight:"The image height is too big ({{ value }}px max).",imageFormat:"The image format is not allowed ({{ value }} only)."},tpl:{wrap:'<div class="dropify-wrapper"></div>',loader:'<div class="dropify-loader"></div>',message:'<div class="dropify-message"><span class="file-icon" /> <p>{{ default }}</p></div>',preview:'<div class="dropify-preview"><span class="dropify-render"></span><div class="dropify-infos"><div class="dropify-infos-inner"><p class="dropify-infos-message">{{ replace }}</p></div></div></div>',filename:'<p class="dropify-filename"><span class="file-icon"></span> <span class="dropify-filename-inner"></span></p>',clearButton:'<button type="button" class="dropify-clear">{{ remove }}</button>',errorLine:'<p class="dropify-error">{{ error }}</p>',errorsContainer:'<div class="dropify-errors-container"><ul></ul></div>'}},i,this.input.data()),this.imgFileExtensions=["png","jpg","jpeg","gif","bmp"],this.errorsEvent=e.Event("dropify.errors"),this.isDisabled=!1,this.isInit=!1,this.file={object:null,name:null,size:null,width:null,height:null,type:null},Array.isArray(this.settings.allowedFormats)||(this.settings.allowedFormats=this.settings.allowedFormats.split(" ")),this.onChange=this.onChange.bind(this),this.clearElement=this.clearElement.bind(this),this.onFileReady=this.onFileReady.bind(this),this.translateMessages(),this.createElements(),this.setContainerSize(),this.errorsEvent.errors=[],this.input.on("change",this.onChange)}}return i.prototype.onChange=function(){this.resetPreview(),this.readFile(this.element)},i.prototype.createElements=function(){this.isInit=!0,this.input.wrap(e(this.settings.tpl.wrap)),this.wrapper=this.input.parent();var t=e(this.settings.tpl.message).insertBefore(this.input);e(this.settings.tpl.errorLine).appendTo(t),!0===this.isTouchDevice()&&this.wrapper.addClass("touch-fallback"),this.input.attr("disabled")&&(this.isDisabled=!0,this.wrapper.addClass("disabled")),!0===this.settings.showLoader&&(this.loader=e(this.settings.tpl.loader),this.loader.insertBefore(this.input)),this.preview=e(this.settings.tpl.preview),this.preview.insertAfter(this.input),!1===this.isDisabled&&!0===this.settings.showRemove&&(this.clearButton=e(this.settings.tpl.clearButton),this.clearButton.insertAfter(this.input),this.clearButton.on("click",this.clearElement)),this.filenameWrapper=e(this.settings.tpl.filename),this.filenameWrapper.prependTo(this.preview.find(".dropify-infos-inner")),!0===this.settings.showErrors&&(this.errorsContainer=e(this.settings.tpl.errorsContainer),"outside"===this.settings.errorsPosition?this.errorsContainer.insertAfter(this.wrapper):this.errorsContainer.insertBefore(this.input));var i=this.settings.defaultFile||"";""!=i.trim()&&(this.file.name=this.cleanFilename(i),this.setPreview(i))},i.prototype.readFile=function(t){if(t.files&&t.files[0]){var i=new FileReader,n=new Image,s=t.files[0],r=null,o=this,a=e.Event("dropify.fileReady");this.clearErrors(),this.showLoader(),this.setFileInformations(s),i.readAsDataURL(s),this.errorsEvent.errors=[],this.checkFileSize(),i.onload=function(e){r=e.target.result,this.isImage()?(n.src=e.target.result,n.onload=function(){o.setFileDimensions(this.width,this.height),o.validateImage(),o.input.trigger(a,[r])}):this.input.trigger(a,[r])}.bind(this),this.input.on("dropify.fileReady",this.onFileReady)}},i.prototype.onFileReady=function(e,t){if(this.input.off("dropify.fileReady",this.onFileReady),0===this.errorsEvent.errors.length)this.setPreview(t,this.file.name);else{this.input.trigger(this.errorsEvent,[this]);for(var i=this.errorsEvent.errors.length-1;i>=0;i--){var n=this.errorsEvent.errors[i].namespace.split(".").pop();this.showError(n)}if(void 0!==this.errorsContainer){this.errorsContainer.addClass("visible");var s=this.errorsContainer;setTimeout(function(){s.removeClass("visible")},1e3)}this.wrapper.addClass("has-error"),this.resetPreview(),this.clearElement()}},i.prototype.setFileInformations=function(e){this.file.object=e,this.file.name=e.name,this.file.size=e.size,this.file.type=e.type,this.file.width=null,this.file.height=null},i.prototype.setFileDimensions=function(e,t){this.file.width=e,this.file.height=t},i.prototype.setPreview=function(t){this.wrapper.removeClass("has-error").addClass("has-preview"),this.filenameWrapper.children(".dropify-filename-inner").html(this.file.name);var i=this.preview.children(".dropify-render");if(this.hideLoader(),!0===this.isImage()){var n=e("<img />").attr("src",t);this.settings.height&&n.css("max-height",this.settings.height),n.appendTo(i)}else e("<i />").attr("class","dropify-font-file").appendTo(i),e('<span class="dropify-extension" />').html(this.getFileType()).appendTo(i);this.preview.fadeIn()},i.prototype.resetPreview=function(){this.wrapper.removeClass("has-preview");var e=this.preview.children(".dropify-render");e.find(".dropify-extension").remove(),e.find("i").remove(),e.find("img").remove(),this.preview.hide(),this.hideLoader()},i.prototype.cleanFilename=function(e){var t=e.split("\\").pop();return t==e&&(t=e.split("/").pop()),""!=e?t:""},i.prototype.clearElement=function(){if(0===this.errorsEvent.errors.length){var t=e.Event("dropify.beforeClear");this.input.trigger(t,[this]),!1!==t.result&&(this.resetFile(),this.input.val(""),this.resetPreview(),this.input.trigger(e.Event("dropify.afterClear"),[this]))}else this.resetFile(),this.input.val(""),this.resetPreview()},i.prototype.resetFile=function(){this.file.object=null,this.file.name=null,this.file.size=null,this.file.type=null,this.file.width=null,this.file.height=null},i.prototype.setContainerSize=function(){this.settings.height&&this.wrapper.height(this.settings.height)},i.prototype.isTouchDevice=function(){return"ontouchstart"in window||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0},i.prototype.getFileType=function(){return this.file.name.split(".").pop().toLowerCase()},i.prototype.isImage=function(){return"-1"!=this.imgFileExtensions.indexOf(this.getFileType())},i.prototype.translateMessages=function(){for(var e in this.settings.tpl)for(var t in this.settings.messages)this.settings.tpl[e]=this.settings.tpl[e].replace("{{ "+t+" }}",this.settings.messages[t])},i.prototype.checkFileSize=function(){0!==this.maxFileSizeToByte()&&this.file.size>this.maxFileSizeToByte()&&this.pushError("fileSize")},i.prototype.maxFileSizeToByte=function(){var e=0;if(0!==this.settings.maxFileSize){var t=this.settings.maxFileSize.slice(-1).toUpperCase();"K"===t?e=1024*parseFloat(this.settings.maxFileSize):"M"===t?e=1048576*parseFloat(this.settings.maxFileSize):"G"===t&&(e=1073741824*parseFloat(this.settings.maxFileSize))}return e},i.prototype.validateImage=function(){0!==this.settings.minWidth&&this.settings.minWidth>=this.file.width&&this.pushError("minWidth"),0!==this.settings.maxWidth&&this.settings.maxWidth<=this.file.width&&this.pushError("maxWidth"),0!==this.settings.minHeight&&this.settings.minHeight>=this.file.height&&this.pushError("minHeight"),0!==this.settings.maxHeight&&this.settings.maxHeight<=this.file.height&&this.pushError("maxHeight"),"-1"==this.settings.allowedFormats.indexOf(this.getImageFormat())&&this.pushError("imageFormat")},i.prototype.getImageFormat=function(){return this.file.width==this.file.height?"square":this.file.width<this.file.height?"portrait":this.file.width>this.file.height?"landscape":void 0},i.prototype.pushError=function(t){var i=e.Event("dropify.error."+t);this.errorsEvent.errors.push(i),this.input.trigger(i,[this])},i.prototype.clearErrors=function(){void 0!==this.errorsContainer&&this.errorsContainer.children("ul").html("")},i.prototype.showError=function(e){void 0!==this.errorsContainer&&this.errorsContainer.children("ul").append("<li>"+this.getError(e)+"</li>")},i.prototype.getError=function(e){var t=this.settings.error[e],i="";return"fileSize"===e?i=this.settings.maxFileSize:"minWidth"===e?i=this.settings.minWidth:"maxWidth"===e?i=this.settings.maxWidth:"minHeight"===e?i=this.settings.minHeight:"maxHeight"===e?i=this.settings.maxHeight:"imageFormat"===e&&(i=this.settings.allowedFormats.join(" ")),""!==i?t.replace("{{ value }}",i):t},i.prototype.showLoader=function(){void 0!==this.loader&&this.loader.show()},i.prototype.hideLoader=function(){void 0!==this.loader&&this.loader.hide()},i.prototype.destroy=function(){this.input.siblings().remove(),this.input.unwrap(),this.isInit=!1},i.prototype.init=function(){this.createElements()},i.prototype.isDropified=function(){return this.isInit},e.fn[t]=function(n){return this.each(function(){e.data(this,t)||e.data(this,t,new i(this,n))}),this},i}),function(e,t){"function"==typeof define&&define.amd?define(["exports"],t):"object"==typeof exports&&"string"!=typeof exports.nodeName?t(exports):t(e.commonJsStrict={})}(this,function(e){"function"!=typeof Promise&&function(e){function t(e,t){return function(){e.apply(t,arguments)}}function i(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],a(e,t(s,this),t(r,this))}function n(e){var t=this;return null===this._state?void this._deferreds.push(e):void u(function(){var i=t._state?e.onFulfilled:e.onRejected;if(null!==i){var n;try{n=i(t._value)}catch(t){return void e.reject(t)}e.resolve(n)}else(t._state?e.resolve:e.reject)(t._value)})}function s(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var i=e.then;if("function"==typeof i)return void a(t(i,e),t(s,this),t(r,this))}this._state=!0,this._value=e,o.call(this)}catch(e){r.call(this,e)}}function r(e){this._state=!1,this._value=e,o.call(this)}function o(){for(var e=0,t=this._deferreds.length;t>e;e++)n.call(this,this._deferreds[e]);this._deferreds=null}function a(e,t,i){var n=!1;try{e(function(e){n||(n=!0,t(e))},function(e){n||(n=!0,i(e))})}catch(e){if(n)return;n=!0,i(e)}}var l=setTimeout,u="function"==typeof setImmediate&&setImmediate||function(e){l(e,1)},c=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){var s=this;return new i(function(i,r){n.call(s,new function(e,t,i,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=i,this.reject=n}(e,t,i,r))})},i.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&c(arguments[0])?arguments[0]:arguments);return new i(function(t,i){function n(r,o){try{if(o&&("object"==typeof o||"function"==typeof o)){var a=o.then;if("function"==typeof a)return void a.call(o,function(e){n(r,e)},i)}e[r]=o,0==--s&&t(e)}catch(e){i(e)}}if(0===e.length)return t([]);for(var s=e.length,r=0;r<e.length;r++)n(r,e[r])})},i.resolve=function(e){return e&&"object"==typeof e&&e.constructor===i?e:new i(function(t){t(e)})},i.reject=function(e){return new i(function(t,i){i(e)})},i.race=function(e){return new i(function(t,i){for(var n=0,s=e.length;s>n;n++)e[n].then(t,i)})},i._setImmediateFn=function(e){u=e},"undefined"!=typeof module&&module.exports?module.exports=i:e.Promise||(e.Promise=i)}(this),"function"!=typeof window.CustomEvent&&function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}e.prototype=window.Event.prototype,window.CustomEvent=e}(),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,i){for(var n=atob(this.toDataURL(t,i).split(",")[1]),s=n.length,r=new Uint8Array(s),o=0;o<s;o++)r[o]=n.charCodeAt(o);e(new Blob([r],{type:t||"image/png"}))}});var t,i,n,s=["Webkit","Moz","ms"],r=document.createElement("div").style,o=[1,8,3,6],a=[2,7,4,5];function l(e){if(e in r)return e;for(var t=e[0].toUpperCase()+e.slice(1),i=s.length;i--;)if((e=s[i]+t)in r)return e}function u(e,t){e=e||{};for(var i in t)t[i]&&t[i].constructor&&t[i].constructor===Object?(e[i]=e[i]||{},u(e[i],t[i])):e[i]=t[i];return e}function c(e){return u({},e)}function h(e){if("createEvent"in document){var t=document.createEvent("HTMLEvents");t.initEvent("change",!1,!0),e.dispatchEvent(t)}else e.fireEvent("onchange")}function d(e,t,i){if("string"==typeof t){var n=t;(t={})[n]=i}for(var s in t)e.style[s]=t[s]}function p(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function f(e,t){for(var i in t)e.setAttribute(i,t[i])}function m(e){return parseInt(e,10)}function g(e,t){var i=e.naturalWidth,n=e.naturalHeight,s=t||b(e);if(s&&s>=5){var r=i;i=n,n=r}return{width:i,height:n}}i=l("transform"),t=l("transformOrigin"),n=l("userSelect");var v={translate3d:{suffix:", 0px"},translate:{suffix:""}},y=function(e,t,i){this.x=parseFloat(e),this.y=parseFloat(t),this.scale=parseFloat(i)};y.parse=function(e){return e.style?y.parse(e.style[i]):e.indexOf("matrix")>-1||e.indexOf("none")>-1?y.fromMatrix(e):y.fromString(e)},y.fromMatrix=function(e){var t=e.substring(7).split(",");return t.length&&"none"!==e||(t=[1,0,0,1,0,0]),new y(m(t[4]),m(t[5]),parseFloat(t[0]))},y.fromString=function(e){var t=e.split(") "),i=t[0].substring(B.globals.translate.length+1).split(","),n=t.length>1?t[1].substring(6):1,s=i.length>1?i[0]:0,r=i.length>1?i[1]:0;return new y(s,r,n)},y.prototype.toString=function(){var e=v[B.globals.translate].suffix||"";return B.globals.translate+"("+this.x+"px, "+this.y+"px"+e+") scale("+this.scale+")"};var w=function(e){if(!e||!e.style[t])return this.x=0,void(this.y=0);var i=e.style[t].split(" ");this.x=parseFloat(i[0]),this.y=parseFloat(i[1])};function b(e){return e.exifdata?e.exifdata.Orientation:1}function _(e,t,i){var n=t.width,s=t.height,r=e.getContext("2d");switch(e.width=t.width,e.height=t.height,r.save(),i){case 2:r.translate(n,0),r.scale(-1,1);break;case 3:r.translate(n,s),r.rotate(180*Math.PI/180);break;case 4:r.translate(0,s),r.scale(1,-1);break;case 5:e.width=s,e.height=n,r.rotate(90*Math.PI/180),r.scale(1,-1);break;case 6:e.width=s,e.height=n,r.rotate(90*Math.PI/180),r.translate(0,-s);break;case 7:e.width=s,e.height=n,r.rotate(-90*Math.PI/180),r.translate(-n,s),r.scale(1,-1);break;case 8:e.width=s,e.height=n,r.translate(0,n),r.rotate(-90*Math.PI/180)}r.drawImage(t,0,0,n,s),r.restore()}function C(){var e,t,s,r,o,a=this,l=a.options.viewport.type?"cr-vp-"+a.options.viewport.type:null;a.options.useCanvas=a.options.enableOrientation||x.call(a),a.data={},a.elements={},e=a.elements.boundary=document.createElement("div"),t=a.elements.viewport=document.createElement("div"),a.elements.img=document.createElement("img"),s=a.elements.overlay=document.createElement("div"),a.options.useCanvas?(a.elements.canvas=document.createElement("canvas"),a.elements.preview=a.elements.canvas):a.elements.preview=a.elements.img,p(e,"cr-boundary"),e.setAttribute("aria-dropeffect","none"),r=a.options.boundary.width,o=a.options.boundary.height,d(e,{width:r+(isNaN(r)?"":"px"),height:o+(isNaN(o)?"":"px")}),p(t,"cr-viewport"),l&&p(t,l),d(t,{width:a.options.viewport.width+"px",height:a.options.viewport.height+"px"}),t.setAttribute("tabindex",0),p(a.elements.preview,"cr-image"),f(a.elements.preview,{alt:"preview","aria-grabbed":"false"}),p(s,"cr-overlay"),a.element.appendChild(e),e.appendChild(a.elements.preview),e.appendChild(t),e.appendChild(s),p(a.element,"croppie-container"),a.options.customClass&&p(a.element,a.options.customClass),function(){var e,t,s,r,o,a=this,l=!1;function u(e,t){var i=a.elements.preview.getBoundingClientRect(),n=o.y+t,s=o.x+e;a.options.enforceBoundary?(r.top>i.top+t&&r.bottom<i.bottom+t&&(o.y=n),r.left>i.left+e&&r.right<i.right+e&&(o.x=s)):(o.y=n,o.x=s)}function c(e){a.elements.preview.setAttribute("aria-grabbed",e),a.elements.boundary.setAttribute("aria-dropeffect",e?"move":"none")}function p(i){if((void 0===i.button||0===i.button)&&(i.preventDefault(),!l)){if(l=!0,e=i.pageX,t=i.pageY,i.touches){var s=i.touches[0];e=s.pageX,t=s.pageY}c(l),o=y.parse(a.elements.preview),window.addEventListener("mousemove",f),window.addEventListener("touchmove",f),window.addEventListener("mouseup",m),window.addEventListener("touchend",m),document.body.style[n]="none",r=a.elements.viewport.getBoundingClientRect()}}function f(n){n.preventDefault();var r=n.pageX,l=n.pageY;if(n.touches){var c=n.touches[0];r=c.pageX,l=c.pageY}var p=r-e,f=l-t,m={};if("touchmove"===n.type&&n.touches.length>1){var g=n.touches[0],v=n.touches[1],y=Math.sqrt((g.pageX-v.pageX)*(g.pageX-v.pageX)+(g.pageY-v.pageY)*(g.pageY-v.pageY));s||(s=y/a._currentZoom);var w=y/s;return D.call(a,w),void h(a.elements.zoomer)}u(p,f),m[i]=o.toString(),d(a.elements.preview,m),T.call(a),t=l,e=r}function m(){c(l=!1),window.removeEventListener("mousemove",f),window.removeEventListener("touchmove",f),window.removeEventListener("mouseup",m),window.removeEventListener("touchend",m),document.body.style[n]="",k.call(a),$.call(a),s=0}a.elements.overlay.addEventListener("mousedown",p),a.elements.viewport.addEventListener("keydown",function(e){var t=37,l=38,c=39,h=40;if(!e.shiftKey||e.keyCode!==l&&e.keyCode!==h){if(a.options.enableKeyMovement&&e.keyCode>=37&&e.keyCode<=40){e.preventDefault();var p=function(e){switch(e){case t:return[1,0];case l:return[0,1];case c:return[-1,0];case h:return[0,-1]}}(e.keyCode);o=y.parse(a.elements.preview),document.body.style[n]="none",r=a.elements.viewport.getBoundingClientRect(),function(e){var t=e[0],r=e[1],l={};u(t,r),l[i]=o.toString(),d(a.elements.preview,l),T.call(a),document.body.style[n]="",k.call(a),$.call(a),s=0}(p)}}else{var f=0;f=e.keyCode===l?parseFloat(a.elements.zoomer.value,10)+parseFloat(a.elements.zoomer.step,10):parseFloat(a.elements.zoomer.value,10)-parseFloat(a.elements.zoomer.step,10),a.setZoom(f)}}),a.elements.overlay.addEventListener("touchstart",p)}.call(this),a.options.enableZoom&&function(){var e=this,t=e.elements.zoomerWrap=document.createElement("div"),i=e.elements.zoomer=document.createElement("input");function n(){E.call(e,{value:parseFloat(i.value),origin:new w(e.elements.preview),viewportRect:e.elements.viewport.getBoundingClientRect(),transform:y.parse(e.elements.preview)})}function s(t){var i,s;if("ctrl"===e.options.mouseWheelZoom&&!0!==t.ctrlKey)return 0;i=t.wheelDelta?t.wheelDelta/1200:t.deltaY?t.deltaY/1060:t.detail?t.detail/-60:0,s=e._currentZoom+i*e._currentZoom,t.preventDefault(),D.call(e,s),n.call(e)}p(t,"cr-slider-wrap"),p(i,"cr-slider"),i.type="range",i.step="0.0001",i.value=1,i.style.display=e.options.showZoomer?"":"none",i.setAttribute("aria-label","zoom"),e.element.appendChild(t),t.appendChild(i),e._currentZoom=1,e.elements.zoomer.addEventListener("input",n),e.elements.zoomer.addEventListener("change",n),e.options.mouseWheelZoom&&(e.elements.boundary.addEventListener("mousewheel",s),e.elements.boundary.addEventListener("DOMMouseScroll",s))}.call(a),a.options.enableResize&&function(){var e,t,i,s,r,o,a,l=this,u=document.createElement("div"),c=!1,h=50;p(u,"cr-resizer"),d(u,{width:this.options.viewport.width+"px",height:this.options.viewport.height+"px"}),this.options.resizeControls.height&&(p(o=document.createElement("div"),"cr-resizer-vertical"),u.appendChild(o));this.options.resizeControls.width&&(p(a=document.createElement("div"),"cr-resizer-horisontal"),u.appendChild(a));function f(o){if((void 0===o.button||0===o.button)&&(o.preventDefault(),!c)){var a=l.elements.overlay.getBoundingClientRect();if(c=!0,t=o.pageX,i=o.pageY,e=-1!==o.currentTarget.className.indexOf("vertical")?"v":"h",s=a.width,r=a.height,o.touches){var u=o.touches[0];t=u.pageX,i=u.pageY}window.addEventListener("mousemove",m),window.addEventListener("touchmove",m),window.addEventListener("mouseup",g),window.addEventListener("touchend",g),document.body.style[n]="none"}}function m(n){var o=n.pageX,a=n.pageY;if(n.preventDefault(),n.touches){var c=n.touches[0];o=c.pageX,a=c.pageY}var p=o-t,f=a-i,m=l.options.viewport.height+f,g=l.options.viewport.width+p;"v"===e&&m>=h&&m<=r?(d(u,{height:m+"px"}),l.options.boundary.height+=f,d(l.elements.boundary,{height:l.options.boundary.height+"px"}),l.options.viewport.height+=f,d(l.elements.viewport,{height:l.options.viewport.height+"px"})):"h"===e&&g>=h&&g<=s&&(d(u,{width:g+"px"}),l.options.boundary.width+=p,d(l.elements.boundary,{width:l.options.boundary.width+"px"}),l.options.viewport.width+=p,d(l.elements.viewport,{width:l.options.viewport.width+"px"})),T.call(l),q.call(l),k.call(l),$.call(l),i=a,t=o}function g(){c=!1,window.removeEventListener("mousemove",m),window.removeEventListener("touchmove",m),window.removeEventListener("mouseup",g),window.removeEventListener("touchend",g),document.body.style[n]=""}o&&(o.addEventListener("mousedown",f),o.addEventListener("touchstart",f));a&&(a.addEventListener("mousedown",f),a.addEventListener("touchstart",f));this.elements.boundary.appendChild(u)}.call(a)}function x(){return this.options.enableExif&&window.EXIF}function D(e){if(this.options.enableZoom){var t=this.elements.zoomer,i=j(e,4);t.value=Math.max(t.min,Math.min(t.max,i))}}function E(e){var n=this,s=e?e.transform:y.parse(n.elements.preview),r=e?e.viewportRect:n.elements.viewport.getBoundingClientRect(),o=e?e.origin:new w(n.elements.preview);function a(){var e={};e[i]=s.toString(),e[t]=o.toString(),d(n.elements.preview,e)}if(n._currentZoom=e?e.value:n._currentZoom,s.scale=n._currentZoom,n.elements.zoomer.setAttribute("aria-valuenow",n._currentZoom),a(),n.options.enforceBoundary){var l=function(e){var t=this._currentZoom,i=e.width,n=e.height,s=this.elements.boundary.clientWidth/2,r=this.elements.boundary.clientHeight/2,o=this.elements.preview.getBoundingClientRect(),a=o.width,l=o.height,u=i/2,c=n/2,h=-1*(u/t-s),d=-1*(c/t-r),p=1/t*u,f=1/t*c;return{translate:{maxX:h,minX:h-(a*(1/t)-i*(1/t)),maxY:d,minY:d-(l*(1/t)-n*(1/t))},origin:{maxX:a*(1/t)-p,minX:p,maxY:l*(1/t)-f,minY:f}}}.call(n,r),u=l.translate,c=l.origin;s.x>=u.maxX&&(o.x=c.minX,s.x=u.maxX),s.x<=u.minX&&(o.x=c.maxX,s.x=u.minX),s.y>=u.maxY&&(o.y=c.minY,s.y=u.maxY),s.y<=u.minY&&(o.y=c.maxY,s.y=u.minY)}a(),M.call(n),$.call(n)}function k(){var e=this,n=e._currentZoom,s=e.elements.preview.getBoundingClientRect(),r=e.elements.viewport.getBoundingClientRect(),o=y.parse(e.elements.preview.style[i]),a=new w(e.elements.preview),l=r.top-s.top+r.height/2,u=r.left-s.left+r.width/2,c={},h={};c.y=l/n,c.x=u/n,h.y=(c.y-a.y)*(1-n),h.x=(c.x-a.x)*(1-n),o.x-=h.x,o.y-=h.y;var p={};p[t]=c.x+"px "+c.y+"px",p[i]=o.toString(),d(e.elements.preview,p)}function T(){if(this.elements){var e=this.elements.boundary.getBoundingClientRect(),t=this.elements.preview.getBoundingClientRect();d(this.elements.overlay,{width:t.width+"px",height:t.height+"px",top:t.top-e.top+"px",left:t.left-e.left+"px"})}}w.prototype.toString=function(){return this.x+"px "+this.y+"px"};var S,A,F,O,M=(S=T,A=500,function(){var e=this,t=arguments,i=F&&!O;clearTimeout(O),O=setTimeout(function(){O=null,F||S.apply(e,t)},A),i&&S.apply(e,t)});function $(){var e,t=this,i=t.get();I.call(t)&&(t.options.update.call(t,i),t.$&&"undefined"==typeof Prototype?t.$(t.element).trigger("update.croppie",i):(window.CustomEvent?e=new CustomEvent("update",{detail:i}):(e=document.createEvent("CustomEvent")).initCustomEvent("update",!0,!0,i),t.element.dispatchEvent(e)))}function I(){return this.elements.preview.offsetHeight>0&&this.elements.preview.offsetWidth>0}function P(){var e,n=this,s={},r=n.elements.preview,o=new y(0,0,1),a=new w;I.call(n)&&!n.data.bound&&(n.data.bound=!0,s[i]=o.toString(),s[t]=a.toString(),s.opacity=1,d(r,s),e=n.elements.preview.getBoundingClientRect(),n._originalImageWidth=e.width,n._originalImageHeight=e.height,n.data.orientation=b(n.elements.img),n.options.enableZoom?q.call(n,!0):n._currentZoom=1,o.scale=n._currentZoom,s[i]=o.toString(),d(r,s),n.data.points.length?function(e){if(4!==e.length)throw"Croppie - Invalid number of points supplied: "+e;var n=this,s=e[2]-e[0],r=n.elements.viewport.getBoundingClientRect(),o=n.elements.boundary.getBoundingClientRect(),a={left:r.left-o.left,top:r.top-o.top},l=r.width/s,u=e[1],c=e[0],h=-1*e[1]+a.top,p=-1*e[0]+a.left,f={};f[t]=c+"px "+u+"px",f[i]=new y(p,h,l).toString(),d(n.elements.preview,f),D.call(n,l),n._currentZoom=l}.call(n,n.data.points):function(){var e=this,t=e.elements.preview.getBoundingClientRect(),n=e.elements.viewport.getBoundingClientRect(),s=e.elements.boundary.getBoundingClientRect(),r=n.left-s.left,o=n.top-s.top,a=r-(t.width-n.width)/2,l=o-(t.height-n.height)/2,u=new y(a,l,e._currentZoom);d(e.elements.preview,i,u.toString())}.call(n),k.call(n),T.call(n))}function q(e){var t,i,n,s,r=this,o=0,a=r.options.maxZoom||1.5,l=r.elements.zoomer,u=parseFloat(l.value),c=r.elements.boundary.getBoundingClientRect(),d=g(r.elements.img,r.data.orientation),p=r.elements.viewport.getBoundingClientRect();r.options.enforceBoundary&&(n=p.width/d.width,s=p.height/d.height,o=Math.max(n,s)),o>=a&&(a=o+1),l.min=j(o,4),l.max=j(a,4),!e&&(u<l.min||u>l.max)?D.call(r,u<l.min?l.min:l.max):e&&(i=Math.max(c.width/d.width,c.height/d.height),t=null!==r.data.boundZoom?r.data.boundZoom:i,D.call(r,t)),h(l)}function U(e){var t=e.points,i=m(t[0]),n=m(t[1]),s=m(t[2])-i,r=m(t[3])-n,o=e.circle,a=document.createElement("canvas"),l=a.getContext("2d"),u=e.outputWidth||s,c=e.outputHeight||r;e.outputWidth&&e.outputHeight;return a.width=u,a.height=c,e.backgroundColor&&(l.fillStyle=e.backgroundColor,l.fillRect(0,0,u,c)),!1!==this.options.enforceBoundary&&(s=Math.min(s,this._originalImageWidth),r=Math.min(r,this._originalImageHeight)),l.drawImage(this.elements.preview,i,n,s,r,0,0,u,c),o&&(l.fillStyle="#fff",l.globalCompositeOperation="destination-in",l.beginPath(),l.arc(a.width/2,a.height/2,a.width/2,0,2*Math.PI,!0),l.closePath(),l.fill()),a}function L(e,t){var i,n,s,r,o=this,a=[],l=null,u=x.call(o);if("string"==typeof e)i=e,e={};else if(Array.isArray(e))a=e.slice();else{if(void 0===e&&o.data.url)return P.call(o),$.call(o),null;i=e.url,a=e.points||[],l=void 0===e.zoom?null:e.zoom}return o.data.bound=!1,o.data.url=i||o.data.url,o.data.boundZoom=l,(n=i,s=u,r=new Image,r.style.opacity=0,new Promise(function(e){function t(){r.style.opacity=1,setTimeout(function(){e(r)},1)}r.removeAttribute("crossOrigin"),n.match(/^https?:\/\/|^\/\//)&&r.setAttribute("crossOrigin","anonymous"),r.onload=function(){s?EXIF.getData(r,function(){t()}):t()},r.src=n})).then(function(i){if(function(e){this.elements.img.parentNode&&(Array.prototype.forEach.call(this.elements.img.classList,function(t){e.classList.add(t)}),this.elements.img.parentNode.replaceChild(e,this.elements.img),this.elements.preview=e),this.elements.img=e}.call(o,i),a.length)o.options.relative&&(a=[a[0]*i.naturalWidth/100,a[1]*i.naturalHeight/100,a[2]*i.naturalWidth/100,a[3]*i.naturalHeight/100]);else{var n,s,r=g(i),l=o.elements.viewport.getBoundingClientRect(),u=l.width/l.height;r.width/r.height>u?n=(s=r.height)*u:(n=r.width,s=r.height/u);var c=(r.width-n)/2,h=(r.height-s)/2,d=c+n,p=h+s;o.data.points=[c,h,d,p]}o.data.points=a.map(function(e){return parseFloat(e)}),o.options.useCanvas&&function(e){var t=this.elements.canvas,i=this.elements.img,n=t.getContext("2d"),s=x.call(this);e=this.options.enableOrientation&&e,n.clearRect(0,0,t.width,t.height),t.width=i.width,t.height=i.height,s&&!e?_(t,i,m(b(i)||0)):e&&_(t,i,e)}.call(o,e.orientation||1),P.call(o),$.call(o),t&&t()}).catch(function(e){console.error("Croppie:"+e)})}function j(e,t){return parseFloat(e).toFixed(t||0)}function N(){var e=this,t=e.elements.preview.getBoundingClientRect(),i=e.elements.viewport.getBoundingClientRect(),n=i.left-t.left,s=i.top-t.top,r=(i.width-e.elements.viewport.offsetWidth)/2,o=(i.height-e.elements.viewport.offsetHeight)/2,a=n+e.elements.viewport.offsetWidth+r,l=s+e.elements.viewport.offsetHeight+o,u=e._currentZoom;(u===1/0||isNaN(u))&&(u=1);var c=e.options.enforceBoundary?0:Number.NEGATIVE_INFINITY;return n=Math.max(c,n/u),s=Math.max(c,s/u),a=Math.max(c,a/u),l=Math.max(c,l/u),{points:[j(n),j(s),j(a),j(l)],zoom:u,orientation:e.data.orientation}}var R={type:"canvas",format:"png",quality:1},z=["jpeg","webp","png"];function H(e){var t=this,i=N.call(t),n=u(c(R),c(e)),s="string"==typeof e?e:n.type||"base64",r=n.size||"viewport",o=n.format,a=n.quality,l=n.backgroundColor,h="boolean"==typeof n.circle?n.circle:"circle"===t.options.viewport.type,f=t.elements.viewport.getBoundingClientRect(),m=f.width/f.height;return"viewport"===r?(i.outputWidth=f.width,i.outputHeight=f.height):"object"==typeof r&&(r.width&&r.height?(i.outputWidth=r.width,i.outputHeight=r.height):r.width?(i.outputWidth=r.width,i.outputHeight=r.width/m):r.height&&(i.outputWidth=r.height*m,i.outputHeight=r.height)),z.indexOf(o)>-1&&(i.format="image/"+o,i.quality=a),i.circle=h,i.url=t.data.url,i.backgroundColor=l,new Promise(function(e,n){switch(s.toLowerCase()){case"rawcanvas":e(U.call(t,i));break;case"canvas":case"base64":e(function(e){return U.call(this,e).toDataURL(e.format,e.quality)}.call(t,i));break;case"blob":(function(e){var t=this;return new Promise(function(i,n){U.call(t,e).toBlob(function(e){i(e)},e.format,e.quality)})}).call(t,i).then(e);break;default:e(function(e){var t=e.points,i=document.createElement("div"),n=document.createElement("img"),s=t[2]-t[0],r=t[3]-t[1];return p(i,"croppie-result"),i.appendChild(n),d(n,{left:-1*t[0]+"px",top:-1*t[1]+"px"}),n.src=e.url,d(i,{width:s+"px",height:r+"px"}),i}.call(t,i))}})}function V(e){if(!this.options.useCanvas||!this.options.enableOrientation)throw"Croppie: Cannot rotate without enableOrientation && EXIF.js included";var t,i,n,s,r,l=this,u=l.elements.canvas;l.data.orientation=(t=l.data.orientation,i=e,n=o.indexOf(t)>-1?o:a,s=n.indexOf(t),r=i/90%n.length,n[(n.length+s+r%n.length)%n.length]),_(u,l.elements.img,l.data.orientation),q.call(l),E.call(l),copy=null}if(window.jQuery){var W=window.jQuery;W.fn.croppie=function(e){if("string"===typeof e){var t=Array.prototype.slice.call(arguments,1),i=W(this).data("croppie");return"get"===e?i.get():"result"===e?i.result.apply(i,t):"bind"===e?i.bind.apply(i,t):this.each(function(){var i=W(this).data("croppie");if(i){var n=i[e];if(!W.isFunction(n))throw"Croppie "+e+" method not found";n.apply(i,t),"destroy"===e&&W(this).removeData("croppie")}})}return this.each(function(){var t=new B(this,e);t.$=W,W(this).data("croppie",t)})}}function B(e,t){if(e.className.indexOf("croppie-container")>-1)throw new Error("Croppie: Can't initialize croppie more than once");if(this.element=e,this.options=u(c(B.defaults),t),"img"===this.element.tagName.toLowerCase()){var i=this.element;p(i,"cr-original-image"),f(i,{"aria-hidden":"true",alt:""});var n=document.createElement("div");this.element.parentNode.appendChild(n),n.appendChild(i),this.element=n,this.options.url=this.options.url||i.src}if(C.call(this),this.options.url){var s={url:this.options.url,points:this.options.points};delete this.options.url,delete this.options.points,L.call(this,s)}}B.defaults={viewport:{width:100,height:100,type:"square"},boundary:{},orientationControls:{enabled:!0,leftClass:"",rightClass:""},resizeControls:{width:!0,height:!0},customClass:"",showZoomer:!0,enableZoom:!0,enableResize:!1,mouseWheelZoom:!0,enableExif:!1,enforceBoundary:!0,enableOrientation:!1,enableKeyMovement:!0,update:function(){}},B.globals={translate:"translate3d"},u(B.prototype,{bind:function(e,t){return L.call(this,e,t)},get:function(){var e=N.call(this),t=e.points;return this.options.relative&&(t[0]/=this.elements.img.naturalWidth/100,t[1]/=this.elements.img.naturalHeight/100,t[2]/=this.elements.img.naturalWidth/100,t[3]/=this.elements.img.naturalHeight/100),e},result:function(e){return H.call(this,e)},refresh:function(){return function(){P.call(this)}.call(this)},setZoom:function(e){D.call(this,e),h(this.elements.zoomer)},rotate:function(e){V.call(this,e)},destroy:function(){return function(){var e,t,i=this;i.element.removeChild(i.elements.boundary),e=i.element,t="croppie-container",e.classList?e.classList.remove(t):e.className=e.className.replace(t,""),i.options.enableZoom&&i.element.removeChild(i.elements.zoomerWrap),delete i.elements}.call(this)}}),e.Croppie=window.Croppie=B});var _slice=Array.prototype.slice,_slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var i=[],n=!0,s=!1,r=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(i.push(o.value),!t||i.length!==t);n=!0);}catch(e){s=!0,r=e}finally{try{!n&&a.return&&a.return()}finally{if(s)throw r}}return i}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e};!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):e.parsley=t(e.jQuery)}(this,function(e){"use strict";function t(e,t){return e.parsleyAdaptedCallback||(e.parsleyAdaptedCallback=function(){var i=Array.prototype.slice.call(arguments,0);i.unshift(this),e.apply(t||T,i)}),e.parsleyAdaptedCallback}function i(e){return 0===e.lastIndexOf(A,0)?e.substr(A.length):e}var n,s=1,r={},o={attr:function(e,t,i){var n,s,r,o=new RegExp("^"+t,"i");if(void 0===i)i={};else for(n in i)i.hasOwnProperty(n)&&delete i[n];if(!e)return i;for(n=(r=e.attributes).length;n--;)s=r[n],s&&s.specified&&o.test(s.name)&&(i[this.camelize(s.name.slice(t.length))]=this.deserializeValue(s.value));return i},checkAttr:function(e,t,i){return e.hasAttribute(t+i)},setAttr:function(e,t,i,n){e.setAttribute(this.dasherize(t+i),String(n))},generateID:function(){return""+s++},deserializeValue:function(t){var i;try{return t?"true"==t||"false"!=t&&("null"==t?null:isNaN(i=Number(t))?/^[\[\{]/.test(t)?e.parseJSON(t):t:i):t}catch(e){return t}},camelize:function(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})},dasherize:function(e){return e.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()},warn:function(){var e;window.console&&"function"==typeof window.console.warn&&(e=window.console).warn.apply(e,arguments)},warnOnce:function(e){r[e]||(r[e]=!0,this.warn.apply(this,arguments))},_resetWarnings:function(){r={}},trimString:function(e){return e.replace(/^\s+|\s+$/g,"")},parse:{date:function(e){var t=e.match(/^(\d{4,})-(\d\d)-(\d\d)$/);if(!t)return null;var i=t.map(function(e){return parseInt(e,10)}),n=_slicedToArray(i,4),s=(n[0],n[1]),r=n[2],o=n[3],a=new Date(s,r-1,o);return a.getFullYear()!==s||a.getMonth()+1!==r||a.getDate()!==o?null:a},string:function(e){return e},integer:function(e){return isNaN(e)?null:parseInt(e,10)},number:function(e){if(isNaN(e))throw null;return parseFloat(e)},boolean:function(e){return!/^\s*false\s*$/i.test(e)},object:function(e){return o.deserializeValue(e)},regexp:function(e){var t="";return/^\/.*\/(?:[gimy]*)$/.test(e)?(t=e.replace(/.*\/([gimy]*)$/,"$1"),e=e.replace(new RegExp("^/(.*?)/"+t+"$"),"$1")):e="^"+e+"$",new RegExp(e,t)}},parseRequirement:function(e,t){var i=this.parse[e||"string"];if(!i)throw'Unknown requirement specification: "'+e+'"';var n=i(t);if(null===n)throw"Requirement is not a "+e+': "'+t+'"';return n},namespaceEvents:function(t,i){return(t=this.trimString(t||"").split(/\s+/))[0]?e.map(t,function(e){return e+"."+i}).join(" "):""},difference:function(t,i){var n=[];return e.each(t,function(e,t){-1==i.indexOf(t)&&n.push(t)}),n},all:function(t){return e.when.apply(e,_toConsumableArray(t).concat([42,42]))},objectCreate:Object.create||(n=function(){},function(e){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof e)throw TypeError("Argument must be an object");n.prototype=e;var t=new n;return n.prototype=null,t}),_SubmitSelector:'input[type="submit"], button:submit'},a={namespace:"data-parsley-",inputs:"input, textarea, select",excluded:"input[type=button], input[type=submit], input[type=reset], input[type=hidden]",priorityEnabled:!0,multiple:null,group:null,uiEnabled:!0,validationThreshold:3,focus:"first",trigger:!1,triggerAfterFailure:"input",errorClass:"parsley-error",successClass:"parsley-success",classHandler:function(e){},errorsContainer:function(e){},errorsWrapper:'<ul class="parsley-errors-list"></ul>',errorTemplate:"<li></li>"},l=function(){this.__id__=o.generateID()};l.prototype={asyncSupport:!0,_pipeAccordingToValidationResult:function(){var t=this,i=function(){var i=e.Deferred();return!0!==t.validationResult&&i.reject(),i.resolve().promise()};return[i,i]},actualizeOptions:function(){return o.attr(this.element,this.options.namespace,this.domOptions),this.parent&&this.parent.actualizeOptions&&this.parent.actualizeOptions(),this},_resetOptions:function(e){this.domOptions=o.objectCreate(this.parent.options),this.options=o.objectCreate(this.domOptions);for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.actualizeOptions()},_listeners:null,on:function(e,t){return this._listeners=this._listeners||{},(this._listeners[e]=this._listeners[e]||[]).push(t),this},subscribe:function(t,i){e.listenTo(this,t.toLowerCase(),i)},off:function(e,t){var i=this._listeners&&this._listeners[e];if(i)if(t)for(var n=i.length;n--;)i[n]===t&&i.splice(n,1);else delete this._listeners[e];return this},unsubscribe:function(t,i){e.unsubscribeTo(this,t.toLowerCase())},trigger:function(e,t,i){t=t||this;var n,s=this._listeners&&this._listeners[e];if(s)for(var r=s.length;r--;)if(n=s[r].call(t,t,i),!1===n)return n;return!this.parent||this.parent.trigger(e,t,i)},asyncIsValid:function(e,t){return o.warnOnce("asyncIsValid is deprecated; please use whenValid instead"),this.whenValid({group:e,force:t})},_findRelated:function(){return this.options.multiple?e(this.parent.element.querySelectorAll("["+this.options.namespace+'multiple="'+this.options.multiple+'"]')):this.$element}};var u=function(t){e.extend(!0,this,t)};u.prototype={validate:function(e,t){if(this.fn)return arguments.length>3&&(t=[].slice.call(arguments,1,-1)),this.fn(e,t);if(Array.isArray(e)){if(!this.validateMultiple)throw"Validator `"+this.name+"` does not handle multiple values";return this.validateMultiple.apply(this,arguments)}var i=arguments[arguments.length-1];if(this.validateDate&&i._isDateInput())return arguments[0]=o.parse.date(arguments[0]),null!==arguments[0]&&this.validateDate.apply(this,arguments);if(this.validateNumber)return!isNaN(e)&&(arguments[0]=parseFloat(arguments[0]),this.validateNumber.apply(this,arguments));if(this.validateString)return this.validateString.apply(this,arguments);throw"Validator `"+this.name+"` only handles multiple values"},parseRequirements:function(t,i){if("string"!=typeof t)return Array.isArray(t)?t:[t];var n=this.requirementType;if(Array.isArray(n)){for(var s=function(e,t){var i=e.match(/^\s*\[(.*)\]\s*$/);if(!i)throw'Requirement is not an array: "'+e+'"';var n=i[1].split(",").map(o.trimString);if(n.length!==t)throw"Requirement has "+n.length+" values when "+t+" are needed";return n}(t,n.length),r=0;r<s.length;r++)s[r]=o.parseRequirement(n[r],s[r]);return s}return e.isPlainObject(n)?function(e,t,i){var n=null,s={};for(var r in e)if(r){var a=i(r);"string"==typeof a&&(a=o.parseRequirement(e[r],a)),s[r]=a}else n=o.parseRequirement(e[r],t);return[n,s]}(n,t,i):[o.parseRequirement(n,t)]},requirementType:"string",priority:2};var c=function(e,t){this.__class__="ValidatorRegistry",this.locale="en",this.init(e||{},t||{})},h={email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,number:/^-?(\d*\.)?\d+(e[-+]?\d+)?$/i,integer:/^-?\d+$/,digits:/^\d+$/,alphanum:/^\w+$/i,date:{test:function(e){return null!==o.parse.date(e)}},url:new RegExp("^(?:(?:https?|ftp)://)?(?:\\S+(?::\\S*)?@)?(?:(?:[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,})))(?::\\d{2,5})?(?:/\\S*)?$","i")};h.range=h.number;var d=function(e){var t=(""+e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},p=function(e,t){return function(i){for(var n=arguments.length,s=Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.pop(),t.apply(void 0,[i].concat(_toConsumableArray((a=e,s.map(o.parse[a])))));var a}},f=function(e){return{validateDate:p("date",e),validateNumber:p("number",e),requirementType:e.length<=2?"string":["string","string"],priority:30}};c.prototype={init:function(e,t){this.catalog=t,this.validators=_extends({},this.validators);for(var i in e)this.addValidator(i,e[i].fn,e[i].priority);window.Parsley.trigger("parsley:validator:init")},setLocale:function(e){if(void 0===this.catalog[e])throw new Error(e+" is not available in the catalog");return this.locale=e,this},addCatalog:function(e,t,i){return"object"==typeof t&&(this.catalog[e]=t),!0===i?this.setLocale(e):this},addMessage:function(e,t,i){return void 0===this.catalog[e]&&(this.catalog[e]={}),this.catalog[e][t]=i,this},addMessages:function(e,t){for(var i in t)this.addMessage(e,i,t[i]);return this},addValidator:function(e,t,i){if(this.validators[e])o.warn('Validator "'+e+'" is already defined.');else if(a.hasOwnProperty(e))return void o.warn('"'+e+'" is a restricted keyword and is not a valid validator name.');return this._setValidator.apply(this,arguments)},updateValidator:function(e,t,i){return this.validators[e]?this._setValidator.apply(this,arguments):(o.warn('Validator "'+e+'" is not already defined.'),this.addValidator.apply(this,arguments))},removeValidator:function(e){return this.validators[e]||o.warn('Validator "'+e+'" is not defined.'),delete this.validators[e],this},_setValidator:function(e,t,i){"object"!=typeof t&&(t={fn:t,priority:i}),t.validate||(t=new u(t)),this.validators[e]=t;for(var n in t.messages||{})this.addMessage(n,e,t.messages[n]);return this},getErrorMessage:function(e){var t;"type"===e.name?t=(this.catalog[this.locale][e.name]||{})[e.requirements]:t=this.formatMessage(this.catalog[this.locale][e.name],e.requirements);return t||this.catalog[this.locale].defaultMessage||this.catalog.en.defaultMessage},formatMessage:function(e,t){if("object"==typeof t){for(var i in t)e=this.formatMessage(e,t[i]);return e}return"string"==typeof e?e.replace(/%s/i,t):""},validators:{notblank:{validateString:function(e){return/\S/.test(e)},priority:2},required:{validateMultiple:function(e){return e.length>0},validateString:function(e){return/\S/.test(e)},priority:512},type:{validateString:function(e,t){var i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=i.step,s=void 0===n?"any":n,r=i.base,o=void 0===r?0:r,a=h[t];if(!a)throw new Error("validator type `"+t+"` is not supported");if(!a.test(e))return!1;if("number"===t&&!/^any$/i.test(s||"")){var l=Number(e),u=Math.max(d(s),d(o));if(d(l)>u)return!1;var c=function(e){return Math.round(e*Math.pow(10,u))};if((c(l)-c(o))%c(s)!=0)return!1}return!0},requirementType:{"":"string",step:"string",base:"number"},priority:256},pattern:{validateString:function(e,t){return t.test(e)},requirementType:"regexp",priority:64},minlength:{validateString:function(e,t){return e.length>=t},requirementType:"integer",priority:30},maxlength:{validateString:function(e,t){return e.length<=t},requirementType:"integer",priority:30},length:{validateString:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:["integer","integer"],priority:30},mincheck:{validateMultiple:function(e,t){return e.length>=t},requirementType:"integer",priority:30},maxcheck:{validateMultiple:function(e,t){return e.length<=t},requirementType:"integer",priority:30},check:{validateMultiple:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:["integer","integer"],priority:30},min:f(function(e,t){return e>=t}),max:f(function(e,t){return e<=t}),range:f(function(e,t,i){return e>=t&&e<=i}),equalto:{validateString:function(t,i){var n=e(i);return n.length?t===n.val():t===i},priority:256}}};var m={};m.Form={_actualizeTriggers:function(){var e=this;this.$element.on("submit.Parsley",function(t){e.onSubmitValidate(t)}),this.$element.on("click.Parsley",o._SubmitSelector,function(t){e.onSubmitButton(t)}),!1!==this.options.uiEnabled&&this.element.setAttribute("novalidate","")},focus:function(){if(this._focusedField=null,!0===this.validationResult||"none"===this.options.focus)return null;for(var e=0;e<this.fields.length;e++){var t=this.fields[e];if(!0!==t.validationResult&&t.validationResult.length>0&&void 0===t.options.noFocus&&(this._focusedField=t.$element,"first"===this.options.focus))break}return null===this._focusedField?null:this._focusedField.focus()},_destroyUI:function(){this.$element.off(".Parsley")}},m.Field={_reflowUI:function(){if(this._buildUI(),this._ui){var e=function e(t,i,n){for(var s=[],r=[],o=0;o<t.length;o++){for(var a=!1,l=0;l<i.length;l++)if(t[o].assert.name===i[l].assert.name){a=!0;break}a?r.push(t[o]):s.push(t[o])}return{kept:r,added:s,removed:n?[]:e(i,t,!0).added}}(this.validationResult,this._ui.lastValidationResult);this._ui.lastValidationResult=this.validationResult,this._manageStatusClass(),this._manageErrorsMessages(e),this._actualizeTriggers(),!e.kept.length&&!e.added.length||this._failedOnce||(this._failedOnce=!0,this._actualizeTriggers())}},getErrorsMessages:function(){if(!0===this.validationResult)return[];for(var e=[],t=0;t<this.validationResult.length;t++)e.push(this.validationResult[t].errorMessage||this._getErrorMessage(this.validationResult[t].assert));return e},addError:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.message,n=t.assert,s=t.updateClass,r=void 0===s||s;this._buildUI(),this._addError(e,{message:i,assert:n}),r&&this._errorClass()},updateError:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.message,n=t.assert,s=t.updateClass,r=void 0===s||s;this._buildUI(),this._updateError(e,{message:i,assert:n}),r&&this._errorClass()},removeError:function(e){var t=(arguments.length<=1||void 0===arguments[1]?{}:arguments[1]).updateClass,i=void 0===t||t;this._buildUI(),this._removeError(e),i&&this._manageStatusClass()},_manageStatusClass:function(){this.hasConstraints()&&this.needsValidation()&&!0===this.validationResult?this._successClass():this.validationResult.length>0?this._errorClass():this._resetClass()},_manageErrorsMessages:function(t){if(void 0===this.options.errorsMessagesDisabled){if(void 0!==this.options.errorMessage)return t.added.length||t.kept.length?(this._insertErrorWrapper(),0===this._ui.$errorsWrapper.find(".parsley-custom-error-message").length&&this._ui.$errorsWrapper.append(e(this.options.errorTemplate).addClass("parsley-custom-error-message")),this._ui.$errorsWrapper.addClass("filled").find(".parsley-custom-error-message").html(this.options.errorMessage)):this._ui.$errorsWrapper.removeClass("filled").find(".parsley-custom-error-message").remove();for(var i=0;i<t.removed.length;i++)this._removeError(t.removed[i].assert.name);for(i=0;i<t.added.length;i++)this._addError(t.added[i].assert.name,{message:t.added[i].errorMessage,assert:t.added[i].assert});for(i=0;i<t.kept.length;i++)this._updateError(t.kept[i].assert.name,{message:t.kept[i].errorMessage,assert:t.kept[i].assert})}},_addError:function(t,i){var n=i.message,s=i.assert;this._insertErrorWrapper(),this._ui.$errorsWrapper.addClass("filled").append(e(this.options.errorTemplate).addClass("parsley-"+t).html(n||this._getErrorMessage(s)))},_updateError:function(e,t){var i=t.message,n=t.assert;this._ui.$errorsWrapper.addClass("filled").find(".parsley-"+e).html(i||this._getErrorMessage(n))},_removeError:function(e){this._ui.$errorsWrapper.removeClass("filled").find(".parsley-"+e).remove()},_getErrorMessage:function(e){var t=e.name+"Message";return void 0!==this.options[t]?window.Parsley.formatMessage(this.options[t],e.requirements):window.Parsley.getErrorMessage(e)},_buildUI:function(){if(!this._ui&&!1!==this.options.uiEnabled){var t={};this.element.setAttribute(this.options.namespace+"id",this.__id__),t.$errorClassHandler=this._manageClassHandler(),t.errorsWrapperId="parsley-id-"+(this.options.multiple?"multiple-"+this.options.multiple:this.__id__),t.$errorsWrapper=e(this.options.errorsWrapper).attr("id",t.errorsWrapperId),t.lastValidationResult=[],t.validationInformationVisible=!1,this._ui=t}},_manageClassHandler:function(){if("string"==typeof this.options.classHandler)return 0===e(this.options.classHandler).length&&ParsleyUtils.warn("No elements found that match the selector `"+this.options.classHandler+"` set in options.classHandler or data-parsley-class-handler"),e(this.options.classHandler);if("function"==typeof this.options.classHandler)var t=this.options.classHandler.call(this,this);return void 0!==t&&t.length?t:this._inputHolder()},_inputHolder:function(){return this.options.multiple&&"SELECT"!==this.element.nodeName?this.$element.parent():this.$element},_insertErrorWrapper:function(){var t;if(0!==this._ui.$errorsWrapper.parent().length)return this._ui.$errorsWrapper.parent();if("string"==typeof this.options.errorsContainer){if(e(this.options.errorsContainer).length)return e(this.options.errorsContainer).append(this._ui.$errorsWrapper);o.warn("The errors container `"+this.options.errorsContainer+"` does not exist in DOM")}else"function"==typeof this.options.errorsContainer&&(t=this.options.errorsContainer.call(this,this));return void 0!==t&&t.length?t.append(this._ui.$errorsWrapper):this._inputHolder().after(this._ui.$errorsWrapper)},_actualizeTriggers:function(){var e,t=this,i=this._findRelated();i.off(".Parsley"),this._failedOnce?i.on(o.namespaceEvents(this.options.triggerAfterFailure,"Parsley"),function(){t._validateIfNeeded()}):(e=o.namespaceEvents(this.options.trigger,"Parsley"))&&i.on(e,function(e){t._validateIfNeeded(e)})},_validateIfNeeded:function(e){var t=this;e&&/key|input/.test(e.type)&&(!this._ui||!this._ui.validationInformationVisible)&&this.getValue().length<=this.options.validationThreshold||(this.options.debounce?(window.clearTimeout(this._debounced),this._debounced=window.setTimeout(function(){return t.validate()},this.options.debounce)):this.validate())},_resetUI:function(){this._failedOnce=!1,this._actualizeTriggers(),void 0!==this._ui&&(this._ui.$errorsWrapper.removeClass("filled").children().remove(),this._resetClass(),this._ui.lastValidationResult=[],this._ui.validationInformationVisible=!1)},_destroyUI:function(){this._resetUI(),void 0!==this._ui&&this._ui.$errorsWrapper.remove(),delete this._ui},_successClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass)},_errorClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass)},_resetClass:function(){this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass)}};var g=function(t,i,n){this.__class__="Form",this.element=t,this.$element=e(t),this.domOptions=i,this.options=n,this.parent=window.Parsley,this.fields=[],this.validationResult=null},v={pending:null,resolved:!0,rejected:!1};g.prototype={onSubmitValidate:function(e){var t=this;if(!0!==e.parsley){var i=this._submitSource||this.$element.find(o._SubmitSelector)[0];if(this._submitSource=null,this.$element.find(".parsley-synthetic-submit-button").prop("disabled",!0),!i||null===i.getAttribute("formnovalidate")){window.Parsley._remoteCache={};var n=this.whenValidate({event:e});"resolved"===n.state()&&!1!==this._trigger("submit")||(e.stopImmediatePropagation(),e.preventDefault(),"pending"===n.state()&&n.done(function(){t._submit(i)}))}}},onSubmitButton:function(e){this._submitSource=e.currentTarget},_submit:function(t){if(!1!==this._trigger("submit")){if(t){var i=this.$element.find(".parsley-synthetic-submit-button").prop("disabled",!1);0===i.length&&(i=e('<input class="parsley-synthetic-submit-button" type="hidden">').appendTo(this.$element)),i.attr({name:t.getAttribute("name"),value:t.getAttribute("value")})}this.$element.trigger(_extends(e.Event("submit"),{parsley:!0}))}},validate:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){o.warnOnce("Calling validate on a parsley form without passing arguments as an object is deprecated.");var i=_slice.call(arguments);t={group:i[0],force:i[1],event:i[2]}}return v[this.whenValidate(t).state()]},whenValidate:function(){var t,i=this,n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],s=n.group,r=n.force,a=n.event;this.submitEvent=a,a&&(this.submitEvent=_extends({},a,{preventDefault:function(){o.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`"),i.validationResult=!1}})),this.validationResult=!0,this._trigger("validate"),this._refreshFields();var l=this._withoutReactualizingFormOptions(function(){return e.map(i.fields,function(e){return e.whenValidate({force:r,group:s})})});return(t=o.all(l).done(function(){i._trigger("success")}).fail(function(){i.validationResult=!1,i.focus(),i._trigger("error")}).always(function(){i._trigger("validated")})).pipe.apply(t,_toConsumableArray(this._pipeAccordingToValidationResult()))},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){o.warnOnce("Calling isValid on a parsley form without passing arguments as an object is deprecated.");var i=_slice.call(arguments);t={group:i[0],force:i[1]}}return v[this.whenValid(t).state()]},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.group,s=i.force;this._refreshFields();var r=this._withoutReactualizingFormOptions(function(){return e.map(t.fields,function(e){return e.whenValid({group:n,force:s})})});return o.all(r)},reset:function(){for(var e=0;e<this.fields.length;e++)this.fields[e].reset();this._trigger("reset")},destroy:function(){this._destroyUI();for(var e=0;e<this.fields.length;e++)this.fields[e].destroy();this.$element.removeData("Parsley"),this._trigger("destroy")},_refreshFields:function(){return this.actualizeOptions()._bindFields()},_bindFields:function(){var t=this,i=this.fields;return this.fields=[],this.fieldsMappedById={},this._withoutReactualizingFormOptions(function(){t.$element.find(t.options.inputs).not(t.options.excluded).each(function(e,i){var n=new window.Parsley.Factory(i,{},t);if(("Field"===n.__class__||"FieldMultiple"===n.__class__)&&!0!==n.options.excluded){var s=n.__class__+"-"+n.__id__;void 0===t.fieldsMappedById[s]&&(t.fieldsMappedById[s]=n,t.fields.push(n))}}),e.each(o.difference(i,t.fields),function(e,t){t.reset()})}),this},_withoutReactualizingFormOptions:function(e){var t=this.actualizeOptions;this.actualizeOptions=function(){return this};var i=e();return this.actualizeOptions=t,i},_trigger:function(e){return this.trigger("form:"+e)}};var y=function(e,t,i,n,s){var r=window.Parsley._validatorRegistry.validators[t],o=new u(r);n=n||e.options[t+"Priority"]||o.priority,_extends(this,{validator:o,name:t,requirements:i,priority:n,isDomConstraint:s=!0===s}),this._parseRequirements(e.options)};y.prototype={validate:function(e,t){var i;return(i=this.validator).validate.apply(i,[e].concat(_toConsumableArray(this.requirementList),[t]))},_parseRequirements:function(e){var t=this;this.requirementList=this.validator.parseRequirements(this.requirements,function(i){return e[t.name+(n=i,n[0].toUpperCase()+n.slice(1))];var n})}};var w=function(t,i,n,s){this.__class__="Field",this.element=t,this.$element=e(t),void 0!==s&&(this.parent=s),this.options=n,this.domOptions=i,this.constraints=[],this.constraintsByName={},this.validationResult=!0,this._bindConstraints()},b={pending:null,resolved:!0,rejected:!1};w.prototype={validate:function(t){arguments.length>=1&&!e.isPlainObject(t)&&(o.warnOnce("Calling validate on a parsley field without passing arguments as an object is deprecated."),t={options:t});var i=this.whenValidate(t);if(!i)return!0;switch(i.state()){case"pending":return null;case"resolved":return!0;case"rejected":return this.validationResult}},whenValidate:function(){var e,t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.force,s=i.group;if(this.refreshConstraints(),!s||this._isInGroup(s))return this.value=this.getValue(),this._trigger("validate"),(e=this.whenValid({force:n,value:this.value,_refreshed:!0}).always(function(){t._reflowUI()}).done(function(){t._trigger("success")}).fail(function(){t._trigger("error")}).always(function(){t._trigger("validated")})).pipe.apply(e,_toConsumableArray(this._pipeAccordingToValidationResult()))},hasConstraints:function(){return 0!==this.constraints.length},needsValidation:function(e){return void 0===e&&(e=this.getValue()),!(!e.length&&!this._isRequired()&&void 0===this.options.validateIfEmpty)},_isInGroup:function(t){return Array.isArray(this.options.group)?-1!==e.inArray(t,this.options.group):this.options.group===t},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){o.warnOnce("Calling isValid on a parsley field without passing arguments as an object is deprecated.");var i=_slice.call(arguments);t={force:i[0],value:i[1]}}var n=this.whenValid(t);return!n||b[n.state()]},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.force,s=void 0!==n&&n,r=i.value,a=i.group;if(i._refreshed||this.refreshConstraints(),!a||this._isInGroup(a)){if(this.validationResult=!0,!this.hasConstraints())return e.when();if(void 0!==r&&null!==r||(r=this.getValue()),!this.needsValidation(r)&&!0!==s)return e.when();var l=this._getGroupedConstraints(),u=[];return e.each(l,function(i,n){var s=o.all(e.map(n,function(e){return t._validateConstraint(r,e)}));if(u.push(s),"rejected"===s.state())return!1}),o.all(u)}},_validateConstraint:function(t,i){var n=this,s=i.validate(t,this);return!1===s&&(s=e.Deferred().reject()),o.all([s]).fail(function(e){n.validationResult instanceof Array||(n.validationResult=[]),n.validationResult.push({assert:i,errorMessage:"string"==typeof e&&e})})},getValue:function(){var e;return void 0===(e="function"==typeof this.options.value?this.options.value(this):void 0!==this.options.value?this.options.value:this.$element.val())||null===e?"":this._handleWhitespace(e)},reset:function(){return this._resetUI(),this._trigger("reset")},destroy:function(){this._destroyUI(),this.$element.removeData("Parsley"),this.$element.removeData("FieldMultiple"),this._trigger("destroy")},refreshConstraints:function(){return this.actualizeOptions()._bindConstraints()},addConstraint:function(e,t,i,n){if(window.Parsley._validatorRegistry.validators[e]){var s=new y(this,e,t,i,n);"undefined"!==this.constraintsByName[s.name]&&this.removeConstraint(s.name),this.constraints.push(s),this.constraintsByName[s.name]=s}return this},removeConstraint:function(e){for(var t=0;t<this.constraints.length;t++)if(e===this.constraints[t].name){this.constraints.splice(t,1);break}return delete this.constraintsByName[e],this},updateConstraint:function(e,t,i){return this.removeConstraint(e).addConstraint(e,t,i)},_bindConstraints:function(){for(var e=[],t={},i=0;i<this.constraints.length;i++)!1===this.constraints[i].isDomConstraint&&(e.push(this.constraints[i]),t[this.constraints[i].name]=this.constraints[i]);this.constraints=e,this.constraintsByName=t;for(var n in this.options)this.addConstraint(n,this.options[n],void 0,!0);return this._bindHtml5Constraints()},_bindHtml5Constraints:function(){null!==this.element.getAttribute("required")&&this.addConstraint("required",!0,void 0,!0),null!==this.element.getAttribute("pattern")&&this.addConstraint("pattern",this.element.getAttribute("pattern"),void 0,!0);var e=this.element.getAttribute("min"),t=this.element.getAttribute("max");null!==e&&null!==t?this.addConstraint("range",[e,t],void 0,!0):null!==e?this.addConstraint("min",e,void 0,!0):null!==t&&this.addConstraint("max",t,void 0,!0),null!==this.element.getAttribute("minlength")&&null!==this.element.getAttribute("maxlength")?this.addConstraint("length",[this.element.getAttribute("minlength"),this.element.getAttribute("maxlength")],void 0,!0):null!==this.element.getAttribute("minlength")?this.addConstraint("minlength",this.element.getAttribute("minlength"),void 0,!0):null!==this.element.getAttribute("maxlength")&&this.addConstraint("maxlength",this.element.getAttribute("maxlength"),void 0,!0);var i=this.element.type;return"number"===i?this.addConstraint("type",["number",{step:this.element.getAttribute("step")||"1",base:e||this.element.getAttribute("value")}],void 0,!0):/^(email|url|range|date)$/i.test(i)?this.addConstraint("type",i,void 0,!0):this},_isRequired:function(){return void 0!==this.constraintsByName.required&&!1!==this.constraintsByName.required.requirements},_trigger:function(e){return this.trigger("field:"+e)},_handleWhitespace:function(e){return!0===this.options.trimValue&&o.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"'),"squish"===this.options.whitespace&&(e=e.replace(/\s{2,}/g," ")),"trim"!==this.options.whitespace&&"squish"!==this.options.whitespace&&!0!==this.options.trimValue||(e=o.trimString(e)),e},_isDateInput:function(){var e=this.constraintsByName.type;return e&&"date"===e.requirements},_getGroupedConstraints:function(){if(!1===this.options.priorityEnabled)return[this.constraints];for(var e=[],t={},i=0;i<this.constraints.length;i++){var n=this.constraints[i].priority;t[n]||e.push(t[n]=[]),t[n].push(this.constraints[i])}return e.sort(function(e,t){return t[0].priority-e[0].priority}),e}};var _=w,C=function(){this.__class__="FieldMultiple"};C.prototype={addElement:function(e){return this.$elements.push(e),this},refreshConstraints:function(){var t;if(this.constraints=[],"SELECT"===this.element.nodeName)return this.actualizeOptions()._bindConstraints(),this;for(var i=0;i<this.$elements.length;i++)if(e("html").has(this.$elements[i]).length){t=this.$elements[i].data("FieldMultiple").refreshConstraints().constraints;for(var n=0;n<t.length;n++)this.addConstraint(t[n].name,t[n].requirements,t[n].priority,t[n].isDomConstraint)}else this.$elements.splice(i,1);return this},getValue:function(){if("function"==typeof this.options.value)return this.options.value(this);if(void 0!==this.options.value)return this.options.value;if("INPUT"===this.element.nodeName){if("radio"===this.element.type)return this._findRelated().filter(":checked").val()||"";if("checkbox"===this.element.type){var t=[];return this._findRelated().filter(":checked").each(function(){t.push(e(this).val())}),t}}return"SELECT"===this.element.nodeName&&null===this.$element.val()?[]:this.$element.val()},_init:function(){return this.$elements=[this.$element],this}};var x=function(t,i,n){this.element=t,this.$element=e(t);var s=this.$element.data("Parsley");if(s)return void 0!==n&&s.parent===window.Parsley&&(s.parent=n,s._resetOptions(s.options)),"object"==typeof i&&_extends(s.options,i),s;if(!this.$element.length)throw new Error("You must bind Parsley on an existing element.");if(void 0!==n&&"Form"!==n.__class__)throw new Error("Parent instance must be a Form instance");return this.parent=n||window.Parsley,this.init(i)};x.prototype={init:function(e){return this.__class__="Parsley",this.__version__="2.7.2",this.__id__=o.generateID(),this._resetOptions(e),"FORM"===this.element.nodeName||o.checkAttr(this.element,this.options.namespace,"validate")&&!this.$element.is(this.options.inputs)?this.bind("parsleyForm"):this.isMultiple()?this.handleMultiple():this.bind("parsleyField")},isMultiple:function(){return"radio"===this.element.type||"checkbox"===this.element.type||"SELECT"===this.element.nodeName&&null!==this.element.getAttribute("multiple")},handleMultiple:function(){var t,i,n=this;if(this.options.multiple=this.options.multiple||(t=this.element.getAttribute("name"))||this.element.getAttribute("id"),"SELECT"===this.element.nodeName&&null!==this.element.getAttribute("multiple"))return this.options.multiple=this.options.multiple||this.__id__,this.bind("parsleyFieldMultiple");if(!this.options.multiple)return o.warn("To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.",this.$element),this;this.options.multiple=this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g,""),t&&e('input[name="'+t+'"]').each(function(e,t){"radio"!==t.type&&"checkbox"!==t.type||t.setAttribute(n.options.namespace+"multiple",n.options.multiple)});for(var s=this._findRelated(),r=0;r<s.length;r++)if(i=e(s.get(r)).data("Parsley"),void 0!==i){this.$element.data("FieldMultiple")||i.addElement(this.$element);break}return this.bind("parsleyField",!0),i||this.bind("parsleyFieldMultiple")},bind:function(t,i){var n;switch(t){case"parsleyForm":n=e.extend(new g(this.element,this.domOptions,this.options),new l,window.ParsleyExtend)._bindFields();break;case"parsleyField":n=e.extend(new _(this.element,this.domOptions,this.options,this.parent),new l,window.ParsleyExtend);break;case"parsleyFieldMultiple":n=e.extend(new _(this.element,this.domOptions,this.options,this.parent),new C,new l,window.ParsleyExtend)._init();break;default:throw new Error(t+"is not a supported Parsley type")}return this.options.multiple&&o.setAttr(this.element,this.options.namespace,"multiple",this.options.multiple),void 0!==i?(this.$element.data("FieldMultiple",n),n):(this.$element.data("Parsley",n),n._actualizeTriggers(),n._trigger("init"),n)}};var D=e.fn.jquery.split(".");if(parseInt(D[0])<=1&&parseInt(D[1])<8)throw"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.";D.forEach||o.warn("Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim");var E=_extends(new l,{element:document,$element:e(document),actualizeOptions:null,_resetOptions:null,Factory:x,version:"2.7.2"});_extends(_.prototype,m.Field,l.prototype),_extends(g.prototype,m.Form,l.prototype),_extends(x.prototype,l.prototype),e.fn.parsley=e.fn.psly=function(t){if(this.length>1){var i=[];return this.each(function(){i.push(e(this).parsley(t))}),i}return e(this).length?new x(this[0],t):void o.warn("You must bind Parsley on an existing element.")},void 0===window.ParsleyExtend&&(window.ParsleyExtend={}),E.options=_extends(o.objectCreate(a),window.ParsleyConfig),window.ParsleyConfig=E.options,window.Parsley=window.psly=E,E.Utils=o,window.ParsleyUtils={},e.each(o,function(e,t){"function"==typeof t&&(window.ParsleyUtils[e]=function(){return o.warnOnce("Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead."),o[e].apply(o,arguments)})});var k=window.Parsley._validatorRegistry=new c(window.ParsleyConfig.validators,window.ParsleyConfig.i18n);window.ParsleyValidator={},e.each("setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator".split(" "),function(e,t){window.Parsley[t]=function(){return k[t].apply(k,arguments)},window.ParsleyValidator[t]=function(){var e;return o.warnOnce("Accessing the method '"+t+"' through Validator is deprecated. Simply call 'window.Parsley."+t+"(...)'"),(e=window.Parsley)[t].apply(e,arguments)}}),window.Parsley.UI=m,window.ParsleyUI={removeError:function(e,t,i){var n=!0!==i;return o.warnOnce("Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method."),e.removeError(t,{updateClass:n})},getErrorsMessages:function(e){return o.warnOnce("Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly."),e.getErrorsMessages()}},e.each("addError updateError".split(" "),function(e,t){window.ParsleyUI[t]=function(e,i,n,s,r){var a=!0!==r;return o.warnOnce("Accessing UI is deprecated. Call '"+t+"' on the instance directly. Please comment in issue 1073 as to your need to call this method."),e[t](i,{message:n,assert:s,updateClass:a})}}),!1!==window.ParsleyConfig.autoBind&&e(function(){e("[data-parsley-validate]").length&&e("[data-parsley-validate]").parsley()});var T=e({}),S=function(){o.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley")},A="parsley:";return e.listen=function(e,n){var s;if(S(),"object"==typeof arguments[1]&&"function"==typeof arguments[2]&&(s=arguments[1],n=arguments[2]),"function"!=typeof n)throw new Error("Wrong parameters");window.Parsley.on(i(e),t(n,s))},e.listenTo=function(e,n,s){if(S(),!(e instanceof _||e instanceof g))throw new Error("Must give Parsley instance");if("string"!=typeof n||"function"!=typeof s)throw new Error("Wrong parameters");e.on(i(n),t(s))},e.unsubscribe=function(e,t){if(S(),"string"!=typeof e||"function"!=typeof t)throw new Error("Wrong arguments");window.Parsley.off(i(e),t.parsleyAdaptedCallback)},e.unsubscribeTo=function(e,t){if(S(),!(e instanceof _||e instanceof g))throw new Error("Must give Parsley instance");e.off(i(t))},e.unsubscribeAll=function(t){S(),window.Parsley.off(i(t)),e("form,input,textarea,select").each(function(){var n=e(this).data("Parsley");n&&n.off(i(t))})},e.emit=function(e,t){var n;S();var s=t instanceof _||t instanceof g,r=Array.prototype.slice.call(arguments,s?2:1);r.unshift(i(e)),s||(t=window.Parsley),(n=t).trigger.apply(n,_toConsumableArray(r))},e.extend(!0,E,{asyncValidators:{default:{fn:function(e){return e.status>=200&&e.status<300},url:!1},reverse:{fn:function(e){return e.status<200||e.status>=300},url:!1}},addAsyncValidator:function(e,t,i,n){return E.asyncValidators[e]={fn:t,url:i||!1,options:n||{}},this}}),E.addValidator("remote",{requirementType:{"":"string",validator:"string",reverse:"boolean",options:"object"},validateString:function(t,i,n,s){var r,o,a={},l=n.validator||(!0===n.reverse?"reverse":"default");if(void 0===E.asyncValidators[l])throw new Error("Calling an undefined async validator: `"+l+"`");(i=E.asyncValidators[l].url||i).indexOf("{value}")>-1?i=i.replace("{value}",encodeURIComponent(t)):a[s.element.getAttribute("name")||s.element.getAttribute("id")]=t;var u=e.extend(!0,n.options||{},E.asyncValidators[l].options);r=e.extend(!0,{},{url:i,data:a,type:"GET"},u),s.trigger("field:ajaxoptions",s,r),o=e.param(r),void 0===E._remoteCache&&(E._remoteCache={});var c=E._remoteCache[o]=E._remoteCache[o]||e.ajax(r),h=function(){var t=E.asyncValidators[l].fn.call(s,c,i,n);return t||(t=e.Deferred().reject()),e.when(t)};return c.then(h,h)},priority:-1}),E.on("form:submit",function(){E._remoteCache={}}),l.prototype.addAsyncValidator=function(){return o.warnOnce("Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`"),E.addAsyncValidator.apply(E,arguments)},E.addMessages("en",{defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",number:"This value should be a valid number.",integer:"This value should be a valid integer.",digits:"This value should be digits.",alphanum:"This value should be alphanumeric."},notblank:"This value should not be blank.",required:"This value is required.",pattern:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or fewer.",length:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or fewer.",check:"You must select between %s and %s choices.",equalto:"This value should be the same."}),E.setLocale("en"),(new function(){var t=this,i=window||global;_extends(this,{isNativeEvent:function(e){return e.originalEvent&&!1!==e.originalEvent.isTrusted},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger("input")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on("change.inputevent",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off("input.inputevent",i.data.selector,t.behavesOk).off("change.inputevent",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched="0.0.3";for(var n=["select",'input[type="checkbox"]','input[type="radio"]','input[type="file"]'],s=0;s<n.length;s++){var r=n[s];e(document).on("input.inputevent",r,{selector:r},t.behavesOk).on("change.inputevent",r,{selector:r},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(".inputevent")}})}).install(),E}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e,t){function i(){return new Date(Date.UTC.apply(Date,arguments))}function n(){var e=new Date;return i(e.getFullYear(),e.getMonth(),e.getDate())}function s(e){return function(){return this[e].apply(this,arguments)}}var r,o=(r={get:function(e){return this.slice(e)[0]},contains:function(e){for(var t=e&&e.valueOf(),i=0,n=this.length;n>i;i++)if(this[i].valueOf()===t)return i;return-1},remove:function(e){this.splice(e,1)},replace:function(t){t&&(e.isArray(t)||(t=[t]),this.clear(),this.push.apply(this,t))},clear:function(){this.length=0},copy:function(){var e=new o;return e.replace(this),e}},function(){var t=[];return t.push.apply(t,arguments),e.extend(t,r),t}),a=function(t,i){e(t).data("datepicker",this),this._process_options(i),this.dates=new o,this.viewDate=this.o.defaultViewDate,this.focusDate=null,this.element=e(t),this.isInput=this.element.is("input"),this.inputField=this.isInput?this.element:this.element.find("input"),this.component=!!this.element.hasClass("date")&&this.element.find(".add-on, .input-group-addon, .btn"),this.hasInput=this.component&&this.inputField.length,this.component&&0===this.component.length&&(this.component=!1),this.isInline=!this.component&&this.element.is("div"),this.picker=e(f.template),this._check_template(this.o.templates.leftArrow)&&this.picker.find(".prev").html(this.o.templates.leftArrow),this._check_template(this.o.templates.rightArrow)&&this.picker.find(".next").html(this.o.templates.rightArrow),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker-inline").appendTo(this.element):this.picker.addClass("datepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("datepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("thead .datepicker-title, tfoot .today, tfoot .clear").attr("colspan",function(e,t){return parseInt(t)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.setDaysOfWeekHighlighted(this.o.daysOfWeekHighlighted),this.setDatesDisabled(this.o.datesDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};a.prototype={constructor:a,_resolveViewName:function(e,i){return 0===e||"days"===e||"month"===e?0:1===e||"months"===e||"year"===e?1:2===e||"years"===e||"decade"===e?2:3===e||"decades"===e||"century"===e?3:4===e||"centuries"===e||"millennium"===e?4:i!==t&&i},_check_template:function(i){try{return i!==t&&""!==i&&((i.match(/[<>]/g)||[]).length<=0||e(i).length>0)}catch(e){return!1}},_process_options:function(t){this._o=e.extend({},this._o,t);var s=this.o=e.extend({},this._o),r=s.language;p[r]||(r=r.split("-")[0],p[r]||(r=h.language)),s.language=r,s.startView=this._resolveViewName(s.startView,0),s.minViewMode=this._resolveViewName(s.minViewMode,0),s.maxViewMode=this._resolveViewName(s.maxViewMode,4),s.startView=Math.min(s.startView,s.maxViewMode),s.startView=Math.max(s.startView,s.minViewMode),!0!==s.multidate&&(s.multidate=Number(s.multidate)||!1,!1!==s.multidate&&(s.multidate=Math.max(0,s.multidate))),s.multidateSeparator=String(s.multidateSeparator),s.weekStart%=7,s.weekEnd=(s.weekStart+6)%7;var o=f.parseFormat(s.format);s.startDate!==-1/0&&(s.startDate?s.startDate instanceof Date?s.startDate=this._local_to_utc(this._zero_time(s.startDate)):s.startDate=f.parseDate(s.startDate,o,s.language,s.assumeNearbyYear):s.startDate=-1/0),s.endDate!==1/0&&(s.endDate?s.endDate instanceof Date?s.endDate=this._local_to_utc(this._zero_time(s.endDate)):s.endDate=f.parseDate(s.endDate,o,s.language,s.assumeNearbyYear):s.endDate=1/0),s.daysOfWeekDisabled=s.daysOfWeekDisabled||[],e.isArray(s.daysOfWeekDisabled)||(s.daysOfWeekDisabled=s.daysOfWeekDisabled.split(/[,\s]*/)),s.daysOfWeekDisabled=e.map(s.daysOfWeekDisabled,function(e){return parseInt(e,10)}),s.daysOfWeekHighlighted=s.daysOfWeekHighlighted||[],e.isArray(s.daysOfWeekHighlighted)||(s.daysOfWeekHighlighted=s.daysOfWeekHighlighted.split(/[,\s]*/)),s.daysOfWeekHighlighted=e.map(s.daysOfWeekHighlighted,function(e){return parseInt(e,10)}),s.datesDisabled=s.datesDisabled||[],e.isArray(s.datesDisabled)||(s.datesDisabled=[s.datesDisabled]),s.datesDisabled=e.map(s.datesDisabled,function(e){return f.parseDate(e,o,s.language,s.assumeNearbyYear)});var a=String(s.orientation).toLowerCase().split(/\s+/g),l=s.orientation.toLowerCase();if(a=e.grep(a,function(e){return/^auto|left|right|top|bottom$/.test(e)}),s.orientation={x:"auto",y:"auto"},l&&"auto"!==l)if(1===a.length)switch(a[0]){case"top":case"bottom":s.orientation.y=a[0];break;case"left":case"right":s.orientation.x=a[0]}else l=e.grep(a,function(e){return/^left|right$/.test(e)}),s.orientation.x=l[0]||"auto",l=e.grep(a,function(e){return/^top|bottom$/.test(e)}),s.orientation.y=l[0]||"auto";if(s.defaultViewDate){var u=s.defaultViewDate.year||(new Date).getFullYear(),c=s.defaultViewDate.month||0,d=s.defaultViewDate.day||1;s.defaultViewDate=i(u,c,d)}else s.defaultViewDate=n()},_events:[],_secondaryEvents:[],_applyEvents:function(e){for(var i,n,s,r=0;r<e.length;r++)i=e[r][0],2===e[r].length?(n=t,s=e[r][1]):3===e[r].length&&(n=e[r][1],s=e[r][2]),i.on(s,n)},_unapplyEvents:function(e){for(var i,n,s,r=0;r<e.length;r++)i=e[r][0],2===e[r].length?(s=t,n=e[r][1]):3===e[r].length&&(s=e[r][1],n=e[r][2]),i.off(n,s)},_buildEvents:function(){var t={keyup:e.proxy(function(t){-1===e.inArray(t.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:e.proxy(this.keydown,this),paste:e.proxy(this.paste,this)};!0===this.o.showOnFocus&&(t.focus=e.proxy(this.show,this)),this.isInput?this._events=[[this.element,t]]:this.component&&this.hasInput?this._events=[[this.inputField,t],[this.component,{click:e.proxy(this.show,this)}]]:this._events=[[this.element,{click:e.proxy(this.show,this),keydown:e.proxy(this.keydown,this)}]],this._events.push([this.element,"*",{blur:e.proxy(function(e){this._focused_from=e.target},this)}],[this.element,{blur:e.proxy(function(e){this._focused_from=e.target},this)}]),this.o.immediateUpdates&&this._events.push([this.element,{"changeYear changeMonth":e.proxy(function(e){this.update(e.date)},this)}]),this._secondaryEvents=[[this.picker,{click:e.proxy(this.click,this)}],[e(window),{resize:e.proxy(this.place,this)}],[e(document),{mousedown:e.proxy(function(e){this.element.is(e.target)||this.element.find(e.target).length||this.picker.is(e.target)||this.picker.find(e.target).length||this.isInline||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(t,i){var n=i||this.dates.get(-1),s=this._utc_to_local(n);this.element.trigger({type:t,date:s,dates:e.map(this.dates,this._utc_to_local),format:e.proxy(function(e,t){0===arguments.length?(e=this.dates.length-1,t=this.o.format):"string"==typeof e&&(t=e,e=this.dates.length-1),t=t||this.o.format;var i=this.dates.get(e);return f.formatDate(i,t,this.o.language)},this)})},show:function(){return this.inputField.prop("disabled")||this.inputField.prop("readonly")&&!1===this.o.enableOnReadonly?void 0:(this.isInline||this.picker.appendTo(this.o.container),this.place(),this.picker.show(),this._attachSecondaryEvents(),this._trigger("show"),(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.o.disableTouchKeyboard&&e(this.element).blur(),this)},hide:function(){return this.isInline||!this.picker.is(":visible")?this:(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&this.inputField.val()&&this.setValue(),this._trigger("hide"),this)},destroy:function(){return this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().datepicker,this.isInput||delete this.element.data().date,this},paste:function(t){var i;if(t.originalEvent.clipboardData&&t.originalEvent.clipboardData.types&&-1!==e.inArray("text/plain",t.originalEvent.clipboardData.types))i=t.originalEvent.clipboardData.getData("text/plain");else{if(!window.clipboardData)return;i=window.clipboardData.getData("Text")}this.setDate(i),this.update(),t.preventDefault()},_utc_to_local:function(e){return e&&new Date(e.getTime()+6e4*e.getTimezoneOffset())},_local_to_utc:function(e){return e&&new Date(e.getTime()-6e4*e.getTimezoneOffset())},_zero_time:function(e){return e&&new Date(e.getFullYear(),e.getMonth(),e.getDate())},_zero_utc_time:function(e){return e&&new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()))},getDates:function(){return e.map(this.dates,this._utc_to_local)},getUTCDates:function(){return e.map(this.dates,function(e){return new Date(e)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){var e=this.dates.get(-1);return void 0!==e?new Date(e):null},clearDates:function(){this.inputField&&this.inputField.val(""),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()},setDates:function(){var t=e.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,t),this._trigger("changeDate"),this.setValue(),this},setUTCDates:function(){var t=e.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,e.map(t,this._utc_to_local)),this._trigger("changeDate"),this.setValue(),this},setDate:s("setDates"),setUTCDate:s("setUTCDates"),remove:s("destroy"),setValue:function(){var e=this.getFormattedDate();return this.inputField.val(e),this},getFormattedDate:function(i){i===t&&(i=this.o.format);var n=this.o.language;return e.map(this.dates,function(e){return f.formatDate(e,i,n)}).join(this.o.multidateSeparator)},getStartDate:function(){return this.o.startDate},setStartDate:function(e){return this._process_options({startDate:e}),this.update(),this.updateNavArrows(),this},getEndDate:function(){return this.o.endDate},setEndDate:function(e){return this._process_options({endDate:e}),this.update(),this.updateNavArrows(),this},setDaysOfWeekDisabled:function(e){return this._process_options({daysOfWeekDisabled:e}),this.update(),this.updateNavArrows(),this},setDaysOfWeekHighlighted:function(e){return this._process_options({daysOfWeekHighlighted:e}),this.update(),this},setDatesDisabled:function(e){this._process_options({datesDisabled:e}),this.update(),this.updateNavArrows()},place:function(){if(this.isInline)return this;var t=this.picker.outerWidth(),i=this.picker.outerHeight(),n=e(this.o.container),s=n.width(),r="body"===this.o.container?e(document).scrollTop():n.scrollTop(),o=n.offset(),a=[];this.element.parents().each(function(){var t=e(this).css("z-index");"auto"!==t&&0!==t&&a.push(parseInt(t))});var l=Math.max.apply(Math,a)+this.o.zIndexOffset,u=this.component?this.component.parent().offset():this.element.offset(),c=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),d=u.left-o.left,p=u.top-o.top;"body"!==this.o.container&&(p+=r),this.picker.removeClass("datepicker-orient-top datepicker-orient-bottom datepicker-orient-right datepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("datepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(d-=t-h)):u.left<0?(this.picker.addClass("datepicker-orient-left"),d-=u.left-10):d+t>s?(this.picker.addClass("datepicker-orient-right"),d+=h-t):this.picker.addClass("datepicker-orient-left");var f=this.o.orientation.y;if("auto"===f&&(f=0>-r+p-i?"bottom":"top"),this.picker.addClass("datepicker-orient-"+f),"top"===f?p-=i+parseInt(this.picker.css("padding-top")):p+=c,this.o.rtl){var m=s-(d+h);this.picker.css({top:p,right:m,zIndex:l})}else this.picker.css({top:p,left:d,zIndex:l});return this},_allow_update:!0,update:function(){if(!this._allow_update)return this;var t=this.dates.copy(),i=[],n=!1;return arguments.length?(e.each(arguments,e.proxy(function(e,t){t instanceof Date&&(t=this._local_to_utc(t)),i.push(t)},this)),n=!0):(i=(i=this.isInput?this.element.val():this.element.data("date")||this.inputField.val())&&this.o.multidate?i.split(this.o.multidateSeparator):[i],delete this.element.data().date),i=e.map(i,e.proxy(function(e){return f.parseDate(e,this.o.format,this.o.language,this.o.assumeNearbyYear)},this)),i=e.grep(i,e.proxy(function(e){return!this.dateWithinRange(e)||!e},this),!0),this.dates.replace(i),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate?this.viewDate=new Date(this.o.endDate):this.viewDate=this.o.defaultViewDate,n?this.setValue():i.length&&String(t)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&t.length&&this._trigger("clearDate"),this.fill(),this.element.change(),this},fillDow:function(){var t=this.o.weekStart,i="<tr>";for(this.o.calendarWeeks&&(this.picker.find(".datepicker-days .datepicker-switch").attr("colspan",function(e,t){return parseInt(t)+1}),i+='<th class="cw">&#160;</th>');t<this.o.weekStart+7;)i+='<th class="dow',e.inArray(t,this.o.daysOfWeekDisabled)>-1&&(i+=" disabled"),i+='">'+p[this.o.language].daysMin[t++%7]+"</th>";i+="</tr>",this.picker.find(".datepicker-days thead").append(i)},fillMonths:function(){for(var e=this._utc_to_local(this.viewDate),t="",i=0;12>i;){t+='<span class="month'+(e&&e.getMonth()===i?" focused":"")+'">'+p[this.o.language].monthsShort[i++]+"</span>"}this.picker.find(".datepicker-months td").html(t)},setRange:function(t){t&&t.length?this.range=e.map(t,function(e){return e.valueOf()}):delete this.range,this.fill()},getClassNames:function(t){var i=[],n=this.viewDate.getUTCFullYear(),s=this.viewDate.getUTCMonth(),r=new Date;return t.getUTCFullYear()<n||t.getUTCFullYear()===n&&t.getUTCMonth()<s?i.push("old"):(t.getUTCFullYear()>n||t.getUTCFullYear()===n&&t.getUTCMonth()>s)&&i.push("new"),this.focusDate&&t.valueOf()===this.focusDate.valueOf()&&i.push("focused"),this.o.todayHighlight&&t.getUTCFullYear()===r.getFullYear()&&t.getUTCMonth()===r.getMonth()&&t.getUTCDate()===r.getDate()&&i.push("today"),-1!==this.dates.contains(t)&&i.push("active"),this.dateWithinRange(t)||i.push("disabled"),this.dateIsDisabled(t)&&i.push("disabled","disabled-date"),-1!==e.inArray(t.getUTCDay(),this.o.daysOfWeekHighlighted)&&i.push("highlighted"),this.range&&(t>this.range[0]&&t<this.range[this.range.length-1]&&i.push("range"),-1!==e.inArray(t.valueOf(),this.range)&&i.push("selected"),t.valueOf()===this.range[0]&&i.push("range-start"),t.valueOf()===this.range[this.range.length-1]&&i.push("range-end")),i},_fill_yearsView:function(i,n,s,r,o,a,l,u){var c,h,d,p,f,m,g,v,y,w,b;for(c="",h=this.picker.find(i),d=parseInt(o/s,10)*s,f=parseInt(a/r,10)*r,m=parseInt(l/r,10)*r,p=e.map(this.dates,function(e){return parseInt(e.getUTCFullYear()/r,10)*r}),h.find(".datepicker-switch").text(d+"-"+(d+9*r)),g=d-r,v=-1;11>v;v+=1)y=[n],w=null,-1===v?y.push("old"):10===v&&y.push("new"),-1!==e.inArray(g,p)&&y.push("active"),(f>g||g>m)&&y.push("disabled"),g===this.viewDate.getFullYear()&&y.push("focused"),u!==e.noop&&(b=u(new Date(g,0,1)),b===t?b={}:"boolean"==typeof b?b={enabled:b}:"string"==typeof b&&(b={classes:b}),!1===b.enabled&&y.push("disabled"),b.classes&&(y=y.concat(b.classes.split(/\s+/))),b.tooltip&&(w=b.tooltip)),c+='<span class="'+y.join(" ")+'"'+(w?' title="'+w+'"':"")+">"+g+"</span>",g+=r;h.find("td").html(c)},fill:function(){var n,s,r=new Date(this.viewDate),o=r.getUTCFullYear(),a=r.getUTCMonth(),l=this.o.startDate!==-1/0?this.o.startDate.getUTCFullYear():-1/0,u=this.o.startDate!==-1/0?this.o.startDate.getUTCMonth():-1/0,c=this.o.endDate!==1/0?this.o.endDate.getUTCFullYear():1/0,h=this.o.endDate!==1/0?this.o.endDate.getUTCMonth():1/0,d=p[this.o.language].today||p.en.today||"",m=p[this.o.language].clear||p.en.clear||"",g=p[this.o.language].titleFormat||p.en.titleFormat;if(!isNaN(o)&&!isNaN(a)){this.picker.find(".datepicker-days .datepicker-switch").text(f.formatDate(r,g,this.o.language)),this.picker.find("tfoot .today").text(d).toggle(!1!==this.o.todayBtn),this.picker.find("tfoot .clear").text(m).toggle(!1!==this.o.clearBtn),this.picker.find("thead .datepicker-title").text(this.o.title).toggle(""!==this.o.title),this.updateNavArrows(),this.fillMonths();var v=i(o,a-1,28),y=f.getDaysInMonth(v.getUTCFullYear(),v.getUTCMonth());v.setUTCDate(y),v.setUTCDate(y-(v.getUTCDay()-this.o.weekStart+7)%7);var w=new Date(v);v.getUTCFullYear()<100&&w.setUTCFullYear(v.getUTCFullYear()),w.setUTCDate(w.getUTCDate()+42),w=w.valueOf();for(var b,_=[];v.valueOf()<w;){if(v.getUTCDay()===this.o.weekStart&&(_.push("<tr>"),this.o.calendarWeeks)){var C=new Date(+v+(this.o.weekStart-v.getUTCDay()-7)%7*864e5),x=new Date(Number(C)+(11-C.getUTCDay())%7*864e5),D=new Date(Number(D=i(x.getUTCFullYear(),0,1))+(11-D.getUTCDay())%7*864e5),E=(x-D)/864e5/7+1;_.push('<td class="cw">'+E+"</td>")}(b=this.getClassNames(v)).push("day"),this.o.beforeShowDay!==e.noop&&((s=this.o.beforeShowDay(this._utc_to_local(v)))===t?s={}:"boolean"==typeof s?s={enabled:s}:"string"==typeof s&&(s={classes:s}),!1===s.enabled&&b.push("disabled"),s.classes&&(b=b.concat(s.classes.split(/\s+/))),s.tooltip&&(n=s.tooltip)),b=e.isFunction(e.uniqueSort)?e.uniqueSort(b):e.unique(b),_.push('<td class="'+b.join(" ")+'"'+(n?' title="'+n+'"':"")+">"+v.getUTCDate()+"</td>"),n=null,v.getUTCDay()===this.o.weekEnd&&_.push("</tr>"),v.setUTCDate(v.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(_.join(""));var k=p[this.o.language].monthsTitle||p.en.monthsTitle||"Months",T=this.picker.find(".datepicker-months").find(".datepicker-switch").text(this.o.maxViewMode<2?k:o).end().find("span").removeClass("active");if(e.each(this.dates,function(e,t){t.getUTCFullYear()===o&&T.eq(t.getUTCMonth()).addClass("active")}),(l>o||o>c)&&T.addClass("disabled"),o===l&&T.slice(0,u).addClass("disabled"),o===c&&T.slice(h+1).addClass("disabled"),this.o.beforeShowMonth!==e.noop){var S=this;e.each(T,function(i,n){var s=new Date(o,i,1),r=S.o.beforeShowMonth(s);r===t?r={}:"boolean"==typeof r?r={enabled:r}:"string"==typeof r&&(r={classes:r}),!1!==r.enabled||e(n).hasClass("disabled")||e(n).addClass("disabled"),r.classes&&e(n).addClass(r.classes),r.tooltip&&e(n).prop("title",r.tooltip)})}this._fill_yearsView(".datepicker-years","year",10,1,o,l,c,this.o.beforeShowYear),this._fill_yearsView(".datepicker-decades","decade",100,10,o,l,c,this.o.beforeShowDecade),this._fill_yearsView(".datepicker-centuries","century",1e3,100,o,l,c,this.o.beforeShowCentury)}},updateNavArrows:function(){if(this._allow_update){var e=new Date(this.viewDate),t=e.getUTCFullYear(),i=e.getUTCMonth();switch(this.viewMode){case 0:this.o.startDate!==-1/0&&t<=this.o.startDate.getUTCFullYear()&&i<=this.o.startDate.getUTCMonth()?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&t>=this.o.endDate.getUTCFullYear()&&i>=this.o.endDate.getUTCMonth()?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"});break;case 1:case 2:case 3:case 4:this.o.startDate!==-1/0&&t<=this.o.startDate.getUTCFullYear()||this.o.maxViewMode<2?this.picker.find(".prev").css({visibility:"hidden"}):this.picker.find(".prev").css({visibility:"visible"}),this.o.endDate!==1/0&&t>=this.o.endDate.getUTCFullYear()||this.o.maxViewMode<2?this.picker.find(".next").css({visibility:"hidden"}):this.picker.find(".next").css({visibility:"visible"})}}},click:function(t){var s,r,o,a,l,u,c;t.preventDefault(),t.stopPropagation(),(s=e(t.target)).hasClass("datepicker-switch")&&this.showMode(1);var h=s.closest(".prev, .next");h.length>0&&(r=f.modes[this.viewMode].navStep*(h.hasClass("prev")?-1:1),0===this.viewMode?(this.viewDate=this.moveMonth(this.viewDate,r),this._trigger("changeMonth",this.viewDate)):(this.viewDate=this.moveYear(this.viewDate,r),1===this.viewMode&&this._trigger("changeYear",this.viewDate)),this.fill()),s.hasClass("today")&&!s.hasClass("day")&&(this.showMode(-2),this._setDate(n(),"linked"===this.o.todayBtn?null:"view")),s.hasClass("clear")&&this.clearDates(),s.hasClass("disabled")||(s.hasClass("day")&&(o=parseInt(s.text(),10)||1,a=this.viewDate.getUTCFullYear(),l=this.viewDate.getUTCMonth(),s.hasClass("old")&&(0===l?(l=11,a-=1,u=!0,c=!0):(l-=1,u=!0)),s.hasClass("new")&&(11===l?(l=0,a+=1,u=!0,c=!0):(l+=1,u=!0)),this._setDate(i(a,l,o)),c&&this._trigger("changeYear",this.viewDate),u&&this._trigger("changeMonth",this.viewDate)),s.hasClass("month")&&(this.viewDate.setUTCDate(1),o=1,l=s.parent().find("span").index(s),a=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(l),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode?(this._setDate(i(a,l,o)),this.showMode()):this.showMode(-1),this.fill()),(s.hasClass("year")||s.hasClass("decade")||s.hasClass("century"))&&(this.viewDate.setUTCDate(1),o=1,l=0,a=parseInt(s.text(),10)||0,this.viewDate.setUTCFullYear(a),s.hasClass("year")&&(this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(i(a,l,o))),s.hasClass("decade")&&(this._trigger("changeDecade",this.viewDate),3===this.o.minViewMode&&this._setDate(i(a,l,o))),s.hasClass("century")&&(this._trigger("changeCentury",this.viewDate),4===this.o.minViewMode&&this._setDate(i(a,l,o))),this.showMode(-1),this.fill())),this.picker.is(":visible")&&this._focused_from&&e(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(e){var t=this.dates.contains(e);if(e||this.dates.clear(),-1!==t?(!0===this.o.multidate||this.o.multidate>1||this.o.toggleActive)&&this.dates.remove(t):!1===this.o.multidate?(this.dates.clear(),this.dates.push(e)):this.dates.push(e),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(e,t){t&&"date"!==t||this._toggle_multidate(e&&new Date(e)),t&&"view"!==t||(this.viewDate=e&&new Date(e)),this.fill(),this.setValue(),t&&"view"===t||this._trigger("changeDate"),this.inputField&&this.inputField.change(),!this.o.autoclose||t&&"date"!==t||this.hide()},moveDay:function(e,t){var i=new Date(e);return i.setUTCDate(e.getUTCDate()+t),i},moveWeek:function(e,t){return this.moveDay(e,7*t)},moveMonth:function(e,t){if(!(i=e)||isNaN(i.getTime()))return this.o.defaultViewDate;var i;if(!t)return e;var n,s,r=new Date(e.valueOf()),o=r.getUTCDate(),a=r.getUTCMonth(),l=Math.abs(t);if(t=t>0?1:-1,1===l)s=-1===t?function(){return r.getUTCMonth()===a}:function(){return r.getUTCMonth()!==n},n=a+t,r.setUTCMonth(n),(0>n||n>11)&&(n=(n+12)%12);else{for(var u=0;l>u;u++)r=this.moveMonth(r,t);n=r.getUTCMonth(),r.setUTCDate(o),s=function(){return n!==r.getUTCMonth()}}for(;s();)r.setUTCDate(--o),r.setUTCMonth(n);return r},moveYear:function(e,t){return this.moveMonth(e,12*t)},moveAvailableDate:function(e,t,i){do{if(e=this[i](e,t),!this.dateWithinRange(e))return!1;i="moveDay"}while(this.dateIsDisabled(e));return e},weekOfDateIsDisabled:function(t){return-1!==e.inArray(t.getUTCDay(),this.o.daysOfWeekDisabled)},dateIsDisabled:function(t){return this.weekOfDateIsDisabled(t)||e.grep(this.o.datesDisabled,function(e){return n=e,(i=t).getUTCFullYear()===n.getUTCFullYear()&&i.getUTCMonth()===n.getUTCMonth()&&i.getUTCDate()===n.getUTCDate();var i,n}).length>0},dateWithinRange:function(e){return e>=this.o.startDate&&e<=this.o.endDate},keydown:function(e){if(this.picker.is(":visible")){var t,i,n=!1,s=this.focusDate||this.viewDate;switch(e.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),e.preventDefault(),e.stopPropagation();break;case 37:case 38:case 39:case 40:if(!this.o.keyboardNavigation||7===this.o.daysOfWeekDisabled.length)break;t=37===e.keyCode||38===e.keyCode?-1:1,0===this.viewMode?e.ctrlKey?(i=this.moveAvailableDate(s,t,"moveYear"))&&this._trigger("changeYear",this.viewDate):e.shiftKey?(i=this.moveAvailableDate(s,t,"moveMonth"))&&this._trigger("changeMonth",this.viewDate):37===e.keyCode||39===e.keyCode?i=this.moveAvailableDate(s,t,"moveDay"):this.weekOfDateIsDisabled(s)||(i=this.moveAvailableDate(s,t,"moveWeek")):1===this.viewMode?((38===e.keyCode||40===e.keyCode)&&(t*=4),i=this.moveAvailableDate(s,t,"moveMonth")):2===this.viewMode&&((38===e.keyCode||40===e.keyCode)&&(t*=4),i=this.moveAvailableDate(s,t,"moveYear")),i&&(this.focusDate=this.viewDate=i,this.setValue(),this.fill(),e.preventDefault());break;case 13:if(!this.o.forceParse)break;s=this.focusDate||this.dates.get(-1)||this.viewDate,this.o.keyboardNavigation&&(this._toggle_multidate(s),n=!0),this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(e.preventDefault(),e.stopPropagation(),this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}n&&(this.dates.length?this._trigger("changeDate"):this._trigger("clearDate"),this.inputField&&this.inputField.change())}else(40===e.keyCode||27===e.keyCode)&&(this.show(),e.stopPropagation())},showMode:function(e){e&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(this.o.maxViewMode,this.viewMode+e))),this.picker.children("div").hide().filter(".datepicker-"+f.modes[this.viewMode].clsName).show(),this.updateNavArrows()}};var l=function(t,i){e(t).data("datepicker",this),this.element=e(t),this.inputs=e.map(i.inputs,function(e){return e.jquery?e[0]:e}),delete i.inputs,c.call(e(this.inputs),i).on("changeDate",e.proxy(this.dateUpdated,this)),this.pickers=e.map(this.inputs,function(t){return e(t).data("datepicker")}),this.updateDates()};l.prototype={updateDates:function(){this.dates=e.map(this.pickers,function(e){return e.getUTCDate()}),this.updateRanges()},updateRanges:function(){var t=e.map(this.dates,function(e){return e.valueOf()});e.each(this.pickers,function(e,i){i.setRange(t)})},dateUpdated:function(t){if(!this.updating){this.updating=!0;var i=e(t.target).data("datepicker");if(void 0!==i){var n=i.getUTCDate(),s=e.inArray(t.target,this.inputs),r=s-1,o=s+1,a=this.inputs.length;if(-1!==s){if(e.each(this.pickers,function(e,t){t.getUTCDate()||t.setUTCDate(n)}),n<this.dates[r])for(;r>=0&&n<this.dates[r];)this.pickers[r--].setUTCDate(n);else if(n>this.dates[o])for(;a>o&&n>this.dates[o];)this.pickers[o++].setUTCDate(n);this.updateDates(),delete this.updating}}}},remove:function(){e.map(this.pickers,function(e){e.remove()}),delete this.element.data().datepicker}};var u=e.fn.datepicker,c=function(i){var n,s=Array.apply(null,arguments);if(s.shift(),this.each(function(){var t=e(this),r=t.data("datepicker"),o="object"==typeof i&&i;if(!r){var u=function(t,i){function n(e,t){return t.toLowerCase()}var s,r=e(t).data(),o={},a=new RegExp("^"+i.toLowerCase()+"([A-Z])");i=new RegExp("^"+i.toLowerCase());for(var l in r)i.test(l)&&(s=l.replace(a,n),o[s]=r[l]);return o}(this,"date"),c=function(t){var i={};if(p[t]||(t=t.split("-")[0],p[t])){var n=p[t];return e.each(d,function(e,t){t in n&&(i[t]=n[t])}),i}}(e.extend({},h,u,o).language),f=e.extend({},h,c,u,o);t.hasClass("input-daterange")||f.inputs?(e.extend(f,{inputs:f.inputs||t.find("input").toArray()}),r=new l(this,f)):r=new a(this,f),t.data("datepicker",r)}"string"==typeof i&&"function"==typeof r[i]&&(n=r[i].apply(r,s))}),n===t||n instanceof a||n instanceof l)return this;if(this.length>1)throw new Error("Using only allowed for the collection of a single element ("+i+" function)");return n};e.fn.datepicker=c;var h=e.fn.datepicker.defaults={assumeNearbyYear:!1,autoclose:!1,beforeShowDay:e.noop,beforeShowMonth:e.noop,beforeShowYear:e.noop,beforeShowDecade:e.noop,beforeShowCentury:e.noop,calendarWeeks:!1,clearBtn:!1,toggleActive:!1,daysOfWeekDisabled:[],daysOfWeekHighlighted:[],datesDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,maxViewMode:4,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0,disableTouchKeyboard:!1,enableOnReadonly:!0,showOnFocus:!0,zIndexOffset:10,container:"body",immediateUpdates:!1,title:"",templates:{leftArrow:"&laquo;",rightArrow:"&raquo;"}},d=e.fn.datepicker.locale_opts=["format","rtl","weekStart"];e.fn.datepicker.Constructor=a;var p=e.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["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"],today:"Today",clear:"Clear",titleFormat:"MM yyyy"}},f={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10},{clsName:"decades",navFnc:"FullDecade",navStep:100},{clsName:"centuries",navFnc:"FullCentury",navStep:1e3}],isLeapYear:function(e){return e%4==0&&e%100!=0||e%400==0},getDaysInMonth:function(e,t){return[31,f.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\u5e74\u6708\u65e5\[-`{-~\t\n\r]+/g,parseFormat:function(e){if("function"==typeof e.toValue&&"function"==typeof e.toDisplay)return e;var t=e.replace(this.validParts,"\0").split("\0"),i=e.match(this.validParts);if(!t||!t.length||!i||0===i.length)throw new Error("Invalid date format.");return{separators:t,parts:i}},parseDate:function(s,r,o,l){function u(e,t){return!0===t&&(t=10),100>e&&((e+=2e3)>(new Date).getFullYear()+t&&(e-=100)),e}function c(){var e=this.slice(0,y[m].length),t=y[m].slice(0,e.length);return e.toLowerCase()===t.toLowerCase()}if(!s)return t;if(s instanceof Date)return s;if("string"==typeof r&&(r=f.parseFormat(r)),r.toValue)return r.toValue(s,r,o);var h,d,m,g,v=/([\-+]\d+)([dmwy])/,y=s.match(/([\-+]\d+)([dmwy])/g),w={d:"moveDay",m:"moveMonth",w:"moveWeek",y:"moveYear"},b={yesterday:"-1d",today:"+0d",tomorrow:"+1d"};if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(s)){for(s=new Date,m=0;m<y.length;m++)h=v.exec(y[m]),d=parseInt(h[1]),g=w[h[2]],s=a.prototype[g](s,d);return i(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}if(void 0!==b[s]&&(y=(s=b[s]).match(/([\-+]\d+)([dmwy])/g),/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(s))){for(s=new Date,m=0;m<y.length;m++)h=v.exec(y[m]),d=parseInt(h[1]),g=w[h[2]],s=a.prototype[g](s,d);return i(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}y=s&&s.match(this.nonpunctuation)||[],s=new Date;var _,C,x={},D=["yyyy","yy","M","MM","m","mm","d","dd"],E={yyyy:function(e,t){return e.setUTCFullYear(l?u(t,l):t)},yy:function(e,t){return e.setUTCFullYear(l?u(t,l):t)},m:function(e,t){if(isNaN(e))return e;for(t-=1;0>t;)t+=12;for(t%=12,e.setUTCMonth(t);e.getUTCMonth()!==t;)e.setUTCDate(e.getUTCDate()-1);return e},d:function(e,t){return e.setUTCDate(t)}};E.M=E.MM=E.mm=E.m,E.dd=E.d,s=n();var k=r.parts.slice();if(y.length!==k.length&&(k=e(k).filter(function(t,i){return-1!==e.inArray(i,D)}).toArray()),y.length===k.length){var T,S,A;for(m=0,T=k.length;T>m;m++){if(_=parseInt(y[m],10),h=k[m],isNaN(_))switch(h){case"MM":C=e(p[o].months).filter(c),_=e.inArray(C[0],p[o].months)+1;break;case"M":C=e(p[o].monthsShort).filter(c),_=e.inArray(C[0],p[o].monthsShort)+1}x[h]=_}for(m=0;m<D.length;m++)A=D[m],A in x&&!isNaN(x[A])&&(S=new Date(s),E[A](S,x[A]),isNaN(S)||(s=S))}return s},formatDate:function(t,i,n){if(!t)return"";if("string"==typeof i&&(i=f.parseFormat(i)),i.toDisplay)return i.toDisplay(t,i,n);var s={d:t.getUTCDate(),D:p[n].daysShort[t.getUTCDay()],DD:p[n].days[t.getUTCDay()],m:t.getUTCMonth()+1,M:p[n].monthsShort[t.getUTCMonth()],MM:p[n].months[t.getUTCMonth()],yy:t.getUTCFullYear().toString().substring(2),yyyy:t.getUTCFullYear()};s.dd=(s.d<10?"0":"")+s.d,s.mm=(s.m<10?"0":"")+s.m,t=[];for(var r=e.extend([],i.separators),o=0,a=i.parts.length;a>=o;o++)r.length&&t.push(r.shift()),t.push(s[i.parts[o]]);return t.join("")},headTemplate:'<thead><tr><th colspan="7" class="datepicker-title"></th></tr><tr><th class="prev">&laquo;</th><th colspan="5" class="datepicker-switch"></th><th class="next">&raquo;</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};f.template='<div class="datepicker"><div class="datepicker-days"><table class="table-condensed">'+f.headTemplate+"<tbody></tbody>"+f.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+f.headTemplate+f.contTemplate+f.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+f.headTemplate+f.contTemplate+f.footTemplate+'</table></div><div class="datepicker-decades"><table class="table-condensed">'+f.headTemplate+f.contTemplate+f.footTemplate+'</table></div><div class="datepicker-centuries"><table class="table-condensed">'+f.headTemplate+f.contTemplate+f.footTemplate+"</table></div></div>",e.fn.datepicker.DPGlobal=f,e.fn.datepicker.noConflict=function(){return e.fn.datepicker=u,this},e.fn.datepicker.version="1.6.4",e(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(t){var i=e(this);i.data("datepicker")||(t.preventDefault(),c.call(i,"show"))}),e(function(){c.call(e('[data-provide="datepicker-inline"]'))})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(i),i}:e(jQuery)}(function(e){var t=function(){if(e&&e.fn&&e.fn.select2&&e.fn.select2.amd)var t=e.fn.select2.amd;var i,n,s;return t&&t.requirejs||(t?n=t:t={},function(e){function t(e,t){return w.call(e,t)}function r(e,t){var i,n,s,r,o,a,l,u,c,h,d,p=t&&t.split("/"),f=v.map,m=f&&f["*"]||{};if(e){for(o=(e=e.split("/")).length-1,v.nodeIdCompat&&_.test(e[o])&&(e[o]=e[o].replace(_,"")),"."===e[0].charAt(0)&&p&&(e=p.slice(0,p.length-1).concat(e)),c=0;c<e.length;c++)if("."===(d=e[c]))e.splice(c,1),c-=1;else if(".."===d){if(0===c||1===c&&".."===e[2]||".."===e[c-1])continue;c>0&&(e.splice(c-1,2),c-=2)}e=e.join("/")}if((p||m)&&f){for(c=(i=e.split("/")).length;c>0;c-=1){if(n=i.slice(0,c).join("/"),p)for(h=p.length;h>0;h-=1)if((s=f[p.slice(0,h).join("/")])&&(s=s[n])){r=s,a=c;break}if(r)break;!l&&m&&m[n]&&(l=m[n],u=c)}!r&&l&&(r=l,a=u),r&&(i.splice(0,a,r),e=i.join("/"))}return e}function o(t,i){return function(){var n=b.call(arguments,0);return"string"!=typeof n[0]&&1===n.length&&n.push(null),d.apply(e,n.concat([t,i]))}}function a(e){return function(t){m[e]=t}}function l(i){if(t(g,i)){var n=g[i];delete g[i],y[i]=!0,h.apply(e,n)}if(!t(m,i)&&!t(y,i))throw new Error("No "+i);return m[i]}function u(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function c(e){return e?u(e):[]}var h,d,p,f,m={},g={},v={},y={},w=Object.prototype.hasOwnProperty,b=[].slice,_=/\.js$/;p=function(e,t){var i,n,s=u(e),o=s[0],a=t[1];return e=s[1],o&&(i=l(o=r(o,a))),o?e=i&&i.normalize?i.normalize(e,(n=a,function(e){return r(e,n)})):r(e,a):(o=(s=u(e=r(e,a)))[0],e=s[1],o&&(i=l(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:i}},f={require:function(e){return o(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:(t=e,function(){return v&&v.config&&v.config[t]||{}})};var t}},h=function(i,n,s,r){var u,h,d,v,w,b,_,C=[],x=typeof s;if(b=c(r=r||i),"undefined"===x||"function"===x){for(n=!n.length&&s.length?["require","exports","module"]:n,w=0;w<n.length;w+=1)if(v=p(n[w],b),"require"===(h=v.f))C[w]=f.require(i);else if("exports"===h)C[w]=f.exports(i),_=!0;else if("module"===h)u=C[w]=f.module(i);else if(t(m,h)||t(g,h)||t(y,h))C[w]=l(h);else{if(!v.p)throw new Error(i+" missing "+h);v.p.load(v.n,o(r,!0),a(h),{}),C[w]=m[h]}d=s?s.apply(m[i],C):void 0,i&&(u&&u.exports!==e&&u.exports!==m[i]?m[i]=u.exports:d===e&&_||(m[i]=d))}else i&&(m[i]=s)},i=n=d=function(t,i,n,s,r){if("string"==typeof t)return f[t]?f[t](i):l(p(t,c(i)).f);if(!t.splice){if((v=t).deps&&d(v.deps,v.callback),!i)return;i.splice?(t=i,i=n,n=null):t=e}return i=i||function(){},"function"==typeof n&&(n=s,s=r),s?h(e,t,i,n):setTimeout(function(){h(e,t,i,n)},4),d},d.config=function(e){return d(e)},i._defined=m,(s=function(e,i,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");i.splice||(n=i,i=[]),t(m,e)||t(g,e)||(g[e]=[e,i,n])}).amd={jQuery:!0}}(),t.requirejs=i,t.require=n,t.define=s),t.define("almond",function(){}),t.define("jquery",[],function(){var t=e||$;return null==t&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),t}),t.define("select2/utils",["jquery"],function(e){function t(e){var t=e.prototype,i=[];for(var n in t)"function"==typeof t[n]&&"constructor"!==n&&i.push(n);return i}var i={Extend:function(e,t){function i(){this.constructor=e}var n={}.hasOwnProperty;for(var s in t)n.call(t,s)&&(e[s]=t[s]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},Decorate:function(e,i){function n(){var t=Array.prototype.unshift,n=i.prototype.constructor.length,s=e.prototype.constructor;n>0&&(t.call(arguments,e.prototype.constructor),s=i.prototype.constructor),s.apply(this,arguments)}var s=t(i),r=t(e);i.displayName=e.displayName,n.prototype=new function(){this.constructor=n};for(var o=0;o<r.length;o++){var a=r[o];n.prototype[a]=e.prototype[a]}for(var l=function(e){var t=function(){};e in n.prototype&&(t=n.prototype[e]);var s=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),s.apply(this,arguments)}},u=0;u<s.length;u++){var c=s[u];n.prototype[c]=l(c)}return n}},n=function(){this.listeners={}};return n.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},n.prototype.trigger=function(e){var t=Array.prototype.slice,i=t.call(arguments,1);this.listeners=this.listeners||{},null==i&&(i=[]),0===i.length&&i.push({}),i[0]._type=e,e in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},n.prototype.invoke=function(e,t){for(var i=0,n=e.length;i<n;i++)e[i].apply(this,t)},i.Observable=n,i.generateChars=function(e){for(var t="",i=0;i<e;i++)t+=Math.floor(36*Math.random()).toString(36);return t},i.bind=function(e,t){return function(){e.apply(t,arguments)}},i._convertData=function(e){for(var t in e){var i=t.split("-"),n=e;if(1!==i.length){for(var s=0;s<i.length;s++){var r=i[s];(r=r.substring(0,1).toLowerCase()+r.substring(1))in n||(n[r]={}),s==i.length-1&&(n[r]=e[t]),n=n[r]}delete e[t]}}return e},i.hasScroll=function(t,i){var n=e(i),s=i.style.overflowX,r=i.style.overflowY;return(s!==r||"hidden"!==r&&"visible"!==r)&&("scroll"===s||"scroll"===r||n.innerHeight()<i.scrollHeight||n.innerWidth()<i.scrollWidth)},i.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.appendMany=function(t,i){if("1.7"===e.fn.jquery.substr(0,3)){var n=e();e.map(i,function(e){n=n.add(e)}),i=n}t.append(i)},i}),t.define("select2/results",["jquery","./utils"],function(e,t){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return t.Extend(i,t.Observable),i.prototype.render=function(){var t=e('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t,t},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(t){var i=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=e('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),s=this.options.get("translations").get(t.message);n.append(i(s(t.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var i=0;i<e.results.length;i++){var n=e.results[i],s=this.option(n);t.push(s)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},i.prototype.position=function(e,t){t.find(".select2-results").append(e)},i.prototype.sort=function(e){return this.options.get("sorter")(e)},i.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option[aria-selected]"),t=e.filter("[aria-selected=true]");t.length>0?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},i.prototype.setClasses=function(){var t=this;this.data.current(function(i){var n=e.map(i,function(e){return e.id.toString()});t.$results.find(".select2-results__option[aria-selected]").each(function(){var t=e(this),i=e.data(this,"data"),s=""+i.id;null!=i.element&&i.element.selected||null==i.element&&e.inArray(s,n)>-1?t.attr("aria-selected","true"):t.attr("aria-selected","false")})})},i.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},i=this.option(t);i.className+=" loading-results",this.$results.prepend(i)},i.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},i.prototype.option=function(t){var i=document.createElement("li");i.className="select2-results__option";var n={role:"treeitem","aria-selected":"false"};t.disabled&&(delete n["aria-selected"],n["aria-disabled"]="true"),null==t.id&&delete n["aria-selected"],null!=t._resultId&&(i.id=t._resultId),t.title&&(i.title=t.title),t.children&&(n.role="group",n["aria-label"]=t.text,delete n["aria-selected"]);for(var s in n){var r=n[s];i.setAttribute(s,r)}if(t.children){var o=e(i),a=document.createElement("strong");a.className="select2-results__group",e(a),this.template(t,a);for(var l=[],u=0;u<t.children.length;u++){var c=t.children[u],h=this.option(c);l.push(h)}var d=e("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});d.append(l),o.append(a),o.append(d)}else this.template(t,i);return e.data(i,"data",t),i},i.prototype.bind=function(t,i){var n=this,s=t.id+"-results";this.$results.attr("id",s),t.on("results:all",function(e){n.clear(),n.append(e.data),t.isOpen()&&(n.setClasses(),n.highlightFirstItem())}),t.on("results:append",function(e){n.append(e.data),t.isOpen()&&n.setClasses()}),t.on("query",function(e){n.hideMessages(),n.showLoading(e)}),t.on("select",function(){t.isOpen()&&(n.setClasses(),n.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(n.setClasses(),n.highlightFirstItem())}),t.on("open",function(){n.$results.attr("aria-expanded","true"),n.$results.attr("aria-hidden","false"),n.setClasses(),n.ensureHighlightVisible()}),t.on("close",function(){n.$results.attr("aria-expanded","false"),n.$results.attr("aria-hidden","true"),n.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=n.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=n.getHighlightedResults();if(0!==e.length){var t=e.data("data");"true"==e.attr("aria-selected")?n.trigger("close",{}):n.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=n.getHighlightedResults(),t=n.$results.find("[aria-selected]"),i=t.index(e);if(0!==i){var s=i-1;0===e.length&&(s=0);var r=t.eq(s);r.trigger("mouseenter");var o=n.$results.offset().top,a=r.offset().top,l=n.$results.scrollTop()+(a-o);0===s?n.$results.scrollTop(0):a-o<0&&n.$results.scrollTop(l)}}),t.on("results:next",function(){var e=n.getHighlightedResults(),t=n.$results.find("[aria-selected]"),i=t.index(e)+1;if(!(i>=t.length)){var s=t.eq(i);s.trigger("mouseenter");var r=n.$results.offset().top+n.$results.outerHeight(!1),o=s.offset().top+s.outerHeight(!1),a=n.$results.scrollTop()+o-r;0===i?n.$results.scrollTop(0):o>r&&n.$results.scrollTop(a)}}),t.on("results:focus",function(e){e.element.addClass("select2-results__option--highlighted")}),t.on("results:message",function(e){n.displayMessage(e)}),e.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=n.$results.scrollTop(),i=n.$results.get(0).scrollHeight-t+e.deltaY,s=e.deltaY>0&&t-e.deltaY<=0,r=e.deltaY<0&&i<=n.$results.height();s?(n.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):r&&(n.$results.scrollTop(n.$results.get(0).scrollHeight-n.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(t){var i=e(this),s=i.data("data");"true"!==i.attr("aria-selected")?n.trigger("select",{originalEvent:t,data:s}):n.options.get("multiple")?n.trigger("unselect",{originalEvent:t,data:s}):n.trigger("close",{})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(t){var i=e(this).data("data");n.getHighlightedResults().removeClass("select2-results__option--highlighted"),n.trigger("results:focus",{data:i,element:e(this)})})},i.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},i.prototype.destroy=function(){this.$results.remove()},i.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find("[aria-selected]").index(e),i=this.$results.offset().top,n=e.offset().top,s=this.$results.scrollTop()+(n-i),r=n-i;s-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(r>this.$results.outerHeight()||r<0)&&this.$results.scrollTop(s)}},i.prototype.template=function(t,i){var n=this.options.get("templateResult"),s=this.options.get("escapeMarkup"),r=n(t,i);null==r?i.style.display="none":"string"==typeof r?i.innerHTML=s(r):e(i).append(r)},i}),t.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}}),t.define("select2/selection/base",["jquery","../utils","../keys"],function(e,t,i){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,t.Observable),n.prototype.render=function(){var t=e('<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"></span>');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")),t.attr("title",this.$element.attr("title")),t.attr("tabindex",this._tabindex),this.$selection=t,t},n.prototype.bind=function(e,t){var n=this,s=(e.id,e.id+"-results");this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===i.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",s),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.focus(),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex)}),e.on("disable",function(){n.$selection.attr("tabindex","-1")})},n.prototype._handleBlur=function(t){var i=this;window.setTimeout(function(){document.activeElement==i.$selection[0]||e.contains(i.$selection[0],document.activeElement)||i.trigger("blur",t)},1)},n.prototype._attachCloseHandler=function(t){e(document.body).on("mousedown.select2."+t.id,function(t){var i=e(t.target).closest(".select2");e(".select2.select2-container--open").each(function(){var t=e(this);this!=i[0]&&t.data("element").select2("close")})})},n.prototype._detachCloseHandler=function(t){e(document.body).off("mousedown.select2."+t.id)},n.prototype.position=function(e,t){t.find(".selection").append(e)},n.prototype.destroy=function(){this._detachCloseHandler(this.container)},n.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},n}),t.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,i,n){function s(){s.__super__.constructor.apply(this,arguments)}return i.Extend(s,t),s.prototype.render=function(){var e=s.__super__.render.call(this);return e.addClass("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},s.prototype.bind=function(e,t){var i=this;s.__super__.bind.apply(this,arguments);var n=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",n),this.$selection.attr("aria-labelledby",n),this.$selection.on("mousedown",function(e){1===e.which&&i.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),e.on("focus",function(t){e.isOpen()||i.$selection.focus()}),e.on("selection:update",function(e){i.update(e.data)})},s.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},s.prototype.display=function(e,t){var i=this.options.get("templateSelection");return this.options.get("escapeMarkup")(i(e,t))},s.prototype.selectionContainer=function(){return e("<span></span>")},s.prototype.update=function(e){if(0!==e.length){var t=e[0],i=this.$selection.find(".select2-selection__rendered"),n=this.display(t,i);i.empty().append(n),i.prop("title",t.title||t.text)}else this.clear()},s}),t.define("select2/selection/multiple",["jquery","./base","../utils"],function(e,t,i){function n(e,t){n.__super__.constructor.apply(this,arguments)}return i.Extend(n,t),n.prototype.render=function(){var e=n.__super__.render.call(this);return e.addClass("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},n.prototype.bind=function(t,i){var s=this;n.__super__.bind.apply(this,arguments),this.$selection.on("click",function(e){s.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(t){if(!s.options.get("disabled")){var i=e(this).parent().data("data");s.trigger("unselect",{originalEvent:t,data:i})}})},n.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},n.prototype.display=function(e,t){var i=this.options.get("templateSelection");return this.options.get("escapeMarkup")(i(e,t))},n.prototype.selectionContainer=function(){return e('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>')},n.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=0;n<e.length;n++){var s=e[n],r=this.selectionContainer(),o=this.display(s,r);r.append(o),r.prop("title",s.title||s.text),r.data("data",s),t.push(r)}var a=this.$selection.find(".select2-selection__rendered");i.appendMany(a,t)}},n}),t.define("select2/selection/placeholder",["../utils"],function(e){function t(e,t,i){this.placeholder=this.normalizePlaceholder(i.get("placeholder")),e.call(this,t,i)}return t.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},t.prototype.createPlaceholder=function(e,t){var i=this.selectionContainer();return i.html(this.display(t)),i.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),i},t.prototype.update=function(e,t){var i=1==t.length&&t[0].id!=this.placeholder.id;if(t.length>1||i)return e.call(this,t);this.clear();var n=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(n)},t}),t.define("select2/selection/allowClear",["jquery","../keys"],function(e,t){function i(){}return i.prototype.bind=function(e,t,i){var n=this;e.call(this,t,i),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(e){n._handleClear(e)}),t.on("keypress",function(e){n._handleKeyboardClear(e,t)})},i.prototype._handleClear=function(e,t){if(!this.options.get("disabled")){var i=this.$selection.find(".select2-selection__clear");if(0!==i.length){t.stopPropagation();for(var n=i.data("data"),s=0;s<n.length;s++){var r={data:n[s]};if(this.trigger("unselect",r),r.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},i.prototype._handleKeyboardClear=function(e,i,n){n.isOpen()||i.which!=t.DELETE&&i.which!=t.BACKSPACE||this._handleClear(i)},i.prototype.update=function(t,i){if(t.call(this,i),!(this.$selection.find(".select2-selection__placeholder").length>0||0===i.length)){var n=e('<span class="select2-selection__clear">&times;</span>');n.data("data",i),this.$selection.find(".select2-selection__rendered").prepend(n)}},i}),t.define("select2/selection/search",["jquery","../utils","../keys"],function(e,t,i){function n(e,t,i){e.call(this,t,i)}return n.prototype.render=function(t){var i=e('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=i,this.$search=i.find("input");var n=t.call(this);return this._transferTabIndex(),n},n.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("open",function(){s.$search.trigger("focus")}),t.on("close",function(){s.$search.val(""),s.$search.removeAttr("aria-activedescendant"),s.$search.trigger("focus")}),t.on("enable",function(){s.$search.prop("disabled",!1),s._transferTabIndex()}),t.on("disable",function(){s.$search.prop("disabled",!0)}),t.on("focus",function(e){s.$search.trigger("focus")}),t.on("results:focus",function(e){s.$search.attr("aria-activedescendant",e.id)}),this.$selection.on("focusin",".select2-search--inline",function(e){s.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){s._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented(),e.which===i.BACKSPACE&&""===s.$search.val()){var t=s.$searchContainer.prev(".select2-selection__choice");if(t.length>0){var n=t.data("data");s.searchRemoveChoice(n),e.preventDefault()}}});var r=document.documentMode,o=r&&r<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){o?s.$selection.off("input.search input.searchcheck"):s.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(o&&"input"===e.type)s.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=i.SHIFT&&t!=i.CTRL&&t!=i.ALT&&t!=i.TAB&&s.handleSearch(e)}})},n.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},n.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},n.prototype.update=function(e,t){var i=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),i&&this.$search.focus()},n.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},n.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},n.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="";e=""!==this.$search.attr("placeholder")?this.$selection.find(".select2-selection__rendered").innerWidth():.75*(this.$search.val().length+1)+"em",this.$search.css("width",e)},n}),t.define("select2/selection/eventRelay",["jquery"],function(e){function t(){}return t.prototype.bind=function(t,i,n){var s=this,r=["open","opening","close","closing","select","selecting","unselect","unselecting"],o=["opening","closing","selecting","unselecting"];t.call(this,i,n),i.on("*",function(t,i){if(-1!==e.inArray(t,r)){i=i||{};var n=e.Event("select2:"+t,{params:i});s.$element.trigger(n),-1!==e.inArray(t,o)&&(i.prevented=n.isDefaultPrevented())}})},t}),t.define("select2/translation",["jquery","require"],function(e,t){function i(e){this.dict=e||{}}return i.prototype.all=function(){return this.dict},i.prototype.get=function(e){return this.dict[e]},i.prototype.extend=function(t){this.dict=e.extend({},t.all(),this.dict)},i._cache={},i.loadPath=function(e){if(!(e in i._cache)){var n=t(e);i._cache[e]=n}return new i(i._cache[e])},i}),t.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","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"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","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"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","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"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","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"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","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"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","Ⓣ":"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","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"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","ⓐ":"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","ⓒ":"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","ǳ":"dz","ǆ":"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","ⓖ":"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","ƕ":"hv","ⓘ":"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","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"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","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"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","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),t.define("select2/data/base",["../utils"],function(e){function t(e,i){t.__super__.constructor.call(this)}return e.Extend(t,e.Observable),t.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},t.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},t.prototype.bind=function(e,t){},t.prototype.destroy=function(){},t.prototype.generateResultId=function(t,i){var n=t.id+"-result-";return n+=e.generateChars(4),null!=i.id?n+="-"+i.id.toString():n+="-"+e.generateChars(4),n},t}),t.define("select2/data/select",["./base","../utils","jquery"],function(e,t,i){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return t.Extend(n,e),n.prototype.current=function(e){var t=[],n=this;this.$element.find(":selected").each(function(){var e=i(this),s=n.item(e);t.push(s)}),e(t)},n.prototype.select=function(e){var t=this;if(e.selected=!0,i(e.element).is("option"))return e.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(n){var s=[];(e=[e]).push.apply(e,n);for(var r=0;r<e.length;r++){var o=e[r].id;-1===i.inArray(o,s)&&s.push(o)}t.$element.val(s),t.$element.trigger("change")});else{var n=e.id;this.$element.val(n),this.$element.trigger("change")}},n.prototype.unselect=function(e){var t=this;if(this.$element.prop("multiple")){if(e.selected=!1,i(e.element).is("option"))return e.element.selected=!1,void this.$element.trigger("change");this.current(function(n){for(var s=[],r=0;r<n.length;r++){var o=n[r].id;o!==e.id&&-1===i.inArray(o,s)&&s.push(o)}t.$element.val(s),t.$element.trigger("change")})}},n.prototype.bind=function(e,t){var i=this;this.container=e,e.on("select",function(e){i.select(e.data)}),e.on("unselect",function(e){i.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){i.removeData(this,"data")})},n.prototype.query=function(e,t){var n=[],s=this;this.$element.children().each(function(){var t=i(this);if(t.is("option")||t.is("optgroup")){var r=s.item(t),o=s.matches(e,r);null!==o&&n.push(o)}}),t({results:n})},n.prototype.addOptions=function(e){t.appendMany(this.$element,e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=i(t),s=this._normalizeItem(e);return s.element=t,i.data(t,"data",s),n},n.prototype.item=function(e){var t={};if(null!=(t=i.data(e[0],"data")))return t;if(e.is("option"))t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if(e.is("optgroup")){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var n=e.children("option"),s=[],r=0;r<n.length;r++){var o=i(n[r]),a=this.item(o);s.push(a)}t.children=s}return(t=this._normalizeItem(t)).element=e[0],i.data(e[0],"data",t),t},n.prototype._normalizeItem=function(e){i.isPlainObject(e)||(e={id:e,text:e});return null!=(e=i.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),i.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),t.define("select2/data/array",["./select","../utils","jquery"],function(e,t,i){function n(e,t){var i=t.get("data")||[];n.__super__.constructor.call(this,e,t),this.addOptions(this.convertToOptions(i))}return t.Extend(n,e),n.prototype.select=function(e){var t=this.$element.find("option").filter(function(t,i){return i.value==e.id.toString()});0===t.length&&(t=this.option(e),this.addOptions(t)),n.__super__.select.call(this,e)},n.prototype.convertToOptions=function(e){function n(e){return function(){return i(this).val()==e.id}}for(var s=this,r=this.$element.find("option"),o=r.map(function(){return s.item(i(this)).id}).get(),a=[],l=0;l<e.length;l++){var u=this._normalizeItem(e[l]);if(i.inArray(u.id,o)>=0){var c=r.filter(n(u)),h=this.item(c),d=i.extend(!0,{},u,h),p=this.option(d);c.replaceWith(p)}else{var f=this.option(u);if(u.children){var m=this.convertToOptions(u.children);t.appendMany(f,m)}a.push(f)}}return a},n}),t.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,i){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return i.extend({},e,{q:e.term})},transport:function(e,t,n){var s=i.ajax(e);return s.then(t),s.fail(n),s}};return i.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(e,t){function n(){var n=r.transport(r,function(n){var r=s.processResults(n,e);s.options.get("debug")&&window.console&&console.error&&(r&&r.results&&i.isArray(r.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),t(r)},function(){n.status&&"0"===n.status||s.trigger("results:message",{message:"errorLoading"})});s._request=n}var s=this;null!=this._request&&(i.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var r=i.extend({type:"GET"},this.ajaxOptions);"function"==typeof r.url&&(r.url=r.url.call(this.$element,e)),"function"==typeof r.data&&(r.data=r.data.call(this.$element,e)),this.ajaxOptions.delay&&null!=e.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(n,this.ajaxOptions.delay)):n()},n}),t.define("select2/data/tags",["jquery"],function(e){function t(t,i,n){var s=n.get("tags"),r=n.get("createTag");void 0!==r&&(this.createTag=r);var o=n.get("insertTag");if(void 0!==o&&(this.insertTag=o),t.call(this,i,n),e.isArray(s))for(var a=0;a<s.length;a++){var l=s[a],u=this._normalizeItem(l),c=this.option(u);this.$element.append(c)}}return t.prototype.query=function(e,t,i){var n=this;this._removeOldTags(),null!=t.term&&null==t.page?e.call(this,t,function e(s,r){for(var o=s.results,a=0;a<o.length;a++){var l=o[a],u=null!=l.children&&!e({results:l.children},!0);if((l.text||"").toUpperCase()===(t.term||"").toUpperCase()||u)return!r&&(s.data=o,void i(s))}if(r)return!0;var c=n.createTag(t);if(null!=c){var h=n.option(c);h.attr("data-select2-tag",!0),n.addOptions([h]),n.insertTag(o,c)}s.results=o,i(s)}):e.call(this,t,i)},t.prototype.createTag=function(t,i){var n=e.trim(i.term);return""===n?null:{id:n,text:n}},t.prototype.insertTag=function(e,t,i){t.unshift(i)},t.prototype._removeOldTags=function(t){this._lastTag,this.$element.find("option[data-select2-tag]").each(function(){this.selected||e(this).remove()})},t}),t.define("select2/data/tokenizer",["jquery"],function(e){function t(e,t,i){var n=i.get("tokenizer");void 0!==n&&(this.tokenizer=n),e.call(this,t,i)}return t.prototype.bind=function(e,t,i){e.call(this,t,i),this.$search=t.dropdown.$search||t.selection.$search||i.find(".select2-search__field")},t.prototype.query=function(t,i,n){var s=this;i.term=i.term||"";var r=this.tokenizer(i,this.options,function(t){var i,n=s._normalizeItem(t);if(!s.$element.find("option").filter(function(){return e(this).val()===n.id}).length){var r=s.option(n);r.attr("data-select2-tag",!0),s._removeOldTags(),s.addOptions([r])}i=n,s.trigger("select",{data:i})});r.term!==i.term&&(this.$search.length&&(this.$search.val(r.term),this.$search.focus()),i.term=r.term),t.call(this,i,n)},t.prototype.tokenizer=function(t,i,n,s){for(var r=n.get("tokenSeparators")||[],o=i.term,a=0,l=this.createTag||function(e){return{id:e.term,text:e.term}};a<o.length;){var u=o[a];if(-1!==e.inArray(u,r)){var c=o.substr(0,a),h=l(e.extend({},i,{term:c}));null!=h?(s(h),o=o.substr(a+1)||"",a=0):a++}else a++}return{term:o}},t}),t.define("select2/data/minimumInputLength",[],function(){function e(e,t,i){this.minimumInputLength=i.get("minimumInputLength"),e.call(this,t,i)}return e.prototype.query=function(e,t,i){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,i)},e}),t.define("select2/data/maximumInputLength",[],function(){function e(e,t,i){this.maximumInputLength=i.get("maximumInputLength"),e.call(this,t,i)}return e.prototype.query=function(e,t,i){t.term=t.term||"",this.maximumInputLength>0&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,i)},e}),t.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,i){this.maximumSelectionLength=i.get("maximumSelectionLength"),e.call(this,t,i)}return e.prototype.query=function(e,t,i){var n=this;this.current(function(s){var r=null!=s?s.length:0;n.maximumSelectionLength>0&&r>=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):e.call(n,t,i)})},e}),t.define("select2/dropdown",["jquery","./utils"],function(e,t){function i(e,t){this.$element=e,this.options=t,i.__super__.constructor.call(this)}return t.Extend(i,t.Observable),i.prototype.render=function(){var t=e('<span class="select2-dropdown"><span class="select2-results"></span></span>');return t.attr("dir",this.options.get("dir")),this.$dropdown=t,t},i.prototype.bind=function(){},i.prototype.position=function(e,t){},i.prototype.destroy=function(){this.$dropdown.remove()},i}),t.define("select2/dropdown/search",["jquery","../utils"],function(e,t){function i(){}return i.prototype.render=function(t){var i=t.call(this),n=e('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),i.prepend(n),i},i.prototype.bind=function(t,i,n){var s=this;t.call(this,i,n),this.$search.on("keydown",function(e){s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(t){e(this).off("keyup")}),this.$search.on("keyup input",function(e){s.handleSearch(e)}),i.on("open",function(){s.$search.attr("tabindex",0),s.$search.focus(),window.setTimeout(function(){s.$search.focus()},0)}),i.on("close",function(){s.$search.attr("tabindex",-1),s.$search.val("")}),i.on("focus",function(){i.isOpen()||s.$search.focus()}),i.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(s.showSearch(e)?s.$searchContainer.removeClass("select2-search--hide"):s.$searchContainer.addClass("select2-search--hide"))})},i.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},i.prototype.showSearch=function(e,t){return!0},i}),t.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,i,n){this.placeholder=this.normalizePlaceholder(i.get("placeholder")),e.call(this,t,i,n)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var i=t.slice(0),n=t.length-1;n>=0;n--){var s=t[n];this.placeholder.id===s.id&&i.splice(n,1)}return i},e}),t.define("select2/dropdown/infiniteScroll",["jquery"],function(e){function t(e,t,i,n){this.lastParams={},e.call(this,t,i,n),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return t.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&this.$results.append(this.$loadingMore)},t.prototype.bind=function(t,i,n){var s=this;t.call(this,i,n),i.on("query",function(e){s.lastParams=e,s.loading=!0}),i.on("query:append",function(e){s.lastParams=e,s.loading=!0}),this.$results.on("scroll",function(){var t=e.contains(document.documentElement,s.$loadingMore[0]);!s.loading&&t&&s.$results.offset().top+s.$results.outerHeight(!1)+50>=s.$loadingMore.offset().top+s.$loadingMore.outerHeight(!1)&&s.loadMore()})},t.prototype.loadMore=function(){this.loading=!0;var t=e.extend({},{page:1},this.lastParams);t.page++,this.trigger("query:append",t)},t.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},t.prototype.createLoadingMore=function(){var t=e('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),i=this.options.get("translations").get("loadingMore");return t.html(i(this.lastParams)),t},t}),t.define("select2/dropdown/attachBody",["jquery","../utils"],function(e,t){function i(t,i,n){this.$dropdownParent=n.get("dropdownParent")||e(document.body),t.call(this,i,n)}return i.prototype.bind=function(e,t,i){var n=this,s=!1;e.call(this,t,i),t.on("open",function(){n._showDropdown(),n._attachPositioningHandler(t),s||(s=!0,t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}))}),t.on("close",function(){n._hideDropdown(),n._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},i.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},i.prototype.position=function(e,t,i){t.attr("class",i.attr("class")),t.removeClass("select2"),t.addClass("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=i},i.prototype.render=function(t){var i=e("<span></span>"),n=t.call(this);return i.append(n),this.$dropdownContainer=i,i},i.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},i.prototype._attachPositioningHandler=function(i,n){var s=this,r="scroll.select2."+n.id,o="resize.select2."+n.id,a="orientationchange.select2."+n.id,l=this.$container.parents().filter(t.hasScroll);l.each(function(){e(this).data("select2-scroll-position",{x:e(this).scrollLeft(),y:e(this).scrollTop()})}),l.on(r,function(t){var i=e(this).data("select2-scroll-position");e(this).scrollTop(i.y)}),e(window).on(r+" "+o+" "+a,function(e){s._positionDropdown(),s._resizeDropdown()})},i.prototype._detachPositioningHandler=function(i,n){var s="scroll.select2."+n.id,r="resize.select2."+n.id,o="orientationchange.select2."+n.id;this.$container.parents().filter(t.hasScroll).off(s),e(window).off(s+" "+r+" "+o)},i.prototype._positionDropdown=function(){var t=e(window),i=this.$dropdown.hasClass("select2-dropdown--above"),n=this.$dropdown.hasClass("select2-dropdown--below"),s=null,r=this.$container.offset();r.bottom=r.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=r.top,o.bottom=r.top+o.height;var a=this.$dropdown.outerHeight(!1),l=t.scrollTop(),u=t.scrollTop()+t.height(),c=l<r.top-a,h=u>r.bottom+a,d={left:r.left,top:o.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var f=p.offset();d.top-=f.top,d.left-=f.left,i||n||(s="below"),h||!c||i?!c&&h&&i&&(s="below"):s="above",("above"==s||i&&"below"!==s)&&(d.top=o.top-f.top-a),null!=s&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+s),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+s)),this.$dropdownContainer.css(d)},i.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},i.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},i}),t.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,i,n){this.minimumResultsForSearch=i.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,i,n)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var i=0,n=0;n<t.length;n++){var s=t[n];s.children?i+=e(s.children):i++}return i}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),t.define("select2/dropdown/selectOnClose",[],function(){function e(){}return e.prototype.bind=function(e,t,i){var n=this;e.call(this,t,i),t.on("close",function(e){n._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var i=t.originalSelect2Event;if("select"===i._type||"unselect"===i._type)return}var n=this.getHighlightedResults();if(!(n.length<1)){var s=n.data("data");null!=s.element&&s.element.selected||null==s.element&&s.selected||this.trigger("select",{data:s})}},e}),t.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,i){var n=this;e.call(this,t,i),t.on("select",function(e){n._selectTriggered(e)}),t.on("unselect",function(e){n._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var i=t.originalEvent;i&&i.ctrlKey||this.trigger("close",{originalEvent:i,originalSelect2Event:t})},e}),t.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,i="Please delete "+t+" character";return 1!=t&&(i+="s"),i},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),t.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(e,t,i,n,s,r,o,a,l,u,c,h,d,p,f,m,g,v,y,w,b,_,C,x,D,E,k,T,S){function A(){this.reset()}return A.prototype.apply=function(h){if(null==(h=e.extend(!0,{},this.defaults,h)).dataAdapter){if(null!=h.ajax?h.dataAdapter=f:null!=h.data?h.dataAdapter=p:h.dataAdapter=d,h.minimumInputLength>0&&(h.dataAdapter=u.Decorate(h.dataAdapter,v)),h.maximumInputLength>0&&(h.dataAdapter=u.Decorate(h.dataAdapter,y)),h.maximumSelectionLength>0&&(h.dataAdapter=u.Decorate(h.dataAdapter,w)),h.tags&&(h.dataAdapter=u.Decorate(h.dataAdapter,m)),null==h.tokenSeparators&&null==h.tokenizer||(h.dataAdapter=u.Decorate(h.dataAdapter,g)),null!=h.query){var S=t(h.amdBase+"compat/query");h.dataAdapter=u.Decorate(h.dataAdapter,S)}if(null!=h.initSelection){var A=t(h.amdBase+"compat/initSelection");h.dataAdapter=u.Decorate(h.dataAdapter,A)}}if(null==h.resultsAdapter&&(h.resultsAdapter=i,null!=h.ajax&&(h.resultsAdapter=u.Decorate(h.resultsAdapter,x)),null!=h.placeholder&&(h.resultsAdapter=u.Decorate(h.resultsAdapter,C)),h.selectOnClose&&(h.resultsAdapter=u.Decorate(h.resultsAdapter,k))),null==h.dropdownAdapter){if(h.multiple)h.dropdownAdapter=b;else{var F=u.Decorate(b,_);h.dropdownAdapter=F}if(0!==h.minimumResultsForSearch&&(h.dropdownAdapter=u.Decorate(h.dropdownAdapter,E)),h.closeOnSelect&&(h.dropdownAdapter=u.Decorate(h.dropdownAdapter,T)),null!=h.dropdownCssClass||null!=h.dropdownCss||null!=h.adaptDropdownCssClass){var O=t(h.amdBase+"compat/dropdownCss");h.dropdownAdapter=u.Decorate(h.dropdownAdapter,O)}h.dropdownAdapter=u.Decorate(h.dropdownAdapter,D)}if(null==h.selectionAdapter){if(h.multiple?h.selectionAdapter=s:h.selectionAdapter=n,null!=h.placeholder&&(h.selectionAdapter=u.Decorate(h.selectionAdapter,r)),h.allowClear&&(h.selectionAdapter=u.Decorate(h.selectionAdapter,o)),h.multiple&&(h.selectionAdapter=u.Decorate(h.selectionAdapter,a)),null!=h.containerCssClass||null!=h.containerCss||null!=h.adaptContainerCssClass){var M=t(h.amdBase+"compat/containerCss");h.selectionAdapter=u.Decorate(h.selectionAdapter,M)}h.selectionAdapter=u.Decorate(h.selectionAdapter,l)}if("string"==typeof h.language)if(h.language.indexOf("-")>0){var $=h.language.split("-")[0];h.language=[h.language,$]}else h.language=[h.language];if(e.isArray(h.language)){var I=new c;h.language.push("en");for(var P=h.language,q=0;q<P.length;q++){var U=P[q],L={};try{L=c.loadPath(U)}catch(e){try{U=this.defaults.amdLanguageBase+U,L=c.loadPath(U)}catch(e){h.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+U+'" could not be automatically loaded. A fallback will be used instead.');continue}}I.extend(L)}h.translations=I}else{var j=c.loadPath(this.defaults.amdLanguageBase+"en"),N=new c(h.language);N.extend(j),h.translations=N}return h},A.prototype.reset=function(){function t(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return h[e]||e})}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:u.escapeMarkup,language:S,matcher:function i(n,s){if(""===e.trim(n.term))return s;if(s.children&&s.children.length>0){for(var r=e.extend(!0,{},s),o=s.children.length-1;o>=0;o--)null==i(n,s.children[o])&&r.children.splice(o,1);return r.children.length>0?r:i(n,r)}var a=t(s.text).toUpperCase(),l=t(n.term).toUpperCase();return a.indexOf(l)>-1?s:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},A.prototype.set=function(t,i){var n={};n[e.camelCase(t)]=i;var s=u._convertData(n);e.extend(this.defaults,s)},new A}),t.define("select2/options",["require","jquery","./defaults","./utils"],function(e,t,i,n){function s(t,s){if(this.options=t,null!=s&&this.fromElement(s),this.options=i.apply(this.options),s&&s.is("input")){var r=e(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=n.Decorate(this.options.dataAdapter,r)}}return s.prototype.fromElement=function(e){var i=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.language&&(e.prop("lang")?this.options.language=e.prop("lang").toLowerCase():e.closest("[lang]").prop("lang")&&(this.options.language=e.closest("[lang]").prop("lang"))),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),e.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.'),e.data("data",e.data("select2Tags")),e.data("tags",!0)),e.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."),e.attr("ajax--url",e.data("ajaxUrl")),e.data("ajax--url",e.data("ajaxUrl")));var s;s=t.fn.jquery&&"1."==t.fn.jquery.substr(0,2)&&e[0].dataset?t.extend(!0,{},e[0].dataset,e.data()):e.data();var r=t.extend(!0,{},s);r=n._convertData(r);for(var o in r)t.inArray(o,i)>-1||(t.isPlainObject(this.options[o])?t.extend(this.options[o],r[o]):this.options[o]=r[o]);return this},s.prototype.get=function(e){return this.options[e]},s.prototype.set=function(e,t){this.options[e]=t},s}),t.define("select2/core",["jquery","./options","./utils","./keys"],function(e,t,i,n){var s=function(e,i){null!=e.data("select2")&&e.data("select2").destroy(),this.$element=e,this.id=this._generateId(e),i=i||{},this.options=new t(i,e),s.__super__.constructor.call(this);var n=e.attr("tabindex")||0;e.data("old-tabindex",n),e.attr("tabindex","-1");var r=this.options.get("dataAdapter");this.dataAdapter=new r(e,this.options);var o=this.render();this._placeContainer(o);var a=this.options.get("selectionAdapter");this.selection=new a(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,o);var l=this.options.get("dropdownAdapter");this.dropdown=new l(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,o);var u=this.options.get("resultsAdapter");this.results=new u(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var c=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){c.trigger("selection:update",{data:e})}),e.addClass("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),e.data("select2",this)};return i.Extend(s,i.Observable),s.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+i.generateChars(2):i.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},s.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},s.prototype._resolveWidth=function(e,t){var i=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var n=this._resolveWidth(e,"style");return null!=n?n:this._resolveWidth(e,"element")}if("element"==t){var s=e.outerWidth(!1);return s<=0?"auto":s+"px"}if("style"==t){var r=e.attr("style");if("string"!=typeof r)return null;for(var o=r.split(";"),a=0,l=o.length;a<l;a+=1){var u=o[a].replace(/\s/g,"").match(i);if(null!==u&&u.length>=1)return u[1]}return null}return t},s.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)},s.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=i.bind(this._syncAttributes,this),this._syncS=i.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var n=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=n?(this._observer=new n(function(i){e.each(i,t._syncA),e.each(i,t._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",t._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",t._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",t._syncS,!1))},s.prototype._registerDataEvents=function(){var e=this;this.dataAdapter.on("*",function(t,i){e.trigger(t,i)})},s.prototype._registerSelectionEvents=function(){var t=this,i=["toggle","focus"];this.selection.on("toggle",function(){t.toggleDropdown()}),this.selection.on("focus",function(e){t.focus(e)}),this.selection.on("*",function(n,s){-1===e.inArray(n,i)&&t.trigger(n,s)})},s.prototype._registerDropdownEvents=function(){var e=this;this.dropdown.on("*",function(t,i){e.trigger(t,i)})},s.prototype._registerResultsEvents=function(){var e=this;this.results.on("*",function(t,i){e.trigger(t,i)})},s.prototype._registerEvents=function(){var e=this;this.on("open",function(){e.$container.addClass("select2-container--open")}),this.on("close",function(){e.$container.removeClass("select2-container--open")}),this.on("enable",function(){e.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){e.$container.addClass("select2-container--disabled")}),this.on("blur",function(){e.$container.removeClass("select2-container--focus")}),this.on("query",function(t){e.isOpen()||e.trigger("open",{}),this.dataAdapter.query(t,function(i){e.trigger("results:all",{data:i,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(i){e.trigger("results:append",{data:i,query:t})})}),this.on("keypress",function(t){var i=t.which;e.isOpen()?i===n.ESC||i===n.TAB||i===n.UP&&t.altKey?(e.close(),t.preventDefault()):i===n.ENTER?(e.trigger("results:select",{}),t.preventDefault()):i===n.SPACE&&t.ctrlKey?(e.trigger("results:toggle",{}),t.preventDefault()):i===n.UP?(e.trigger("results:previous",{}),t.preventDefault()):i===n.DOWN&&(e.trigger("results:next",{}),t.preventDefault()):(i===n.ENTER||i===n.SPACE||i===n.DOWN&&t.altKey)&&(e.open(),t.preventDefault())})},s.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",{})},s.prototype._syncSubtree=function(e,t){var i=!1,n=this;if(!e||!e.target||"OPTION"===e.target.nodeName||"OPTGROUP"===e.target.nodeName){if(t)if(t.addedNodes&&t.addedNodes.length>0)for(var s=0;s<t.addedNodes.length;s++){t.addedNodes[s].selected&&(i=!0)}else t.removedNodes&&t.removedNodes.length>0&&(i=!0);else i=!0;i&&this.dataAdapter.current(function(e){n.trigger("selection:update",{data:e})})}},s.prototype.trigger=function(e,t){var i=s.__super__.trigger,n={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===t&&(t={}),e in n){var r=n[e],o={prevented:!1,name:e,args:t};if(i.call(this,r,o),o.prevented)return void(t.prevented=!0)}i.call(this,e,t)},s.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},s.prototype.open=function(){this.isOpen()||this.trigger("query",{})},s.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},s.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},s.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},s.prototype.focus=function(e){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},s.prototype.enable=function(e){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!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},s.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 e=[];return this.dataAdapter.current(function(t){e=t}),e},s.prototype.val=function(t){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==t||0===t.length)return this.$element.val();var i=t[0];e.isArray(i)&&(i=e.map(i,function(e){return e.toString()})),this.$element.val(i).trigger("change")},s.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},s.prototype.render=function(){var t=e('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return t.attr("dir",this.options.get("dir")),this.$container=t,this.$container.addClass("select2-container--"+this.options.get("theme")),t.data("element",this.$element),t},s}),t.define("jquery-mousewheel",["jquery"],function(e){return e}),t.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(e,t,i,n){if(null==e.fn.select2){var s=["open","close","destroy"];e.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var n=e.extend(!0,{},t);new i(e(this),n)}),this;if("string"==typeof t){var n,r=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=e(this).data("select2");null==i&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=i[t].apply(i,r)}),e.inArray(t,s)>-1?this:n}throw new Error("Invalid arguments for Select2: "+t)}}return null==e.fn.select2.defaults&&(e.fn.select2.defaults=n),i}),{define:t.define,require:t.require}}(),i=t.require("jquery.select2");return e.fn.select2.amd=t,i});

/**
 * Jquery start
 */
$(document).ready(function () {
	toastr.options = {
		"closeButton": true,
		"newestOnTop": true,
		"progressBar": true,
		"positionClass": "toast-top-right",
		"preventDuplicates": false,
		"onclick": null,
		"showDuration": "300",
		"hideDuration": "1000",
		"timeOut": "5000",
		"extendedTimeOut": "1000",
		"showEasing": "swing",
		"hideEasing": "swing",
		"showMethod": "slideDown",
		"hideMethod": "slideUp"
	};


	/*
	 * initialize dropify
	 */
	 if ($(".dropify")) {
	 	$(".dropify").dropify();
	 }

	/*
	 * initialize dropify
	 */
	 if ($(".select2")) {
	 	$(".select2").select2();
	 }


	/*
	 * initialize datepicker
	 */
	 if ($(".datepicker")) {
	 	$('.datepicker').datepicker({
		    autoclose: true
		});
	 }


	/*
	 * initialize dropify
	 */
	 if ($(".croppie")) {
	 	croppify();
	 }

	/*
	 * initialize Switchery
	 */
	var elems = Array.prototype.slice.call(document.querySelectorAll('.switch'));
	elems.forEach(function(html) {
		var switchery = new Switchery(html, {
			size: 'small',
			color: '#007bff'
		});
	});
});
/*
 * Simcyfy show loader
 */
function showLoader(options) {
	/**
	 * remove existing loaders
	 */
	hideLoader();
	if (options === undefined) {
		options = {
			color: "#007bff",
			background: "rgba(298, 294, 290, 0.9)"
		};
	} else {
		if (options.background === undefined) {
			options.background = "rgba(298, 294, 290, 0.9)";
		}
		if (options.color === undefined) {
			options.color = "#007bff";
		}
	}
	$("body").append('<div class="loading-overlay" style="background-color:' + options.background + ';"><div class="loader-box"><div class="circle-loader"></div></div></div>');
	$("body").append('<style class="notify-styling">.circle-loader:before { border-top-color: ' + options.color + '; }</style>');
}
/*
 * Simcyfy hide loader
 */
function hideLoader() {
	$(".loading-overlay, notify-styling").remove();
}
/*
 * Simcyfy show card payment form
 *
 * @param {object} with [buttonText] - text of the button, [buttonClass] - class of the button and [callback] - this is a function
 */
function showCardPaymentForm(options) {
	hideCardPaymentForm();
	if (options === undefined) {
		options = {
			buttonText: "Proceed",
			buttonClass: "",
			callback: undefined
		};
	} else {
		if (options.buttonText === undefined) {
			options.buttonText = "Proceed";
		}
		if (options.buttonClass === undefined) {
			options.buttonClass = "";
		}
		if (options.callback === undefined) {
			options.callback = false;
		}
	}
	$("body").addClass("fit-screen");
	$("body").append('<div class="payment-modal"><div class="cancel-payment">&times;</div><div id="card-success" class="hidden"> <i class="fa fa-check"></i><p>Payment Successful!</p></div><div id="form-errors" class="hidden"> <i class="fa fa-exclamation-triangle"></i><p id="card-error">Card error</p></div><div id="form-container"><div id="card-front"><div id="shadow"></div><div id="image-container"> <span id="amount">This is a <strong>Secure</strong> checkout.</span> </span> <span id="card-image"> </span></div><form class="card-payment-form"> <label for="card-number"> Card Number </label> <input type="text" id="card-number" data-stripe="number" placeholder="1234 5678 9101 1112" length="16"><div id="cardholder-container"> <label for="card-holder">Card Holder </label> <input type="text" id="card-holder" data-stripe="holder" placeholder="e.g. John Doe" /></div><div id="exp-container"> <label for="card-exp"> Expiration </label> <input id="card-month" data-stripe="exp_month" type="text" placeholder="MM" length="2"> <input id="card-year" data-stripe="exp_year" type="text" placeholder="YY" length="2"></div><div id="cvc-container"> <label for="card-cvc"> CVC/CVV</label> <input id="card-cvc" data-stripe="cvc" placeholder="XXX-X" type="text" min-length="3" max-length="4"><p>Last 3 or 4 digits</p></div></form></div><div id="card-back"><div id="card-stripe"></div></div> <button type="button" id="card-btn" class="btn btn-primary card-button ' + options.buttonClass + '">' + options.buttonText + '</button></div></div>');
	$(".cancel-payment").click(function () {
		hideCardPaymentForm();
	});
	if (options.callback) {
		$(".card-button").click(function () {
			eval(options.callback);
		});
	}
}
/*
 * hide card payment form
 */
function hideCardPaymentForm() {
	$(".payment-modal").slideUp("slow", function () {
		$(".payment-modal").remove();
		$("body").removeClass("fit-screen");
	});
}
/*
 * fancyboxjs
 */
 $("body").on("click", ".click-preview", function(){
 	var imagePath = $(this).attr("src");
 	log("here");
 	$("body").append('<div class="click-preview-overlay"><div class="click-preview-close"><div></div></div><div class="click-preview-box"><div class="click-preview-image-holder"><img src="'+imagePath+'"></div></div></div>');

 });
 $("body").on("click", ".click-preview-overlay", function(){
 	$(".click-preview-overlay").remove();
 });
/*
 * reload page
 */
function reload() {
	window.location.reload();
}
/*
 * redirect
 *
 *@param {string} url to redirect
 */
function redirect(url, loader) {
	if (loader === undefined) {
		loader = false
	}
	if (loader) {
		showLoader();
	}
	window.location.href = url;
}
/*
 * open url on a new tap
 *
 *@param {string} url to open
 */
function openUrl(url) {
	window.open(url);
}
/*
 * print on console
 *
 *@param {any data type}
 */
function log(data) {
	console.log(data);
}
/*
 * print error on console
 *
 *@param {any data type}
 */
function error(data) {
	console.error(data);
}
/*
 * send data to server side
 *
 *@param {string}
 *@param {object}: {string}[url], the url where to send data, {object}[data], data to send to server, {boolean} loader, whether to show loading or not.
 */
function server(options) {
	var sendToServer = true;
	if (options === undefined) {
		sendToServer = false;
	} else {
		if (options.url === undefined) {
			console.error("URL is missing!");
			sendToServer = false;
		}
		if (options.data === undefined) {
			console.error("Data is missing!");
			sendToServer = false;
		}
		if (options.loader === undefined) {
			options.loader = true;
		}
	}
	if (sendToServer) {
		if (options.loader) {
			showLoader();
		}
		var posting = $.post(options.url, options.data);
		posting.done(function (response) {
			if (options.loader) {
				hideLoader()
			}
			serverResponse(response);
		});
	}
}
/*
 * create random string
 *
 *@param {object}: {string}[length], the length of the random string, {string}[type], number or alphabet characters, {string}[case] lower|upper.
 */
function random(options) {
	var response = "";
	if (options === undefined) {
		options = {
			length: 16,
			type: "",
			case :""
		};
	} else {
		if (options.length === undefined) {
			options.length = 16;
		}
	}
	if (options.type === "alphabet") {
		var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	} else if (options.type === "number") {
		var possible = "1234567890";
	} else {
		var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
	}
	options.length = parseInt(options.length);
	for (var i = 0; i < options.length; i++) {
		response += possible.charAt(Math.floor(Math.random() * possible.length));
	}
	if (options.case === "upper") {
		response = response.toUpperCase();
	} else if (options.case === "lower") {
		response = response.toLowerCase();
	}
	return response;
}
/*
 * sweet alert
 *
 *@param {string} title
 *@param {string} message
 *@param {string} success|info|error|warning
 *@param {string} text of the button
 *@param {object} [callback] [callback][string] function, [showCancelButton][boolen], [closeOnConfirm][boolean]
 */
function notify(title, message, type, button, advanced) {
	if (type === undefined) {
		type = "info";
	}
	if (button === undefined) {
		button = OkayButton;
	}
	if (advanced === undefined) {
		swal({
			title: title,
			text: message,
			type: type,
			showCancelButton: false,
			confirmButtonColor: "#007bff",
			confirmButtonText: button,
			closeOnConfirm: true
		});
	} else {
		if (advanced.color === undefined) {
			advanced.color = "#007bff";
		}
		if (advanced.showCancelButton === undefined) {
			advanced.showCancelButton = false;
		}
		if (advanced.closeOnConfirm === undefined) {
			advanced.closeOnConfirm = true;
		}
		if (advanced.callback === undefined) {
			swal({
				title: title,
				text: message,
				type: type,
				showCancelButton: advanced.showCancelButton,
				confirmButtonColor: advanced.color,
				confirmButtonText: button,
				closeOnConfirm: advanced.closeOnConfirm
			});
		} else {
			swal({
				title: title,
				text: message,
				type: type,
				showCancelButton: advanced.showCancelButton,
				confirmButtonColor: advanced.color,
				confirmButtonText: button,
				closeOnConfirm: advanced.closeOnConfirm
			}, function () {
				eval(advanced.callback);
			});
		}
	}
}
/*
 * send to server on click
 *
 *@param {any data type}
 */
$("body").on("click", ".send-to-server-click", function (event) {
	event.preventDefault();
	var holder = $(this);
	var data = holder.attr("data"),
		url = holder.attr("url"),
		loader = true;
	// format data 
	var dataArray = data.split("|");
	var data = {};
	dataArray.forEach(function (item) {
		var singleItem = item.split(":");
		data[singleItem[0]] = singleItem[1];
	});
	if (holder.attr("loader") === "true") {
		loader = true;
	} else if (holder.attr("loader") === "false") {
		loader = false;
	}
	if (holder.attr("warning-title") === undefined) {
		server({
			url: url,
			data: data,
			loader: loader
		});
	} else {
		var title = holder.attr("warning-title"),
			button = "Continue";
		if (holder.attr("warning-button") === undefined) {
			button = "Continue";
		} else {
			button = holder.attr("warning-button");
		}
		if (holder.attr("warning-message") === undefined) {
			message = "";
		} else {
			message = holder.attr("warning-message");
		}
		swal({
			title: title,
			text: message,
			type: "warning",
			showCancelButton: true,
			confirmButtonColor: "#007bff",
			confirmButtonText: button,
			closeOnConfirm: false
		}, function () {
			server({
				url: url,
				data: data,
				loader: loader
			});
		});
	}
})
/*
 * send to server on change
 *
 */
$("body").on("change", ".send-to-server-change", function (event) {
	event.preventDefault();
	var holder = $(this);
	var extradata = holder.attr("extradata"),
		  url = holder.attr("url"),
		  fieldName = holder.attr("name"),
		  fieldValue = holder.val(),
		  url = holder.attr("url"),
		  loader = true;

	var data = {};
	data[fieldName] = fieldValue;

	if (holder.attr("extradata") !== undefined) {
		// format data 
		var dataArray = extradata.split("|");
		dataArray.forEach(function (item) {
			var singleItem = item.split(":");
			data[singleItem[0]] = singleItem[1];
		});
	}
	if (holder.attr("loader") === "true") {
		loader = true;
	} else if (holder.attr("loader") === "false") {
		loader = false;
	}

	server({
		url: url,
		data: data,
		loader: loader
	});
})
/*
 * fetch from server and display
 *
 *@param {any data type}
 */
$("body").on("click", ".fetch-display-click", function (event) {
	event.preventDefault();
	var holder = $(this);
	var data = holder.attr("data"),
		url = holder.attr("url"),
		dataHolder = holder.attr("holder"),
		loader = true;
	if (data !== undefined) {
		// format data 
		var dataArray = data.split("|");
		var data = {};
		dataArray.forEach(function (item) {
			var singleItem = item.split(":");
			data[singleItem[0]] = singleItem[1];
		});
	}
	if (holder.attr("loader") === "true") {
		loader = true;
	} else if (holder.attr("loader") === "false") {
		loader = false;
	}
	if (loader) {
		showLoader();
		$(dataHolder).html('<div class="loader-box"><div class="circle-loader"></div></div>');
	}
	var posting = $.post(url, data);
	posting.done(function (response) {
		if (loader) {
			hideLoader()
		}
		if (holder.attr("modal") !== undefined) {
			$(holder.attr("modal")).modal({show: true, backdrop: 'static', keyboard: false});
		}
		$(dataHolder).html(response);
	});
})
/*
 * handle response from server
 *
 *@param {json}
 */
function serverResponse(response) {
	if (response.notify === undefined) {
		response.notify = true;
	}
	if (response.notifyType === undefined) {
		response.notifyType = "swal";
	}
	if (response.status === undefined) {
		response.status = "info";
	}
	if (response.title === undefined) {
		response.title = "Hello!";
	}
	if (response.buttonText === undefined) {
		response.buttonText = OkayButton;
	}
	if (response.callback !== undefined && response.callbackTime === undefined) {
		if (!response.notify || response.notifyType === "toastr") {
			response.callbackTime = "instant";
		} else if (response.notify && response.notifyType === "swal") {
			response.callbackTime = "onconfirm";
		}
	}
	if (response.showCancelButton === undefined) {
		response.showCancelButton = false;
	}
	if (response.message === undefined) {
		response.message = "";
	}
	if (response.callbackTime === "instant" && response.callback !== undefined) {
		eval(response.callback);
	}
	if (response.notify) {
		if (response.notifyType === "swal") {
			if (response.callbackTime === "onconfirm" && response.callback !== undefined) {
				swal({
					title: response.title,
					text: response.message,
					type: response.status,
					showCancelButton: response.showCancelButton,
					confirmButtonColor: "#007bff",
					confirmButtonText: response.buttonText,
					closeOnConfirm: true
				}, function () {
					eval(response.callback);
				});
			} else {
				swal({
					title: response.title,
					text: response.message,
					type: response.status,
					showCancelButton: response.showCancelButton,
					confirmButtonColor: "#007bff",
					confirmButtonText: response.buttonText,
					closeOnConfirm: true
				});
			}
		} else if (response.notifyType === "toastr") {
			swal.close();
			if (response.status === "success") {
				toastr.success(response.message, response.title);
			} else if (response.status === "error") {
				toastr.error(response.message, response.title);
			} else if (response.status === "info") {
				toastr.info(response.message, response.title);
			} else if (response.status === "warning") {
				toastr.warning(response.message, response.title);
			}
		}
	} else {
		swal.close();
	}
}
/*
 * submit form
 */
$("body").on("submit", ".simcy-form", function (event) {
	event.preventDefault();
	var loader = false;
	if ($(this).attr("loader") === "true") {
		loader = true;
	}
	$(this).parsley().validate();
	if (($(this).parsley().isValid())) {
		if (loader) {
			showLoader();
		}
		$.ajax({
			url: $(this).attr("action"),
			type: $(this).attr("method"),
			data: new FormData(this),
			contentType: false,
			processData: false,
			success: function (response) {
				if (loader) {
					hideLoader();
				}
				serverResponse(response);
			},
			error: function (xhr, status, error) {
				if (loader) {
					hideLoader();
				}
				toastr.error(error, "Oops!");
			}
		});
	}
});
/*
 * form with js callback
 */
$(".simcy-front-form").submit(function(event){
  event.preventDefault();
  $(this).parsley().validate();
  if (($(this).parsley().isValid())) {
    eval($(this).attr("callback"));
  }
});
/*
 * render cropie js DOM
 */
function croppify() {
	$('.croppie').each(function() {
		var input = $(this),
		      inputName = input.attr("name"),
		      defaultImage = "data:image/png;base64,[encoded data, 7000 characters]",
		      inputId = random();
		if (input.attr("default") !== undefined) {
			defaultImage = input.attr("default");
		}
		input.removeAttr("name");
		input.attr("croppie-id",".croppie-"+inputId);
		input.after('<label class="croppie-cabinet croppie-'+inputId+'"><div class="croppie-figure"><img src="'+defaultImage+'" class="croppie-output" /><div class="croppie-cabinet-overlay"><div class="croppie-upload-icon"></div></div></div><input type="hidden" name="'+inputName+'"></label>');
		var inputHidden = $(".croppie-"+inputId).find("input");
		input.insertAfter(inputHidden);
	})
}

/*
 * process cropie js image
 */
var $uploadCrop, tempFilename, rawImg, imageId, croppieId;
// var cropWidth = 
function readFile(input) {
    showLoader();
    if (input.files && input.files[0]) {
        document.getElementsByTagName("input")[0].removeAttribute("croppie-status");
        var reader = new FileReader(),
            cropWidth = 300,
            cropHeight = 300,
            croppieId = input.getAttribute("croppie-id");
        reader.onload = function(e) {
            // $('body').find(".croppie-box").remove();
            $("body").append('<div class="croppie-overlay"><div class="croppie-overlay-close"><div></div></div><div class="croppie-overlay-save"><div></div></div><div class="croppie-box ready"></div></div>');
            hideLoader();
            input.setAttribute("croppie-status", "active");
            rawImg = e.target.result;
            if (input.getAttribute("crop-width")) {
                cropWidth = parseInt(input.getAttribute("crop-width"));
            }
            if (input.getAttribute("crop-height")) {
                cropHeight = parseInt(input.getAttribute("crop-height"));
            }
            $uploadCrop = $(".croppie-box").croppie({
                viewport: {
                    width: cropWidth,
                    height: cropHeight,
                },
                boundary: {
                    width: parseInt(cropWidth + 100),
                    height: parseInt(cropHeight + 100)
                },
                enforceBoundary: false,
                enableExif: true,
                showZoomer: false
            });


            $uploadCrop.croppie('bind', {
                url: rawImg
            }).then(function() {});
        }

        reader.readAsDataURL(input.files[0]);



    } else {
        notify("Oops!", "you're browser doesn't support the FileReader API", "error");
    }
}

$('body').on('click', '.croppie-overlay-close', function() {
    $(".croppie-overlay").remove();
});

$('body').on('change', '.croppie', function(ev) {
    imageId = $(this).data('id');
    tempFilename = $(this).val();
    $('.croppie-overlay-close').data('id', imageId);
    readFile(this);
});

$('body').on('click', '.croppie-overlay-save', function(ev) {
    var croppieInput = $("body").find("input[croppie-status=active]");
    $uploadCrop.croppie('result', {
        type: 'base64',
        format: 'png',
        size: {
            width: parseInt(croppieInput.attr("crop-width")),
            height: parseInt(croppieInput.attr("crop-height"))
        }
    }).then(function(resp) {
        croppieInput.closest(".croppie-cabinet").find('img').attr('src', resp);
        croppieInput.siblings("input[type=hidden]").val(resp);
        $("input").removeAttr("croppie-status");
        $(".croppie-overlay").remove();
    });
});
