UNPKG

fuelux

Version:

Base Fuel UX styles and controls

7 lines (6 loc) 134 kB
/*! * Fuel UX v3.16.4 * Copyright 2012-2018 ExactTarget * Licensed under the BSD-3-Clause license (https://github.com/ExactTarget/fuelux/blob/master/LICENSE) */ !function(e){"function"==typeof define&&define.amd?define(["jquery","bootstrap"],e):e(jQuery)}(function(e){if(void 0===e)throw new Error("Fuel UX's JavaScript requires jQuery");if(void 0===e.fn.dropdown||void 0===e.fn.collapse)throw new Error("Fuel UX's JavaScript requires Bootstrap");!function(e){var t=e.fn.checkbox,i=function(e){window&&window.console&&window.console.error&&window.console.error(e)},s=function(t,s){this.options=e.extend({},e.fn.checkbox.defaults,s);var n=e(t);if("label"===t.tagName.toLowerCase()){this.$label=n,this.$chk=this.$label.find('input[type="checkbox"]'),this.$container=n.parent(".checkbox"),!this.options.ignoreVisibilityCheck&&this.$chk.css("visibility").match(/hidden|collapse/)&&i("For accessibility reasons, in order for tab and space to function on checkbox, checkbox `<input />`'s `visibility` must not be set to `hidden` or `collapse`. See https://github.com/ExactTarget/fuelux/pull/1996 for more details.");var a=this.$chk.attr("data-toggle");this.$toggleContainer=e(a),this.$chk.on("change",e.proxy(this.itemchecked,this)),this.setInitialState()}else i("Checkbox must be initialized on the `label` that wraps the `input` element. See https://github.com/ExactTarget/fuelux/blob/master/reference/markup/checkbox.html for example of proper markup. Call `.checkbox()` on the `<label>` not the `<input>`")};(s.prototype={constructor:s,setInitialState:function(){var e=this.$chk,t=e.prop("checked"),i=e.prop("disabled");this.setCheckedState(e,t),this.setDisabledState(e,i)},setCheckedState:function(e,t){var i=e,s=this.$label,n=this.$toggleContainer;t?(i.prop("checked",!0),s.addClass("checked"),n.removeClass("hide hidden"),s.trigger("checked.fu.checkbox")):(i.prop("checked",!1),s.removeClass("checked"),n.addClass("hidden"),s.trigger("unchecked.fu.checkbox")),s.trigger("changed.fu.checkbox",t)},setDisabledState:function(t,i){var s=e(t),n=this.$label;return i?(s.prop("disabled",!0),n.addClass("disabled"),n.trigger("disabled.fu.checkbox")):(s.prop("disabled",!1),n.removeClass("disabled"),n.trigger("enabled.fu.checkbox")),s},itemchecked:function(t){var i=e(t.target),s=i.prop("checked");this.setCheckedState(i,s)},toggle:function(){this.isChecked()?this.uncheck():this.check()},check:function(){this.setCheckedState(this.$chk,!0)},uncheck:function(){this.setCheckedState(this.$chk,!1)},isChecked:function(){return this.$chk.prop("checked")},enable:function(){this.setDisabledState(this.$chk,!1)},disable:function(){this.setDisabledState(this.$chk,!0)},destroy:function(){return this.$label.remove(),this.$label[0].outerHTML}}).getValue=s.prototype.isChecked,e.fn.checkbox=function(t){var i,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.checkbox"),l="object"==typeof t&&t;r||a.data("fu.checkbox",r=new s(this,l)),"string"==typeof t&&(i=r[t].apply(r,n))});return void 0===i?a:i},e.fn.checkbox.defaults={ignoreVisibilityCheck:!1},e.fn.checkbox.Constructor=s,e.fn.checkbox.noConflict=function(){return e.fn.checkbox=t,this},e(document).on("mouseover.fu.checkbox.data-api","[data-initialize=checkbox]",function(t){var i=e(t.target);i.data("fu.checkbox")||i.checkbox(i.data())}),e(function(){e("[data-initialize=checkbox]").each(function(){var t=e(this);t.data("fu.checkbox")||t.checkbox(t.data())})})}(e),function(e){var t=e.fn.combobox,i=function(t,i){this.$element=e(t),this.options=e.extend({},e.fn.combobox.defaults,i),this.$dropMenu=this.$element.find(".dropdown-menu"),this.$input=this.$element.find("input"),this.$button=this.$element.find(".btn"),this.$inputGroupBtn=this.$element.find(".input-group-btn"),this.$element.on("click.fu.combobox","a",e.proxy(this.itemclicked,this)),this.$element.on("change.fu.combobox","input",e.proxy(this.inputchanged,this)),this.$element.on("shown.bs.dropdown",e.proxy(this.menuShown,this)),this.$input.on("keyup.fu.combobox",e.proxy(this.keypress,this)),this.setDefaultSelection(),0===this.$dropMenu.children("li").length&&this.$button.addClass("disabled"),this.options.filterOnKeypress&&this.options.filter(this.$dropMenu.find("li"),this.$input.val(),this)};(i.prototype={constructor:i,destroy:function(){return this.$element.remove(),this.$element.find("input").each(function(){e(this).attr("value",e(this).val())}),this.$element[0].outerHTML},doSelect:function(e){void 0!==e[0]?(this.$element.find("li.selected:first").removeClass("selected"),this.$selectedItem=e,this.$selectedItem.addClass("selected"),this.$input.val(this.$selectedItem.text().trim())):(this.$selectedItem=null,this.$element.find("li.selected:first").removeClass("selected"))},clearSelection:function(){this.$selectedItem=null,this.$input.val(""),this.$dropMenu.find("li").removeClass("selected")},menuShown:function(){this.options.autoResizeMenu&&this.resizeMenu()},resizeMenu:function(){var e=this.$element.outerWidth();this.$dropMenu.outerWidth(e)},selectedItem:function(){var t={};if(this.$selectedItem){var i=this.$selectedItem.text().trim();t=e.extend({text:i},this.$selectedItem.data())}else t={text:this.$input.val().trim(),notFound:!0};return t},selectByText:function(t){var i=e([]);this.$element.find("li").each(function(){if((this.textContent||this.innerText||e(this).text()||"").trim().toLowerCase()===(t||"").trim().toLowerCase())return i=e(this),!1}),this.doSelect(i)},selectByValue:function(e){var t='li[data-value="'+e+'"]';this.selectBySelector(t)},selectByIndex:function(e){var t="li:eq("+e+")";this.selectBySelector(t)},selectBySelector:function(e){var t=this.$element.find(e);this.doSelect(t)},setDefaultSelection:function(){var e="li[data-selected=true]:first",t=this.$element.find(e);t.length>0&&(this.selectBySelector(e),t.removeData("selected"),t.removeAttr("data-selected"))},enable:function(){this.$element.removeClass("disabled"),this.$input.removeAttr("disabled"),this.$button.removeClass("disabled")},disable:function(){this.$element.addClass("disabled"),this.$input.attr("disabled",!0),this.$button.addClass("disabled")},itemclicked:function(t){this.$selectedItem=e(t.target).parent(),this.$input.val(this.$selectedItem.text().trim()).trigger("change",{synthetic:!0});var i=this.selectedItem();this.$element.trigger("changed.fu.combobox",i),t.preventDefault(),this.$element.find(".dropdown-toggle").focus()},keypress:function(e){var t=38===e.which||40===e.which||37===e.which||39===e.which;if(this.options.showOptionsOnKeypress&&!this.$inputGroupBtn.hasClass("open")&&(this.$button.dropdown("toggle"),this.$input.focus()),13===e.which){e.preventDefault();var i=this.$dropMenu.find("li.selected").text().trim();i.length>0?this.selectByText(i):this.selectByText(this.$input.val()),this.$inputGroupBtn.removeClass("open")}else if(27===e.which)e.preventDefault(),this.clearSelection(),this.$inputGroupBtn.removeClass("open");else if(this.options.showOptionsOnKeypress&&(40===e.which||38===e.which)){e.preventDefault();var s=this.$dropMenu.find("li.selected");s.length>0&&(s=40===e.which?s.next(":not(.hidden)"):s.prev(":not(.hidden)")),0===s.length&&(s=40===e.which?this.$dropMenu.find("li:not(.hidden):first"):this.$dropMenu.find("li:not(.hidden):last")),this.doSelect(s)}this.options.filterOnKeypress&&!t&&this.options.filter(this.$dropMenu.find("li"),this.$input.val(),this),this.previousKeyPress=e.which},inputchanged:function(t,i){var s=e(t.target).val();if(i&&i.synthetic)this.selectByText(s);else{this.selectByText(s);var n=this.selectedItem();0===n.text.length&&(n={text:s}),this.$element.trigger("changed.fu.combobox",n)}}}).getValue=i.prototype.selectedItem,e.fn.combobox=function(t){var s,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.combobox"),l="object"==typeof t&&t;r||a.data("fu.combobox",r=new i(this,l)),"string"==typeof t&&(s=r[t].apply(r,n))});return void 0===s?a:s},e.fn.combobox.defaults={autoResizeMenu:!0,filterOnKeypress:!1,showOptionsOnKeypress:!1,filter:function(t,i,s){var n=0;s.$dropMenu.find(".empty-indicator").remove(),t.each(function(t){var s=e(this),a=e(this).text().trim();s.removeClass(),a===i?(s.addClass("text-success"),n++):a.substr(0,i.length)===i?(s.addClass("text-info"),n++):s.addClass("hidden")}),0===n&&s.$dropMenu.append('<li class="empty-indicator text-muted"><em>No Matches</em></li>')}},e.fn.combobox.Constructor=i,e.fn.combobox.noConflict=function(){return e.fn.combobox=t,this},e(document).on("mousedown.fu.combobox.data-api","[data-initialize=combobox]",function(t){var i=e(t.target).closest(".combobox");i.data("fu.combobox")||i.combobox(i.data())}),e(function(){e("[data-initialize=combobox]").each(function(){var t=e(this);t.data("fu.combobox")||t.combobox(t.data())})})}(e),function(e){var t="moment.js is not available so you cannot use this function",i=[],s=!1,n=e.fn.datepicker,a=!1,r=function(){var e,t;for(a=!0,e=0,t=i.length;e<t;e++)i[e].init.call(i[e].scope);i=[]};"function"==typeof define&&define.amd?require(["moment"],function(e){s=e,r()},function(e){"moment"===(e.requireModules&&e.requireModules[0])&&r()}):r();var l=function(t,n){this.$element=e(t),this.options=e.extend(!0,{},e.fn.datepicker.defaults,n),this.$calendar=this.$element.find(".datepicker-calendar"),this.$days=this.$calendar.find(".datepicker-calendar-days"),this.$header=this.$calendar.find(".datepicker-calendar-header"),this.$headerTitle=this.$header.find(".title"),this.$input=this.$element.find("input"),this.$inputGroupBtn=this.$element.find(".input-group-btn"),this.$wheels=this.$element.find(".datepicker-wheels"),this.$wheelsMonth=this.$element.find(".datepicker-wheels-month"),this.$wheelsYear=this.$element.find(".datepicker-wheels-year"),this.artificialScrolling=!1,this.formatDate=this.options.formatDate||this.formatDate,this.inputValue=null,this.moment=!1,this.momentFormat=null,this.parseDate=this.options.parseDate||this.parseDate,this.preventBlurHide=!1,this.restricted=this.options.restricted||[],this.restrictedParsed=[],this.restrictedText=this.options.restrictedText,this.sameYearOnly=this.options.sameYearOnly,this.selectedDate=null,this.yearRestriction=null,this.$calendar.find(".datepicker-today").on("click.fu.datepicker",e.proxy(this.todayClicked,this)),this.$days.on("click.fu.datepicker","tr td button",e.proxy(this.dateClicked,this)),this.$header.find(".next").on("click.fu.datepicker",e.proxy(this.next,this)),this.$header.find(".prev").on("click.fu.datepicker",e.proxy(this.prev,this)),this.$headerTitle.on("click.fu.datepicker",e.proxy(this.titleClicked,this)),this.$input.on("change.fu.datepicker",e.proxy(this.inputChanged,this)),this.$input.on("mousedown.fu.datepicker",e.proxy(this.showDropdown,this)),this.$inputGroupBtn.on("hidden.bs.dropdown",e.proxy(this.hide,this)),this.$inputGroupBtn.on("shown.bs.dropdown",e.proxy(this.show,this)),this.$wheels.find(".datepicker-wheels-back").on("click.fu.datepicker",e.proxy(this.backClicked,this)),this.$wheels.find(".datepicker-wheels-select").on("click.fu.datepicker",e.proxy(this.selectClicked,this)),this.$wheelsMonth.on("click.fu.datepicker","ul button",e.proxy(this.monthClicked,this)),this.$wheelsYear.on("click.fu.datepicker","ul button",e.proxy(this.yearClicked,this)),this.$wheelsYear.find("ul").on("scroll.fu.datepicker",e.proxy(this.onYearScroll,this));var r=function(){this.checkForMomentJS()&&(s=s||window.moment,this.moment=!0,this.momentFormat=this.options.momentConfig.format,this.setCulture(this.options.momentConfig.culture),s.locale=s.locale||s.lang),this.setRestrictedDates(this.restricted),this.setDate(this.options.date)||(this.$input.val(""),this.inputValue=this.$input.val()),this.sameYearOnly&&(this.yearRestriction=this.selectedDate?this.selectedDate.getFullYear():(new Date).getFullYear())};a?r.call(this):i.push({init:r,scope:this})};(l.prototype={constructor:l,backClicked:function(){this.changeView("calendar")},changeView:function(e,t){"wheels"===e?(this.$calendar.hide().attr("aria-hidden","true"),this.$wheels.show().removeAttr("aria-hidden",""),t&&this.renderWheel(t)):(this.$wheels.hide().attr("aria-hidden","true"),this.$calendar.show().removeAttr("aria-hidden",""),t&&this.renderMonth(t))},checkForMomentJS:function(){return!(!(e.isFunction(window.moment)||void 0!==s&&e.isFunction(s))||!e.isPlainObject(this.options.momentConfig)||"string"!=typeof this.options.momentConfig.culture||"string"!=typeof this.options.momentConfig.format)},dateClicked:function(t){var i,s=e(t.currentTarget).parents("td:first");s.hasClass("restricted")||(this.$days.find("td.selected").removeClass("selected"),s.addClass("selected"),i=new Date(s.attr("data-year"),s.attr("data-month"),s.attr("data-date")),this.selectedDate=i,this.$input.val(this.formatDate(i)),this.inputValue=this.$input.val(),this.hide(),this.$input.focus(),this.$element.trigger("dateClicked.fu.datepicker",i))},destroy:function(){return this.$element.remove(),this.$days.find("tbody").empty(),this.$wheelsYear.find("ul").empty(),this.$element[0].outerHTML},disable:function(){this.$element.addClass("disabled"),this.$element.find("input, button").attr("disabled","disabled"),this.$inputGroupBtn.removeClass("open")},enable:function(){this.$element.removeClass("disabled"),this.$element.find("input, button").removeAttr("disabled")},formatDate:function(e){var t=function(e){var t="0"+e;return t.substr(t.length-2)};return this.moment?s(e).format(this.momentFormat):t(e.getMonth()+1)+"/"+t(e.getDate())+"/"+e.getFullYear()},getCulture:function(){if(this.moment)return s.locale();throw t},getDate:function(){return this.selectedDate?this.selectedDate:new Date(NaN)},getFormat:function(){if(this.moment)return this.momentFormat;throw t},getFormattedDate:function(){return this.selectedDate?this.formatDate(this.selectedDate):"Invalid Date"},getRestrictedDates:function(){return this.restricted},inputChanged:function(){var e,t=this.$input.val();t!==this.inputValue&&(null===(e=this.setDate(t))?this.$element.trigger("inputParsingFailed.fu.datepicker",t):!1===e?this.$element.trigger("inputRestrictedDate.fu.datepicker",e):this.$element.trigger("changed.fu.datepicker",e))},show:function(){var e=this.selectedDate?this.selectedDate:new Date;this.changeView("calendar",e),this.$inputGroupBtn.addClass("open"),this.$element.trigger("shown.fu.datepicker")},showDropdown:function(e){this.$input.is(":focus")||this.$inputGroupBtn.hasClass("open")||this.show()},hide:function(){this.$inputGroupBtn.removeClass("open"),this.$element.trigger("hidden.fu.datepicker")},hideDropdown:function(){this.hide()},isInvalidDate:function(e){var t=e.toString();return"Invalid Date"===t||"NaN"===t},isRestricted:function(e,t,i){var s,n,a,r,l=this.restrictedParsed;if(this.sameYearOnly&&null!==this.yearRestriction&&i!==this.yearRestriction)return!0;for(s=0,a=l.length;s<a;s++)if(n=l[s].from,r=l[s].to,(i>n.year||i===n.year&&t>n.month||i===n.year&&t===n.month&&e>=n.date)&&(i<r.year||i===r.year&&t<r.month||i===r.year&&t===r.month&&e<=r.date))return!0;return!1},monthClicked:function(t){this.$wheelsMonth.find(".selected").removeClass("selected"),e(t.currentTarget).parent().addClass("selected")},next:function(){var e=this.$headerTitle.attr("data-month"),t=this.$headerTitle.attr("data-year");if(++e>11){if(this.sameYearOnly)return;e=0,t++}this.renderMonth(new Date(t,e,1))},onYearScroll:function(t){if(!this.artificialScrolling){var i,s,n=e(t.currentTarget),a="border-box"===n.css("box-sizing")?n.outerHeight():n.height(),r=n.get(0).scrollHeight,l=n.scrollTop(),o=a/(r-l)*100;if(l/r*100<5){for(i=(s=parseInt(n.find("li:first").attr("data-year"),10))-1;i>s-11;i--)n.prepend('<li data-year="'+i+'"><button type="button">'+i+"</button></li>");this.artificialScrolling=!0,n.scrollTop(n.get(0).scrollHeight-r+l),this.artificialScrolling=!1}else if(o>90)for(i=(s=parseInt(n.find("li:last").attr("data-year"),10))+1;i<s+11;i++)n.append('<li data-year="'+i+'"><button type="button">'+i+"</button></li>")}},parseDate:function(e){var t,i,n,a,r,l,o,d=this,h=new Date(NaN);if(e){if(this.moment)return a=function(e){var t=s(e,d.momentFormat);return!0===t.isValid()?t.toDate():h},n=function(e){var t=s(new Date(e));return!0===t.isValid()?t.toDate():h},r=function(e,t,i){var s=t(e);return d.isInvalidDate(s)?(s=i(e),d.isInvalidDate(s)?h:s):s},"string"==typeof e?r(e,a,n):r(e,n,a);if("string"==typeof e){if(t=new Date(Date.parse(e)),!this.isInvalidDate(t))return t;if(e=e.split("T")[0],i=/^\s*(\d{4})-(\d\d)-(\d\d)\s*$/,(o=i.exec(e))&&(l=parseInt(o[2],10),t=new Date(o[1],l-1,o[3]),l===t.getMonth()+1))return t}else if(t=new Date(e),!this.isInvalidDate(t))return t}return new Date(NaN)},prev:function(){var e=this.$headerTitle.attr("data-month"),t=this.$headerTitle.attr("data-year");if(--e<0){if(this.sameYearOnly)return;e=11,t--}this.renderMonth(new Date(t,e,1))},renderMonth:function(t){t=t||new Date;var i,s,n,a,r,l,o,d,h,c,p,u=new Date(t.getFullYear(),t.getMonth(),1).getDay(),f=new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),m=new Date(t.getFullYear(),t.getMonth(),0).getDate(),v=this.$headerTitle.find(".month"),g=t.getMonth(),$=new Date,b=$.getDate(),y=$.getMonth(),w=$.getFullYear(),C=this.selectedDate,x=this.$days.find("tbody"),k=t.getFullYear();for(C&&(C={date:C.getDate(),month:C.getMonth(),year:C.getFullYear()}),v.find(".current").removeClass("current"),v.find('span[data-month="'+g+'"]').addClass("current"),this.$headerTitle.find(".year").text(k),this.$headerTitle.attr({"data-month":g,"data-year":k}),x.empty(),0!==u?(i=m-u+1,o=-1):(i=1,o=0),l=f<=35-u?5:6,a=0;a<l;a++){for(p=e("<tr></tr>"),r=0;r<7;r++)c=e("<td></td>"),-1===o?(c.addClass("last-month"),d!==o&&c.addClass("first")):1===o&&(c.addClass("next-month"),d!==o&&c.addClass("first")),n=k,(s=g+o)<0?(s=11,n--):s>11&&(s=0,n++),c.attr({"data-date":i,"data-month":s,"data-year":n}),n===w&&s===y&&i===b?c.addClass("current-day"):(n<w||n===w&&s<y||n===w&&s===y&&i<b)&&(c.addClass("past"),this.options.allowPastDates||c.addClass("restricted").attr("title",this.restrictedText)),this.isRestricted(i,s,n)&&c.addClass("restricted").attr("title",this.restrictedText),C&&n===C.year&&s===C.month&&i===C.date&&c.addClass("selected"),c.hasClass("restricted")?c.html('<span><b class="datepicker-date">'+i+"</b></span>"):c.html('<span><button type="button" class="datepicker-date">'+i+"</button></span>"),i++,h=d,d=o,-1===o&&i>m?(i=1,h!==(o=0)&&c.addClass("last")):0===o&&i>f&&(i=1,h!==(o=1)&&c.addClass("last")),a===l-1&&6===r&&c.addClass("last"),p.append(c);x.append(p)}},renderWheel:function(e){var t,i,s,n=e.getMonth(),a=this.$wheelsMonth.find("ul"),r=e.getFullYear(),l=this.$wheelsYear.find("ul");for(this.sameYearOnly?(this.$wheelsMonth.addClass("full"),this.$wheelsYear.addClass("hidden")):(this.$wheelsMonth.removeClass("full"),this.$wheelsYear.removeClass("hide hidden")),a.find(".selected").removeClass("selected"),(i=a.find('li[data-month="'+n+'"]')).addClass("selected"),a.scrollTop(a.scrollTop()+(i.position().top-a.outerHeight()/2-i.outerHeight(!0)/2)),l.empty(),t=r-10;t<r+11;t++)l.append('<li data-year="'+t+'"><button type="button">'+t+"</button></li>");(s=l.find('li[data-year="'+r+'"]')).addClass("selected"),this.artificialScrolling=!0,l.scrollTop(l.scrollTop()+(s.position().top-l.outerHeight()/2-s.outerHeight(!0)/2)),this.artificialScrolling=!1,i.find("button").focus()},selectClicked:function(){var e=this.$wheelsMonth.find(".selected").attr("data-month"),t=this.$wheelsYear.find(".selected").attr("data-year");this.changeView("calendar",new Date(t,e,1))},setCulture:function(e){if(!e)return!1;if(!this.moment)throw t;s.locale(e)},setDate:function(e){var t=this.parseDate(e);return this.isInvalidDate(t)?(this.selectedDate=null,this.renderMonth()):this.isRestricted(t.getDate(),t.getMonth(),t.getFullYear())?(this.selectedDate=!1,this.renderMonth()):(this.selectedDate=t,this.renderMonth(t),this.$input.val(this.formatDate(t))),this.inputValue=this.$input.val(),this.selectedDate},setFormat:function(e){if(!e)return!1;if(!this.moment)throw t;this.momentFormat=e},setRestrictedDates:function(e){var t,i,s=[],n=this,a=function(e){return e===-1/0?{date:-1/0,month:-1/0,year:-1/0}:e===1/0?{date:1/0,month:1/0,year:1/0}:(e=n.parseDate(e),{date:e.getDate(),month:e.getMonth(),year:e.getFullYear()})};for(this.restricted=e,t=0,i=e.length;t<i;t++)s.push({from:a(e[t].from),to:a(e[t].to)});this.restrictedParsed=s},titleClicked:function(e){this.changeView("wheels",new Date(this.$headerTitle.attr("data-year"),this.$headerTitle.attr("data-month"),1))},todayClicked:function(e){var t=new Date;t.getMonth()+""===this.$headerTitle.attr("data-month")&&t.getFullYear()+""===this.$headerTitle.attr("data-year")||this.renderMonth(t)},yearClicked:function(t){this.$wheelsYear.find(".selected").removeClass("selected"),e(t.currentTarget).parent().addClass("selected")}}).getValue=l.prototype.getDate,e.fn.datepicker=function(t){var i,s=Array.prototype.slice.call(arguments,1),n=this.each(function(){var n=e(this),a=n.data("fu.datepicker"),r="object"==typeof t&&t;a||n.data("fu.datepicker",a=new l(this,r)),"string"==typeof t&&(i=a[t].apply(a,s))});return void 0===i?n:i},e.fn.datepicker.defaults={allowPastDates:!1,date:new Date,formatDate:null,momentConfig:{culture:"en",format:"L"},parseDate:null,restricted:[],restrictedText:"Restricted",sameYearOnly:!1},e.fn.datepicker.Constructor=l,e.fn.datepicker.noConflict=function(){return e.fn.datepicker=n,this},e(document).on("mousedown.fu.datepicker.data-api","[data-initialize=datepicker]",function(t){var i=e(t.target).closest(".datepicker");i.data("datepicker")||i.datepicker(i.data())}),e(document).on("click.fu.datepicker.data-api",".datepicker .dropdown-menu",function(t){var i=e(t.target);i.is(".datepicker-date")&&!i.closest(".restricted").length||t.stopPropagation()}),e(document).on("click.fu.datepicker.data-api",".datepicker input",function(e){e.stopPropagation()}),e(function(){e("[data-initialize=datepicker]").each(function(){var t=e(this);t.data("datepicker")||t.datepicker(t.data())})})}(e),function(e){function t(t){e(t).css({visibility:"hidden"}),i(t)?t.parent().addClass("dropup"):t.parent().removeClass("dropup"),e(t).css({visibility:"visible"})}function i(e){var t=s(e),i={};return i.parentHeight=e.parent().outerHeight(),i.parentOffsetTop=e.parent().offset().top,i.dropdownHeight=e.outerHeight(),i.containerHeight=t.overflowElement.outerHeight(),i.containerOffsetTop=t.isWindow?t.overflowElement.scrollTop():t.overflowElement.offset().top,i.fromTop=i.parentOffsetTop-i.containerOffsetTop,i.fromBottom=i.containerHeight-i.parentHeight-(i.parentOffsetTop-i.containerOffsetTop),!(i.dropdownHeight<i.fromBottom)&&(i.dropdownHeight<i.fromTop||(i.dropdownHeight>=i.fromTop&&i.dropdownHeight>=i.fromBottom?i.fromTop>=i.fromBottom:void 0))}function s(t){var i,s=t.attr("data-target"),n=!0;return s?"window"!==s&&(i=e(s),n=!1):e.each(t.parents(),function(t,s){if("visible"!==e(s).css("overflow"))return i=s,n=!1,!1}),n&&(i=window),{overflowElement:e(i),isWindow:n}}e(document).on("click.fu.dropdown-autoflip","[data-toggle=dropdown][data-flip]",function(i){"auto"===e(this).data().flip&&t(e(this).next(".dropdown-menu"))}),e(document).on("suggested.fu.pillbox",function(i,s){t(e(s)),e(s).parent().addClass("open")}),e.fn.dropdownautoflip=function(){}}(e),function(e){var t=e.fn.loader,i=function(t,i){this.$element=e(t),this.options=e.extend({},e.fn.loader.defaults,i)};i.prototype={constructor:i,destroy:function(){return this.$element.remove(),this.$element[0].outerHTML},ieRepaint:function(){},msieVersion:function(){},next:function(){},pause:function(){},play:function(){},previous:function(){},reset:function(){}},e.fn.loader=function(t){var s,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.loader"),l="object"==typeof t&&t;r||a.data("fu.loader",r=new i(this,l)),"string"==typeof t&&(s=r[t].apply(r,n))});return void 0===s?a:s},e.fn.loader.defaults={},e.fn.loader.Constructor=i,e.fn.loader.noConflict=function(){return e.fn.loader=t,this},e(function(){e("[data-initialize=loader]").each(function(){var t=e(this);t.data("fu.loader")||t.loader(t.data())})})}(e),function(e){var t=e.fn.placard,i={accepted:"onAccept",cancelled:"onCancel"},s=function(t,i){var s=this;this.$element=e(t),this.options=e.extend({},e.fn.placard.defaults,i),"true"===this.$element.attr("data-ellipsis")&&(this.options.applyEllipsis=!0),this.$accept=this.$element.find(".placard-accept"),this.$cancel=this.$element.find(".placard-cancel"),this.$field=this.$element.find(".placard-field"),this.$footer=this.$element.find(".placard-footer"),this.$header=this.$element.find(".placard-header"),this.$popup=this.$element.find(".placard-popup"),this.actualValue=null,this.clickStamp="_",this.previousValue="",-1===this.options.revertOnCancel&&(this.options.revertOnCancel=this.$accept.length>0),this.isContentEditableDiv=this.$field.is("div"),this.isInput=this.$field.is("input"),this.divInTextareaMode=this.isContentEditableDiv&&"true"===this.$field.attr("data-textarea"),this.$field.on("focus.fu.placard",e.proxy(this.show,this)),this.$field.on("keydown.fu.placard",e.proxy(this.keyComplete,this)),this.$element.on("close.fu.placard",e.proxy(this.hide,this)),this.$accept.on("click.fu.placard",e.proxy(this.complete,this,"accepted")),this.$cancel.on("click.fu.placard",function(e){e.preventDefault(),s.complete("cancelled")}),this.applyEllipsis()},n=function(e){return e.$element.hasClass("showing")},a=function(){var t;if((t=e(document).find(".placard.showing")).length>0){if(t.data("fu.placard")&&t.data("fu.placard").options.explicit)return!1;t.placard("externalClickListener",{},!0)}return!0};s.prototype={constructor:s,complete:function(e){var t=this.options[i[e]],s={previousValue:this.previousValue,value:this.getValue()};t?(t(s),this.$element.trigger(e+".fu.placard",s)):("cancelled"===e&&this.options.revertOnCancel&&this.setValue(this.previousValue,!0),this.$element.trigger(e+".fu.placard",s),this.hide())},keyComplete:function(e){(this.isContentEditableDiv&&!this.divInTextareaMode||this.isInput)&&13===e.keyCode?(this.complete("accepted"),this.$field.blur()):27===e.keyCode&&(this.complete("cancelled"),this.$field.blur())},destroy:function(){return this.$element.remove(),e(document).off("click.fu.placard.externalClick."+this.clickStamp),this.$element.find("input").each(function(){e(this).attr("value",e(this).val())}),this.$element[0].outerHTML},disable:function(){this.$element.addClass("disabled"),this.$field.attr("disabled","disabled"),this.isContentEditableDiv&&this.$field.removeAttr("contenteditable"),this.hide()},applyEllipsis:function(){var e,t,i;if(this.options.applyEllipsis)if(e=this.$field.get(0),this.isContentEditableDiv&&!this.divInTextareaMode||this.isInput)e.scrollLeft=0;else if(e.scrollTop=0,e.clientHeight<e.scrollHeight){for(this.actualValue=this.getValue(),this.setValue("",!0),i="",t=0;e.clientHeight>=e.scrollHeight;)i+=this.actualValue[t],this.setValue(i+"...",!0),t++;i=i.length>0?i.substring(0,i.length-1):"",this.setValue(i+"...",!0)}},enable:function(){this.$element.removeClass("disabled"),this.$field.removeAttr("disabled"),this.isContentEditableDiv&&this.$field.attr("contenteditable","true")},externalClickListener:function(e,t){(!0===t||this.isExternalClick(e))&&this.complete(this.options.externalClickAction)},getValue:function(){return null!==this.actualValue?this.actualValue:this.isContentEditableDiv?this.$field.html():this.$field.val()},hide:function(){this.$element.hasClass("showing")&&(this.$element.removeClass("showing"),this.applyEllipsis(),e(document).off("click.fu.placard.externalClick."+this.clickStamp),this.$element.trigger("hidden.fu.placard"))},isExternalClick:function(t){var i,s,n=this.$element.get(0),a=this.options.externalClickExceptions||[],r=e(t.target);if(t.target===n||r.parents(".placard:first").get(0)===n)return!1;for(i=0,s=a.length;i<s;i++)if(r.is(a[i])||r.parents(a[i]).length>0)return!1;return!0},setValue:function(e,t){return void 0===t&&(t=!this.options.applyEllipsis),this.isContentEditableDiv?this.$field.empty().append(e):this.$field.val(e),t||n(this)||this.applyEllipsis(),this.$field},show:function(){n(this)||a()&&(this.previousValue=this.isContentEditableDiv?this.$field.html():this.$field.val(),null!==this.actualValue&&(this.setValue(this.actualValue,!0),this.actualValue=null),this.showPlacard())},showPlacard:function(){this.$element.addClass("showing"),this.$header.length>0&&this.$popup.css("top","-"+this.$header.outerHeight(!0)+"px"),this.$footer.length>0&&this.$popup.css("bottom","-"+this.$footer.outerHeight(!0)+"px"),this.$element.trigger("shown.fu.placard"),this.clickStamp=(new Date).getTime()+(Math.floor(100*Math.random())+1),this.options.explicit||e(document).on("click.fu.placard.externalClick."+this.clickStamp,e.proxy(this.externalClickListener,this))}},e.fn.placard=function(t){var i,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.placard"),l="object"==typeof t&&t;r||a.data("fu.placard",r=new s(this,l)),"string"==typeof t&&(i=r[t].apply(r,n))});return void 0===i?a:i},e.fn.placard.defaults={onAccept:void 0,onCancel:void 0,externalClickAction:"cancelled",externalClickExceptions:[],explicit:!1,revertOnCancel:-1,applyEllipsis:!1},e.fn.placard.Constructor=s,e.fn.placard.noConflict=function(){return e.fn.placard=t,this},e(document).on("focus.fu.placard.data-api","[data-initialize=placard]",function(t){var i=e(t.target).closest(".placard");i.data("fu.placard")||i.placard(i.data())}),e(function(){e("[data-initialize=placard]").each(function(){var t=e(this);t.data("fu.placard")||t.placard(t.data())})})}(e),function(e){var t=e.fn.radio,i=function(e){window&&window.console&&window.console.error&&window.console.error(e)},s=function(t,s){if(this.options=e.extend({},e.fn.radio.defaults,s),"label"===t.tagName.toLowerCase()){this.$label=e(t),this.$radio=this.$label.find('input[type="radio"]'),this.groupName=this.$radio.attr("name"),!this.options.ignoreVisibilityCheck&&this.$radio.css("visibility").match(/hidden|collapse/)&&i("For accessibility reasons, in order for tab and space to function on radio, `visibility` must not be set to `hidden` or `collapse`. See https://github.com/ExactTarget/fuelux/pull/1996 for more details.");var n=this.$radio.attr("data-toggle");this.$toggleContainer=e(n),this.$radio.on("change",e.proxy(this.itemchecked,this)),this.setInitialState()}else i("Radio must be initialized on the `label` that wraps the `input` element. See https://github.com/ExactTarget/fuelux/blob/master/reference/markup/radio.html for example of proper markup. Call `.radio()` on the `<label>` not the `<input>`")};(s.prototype={constructor:s,setInitialState:function(){var e=this.$radio,t=e.prop("checked"),i=e.prop("disabled");this.setCheckedState(e,t),this.setDisabledState(e,i)},resetGroup:function(){e('input[name="'+this.groupName+'"]').each(function(t,i){var s=e(i),n=s.parent(),a=s.attr("data-toggle"),r=e(a);n.removeClass("checked"),r.addClass("hidden")})},setCheckedState:function(t,i){var s=t,n=s.parent(),a=s.attr("data-toggle"),r=e(a);i?(this.resetGroup(),s.prop("checked",!0),n.addClass("checked"),r.removeClass("hide hidden"),n.trigger("checked.fu.radio")):(s.prop("checked",!1),n.removeClass("checked"),r.addClass("hidden"),n.trigger("unchecked.fu.radio")),n.trigger("changed.fu.radio",i)},setDisabledState:function(t,i){var s=e(t),n=this.$label;return i?(s.prop("disabled",!0),n.addClass("disabled"),n.trigger("disabled.fu.radio")):(s.prop("disabled",!1),n.removeClass("disabled"),n.trigger("enabled.fu.radio")),s},itemchecked:function(t){var i=e(t.target);this.setCheckedState(i,!0)},check:function(){this.setCheckedState(this.$radio,!0)},uncheck:function(){this.setCheckedState(this.$radio,!1)},isChecked:function(){return this.$radio.prop("checked")},enable:function(){this.setDisabledState(this.$radio,!1)},disable:function(){this.setDisabledState(this.$radio,!0)},destroy:function(){return this.$label.remove(),this.$label[0].outerHTML}}).getValue=s.prototype.isChecked,e.fn.radio=function(t){var i,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.radio"),l="object"==typeof t&&t;r||a.data("fu.radio",r=new s(this,l)),"string"==typeof t&&(i=r[t].apply(r,n))});return void 0===i?a:i},e.fn.radio.defaults={ignoreVisibilityCheck:!1},e.fn.radio.Constructor=s,e.fn.radio.noConflict=function(){return e.fn.radio=t,this},e(document).on("mouseover.fu.radio.data-api","[data-initialize=radio]",function(t){var i=e(t.target);i.data("fu.radio")||i.radio(i.data())}),e(function(){e("[data-initialize=radio]").each(function(){var t=e(this);t.data("fu.radio")||t.radio(t.data())})})}(e),function(e){var t=e.fn.search,i=function(t,i){this.$element=e(t),this.$repeater=e(t).closest(".repeater"),this.options=e.extend({},e.fn.search.defaults,i),"true"===this.$element.attr("data-searchOnKeyPress")&&(this.options.searchOnKeyPress=!0),this.$button=this.$element.find("button"),this.$input=this.$element.find("input"),this.$icon=this.$element.find(".glyphicon, .fuelux-icon"),this.$button.on("click.fu.search",e.proxy(this.buttonclicked,this)),this.$input.on("keyup.fu.search",e.proxy(this.keypress,this)),this.$repeater.length>0&&this.$repeater.on("rendered.fu.repeater",e.proxy(this.clearPending,this)),this.activeSearch=""};i.prototype={constructor:i,destroy:function(){return this.$element.remove(),this.$element.find("input").each(function(){e(this).attr("value",e(this).val())}),this.$element[0].outerHTML},search:function(e){this.$icon.hasClass("glyphicon")&&this.$icon.removeClass("glyphicon-search").addClass("glyphicon-remove"),this.$icon.hasClass("fuelux-icon")&&this.$icon.removeClass("fuelux-icon-search").addClass("fuelux-icon-remove"),this.activeSearch=e,this.$element.addClass("searched pending"),this.$element.trigger("searched.fu.search",e)},clear:function(){this.$icon.hasClass("glyphicon")&&this.$icon.removeClass("glyphicon-remove").addClass("glyphicon-search"),this.$icon.hasClass("fuelux-icon")&&this.$icon.removeClass("fuelux-icon-remove").addClass("fuelux-icon-search"),this.$element.hasClass("pending")&&this.$element.trigger("canceled.fu.search"),this.activeSearch="",this.$input.val(""),this.$element.trigger("cleared.fu.search"),this.$element.removeClass("searched pending")},clearPending:function(){this.$element.removeClass("pending")},action:function(){var e=this.$input.val();e&&e.length>0?this.search(e):this.clear()},buttonclicked:function(t){t.preventDefault(),e(t.currentTarget).is(".disabled, :disabled")||(this.$element.hasClass("pending")||this.$element.hasClass("searched")?this.clear():this.action())},keypress:function(e){13===e.which?(e.preventDefault(),this.action()):9===e.which?e.preventDefault():27===e.which?(e.preventDefault(),this.clear()):this.options.searchOnKeyPress&&this.action()},disable:function(){this.$element.addClass("disabled"),this.$input.attr("disabled","disabled"),this.options.allowCancel||this.$button.addClass("disabled")},enable:function(){this.$element.removeClass("disabled"),this.$input.removeAttr("disabled"),this.$button.removeClass("disabled")}},e.fn.search=function(t){var s,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.search"),l="object"==typeof t&&t;r||a.data("fu.search",r=new i(this,l)),"string"==typeof t&&(s=r[t].apply(r,n))});return void 0===s?a:s},e.fn.search.defaults={clearOnEmpty:!1,searchOnKeyPress:!1,allowCancel:!1},e.fn.search.Constructor=i,e.fn.search.noConflict=function(){return e.fn.search=t,this},e(document).on("mousedown.fu.search.data-api","[data-initialize=search]",function(t){var i=e(t.target).closest(".search");i.data("fu.search")||i.search(i.data())}),e(function(){e("[data-initialize=search]").each(function(){var t=e(this);t.data("fu.search")||t.search(t.data())})})}(e),function(e){var t=e.fn.selectlist,i=function(t,i){this.$element=e(t),this.options=e.extend({},e.fn.selectlist.defaults,i),this.$button=this.$element.find(".btn.dropdown-toggle"),this.$hiddenField=this.$element.find(".hidden-field"),this.$label=this.$element.find(".selected-label"),this.$dropdownMenu=this.$element.find(".dropdown-menu"),this.$element.on("click.fu.selectlist",".dropdown-menu a",e.proxy(this.itemClicked,this)),this.setDefaultSelection(),"auto"!==i.resize&&"auto"!==this.$element.attr("data-resize")||this.resize(),0===this.$dropdownMenu.children("li").length&&(this.disable(),this.doSelect(e(this.options.emptyLabelHTML))),this.$element.on("shown.bs.dropdown",function(){var t=e(this);e(document).on("keypress.fu.selectlist",function(i){var s=String.fromCharCode(i.which);t.find("li").each(function(t,i){if(e(i).text().charAt(0).toLowerCase()===s)return e(i).children("a").focus(),!1})})}),this.$element.on("hide.bs.dropdown",function(){e(document).off("keypress.fu.selectlist")})};(i.prototype={constructor:i,destroy:function(){return this.$element.remove(),this.$element[0].outerHTML},doSelect:function(t){var i;this.$selectedItem=i=t,this.$hiddenField.val(this.$selectedItem.attr("data-value")),this.$label.html(e(this.$selectedItem.children()[0]).html()),this.$element.find("li").each(function(){i.is(e(this))?e(this).attr("data-selected",!0):e(this).removeData("selected").removeAttr("data-selected")})},itemClicked:function(t){this.$element.trigger("clicked.fu.selectlist",this.$selectedItem),t.preventDefault(),e(t.currentTarget).parent("li").is(".disabled, :disabled")||(e(t.target).parent().is(this.$selectedItem)||this.itemChanged(t),this.$element.find(".dropdown-toggle").focus())},itemChanged:function(t){this.doSelect(e(t.target).closest("li"));var i=this.selectedItem();this.$element.trigger("changed.fu.selectlist",i)},resize:function(){var t=0,i=0,s=e("<div/>").addClass("selectlist-sizer");Boolean(e(document).find("html").hasClass("fuelux"))?e(document.body).append(s):e(".fuelux:first").append(s),s.append(this.$element.clone()),this.$element.find("a").each(function(){s.find(".selected-label").text(e(this).text()),i=s.find(".selectlist").outerWidth(),(i+=s.find(".sr-only").outerWidth())>t&&(t=i)}),t<=1||(this.$button.css("width",t),this.$dropdownMenu.css("width",t),s.remove())},selectedItem:function(){var t=this.$selectedItem.text();return e.extend({text:t},this.$selectedItem.data())},selectByText:function(t){var i=e([]);this.$element.find("li").each(function(){if((this.textContent||this.innerText||e(this).text()||"").toLowerCase()===(t||"").toLowerCase())return i=e(this),!1}),this.doSelect(i)},selectByValue:function(e){var t='li[data-value="'+e+'"]';this.selectBySelector(t)},selectByIndex:function(e){var t="li:eq("+e+")";this.selectBySelector(t)},selectBySelector:function(e){var t=this.$element.find(e);this.doSelect(t)},setDefaultSelection:function(){var e=this.$element.find("li[data-selected=true]").eq(0);0===e.length&&(e=this.$element.find("li").has("a").eq(0)),this.doSelect(e)},enable:function(){this.$element.removeClass("disabled"),this.$button.removeClass("disabled")},disable:function(){this.$element.addClass("disabled"),this.$button.addClass("disabled")}}).getValue=i.prototype.selectedItem,e.fn.selectlist=function(t){var s,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.selectlist"),l="object"==typeof t&&t;r||a.data("fu.selectlist",r=new i(this,l)),"string"==typeof t&&(s=r[t].apply(r,n))});return void 0===s?a:s},e.fn.selectlist.defaults={emptyLabelHTML:'<li data-value=""><a href="#">No items</a></li>'},e.fn.selectlist.Constructor=i,e.fn.selectlist.noConflict=function(){return e.fn.selectlist=t,this},e(document).on("mousedown.fu.selectlist.data-api","[data-initialize=selectlist]",function(t){var i=e(t.target).closest(".selectlist");i.data("fu.selectlist")||i.selectlist(i.data())}),e(function(){e("[data-initialize=selectlist]").each(function(){var t=e(this);t.data("fu.selectlist")||t.selectlist(t.data())})})}(e),function(e){var t=e.fn.spinbox,i=function(t,i){this.$element=e(t),this.$element.find(".btn").on("click",function(e){e.preventDefault()}),this.options=e.extend({},e.fn.spinbox.defaults,i),this.options.step=this.$element.data("step")||this.options.step,this.options.value<this.options.min?this.options.value=this.options.min:this.options.max<this.options.value&&(this.options.value=this.options.max),this.$input=this.$element.find(".spinbox-input"),this.$input.on("focusout.fu.spinbox",this.$input,e.proxy(this.change,this)),this.$element.on("keydown.fu.spinbox",this.$input,e.proxy(this.keydown,this)),this.$element.on("keyup.fu.spinbox",this.$input,e.proxy(this.keyup,this)),this.options.hold?(this.$element.on("mousedown.fu.spinbox",".spinbox-up",e.proxy(function(){this.startSpin(!0)},this)),this.$element.on("mouseup.fu.spinbox",".spinbox-up, .spinbox-down",e.proxy(this.stopSpin,this)),this.$element.on("mouseout.fu.spinbox",".spinbox-up, .spinbox-down",e.proxy(this.stopSpin,this)),this.$element.on("mousedown.fu.spinbox",".spinbox-down",e.proxy(function(){this.startSpin(!1)},this))):(this.$element.on("click.fu.spinbox",".spinbox-up",e.proxy(function(){this.step(!0)},this)),this.$element.on("click.fu.spinbox",".spinbox-down",e.proxy(function(){this.step(!1)},this))),this.switches={count:1,enabled:!0},"medium"===this.options.speed?this.switches.speed=300:"fast"===this.options.speed?this.switches.speed=100:this.switches.speed=500,this.options.defaultUnit=n(this.options.defaultUnit,this.options.units)?this.options.defaultUnit:"",this.unit=this.options.defaultUnit,this.lastValue=this.options.value,this.render(),this.options.disabled&&this.disable()},s=function(e,t){return Math.round(e/t)*t},n=function(t,i){var s=!1,n=t.toLowerCase();return e.each(i,function(e,t){if(t=t.toLowerCase(),n===t)return s=!0,!1}),s},a=function(e){return isNaN(parseFloat(e))?e:(e>this.options.max?e=this.options.cycle?this.options.min:this.options.max:e<this.options.min&&(e=this.options.cycle?this.options.max:this.options.min),this.options.limitToStep&&this.options.step&&((e=s(e,this.options.step))>this.options.max?e-=this.options.step:e<this.options.min&&(e+=this.options.step)),e)};i.prototype={constructor:i,destroy:function(){return this.$element.remove(),this.$element.find("input").each(function(){e(this).attr("value",e(this).val())}),this.$element[0].outerHTML},render:function(){this._setValue(this.getDisplayValue())},change:function(){this._setValue(this.getDisplayValue()),this.triggerChangedEvent()},stopSpin:function(){void 0!==this.switches.timeout&&(clearTimeout(this.switches.timeout),this.switches.count=1,this.triggerChangedEvent())},triggerChangedEvent:function(){var e=this.getValue();e!==this.lastValue&&(this.lastValue=e,this.$element.trigger("changed.fu.spinbox",e))},startSpin:function(t){if(!this.options.disabled){var i=this.switches.count;1===i?(this.step(t),i=1):i=i<3?1.5:i<8?2.5:4,this.switches.timeout=setTimeout(e.proxy(function(){this.iterate(t)},this),this.switches.speed/i),this.switches.count++}},iterate:function(e){this.step(e),this.startSpin(e)},step:function(e){this._setValue(this.getDisplayValue());var t;t=(t=e?this.options.value+this.options.step:this.options.value-this.options.step).toFixed(5),this._setValue(t+this.unit)},getDisplayValue:function(){var e=this.parseInput(this.$input.val());return e||this.options.value},setDisplayValue:function(e){this.$input.val(e)},getValue:function(){var e=this.options.value;return"."!==this.options.decimalMark&&(e=(e+"").split(".").join(this.options.decimalMark)),e+this.unit},setValue:function(e){return this._setValue(e,!0)},_setValue:function(e,t){if("."!==this.options.decimalMark&&(e=this.parseInput(e)),"number"!=typeof e){var i=e.replace(/[0-9.-]/g,"");this.unit=n(i,this.options.units)?i:this.options.defaultUnit}var s=this.getIntValue(e);return isNaN(s)&&!isFinite(s)?this._setValue(this.options.value,t):(s=a.call(this,s),this.options.value=s,e=s+this.unit,"."!==this.options.decimalMark&&(e=(e+"").split(".").join(this.options.decimalMark)),this.setDisplayValue(e),t&&(this.lastValue=e),this)},value:function(e){return e||0===e?this.setValue(e):this.getValue()},parseInput:function(e){return e=(e+"").split(this.options.decimalMark).join(".")},getIntValue:function(e){if(void 0!==(e=void 0===e?this.getValue():e))return"string"==typeof e&&(e=this.parseInput(e)),e=parseFloat(e,10)},disable:function(){this.options.disabled=!0,this.$element.addClass("disabled"),this.$input.attr("disabled",""),this.$element.find("button").addClass("disabled")},enable:function(){this.options.disabled=!1,this.$element.removeClass("disabled"),this.$input.removeAttr("disabled"),this.$element.find("button").removeClass("disabled")},keydown:function(e){var t=e.keyCode;38===t?this.step(!0):40===t?this.step(!1):13===t&&this.change()},keyup:function(e){var t=e.keyCode;38!==t&&40!==t||this.triggerChangedEvent()}},e.fn.spinbox=function(t){var s,n=Array.prototype.slice.call(arguments,1),a=this.each(function(){var a=e(this),r=a.data("fu.spinbox"),l="object"==typeof t&&t;r||a.data("fu.spinbox",r=new i(this,l)),"string"==typeof t&&(s=r[t].apply(r,n))});return void 0===s?a:s},e.fn.spinbox.defaults={value:0,min:0,max:999,step:1,hold:!0,speed:"medium",disabled:!1,cycle:!1,units:[],decimalMark:".",defaultUnit:"",limitToStep:!1},e.fn.spinbox.Constructor=i,e.fn.spinbox.noConflict=function(){return e.fn.spinbox=t,this},e(document).on("mousedown.fu.spinbox.data-api","[data-initialize=spinbox]",function(t){var i=e(t.target).closest(".spinbox");i.data("fu.spinbox")||i.spinbox(i.data())}),e(function(){e("[data-initialize=spinbox]").each(function(){var t=e(this);t.data("fu.spinbox")||t.spinbox(t.data())})})}(e),function(e){function t(e,t){e.addClass("tree-selected"),"item"===e.data("type")&&t.hasClass("fueluxicon-bullet")&&t.removeClass("fueluxicon-bullet").addClass("glyphicon-ok")}function i(e,t){e.removeClass("tree-selected"),"item"===e.data("type")&&t.hasClass("glyphicon-ok")&&t.removeClass("glyphicon-ok").addClass("fueluxicon-bullet")}function s(s,n,a){return e.each(a.$elements,function(t,i){var s=e(i);s[0]!==n.$element[0]&&a.dataForEvent.push(e(s).data())}),n.$element.hasClass("tree-selected")?(i(n.$element,n.$icon),a.eventType="deselected"):(t(n.$element,n.$icon),a.eventType="selected",a.dataForEvent.push(n.elementData)),a}function n(e,s,n){return n.$elements[0]!==s.$element[0]?(e.deselectAll(e.$element),t(s.$element,s.$icon),n.eventType="selected",n.dataForEvent=[s.elementData]):(i(s.$element,s.$icon),n.eventType="deselected",n.dataForEvent=[]),n}var a=e.fn.tree,r=function(t,i){this.$element=e(t),this.options=e.extend({},e.fn.tree.defaults,i),this.$element.attr("tabindex","0"),this.options.itemSelect&&this.$element.on("click.fu.tree",".tree-item",e.proxy(function(e){this.selectItem(e.currentTarget)},this)),this.$element.on("click.fu.tree",".tree-branch-name",e.proxy(function(e){this.toggleFolder(e.currentTarget)},this)),this.$element.on("click.fu.tree",".tree-overflow",e.proxy(function(t){this.populate(e(t.currentTarget))},this)),this.options.folderSelect&&(this.$element.addClass("tree-folder-select"),this.$element.off("click.fu.tree",".tree-branch-name"),this.$element.on("click.fu.tree",".icon-caret",e.proxy(function(t){this.toggleFolder(e(t.currentTarget).parent())},this)),this.$element.on("click.fu.tree",".tree-branch-name",e.proxy(function(t){this.selectFolder(e(t.currentTarget))},this))),this.$element.on("focus",function(){var t=e(this);o(t,t)}),this.$element.on("keydown",function(t){return h(e(this),t)}),this.render()};(r.prototype={constructor:r,deselectAll:function(t){var s=t||this.$element,n=e(s).find(".tree-selected");return n.each(function(t,s){var n=e(s);p(n),i(n,n.find(".glyphicon"))}),n},destroy:function(){return this.$element.find("li:not([data-template])").remove(),this.$element.remove(),this.$element[0].outerHTML},render:function(){this.populate(this.$element)},populate:function(t,i){var s=this,n=t.hasClass("tree-overflow"),a=t.hasClass("tree")?t:t.parent(),r=a.hasClass("tree");n&&!r&&(a=a.parent());var l=a.data();n&&(l.overflow=t.data());var o=i||!1;n&&(r?t.replaceWith(a.find("> .tree-loader").remove()):t.remove());var d=a.find(".tree-loader:last");!1===o&&d.removeClass("hide hidden"),this.options.dataSource(l||{},function(t){e.each(t.data,function(t,i){var n=i.type;"folder"===i.type&&(n="branch");var l=s.$element.find("[data-template=tree"+n+"]:eq(0)").clone().removeClass("hide hidden").removeData("template").removeAttr("data-template");l.find(".tree-"+n+"-name > .tree-label").html(i.text||i.name),l.data(i);var o=i.attr||i.dataAttributes||[];e.each(o,function(e,t){switch(e){case"cssClass":case"class":case"className":l.addClass(t);break;case"data-icon":l.find(".icon-item").removeClass().addClass("icon-item "+t),l.attr(e,t);break;case"id":l.attr(e,t),l.attr("aria-labelledby",t+"-label"),l.find(".tree-branch-name > .tree-label").attr("id",t+"-label");break;default:l.attr(e,t)}}),r?a.append(l):a.find(".tree-branch-children:eq(0)").append(l)}),a.find(".tree-loader").addClass("hidden"),s.$element.trigger("loaded.fu.tree",a)})},selectTreeNode:function(t,i){var a={};a.$element=e(t);var r={};r.$elements=this.$element.find(".tree-selected"),r.dataForEvent=[],"folder"===i?(a.$element=a.$element.closest(".tree-branch"),a.$icon=a.$element.find(".icon-folder")):a.$icon=a.$element.find(".icon-item"),a.elementData=a.$element.data(),c(a.$element),r=this.options.multiSelect?s(0,a,r):n(this,a,r),d(this.$element,a.$element),this.$element.trigger(r.eventType+".fu.tree",{target:a.elementData,selected:r.dataForEvent}),a.$element.trigger("updated.fu.tree",{selected:r.dataForEvent,item:a.$element,eventType:r.eventType})},discloseFolder:function(t){var i=e(t).closest(".tree-branch"),s=i.find(".tree-branch-children"),n=s.eq(0);i.addClass("tree-open"),i.attr("aria-expanded","true"),n.removeClass("hide hidden"),i.find("> .tree-branch-header .icon-folder").eq(0).removeClass("glyphicon-folder-close").addClass("glyphicon-folder-open");var a=this.$element,r=function(){a.trigger("disclosedFolder.fu.tree",i.data())};s.children().length?r():(a.one("loaded.fu.tree",r),this.populate(s))},closeFolder:function(t){var i=e(t).closest(".tree-branch"),s=i.find(".tree-branch-children").eq(0);i.removeClass("tree-open"),i