diff --git a/app.js b/app.js index e0e9ee4..92c62f5 100644 --- a/app.js +++ b/app.js @@ -36,8 +36,8 @@ app.configure('development', function(){ }); function requireLogin(req, res, next) { - - if (req.session.email) { + console.log(req.session, req.cookies); + if (req.session.email || req.cookies.email) { next(); // allow the next route to run } else { req.session.redirect = req.route.path; @@ -50,6 +50,8 @@ app.get('/', routes.index); app.get('/login', routes.login); +app.get('/logout', routes.logout); + app.post('/user/set/username', user.setUsername); app.post('/auth/verify', auth.verify); @@ -58,8 +60,7 @@ app.post('/user/payswarm', auth.payswarmVerify); app.get('/auth/createKeyPair', auth.createKeyPair); app.post('/payswarm/register', requireLogin, auth.registerKey); -app.post('/payswarm/complete/:email', auth.completePayswarmRegistration); -app.get('/payswarm/complete/:email', auth.completePayswarmRegistration); +app.post('/payswarm/complete', auth.completePayswarmRegistration); /* Editing assets @@ -71,7 +72,7 @@ app.post('/assets/asset/edit', assets.update); /* New asset */ -app.get('/newasset', requireLogin, routes.newasset); +app.get('/newasset', routes.newasset); // should require login app.post('/newasset/process/', assets.createAssetAndListing); app.post('/newasset/save', assets.saveAsset); @@ -91,9 +92,11 @@ app.get('/assets/asset/:id/edit', assets.edit); app.get('/listings/listing/:id', assets.getListing); app.get('/assets/asset/:id/content', function (req, res){ - res.end('The content!'); + res.end('The content!'); }); +app.post('/assets/asset/:id/download', assets.download); + app.get('/decrypt/:type/:id', assets.decrypt); /* diff --git a/changelog b/changelog new file mode 100644 index 0000000..d8aeab5 --- /dev/null +++ b/changelog @@ -0,0 +1,2 @@ +* better signup +* gravatar \ No newline at end of file diff --git a/lib/db.js b/lib/db.js index 2c6a881..6c74340 100644 --- a/lib/db.js +++ b/lib/db.js @@ -79,13 +79,9 @@ var dbUtils = { }, findOne: { user : function (query, cb) { - schemas.User.findOne(query, function (err, docs) { - if (!docs) { - dbUtils.create.user(query, cb); - } else { - cb(docs); - } - }); + console.log('finding one user', query); + // dbUtils.create.user(query, cb); + schemas.User.findOne(query, cb); }, asset: { update: function (asset, query, cb) { diff --git a/lib/user.js b/lib/user.js index 045f7a8..7974eaa 100644 --- a/lib/user.js +++ b/lib/user.js @@ -5,14 +5,44 @@ module.exports = function (opts) { var userUtils = {}; function checkUser (json, cb) { - db.findOne.user({email : json.email}, cb); + db.findOne.user({email : json.email}, function (err, doc) { + if (err) { + console.log('error checking user'); + console.log(json, err); + cb(err); + } else { + if (doc) { + cb(null, doc); + } else { + db.create.user(json, cb); + } + } + }); + } + + function isUnique (query, success, fail) { + console.log('checking ',query); + db.findOne.user(query, function (err, doc) { + console.log('findOne retured', err, doc); + if (err) { + fail(err); + } else { + if (doc) { + fail(); + } else { + console.log('unique calling cb'); + success(); + } + } + }); } function updateFields (query, user, cb) { - db.findOneAndUpdate(user, query, cb); + db.findOneAndUpdate(user, query, cb); } function get (fields, user, cb) { + console.log('get',fields,user); db.get.user(fields, user, cb); } @@ -31,6 +61,7 @@ module.exports = function (opts) { userUtils.checkUser = checkUser; userUtils.updateFields = updateFields; userUtils.get = get; + userUtils.isUnique = isUnique; userUtils.addPurchase = addPurchase; return userUtils; diff --git a/package.json b/package.json index 4370f59..b0b20ef 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "start": "node app.js" }, - "host": "http://appstoredemo.payswarm.com", + "host": "http://12e29bb4.ngrok.com", "keywords": [ "webpayments", "persona", @@ -34,7 +34,11 @@ "url": "https://github.com/piatra/webpayments-marketplace" }, "devDependencies": { - "requirejs": "~2.1.6", - "zipper": "~0.3.0" + "requirejs": "~2.1.8", + "zipper": "~0.3.0", + "grunt": "~0.4.1", + "grunt-mocha-phantomjs": "~0.3.0", + "chai": "~1.7.2", + "mocha": "~1.13.0" } } diff --git a/public/javascripts/assert.js b/public/javascripts/assert.js new file mode 100644 index 0000000..bbe81ee --- /dev/null +++ b/public/javascripts/assert.js @@ -0,0 +1,14 @@ +define([], function () { + + function existy (x) { + return x != null; + } + + function assert (value, message) { + if (!existy(value)) { + throw new Error(message); + } + } + + return assert; +}); \ No newline at end of file diff --git a/public/javascripts/event-handlers.js b/public/javascripts/event-handlers.js index 9ff901f..79d786f 100644 --- a/public/javascripts/event-handlers.js +++ b/public/javascripts/event-handlers.js @@ -1,21 +1,26 @@ +/* global define, $, console */ + +'use strict'; + define([ 'message', 'event-login', 'event-assets', - 'modal' - ], function (message, loginEv, assetsEv, modal, upload) { + 'user', + 'formHandler' +], function (message, loginEv, assetsEv, user, formHandler) { var verify = { assertion : function (assertion) { $('.js-handler--login').html('Logging in').addClass('loading'); - $.post("/auth/verify", { assertion: assertion }) + $.post('/auth/verify', { assertion: assertion }) .success(loginEv.handleLogin) .fail(function (data) { console.log('fail', data); }) - .done(function (data) { + .done(function () { console.log('done'); }) ; @@ -25,15 +30,22 @@ define([ var evHandler = { init : function () { - var email = ($('img', $('.js-handler--login')).length) - ? null - : $('.js-handler--login').text().trim() - ; + var email = $('.js-handler--email').text().trim(); + + user = user({ + email: email + }); + + if (typeof logout != 'undefined' && logout) + email = null; + else + var logout = false; navigator.id.watch({ onlogin: function(assertion) { - if ($('img', $('.js-handler--login:not(.hidden)')).length) + if (!logout && $('img', $('.js-handler--login:not(.hidden)')).length) { verify.assertion(assertion); + } }, onlogout: function() { console.log('logout'); @@ -45,21 +57,14 @@ define([ navigator.id.request(); }); - // $('.js-handler--change-username').on('submit', assetsEv.create(assetsEv.usernameChanged)); + $('.js-handler--change-username').on('submit', user.setUsername); - // FIXME - // if ($('.js-handler--show-payswarm-verify').length) { - // $.post('/payswarm/register/', { - // publicKey: $('.js-handler--show-payswarm-verify').text() - // }).success(loginEv.displayPayswarmMsg); - // } + if (email) assetsEv.count(email); -// assetsEv.loadLatest($('.container--newest')); - console.log('count'); - assetsEv.count(email); + $('.js-handler--add-more-payee').on('click', formHandler.duplicateRow) } }; return evHandler; -}); \ No newline at end of file +}); diff --git a/public/javascripts/formHandler.js b/public/javascripts/formHandler.js new file mode 100644 index 0000000..00b7406 --- /dev/null +++ b/public/javascripts/formHandler.js @@ -0,0 +1,19 @@ +define([], function () { + + var formHandler = { + duplicateRow: function (e) { + e.preventDefault(); + var $this = $(this); + var row = $this.parents('tr'); + + var rowClone = row.clone(); + rowClone.insertAfter(row); + + $this.parents('p').remove(); + rowClone.find('a').on('click', formHandler.duplicateRow); + } + } + + return formHandler; + +}); \ No newline at end of file diff --git a/public/javascripts/libs/jquery.min.js b/public/javascripts/libs/jquery.min.js index c209ca6..4567d37 100644 --- a/public/javascripts/libs/jquery.min.js +++ b/public/javascripts/libs/jquery.min.js @@ -1,4 +1,37 @@ -/*! jQuery v2.0.4-pre -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-css,-css/defaultDisplay,-css/hidden-visible-selectors,-css/var/cssExpand,-css/var/isHidden,-effects,-effects/Tween,-effects/animated-selector,-dimensions,-offset,-deprecated,-event/alias,-wrap | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=function(c){if(c=c||a,!c.document)throw new Error("jQuery requires a window with a document");return b(c)}:b(a)}(this,function(a){var b="undefined";var c=[];var d=c.slice;var e=c.concat;var f=c.push;var g=c.indexOf;var h={};var i=h.toString;var j=h.hasOwnProperty;var k="".trim;var l,m=a.document,n=a.jQuery,o=a.$,p="2.0.4-pre -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-css,-css/defaultDisplay,-css/hidden-visible-selectors,-css/var/cssExpand,-css/var/isHidden,-effects,-effects/Tween,-effects/animated-selector,-dimensions,-offset,-deprecated,-event/alias,-wrap",q=function(a,b){return new q.fn.init(a,b,l)},r=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,s=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,t=/^-ms-/,u=/-([\da-z])/gi,v=function(a,b){return b.toUpperCase()};q.fn=q.prototype={jquery:p,constructor:q,init:function(a,b,c){var d,e;if(!a)return this;if("string"==typeof a){if(d="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:r.exec(a),!d||!d[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(d[1]){if(b=b instanceof q?b[0]:b,q.merge(this,q.parseHTML(d[1],b&&b.nodeType?b.ownerDocument||b:m,!0)),s.test(d[1])&&q.isPlainObject(b))for(d in b)q.isFunction(this[d])?this[d](b[d]):this.attr(d,b[d]);return this}return e=m.getElementById(d[2]),e&&e.parentNode&&(this.length=1,this[0]=e),this.context=m,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):q.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(q):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),q.makeArray(a,this))},selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a){var b=q.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return q.each(this,a,b)},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},map:function(a){return this.pushStack(q.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},q.fn.init.prototype=q.fn,q.extend=q.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[1]||{},h=2),"object"==typeof g||q.isFunction(g)||(g={}),i===h&&(g=this,--h);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(q.isPlainObject(d)||(e=q.isArray(d)))?(e?(e=!1,f=c&&q.isArray(c)?c:[]):f=c&&q.isPlainObject(c)?c:{},g[b]=q.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},q.extend({expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),isReady:!0,noConflict:function(b){return a.$===q&&(a.$=o),b&&a.jQuery===q&&(a.jQuery=n),q},isFunction:function(a){return"function"===q.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},isPlainObject:function(a){if("object"!==q.type(a)||a.nodeType||q.isWindow(a))return!1;try{if(a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||m;var d=s.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=q.buildFragment([a],b,e),e&&e.length&&q(e).remove(),q.merge([],d.childNodes))},parseJSON:JSON.parse,parseXML:function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&q.error("Invalid XML: "+a),b},noop:function(){},globalEval:function(a){var b,c=eval;a=q.trim(a),a&&(1===a.indexOf("use strict")?(b=m.createElement("script"),b.text=a,m.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=w(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":k.call(a)},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?q.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){var c=+b.length,d=0,e=a.length;for(;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;for(c=!!c;g>f;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=w(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&(i[i.length]=d);else for(f in a)d=b(a[f],f,c),null!=d&&(i[i.length]=d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),q.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||q.guid++,f):void 0},access:function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===q.type(c)){e=!0;for(h in c)q.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,q.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(q(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},now:Date.now}),q.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=a.length,c=q.type(a);return q.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||"function"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}l=q(m);var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=fb(),x=fb(),y=fb(),z=!1,A=function(a,b){return a===b?(z=!0,0):0},B="undefined",C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=E.indexOf||function(a){var b=0,c=this.length;for(;c>b;b++)if(this[b]===a)return b;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")"+L+"*(?:([*^$|!~]?=)"+L+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+N+")|)|)"+L+"*\\]",P=":("+M+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+O.replace(3,8)+")*)|.*)\\)|)",Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp(L+"*[+~]"),U=new RegExp("="+L+"*([^\\]'\"]*)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/^(?:input|select|textarea|button)$/i,_=/^h\d$/i,ab=/'|\\/g,bb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),cb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(55296|d>>10,56320|1023&d)};try{H.apply(E=I.call(t.childNodes),t.childNodes),E[t.childNodes.length].nodeType}catch(db){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function eb(a,b,d,e){var f,g,h,i,j,m,p,q,u,v;if((b?b.ownerDocument||b:t)!==l&&k(b),b=b||l,d=d||[],!a||"string"!=typeof a)return d;if(1!==(i=b.nodeType)&&9!==i)return[];if(n&&!e){if(f=Z.exec(a))if(h=f[1]){if(9===i){if(g=b.getElementById(h),!g||!g.parentNode)return d;if(g.id===h)return d.push(g),d}else if(b.ownerDocument&&(g=b.ownerDocument.getElementById(h))&&r(b,g)&&g.id===h)return d.push(g),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((h=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(h)),d}if(c.qsa&&(!o||!o.test(a))){if(q=p=s,u=b,v=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){m=ob(a),(p=b.getAttribute("id"))?q=p.replace(ab,"\\$&"):b.setAttribute("id",q),q="[id='"+q+"'] ",j=m.length;while(j--)m[j]=q+pb(m[j]);u=T.test(a)&&b.parentNode||b,v=m.join(",")}if(v)try{return H.apply(d,u.querySelectorAll(v)),d}catch(w){}finally{p||b.removeAttribute("id")}}}return xb(a.replace(Q,"$1"),b,d,e)}function fb(){var a=[];function b(c,d){return a.push(c+=" ")>e.cacheLength&&delete b[a.shift()],b[c]=d}return b}function gb(a){return a[s]=!0,a}function hb(a){var b=l.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ib(a,b){var c=a.split("|"),d=a.length;while(d--)e.attrHandle[c[d]]=b}function jb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function mb(a){return gb(function(b){return b=+b,gb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}g=eb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},c=eb.support={},k=eb.setDocument=function(a){var b=a?a.ownerDocument||a:t,d=b.defaultView;return b!==l&&9===b.nodeType&&b.documentElement?(l=b,m=b.documentElement,n=!g(b),d&&d.attachEvent&&d!==d.top&&d.attachEvent("onbeforeunload",function(){k()}),c.attributes=hb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=hb(function(a){return a.appendChild(b.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=hb(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=hb(function(a){return m.appendChild(a).id=s,!b.getElementsByName||!b.getElementsByName(s).length}),c.getById?(e.find.ID=function(a,b){if(typeof b.getElementById!==B&&n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},e.filter.ID=function(a){var b=a.replace(bb,cb);return function(a){return a.getAttribute("id")===b}}):(delete e.find.ID,e.filter.ID=function(a){var b=a.replace(bb,cb);return function(a){var c=typeof a.getAttributeNode!==B&&a.getAttributeNode("id");return c&&c.value===b}}),e.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==B?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},e.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==B&&n?b.getElementsByClassName(a):void 0},p=[],o=[],(c.qsa=Y.test(b.querySelectorAll))&&(hb(function(a){a.innerHTML="",a.querySelectorAll("[selected]").length||o.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll(":checked").length||o.push(":checked")}),hb(function(a){var c=b.createElement("input");c.setAttribute("type","hidden"),a.appendChild(c).setAttribute("t",""),a.querySelectorAll("[t^='']").length&&o.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(c.matchesSelector=Y.test(q=m.webkitMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&hb(function(a){c.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",P)}),o=o.length&&new RegExp(o.join("|")),p=p.length&&new RegExp(p.join("|")),r=Y.test(m.contains)||m.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},A=m.compareDocumentPosition?function(a,d){if(a===d)return z=!0,0;var e=d.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(d);return e?1&e||!c.sortDetached&&d.compareDocumentPosition(a)===e?a===b||r(t,a)?-1:d===b||r(t,d)?1:j?J.call(j,a)-J.call(j,d):0:4&e?-1:1:a.compareDocumentPosition?-1:1}:function(a,c){var d,e=0,f=a.parentNode,g=c.parentNode,h=[a],i=[c];if(a===c)return z=!0,0;if(!f||!g)return a===b?-1:c===b?1:f?-1:g?1:j?J.call(j,a)-J.call(j,c):0;if(f===g)return jb(a,c);d=a;while(d=d.parentNode)h.unshift(d);d=c;while(d=d.parentNode)i.unshift(d);while(h[e]===i[e])e++;return e?jb(h[e],i[e]):h[e]===t?-1:i[e]===t?1:0},b):l},eb.matches=function(a,b){return eb(a,null,null,b)},eb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!n||p&&p.test(b)||o&&o.test(b)))try{var d=q.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return eb(b,l,null,[a]).length>0},eb.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},eb.attr=function(a,b){(a.ownerDocument||a)!==l&&k(a);var d=e.attrHandle[b.toLowerCase()],f=d&&D.call(e.attrHandle,b.toLowerCase())?d(a,b,!n):void 0;return void 0===f?c.attributes||!n?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null:f},eb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},eb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(z=!c.detectDuplicates,j=!c.sortStable&&a.slice(0),a.sort(A),z){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return a},f=eb.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},e=eb.selectors={cacheLength:50,createPseudo:gb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(bb,cb),a[3]=(a[4]||a[5]||"").replace(bb,cb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||eb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&eb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return X.CHILD.test(a[0])?null:(a[3]&&void 0!==a[4]?a[2]=a[4]:c&&V.test(c)&&(b=ob(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(bb,cb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=w[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&w(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==B&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=eb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),t=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&t){k=q[s]||(q[s]={}),j=k[a]||[],n=j[0]===u&&j[1],m=j[0]===u&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[u,n,m];break}}else if(t&&(j=(b[s]||(b[s]={}))[a])&&j[0]===u)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(t&&((l[s]||(l[s]={}))[a]=[u,m]),l===b))break;return m-=e,m===d||0===m%d&&m/d>=0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||eb.error("unsupported pseudo: "+a);return d[s]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?gb(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=J.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:gb(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[s]?gb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:gb(function(a){return function(b){return eb(a,b).length>0}}),contains:gb(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),lang:gb(function(a){return W.test(a||"")||eb.error("unsupported lang: "+a),a=a.replace(bb,cb).toLowerCase(),function(b){var c;do if(c=n?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeName>"@"||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!e.pseudos.empty(a)},header:function(a){return _.test(a.nodeName)},input:function(a){return $.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:mb(function(){return[0]}),last:mb(function(a,b){return[b-1]}),eq:mb(function(a,b,c){return[0>c?c+b:c]}),even:mb(function(a,b){var c=0;for(;b>c;c+=2)a.push(c);return a}),odd:mb(function(a,b){var c=1;for(;b>c;c+=2)a.push(c);return a}),lt:mb(function(a,b,c){var d=0>c?c+b:c;for(;--d>=0;)a.push(d);return a}),gt:mb(function(a,b,c){var d=0>c?c+b:c;for(;++db;b++)d+=a[b].value;return d}function qb(a,b,c){var e=b.dir,f=c&&"parentNode"===e,g=v++;return b.first?function(b,c,d){while(b=b[e])if(1===b.nodeType||f)return a(b,c,d)}:function(b,c,h){var i,j,k,l=u+" "+g;if(h){while(b=b[e])if((1===b.nodeType||f)&&a(b,c,h))return!0}else while(b=b[e])if(1===b.nodeType||f)if(k=b[s]||(b[s]={}),(j=k[e])&&j[0]===l){if((i=j[1])===!0||i===d)return i===!0}else if(j=k[e]=[l],j[1]=a(b,c,h)||d,j[1]===!0)return!0}}function rb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function sb(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=null!=b;for(;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function tb(a,b,c,d,e,f){return d&&!d[s]&&(d=tb(d)),e&&!e[s]&&(e=tb(e,f)),gb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||wb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:sb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=sb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=sb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function ub(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],j=g?1:0,k=qb(function(a){return a===b},h,!0),l=qb(function(a){return J.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==i)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];for(;f>j;j++)if(c=e.relative[a[j].type])m=[qb(rb(m),c)];else{if(c=e.filter[a[j].type].apply(null,a[j].matches),c[s]){for(d=++j;f>d;d++)if(e.relative[a[d].type])break;return tb(j>1&&rb(m),j>1&&pb(a.slice(0,j-1).concat({value:" "===a[j-2].type?"*":""})).replace(Q,"$1"),c,d>j&&ub(a.slice(j,d)),f>d&&ub(a=a.slice(d)),f>d&&pb(a))}m.push(c)}return rb(m)}function vb(a,b){var c=0,f=b.length>0,g=a.length>0,h=function(h,j,k,m,n){var o,p,q,r=[],s=0,t="0",v=h&&[],w=null!=n,x=i,y=h||g&&e.find.TAG("*",n&&j.parentNode||j),z=u+=null==x?1:Math.random()||.1,A=y.length;for(w&&(i=j!==l&&j,d=c);t!==A&&null!=(o=y[t]);t++){if(g&&o){p=0;while(q=a[p++])if(q(o,j,k)){m.push(o);break}w&&(u=z,d=++c)}f&&((o=!q&&o)&&s--,h&&v.push(o))}if(s+=t,f&&t!==s){p=0;while(q=b[p++])q(v,r,j,k);if(h){if(s>0)while(t--)v[t]||r[t]||(r[t]=F.call(m));r=sb(r)}H.apply(m,r),w&&!h&&r.length>0&&s+b.length>1&&eb.uniqueSort(m)}return w&&(u=z,i=x),v};return f?gb(h):h}h=eb.compile=function(a,b){var c,d=[],e=[],f=y[a+" "];if(!f){b||(b=ob(a)),c=b.length;while(c--)f=ub(b[c]),f[s]?d.push(f):e.push(f);f=y(a,vb(e,d))}return f};function wb(a,b,c){var d=0,e=b.length;for(;e>d;d++)eb(a,b[d],c);return c}function xb(a,b,d,f){var g,i,j,k,l,m=ob(a);if(!f&&1===m.length){if(i=m[0]=m[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&c.getById&&9===b.nodeType&&n&&e.relative[i[1].type]){if(b=(e.find.ID(j.matches[0].replace(bb,cb),b)||[])[0],!b)return d;a=a.slice(i.shift().value.length)}g=X.needsContext.test(a)?0:i.length;while(g--){if(j=i[g],e.relative[k=j.type])break;if((l=e.find[k])&&(f=l(j.matches[0].replace(bb,cb),T.test(i[0].type)&&b.parentNode||b))){if(i.splice(g,1),a=f.length&&pb(i),!a)return H.apply(d,f),d;break}}}return h(a,m)(f,b,!n,d,T.test(a)),d}return c.sortStable=s.split("").sort(A).join("")===s,c.detectDuplicates=z,k(),c.sortDetached=hb(function(a){return 1&a.compareDocumentPosition(l.createElement("div"))}),hb(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ib("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&hb(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ib("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),hb(function(a){return null==a.getAttribute("disabled")})||ib(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),eb}(a);q.find=x,q.expr=x.selectors,q.expr[":"]=q.expr.pseudos,q.unique=x.uniqueSort,q.text=x.getText,q.isXMLDoc=x.isXML,q.contains=x.contains;var y=/^.[^:#\[\.,]*$/,z=/^(?:parents|prev(?:Until|All))/,A=q.expr.match.needsContext,B={children:!0,contents:!0,next:!0,prev:!0};q.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(q(a).filter(function(){for(b=0;e>b;b++)if(q.contains(d[b],this))return!0}));for(b=0;e>b;b++)q.find(a,d[b],c);return c=this.pushStack(e>1?q.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},has:function(a){var b=q(a,this),c=b.length;return this.filter(function(){var a=0;for(;c>a;a++)if(q.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(D(this,a||[],!0))},filter:function(a){return this.pushStack(D(this,a||[],!1))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?q(a):a||[],!1).length},closest:function(a,b){var c,d=0,e=this.length,f=[],g=A.test(a)||"string"!=typeof a?q(a,b||this.context):0;for(;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&q.find.matchesSelector(c,a))){c=f.push(c);break}return this.pushStack(f.length>1?q.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(q(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){var c="string"==typeof a?q(a,b):q.makeArray(a&&a.nodeType?[a]:a),d=q.merge(this.get(),c);return this.pushStack(q.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function C(a,b){while((a=a[b])&&1!==a.nodeType);return a}q.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return q.dir(a,"parentNode")},parentsUntil:function(a,b,c){return q.dir(a,"parentNode",c)},next:function(a){return C(a,"nextSibling")},prev:function(a){return C(a,"previousSibling")},nextAll:function(a){return q.dir(a,"nextSibling")},prevAll:function(a){return q.dir(a,"previousSibling")},nextUntil:function(a,b,c){return q.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return q.dir(a,"previousSibling",c)},siblings:function(a){return q.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return q.sibling(a.firstChild)},contents:function(a){return a.contentDocument||q.merge([],a.childNodes)}},function(a,b){q.fn[a]=function(c,d){var e=q.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=q.filter(d,e)),this.length>1&&(B[a]||q.unique(e),z.test(a)&&e.reverse()),this.pushStack(e)}}),q.extend({filter:function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?q.find.matchesSelector(d,a)?[d]:[]:q.find.matches(a,q.grep(b,function(a){return 1===a.nodeType}))},dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&q(a).is(c))break;d.push(a)}return d},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});function D(a,b,c){if(q.isFunction(b))return q.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return q.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return q.filter(b,a,c);b=q.filter(b,a)}return q.grep(a,function(a){return g.call(b,a)>=0!==c})}var E=/\S+/g;var F={};function G(a){var b=F[a]={};return q.each(a.match(E)||[],function(a,c){b[c]=!0}),b}q.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):q.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){q.each(b,function(b,c){var d=q.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&q.each(arguments,function(a,b){var c;while((c=q.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?q.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},q.extend({Deferred:function(a){var b=[["resolve","done",q.Callbacks("once memory"),"resolved"],["reject","fail",q.Callbacks("once memory"),"rejected"],["notify","progress",q.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return q.Deferred(function(c){q.each(b,function(b,f){var g=q.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&q.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?q.extend(a,d):d}},e={};return d.pipe=d.then,q.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&q.isFunction(a.promise)?e:0,g=1===f?a:q.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&q.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;q.fn.ready=function(a){return q.ready.promise().done(a),this},q.extend({isReady:!1,readyWait:1,holdReady:function(a){a?q.readyWait++:q.ready(!0)},ready:function(a){(a===!0?--q.readyWait:q.isReady)||(q.isReady=!0,a!==!0&&--q.readyWait>0||(H.resolveWith(m,[q]),q.fn.trigger&&q(m).trigger("ready").off("ready")))}});function I(){m.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),q.ready()}q.ready.promise=function(b){return H||(H=q.Deferred(),"complete"===m.readyState?setTimeout(q.ready):(m.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},q.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},q.support=function(b){var c=m.createElement("input"),d=m.createDocumentFragment(),e=m.createElement("div"),f=m.createElement("select"),g=f.appendChild(m.createElement("option"));return c.type?(c.type="checkbox",b.checkOn=""!==c.value,b.optSelected=g.selected,b.reliableMarginRight=!0,b.boxSizingReliable=!0,b.pixelPosition=!1,c.checked=!0,b.noCloneChecked=c.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled,c=m.createElement("input"),c.value="t",c.type="radio",b.radioValue="t"===c.value,c.setAttribute("checked","t"),c.setAttribute("name","t"),d.appendChild(c),b.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked,b.focusinBubbles="onfocusin"in a,e.style.backgroundClip="content-box",e.cloneNode(!0).style.backgroundClip="",b.clearCloneStyle="content-box"===e.style.backgroundClip,q(function(){var c,d,f="padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box",g=m.getElementsByTagName("body")[0];g&&(c=m.createElement("div"),c.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",g.appendChild(c).appendChild(e),e.innerHTML="",e.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%",q.swap(g,null!=g.style.zoom?{zoom:1}:{},function(){b.boxSizing=4===e.offsetWidth -}),a.getComputedStyle&&(b.pixelPosition="1%"!==(a.getComputedStyle(e,null)||{}).top,b.boxSizingReliable="4px"===(a.getComputedStyle(e,null)||{width:"4px"}).width,d=e.appendChild(m.createElement("div")),d.style.cssText=e.style.cssText=f,d.style.marginRight=d.style.width="0",e.style.width="1px",b.reliableMarginRight=!parseFloat((a.getComputedStyle(d,null)||{}).marginRight)),g.removeChild(c))}),b):b}({}),q.acceptData=function(a){return a.nodeType?1===a.nodeType||9===a.nodeType:!0};function J(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=q.expando+Math.random()}J.uid=1,J.accepts=q.acceptData,J.prototype={key:function(a){if(!J.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=J.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,q.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(q.isEmptyObject(f))q.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,q.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{q.isArray(b)?d=b.concat(b.map(q.camelCase)):(e=q.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!q.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var K=new J;var L=new J;var M=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,N=/([A-Z])/g;q.extend({hasData:function(a){return L.hasData(a)||K.hasData(a)},data:function(a,b,c){return L.access(a,b,c)},removeData:function(a,b){L.remove(a,b)},_data:function(a,b,c){return K.access(a,b,c)},_removeData:function(a,b){K.remove(a,b)}}),q.fn.extend({data:function(a,b){var c,d,e=this[0],f=0,g=null;if(void 0===a){if(this.length&&(g=L.get(e),1===e.nodeType&&!K.get(e,"hasDataAttrs"))){for(c=e.attributes;ft |