// minifier: path aliases enyo.path.addPaths({css: "css/"}); // Icon.js enyo.kind({ name: "onyx.Icon", published: { src: "", disabled: !1 }, classes: "onyx-icon", create: function() { this.inherited(arguments), this.src && this.srcChanged(), this.disabledChanged(); }, disabledChanged: function() { this.addRemoveClass("disabled", this.disabled); }, srcChanged: function() { this.applyStyle("background-image", "url(" + enyo.path.rewrite(this.src) + ")"); } }); // Button.js enyo.kind({ name: "onyx.Button", kind: "enyo.Button", classes: "onyx-button enyo-unselectable", create: function() { enyo.platform.firefoxOS && (this.handlers.ondown = "fxosDown", this.handlers.onenter = "fxosEnter", this.handlers.ondrag = "fxosDrag", this.handlers.onleave = "fxosLeave", this.handlers.onup = "fxosUp"), this.inherited(arguments); }, fxosDown: function(e, t) { this.addClass("pressed"), this._isInControl = !0; }, fxosEnter: function(e, t) { this._isInControl = !0; }, fxosDrag: function(e, t) { this.addRemoveClass("pressed", this._isInControl); }, fxosLeave: function(e, t) { this._isInControl = !1; }, fxosUp: function(e, t) { this.removeClass("pressed"), this._isInControl = !1; } }); // IconButton.js enyo.kind({ name: "onyx.IconButton", kind: "onyx.Icon", published: { active: !1 }, classes: "onyx-icon-button", create: function() { enyo.platform.firefoxOS && (this.handlers.ondown = "fxosDown", this.handlers.onenter = "fxosEnter", this.handlers.ondrag = "fxosDrag", this.handlers.onleave = "fxosLeave", this.handlers.onup = "fxosUp"), this.inherited(arguments); }, fxosDown: function(e, t) { this.addClass("pressed"), this._isInControl = !0; }, fxosEnter: function(e, t) { this._isInControl = !0; }, fxosDrag: function(e, t) { this.addRemoveClass("pressed", this._isInControl); }, fxosLeave: function(e, t) { this._isInControl = !1; }, fxosUp: function(e, t) { this.removeClass("pressed"), this._isInControl = !1; }, rendered: function() { this.inherited(arguments), this.activeChanged(); }, tap: function() { if (this.disabled) return !0; this.setActive(!0); }, activeChanged: function() { this.bubble("onActivate"); } }); // Checkbox.js enyo.kind({ name: "onyx.Checkbox", classes: "onyx-checkbox", kind: enyo.Checkbox, tag: "div", handlers: { onclick: "" }, tap: function(e, t) { return this.disabled || (this.setChecked(!this.getChecked()), this.bubble("onchange")), !this.disabled; }, dragstart: function() {} }); // Drawer.js enyo.kind({ name: "onyx.Drawer", kind: "enyo.Drawer", published: {} }); // Grabber.js enyo.kind({ name: "onyx.Grabber", classes: "onyx-grabber" }); // Groupbox.js enyo.kind({ name: "onyx.Groupbox", classes: "onyx-groupbox" }), enyo.kind({ name: "onyx.GroupboxHeader", classes: "onyx-groupbox-header" }); // Input.js enyo.kind({ name: "onyx.Input", kind: "enyo.Input", classes: "onyx-input" }); // Popup.js enyo.kind({ name: "onyx.Popup", kind: "Popup", classes: "onyx-popup", published: { scrimWhenModal: !0, scrim: !1, scrimClassName: "" }, statics: { count: 0 }, defaultZ: 120, showingChanged: function() { this.showing ? (onyx.Popup.count++, this.applyZIndex()) : onyx.Popup.count > 0 && onyx.Popup.count--, this.showHideScrim(this.showing), this.inherited(arguments); }, showHideScrim: function(e) { if (this.floating && (this.scrim || this.modal && this.scrimWhenModal)) { var t = this.getScrim(); if (e) { var n = this.getScrimZIndex(); this._scrimZ = n, t.showAtZIndex(n); } else t.hideAtZIndex(this._scrimZ); enyo.call(t, "addRemoveClass", [ this.scrimClassName, t.showing ]); } }, getScrimZIndex: function() { return this.findZIndex() - 1; }, getScrim: function() { return this.modal && this.scrimWhenModal && !this.scrim ? onyx.scrimTransparent.make() : onyx.scrim.make(); }, applyZIndex: function() { this._zIndex = onyx.Popup.count * 2 + this.findZIndex() + 1, this.applyStyle("z-index", this._zIndex); }, findZIndex: function() { var e = this.defaultZ; return this._zIndex ? e = this._zIndex : this.hasNode() && (e = Number(enyo.dom.getComputedStyleValue(this.node, "z-index")) || e), this._zIndex = e; } }); // TextArea.js enyo.kind({ name: "onyx.TextArea", kind: "enyo.TextArea", classes: "onyx-textarea" }); // RichText.js enyo.kind({ name: "onyx.RichText", kind: "enyo.RichText", classes: "onyx-richtext" }); // InputDecorator.js enyo.kind({ name: "onyx.InputDecorator", kind: "enyo.ToolDecorator", tag: "label", classes: "onyx-input-decorator", published: { alwaysLooksFocused: !1 }, handlers: { onDisabledChange: "disabledChange", onfocus: "receiveFocus", onblur: "receiveBlur" }, create: function() { this.inherited(arguments), this.updateFocus(!1); }, alwaysLooksFocusedChanged: function(e) { this.updateFocus(this.focus); }, updateFocus: function(e) { this.focused = e, this.addRemoveClass("onyx-focused", this.alwaysLooksFocused || this.focused); }, receiveFocus: function() { this.updateFocus(!0); }, receiveBlur: function() { this.updateFocus(!1); }, disabledChange: function(e, t) { this.addRemoveClass("onyx-disabled", t.originator.disabled); } }); // Tooltip.js enyo.kind({ name: "onyx.Tooltip", kind: "onyx.Popup", classes: "onyx-tooltip below left-arrow", autoDismiss: !1, showDelay: 500, defaultLeft: -6, handlers: { onRequestShowTooltip: "requestShow", onRequestHideTooltip: "requestHide" }, requestShow: function() { return this.showJob = setTimeout(enyo.bind(this, "show"), this.showDelay), !0; }, cancelShow: function() { clearTimeout(this.showJob); }, requestHide: function() { return this.cancelShow(), this.inherited(arguments); }, showingChanged: function() { this.cancelShow(), this.adjustPosition(!0), this.inherited(arguments); }, applyPosition: function(e) { var t = ""; for (var n in e) t += n + ":" + e[n] + (isNaN(e[n]) ? "; " : "px; "); this.addStyles(t); }, adjustPosition: function(e) { if (this.showing && this.hasNode()) { var t = this.node.getBoundingClientRect(); t.top + t.height > window.innerHeight ? (this.addRemoveClass("below", !1), this.addRemoveClass("above", !0)) : (this.addRemoveClass("above", !1), this.addRemoveClass("below", !0)), t.left + t.width > window.innerWidth && (this.applyPosition({ "margin-left": -t.width, bottom: "auto" }), this.addRemoveClass("left-arrow", !1), this.addRemoveClass("right-arrow", !0)); } }, resizeHandler: function() { this.applyPosition({ "margin-left": this.defaultLeft, bottom: "auto" }), this.addRemoveClass("left-arrow", !0), this.addRemoveClass("right-arrow", !1), this.adjustPosition(!0), this.inherited(arguments); } }); // TooltipDecorator.js enyo.kind({ name: "onyx.TooltipDecorator", defaultKind: "onyx.Button", classes: "onyx-popup-decorator", handlers: { onenter: "enter", onleave: "leave" }, enter: function() { this.requestShowTooltip(); }, leave: function() { this.requestHideTooltip(); }, tap: function() { this.requestHideTooltip(); }, requestShowTooltip: function() { this.waterfallDown("onRequestShowTooltip"); }, requestHideTooltip: function() { this.waterfallDown("onRequestHideTooltip"); } }); // MenuDecorator.js enyo.kind({ name: "onyx.MenuDecorator", kind: "onyx.TooltipDecorator", defaultKind: "onyx.Button", classes: "onyx-popup-decorator enyo-unselectable", handlers: { onActivate: "activated", onHide: "menuHidden" }, activated: function(e, t) { this.requestHideTooltip(), t.originator.active && (this.menuActive = !0, this.activator = t.originator, this.activator.addClass("active"), this.requestShowMenu()); }, requestShowMenu: function() { this.waterfallDown("onRequestShowMenu", { activator: this.activator }); }, requestHideMenu: function() { this.waterfallDown("onRequestHideMenu"); }, menuHidden: function() { this.menuActive = !1, this.activator && (this.activator.setActive(!1), this.activator.removeClass("active")); }, enter: function(e) { this.menuActive || this.inherited(arguments); }, leave: function(e, t) { this.menuActive || this.inherited(arguments); } }); // Menu.js enyo.kind({ name: "onyx.Menu", kind: "onyx.Popup", modal: !0, defaultKind: "onyx.MenuItem", classes: "onyx-menu", published: { maxHeight: 200, scrolling: !0 }, handlers: { onActivate: "itemActivated", onRequestShowMenu: "requestMenuShow", onRequestHideMenu: "requestHide" }, childComponents: [ { name: "client", kind: "enyo.Scroller", strategyKind: "TouchScrollStrategy" } ], showOnTop: !1, scrollerName: "client", create: function() { this.inherited(arguments), this.maxHeightChanged(); }, initComponents: function() { this.scrolling && this.createComponents(this.childComponents, { isChrome: !0 }), this.inherited(arguments); }, getScroller: function() { return this.$[this.scrollerName]; }, maxHeightChanged: function() { this.scrolling && this.getScroller().setMaxHeight(this.maxHeight + "px"); }, itemActivated: function(e, t) { return t.originator.setActive(!1), !0; }, showingChanged: function() { this.inherited(arguments), this.scrolling && this.getScroller().setShowing(this.showing), this.adjustPosition(!0); }, requestMenuShow: function(e, t) { if (this.floating) { var n = t.activator.hasNode(); if (n) { var r = this.activatorOffset = this.getPageOffset(n); this.applyPosition({ top: r.top + (this.showOnTop ? 0 : r.height), left: r.left, width: r.width }); } } return this.show(), !0; }, applyPosition: function(e) { var t = ""; for (var n in e) t += n + ":" + e[n] + (isNaN(e[n]) ? "; " : "px; "); this.addStyles(t); }, getPageOffset: function(e) { var t = e.getBoundingClientRect(), n = window.pageYOffset === undefined ? document.documentElement.scrollTop : window.pageYOffset, r = window.pageXOffset === undefined ? document.documentElement.scrollLeft : window.pageXOffset, i = t.height === undefined ? t.bottom - t.top : t.height, s = t.width === undefined ? t.right - t.left : t.width; return { top: t.top + n, left: t.left + r, height: i, width: s }; }, adjustPosition: function() { if (this.showing && this.hasNode()) { this.scrolling && !this.showOnTop && this.getScroller().setMaxHeight(this.maxHeight + "px"), this.removeClass("onyx-menu-up"), this.floating || this.applyPosition({ left: "auto" }); var e = this.node.getBoundingClientRect(), t = e.height === undefined ? e.bottom - e.top : e.height, n = window.innerHeight === undefined ? document.documentElement.clientHeight : window.innerHeight, r = window.innerWidth === undefined ? document.documentElement.clientWidth : window.innerWidth; this.menuUp = e.top + t > n && n - e.bottom < e.top - t, this.addRemoveClass("onyx-menu-up", this.menuUp); if (this.floating) { var i = this.activatorOffset; this.menuUp ? this.applyPosition({ top: i.top - t + (this.showOnTop ? i.height : 0), bottom: "auto" }) : e.top < i.top && i.top + (this.showOnTop ? 0 : i.height) + t < n && this.applyPosition({ top: i.top + (this.showOnTop ? 0 : i.height), bottom: "auto" }); } e.right > r && (this.floating ? this.applyPosition({ left: r - e.width }) : this.applyPosition({ left: -(e.right - r) })), e.left < 0 && (this.floating ? this.applyPosition({ left: 0, right: "auto" }) : this.getComputedStyleValue("right") == "auto" ? this.applyPosition({ left: -e.left }) : this.applyPosition({ right: e.left })); if (this.scrolling && !this.showOnTop) { e = this.node.getBoundingClientRect(); var s; this.menuUp ? s = this.maxHeight < e.bottom ? this.maxHeight : e.bottom : s = e.top + this.maxHeight < n ? this.maxHeight : n - e.top, this.getScroller().setMaxHeight(s + "px"); } } }, resizeHandler: function() { this.inherited(arguments), this.adjustPosition(); }, requestHide: function() { this.setShowing(!1); } }); // MenuItem.js enyo.kind({ name: "onyx.MenuItem", kind: "enyo.Button", events: { onSelect: "", onItemContentChange: "" }, classes: "onyx-menu-item", tag: "div", create: function() { this.inherited(arguments), this.active && this.bubble("onActivate"); }, tap: function(e) { this.inherited(arguments), this.bubble("onRequestHideMenu"), this.doSelect({ selected: this, content: this.content }); }, contentChanged: function(e) { this.inherited(arguments), this.doItemContentChange({ content: this.content }); } }); // PickerDecorator.js enyo.kind({ name: "onyx.PickerDecorator", kind: "onyx.MenuDecorator", classes: "onyx-picker-decorator", defaultKind: "onyx.PickerButton", handlers: { onChange: "change" }, change: function(e, t) { this.waterfallDown("onChange", t); } }); // PickerButton.js enyo.kind({ name: "onyx.PickerButton", kind: "onyx.Button", handlers: { onChange: "change" }, change: function(e, t) { t.content !== undefined && this.setContent(t.content); } }); // Picker.js enyo.kind({ name: "onyx.Picker", kind: "onyx.Menu", classes: "onyx-picker enyo-unselectable", published: { selected: null }, events: { onChange: "" }, handlers: { onItemContentChange: "itemContentChange" }, floating: !0, showOnTop: !0, initComponents: function() { this.setScrolling(!0), this.inherited(arguments); }, showingChanged: function() { this.getScroller().setShowing(this.showing), this.inherited(arguments), this.showing && this.selected && this.scrollToSelected(); }, scrollToSelected: function() { this.getScroller().scrollToControl(this.selected, !this.menuUp); }, itemActivated: function(e, t) { return this.processActivatedItem(t.originator), this.inherited(arguments); }, processActivatedItem: function(e) { e.active && this.setSelected(e); }, selectedChanged: function(e) { e && e.removeClass("selected"), this.selected && (this.selected.addClass("selected"), this.doChange({ selected: this.selected, content: this.selected.content })); }, itemContentChange: function(e, t) { t.originator == this.selected && this.doChange({ selected: this.selected, content: this.selected.content }); }, resizeHandler: function() { this.inherited(arguments), this.adjustPosition(); } }); // FlyweightPicker.js enyo.kind({ name: "onyx.FlyweightPicker", kind: "onyx.Picker", classes: "onyx-flyweight-picker", published: { count: 0 }, events: { onSetupItem: "", onSelect: "" }, handlers: { onSelect: "itemSelect" }, components: [ { name: "scroller", kind: "enyo.Scroller", strategyKind: "TouchScrollStrategy", components: [ { name: "flyweight", kind: "FlyweightRepeater", noSelect: !0, ontap: "itemTap" } ] } ], scrollerName: "scroller", initComponents: function() { this.controlParentName = "flyweight", this.inherited(arguments), this.$.flyweight.$.client.children[0].setActive(!0); }, create: function() { this.inherited(arguments), this.countChanged(); }, rendered: function() { this.inherited(arguments), this.selectedChanged(); }, scrollToSelected: function() { var e = this.$.flyweight.fetchRowNode(this.selected); this.getScroller().scrollToNode(e, !this.menuUp); }, countChanged: function() { this.$.flyweight.count = this.count; }, processActivatedItem: function(e) { this.item = e; }, selectedChanged: function(e) { if (!this.item) return; e != null && (this.item.removeClass("selected"), this.$.flyweight.renderRow(e)); var t; this.selected != null && (this.item.addClass("selected"), this.$.flyweight.renderRow(this.selected), this.item.removeClass("selected"), t = this.$.flyweight.fetchRowNode(this.selected)), this.doChange({ selected: this.selected, content: t && t.textContent || this.item.content }); }, itemTap: function(e, t) { this.setSelected(t.rowIndex), this.doSelect({ selected: this.item, content: this.item.content }); }, itemSelect: function(e, t) { if (t.originator != this) return !0; } }); // DatePicker.js enyo.kind({ name: "onyx.DatePicker", classes: "onyx-toolbar-inline", published: { disabled: !1, locale: "en_us", dayHidden: !1, monthHidden: !1, yearHidden: !1, minYear: 1900, maxYear: 2099, value: null }, events: { onSelect: "" }, create: function() { this.inherited(arguments), enyo.g11n && (this.locale = enyo.g11n.currentLocale().getLocale()), this.initDefaults(); }, initDefaults: function() { var e = [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]; enyo.g11n && (this._tf = new enyo.g11n.Fmts({ locale: this.locale }), e = this._tf.getMonthFields()), this.setupPickers(this._tf ? this._tf.getDateFieldOrder() : "mdy"), this.dayHiddenChanged(), this.monthHiddenChanged(), this.yearHiddenChanged(); var t = this.value = this.value || new Date; for (var n = 0, r; r = e[n]; n++) this.$.monthPicker.createComponent({ content: r, value: n, active: n == t.getMonth() }); var i = t.getFullYear(); this.$.yearPicker.setSelected(i - this.minYear); for (n = 1; n <= this.monthLength(t.getYear(), t.getMonth()); n++) this.$.dayPicker.createComponent({ content: n, value: n, active: n == t.getDate() }); }, monthLength: function(e, t) { return 32 - (new Date(e, t, 32)).getDate(); }, setupYear: function(e, t) { this.$.year.setContent(this.minYear + t.index); }, setupPickers: function(e) { var t = e.split(""), n, r, i; for (r = 0, i = t.length; r < i; r++) { n = t[r]; switch (n) { case "d": this.createDay(); break; case "m": this.createMonth(); break; case "y": this.createYear(); break; default: } } }, createYear: function() { var e = this.maxYear - this.minYear; this.createComponent({ kind: "onyx.PickerDecorator", onSelect: "updateYear", components: [ { classes: "onyx-datepicker-year", name: "yearPickerButton", disabled: this.disabled }, { name: "yearPicker", kind: "onyx.FlyweightPicker", count: ++e, onSetupItem: "setupYear", components: [ { name: "year" } ] } ] }); }, createMonth: function() { this.createComponent({ kind: "onyx.PickerDecorator", onSelect: "updateMonth", components: [ { classes: "onyx-datepicker-month", name: "monthPickerButton", disabled: this.disabled }, { name: "monthPicker", kind: "onyx.Picker" } ] }); }, createDay: function() { this.createComponent({ kind: "onyx.PickerDecorator", onSelect: "updateDay", components: [ { classes: "onyx-datepicker-day", name: "dayPickerButton", disabled: this.disabled }, { name: "dayPicker", kind: "onyx.Picker" } ] }); }, localeChanged: function() { this.refresh(); }, dayHiddenChanged: function() { this.$.dayPicker.getParent().setShowing(this.dayHidden ? !1 : !0); }, monthHiddenChanged: function() { this.$.monthPicker.getParent().setShowing(this.monthHidden ? !1 : !0); }, yearHiddenChanged: function() { this.$.yearPicker.getParent().setShowing(this.yearHidden ? !1 : !0); }, minYearChanged: function() { this.refresh(); }, maxYearChanged: function() { this.refresh(); }, valueChanged: function() { this.refresh(); }, disabledChanged: function() { this.$.yearPickerButton.setDisabled(this.disabled), this.$.monthPickerButton.setDisabled(this.disabled), this.$.dayPickerButton.setDisabled(this.disabled); }, updateDay: function(e, t) { var n = this.calcDate(this.value.getFullYear(), this.value.getMonth(), t.selected.value); return this.doSelect({ name: this.name, value: n }), this.setValue(n), !0; }, updateMonth: function(e, t) { var n = this.calcDate(this.value.getFullYear(), t.selected.value, this.value.getDate()); return this.doSelect({ name: this.name, value: n }), this.setValue(n), !0; }, updateYear: function(e, t) { if (t.originator.selected != -1) { var n = this.calcDate(this.minYear + t.originator.selected, this.value.getMonth(), this.value.getDate()); this.doSelect({ name: this.name, value: n }), this.setValue(n); } return !0; }, calcDate: function(e, t, n) { return new Date(e, t, n, this.value.getHours(), this.value.getMinutes(), this.value.getSeconds(), this.value.getMilliseconds()); }, refresh: function() { this.destroyClientControls(), this.initDefaults(), this.render(); } }); // TimePicker.js enyo.kind({ name: "onyx.TimePicker", classes: "onyx-toolbar-inline", published: { disabled: !1, locale: "en_us", is24HrMode: null, value: null }, events: { onSelect: "" }, create: function() { this.inherited(arguments), enyo.g11n && (this.locale = enyo.g11n.currentLocale().getLocale()), this.initDefaults(); }, initDefaults: function() { var e = "AM", t = "PM"; this.is24HrMode == null && (this.is24HrMode = !1), enyo.g11n && (this._tf = new enyo.g11n.Fmts({ locale: this.locale }), e = this._tf.getAmCaption(), t = this._tf.getPmCaption(), this.is24HrMode == null && (this.is24HrMode = !this._tf.isAmPm())), this.setupPickers(this._tf ? this._tf.getTimeFieldOrder() : "hma"); var n = this.value = this.value || new Date, r; if (!this.is24HrMode) { var i = n.getHours(); i = i === 0 ? 12 : i; for (r = 1; r <= 12; r++) this.$.hourPicker.createComponent({ content: r, value: r, active: r == (i > 12 ? i % 12 : i) }); } else for (r = 0; r < 24; r++) this.$.hourPicker.createComponent({ content: r, value: r, active: r == n.getHours() }); for (r = 0; r <= 59; r++) this.$.minutePicker.createComponent({ content: r < 10 ? "0" + r : r, value: r, active: r == n.getMinutes() }); n.getHours() >= 12 ? this.$.ampmPicker.createComponents([ { content: e }, { content: t, active: !0 } ]) : this.$.ampmPicker.createComponents([ { content: e, active: !0 }, { content: t } ]), this.$.ampmPicker.getParent().setShowing(!this.is24HrMode); }, setupPickers: function(e) { var t = e.split(""), n, r, i; for (r = 0, i = t.length; r < i; r++) { n = t[r]; switch (n) { case "h": this.createHour(); break; case "m": this.createMinute(); break; case "a": this.createAmPm(); break; default: } } }, createHour: function() { this.createComponent({ kind: "onyx.PickerDecorator", onSelect: "updateHour", components: [ { classes: "onyx-timepicker-hour", name: "hourPickerButton", disabled: this.disabled }, { name: "hourPicker", kind: "onyx.Picker" } ] }); }, createMinute: function() { this.createComponent({ kind: "onyx.PickerDecorator", onSelect: "updateMinute", components: [ { classes: "onyx-timepicker-minute", name: "minutePickerButton", disabled: this.disabled }, { name: "minutePicker", kind: "onyx.Picker" } ] }); }, createAmPm: function() { this.createComponent({ kind: "onyx.PickerDecorator", onSelect: "updateAmPm", components: [ { classes: "onyx-timepicker-ampm", name: "ampmPickerButton", disabled: this.disabled }, { name: "ampmPicker", kind: "onyx.Picker" } ] }); }, disabledChanged: function() { this.$.hourPickerButton.setDisabled(this.disabled), this.$.minutePickerButton.setDisabled(this.disabled), this.$.ampmPickerButton.setDisabled(this.disabled); }, localeChanged: function() { this.is24HrMode = null, this.refresh(); }, is24HrModeChanged: function() { this.refresh(); }, valueChanged: function() { this.refresh(); }, updateHour: function(e, t) { var n = t.selected.value; if (!this.is24HrMode) { var r = this.$.ampmPicker.getParent().controlAtIndex(0).content; n = n + (n == 12 ? -12 : 0) + (this.isAm(r) ? 0 : 12); } return this.value = this.calcTime(n, this.value.getMinutes()), this.doSelect({ name: this.name, value: this.value }), !0; }, updateMinute: function(e, t) { return this.value = this.calcTime(this.value.getHours(), t.selected.value), this.doSelect({ name: this.name, value: this.value }), !0; }, updateAmPm: function(e, t) { var n = this.value.getHours(); return this.is24HrMode || (n += n > 11 ? this.isAm(t.content) ? -12 : 0 : this.isAm(t.content) ? 0 : 12), this.value = this.calcTime(n, this.value.getMinutes()), this.doSelect({ name: this.name, value: this.value }), !0; }, calcTime: function(e, t) { return new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), e, t, this.value.getSeconds(), this.value.getMilliseconds()); }, isAm: function(e) { var t, n, r; try { t = this._tf.getAmCaption(), n = this._tf.getPmCaption(); } catch (i) { t = "AM", n = "PM"; } return e == t ? !0 : !1; }, refresh: function() { this.destroyClientControls(), this.initDefaults(), this.render(); } }); // RadioButton.js enyo.kind({ name: "onyx.RadioButton", kind: "Button", classes: "onyx-radiobutton" }); // RadioGroup.js enyo.kind({ name: "onyx.RadioGroup", kind: "Group", defaultKind: "onyx.RadioButton", highlander: !0 }); // ToggleButton.js enyo.kind({ name: "onyx.ToggleButton", classes: "onyx-toggle-button", published: { active: !1, value: !1, onContent: "On", offContent: "Off", disabled: !1 }, events: { onChange: "" }, handlers: { ondragstart: "dragstart", ondrag: "drag", ondragfinish: "dragfinish" }, components: [ { name: "contentOn", classes: "onyx-toggle-content on" }, { name: "contentOff", classes: "onyx-toggle-content off" }, { classes: "onyx-toggle-button-knob" } ], create: function() { this.inherited(arguments), this.value = Boolean(this.value || this.active), this.onContentChanged(), this.offContentChanged(), this.disabledChanged(); }, rendered: function() { this.inherited(arguments), this.updateVisualState(); }, updateVisualState: function() { this.addRemoveClass("off", !this.value), this.$.contentOn.setShowing(this.value), this.$.contentOff.setShowing(!this.value), this.setActive(this.value); }, valueChanged: function() { this.updateVisualState(), this.doChange({ value: this.value }); }, activeChanged: function() { this.setValue(this.active), this.bubble("onActivate"); }, onContentChanged: function() { this.$.contentOn.setContent(this.onContent || ""), this.$.contentOn.addRemoveClass("empty", !this.onContent); }, offContentChanged: function() { this.$.contentOff.setContent(this.offContent || ""), this.$.contentOff.addRemoveClass("empty", !this.onContent); }, disabledChanged: function() { this.addRemoveClass("disabled", this.disabled); }, updateValue: function(e) { this.disabled || this.setValue(e); }, tap: function() { this.updateValue(!this.value); }, dragstart: function(e, t) { if (t.horizontal) return t.preventDefault(), this.dragging = !0, this.dragged = !1, !0; }, drag: function(e, t) { if (this.dragging) { var n = t.dx; return Math.abs(n) > 10 && (this.updateValue(n > 0), this.dragged = !0), !0; } }, dragfinish: function(e, t) { this.dragging = !1, this.dragged && t.preventTap(); } }); // ToggleIconButton.js enyo.kind({ name: "onyx.ToggleIconButton", kind: "onyx.Icon", published: { active: !1, value: !1 }, events: { onChange: "" }, classes: "onyx-icon-button onyx-icon-toggle", activeChanged: function() { this.addRemoveClass("active", this.value), this.bubble("onActivate"); }, updateValue: function(e) { this.disabled || (this.setValue(e), this.doChange({ value: this.value })); }, tap: function() { this.updateValue(!this.value); }, valueChanged: function() { this.setActive(this.value); }, create: function() { this.inherited(arguments), this.value = Boolean(this.value || this.active); }, rendered: function() { this.inherited(arguments), this.valueChanged(), this.removeClass("onyx-icon"); } }); // Toolbar.js enyo.kind({ name: "onyx.Toolbar", classes: "onyx onyx-toolbar onyx-toolbar-inline", create: function() { this.inherited(arguments), this.hasClass("onyx-menu-toolbar") && enyo.platform.android >= 4 && this.applyStyle("position", "static"); } }); // Tooltip.js enyo.kind({ name: "onyx.Tooltip", kind: "onyx.Popup", classes: "onyx-tooltip below left-arrow", autoDismiss: !1, showDelay: 500, defaultLeft: -6, handlers: { onRequestShowTooltip: "requestShow", onRequestHideTooltip: "requestHide" }, requestShow: function() { return this.showJob = setTimeout(enyo.bind(this, "show"), this.showDelay), !0; }, cancelShow: function() { clearTimeout(this.showJob); }, requestHide: function() { return this.cancelShow(), this.inherited(arguments); }, showingChanged: function() { this.cancelShow(), this.adjustPosition(!0), this.inherited(arguments); }, applyPosition: function(e) { var t = ""; for (var n in e) t += n + ":" + e[n] + (isNaN(e[n]) ? "; " : "px; "); this.addStyles(t); }, adjustPosition: function(e) { if (this.showing && this.hasNode()) { var t = this.node.getBoundingClientRect(); t.top + t.height > window.innerHeight ? (this.addRemoveClass("below", !1), this.addRemoveClass("above", !0)) : (this.addRemoveClass("above", !1), this.addRemoveClass("below", !0)), t.left + t.width > window.innerWidth && (this.applyPosition({ "margin-left": -t.width, bottom: "auto" }), this.addRemoveClass("left-arrow", !1), this.addRemoveClass("right-arrow", !0)); } }, resizeHandler: function() { this.applyPosition({ "margin-left": this.defaultLeft, bottom: "auto" }), this.addRemoveClass("left-arrow", !0), this.addRemoveClass("right-arrow", !1), this.adjustPosition(!0), this.inherited(arguments); } }); // TooltipDecorator.js enyo.kind({ name: "onyx.TooltipDecorator", defaultKind: "onyx.Button", classes: "onyx-popup-decorator", handlers: { onenter: "enter", onleave: "leave" }, enter: function() { this.requestShowTooltip(); }, leave: function() { this.requestHideTooltip(); }, tap: function() { this.requestHideTooltip(); }, requestShowTooltip: function() { this.waterfallDown("onRequestShowTooltip"); }, requestHideTooltip: function() { this.waterfallDown("onRequestHideTooltip"); } }); // ProgressBar.js enyo.kind({ name: "onyx.ProgressBar", classes: "onyx-progress-bar", published: { progress: 0, min: 0, max: 100, barClasses: "", showStripes: !0, animateStripes: !0, increment: 0 }, events: { onAnimateProgressFinish: "" }, components: [ { name: "progressAnimator", kind: "Animator", onStep: "progressAnimatorStep", onEnd: "progressAnimatorComplete" }, { name: "bar", classes: "onyx-progress-bar-bar" } ], create: function() { this.inherited(arguments), this.progressChanged(), this.barClassesChanged(), this.showStripesChanged(), this.animateStripesChanged(); }, barClassesChanged: function(e) { this.$.bar.removeClass(e), this.$.bar.addClass(this.barClasses); }, showStripesChanged: function() { this.$.bar.addRemoveClass("striped", this.showStripes); }, animateStripesChanged: function() { this.$.bar.addRemoveClass("animated", this.animateStripes); }, progressChanged: function() { this.progress = this.clampValue(this.min, this.max, this.progress); var e = this.calcPercent(this.progress); this.updateBarPosition(e); }, calcIncrement: function(e) { return Math.round(e / this.increment) * this.increment; }, clampValue: function(e, t, n) { return Math.max(e, Math.min(n, t)); }, calcRatio: function(e) { return (e - this.min) / (this.max - this.min); }, calcPercent: function(e) { return this.calcRatio(e) * 100; }, updateBarPosition: function(e) { this.$.bar.applyStyle("width", e + "%"); }, animateProgressTo: function(e) { this.$.progressAnimator.play({ startValue: this.progress, endValue: e, node: this.hasNode() }); }, progressAnimatorStep: function(e) { return this.setProgress(e.value), !0; }, progressAnimatorComplete: function(e) { return this.doAnimateProgressFinish(e), !0; } }); // ProgressButton.js enyo.kind({ name: "onyx.ProgressButton", kind: "onyx.ProgressBar", classes: "onyx-progress-button", events: { onCancel: "" }, components: [ { name: "progressAnimator", kind: "Animator", onStep: "progressAnimatorStep", onEnd: "progressAnimatorComplete" }, { name: "bar", classes: "onyx-progress-bar-bar onyx-progress-button-bar" }, { name: "client", classes: "onyx-progress-button-client" }, { kind: "onyx.Icon", src: "$lib/onyx/images/progress-button-cancel.png", classes: "onyx-progress-button-icon", ontap: "cancelTap" } ], cancelTap: function() { this.doCancel(); } }); // Scrim.js enyo.kind({ name: "onyx.Scrim", showing: !1, classes: "onyx-scrim enyo-fit", floating: !1, create: function() { this.inherited(arguments), this.zStack = [], this.floating && this.setParent(enyo.floatingLayer); }, showingChanged: function() { this.floating && this.showing && !this.hasNode() && this.render(), this.inherited(arguments); }, addZIndex: function(e) { enyo.indexOf(e, this.zStack) < 0 && this.zStack.push(e); }, removeZIndex: function(e) { enyo.remove(e, this.zStack); }, showAtZIndex: function(e) { this.addZIndex(e), e !== undefined && this.setZIndex(e), this.show(); }, hideAtZIndex: function(e) { this.removeZIndex(e); if (!this.zStack.length) this.hide(); else { var t = this.zStack[this.zStack.length - 1]; this.setZIndex(t); } }, setZIndex: function(e) { this.zIndex = e, this.applyStyle("z-index", e); }, make: function() { return this; } }), enyo.kind({ name: "onyx.scrimSingleton", kind: null, constructor: function(e, t) { this.instanceName = e, enyo.setObject(this.instanceName, this), this.props = t || {}; }, make: function() { var e = new onyx.Scrim(this.props); return enyo.setObject(this.instanceName, e), e; }, showAtZIndex: function(e) { var t = this.make(); t.showAtZIndex(e); }, hideAtZIndex: enyo.nop, show: function() { var e = this.make(); e.show(); } }), new onyx.scrimSingleton("onyx.scrim", { floating: !0, classes: "onyx-scrim-translucent" }), new onyx.scrimSingleton("onyx.scrimTransparent", { floating: !0, classes: "onyx-scrim-transparent" }); // Slider.js enyo.kind({ name: "onyx.Slider", kind: "onyx.ProgressBar", classes: "onyx-slider", published: { value: 0, lockBar: !0, tappable: !0 }, events: { onChange: "", onChanging: "", onAnimateFinish: "" }, showStripes: !1, handlers: { ondragstart: "dragstart", ondrag: "drag", ondragfinish: "dragfinish" }, moreComponents: [ { kind: "Animator", onStep: "animatorStep", onEnd: "animatorComplete" }, { classes: "onyx-slider-taparea" }, { name: "knob", classes: "onyx-slider-knob" } ], create: function() { this.inherited(arguments), enyo.platform.firefoxOS && (this.moreComponents[2].ondown = "fxosDown", this.moreComponents[2].onenter = "fxosEnter", this.moreComponents[2].ondrag = "fxosDrag", this.moreComponents[2].onleave = "fxosLeave", this.moreComponents[2].onup = "fxosUp"), this.createComponents(this.moreComponents), this.valueChanged(); }, valueChanged: function() { this.value = this.clampValue(this.min, this.max, this.value); var e = this.calcPercent(this.value); this.updateKnobPosition(e), this.lockBar && this.setProgress(this.value); }, updateKnobPosition: function(e) { this.$.knob.applyStyle("left", e + "%"); }, calcKnobPosition: function(e) { var t = e.clientX - this.hasNode().getBoundingClientRect().left; return t / this.getBounds().width * (this.max - this.min) + this.min; }, dragstart: function(e, t) { if (t.horizontal) return t.preventDefault(), this.dragging = !0, !0; }, drag: function(e, t) { if (this.dragging) { var n = this.calcKnobPosition(t); return n = this.increment ? this.calcIncrement(n) : n, this.setValue(n), this.doChanging({ value: this.value }), !0; } }, dragfinish: function(e, t) { return this.dragging = !1, t.preventTap(), this.doChange({ value: this.value }), !0; }, tap: function(e, t) { if (this.tappable) { var n = this.calcKnobPosition(t); return n = this.increment ? this.calcIncrement(n) : n, this.tapped = !0, this.animateTo(n), !0; } }, fxosDown: function(e, t) { this.$.knob.addClass("pressed"), this._isInControl = !0; }, fxosEnter: function(e, t) { this._isInControl = !0; }, fxosDrag: function(e, t) { this.$.knob.addRemoveClass("pressed", this._isInControl); }, fxosLeave: function(e, t) { this._isInControl = !1; }, fxosUp: function(e, t) { this.$.knob.removeClass("pressed"), this._isInControl = !1; }, animateTo: function(e) { this.$.animator.play({ startValue: this.value, endValue: e, node: this.hasNode() }); }, animatorStep: function(e) { return this.setValue(e.value), !0; }, animatorComplete: function(e) { return this.tapped && (this.tapped = !1, this.doChange({ value: this.value })), this.doAnimateFinish(e), !0; } }); // RangeSlider.js enyo.kind({ name: "onyx.RangeSlider", kind: "onyx.ProgressBar", classes: "onyx-slider", published: { rangeMin: 0, rangeMax: 100, rangeStart: 0, rangeEnd: 100, beginValue: 0, endValue: 0 }, events: { onChange: "", onChanging: "" }, showStripes: !1, showLabels: !1, handlers: { ondragstart: "dragstart", ondrag: "drag", ondragfinish: "dragfinish", ondown: "down" }, moreComponents: [ { name: "startKnob", classes: "onyx-slider-knob" }, { name: "endKnob", classes: "onyx-slider-knob onyx-range-slider-knob" } ], create: function() { this.inherited(arguments), this.createComponents(this.moreComponents), this.initControls(); }, rendered: function() { this.inherited(arguments); var e = this.calcPercent(this.beginValue); this.updateBarPosition(e); }, initControls: function() { this.$.bar.applyStyle("position", "relative"), this.refreshRangeSlider(), this.showLabels && (this.$.startKnob.createComponent({ name: "startLabel", kind: "onyx.RangeSliderKnobLabel" }), this.$.endKnob.createComponent({ name: "endLabel", kind: "onyx.RangeSliderKnobLabel" })); }, refreshRangeSlider: function() { this.beginValue = this.calcKnobPercent(this.rangeStart), this.endValue = this.calcKnobPercent(this.rangeEnd), this.beginValueChanged(), this.endValueChanged(); }, calcKnobRatio: function(e) { return (e - this.rangeMin) / (this.rangeMax - this.rangeMin); }, calcKnobPercent: function(e) { return this.calcKnobRatio(e) * 100; }, beginValueChanged: function(e) { if (e === undefined) { var t = this.calcPercent(this.beginValue); this.updateKnobPosition(t, this.$.startKnob); } }, endValueChanged: function(e) { if (e === undefined) { var t = this.calcPercent(this.endValue); this.updateKnobPosition(t, this.$.endKnob); } }, calcKnobPosition: function(e) { var t = e.clientX - this.hasNode().getBoundingClientRect().left; return t / this.getBounds().width * (this.max - this.min) + this.min; }, updateKnobPosition: function(e, t) { t.applyStyle("left", e + "%"), this.updateBarPosition(); }, updateBarPosition: function() { if (this.$.startKnob !== undefined && this.$.endKnob !== undefined) { var e = this.calcKnobPercent(this.rangeStart), t = this.calcKnobPercent(this.rangeEnd) - e; this.$.bar.applyStyle("left", e + "%"), this.$.bar.applyStyle("width", t + "%"); } }, calcRangeRatio: function(e) { return e / 100 * (this.rangeMax - this.rangeMin) + this.rangeMin - this.increment / 2; }, swapZIndex: function(e) { e === "startKnob" ? (this.$.startKnob.applyStyle("z-index", 1), this.$.endKnob.applyStyle("z-index", 0)) : e === "endKnob" && (this.$.startKnob.applyStyle("z-index", 0), this.$.endKnob.applyStyle("z-index", 1)); }, down: function(e, t) { this.swapZIndex(e.name); }, dragstart: function(e, t) { if (t.horizontal) return t.preventDefault(), this.dragging = !0, !0; }, drag: function(e, t) { if (this.dragging) { var n = this.calcKnobPosition(t), r, i, s; if (e.name === "startKnob" && n >= 0) { if (!(n <= this.endValue && t.xDirection === -1 || n <= this.endValue)) return this.drag(this.$.endKnob, t); this.setBeginValue(n), r = this.calcRangeRatio(this.beginValue), i = this.increment ? this.calcIncrement(r + .5 * this.increment) : r, s = this.calcKnobPercent(i), this.updateKnobPosition(s, this.$.startKnob), this.setRangeStart(i), this.doChanging({ value: i }); } else if (e.name === "endKnob" && n <= 100) { if (!(n >= this.beginValue && t.xDirection === 1 || n >= this.beginValue)) return this.drag(this.$.startKnob, t); this.setEndValue(n), r = this.calcRangeRatio(this.endValue), i = this.increment ? this.calcIncrement(r + .5 * this.increment) : r, s = this.calcKnobPercent(i), this.updateKnobPosition(s, this.$.endKnob), this.setRangeEnd(i), this.doChanging({ value: i }); } return !0; } }, dragfinish: function(e, t) { this.dragging = !1, t.preventTap(); var n; return e.name === "startKnob" ? (n = this.calcRangeRatio(this.beginValue), this.doChange({ value: n, startChanged: !0 })) : e.name === "endKnob" && (n = this.calcRangeRatio(this.endValue), this.doChange({ value: n, startChanged: !1 })), !0; }, rangeMinChanged: function() { this.refreshRangeSlider(); }, rangeMaxChanged: function() { this.refreshRangeSlider(); }, rangeStartChanged: function() { this.refreshRangeSlider(); }, rangeEndChanged: function() { this.refreshRangeSlider(); }, setStartLabel: function(e) { this.$.startKnob.waterfallDown("onSetLabel", e); }, setEndLabel: function(e) { this.$.endKnob.waterfallDown("onSetLabel", e); } }), enyo.kind({ name: "onyx.RangeSliderKnobLabel", classes: "onyx-range-slider-label", handlers: { onSetLabel: "setLabel" }, setLabel: function(e, t) { this.setContent(t); } }); // Item.js enyo.kind({ name: "onyx.Item", classes: "onyx-item", tapHighlight: !0, handlers: { onhold: "hold", onrelease: "release" }, hold: function(e, t) { this.tapHighlight && onyx.Item.addRemoveFlyweightClass(this.controlParent || this, "onyx-highlight", !0, t); }, release: function(e, t) { this.tapHighlight && onyx.Item.addRemoveFlyweightClass(this.controlParent || this, "onyx-highlight", !1, t); }, statics: { addRemoveFlyweightClass: function(e, t, n, r, i) { var s = r.flyweight; if (s) { var o = i !== undefined ? i : r.index; s.performOnRow(o, function() { e.addRemoveClass(t, n); }); } } } }); // Spinner.js enyo.kind({ name: "onyx.Spinner", classes: "onyx-spinner", stop: function() { this.setShowing(!1); }, start: function() { this.setShowing(!0); }, toggle: function() { this.setShowing(!this.getShowing()); } }); // MoreToolbar.js enyo.kind({ name: "onyx.MoreToolbar", classes: "onyx-toolbar onyx-more-toolbar", menuClass: "", movedClass: "", layoutKind: "FittableColumnsLayout", noStretch: !0, handlers: { onHide: "reflow" }, published: { clientLayoutKind: "FittableColumnsLayout" }, tools: [ { name: "client", noStretch: !0, fit: !0, classes: "onyx-toolbar-inline" }, { name: "nard", kind: "onyx.MenuDecorator", showing: !1, onActivate: "activated", components: [ { kind: "onyx.IconButton", classes: "onyx-more-button" }, { name: "menu", kind: "onyx.Menu", scrolling: !1, classes: "onyx-more-menu" } ] } ], initComponents: function() { this.menuClass && this.menuClass.length > 0 && !this.$.menu.hasClass(this.menuClass) && this.$.menu.addClass(this.menuClass), this.createChrome(this.tools), this.inherited(arguments), this.$.client.setLayoutKind(this.clientLayoutKind); }, clientLayoutKindChanged: function() { this.$.client.setLayoutKind(this.clientLayoutKind); }, reflow: function() { this.inherited(arguments), this.isContentOverflowing() ? (this.$.nard.show(), this.popItem() && this.reflow()) : this.tryPushItem() ? this.reflow() : this.$.menu.children.length || (this.$.nard.hide(), this.$.menu.hide()); }, activated: function(e, t) { this.addRemoveClass("active", t.originator.active); }, popItem: function() { var e = this.findCollapsibleItem(); if (e) { this.movedClass && this.movedClass.length > 0 && !e.hasClass(this.movedClass) && e.addClass(this.movedClass), this.$.menu.addChild(e, null); var t = this.$.menu.hasNode(); return t && e.hasNode() && e.insertNodeInParent(t), !0; } }, pushItem: function() { var e = this.$.menu.children, t = e[0]; if (t) { this.movedClass && this.movedClass.length > 0 && t.hasClass(this.movedClass) && t.removeClass(this.movedClass), this.$.client.addChild(t); var n = this.$.client.hasNode(); if (n && t.hasNode()) { var r, i; for (var s = 0; s < this.$.client.children.length; s++) { var o = this.$.client.children[s]; if (o.toolbarIndex !== undefined && o.toolbarIndex != s) { r = o, i = s; break; } } if (r && r.hasNode()) { t.insertNodeInParent(n, r.node); var u = this.$.client.children.pop(); this.$.client.children.splice(i, 0, u); } else t.appendNodeToParent(n); } return !0; } }, tryPushItem: function() { if (this.pushItem()) { if (!this.isContentOverflowing()) return !0; this.popItem(); } }, isContentOverflowing: function() { if (this.$.client.hasNode()) { var e = this.$.client.children, t = e[e.length - 1].hasNode(); if (t) return this.$.client.reflow(), t.offsetLeft + t.offsetWidth > this.$.client.node.clientWidth; } }, findCollapsibleItem: function() { var e = this.$.client.children; for (var t = e.length - 1; c = e[t]; t--) { if (!c.unmoveable) return c; c.toolbarIndex === undefined && (c.toolbarIndex = t); } } }); // IntegerPicker.js enyo.kind({ name: "onyx.IntegerPicker", kind: "onyx.Picker", published: { value: 0, min: 0, max: 9 }, create: function() { this.inherited(arguments), this.rangeChanged(); }, minChanged: function() { this.destroyClientControls(), this.rangeChanged(), this.render(); }, maxChanged: function() { this.destroyClientControls(), this.rangeChanged(), this.render(); }, rangeChanged: function() { for (var e = this.min; e <= this.max; e++) this.createComponent({ content: e, active: e === this.value ? !0 : !1 }); }, valueChanged: function(e) { var t = this.getClientControls(), n = t.length; this.value = this.value >= this.min && this.value <= this.max ? this.value : this.min; for (var r = 0; r < n; r++) if (this.value === parseInt(t[r].content)) { this.setSelected(t[r]); break; } }, selectedChanged: function(e) { e && e.removeClass("selected"), this.selected && (this.selected.addClass("selected"), this.doChange({ selected: this.selected, content: this.selected.content })), this.value = parseInt(this.selected.content); } }); // ContextualPopup.js enyo.kind({ name: "onyx.ContextualPopup", kind: "enyo.Popup", modal: !0, autoDismiss: !0, floating: !1, classes: "onyx-contextual-popup enyo-unselectable", published: { maxHeight: 100, scrolling: !0, title: undefined, actionButtons: [] }, vertFlushMargin: 60, horizFlushMargin: 50, widePopup: 200, longPopup: 200, horizBuffer: 16, events: { onTap: "" }, handlers: { onRequestShowMenu: "requestShow", onRequestHideMenu: "requestHide" }, components: [ { name: "title", classes: "onyx-contextual-popup-title" }, { classes: "onyx-contextual-popup-scroller", components: [ { name: "client", kind: "enyo.Scroller", vertical: "auto", classes: "enyo-unselectable", thumb: !1, strategyKind: "TouchScrollStrategy" } ] }, { name: "actionButtons", classes: "onyx-contextual-popup-action-buttons" } ], scrollerName: "client", create: function() { this.inherited(arguments), this.maxHeightChanged(), this.titleChanged(), this.actionButtonsChanged(); }, getScroller: function() { return this.$[this.scrollerName]; }, titleChanged: function() { this.$.title.setContent(this.title); }, actionButtonsChanged: function() { for (var e = 0; e < this.actionButtons.length; e++) this.$.actionButtons.createComponent({ kind: "onyx.Button", content: this.actionButtons[e].content, classes: this.actionButtons[e].classes + " onyx-contextual-popup-action-button", name: this.actionButtons[e].name ? this.actionButtons[e].name : "ActionButton" + e, index: e, tap: enyo.bind(this, this.tapHandler) }); }, tapHandler: function(e, t) { return t.actionButton = !0, t.popup = this, this.bubble("ontap", t), !0; }, maxHeightChanged: function() { this.scrolling && this.getScroller().setMaxHeight(this.maxHeight + "px"); }, showingChanged: function() { this.inherited(arguments), this.scrolling && this.getScroller().setShowing(this.showing), this.adjustPosition(); }, requestShow: function(e, t) { var n = t.activator.hasNode(); return n && (this.activatorOffset = this.getPageOffset(n)), this.show(), !0; }, applyPosition: function(e) { var t = ""; for (var n in e) t += n + ":" + e[n] + (isNaN(e[n]) ? "; " : "px; "); this.addStyles(t); }, getPageOffset: function(e) { var t = this.getBoundingRect(e), n = window.pageYOffset === undefined ? document.documentElement.scrollTop : window.pageYOffset, r = window.pageXOffset === undefined ? document.documentElement.scrollLeft : window.pageXOffset, i = t.height === undefined ? t.bottom - t.top : t.height, s = t.width === undefined ? t.right - t.left : t.width; return { top: t.top + n, left: t.left + r, height: i, width: s }; }, adjustPosition: function() { if (this.showing && this.hasNode()) { this.resetPositioning(); var e = this.getViewWidth(), t = this.getViewHeight(), n = this.vertFlushMargin, r = t - this.vertFlushMargin, i = this.horizFlushMargin, s = e - this.horizFlushMargin; if (this.activatorOffset.top + this.activatorOffset.height < n || this.activatorOffset.top > r) { if (this.applyVerticalFlushPositioning(i, s)) return; if (this.applyHorizontalFlushPositioning(i, s)) return; if (this.applyVerticalPositioning()) return; } else if (this.activatorOffset.left + this.activatorOffset.width < i || this.activatorOffset.left > s) if (this.applyHorizontalPositioning()) return; var o = this.getBoundingRect(this.node); if (o.width > this.widePopup) { if (this.applyVerticalPositioning()) return; } else if (o.height > this.longPopup && this.applyHorizontalPositioning()) return; if (this.applyVerticalPositioning()) return; if (this.applyHorizontalPositioning()) return; } }, initVerticalPositioning: function() { this.resetPositioning(), this.addClass("vertical"); var e = this.getBoundingRect(this.node), t = this.getViewHeight(); return this.floating ? this.activatorOffset.top < t / 2 ? (this.applyPosition({ top: this.activatorOffset.top + this.activatorOffset.height, bottom: "auto" }), this.addClass("below")) : (this.applyPosition({ top: this.activatorOffset.top - e.height, bottom: "auto" }), this.addClass("above")) : e.top + e.height > t && t - e.bottom < e.top - e.height ? this.addClass("above") : this.addClass("below"), e = this.getBoundingRect(this.node), e.top + e.height > t || e.top < 0 ? !1 : !0; }, applyVerticalPositioning: function() { if (!this.initVerticalPositioning()) return !1; var e = this.getBoundingRect(this.node), t = this.getViewWidth(); if (this.floating) { var n = this.activatorOffset.left + this.activatorOffset.width / 2 - e.width / 2; n + e.width > t ? (this.applyPosition({ left: this.activatorOffset.left + this.activatorOffset.width - e.width }), this.addClass("left")) : n < 0 ? (this.applyPosition({ left: this.activatorOffset.left }), this.addClass("right")) : this.applyPosition({ left: n }); } else { var r = this.activatorOffset.left + this.activatorOffset.width / 2 - e.left - e.width / 2; e.right + r > t ? (this.applyPosition({ left: this.activatorOffset.left + this.activatorOffset.width - e.right }), this.addRemoveClass("left", !0)) : e.left + r < 0 ? this.addRemoveClass("right", !0) : this.applyPosition({ left: r }); } return !0; }, applyVerticalFlushPositioning: function(e, t) { if (!this.initVerticalPositioning()) return !1; var n = this.getBoundingRect(this.node), r = this.getViewWidth(); return this.activatorOffset.left + this.activatorOffset.width / 2 < e ? (this.activatorOffset.left + this.activatorOffset.width / 2 < this.horizBuffer ? this.applyPosition({ left: this.horizBuffer + (this.floating ? 0 : -n.left) }) : this.applyPosition({ left: this.activatorOffset.width / 2 + (this.floating ? this.activatorOffset.left : 0) }), this.addClass("right"), this.addClass("corner"), !0) : this.activatorOffset.left + this.activatorOffset.width / 2 > t ? (this.activatorOffset.left + this.activatorOffset.width / 2 > r - this.horizBuffer ? this.applyPosition({ left: r - this.horizBuffer - n.right }) : this.applyPosition({ left: this.activatorOffset.left + this.activatorOffset.width / 2 - n.right }), this.addClass("left"), this.addClass("corner"), !0) : !1; }, initHorizontalPositioning: function() { this.resetPositioning(); var e = this.getBoundingRect(this.node), t = this.getViewWidth(); return this.floating ? this.activatorOffset.left + this.activatorOffset.width < t / 2 ? (this.applyPosition({ left: this.activatorOffset.left + this.activatorOffset.width }), this.addRemoveClass("left", !0)) : (this.applyPosition({ left: this.activatorOffset.left - e.width }), this.addRemoveClass("right", !0)) : this.activatorOffset.left - e.width > 0 ? (this.applyPosition({ left: this.activatorOffset.left - e.left - e.width }), this.addRemoveClass("right", !0)) : (this.applyPosition({ left: this.activatorOffset.width }), this.addRemoveClass("left", !0)), this.addRemoveClass("horizontal", !0), e = this.getBoundingRect(this.node), e.left < 0 || e.left + e.width > t ? !1 : !0; }, applyHorizontalPositioning: function() { if (!this.initHorizontalPositioning()) return !1; var e = this.getBoundingRect(this.node), t = this.getViewHeight(), n = this.activatorOffset.top + this.activatorOffset.height / 2; return this.floating ? n >= t / 2 - .05 * t && n <= t / 2 + .05 * t ? this.applyPosition({ top: this.activatorOffset.top + this.activatorOffset.height / 2 - e.height / 2, bottom: "auto" }) : this.activatorOffset.top + this.activatorOffset.height < t / 2 ? (this.applyPosition({ top: this.activatorOffset.top - this.activatorOffset.height, bottom: "auto" }), this.addRemoveClass("high", !0)) : (this.applyPosition({ top: this.activatorOffset.top - e.height + this.activatorOffset.height * 2, bottom: "auto" }), this.addRemoveClass("low", !0)) : n >= t / 2 - .05 * t && n <= t / 2 + .05 * t ? this.applyPosition({ top: (this.activatorOffset.height - e.height) / 2 }) : this.activatorOffset.top + this.activatorOffset.height < t / 2 ? (this.applyPosition({ top: -this.activatorOffset.height }), this.addRemoveClass("high", !0)) : (this.applyPosition({ top: e.top - e.height - this.activatorOffset.top + this.activatorOffset.height }), this.addRemoveClass("low", !0)), !0; }, applyHorizontalFlushPositioning: function(e, t) { if (!this.initHorizontalPositioning()) return !1; var n = this.getBoundingRect(this.node), r = this.getViewWidth(); return this.floating ? this.activatorOffset.top < innerHeight / 2 ? (this.applyPosition({ top: this.activatorOffset.top + this.activatorOffset.height / 2 }), this.addRemoveClass("high", !0)) : (this.applyPosition({ top: this.activatorOffset.top + this.activatorOffset.height / 2 - n.height }), this.addRemoveClass("low", !0)) : n.top + n.height > innerHeight && innerHeight - n.bottom < n.top - n.height ? (this.applyPosition({ top: n.top - n.height - this.activatorOffset.top - this.activatorOffset.height / 2 }), this.addRemoveClass("low", !0)) : (this.applyPosition({ top: this.activatorOffset.height / 2 }), this.addRemoveClass("high", !0)), this.activatorOffset.left + this.activatorOffset.width < e ? (this.addClass("left"), this.addClass("corner"), !0) : this.activatorOffset.left > t ? (this.addClass("right"), this.addClass("corner"), !0) : !1; }, getBoundingRect: function(e) { var t = e.getBoundingClientRect(); return !t.width || !t.height ? { left: t.left, right: t.right, top: t.top, bottom: t.bottom, width: t.right - t.left, height: t.bottom - t.top } : t; }, getViewHeight: function() { return window.innerHeight === undefined ? document.documentElement.clientHeight : window.innerHeight; }, getViewWidth: function() { return window.innerWidth === undefined ? document.documentElement.clientWidth : window.innerWidth; }, resetPositioning: function() { this.removeClass("right"), this.removeClass("left"), this.removeClass("high"), this.removeClass("low"), this.removeClass("corner"), this.removeClass("below"), this.removeClass("above"), this.removeClass("vertical"), this.removeClass("horizontal"), this.applyPosition({ left: "auto" }), this.applyPosition({ top: "auto" }); }, resizeHandler: function() { this.inherited(arguments), this.adjustPosition(); }, requestHide: function() { this.setShowing(!1); } });