diff --git a/browserid/.gitignore b/browserid/.gitignore index c4c53c804943031be0c755915d85c53e73beca7b..d409b4ca52015ce8058fa6344c16b8ca678eb561 100644 --- a/browserid/.gitignore +++ b/browserid/.gitignore @@ -1 +1,3 @@ +/static/dialog/production.js +/static/dialog/production.css /var diff --git a/browserid/app.js b/browserid/app.js index 968a262120bc9a79ab92f2a88c7be10135c74b56..8bef77366d4ca9480d6e0e20df40c69ce173cfb9 100644 --- a/browserid/app.js +++ b/browserid/app.js @@ -35,9 +35,13 @@ function router(app) { // this should probably be an internal redirect // as soon as relative paths are figured out. - app.get('/sign_in', function(req, resp, next ){ - resp.redirect('/dialog/dialog.html'); - }); + app.get('/sign_in', function(req, res, next ){ + res.render('dialog.ejs', { + title: 'A Better Way to Sign In', + layout: false, + production: exports.production + }); + }); // simple redirects (internal for now) app.get('/register_iframe', internal_redirector('/dialog/register_iframe.html')); @@ -104,6 +108,8 @@ function router(app) { exports.varDir = VAR_DIR; +exports.production = true; + exports.setup = function(server) { server.use(express.cookieParser()); diff --git a/browserid/static/dialog/compressed/production.js b/browserid/static/dialog/compressed/production.js deleted file mode 100644 index dbb3453faa94c9d2d26a1a11c670bc0e871258e4..0000000000000000000000000000000000000000 --- a/browserid/static/dialog/compressed/production.js +++ /dev/null @@ -1,442 +0,0 @@ -steal.plugins("jquery/controller","jquery/controller/subscribe","jquery/view/ejs","jquery/controller/view").css().resources("jschannel","underscore-min","crypto","crypto-stubs","channel","storage").models().controllers("dialog").views("authenticate.ejs","addemail.ejs","body.ejs","bottom-addemail.ejs","bottom-confirmemail.ejs","bottom-continue.ejs","bottom-pickemail.ejs","bottom-signin.ejs","bottom.ejs","confirmemail.ejs","create.ejs","forgotpassword.ejs","signin.ejs","wait.ejs"); -; -steal.end(); -steal.plugins("jquery/class","jquery/lang","jquery/event/destroyed").then(function(e){var o=function(a,b,c){var d;if(b.indexOf(">")===0){b=b.substr(1);d=function(f){if(f.target===a)c.apply(this,arguments);else f.handled=null}}e(a).bind(b,d||c);return function(){e(a).unbind(b,d||c);a=b=c=d=null}},p=function(a,b,c,d){e(a).delegate(b,c,d);return function(){e(a).undelegate(b,c,d);a=c=d=b=null}},j=function(a,b,c,d){return d?p(a,d,b,c):o(a,b,c)},i=function(a){return function(){return a.apply(null,[e(this)].concat(Array.prototype.slice.call(arguments, -0)))}},q=/\./g,r=/_?controllers?/ig,m=function(a){return e.String.underscore(a.replace("jQuery.","").replace(q,"_").replace(r,""))},s=/[^\w]/,t=/^(>?default\.)|(>)/,n=/\{([^\}]+)\}/g,u=/^(?:(.*?)\s)?([\w\.\:>]+)$/,k;e.Class.extend("jQuery.Controller",{init:function(){if(!(!this.shortName||this.fullName=="jQuery.Controller")){this._fullName=m(this.fullName);this._shortName=m(this.shortName);var a=this,b=this.pluginName||this._fullName,c;e.fn[b]||(e.fn[b]=function(d){var f=e.makeArray(arguments),v= -typeof d=="string"&&e.isFunction(a.prototype[d]),w=f[0];this.each(function(){var g=e.data(this,"controllers");if(g=g&&g[b])v?g[w].apply(g,f.slice(1)):g.update.apply(g,f);else a.newInstance.apply(a,[this].concat(f))});return this});this.actions={};for(c in this.prototype)if(this.prototype.hasOwnProperty(c))if(e.isFunction(this.prototype[c]))if(this._isAction(c))this.actions[c]=this._getAction(c);this.onDocument&&new a(document.documentElement)}},hookup:function(a){return new this(a)},_isAction:function(a){if(s.test(a))return true; -else{a=a.replace(t,"");return e.inArray(a,this.listensTo)>-1||e.event.special[a]||e.Controller.processors[a]}},_getAction:function(a,b){n.lastIndex=0;if(!b&&n.test(a))return null;a=(b?e.String.sub(a,b):a).match(u);return{processor:this.processors[a[2]]||k,parts:a}},processors:{},listensTo:[],defaults:{}},{setup:function(a,b){var c,d=this.Class;a=a.jquery?a[0]:a;this.element=e(a).addClass(d._fullName);(e.data(a,"controllers")||e.data(a,"controllers",{}))[d._fullName]=this;this._bindings=[];this.options= -e.extend(e.extend(true,{},d.defaults),b);for(c in d.actions)if(d.actions.hasOwnProperty(c)){b=d.actions[c]||d._getAction(c,this.options);this._bindings.push(b.processor(a,b.parts[2],b.parts[1],this.callback(c),this))}this.called="init";var f=i(this.callback("destroy"));this.element.bind("destroyed",f);this._bindings.push(function(){f.removed=true;e(a).unbind("destroyed",f)});return this.element},bind:function(a,b,c){if(typeof a=="string"){c=b;b=a;a=this.element}return this._binder(a,b,c)},_binder:function(a, -b,c,d){if(typeof c=="string")c=i(this.callback(c));this._bindings.push(j(a,b,c,d));return this._bindings.length},delegate:function(a,b,c,d){if(typeof a=="string"){d=c;c=b;b=a;a=this.element}return this._binder(a,c,d,b)},update:function(a){e.extend(this.options,a)},destroy:function(){if(this._destroyed)throw this.Class.shortName+" controller instance has been deleted";var a=this,b=this.Class._fullName,c;this._destroyed=true;this.element.removeClass(b);e.each(this._bindings,function(d,f){e.isFunction(f)&& -f(a.element[0])});delete this._actions;(c=this.element.data("controllers"))&&c[b]&&delete c[b];e(this).triggerHandler("destroyed");this.element=null},find:function(a){return this.element.find(a)},_set_called:true});k=function(a,b,c,d,f){f=f.Class;if(f.onDocument&&!/^Main(Controller)?$/.test(f.shortName))c=c?"#"+f._shortName+" "+c:"#"+f._shortName;return j(a,b,i(d),c)};var l=e.Controller.processors,x=function(a,b,c,d){return j(window,b.replace(/window/,""),i(d))};e.each("change click contextmenu dblclick keydown keyup keypress mousedown mousemove mouseout mouseover mouseup reset windowresize resize windowscroll scroll select submit dblclick focusin focusout load unload ready hashchange mouseenter mouseleave".split(" "), -function(a,b){l[b]=k});e.each(["windowresize","windowscroll","load","ready","unload","hashchange"],function(a,b){l[b]=x});l.ready=function(a,b,c,d){e(i(d))};e.fn.mixin=function(){var a=e.makeArray(arguments);return this.each(function(){for(var b=0;b<a.length;b++)new a[b](this)})};var h,y=function(a,b){for(h=0;h<b.length;h++)if(typeof b[h]=="string"?a.Class._shortName==b[h]:a instanceof b[h])return true;return false};e.fn.controllers=function(){var a=e.makeArray(arguments),b=[],c;this.each(function(){var d, -f;if(c=e.data(this,"controllers"))for(f in c)if(c.hasOwnProperty(f)){d=c[f];if(!a.length||y(d,a))b.push(d)}});return b};e.fn.controller=function(){return this.controllers.apply(this,arguments)[0]}}); -; -steal.end(); -steal.plugins("jquery").then(function(g){var j=false,n=/xyz/.test(function(){})?/\b_super\b/:/.*/,m=function(a,c,d){d=d||a;for(var b in a)d[b]=typeof a[b]=="function"&&typeof c[b]=="function"&&n.test(a[b])?function(h,i){return function(){var e=this._super,f;this._super=c[h];f=i.apply(this,arguments);this._super=e;return f}}(b,a[b]):a[b]};jQuery.Class=function(){arguments.length&&jQuery.Class.extend.apply(jQuery.Class,arguments)};g.extend(g.Class,{callback:function(a){var c=jQuery.makeArray(arguments), -d;a=c.shift();jQuery.isArray(a)||(a=[a]);d=this;return function(){for(var b=c.concat(jQuery.makeArray(arguments)),h,i=a.length,e=0,f;e<i;e++)if(f=a[e]){if((h=typeof f=="string")&&d._set_called)d.called=f;b=(h?d[f]:f).apply(d,b||[]);if(e<i-1)b=!jQuery.isArray(b)||b._use_call?[b]:b}return b}},getObject:function(a,c){c=c||window;a=a?a.split(/\./):[];for(var d=0;d<a.length;d++)c=c[a[d]]||(c[a[d]]={});return c},newInstance:function(){var a=this.rawInstance(),c;if(a.setup)c=a.setup.apply(a,arguments);if(a.init)a.init.apply(a, -g.isArray(c)?c:arguments);return a},setup:function(a){this.defaults=g.extend(true,{},a.defaults,this.defaults);return arguments},rawInstance:function(){j=true;var a=new this;j=false;return a},extend:function(a,c,d){function b(){if(!j)return this.constructor!==b&&arguments.length?arguments.callee.extend.apply(arguments.callee,arguments):this.Class.newInstance.apply(this.Class,arguments)}if(typeof a!="string"){d=c;c=a;a=null}if(!d){d=c;c=null}d=d||{};var h=this,i=this.prototype,e,f,k,l;j=true;l=new this; -j=false;m(d,i,l);for(e in this)if(this.hasOwnProperty(e)&&g.inArray(e,["prototype","defaults","getObject"])==-1)b[e]=this[e];m(c,this,b);if(a){k=a.split(/\./);f=k.pop();k=i=g.Class.getObject(k.join("."));i[f]=b}g.extend(b,{prototype:l,namespace:k,shortName:f,constructor:b,fullName:a});b.prototype.Class=b.prototype.constructor=b;h=b.setup.apply(b,[h].concat(g.makeArray(arguments)));if(b.init)b.init.apply(b,h||[]);return b}});jQuery.Class.prototype.callback=jQuery.Class.callback})(); -; -steal.end(); -(function(E,A){function ka(a,b,d){if(d===A&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):La.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=A}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function ma(a){var b,d,e,f,h,k,l,n,u,s,y,C=[];f=[];n=c.data(this,this.nodeType?"events":"__events__");if(typeof n==="function")n= -n.events;if(!(a.liveFired===this||!n||!n.live||a.button&&a.type==="click")){if(a.namespace)y=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var I=n.live.slice(0);for(l=0;l<I.length;l++){h=I[l];h.origType.replace(X,"")===a.type?f.push(h.selector):I.splice(l--,1)}f=c(a.target).closest(f,a.currentTarget);n=0;for(u=f.length;n<u;n++){s=f[n];for(l=0;l<I.length;l++){h=I[l];if(s.selector===h.selector&&(!y||y.test(h.namespace))){k=s.elem;e=null;if(h.preType=== -"mouseenter"||h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==k)C.push({elem:k,handleObj:h,level:s.level})}}}n=0;for(u=C.length;n<u;n++){f=C[n];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;h=a.handled;y=f.handleObj.origHandler.apply(f.elem,arguments);a.handled=a.handled===null?h:true;if(y===false||a.isPropagationStopped()){d=f.level;if(y===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}} -function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ma,"`").replace(Na,"&")}function na(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function oa(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Oa.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0=== -d})}function Pa(a){return c.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function pa(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var k in e[h])c.event.add(this,h,e[h][k],e[h][k].data)}}})}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML|| -"");b.parentNode&&b.parentNode.removeChild(b)}function qa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Ra:Sa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ta.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&& -b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(ra.concat.apply([],ra.slice(0,b)),function(){d[this]=a});return d}function sa(a){if(!ea[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a, -1);return}b.ready()}}var b=function(j,q){return new b.fn.init(j,q)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,k=/\S/,l=/^\s+/,n=/\s+$/,u=/\W/,s=/\d/,y=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,C=/^[\],:{}\s]*$/,I=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,H=/(?:^|:|,)(?:\s*\[)+/g,M=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,m=/(mozilla)(?:.*? rv:([\w.]+))?/,o=navigator.userAgent,p=false, -r=[],x,z=Object.prototype.toString,F=Object.prototype.hasOwnProperty,L=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,q){var v,B;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!q&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!q))if(v[1]){B=q?q.ownerDocument||q:t;if(j=y.exec(j))if(b.isPlainObject(q)){j= -[t.createElement(j[1])];b.fn.attr.call(j,q,true)}else j=[B.createElement(j[1])];else{j=b.buildFragment([v[1]],[B]);j=(j.cacheable?j.fragment.cloneNode(true):j.fragment).childNodes}return b.merge(this,j)}else{if((q=t.getElementById(v[2]))&&q.parentNode){if(q.id!==v[2])return f.find(j);this.length=1;this[0]=q}this.context=t;this.selector=j;return this}else if(!q&&!u.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!q||q.jquery?(q||f).find(j):b(q).find(j); -else if(b.isFunction(j))return f.ready(j);if(j.selector!==A){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,q,v){var B=b();b.isArray(j)?L.apply(B,j):b.merge(B,j);B.prevObject=this;B.context=this.context;if(q==="find")B.selector=this.selector+(this.selector?" ": -"")+v;else if(q)B.selector=this.selector+"."+q+"("+v+")";return B},each:function(j,q){return b.each(this,j,q)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else r&&r.push(j);return this},eq:function(j){return j===-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(q,v){return j.call(q, -v,q)}))},end:function(){return this.prevObject||b(null)},push:L,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,q,v,B,J,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(q in j){v=G[q];B=j[q];if(G!==B)if(ga&&B&&(b.isPlainObject(B)||(J=b.isArray(B)))){if(J){J=false;v=v&&b.isArray(v)?v:[]}else v= -v&&b.isPlainObject(v)?v:{};G[q]=b.extend(ga,v,B)}else if(B!==A)G[q]=B}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(r){var q=0,v=r;for(r=null;j=v[q++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready, -1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",x,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",x);E.attachEvent("onload",b.ready);var j=false;try{j=E.frameElement==null}catch(q){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j== -null||!s.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[z.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;var q;for(q in j);return q===A||F.call(j,q)},isEmptyObject:function(j){for(var q in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j); -if(C.test(j.replace(I,"@").replace(w,"]").replace(H,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&k.test(j)){var q=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;q.insertBefore(v,q.firstChild);q.removeChild(v)}},nodeName:function(j,q){return j.nodeName&&j.nodeName.toUpperCase()=== -q.toUpperCase()},each:function(j,q,v){var B,J=0,G=j.length,K=G===A||b.isFunction(j);if(v)if(K)for(B in j){if(q.apply(j[B],v)===false)break}else for(;J<G;){if(q.apply(j[J++],v)===false)break}else if(K)for(B in j){if(q.call(j[B],B,j[B])===false)break}else for(v=j[0];J<G&&q.call(v,J,v)!==false;v=j[++J]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(l,"").replace(n,"")},makeArray:function(j,q){q=q||[];if(j!=null){var v=b.type(j);j.length== -null||v==="string"||v==="function"||v==="regexp"||b.isWindow(j)?L.call(q,j):b.merge(q,j)}return q},inArray:function(j,q){if(q.indexOf)return q.indexOf(j);for(var v=0,B=q.length;v<B;v++)if(q[v]===j)return v;return-1},merge:function(j,q){var v=j.length,B=0;if(typeof q.length==="number")for(var J=q.length;B<J;B++)j[v++]=q[B];else for(;q[B]!==A;)j[v++]=q[B++];j.length=v;return j},grep:function(j,q,v){var B=[],J;v=!!v;for(var G=0,K=j.length;G<K;G++){J=!!q(j[G],G);v!==J&&B.push(j[G])}return B},map:function(j, -q,v){for(var B=[],J,G=0,K=j.length;G<K;G++){J=q(j[G],G,v);if(J!=null)B[B.length]=J}return B.concat.apply([],B)},guid:1,proxy:function(j,q,v){if(arguments.length===2)if(typeof q==="string"){v=j;j=v[q];q=A}else if(q&&!b.isFunction(q)){v=q;q=A}if(!q&&j)q=function(){return j.apply(v||this,arguments)};if(j)q.guid=j.guid=j.guid||q.guid||b.guid++;return q},access:function(j,q,v,B,J,G){var K=j.length;if(typeof q==="object"){for(var Q in q)b.access(j,Q,q[Q],B,J,v);return j}if(v!==A){B=!G&&B&&b.isFunction(v); -for(Q=0;Q<K;Q++)J(j[Q],q,B?v.call(j[Q],Q,J(j[Q],q)):v,G);return j}return K?J(j[0],q):A},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=M.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&m.exec(j)||[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,q){R["[object "+q+"]"]=q.toLowerCase()});o=b.uaMatch(o);if(o.browser){b.browser[o.browser]=true;b.browser.version= -o.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,q){return D.call(q,j)};if(!/\s/.test("\u00a0")){l=/^[\s\xA0]+/;n=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)x=function(){t.removeEventListener("DOMContentLoaded",x,false);b.ready()};else if(t.attachEvent)x=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",x);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"), -e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],k=t.createElement("select"),l=k.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")), -hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:l.selected,deleteExpando:true,optDisabled:false,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};k.disabled=true;c.support.optDisabled=!l.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(n){}a.insertBefore(b, -a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(u){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function s(){c.support.noCloneEvent=false;d.detachEvent("onclick",s)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked; -c(function(){var s=t.createElement("div");s.style.width=s.style.paddingLeft="1px";t.body.appendChild(s);c.boxModel=c.support.boxModel=s.offsetWidth===2;if("zoom"in s.style){s.style.display="inline";s.style.zoom=1;c.support.inlineBlockNeedsLayout=s.offsetWidth===2;s.style.display="";s.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=s.offsetWidth!==2}s.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var y=s.getElementsByTagName("td");c.support.reliableHiddenOffsets= -y[0].offsetHeight===0;y[0].style.display="";y[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&y[0].offsetHeight===0;s.innerHTML="";t.body.removeChild(s).style.display="none"});a=function(s){var y=t.createElement("div");s="on"+s;var C=s in y;if(!C){y.setAttribute(s,"return;");C=typeof y[s]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ta={},La=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0, -expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ta:a;var e=a.nodeType,f=e?a[c.expando]:null,h=c.cache;if(!(e&&!f&&typeof b==="string"&&d===A)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==A)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a== -E?ta:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete f[e];else for(var k in a)delete a[k]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e= -this[0].attributes,f;d=c.data(this[0]);for(var h=0,k=e.length;h<k;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,a)});var l=a.split(".");l[1]=l[1]?"."+l[1]:"";if(b===A){d=this.triggerHandler("getData"+l[1]+"!",[l[0]]);if(d===A&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===A&&l[1]?this.data(l[0]):d}else return this.each(function(){var n=c(this),u=[l[0],b];n.triggerHandler("setData"+ -l[1]+"!",u);c.data(this,a,b);n.triggerHandler("changeData"+l[1]+"!",u)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a, -b){if(typeof a!=="string"){b=a;a="fx"}if(b===A)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ua=/[\n\t]/g,ha=/\s+/,Ua=/\r/g,Va=/^(?:href|src|style)$/, -Wa=/^(?:button|input)$/i,Xa=/^(?:button|input|object|select|textarea)$/i,Ya=/^a(?:rea)?$/i,va=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})}, -addClass:function(a){if(c.isFunction(a))return this.each(function(u){var s=c(this);s.addClass(a.call(this,u,s.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1)if(f.className){for(var h=" "+f.className+" ",k=f.className,l=0,n=b.length;l<n;l++)if(h.indexOf(" "+b[l]+" ")<0)k+=" "+b[l];f.className=c.trim(k)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(n){var u=c(this); -u.removeClass(a.call(this,n,u.attr("class")))});if(a&&typeof a==="string"||a===A)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(ua," "),k=0,l=b.length;k<l;k++)h=h.replace(" "+b[k]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"), -b),b)});return this.each(function(){if(d==="string")for(var f,h=0,k=c(this),l=b,n=a.split(ha);f=n[h++];){l=e?l:!k.hasClass(f);k[l?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(ua," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b= -this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var k=f[h];if(k.selected&&(c.support.optDisabled?!k.disabled:k.getAttribute("disabled")===null)&&(!k.parentNode.disabled||!c.nodeName(k.parentNode,"optgroup"))){a=c(k).val();if(b)return a;d.push(a)}}return d}if(va.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")=== -null?"on":b.value;return(b.value||"").replace(Ua,"")}return A}var l=c.isFunction(a);return this.each(function(n){var u=c(this),s=a;if(this.nodeType===1){if(l)s=a.call(this,n,u.val());if(s==null)s="";else if(typeof s==="number")s+="";else if(c.isArray(s))s=c.map(s,function(C){return C==null?"":C+""});if(c.isArray(s)&&va.test(this.type))this.checked=c.inArray(u.val(),s)>=0;else if(c.nodeName(this,"select")){var y=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(), -y)>=0});if(!y.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return A;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==A;b=e&&c.props[b]||b;var h=Va.test(b);if((b in a||a[b]!==A)&&e&&!h){if(f){b==="type"&&Wa.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType=== -1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Xa.test(a.nodeName)||Ya.test(a.nodeName)&&a.href?0:A;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return A;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b); -return a===null?A:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,Ma=/\./g,Na=/ /g,Za=/[^\w\s.|`]/g,$a=function(a){return a.replace(Za,"\\$&")},wa={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var k=a.nodeType?"events":"__events__",l=h[k],n=h.handle;if(typeof l==="function"){n=l.handle; -l=l.events}else if(!l){a.nodeType||(h[k]=h=function(){});h.events=l={}}if(!n)h.handle=n=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(n.elem,arguments):A};n.elem=a;b=b.split(" ");for(var u=0,s;k=b[u++];){h=f?c.extend({},f):{handler:d,data:e};if(k.indexOf(".")>-1){s=k.split(".");k=s.shift();h.namespace=s.slice(0).sort().join(".")}else{s=[];h.namespace=""}h.type=k;if(!h.guid)h.guid=d.guid;var y=l[k],C=c.event.special[k]||{};if(!y){y=l[k]=[];if(!C.setup||C.setup.call(a, -e,s,n)===false)if(a.addEventListener)a.addEventListener(k,n,false);else a.attachEvent&&a.attachEvent("on"+k,n)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=d.guid}y.push(h);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,k=0,l,n,u,s,y,C,I=a.nodeType?"events":"__events__",w=c.data(a),H=w&&w[I];if(w&&H){if(typeof H==="function"){w=H;H=H.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&& -b.charAt(0)==="."){b=b||"";for(f in H)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[k++];){s=f;l=f.indexOf(".")<0;n=[];if(!l){n=f.split(".");f=n.shift();u=new RegExp("(^|\\.)"+c.map(n.slice(0).sort(),$a).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(y=H[f])if(d){s=c.event.special[f]||{};for(h=e||0;h<y.length;h++){C=y[h];if(d.guid===C.guid){if(l||u.test(C.namespace)){e==null&&y.splice(h--,1);s.remove&&s.remove.call(a,C)}if(e!=null)break}}if(y.length===0||e!=null&&y.length===1){if(!s.teardown||s.teardown.call(a, -n)===false)c.removeEvent(a,f,w.handle);delete H[f]}}else for(h=0;h<y.length;h++){C=y[h];if(l||u.test(C.namespace)){c.event.remove(a,s,C.handler,h);y.splice(h--,1)}}}if(c.isEmptyObject(H)){if(b=w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,I);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive= -true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return A;a.result=A;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&& -e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var k;e=a.target;var l=f.replace(X,""),n=c.nodeName(e,"a")&&l==="click",u=c.event.special[l]||{};if((!u._default||u._default.call(d,a)===false)&&!n&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[l]){if(k=e["on"+l])e["on"+l]=null;c.event.triggered=true;e[l]()}}catch(s){}if(k)e["on"+l]=k;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget= -this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var k=d.length;f<k;f++){var l=d[f];if(b||e.test(l.namespace)){a.handler=l.handler;a.data=l.data;a.handleObj=l;var n=a.handled,u=l.handler.apply(this,h);a.handled=a.handled=== -null||l.handler===ma?n:true;if(u!==A){a.result=u;if(u===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==A)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:ma,guid:a.handler.guid}))},remove:function(a){c.event.remove(this, -Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp= -c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U}; -var xa=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},ya=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?ya:xa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?ya:xa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!== -"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=A;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=A;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V, -za=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=za(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===A||f===e))if(e!=null||f){a.type="change";a.liveFired= -A;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",za(a))}},setup:function(){if(this.type=== -"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){wa[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--wa[b]=== -0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=A}var k=b==="one"?c.proxy(f,function(n){c(this).unbind(n,k);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var l=this.length;h<l;h++)c.event.add(this[h],d,k,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d, -a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d< -b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Aa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var k,l=0,n,u,s=h||this.selector;h=h?this:c(this.context);if(typeof d=== -"object"&&!d.preventDefault){for(k in d)h[b](k,e,d[k],s);return this}if(c.isFunction(e)){f=e;e=A}for(d=(d||"").split(" ");(k=d[l++])!=null;){n=X.exec(k);u="";if(n){u=n[0];k=k.replace(X,"")}if(k==="hover")d.push("mouseenter"+u,"mouseleave"+u);else{n=k;if(k==="focus"||k==="blur"){d.push(Aa[k]+u);k+=u}else k=(Aa[k]||k)+u;if(b==="live"){u=0;for(var y=h.length;u<y;u++)c.event.add(h[u],"live."+Y(k,s),{data:e,selector:s,handler:f,origType:k,origHandler:f,preType:n})}else h.unbind("live."+Y(k,s),f)}}return this}}); -c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}}); -(function(){function a(g,i,m,o,p,r){p=0;for(var x=o.length;p<x;p++){var z=o[p];if(z){var F=false;for(z=z[g];z;){if(z.sizcache===m){F=o[z.sizset];break}if(z.nodeType===1&&!r){z.sizcache=m;z.sizset=p}if(z.nodeName.toLowerCase()===i){F=z;break}z=z[g]}o[p]=F}}}function b(g,i,m,o,p,r){p=0;for(var x=o.length;p<x;p++){var z=o[p];if(z){var F=false;for(z=z[g];z;){if(z.sizcache===m){F=o[z.sizset];break}if(z.nodeType===1){if(!r){z.sizcache=m;z.sizset=p}if(typeof i!=="string"){if(z===i){F=true;break}}else if(l.filter(i, -[z]).length>0){F=z;break}}z=z[g]}o[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,k=true;[0,0].sort(function(){k=false;return 0});var l=function(g,i,m,o){m=m||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return m;var r,x,z,F,L,N=true,O=l.isXML(i),D=[],R=g;do{d.exec("");if(r=d.exec(R)){R=r[3];D.push(r[1]);if(r[2]){F=r[3]; -break}}}while(r);if(D.length>1&&u.exec(g))if(D.length===2&&n.relative[D[0]])x=M(D[0]+D[1],i);else for(x=n.relative[D[0]]?[i]:l(D.shift(),i);D.length;){g=D.shift();if(n.relative[g])g+=D.shift();x=M(g,x)}else{if(!o&&D.length>1&&i.nodeType===9&&!O&&n.match.ID.test(D[0])&&!n.match.ID.test(D[D.length-1])){r=l.find(D.shift(),i,O);i=r.expr?l.filter(r.expr,r.set)[0]:r.set[0]}if(i){r=o?{expr:D.pop(),set:C(o)}:l.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);x=r.expr?l.filter(r.expr, -r.set):r.set;if(D.length>0)z=C(x);else N=false;for(;D.length;){r=L=D.pop();if(n.relative[L])r=D.pop();else L="";if(r==null)r=i;n.relative[L](z,r,O)}}else z=[]}z||(z=x);z||l.error(L||g);if(f.call(z)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;z[g]!=null;g++){if(z[g]&&(z[g]===true||z[g].nodeType===1&&l.contains(i,z[g])))m.push(x[g])}else for(g=0;z[g]!=null;g++)z[g]&&z[g].nodeType===1&&m.push(x[g]);else m.push.apply(m,z);else C(z,m);if(F){l(F,p,m,o);l.uniqueSort(m)}return m};l.uniqueSort=function(g){if(w){h= -k;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};l.matches=function(g,i){return l(g,null,null,i)};l.matchesSelector=function(g,i){return l(i,null,null,[g]).length>0};l.find=function(g,i,m){var o;if(!g)return[];for(var p=0,r=n.order.length;p<r;p++){var x,z=n.order[p];if(x=n.leftMatch[z].exec(g)){var F=x[1];x.splice(1,1);if(F.substr(F.length-1)!=="\\"){x[1]=(x[1]||"").replace(/\\/g,"");o=n.find[z](x,i,m);if(o!=null){g=g.replace(n.match[z],"");break}}}}o||(o=i.getElementsByTagName("*")); -return{set:o,expr:g}};l.filter=function(g,i,m,o){for(var p,r,x=g,z=[],F=i,L=i&&i[0]&&l.isXML(i[0]);g&&i.length;){for(var N in n.filter)if((p=n.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=n.filter[N];D=p[1];r=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===z)z=[];if(n.preFilter[N])if(p=n.preFilter[N](p,F,m,z,o,L)){if(p===true)continue}else r=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var q=o^!!O;if(m&&O!=null)if(q)r=true;else F[j]=false;else if(q){z.push(D);r=true}}if(O!== -A){m||(F=z);g=g.replace(n.match[N],"");if(!r)return[];break}}}if(g===x)if(r==null)l.error(g);else break;x=g}return F};l.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/, -POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var m=typeof i==="string",o=m&&!/\W/.test(i);m=m&&!o;if(o)i=i.toLowerCase();o=0;for(var p=g.length,r;o<p;o++)if(r=g[o]){for(;(r=r.previousSibling)&&r.nodeType!==1;);g[o]=m||r&&r.nodeName.toLowerCase()=== -i?r||false:r===i}m&&l.filter(i,g,true)},">":function(g,i){var m,o=typeof i==="string",p=0,r=g.length;if(o&&!/\W/.test(i))for(i=i.toLowerCase();p<r;p++){if(m=g[p]){m=m.parentNode;g[p]=m.nodeName.toLowerCase()===i?m:false}}else{for(;p<r;p++)if(m=g[p])g[p]=o?m.parentNode:m.parentNode===i;o&&l.filter(i,g,true)}},"":function(g,i,m){var o,p=e++,r=b;if(typeof i==="string"&&!/\W/.test(i)){o=i=i.toLowerCase();r=a}r("parentNode",i,p,g,o,m)},"~":function(g,i,m){var o,p=e++,r=b;if(typeof i==="string"&&!/\W/.test(i)){o= -i=i.toLowerCase();r=a}r("previousSibling",i,p,g,o,m)}},find:{ID:function(g,i,m){if(typeof i.getElementById!=="undefined"&&!m)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){var m=[];i=i.getElementsByName(g[1]);for(var o=0,p=i.length;o<p;o++)i[o].getAttribute("name")===g[1]&&m.push(i[o]);return m.length===0?null:m}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,m,o,p,r){g=" "+g[1].replace(/\\/g, -"")+" ";if(r)return g;r=0;for(var x;(x=i[r])!=null;r++)if(x)if(p^(x.className&&(" "+x.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))m||o.push(x);else if(m)i[r]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,m, -o,p,r){i=g[1].replace(/\\/g,"");if(!r&&n.attrMap[i])g[1]=n.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,m,o,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=l(g[3],null,null,i);else{g=l.filter(g[3],i,m,true^p);m||o.push.apply(o,g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled=== -true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,m){return!!l(m[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"=== -g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,m,o){return i===o.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,m){return i<m[3]-0},gt:function(g,i,m){return i>m[3]-0},nth:function(g,i,m){return m[3]- -0===i},eq:function(g,i,m){return m[3]-0===i}},filter:{PSEUDO:function(g,i,m,o){var p=i[1],r=n.filters[p];if(r)return r(g,m,i,o);else if(p==="contains")return(g.textContent||g.innerText||l.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];m=0;for(o=i.length;m<o;m++)if(i[m]===g)return false;return true}else l.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var m=i[1],o=g;switch(m){case "only":case "first":for(;o=o.previousSibling;)if(o.nodeType===1)return false;if(m=== -"first")return true;o=g;case "last":for(;o=o.nextSibling;)if(o.nodeType===1)return false;return true;case "nth":m=i[2];var p=i[3];if(m===1&&p===0)return true;i=i[0];var r=g.parentNode;if(r&&(r.sizcache!==i||!g.nodeIndex)){var x=0;for(o=r.firstChild;o;o=o.nextSibling)if(o.nodeType===1)o.nodeIndex=++x;r.sizcache=i}g=g.nodeIndex-p;return m===0?g===0:g%m===0&&g/m>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()=== -i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var m=i[1];g=n.attrHandle[m]?n.attrHandle[m](g):g[m]!=null?g[m]:g.getAttribute(m);m=g+"";var o=i[2];i=i[4];return g==null?o==="!=":o==="="?m===i:o==="*="?m.indexOf(i)>=0:o==="~="?(" "+m+" ").indexOf(i)>=0:!i?m&&g!==false:o==="!="?m!==i:o==="^="?m.indexOf(i)===0:o==="$="?m.substr(m.length-i.length)===i:o==="|="?m===i||m.substr(0,i.length+1)===i+"-":false},POS:function(g,i,m,o){var p=n.setFilters[i[2]]; -if(p)return p(g,m,i,o)}}},u=n.match.POS,s=function(g,i){return"\\"+(i-0+1)};for(var y in n.match){n.match[y]=new RegExp(n.match[y].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[y]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[y].source.replace(/\\(\d+)/g,s))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(I){C=function(g,i){var m=0;i=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(i, -g);else if(typeof g.length==="number")for(var o=g.length;m<o;m++)i.push(g[m]);else for(;g[m];m++)i.push(g[m]);return i}}var w,H;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var m,o,p=[],r=[];m=g.parentNode;o=i.parentNode;var x=m;if(g===i){h=true;return 0}else if(m===o)return H(g,i);else if(m){if(!o)return 1}else return-1; -for(;x;){p.unshift(x);x=x.parentNode}for(x=o;x;){r.unshift(x);x=x.parentNode}m=p.length;o=r.length;for(x=0;x<m&&x<o;x++)if(p[x]!==r[x])return H(p[x],r[x]);return x===m?H(g,r[x],-1):H(p[x],i,1)};H=function(g,i,m){if(g===i)return m;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}l.getText=function(g){for(var i="",m,o=0;g[o];o++){m=g[o];if(m.nodeType===3||m.nodeType===4)i+=m.nodeValue;else if(m.nodeType!==8)i+=l.getText(m.childNodes)}return i};(function(){var g=t.createElement("div"), -i="script"+(new Date).getTime(),m=t.documentElement;g.innerHTML="<a name='"+i+"'/>";m.insertBefore(g,m.firstChild);if(t.getElementById(i)){n.find.ID=function(o,p,r){if(typeof p.getElementById!=="undefined"&&!r)return(p=p.getElementById(o[1]))?p.id===o[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===o[1]?[p]:A:[]};n.filter.ID=function(o,p){var r=typeof o.getAttributeNode!=="undefined"&&o.getAttributeNode("id");return o.nodeType===1&&r&&r.nodeValue===p}}m.removeChild(g); -m=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(i,m){m=m.getElementsByTagName(i[1]);if(i[1]==="*"){i=[];for(var o=0;m[o];o++)m[o].nodeType===1&&i.push(m[o]);m=i}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& -function(){var g=l,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){l=function(o,p,r,x){p=p||t;o=o.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!x&&!l.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(o),r)}catch(z){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),L=F||"__sizzle__";F||p.setAttribute("id",L);try{return C(p.querySelectorAll("#"+L+" "+o),r)}catch(N){}finally{F|| -p.removeAttribute("id")}}return g(o,p,r,x)};for(var m in g)l[m]=g[m];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,m=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(o){m=true}if(i)l.matchesSelector=function(p,r){r=r.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!l.isXML(p))try{if(m||!n.match.PSEUDO.test(r)&&!/!=/.test(r))return i.call(p,r)}catch(x){}return l(r,null,null,[p]).length>0}})();(function(){var g= -t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(i,m,o){if(typeof m.getElementsByClassName!=="undefined"&&!o)return m.getElementsByClassName(i[1])};g=null}}})();l.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition? -function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};l.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var M=function(g,i){var m,o=[],p="";for(i=i.nodeType?[i]:i;m=n.match.PSEUDO.exec(g);){p+=m[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;m=0;for(var r=i.length;m<r;m++)l(g,i[m],o);return l.filter(p,o)};c.find=l;c.expr=l.selectors;c.expr[":"]=c.expr.filters;c.unique=l.uniqueSort;c.text=l.getText;c.isXMLDoc=l.isXML; -c.contains=l.contains})();var ab=/Until$/,bb=/^(?:parents|prevUntil|prevAll)/,cb=/,/,Oa=/^.[^:#\[\.,]*$/,db=Array.prototype.slice,eb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var k=0;k<d;k++)if(b[k]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})}, -not:function(a){return this.pushStack(oa(this,a,false),"not",a)},filter:function(a){return this.pushStack(oa(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var k,l={},n=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){k=a[e];l[k]||(l[k]=c.expr.match.POS.test(k)?c(k,b||this.context):k)}for(;h&&h.ownerDocument&&h!==b;){for(k in l){a=l[k];if(a.jquery?a.index(h)>-1:c(h).is(a))d.push({selector:k,elem:h,level:n})}h= -h.parentNode;n++}}return d}k=eb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(k?k.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context): -c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(na(a[0])||na(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a, -"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);ab.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f); -f=this.length>1?c.unique(f):f;if((this.length>1||cb.test(e))&&bb.test(a))f=f.reverse();return this.pushStack(f,a,db.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===A||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break; -return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ba=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Ca=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Da=/<([\w:]+)/,fb=/<tbody/i,gb=/<|&#?\w+;/,Ea=/<(?:script|object|embed|option|style)/i,Fa=/checked\s*(?:[^=]|=\s*.checked.)/i,hb=/\=([^="'>\s]+\/)>/g,P={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"], -tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&& -this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))}); -return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a, -this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments); -a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&& -!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ba,"").replace(hb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){pa(this,b);pa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===A)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ba,""):null;else if(typeof a==="string"&&!Ea.test(a)&&(c.support.leadingWhitespace||!$.test(a))&& -!P[(Da.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ca,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),e=d.html();d.replaceWith(a.call(this, -b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,k=a[0],l=[];if(!c.support.checkClone&&arguments.length===3&&typeof k==="string"&&Fa.test(k))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(k))return this.each(function(s){var y= -c(this);a[0]=k.call(this,s,b?y.html():A);y.domManip(a,b,d)});if(this[0]){e=k&&k.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,l);h=e.fragment;if(f=h.childNodes.length===1?(h=h.firstChild):h.firstChild){b=b&&c.nodeName(f,"tr");for(var n=0,u=this.length;n<u;n++)d.call(b?Pa(this[n],f):this[n],n>0||e.cacheable||this.length>1?h.cloneNode(true):h)}l.length&&c.each(l,Qa)}return this}});c.buildFragment=function(a,b,d){var e,f, -h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ea.test(a[0])&&(c.support.checkClone||!Fa.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f= -this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var k=(f>0?this.clone(true):this).get();c(d[f])[b](k);e=e.concat(k)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,k;(k=a[h])!=null;h++){if(typeof k==="number")k+="";if(k){if(typeof k==="string"&&!gb.test(k))k= -b.createTextNode(k);else if(typeof k==="string"){k=k.replace(Ca,"<$1></$2>");var l=(Da.exec(k)||["",""])[1].toLowerCase(),n=P[l]||P._default,u=n[0],s=b.createElement("div");for(s.innerHTML=n[1]+k+n[2];u--;)s=s.lastChild;if(!c.support.tbody){u=fb.test(k);l=l==="table"&&!u?s.firstChild&&s.firstChild.childNodes:n[1]==="<table>"&&!u?s.childNodes:[];for(n=l.length-1;n>=0;--n)c.nodeName(l[n],"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!c.support.leadingWhitespace&&$.test(k)&&s.insertBefore(b.createTextNode($.exec(k)[0]), -s.firstChild);k=s.childNodes}if(k.nodeType)f.push(k);else f=c.merge(f,k)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,k=0,l;(l=a[k])!=null;k++)if(!(l.nodeName&& -c.noData[l.nodeName.toLowerCase()]))if(d=l[c.expando]){if((b=e[d])&&b.events)for(var n in b.events)f[n]?c.event.remove(l,n):c.removeEvent(l,n,b.handle);if(h)delete l[c.expando];else l.removeAttribute&&l.removeAttribute(c.expando);delete e[d]}}});var Ga=/alpha\([^)]*\)/i,ib=/opacity=([^)]*)/,jb=/-([a-z])/ig,kb=/([A-Z])/g,Ha=/^-?\d+(?:px)?$/i,lb=/^-?\d/,mb={position:"absolute",visibility:"hidden",display:"block"},Ra=["Left","Right"],Sa=["Top","Bottom"],W,Ia,aa,nb=function(a,b){return b.toUpperCase()}; -c.fn.css=function(a,b){if(arguments.length===2&&b===A)return this;return c.access(this,a,b,true,function(d,e,f){return f!==A?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){a=W(a,"opacity","opacity");return a===""?"1":a}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f, -h=c.camelCase(b),k=a.style,l=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==A){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!l||!("set"in l)||(d=l.set(a,d))!==A)try{k[b]=d}catch(n){}}}else{if(l&&"get"in l&&(f=l.get(a,false,e))!==A)return f;return k[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==A)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={};for(var f in b){e[f]= -a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(jb,nb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=qa(d,b,f);else c.swap(d,mb,function(){h=qa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d, -e){if(Ha.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return ib.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){a=a.style;a.zoom=1;b=c.isNaN(b)?"":"alpha(opacity="+b*100+")";var d=a.filter||"";a.filter=Ga.test(d)?d.replace(Ga,b):a.filter+" "+b}};if(t.defaultView&&t.defaultView.getComputedStyle)Ia=function(a,b,d){var e;d=d.replace(kb,"-$1").toLowerCase(); -if(!(b=a.ownerDocument.defaultView))return A;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Ha.test(f)&&lb.test(f)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ia|| -aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var ob=c.now(),pb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,qb=/^(?:select|textarea)/i,rb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,sb=/^(?:GET|HEAD)$/,Ta=/\[\]$/, -T=/\=\?(&|$)/,ja=/\?/,tb=/([?&])_=[^&]*/,ub=/^(\w+:)?\/\/([^\/?#]+)/,vb=/%20/g,wb=/#.*$/,Ja=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ja)return Ja.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(k,l){if(l=== -"success"||l==="notmodified")h.html(f?c("<div>").append(k.responseText.replace(pb,"")).find(f):k.responseText);d&&h.each(d,[k.responseText,l,k])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||qb.test(this.nodeName)||rb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)? -c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e= -e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b= -c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),k=sb.test(h);b.url=b.url.replace(wb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)|| -T.test(b.url))){d=b.jsonpCallback||"jsonp"+ob++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var l=E[d];E[d]=function(o){if(c.isFunction(l))l(o);else{E[d]=A;try{delete E[d]}catch(p){}}f=o;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);s&&s.removeChild(y)}}if(b.dataType==="script"&&b.cache===null)b.cache=false;if(b.cache===false&&k){var n=c.now(),u=b.url.replace(tb,"$1_="+n);b.url=u+(u===b.url?(ja.test(b.url)?"&":"?")+"_="+n:"")}if(b.data&& -k)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");n=(n=ub.exec(b.url))&&(n[1]&&n[1].toLowerCase()!==location.protocol||n[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&n){var s=t.getElementsByTagName("head")[0]||t.documentElement,y=t.createElement("script");if(b.scriptCharset)y.charset=b.scriptCharset;y.src=b.url;if(!d){var C=false;y.onload=y.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState=== -"complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);y.onload=y.onreadystatechange=null;s&&y.parentNode&&s.removeChild(y)}}}s.insertBefore(y,s.firstChild);return A}var I=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!k||a&&a.contentType)w.setRequestHeader("Content-Type",b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match", -c.etag[b.url])}n||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(H){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&c.triggerGlobal(b,"ajaxSend",[w,b]);var M=w.onreadystatechange=function(o){if(!w||w.readyState===0||o==="abort"){I||c.handleComplete(b,w,e,f);I=true;if(w)w.onreadystatechange= -c.noop}else if(!I&&w&&(w.readyState===4||o==="timeout")){I=true;w.onreadystatechange=c.noop;e=o==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(r){e="parsererror";p=r}if(e==="success"||e==="notmodified")d||c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);o==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g, -w);M("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!I&&M("timeout")},b.timeout);try{w.send(k||b.data==null?null:b.data)}catch(m){c.handleError(b,w,null,m);c.handleComplete(b,w,e,f)}b.async||M();return w}},param:function(a,b){var d=[],e=function(h,k){k=c.isFunction(k)?k():k;d[d.length]=encodeURIComponent(h)+"="+encodeURIComponent(k)};if(b===A)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e); -return d.join("&").replace(vb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")}, -triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b=== -"xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}; -c.support.ajax=!!c.ajaxSettings.xhr();var ea={},xb=/^(?:toggle|show|hide)$/,yb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,ra=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")=== -"none"&&c.data(a,"olddisplay",sa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this, -arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),k,l=this.nodeType===1,n=l&&c(this).is(":hidden"),u=this;for(k in a){var s= -c.camelCase(k);if(k!==s){a[s]=a[k];delete a[k];k=s}if(a[k]==="hide"&&n||a[k]==="show"&&!n)return h.complete.call(this);if(l&&(k==="height"||k==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(sa(this.nodeName)==="inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[k])){(h.specialEasing= -h.specialEasing||{})[k]=a[k][1];a[k]=a[k][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(y,C){var I=new c.fx(u,h,y);if(xb.test(C))I[C==="toggle"?n?"show":"hide":C](a);else{var w=yb.exec(C),H=I.cur()||0;if(w){C=parseFloat(w[2]);var M=w[3]||"px";if(M!=="px"){c.style(u,y,(C||1)+M);H=(C||1)/I.cur()*H;c.style(u,y,H+M)}if(w[1])C=(w[1]==="-="?-1:1)*C+H;I.custom(H,C,M)}else I.custom(H,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]); -this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b|| -b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&& -this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-10000?a:0},custom:function(a,b,d){function e(k){return f.step(k)}var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem; -if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1; -this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(l,n){f.style["overflow"+n]=h.overflow[l]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var k in this.options.curAnim)c.style(this.elem,k,this.options.orig[k]);this.options.complete.call(this.elem)}return false}else{a= -b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600, -fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};var zb=/^t(?:able|d|h)$/i,Ka=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b= -this[0],d;if(a)return this.each(function(k){c.offset.setOffset(this,a,k)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)- -(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(s){c.offset.setOffset(this,a,s)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b,h=b.ownerDocument,k=h.documentElement,l=h.body;d=(h=h.defaultView)?h.getComputedStyle(b,null):b.currentStyle;for(var n=b.offsetTop,u=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==k;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break; -d=h?h.getComputedStyle(b,null):b.currentStyle;n-=b.scrollTop;u-=b.scrollLeft;if(b===e){n+=b.offsetTop;u+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&zb.test(b.nodeName))){n+=parseFloat(d.borderTopWidth)||0;u+=parseFloat(d.borderLeftWidth)||0}f=e;e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){n+=parseFloat(d.borderTopWidth)||0;u+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){n+= -l.offsetTop;u+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){n+=Math.max(k.scrollTop,l.scrollTop);u+=Math.max(k.scrollLeft,l.scrollLeft)}return{top:n,left:u}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; -a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),k=c.css(a,"top"),l=c.css(a,"left"),n=e==="absolute"&&c.inArray("auto",[k,l])>-1;e={};var u={};if(n)u=f.position();k=n?u.top:parseInt(k, -10)||0;l=n?u.left:parseInt(l,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+k;if(b.left!=null)e.left=b.left-h.left+l;"using"in b?b.using.call(a,e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ka.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0], -"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ka.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==A)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in -h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(k){var l=c(this);l[d](e.call(this, -k,l[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===A){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window); -; -steal.end(); -steal.plugins("jquery").then(function(h){var c={undHash:/_|-/,colons:/::/,words:/([A-Z]+)([A-Z][a-z])/g,lowerUpper:/([a-z\d])([A-Z])/g,dash:/([a-z\d])([A-Z])/g,replacer:/\{([^\}]+)\}/g},i=function(a,b,e){b=b||window;a=a?a.split(/\./):[];for(var f,d=0;d<a.length-1&&b;d++)b=b[a[d]];f=b[a[d]];e&&delete b[a[d]];return f},g=h.String={strip:function(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")},capitalize:function(a){return a.charAt(0).toUpperCase()+a.substr(1)},endsWith:function(a,b){var e=a.length- -b.length;return e>=0&&a.lastIndexOf(b)===e},camelize:function(a){a=a.split(c.undHash);var b=1;for(a[0]=a[0].charAt(0).toLowerCase()+a[0].substr(1);b<a.length;b++)a[b]=g.capitalize(a[b]);return a.join("")},classize:function(a){a=a.split(c.undHash);for(var b=0;b<a.length;b++)a[b]=g.capitalize(a[b]);return a.join("")},niceName:function(a){a=a.split(c.undHash);for(var b=0;b<a.length;b++)a[b]=g.capitalize(a[b]);return a.join(" ")},underscore:function(a){return a.replace(c.colons,"/").replace(c.words,"$1_$2").replace(c.lowerUpper, -"$1_$2").replace(c.dash,"_").toLowerCase()},sub:function(a,b,e){return a.replace(c.replacer,function(f,d){return i(d,b,e).toString()})}}}); -; -steal.end(); -steal.plugins("jquery/event").then(function(a){var e=jQuery.cleanData;a.cleanData=function(b){for(var c=0,d;(d=b[c])!==undefined;c++)a(d).triggerHandler("destroyed");e(b)}}); -; -steal.end(); -steal.plugins("jquery"); -; -steal.end(); -steal.plugins("jquery/controller","jquery/lang/openajax").then(function(){jQuery.Controller.processors.subscribe=function(d,e,a,b){var c=OpenAjax.hub.subscribe(a,b);return function(){OpenAjax.hub.unsubscribe(c)}};jQuery.Controller.prototype.publish=function(){OpenAjax.hub.publish.apply(OpenAjax.hub,arguments)}}); -; -steal.end(); -steal.then(function(){if(!window.OpenAjax){OpenAjax=new (function(){var d={};this.hub=d;d.implementer="http://openajax.org";d.implVersion="1.0";d.specVersion="1.0";d.implExtraData={};var h={};d.libraries=h;d.registerLibrary=function(a,c,b,e){h[a]={prefix:a,namespaceURI:c,version:b,extraData:e};this.publish("org.openajax.hub.registerLibrary",h[a])};d.unregisterLibrary=function(a){this.publish("org.openajax.hub.unregisterLibrary",h[a]);delete h[a]};d._subscriptions={c:{},s:[]};d._cleanup=[];d._subIndex= -0;d._pubDepth=0;d.subscribe=function(a,c,b,e,f){b||(b=window);var g=a+"."+this._subIndex;c={scope:b,cb:c,fcb:f,data:e,sid:this._subIndex++,hdl:g};this._subscribe(this._subscriptions,a.split("."),0,c);return g};d.publish=function(a,c){var b=a.split(".");this._pubDepth++;this._publish(this._subscriptions,b,0,a,c);this._pubDepth--;if(this._cleanup.length>0&&this._pubDepth==0){for(a=0;a<this._cleanup.length;a++)this.unsubscribe(this._cleanup[a].hdl);delete this._cleanup;this._cleanup=[]}};d.unsubscribe= -function(a){a=a.split(".");var c=a.pop();this._unsubscribe(this._subscriptions,a,0,c)};d._subscribe=function(a,c,b,e){var f=c[b];if(b==c.length)a.s.push(e);else{if(typeof a.c=="undefined")a.c={};if(typeof a.c[f]=="undefined")a.c[f]={c:{},s:[]};this._subscribe(a.c[f],c,b+1,e)}};d._publish=function(a,c,b,e,f,g,l){if(typeof a!="undefined"){if(b==c.length)a=a;else{this._publish(a.c[c[b]],c,b+1,e,f,g,l);this._publish(a.c["*"],c,b+1,e,f,g,l);a=a.c["**"]}if(typeof a!="undefined"){a=a.s;c=a.length;for(b= -0;b<c;b++)if(a[b].cb){var j=a[b].scope,k=a[b].cb,i=a[b].fcb,m=a[b].data,n=a[b].sid,o=a[b].cid;if(typeof k=="string")k=j[k];if(typeof i=="string")i=j[i];if(!i||i.call(j,e,f,m))if(!g||g(e,f,l,o))k.call(j,e,f,m,n)}}}};d._unsubscribe=function(a,c,b,e){if(typeof a!="undefined")if(b<c.length){var f=a.c[c[b]];this._unsubscribe(f,c,b+1,e);if(f.s.length==0){for(var g in f.c)return;delete a.c[c[b]]}}else{a=a.s;c=a.length;for(b=0;b<c;b++)if(e==a[b].sid){if(this._pubDepth>0){a[b].cb=null;this._cleanup.push(a[b])}else a.splice(b, -1);return}}};d.reinit=function(){for(var a in OpenAjax.hub.libraries)delete OpenAjax.hub.libraries[a];OpenAjax.hub.registerLibrary("OpenAjax","http://openajax.org/hub","1.0",{});delete OpenAjax._subscriptions;OpenAjax._subscriptions={c:{},s:[]};delete OpenAjax._cleanup;OpenAjax._cleanup=[];OpenAjax._subIndex=0;OpenAjax._pubDepth=0}});OpenAjax.hub.registerLibrary("OpenAjax","http://openajax.org/hub","1.0",{})}OpenAjax.hub.registerLibrary("JavaScriptMVC","http://JavaScriptMVC.com","1.5",{})}); -; -steal.end(); -steal.plugins("jquery/view","jquery/lang/rsplit").then(function(f){var m=function(a){eval(a)},n=function(a){return a.substr(0,a.length-1)},k=f.extend,o=f.isArray,e=function(a){if(this.constructor!=e){var b=new e(a);return function(c,g){return b.render(c,g)}}if(typeof a=="function"){this.template={};this.template.process=a}else{f.extend(this,e.options,a);var d=new e.Compiler(this.text,this.type);d.compile(a,this.name);this.template=d}},p=/(\[%%)|(%%\])|(\[%=)|(\[%#)|(\[%)|(%\]\n)|(%\])|(\n)/;f.EJS= -e;e.prototype={constructor:e,render:function(a,b){a=a||{};this._extra_helpers=b;b=new e.Helpers(a,b||{});return this.template.process.call(a,a,b)},out:function(){return this.template.out}};e.text=function(a){if(typeof a=="string")return a;var b;if(a===null||a===undefined)return"";if(a instanceof Date)return a.toDateString();if(a.hookup){b=f.View.hookup(function(d,c){a.hookup.call(a,d,c)});return"data-view-id='"+b+"'"}if(typeof a=="function")return"data-view-id='"+f.View.hookup(a)+"'";if(o(a)){b=f.View.hookup(function(d, -c){for(var g=0;g<a.length;g++)a[g].hookup?a[g].hookup(d,c):a[g](d,c)});return"data-view-id='"+b+"'"}if(a.nodeName||a.jQuery)throw"elements in views are not supported";if(a.toString)return b?a.toString(b):a.toString();return""};e.Scanner=function(a,b,d){k(this,{leftDelimiter:b+"%",rightDelimiter:"%"+d,doubleLeft:b+"%%",doubleRight:"%%"+d,leftEqual:b+"%=",leftComment:b+"%#"});this.splitRegexp=b=="["?p:new RegExp("("+[this.doubleLeft,this.doubleRight,this.leftEqual,this.leftComment,this.leftDelimiter, -this.rightDelimiter+"\n",this.rightDelimiter,"\n"].join(")|(")+")");this.source=a;this.lines=0};e.Scanner.prototype={scan:function(a){var b=this.splitRegexp;if(this.source)for(var d=f.String.rsplit(this.source,/\n/),c=0;c<d.length;c++)this.scanline(d[c],b,a)},scanline:function(a,b,d){this.lines++;a=f.String.rsplit(a,b);for(var c=0;c<a.length;c++){b=a[c];if(b!==null)try{d(b,this)}catch(g){throw{type:"jQuery.EJS.Scanner",line:this.lines};}}}};e.Buffer=function(a,b){this.line=[];this.script=[];this.post_cmd= -b;this.push.apply(this,a)};e.Buffer.prototype={push:function(){this.line.push.apply(this.line,arguments)},cr:function(){this.script.push(this.line.join(""),"\n");this.line=[]},close:function(){if(this.line.length>0){this.script.push(this.line.join(""));this.line=[]}this.post_cmd.length&&this.push.apply(this,this.post_cmd);this.script.push(";");return this.script.join("")}};e.Compiler=function(a,b){this.source=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n");b=b||"<";a=">";switch(b){case "[":a="]";break; -case "<":break;default:throw b+" is not a supported deliminator";}this.scanner=new e.Scanner(this.source,b,a);this.out=""};e.Compiler.prototype={compile:function(a,b){a=a||{};this.out="";var d=new e.Buffer(["var ___v1ew = [];"],[]),c="",g=function(i){return i.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')},l=function(i){d.push("___v1ew.push(",'"',g(i),'");')},j=null;this.scanner.scan(function(i,h){if(j===null)switch(i){case "\n":c+="\n";l(c);d.cr();c="";break;case h.leftDelimiter:case h.leftEqual:case h.leftComment:j= -i;c.length>0&&l(c);c="";break;case h.doubleLeft:c+=h.leftDelimiter;break;default:c+=i;break}else switch(i){case h.rightDelimiter:switch(j){case h.leftDelimiter:if(c[c.length-1]=="\n"){c=n(c);d.push(c,";");d.cr()}else d.push(c,";");break;case h.leftEqual:d.push("___v1ew.push(","(jQuery.EJS.text(",c,")));");break}j=null;c="";break;case h.doubleRight:c+=h.rightDelimiter;break;default:c+=i;break}});c.length>0&&d.push("___v1ew.push(",'"',g(c)+'");');this.out="try { with(_VIEW) { with (_CONTEXT) {"+d.close()+ -" return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;}";m.call(this,"this.process = (function(_CONTEXT,_VIEW){"+this.out+"});\r\n//@ sourceURL="+b+".js")}};e.options={cache:true,type:"<",ext:".ejs"};e.Helpers=function(a,b){this._data=a;this._extras=b;k(this,b)};e.Helpers.prototype={plugin:function(){var a=f.makeArray(arguments),b=a.shift();return function(d){d=f(d);d[b].apply(d,a)}},view:function(a,b,d){d=d||this._extras;b=b||this._data;return f.View(a,b,d)}};f.View.register({suffix:"ejs", -script:function(a,b){return"jQuery.EJS(function(_CONTEXT,_VIEW) { "+(new e({text:b})).out()+" })"},renderer:function(a,b){var d=new e({text:b,name:a});return function(c,g){return d.render.call(d,c,g)}}})}); -; -steal.end(); -steal.plugins("jquery").then(function(d){var u=function(a){return a.replace(/^\/\//,"").replace(/[\/\.]/g,"_")},v=1,o,k,j,p;o=d.View=function(a,c,b,e){var f=a.match(/\.[\w\d]+$/),g,h,i=a;if(g=document.getElementById(a))f=g.type.match(/\/[\d\w]+$/)[0].replace(/^\//,".");if(typeof b==="function"){e=b;b=undefined}if(!f){f=d.View.ext;i+=d.View.ext}h=u(i);if(i.match(/^\/\//))i=steal.root.join(i.substr(2));f=d.View.types[f];return(a=d.View.cached[h]?d.View.cached[h]:(g=document.getElementById(a))?f.renderer(h, -g.innerHTML):p(f,h,i,c,b,e))&&k(a,f,h,c,b,e)};k=function(a,c,b,e,f,g){if(d.View.cache)d.View.cached[b]=a;a=a.call(c,e,f);g&&g(a);return a};j=function(a,c){if(!a.match(/[^\s]/))throw"$.View ERROR: There is no template or an empty template at "+c;};p=function(a,c,b,e,f,g){if(g)d.ajax({url:b,dataType:"text",error:function(){j("",b)},success:function(i){j(i,b);k(a.renderer(c,i),a,c,e,f,g)}});else{var h=d.ajax({async:false,url:b,dataType:"text",error:function(){j("",b)}}).responseText;j(h,b);return a.renderer(c, -h)}};d.extend(d.View,{hookups:{},hookup:function(a){var c=++v;o.hookups[c]=a;return c},cached:{},cache:true,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(a,c,b){return"$.View.preload('"+c+"',"+d.View.types["."+a].script(c,b)+");"},preload:function(a,c){d.View.cached[a]=function(b,e){return c.call(b,b,e)}}});var q,l,r,s,t,m;q=function(a){var c=d.fn[a];d.fn[a]=function(){var b=d.makeArray(arguments),e,f,g=this;if(r(b)){if(e=s(b)){f=b[e];b[e]=function(h){l.call(g, -[h],c);f.call(g,h)};d.View.apply(d.View,b);return this}b=[d.View.apply(d.View,b)]}return l.call(this,b,c)}};l=function(a,c){var b;for(var e in jQuery.View.hookups)break;if(e){b=d.View.hookups;d.View.hookups={};a[0]=d(a[0])}c=c.apply(this,a);e&&t(a[0],b);return c};r=function(a){var c=typeof a[1];return typeof a[0]=="string"&&(c=="object"||c=="function")&&!a[1].nodeType&&!a[1].jquery};s=function(a){return typeof a[3]==="function"?3:typeof a[2]==="function"&&2};t=function(a,c){var b,e=0,f,g;a=a.filter(function(){return this.nodeType!= -3});a=a.add("[data-view-id]",a);for(b=a.length;e<b;e++)if(a[e].getAttribute&&(f=a[e].getAttribute("data-view-id"))&&(g=c[f])){g(a[e],f);delete c[f];a[e].removeAttribute("data-view-id")}d.extend(d.View.hookups,c)};m=["prepend","append","after","before","replace","text","html","replaceWith"];for(var n=0;n<m.length;n++)q(m[n])}); -; -steal.end(); -steal.plugins("jquery/lang").then(function(f){f.String.rsplit=function(a,e){for(var b=e.exec(a),c=[],d;b!==null;){d=b.index;if(d!==0){c.push(a.substring(0,d));a=a.slice(d)}c.push(b[0]);a=a.slice(b[0].length);b=e.exec(a)}a!==""&&c.push(a);return c}}); -; -steal.end(); -steal.plugins("jquery/controller","jquery/view").then(function(){jQuery.Controller.getFolder=function(){return jQuery.String.underscore(this.fullName.replace(/\./g,"/")).replace("/Controllers","")};var g=function(a,b,c){var d=a.fullName.replace(/\./g,"/"),e=d.indexOf("/Controllers/"+a.shortName)!=-1;d=jQuery.String.underscore(d.replace("/Controllers/"+a.shortName,""));a=a._shortName;var f=typeof b=="string"&&b.match(/\.[\w\d]+$/)||jQuery.View.ext;if(typeof b=="string"){if(b.substr(0,2)!="//")b="//"+ -(new steal.File("views/"+(b.indexOf("/")!==-1?b:(e?a+"/":"")+b))).joinFrom(d)+f}else b||(b="//"+(new steal.File("views/"+(e?a+"/":"")+c.replace(/\.|#/g,"").replace(/ /g,"_"))).joinFrom(d)+f);return b},h=function(a){var b={};if(a)if(jQuery.isArray(a))for(var c=0;c<a.length;c++)jQuery.extend(b,a[c]);else jQuery.extend(b,a);else{if(this._default_helpers)b=this._default_helpers;a=window;c=this.Class.fullName.split(/\./);for(var d=0;d<c.length;d++){typeof a.Helpers=="object"&&jQuery.extend(b,a.Helpers); -a=a[c[d]]}typeof a.Helpers=="object"&&jQuery.extend(b,a.Helpers);this._default_helpers=b}return b};jQuery.Controller.prototype.view=function(a,b,c){if(typeof a!="string"&&!c){c=b;b=a;a=null}a=g(this.Class,a,this.called);b=b||this;c=h.call(this,c);return jQuery.View(a,b,c)}}); -; -steal.end(); -Channel=function(){function E(c,e,m){var n=false;if(c==="*")for(var f in h){if(h.hasOwnProperty(f))if(f!=="*")if(typeof h[f][e]==="object")n=true}else if(h["*"]&&h["*"][e]||h[c]&&h[c][e])n=true;if(n)throw"A channel already exists which overlaps with origin '"+c+"' and has scope '"+e+"'";if(typeof h[c]!="object")h[c]={};h[c][e]=m}function F(c,e){delete h[c][e]}function C(c){return Array.isArray?Array.isArray(c):c.constructor.toString().indexOf("Array")!=-1}var w=Math.floor(Math.random()*1000001),h= -{},x={},D=function(c){var e=JSON.parse(c.data);if(typeof e==="object"){c=c.origin;var m=null,n=null,f=null;if(typeof e.method==="string"){f=e.method.split("::");if(f.length==2){m=f[0];f=f[1]}else f=e.method}if(typeof e.id!=="undefined")n=e.id;if(typeof f==="string")if(h[c]&&h[c][m])h[c][m](c,f,e);else h["*"]&&h["*"][m]&&h["*"][m](c,f,e);else typeof n!="undefined"&&x[n]&&x[n](c,f,e)}};if(window.addEventListener)window.addEventListener("message",D,false);else window.attachEvent&&window.attachEvent("onmessage", -D);return{build:function(c){var e=function(a){if(c.debugOutput&&window.console&&window.console.log){try{if(typeof a!=="string")a=JSON.stringify(a)}catch(d){}console.log("["+f+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if(typeof c!="object")throw"Channel build invoked without a proper object argument";if(!c.window||!c.window.postMessage)throw"Channel.build() called without a valid window argument"; -if(window===c.window)throw"target window is same as present window -- not allowed";var m=false;if(typeof c.origin==="string"){var n;if(c.origin==="*")m=true;else if(null!==(n=c.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9\.])+(?::\d+)?/))){c.origin=n[0];m=true}}if(!m)throw"Channel.build() called with an invalid origin";if(typeof c.scope!=="undefined"){if(typeof c.scope!=="string")throw"scope, when specified, must be a string";if(c.scope.split("::").length>1)throw"scope may not contain double colons: '::'"; -}var f=function(){for(var a="",d=0;d<5;d++)a+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".charAt(Math.floor(Math.random()*62));return a}(),q={},o={},r={},u=false,y=[],G=function(a,d,b){var s=false,l=false;return{origin:d,invoke:function(j,g){if(!r[a])throw"attempting to invoke a callback of a non-existant transaction: "+a;for(var k=false,p=0;p<b.length;p++)if(j===b[p]){k=true;break}if(!k)throw"request supports no such callback '"+j+"'";t({id:a,callback:j,params:g})},error:function(j, -g){l=true;if(!r[a])throw"error called for non-existant message: "+a;delete r[a];t({id:a,error:j,message:g})},complete:function(j){l=true;if(!r[a])throw"complete called for non-existant message: "+a;delete r[a];t({id:a,result:j})},delayReturn:function(j){if(typeof j==="boolean")s=j===true;return s},completed:function(){return l}}},z=function(a,d,b){if(typeof c.gotMessageObserver==="function")try{c.gotMessageObserver(a,b)}catch(s){e("gotMessageObserver() raised an exception: "+s.toString())}if(b.id&& -d){if(q[d]){var l=G(b.id,a,b.callbacks?b.callbacks:[]);r[b.id]={};try{if(b.callbacks&&C(b.callbacks)&&b.callbacks.length>0)for(a=0;a<b.callbacks.length;a++){for(var j=b.callbacks[a],g=b.params,k=j.split("/"),p=0;p<k.length-1;p++){var A=k[p];if(typeof g[A]!=="object")g[A]={};g=g[A]}g[k[k.length-1]]=function(){return function(H){return l.invoke(j,H)}}()}var I=q[d](l,b.params);!l.delayReturn()&&!l.completed()&&l.complete(I)}catch(i){d="runtime_error";b=null;if(typeof i==="string")b=i;else if(typeof i=== -"object")if(i&&C(i)&&i.length==2){d=i[0];b=i[1]}else if(typeof i.error==="string"){d=i.error;if(i.message)if(typeof i.message==="string")b=i.message;else i=i.message;else b=""}if(b===null)try{b=JSON.stringify(i)}catch(J){b=i.toString()}l.error(d,b)}}}else if(b.id&&b.callback)!o[b.id]||!o[b.id].callbacks||!o[b.id].callbacks[b.callback]?e("ignoring invalid callback, id:"+b.id+" ("+b.callback+")"):o[b.id].callbacks[b.callback](b.params);else if(b.id)if(o[b.id]){if(b.error)(1,o[b.id].error)(b.error,b.message); -else b.result!==undefined?(1,o[b.id].success)(b.result):(1,o[b.id].success)();delete o[b.id];delete x[b.id]}else e("ignoring invalid response: "+b.id);else d&&q[d]&&q[d](null,b.params)};E(c.origin,typeof c.scope==="string"?c.scope:"",z);var B=function(a){if(typeof c.scope==="string"&&c.scope.length)a=[c.scope,a].join("::");return a},t=function(a,d){if(!a)throw"postMessage called with null message";e((u?"post ":"queue ")+" message: "+JSON.stringify(a));if(!d&&!u)y.push(a);else{if(typeof c.postMessageObserver=== -"function")try{c.postMessageObserver(c.origin,a)}catch(b){e("postMessageObserver() raised an exception: "+b.toString())}c.window.postMessage(JSON.stringify(a),c.origin)}},v={unbind:function(a){if(q[a]){if(!delete q[a])throw"can't delete method: "+a;return true}return false},bind:function(a,d){if(!a||typeof a!=="string")throw"'method' argument to bind must be string";if(!d||typeof d!=="function")throw"callback missing from bind params";if(q[a])throw"method '"+a+"' is already bound!";q[a]=d},call:function(a){if(!a)throw"missing arguments to call function"; -if(!a.method||typeof a.method!=="string")throw"'method' argument to call must be string";if(!a.success||typeof a.success!=="function")throw"'success' callback missing from call";var d={},b=[],s=function(j,g){if(typeof g==="object")for(var k in g)if(g.hasOwnProperty(k)){var p=j+(j.length?"/":"")+k;if(typeof g[k]==="function"){d[p]=g[k];b.push(p);delete g[k]}else typeof g[k]==="object"&&s(p,g[k])}};s("",a.params);var l={id:w,method:B(a.method),params:a.params};if(b.length)l.callbacks=b;o[w]={callbacks:d, -error:a.error,success:a.success};x[w]=z;w++;t(l)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||typeof a.method!=="string")throw"'method' argument to notify must be string";t({method:B(a.method),params:a.params})},destroy:function(){F(c.origin,typeof c.scope==="string"?c.scope:"");if(window.removeEventListener)window.removeEventListener("message",z,false);else window.detachEvent&&window.detachEvent("onmessage",z);u=false;q={};r={};o={};c.origin=null;y=[];e("channel destroyed"); -f=""}};v.bind("__ready",function(a,d){e("ready msg received");if(u)throw"received ready message while in ready state. help!";f+=d==="ping"?"-R":"-L";v.unbind("__ready");u=true;e("ready msg accepted.");for(d==="ping"&&v.notify({method:"__ready",params:"pong"});y.length;)t(y.pop());typeof c.onReady==="function"&&c.onReady(v)});setTimeout(function(){t({method:B("__ready"),params:"ping"},true)},0);return v}}}(); -; -steal.end(); -(function(){var q=this,D=q._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,E=k.unshift,F=o.toString,m=o.hasOwnProperty,t=k.forEach,u=k.map,v=k.reduce,w=k.reduceRight,x=k.filter,y=k.every,z=k.some,p=k.indexOf,A=k.lastIndexOf;o=Array.isArray;var G=Object.keys,r=Function.prototype.bind,c=function(a){return new l(a)};typeof module!=="undefined"&&module.exports?(module.exports=c,c._=c):(q._=c);c.VERSION="1.1.6";var j=c.each=c.forEach=function(a,b,d){if(a!=null)if(t&&a.forEach===t)a.forEach(b,d); -else if(c.isNumber(a.length))for(var e=0,f=a.length;e<f;e++){if(b.call(d,a[e],e,a)===n)break}else for(e in a)if(m.call(a,e)&&b.call(d,a[e],e,a)===n)break};c.map=function(a,b,d){var e=[];if(a==null)return e;if(u&&a.map===u)return a.map(b,d);j(a,function(f,g,h){e[e.length]=b.call(d,f,g,h)});return e};c.reduce=c.foldl=c.inject=function(a,b,d,e){var f=d!==void 0;a==null&&(a=[]);if(v&&a.reduce===v)return e&&(b=c.bind(b,e)),f?a.reduce(b,d):a.reduce(b);j(a,function(g,h,H){!f&&h===0?(d=g,f=true):(d=b.call(e, -d,g,h,H))});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};c.reduceRight=c.foldr=function(a,b,d,e){a==null&&(a=[]);if(w&&a.reduceRight===w)return e&&(b=c.bind(b,e)),d!==void 0?a.reduceRight(b,d):a.reduceRight(b);a=(c.isArray(a)?a.slice():c.toArray(a)).reverse();return c.reduce(a,b,d,e)};c.find=c.detect=function(a,b,d){var e;B(a,function(f,g,h){if(b.call(d,f,g,h))return e=f,true});return e};c.filter=c.select=function(a,b,d){var e=[];if(a==null)return e;if(x&&a.filter=== -x)return a.filter(b,d);j(a,function(f,g,h){b.call(d,f,g,h)&&(e[e.length]=f)});return e};c.reject=function(a,b,d){var e=[];if(a==null)return e;j(a,function(f,g,h){b.call(d,f,g,h)||(e[e.length]=f)});return e};c.every=c.all=function(a,b,d){var e=true;if(a==null)return e;if(y&&a.every===y)return a.every(b,d);j(a,function(f,g,h){if(!(e=e&&b.call(d,f,g,h)))return n});return e};var B=c.some=c.any=function(a,b,d){b||(b=c.identity);var e=false;if(a==null)return e;if(z&&a.some===z)return a.some(b,d);j(a,function(f, -g,h){if(e=b.call(d,f,g,h))return n});return e};c.include=c.contains=function(a,b){var d=false;if(a==null)return d;if(p&&a.indexOf===p)return a.indexOf(b)!=-1;B(a,function(e){if(d=e===b)return true});return d};c.invoke=function(a,b){var d=i.call(arguments,2);return c.map(a,function(e){return(b.call?b||e:e[b]).apply(e,d)})};c.pluck=function(a,b){return c.map(a,function(d){return d[b]})};c.max=function(a,b,d){if(!b&&c.isArray(a))return Math.max.apply(Math,a);var e={computed:-Infinity};j(a,function(f, -g,h){g=b?b.call(d,f,g,h):f;g>=e.computed&&(e={value:f,computed:g})});return e.value};c.min=function(a,b,d){if(!b&&c.isArray(a))return Math.min.apply(Math,a);var e={computed:Infinity};j(a,function(f,g,h){g=b?b.call(d,f,g,h):f;g<e.computed&&(e={value:f,computed:g})});return e.value};c.sortBy=function(a,b,d){return c.pluck(c.map(a,function(e,f,g){return{value:e,criteria:b.call(d,e,f,g)}}).sort(function(e,f){e=e.criteria;f=f.criteria;return e<f?-1:e>f?1:0}),"value")};c.sortedIndex=function(a,b,d){d|| -(d=c.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(b)?(e=g+1):(f=g)}return e};c.toArray=function(a){if(!a)return[];if(a.toArray)return a.toArray();if(c.isArray(a))return a;if(c.isArguments(a))return i.call(a);return c.values(a)};c.size=function(a){return c.toArray(a).length};c.first=c.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};c.rest=c.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};c.last=function(a){return a[a.length-1]};c.compact=function(a){return c.filter(a, -function(b){return!!b})};c.flatten=function(a){return c.reduce(a,function(b,d){if(c.isArray(d))return b.concat(c.flatten(d));b[b.length]=d;return b},[])};c.without=function(a){var b=i.call(arguments,1);return c.filter(a,function(d){return!c.include(b,d)})};c.uniq=c.unique=function(a,b){return c.reduce(a,function(d,e,f){if(0==f||(b===true?c.last(d)!=e:!c.include(d,e)))d[d.length]=e;return d},[])};c.intersect=function(a){var b=i.call(arguments,1);return c.filter(c.uniq(a),function(d){return c.every(b, -function(e){return c.indexOf(e,d)>=0})})};c.zip=function(){for(var a=i.call(arguments),b=c.max(c.pluck(a,"length")),d=Array(b),e=0;e<b;e++)d[e]=c.pluck(a,""+e);return d};c.indexOf=function(a,b,d){if(a==null)return-1;var e;if(d)return d=c.sortedIndex(a,b),a[d]===b?d:-1;if(p&&a.indexOf===p)return a.indexOf(b);d=0;for(e=a.length;d<e;d++)if(a[d]===b)return d;return-1};c.lastIndexOf=function(a,b){if(a==null)return-1;if(A&&a.lastIndexOf===A)return a.lastIndexOf(b);for(var d=a.length;d--;)if(a[d]===b)return d; -return-1};c.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);d=arguments[2]||1;for(var e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;){g[f++]=a;a+=d}return g};c.bind=function(a,b){if(a.bind===r&&r)return r.apply(a,i.call(arguments,1));var d=i.call(arguments,2);return function(){return a.apply(b,d.concat(i.call(arguments)))}};c.bindAll=function(a){var b=i.call(arguments,1);b.length==0&&(b=c.functions(a));j(b,function(d){a[d]=c.bind(a[d],a)});return a};c.memoize=function(a,b){var d={}; -b||(b=c.identity);return function(){var e=b.apply(this,arguments);return m.call(d,e)?d[e]:(d[e]=a.apply(this,arguments))}};c.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};c.defer=function(a){return c.delay.apply(c,[a,1].concat(i.call(arguments,1)))};var C=function(a,b,d){var e;return function(){var f=this,g=arguments,h=function(){e=null;a.apply(f,g)};d&&clearTimeout(e);if(d||!e)e=setTimeout(h,b)}};c.throttle=function(a,b){return C(a,b,false)}; -c.debounce=function(a,b){return C(a,b,true)};c.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};c.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments));return b.apply(this,d)}};c.compose=function(){var a=i.call(arguments);return function(){for(var b=i.call(arguments),d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};c.after=function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}};c.keys=G||function(a){if(a!== -Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)m.call(a,d)&&(b[b.length]=d);return b};c.values=function(a){return c.map(a,c.identity)};c.functions=c.methods=function(a){return c.filter(c.keys(a),function(b){return c.isFunction(a[b])}).sort()};c.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};c.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};c.clone=function(a){return c.isArray(a)? -a.slice():c.extend({},a)};c.tap=function(a,b){b(a);return a};c.isEqual=function(a,b){if(a===b)return true;var d=typeof a;if(d!=typeof b)return false;if(a==b)return true;if(!a&&b||a&&!b)return false;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(a.isEqual)return a.isEqual(b);if(c.isDate(a)&&c.isDate(b))return a.getTime()===b.getTime();if(c.isNaN(a)&&c.isNaN(b))return false;if(c.isRegExp(a)&&c.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline=== -b.multiline;if(d!=="object")return false;if(a.length&&a.length!==b.length)return false;d=c.keys(a);var e=c.keys(b);if(d.length!=e.length)return false;for(var f in a)if(!(f in b)||!c.isEqual(a[f],b[f]))return false;return true};c.isEmpty=function(a){if(c.isArray(a)||c.isString(a))return a.length===0;for(var b in a)if(m.call(a,b))return false;return true};c.isElement=function(a){return!!(a&&a.nodeType==1)};c.isArray=o||function(a){return F.call(a)==="[object Array]"};c.isArguments=function(a){return!(!a|| -!m.call(a,"callee"))};c.isFunction=function(a){return!(!a||!a.constructor||!a.call||!a.apply)};c.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)};c.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)};c.isNaN=function(a){return a!==a};c.isBoolean=function(a){return a===true||a===false};c.isDate=function(a){return!(!a||!a.getTimezoneOffset||!a.setUTCFullYear)};c.isRegExp=function(a){return!(!a||!a.test||!a.exec||!(a.ignoreCase||a.ignoreCase===false))};c.isNull=function(a){return a=== -null};c.isUndefined=function(a){return a===void 0};c.noConflict=function(){q._=D;return this};c.identity=function(a){return a};c.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};c.mixin=function(a){j(c.functions(a),function(b){I(b,c[b]=a[b])})};var J=0;c.uniqueId=function(a){var b=J++;return a?a+b:b};c.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g};c.template=function(a,b){var d=c.templateSettings;d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+ -a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.interpolate,function(e,f){return"',"+f.replace(/\\'/g,"'")+",'"}).replace(d.evaluate||null,function(e,f){return"');"+f.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";d=new Function("obj",d);return b?d(b):d};var l=function(a){this._wrapped=a};c.prototype=l.prototype;var s=function(a,b){return b?c(a).chain():a},I=function(a,b){l.prototype[a]=function(){var d= -i.call(arguments);E.call(d,this._wrapped);return s(b.apply(c,d),this._chain)}};c.mixin(c);j(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=k[a];l.prototype[a]=function(){b.apply(this._wrapped,arguments);return s(this._wrapped,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];l.prototype[a]=function(){return s(b.apply(this._wrapped,arguments),this._chain)}});l.prototype.chain=function(){this._chain=true;return this};l.prototype.value=function(){return this._wrapped}})(); -; -steal.end(); -; -steal.end(); -; -steal.end(); -function errorOut(a,c){function b(e){var d={canceled:"user canceled selection",notImplemented:"the user tried to invoke behavior that's not yet implemented",serverError:"a technical problem was encountered while trying to communicate with BrowserID servers."}[e];if(!d){alert("need verbose message for "+e);d="unknown error"}return d}a.error(c,b(c));window.self.close()} -var setupChannel=function(a){navigator.id&&navigator.id.channel?setupNativeChannel(a):setupHTMLChannel(a)},setupNativeChannel=function(a){navigator.id.channel.registerController(a)},setupHTMLChannel=function(a){var c=Channel.build({window:window.opener,origin:"*",scope:"mozid"});c.bind("getVerifiedEmail",function(b){function e(f){b.complete(f)}function d(f){errorOut(b,f)}b.delayReturn(true);a.getVerifiedEmail(b.origin,e,d)});return c}; -; -steal.end(); -var getEmails=function(){try{var a=JSON.parse(window.localStorage.emails);if(a!=null)return a}catch(b){}clearEmails();return{}},_storeEmails=function(a){window.localStorage.emails=JSON.stringify(a)},addEmail=function(a,b){var c=getEmails();c[a]=b;_storeEmails(c)},removeEmail=function(a){var b=getEmails();delete b[a];_storeEmails(b)},clearEmails=function(){_storeEmails({})}; -; -steal.end(); -$.Controller("Dialog",{},{init:function(){setupChannel(this);this.element.html("views/body.ejs",{});this.element.show();this.onerror=this.onsuccess=null},setupEnterKey:function(){$("input").keyup(function(a){if(a.which==13){$(".submit").click();a.preventDefault()}})},renderTemplates:function(a,b,c,d){a&&$("#dialog").html(a,b).hide().fadeIn(300);c&&$("#bottom-bar").html(c,d)},"#suggest_signin click":function(){this.doAuthenticate()},"#signin click":function(){var a=$("#email_input").val(),b=$("#password_input").val(), -c=this;$.ajax({url:"/wsapi/authenticate_user?email="+encodeURIComponent(a)+"&pass="+encodeURIComponent(b),success:function(d){if(JSON.parse(d)){c.doWait("Finishing Log In...","In just a moment you'll be logged into BrowserID.");c.syncIdentities()}else c.find("#nosuchaccount").hide().fadeIn(400)},error:function(){runErrorDialog("serverError","Error Authenticating!","There was a technical problem while trying to log you in. Yucky!")}})},"#pickemail click":function(){var a=$("#identities input:checked").val(), -b=getEmails()[a],c=b.priv;b=b.issuer;var d=this.remoteOrigin.replace(/^(http|https):\/\//,"");this.onsuccess(CryptoStubs.createAssertion(d,a,c,b))},"#addemail click":function(){this.doNewEmail()},"#addemail_button click":function(){var a=$("#email_input").val(),b=CryptoStubs.genKeyPair(),c=this;this.doWait("One Moment Please...","We're adding this email to your account, this should only take a couple seconds.");$.ajax({url:"/wsapi/add_email?email="+encodeURIComponent(a)+"&pubkey="+encodeURIComponent(b.pub)+ -"&site="+encodeURIComponent(this.remoteOrigin.replace(/^(http|https):\/\//,"")),success:function(){c.doConfirmEmail(a,b)},error:function(){runErrorDialog("serverError","Error Adding Address!","There was a technical problem while trying to add this email to your account. Yucky.")}})},"#notme click":function(){clearEmails();var a=this;$.get("/wsapi/logout",function(){a.doAuthenticate()})},"#create click":function(){this.doCreate()},"#forgotpassword click":function(){this.doForgotPassword()},"#cancel click":function(){this.onerror("canceled")}, -"#back click":function(){this.doStart()},"#continue_button click":function(){$("#continue_button").hasClass("disabled")||this.doSignIn()},"#create_continue click":function(){var a=this.find("#email_input").val(),b=this.find("#password_input").val(),c=CryptoStubs.genKeyPair();this.doWait("One Moment Please...","We're creating your account, this should only take a couple seconds");var d=this;$.ajax({url:"/wsapi/stage_user?email="+encodeURIComponent(a)+"&pass="+encodeURIComponent(b)+"&pubkey="+encodeURIComponent(c.pub)+ -"&site="+encodeURIComponent(this.remoteOrigin.replace(/^(http|https):\/\//,"")),success:function(){d.doConfirmEmail(a,c)},error:function(){runErrorDialog("serverError","Error Creating Account!","There was a technical problem while trying to create your account. Yucky.")}})},getVerifiedEmail:function(a,b,c){console.log("typeof onsuccess: "+typeof b);console.log("typeof onerror: "+typeof c);this.onsuccess=b;this.onerror=c;this.remoteOrigin=a.replace(/^.*:\/\//,"");this.doStart()},doStart:function(){var a= -this;_.keys(getEmails()).length>0?this.doSignIn():this.checkAuth(function(){a.syncIdentities()},function(){a.doAuthenticate()})},doSignIn:function(){this.renderTemplates("views/signin.ejs",{sitename:this.remoteOrigin,identities:getEmails()},"views/bottom-pickemail.ejs",{});this.find("input:first").attr("checked",true)},doAuthenticate:function(){this.renderTemplates("views/authenticate.ejs",{sitename:this.remoteOrigin},"views/bottom-signin.ejs",{});this.setupEnterKey()},doCreate:function(){function a(){var f= -e.find("#email_input").val();if(typeof f==="string"&&f.length){var g=b[f];if(typeof g!=="string")if(typeof g==="boolean")if(g){e.find("#email_input_note").show();e.find("#emailinuse_message").hide()}else{$("#emailinuse_message").fadeIn(300);e.find("#email_input_note").hide();$("#in_use_email").text(f)}else if(c!=="querying"){c&&window.clearTimeout(c);c=setTimeout(function(){c="querying";var h=d;$.ajax({url:"/wsapi/have_email?email="+encodeURIComponent(h),success:function(i){b[h]=!JSON.parse(i);c= -undefined;a()},error:function(){b[h]="server failed";c=undefined;a()}})},700)}d=f}f=$("#password_input").val();g=f===$("#password_verify_input").val();e.find(".passwordnote").hide();if(g)if(f)f.length<5?e.find("#password_too_short").show():e.find("#password_ok").show();else e.find("#enter_a_password").show();else e.find("#passwords_different").show()}this.renderTemplates("views/create.ejs",{},"views/bottom-continue.ejs",{});var b={},c=null,d=null,e=this;e.find("input").unbind("keyup").bind("keyup", -a);this.setupEnterKey();a()},doForgotPassword:function(){function a(){var c=$("#password_input").val(),d=c===$("#password_verify_input").val();b.find(".passwordnote").hide();if(d)if(c)c.length<5?b.find("#password_too_short").show():b.find("#password_ok").show();else b.find("#enter_a_password").show();else b.find("#passwords_different").show()}this.renderTemplates("views/forgotpassword.ejs",{},"views/bottom-continue.ejs",{});var b=this;b.find("input").unbind("keyup").bind("keyup",a);this.setupEnterKey(); -a()},doWait:function(a,b){this.renderTemplates("views/wait.ejs",{title:a,message:b})},doNewEmail:function(){this.renderTemplates("views/addemail.ejs",{},"views/bottom-addemail.ejs",{});this.setupEnterKey()},doConfirmEmail:function(a,b){function c(){return setTimeout(function(){$.ajax({url:"/wsapi/registration_status",success:function(e){if(e==="complete"){d.persistAddressAndKeyPair(a,b,"browserid.org:443");d.find("#waiting_confirmation").hide();d.find("#resendit_action").hide();d.find("#confirmed_notice").show(); -$("#continue_button").removeClass("disabled")}else if(e==="pending")pollTimeout=c();else runErrorDialog("serverError","Registration Failed","An error was encountered and the sign up cannot be completed, please try again later.")},error:function(e){runErrorDialog("serverError","Registration Failed",e.responseText)}})},3E3)}this.renderTemplates("views/confirmemail.ejs",{email:a},"views/bottom-confirmemail.ejs",{});$("#continue_button").addClass("disabled");var d=this;this.pollTimeout=c()},persistAddressAndKeyPair:function(a, -b,c){b={created:new Date,pub:b.pub,priv:b.priv};if(c)b.issuer=c;addEmail(a,b)},syncIdentities:function(){var a=getEmails(),b={};_(a).each(function(d,e){b[e]=d.pub});var c=this;$.ajax({url:"/wsapi/sync_emails",type:"post",data:JSON.stringify(b),success:function(d){function e(){if(!f||!f.length)c.doSignIn();else{var g=f.shift(),h=CryptoStubs.genKeyPair();$.ajax({url:"/wsapi/set_key?email="+encodeURIComponent(g)+"&pubkey="+encodeURIComponent(h.pub),success:function(){c.persistAddressAndKeyPair(g,h,"browserid.org:443"); -e()},error:function(){runErrorDialog("serverError","Error Adding Address!","There was a technical problem while trying to synchronize your account. Yucky.")}})}}d.unknown_emails&&_(d.unknown_emails).each(function(g){console.log("removed local identity: "+g);removeEmail(g)});var f=d.key_refresh;e()},error:function(d){runErrorDialog("serverError","Login Failed",d.responseText)}})},checkAuth:function(a,b){this.doWait("Communicating with server","Just a moment while we talk with the server.");$.ajax({url:"/wsapi/am_authed", -success:function(c){JSON.parse(c)?a():b()},error:function(){runErrorDialog("serverError","Error Communicating With Server!","There was a technical problem while trying to log you in. Yucky!")}})}}); -; -steal.end(); -$.View.preload('dialog_views_authenticate_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"content\">\n"); -___v1ew.push(" <p class=\"prompt\">Signing into <span class=\"sitename bad\">");___v1ew.push((jQuery.EJS.text( sitename )));___v1ew.push("</span>:</p>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Email </div>\n"); -___v1ew.push(" <div class=\"input\"> <input type=\"text\" id=\"email_input\"></input></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Password </div>\n"); -___v1ew.push(" <div class=\"input\"> <input type=\"password\" id=\"password_input\"></input></div>\n"); -___v1ew.push(" <div class=\"note\"> <a href=\"#\" id=\"forgotpassword\">I forgot my password</a> </div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"attention_lame\" id=\"nosuchaccount\" style=\"display:none;\">\n"); -___v1ew.push(" No such account exists with that email and/or password\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"actions\">\n"); -___v1ew.push(" <div class=\"action\"><a href=\"#\" id=\"create\">Don't have a BrowserID yet?</a></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" </div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_addemail_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"title\"> Add a new email address </div>\n"); -___v1ew.push(" <div class=\"content\">\n"); -___v1ew.push(" <div class=\"summary\">Setting up a up a new email address is easy, tell us what it is and we'll get started:</div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Email </div>\n"); -___v1ew.push(" <div class=\"input\"> <input type=\"text\" id=\"email_input\"></input></div>\n"); -___v1ew.push(" <div class=\"note\"></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" </div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_body_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push("<div id=\"header\">\n"); -___v1ew.push(" <div class=\"title\"><img src=\"/i/browserid_logo_lil.png\"></div><div class=\"subtitle\">A better way to sign in.</div>\n"); -___v1ew.push("</div>\n"); -___v1ew.push("\n"); -___v1ew.push("<div id=\"dialog\" class=\"dialog\">\n"); -___v1ew.push("</div>\n"); -___v1ew.push("\n"); -___v1ew.push("<div id=\"bottom-bar\">\n"); -___v1ew.push("</div>\n"); -___v1ew.push("\n"); -___v1ew.push("<div id=\"terms\">\n"); -___v1ew.push("BrowserID is a <a target=\"_blank\" href=\"http://mozillalabs.org\">Mozilla Labs</a> service.\n"); -___v1ew.push("See our <a target=\"_blank\" href=\"https://browserid.org/tos\">terms</a> and <a target=\"_blank\" href=\"https://browserid.org/privacy\">privacy policy</a>, or <a target=\"_blank\" href=\"https://browserid.org/users\">learn more</a>.\n"); -___v1ew.push("</div>");; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_bottom-addemail_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <button id=\"back\">Go Back</button>\n"); -___v1ew.push(" <button id=\"addemail_button\" class=\"righty action submit\">Add Email</button>\n"); -___v1ew.push(" <button id=\"cancel\" class=\"righty\">Cancel</button>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_bottom-confirmemail_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push("<button class=\"righty action submit\" id=\"continue_button\">Continue</button>\n"); -___v1ew.push("<button class=\"righty\" id=\"cancel\">Cancel</button>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_bottom-continue_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <button id=\"back\">Go Back</button>\n"); -___v1ew.push(" <button id=\"create_continue\" class=\"righty action submit\">Continue</button>\n"); -___v1ew.push(" <button id=\"cancel\" class=\"righty\">Cancel</button>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_bottom-pickemail_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <button id=\"pickemail\" class=\"righty action submit\">Sign In</button>\n"); -___v1ew.push(" <button id=\"cancel\" class=\"righty\">Cancel</button>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_bottom-signin_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <button id=\"signin\" class=\"righty action submit\">Sign In</button>\n"); -___v1ew.push(" <button id=\"cancel\" class=\"righty\">Cancel</button>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_bottom_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <button id=\"back\">Go Back</button>\n"); -___v1ew.push(" <button id=\"submit\" class=\"righty action submit\">Sign In</button>\n"); -___v1ew.push(" <button id=\"cancel\" class=\"righty\">Cancel</button>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_confirmemail_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"title\"> Confirm Your Email </div>\n"); -___v1ew.push(" <div class=\"content\">\n"); -___v1ew.push(" <div class=\"summary\">Welcome, <span class=\"email good\">");___v1ew.push((jQuery.EJS.text( email )));___v1ew.push("</span>. You will receive a <strong>confirmation email</strong> in a few moments. To activate your BrowserID, please <strong>visit the link</strong> included in the email.</div>\n"); -___v1ew.push(" <div class=\"attention\" id=\"waiting_confirmation\">\n"); -___v1ew.push(" Waiting for email confirmation...\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"attention_awesome\" style=\"display:none;\" id=\"confirmed_notice\">\n"); -___v1ew.push(" Your email has been confirmed! </span>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"actions\">\n"); -___v1ew.push(" <!-- XXX: disable the resend link until it's implemented -->\n"); -___v1ew.push(" <div style=\"display: none;\" class=\"action\" id=\"resendit_action\"> No email yet? <a href=\"#\">Resend it!</a></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" </div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_create_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"content\">\n"); -___v1ew.push(" <div class=\"summary\">BrowserID makes signing in <b>safer and easier</b>. To begin, please provide an email address and pick a password:</div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Email </div>\n"); -___v1ew.push(" <div class=\"input\"> <input id=\"email_input\" type=\"text\"></input></div>\n"); -___v1ew.push(" <div class=\"note\" id=\"email_input_note\" style=\"display:none;\"><span class=\"good\">Not registered</span></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Password </div>\n"); -___v1ew.push(" <div class=\"input\"> <input id=\"password_input\" type=\"password\"></input></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Verify </div>\n"); -___v1ew.push(" <div class=\"input\"> <input id=\"password_verify_input\" type=\"password\"></input></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"enter_a_password\"><span class=\"bad\">Enter a password</span></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"passwords_different\" style=\"display:none;\"><span class=\"bad\">Passwords different</span></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"password_too_short\" style=\"display:none;\"><span class=\"bad\">Password too short</span></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"password_ok\" style=\"display:none;\"><span class=\"good\">Password OK</span></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"attention_lame\" style=\"display:none;\" id=\"emailinuse_message\">\n"); -___v1ew.push(" <span id=\"in_use_email\">Email</span> in use, If this email is yours you can <a href=\"#\" id=\"suggest_signin\">sign in</a> with it?\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" </div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_forgotpassword_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"content\">\n"); -___v1ew.push(" <div class=\"summary\"><b>Forgot your password?</b> No problem! Enter your email address, pick a new password, and we'll get you set up again!</div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Email </div>\n"); -___v1ew.push(" <div class=\"input\"> <input id=\"email_input\" type=\"text\"></input></div>\n"); -___v1ew.push(" <div class=\"note\" id=\"email_input_note\" style=\"display:none;\"><span class=\"good\">Not registered</span></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Password </div>\n"); -___v1ew.push(" <div class=\"input\"> <input id=\"password_input\" type=\"password\"></input></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"input\">\n"); -___v1ew.push(" <div class=\"label\"> Verify </div>\n"); -___v1ew.push(" <div class=\"input\"> <input id=\"password_verify_input\" type=\"password\"></input></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"enter_a_password\"><span class=\"bad\">Enter a password</span></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"passwords_different\" style=\"display:none;\"><span class=\"bad\">Passwords different</span></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"password_too_short\" style=\"display:none;\"><span class=\"bad\">Password too short</span></div>\n"); -___v1ew.push(" <div class=\"note passwordnote\" id=\"password_ok\" style=\"display:none;\"><span class=\"good\">Password OK</span></div>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"attention_lame\" style=\"display:none;\" id=\"emailinuse_message\">\n"); -___v1ew.push(" <span id=\"in_use_email\">Email</span> in use, If this email is yours you can <a href=\"#\">sign in</a> with it?\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" </div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_signin_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"content\">\n"); -___v1ew.push(" <p class=\"prompt\">What email address would you like to use to sign into <span class=\"sitename bad\">");___v1ew.push((jQuery.EJS.text( sitename )));___v1ew.push("</span>?</p>\n"); -___v1ew.push(" <form id=\"identities\" name=\"identities\">\n"); -___v1ew.push(" "); _.each(identities, function(email_obj, email_address) { ;___v1ew.push("\n"); -___v1ew.push(" <div><input type=\"radio\" name=\"identity\" value=\"");___v1ew.push((jQuery.EJS.text(email_address)));___v1ew.push("\" /> ");___v1ew.push((jQuery.EJS.text( email_address )));___v1ew.push("</div>\n"); -___v1ew.push(" "); }); ;___v1ew.push("\n"); -___v1ew.push(" </form>\n"); -___v1ew.push(" </div>\n"); -___v1ew.push(" <div class=\"actions\">\n"); -___v1ew.push(" <div class=\"action\"><a id=\"addemail\" href=\"#\">Add a new email address</a></div>\n"); -___v1ew.push(" <div class=\"action\"><a id=\"notme\" href=\"#\">This is not me.</a></div>\n"); -___v1ew.push(" </div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end(); -$.View.preload('dialog_views_wait_ejs',jQuery.EJS(function(_CONTEXT,_VIEW) { try { with(_VIEW) { with (_CONTEXT) {var ___v1ew = [];___v1ew.push(" <div class=\"title\">");___v1ew.push((jQuery.EJS.text( title )));___v1ew.push("</div>\n"); -___v1ew.push(" <div class=\"content\">");___v1ew.push((jQuery.EJS.text( message )));___v1ew.push("</div>\n"); -; return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;} }));; -steal.end() \ No newline at end of file diff --git a/browserid/static/dialog/controllers/dialog_controller.js b/browserid/static/dialog/controllers/dialog_controller.js index 22998c2f393507b1fb946bc56644623ad4736112..8744d723808a298ffbd0c439626d79e658ef1e58 100644 --- a/browserid/static/dialog/controllers/dialog_controller.js +++ b/browserid/static/dialog/controllers/dialog_controller.js @@ -11,7 +11,8 @@ $.Controller("Dialog", {}, { this.csrf = null; this._getCSRF(); - this.element.html("views/body.ejs", {}); + var html = $.View("//dialog/views/body.ejs", {}); + this.element.html(html); this.element.show(); // keep track of where we are and what we do on success and error @@ -40,11 +41,15 @@ $.Controller("Dialog", {}, { }, renderTemplates: function(body, body_vars, footer, footer_vars) { - if (body) - $('#dialog').html(body, body_vars).hide().fadeIn(300); + if (body) { + var bodyHtml = $.View("//dialog/views/" + body, body_vars); + $('#dialog').html(bodyHtml).hide().fadeIn(300); + } - if (footer) - $('#bottom-bar').html(footer, footer_vars); + if (footer) { + var footerHtml = $.View("//dialog/views/" + footer, footer_vars); + $('#bottom-bar').html(footerHtml); + } }, "#suggest_signin click": function(event) { @@ -229,23 +234,23 @@ $.Controller("Dialog", {}, { }, doSignIn: function() { - this.renderTemplates("views/signin.ejs", {sitename: this.remoteOrigin, identities: getEmails()}, - "views/bottom-pickemail.ejs", {}); + this.renderTemplates("signin.ejs", {sitename: this.remoteOrigin, identities: getEmails()}, + "bottom-pickemail.ejs", {}); // select the first option this.find('input:first').attr('checked', true); }, doAuthenticate: function() { - this.renderTemplates("views/authenticate.ejs", {sitename: this.remoteOrigin}, - "views/bottom-signin.ejs", {}); + this.renderTemplates("authenticate.ejs", {sitename: this.remoteOrigin}, + "bottom-signin.ejs", {}); this.setupEnterKey(); }, doCreate: function() { - this.renderTemplates("views/create.ejs", {}, - "views/bottom-continue.ejs", {}); + this.renderTemplates("create.ejs", {}, + "bottom-continue.ejs", {}); $('#create_continue').addClass('disabled'); @@ -310,7 +315,6 @@ $.Controller("Dialog", {}, { $('#create_continue').addClass('disabled'); if (!match) { self.find('#passwords_different').show(); - self.find } else { if (!pass) { self.find('#enter_a_password').show(); @@ -332,8 +336,8 @@ $.Controller("Dialog", {}, { }, doForgotPassword: function() { - this.renderTemplates("views/forgotpassword.ejs", {}, - "views/bottom-continue.ejs", {}); + this.renderTemplates("forgotpassword.ejs", {}, + "bottom-continue.ejs", {}); $('#create_continue').addClass('disabled'); @@ -366,19 +370,19 @@ $.Controller("Dialog", {}, { }, doWait: function(title, message) { - this.renderTemplates("views/wait.ejs", {title: title, message: message}); + this.renderTemplates("wait.ejs", {title: title, message: message}); }, doNewEmail: function() { - this.renderTemplates("views/addemail.ejs", {}, - "views/bottom-addemail.ejs", {}); + this.renderTemplates("addemail.ejs", {}, + "bottom-addemail.ejs", {}); this.setupEnterKey(); }, doConfirmEmail: function(email, keypair) { - this.renderTemplates("views/confirmemail.ejs", {email:email}, - "views/bottom-confirmemail.ejs", {}); + this.renderTemplates("confirmemail.ejs", {email:email}, + "bottom-confirmemail.ejs", {}); $('#continue_button').addClass('disabled'); diff --git a/browserid/static/dialog/dialog.css b/browserid/static/dialog/dialog.css deleted file mode 100644 index 62aab7ebd574bdd24850cfc4aa2b768e01726b2a..0000000000000000000000000000000000000000 --- a/browserid/static/dialog/dialog.css +++ /dev/null @@ -1,2 +0,0 @@ -body {font-family: verdana} -td {padding: 3px;} \ No newline at end of file diff --git a/browserid/static/dialog/dialog.html b/browserid/static/dialog/dialog.html deleted file mode 100644 index 26d8835e49a0520c02892431f92f2b68d91cd6b3..0000000000000000000000000000000000000000 --- a/browserid/static/dialog/dialog.html +++ /dev/null @@ -1,15 +0,0 @@ -<html> -<head> - <head> - <title>Browser ID</title> - <link href="style.css" type="text/css" media="screen" rel="stylesheet"></link> - <script type='text/javascript' src='../steal/steal.js?dialog,development'></script> - <script> - $(document).ready(function() { - $('#body').dialog().show(); - }); - </script> - </head> -<body id="body"> - </body> -</html> diff --git a/browserid/static/dialog/dialog.js b/browserid/static/dialog/dialog.js index 2f334944f49a5668e04e9589afa032d955d16b83..281b52b02609314d138c318fd34cd8d3e02458f9 100644 --- a/browserid/static/dialog/dialog.js +++ b/browserid/static/dialog/dialog.js @@ -1,36 +1,36 @@ /*globals steal */ -steal.plugins( +steal.plugins( 'jquery/controller', // a widget factory 'jquery/controller/subscribe', // subscribe to OpenAjax.hub 'jquery/view/ejs', // client side templates 'jquery/controller/view') // lookup views with the controller's name - - .css() // loads styles + + .css("style") // loads styles .resources('jschannel', - 'underscore-min', - 'crypto', - 'crypto-stubs', - 'channel', - 'storage') // 3rd party script's (like jQueryUI), in resources folder + 'underscore-min', + 'crypto', + 'crypto-api', + 'channel', + 'storage') // 3rd party script's (like jQueryUI), in resources folder .models() // loads files in models folder .controllers('dialog') // loads files in controllers folder .views('authenticate.ejs', - 'addemail.ejs', - 'body.ejs', - 'bottom-addemail.ejs', - 'bottom-confirmemail.ejs', - 'bottom-continue.ejs', - 'bottom-pickemail.ejs', - 'bottom-signin.ejs', - 'bottom.ejs', - 'confirmemail.ejs', - 'create.ejs', - 'forgotpassword.ejs', - 'signin.ejs', - 'wait.ejs' - ); // adds views to be added to build + 'addemail.ejs', + 'body.ejs', + 'bottom-addemail.ejs', + 'bottom-confirmemail.ejs', + 'bottom-continue.ejs', + 'bottom-pickemail.ejs', + 'bottom-signin.ejs', + 'bottom.ejs', + 'confirmemail.ejs', + 'create.ejs', + 'forgotpassword.ejs', + 'signin.ejs', + 'wait.ejs' + ); // adds views to be added to build diff --git a/browserid/static/dialog/html5shim.js b/browserid/static/dialog/html5shim.js new file mode 100644 index 0000000000000000000000000000000000000000..b87a4e57a484234b2e06f5af65fd00b153f1c647 --- /dev/null +++ b/browserid/static/dialog/html5shim.js @@ -0,0 +1,4 @@ +// html5shiv @rem remysharp.com/html5-enabling-script +// iepp v1.6.2 @jon_neal iecss.com/print-protector +// Dual licensed under the MIT or GPL Version 2 licenses +/*@cc_on(function(a,b){function r(a){var b=-1;while(++b<f)a.createElement(e[b])}if(!(!window.attachEvent||!b.createStyleSheet||!function(){var a=document.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}())){a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=l.firstChild,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){if(a+""===undefined)return"";var d=-1,e=a.length,f,g=[];while(++d<e){f=a[d];if(f.disabled)continue;b=f.media||b,p.test(b)&&g.push(c.getCSS(f.imports,b),f.cssText),b="all"}return g.join("")},c.parseCSS=function(a){var b=[],c;while((c=j.exec(a))!=null)b.push(((i.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(g,"$1.iepp_$2")+c[4]);return b.join("\n")},c.writeHTML=function(){var a=-1;q=q||b.body;while(++a<f){var c=b.getElementsByTagName(e[a]),d=c.length,g=-1;while(++g<d)c[g].className.indexOf("iepp_")<0&&(c[g].className+=" iepp_"+e[a])}k.appendChild(q),l.appendChild(n),n.className=q.className,n.id=q.id,n.innerHTML=q.innerHTML.replace(h,"<$1font")},c._beforePrint=function(){o.styleSheet.cssText=c.parseCSS(c.getCSS(b.styleSheets,"all")),c.writeHTML()},c.restoreHTML=function(){n.innerHTML="",l.removeChild(n),l.appendChild(q)},c._afterPrint=function(){c.restoreHTML(),o.styleSheet.cssText=""},r(b),r(k);if(c.disablePP)return;m.insertBefore(o,m.firstChild),o.media="print",o.className="iepp-printshim",a.attachEvent("onbeforeprint",c._beforePrint),a.attachEvent("onafterprint",c._afterPrint)}})(this,document);@*/ diff --git a/browserid/static/dialog/register_iframe.html b/browserid/static/dialog/register_iframe.html index d9a2f96ebb6248046d5be286ec1c4362588c3931..0365a0de3b05ad4f96102cf237c9f1ddd52c57c4 100644 --- a/browserid/static/dialog/register_iframe.html +++ b/browserid/static/dialog/register_iframe.html @@ -1,3 +1,4 @@ <script src="../dialog/jschannel.js"></script> -<script src="../dialog/crypto-stubs.js"></script> +<script src="../dialog/crypto.js"></script> +<script src="../dialog/crypto-api.js"></script> <script src="../dialog/register_iframe.js"></script> diff --git a/browserid/static/dialog/resources/crypto-api.js b/browserid/static/dialog/resources/crypto-api.js new file mode 100644 index 0000000000000000000000000000000000000000..3eeec8c946f93835c19af2e97a20e923d703b81b --- /dev/null +++ b/browserid/static/dialog/resources/crypto-api.js @@ -0,0 +1,38 @@ +/*global CryptoStubs:true */ +// This file is the cryptographic routines that are required for +// BrowserID's HTML5 implementation + +CryptoStubs = (function() { + function genKeyPair() { + // fake keypairs. they're a random string with pub or priv prepended. + var key = new RSAKey(); + key.generate(512, "10001"); + + // hm. PEM encoding, anyone? + return { + pub: key.serializePublicASN1(), + priv: key.serializePrivateASN1() + }; + } + + function createAssertion(audience, email, privkey, issuer) { + var assertion = { + audience: audience, + email: email, + "valid-until": (new Date()).getTime() + (1000 * 120) // 2 mins from now. + }; + if (issuer) { + assertion.issuer = issuer; + } + + var token = new jwt.WebToken(JSON.stringify(assertion), JSON.stringify({alg:"RS256"})); + var signed = token.serialize(privkey); + return signed; + } + + return { + genKeyPair: genKeyPair, + createAssertion: createAssertion + }; +})(); + diff --git a/browserid/static/dialog/resources/crypto-stubs.js b/browserid/static/dialog/resources/crypto-stubs.js deleted file mode 100644 index 99db775ce20743513d1aaca8e75bed7a91cbc7c8..0000000000000000000000000000000000000000 --- a/browserid/static/dialog/resources/crypto-stubs.js +++ /dev/null @@ -1,41 +0,0 @@ -/*global CryptoStubs:true */ -// This file is the cryptographic routines that are required for -// BrowserID's HTML5 implementation - -CryptoStubs = (function() { - -"use strict";var sjcl={cipher:{},hash:{},mode:{},misc:{},codec:{},exception:{corrupt:function(b){this.toString=function(){return"CORRUPT: "+this.message};this.message=b},invalid:function(b){this.toString=function(){return"INVALID: "+this.message};this.message=b},bug:function(b){this.toString=function(){return"BUG: "+this.message};this.message=b}}};sjcl.cipher.aes=function(j){this.h[0][0][0]||this.w();var i,p,o,n,m=this.h[0][4],l=this.h[1];i=j.length;var k=1;if(i!==4&&i!==6&&i!==8){throw new sjcl.exception.invalid("invalid aes key size")}this.a=[o=j.slice(0),n=[]];for(j=i;j<4*i+28;j++){p=o[j-1];if(j%i===0||i===8&&j%i===4){p=m[p>>>24]<<24^m[p>>16&255]<<16^m[p>>8&255]<<8^m[p&255];if(j%i===0){p=p<<8^p>>>24^k<<24;k=k<<1^(k>>7)*283}}o[j]=o[j-i]^p}for(i=0;j;i++,j--){p=o[i&3?j:j-4];n[i]=j<=4||i<4?p:l[0][m[p>>>24]]^l[1][m[p>>16&255]]^l[2][m[p>>8&255]]^l[3][m[p&255]]}};sjcl.cipher.aes.prototype={encrypt:function(b){return this.H(b,0)},decrypt:function(b){return this.H(b,1)},h:[[[],[],[],[],[]],[[],[],[],[],[]]],w:function(){var B=this.h[0],A=this.h[1],y=B[4],x=A[4],w,v,u,s=[],r=[],p,q,o,n;for(w=0;w<256;w++){r[(s[w]=w<<1^(w>>7)*283)^w]=w}for(v=u=0;!y[v];v^=p||1,u=r[u]||1){o=u^u<<1^u<<2^u<<3^u<<4;o=o>>8^o&255^99;y[v]=o;x[o]=v;q=s[w=s[p=s[v]]];n=q*16843009^w*65537^p*257^v*16843008;q=s[o]*257^o*16843008;for(w=0;w<4;w++){B[w][v]=q=q<<24^q>>>8;A[w][o]=n=n<<24^n>>>8}}for(w=0;w<5;w++){B[w]=B[w].slice(0);A[w]=A[w].slice(0)}},H:function(L,K){if(L.length!==4){throw new sjcl.exception.invalid("invalid aes block size")}var J=this.a[K],I=L[0]^J[0],H=L[K?3:1]^J[1],G=L[2]^J[2];L=L[K?1:3]^J[3];var F,E,D,B=J.length/4-2,C,A=4,y=[0,0,0,0];F=this.h[K];var x=F[0],w=F[1],v=F[2],u=F[3],s=F[4];for(C=0;C<B;C++){F=x[I>>>24]^w[H>>16&255]^v[G>>8&255]^u[L&255]^J[A];E=x[H>>>24]^w[G>>16&255]^v[L>>8&255]^u[I&255]^J[A+1];D=x[G>>>24]^w[L>>16&255]^v[I>>8&255]^u[H&255]^J[A+2];L=x[L>>>24]^w[I>>16&255]^v[H>>8&255]^u[G&255]^J[A+3];A+=4;I=F;H=E;G=D}for(C=0;C<4;C++){y[K?3&-C:C]=s[I>>>24]<<24^s[H>>16&255]<<16^s[G>>8&255]<<8^s[L&255]^J[A++];F=I;I=H;H=G;G=L;L=F}return y}};sjcl.bitArray={bitSlice:function(f,d,g){f=sjcl.bitArray.P(f.slice(d/32),32-(d&31)).slice(1);return g===undefined?f:sjcl.bitArray.clamp(f,g-d)},concat:function(g,f){if(g.length===0||f.length===0){return g.concat(f)}var i=g[g.length-1],h=sjcl.bitArray.getPartial(i);return h===32?g.concat(f):sjcl.bitArray.P(f,h,i|0,g.slice(0,g.length-1))},bitLength:function(d){var c=d.length;if(c===0){return 0}return(c-1)*32+sjcl.bitArray.getPartial(d[c-1])},clamp:function(f,d){if(f.length*32<d){return f}f=f.slice(0,Math.ceil(d/32));var g=f.length;d&=31;if(g>0&&d){f[g-1]=sjcl.bitArray.partial(d,f[g-1]&2147483648>>d-1,1)}return f},partial:function(f,d,g){if(f===32){return d}return(g?d|0:d<<32-f)+f*1099511627776},getPartial:function(b){return Math.round(b/1099511627776)||32},equal:function(g,f){if(sjcl.bitArray.bitLength(g)!==sjcl.bitArray.bitLength(f)){return false}var i=0,h;for(h=0;h<g.length;h++){i|=g[h]^f[h]}return i===0},P:function(g,f,j,i){var h;h=0;if(i===undefined){i=[]}for(;f>=32;f-=32){i.push(j);j=0}if(f===0){return i.concat(g)}for(h=0;h<g.length;h++){i.push(j|g[h]>>>f);j=g[h]<<32-f}h=g.length?g[g.length-1]:0;g=sjcl.bitArray.getPartial(h);i.push(sjcl.bitArray.partial(f+g&31,f+g>32?j:i.pop(),1));return i},k:function(d,c){return[d[0]^c[0],d[1]^c[1],d[2]^c[2],d[3]^c[3]]}};sjcl.codec.utf8String={fromBits:function(g){var f="",j=sjcl.bitArray.bitLength(g),i,h;for(i=0;i<j/8;i++){if((i&3)===0){h=g[i/4]}f+=String.fromCharCode(h>>>24);h<<=8}return decodeURIComponent(escape(f))},toBits:function(g){g=unescape(encodeURIComponent(g));var f=[],i,h=0;for(i=0;i<g.length;i++){h=h<<8|g.charCodeAt(i);if((i&3)===3){f.push(h);h=0}}i&3&&f.push(sjcl.bitArray.partial(8*(i&3),h));return f}};sjcl.codec.hex={fromBits:function(f){var d="",g;for(g=0;g<f.length;g++){d+=((f[g]|0)+263882790666240).toString(16).substr(4)}return d.substr(0,sjcl.bitArray.bitLength(f)/4)},toBits:function(g){var f,i=[],h;g=g.replace(/\s|0x/g,"");h=g.length;g+="00000000";for(f=0;f<g.length;f+=8){i.push(parseInt(g.substr(f,8),16)^0)}return sjcl.bitArray.clamp(i,h*4)}};sjcl.codec.base64={D:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(j,i){var p="",o,n=0,m=sjcl.codec.base64.D,l=0,k=sjcl.bitArray.bitLength(j);for(o=0;p.length*6<k;){p+=m.charAt((l^j[o]>>>n)>>>26);if(n<6){l=j[o]<<6-n;n+=26;o++}else{l<<=6;n-=6}}for(;p.length&3&&!i;){p+="="}return p},toBits:function(i){i=i.replace(/\s|=/g,"");var h=[],n,m=0,l=sjcl.codec.base64.D,k=0,j;for(n=0;n<i.length;n++){j=l.indexOf(i.charAt(n));if(j<0){throw new sjcl.exception.invalid("this isn't base64!")}if(m>26){m-=26;h.push(k^j>>>m);k=j<<32-m}else{m+=6;k^=j<<32-m}}m&56&&h.push(sjcl.bitArray.partial(m&56,k,1));return h}};sjcl.hash.sha256=function(b){this.a[0]||this.w();if(b){this.n=b.n.slice(0);this.i=b.i.slice(0);this.e=b.e}else{this.reset()}};sjcl.hash.sha256.hash=function(b){return(new sjcl.hash.sha256).update(b).finalize()};sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.n=this.N.slice(0);this.i=[];this.e=0;return this},update:function(f){if(typeof f==="string"){f=sjcl.codec.utf8String.toBits(f)}var d,g=this.i=sjcl.bitArray.concat(this.i,f);d=this.e;f=this.e=d+sjcl.bitArray.bitLength(f);for(d=512+d&-512;d<=f;d+=512){this.C(g.splice(0,16))}return this},finalize:function(){var f,d=this.i,g=this.n;d=sjcl.bitArray.concat(d,[sjcl.bitArray.partial(1,1)]);for(f=d.length+2;f&15;f++){d.push(0)}d.push(Math.floor(this.e/4294967296));for(d.push(this.e|0);d.length;){this.C(d.splice(0,16))}this.reset();return g},N:[],a:[],w:function(){function g(a){return(a-Math.floor(a))*4294967296|0}var f=0,i=2,h;g:for(;f<64;i++){for(h=2;h*h<=i;h++){if(i%h===0){continue g}}if(f<8){this.N[f]=g(Math.pow(i,0.5))}this.a[f]=g(Math.pow(i,1/3));f++}},C:function(D){var C,B,A=D.slice(0),y=this.n,x=this.a,w=y[0],v=y[1],u=y[2],r=y[3],s=y[4],q=y[5],p=y[6],o=y[7];for(D=0;D<64;D++){if(D<16){C=A[D]}else{C=A[D+1&15];B=A[D+14&15];C=A[D&15]=(C>>>7^C>>>18^C>>>3^C<<25^C<<14)+(B>>>17^B>>>19^B>>>10^B<<15^B<<13)+A[D&15]+A[D+9&15]|0}C=C+o+(s>>>6^s>>>11^s>>>25^s<<26^s<<21^s<<7)+(p^s&(q^p))+x[D];o=p;p=q;q=s;s=r+C|0;r=u;u=v;v=w;w=C+(v&u^r&(v^u))+(v>>>2^v>>>13^v>>>22^v<<30^v<<19^v<<10)|0}y[0]=y[0]+w|0;y[1]=y[1]+v|0;y[2]=y[2]+u|0;y[3]=y[3]+r|0;y[4]=y[4]+s|0;y[5]=y[5]+q|0;y[6]=y[6]+p|0;y[7]=y[7]+o|0}};sjcl.mode.ccm={name:"ccm",encrypt:function(u,s,r,q,p){var o,n=s.slice(0),m=sjcl.bitArray,l=m.bitLength(r)/8,j=m.bitLength(n)/8;p=p||64;q=q||[];if(l<7){throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes")}for(o=2;o<4&&j>>>8*o;o++){}if(o<15-l){o=15-l}r=m.clamp(r,8*(15-o));s=sjcl.mode.ccm.G(u,s,r,q,p,o);n=sjcl.mode.ccm.I(u,n,r,s,p,o);return m.concat(n.data,n.tag)},decrypt:function(u,s,r,q,p){p=p||64;q=q||[];var o=sjcl.bitArray,n=o.bitLength(r)/8,m=o.bitLength(s),l=o.clamp(s,m-p),j=o.bitSlice(s,m-p);m=(m-p)/8;if(n<7){throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes")}for(s=2;s<4&&m>>>8*s;s++){}if(s<15-n){s=15-n}r=o.clamp(r,8*(15-s));l=sjcl.mode.ccm.I(u,l,r,j,p,s);u=sjcl.mode.ccm.G(u,l.data,r,q,p,s);if(!o.equal(l.tag,u)){throw new sjcl.exception.corrupt("ccm: tag doesn't match")}return l.data},G:function(r,q,p,o,n,m){var l=[],k=sjcl.bitArray,j=k.k;n/=8;if(n%2||n<4||n>16){throw new sjcl.exception.invalid("ccm: invalid tag length")}if(o.length>4294967295||q.length>4294967295){throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data")}m=[k.partial(8,(o.length?64:0)|n-2<<2|m-1)];m=k.concat(m,p);m[3]|=k.bitLength(q)/8;m=r.encrypt(m);if(o.length){p=k.bitLength(o)/8;if(p<=65279){l=[k.partial(16,p)]}else{if(p<=4294967295){l=k.concat([k.partial(16,65534)],[p])}}l=k.concat(l,o);for(o=0;o<l.length;o+=4){m=r.encrypt(j(m,l.slice(o,o+4)))}}for(o=0;o<q.length;o+=4){m=r.encrypt(j(m,q.slice(o,o+4)))}return k.clamp(m,n*8)},I:function(u,s,r,q,p,o){var n,m=sjcl.bitArray;n=m.k;var l=s.length,j=m.bitLength(s);r=m.concat([m.partial(8,o-1)],r).concat([0,0,0]).slice(0,4);q=m.bitSlice(n(q,u.encrypt(r)),0,p);if(!l){return{tag:q,data:[]}}for(n=0;n<l;n+=4){r[3]++;p=u.encrypt(r);s[n]^=p[0];s[n+1]^=p[1];s[n+2]^=p[2];s[n+3]^=p[3]}return{tag:q,data:m.clamp(s,j)}}};sjcl.mode.ocb2={name:"ocb2",encrypt:function(B,A,y,x,w,v){if(sjcl.bitArray.bitLength(y)!==128){throw new sjcl.exception.invalid("ocb iv must be 128 bits")}var u,s=sjcl.mode.ocb2.A,r=sjcl.bitArray,p=r.k,q=[0,0,0,0];y=s(B.encrypt(y));var o,n=[];x=x||[];w=w||64;for(u=0;u+4<A.length;u+=4){o=A.slice(u,u+4);q=p(q,o);n=n.concat(p(y,B.encrypt(p(y,o))));y=s(y)}o=A.slice(u);A=r.bitLength(o);u=B.encrypt(p(y,[0,0,0,A]));o=r.clamp(p(o,u),A);q=p(q,p(o,u));q=B.encrypt(p(q,p(y,s(y))));if(x.length){q=p(q,v?x:sjcl.mode.ocb2.pmac(B,x))}return n.concat(r.concat(o,r.clamp(q,w)))},decrypt:function(F,E,D,C,B,A){if(sjcl.bitArray.bitLength(D)!==128){throw new sjcl.exception.invalid("ocb iv must be 128 bits")}B=B||64;var y=sjcl.mode.ocb2.A,x=sjcl.bitArray,w=x.k,u=[0,0,0,0],v=y(F.encrypt(D)),s,r,q=sjcl.bitArray.bitLength(E)-B,p=[];C=C||[];for(D=0;D+4<q/32;D+=4){s=w(v,F.decrypt(w(v,E.slice(D,D+4))));u=w(u,s);p=p.concat(s);v=y(v)}r=q-D*32;s=F.encrypt(w(v,[0,0,0,r]));s=w(s,x.clamp(E.slice(D),r));u=w(u,s);u=F.encrypt(w(u,w(v,y(v))));if(C.length){u=w(u,A?C:sjcl.mode.ocb2.pmac(F,C))}if(!x.equal(x.clamp(u,B),x.bitSlice(E,q))){throw new sjcl.exception.corrupt("ocb: tag doesn't match")}return p.concat(x.clamp(s,r))},pmac:function(j,i){var p,o=sjcl.mode.ocb2.A,n=sjcl.bitArray,m=n.k,l=[0,0,0,0],k=j.encrypt([0,0,0,0]);k=m(k,o(o(k)));for(p=0;p+4<i.length;p+=4){k=o(k);l=m(l,j.encrypt(m(k,i.slice(p,p+4))))}i=i.slice(p);if(n.bitLength(i)<128){k=m(k,o(k));i=n.concat(i,[2147483648|0])}l=m(l,i);return j.encrypt(m(o(m(k,o(k))),l))},A:function(b){return[b[0]<<1^b[1]>>>31,b[1]<<1^b[2]>>>31,b[2]<<1^b[3]>>>31,b[3]<<1^(b[0]>>>31)*135]}};sjcl.misc.hmac=function(g,f){this.M=f=f||sjcl.hash.sha256;var i=[[],[]],h=f.prototype.blockSize/32;this.l=[new f,new f];if(g.length>h){g=f.hash(g)}for(f=0;f<h;f++){i[0][f]=g[f]^909522486;i[1][f]=g[f]^1549556828}this.l[0].update(i[0]);this.l[1].update(i[1])};sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(d,c){d=(new this.M(this.l[0])).update(d,c).finalize();return(new this.M(this.l[1])).update(d).finalize()};sjcl.misc.pbkdf2=function(w,v,u,s,r){u=u||1000;if(s<0||u<0){throw sjcl.exception.invalid("invalid params to pbkdf2")}if(typeof w==="string"){w=sjcl.codec.utf8String.toBits(w)}r=r||sjcl.misc.hmac;w=new r(w);var q,p,o,n,l=[],m=sjcl.bitArray;for(n=1;32*l.length<(s||1);n++){r=q=w.encrypt(m.concat(v,[n]));for(p=1;p<u;p++){q=w.encrypt(q);for(o=0;o<q.length;o++){r[o]^=q[o]}}l=l.concat(r)}if(s){l=m.clamp(l,s)}return l};sjcl.random={randomWords:function(g,f){var i=[];f=this.isReady(f);var h;if(f===0){throw new sjcl.exception.notready("generator isn't seeded")}else{f&2&&this.U(!(f&1))}for(f=0;f<g;f+=4){(f+1)%65536===0&&this.L();h=this.u();i.push(h[0],h[1],h[2],h[3])}this.L();return i.slice(0,g)},setDefaultParanoia:function(b){this.t=b},addEntropy:function(j,i,p){p=p||"user";var o,n,m=(new Date).valueOf(),l=this.q[p],k=this.isReady();o=this.F[p];if(o===undefined){o=this.F[p]=this.R++}if(l===undefined){l=this.q[p]=0}this.q[p]=(this.q[p]+1)%this.b.length;switch(typeof j){case"number":break;case"object":if(i===undefined){for(p=i=0;p<j.length;p++){for(n=j[p];n>0;){i++;n>>>=1}}}this.b[l].update([o,this.J++,2,i,m,j.length].concat(j));break;case"string":if(i===undefined){i=j.length}this.b[l].update([o,this.J++,3,i,m,j.length]);this.b[l].update(j);break;default:throw new sjcl.exception.bug("random: addEntropy only supports number, array or string")}this.j[l]+=i;this.f+=i;if(k===0){this.isReady()!==0&&this.K("seeded",Math.max(this.g,this.f));this.K("progress",this.getProgress())}},isReady:function(b){b=this.B[b!==undefined?b:this.t];return this.g&&this.g>=b?this.j[0]>80&&(new Date).valueOf()>this.O?3:1:this.f>=b?2:0},getProgress:function(b){b=this.B[b?b:this.t];return this.g>=b?1["0"]:this.f>b?1["0"]:this.f/b},startCollectors:function(){if(!this.m){if(window.addEventListener){window.addEventListener("load",this.o,false);window.addEventListener("mousemove",this.p,false)}else{if(document.attachEvent){document.attachEvent("onload",this.o);document.attachEvent("onmousemove",this.p)}else{throw new sjcl.exception.bug("can't attach event")}}this.m=true}},stopCollectors:function(){if(this.m){if(window.removeEventListener){window.removeEventListener("load",this.o);window.removeEventListener("mousemove",this.p)}else{if(window.detachEvent){window.detachEvent("onload",this.o);window.detachEvent("onmousemove",this.p)}}this.m=false}},addEventListener:function(d,c){this.r[d][this.Q++]=c},removeEventListener:function(g,f){var i;g=this.r[g];var h=[];for(i in g){g.hasOwnProperty[i]&&g[i]===f&&h.push(i)}for(f=0;f<h.length;f++){i=h[f];delete g[i]}},b:[new sjcl.hash.sha256],j:[0],z:0,q:{},J:0,F:{},R:0,g:0,f:0,O:0,a:[0,0,0,0,0,0,0,0],d:[0,0,0,0],s:undefined,t:6,m:false,r:{progress:{},seeded:{}},Q:0,B:[0,48,64,96,128,192,256,384,512,768,1024],u:function(){for(var b=0;b<4;b++){this.d[b]=this.d[b]+1|0;if(this.d[b]){break}}return this.s.encrypt(this.d)},L:function(){this.a=this.u().concat(this.u());this.s=new sjcl.cipher.aes(this.a)},T:function(b){this.a=sjcl.hash.sha256.hash(this.a.concat(b));this.s=new sjcl.cipher.aes(this.a);for(b=0;b<4;b++){this.d[b]=this.d[b]+1|0;if(this.d[b]){break}}},U:function(g){var f=[],i=0,h;this.O=f[0]=(new Date).valueOf()+30000;for(h=0;h<16;h++){f.push(Math.random()*4294967296|0)}for(h=0;h<this.b.length;h++){f=f.concat(this.b[h].finalize());i+=this.j[h];this.j[h]=0;if(!g&&this.z&1<<h){break}}if(this.z>=1<<this.b.length){this.b.push(new sjcl.hash.sha256);this.j.push(0)}this.f-=i;if(i>this.g){this.g=i}this.z++;this.T(f)},p:function(b){sjcl.random.addEntropy([b.x||b.clientX||b.offsetX,b.y||b.clientY||b.offsetY],2,"mouse")},o:function(){sjcl.random.addEntropy(new Date,2,"loadtime")},K:function(g,f){var i;g=sjcl.random.r[g];var h=[];for(i in g){g.hasOwnProperty(i)&&h.push(g[i])}for(i=0;i<h.length;i++){h[i](f)}}};sjcl.json={defaults:{v:1,iter:1000,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},encrypt:function(h,g,l,k){l=l||{};k=k||{};var j=sjcl.json,i=j.c({iv:sjcl.random.randomWords(4,0)},j.defaults);j.c(i,l);if(typeof i.salt==="string"){i.salt=sjcl.codec.base64.toBits(i.salt)}if(typeof i.iv==="string"){i.iv=sjcl.codec.base64.toBits(i.iv)}if(!sjcl.mode[i.mode]||!sjcl.cipher[i.cipher]||typeof h==="string"&&i.iter<=100||i.ts!==64&&i.ts!==96&&i.ts!==128||i.ks!==128&&i.ks!==192&&i.ks!==256||i.iv.length<2||i.iv.length>4){throw new sjcl.exception.invalid("json encrypt: invalid parameters")}if(typeof h==="string"){l=sjcl.misc.cachedPbkdf2(h,i);h=l.key.slice(0,i.ks/32);i.salt=l.salt}if(typeof g==="string"){g=sjcl.codec.utf8String.toBits(g)}l=new sjcl.cipher[i.cipher](h);j.c(k,i);k.key=h;i.ct=sjcl.mode[i.mode].encrypt(l,g,i.iv,i.adata,i.tag);return j.encode(j.V(i,j.defaults))},decrypt:function(g,f,j,i){j=j||{};i=i||{};var h=sjcl.json;f=h.c(h.c(h.c({},h.defaults),h.decode(f)),j,true);if(typeof f.salt==="string"){f.salt=sjcl.codec.base64.toBits(f.salt)}if(typeof f.iv==="string"){f.iv=sjcl.codec.base64.toBits(f.iv)}if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||typeof g==="string"&&f.iter<=100||f.ts!==64&&f.ts!==96&&f.ts!==128||f.ks!==128&&f.ks!==192&&f.ks!==256||!f.iv||f.iv.length<2||f.iv.length>4){throw new sjcl.exception.invalid("json decrypt: invalid parameters")}if(typeof g==="string"){j=sjcl.misc.cachedPbkdf2(g,f);g=j.key.slice(0,f.ks/32);f.salt=j.salt}j=new sjcl.cipher[f.cipher](g);j=sjcl.mode[f.mode].decrypt(j,f.ct,f.iv,f.adata,f.tag);h.c(i,f);i.key=g;return sjcl.codec.utf8String.fromBits(j)},encode:function(g){var f,i="{",h="";for(f in g){if(g.hasOwnProperty(f)){if(!f.match(/^[a-z0-9]+$/i)){throw new sjcl.exception.invalid("json encode: invalid property name")}i+=h+f+":";h=",";switch(typeof g[f]){case"number":case"boolean":i+=g[f];break;case"string":i+='"'+escape(g[f])+'"';break;case"object":i+='"'+sjcl.codec.base64.fromBits(g[f],1)+'"';break;default:throw new sjcl.exception.bug("json encode: unsupported type")}}}return i+"}"},decode:function(g){g=g.replace(/\s/g,"");if(!g.match(/^\{.*\}$/)){throw new sjcl.exception.invalid("json decode: this isn't json!")}g=g.replace(/^\{|\}$/g,"").split(/,/);var f={},i,h;for(i=0;i<g.length;i++){if(!(h=g[i].match(/^([a-z][a-z0-9]*):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i))){throw new sjcl.exception.invalid("json decode: this isn't json!")}f[h[1]]=h[2]?parseInt(h[2],10):h[1].match(/^(ct|salt|iv)$/)?sjcl.codec.base64.toBits(h[3]):unescape(h[3])}return f},c:function(g,f,i){if(g===undefined){g={}}if(f===undefined){return g}var h;for(h in f){if(f.hasOwnProperty(h)){if(i&&g[h]!==undefined&&g[h]!==f[h]){throw new sjcl.exception.invalid("required parameter overridden")}g[h]=f[h]}}return g},V:function(g,f){var i={},h;for(h in g){if(g.hasOwnProperty(h)&&g[h]!==f[h]){i[h]=g[h]}}return i},W:function(g,f){var i={},h;for(h=0;h<f.length;h++){if(g[f[h]]!==undefined){i[f[h]]=g[f[h]]}}return i}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.S={};sjcl.misc.cachedPbkdf2=function(g,f){var i=sjcl.misc.S,h;f=f||{};h=f.iter||1000;i=i[g]=i[g]||{};h=i[h]=i[h]||{firstSalt:f.salt&&f.salt.length?f.salt.slice(0):sjcl.random.randomWords(2,0)};i=f.salt===undefined?h.firstSalt:f.salt;h[i]=h[i]||sjcl.misc.pbkdf2(g,i,f.iter);return{key:h[i].slice(0),salt:i.slice(0)}};var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64pad="=";function hex2b64(d){var b;var f;var a="";for(b=0;b+3<=d.length;b+=3){f=parseInt(d.substring(b,b+3),16);a+=b64map.charAt(f>>6)+b64map.charAt(f&63)}if(b+1==d.length){f=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(f<<2)}else{if(b+2==d.length){f=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(f>>2)+b64map.charAt((f&3)<<4)}}while((a.length&3)>0){a+=b64pad}return a}function b64tohex(g){var d="";var f;var b=0;var c;for(f=0;f<g.length;++f){if(g.charAt(f)==b64pad){break}var a=b64map.indexOf(g.charAt(f));if(a<0){continue}if(b==0){d+=int2char(a>>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(f){var d=b64tohex(f);var c;var b=new Array();for(c=0;2*c<d.length;++c){b[c]=parseInt(d.substring(2*c,2*c+2),16)}return b}var dbits;var canary=244837814094590;var j_lm=((canary&16777215)==15715070);function BigInteger(f,d,g){if(f!=null){if("number"==typeof f){this.fromNumber(f,d,g)}else{if(d==null&&"string"!=typeof f){this.fromString(f,256)}else{this.fromString(f,d)}}}}function nbi(){return new BigInteger(null)}function am1(g,a,b,f,k,h){while(--h>=0){var d=a*this[g++]+b[f]+k;k=Math.floor(d/67108864);b[f++]=d&67108863}return k}function am2(g,r,s,f,p,a){var o=r&32767,q=r>>15;while(--a>=0){var d=this[g]&32767;var k=this[g++]>>15;var b=q*d+k*o;d=o*d+((b&32767)<<15)+s[f]+(p&1073741823);p=(d>>>30)+(b>>>15)+q*k+(p>>>30);s[f++]=d&1073741823}return p}function am3(g,r,s,f,p,a){var o=r&16383,q=r>>14;while(--a>=0){var d=this[g]&16383;var k=this[g++]>>14;var b=q*d+k*o;d=o*d+((b&16383)<<14)+s[f]+p;p=(d>>28)+(b>>14)+q*k;s[f++]=d&268435455}return p}try{if(j_lm&&(navigator&&navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator&&navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}}catch(e){BigInteger.prototype.am=am3;dbits=28}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<<dbits)-1);BigInteger.prototype.DV=(1<<dbits);var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";var BI_RC=new Array();var rr,vv;rr="0".charCodeAt(0);for(vv=0;vv<=9;++vv){BI_RC[rr++]=vv}rr="a".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}rr="A".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}function int2char(a){return BI_RM.charAt(a)}function intAt(b,a){var d=BI_RC[b.charCodeAt(a)];return(d==null)?-1:d}function bnpCopyTo(b){for(var a=this.t-1;a>=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(j,c){var f;if(c==16){f=4}else{if(c==8){f=3}else{if(c==256){f=8}else{if(c==2){f=1}else{if(c==32){f=5}else{if(c==4){f=2}else{this.fromRadix(j,c);return}}}}}}this.t=0;this.s=0;var h=j.length,d=false,g=0;while(--h>=0){var a=(f==8)?j[h]&255:intAt(j,h);if(a<0){if(j.charAt(h)=="-"){d=true}continue}d=false;if(g==0){this[this.t++]=a}else{if(g+f>this.DB){this[this.t-1]|=(a&((1<<(this.DB-g))-1))<<g;this[this.t++]=(a>>(this.DB-g))}else{this[this.t-1]|=a<<g}}g+=f;if(g>=this.DB){g-=this.DB}}if(f==8&&(j[0]&128)!=0){this.s=-1;if(g>0){this[this.t-1]|=((1<<(this.DB-g))-1)<<g}}this.clamp();if(d){BigInteger.ZERO.subTo(this,this)}}function bnpClamp(){var a=this.s&this.DM;while(this.t>0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var f;if(c==16){f=4}else{if(c==8){f=3}else{if(c==2){f=1}else{if(c==32){f=5}else{if(c==4){f=2}else{return this.toRadix(c)}}}}}var h=(1<<f)-1,n,a=false,j="",g=this.t;var l=this.DB-(g*this.DB)%f;if(g-->0){if(l<this.DB&&(n=this[g]>>l)>0){a=true;j=int2char(n)}while(g>=0){if(l<f){n=(this[g]&((1<<l)-1))<<(f-l);n|=this[--g]>>(l+=this.DB-f)}else{n=(this[g]>>(l-=f))&h;if(l<=0){l+=this.DB;--g}}if(n>0){a=true}if(a){j+=int2char(n)}}}return a?j:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a<this.t;++a){b[a-c]=this[a]}b.t=Math.max(this.t-c,0);b.s=this.s}function bnpLShiftTo(k,f){var b=k%this.DB;var a=this.DB-b;var h=(1<<a)-1;var g=Math.floor(k/this.DB),j=(this.s<<b)&this.DM,d;for(d=this.t-1;d>=0;--d){f[d+g+1]=(this[d]>>a)|j;j=(this[d]&h)<<b}for(d=g-1;d>=0;--d){f[d]=0}f[g]=j;f.t=this.t+g+1;f.s=this.s;f.clamp()}function bnpRShiftTo(h,d){d.s=this.s;var f=Math.floor(h/this.DB);if(f>=this.t){d.t=0;return}var b=h%this.DB;var a=this.DB-b;var g=(1<<b)-1;d[0]=this[f]>>b;for(var c=f+1;c<this.t;++c){d[c-f-1]|=(this[c]&g)<<a;d[c-f]=this[c]>>b}if(b>0){d[this.t-f-1]|=(this.s&g)<<a}d.t=this.t-f;d.clamp()}function bnpSubTo(d,g){var f=0,h=0,b=Math.min(d.t,this.t);while(f<b){h+=this[f]-d[f];g[f++]=h&this.DM;h>>=this.DB}if(d.t<this.t){h-=d.s;while(f<this.t){h+=this[f];g[f++]=h&this.DM;h>>=this.DB}h+=this.s}else{h+=this.s;while(f<d.t){h-=d[f];g[f++]=h&this.DM;h>>=this.DB}h-=d.s}g.s=(h<0)?-1:0;if(h<-1){g[f++]=this.DV+h}else{if(h>0){g[f++]=h}}g.t=f;g.clamp()}function bnpMultiplyTo(c,f){var b=this.abs(),g=c.abs();var d=b.t;f.t=d+g.t;while(--d>=0){f[d]=0}for(d=0;d<g.t;++d){f[d+b.t]=b.am(0,g[d],f,d,0,b.t)}f.s=0;f.clamp();if(this.s!=c.s){BigInteger.ZERO.subTo(f,f)}}function bnpSquareTo(d){var a=this.abs();var b=d.t=2*a.t;while(--b>=0){d[b]=0}for(b=0;b<a.t-1;++b){var f=a.am(b,a[b],d,2*b,0,1);if((d[b+a.t]+=a.am(b+1,2*a[b],d,2*b+1,f,a.t-b-1))>=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t<w.t){if(h!=null){h.fromInt(0)}if(g!=null){this.copyTo(g)}return}if(g==null){g=nbi()}var d=nbi(),a=this.s,l=n.s;var v=this.DB-nbits(w[w.t-1]);if(v>0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<<this.F1)+((p>1)?d[p-2]>>this.F2:0);var B=this.FV/o,A=(1<<this.F1)/o,x=1<<this.F2;var u=g.t,s=u-p,f=(h==null)?nbi():h;d.dlShiftTo(s,f);if(g.compareTo(f)>=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t<p){d[d.t++]=0}while(--s>=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*B+(g[u-1]+x)*A);if((g[u]+=d.am(0,c,g,s,0,p))<c){d.dlShiftTo(s,f);g.subTo(f,g);while(g[u]<--c){g.subTo(f,g)}}}if(h!=null){g.drShiftTo(p,h);if(a!=l){BigInteger.ZERO.subTo(h,h)}}g.t=p;g.clamp();if(v>0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c<this.m.t;++c){var b=a[c]&32767;var d=(b*this.mpl+(((b*this.mph+(a[c]>>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<<c))>0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]}function bnByteValue(){return(this.t==0)?this.s:(this[0]<<24)>>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var g=this.chunkSize(c);var f=Math.pow(c,g);var j=nbv(f),k=nbi(),i=nbi(),h="";this.divRemTo(j,k,i);while(k.signum()>0){h=(f+i.intValue()).toString(c).substr(1)+h;k.divRemTo(j,k,i)}return i.intValue().toString(c)+h}function bnpFromRadix(n,k){this.fromInt(0);if(k==null){k=10}var g=this.chunkSize(k);var h=Math.pow(k,g),f=false,a=0,m=0;for(var c=0;c<n.length;++c){var l=intAt(n,c);if(l<0){if(n.charAt(c)=="-"&&this.signum()==0){f=true}continue}m=k*m+l;if(++a>=g){this.dMultiply(h);this.dAddOffset(m,0);a=0;m=0}}if(a>0){this.dMultiply(Math.pow(k,a));this.dAddOffset(m,0)}if(f){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(g,f,i){if("number"==typeof f){if(g<2){this.fromInt(1)}else{this.fromNumber(g,i);if(!this.testBit(g-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(g-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(f)){this.dAddOffset(2,0);if(this.bitLength()>g){this.subTo(BigInteger.ONE.shiftLeft(g-1),this)}}}}else{var d=new Array(),h=g&7;d.length=(g>>3)+1;f.nextBytes(d);if(h>0){d[0]&=((1<<h)-1)}else{d[0]=0}this.fromString(d,256)}}function bnToByteArray(){var b=this.t,c=new Array();c[0]=this.s;var f=this.DB-(b*this.DB)%8,g,a=0;if(b-->0){if(f<this.DB&&(g=this[b]>>f)!=(this.s&this.DM)>>f){c[a++]=g|(this.s<<(this.DB-f))}while(b>=0){if(f<8){g=(this[b]&((1<<f)-1))<<(8-f);g|=this[--b]>>(f+=this.DB-8)}else{g=(this[b]>>(f-=8))&255;if(f<=0){f+=this.DB;--b}}if((g&128)!=0){g|=-256}if(a==0&&(this.s&128)!=(g&128)){++a}if(a>0||g!=this.s){c[a++]=g}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,j,g){var d,h,b=Math.min(c.t,this.t);for(d=0;d<b;++d){g[d]=j(this[d],c[d])}if(c.t<this.t){h=c.s&this.DM;for(d=b;d<this.t;++d){g[d]=j(this[d],h)}g.t=this.t}else{h=this.s&this.DM;for(d=b;d<c.t;++d){g[d]=j(h,c[d])}g.t=c.t}g.s=j(this.s,c.s);g.clamp()}function op_and(a,b){return a&b}function bnAnd(b){var c=nbi();this.bitwiseTo(b,op_and,c);return c}function op_or(a,b){return a|b}function bnOr(b){var c=nbi();this.bitwiseTo(b,op_or,c);return c}function op_xor(a,b){return a^b}function bnXor(b){var c=nbi();this.bitwiseTo(b,op_xor,c);return c}function op_andnot(a,b){return a&~b}function bnAndNot(b){var c=nbi();this.bitwiseTo(b,op_andnot,c);return c}function bnNot(){var b=nbi();for(var a=0;a<this.t;++a){b[a]=this.DM&~this[a]}b.t=this.t;b.s=~this.s;return b}function bnShiftLeft(b){var a=nbi();if(b<0){this.rShiftTo(-b,a)}else{this.lShiftTo(b,a)}return a}function bnShiftRight(b){var a=nbi();if(b<0){this.lShiftTo(-b,a)}else{this.rShiftTo(b,a)}return a}function lbit(a){if(a==0){return -1}var b=0;if((a&65535)==0){a>>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a<this.t;++a){if(this[a]!=0){return a*this.DB+lbit(this[a])}}if(this.s<0){return this.t*this.DB}return -1}function cbit(a){var b=0;while(a!=0){a&=a-1;++b}return b}function bnBitCount(){var c=0,a=this.s&this.DM;for(var b=0;b<this.t;++b){c+=cbit(this[b]^a)}return c}function bnTestBit(b){var a=Math.floor(b/this.DB);if(a>=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,g){var f=0,h=0,b=Math.min(d.t,this.t);while(f<b){h+=this[f]+d[f];g[f++]=h&this.DM;h>>=this.DB}if(d.t<this.t){h+=d.s;while(f<this.t){h+=this[f];g[f++]=h&this.DM;h>>=this.DB}h+=this.s}else{h+=this.s;while(f<d.t){h+=d[f];g[f++]=h&this.DM;h>>=this.DB}h+=d.s}g.s=(h<0)?-1:0;if(h>0){g[f++]=h}else{if(h<-1){g[f++]=this.DV+h}}g.t=f;g.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,g,f){var d=Math.min(this.t+b.t,g);f.s=0;f.t=d;while(d>0){f[--d]=0}var c;for(c=f.t-this.t;d<c;++d){f[d+this.t]=this.am(0,b[d],f,d,0,this.t)}for(c=Math.min(b.t,g);d<c;++d){this.am(0,b[d],f,d,0,g-d)}f.clamp()}function bnpMultiplyUpperTo(b,f,d){--f;var c=d.t=this.t+b.t-f;d.s=0;while(--c>=0){d[c]=0}for(c=Math.max(f-this.t,0);c<b.t;++c){d[this.t+c-f]=this.am(f-c,b[c],d,0,0,this.t+c-f)}d.clamp();d.drShiftTo(1,d)}function Barrett(a){this.r2=nbi();this.q3=nbi();BigInteger.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function barrettConvert(a){if(a.s<0||a.t>2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<<h)-1;p[1]=v.convert(this);if(h>1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<<o))==0){v.sqrTo(b,c);y=b;b=c;c=y;if(--o<0){o=this.DB-1;--l}}}return v.revert(b)}function bnGCD(c){var b=(this.s<0)?this.negate():this.clone();var j=(c.s<0)?c.negate():c.clone();if(b.compareTo(j)<0){var f=b;b=j;j=f}var d=b.getLowestSetBit(),h=j.getLowestSetBit();if(h<0){return b}if(d<h){h=d}if(h>0){b.rShiftTo(h,b);j.rShiftTo(h,j)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=j.getLowestSetBit())>0){j.rShiftTo(d,j)}if(b.compareTo(j)>=0){b.subTo(j,b);b.rShiftTo(1,b)}else{j.subTo(b,j);j.rShiftTo(1,j)}}if(h>0){j.lShiftTo(h,j)}return j}function bnpModInt(f){if(f<=0){return 0}var c=this.DV%f,b=(this.s<0)?f-1:0;if(this.t>0){if(c==0){b=this[0]%f}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%f}}}return b}function bnModInverse(g){var k=g.isEven();if((this.isEven()&&k)||g.signum()==0){return BigInteger.ZERO}var j=g.clone(),i=this.clone();var h=nbv(1),f=nbv(0),n=nbv(0),l=nbv(1);while(j.signum()!=0){while(j.isEven()){j.rShiftTo(1,j);if(k){if(!h.isEven()||!f.isEven()){h.addTo(this,h);f.subTo(g,f)}h.rShiftTo(1,h)}else{if(!f.isEven()){f.subTo(g,f)}}f.rShiftTo(1,f)}while(i.isEven()){i.rShiftTo(1,i);if(k){if(!n.isEven()||!l.isEven()){n.addTo(this,n);l.subTo(g,l)}n.rShiftTo(1,n)}else{if(!l.isEven()){l.subTo(g,l)}}l.rShiftTo(1,l)}if(j.compareTo(i)>=0){j.subTo(i,j);if(k){h.subTo(n,h)}f.subTo(l,f)}else{i.subTo(j,i);if(k){n.subTo(h,n)}l.subTo(f,l)}}if(i.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(l.compareTo(g)>=0){return l.subtract(g)}if(l.signum()<0){l.addTo(g,l)}else{return l}if(l.signum()<0){return l.add(g)}else{return l}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(f){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d<lowprimes.length;++d){if(b[0]==lowprimes[d]){return true}}return false}if(b.isEven()){return false}d=1;while(d<lowprimes.length){var a=lowprimes[d],c=d+1;while(c<lowprimes.length&&a<lplim){a*=lowprimes[c++]}a=b.modInt(a);while(d<c){if(a%lowprimes[d++]==0){return false}}}return b.millerRabin(f)}function bnpMillerRabin(g){var h=this.subtract(BigInteger.ONE);var c=h.getLowestSetBit();if(c<=0){return false}var l=h.shiftRight(c);g=(g+1)>>1;if(g>lowprimes.length){g=lowprimes.length}var b=nbi();for(var f=0;f<g;++f){b.fromInt(lowprimes[f]);var m=b.modPow(l,this);if(m.compareTo(BigInteger.ONE)!=0&&m.compareTo(h)!=0){var d=1;while(d++<c&&m.compareTo(h)!=0){m=m.modPowInt(2,this);if(m.compareTo(BigInteger.ONE)==0){return false}}if(m.compareTo(h)!=0){return false}}}return true}BigInteger.prototype.chunkSize=bnpChunkSize;BigInteger.prototype.toRadix=bnpToRadix;BigInteger.prototype.fromRadix=bnpFromRadix;BigInteger.prototype.fromNumber=bnpFromNumber;BigInteger.prototype.bitwiseTo=bnpBitwiseTo;BigInteger.prototype.changeBit=bnpChangeBit;BigInteger.prototype.addTo=bnpAddTo;BigInteger.prototype.dMultiply=bnpDMultiply;BigInteger.prototype.dAddOffset=bnpDAddOffset;BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo;BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo;BigInteger.prototype.modInt=bnpModInt;BigInteger.prototype.millerRabin=bnpMillerRabin;BigInteger.prototype.clone=bnClone;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.byteValue=bnByteValue;BigInteger.prototype.shortValue=bnShortValue;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.toByteArray=bnToByteArray;BigInteger.prototype.equals=bnEquals;BigInteger.prototype.min=bnMin;BigInteger.prototype.max=bnMax;BigInteger.prototype.and=bnAnd;BigInteger.prototype.or=bnOr;BigInteger.prototype.xor=bnXor;BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract;BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;function parseBigInt(b,a){return new BigInteger(b,a)}function linebrk(c,d){var a="";var b=0;while(b+d<c.length){a+=c.substring(b,b+d)+"\n";b+=d}return a+c.substring(b,c.length)}function byte2Hex(a){if(a<16){return"0"+a.toString(16)}else{return a.toString(16)}}function pkcs1pad2(f,j){if(j<f.length+11){alert("Message too long for RSA");return null}var h=new Array();var d=f.length-1;while(d>=0&&j>0){var g=f.charCodeAt(d--);if(g<128){h[--j]=g}else{if((g>127)&&(g<2048)){h[--j]=(g&63)|128;h[--j]=(g>>6)|192}else{h[--j]=(g&63)|128;h[--j]=((g>>6)&63)|128;h[--j]=(g>>12)|224}}}h[--j]=0;var b=new SecureRandom();var a=new Array();while(j>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}h[--j]=a[0]}h[--j]=2;h[--j]=0;return new BigInteger(h)}function RSAKey(){this.n=null;this.e=0;this.d=null;this.p=null;this.q=null;this.dmp1=null;this.dmq1=null;this.coeff=null}function RSASetPublic(b,a){if(b!=null&&a!=null&&b.length>0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{alert("Invalid RSA public key")}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var f=this.doPublic(a);if(f==null){return null}var b=f.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;function pkcs1unpad2(h,k){var a=h.toByteArray();var g=0;while(g<a.length&&a[g]==0){++g}if(a.length-g!=k-1||a[g]!=2){return null}++g;while(a[g]!=0){if(++g>=a.length){return null}}var f="";while(++g<a.length){var j=a[g]&255;if(j<128){f+=String.fromCharCode(j)}else{if((j>191)&&(j<224)){f+=String.fromCharCode(((j&31)<<6)|(a[g+1]&63));++g}else{f+=String.fromCharCode(((j&15)<<12)|((a[g+1]&63)<<6)|(a[g+2]&63));g+=2}}}return f}function RSASetPrivate(c,a,b){if(c!=null&&a!=null&&c.length>0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}function RSASetPrivateEx(h,d,f,c,b,a,i,g){if(h!=null&&d!=null&&h.length>0&&d.length>0){this.n=parseBigInt(h,16);this.e=parseInt(d,16);this.d=parseBigInt(f,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(i,16);this.coeff=parseBigInt(g,16)}else{alert("Invalid RSA private key")}}function RSAGenerate(b,j){var a=new SecureRandom();var g=b>>1;this.e=parseInt(j,16);var c=new BigInteger(j,16);for(;;){for(;;){this.p=new BigInteger(b-g,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(g,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var i=this.p;this.p=this.q;this.q=i}var h=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var f=h.multiply(d);if(f.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(f);this.dmp1=this.d.mod(h);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}}function RSAPrivateKeySerializeASN1(){function g(j,k){var i=k.toByteArray();j.push(2);j.push(i.length);return j.concat(i)}var c=[];c.push(48);c.push(130);c.push(1);c.push(0);c.push(2);c.push(1);c.push(0);c=g(c,this.n);c=g(c,new BigInteger(""+this.e,10));c=g(c,this.d);c=g(c,this.p);c=g(c,this.q);c=g(c,this.dmp1);c=g(c,this.dmq1);c=g(c,this.coeff);var f=c.length-4;var a=new BigInteger(""+f,10).toByteArray();c[2]=a[0];c[3]=a[1];var b="";for(var d=0;d<c.length;d++){b+=int2char((c[d]&240)>>4);b+=int2char(c[d]&15)}b=hex2b64(b);var h="";for(var d=0;d<b.length;d++){if(d>0&&(d%64)==0){h+="\n"}h+=b[d]}return"-----BEGIN RSA PRIVATE KEY-----\n"+h+"\n-----END RSA PRIVATE KEY-----\n"}function RSAPublicKeySerializeASN1(){function g(o){var n=0;for(var q=0;q<o.length;q++){n+=o[q].length}var p=[];p.push(48);if(n<128){p.push(n)}else{var m=new BigInteger(""+n,10).toByteArray();p.push(128|m.length);for(var q=0;q<m.length;q++){p.push(m[q])}}for(var q=0;q<o.length;q++){p=p.concat(o[q])}return p}function b(n){var i=n.toByteArray();var m=[];m.push(2);m.push(i.length);return m.concat(i)}function k(m){var i=[];i.push(3);i.push(m.length+1);i.push(0);return i.concat(m)}var h=g([b(this.n),b(new BigInteger(""+this.e,10))]);var a=k(h);var j=g([[6,9,42,134,72,134,247,13,1,1,1],[5,0],]);var l=g([j,a]);var d="";for(var f=0;f<l.length;f++){d+=int2char((l[f]&240)>>4);d+=int2char(l[f]&15)}d=hex2b64(d);var c="";for(var f=0;f<d.length;f++){if(f>0&&(f%64)==0){c+="\n"}c+=d[f]}return"-----BEGIN PUBLIC KEY-----\n"+c+"\n-----END PUBLIC KEY-----\n"}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.serializePrivateASN1=RSAPrivateKeySerializeASN1;RSAKey.prototype.serializePublicASN1=RSAPublicKeySerializeASN1;function _asnhex_getByteLengthOfL_AtObj(b,c){if(b.substring(c+2,c+3)!="8"){return 1}var a=parseInt(b.substring(c+3,c+4));if(a==0){return -1}if(0<a&&a<10){return a+1}return -2}function _asnhex_getHexOfL_AtObj(b,c){var a=_asnhex_getByteLengthOfL_AtObj(b,c);if(a<1){return""}return b.substring(c+2,c+2+a*2)}function _asnhex_getIntOfL_AtObj(c,d){var b=_asnhex_getHexOfL_AtObj(c,d);if(b==""){return -1}var a;if(parseInt(b.substring(0,1))<8){a=parseBigInt(b,16)}else{a=parseBigInt(b.substring(2),16)}return a.intValue()}function _asnhex_getStartPosOfV_AtObj(b,c){var a=_asnhex_getByteLengthOfL_AtObj(b,c);if(a<0){return a}return c+(a+1)*2}function _asnhex_getHexOfV_AtObj(c,d){var b=_asnhex_getStartPosOfV_AtObj(c,d);var a=_asnhex_getIntOfL_AtObj(c,d);return c.substring(b,b+a*2)}function _asnhex_getPosOfNextSibling_AtObj(c,d){var b=_asnhex_getStartPosOfV_AtObj(c,d);var a=_asnhex_getIntOfL_AtObj(c,d);return b+a*2}function _asnhex_getPosArrayOfChildren_AtObj(g,l){var c=new Array();var j=_asnhex_getStartPosOfV_AtObj(g,l);c.push(j);var b=_asnhex_getIntOfL_AtObj(g,l);var i=j;var d=0;while(1){var f=_asnhex_getPosOfNextSibling_AtObj(g,i);if(f==null||(f-j>=(b*2))){break}if(d>=200){break}c.push(f);i=f;d++}return c}function _rsapem_pemToBase64(b){var a=b;a=a.replace("-----BEGIN RSA PRIVATE KEY-----","");a=a.replace("-----END RSA PRIVATE KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapubpem_pemToBase64(b){if(b.indexOf("-----BEGIN PUBLIC KEY-----")!=0){throw"Malformed input to readPublicKeyFromPEMString: input does not start with '-----BEGIN PUBLIC KEY-----'"}var a=b;a=a.replace("-----BEGIN PUBLIC KEY-----","");a=a.replace("-----END PUBLIC KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapem_getPosArrayOfChildrenFromHex(d){var k=new Array();var l=_asnhex_getStartPosOfV_AtObj(d,0);var g=_asnhex_getPosOfNextSibling_AtObj(d,l);var i=_asnhex_getPosOfNextSibling_AtObj(d,g);var b=_asnhex_getPosOfNextSibling_AtObj(d,i);var m=_asnhex_getPosOfNextSibling_AtObj(d,b);var f=_asnhex_getPosOfNextSibling_AtObj(d,m);var h=_asnhex_getPosOfNextSibling_AtObj(d,f);var c=_asnhex_getPosOfNextSibling_AtObj(d,h);var j=_asnhex_getPosOfNextSibling_AtObj(d,c);k.push(l,g,i,b,m,f,h,c,j);return k}function _rsapem_getHexValueArrayOfChildrenFromHex(i){var o=_rsapem_getPosArrayOfChildrenFromHex(i);var r=_asnhex_getHexOfV_AtObj(i,o[0]);var f=_asnhex_getHexOfV_AtObj(i,o[1]);var j=_asnhex_getHexOfV_AtObj(i,o[2]);var k=_asnhex_getHexOfV_AtObj(i,o[3]);var c=_asnhex_getHexOfV_AtObj(i,o[4]);var b=_asnhex_getHexOfV_AtObj(i,o[5]);var h=_asnhex_getHexOfV_AtObj(i,o[6]);var g=_asnhex_getHexOfV_AtObj(i,o[7]);var l=_asnhex_getHexOfV_AtObj(i,o[8]);var m=new Array();m.push(r,f,j,k,c,b,h,g,l);return m}function _rsapem_readPrivateKeyFromPEMString(f){var c=_rsapem_pemToBase64(f);var d=b64tohex(c);var b=_rsapem_getHexValueArrayOfChildrenFromHex(d);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}function _rsapem_readPublicKeyFromPEMString(c){var h=_rsapubpem_pemToBase64(c);var g=b64tohex(h);var b=_asnhex_getPosArrayOfChildren_AtObj(g,0);var f=_asnhex_getHexOfV_AtObj(g,b[0]);var j=_asnhex_getHexOfV_AtObj(g,b[1]);j=j.substring(2,j.length);var i=_asnhex_getPosArrayOfChildren_AtObj(j,0);var a=_asnhex_getHexOfV_AtObj(j,i[0]);var d=_asnhex_getHexOfV_AtObj(j,i[1]);this.setPublic(a,d)}RSAKey.prototype.readPrivateKeyFromPEMString=_rsapem_readPrivateKeyFromPEMString;RSAKey.prototype.readPublicKeyFromPEMString=_rsapem_readPublicKeyFromPEMString;var _RSASIGN_DIHEAD=[];_RSASIGN_DIHEAD.sha1="3021300906052b0e03021a05000414";_RSASIGN_DIHEAD.sha256="3031300d060960864801650304020105000420";var _RSASIGN_HASHHEXFUNC=[];_RSASIGN_HASHHEXFUNC.sha256=function(a){return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(a))};function _rsasign_getHexPaddedDigestInfoForString(n,h,b){var d=h/4;var k=_RSASIGN_HASHHEXFUNC[b];var f=k(n);var a="0001";var l="00"+_RSASIGN_DIHEAD[b]+f;var j="";var m=d-a.length-l.length;for(var g=0;g<m;g+=2){j+="ff"}var c=a+j+l;return c}function _rsasign_signString(g,c){var h=_rsasign_getHexPaddedDigestInfoForString(g,this.n.bitLength(),c);var f=h.length;var b=parseBigInt(h,16);var d=this.doPrivate(b);var a=d.toString(16);while(a.length<f){a="0"+a}return a}function _rsasign_signStringWithSHA1(d){var f=_rsasign_getHexPaddedDigestInfoForString(d,this.n.bitLength(),"sha1");var b=parseBigInt(f,16);var c=this.doPrivate(b);var a=c.toString(16);return a}function _rsasign_signStringWithSHA256(d){var f=_rsasign_getHexPaddedDigestInfoForString(d,this.n.bitLength(),"sha256");var b=parseBigInt(f,16);var c=this.doPrivate(b);var a=c.toString(16);return a}function _rsasign_getDecryptSignatureBI(a,d,c){var b=new RSAKey();b.setPublic(d,c);var f=b.doPublic(a);return f}function _rsasign_getHexDigestInfoFromSig(a,c,b){var f=_rsasign_getDecryptSignatureBI(a,c,b);var d=f.toString(16).replace(/^1f+00/,"");return d}function _rsasign_getAlgNameAndHashFromHexDisgestInfo(g){for(var f in _RSASIGN_DIHEAD){var d=_RSASIGN_DIHEAD[f];var b=d.length;if(g.substring(0,b)==d){var c=[f,g.substring(b)];return c}}return[]}function _rsasign_verifySignatureWithArgs(g,b,h,k){var f=_rsasign_getHexDigestInfoFromSig(b,h,k);var i=_rsasign_getAlgNameAndHashFromHexDisgestInfo(f);if(i.length==0){return false}var d=i[0];var j=i[1];var a=_RSASIGN_HASHHEXFUNC[d];var c=a(g);return(j==c)}function _rsasign_verifyHexSignatureForMessage(c,b){var d=parseBigInt(c,16);var a=_rsasign_verifySignatureWithArgs(b,d,this.n.toString(16),this.e.toString(16));return a}function _rsasign_verifyString(g,k){k=k.replace(/[ \n]+/g,"");var b=parseBigInt(k,16);var j=this.doPublic(b);var f=j.toString(16).replace(/^1f+00/,"");var h=_rsasign_getAlgNameAndHashFromHexDisgestInfo(f);if(h.length==0){return false}var d=h[0];var i=h[1];var a=_RSASIGN_HASHHEXFUNC[d];var c=a(g);return(i==c)}RSAKey.prototype.signString=_rsasign_signString;RSAKey.prototype.signStringWithSHA1=_rsasign_signStringWithSHA1;RSAKey.prototype.signStringWithSHA256=_rsasign_signStringWithSHA256;RSAKey.prototype.verifyString=_rsasign_verifyString;RSAKey.prototype.verifyHexSignatureForMessage=_rsasign_verifyHexSignatureForMessage;function _x509_pemToBase64(a){var b=a;b=b.replace("-----BEGIN CERTIFICATE-----","");b=b.replace("-----END CERTIFICATE-----","");b=b.replace(/[ \n]+/g,"");return b}function _x509_pemToHex(a){var c=_x509_pemToBase64(a);var b=b64tohex(c);return b}function _x509_getHexTbsCertificateFromCert(b){var a=_asnhex_getStartPosOfV_AtObj(b,0);return a}function _x509_getSubjectPublicKeyInfoPosFromCertHex(d){var c=_asnhex_getStartPosOfV_AtObj(d,0);var b=_asnhex_getPosArrayOfChildren_AtObj(d,c);if(b.length<1){return -1}if(d.substring(b[0],b[0]+10)=="a003020102"){if(b.length<6){return -1}return b[6]}else{if(b.length<5){return -1}return b[5]}}function _x509_getSubjectPublicKeyPosFromCertHex(g){var f=_x509_getSubjectPublicKeyInfoPosFromCertHex(g);if(f==-1){return -1}var b=_asnhex_getPosArrayOfChildren_AtObj(g,f);if(b.length!=2){return -1}var d=b[1];if(g.substring(d,d+2)!="03"){return -1}var c=_asnhex_getStartPosOfV_AtObj(g,d);if(g.substring(c,c+2)!="00"){return -1}return c+2}function _x509_getPublicKeyHexArrayFromCertHex(g){var f=_x509_getSubjectPublicKeyPosFromCertHex(g);var b=_asnhex_getPosArrayOfChildren_AtObj(g,f);if(b.length!=2){return[]}var d=_asnhex_getHexOfV_AtObj(g,b[0]);var c=_asnhex_getHexOfV_AtObj(g,b[1]);if(d!=null&&c!=null){return[d,c]}else{return[]}}function _x509_getPublicKeyHexArrayFromCertPEM(c){var d=_x509_pemToHex(c);var b=_x509_getPublicKeyHexArrayFromCertHex(d);return b}function _x509_readCertPEM(c){var f=_x509_pemToHex(c);var b=_x509_getPublicKeyHexArrayFromCertHex(f);var d=new RSAKey();d.setPublic(b[0],b[1]);this.subjectPublicKeyRSA=d;this.subjectPublicKeyRSA_hN=b[0];this.subjectPublicKeyRSA_hE=b[1]}function _x509_readCertPEMWithoutRSAInit(c){var d=_x509_pemToHex(c);var b=_x509_getPublicKeyHexArrayFromCertHex(d);this.subjectPublicKeyRSA.setPublic(b[0],b[1]);this.subjectPublicKeyRSA_hN=b[0];this.subjectPublicKeyRSA_hE=b[1]}function X509(){this.subjectPublicKeyRSA=null;this.subjectPublicKeyRSA_hN=null;this.subjectPublicKeyRSA_hE=null}X509.prototype.readCertPEM=_x509_readCertPEM;X509.prototype.readCertPEMWithoutRSAInit=_x509_readCertPEMWithoutRSAInit;function Arcfour(){this.i=0;this.j=0;this.S=new Array()}function ARC4init(d){var c,a,b;for(c=0;c<256;++c){this.S[c]=c}a=0;for(c=0;c<256;++c){a=(a+this.S[c]+d[c%d.length])&255;b=this.S[c];this.S[c]=this.S[a];this.S[a]=b}this.i=0;this.j=0}function ARC4next(){var a;this.i=(this.i+1)&255;this.j=(this.j+this.S[this.i])&255;a=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=a;return this.S[(a+this.S[this.i])&255]}Arcfour.prototype.init=ARC4init;Arcfour.prototype.next=ARC4next;function prng_newstate(){return new Arcfour()}var rng_psize=256;var rng_state;var rng_pool;var rng_pptr;function rng_seed_int(a){rng_pool[rng_pptr++]^=a&255;rng_pool[rng_pptr++]^=(a>>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t<z.length;++t){rng_pool[rng_pptr++]=z.charCodeAt(t)&255}}while(rng_pptr<rng_psize){t=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=t>>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr){rng_pool[rng_pptr]=0}rng_pptr=0}return rng_state.next()}function rng_get_bytes(b){var a;for(a=0;a<b.length;++a){b[a]=rng_get_byte()}}function SecureRandom(){}SecureRandom.prototype.nextBytes=rng_get_bytes;var jwt={};var JWTInternals=(function(){var v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function r(D){var B="";var C;var y=0;var A;for(C=0;C<D.length;++C){var x=v.indexOf(D.charAt(C));if(x<0){continue}if(y==0){B+=int2char(x>>2);A=x&3;y=1}else{if(y==1){B+=int2char((A<<2)|(x>>4));A=x&15;y=2}else{if(y==2){B+=int2char(A);B+=int2char(x>>2);A=x&3;y=3}else{B+=int2char((A<<2)|(x>>4));B+=int2char(x&15);y=0}}}}if(y==1){B+=int2char(A<<2)}return B}function f(x){return hex2b64(x).split("=")[0].replace(/\+/g,"-").replace(/\//g,"_")}function g(x){var y=window.btoa(x);y=y.split("=")[0];y=y.replace(/\+/g,"-");y=y.replace(/\//g,"_");return y}function m(x){var y=x;y=y.replace(/-/g,"+");y=y.replace(/_/g,"/");switch(y.length%4){case 0:break;case 2:y+="==";break;case 3:y+="=";break;default:throw new p("Illegal base64url string!")}return window.atob(y)}function o(x){this.message=x;this.toString=function(){return"No such algorithm: "+this.message}}function c(x){this.message=x;this.toString=function(){return"Not implemented: "+this.message}}function s(x){this.message=x;this.toString=function(){return"Malformed JSON web token: "+this.message}}function p(x){this.message=x;this.toString=function(){return"Malformed input: "+this.message}}function h(y,x){if(y=="sha256"){this.hash=sjcl.hash.sha256}else{throw new o("HMAC does not support hash "+y)}this.key=sjcl.codec.utf8String.toBits(x)}h.prototype={update:function q(x){this.data=x},finalize:function d(){},sign:function k(){var y=new sjcl.misc.hmac(this.key,this.hash);var x=y.encrypt(this.data);return g(window.atob(sjcl.codec.base64.fromBits(x)))},verify:function i(A){var y=new sjcl.misc.hmac(this.key,this.hash);var x=y.encrypt(this.data);return g(window.atob(sjcl.codec.base64.fromBits(x)))==A}};function a(x,y){if(x=="sha1"){this.hash="sha1"}else{if(x=="sha256"){this.hash="sha256"}else{throw new o("JWT algorithm: "+x)}}this.keyPEM=y}a.prototype={update:function q(x){this.data=x},finalize:function d(){},sign:function k(){var y=new RSAKey();y.readPrivateKeyFromPEMString(this.keyPEM);var x=y.signString(this.data,this.hash);return f(x)},verify:function i(y){var x=this.keyPEM.verifyString(this.data,r(y));return x}};function w(y,x){this.objectStr=y;this.pkAlgorithm=x}var l={parse:function b(x){var A=x.split(".");if(A.length!=3){throw new s("Must have three parts")}var y=new w();y.headerSegment=A[0];y.payloadSegment=A[1];y.cryptoSegment=A[2];y.pkAlgorithm=m(A[0]);return y}};function u(x){if(typeof x=="string"){return JSON.parse(x)}return x}function n(y,x){if("ES256"===y){throw new c("ECDSA-SHA256 not yet implemented")}else{if("ES384"===y){throw new c("ECDSA-SHA384 not yet implemented")}else{if("ES512"===y){throw new c("ECDSA-SHA512 not yet implemented")}else{if("HS256"===y){return new h("sha256",x)}else{if("HS384"===y){throw new c("HMAC-SHA384 not yet implemented")}else{if("HS512"===y){throw new c("HMAC-SHA512 not yet implemented")}else{if("RS256"===y){return new a("sha256",x)}else{if("RS384"===y){throw new c("RSA-SHA384 not yet implemented")}else{if("RS512"===y){throw new c("RSA-SHA512 not yet implemented")}else{throw new o("Unknown algorithm: "+y)}}}}}}}}}}w.prototype={serialize:function j(F){var A=u(this.pkAlgorithm);var E=A.alg;var D=n(E,F);var B=g(this.pkAlgorithm);var G=g(this.objectStr);var C=B+"."+G;D.update(C);var x=D.finalize();var y=D.sign();return B+"."+G+"."+y},verify:function i(y){var B=u(this.pkAlgorithm);var A=B.alg;var x=n(A,y);x.update(this.headerSegment+"."+this.payloadSegment);x.finalize();return x.verify(this.cryptoSegment)}};jwt.WebToken=w;jwt.WebTokenParser=l;jwt.base64urlencode=g;jwt.base64urldecode=m})(); - - function genKeyPair() { - // fake keypairs. they're a random string with pub or priv prepended. - var key = new RSAKey(); - key.generate(512, "10001"); - - // hm. PEM encoding, anyone? - return { - pub: key.serializePublicASN1(), - priv: key.serializePrivateASN1() - }; - } - - function createAssertion(audience, email, privkey, issuer) { - var assertion = { - audience: audience, - email: email, - "valid-until": (new Date()).getTime() + (1000 * 120), // 2 mins from now. - }; - if (issuer) { - assertion.issuer = issuer; - } - - var token = new jwt.WebToken(JSON.stringify(assertion), JSON.stringify({alg:"RS256"})); - var signed = token.serialize(privkey); - return signed; - } - - return { - genKeyPair: genKeyPair, - createAssertion: createAssertion - }; -})(); - diff --git a/browserid/static/dialog/resources/crypto.js b/browserid/static/dialog/resources/crypto.js index 2281a9fd9faa55cfce18990dab8c5dcf3cdfebc5..0144f3b75c42957ddd2d1fb74142e67b67d36c48 100644 --- a/browserid/static/dialog/resources/crypto.js +++ b/browserid/static/dialog/resources/crypto.js @@ -1640,7 +1640,7 @@ function RSAPublicKeySerializeASN1() { var rsaEncSequence = encodeSequence( [ [0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01], - [0x05, 0x00],// NULL + [0x05, 0x00]// NULL ] ); diff --git a/browserid/static/dialog/scripts/build.js b/browserid/static/dialog/scripts/build.js index 339edb602883fff8dd6e50834604e593bebe1fcf..abfabc5ff500a65ecbadaea7fd2eb7a398c715ad 100644 --- a/browserid/static/dialog/scripts/build.js +++ b/browserid/static/dialog/scripts/build.js @@ -1,6 +1,8 @@ //steal/js /web/browserid/browserid/static/dialog/dialog/scripts/compress.js load("steal/rhino/steal.js"); -steal.plugins('steal/build','steal/build/scripts','steal/build/styles',function(){ - steal.build('../static/dialog/scripts/build.html',{to: '../static/dialog/compressed'}); +steal.plugins('steal/build','steal/build/scripts','steal/build/styles',function() { + steal.build('../static/dialog/scripts/build.html',{ + to: '../static/dialog' + }); }); diff --git a/browserid/static/dialog/style.css b/browserid/static/dialog/style.css index 235542a42722d18a1e5e15cf1492ebc77e223b0c..f9e18534eae94e73f82490ff4431e7d4cc812f6a 100644 --- a/browserid/static/dialog/style.css +++ b/browserid/static/dialog/style.css @@ -1,15 +1,9 @@ -@font-face { - font-family: 'Shadows Into Light'; - font-style: normal; - font-weight: normal; - src: local('Shadows Into Light'), local('ShadowsIntoLight'), url('../../css/sil.ttf') format('truetype'); -} @font-face { font-family: 'Tenor Sans'; font-style: normal; font-weight: normal; - src: local('Tenor Sans'), local('TenorSans'), url('../../css/ts.ttf') format('truetype'); + src: local('Tenor Sans'), local('TenorSans'), url('/css/ts.ttf') format('truetype'); } body { @@ -34,24 +28,6 @@ span.sitename, span.email { margin-bottom: 1em; } -#logo { - margin: 0; - padding: 0; - width: 575px; - position: fixed; - left: 30px; - top: 120px; - opacity: .1; - -moz-transform: rotate(-25deg); - -webkit-transform: rotate(-25deg); - transform: rotate(-25deg); - z-index: -5; -} - -#logo > img { - width: 100%; -} - #bottom-bar { margin: 0; padding: 0; @@ -192,7 +168,7 @@ div.input input { border: 1px solid black; width: 240px; height: 2em; - padding: .4em; + padding: 0 .4em 0 .4em; } a { @@ -246,6 +222,10 @@ div.dialog div.attention_lame { font-size: .8em; } +.sprite { + background: url('/i/sprite.png') no-repeat 0 0; +} + #header { position: fixed; padding: 0; @@ -259,18 +239,31 @@ div.dialog div.attention_lame { color: #fff; } -#header .title { - font-size: 1.7em; - font-weight: bold; +#logo { + background-position: 0 -26px;; + color: transparent; + width: 135px; + height: 35px; + margin: 2px 16px 0 16px; float: left; - margin: 4px 16px 0 16px; } -#header .subtitle { - size: 1.2em; - font-family: 'Shadows into light', arial, serif; +#subtitle { + margin: 8px 0 0; + color: transparent; + background-position: 0 0; + width: 146px; + height: 25px; float: left; - margin-top: .6em; +} + +#labs_logo { + position: absolute; + top: 9px; + right: 10px; + background-position: 0 -62px; + width: 97px; + height: 20px; } p.prompt { @@ -279,4 +272,5 @@ p.prompt { p.prompt .sitename { font-size: 1.1em; -} \ No newline at end of file +} + diff --git a/browserid/static/dialog/test_crypto_stubs.htm b/browserid/static/dialog/test_crypto_stubs.htm index 0b7e5615758927976b6c1dcfdcaf394a8285168a..8935b7586fc0b109f0938d34061fb236c3368c44 100644 --- a/browserid/static/dialog/test_crypto_stubs.htm +++ b/browserid/static/dialog/test_crypto_stubs.htm @@ -1,7 +1,7 @@ <script src="prng4.js"></script> <script src="rng.js"></script> <script src="crypto.js"></script> -<script src="crypto-stubs.js"></script> +<script src="crypto-api.js"></script> <script> function runGenKeyPairTest() @@ -23,4 +23,4 @@ function runGenKeyPairTest() <textarea style="font:12pt Courier" rows="12" cols="80" id="private"></textarea> <textarea style="font:12pt Courier" rows="12" cols="80" id="public"></textarea> <br> -<div id="timing"></div> \ No newline at end of file +<div id="timing"></div> diff --git a/browserid/static/dialog/views/body.ejs b/browserid/static/dialog/views/body.ejs index 4dc68a53c39d148e3d655f44caa3bf3b1a87407f..b2952fe21134287a155a77a177fe39fa730d00bb 100644 --- a/browserid/static/dialog/views/body.ejs +++ b/browserid/static/dialog/views/body.ejs @@ -1,6 +1,10 @@ -<div id="header"> - <div class="title"><img src="/i/browserid_logo_lil.png"></div><div class="subtitle">A better way to sign in.</div> -</div> +<header id="header"> + <hgroup> + <h1 id="logo" class="sprite">BrowserID</h1> + <h2 id="subtitle" class="sprite">A better way to sign in.</h2> + </hgroup> + <div id="labs_logo" class="sprite"></div> +</header> <div id="dialog" class="dialog"> </div> @@ -8,7 +12,7 @@ <div id="bottom-bar"> </div> -<div id="terms"> -BrowserID is a <a target="_blank" href="http://mozillalabs.org">Mozilla Labs</a> service. -See our <a target="_blank" href="https://browserid.org/tos">terms</a> and <a target="_blank" href="https://browserid.org/privacy">privacy policy</a>, or <a target="_blank" href="https://browserid.org/users">learn more</a>. -</div> \ No newline at end of file +<footer id="terms"> + BrowserID is a <a target="_blank" href="http://mozillalabs.org">Mozilla Labs</a> service. + See our <a target="_blank" href="https://browserid.org/tos">terms</a> and <a target="_blank" href="https://browserid.org/privacy">privacy policy</a>, or <a target="_blank" href="https://browserid.org/users">learn more</a>. +</footer> diff --git a/browserid/static/i/a_better_way.png b/browserid/static/i/a_better_way.png new file mode 100644 index 0000000000000000000000000000000000000000..650db6a8b64b1f06a0fde18dabeb98780f017afe Binary files /dev/null and b/browserid/static/i/a_better_way.png differ diff --git a/browserid/static/i/browserid_logo_lil.png b/browserid/static/i/browserid_logo_lil.png index 9a42adc79f2bcb78c88136da7d09b0a99bdf6022..7a5c42bf7cd897f1745948a82214265e6fbae364 100644 Binary files a/browserid/static/i/browserid_logo_lil.png and b/browserid/static/i/browserid_logo_lil.png differ diff --git a/browserid/static/i/labs-logo-small.png b/browserid/static/i/labs-logo-small.png new file mode 100644 index 0000000000000000000000000000000000000000..5f0cb6bdc636f09e34f42b83555a2008fd419b7c Binary files /dev/null and b/browserid/static/i/labs-logo-small.png differ diff --git a/browserid/static/i/sprite.png b/browserid/static/i/sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..2a2f7c199db56bf45dd48efa1fa520975580fd71 Binary files /dev/null and b/browserid/static/i/sprite.png differ diff --git a/browserid/static/steal/build/scripts/scripts.js b/browserid/static/steal/build/scripts/scripts.js index 42dbbf74c453e5a2678cab46d93f213d0e8bfdc2..338b4eceade1369c1dcd72023ff36c56d730a9eb 100644 --- a/browserid/static/steal/build/scripts/scripts.js +++ b/browserid/static/steal/build/scripts/scripts.js @@ -150,6 +150,10 @@ steal(function( steal ) { return outBaos.toString(); }; - } + }, + concatOnly: function() { + steal.print("steal.compress - Not compressing resources, only concatenating"); + return function( src ) { return src; } + } }; }); \ No newline at end of file diff --git a/browserid/views/dialog.ejs b/browserid/views/dialog.ejs new file mode 100644 index 0000000000000000000000000000000000000000..a2c41b7b3d434ee2dd1a6eec20272d5cb9509ff5 --- /dev/null +++ b/browserid/views/dialog.ejs @@ -0,0 +1,18 @@ +<!doctype html> +<html> +<head> + <head> + <title>Browser ID</title> + <script type='text/javascript' src='steal/steal<%= production ? ".production" : "" %>.js?dialog'></script> + <!--[if lt IE 9]> + <script src="/dialog/html5shim.js"></script> + <![endif]--> + <script> + $(function() { + $('body').dialog().show(); + }); + </script> + </head> + <body> + </body> +</html> diff --git a/run.js b/run.js index ba23c8c899cc9f1180f9d7782f8aaecacb915a81..187b1f1cfc09eb6474add9bd587ff734da499e00 100755 --- a/run.js +++ b/run.js @@ -190,6 +190,8 @@ dirs.forEach(function(dirObj) { try { runJSExists = fs.statSync(handlerPath).isFile() } catch(e) {}; if (runJSExists) { var runJS = require(handlerPath); + // set to development mode + runJS.production = false; } } catch(e) { console.log("Error loading " + handlerPath + ": " + e);