todomvc
Version:
> Helping you select an MV\* framework
1,390 lines (1,380 loc) • 179 kB
JavaScript
// enyo.js
(function() {
var e = "enyo.js";
enyo = window.enyo || {}, enyo.locateScript = function(e) {
var t = document.getElementsByTagName("script");
for (var n = t.length - 1, r, i, s = e.length; n >= 0 && (r = t[n]); n--) if (!r.located) {
i = r.getAttribute("src") || "";
if (i.slice(-s) == e) return r.located = !0, {
path: i.slice(0, Math.max(0, i.lastIndexOf("/"))),
node: r
};
}
}, enyo.args = enyo.args || {};
var t = enyo.locateScript(e);
if (t) {
enyo.args.root = (enyo.args.root || t.path).replace("/source", "");
for (var n = 0, r = t.node.attributes.length, i; n < r && (i = t.node.attributes.item(n)); n++) enyo.args[i.nodeName] = i.value;
}
})();
// ready.js
(function(e) {
var t = e.document, n = [], r = "complete" === t.readyState, i, s, o, u, a;
enyo.ready = function(e, t) {
r ? i(e, t) : n.push([ e, t ]);
}, i = function(e, t) {
e.call(t || enyo.global);
}, s = function(e) {
if (r = "interactive" === t.readyState) ~[ "DOMContentLoaded", "readystatechange" ].indexOf(e.type) || (o(e.type, s), a());
if (r = "complete" === t.readyState) o(e.type, s), a();
}, u = function(e, n) {
var r = t.addEventListener ? "addEventListener" : "attachEvent", i = r === "attachEvent" ? "on" : "";
t[r](i + e, n, !1);
}, o = function(e, n) {
var r = t.addEventListener ? "removeEventListener" : "detachEvent", i = r === "detachEvent" ? "on" : "";
t[r](i + e, n, !1);
}, a = function() {
if (r && n.length) while (n.length) i.apply(e, n.shift());
}, u("DOMContentLoaded", s), u("readystatechange", s);
})(window);
// ../../loader.js
(function() {
enyo = window.enyo || {}, enyo.pathResolverFactory = function() {
this.paths = {};
}, enyo.pathResolverFactory.prototype = {
addPath: function(e, t) {
return this.paths[e] = t;
},
addPaths: function(e) {
if (e) for (var t in e) this.addPath(t, e[t]);
},
includeTrailingSlash: function(e) {
return e && e.slice(-1) !== "/" ? e + "/" : e;
},
rewritePattern: /\$([^\/\\]*)(\/)?/g,
rewrite: function(e) {
var t, n = this.includeTrailingSlash, r = this.paths, i = function(e, i) {
return t = !0, n(r[i]) || "";
}, s = e;
do t = !1, s = s.replace(this.rewritePattern, i); while (t);
return s;
}
}, enyo.path = new enyo.pathResolverFactory, enyo.loaderFactory = function(e, t) {
this.machine = e, this.packages = [], this.modules = [], this.sheets = [], this.stack = [], this.pathResolver = t || enyo.path, this.packageName = "", this.packageFolder = "", this.finishCallbacks = {};
}, enyo.loaderFactory.prototype = {
verbose: !1,
loadScript: function(e) {
this.machine.script(e);
},
loadSheet: function(e) {
this.machine.sheet(e);
},
loadPackage: function(e) {
this.machine.script(e);
},
report: function() {},
load: function() {
this.more({
index: 0,
depends: arguments || []
});
},
more: function(e) {
if (e && this.continueBlock(e)) return;
var t = this.stack.pop();
t ? (this.verbose && console.groupEnd("* finish package (" + (t.packageName || "anon") + ")"), this.packageFolder = t.folder, this.packageName = "", this.more(t)) : this.finish();
},
finish: function() {
this.packageFolder = "", this.verbose && console.log("-------------- fini");
for (var e in this.finishCallbacks) this.finishCallbacks[e] && (this.finishCallbacks[e](), this.finishCallbacks[e] = null);
},
continueBlock: function(e) {
while (e.index < e.depends.length) {
var t = e.depends[e.index++];
if (t) if (typeof t == "string") {
if (this.require(t, e)) return !0;
} else this.pathResolver.addPaths(t);
}
},
require: function(e, t) {
var n = this.pathResolver.rewrite(e), r = this.getPathPrefix(e);
n = r + n;
if (n.slice(-4) == ".css" || n.slice(-5) == ".less") this.verbose && console.log("+ stylesheet: [" + r + "][" + e + "]"), this.requireStylesheet(n); else {
if (n.slice(-3) != ".js" || n.slice(-10) == "package.js") return this.requirePackage(n, t), !0;
this.verbose && console.log("+ module: [" + r + "][" + e + "]"), this.requireScript(e, n);
}
},
getPathPrefix: function(e) {
var t = e.slice(0, 1);
return t != "/" && t != "\\" && t != "$" && !/^https?:/i.test(e) ? this.packageFolder : "";
},
requireStylesheet: function(e) {
this.sheets.push(e), this.loadSheet(e);
},
requireScript: function(e, t) {
this.modules.push({
packageName: this.packageName,
rawPath: e,
path: t
}), this.loadScript(t);
},
decodePackagePath: function(e) {
var t = "", n = "", r = "", i = "package.js", s = e.replace(/\\/g, "/").replace(/\/\//g, "/").replace(/:\//, "://").split("/"), o, u;
if (s.length) {
var a = s.pop() || s.pop() || "";
a.slice(-i.length) !== i ? s.push(a) : i = a, r = s.join("/"), r = r ? r + "/" : "", i = r + i;
for (o = s.length - 1; o >= 0; o--) if (s[o] == "source") {
s.splice(o, 1);
break;
}
n = s.join("/");
for (o = s.length - 1; u = s[o]; o--) if (u == "lib" || u == "enyo") {
s = s.slice(o + 1);
break;
}
for (o = s.length - 1; u = s[o]; o--) (u == ".." || u == ".") && s.splice(o, 1);
t = s.join("-");
}
return {
alias: t,
target: n,
folder: r,
manifest: i
};
},
aliasPackage: function(e) {
var t = this.decodePackagePath(e);
this.manifest = t.manifest, t.alias && (this.pathResolver.addPath(t.alias, t.target), this.packageName = t.alias, this.packages.push({
name: t.alias,
folder: t.folder
})), this.packageFolder = t.folder;
},
requirePackage: function(e, t) {
t.folder = this.packageFolder, this.aliasPackage(e), t.packageName = this.packageName, this.stack.push(t), this.report("loading package", this.packageName), this.verbose && console.group("* start package [" + this.packageName + "]"), this.loadPackage(this.manifest);
}
};
})();
// boot.js
enyo.execUnsafeLocalFunction = function(e) {
typeof MSApp == "undefined" ? e() : MSApp.execUnsafeLocalFunction(e);
}, enyo.machine = {
sheet: function(e) {
var t = "text/css", n = "stylesheet", r = e.slice(-5) == ".less";
r && (window.less ? (t = "text/less", n = "stylesheet/less") : e = e.slice(0, e.length - 4) + "css");
var i;
enyo.runtimeLoading || r ? (i = document.createElement("link"), i.href = e, i.media = "screen", i.rel = n, i.type = t, document.getElementsByTagName("head")[0].appendChild(i)) : (i = function() {
document.write('<link href="' + e + '" media="screen" rel="' + n + '" type="' + t + '" />');
}, enyo.execUnsafeLocalFunction(i)), r && window.less && (less.sheets.push(i), enyo.loader.finishCallbacks.lessRefresh || (enyo.loader.finishCallbacks.lessRefresh = function() {
less.refresh(!0);
}));
},
script: function(e, t, n) {
if (!enyo.runtimeLoading) document.write('<script src="' + e + '"' + (t ? ' onload="' + t + '"' : "") + (n ? ' onerror="' + n + '"' : "") + "></scri" + "pt>"); else {
var r = document.createElement("script");
r.src = e, r.onload = t, r.onerror = n, document.getElementsByTagName("head")[0].appendChild(r);
}
},
inject: function(e) {
document.write('<script type="text/javascript">' + e + "</scri" + "pt>");
}
}, enyo.loader = new enyo.loaderFactory(enyo.machine), enyo.depends = function() {
var e = enyo.loader;
if (!e.packageFolder) {
var t = enyo.locateScript("package.js");
t && t.path && (e.aliasPackage(t.path), e.packageFolder = t.path + "/");
}
e.load.apply(e, arguments);
}, function() {
function n(r) {
r && r();
if (t.length) {
var i = t.shift(), s = i[0], o = e.isArray(s) ? s : [ s ], u = i[1];
e.loader.finishCallbacks.runtimeLoader = function(e) {
n(function() {
u && u(e);
});
}, e.loader.packageFolder = "./", e.depends.apply(this, o);
} else e.runtimeLoading = !1, e.loader.packageFolder = "";
}
var e = window.enyo, t = [];
e.load = function(r, i) {
t.push(arguments), e.runtimeLoading || (e.runtimeLoading = !0, n());
};
}(), enyo.path.addPaths({
enyo: enyo.args.root,
lib: "$enyo/../lib"
});
// enyo.js
(function() {
var e = "enyo.js";
enyo = window.enyo || {}, enyo.locateScript = function(e) {
var t = document.getElementsByTagName("script");
for (var n = t.length - 1, r, i, s = e.length; n >= 0 && (r = t[n]); n--) if (!r.located) {
i = r.getAttribute("src") || "";
if (i.slice(-s) == e) return r.located = !0, {
path: i.slice(0, Math.max(0, i.lastIndexOf("/"))),
node: r
};
}
}, enyo.args = enyo.args || {};
var t = enyo.locateScript(e);
if (t) {
enyo.args.root = (enyo.args.root || t.path).replace("/source", "");
for (var n = 0, r = t.node.attributes.length, i; n < r && (i = t.node.attributes.item(n)); n++) enyo.args[i.nodeName] = i.value;
}
})(), function(e) {
var t = e.document, n = [], r = "complete" === t.readyState, i, s, o, u, a;
enyo.ready = function(e, t) {
r ? i(e, t) : n.push([ e, t ]);
}, i = function(e, t) {
e.call(t || enyo.global);
}, s = function(e) {
if (r = "interactive" === t.readyState) ~[ "DOMContentLoaded", "readystatechange" ].indexOf(e.type) || (o(e.type, s), a());
if (r = "complete" === t.readyState) o(e.type, s), a();
}, u = function(e, n) {
var r = t.addEventListener ? "addEventListener" : "attachEvent", i = r === "attachEvent" ? "on" : "";
t[r](i + e, n, !1);
}, o = function(e, n) {
var r = t.addEventListener ? "removeEventListener" : "detachEvent", i = r === "detachEvent" ? "on" : "";
t[r](i + e, n, !1);
}, a = function() {
if (r && n.length) while (n.length) i.apply(e, n.shift());
}, u("DOMContentLoaded", s), u("readystatechange", s);
}(window), function() {
enyo = window.enyo || {}, enyo.pathResolverFactory = function() {
this.paths = {};
}, enyo.pathResolverFactory.prototype = {
addPath: function(e, t) {
return this.paths[e] = t;
},
addPaths: function(e) {
if (e) for (var t in e) this.addPath(t, e[t]);
},
includeTrailingSlash: function(e) {
return e && e.slice(-1) !== "/" ? e + "/" : e;
},
rewritePattern: /\$([^\/\\]*)(\/)?/g,
rewrite: function(e) {
var t, n = this.includeTrailingSlash, r = this.paths, i = function(e, i) {
return t = !0, n(r[i]) || "";
}, s = e;
do t = !1, s = s.replace(this.rewritePattern, i); while (t);
return s;
}
}, enyo.path = new enyo.pathResolverFactory, enyo.loaderFactory = function(e, t) {
this.machine = e, this.packages = [], this.modules = [], this.sheets = [], this.stack = [], this.pathResolver = t || enyo.path, this.packageName = "", this.packageFolder = "", this.finishCallbacks = {};
}, enyo.loaderFactory.prototype = {
verbose: !1,
loadScript: function(e) {
this.machine.script(e);
},
loadSheet: function(e) {
this.machine.sheet(e);
},
loadPackage: function(e) {
this.machine.script(e);
},
report: function() {},
load: function() {
this.more({
index: 0,
depends: arguments || []
});
},
more: function(e) {
if (e && this.continueBlock(e)) return;
var t = this.stack.pop();
t ? (this.verbose && console.groupEnd("* finish package (" + (t.packageName || "anon") + ")"), this.packageFolder = t.folder, this.packageName = "", this.more(t)) : this.finish();
},
finish: function() {
this.packageFolder = "", this.verbose && console.log("-------------- fini");
for (var e in this.finishCallbacks) this.finishCallbacks[e] && (this.finishCallbacks[e](), this.finishCallbacks[e] = null);
},
continueBlock: function(e) {
while (e.index < e.depends.length) {
var t = e.depends[e.index++];
if (t) if (typeof t == "string") {
if (this.require(t, e)) return !0;
} else this.pathResolver.addPaths(t);
}
},
require: function(e, t) {
var n = this.pathResolver.rewrite(e), r = this.getPathPrefix(e);
n = r + n;
if (n.slice(-4) == ".css" || n.slice(-5) == ".less") this.verbose && console.log("+ stylesheet: [" + r + "][" + e + "]"), this.requireStylesheet(n); else {
if (n.slice(-3) != ".js" || n.slice(-10) == "package.js") return this.requirePackage(n, t), !0;
this.verbose && console.log("+ module: [" + r + "][" + e + "]"), this.requireScript(e, n);
}
},
getPathPrefix: function(e) {
var t = e.slice(0, 1);
return t != "/" && t != "\\" && t != "$" && !/^https?:/i.test(e) ? this.packageFolder : "";
},
requireStylesheet: function(e) {
this.sheets.push(e), this.loadSheet(e);
},
requireScript: function(e, t) {
this.modules.push({
packageName: this.packageName,
rawPath: e,
path: t
}), this.loadScript(t);
},
decodePackagePath: function(e) {
var t = "", n = "", r = "", i = "package.js", s = e.replace(/\\/g, "/").replace(/\/\//g, "/").replace(/:\//, "://").split("/"), o, u;
if (s.length) {
var a = s.pop() || s.pop() || "";
a.slice(-i.length) !== i ? s.push(a) : i = a, r = s.join("/"), r = r ? r + "/" : "", i = r + i;
for (o = s.length - 1; o >= 0; o--) if (s[o] == "source") {
s.splice(o, 1);
break;
}
n = s.join("/");
for (o = s.length - 1; u = s[o]; o--) if (u == "lib" || u == "enyo") {
s = s.slice(o + 1);
break;
}
for (o = s.length - 1; u = s[o]; o--) (u == ".." || u == ".") && s.splice(o, 1);
t = s.join("-");
}
return {
alias: t,
target: n,
folder: r,
manifest: i
};
},
aliasPackage: function(e) {
var t = this.decodePackagePath(e);
this.manifest = t.manifest, t.alias && (this.pathResolver.addPath(t.alias, t.target), this.packageName = t.alias, this.packages.push({
name: t.alias,
folder: t.folder
})), this.packageFolder = t.folder;
},
requirePackage: function(e, t) {
t.folder = this.packageFolder, this.aliasPackage(e), t.packageName = this.packageName, this.stack.push(t), this.report("loading package", this.packageName), this.verbose && console.group("* start package [" + this.packageName + "]"), this.loadPackage(this.manifest);
}
};
}(), enyo.execUnsafeLocalFunction = function(e) {
typeof MSApp == "undefined" ? e() : MSApp.execUnsafeLocalFunction(e);
}, enyo.machine = {
sheet: function(e) {
var t = "text/css", n = "stylesheet", r = e.slice(-5) == ".less";
r && (window.less ? (t = "text/less", n = "stylesheet/less") : e = e.slice(0, e.length - 4) + "css");
var i;
enyo.runtimeLoading || r ? (i = document.createElement("link"), i.href = e, i.media = "screen", i.rel = n, i.type = t, document.getElementsByTagName("head")[0].appendChild(i)) : (i = function() {
document.write('<link href="' + e + '" media="screen" rel="' + n + '" type="' + t + '" />');
}, enyo.execUnsafeLocalFunction(i)), r && window.less && (less.sheets.push(i), enyo.loader.finishCallbacks.lessRefresh || (enyo.loader.finishCallbacks.lessRefresh = function() {
less.refresh(!0);
}));
},
script: function(e, t, n) {
if (!enyo.runtimeLoading) document.write('<script src="' + e + '"' + (t ? ' onload="' + t + '"' : "") + (n ? ' onerror="' + n + '"' : "") + "></scri" + "pt>"); else {
var r = document.createElement("script");
r.src = e, r.onload = t, r.onerror = n, document.getElementsByTagName("head")[0].appendChild(r);
}
},
inject: function(e) {
document.write('<script type="text/javascript">' + e + "</scri" + "pt>");
}
}, enyo.loader = new enyo.loaderFactory(enyo.machine), enyo.depends = function() {
var e = enyo.loader;
if (!e.packageFolder) {
var t = enyo.locateScript("package.js");
t && t.path && (e.aliasPackage(t.path), e.packageFolder = t.path + "/");
}
e.load.apply(e, arguments);
}, function() {
function e(r) {
r && r();
if (n.length) {
var i = n.shift(), s = i[0], o = t.isArray(s) ? s : [ s ], u = i[1];
t.loader.finishCallbacks.runtimeLoader = function() {
e(function() {
u && u(s);
});
}, t.loader.packageFolder = "./", t.depends.apply(this, o);
} else t.runtimeLoading = !1, t.loader.packageFolder = "";
}
var t = window.enyo, n = [];
t.load = function(r, i) {
n.push(arguments), t.runtimeLoading || (t.runtimeLoading = !0, e());
};
}(), enyo.path.addPaths({
enyo: enyo.args.root,
lib: "$enyo/../lib"
}), enyo.logging = {
level: 99,
levels: {
log: 20,
warn: 10,
error: 0
},
shouldLog: function(e) {
var t = parseInt(this.levels[e], 0);
return t <= this.level;
},
_log: function(e, t) {
if (typeof console == "undefined") return;
var n = enyo.isArray(t) ? t : enyo.cloneArray(t);
enyo.dumbConsole && (n = [ n.join(" ") ]);
var r = console[e];
r && r.apply ? r.apply(console, n) : console.log.apply ? console.log.apply(console, n) : console.log(n.join(" "));
},
log: function(e, t) {
typeof console != "undefined" && this.shouldLog(e) && this._log(e, t);
}
}, enyo.setLogLevel = function(e) {
var t = parseInt(e, 0);
isFinite(t) && (enyo.logging.level = t);
}, enyo.log = function() {
enyo.logging.log("log", arguments);
}, enyo.warn = function() {
enyo.logging.log("warn", arguments);
}, enyo.error = function() {
enyo.logging.log("error", arguments);
}, function() {
enyo.global = this;
var e = 0;
enyo.ready(function() {
var e = window.performance = window.performance || {};
e.now = e.now || e.mozNow || e.msNow || e.oNow || e.webkitNow || enyo.now, enyo.bench = function() {
return e.now();
};
});
var t = enyo.exists = function(e) {
return undefined !== e;
}, n = enyo.lastIndexOf = function(e, t, n) {
if (t.lastIndexOf) return t.lastIndexOf(e, n || t.length);
var r = "string" == typeof t, i = (r ? t.split("") : t).reverse(), s = i.length - 1, o = t.length, u;
return r && (i = i.join("")), u = enyo.indexOf(e, i, o - (n || o)), r || i.reverse(), -1 === u ? u : s - u;
}, r = function(e) {
var t = 0;
while ("." === e[t]) ++t;
return 0 !== t && (e = e.slice(t)), e;
}, i = function(e) {
return e && "function" == typeof e && !0 === e.isProperty;
}, s = function(e) {
return e && "function" == typeof e && !0 === e.overloaded;
};
enyo.getPath = function(e) {
if (!t(e) || null === e) return undefined;
var n = 0, i, o, u, a, f = "object" == typeof e && e.recursing ? !0 : !1, l = this === enyo && !0 !== f ? window : this;
if ("object" == typeof e) {
if (!e.path || "string" != typeof e.path) return undefined;
e = e.path;
}
e = r(e), n = e.indexOf(".");
if (this._check_hooks && !1 !== (i = this._check_hooks("get", e))) return i;
if (-1 === n) u = "get" + enyo.cap(e), i = s(l[u]) ? l[u].call(this) : l[e]; else {
o = e.substring(0, n), e = e.slice(n + 1);
if ("object" == typeof l[o]) i = enyo.getPath.call(l[o], {
path: e,
recursing: !0
}); else {
if ("function" != typeof l[o] || !l[o].isProperty) return undefined;
i = enyo.getPath.call(enyo.getPath.call(l, o), {
path: e,
recursing: !0
});
}
}
return "function" == typeof i && !0 === i.isProperty ? (a = enyo.toArray(arguments).slice(1), i.apply(this, a)) : i;
};
var o = enyo.proxyMethod = function(e, t) {
return function() {
return e.apply(t, arguments);
};
};
enyo.setPath = function(e, n, s) {
if (!t(e) || "string" != typeof e) return this;
var o = enyo === this ? enyo.global : this, u, a, f, l, c, h = !0 === s ? !0 : !1, p = "function" == typeof s ? s : undefined, d = enyo.getPath.call(o, e);
e = r(e);
if (this._check_hooks && !1 !== (l = this._check_hooks("set", e, n))) return l;
u = e.indexOf(".");
if (-1 === u) a = o[e], !0 === i(a) ? (f = enyo.toArray(arguments).slice(1), a.apply(o, f)) : o[e] = n; else {
c = e.split(".");
while (c.length) {
a = c.shift();
if ("enyo" === a && enyo === o) continue;
0 === c.length ? !0 === i(a) ? (f = enyo.toArray(arguments).slice(1), a.apply(o, f)) : o[a] = n : ("object" != typeof o[a] && (o[a] = {}), o = i(o[a]) ? enyo.getPath.call(o, a) : o[a]);
}
}
return !0 !== h && (p ? h = p(d, n) : h = d !== n), !0 === h && o.notifyObservers && (o.notifyObservers(e, d, n), o.notifyObservers("set:" + e, d, n)), o;
}, enyo.findAndInstance = function(e, n) {
var r, i, s;
return n = t(n) && "function" == typeof n ? n : enyo.nop, s = enyo.getPath.call(this, e), s ? ("string" == typeof s ? (r = enyo.getPath(s), t(r) && "function" != typeof r && (i = r, r = undefined)) : "function" == typeof s ? r = s : i = s, t(r) && !t(i) && (i = new r), t(i) && (this[e] = i), n(r, i)) : n();
};
var u = enyo.uid = function(t) {
return String((t ? t : "") + e++);
};
enyo.irand = function(e) {
return Math.floor(Math.random() * e);
}, enyo.cap = function(e) {
return e.slice(0, 1).toUpperCase() + e.slice(1);
}, enyo.uncap = function(e) {
return e.slice(0, 1).toLowerCase() + e.slice(1);
}, enyo.format = function(e) {
var t = /\%./g, n = 0, r = e, i = arguments, s = function(e) {
return i[++n];
};
return r.replace(t, s);
};
var a = Object.prototype.toString;
enyo.isString = function(e) {
return a.call(e) === "[object String]";
}, enyo.isFunction = function(e) {
return a.call(e) === "[object Function]";
}, enyo.isArray = Array.isArray || function(e) {
return a.call(e) === "[object Array]";
}, enyo.isTrue = function(e) {
return e !== "false" && e !== !1 && e !== 0 && e !== null && e !== undefined;
}, enyo.indexOf = function(e, t, n) {
if (t.indexOf) return t.indexOf(e, n);
if (n) {
n < 0 && (n = 0);
if (n > t.length) return -1;
}
for (var r = n || 0, i = t.length, s; (s = t[r]) || r < i; r++) if (s == e) return r;
return -1;
}, enyo.remove = function(e, t) {
var n = enyo.indexOf(e, t);
n >= 0 && t.splice(n, 1);
}, enyo.forEach = function(e, t, n) {
if (e) {
var r = n || this;
if (enyo.isArray(e) && e.forEach) e.forEach(t, r); else {
var i = Object(e), s = i.length >>> 0;
for (var o = 0; o < s; o++) o in i && t.call(r, i[o], o, i);
}
}
}, enyo.map = function(e, t, n) {
var r = n || this;
if (enyo.isArray(e) && e.map) return e.map(t, r);
var i = [], s = function(e, n, s) {
i.push(t.call(r, e, n, s));
};
return enyo.forEach(e, s, r), i;
};
var f = enyo.merge = function() {
var e = Array.prototype.concat.apply([], arguments);
return c(e);
}, l = enyo.union = function() {
var e = Array.prototype.concat.apply([], arguments), t = [], r = [], i = 0, s = e.length, o;
for (; i < s; ++i) o = e[i], ~t.indexOf(o) || (t.push(o), i === n(o, e) && r.push(o));
return r;
}, c = enyo.unique = l, h = enyo.reduce = f, p = enyo.only = function(e, n) {
var r = {}, i = 0, s, o;
if (!!t(e) && e instanceof Array) {
if (!t(n) || "object" != typeof n) return r;
e = c(e);
for (s = e.length; i < s; ++i) o = e[i], o in n && (r[o] = n[o]);
return r;
}
return r;
}, d = enyo.remap = function(e, t) {
var n = {}, r, i;
for (r in e) i = e[r], r in t && (n[i] = t[r]);
return n;
}, v = enyo.except = function(e, n) {
var r = {}, i, s = 0, o, u;
if (!!t(e) && e instanceof Array) {
if (!t(n) || "object" != typeof n) return r;
i = l(e, y(n));
for (o = i.length; s < o; ++s) {
u = i[s];
if (!(u in n)) continue;
r[u] = n[u];
}
return r;
}
return r;
}, m = enyo.indexBy = function(e, n, r) {
var i = {}, s, o, u = 0;
if (!!t(n) && n instanceof Array) {
if (!t(e) || "string" != typeof e) return i;
var a = enyo.clone(n);
r = t(r) && "function" == typeof r ? r : undefined;
for (o = n.length; u < o; ++u) s = n[u], t(s) && t(s[e]) && (r ? r(e, s, i, a) : i[s[e]] = s);
return i;
}
return i;
}, g = enyo.pluck = function(e, n) {
var r = [], i = 0, s;
if (!t(e) || !t(n)) return r;
if (n instanceof Array) {
if ("string" != typeof e) return r;
for (s = n.length; i < s; ++i) {
if (!t(n[i])) continue;
t(n[i][e]) && r.push(n[i][e]);
}
return r;
}
return r;
};
enyo.filter = function(e, t, n) {
var r = n || this;
if (enyo.isArray(e) && e.filter) return e.filter(t, r);
var i = [], s = function(e, n, s) {
var o = e;
t.call(r, e, n, s) && i.push(o);
};
return enyo.forEach(e, s, r), i;
};
var y = enyo.keys = Object.keys || function(e) {
var t = [], n = Object.prototype.hasOwnProperty;
for (var r in e) n.call(e, r) && t.push(r);
if (!{
toString: null
}.propertyIsEnumerable("toString")) {
var i = [ "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor" ];
for (var s = 0, o; o = i[s]; s++) n.call(e, o) && t.push(o);
}
return t;
};
enyo.cloneArray = function(e, t, n) {
var r = n || [];
for (var i = t || 0, s = e.length; i < s; i++) r.push(e[i]);
return r;
}, enyo.toArray = enyo.cloneArray, enyo.clone = function(e) {
return enyo.isArray(e) ? enyo.cloneArray(e) : enyo.mixin({}, e);
};
var b = {};
enyo.mixin = function(e, t) {
e = e || {};
if (t) {
var n, r, i;
for (n in t) r = t[n], b[n] !== r && (e[n] = r);
}
return e;
}, enyo.bind = function(e, t) {
t || (t = e, e = null), e = e || enyo.global;
if (enyo.isString(t)) {
if (!e[t]) throw [ 'enyo.bind: scope["', t, '"] is null (scope="', e, '")' ].join("");
t = e[t];
}
if (enyo.isFunction(t)) {
var n = enyo.cloneArray(arguments, 2);
return t.bind ? t.bind.apply(t, [ e ].concat(n)) : function() {
var r = enyo.cloneArray(arguments);
return t.apply(e, n.concat(r));
};
}
throw [ 'enyo.bind: scope["', t, '"] is not a function (scope="', e, '")' ].join("");
}, enyo.asyncMethod = function(e, t) {
return setTimeout(enyo.bind.apply(enyo, arguments), 1);
}, enyo.call = function(e, t, n) {
var r = e || this;
if (t) {
var i = r[t] || t;
if (i && i.apply) return i.apply(r, n || []);
}
}, enyo.now = Date.now || function() {
return (new Date).getTime();
}, enyo.nop = function() {}, enyo.nob = {}, enyo.nar = [], enyo.instance = function() {}, enyo.setPrototype || (enyo.setPrototype = function(e, t) {
e.prototype = t;
}), enyo.delegate = function(e) {
return enyo.setPrototype(enyo.instance, e), new enyo.instance;
}, $L = function(e) {
return e;
};
}(), enyo.job = function(e, t, n) {
enyo.job.stop(e), enyo.job._jobs[e] = setTimeout(function() {
enyo.job.stop(e), t();
}, n);
}, enyo.job.stop = function(e) {
enyo.job._jobs[e] && (clearTimeout(enyo.job._jobs[e]), delete enyo.job._jobs[e]);
}, enyo.job._jobs = {}, enyo.macroize = function(e, t, n) {
var r, i, s = e, o = n || enyo.macroize.pattern, u = function(e, n) {
return r = enyo.getPath.call(t, n), r === undefined || r === null ? "{$" + n + "}" : (i = !0, r);
}, a = 0;
do {
i = !1, s = s.replace(o, u);
if (++a >= 20) throw "enyo.macroize: recursion too deep";
} while (i);
return s;
}, enyo.quickMacroize = function(e, t, n) {
var r, i, s = e, o = n || enyo.macroize.pattern, u = function(e, n) {
return n in t ? r = t[n] : r = enyo.getPath.call(t, n), r === undefined || r === null ? "{$" + n + "}" : r;
};
return s = s.replace(o, u), s;
}, enyo.macroize.pattern = /\{\$([^{}]*)\}/g, enyo.Observer = function(e) {
var t = enyo.toArray(arguments).slice(1);
if (!enyo.exists(e) || "function" != typeof e) throw "enyo.Observer: invalid observer, must have a function";
return e.isObserver = !0, e.events = (e.events ? e.events : []).concat(t), e;
}, enyo.Computed = function(e) {
var t = enyo.toArray(arguments).slice(1);
if (!enyo.exists(e) || "function" != typeof e) throw "enyo.Computed: invalid computed property, must have a function";
return e.isProperty = !0, e.properties = (e.properties ? e.properties : []).concat(t), e;
}, enyo.concat = [ "concat", "bindings", "mixins" ], enyo.handleConcatenatedProperties = function(e, t) {
var n = enyo.merge(e.concat || [], t.concat || []), r, i, s;
while (n.length) r = n.shift(), s = e[r], i = t[r], s instanceof Array && i instanceof Array && (e[r] = enyo.merge(s, i), delete t[r]);
}, enyo.kind = function(e) {
enyo._kindCtors = {};
var t = e.name || "";
delete e.name;
var n = "kind" in e, r = e.kind;
delete e.kind;
var i = enyo.constructorForKind(r), s = i && i.prototype || null;
if (n && r === undefined || i === undefined) {
var o = r === undefined ? "undefined kind" : "unknown kind (" + r + ")";
throw "enyo.kind: Attempt to subclass an " + o + ". Check dependencies for [" + (t || "<unnamed>") + "].";
}
var u = enyo.kind.makeCtor();
return e.hasOwnProperty("constructor") && (e._constructor = e.constructor, delete e.constructor), enyo.setPrototype(u, s ? enyo.delegate(s) : {}), enyo.handleConcatenatedProperties(u.prototype, e), enyo.mixin(u.prototype, e), u.prototype.kindName = t, u.prototype.base = i, u.prototype.ctor = u, enyo.forEach(enyo.kind.features, function(t) {
t(u, e);
}), enyo.setPath(t, u), u;
}, enyo.singleton = function(e, t) {
var n = e.name;
delete e.name;
var r = enyo.kind(e), i;
return enyo.setPath.call(t || enyo.global, n, i = new r), i;
}, enyo.kind.makeCtor = function() {
return function() {
if (!(this instanceof arguments.callee)) throw "enyo.kind: constructor called directly, not using 'new'";
var e;
this._constructor && (e = this._constructor.apply(this, arguments)), this.constructed && this.constructed.apply(this, arguments);
if (e) return e;
};
}, enyo.kind.defaultNamespace = "enyo", enyo.kind.features = [], enyo.kind.features.push(function(e, t) {
var n = e.prototype;
n.inherited || (n.inherited = enyo.kind.inherited);
if (n.base) for (var r in t) {
var i = t[r];
enyo.isFunction(i) && (i._inherited = n.base.prototype[r] || enyo.nop, i.nom = n.kindName + "." + r + "()");
}
}), enyo.kind.inherited = function(e, t) {
var n = e.callee, r = n._inherited;
if (!r || "function" != typeof r) n = n.caller, r = n ? n._inherited : undefined;
if ("function" == typeof r) return r.apply(this, t || e);
}, enyo.kind.features.push(function(e, t) {
enyo.mixin(e, enyo.kind.statics), t.statics && (enyo.mixin(e, t.statics), delete e.prototype.statics);
var n = e.prototype.base;
while (n) n.subclass(e, t), n = n.prototype.base;
}), enyo.kind.statics = {
subclass: function(e, t) {},
extend: function(e) {
enyo.mixin(this.prototype, e);
var t = this;
enyo.forEach(enyo.kind.features, function(n) {
n(t, e);
});
}
}, enyo._kindCtors = {}, enyo.constructorForKind = function(e) {
if (e === null || enyo.isFunction(e)) return e;
if (e) {
var t = enyo._kindCtors[e];
return t ? t : enyo._kindCtors[e] = enyo.Theme[e] || enyo[e] || enyo.getPath.call(enyo, e) || window[e] || enyo.getPath(e);
}
return enyo.defaultCtor;
}, enyo.Theme = {}, enyo.registerTheme = function(e) {
enyo.mixin(enyo.Theme, e);
}, function() {
function e(e, t) {
this.transformer = e, this.binding = t;
}
function t() {
var e = 0, t = arguments.length;
enyo.Binding.bindingCount++;
for (; e < t; ++e) enyo.mixin(this, arguments[e]);
this.id = enyo.uid("binding"), this.setup();
}
enyo.Binding = t, enyo.Transform = e, e.prototype = {
transform: function(e, t) {
var n = this.transformer, r = this.binding, i = r.owner || enyo.global;
return n.call(i, e, t, r);
},
destroy: function() {
this.transformer = null, this.binding = null;
}
};
var n = enyo.Binding.map = {}, r = function(e) {
n[e.id] = e;
}, i = function(e) {
e = e.isBinding ? e.id : e, n[e] && delete n[e];
};
enyo.Binding.bindingCount = 0;
var s = function(e, t) {
var n = e[(t || [])[0]];
if (enyo.exists(n)) return enyo.global === e ? "object" == typeof n ? e : undefined : e;
}, o = enyo.Binding.getParts = function(e, t) {
if (this.debug) debugger;
var n, r = 0, i = {}, o, u, a, f, l, c = this.owner, h = e[0] === "." ? !0 : !1;
e = e[0] === "." ? e.slice(1) : e, n = e.split("."), o = h ? t || c : t || s(enyo.global, n) || c, f = o, i.property = a = n.length > 1 ? n.pop() : e;
if (a === e || !h && t) i.base = f; else {
u = f;
for (; r < n.length; ++r) {
l = n[r];
if (!l) continue;
u = u[l];
if (!u || "string" == typeof u) return l !== a && (i.base = null), i;
}
l !== e && (f = u), i.base = f;
}
return i;
};
enyo.Binding.transform = function(e, t) {
var n = this.transform;
return n(e, t);
}, t.prototype = {
source: null,
target: null,
sourceProperty: null,
targetProperty: null,
sourceResponder: null,
targetResponder: null,
isConnected: !1,
isRefreshing: !1,
sourceConnected: !1,
targetConnected: !1,
to: null,
from: null,
owner: null,
autoConnect: !0,
autoSync: !0,
transform: null,
oneWay: !0,
isBinding: !0,
destroyed: !1,
synchronizing: !1,
setup: function() {
var e = this.debug;
if (!0 === e) debugger;
var t = this.autoConnect, n = this.autoSync, i = this.setupSource(), s = this.setupTarget(), o = this.isRefreshing;
r(this), this.setupTransform();
if (!i || !s) {
o && s && this.setTargetValue(null);
return;
}
try {
(t || o) && this.connect();
} catch (u) {
if ("binding-destroyed" === u) return;
throw u;
}
(n || o) && this.sync();
},
sync: function() {
!0 === this.isConnected && this.syncFromSource();
},
refresh: function() {
this.isRefreshing = !0, this.disconnect(), this.setup(), this.isRefreshing = !1;
},
connect: function() {
if (!0 === this.isConnected) return;
if (!0 === this.destroyed) return;
this.connectSource(), this.connectTarget(), this.sourceConnected && this.targetConnected ? this.isConnected = !0 : this.isConnected = !1;
},
disconnect: function() {
if (!1 === this.isConnected) return;
this.disconnectSource(), this.disconnectTarget(), this.isConnected = !1;
},
setupSource: function() {
var e, t, n = this.sourceProperty, r = this.source, i = this.from;
return r && n ? !0 : i ? (e = o.call(this, i, r), t = e.base, n = e.property, !t || "object" != typeof t ? !1 : (this.source = t, this.sourceProperty = n, !0)) : !1;
},
setupTarget: function() {
var e, t, n = this.targetProperty, r = this.target, i = this.to;
return r && n ? !0 : i ? (e = o.call(this, i, r), t = e.base, n = e.property, !t || "object" != typeof t ? !1 : (this.target = t, this.targetProperty = n, !0)) : !1;
},
stop: function() {
throw "stop-binding";
},
connectSource: function() {
var e = this.source, t = this.sourceProperty, n = this.sourceResponder;
if (e instanceof enyo.Object) {
if (!enyo.exists(n) || "function" != typeof n) n = enyo.bind(this, this.syncFromSource), this.sourceResponder = n;
if (!0 === e.destroyed) throw this.destroy(), "binding-destroyed";
return !0 === this.sourceConnected ? !0 : enyo.exists(e) ? (n.bindingId = this.id, e.addObserver(t, n), this.sourceConnected = !0) : this.sourceConnected = !1;
}
return this.sourceConnected = !1;
},
connectTarget: function() {
var e = this.target, t = this.targetProperty, n = this.targetResponder, r = this.oneWay;
if (e instanceof enyo.Object) {
if (!0 === e.destroyed) throw this.destroy(), "binding-destroyed";
if (!0 === r) return this.targetConnected = !0;
if (!enyo.exists(n) || "function" != typeof n) n = enyo.bind(this, this.syncFromTarget), this.targetResponder = n;
return !0 === this.targetConnected ? !0 : enyo.exists(e) ? (n.bindingId = this.id, e.addObserver(t, n), this.targetConnected = !0) : this.targetConnected = !1;
}
return this.targetConnected = !1;
},
syncFromSource: function() {
var e = !this.oneWay, t = this.getSourceValue(), n = this.transform;
try {
t = n.transform(t, "source");
} catch (r) {
if ("stop-binding" === r) return;
throw r;
}
e && (this.synchronizing = !0, this.disconnectTarget()), this.setTargetValue(t), e && (this.connectTarget(), this.synchronizing = !1);
},
syncFromTarget: function() {
var e = this.getTargetValue(), t = this.transform;
try {
e = t.transform(e, "target");
} catch (n) {
if ("stop-binding" === n) return;
throw n;
}
this.disconnectSource(), this.setSourceValue(e), this.connectSource();
},
disconnectSource: function() {
var e = this.source, t = this.sourceProperty, n = this.sourceResponder;
if (!enyo.exists(e)) return;
e.removeObserver(t, n), this.sourceConnected = !1;
},
disconnectTarget: function() {
var e = this.target, t = this.targetResponder, n = this.targetProperty;
if (!enyo.exists(e)) return;
"function" == typeof t && e.removeObserver(n, t), this.targetConnected = !1;
},
setSourceValue: function(e) {
var t = this.source, n = this.sourceProperty;
t.set(n, e, !0);
},
setTargetValue: function(e) {
var t = this.target, n = this.targetProperty;
t.set(n, e, !0);
},
getSourceValue: function() {
var e = this.source, t = this.sourceProperty;
return e.get(t);
},
getTargetValue: function() {
var e = this.target, t = this.targetProperty;
return e.get(t);
},
setupTransform: function() {
var t = this.transform, n = this.owner || {};
"string" == typeof t ? t = n[t] || enyo.getPath.call(n, t) || enyo.getPath.call(enyo.global, t) : "function" == typeof t && (t = this.transform), "function" != typeof t && (t = this.transform = function(e) {
return e;
}), t instanceof e || (this.transform = new e(t, this));
},
destroy: function() {
if (!0 === this.destroyed) return;
this.destroyed = !0, this.disconnect(), this.source = null, this.target = null, this.sourceResponder = null, this.targetResponder = null, enyo.Binding.bindingCount--, this.transform && (this.transform.destroy(), this.transform = null), this.owner && this.owner.removeBinding(this), i(this);
}
}, t.extend = function(e) {
e = e || {};
var n = function() {
t.apply(this, arguments);
}, r = e.name;
return delete e.name, n.prototype = enyo.mixin(Object.create(t.prototype), e), r && enyo.setPath(r, n), n;
};
}(), enyo.kind({
name: "enyo.Object",
kind: null,
concat: enyo.concat,
mixins: null,
initBindings: !0,
initMixins: !0,
initObservers: !0,
appliedMixins: null,
initComputed: !0,
bindings: null,
observers: null,
computed: null,
defaultBindingKind: "enyo.Binding",
constructor: function() {
enyo._objectCount++, this.setup();
},
constructed: function(e) {
if (e) for (var t in e) {
if (!e.hasOwnProperty(t)) continue;
this[t] = e[t];
}
},
destroyObject: function(e) {
this[e] && this[e].destroy && this[e].destroy(), this[e] = null;
},
log: function() {
var e = arguments.callee.caller, t = ((e ? e.nom : "") || "(instance method)") + ":";
enyo.logging.log("log", [ t ].concat(enyo.cloneArray(arguments)));
},
warn: function() {
this._log("warn", arguments);
},
error: function() {
this._log("error", arguments);
},
_log: function(e, t) {
if (enyo.logging.shouldLog(e)) try {
throw new Error;
} catch (n) {
enyo.logging._log(e, [ t.callee.caller.nom + ": " ].concat(enyo.cloneArray(t))), enyo.log(n.stack);
}
},
findAndInstance: function(e) {
if (!enyo.exists(e)) return;
var t = this[e + "FindAndInstance"];
return t = enyo.exists(t) && "function" == typeof t ? enyo.bind(this, t) : null, enyo.findAndInstance.call(this, e, t);
},
setupMixins: function(e) {
if (!1 === this.initMixins && !e) return;
this.initMixins = !1, this.appliedMixins || (this.appliedMixins = []), enyo.forEach(this.mixins || [], this.prepareMixin, this);
},
prepareMixin: function(e) {
"string" == typeof e && (e = enyo.getPath(e)), e && this.extend(e);
},
setup: function() {
this.setupHooks(), this.setupMixins(), this.setupObservers(), this.setupComputed(), this.setupBindings();
},
setupBindings: function(e) {
if (!1 === this.initBindings && !e) return;
this.initBindings = !1;
if (!0 === this.didSetupBindings) return this.refreshBindings();
var t = this.bindings || [], n = 0, r, i;
this.bindings = [];
for (r = t.length; n < r; ++n) i = t[n], this.binding(i);
this.didSetupBindings = !0, this.notifyObservers("didSetupBindings"), this.removeObserver("didSetupBindings");
},
binding: function() {
var e = arguments, t = 0, n = e.length, r, i = {}, s = this.bindings, o = enyo.getPath(this.defaultBindingKind), u, a;
for (; t < n; ++t) enyo.mixin(i, e[t]);
if (a = i.kind) "string" == typeof a ? u = enyo.getPath(i.kind) : "function" == typeof a && (u = a);
if (!u || "function" != typeof u) u = o;
return r = new u({
owner: this,
autoConnect: !0
}, i), s.push(r), r;
},
clearBindings: function(e) {
var t = enyo.cloneArray(e || this.bindings || []), n;
while (t.length) n = t.shift(), n instanceof enyo.Binding && n.destroy();
},
refreshBindings: function(e) {
var t = enyo.cloneArray(e || this.bindings || []), n;
while (t.length) n = t.shift(), n instanceof enyo.Binding && n.refresh();
},
removeBinding: function(e) {
if (!enyo.exists(e) || !(e instanceof enyo.Binding)) return;
var t = this.bindings || [], n = t.indexOf(e);
!~n || t.splice(n, 1);
},
setupComputed: function(e) {
if (!1 === this.initComputed && !e) return;
this.initComputed = !1;
var t, n, r, i, s, o, u, a = this.computed || (this.computed = {});
for (n in this) {
if (!enyo.exists(t = this[n])) continue;
if ("function" == typeof t && !0 === t.isProperty) {
a[n] = t, s = t.properties || [];
for (r = 0, i = s.length; r < i; ++r) o = s[r], u = enyo.bind(this, function(e) {
this.notifyObservers(e, null, this.get(e), !0);
}, n), this.addObserver(o, u);
}
}
},
setupObservers: function(e) {
if (!1 === this.initObservers && !e) return;
this.initObservers = !1, this.didSetupObservers = !0;
var t, n, r, i, s = this.observers || (this.observers = {}), o, u;
for (t in this) {
if (!enyo.exists(n = this[t])) continue;
if ("function" == typeof n && !0 === n.isObserver) {
o = n.events || [];
if (!o.length) continue;
for (r = 0, i = o.length; r < i; ++r) u = o[r], this.addObserver(u, n, this);
}
}
},
addObserver: function(e, t, n) {
var r = this.observers || (this.observers = {}), i;
return t = n ? enyo.bind(n, t) : t, enyo.exists(r[e]) ? i = r[e] : i = r[e] = [], ~i.indexOf(t) || i.push(t), t;
},
removeObserver: function(e, t) {
var n = this.observers, r, i;
if (!(i = n[e])) return this;
enyo.exists(t) && "function" == typeof t ? (r = i.indexOf(t), !~r || i.splice(r, 1)) : delete n[e];
},
removeAllObservers: function() {
var e = this.observers, t, n, r, i, s;
for (i in e) {
if (!e.hasOwnProperty(i)) continue;
t = e[i], e[i] = null;
for (s = 0, len = t.length; s < len; ++s) n = t[s], n.bindingId && (r = enyo.Binding.map[n.bindingId], r && r instanceof enyo.Binding && r.destroy());
}
return this.observers = {}, this;
},
notifyObservers: function(e, t, n) {
var r = this.observers || {}, i = r[e] || [], s = 0, o, u = enyo.uncap(e) + "Changed";
"*" !== e && (i = enyo.merge(i, r["*"] || []));
if (i) for (; s < i.length; ++s) {
o = i[s];
if (!enyo.exists(o) || "function" != typeof o) continue;
!1 === this.allowNotifications ? this.addNotificationToQueue(e, o, [ e, t, n ]) : o.call(this, e, t, n);
}
enyo.exists(this[u]) && "function" == typeof this[u] && (!1 === this.allowNotifications ? this.addNotificationToQueue(e, this[u], [ t, n ]) : this[u].call(this, t, n));
},
notificationQueue: null,
allowNotifications: !0,
allowNotificationQueue: !0,
addNotificationToQueue: function(e, t, n) {
var r = this.notificationQueue || (this.notificationQueue = {}), i = r[e];
n = n || [];
if (!1 === this.allowNotificationQueue) return;
enyo.exists(i) ? (i[0] !== n && i.splice(0, 1, n), ~i.indexOf(t) || i.push(t)) : r[e] = [ n, t ];
},
stopNotifications: function(e) {
this.allowNotifications = !1, this._stop_count += 1, !0 === e && this.disableNotificationQueue();
},
_stop_count: 0,
startNotifications: function(e) {
0 !== this._stop_count && --this._stop_count, 0 === this._stop_count && (this.allowNotifications = !0, this.flushNotifications()), !0 === e && this.enableNotificationQueue();
},
enableNotificationQueue: function() {
this.allowNotificationQueue = !0;
},
disableNotificationQueue: function() {
this.allowNotificationQueue = !1, this.notificationQueue = {};
},
flushNotifications: function() {
if (0 !== this._stop_count) return;
var e = this.notificationQueue, t, n, r, i;
if (!enyo.exists(e) || !1 === this.allowNotificationQueue) return;
for (n in e) {
if (!e.hasOwnProperty(n)) continue;
r = e[n], i = r.shift(), "function" == typeof i && (r.unshift(i), i = []);
while (r.length) t = r.shift(), t.apply(this, i);
}
},
_get_hooks: null,
_set_hooks: null,
_did_setup_hooks: !1,
setupHooks: function() {
if (!0 === this._did_setup_hooks) return;
this._get_hooks = [], this._set_hooks = [], this._did_setup_hooks = !0;
},
hook: function(e, t, n) {
var r = this["_" + e + "_hooks"];
r.push({
path: t,
method: n
});
},
_check_hooks: function(e, t, n) {
if (!this._did_setup_hooks) return !1;
var r = this["_" + e + "_hooks"], i = 0, s = r.length, o;
for (; i < s; ++i) {
o = r[i];
if ("string" == typeof o.path) {
if (t === o.path) return o.method.call(this, t, n);
} else if ("function" == typeof o.path) {
if (!0 === o.path(t)) return o.method.call(this, t, n);
} else if (o.path instanceof RegExp && o.path.test(t)) return o.method.call(this, t, n);
}
return !1;
},
get: function(e) {
return enyo.getPath.apply(this, arguments);
},
set: function(e, t) {
return enyo.setPath.apply(this, arguments);
},
extend: function() {
var e = enyo.toArray(arguments), t, n, r;
while (e.length && (t = e.shift())) if (t.isMixin || "function" == typeof t) this.extendMixin(t); else for (n in t) {
if (!t.hasOwnProperty(n)) continue;
r = t[n], "string" == typeof r ? this[n] = r : "function" == typeof r && this.extendMethod(n, r, t);
}
},
extendMethod: function(e, t, n) {
var r = this[e], i = !!t.isProperty, s = !!t.isObserver, o;
o = enyo.proxyMethod(t, this);
if (!enyo.exists(r) || "function" != typeof r) r = enyo.nop;
this[e] = o, o._inherited = r, !0 === i ? (o.isProperty = !0, o.properties = t.properties || []) : !0 === s && (o.isObserver = !0, o.events = t.events || []), o.isExtended = !0;
},
extendMixin: function(e) {
enyo.exists(e) && e.apply && e.apply(this);
},
destroy: function() {
this.clearBindings(), this.removeAllObservers(), this.destroyed = !0;
}
}), enyo._objectCount = 0, enyo.Object.subclass = function(e, t) {
this.publish(e, t);
}, enyo.Object.publish = function(e, t) {
var n = t.published;
if (n) {
var r = e.prototype;
for (var i in n) {
if (t[i] && enyo.isFunction(t[i]) && t[i].isProperty) continue;
enyo.Object.addGetterSetter(i, n[i], r);
}
}
}, enyo.Object.addGetterSetter = function(e, t, n) {
var r = "get" + enyo.cap(e), i = "set" + enyo.cap(e), s;
n[e] = t, s = n[r], "function" != typeof s ? (s = n[r] = function() {
return this.get(e);
}, s.overloaded = !1) : !1 !== s.overloaded && (s.overloaded = !0), s = n[i], "function" != typeof s ? (s = n[i] = function() {
return this.set(e, arguments[0]);
}, s.overloaded = !1) : !1 !== s.overloaded && (s.overloaded = !0);
}, enyo.kind({
name: "enyo.Component",
kind: enyo.Object,
published: {
name: "",
id: "",
owner: null
},
statics: {
_kindPrefixi: {},
_unnamedKindNumber: 0
},
defaultKind: "Component",
handlers: {},
initMixins: !1,
initComputed: !1,
toString: function() {
return this.kindName;
},
constructor: function(e) {
this._componentNameMap = {}, this.$ = {}, this.inherited(arguments);
},
constructed: function(e) {
this.importProps(e), this.initMixins = !0, this.setup(), this.create();
},
importProps: function(e) {
if (e) for (var t in e) this[t] = e[t];
this.handlers = enyo.mixin(enyo.clone(this.kindHandlers), this.handlers);
},
create: function() {
this.ownerChanged(), this.initComponents(), this.initComputed = !0, this.setup();
},
initComponents: function() {
this.createChrome(this.kindComponents), this.createClientComponents(this.components);
},
createChrome: function(e) {
this.createComponents(e, {
isChrome: !0
});
},
createClientComponents: function(e) {
this.createComponents(e, {
owner: this.getInstanceOwner()
});
},
getInstanceOwner: function() {
return !this.owner || this.owner.notInstanceOwner ? this : this.owner;
},
destroy: function() {
this.destroyComponents(), this.setOwner(null), this.inherited(arguments);
},
destroyComponents: function() {
enyo.forEach(this.getComponents(), function(e) {
e.destroyed || e.destroy();
});
},
makeId: function() {
var e = "_", t = this.owner && this.owner.getId(), n = this.name || "@@" + ++enyo.Component._unnamedKindNumber;
return (t ? t + e : "") + n;
},
ownerChanged: function(e) {
e && e.removeComponent && e.removeComponent(this), this.owner && this.owner.addComponent && this.owner.addComponent(this), this.id || (this.id = this.makeId());
},
nameComponent: function(e) {
var t = enyo.Component.prefixFromKindName(e.kindName), n, r = this._componentNameMap[t] || 0;
do n = t + (++r > 1 ? String(r) : ""); while (this.$[n]);
return this._componentNameMap[t] = Number(r), e.name = n;
},
addComponent: function(e) {
var t = e.getName();
t || (t = this.nameComponent(e)), this.$[t] && this.warn('Duplicate component name "' + t + '" in owner "' + this.id + '" violates ' + "unique-name-under-owner rule, replacing existing component in the hash and continuing, " + "but this is an error condition and should be fixed."), this.$[t] = e;
},
removeComponent: function(e) {
delete this.$[e.getName()];
},
getComponents: function() {
var e = [];
for (var t in this.$) e.push(this.$[t]);
return e;
},
adjustComponentProps: function(e) {
this.defaultProps && enyo.mixin(e, this.defaultProps), e.kind = e.kind || e.isa || this.defaultKind, e.owner = e.owner || this;
},
_createComponent: function(e, t) {
if (!e.kind && "kind" in e) throw "enyo.create: Attempt to create a null kind. Check dependencies for [" + e.name + "].";
var n = enyo.mixin(enyo.clone(t), e);
return this.adjustComponentProps(n), enyo.Component.create(n);
},
createComponent: function(e, t) {
return this._createComponent(e, t);
},
createComponents: function(e, t) {
if (e) {
var n = [];
for (var r = 0, i; i = e[r]; r++) n.push(this._createComponent(i, t));
return n;
}
},
getBubbleTarget: function() {
return this.owner;
},
bubble: function(e, t, n) {
if (this._silenced) return;
var r = t || {};
return "originator" in r || (r.originator = n || this), this.dispatchBubble(e, r, n);
},
bubbleUp: function(e, t, n) {
if (this._silenced) return;
var r = this.getBubbleTarget();
return r ? r.dispatchBubble(e, t, this) : !1;
},
dispatchEvent: function(e, t, n) {
if (this._silenced) return;
this.decorateEvent(e, t, n);
if (this.handlers && this.handlers[e] && this.dispatch(this.handlers[e], t, n)) return !0;
if (this[e]) return "function" == typeof this[e] ? this.dispatch(e, t, n) : this.dispatchBubble(this[e], t, n);
},
dispatchBubble: function(e, t, n) {
if (this._silenced) return;
return this.dispatchEvent(e, t, n) ? !0 : this.bubbleUp(e, t, n);
},
decorateEvent: function(e, t, n) {},
bubbleDelegation: function(e, t, n, r, i) {
if (this._silenced) return;
var s = this.getBubbleTarget();
if (s) return s.delegateEvent(e, t, n, r, i);
},
delegateEvent: function(e, t, n, r, i) {
if (this._silenced) return;
return this.decorateEvent(n, r, i), e == this ? this.dispatch(t, r, i) : this.bubbleDelegation(e, t, n, r, i);
},
dispatch: function(e, t, n) {
if (this._silenced) return;
var r = e && this[e];
if (r && "function" == typeof r) return r.call(this, n || this, t);
},
waterfall: function(e, t, n) {
if (this._silenced) return;
if (this.dispatchEvent(e, t, n)) return !0;
this.waterfallDown(e, t, n || this);
},
waterfallDown: function(e, t, n) {
if (this._silenced) return;
for (var r in this.$) this.$[r].waterfall(e, t, n);
},
_silenced: !1,
_silence_count: 0,
silence: function() {
this._silenced = !0, this._silence_count += 1;
},
unsilence: function() {
0 !== this._silence_count && --this._silence_count, 0 === this._silence_count && (this._silenced = !1);
}
}), enyo.defaultCtor = enyo.Component, enyo.create = enyo.Component.create = function(e) {
if (!e.kind && "kind" in e) throw "enyo.create: Attempt to create a null kind. Check dependencies for [" + (e.name || "") + "].";
var t = e.kind || e.isa || enyo.defaultCtor, n = enyo.constructorForKind(t);
return n || (enyo.error('no constructor found for kind "' + t + '"'), n = enyo.Component), new n(e);
}, enyo.Component.subclass = function(e, t) {
var n = e.prototype;
t.components && (n.kindComponents = t.components, delete n.components);
if (t.handlers) {
var r = n.kindHandlers;
n.kindHandlers = enyo.mixin(enyo.clone(r), n.handlers), n.handlers = null;
}
t.events && this.publishEvents(e, t);
}, enyo.Component.publishEvents = function(e, t) {
var n = t.events;
if (n) {
var r = e.prototy