").append(ut.parseHTML(e)).find(i): e);
}
).complete(r && function (e, t){
u.each(r, o || [e.responseText, t, e] );
}
), this;
}
, ut.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"] , function (e, t){
ut.fn[t] = function (e){
return this.on(t, e);
}
;
}
), ut.each(["get", "post"] , function (e, n){
ut[n] = function (e, r, i, s){
return ut.isFunction(r) && (s = s || i, i = r, r = t), ut.ajax({
url: e,
type: n,
dataType: s,
data: r,
success: i}
);
}
;
}
), ut.extend({
active: 0,
lastModified: {
}
,
etag: {
}
,
ajaxSettings: {
url: On,
type: "GET",
isLocal: Bn.test(An[1]),
global: true ,
processData: true ,
async: true ,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
accepts: {
"*": zn,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"}
,
contents: {
xml: /xml/,
html: /html/,
json: /json/}
,
responseFields: {
xml: "responseXML",
text: "responseText"}
,
converters: {
"* text": e.String,
"text html": true ,
"text json": ut.parseJSON,
"text xml": ut.parseXML}
,
flatOptions: {
url: true ,
context: true }
}
,
ajaxSetup: function (e, t){
return t? _(_(e, ut.ajaxSettings), t): _(ut.ajaxSettings, e);
}
,
ajaxPrefilter: O(Rn),
ajaxTransport: O(Un),
ajax: function (e, n){
function r(e, n, r, u){
var f, c, y, b, E, x = n;
2 !== w && (w = 2, a && clearTimeout(a), i = t, o = u || "", S.readyState = e > 0? 4: 0, r && (b = D(h, S, r)), e >= 200 && 300 > e || 304 === e? (h.ifModified && (E = S.getResponseHeader("Last-Modified"), E && (ut.lastModified[s] = E), E = S.getResponseHeader("etag"), E && (ut.etag[s] = E)), 304 === e? (f = true , x = "notmodified"): (f = P(h, b), x = f.state, c = f.data, y = f.error, f = !y)): (y = x, (e || !x) && (x = "error", 0 > e && (e = 0))), S.status = e, S.statusText = (n || x) + "", f? v.resolveWith(p, [c, x, S] ): v.rejectWith(p, [S, x, y] ), S.statusCode(g), g = t, l && d.trigger(f? "ajaxSuccess": "ajaxError", [S, h, f? c: y] ), m.fireWith(p, [S, x] ), l && (d.trigger("ajaxComplete", [S, h] ), --ut.active || ut.event.trigger("ajaxStop")));
}
"object" == typeof e && (n = e, e = t), n = n || {
}
;
var i, s, o, u, a, f, l, c, h = ut.ajaxSetup({
}
, n), p = h.context || h, d = h.context && (p.nodeType || p.jquery)? ut(p): ut.event, v = ut.Deferred(), m = ut.Callbacks("once memory"), g = h.statusCode || {
}
, y = {
}
, b = {
}
, w = 0, E = "canceled", S = {
readyState: 0,
getResponseHeader: function (e){
var t;
if (2 === w) {
if (!u) for (u = {
}
; t = Hn.exec(o); )u[t[1].toLowerCase()] = t[2];
t = u[e.toLowerCase()];
}
return null == t? null : t;
}
,
getAllResponseHeaders: function (){
return 2 === w? o: null ;
}
,
setRequestHeader: function (e, t){
var n = e.toLowerCase();
return w || (e = b[n] = b[n] || e, y[e] = t), this;
}
,
overrideMimeType: function (e){
return w || (h.mimeType = e), this;
}
,
statusCode: function (e){
var t;
if (e) if (2 > w) for (t in e)g[t] = [g[t], e[t]] ;
else S.always(e[S.status]);
return this;
}
,
abort: function (e){
var t = e || E;
return i && i.abort(t), r(0, t), this;
}
}
;
if (v.promise(S).complete = m.add, S.success = S.done, S.error = S.fail, _AN_Write_url("url", h, false , _AN_Call_replace("replace", _AN_Call_replace("replace", ((e || _AN_Read_url("url", h) || On) + ""), Dn, ""), Fn, An[1] + "//")), h.type = n.method || n.type || h.method || h.type, h.dataTypes = ut.trim(h.dataType || "*").toLowerCase().match(ft) || [""] , null == h.crossDomain && (f = In.exec(_AN_Read_url("url", h).toLowerCase()), h.crossDomain = !(!f || f[1] === An[1] && f[2] === An[2] && (f[3] || ("http:" === f[1]? 80: 443)) == (An[3] || ("http:" === An[1]? 80: 443)))), h.data && h.processData && "string" != typeof h.data && (h.data = ut.param(h.data, h.traditional)), M(Rn, h, n, S), 2 === w) return S;
l = h.global, l && 0 === ut.active++ && ut.event.trigger("ajaxStart"), h.type = h.type.toUpperCase(), h.hasContent = !jn.test(h.type), s = _AN_Read_url("url", h), h.hasContent || (h.data && (s = _AN_Write_url("url", h, true , (_n.test(s)? "&": "?") + h.data), delete h.data), h.cache === false && (_AN_Write_url("url", h, false , Pn.test(s)? _AN_Call_replace("replace", s, Pn, "$1_=" + Mn++ ): s + (_n.test(s)? "&": "?") + "_=" + Mn++ ))), h.ifModified && (ut.lastModified[s] && S.setRequestHeader("If-Modified-Since", ut.lastModified[s]), ut.etag[s] && S.setRequestHeader("If-None-Match", ut.etag[s])), (h.data && h.hasContent && h.contentType !== false || n.contentType) && S.setRequestHeader("Content-Type", h.contentType), S.setRequestHeader("Accept", h.dataTypes[0] && h.accepts[h.dataTypes[0]]? h.accepts[h.dataTypes[0]] + ("*" !== h.dataTypes[0]? ", " + zn + "; q=0.01": ""): h.accepts["*"] );
for (c in h.headers)S.setRequestHeader(c, h.headers[c]);
if (!h.beforeSend || h.beforeSend.call(p, S, h) !== false && 2 !== w) {
E = "abort";
for (c in {
success: 1,
error: 1,
complete: 1}
)S[c](h[c]);
if (i = M(Un, h, n, S)) {
S.readyState = 1, l && d.trigger("ajaxSend", [S, h] ), h.async && h.timeout > 0 && (a = _AN_Call_settimeout("setTimeout", window, function (){
S.abort("timeout");
}
, h.timeout));
try {
w = 1, _AN_Call_send("send", i, y, r);
}
catch (x) {
if (!(2 > w)) throw x
r(-1, x);
}
}
else r(-1, "No Transport");
return S;
}
return S.abort();
}
,
getScript: function (e, n){
return ut.get(e, t, n, "script");
}
,
getJSON: function (e, t, n){
return ut.get(e, t, n, "json");
}
}
), ut.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"}
,
contents: {
script: /(?:java|ecma)script/}
,
converters: {
"text script": function (e){
return ut.globalEval(e), e;
}
}
}
), ut.ajaxPrefilter("script", function (e){
e.cache === t && (e.cache = false ), e.crossDomain && (e.type = "GET", e.global = false );
}
), ut.ajaxTransport("script", function (e){
if (e.crossDomain) {
var n, r = $.head || ut("head")[0] || $.documentElement;
return {
send: function (t, i){
n = _AN_Call_createelement("createElement", $, "script"), n.async = true , e.scriptCharset && (n.charset = e.scriptCharset), _AN_Write_src("src", n, false , _AN_Read_url("url", e)), n.onload = n.onreadystatechange = function (e, t){
(t || !n.readyState || /loaded|complete/.test(n.readyState)) && (n.onload = n.onreadystatechange = null , n.parentNode && n.parentNode.removeChild(n), n = null , t || i(200, "success"));
}
, r.insertBefore(n, r.firstChild);
}
,
abort: function (){
n && n.onload(t, true );
}
}
;
}
}
);
var Xn = [] , Vn = /(=)\?(?=&|$)|\?\?/;
ut.ajaxSetup({
jsonp: "callback",
jsonpCallback: function (){
var e = Xn.pop() || ut.expando + "_" + Mn++ ;
return this[e] = true , e;
}
}
), ut.ajaxPrefilter("json jsonp", function (n, r, i){
var s, o, u, a = n.jsonp !== false && (Vn.test(_AN_Read_url("url", n))? "url": "string" == typeof n.data && !(n.contentType || "").indexOf("application/x-www-form-urlencoded") && Vn.test(n.data) && "data");
return a || "jsonp" === n.dataTypes[0]? (s = n.jsonpCallback = ut.isFunction(n.jsonpCallback)? n.jsonpCallback(): n.jsonpCallback, a? n[a] = _AN_Call_replace("replace", n[a], Vn, "$1" + s): n.jsonp !== false && (_AN_Write_url("url", n, true , (_n.test(_AN_Read_url("url", n))? "&": "?") + n.jsonp + "=" + s)), n.converters["script json"] = function (){
return u || ut.error(s + " was not called"), u[0];
}
, n.dataTypes[0] = "json", o = e[s], e[s] = function (){
u = arguments;
}
, i.always(function (){
e[s] = o, n[s] && (n.jsonpCallback = r.jsonpCallback, Xn.push(s)), u && ut.isFunction(o) && o(u[0]), u = o = t;
}
), "script"): t;
}
);
var $n, Jn, Kn = 0, Qn = e.ActiveXObject && function (){
var e;
for (e in $n)$n[e](t, true );
}
;
ut.ajaxSettings.xhr = e.ActiveXObject? function (){
return !this.isLocal && H() || B();
}
: H, Jn = ut.ajaxSettings.xhr(), ut.support.cors = !!Jn && "withCredentials" in Jn, Jn = ut.support.ajax = !!Jn, Jn && ut.ajaxTransport(function (n){
if (!n.crossDomain || ut.support.cors) {
var r;
return {
send: function (i, s){
var o, u, a = n.xhr();
if (n.username? _AN_Call_open("open", a, n.type, _AN_Read_url("url", n), n.async, n.username, n.password): _AN_Call_open("open", a, n.type, _AN_Read_url("url", n), n.async), n.xhrFields) for (u in n.xhrFields)a[u] = n.xhrFields[u];
n.mimeType && a.overrideMimeType && a.overrideMimeType(n.mimeType), n.crossDomain || i["X-Requested-With"] || (i["X-Requested-With"] = "XMLHttpRequest");
try {
for (u in i)a.setRequestHeader(u, i[u]);
}
catch (f) {
}
_AN_Call_send("send", a, n.hasContent && n.data || null ), r = function (e, i){
var u, f, l, c, h;
try {
if (r && (i || 4 === a.readyState)) if (r = t, o && (a.onreadystatechange = ut.noop, Qn && delete $n[o]), i) 4 !== a.readyState && a.abort();
else {
c = {
}
, u = a.status, h = a.responseXML, l = a.getAllResponseHeaders(), h && h.documentElement && (c.xml = h), "string" == typeof a.responseText && (_AN_Write_text("text", c, false , a.responseText));
try {
f = a.statusText;
}
catch (p) {
f = "";
}
u || !n.isLocal || n.crossDomain? 1223 === u && (u = 204): u = c.text? 200: 404;
}
}
catch (d) {
i || s(-1, d);
}
c && s(u, f, c, l);
}
, n.async? 4 === a.readyState? _AN_Call_settimeout("setTimeout", window, r): (o = ++Kn, Qn && ($n || ($n = {
}
, ut(e).unload(Qn)), $n[o] = r), a.onreadystatechange = r): r();
}
,
abort: function (){
r && r(t, true );
}
}
;
}
}
);
var Gn, Yn, Zn = /^(?:toggle|show|hide)$/, er = RegExp("^(?:([+-])=|)(" + at + ")([a-z%]*)$", "i"), tr = /queueHooks$/, nr = [R] , rr = {
"*": [function (e, t){
var n, r, i = this.createTween(e, t), s = er.exec(t), o = i.cur(), u = + o || 0, a = 1, f = 20;
if (s) {
if (n = + s[2], r = s[3] || (ut.cssNumber[e]? "": "px"), "px" !== r && u) {
u = ut.css(i.elem, e, true ) || n || 1;
do a = a || ".5", u /= a, ut.style(i.elem, e, u + r);
while(a !== (a = i.cur() / o) && 1 !== a && --f)}
i.unit = r, i.start = u, i.end = s[1]? u + (s[1] + 1) * n: n;
}
return i;
}
] }
;
ut.Animation = ut.extend(I, {
tweener: function (e, t){
ut.isFunction(e)? (t = e, e = ["*"] ): e = e.split(" ");
for (var n, r = 0, i = _AN_Read_length("length", e);
i > r; r++ )n = e[r], rr[n] = rr[n] || [] , rr[n].unshift(t);
}
,
prefilter: function (e, t){
t? nr.unshift(e): nr.push(e);
}
}
), ut.Tween = U, U.prototype = {
constructor: U,
init: function (e, t, n, r, i, s){
this.elem = e, this.prop = n, this.easing = i || "swing", this.options = t, this.start = this.now = this.cur(), this.end = r, this.unit = s || (ut.cssNumber[n]? "": "px");
}
,
cur: function (){
var e = U.propHooks[this.prop];
return e && e.get? e.get(this): U.propHooks._default.get(this);
}
,
run: function (e){
var t, n = U.propHooks[this.prop];
return this.pos = t = this.options.duration? ut.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration): e, this.now = (this.end - this.start) * t + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), n && n.set? n.set(this): U.propHooks._default.set(this), this;
}
}
, U.prototype.init.prototype = U.prototype, U.propHooks = {
_default: {
get: function (e){
var t;
return null == e.elem[e.prop] || e.elem.style && null != e.elem.style[e.prop]? (t = ut.css(e.elem, e.prop, "auto"), t && "auto" !== t? t: 0): e.elem[e.prop];
}
,
set: function (e){
ut.fx.step[e.prop]? ut.fx.step[e.prop](e): e.elem.style && (null != e.elem.style[ut.cssProps[e.prop]] || ut.cssHooks[e.prop])? ut.style(e.elem, e.prop, e.now + e.unit): e.elem[e.prop] = e.now;
}
}
}
, U.propHooks.scrollTop = U.propHooks.scrollLeft = {
set: function (e){
e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now);
}
}
, ut.each(["toggle", "show", "hide"] , function (e, t){
var n = ut.fn[t];
ut.fn[t] = function (e, r, i){
return null == e || "boolean" == typeof e? n.apply(this, arguments): this.animate(z(t, true ), e, r, i);
}
;
}
), ut.fn.extend({
fadeTo: function (e, t, n, r){
return _AN_Call_show("show", this.filter(S).css("opacity", 0)).end().animate({
opacity: t}
, e, n, r);
}
,
animate: function (e, t, n, r){
var i = ut.isEmptyObject(e), s = ut.speed(t, n, r), o = function (){
var t = I(this, ut.extend({
}
, e), s);
o.finish = function (){
t.stop(true );
}
, (i || ut._data(this, "finish")) && t.stop(true );
}
;
return o.finish = o, i || s.queue === false ? this.each(o): this.queue(s.queue, o);
}
,
stop: function (e, n, r){
var i = function (e){
var t = e.stop;
delete e.stop, t(r);
}
;
return "string" != typeof e && (r = n, n = e, e = t), n && e !== false && this.queue(e || "fx", [] ), this.each(function (){
var t = true , n = null != e && e + "queueHooks", s = ut.timers, o = ut._data(this);
if (n) o[n] && o[n].stop && i(o[n]);
else for (n in o)o[n] && o[n].stop && tr.test(n) && i(o[n]);
for (n = _AN_Read_length("length", s); n-- ; )s[n].elem !== this || null != e && s[n].queue !== e || (s[n].anim.stop(r), t = false , s.splice(n, 1));
(t || !r) && ut.dequeue(this, e);
}
);
}
,
finish: function (e){
return e !== false && (e = e || "fx"), this.each(function (){
var t, n = ut._data(this), r = n[e + "queue"], i = n[e + "queueHooks"], s = ut.timers, o = r? _AN_Read_length("length", r): 0;
for (n.finish = true , ut.queue(this, e, [] ), i && i.cur && i.cur.finish && i.cur.finish.call(this), t = _AN_Read_length("length", s); t-- ; )s[t].elem === this && s[t].queue === e && (s[t].anim.stop(true ), s.splice(t, 1));
for (t = 0; o > t; t++ )r[t] && r[t].finish && r[t].finish.call(this);
delete n.finish;
}
);
}
}
), ut.each({
slideDown: z("show"),
slideUp: z("hide"),
slideToggle: z("toggle"),
fadeIn: {
opacity: "show"}
,
fadeOut: {
opacity: "hide"}
,
fadeToggle: {
opacity: "toggle"}
}
, function (e, t){
ut.fn[e] = function (e, n, r){
return this.animate(t, e, n, r);
}
;
}
), ut.speed = function (e, t, n){
var r = e && "object" == typeof e? ut.extend({
}
, e): {
complete: n || !n && t || ut.isFunction(e) && e,
duration: e,
easing: n && t || t && !ut.isFunction(t) && t}
;
return r.duration = ut.fx.off? 0: "number" == typeof r.duration? r.duration: r.duration in ut.fx.speeds? ut.fx.speeds[r.duration]: ut.fx.speeds._default, (null == r.queue || r.queue === true ) && (r.queue = "fx"), r.old = r.complete, r.complete = function (){
ut.isFunction(r.old) && r.old.call(this), r.queue && ut.dequeue(this, r.queue);
}
, r;
}
, ut.easing = {
linear: function (e){
return e;
}
,
swing: function (e){
return 0.5 - Math.cos(e * Math.PI) / 2;
}
}
, ut.timers = [] , ut.fx = U.prototype.init, ut.fx.tick = function (){
var e, n = ut.timers, r = 0;
for (Gn = ut.now(); _AN_Read_length("length", n) > r; r++ )e = n[r], e() || n[r] !== e || n.splice(r-- , 1);
_AN_Read_length("length", n) || ut.fx.stop(), Gn = t;
}
, ut.fx.timer = function (e){
e() && ut.timers.push(e) && ut.fx.start();
}
, ut.fx.interval = 13, ut.fx.start = function (){
Yn || (Yn = _AN_Call_setinterval("setInterval", window, ut.fx.tick, ut.fx.interval));
}
, ut.fx.stop = function (){
clearInterval(Yn), Yn = null ;
}
, ut.fx.speeds = {
slow: 600,
fast: 200,
_default: 400}
, ut.fx.step = {
}
, ut.expr && ut.expr.filters && (ut.expr.filters.animated = function (e){
return _AN_Read_length("length", ut.grep(ut.timers, function (t){
return e === t.elem;
}
));
}
), ut.fn.offset = function (e){
if (arguments.length) return e === t? this: this.each(function (t){
ut.offset.setOffset(this, e, t);
}
);
var n, r, i = {
top: 0,
left: 0}
, s = this[0], o = s && s.ownerDocument;
if (o) return n = o.documentElement, ut.contains(n, s)? (s.getBoundingClientRect !== t && (i = s.getBoundingClientRect()), r = W(o), {
top: i.top + (r.pageYOffset || n.scrollTop) - (n.clientTop || 0),
left: i.left + (r.pageXOffset || n.scrollLeft) - (n.clientLeft || 0)}
): i;
}
, ut.offset = {
setOffset: function (e, t, n){
var r = ut.css(e, "position");
"static" === r && (e.style.position = "relative");
var i, s, o = ut(e), u = o.offset(), a = ut.css(e, "top"), f = ut.css(e, "left"), l = ("absolute" === r || "fixed" === r) && ut.inArray("auto", [a, f] ) > -1, c = {
}
, h = {
}
;
l? (h = o.position(), i = h.top, s = h.left): (i = parseFloat(a) || 0, s = parseFloat(f) || 0), ut.isFunction(t) && (t = t.call(e, n, u)), null != t.top && (c.top = t.top - u.top + i), null != t.left && (c.left = t.left - u.left + s), "using" in t? t.using.call(e, c): o.css(c);
}
}
, ut.fn.extend({
position: function (){
if (this[0]) {
var e, t, n = {
top: 0,
left: 0}
, r = this[0];
return "fixed" === ut.css(r, "position")? t = r.getBoundingClientRect(): (e = this.offsetParent(), t = this.offset(), ut.nodeName(e[0], "html") || (n = e.offset()), n.top += ut.css(e[0], "borderTopWidth", true ), n.left += ut.css(e[0], "borderLeftWidth", true )), {
top: t.top - n.top - ut.css(r, "marginTop", true ),
left: t.left - n.left - ut.css(r, "marginLeft", true )}
;
}
}
,
offsetParent: function (){
return this.map(function (){
for (var e = this.offsetParent || $.documentElement;
e && !ut.nodeName(e, "html") && "static" === ut.css(e, "position"); )e = e.offsetParent;
return e || $.documentElement;
}
);
}
}
), ut.each({
scrollLeft: "pageXOffset",
scrollTop: "pageYOffset"}
, function (e, n){
var r = /Y/.test(n);
ut.fn[e] = function (i){
return ut.access(this, function (e, i, s){
var o = W(e);
return s === t? o? n in o? o[n]: o.document.documentElement[i]: e[i]: (o? o.scrollTo(r? ut(o).scrollLeft(): s, r? s: ut(o).scrollTop()): e[i] = s, t);
}
, e, i, _AN_Read_length("length", arguments), null );
}
;
}
), ut.each({
Height: "height",
Width: "width"}
, function (e, n){
ut.each({
padding: "inner" + e,
content: n,
"": "outer" + e}
, function (r, i){
ut.fn[i] = function (i, s){
var o = _AN_Read_length("length", arguments) && (r || "boolean" != typeof i), u = r || (i === true || s === true ? "margin": "border");
return ut.access(this, function (n, r, i){
var s;
return ut.isWindow(n)? n.document.documentElement["client" + e]: 9 === n.nodeType? (s = n.documentElement, Math.max(n.body["scroll" + e], s["scroll" + e], n.body["offset" + e], s["offset" + e], s["client" + e])): i === t? ut.css(n, r, u): ut.style(n, r, i, u);
}
, n, o? i: t, o, null );
}
;
}
);
}
), e.jQuery = e.$ = ut, "function" == typeof define && define.amd && define.amd.jQuery && define("jquery", [] , function (){
return ut;
}
);
}
)(window), function (){
var e = this, t = e._, n = {
}
, r = Array.prototype, i = Object.prototype, s = Function.prototype, o = r.push, u = r.slice, a = r.concat, f = i.toString, l = i.hasOwnProperty, c = r.forEach, h = r.map, p = r.reduce, d = r.reduceRight, v = r.filter, m = r.every, g = r.some, y = r.indexOf, b = r.lastIndexOf, w = Array.isArray, E = Object.keys, S = s.bind, x = function (e){
if (e instanceof x) return e;
if (!(this instanceof x)) return new x(e);
this._wrapped = e;
}
;
typeof exports != "undefined"? (typeof module != "undefined" && module.exports && (exports = module.exports = x), exports._ = x): e._ = x, x.VERSION = "1.4.4";
var T = x.each = x.forEach = function (e, t, r){
if (e == null ) return ;
if (c && e.forEach === c) e.forEach(t, r);
else if (_AN_Read_length("length", e) === + _AN_Read_length("length", e)) {
for (var i = 0, s = _AN_Read_length("length", e);
i < s; i++ )if (t.call(r, e[i], i, e) === n) return ;
}
else for (var o in e)if (x.has(e, o) && t.call(r, e[o], o, e) === n) return ;
}
;
x.map = x.collect = function (e, t, n){
var r = [] ;
return e == null ? r: h && e.map === h? e.map(t, n): (T(e, function (e, i, s){
r[_AN_Read_length("length", r)] = t.call(n, e, i, s);
}
), r);
}
;
var N = "Reduce of empty array with no initial value";
x.reduce = x.foldl = x.inject = function (e, t, n, r){
var i = _AN_Read_length("length", arguments) > 2;
e == null && (e = [] );
if (p && e.reduce === p) return r && (t = x.bind(t, r)), i? e.reduce(t, n): e.reduce(t);
T(e, function (e, s, o){
i? n = t.call(r, n, e, s, o): (n = e, i = true );
}
);
if (!i) throw new TypeError(N)
return n;
}
, x.reduceRight = x.foldr = function (e, t, n, r){
var i = _AN_Read_length("length", arguments) > 2;
e == null && (e = [] );
if (d && e.reduceRight === d) return r && (t = x.bind(t, r)), i? e.reduceRight(t, n): e.reduceRight(t);
var s = _AN_Read_length("length", e);
if (s !== + s) {
var o = x.keys(e);
s = _AN_Read_length("length", o);
}
T(e, function (u, a, f){
a = o? o[--s]: --s, i? n = t.call(r, n, e[a], a, f): (n = e[a], i = true );
}
);
if (!i) throw new TypeError(N)
return n;
}
, x.find = x.detect = function (e, t, n){
var r;
return C(e, function (e, i, s){
if (t.call(n, e, i, s)) return r = e, true ;
}
), r;
}
, _AN_Write_filter("filter", x, false , x.select = function (e, t, n){
var r = [] ;
return e == null ? r: v && e.filter === v? e.filter(t, n): (T(e, function (e, i, s){
t.call(n, e, i, s) && (r[_AN_Read_length("length", r)] = e);
}
), r);
}
), x.reject = function (e, t, n){
return x.filter(e, function (e, r, i){
return !t.call(n, e, r, i);
}
, n);
}
, x.every = x.all = function (e, t, r){
t || (t = x.identity);
var i = true ;
return e == null ? i: m && e.every === m? e.every(t, r): (T(e, function (e, s, o){
if (!(i = i && t.call(r, e, s, o))) return n;
}
), !!i);
}
;
var C = x.some = x.any = function (e, t, r){
t || (t = x.identity);
var i = false ;
return e == null ? i: g && e.some === g? e.some(t, r): (T(e, function (e, s, o){
if (i || (i = t.call(r, e, s, o))) return n;
}
), !!i);
}
;
x.contains = x.include = function (e, t){
return e == null ? false : y && e.indexOf === y? e.indexOf(t) != -1: C(e, function (e){
return e === t;
}
);
}
, x.invoke = function (e, t){
var n = u.call(arguments, 2), r = x.isFunction(t);
return x.map(e, function (e){
return (r? t: e[t]).apply(e, n);
}
);
}
, x.pluck = function (e, t){
return x.map(e, function (e){
return e[t];
}
);
}
, x.where = function (e, t, n){
return x.isEmpty(t)? n? null : [] : x[n? "find": "filter"](e, function (e){
for (var n in t)if (t[n] !== e[n]) return false ;
return true ;
}
);
}
, x.findWhere = function (e, t){
return x.where(e, t, true );
}
, x.max = function (e, t, n){
if (!t && x.isArray(e) && e[0] === + e[0] && _AN_Read_length("length", e) < 65535) return Math.max.apply(Math, e);
if (!t && x.isEmpty(e)) return - Infinity;
var r = {
computed: - Infinity,
value: - Infinity}
;
return T(e, function (e, i, s){
var o = t? t.call(n, e, i, s): e;
o >= r.computed && (r = {
value: e,
computed: o}
);
}
), r.value;
}
, x.min = function (e, t, n){
if (!t && x.isArray(e) && e[0] === + e[0] && _AN_Read_length("length", e) < 65535) return Math.min.apply(Math, e);
if (!t && x.isEmpty(e)) return Infinity;
var r = {
computed: Infinity,
value: Infinity}
;
return T(e, function (e, i, s){
var o = t? t.call(n, e, i, s): e;
o < r.computed && (r = {
value: e,
computed: o}
);
}
), r.value;
}
, x.shuffle = function (e){
var t, n = 0, r = [] ;
return T(e, function (e){
t = x.random(n++ ), r[n - 1] = r[t], r[t] = e;
}
), r;
}
;
var k = function (e){
return x.isFunction(e)? e: function (t){
return t[e];
}
;
}
;
x.sortBy = function (e, t, n){
var r = k(t);
return x.pluck(x.map(e, function (e, t, i){
return {
value: e,
index: t,
criteria: r.call(n, e, t, i)}
;
}
).sort(function (e, t){
var n = e.criteria, r = t.criteria;
if (n !== r) {
if (n > r || n === void 0) return 1;
if (n < r || r === void 0) return -1;
}
return e.index < t.index? -1: 1;
}
), "value");
}
;
var L = function (e, t, n, r){
var i = {
}
, s = k(t || x.identity);
return T(e, function (t, o){
var u = s.call(n, t, o, e);
r(i, u, t);
}
), i;
}
;
x.groupBy = function (e, t, n){
return L(e, t, n, function (e, t, n){
(x.has(e, t)? e[t]: e[t] = [] ).push(n);
}
);
}
, x.countBy = function (e, t, n){
return L(e, t, n, function (e, t){
x.has(e, t) || (e[t] = 0), e[t]++ ;
}
);
}
, x.sortedIndex = function (e, t, n, r){
n = n == null ? x.identity: k(n);
var i = n.call(r, t), s = 0, o = _AN_Read_length("length", e);
while (s < o){
var u = s + o >>> 1;
n.call(r, e[u]) < i? s = u + 1: o = u;
}
return s;
}
, x.toArray = function (e){
return e? x.isArray(e)? u.call(e): _AN_Read_length("length", e) === + _AN_Read_length("length", e)? x.map(e, x.identity): x.values(e): [] ;
}
, x.size = function (e){
return e == null ? 0: _AN_Read_length("length", e) === + _AN_Read_length("length", e)? _AN_Read_length("length", e): _AN_Read_length("length", x.keys(e));
}
, x.first = x.head = x.take = function (e, t, n){
return e == null ? void 0: t != null && !n? u.call(e, 0, t): e[0];
}
, x.initial = function (e, t, n){
return u.call(e, 0, _AN_Read_length("length", e) - (t == null || n? 1: t));
}
, x.last = function (e, t, n){
return e == null ? void 0: t != null && !n? u.call(e, Math.max(_AN_Read_length("length", e) - t, 0)): e[_AN_Read_length("length", e) - 1];
}
, x.rest = x.tail = x.drop = function (e, t, n){
return u.call(e, t == null || n? 1: t);
}
, x.compact = function (e){
return x.filter(e, x.identity);
}
;
var A = function (e, t, n){
return T(e, function (e){
x.isArray(e)? t? o.apply(n, e): A(e, t, n): n.push(e);
}
), n;
}
;
x.flatten = function (e, t){
return A(e, t, [] );
}
, x.without = function (e){
return x.difference(e, u.call(arguments, 1));
}
, x.uniq = x.unique = function (e, t, n, r){
x.isFunction(t) && (r = n, n = t, t = false );
var i = n? x.map(e, n, r): e, s = [] , o = [] ;
return T(i, function (n, r){
if (t? !r || o[_AN_Read_length("length", o) - 1] !== n: !x.contains(o, n)) o.push(n), s.push(e[r]);
}
), s;
}
, x.union = function (){
return x.uniq(a.apply(r, arguments));
}
, x.intersection = function (e){
var t = u.call(arguments, 1);
return x.filter(x.uniq(e), function (e){
return x.every(t, function (t){
return x.indexOf(t, e) >= 0;
}
);
}
);
}
, x.difference = function (e){
var t = a.apply(r, u.call(arguments, 1));
return x.filter(e, function (e){
return !x.contains(t, e);
}
);
}
, x.zip = function (){
var e = u.call(arguments), t = x.max(x.pluck(e, "length")), n = new Array(t);
for (var r = 0;
r < t; r++ )n[r] = x.pluck(e, "" + r);
return n;
}
, x.object = function (e, t){
if (e == null ) return {
}
;
var n = {
}
;
for (var r = 0, i = _AN_Read_length("length", e);
r < i; r++ )t? n[e[r]] = t[r]: n[e[r][0]] = e[r][1];
return n;
}
, x.indexOf = function (e, t, n){
if (e == null ) return -1;
var r = 0, i = _AN_Read_length("length", e);
if (n) {
if (typeof n != "number") return r = x.sortedIndex(e, t), e[r] === t? r: -1;
r = n < 0? Math.max(0, i + n): n;
}
if (y && e.indexOf === y) return e.indexOf(t, n);
for (; r < i; r++ )if (e[r] === t) return r;
return -1;
}
, x.lastIndexOf = function (e, t, n){
if (e == null ) return -1;
var r = n != null ;
if (b && e.lastIndexOf === b) return r? e.lastIndexOf(t, n): e.lastIndexOf(t);
var i = r? n: _AN_Read_length("length", e);
while (i-- )if (e[i] === t) return i;
return -1;
}
, x.range = function (e, t, n){
_AN_Read_length("length", arguments) <= 1 && (t = e || 0, e = 0), n = arguments[2] || 1;
var r = Math.max(Math.ceil((t - e) / n), 0), i = 0, s = new Array(r);
while (i < r)s[i++ ] = e, e += n;
return s;
}
, x.bind = function (e, t){
if (e.bind === S && S) return S.apply(e, u.call(arguments, 1));
var n = u.call(arguments, 2);
return function (){
return e.apply(t, n.concat(u.call(arguments)));
}
;
}
, x.partial = function (e){
var t = u.call(arguments, 1);
return function (){
return e.apply(this, t.concat(u.call(arguments)));
}
;
}
, x.bindAll = function (e){
var t = u.call(arguments, 1);
return _AN_Read_length("length", t) === 0 && (t = x.functions(e)), T(t, function (t){
e[t] = x.bind(e[t], e);
}
), e;
}
, x.memoize = function (e, t){
var n = {
}
;
return t || (t = x.identity), function (){
var r = t.apply(this, arguments);
return x.has(n, r)? n[r]: n[r] = e.apply(this, arguments);
}
;
}
, x.delay = function (e, t){
var n = u.call(arguments, 2);
return _AN_Call_settimeout("setTimeout", window, function (){
return e.apply(null , n);
}
, t);
}
, x.defer = function (e){
return x.delay.apply(x, [e, 1] .concat(u.call(arguments, 1)));
}
, x.throttle = function (e, t){
var n, r, i, s, o = 0, u = function (){
o = new Date(), i = null , s = e.apply(n, r);
}
;
return function (){
var a = new Date(), f = t - (a - o);
return n = this, r = arguments, f <= 0? (clearTimeout(i), i = null , o = a, s = e.apply(n, r)): i || (i = _AN_Call_settimeout("setTimeout", window, u, f)), s;
}
;
}
, x.debounce = function (e, t, n){
var r, i;
return function (){
var s = this, o = arguments, u = function (){
r = null , n || (i = e.apply(s, o));
}
, a = n && !r;
return clearTimeout(r), r = _AN_Call_settimeout("setTimeout", window, u, t), a && (i = e.apply(s, o)), i;
}
;
}
, x.once = function (e){
var t = false , n;
return function (){
return t? n: (t = true , n = e.apply(this, arguments), e = null , n);
}
;
}
, x.wrap = function (e, t){
return function (){
var n = [e] ;
return o.apply(n, arguments), t.apply(this, n);
}
;
}
, x.compose = function (){
var e = arguments;
return function (){
var t = arguments;
for (var n = _AN_Read_length("length", e) - 1;
n >= 0; n-- )t = [e[n].apply(this, t)] ;
return t[0];
}
;
}
, x.after = function (e, t){
return e <= 0? t(): function (){
if (--e < 1) return t.apply(this, arguments);
}
;
}
, x.keys = E || function (e){
if (e !== Object(e)) throw new TypeError("Invalid object")
var t = [] ;
for (var n in e)x.has(e, n) && (t[_AN_Read_length("length", t)] = n);
return t;
}
, x.values = function (e){
var t = [] ;
for (var n in e)x.has(e, n) && t.push(e[n]);
return t;
}
, x.pairs = function (e){
var t = [] ;
for (var n in e)x.has(e, n) && t.push([n, e[n]] );
return t;
}
, x.invert = function (e){
var t = {
}
;
for (var n in e)x.has(e, n) && (t[e[n]] = n);
return t;
}
, x.functions = x.methods = function (e){
var t = [] ;
for (var n in e)x.isFunction(e[n]) && t.push(n);
return t.sort();
}
, x.extend = function (e){
return T(u.call(arguments, 1), function (t){
if (t) for (var n in t)e[n] = t[n];
}
), e;
}
, x.pick = function (e){
var t = {
}
, n = a.apply(r, u.call(arguments, 1));
return T(n, function (n){
n in e && (t[n] = e[n]);
}
), t;
}
, x.omit = function (e){
var t = {
}
, n = a.apply(r, u.call(arguments, 1));
for (var i in e)x.contains(n, i) || (t[i] = e[i]);
return t;
}
, x.defaults = function (e){
return T(u.call(arguments, 1), function (t){
if (t) for (var n in t)e[n] == null && (e[n] = t[n]);
}
), e;
}
, x.clone = function (e){
return x.isObject(e)? x.isArray(e)? e.slice(): x.extend({
}
, e): e;
}
, x.tap = function (e, t){
return t(e), e;
}
;
var O = function (e, t, n, r){
if (e === t) return e !== 0 || 1 / e == 1 / t;
if (e == null || t == null ) return e === t;
e instanceof x && (e = e._wrapped), t instanceof x && (t = t._wrapped);
var i = f.call(e);
if (i != f.call(t)) return false ;
switch (i){
case "[object String]": return e == String(t);
case "[object Number]": return e != + e? t != + t: e == 0? 1 / e == 1 / t: e == + t;
case "[object Date]": case "[object Boolean]": return + e == + t;
case "[object RegExp]": return e.source == t.source && e.global == t.global && e.multiline == t.multiline && e.ignoreCase == t.ignoreCase;
}
if (typeof e != "object" || typeof t != "object") return false ;
var s = _AN_Read_length("length", n);
while (s-- )if (n[s] == e) return r[s] == t;
n.push(e), r.push(t);
var o = 0, u = true ;
if (i == "[object Array]") {
o = _AN_Read_length("length", e), u = o == _AN_Read_length("length", t);
if (u) while (o-- )if (!(u = O(e[o], t[o], n, r))) break ;
}
else {
var a = e.constructor, l = t.constructor;
if (a !== l && !(x.isFunction(a) && a instanceof a && x.isFunction(l) && l instanceof l)) return false ;
for (var c in e)if (x.has(e, c)) {
o++ ;
if (!(u = x.has(t, c) && O(e[c], t[c], n, r))) break ;
}
if (u) {
for (c in t)if (x.has(t, c) && !(o-- )) break ;
u = !o;
}
}
return n.pop(), r.pop(), u;
}
;
x.isEqual = function (e, t){
return O(e, t, [] , [] );
}
, x.isEmpty = function (e){
if (e == null ) return true ;
if (x.isArray(e) || x.isString(e)) return _AN_Read_length("length", e) === 0;
for (var t in e)if (x.has(e, t)) return false ;
return true ;
}
, x.isElement = function (e){
return !!e && e.nodeType === 1;
}
, x.isArray = w || function (e){
return f.call(e) == "[object Array]";
}
, x.isObject = function (e){
return e === Object(e);
}
, T(["Arguments", "Function", "String", "Number", "Date", "RegExp"] , function (e){
x["is" + e] = function (t){
return f.call(t) == "[object " + e + "]";
}
;
}
), x.isArguments(arguments) || (x.isArguments = function (e){
return !!e && !!x.has(e, "callee");
}
), typeof /./ != "function" && (x.isFunction = function (e){
return typeof e == "function";
}
), x.isFinite = function (e){
return isFinite(e) && !isNaN(parseFloat(e));
}
, x.isNaN = function (e){
return x.isNumber(e) && e != + e;
}
, x.isBoolean = function (e){
return e === true || e === false || f.call(e) == "[object Boolean]";
}
, x.isNull = function (e){
return e === null ;
}
, x.isUndefined = function (e){
return e === void 0;
}
, x.has = function (e, t){
return l.call(e, t);
}
, x.noConflict = function (){
return e._ = t, this;
}
, x.identity = function (e){
return e;
}
, x.times = function (e, t, n){
var r = Array(e);
for (var i = 0;
i < e; i++ )r[i] = t.call(n, i);
return r;
}
, x.random = function (e, t){
return t == null && (t = e, e = 0), e + Math.floor(Math.random() * (t - e + 1));
}
;
var M = {
escape: {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"/": "/"}
}
;
M.unescape = x.invert(M.escape);
var _ = {
escape: new RegExp("[" + x.keys(M.escape).join("") + "]", "g"),
unescape: new RegExp("(" + x.keys(M.unescape).join("|") + ")", "g")}
;
x.each(["escape", "unescape"] , function (e){
x[e] = function (t){
return t == null ? "": _AN_Call_replace("replace", ("" + t), _[e], function (t){
return M[e][t];
}
);
}
;
}
), x.result = function (e, t){
if (e == null ) return null ;
var n = e[t];
return x.isFunction(n)? n.call(e): n;
}
, x.mixin = function (e){
T(x.functions(e), function (t){
var n = x[t] = e[t];
x.prototype[t] = function (){
var e = [this._wrapped] ;
return o.apply(e, arguments), j.call(this, n.apply(x, e));
}
;
}
);
}
;
var D = 0;
x.uniqueId = function (e){
var t = ++D + "";
return e? e + t: t;
}
, x.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g}
;
var P = /(.)^/, H = {
"'": "'",
"\\": "\\",
"\r": "r",
"\n": "n",
" ": "t",
"\u2028": "u2028",
"\u2029": "u2029"}
, B = /\\|'|\r|\n|\t|\u2028|\u2029/g;
x.template = function (e, t, n){
var r;
n = x.defaults({
}
, n, x.templateSettings);
var i = new RegExp([(n.escape || P).source, (n.interpolate || P).source, (n.evaluate || P).source] .join("|") + "|$", "g"), s = 0, o = "__p+='";
_AN_Call_replace("replace", e, i, function (t, n, r, i, u){
return o += _AN_Call_replace("replace", e.slice(s, u), B, function (e){
return "\\" + H[e];
}
), n && (o += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'"), r && (o += "'+\n((__t=(" + r + "))==null?'':__t)+\n'"), i && (o += "';\n" + i + "\n__p+='"), s = u + _AN_Read_length("length", t), t;
}
), o += "';\n", n.variable || (o = "with(obj||{}){\n" + o + "}\n"), o = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + o + "return __p;\n";
try {
r = new Function(n.variable || "obj", "_", o);
}
catch (u) {
throw u.source = o, u
}
if (t) return r(t, x);
var a = function (e){
return r.call(this, e, x);
}
;
return a.source = "function(" + (n.variable || "obj") + "){\n" + o + "}", a;
}
, x.chain = function (e){
return x(e).chain();
}
;
var j = function (e){
return this._chain? x(e).chain(): e;
}
;
x.mixin(x), T(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"] , function (e){
var t = r[e];
x.prototype[e] = function (){
var n = this._wrapped;
return t.apply(n, arguments), (e == "shift" || e == "splice") && _AN_Read_length("length", n) === 0 && delete n[0], j.call(this, n);
}
;
}
), T(["concat", "join", "slice"] , function (e){
var t = r[e];
x.prototype[e] = function (){
return j.call(this, t.apply(this._wrapped, arguments));
}
;
}
), x.extend(x.prototype, {
chain: function (){
return this._chain = true , this;
}
,
value: function (){
return this._wrapped;
}
}
);
}
.call(this), define("underscore", function (e){
return function (){
var t, n;
return t || e._;
}
;
}
(this)), function (){
var e = this, t = e.Backbone, n = Array.prototype.slice, r = Array.prototype.splice, i;
typeof exports != "undefined"? i = exports: i = e.Backbone = {
}
, i.VERSION = "0.9.2";
var s = e._;
!s && typeof require != "undefined" && (s = require("underscore"));
var o = e.jQuery || e.Zepto || e.ender;
i.setDomLibrary = function (e){
o = e;
}
, i.noConflict = function (){
return e.Backbone = t, this;
}
, i.emulateHTTP = false , i.emulateJSON = false ;
var u = /\s+/, a = i.Events = {
on: function (e, t, n){
var r, i, s, o, a;
if (!t) return this;
e = e.split(u), r = this._callbacks || (this._callbacks = {
}
);
while (i = e.shift())a = r[i], s = a? a.tail: {
}
, s.next = o = {
}
, s.context = n, s.callback = t, r[i] = {
tail: o,
next: a? a.next: s}
;
return this;
}
,
off: function (e, t, n){
var r, i, o, a, f, l;
if (!(i = this._callbacks)) return ;
if (!(e || t || n)) return delete this._callbacks, this;
e = e? e.split(u): s.keys(i);
while (r = e.shift()){
o = i[r], delete i[r];
if (!o || !t && !n) continue ;
a = o.tail;
while ((o = o.next) !== a)f = o.callback, l = o.context, (t && f !== t || n && l !== n) && this.on(r, f, l);
}
return this;
}
,
trigger: function (e){
var t, r, i, s, o, a, f;
if (!(i = this._callbacks)) return this;
a = i.all, e = e.split(u), f = n.call(arguments, 1);
while (t = e.shift()){
if (r = i[t]) {
s = r.tail;
while ((r = r.next) !== s)r.callback.apply(r.context || this, f);
}
if (r = a) {
s = r.tail, o = [t] .concat(f);
while ((r = r.next) !== s)r.callback.apply(r.context || this, o);
}
}
return this;
}
}
;
a.bind = a.on, a.unbind = a.off;
var f = i.Model = function (e, t){
var n;
e || (e = {
}
), t && t.parse && (e = this.parse(e));
if (n = C(this, "defaults")) e = s.extend({
}
, n, e);
t && t.collection && (this.collection = t.collection), this.attributes = {
}
, this._escapedAttributes = {
}
, this.cid = s.uniqueId("c"), this.changed = {
}
, this._silent = {
}
, this._pending = {
}
, this.set(e, {
silent: true }
), this.changed = {
}
, this._silent = {
}
, this._pending = {
}
, this._previousAttributes = s.clone(this.attributes), this.initialize.apply(this, arguments);
}
;
s.extend(f.prototype, a, {
changed: null ,
_silent: null ,
_pending: null ,
idAttribute: "id",
initialize: function (){
}
,
toJSON: function (e){
return s.clone(this.attributes);
}
,
get: function (e){
return this.attributes[e];
}
,
escape: function (e){
var t;
if (t = this._escapedAttributes[e]) return t;
var n = this.get(e);
return this._escapedAttributes[e] = s.escape(n == null ? "": "" + n);
}
,
has: function (e){
return this.get(e) != null ;
}
,
set: function (e, t, n){
var r, i, o;
s.isObject(e) || e == null ? (r = e, n = t): (r = {
}
, r[e] = t), n || (n = {
}
);
if (!r) return this;
r instanceof f && (r = r.attributes);
if (n.unset) for (i in r)r[i] = void 0;
if (!this._validate(r, n)) return false ;
this.idAttribute in r && (this.id = r[this.idAttribute]);
var u = n.changes = {
}
, a = this.attributes, l = this._escapedAttributes, c = this._previousAttributes || {
}
;
for (i in r){
o = r[i];
if (!s.isEqual(a[i], o) || n.unset && s.has(a, i)) delete l[i], (n.silent? this._silent: u)[i] = true ;
n.unset? delete a[i]: a[i] = o, !s.isEqual(c[i], o) || s.has(a, i) != s.has(c, i)? (this.changed[i] = o, n.silent || (this._pending[i] = true )): (delete this.changed[i], delete this._pending[i]);
}
return n.silent || this.change(n), this;
}
,
unset: function (e, t){
return (t || (t = {
}
)).unset = true , this.set(e, null , t);
}
,
clear: function (e){
return (e || (e = {
}
)).unset = true , this.set(s.clone(this.attributes), e);
}
,
fetch: function (e){
e = e? s.clone(e): {
}
;
var t = this, n = e.success;
return e.success = function (r, i, s){
if (!t.set(t.parse(r, s), e)) return false ;
n && n(t, r);
}
, e.error = i.wrapError(e.error, t, e), (this.sync || i.sync).call(this, "read", this, e);
}
,
save: function (e, t, n){
var r, o;
s.isObject(e) || e == null ? (r = e, n = t): (r = {
}
, r[e] = t), n = n? s.clone(n): {
}
;
if (n.wait) {
if (!this._validate(r, n)) return false ;
o = s.clone(this.attributes);
}
var u = s.extend({
}
, n, {
silent: true }
);
if (r && !this.set(r, n.wait? u: n)) return false ;
var a = this, f = n.success;
n.success = function (e, t, i){
var o = a.parse(e, i);
n.wait && (delete n.wait, o = s.extend(r || {
}
, o));
if (!a.set(o, n)) return false ;
f? f(a, e): a.trigger("sync", a, e, n);
}
, n.error = i.wrapError(n.error, a, n);
var l = this.isNew()? "create": "update", c = (this.sync || i.sync).call(this, l, this, n);
return n.wait && this.set(o, u), c;
}
,
destroy: function (e){
e = e? s.clone(e): {
}
;
var t = this, n = e.success, r = function (){
t.trigger("destroy", t, t.collection, e);
}
;
if (this.isNew()) return r(), false ;
e.success = function (i){
e.wait && r(), n? n(t, i): t.trigger("sync", t, i, e);
}
, e.error = i.wrapError(e.error, t, e);
var o = (this.sync || i.sync).call(this, "delete", this, e);
return e.wait || r(), o;
}
,
url: function (){
var e = C(this, "urlRoot") || C(this.collection, "url") || k();
return this.isNew()? e: e + (e.charAt(_AN_Read_length("length", e) - 1) == "/"? "": "/") + encodeURIComponent(this.id);
}
,
parse: function (e, t){
return e;
}
,
clone: function (){
return new this.constructor(this.attributes);
}
,
isNew: function (){
return this.id == null ;
}
,
change: function (e){
e || (e = {
}
);
var t = this._changing;
this._changing = true ;
for (var n in this._silent)this._pending[n] = true ;
var r = s.extend({
}
, e.changes, this._silent);
this._silent = {
}
;
for (var n in r)this.trigger("change:" + n, this, this.get(n), e);
if (t) return this;
while (!s.isEmpty(this._pending)){
this._pending = {
}
, this.trigger("change", this, e);
for (var n in this.changed){
if (this._pending[n] || this._silent[n]) continue ;
delete this.changed[n];
}
this._previousAttributes = s.clone(this.attributes);
}
return this._changing = false , this;
}
,
hasChanged: function (e){
return _AN_Read_length("length", arguments)? s.has(this.changed, e): !s.isEmpty(this.changed);
}
,
changedAttributes: function (e){
if (!e) return this.hasChanged()? s.clone(this.changed): false ;
var t, n = false , r = this._previousAttributes;
for (var i in e){
if (s.isEqual(r[i], t = e[i])) continue ;
(n || (n = {
}
))[i] = t;
}
return n;
}
,
previous: function (e){
return !_AN_Read_length("length", arguments) || !this._previousAttributes? null : this._previousAttributes[e];
}
,
previousAttributes: function (){
return s.clone(this._previousAttributes);
}
,
isValid: function (){
return !this.validate(this.attributes);
}
,
_validate: function (e, t){
if (t.silent || !this.validate) return true ;
e = s.extend({
}
, this.attributes, e);
var n = this.validate(e, t);
return n? (t && t.error? t.error(this, n, t): this.trigger("error", this, n, t), false ): true ;
}
}
);
var l = i.Collection = function (e, t){
t || (t = {
}
), t.model && (this.model = t.model), t.comparator && (this.comparator = t.comparator), this._reset(), this.initialize.apply(this, arguments), e && this.reset(e, {
silent: true ,
parse: t.parse}
);
}
;
s.extend(l.prototype, a, {
model: f,
initialize: function (){
}
,
toJSON: function (e){
return this.map(function (t){
return t.toJSON(e);
}
);
}
,
add: function (e, t){
var n, i, o, u, a, f, l = {
}
, c = {
}
, h = [] ;
t || (t = {
}
), e = s.isArray(e)? e.slice(): [e] ;
for (n = 0, o = _AN_Read_length("length", e); n < o; n++ ){
if (!(u = e[n] = this._prepareModel(e[n], t))) throw new Error("Can't add an invalid model to a collection")
a = u.cid, f = u.id;
if (l[a] || this._byCid[a] || f != null && (c[f] || this._byId[f])) {
h.push(n);
continue ;
}
l[a] = c[f] = u;
}
n = _AN_Read_length("length", h);
while (n-- )e.splice(h[n], 1);
for (n = 0, o = _AN_Read_length("length", e); n < o; n++ )(u = e[n]).on("all", this._onModelEvent, this), this._byCid[u.cid] = u, u.id != null && (this._byId[u.id] = u);
this.length += o, i = t.at != null ? t.at: _AN_Read_length("length", this.models), r.apply(this.models, [i, 0] .concat(e)), this.comparator && this.sort({
silent: true }
);
if (t.silent) return this;
for (n = 0, o = _AN_Read_length("length", this.models); n < o; n++ ){
if (!l[(u = this.models[n]).cid]) continue ;
t.index = n, u.trigger("add", u, this, t);
}
return this;
}
,
remove: function (e, t){
var n, r, i, o;
t || (t = {
}
), e = s.isArray(e)? e.slice(): [e] ;
for (n = 0, r = _AN_Read_length("length", e); n < r; n++ ){
o = this.getByCid(e[n]) || this.get(e[n]);
if (!o) continue ;
delete this._byId[o.id], delete this._byCid[o.cid], i = this.indexOf(o), this.models.splice(i, 1), this.length-- , t.silent || (t.index = i, o.trigger("remove", o, this, t)), this._removeReference(o);
}
return this;
}
,
push: function (e, t){
return e = this._prepareModel(e, t), this.add(e, t), e;
}
,
pop: function (e){
var t = this.at(_AN_Read_length("length", this) - 1);
return this.remove(t, e), t;
}
,
unshift: function (e, t){
return e = this._prepareModel(e, t), this.add(e, s.extend({
at: 0}
, t)), e;
}
,
shift: function (e){
var t = this.at(0);
return this.remove(t, e), t;
}
,
get: function (e){
return e == null ? void 0: this._byId[e.id != null ? e.id: e];
}
,
getByCid: function (e){
return e && this._byCid[e.cid || e];
}
,
at: function (e){
return this.models[e];
}
,
where: function (e){
return s.isEmpty(e)? [] : this.filter(function (t){
for (var n in e)if (e[n] !== t.get(n)) return false ;
return true ;
}
);
}
,
sort: function (e){
e || (e = {
}
);
if (!this.comparator) throw new Error("Cannot sort a set without a comparator")
var t = s.bind(this.comparator, this);
return _AN_Read_length("length", this.comparator) == 1? this.models = this.sortBy(t): this.models.sort(t), e.silent || this.trigger("reset", this, e), this;
}
,
pluck: function (e){
return s.map(this.models, function (t){
return t.get(e);
}
);
}
,
reset: function (e, t){
e || (e = [] ), t || (t = {
}
);
for (var n = 0, r = _AN_Read_length("length", this.models);
n < r; n++ )this._removeReference(this.models[n]);
return this._reset(), this.add(e, s.extend({
silent: true }
, t)), t.silent || this.trigger("reset", this, t), this;
}
,
fetch: function (e){
e = e? s.clone(e): {
}
, e.parse === undefined && (e.parse = true );
var t = this, n = e.success;
return e.success = function (r, i, s){
t[e.add? "add": "reset"](t.parse(r, s), e), n && n(t, r);
}
, e.error = i.wrapError(e.error, t, e), (this.sync || i.sync).call(this, "read", this, e);
}
,
create: function (e, t){
var n = this;
t = t? s.clone(t): {
}
, e = this._prepareModel(e, t);
if (!e) return false ;
t.wait || n.add(e, t);
var r = t.success;
return t.success = function (i, s, o){
t.wait && n.add(i, t), r? r(i, s): i.trigger("sync", e, s, t);
}
, e.save(null , t), e;
}
,
parse: function (e, t){
return e;
}
,
chain: function (){
return s(this.models).chain();
}
,
_reset: function (e){
this.length = 0, this.models = [] , this._byId = {
}
, this._byCid = {
}
;
}
,
_prepareModel: function (e, t){
t || (t = {
}
);
if (e instanceof f) e.collection || (e.collection = this);
else {
var n = e;
t.collection = this, e = new this.model(n, t), e._validate(e.attributes, t) || (e = false );
}
return e;
}
,
_removeReference: function (e){
this == e.collection && delete e.collection, e.off("all", this._onModelEvent, this);
}
,
_onModelEvent: function (e, t, n, r){
if ((e == "add" || e == "remove") && n != this) return ;
e == "destroy" && this.remove(t, r), t && e === "change:" + t.idAttribute && (delete this._byId[t.previous(t.idAttribute)], this._byId[t.id] = t), this.trigger.apply(this, arguments);
}
}
);
var c = ["forEach", "each", "map", "reduce", "reduceRight", "find", "detect", "filter", "select", "reject", "every", "all", "some", "any", "include", "contains", "invoke", "max", "min", "sortBy", "sortedIndex", "toArray", "size", "first", "initial", "rest", "last", "without", "indexOf", "shuffle", "lastIndexOf", "isEmpty", "groupBy"] ;
s.each(c, function (e){
l.prototype[e] = function (){
return s[e].apply(s, [this.models] .concat(s.toArray(arguments)));
}
;
}
);
var h = i.Router = function (e){
e || (e = {
}
), e.routes && (this.routes = e.routes), this._bindRoutes(), this.initialize.apply(this, arguments);
}
, p = /:\w+/g, d = /\*\w+/g, v = /[-[\]{}()+?.,\\^$|#\s]/g;
s.extend(h.prototype, a, {
initialize: function (){
}
,
route: function (e, t, n){
return i.history || (i.history = new m()), s.isRegExp(e) || (e = this._routeToRegExp(e)), n || (n = this[t]), i.history.route(e, s.bind(function (r){
var s = this._extractParameters(e, r);
n && n.apply(this, s), this.trigger.apply(this, ["route:" + t] .concat(s)), i.history.trigger("route", this, t, s);
}
, this)), this;
}
,
navigate: function (e, t){
_AN_Call_navigate("navigate", i.history, e, t);
}
,
_bindRoutes: function (){
if (!this.routes) return ;
var e = [] ;
for (var t in this.routes)e.unshift([t, this.routes[t]] );
for (var n = 0, r = _AN_Read_length("length", e);
n < r; n++ )this.route(e[n][0], e[n][1], this[e[n][1]]);
}
,
_routeToRegExp: function (e){
return e = _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", e, v, "\\$&"), p, "([^/]+)"), d, "(.*?)"), new RegExp("^" + e + "$");
}
,
_extractParameters: function (e, t){
return e.exec(t).slice(1);
}
}
);
var m = i.History = function (){
this.handlers = [] , s.bindAll(this, "checkUrl");
}
, g = /^[#\/]/, y = /msie [\w.]+/;
m.started = false , s.extend(m.prototype, a, {
interval: 50,
getHash: function (e){
var t = e? _AN_Read_location("location", e): _AN_Read_location("location", window), n = _AN_Read_href("href", t).match(/#(.*)$/);
return n? n[1]: "";
}
,
getFragment: function (e, t){
if (e == null ) if (this._hasPushState || t) {
e = _AN_Read_pathname("pathname", _AN_Read_location("location", window));
var n = _AN_Read_search("search", _AN_Read_location("location", window));
n && (e += n);
}
else e = this.getHash();
return e.indexOf(this.options.root) || (e = e.substr(_AN_Read_length("length", this.options.root))), _AN_Call_replace("replace", e, g, "");
}
,
start: function (e){
if (m.started) throw new Error("Backbone.history has already been started")
m.started = true , this.options = s.extend({
}
, {
root: "/"}
, this.options, e), this._wantsHashChange = this.options.hashChange !== false , this._wantsPushState = !!this.options.pushState, this._hasPushState = !!(this.options.pushState && window.history && window.history.pushState);
var t = this.getFragment(), n = document.documentMode, r = y.exec(navigator.userAgent.toLowerCase()) && (!n || n <= 7);
r && (this.iframe = o('
').hide().appendTo("body")[0].contentWindow, _AN_Call_navigate("navigate", this, t)), this._hasPushState? o(window).bind("popstate", this.checkUrl): this._wantsHashChange && "onhashchange" in window && !r? o(window).bind("hashchange", this.checkUrl): this._wantsHashChange && (this._checkUrlInterval = _AN_Call_setinterval("setInterval", window, this.checkUrl, this.interval)), this.fragment = t;
var i = _AN_Read_location("location", window), u = _AN_Read_pathname("pathname", i) == this.options.root;
if (this._wantsHashChange && this._wantsPushState && !this._hasPushState && !u) return this.fragment = this.getFragment(null , true ), _AN_Call_replace("replace", _AN_Read_location("location", window), this.options.root + "#" + this.fragment), true ;
this._wantsPushState && this._hasPushState && u && _AN_Read_hash("hash", i) && (this.fragment = _AN_Call_replace("replace", this.getHash(), g, ""), window.history.replaceState({
}
, document.title, _AN_Read_protocol("protocol", i) + "//" + _AN_Read_host("host", i) + this.options.root + this.fragment));
if (!this.options.silent) return _AN_Call_loadurl("loadUrl", this);
}
,
stop: function (){
o(window).unbind("popstate", this.checkUrl).unbind("hashchange", this.checkUrl), clearInterval(this._checkUrlInterval), m.started = false ;
}
,
route: function (e, t){
this.handlers.unshift({
route: e,
callback: t}
);
}
,
checkUrl: function (e){
var t = this.getFragment();
t == this.fragment && this.iframe && (t = this.getFragment(this.getHash(this.iframe)));
if (t == this.fragment) return false ;
this.iframe && _AN_Call_navigate("navigate", this, t), _AN_Call_loadurl("loadUrl", this) || _AN_Call_loadurl("loadUrl", this, this.getHash());
}
,
loadUrl: function (e){
var t = this.fragment = this.getFragment(e), n = s.any(this.handlers, function (e){
if (e.route.test(t)) return e.callback(t), true ;
}
);
return n;
}
,
navigate: function (e, t){
if (!m.started) return false ;
if (!t || t === true ) t = {
trigger: t}
;
var n = _AN_Call_replace("replace", (e || ""), g, "");
if (this.fragment == n) return ;
this._hasPushState? (n.indexOf(this.options.root) != 0 && (n = this.options.root + n), this.fragment = n, window.history[t.replace? "replaceState": "pushState"]({
}
, document.title, n)): this._wantsHashChange? (this.fragment = n, this._updateHash(_AN_Read_location("location", window), n, t.replace), this.iframe && n != this.getFragment(this.getHash(this.iframe)) && (t.replace || _AN_Call_open("open", this.iframe.document).close(), this._updateHash(_AN_Read_location("location", this.iframe), n, t.replace))): _AN_Call_assign("assign", _AN_Read_location("location", window), this.options.root + e), t.trigger && _AN_Call_loadurl("loadUrl", this, e);
}
,
_updateHash: function (e, t, n){
n? _AN_Call_replace("replace", e, _AN_Call_replace("replace", e.toString(), /(javascript:|#).*$/, "") + "#" + t): _AN_Write_hash("hash", e, false , t);
}
}
);
var b = i.View = function (e){
this.cid = s.uniqueId("view"), this._configure(e || {
}
), this._ensureElement(), this.initialize.apply(this, arguments), this.delegateEvents();
}
, w = /^(\S+)\s*(.*)$/, E = ["model", "collection", "el", "id", "attributes", "className", "tagName"] ;
s.extend(b.prototype, a, {
tagName: "div",
$: function (e){
return this.$el.find(e);
}
,
initialize: function (){
}
,
render: function (){
return this;
}
,
remove: function (){
return this.$el.remove(), this;
}
,
make: function (e, t, n){
var r = _AN_Call_createelement("createElement", document, e);
return t && o(r).attr(t), n && o(r).html(n), r;
}
,
setElement: function (e, t){
return this.$el && this.undelegateEvents(), this.$el = e instanceof o? e: o(e), this.el = this.$el[0], t !== false && this.delegateEvents(), this;
}
,
delegateEvents: function (e){
if (!e && !(e = C(this, "events"))) return ;
this.undelegateEvents();
for (var t in e){
var n = e[t];
s.isFunction(n) || (n = this[e[t]]);
if (!n) throw new Error('Method "' + e[t] + '" does not exist')
var r = t.match(w), i = r[1], o = r[2];
n = s.bind(n, this), i += ".delegateEvents" + this.cid, o === ""? this.$el.bind(i, n): this.$el.delegate(o, i, n);
}
}
,
undelegateEvents: function (){
this.$el.unbind(".delegateEvents" + this.cid);
}
,
_configure: function (e){
this.options && (e = s.extend({
}
, this.options, e));
for (var t = 0, n = _AN_Read_length("length", E);
t < n; t++ ){
var r = E[t];
e[r] && (this[r] = e[r]);
}
this.options = e;
}
,
_ensureElement: function (){
if (!this.el) {
var e = C(this, "attributes") || {
}
;
this.id && (e.id = this.id), this.className && (e["class"] = this.className), this.setElement(this.make(this.tagName, e), false );
}
else this.setElement(this.el, false );
}
}
);
var S = function (e, t){
var n = N(this, e, t);
return n.extend = this.extend, n;
}
;
f.extend = l.extend = h.extend = b.extend = S;
var x = {
create: "POST",
update: "PUT",
"delete": "DELETE",
read: "GET"}
;
i.sync = function (e, t, n){
var r = x[e];
n || (n = {
}
);
var u = {
type: r,
dataType: "json"}
;
return _AN_Read_url("url", n) || (_AN_Write_url("url", u, false , C(t, "url") || k())), !n.data && t && (e == "create" || e == "update") && (u.contentType = "application/json", u.data = JSON.stringify(t.toJSON())), i.emulateJSON && (u.contentType = "application/x-www-form-urlencoded", u.data = u.data? {
model: u.data}
: {
}
), i.emulateHTTP && (r === "PUT" || r === "DELETE") && (i.emulateJSON && (u.data._method = r), u.type = "POST", u.beforeSend = function (e){
e.setRequestHeader("X-HTTP-Method-Override", r);
}
), u.type !== "GET" && !i.emulateJSON && (u.processData = false ), o.ajax(s.extend(u, n));
}
, i.wrapError = function (e, t, n){
return function (r, i){
i = r === t? i: r, e? e(t, i, n): t.trigger("error", t, i, n);
}
;
}
;
var T = function (){
}
, N = function (e, t, n){
var r;
return t && t.hasOwnProperty("constructor")? r = t.constructor: r = function (){
e.apply(this, arguments);
}
, s.extend(r, e), T.prototype = e.prototype, r.prototype = new T(), t && s.extend(r.prototype, t), n && s.extend(r, n), r.prototype.constructor = r, r.__super__ = e.prototype, r;
}
, C = function (e, t){
return !e || !e[t]? null : s.isFunction(e[t])? e[t](): e[t];
}
, k = function (){
throw new Error('A "url" property or function must be specified')
}
;
}
.call(this), define("backbone", ["underscore", "jquery"] , function (e){
return function (){
var t, n;
return t || e.Backbone;
}
;
}
(this)), define("models/snippet", ["jquery", "underscore", "backbone"] , function (e, t, n){
return n.Model.extend({
getValues: function (){
return t.reduce(this.get("fields"), function (e, n, r){
return n.type == "select"? e[r] = t.find(n.value, function (e){
return e.selected;
}
).value: e[r] = n.value, e;
}
, {
}
);
}
,
idFriendlyTitle: function (){
return _AN_Call_replace("replace", this.get("title"), /\W/g, "").toLowerCase();
}
,
setField: function (e, t){
var n = this.get("fields");
n[e].value = t, this.set("fields", n);
}
}
);
}
), define("text", ["module"] , function (e){
var t, n, r = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"] , i = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, s = /]*>\s*([\s\S]+)\s*<\/body>/im, o = typeof _AN_Read_location("location", window) != "undefined" && _AN_Read_href("href", _AN_Read_location("location", window)), u = o && _AN_Read_protocol("protocol", _AN_Read_location("location", window)) && _AN_Call_replace("replace", _AN_Read_protocol("protocol", _AN_Read_location("location", window)), /\:/, ""), a = o && _AN_Read_hostname("hostname", _AN_Read_location("location", window)), f = o && (_AN_Read_port("port", _AN_Read_location("location", window)) || undefined), l = [] , c = e.config && e.config() || {
}
;
t = {
version: "2.0.5",
strip: function (e){
if (e) {
e = _AN_Call_replace("replace", e, i, "");
var t = e.match(s);
t && (e = t[1]);
}
else e = "";
return e;
}
,
jsEscape: function (e){
return _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", _AN_Call_replace("replace", e, /(['\\])/g, "\\$1"), /[\f]/g, "\\f"), /[\b]/g, "\\b"), /[\n]/g, "\\n"), /[\t]/g, "\\t"), /[\r]/g, "\\r"), /[\u2028]/g, "\\u2028"), /[\u2029]/g, "\\u2029");
}
,
createXhr: c.createXhr || function (){
var e, t, n;
if (typeof XMLHttpRequest != "undefined") return new XMLHttpRequest();
if (typeof ActiveXObject != "undefined") for (t = 0; t < 3; t += 1){
n = r[t];
try {
e = new ActiveXObject(n);
}
catch (i) {
}
if (e) {
r = [n] ;
break ;
}
}
return e;
}
,
parseName: function (e){
var t, n, r, i = false , s = e.indexOf("."), o = e.indexOf("./") === 0 || e.indexOf("../") === 0;
return s !== -1 && (!o || s > 1)? (t = e.substring(0, s), n = e.substring(s + 1, _AN_Read_length("length", e))): t = e, r = n || t, s = r.indexOf("!"), s !== -1 && (i = r.substring(s + 1) === "strip", r = r.substring(0, s), n? n = r: t = r), {
moduleName: t,
ext: n,
strip: i}
;
}
,
xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
useXhr: function (e, n, r, i){
var s, o, u, a = t.xdRegExp.exec(e);
return a? (s = a[2], o = a[3], o = o.split(":"), u = o[1], o = o[0], (!s || s === n) && (!o || o.toLowerCase() === r.toLowerCase()) && (!u && !o || u === i)): true ;
}
,
finishLoad: function (e, n, r, i){
r = n? t.strip(r): r, c.isBuild && (l[e] = r), i(r);
}
,
load: function (e, n, r, i){
if (i.isBuild && !i.inlineText) {
r();
return ;
}
c.isBuild = i.isBuild;
var s = t.parseName(e), l = s.moduleName + (s.ext? "." + s.ext: ""), h = n.toUrl(l), p = c.useXhr || t.useXhr;
!o || p(h, u, a, f)? t.get(h, function (n){
t.finishLoad(e, s.strip, n, r);
}
, function (e){
r.error && r.error(e);
}
): n([l] , function (e){
t.finishLoad(s.moduleName + "." + s.ext, s.strip, e, r);
}
);
}
,
write: function (e, n, r, i){
if (l.hasOwnProperty(n)) {
var s = t.jsEscape(l[n]);
r.asModule(e + "!" + n, "define(function () { return '" + s + "';});\n");
}
}
,
writeFile: function (e, n, r, i, s){
var o = t.parseName(n), u = o.ext? "." + o.ext: "", a = o.moduleName + u, f = r.toUrl(o.moduleName + u) + ".js";
_AN_Call_load("load", t, a, r, function (n){
var r = function (e){
return i(f, e);
}
;
r.asModule = function (e, t){
return i.asModule(e, f, t);
}
, _AN_Call_write("write", t, e, a, r, s);
}
, s);
}
}
;
if (c.env === "node" || !c.env && typeof process != "undefined" && process.versions && !!process.versions.node) n = require.nodeRequire("fs"), t.get = function (e, t){
var r = n.readFileSync(e, "utf8");
r.indexOf("") === 0 && (r = r.substring(1)), t(r);
}
;
else if (c.env === "xhr" || !c.env && t.createXhr()) t.get = function (e, n, r, i){
var s = t.createXhr(), o;
_AN_Call_open("open", s, "GET", e, true );
if (i) for (o in i)i.hasOwnProperty(o) && s.setRequestHeader(o.toLowerCase(), i[o]);
c.onXhr && c.onXhr(s, e), s.onreadystatechange = function (t){
var i, o;
s.readyState === 4 && (i = s.status, i > 399 && i < 600? (o = new Error(e + " HTTP status: " + i), o.xhr = s, r(o)): n(s.responseText));
}
, _AN_Call_send("send", s, null );
}
;
else if (c.env === "rhino" || !c.env && typeof Packages != "undefined" && typeof java != "undefined") t.get = function (e, t){
var n, r, i = "utf-8", s = new java.io.File(e), o = java.lang.System.getProperty("line.separator"), u = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s), i)), a = "";
try {
n = new java.lang.StringBuffer(), r = u.readLine(), r && r.length() && r.charAt(0) === 65279 && (r = r.substring(1)), n.append(r);
while ((r = u.readLine()) !== null )n.append(o), n.append(r);
a = String(n.toString());
}
finally{
u.close();
}
t(a);
}
;
return t;
}
), define("text!templates/popover/popover-main.html", [] , function (){
return '
\n';
}
), define("text!templates/popover/popover-input.html", [] , function (){
return "
<%= label %> \n
\" type='text' name='<%= name %>' id='<%= name %>' value ='<%= value %>' />\n";
}
), define("text!templates/popover/popover-select.html", [] , function (){
return '
<%= label %> \n
\'>\n<% _.each(value, function(v,k){ %>\n " <% if (v["selected"]){ %> selected <% } %> ><%= v["label"] %> \n<% }); %>\n \n';
}
), define("text!templates/popover/popover-textarea.html", [] , function (){
return "
<%= label %> \n
\n";
}
), define("text!templates/popover/popover-textarea-split.html", [] , function (){
return "
<%= label %> \n
\n";
}
), define("text!templates/popover/popover-checkbox.html", [] , function (){
return '
\n checked="checked" <% } %>>\n <%= label %>\n \n';
}
), define("text!templates/snippet/formname.html", [] , function (){
return "\n
<%= name %> \n";
}
), define("text!templates/snippet/prependedtext.html", [] , function (){
return '\n
\n
<%= label %> \n
\n
\n <%= prepend %> \n required <% } %> />\n
\n <% if (helptext.length > 0) { %>
<%= helptext %>
<% } %>\n
\n
\n';
}
), define("text!templates/snippet/searchinput.html", [] , function (){
return '\n
\n
<%= label %> \n
\n
required <% } %> />\n <% if (helptext.length > 0) { %>
<%= helptext %>
<% } %>\n
\n
\n';
}
), define("text!templates/snippet/textinput.html", [] , function (){
return '\n
\n
<%= label %> \n
\n
required <% } %> />\n <% if (helptext.length > 0) { %>
<%= helptext %>
<% } %>\n
\n
\n';
}
), define("text!templates/snippet/appendedcheckbox.html", [] , function (){
return '\n
\n';
}
), define("text!templates/snippet/appendedtext.html", [] , function (){
return '\n
\n
<%= label %> \n
\n
\n required <% } %> />\n <%= append %> \n
\n <% if (helptext.length > 0) { %>
<%= helptext %>
<% } %>\n
\n
\n';
}
), define("text!templates/snippet/filebutton.html", [] , function (){
return ' \n
\n
<%= label %> \n
\n \n
\n
\n';
}
), define("text!templates/snippet/button.html", [] , function (){
return '\n
\n
<%= label %> \n
\n \'><%= buttonlabel %> \n
\n
\n';
}
), define("text!templates/snippet/buttondouble.html", [] , function (){
return '\n
\n
<%= label %> \n
\n \'><%= button1label %> \n \'><%= button2label %> \n
\n
\n';
}
), define("text!templates/snippet/buttondropdown.html", [] , function (){
return '\n
\n';
}
), define("text!templates/snippet/multiplecheckboxes.html", [] , function (){
return '\n
\n
<%= label %> \n
<% _.each(checkboxes, function(checkbox, i){ %>\n \n required="required"<% } %>>\n <%= checkbox %>\n <% }); %>\n
\n
\n';
}
), define("text!templates/snippet/multiplecheckboxesinline.html", [] , function (){
return '\n
\n
<%= label %> \n
<% _.each(checkboxes, function(checkbox, i){ %>\n \n required="required"<% } %>>\n <%= checkbox %>\n <% }); %>\n
\n
\n';
}
), define("text!templates/snippet/multipleradios.html", [] , function (){
return '\n
\n
<%= label %> \n
<% _.each(radios, function(radio, i){ %>\n \n checked="checked" <% } %><% if(required){ %> required="required"<% } %>>\n <%= radio %>\n <% }); %>\n
\n
\n';
}
), define("text!templates/snippet/multipleradiosinline.html", [] , function (){
return '\n
\n
<%= label %> \n
<% _.each(radios, function(radio, i){ %>\n \n checked="checked" <% } %><% if(required){ %> required="required"<% } %>>\n <%= radio %>\n <% }); %>\n
\n
\n';
}
), define("text!templates/snippet/passwordinput.html", [] , function (){
return '\n
\n
<%= label %> \n
\n
required <% } %> />\n <% if (helptext.length > 0) { %>
<%= helptext %>
<% } %>\n
\n
\n';
}
), define("text!templates/snippet/prependedcheckbox.html", [] , function (){
return '\n
\n';
}
), define("text!templates/snippet/selectbasic.html", [] , function (){
return '\n
\n
<%= label %> \n
\n <% _.each(options, function(option) { %>\n <%= option %> <% }); %>\n \n
\n
\n';
}
), define("text!templates/snippet/selectmultiple.html", [] , function (){
return '\n
\n
<%= label %> \n
\n <% _.each(options, function(option) { %>\n <%= option %> <% }); %>\n \n
\n
\n';
}
), define("text!templates/snippet/textarea.html", [] , function (){
return '\n
\n
<%= label %> \n
\n \n
\n
\n';
}
), define("templates/snippet/snippet-templates", ["require", "text!templates/snippet/formname.html", "text!templates/snippet/prependedtext.html", "text!templates/snippet/searchinput.html", "text!templates/snippet/textinput.html", "text!templates/snippet/appendedcheckbox.html", "text!templates/snippet/appendedtext.html", "text!templates/snippet/filebutton.html", "text!templates/snippet/button.html", "text!templates/snippet/buttondouble.html", "text!templates/snippet/buttondropdown.html", "text!templates/snippet/multiplecheckboxes.html", "text!templates/snippet/multiplecheckboxesinline.html", "text!templates/snippet/multipleradios.html", "text!templates/snippet/multipleradiosinline.html", "text!templates/snippet/passwordinput.html", "text!templates/snippet/prependedcheckbox.html", "text!templates/snippet/prependedtext.html", "text!templates/snippet/searchinput.html", "text!templates/snippet/selectbasic.html", "text!templates/snippet/selectmultiple.html", "text!templates/snippet/textarea.html", "text!templates/snippet/textinput.html"] , function (e){
var t = e("text!templates/snippet/formname.html"), n = e("text!templates/snippet/prependedtext.html"), r = e("text!templates/snippet/searchinput.html"), i = e("text!templates/snippet/textinput.html"), s = e("text!templates/snippet/appendedcheckbox.html"), o = e("text!templates/snippet/appendedtext.html"), u = e("text!templates/snippet/filebutton.html"), a = e("text!templates/snippet/button.html"), f = e("text!templates/snippet/buttondouble.html"), l = e("text!templates/snippet/buttondropdown.html"), c = e("text!templates/snippet/multiplecheckboxes.html"), h = e("text!templates/snippet/multiplecheckboxesinline.html"), p = e("text!templates/snippet/multipleradios.html"), d = e("text!templates/snippet/multipleradiosinline.html"), v = e("text!templates/snippet/passwordinput.html"), m = e("text!templates/snippet/prependedcheckbox.html"), n = e("text!templates/snippet/prependedtext.html"), g = e("text!templates/snippet/searchinput.html"), y = e("text!templates/snippet/selectbasic.html"), b = e("text!templates/snippet/selectmultiple.html"), w = e("text!templates/snippet/textarea.html"), i = e("text!templates/snippet/textinput.html");
return {
formname: t,
prependedtext: n,
search: r,
textinput: i,
appendedcheckbox: s,
appendedtext: o,
filebutton: u,
singlebutton: a,
doublebutton: f,
buttondropdown: l,
multiplecheckboxes: c,
multiplecheckboxesinline: h,
multipleradios: p,
multipleradiosinline: d,
passwordinput: v,
prependedcheckbox: m,
prependedtext: n,
searchinput: g,
selectbasic: y,
selectmultiple: b,
textarea: w,
textinput: i}
;
}
), !function (e){
e(function (){
e.support.transition = function (){
var e = function (){
var e = _AN_Call_createelement("createElement", document, "bootstrap"), t = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "oTransitionEnd otransitionend",
transition: "transitionend"}
, n;
for (n in t)if (e.style[n] !== undefined) return t[n];
}
();
return e && {
end: e}
;
}
();
}
);
}
(window.jQuery), !function (e){
var t = '[data-dismiss="alert"]', n = function (n){
e(n).on("click", t, this.close);
}
;
n.prototype.close = function (t){
function n(){
s.trigger("closed").remove();
}
var r = e(this), i = r.attr("data-target"), s;
i || (i = r.attr("href"), i = i && _AN_Call_replace("replace", i, /.*(?=#[^\s]*$)/, "")), s = e(i), t && t.preventDefault(), _AN_Read_length("length", s) || (s = r.hasClass("alert")? r: r.parent()), s.trigger(t = e.Event("close"));
if (t.isDefaultPrevented()) return ;
s.removeClass("in"), e.support.transition && s.hasClass("fade")? s.on(e.support.transition.end, n): n();
}
;
var r = e.fn.alert;
e.fn.alert = function (t){
return this.each(function (){
var r = e(this), i = r.data("alert");
i || r.data("alert", i = new n(this)), typeof t == "string" && i[t].call(r);
}
);
}
, e.fn.alert.Constructor = n, e.fn.alert.noConflict = function (){
return e.fn.alert = r, this;
}
, e(document).on("click.alert.data-api", t, n.prototype.close);
}
(window.jQuery), !function (e){
var t = function (t, n){
this.$element = e(t), this.options = e.extend({
}
, e.fn.button.defaults, n);
}
;
t.prototype.setState = function (e){
var t = "disabled", n = this.$element, r = n.data(), i = n.is("input")? "val": "html";
e += "Text", r.resetText || n.data("resetText", n[i]()), n[i](r[e] || this.options[e]), _AN_Call_settimeout("setTimeout", window, function (){
e == "loadingText"? n.addClass(t).attr(t, t): n.removeClass(t).removeAttr(t);
}
, 0);
}
, t.prototype.toggle = function (){
var e = this.$element.closest('[data-toggle="buttons-radio"]');
e && e.find(".active").removeClass("active"), this.$element.toggleClass("active");
}
;
var n = e.fn.button;
e.fn.button = function (n){
return this.each(function (){
var r = e(this), i = r.data("button"), s = typeof n == "object" && n;
i || r.data("button", i = new t(this, s)), n == "toggle"? i.toggle(): n && i.setState(n);
}
);
}
, e.fn.button.defaults = {
loadingText: "loading..."}
, e.fn.button.Constructor = t, e.fn.button.noConflict = function (){
return e.fn.button = n, this;
}
, e(document).on("click.button.data-api", "[data-toggle^=button]", function (t){
var n = e(_AN_Read_target("target", t));
n.hasClass("btn") || (n = n.closest(".btn")), n.button("toggle");
}
);
}
(window.jQuery), !function (e){
var t = function (t, n){
this.$element = e(t), this.$indicators = this.$element.find(".carousel-indicators"), this.options = n, this.options.pause == "hover" && this.$element.on("mouseenter", e.proxy(this.pause, this)).on("mouseleave", e.proxy(this.cycle, this));
}
;
t.prototype = {
cycle: function (t){
return t || (this.paused = false ), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = _AN_Call_setinterval("setInterval", window, e.proxy(this.next, this), this.options.interval)), this;
}
,
getActiveIndex: function (){
return this.$active = this.$element.find(".item.active"), this.$items = this.$active.parent().children(), this.$items.index(this.$active);
}
,
to: function (t){
var n = this.getActiveIndex(), r = this;
if (t > _AN_Read_length("length", this.$items) - 1 || t < 0) return ;
return this.sliding? this.$element.one("slid", function (){
r.to(t);
}
): n == t? this.pause().cycle(): this.slide(t > n? "next": "prev", e(this.$items[t]));
}
,
pause: function (t){
return t || (this.paused = true ), _AN_Read_length("length", this.$element.find(".next, .prev")) && e.support.transition.end && (this.$element.trigger(e.support.transition.end), this.cycle(true )), clearInterval(this.interval), this.interval = null , this;
}
,
next: function (){
if (this.sliding) return ;
return this.slide("next");
}
,
prev: function (){
if (this.sliding) return ;
return this.slide("prev");
}
,
slide: function (t, n){
var r = this.$element.find(".item.active"), i = n || r[t](), s = this.interval, o = t == "next"? "left": "right", u = t == "next"? "first": "last", a = this, f;
this.sliding = true , s && this.pause(), i = _AN_Read_length("length", i)? i: this.$element.find(".item")[u](), f = e.Event("slide", {
relatedTarget: i[0],
direction: o}
);
if (i.hasClass("active")) return ;
_AN_Read_length("length", this.$indicators) && (this.$indicators.find(".active").removeClass("active"), this.$element.one("slid", function (){
var t = e(a.$indicators.children()[a.getActiveIndex()]);
t && t.addClass("active");
}
));
if (e.support.transition && this.$element.hasClass("slide")) {
this.$element.trigger(f);
if (f.isDefaultPrevented()) return ;
i.addClass(t), i[0].offsetWidth, r.addClass(o), i.addClass(o), this.$element.one(e.support.transition.end, function (){
i.removeClass([t, o] .join(" ")).addClass("active"), r.removeClass(["active", o] .join(" ")), a.sliding = false , _AN_Call_settimeout("setTimeout", window, function (){
a.$element.trigger("slid");
}
, 0);
}
);
}
else {
this.$element.trigger(f);
if (f.isDefaultPrevented()) return ;
r.removeClass("active"), i.addClass("active"), this.sliding = false , this.$element.trigger("slid");
}
return s && this.cycle(), this;
}
}
;
var n = e.fn.carousel;
e.fn.carousel = function (n){
return this.each(function (){
var r = e(this), i = r.data("carousel"), s = e.extend({
}
, e.fn.carousel.defaults, typeof n == "object" && n), o = typeof n == "string"? n: s.slide;
i || r.data("carousel", i = new t(this, s)), typeof n == "number"? i.to(n): o? i[o](): s.interval && i.pause().cycle();
}
);
}
, e.fn.carousel.defaults = {
interval: 5000,
pause: "hover"}
, e.fn.carousel.Constructor = t, e.fn.carousel.noConflict = function (){
return e.fn.carousel = n, this;
}
, e(document).on("click.carousel.data-api", "[data-slide], [data-slide-to]", function (t){
var n = e(this), r, i = e(n.attr("data-target") || (r = n.attr("href")) && _AN_Call_replace("replace", r, /.*(?=#[^\s]+$)/, "")), s = e.extend({
}
, i.data(), n.data()), o;
i.carousel(s), (o = n.attr("data-slide-to")) && i.data("carousel").pause().to(o).cycle(), t.preventDefault();
}
);
}
(window.jQuery), !function (e){
var t = function (t, n){
this.$element = e(t), this.options = e.extend({
}
, e.fn.collapse.defaults, n), this.options.parent && (this.$parent = e(this.options.parent)), this.options.toggle && this.toggle();
}
;
t.prototype = {
constructor: t,
dimension: function (){
var e = this.$element.hasClass("width");
return e? "width": "height";
}
,
show: function (){
var t, n, r, i;
if (this.transitioning || this.$element.hasClass("in")) return ;
t = this.dimension(), n = e.camelCase(["scroll", t] .join("-")), r = this.$parent && this.$parent.find("> .accordion-group > .in");
if (r && _AN_Read_length("length", r)) {
i = r.data("collapse");
if (i && i.transitioning) return ;
r.collapse("hide"), i || r.data("collapse", null );
}
this.$element[t](0), this.transition("addClass", e.Event("show"), "shown"), e.support.transition && this.$element[t](this.$element[0][n]);
}
,
hide: function (){
var t;
if (this.transitioning || !this.$element.hasClass("in")) return ;
t = this.dimension(), this.reset(this.$element[t]()), this.transition("removeClass", e.Event("hide"), "hidden"), this.$element[t](0);
}
,
reset: function (e){
var t = this.dimension();
return this.$element.removeClass("collapse")[t](e || "auto")[0].offsetWidth, this.$element[e !== null ? "addClass": "removeClass"]("collapse"), this;
}
,
transition: function (t, n, r){
var i = this, s = function (){
n.type == "show" && i.reset(), i.transitioning = 0, i.$element.trigger(r);
}
;
this.$element.trigger(n);
if (n.isDefaultPrevented()) return ;
this.transitioning = 1, this.$element[t]("in"), e.support.transition && this.$element.hasClass("collapse")? this.$element.one(e.support.transition.end, s): s();
}
,
toggle: function (){
this[this.$element.hasClass("in")? "hide": "show"]();
}
}
;
var n = e.fn.collapse;
e.fn.collapse = function (n){
return this.each(function (){
var r = e(this), i = r.data("collapse"), s = e.extend({
}
, e.fn.collapse.defaults, r.data(), typeof n == "object" && n);
i || r.data("collapse", i = new t(this, s)), typeof n == "string" && i[n]();
}
);
}
, e.fn.collapse.defaults = {
toggle: true }
, e.fn.collapse.Constructor = t, e.fn.collapse.noConflict = function (){
return e.fn.collapse = n, this;
}
, e(document).on("click.collapse.data-api", "[data-toggle=collapse]", function (t){
var n = e(this), r, i = n.attr("data-target") || t.preventDefault() || (r = n.attr("href")) && _AN_Call_replace("replace", r, /.*(?=#[^\s]+$)/, ""), s = e(i).data("collapse")? "toggle": n.data();
n[e(i).hasClass("in")? "addClass": "removeClass"]("collapsed"), e(i).collapse(s);
}
);
}
(window.jQuery), !function (e){
function t(){
e(r).each(function (){
n(e(this)).removeClass("open");
}
);
}
function n(t){
var n = t.attr("data-target"), r;
n || (n = t.attr("href"), n = n && /#/.test(n) && _AN_Call_replace("replace", n, /.*(?=#[^\s]*$)/, "")), r = n && e(n);
if (!r || !_AN_Read_length("length", r)) r = t.parent();
return r;
}
var r = "[data-toggle=dropdown]", i = function (t){
var n = e(t).on("click.dropdown.data-api", this.toggle);
e("html").on("click.dropdown.data-api", function (){
n.parent().removeClass("open");
}
);
}
;
i.prototype = {
constructor: i,
toggle: function (r){
var i = e(this), s, o;
if (i.is(".disabled, :disabled")) return ;
return s = n(i), o = s.hasClass("open"), t(), o || s.toggleClass("open"), i.focus(), false ;
}
,
keydown: function (t){
var i, s, o, u, a, f;
if (!/(38|40|27)/.test(t.keyCode)) return ;
i = e(this), t.preventDefault(), t.stopPropagation();
if (i.is(".disabled, :disabled")) return ;
u = n(i), a = u.hasClass("open");
if (!a || a && t.keyCode == 27) return t.which == 27 && u.find(r).focus(), i.click();
s = e("[role=menu] li:not(.divider):visible a", u);
if (!_AN_Read_length("length", s)) return ;
f = s.index(s.filter(":focus")), t.keyCode == 38 && f > 0 && f-- , t.keyCode == 40 && f < _AN_Read_length("length", s) - 1 && f++ , ~f || (f = 0), s.eq(f).focus();
}
}
;
var s = e.fn.dropdown;
e.fn.dropdown = function (t){
return this.each(function (){
var n = e(this), r = n.data("dropdown");
r || n.data("dropdown", r = new i(this)), typeof t == "string" && r[t].call(n);
}
);
}
, e.fn.dropdown.Constructor = i, e.fn.dropdown.noConflict = function (){
return e.fn.dropdown = s, this;
}
, e(document).on("click.dropdown.data-api", t).on("click.dropdown.data-api", ".dropdown form", function (e){
e.stopPropagation();
}
).on("click.dropdown-menu", function (e){
e.stopPropagation();
}
).on("click.dropdown.data-api", r, i.prototype.toggle).on("keydown.dropdown.data-api", r + ", [role=menu]", i.prototype.keydown);
}
(window.jQuery), !function (e){
var t = function (t, n){
this.options = n, this.$element = e(t).delegate('[data-dismiss="modal"]', "click.dismiss.modal", e.proxy(this.hide, this)), this.options.remote && _AN_Call_load("load", this.$element.find(".modal-body"), this.options.remote);
}
;
t.prototype = {
constructor: t,
toggle: function (){
return this[this.isShown? "hide": "show"]();
}
,
show: function (){
var t = this, n = e.Event("show");
this.$element.trigger(n);
if (this.isShown || n.isDefaultPrevented()) return ;
this.isShown = true , this.escape(), this.backdrop(function (){
var n = e.support.transition && t.$element.hasClass("fade");
_AN_Read_length("length", t.$element.parent()) || t.$element.appendTo(document.body), _AN_Call_show("show", t.$element), n && t.$element[0].offsetWidth, t.$element.addClass("in").attr("aria-hidden", false ), t.enforceFocus(), n? t.$element.one(e.support.transition.end, function (){
t.$element.focus().trigger("shown");
}
): t.$element.focus().trigger("shown");
}
);
}
,
hide: function (t){
t && t.preventDefault();
var n = this;
t = e.Event("hide"), this.$element.trigger(t);
if (!this.isShown || t.isDefaultPrevented()) return ;
this.isShown = false , this.escape(), e(document).off("focusin.modal"), this.$element.removeClass("in").attr("aria-hidden", true ), e.support.transition && this.$element.hasClass("fade")? this.hideWithTransition(): this.hideModal();
}
,
enforceFocus: function (){
var t = this;
e(document).on("focusin.modal", function (e){
t.$element[0] !== _AN_Read_target("target", e) && !_AN_Read_length("length", t.$element.has(_AN_Read_target("target", e))) && t.$element.focus();
}
);
}
,
escape: function (){
var e = this;
this.isShown && this.options.keyboard? this.$element.on("keyup.dismiss.modal", function (t){
t.which == 27 && e.hide();
}
): this.isShown || this.$element.off("keyup.dismiss.modal");
}
,
hideWithTransition: function (){
var t = this, n = _AN_Call_settimeout("setTimeout", window, function (){
t.$element.off(e.support.transition.end), t.hideModal();
}
, 500);
this.$element.one(e.support.transition.end, function (){
clearTimeout(n), t.hideModal();
}
);
}
,
hideModal: function (){
var e = this;
this.$element.hide(), this.backdrop(function (){
e.removeBackdrop(), e.$element.trigger("hidden");
}
);
}
,
removeBackdrop: function (){
this.$backdrop && this.$backdrop.remove(), this.$backdrop = null ;
}
,
backdrop: function (t){
var n = this, r = this.$element.hasClass("fade")? "fade": "";
if (this.isShown && this.options.backdrop) {
var i = e.support.transition && r;
this.$backdrop = e('
').appendTo(document.body), this.$backdrop.click(this.options.backdrop == "static"? e.proxy(this.$element[0].focus, this.$element[0]): e.proxy(this.hide, this)), i && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in");
if (!t) return ;
i? this.$backdrop.one(e.support.transition.end, t): t();
}
else !this.isShown && this.$backdrop? (this.$backdrop.removeClass("in"), e.support.transition && this.$element.hasClass("fade")? this.$backdrop.one(e.support.transition.end, t): t()): t && t();
}
}
;
var n = e.fn.modal;
e.fn.modal = function (n){
return this.each(function (){
var r = e(this), i = r.data("modal"), s = e.extend({
}
, e.fn.modal.defaults, r.data(), typeof n == "object" && n);
i || r.data("modal", i = new t(this, s)), typeof n == "string"? i[n](): s.show && _AN_Call_show("show", i);
}
);
}
, e.fn.modal.defaults = {
backdrop: true ,
keyboard: true ,
show: true }
, e.fn.modal.Constructor = t, e.fn.modal.noConflict = function (){
return e.fn.modal = n, this;
}
, e(document).on("click.modal.data-api", '[data-toggle="modal"]', function (t){
var n = e(this), r = n.attr("href"), i = e(n.attr("data-target") || r && _AN_Call_replace("replace", r, /.*(?=#[^\s]+$)/, "")), s = i.data("modal")? "toggle": e.extend({
remote: !/#/.test(r) && r}
, i.data(), n.data());
t.preventDefault(), i.modal(s).one("hide", function (){
n.focus();
}
);
}
);
}
(window.jQuery), !function (e){
var t = function (e, t){
_AN_Call_init("init", this, "tooltip", e, t);
}
;
t.prototype = {
constructor: t,
init: function (t, n, r){
var i, s, o, u, a;
this.type = t, this.$element = e(n), this.options = this.getOptions(r), this.enabled = true , o = this.options.trigger.split(" ");
for (a = _AN_Read_length("length", o); a-- ; )u = o[a], u == "click"? this.$element.on("click." + this.type, this.options.selector, e.proxy(this.toggle, this)): u != "manual" && (i = u == "hover"? "mouseenter": "focus", s = u == "hover"? "mouseleave": "blur", this.$element.on(i + "." + this.type, this.options.selector, e.proxy(this.enter, this)), this.$element.on(s + "." + this.type, this.options.selector, e.proxy(this.leave, this)));
this.options.selector? this._options = e.extend({
}
, this.options, {
trigger: "manual",
selector: ""}
): this.fixTitle();
}
,
getOptions: function (t){
return t = e.extend({
}
, e.fn[this.type].defaults, this.$element.data(), t), t.delay && typeof t.delay == "number" && (t.delay = {
show: t.delay,
hide: t.delay}
), t;
}
,
enter: function (t){
var n = e.fn[this.type].defaults, r = {
}
, i;
this._options && e.each(this._options, function (e, t){
n[e] != t && (r[e] = t);
}
, this), i = e(t.currentTarget)[this.type](r).data(this.type);
if (!i.options.delay || !i.options.delay.show) return _AN_Call_show("show", i);
clearTimeout(this.timeout), i.hoverState = "in", this.timeout = _AN_Call_settimeout("setTimeout", window, function (){
i.hoverState == "in" && _AN_Call_show("show", i);
}
, i.options.delay.show);
}
,
leave: function (t){
var n = e(t.currentTarget)[this.type](this._options).data(this.type);
this.timeout && clearTimeout(this.timeout);
if (!n.options.delay || !n.options.delay.hide) return n.hide();
n.hoverState = "out", this.timeout = _AN_Call_settimeout("setTimeout", window, function (){
n.hoverState == "out" && n.hide();
}
, n.options.delay.hide);
}
,
show: function (){
var t, n, r, i, s, o, u = e.Event("show");
if (this.hasContent() && this.enabled) {
this.$element.trigger(u);
if (u.isDefaultPrevented()) return ;
t = this.tip(), this.setContent(), this.options.animation && t.addClass("fade"), s = typeof this.options.placement == "function"? this.options.placement.call(this, t[0], this.$element[0]): this.options.placement, t.detach().css({
top: 0,
left: 0,
display: "block"}
), this.options.container? t.appendTo(this.options.container): t.insertAfter(this.$element), n = this.getPosition(), r = t[0].offsetWidth, i = t[0].offsetHeight;
switch (s){
case "bottom": o = {
top: n.top + n.height,
left: n.left + n.width / 2 - r / 2}
;
break ;
case "top": o = {
top: n.top - i,
left: n.left + n.width / 2 - r / 2}
;
break ;
case "left": o = {
top: n.top + n.height / 2 - i / 2,
left: n.left - r}
;
break ;
case "right": o = {
top: n.top + n.height / 2 - i / 2,
left: n.left + n.width}
;
}
this.applyPlacement(o, s), this.$element.trigger("shown");
}
}
,
applyPlacement: function (e, t){
var n = this.tip(), r = n[0].offsetWidth, i = n[0].offsetHeight, s, o, u, a;
n.offset(e).addClass(t).addClass("in"), s = n[0].offsetWidth, o = n[0].offsetHeight, t == "top" && o != i && (e.top = e.top + i - o, a = true ), t == "bottom" || t == "top"? (u = 0, e.left < 0 && (u = e.left * -2, e.left = 0, n.offset(e), s = n[0].offsetWidth, o = n[0].offsetHeight), this.replaceArrow(u - r + s, s, "left")): this.replaceArrow(o - i, o, "top"), a && n.offset(e);
}
,
replaceArrow: function (e, t, n){
this.arrow().css(n, e? 50 * (1 - e / t) + "%": "");
}
,
setContent: function (){
var e = this.tip(), t = this.getTitle();
e.find(".tooltip-inner")[this.options.html? "html": "text"](t), e.removeClass("fade in top bottom left right");
}
,
hide: function (){
function t(){
var t = _AN_Call_settimeout("setTimeout", window, function (){
r.off(e.support.transition.end).detach();
}
, 500);
r.one(e.support.transition.end, function (){
clearTimeout(t), r.detach();
}
);
}
var n = this, r = this.tip(), i = e.Event("hide");
this.$element.trigger(i);
if (i.isDefaultPrevented()) return ;
return r.removeClass("in"), e.support.transition && this.$tip.hasClass("fade")? t(): r.detach(), this.$element.trigger("hidden"), this;
}
,
fixTitle: function (){
var e = this.$element;
(e.attr("title") || typeof e.attr("data-original-title") != "string") && e.attr("data-original-title", e.attr("title") || "").attr("title", "");
}
,
hasContent: function (){
return this.getTitle();
}
,
getPosition: function (){
var t = this.$element[0];
return e.extend({
}
, typeof t.getBoundingClientRect == "function"? t.getBoundingClientRect(): {
width: t.offsetWidth,
height: t.offsetHeight}
, this.$element.offset());
}
,
getTitle: function (){
var e, t = this.$element, n = this.options;
return e = t.attr("data-original-title") || (typeof n.title == "function"? n.title.call(t[0]): n.title), e;
}
,
tip: function (){
return this.$tip = this.$tip || e(this.options.template);
}
,
arrow: function (){
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow");
}
,
validate: function (){
this.$element[0].parentNode || (this.hide(), this.$element = null , this.options = null );
}
,
enable: function (){
this.enabled = true ;
}
,
disable: function (){
this.enabled = false ;
}
,
toggleEnabled: function (){
this.enabled = !this.enabled;
}
,
toggle: function (t){
var n = t? e(t.currentTarget)[this.type](this._options).data(this.type): this;
n.tip().hasClass("in")? n.hide(): _AN_Call_show("show", n);
}
,
destroy: function (){
this.hide().$element.off("." + this.type).removeData(this.type);
}
}
;
var n = e.fn.tooltip;
e.fn.tooltip = function (n){
return this.each(function (){
var r = e(this), i = r.data("tooltip"), s = typeof n == "object" && n;
i || r.data("tooltip", i = new t(this, s)), typeof n == "string" && i[n]();
}
);
}
, e.fn.tooltip.Constructor = t, e.fn.tooltip.defaults = {
animation: true ,
placement: "top",
selector: false ,
template: '
',
trigger: "hover focus",
title: "",
delay: 0,
html: false ,
container: false }
, e.fn.tooltip.noConflict = function (){
return e.fn.tooltip = n, this;
}
;
}
(window.jQuery), !function (e){
var t = function (e, t){
_AN_Call_init("init", this, "popover", e, t);
}
;
t.prototype = e.extend({
}
, e.fn.tooltip.Constructor.prototype, {
constructor: t,
setContent: function (){
var e = this.tip(), t = this.getTitle(), n = this.getContent();
e.find(".popover-title")[this.options.html? "html": "text"](t), e.find(".popover-content")[this.options.html? "html": "text"](n), e.removeClass("fade top bottom left right in");
}
,
hasContent: function (){
return this.getTitle() || this.getContent();
}
,
getContent: function (){
var e, t = this.$element, n = this.options;
return e = (typeof n.content == "function"? n.content.call(t[0]): n.content) || t.attr("data-content"), e;
}
,
tip: function (){
return this.$tip || (this.$tip = e(this.options.template)), this.$tip;
}
,
destroy: function (){
this.hide().$element.off("." + this.type).removeData(this.type);
}
}
);
var n = e.fn.popover;
e.fn.popover = function (n){
return this.each(function (){
var r = e(this), i = r.data("popover"), s = typeof n == "object" && n;
i || r.data("popover", i = new t(this, s)), typeof n == "string" && i[n]();
}
);
}
, e.fn.popover.Constructor = t, e.fn.popover.defaults = e.extend({
}
, e.fn.tooltip.defaults, {
placement: "right",
trigger: "click",
content: "",
template: '
'}
), e.fn.popover.noConflict = function (){
return e.fn.popover = n, this;
}
;
}
(window.jQuery), !function (e){
function t(t, n){
var r = e.proxy(this.process, this), i = e(t).is("body")? e(window): e(t), s;
this.options = e.extend({
}
, e.fn.scrollspy.defaults, n), this.$scrollElement = i.on("scroll.scroll-spy.data-api", r), this.selector = (_AN_Read_target("target", this.options) || (s = e(t).attr("href")) && _AN_Call_replace("replace", s, /.*(?=#[^\s]+$)/, "") || "") + " .nav li > a", this.$body = e("body"), _AN_Call_refresh("refresh", this), this.process();
}
t.prototype = {
constructor: t,
refresh: function (){
var t = this, n;
this.offsets = e([] ), this.targets = e([] ), n = this.$body.find(this.selector).map(function (){
var n = e(this), r = n.data("target") || n.attr("href"), i = /^#\w/.test(r) && e(r);
return i && _AN_Read_length("length", i) && [[i.position().top + (!e.isWindow(t.$scrollElement.get(0)) && t.$scrollElement.scrollTop()), r] ] || null ;
}
).sort(function (e, t){
return e[0] - t[0];
}
).each(function (){
t.offsets.push(this[0]), t.targets.push(this[1]);
}
);
}
,
process: function (){
var e = this.$scrollElement.scrollTop() + this.options.offset, t = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight, n = t - this.$scrollElement.height(), r = this.offsets, i = this.targets, s = this.activeTarget, o;
if (e >= n) return s != (o = i.last()[0]) && this.activate(o);
for (o = _AN_Read_length("length", r); o-- ; )s != i[o] && e >= r[o] && (!r[o + 1] || e <= r[o + 1]) && this.activate(i[o]);
}
,
activate: function (t){
var n, r;
this.activeTarget = t, e(this.selector).parent(".active").removeClass("active"), r = this.selector + '[data-target="' + t + '"],' + this.selector + '[href="' + t + '"]', n = e(r).parent("li").addClass("active"), _AN_Read_length("length", n.parent(".dropdown-menu")) && (n = n.closest("li.dropdown").addClass("active")), n.trigger("activate");
}
}
;
var n = e.fn.scrollspy;
e.fn.scrollspy = function (n){
return this.each(function (){
var r = e(this), i = r.data("scrollspy"), s = typeof n == "object" && n;
i || r.data("scrollspy", i = new t(this, s)), typeof n == "string" && i[n]();
}
);
}
, e.fn.scrollspy.Constructor = t, e.fn.scrollspy.defaults = {
offset: 10}
, e.fn.scrollspy.noConflict = function (){
return e.fn.scrollspy = n, this;
}
, e(window).on("load", function (){
e('[data-spy="scroll"]').each(function (){
var t = e(this);
t.scrollspy(t.data());
}
);
}
);
}
(window.jQuery), !function (e){
var t = function (t){
this.element = e(t);
}
;
t.prototype = {
constructor: t,
show: function (){
var t = this.element, n = t.closest("ul:not(.dropdown-menu)"), r = t.attr("data-target"), i, s, o;
r || (r = t.attr("href"), r = r && _AN_Call_replace("replace", r, /.*(?=#[^\s]*$)/, ""));
if (t.parent("li").hasClass("active")) return ;
i = n.find(".active:last a")[0], o = e.Event("show", {
relatedTarget: i}
), t.trigger(o);
if (o.isDefaultPrevented()) return ;
s = e(r), this.activate(t.parent("li"), n), this.activate(s, s.parent(), function (){
t.trigger({
type: "shown",
relatedTarget: i}
);
}
);
}
,
activate: function (t, n, r){
function i(){
s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"), t.addClass("active"), o? (t[0].offsetWidth, t.addClass("in")): t.removeClass("fade"), t.parent(".dropdown-menu") && t.closest("li.dropdown").addClass("active"), r && r();
}
var s = n.find("> .active"), o = r && e.support.transition && s.hasClass("fade");
o? s.one(e.support.transition.end, i): i(), s.removeClass("in");
}
}
;
var n = e.fn.tab;
e.fn.tab = function (n){
return this.each(function (){
var r = e(this), i = r.data("tab");
i || r.data("tab", i = new t(this)), typeof n == "string" && i[n]();
}
);
}
, e.fn.tab.Constructor = t, e.fn.tab.noConflict = function (){
return e.fn.tab = n, this;
}
, e(document).on("click.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function (t){
t.preventDefault(), e(this).tab("show");
}
);
}
(window.jQuery), !function (e){
var t = function (t, n){
this.$element = e(t), this.options = e.extend({
}
, e.fn.typeahead.defaults, n), this.matcher = this.options.matcher || this.matcher, this.sorter = this.options.sorter || this.sorter, this.highlighter = this.options.highlighter || this.highlighter, this.updater = this.options.updater || this.updater, this.source = this.options.source, this.$menu = e(this.options.menu), this.shown = false , this.listen();
}
;
t.prototype = {
constructor: t,
select: function (){
var e = this.$menu.find(".active").attr("data-value");
return this.$element.val(this.updater(e)).change(), this.hide();
}
,
updater: function (e){
return e;
}
,
show: function (){
var t = e.extend({
}
, this.$element.position(), {
height: this.$element[0].offsetHeight}
);
return _AN_Call_show("show", this.$menu.insertAfter(this.$element).css({
top: t.top + t.height,
left: t.left}
)), this.shown = true , this;
}
,
hide: function (){
return this.$menu.hide(), this.shown = false , this;
}
,
lookup: function (t){
var n;
return this.query = this.$element.val(), !this.query || _AN_Read_length("length", this.query) < this.options.minLength? this.shown? this.hide(): this: (n = e.isFunction(this.source)? this.source(this.query, e.proxy(this.process, this)): this.source, n? this.process(n): this);
}
,
process: function (t){
var n = this;
return t = e.grep(t, function (e){
return n.matcher(e);
}
), t = this.sorter(t), _AN_Read_length("length", t)? _AN_Call_show("show", this.render(t.slice(0, this.options.items))): this.shown? this.hide(): this;
}
,
matcher: function (e){
return ~e.toLowerCase().indexOf(this.query.toLowerCase());
}
,
sorter: function (e){
var t = [] , n = [] , r = [] , i;
while (i = e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())? ~i.indexOf(this.query)? n.push(i): r.push(i): t.push(i);
return t.concat(n, r);
}
,
highlighter: function (e){
var t = _AN_Call_replace("replace", this.query, /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
return _AN_Call_replace("replace", e, new RegExp("(" + t + ")", "ig"), function (e, t){
return "
" + t + " ";
}
);
}
,
render: function (t){
var n = this;
return t = e(t).map(function (t, r){
return t = e(n.options.item).attr("data-value", r), t.find("a").html(n.highlighter(r)), t[0];
}
), t.first().addClass("active"), this.$menu.html(t), this;
}
,
next: function (t){
var n = this.$menu.find(".active").removeClass("active"), r = n.next();
_AN_Read_length("length", r) || (r = e(this.$menu.find("li")[0])), r.addClass("active");
}
,
prev: function (e){
var t = this.$menu.find(".active").removeClass("active"), n = t.prev();
_AN_Read_length("length", n) || (n = this.$menu.find("li").last()), n.addClass("active");
}
,
listen: function (){
this.$element.on("focus", e.proxy(this.focus, this)).on("blur", e.proxy(this.blur, this)).on("keypress", e.proxy(this.keypress, this)).on("keyup", e.proxy(this.keyup, this)), this.eventSupported("keydown") && this.$element.on("keydown", e.proxy(this.keydown, this)), this.$menu.on("click", e.proxy(this.click, this)).on("mouseenter", "li", e.proxy(this.mouseenter, this)).on("mouseleave", "li", e.proxy(this.mouseleave, this));
}
,
eventSupported: function (e){
var t = e in this.$element;
return t || (_AN_Call_setattribute("setAttribute", this.$element, e, "return;"), t = typeof this.$element[e] == "function"), t;
}
,
move: function (e){
if (!this.shown) return ;
switch (e.keyCode){
case 9: case 13: case 27: e.preventDefault();
break ;
case 38: e.preventDefault(), this.prev();
break ;
case 40: e.preventDefault(), this.next();
}
e.stopPropagation();
}
,
keydown: function (t){
this.suppressKeyPressRepeat = ~e.inArray(t.keyCode, [40, 38, 9, 13, 27] ), this.move(t);
}
,
keypress: function (e){
if (this.suppressKeyPressRepeat) return ;
this.move(e);
}
,
keyup: function (e){
switch (e.keyCode){
case 40: case 38: case 16: case 17: case 18: break ;
case 9: case 13: if (!this.shown) return ;
this.select();
break ;
case 27: if (!this.shown) return ;
this.hide();
break ;
default : {
this.lookup();
}
}
e.stopPropagation(), e.preventDefault();
}
,
focus: function (e){
this.focused = true ;
}
,
blur: function (e){
this.focused = false , !this.mousedover && this.shown && this.hide();
}
,
click: function (e){
e.stopPropagation(), e.preventDefault(), this.select(), this.$element.focus();
}
,
mouseenter: function (t){
this.mousedover = true , this.$menu.find(".active").removeClass("active"), e(t.currentTarget).addClass("active");
}
,
mouseleave: function (e){
this.mousedover = false , !this.focused && this.shown && this.hide();
}
}
;
var n = e.fn.typeahead;
e.fn.typeahead = function (n){
return this.each(function (){
var r = e(this), i = r.data("typeahead"), s = typeof n == "object" && n;
i || r.data("typeahead", i = new t(this, s)), typeof n == "string" && i[n]();
}
);
}
, e.fn.typeahead.defaults = {
source: [] ,
items: 8,
menu: '',
item: '
',
minLength: 1}
, e.fn.typeahead.Constructor = t, e.fn.typeahead.noConflict = function (){
return e.fn.typeahead = n, this;
}
, e(document).on("focus.typeahead.data-api", '[data-provide="typeahead"]', function (t){
var n = e(this);
if (n.data("typeahead")) return ;
n.typeahead(n.data());
}
);
}
(window.jQuery), !function (e){
var t = function (t, n){
this.options = e.extend({
}
, e.fn.affix.defaults, n), this.$window = e(window).on("scroll.affix.data-api", e.proxy(this.checkPosition, this)).on("click.affix.data-api", e.proxy(function (){
_AN_Call_settimeout("setTimeout", window, e.proxy(this.checkPosition, this), 1);
}
, this)), this.$element = e(t), this.checkPosition();
}
;
t.prototype.checkPosition = function (){
if (!this.$element.is(":visible")) return ;
var t = e(document).height(), n = this.$window.scrollTop(), r = this.$element.offset(), i = this.options.offset, s = i.bottom, o = i.top, u = "affix affix-top affix-bottom", a;
typeof i != "object" && (s = o = i), typeof o == "function" && (o = i.top()), typeof s == "function" && (s = i.bottom()), a = this.unpin != null && n + this.unpin <= r.top? false : s != null && r.top + this.$element.height() >= t - s? "bottom": o != null && n <= o? "top": false ;
if (this.affixed === a) return ;
this.affixed = a, this.unpin = a == "bottom"? r.top - n: null , this.$element.removeClass(u).addClass("affix" + (a? "-" + a: ""));
}
;
var n = e.fn.affix;
e.fn.affix = function (n){
return this.each(function (){
var r = e(this), i = r.data("affix"), s = typeof n == "object" && n;
i || r.data("affix", i = new t(this, s)), typeof n == "string" && i[n]();
}
);
}
, e.fn.affix.Constructor = t, e.fn.affix.defaults = {
offset: 0}
, e.fn.affix.noConflict = function (){
return e.fn.affix = n, this;
}
, e(window).on("load", function (){
e('[data-spy="affix"]').each(function (){
var t = e(this), n = t.data();
n.offset = n.offset || {
}
, n.offsetBottom && (n.offset.bottom = n.offsetBottom), n.offsetTop && (n.offset.top = n.offsetTop), t.affix(n);
}
);
}
);
}
(window.jQuery), define("bootstrap", ["jquery"] , function (e){
return function (){
var t, n;
return t || e.$.fn.popover;
}
;
}
(this)), define("views/snippet", ["jquery", "underscore", "backbone", "text!templates/popover/popover-main.html", "text!templates/popover/popover-input.html", "text!templates/popover/popover-select.html", "text!templates/popover/popover-textarea.html", "text!templates/popover/popover-textarea-split.html", "text!templates/popover/popover-checkbox.html", "templates/snippet/snippet-templates", "bootstrap"] , function (e, t, n, r, i, s, o, u, a, f){
return n.View.extend({
tagName: "div",
className: "component",
initialize: function (){
this.template = t.template(f[this.model.idFriendlyTitle()]), this.popoverTemplates = {
input: t.template(i),
select: t.template(s),
textarea: t.template(o),
"textarea-split": t.template(u),
checkbox: t.template(a)}
;
}
,
render: function (e){
var n = this, i = t.template(r)({
title: n.model.get("title"),
items: n.model.get("fields"),
popoverTemplates: n.popoverTemplates}
);
return e? this.$el.html(n.template(n.model.getValues())).attr({
"data-content": i,
"data-title": n.model.get("title"),
"data-trigger": "manual",
"data-html": true }
): this.$el.html(n.template(n.model.getValues()));
}
}
);
}
), define("text!templates/app/temp.html", [] , function (){
return "
\n";
}
), define("helper/pubsub", ["jquery", "underscore", "backbone"] , function (e, t, n){
return t.extend({
}
, n.Events);
}
), define("views/temp-snippet", ["jquery", "views/snippet", "text!templates/app/temp.html", "helper/pubsub"] , function (e, t, n, r){
return t.extend({
initialize: function (){
r.on("newTempPostRender", this.postRender, this), this.constructor.__super__.initialize.call(this), this.tempTemplate = _.template(n);
}
,
className: "temp",
render: function (){
return this.$el.html(this.tempTemplate({
text: this.constructor.__super__.render.call(this).html()}
));
}
,
postRender: function (e){
this.tempForm = this.$el.find("form")[0], this.halfHeight = Math.floor(this.tempForm.clientHeight / 2), this.halfWidth = Math.floor(this.tempForm.clientWidth / 2), this.centerOnEvent(e);
}
,
events: {
mousemove: "mouseMoveHandler",
mouseup: "mouseUpHandler"}
,
centerOnEvent: function (e){
var t = e.pageX, n = e.pageY;
this.tempForm.style.top = n - this.halfHeight + "px", this.tempForm.style.left = t - this.halfWidth + "px", r.trigger("tempMove", e);
}
,
mouseMoveHandler: function (e){
e.preventDefault(), this.centerOnEvent(e);
}
,
mouseUpHandler: function (e){
e.preventDefault(), r.trigger("tempDrop", e, this.model), this.remove();
}
}
);
}
), define("views/tab-snippet", ["jquery", "underscore", "backbone", "models/snippet", "views/snippet", "views/temp-snippet", "helper/pubsub"] , function (e, t, n, r, i, s, o){
return i.extend({
events: {
mousedown: "mouseDownHandler"}
,
mouseDownHandler: function (t){
t.preventDefault(), t.stopPropagation(), e(".popover").hide(), e("body").append((new s({
model: new r(e.extend(true , {
}
, this.model.attributes))}
)).render()), o.trigger("newTempPostRender", t);
}
}
);
}
), define("collections/snippets", ["jquery", "underscore", "backbone", "models/snippet", "views/tab-snippet"] , function (e, t, n, r, i){
return n.Collection.extend({
model: r,
renderAll: function (){
return this.map(function (e){
return (new i({
model: e}
)).render();
}
);
}
}
);
}
), define("views/my-form-snippet", ["jquery", "underscore", "backbone", "views/snippet", "views/temp-snippet", "helper/pubsub"] , function (e, t, n, r, i, s){
return r.extend({
events: {
click: "preventPropagation",
mousedown: "mouseDownHandler",
mouseup: "mouseUpHandler"}
,
mouseDownHandler: function (t){
t.stopPropagation(), t.preventDefault();
var n = this;
e(".popover").remove(), this.$el.popover("show"), e(".popover #save").on("click", this.saveHandler(n)), e(".popover #cancel").on("click", this.cancelHandler(n)), this.model.get("title") !== "Form Name" && e("body").on("mousemove", function (e){
if (Math.abs(t.pageX - e.pageX) > 10 || Math.abs(t.pageY - e.pageY) > 10) n.$el.popover("destroy"), s.trigger("mySnippetDrag", t, n.model), n.mouseUpHandler();
}
);
}
,
preventPropagation: function (e){
e.stopPropagation(), e.preventDefault();
}
,
mouseUpHandler: function (t){
e("body").off("mousemove");
}
,
saveHandler: function (n){
return function (r){
r.preventDefault();
var i = e(".popover .field");
t.each(i, function (r){
var i = e(r), s = i.attr("data-type"), o = i.attr("id");
switch (s){
case "checkbox": n.model.setField(o, i.is(":checked"));
break ;
case "input": n.model.setField(o, i.val());
break ;
case "textarea": n.model.setField(o, i.val());
break ;
case "textarea-split": n.model.setField(o, t.chain(i.val().split("\n")).map(function (t){
return e.trim(t);
}
).filter(function (e){
return _AN_Read_length("length", e) > 0;
}
).value());
break ;
case "select": var u = t.map(i.find("option"), function (t){
return {
value: t.value,
selected: t.selected,
label: e(t).text()}
;
}
);
n.model.setField(o, u);
}
}
), n.model.trigger("change"), e(".popover").remove();
}
;
}
,
cancelHandler: function (t){
return function (n){
n.preventDefault(), e(".popover").remove(), t.model.trigger("change");
}
;
}
}
);
}
), define("collections/my-form-snippets", ["jquery", "underscore", "backbone", "models/snippet", "collections/snippets", "views/my-form-snippet"] , function (e, t, n, r, i, s){
return i.extend({
model: r,
renderAll: function (){
return this.map(function (e){
return (new s({
model: e}
)).render(true );
}
);
}
,
renderAllClean: function (){
return this.map(function (e){
return (new s({
model: e}
)).render(false );
}
);
}
}
);
}
), define("text!templates/app/tab-nav.html", [] , function (){
return '
<%= title %> \n';
}
), define("views/tab", ["jquery", "underscore", "backbone", "text!templates/app/tab-nav.html"] , function (e, t, n, r){
return n.View.extend({
tagName: "div",
className: "tab-pane",
initialize: function (){
this.id = _AN_Call_replace("replace", this.options.title.toLowerCase(), /\W/g, ""), this.tabNavTemplate = t.template(r), this.render();
}
,
render: function (){
var n = this;
n.collection !== undefined? t.each(this.collection.renderAll(), function (e){
n.$el.append(e);
}
): n.options.content && n.$el.append(n.options.content), e("#formtabs").append(this.tabNavTemplate({
title: this.options.title,
id: this.id}
)), this.$el.attr("id", this.id), this.$el.appendTo(".tab-content"), this.delegateEvents();
}
}
);
}
), define("text!templates/app/renderform.html", [] , function (){
return '
\n';
}
), define("views/my-form", ["jquery", "underscore", "backbone", "views/temp-snippet", "helper/pubsub", "text!templates/app/renderform.html"] , function (e, t, n, r, i, s){
return n.View.extend({
tagName: "fieldset",
initialize: function (){
this.collection.on("add", this.render, this), this.collection.on("remove", this.render, this), this.collection.on("change", this.render, this), i.on("mySnippetDrag", this.handleSnippetDrag, this), i.on("tempMove", this.handleTempMove, this), i.on("tempDrop", this.handleTempDrop, this), this.$build = e("#build"), this.renderForm = t.template(s), this.render();
}
,
render: function (){
this.$el.empty();
var n = this;
t.each(this.collection.renderAll(), function (e){
n.$el.append(e);
}
), e("#render").val(n.renderForm({
text: t.map(this.collection.renderAllClean(), function (e){
return e.html();
}
).join("\n")}
)), this.$el.appendTo("#build form"), this.delegateEvents();
}
,
getBottomAbove: function (n){
var r = e(this.$el.find(".component")), i = t.find(r, function (t){
return e(t).position().top + e(t).height() > n - 90? true : false ;
}
);
return i? i: r[0];
}
,
handleSnippetDrag: function (t, n){
e("body").append((new r({
model: n}
)).render()), this.collection.remove(n), i.trigger("newTempPostRender", t);
}
,
handleTempMove: function (t){
e(".target").removeClass("target"), t.pageX >= this.$build.position().left && t.pageX < this.$build.width() + this.$build.position().left && t.pageY >= this.$build.position().top && t.pageY < this.$build.height() + this.$build.position().top? e(this.getBottomAbove(t.pageY)).addClass("target"): e(".target").removeClass("target");
}
,
handleTempDrop: function (t, n, r){
if (t.pageX >= this.$build.position().left && t.pageX < this.$build.width() + this.$build.position().left && t.pageY >= this.$build.position().top && t.pageY < this.$build.height() + this.$build.position().top) {
var r = e(".target").index();
e(".target").removeClass("target"), this.collection.add(n, {
at: r + 1}
);
}
else e(".target").removeClass("target");
}
}
);
}
), define("text!data/input.json", [] , function (){
return '[\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "textinput"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Text Input"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Text Input"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "passwordinput"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Password Input"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Password Input"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "searchinput"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Search Input"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Search Input"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "prependedtext"\n },\n "prepend": {\n "type": "input",\n "label": "Prepend",\n "value": "prepend"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Prepended Text"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Prepended Text"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "appendedtext"\n },\n "append": {\n "type": "input",\n "label": "Append",\n "value": "append"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Appended Text"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Appended Text"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "prependedcheckbox"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Prepended Checkbox"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "checked": {\n "type": "checkbox",\n "label": "Checked",\n "value": false\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Prepended Checkbox"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "appendedcheckbox"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Appended Checkbox"\n },\n "helptext": {\n "type": "input",\n "label": "Help Text",\n "value": "help"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "checked": {\n "type": "checkbox",\n "label": "Checked",\n "value": false\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Appended Checkbox"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "buttondropdown"\n },\n "buttonoptions": {\n "type": "textarea-split",\n "label": "Options",\n "value": [\n "Option one",\n "Option two",\n "Option three"\n ]\n },\n "buttontext": {\n "type": "input",\n "label": "Button Text",\n "value": "Action"\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Button Drop Down"\n },\n "placeholder": {\n "type": "input",\n "label": "Placeholder",\n "value": "placeholder"\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n }\n },\n "title": "Button Drop Down"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "textarea"\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Text Area"\n },\n "textarea": {\n "type": "textarea",\n "label": "Starting Text",\n "value": "default text"\n }\n },\n "title": "Text Area"\n }\n]';
}
), define("text!data/radio.json", [] , function (){
return '[\n {\n "fields": {\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Multiple Radios"\n },\n "radios": {\n "type": "textarea-split",\n "label": "Radios",\n "value": [\n "Option one",\n "Option two"\n ]\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n },\n "name": {\n "type": "input",\n "label": "Group Name",\n "value": "radios"\n }\n },\n "title": "Multiple Radios"\n },\n {\n "fields": {\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Inline Radios"\n },\n "radios": {\n "type": "textarea-split",\n "label": "Radios",\n "value": [\n 1234\n ]\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n },\n "name": {\n "type": "input",\n "label": "Group Name",\n "value": "radios"\n }\n },\n "title": "Multiple Radios Inline"\n },\n {\n "fields": {\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Multiple Checkboxes"\n },\n "checkboxes": {\n "type": "textarea-split",\n "label": "Checkboxes",\n "value": [\n "Option one",\n "Option two"\n ]\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n },\n "name": {\n "type": "input",\n "label": "Group Name",\n "value": "checkboxes"\n }\n },\n "title": "Multiple Checkboxes"\n },\n {\n "fields": {\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Inline Checkboxes"\n },\n "checkboxes": {\n "type": "textarea-split",\n "label": "Checkboxes",\n "value": [\n 1234\n ]\n },\n "required": {\n "type": "checkbox",\n "label": "Required",\n "value": false\n },\n "name": {\n "type": "input",\n "label": "Group Name",\n "value": "checkboxes"\n }\n },\n "title": "Multiple Checkboxes Inline"\n }\n]';
}
), define("text!data/select.json", [] , function (){
return '[\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "selectbasic"\n },\n "options": {\n "type": "textarea-split",\n "label": "Options",\n "value": [\n "Option one",\n "Option two"\n ]\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Select Basic"\n }\n },\n "title": "Select Basic"\n },\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "selectmultiple"\n },\n "options": {\n "type": "textarea-split",\n "label": "Options",\n "value": [\n "Option one",\n "Option two"\n ]\n },\n "inputsize": {\n "type": "select",\n "label": "Input Size",\n "value": [\n {\n "label": "Mini",\n "value": "input-mini",\n "selected": false\n },\n {\n "label": "Small",\n "value": "input-small",\n "selected": false\n },\n {\n "label": "Medium",\n "value": "input-medium",\n "selected": false\n },\n {\n "label": "Large",\n "value": "input-large",\n "selected": false\n },\n {\n "label": "Xlarge",\n "value": "input-xlarge",\n "selected": true\n },\n {\n "label": "Xxlarge",\n "value": "input-xxlarge",\n "selected": false\n }\n ]\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Select Multiple"\n }\n },\n "title": "Select Multiple"\n }\n]';
}
), define("text!data/buttons.json", [] , function (){
return '[\n {\n "fields": {\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "filebutton"\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "File Button"\n }\n },\n "title": "File Button"\n },\n {\n "fields": {\n "buttontype": {\n "type": "select",\n "label": "Button Type",\n "value": [\n {\n "label": "Default",\n "value": "btn-default",\n "selected": false\n },\n {\n "label": "Primary",\n "value": "btn-primary",\n "selected": true\n },\n {\n "label": "Info",\n "value": "btn-info",\n "selected": false\n },\n {\n "label": "Success",\n "value": "btn-success",\n "selected": false\n },\n {\n "label": "Warning",\n "value": "btn-warning",\n "selected": false\n },\n {\n "label": "Danger",\n "value": "btn-danger",\n "selected": false\n },\n {\n "label": "Inverse",\n "value": "btn-inverse",\n "selected": false\n }\n ]\n },\n "id": {\n "type": "input",\n "label": "ID / Name",\n "value": "singlebutton"\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Single Button"\n },\n "buttonlabel": {\n "type": "input",\n "label": "Button Label",\n "value": "Button"\n }\n },\n "title": "Single Button"\n },\n {\n "fields": {\n "button2type": {\n "type": "select",\n "label": "Button Type",\n "value": [\n {\n "label": "Default",\n "value": "btn-default",\n "selected": false\n },\n {\n "label": "Primary",\n "value": "btn-primary",\n "selected": false\n },\n {\n "label": "Info",\n "value": "btn-info",\n "selected": false\n },\n {\n "label": "Success",\n "value": "btn-success",\n "selected": false\n },\n {\n "label": "Warning",\n "value": "btn-warning",\n "selected": false\n },\n {\n "label": "Danger",\n "value": "btn-danger",\n "selected": true\n },\n {\n "label": "Inverse",\n "value": "btn-inverse",\n "selected": false\n }\n ]\n },\n "id": {\n "type": "input",\n "label": "Button 1 ID / Name",\n "value": "button1id"\n },\n "id2": {\n "type": "input",\n "label": "Button 2 ID / Name",\n "value": "button2id"\n },\n "label": {\n "type": "input",\n "label": "Label Text",\n "value": "Double Button"\n },\n "button1type": {\n "type": "select",\n "label": "Button Type",\n "value": [\n {\n "label": "Default",\n "value": "btn-default",\n "selected": false\n },\n {\n "label": "Primary",\n "value": "btn-primary",\n "selected": false\n },\n {\n "label": "Info",\n "value": "btn-info",\n "selected": false\n },\n {\n "label": "Success",\n "value": "btn-success",\n "selected": true\n },\n {\n "label": "Warning",\n "value": "btn-warning",\n "selected": false\n },\n {\n "label": "Danger",\n "value": "btn-danger",\n "selected": false\n },\n {\n "label": "Inverse",\n "value": "btn-inverse",\n "selected": false\n }\n ]\n },\n "button1label": {\n "type": "input",\n "label": "Button Label",\n "value": "Good Button"\n },\n "button2label": {\n "type": "input",\n "label": "Button Label",\n "value": "Scary Button"\n }\n },\n "title": "Double Button"\n }\n]';
}
), define("text!templates/app/render.html", [] , function (){
return '
Rendered source of your form: \n
\n';
}
), define("text!templates/app/about.html", [] , function (){
return '
About \n\n
\nCreated By Adam Moore (@minikomi ) to help take the stress out of \nwriting all that markup to get bootstrap forms together. The original version of this was a big jQuery\nspaghetti mess, so as of March 2013 it has been rewritten using backbone.js and \ntakes advantage of underscode.js templates .\n
\n\n
\nIf you have a problem, or want a specific snippet added please check out the \ngithub project . Note, this is only a simple tool so I\'m not \nthat keen on adding many features (eg. saving/exporting forms, embedding forms etc.). \n
\n\n
\n Adding snippets is quite simple now (due to the rewrite!) so please don\'t hesitate to open an issue!\n
\n';
}
), define("app/app", ["jquery", "underscore", "backbone", "collections/snippets", "collections/my-form-snippets", "views/tab", "views/my-form", "text!data/input.json", "text!data/radio.json", "text!data/select.json", "text!data/buttons.json", "text!templates/app/render.html", "text!templates/app/about.html"] , function (e, t, n, r, i, s, o, u, a, f, l, c, h){
return {
initialize: function (){
new s({
title: "Input",
collection: new r(JSON.parse(u))}
), new s({
title: "Radios / Checkboxes",
collection: new r(JSON.parse(a))}
), new s({
title: "Select",
collection: new r(JSON.parse(f))}
), new s({
title: "Buttons",
collection: new r(JSON.parse(l))}
), new s({
title: "Rendered",
content: c}
), new s({
title: "About",
content: h}
), e("#components .tab-pane").first().addClass("active"), e("#formtabs li").first().addClass("active"), new o({
title: "Original",
collection: new i([{
title: "Form Name",
fields: {
name: {
label: "Form Name",
type: "input",
value: "Form Name"}
}
}
] )}
);
}
}
;
}
), require.config({
baseUrl: "assets/js/lib/",
shim: {
backbone: {
deps: ["underscore", "jquery"] ,
exports: "Backbone"}
,
underscore: {
exports: "_"}
,
bootstrap: {
deps: ["jquery"] ,
exports: "$.fn.popover"}
}
,
paths: {
app: "..",
collections: "../collections",
data: "../data",
models: "../models",
helper: "../helper",
templates: "../templates",
views: "../views"}
}
), require(["app/app"] , function (e){
e.initialize();
}
), define("../main", function (){
}
);