140 lines
304 KiB
JavaScript
140 lines
304 KiB
JavaScript
/** vim: et:ts=4:sw=4:sts=4
|
||
* @license RequireJS 2.1.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||
* Available via the MIT or new BSD license.
|
||
* see: http://github.com/jrburke/requirejs for details
|
||
*/
|
||
|
||
/*!
|
||
* jQuery JavaScript Library v1.8.2
|
||
* http://jquery.com/
|
||
*
|
||
* Includes Sizzle.js
|
||
* http://sizzlejs.com/
|
||
*
|
||
* Copyright 2012 jQuery Foundation and other contributors
|
||
* Released under the MIT license
|
||
* http://jquery.org/license
|
||
*
|
||
* Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time)
|
||
*/
|
||
|
||
/*!
|
||
* Sizzle CSS Selector Engine
|
||
* Copyright 2012 jQuery Foundation and other contributors
|
||
* Released under the MIT license
|
||
* http://sizzlejs.com/
|
||
*/
|
||
|
||
/*
|
||
jed.js
|
||
v0.5.0beta
|
||
|
||
https://github.com/SlexAxton/Jed
|
||
-----------
|
||
A gettext compatible i18n library for modern JavaScript Applications
|
||
|
||
by Alex Sexton - AlexSexton [at] gmail - @SlexAxton
|
||
WTFPL license for use
|
||
Dojo CLA for contributions
|
||
|
||
Jed offers the entire applicable GNU gettext spec'd set of
|
||
functions, but also offers some nicer wrappers around them.
|
||
The api for gettext was written for a language with no function
|
||
overloading, so Jed allows a little more of that.
|
||
|
||
Many thanks to Joshua I. Miller - unrtst@cpan.org - who wrote
|
||
gettext.js back in 2008. I was able to vet a lot of my ideas
|
||
against his. I also made sure Jed passed against his tests
|
||
in order to offer easy upgrades -- jsgettext.berlios.de
|
||
*/
|
||
|
||
// Underscore 1.3.0 was used to port and is licensed
|
||
|
||
/**
|
||
sprintf() for JavaScript 0.7-beta1
|
||
http://www.diveintojavascript.com/projects/javascript-sprintf
|
||
|
||
Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
|
||
All rights reserved.
|
||
|
||
Redistribution and use in source and binary forms, with or without
|
||
modification, are permitted provided that the following conditions are met:
|
||
* Redistributions of source code must retain the above copyright
|
||
notice, this list of conditions and the following disclaimer.
|
||
* Redistributions in binary form must reproduce the above copyright
|
||
notice, this list of conditions and the following disclaimer in the
|
||
documentation and/or other materials provided with the distribution.
|
||
* Neither the name of sprintf() for JavaScript nor the
|
||
names of its contributors may be used to endorse or promote products
|
||
derived from this software without specific prior written permission.
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||
DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
|
||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
|
||
// Underscore.js 1.4.4
|
||
// http://underscorejs.org
|
||
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
|
||
// Underscore may be freely distributed under the MIT license.
|
||
|
||
// (c) 2010-2013 Jeremy Ashkenas, DocumentCloud Inc.
|
||
// Backbone may be freely distributed under the MIT license.
|
||
// For all details and documentation:
|
||
// http://backbonejs.org
|
||
|
||
/*! TinySort 1.4.29
|
||
* Copyright (c) 2008-2012 Ron Valstar http://www.sjeiti.com/
|
||
*
|
||
* Dual licensed under the MIT and GPL licenses:
|
||
* http://www.opensource.org/licenses/mit-license.php
|
||
* http://www.gnu.org/licenses/gpl.html
|
||
*/
|
||
|
||
/*! Array.prototype.indexOf for IE (issue #26) */
|
||
|
||
/*
|
||
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
|
||
* in FIPS PUB 180-1
|
||
* Version 2.1a Copyright Paul Johnston 2000 - 2002.
|
||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||
* Distributed under the BSD License
|
||
* See http://pajhome.org.uk/crypt/md5 for details.
|
||
*/
|
||
|
||
/*
|
||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||
* Digest Algorithm, as defined in RFC 1321.
|
||
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
|
||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||
* Distributed under the BSD License
|
||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||
*/
|
||
|
||
/*
|
||
This program is distributed under the terms of the MIT license.
|
||
Please see the LICENSE file for details.
|
||
|
||
Copyright 2006-2008, OGG, LLC
|
||
*/
|
||
|
||
/*
|
||
Copyright 2010, François de Metz <francois@2metz.fr>
|
||
*/
|
||
|
||
/*!
|
||
* Converse.js (Web-based XMPP instant messaging client)
|
||
* http://conversejs.org
|
||
*
|
||
* Copyright (c) 2012, Jan-Carel Brand <jc@opkode.com>
|
||
* Dual licensed under the MIT and GPL Licenses
|
||
*/
|
||
|
||
function hex_sha1(e){return binb2hex(core_sha1(str2binb(e),e.length*chrsz))}function b64_sha1(e){return binb2b64(core_sha1(str2binb(e),e.length*chrsz))}function str_sha1(e){return binb2str(core_sha1(str2binb(e),e.length*chrsz))}function hex_hmac_sha1(e,t){return binb2hex(core_hmac_sha1(e,t))}function b64_hmac_sha1(e,t){return binb2b64(core_hmac_sha1(e,t))}function str_hmac_sha1(e,t){return binb2str(core_hmac_sha1(e,t))}function sha1_vm_test(){return hex_sha1("abc")=="a9993e364706816aba3e25717850c26c9cd0d89d"}function core_sha1(e,t){e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;var n=new Array(80),r=1732584193,i=-271733879,s=-1732584194,o=271733878,u=-1009589776,a,f,l,c,h,p,d,v;for(a=0;a<e.length;a+=16){c=r,h=i,p=s,d=o,v=u;for(f=0;f<80;f++)f<16?n[f]=e[a+f]:n[f]=rol(n[f-3]^n[f-8]^n[f-14]^n[f-16],1),l=safe_add(safe_add(rol(r,5),sha1_ft(f,i,s,o)),safe_add(safe_add(u,n[f]),sha1_kt(f))),u=o,o=s,s=rol(i,30),i=r,r=l;r=safe_add(r,c),i=safe_add(i,h),s=safe_add(s,p),o=safe_add(o,d),u=safe_add(u,v)}return[r,i,s,o,u]}function sha1_ft(e,t,n,r){return e<20?t&n|~t&r:e<40?t^n^r:e<60?t&n|t&r|n&r:t^n^r}function sha1_kt(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function core_hmac_sha1(e,t){var n=str2binb(e);n.length>16&&(n=core_sha1(n,e.length*chrsz));var r=new Array(16),i=new Array(16);for(var s=0;s<16;s++)r[s]=n[s]^909522486,i[s]=n[s]^1549556828;var o=core_sha1(r.concat(str2binb(t)),512+t.length*chrsz);return core_sha1(i.concat(o),672)}function safe_add(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function rol(e,t){return e<<t|e>>>32-t}function str2binb(e){var t=[],n=(1<<chrsz)-1;for(var r=0;r<e.length*chrsz;r+=chrsz)t[r>>5]|=(e.charCodeAt(r/chrsz)&n)<<32-chrsz-r%32;return t}function binb2str(e){var t="",n=(1<<chrsz)-1;for(var r=0;r<e.length*32;r+=chrsz)t+=String.fromCharCode(e[r>>5]>>>32-chrsz-r%32&n);return t}function binb2hex(e){var t=hexcase?"0123456789ABCDEF":"0123456789abcdef",n="";for(var r=0;r<e.length*4;r++)n+=t.charAt(e[r>>2]>>(3-r%4)*8+4&15)+t.charAt(e[r>>2]>>(3-r%4)*8&15);return n}function binb2b64(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",r,i;for(var s=0;s<e.length*4;s+=3){r=(e[s>>2]>>8*(3-s%4)&255)<<16|(e[s+1>>2]>>8*(3-(s+1)%4)&255)<<8|e[s+2>>2]>>8*(3-(s+2)%4)&255;for(i=0;i<4;i++)s*8+i*6>e.length*32?n+=b64pad:n+=t.charAt(r>>6*(3-i)&63)}return n}var requirejs,require,define;(function(global){function isFunction(e){return ostring.call(e)==="[object Function]"}function isArray(e){return ostring.call(e)==="[object Array]"}function each(e,t){if(e){var n;for(n=0;n<e.length;n+=1)if(e[n]&&t(e[n],n,e))break}}function eachReverse(e,t){if(e){var n;for(n=e.length-1;n>-1;n-=1)if(e[n]&&t(e[n],n,e))break}}function hasProp(e,t){return hasOwn.call(e,t)}function eachProp(e,t){var n;for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n))break}function mixin(e,t,n,r){return t&&eachProp(t,function(t,i){if(n||!hasProp(e,i))r&&typeof t!="string"?(e[i]||(e[i]={}),mixin(e[i],t,n,r)):e[i]=t}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,r){var i=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=r,n&&(i.originalError=n),i}function newContext(e){function d(e){var t,n;for(t=0;e[t];t+=1){n=e[t];if(n===".")e.splice(t,1),t-=1;else if(n===".."){if(t===1&&(e[2]===".."||e[0]===".."))break;t>0&&(e.splice(t-1,2),t-=2)}}}function v(e,t,n){var r,i,s,u,a,f,l,c,h,p,v,m=t&&t.split("/"),g=m,y=o.map,b=y&&y["*"];e&&e.charAt(0)==="."&&(t?(o.pkgs[t]?g=m=[t]:g=m.slice(0,m.length-1),e=g.concat(e.split("/")),d(e),i=o.pkgs[r=e[0]],e=e.join("/"),i&&e===r+"/"+i.main&&(e=r)):e.indexOf("./")===0&&(e=e.substring(2)));if(n&&(m||b)&&y){u=e.split("/");for(a=u.length;a>0;a-=1){l=u.slice(0,a).join("/");if(m)for(f=m.length;f>0;f-=1){s=y[m.slice(0,f).join("/")];if(s){s=s[l];if(s){c=s,h=a;break}}}if(c)break;!p&&b&&b[l]&&(p=b[l],v=a)}!c&&p&&(c=p,h=v),c&&(u.splice(0,h,c),e=u.join("/"))}return e}function m(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===r.contextName)return t.parentNode.removeChild(t),!0})}function g(e){var t=o.paths[e];if(t&&isArray(t)&&t.length>1)return m(e),t.shift(),r.require.undef(e),r.require([e]),!0}function y(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function b(e,t,n,i){var s,o,u,a,f=null,c=t?t.name:null,d=e,m=!0,g="";return e||(m=!1,e="_@r"+(h+=1)),a=y(e),f=a[0],e=a[1],f&&(f=v(f,c,i),o=l[f]),e&&(f?o&&o.normalize?g=o.normalize(e,function(e){return v(e,c,i)}):g=v(e,c,i):(g=v(e,c,i),a=y(g),f=a[0],g=a[1],n=!0,s=r.nameToUrl(g))),u=f&&!o&&!n?"_unnormalized"+(p+=1):"",{prefix:f,name:g,parentMap:t,unnormalized:!!u,url:s,originalName:d,isDefine:m,id:(f?f+"!"+g:g)+u}}function w(e){var t=e.id,n=u[t];return n||(n=u[t]=new r.Module(e)),n}function E(e,t,n){var r=e.id,i=u[r];hasProp(l,r)&&(!i||i.defineEmitComplete)?t==="defined"&&n(l[r]):w(e).on(t,n)}function S(e,t){var n=e.requireModules,r=!1;t?t(e):(each(n,function(t){var n=u[t];n&&(n.error=e,n.events.error&&(r=!0,n.emit("error",e)))}),r||req.onError(e))}function x(){globalDefQueue.length&&(apsp.apply(f,[f.length-1,0].concat(globalDefQueue)),globalDefQueue=[])}function T(e){delete u[e]}function N(e,t,n){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,i){var s=r.id,o=u[s];o&&!e.depMatched[i]&&!n[s]&&(t[s]?(e.defineDep(i,l[s]),e.check()):N(o,t,n))}),n[r]=!0)}function C(){var e,n,i,a,f=o.waitSeconds*1e3,l=f&&r.startTime+f<(new Date).getTime(),c=[],h=[],p=!1,d=!0;if(t)return;t=!0,eachProp(u,function(t){e=t.map,n=e.id;if(!t.enabled)return;e.isDefine||h.push(t);if(!t.error)if(!t.inited&&l)g(n)?(a=!0,p=!0):(c.push(n),m(n));else if(!t.inited&&t.fetched&&e.isDefine){p=!0;if(!e.prefix)return d=!1}});if(l&&c.length)return i=makeError("timeout","Load timeout for modules: "+c,null,c),i.contextName=r.contextName,S(i);d&&each(h,function(e){N(e,{},{})}),(!l||a)&&p&&(isBrowser||isWebWorker)&&!s&&(s=setTimeout(function(){s=0,C()},50)),t=!1}function k(e){w(b(e[0],null,!0)).init(e[1],e[2])}function L(e,t,n,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(n,t,!1)}function A(e){var t=e.currentTarget||e.srcElement;return L(t,r.onScriptLoad,"load","onreadystatechange"),L(t,r.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function O(){var e;x();while(f.length){e=f.shift();if(e[0]===null)return S(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));k(e)}}var t,n,r,i,s,o={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},map:{},config:{}},u={},a={},f=[],l={},c={},h=1,p=1;return i={require:function(e){return e.require?e.require:e.require=r.makeRequire(e.map)},exports:function(e){e.usingExports=!0;if(e.map.isDefine)return e.exports?e.exports:e.exports=l[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return o.config&&o.config[e.map.id]||{}},exports:l[e.map.id]}}},n=function(e){this.events=a[e.id]||{},this.map=e,this.shim=o.shim[e.id],this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},n.prototype={init:function(e,t,n,r){r=r||{};if(this.inited)return;this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check()},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(this.fetched)return;this.fetched=!0,r.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();r.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))},load:function(){var e=this.map.url;c[e]||(c[e]=!0,r.load(this.map.id,e))},check:function(){if(!this.enabled||this.enabling)return;var e,t,n=this.map.id,i=this.depExports,s=this.exports,o=this.factory;if(!this.inited)this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error)try{s=r.execCb(n,o,i,s)}catch(a){e=a}else s=r.execCb(n,o,i,s);this.map.isDefine&&(t=this.module,t&&t.exports!==undefined&&t.exports!==this.exports?s=t.exports:s===undefined&&this.usingExports&&(s=this.exports));if(e)return e.requireMap=this.map,e.requireModules=[this.map.id],e.requireType="define",S(this.error=e)}else s=o;this.exports=s,this.map.isDefine&&!this.ignore&&(l[n]=s,req.onResourceLoad&&req.onResourceLoad(r,this.map,this.depMaps)),delete u[n],this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}},callPlugin:function(){var e=this.map,t=e.id,n=b(e.prefix);this.depMaps.push(n),E(n,"defined",bind(this,function(n){var i,s,a,f=this.map.name,l=this.map.parentMap?this.map.parentMap.name:null,c=r.makeRequire(e.parentMap,{enableBuildCallback:!0,skipMap:!0});if(this.map.unnormalized){n.normalize&&(f=n.normalize(f,function(e){return v(e,l,!0)})||""),s=b(e.prefix+"!"+f,this.map.parentMap),E(s,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),a=u[s.id],a&&(this.depMaps.push(s),this.events.error&&a.on("error",bind(this,function(e){this.emit("error",e)})),a.enable());return}i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(u,function(e){e.map.id.indexOf(t+"_unnormalized")===0&&T(e.map.id)}),S(e)}),i.fromText=bind(this,function(t,n){var s=e.name,o=b(s),u=useInteractive;n&&(t=n),u&&(useInteractive=!1),w(o);try{req.exec(t)}catch(a){throw new Error("fromText eval for "+s+" failed: "+a)}u&&(useInteractive=!0),this.depMaps.push(o),r.completeLoad(s),c([s],i)}),n.load(e.name,c,i,o)})),r.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,s,o;if(typeof e=="string"){e=b(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=i[e.id];if(o){this.depExports[t]=o(this);return}this.depCount+=1,E(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&E(e,"error",this.errback)}n=e.id,s=u[n],!i[n]&&s&&!s.enabled&&r.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=u[e.id];t&&!t.enabled&&r.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),e==="error"&&delete this.events[e]}},r={config:o,contextName:e,registry:u,defined:l,urlFetched:c,defQueue:f,Module:n,makeModuleMap:b,nextTick:req.nextTick,configure:function(e){e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/");var t=o.pkgs,n=o.shim,i={paths:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?t==="map"?mixin(o[t],e,!0,!0):mixin(o[t],e,!0):o[t]=e}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),e.exports&&!e.exportsFn&&(e.exportsFn=r.makeShimExports(e)),n[t]=e}),o.shim=n),e.packages&&(each(e.packages,function(e){var n;e=typeof e=="string"?{name:e}:e,n=e.location,t[e.name]={name:e.name,location:n||e.name,main:(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}}),o.pkgs=t),eachProp(u,function(e,t){!e.inited&&!e.map.unnormalized&&(e.map=b(t))}),(e.deps||e.callback)&&r.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||getGlobal(e.exports)}return t},makeRequire:function(t,n){function s(o,a,f){var c,h,p;return n.enableBuildCallback&&a&&isFunction(a)&&(a.__requireJsBuild=!0),typeof o=="string"?isFunction(a)?S(makeError("requireargs","Invalid require call"),f):t&&i[o]?i[o](u[t.id]):req.get?req.get(r,o,t):(h=b(o,t,!1,!0),c=h.id,hasProp(l,c)?l[c]:S(makeError("notloaded",'Module name "'+c+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(O(),r.nextTick(function(){O(),p=w(b(null,t)),p.skipMap=n.skipMap,p.init(o,a,f,{enabled:!0}),C()}),s)}return n=n||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n=e.lastIndexOf("."),i=null;return n!==-1&&(i=e.substring(n,e.length),e=e.substring(0,n)),r.nameToUrl(v(e,t&&t.id,!0),i)},defined:function(e){return hasProp(l,b(e,t,!1,!0).id)},specified:function(e){return e=b(e,t,!1,!0).id,hasProp(l,e)||hasProp(u,e)}}),t||(s.undef=function(e){x();var n=b(e,t,!0),r=u[e];delete l[e],delete c[n.url],delete a[e],r&&(r.events.defined&&(a[e]=r.events),T(e))}),s},enable:function(e,t){var n=u[e.id];n&&w(e).enable()},completeLoad:function(e){var t,n,r,i=o.shim[e]||{},s=i.exports;x();while(f.length){n=f.shift();if(n[0]===null){n[0]=e;if(t)break;t=!0}else n[0]===e&&(t=!0);k(n)}r=u[e];if(!t&&!l[e]&&r&&!r.inited){if(o.enforceDefine&&(!s||!getGlobal(s))){if(g(e))return;return S(makeError("nodefine","No define call for "+e,null,[e]))}k([e,i.deps||[],i.exportsFn])}C()},nameToUrl:function(e,t){var n,r,i,s,u,a,f,l,c;if(req.jsExtRegExp.test(e))l=e+(t||"");else{n=o.paths,r=o.pkgs,u=e.split("/");for(a=u.length;a>0;a-=1){f=u.slice(0,a).join("/"),i=r[f],c=n[f];if(c){isArray(c)&&(c=c[0]),u.splice(0,a,c);break}if(i){e===i.name?s=i.location+"/"+i.main:s=i.location,u.splice(0,a,s);break}}l=u.join("/"),l+=t||(/\?/.test(l)?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\w\+\.\-]+:/)?"":o.baseUrl)+l}return o.urlArgs?l+((l.indexOf("?")===-1?"?":"&")+o.urlArgs):l},load:function(e,t){req.load(r,e,t)},execCb:function(e,t,n,r){return t.apply(r,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=A(e);r.completeLoad(t.id)}},onScriptError:function(e){var t=A(e);if(!g(t.id))return S(makeError("scripterror","Script error",e,[t.id]))}},r.require=r.makeRequire(),r}function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"?interactiveScript:(eachReverse(scripts(),function(e){if(e.readyState==="interactive")return interactiveScript=e}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.1",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,aps=ap.slice,apsp=ap.splice,isBrowser=typeof window!="undefined"&&!!navigator&&!!document,isWebWorker=!isBrowser&&typeof importScripts!="undefined",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera!="undefined"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(typeof define!="undefined")return;if(typeof requirejs!="undefined"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=undefined}typeof require!="undefined"&&!isFunction(require)&&(cfg=require,require=undefined),req=requirejs=function(e,t,n,r){var i,s,o=defContextName;return!isArray(e)&&typeof e!="string"&&(s=e,isArray(t)?(e=t,t=n,n=r):e=[]),s&&s.context&&(o=s.context),i=contexts[o],i||(i=contexts[o]=req.s.newContext(o)),s&&i.configure(s),i.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick=typeof setTimeout!="undefined"?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=function(e){throw e},req.load=function(e,t,n){var r=e&&e.config||{},i;if(isBrowser)return i=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),i.type=r.scriptType||"text/javascript",i.charset="utf-8",i.async=!0,i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),i.attachEvent&&!(i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)):(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)),i.src=n,currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;isWebWorker&&(importScripts(n),e.completeLoad(t))},isBrowser&&eachReverse(scripts(),function(e){head||(head=e.parentNode),dataMain=e.getAttribute("data-main");if(dataMain)return cfg.baseUrl||(src=dataMain.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath,dataMain=mainScript),dataMain=dataMain.replace(jsSuffixRegExp,""),cfg.deps=cfg.deps?cfg.deps.concat(dataMain):[dataMain],!0}),define=function(e,t,n){var r,i;typeof e!="string"&&(n=t,t=e,e=null),isArray(t)||(n=t,t=[]),!t.length&&isFunction(n)&&n.length&&(n.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(n.length===1?["require"]:["require","exports","module"]).concat(t)),useInteractive&&(r=currentlyAddingScript||getInteractiveScript(),r&&(e||(e=r.getAttribute("data-requiremodule")),i=contexts[r.getAttribute("data-requirecontext")])),(i?i.defQueue:globalDefQueue).push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this),function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=1-(n/f.duration||0),i=0,s=f.tweens.length;for(;i<s;i++)f.tweens[i].run(r);return u.notifyWith(e,[f,r,n]),r<1&&s?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c=this,h=e.style,p={},d=[],m=e.nodeType&&Gt(e);n.queue||(f=v._queueHooks(e,"fx"),f.unqueued==null&&(f.unqueued=0,l=f.empty.fire,f.empty.fire=function(){f.unqueued||l()}),f.unqueued++,c.always(function(){c.always(function(){f.unqueued--,v.queue(e,"fx").length||f.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?h.display="inline-block":h.zoom=1)),n.overflow&&(h.overflow="hidden",v.support.shrinkWrapBlocks||c.done(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r];if(s===(m?"hide":"show"))continue;d.push(r)}}o=d.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),m?v(e).show():c.done(function(){v(e).hide()}),c.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in p)v.style(e,t,p[t])});for(r=0;r<o;r++)i=d[r],a=c.createTween(i,m?u[i]:0),p[i]=u[i]||v.style(e,i),i in u||(u[i]=a.start,m&&(a.end=a.start,a.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call(" ")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"&&(!e.unique||!c.has(n))?a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0],r.style.cssText="top:1px;float:left;opacity:.5";if(!n||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,s=e.selectedIndex,o=[],u=e.options,a=e.type==="select-one";if(s<0)return null;n=a?s:0,r=a?s+1:u.length;for(;n<r;n++){i=u[n];if(i.selected&&(v.support.optDisabled?!i.disabled:i.getAttribute("disabled")===null)&&(!i.parentNode.disabled||!v.nodeName(i.parentNode,"optgroup"))){t=v(i).val();if(a)return t;o.push(t)}}return a&&!o.length&&u.length?v(u[s]).val():o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.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 contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r,g,!0)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){if(s&&i)return;var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[],s),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){c=lt(g,p),r(c,[],u,a),f=c.length;while(f--)if(l=c[f])g[p[f]]=!(m[p[f]]=l)}if(s){f=e&&g.length;while(f--)if(l=g[f])s[h[f]]=!(o[h[f]]=l)}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n,r){var i=0,s=t.length;for(;i<s;i++)nt(e,t[i],n,r);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e];return t||(t=k(e,new RegExp("(^|"+O+")"+e+"("+O+"|$)"))),function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")}},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&(!!e.type||!!e.href)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(e,t,n){return[0]}),last:st(function(e,t,n){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t,n){for(var r=0;r<t;r+=2)e.push(r);return e}),odd:st(function(e,t,n){for(var r=1;r<t;r+=2)e.push(r);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=1;l=h,e.sort(f);if(l)for(;t=e[n];n++)t===e[n-1]&&e.splice(n--,1);return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active",":focus"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&(!i||!i.test(e))){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&(!i||!i.test(n)))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={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,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase())||!1,c.crossDomain=a&&a.join(":")+(a[3]?"":a[1]==="http:"?80:443)!==ln.join(":")+(ln[3]?"":ln[1]==="http:"?80:443)),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(e){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,t=v.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||v.fx.stop()},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})}(window),function(e,t){function l(e){return f.PF.compile(e||"nplurals=2; plural=(n != 1);")}function c(e,t){this._key=e,this._i18n=t}var n=Array.prototype,r=Object.prototype,i=n.slice,s=r.hasOwnProperty,o=n.forEach,u={},a={forEach:function(e,t,n){var r,i,a;if(e===null)return;if(o&&e.forEach===o)e.forEach(t,n);else if(e.length===+e.length){for(r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r,e)===u)return}else for(a in e)if(s.call(e,a)&&t.call(n,e[a],a,e)===u)return},extend:function(e){return this.forEach(i.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e}},f=function(e){this.defaults={locale_data:{messages:{"":{domain:"messages",lang:"en",plural_forms:"nplurals=2; plural=(n != 1);"}}},domain:"messages"},this.options=a.extend({},this.defaults,e),this.textdomain(this.options.domain);if(e.domain&&!this.options.locale_data[this.options.domain])throw new Error("Text domain set to non-existent domain: `"+e.domain+"`")};f.context_delimiter=String.fromCharCode(4),a.extend(c.prototype,{onDomain:function(e){return this._domain=e,this},withContext:function(e){return this._context=e,this},ifPlural:function(e,t){return this._val=e,this._pkey=t,this},fetch:function(e){return{}.toString.call(e)!="[object Array]"&&(e=[].slice.call(arguments)),(e&&e.length?f.sprintf:function(e){return e})(this._i18n.dcnpgettext(this._domain,this._context,this._key,this._pkey,this._val),e)}}),a.extend(f.prototype,{translate:function(e){return new c(e,this)},textdomain:function(e){if(!e)return this._textdomain;this._textdomain=e},gettext:function(e){return this.dcnpgettext.call(this,t,t,e)},dgettext:function(e,n){return this.dcnpgettext.call(this,e,t,n)},dcgettext:function(e,n){return this.dcnpgettext.call(this,e,t,n)},ngettext:function(e,n,r){return this.dcnpgettext.call(this,t,t,e,n,r)},dngettext:function(e,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},dcngettext:function(e,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},pgettext:function(e,n){return this.dcnpgettext.call(this,t,e,n)},dpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},dcpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},npgettext:function(e,n,r,i){return this.dcnpgettext.call(this,t,e,n,r,i)},dnpgettext:function(e,t,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},dcnpgettext:function(e,t,n,r,i){r=r||n,e=e||this._textdomain,i=typeof i=="undefined"?1:i;var s;if(!this.options)return s=new f,s.dcnpgettext.call(s,undefined,undefined,n,r,i);if(!this.options.locale_data)throw new Error("No locale data provided.");if(!this.options.locale_data[e])throw new Error("Domain `"+e+"` was not found.");if(!this.options.locale_data[e][""])throw new Error("No locale meta information provided.");if(!n)throw new Error("No translation key found.");if(typeof i!="number"){i=parseInt(i,10);if(isNaN(i))throw new Error("The number that was passed in is not a number.")}var o=t?t+f.context_delimiter+n:n,u=this.options.locale_data,a=u[e],c=a[""].plural_forms||(u.messages||this.defaults.locale_data.messages)[""].plural_forms,h=l(c)(i)+1,p,d;if(!a)throw new Error("No domain named `"+e+"` could be found.");return p=a[o],!p||h>=p.length?(this.options.missing_key_callback&&this.options.missing_key_callback(o),d=[null,n,r],d[l(c)(i)+1]):(d=p[h],d?d:(d=[null,n,r],d[l(c)(i)+1]))}});var h=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function t(e,t){for(var n=[];t>0;n[--t]=e);return n.join("")}var n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.format=function(n,r){var i=1,s=n.length,o="",u,a=[],f,l,c,p,d,v;for(f=0;f<s;f++){o=e(n[f]);if(o==="string")a.push(n[f]);else if(o==="array"){c=n[f];if(c[2]){u=r[i];for(l=0;l<c[2].length;l++){if(!u.hasOwnProperty(c[2][l]))throw h('[sprintf] property "%s" does not exist',c[2][l]);u=u[c[2][l]]}}else c[1]?u=r[c[1]]:u=r[i++];if(/[^s]/.test(c[8])&&e(u)!="number")throw h("[sprintf] expecting number but found %s",e(u));if(typeof u=="undefined"||u===null)u="";switch(c[8]){case"b":u=u.toString(2);break;case"c":u=String.fromCharCode(u);break;case"d":u=parseInt(u,10);break;case"e":u=c[7]?u.toExponential(c[7]):u.toExponential();break;case"f":u=c[7]?parseFloat(u).toFixed(c[7]):parseFloat(u);break;case"o":u=u.toString(8);break;case"s":u=(u=String(u))&&c[7]?u.substring(0,c[7]):u;break;case"u":u=Math.abs(u);break;case"x":u=u.toString(16);break;case"X":u=u.toString(16).toUpperCase()}u=/[def]/.test(c[8])&&c[3]&&u>=0?"+"+u:u,d=c[4]?c[4]=="0"?"0":c[4].charAt(1):" ",v=c[6]-String(u).length,p=c[6]?t(d,v):"",a.push(c[5]?u+p:p+u)}}return a.join("")},n.cache={},n.parse=function(e){var t=e,n=[],r=[],i=0;while(t){if((n=/^[^\x25]+/.exec(t))!==null)r.push(n[0]);else if((n=/^\x25{2}/.exec(t))!==null)r.push("%");else{if((n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t))===null)throw"[sprintf] huh?";if(n[2]){i|=1;var s=[],o=n[2],u=[];if((u=/^([a-z_][a-z_\d]*)/i.exec(o))===null)throw"[sprintf] huh?";s.push(u[1]);while((o=o.substring(u[0].length))!=="")if((u=/^\.([a-z_][a-z_\d]*)/i.exec(o))!==null)s.push(u[1]);else{if((u=/^\[(\d+)\]/.exec(o))===null)throw"[sprintf] huh?";s.push(u[1])}n[2]=s}else i|=2;if(i===3)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";r.push(n)}t=t.substring(n[0].length)}return r},n}(),p=function(e,t){return t.unshift(e),h.apply(null,t)};f.parse_plural=function(e,t){return e=e.replace(/n/g,t),f.parse_expression(e)},f.sprintf=function(e,t){return{}.toString.call(t)=="[object Array]"?p(e,[].slice.call(t)):h.apply(this,[].slice.call(arguments))},f.prototype.sprintf=function(){return f.sprintf.apply(this,arguments)},f.PF={},f.PF.parse=function(e){var t=f.PF.extractPluralExpr(e);return f.PF.parser.parse.call(f.PF.parser,t)},f.PF.compile=function(e){function t(e){return e===!0?1:e?e:0}var n=f.PF.parse(e);return function(e){return t(f.PF.interpreter(n)(e))}},f.PF.interpreter=function(e){return function(t){var n;switch(e.type){case"GROUP":return f.PF.interpreter(e.expr)(t);case"TERNARY":if(f.PF.interpreter(e.expr)(t))return f.PF.interpreter(e.truthy)(t);return f.PF.interpreter(e.falsey)(t);case"OR":return f.PF.interpreter(e.left)(t)||f.PF.interpreter(e.right)(t);case"AND":return f.PF.interpreter(e.left)(t)&&f.PF.interpreter(e.right)(t);case"LT":return f.PF.interpreter(e.left)(t)<f.PF.interpreter(e.right)(t);case"GT":return f.PF.interpreter(e.left)(t)>f.PF.interpreter(e.right)(t);case"LTE":return f.PF.interpreter(e.left)(t)<=f.PF.interpreter(e.right)(t);case"GTE":return f.PF.interpreter(e.left)(t)>=f.PF.interpreter(e.right)(t);case"EQ":return f.PF.interpreter(e.left)(t)==f.PF.interpreter(e.right)(t);case"NEQ":return f.PF.interpreter(e.left)(t)!=f.PF.interpreter(e.right)(t);case"MOD":return f.PF.interpreter(e.left)(t)%f.PF.interpreter(e.right)(t);case"VAR":return t;case"NUM":return e.val;default:throw new Error("Invalid Token found.")}}},f.PF.extractPluralExpr=function(e){e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),/;\s*$/.test(e)||(e=e.concat(";"));var t=/nplurals\=(\d+);/,n=/plural\=(.*);/,r=e.match(t),i={},s;if(r.length>1){i.nplurals=r[1],e=e.replace(t,""),s=e.match(n);if(!(s&&s.length>1))throw new Error("`plural` expression not found: "+e);return s[1]}throw new Error("nplurals not found in plural_forms string: "+e)},f.PF.parser=function(){var e={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,n:19,NUMBER:20,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},productions_:[0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:return{type:"GROUP",expr:o[a-1]};case 2:this.$={type:"TERNARY",expr:o[a-4],truthy:o[a-2],falsey:o[a]};break;case 3:this.$={type:"OR",left:o[a-2],right:o[a]};break;case 4:this.$={type:"AND",left:o[a-2],right:o[a]};break;case 5:this.$={type:"LT",left:o[a-2],right:o[a]};break;case 6:this.$={type:"LTE",left:o[a-2],right:o[a]};break;case 7:this.$={type:"GT",left:o[a-2],right:o[a]};break;case 8:this.$={type:"GTE",left:o[a-2],right:o[a]};break;case 9:this.$={type:"NEQ",left:o[a-2],right:o[a]};break;case 10:this.$={type:"EQ",left:o[a-2],right:o[a]};break;case 11:this.$={type:"MOD",left:o[a-2],right:o[a]};break;case 12:this.$={type:"GROUP",expr:o[a-1]};break;case 13:this.$={type:"VAR"};break;case 14:this.$={type:"NUM",val:Number(t)}}},table:[{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],defaultActions:{6:[2,1]},parseError:function(t,n){throw new Error(t)},parse:function(t){function d(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function v(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var m,g,y,b,w,E,S={},x,T,N,C;for(;;){y=r[r.length-1],this.defaultActions[y]?b=this.defaultActions[y]:(m==null&&(m=v()),b=o[y]&&o[y][m]);if(typeof b=="undefined"||!b.length||!b[0]){if(!l){C=[];for(x in o[y])this.terminals_[x]&&x>2&&C.push("'"+this.terminals_[x]+"'");var k="";this.lexer.showPosition?k="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+C.join(", ")+", got '"+this.terminals_[m]+"'":k="Parse error on line "+(a+1)+": Unexpected "+(m==1?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(k,{text:this.lexer.match,token:this.terminals_[m]||m,line:this.lexer.yylineno,loc:p,expected:C})}if(l==3){if(m==h)throw new Error(k||"Parsing halted.");f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,m=v()}for(;;){if(c.toString()in o[y])break;if(y==0)throw new Error(k||"Parsing halted.");d(1),y=r[r.length-1]}g=m,m=c,y=r[r.length-1],b=o[y]&&o[y][c],l=3}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+y+", token: "+m);switch(b[0]){case 1:r.push(m),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(b[1]),m=null,g?(m=g,g=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:T=this.productions_[b[1]][1],S.$=i[i.length-T],S._$={first_line:s[s.length-(T||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(T||1)].first_column,last_column:s[s.length-1].last_column},E=this.performAction.call(S,u,f,a,this.yy,b[1],i,s);if(typeof E!="undefined")return E;T&&(r=r.slice(0,-1*T*2),i=i.slice(0,-1*T),s=s.slice(0,-1*T)),r.push(this.productions_[b[1]][0]),i.push(S.$),s.push(S._$),N=o[r[r.length-2]][r[r.length-1]],r.push(N);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parseError)throw new Error(t);this.yy.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e;var t=e.match(/\n/);return t&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext="",this.match="");var i=this._currentRules();for(var s=0;s<i.length;s++){t=this._input.match(this.rules[i[s]]);if(t){r=t[0].match(/\n.*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i[s],this.conditionStack[this.conditionStack.length-1]);if(e)return e;return}}if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:break;case 1:return 20;case 2:return 19;case 3:return 8;case 4:return 9;case 5:return 6;case 6:return 7;case 7:return 11;case 8:return 13;case 9:return 10;case 10:return 12;case 11:return 14;case 12:return 15;case 13:return 16;case 14:return 17;case 15:return 18;case 16:return 5;case 17:return"INVALID"}},e.rules=[/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./],e.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],inclusive:!0}},e}();return e.lexer=t,e}(),typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=f),exports.Jed=f):(typeof define=="function"&&define.amd&&define("jed",[],function(){return f}),e.Jed=f)}(this),function(e,t){define("af",["jed"],function(){var e=new Jed({domain:"converse",locale_data:{converse:{"":{domain:"converse",lang:"af",plural_forms:"nplurals=2; plural=(n != 1);"},"Show this menu":[null,"Vertoon hierdie keuselys"],"Write in the third person":[null,"Skryf in die derde persoon"],"Remove messages":[null,"Verwyder boodskappe"],"Personal message":[null,"Persoonlike boodskap"],Contacts:[null,"Kontakte"],Online:[null,"Aanlyn"],Busy:[null,"Besig"],Away:[null,"Weg"],Offline:[null,"Aflyn"],"Click to add new chat contacts":[null,"Kliek om nuwe kletskontakte by te voeg"],"Add a contact":[null,"Voeg 'n kontak by"],"Contact username":[null,"Konak gebruikersnaam"],Add:[null,"Voeg by"],"Contact name":[null,"Kontaknaam"],Search:[null,"Soek"],"No users found":[null,"Geen gebruikers gevind"],"Click to add as a chat contact":[null,"Kliek om as kletskontak by te voeg"],"Click to open this room":[null,"Kliek om hierdie kletskamer te open"],"Show more information on this room":[null,"Wys meer inligting aangaande hierdie kletskamer"],"Description:":[null,"Beskrywing:"],"Occupants:":[null,"Deelnemers:"],"Features:":[null,"Eienskappe:"],"Requires authentication":[null,"Benodig magtiging"],Hidden:[null,"Verskuil"],"Requires an invitation":[null,"Benodig 'n uitnodiging"],Moderated:[null,"Gemodereer"],"Non-anonymous":[null,"Nie-anoniem"],"Open room":[null,"Oop kletskamer"],"Permanent room":[null,"Permanente kamer"],Public:[null,"Publiek"],"Semi-anonymous":[null,"Deels anoniem"],"Temporary room":[null,"Tydelike kamer"],Unmoderated:[null,"Ongemodereer"],Rooms:[null,"Kamers"],"Room name":[null,"Kamer naam"],Nickname:[null,"Bynaam"],Server:[null,"Bediener"],Join:[null,"Sluit aan"],"Show rooms":[null,"Wys kamers"],"No rooms on %1$s":[null,"Geen kamers op %1$s"],"Rooms on %1$s":[null,"Kamers op %1$s"],"Set chatroom topic":[null,"Stel kletskamer onderwerp"],"Kick user from chatroom":[null,"Skop gebruiker uit die kletskamer"],"Ban user from chatroom":[null,"Verban gebruiker vanuit die kletskamer"],Message:[null,"Boodskap"],Save:[null,"Stoor"],Cancel:[null,"Kanseleer"],"An error occurred while trying to save the form.":[null,"A fout het voorgekom terwyl probeer is om die vorm te stoor."],"This chatroom requires a password":[null,"Hiedie kletskamer benodig 'n wagwoord"],"Password: ":[null,"Wagwoord:"],Submit:[null,"Dien in"],"This room is not anonymous":[null,"Hierdie vertrek is nie anoniem nie"],"This room now shows unavailable members":[null,"Hierdie vertrek wys nou onbeskikbare lede"],"This room does not show unavailable members":[null,"Hierdie vertrek wys nie onbeskikbare lede nie"],"Non-privacy-related room configuration has changed":[null,"Nie-privaatheidverwante kamer instellings het verander"],"Room logging is now enabled":[null,"Kamer log is nou aangeskakel"],"Room logging is now disabled":[null,"Kamer log is nou afgeskakel"],"This room is now non-anonymous":[null,"Hiedie kamer is nou nie anoniem nie"],"This room is now semi-anonymous":[null,"Hierdie kamer is nou gedeeltelik anoniem"],"This room is now fully-anonymous":[null,"Hierdie kamer is nou ten volle anoniem"],"A new room has been created":[null,"'n Nuwe kamer is geskep"],"Your nickname has been changed":[null,"Jou bynaam is verander"],"<strong>%1$s</strong> has been banned":[null,"<strong>%1$s</strong> is verban"],"<strong>%1$s</strong> has been kicked out":[null,"<strong>%1$s</strong> is uitgeskop"],"<strong>%1$s</strong> has been removed because of an affiliation change":[null,"<strong>%1$s</strong> is verwyder a.g.v 'n verandering van affiliasie"],"<strong>%1$s</strong> has been removed for not being a member":[null,"<strong>%1$s</strong> is nie 'n lid nie, en dus verwyder"],"You have been banned from this room":[null,"Jy is uit die kamer verban"],"You have been kicked from this room":[null,"Jy is uit die kamer geskop"],"You have been removed from this room because of an affiliation change":[null,"Jy is vanuit die kamer verwyder a.g.v 'n verandering van affiliasie"],"You have been removed from this room because the room has changed to members-only and you're not a member":[null,"Jy is vanuit die kamer verwyder omdat die kamer nou slegs tot lede beperk word en jy nie 'n lid is nie."],"You have been removed from this room because the MUC (Multi-user chat) service is being shut down.":[null,"Jy is van hierdie kamer verwyder aangesien die MUC (Multi-user chat) diens nou afgeskakel word."],"You are not on the member list of this room":[null,"Jy is nie op die ledelys van hierdie kamer nie"],"No nickname was specified":[null,"Geen bynaam verskaf nie"],"You are not allowed to create new rooms":[null,"Jy word nie toegelaat om nog kamers te skep nie"],"Your nickname doesn't conform to this room's policies":[null,"Jou bynaam voldoen nie aan die kamer se beleid nie"],"Your nickname is already taken":[null,"Jou bynaam is reeds geneem"],"This room does not (yet) exist":[null,"Hierdie kamer bestaan tans (nog) nie"],"This room has reached it's maximum number of occupants":[null,"Hierdie kamer het sy maksimum aantal deelnemers bereik"],"Topic set by %1$s to: %2$s":[null,"Onderwerp deur %1$s bygewerk na: %2$s"],"This user is a moderator":[null,"Hierdie gebruiker is 'n moderator"],"This user can send messages in this room":[null,"Hierdie gebruiker kan boodskappe na die kamer stuur"],"This user can NOT send messages in this room":[null,"Hierdie gebruiker kan NIE boodskappe na die kamer stuur nie"],"Click to chat with this contact":[null,"Kliek om met hierdie kontak te klets"],"Click to remove this contact":[null,"Kliek om hierdie kontak te verwyder"],"Contact requests":[null,"Kontak versoeke"],"My contacts":[null,"My kontakte"],"Pending contacts":[null,"Hangende kontakte"],"Custom status":[null,"Doelgemaakte status"],"Click to change your chat status":[null,"Kliek om jou klets-status te verander"],"Click here to write a custom status message":[null,"Kliek hier om jou eie statusboodskap te skryf"],online:[null,"aanlyn"],busy:[null,"besig"],"away for long":[null,"weg vir lank"],away:[null,"weg"],"I am %1$s":[null,"Ek is %1$s"],"Sign in":[null,"Teken in"],"XMPP/Jabber Username:":[null,"XMPP/Jabber Gebruikersnaam:"],"Password:":[null,"Wagwoord"],"Log In":[null,"Meld aan"],"BOSH Service URL:":[null,"BOSH bediener URL"],Connected:[null,"Verbind"],Disconnected:[null,"Ontkoppel"],Error:[null,"Fout"],Connecting:[null,"Verbind tans"],"Connection Failed":[null,"Verbinding het gefaal"],Authenticating:[null,"Besig om te bekragtig"],"Authentication Failed":[null,"Bekragtiging het gefaal"],Disconnecting:[null,"Besig om te ontkoppel"],Attached:[null,"Geheg"],"Online Contacts":[null,"Kontakte aanlyn"]}}});return t(e)})}(this,function(e){return e}),function(e,t){define("en",["jed"],function(){var e=new Jed({domain:"converse",locale_data:{converse:{"":{domain:"converse",lang:"en",plural_forms:"nplurals=2; plural=(n != 1);"}}}});return t(e)})}(this,function(e){return e}),function(e,t){define("locales",["jed","af","en"],function(t,n,r){e.locales={},e.locales.af=n,e.locales.en=r})}(this),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?null:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t||x.identity);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s},x.bind=function(e,t){if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));var n=u.call(arguments,2);return function(){return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return t.length===0&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,f<=0?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]==null&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var O=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=O(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&O(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return O(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var M={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};M.unescape=x.invert(M.escape);var _={escape:new RegExp("["+x.keys(M.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(M.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(_[e],function(t){return M[e][t]})}}),x.result=function(e,t){if(e==null)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),j.call(this,n.apply(x,e))}})};var D=0;x.uniqueId=function(e){var t=++D+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||P).source,(n.interpolate||P).source,(n.evaluate||P).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(B,function(e){return"\\"+H[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var j=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],j.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return j.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(){}),function(){var e=this,t=e.Backbone,n=[],r=n.push,i=n.slice,s=n.splice,o;typeof exports!="undefined"?o=exports:o=e.Backbone={},o.VERSION="1.0.0";var u=e._;!u&&typeof require!="undefined"&&(u=require("underscore")),o.$=e.jQuery||e.Zepto||e.ender||e.$,o.noConflict=function(){return e.Backbone=t,this},o.emulateHTTP=!1,o.emulateJSON=!1;var a=o.Events={on:function(e,t,n){if(!l(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!l(this,"once",e,[t,n])||!t)return this;var r=this,i=u.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){var r,i,s,o,a,f,c,h;if(!this._events||!l(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;o=e?[e]:u.keys(this._events);for(a=0,f=o.length;a<f;a++){e=o[a];if(s=this._events[e]){this._events[e]=r=[];if(t||n)for(c=0,h=s.length;c<h;c++)i=s[c],(t&&t!==i.callback&&t!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[e]}}return this},trigger:function(e){if(!this._events)return this;var t=i.call(arguments,1);if(!l(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&c(n,t),r&&c(r,arguments),this},stopListening:function(e,t,n){var r=this._listeners;if(!r)return this;var i=!t&&!n;typeof t=="object"&&(n=this),e&&((r={})[e._listenerId]=e);for(var s in r)r[s].off(t,n,this),i&&delete this._listeners[s];return this}},f=/\s+/,l=function(e,t,n,r){if(!n)return!0;if(typeof n=="object"){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(f.test(n)){var s=n.split(f);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r));return!1}return!0},c=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t)}},h={listenTo:"on",listenToOnce:"once"};u.each(h,function(e,t){a[t]=function(t,n,r){var i=this._listeners||(this._listeners={}),s=t._listenerId||(t._listenerId=u.uniqueId("l"));return i[s]=t,typeof n=="object"&&(r=this),t[e](n,r,this),this}}),a.bind=a.on,a.unbind=a.off,u.extend(o,a);var p=o.Model=function(e,t){var n,r=e||{};t||(t={}),this.cid=u.uniqueId("c"),this.attributes={},u.extend(this,u.pick(t,d)),t.parse&&(r=this.parse(r,t)||{});if(n=u.result(this,"defaults"))r=u.defaults({},r,n);this.set(r,t),this.changed={},this.initialize.apply(this,arguments)},d=["url","urlRoot","collection"];u.extend(p.prototype,a,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return u.clone(this.attributes)},sync:function(){return o.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return u.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i,s,o,a,f,l,c;if(e==null)return this;typeof e=="object"?(i=e,n=t):(i={})[e]=t,n||(n={});if(!this._validate(i,n))return!1;s=n.unset,a=n.silent,o=[],f=this._changing,this._changing=!0,f||(this._previousAttributes=u.clone(this.attributes),this.changed={}),c=this.attributes,l=this._previousAttributes,this.idAttribute in i&&(this.id=i[this.idAttribute]);for(r in i)t=i[r],u.isEqual(c[r],t)||o.push(r),u.isEqual(l[r],t)?delete this.changed[r]:this.changed[r]=t,s?delete c[r]:c[r]=t;if(!a){o.length&&(this._pending=!0);for(var h=0,p=o.length;h<p;h++)this.trigger("change:"+o[h],this,c[o[h]],n)}if(f)return this;if(!a)while(this._pending)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,u.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,u.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!u.isEmpty(this.changed):u.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?u.clone(this.changed):!1;var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var i in e){if(u.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return u.clone(this._previousAttributes)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r){if(!t.set(t.parse(r,e),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},j(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,i,s,o=this.attributes;e==null||typeof e=="object"?(r=e,n=t):(r={})[e]=t;if(r&&(!n||!n.wait)&&!this.set(r,n))return!1;n=u.extend({validate:!0},n);if(!this._validate(r,n))return!1;r&&n.wait&&(this.attributes=u.extend({},o,r)),n.parse===void 0&&(n.parse=!0);var a=this,f=n.success;return n.success=function(e){a.attributes=o;var t=a.parse(e,n);n.wait&&(t=u.extend(r||{},t));if(u.isObject(t)&&!a.set(t,n))return!1;f&&f(a,e,n),a.trigger("sync",a,e,n)},j(this,n),i=this.isNew()?"create":n.patch?"patch":"update",i==="patch"&&(n.attrs=r),s=this.sync(i,this,n),r&&n.wait&&(this.attributes=o),s},destroy:function(e){e=e?u.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e),t.isNew()||t.trigger("sync",t,i,e)};if(this.isNew())return e.success(),!1;j(this,e);var i=this.sync("delete",this,e);return e.wait||r(),i},url:function(){var e=u.result(this,"urlRoot")||u.result(this.collection,"url")||B();return this.isNew()?e:e+(e.charAt(e.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(e){return this._validate({},u.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=u.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,u.extend(t||{},{validationError:n})),!1):!0}});var v=["keys","values","pairs","invert","pick","omit"];u.each(v,function(e){p.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.attributes),u[e].apply(u,t)}});var m=o.Collection=function(e,t){t||(t={}),t.url&&(this.url=t.url),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,u.extend({silent:!0},t))},g={add:!0,remove:!0,merge:!0},y={add:!0,merge:!1,remove:!1};u.extend(m.prototype,a,{model:p,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return o.sync.apply(this,arguments)},add:function(e,t){return this.set(e,u.defaults(t||{},y))},remove:function(e,t){e=u.isArray(e)?e.slice():[e],t||(t={});var n,r,i,s;for(n=0,r=e.length;n<r;n++){s=this.get(e[n]);if(!s)continue;delete this._byId[s.id],delete this._byId[s.cid],i=this.indexOf(s),this.models.splice(i,1),this.length--,t.silent||(t.index=i,s.trigger("remove",s,this,t)),this._removeReference(s)}return this},set:function(e,t){t=u.defaults(t||{},g),t.parse&&(e=this.parse(e,t)),u.isArray(e)||(e=e?[e]:[]);var n,i,o,a,f,l,c=t.at,h=this.comparator&&c==null&&t.sort!==!1,p=u.isString(this.comparator)?this.comparator:null,d=[],v=[],m={};for(n=0,i=e.length;n<i;n++){if(!(o=this._prepareModel(e[n],t)))continue;(f=this.get(o))?(t.remove&&(m[f.cid]=!0),t.merge&&(f.set(o.attributes,t),h&&!l&&f.hasChanged(p)&&(l=!0))):t.add&&(d.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,o.id!=null&&(this._byId[o.id]=o))}if(t.remove){for(n=0,i=this.length;n<i;++n)m[(o=this.models[n]).cid]||v.push(o);v.length&&this.remove(v,t)}d.length&&(h&&(l=!0),this.length+=d.length,c!=null?s.apply(this.models,[c,0].concat(d)):r.apply(this.models,d)),l&&this.sort({silent:!0});if(t.silent)return this;for(n=0,i=d.length;n<i;n++)(o=d[n]).trigger("add",o,this,t);return l&&this.trigger("sort",this,t),this},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),this.add(e,u.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,u.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,u.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return e==null?void 0:this._byId[e.id!=null?e.id:e.cid||e]},at:function(e){return this.models[e]},where:function(e,t){return u.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),u.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(u.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},sortedIndex:function(e,t,n){t||(t=this.comparator);var r=u.isFunction(t)?t:function(e){return e.get(t)};return u.sortedIndex(this.models,e,r,n)},pluck:function(e){return u.invoke(this.models,"get",e)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=e.success,n=this;return e.success=function(r){var i=e.reset?"reset":"set";n[i](r,e),t&&t(n,r,e),n.trigger("sync",n,r,e)},j(this,e),this.sync("read",this,e)},create:function(e,t){t=t?u.clone(t):{};if(!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,r=t.success;return t.success=function(i){t.wait&&n.add(e,t),r&&r(e,i,t)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof p)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(e,t)?n:(this.trigger("invalid",this,e,t),!1)},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var b=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];u.each(b,function(e){m.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.models),u[e].apply(u,t)}});var w=["groupBy","countBy","sortBy"];u.each(w,function(e){m.prototype[e]=function(t,n){var r=u.isFunction(t)?t:function(e){return e.get(t)};return u[e](this.models,r,n)}});var E=o.View=function(e){this.cid=u.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},S=/^(\S+)\s*(.*)$/,x=["model","collection","el","id","attributes","className","tagName","events"];u.extend(E.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof o.$?e:o.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=u.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];u.isFunction(n)||(n=this[e[t]]);if(!n)continue;var r=t.match(S),i=r[1],s=r[2];n=u.bind(n,this),i+=".delegateEvents"+this.cid,s===""?this.$el.on(i,n):this.$el.on(i,s,n)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(e){this.options&&(e=u.extend({},u.result(this,"options"),e)),u.extend(this,u.pick(e,x)),this.options=e},_ensureElement:function(){if(!this.el){var e=u.extend({},u.result(this,"attributes"));this.id&&(e.id=u.result(this,"id")),this.className&&(e["class"]=u.result(this,"className"));var t=o.$("<"+u.result(this,"tagName")+">").attr(e);this.setElement(t,!1)}else this.setElement(u.result(this,"el"),!1)}}),o.sync=function(e,t,n){var r=T[e];u.defaults(n||(n={}),{emulateHTTP:o.emulateHTTP,emulateJSON:o.emulateJSON});var i={type:r,dataType:"json"};n.url||(i.url=u.result(t,"url")||B()),n.data==null&&t&&(e==="create"||e==="update"||e==="patch")&&(i.contentType="application/json",i.data=JSON.stringify(n.attrs||t.toJSON(n))),n.emulateJSON&&(i.contentType="application/x-www-form-urlencoded",i.data=i.data?{model:i.data}:{});if(n.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){i.type="POST",n.emulateJSON&&(i.data._method=r);var s=n.beforeSend;n.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",r);if(s)return s.apply(this,arguments)}}i.type!=="GET"&&!n.emulateJSON&&(i.processData=!1),i.type==="PATCH"&&window.ActiveXObject&&(!window.external||!window.external.msActiveXFilteringEnabled)&&(i.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=n.xhr=o.ajax(u.extend(i,n));return t.trigger("request",t,a,n),a};var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};o.ajax=function(){return o.$.ajax.apply(o.$,arguments)};var N=o.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},C=/\((.*?)\)/g,k=/(\(\?)?:\w+/g,L=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;u.extend(N.prototype,a,{initialize:function(){},route:function(e,t,n){u.isRegExp(e)||(e=this._routeToRegExp(e)),u.isFunction(t)&&(n=t,t=""),n||(n=this[t]);var r=this;return o.history.route(e,function(i){var s=r._extractParameters(e,i);n&&n.apply(r,s),r.trigger.apply(r,["route:"+t].concat(s)),r.trigger("route",t,s),o.history.trigger("route",r,t,s)}),this},navigate:function(e,t){return o.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;this.routes=u.result(this,"routes");var e,t=u.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(C,"(?:$1)?").replace(k,function(e,t){return t?e:"([^/]+)"}).replace(L,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return u.map(n,function(e){return e?decodeURIComponent(e):null})}});var O=o.History=function(){this.handlers=[],u.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},M=/^[#\/]|\s+$/g,_=/^\/+|\/+$/g,D=/msie [\w.]+/,P=/\/$/;O.started=!1,u.extend(O.prototype,a,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(P,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace(M,"")},start:function(e){if(O.started)throw new Error("Backbone.history has already been started");O.started=!0,this.options=u.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,r=D.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(_,"/"),r&&this._wantsHashChange&&(this.iframe=o.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?o.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?o.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=this.location,s=i.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!s)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&s&&i.hash&&(this.fragment=this.getHash().replace(M,""),this.history.replaceState({},document.title,this.root+this.fragment+i.search));if(!this.options.silent)return this.loadUrl()},stop:function(){o.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),O.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=u.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!O.started)return!1;if(!t||t===!0)t={trigger:t};e=this.getFragment(e||"");if(this.fragment===e)return;this.fragment=e;var n=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),o.history=new O;var H=function(e,t){var n=this,r;e&&u.has(e,"constructor")?r=e.constructor:r=function(){return n.apply(this,arguments)},u.extend(r,n,t);var i=function(){this.constructor=r};return i.prototype=n.prototype,r.prototype=new i,e&&u.extend(r.prototype,e),r.__super__=n.prototype,r};p.extend=m.extend=N.extend=E.extend=O.extend=H;var B=function(){throw new Error('A "url" property or function must be specified')},j=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}}}.call(this),define("backbone",function(){}),function(e,t){typeof define=="function"&&define.amd?define("localstorage",["underscore","backbone"],function(n,r){return t(n||e._,r||e.Backbone)}):t(_,Backbone)}(this,function(e,t){function n(){return((1+Math.random())*65536|0).toString(16).substring(1)}function r(){return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}return t.LocalStorage=window.Store=function(e){this.name=e;var t=this.localStorage().getItem(this.name);this.records=t&&t.split(",")||[]},e.extend(t.LocalStorage.prototype,{save:function(){this.localStorage().setItem(this.name,this.records.join(","))},create:function(e){return e.id||(e.id=r(),e.set(e.idAttribute,e.id)),this.localStorage().setItem(this.name+"-"+e.id,JSON.stringify(e)),this.records.push(e.id.toString()),this.save(),this.find(e)},update:function(t){return this.localStorage().setItem(this.name+"-"+t.id,JSON.stringify(t)),e.include(this.records,t.id.toString())||this.records.push(t.id.toString()),this.save(),this.find(t)},find:function(e){return this.jsonData(this.localStorage().getItem(this.name+"-"+e.id))},findAll:function(){return e(this.records).chain().map(function(e){return this.jsonData(this.localStorage().getItem(this.name+"-"+e))},this).compact().value()},destroy:function(t){return t.isNew()?!1:(this.localStorage().removeItem(this.name+"-"+t.id),this.records=e.reject(this.records,function(e){return e===t.id.toString()}),this.save(),t)},localStorage:function(){return localStorage},jsonData:function(e){return e&&JSON.parse(e)}}),t.LocalStorage.sync=window.Store.sync=t.localSync=function(e,n,r){var i=n.localStorage||n.collection.localStorage,s,o,u=$.Deferred&&$.Deferred();try{switch(e){case"read":s=n.id!=undefined?i.find(n):i.findAll();break;case"create":s=i.create(n);break;case"update":s=i.update(n);break;case"delete":s=i.destroy(n)}}catch(a){a.code===DOMException.QUOTA_EXCEEDED_ERR&&window.localStorage.length===0?o="Private browsing is unsupported":o=a.message}return s?(r&&r.success&&(t.VERSION==="0.9.10"?r.success(n,s,r):r.success(s)),u&&u.resolve(s)):(o=o?o:"Record Not Found",r&&r.error&&(t.VERSION==="0.9.10"?r.error(n,o,r):r.error(o)),u&&u.reject(o)),r&&r.complete&&r.complete(s),u&&u.promise()},t.ajaxSync=t.sync,t.getSyncMethod=function(e){return e.localStorage||e.collection&&e.collection.localStorage?t.localSync:t.ajaxSync},t.sync=function(e,n,r){return t.getSyncMethod(n).apply(this,[e,n,r])},t.LocalStorage}),function(e){function a(e){return e&&e.toLowerCase?e.toLowerCase():e}function f(e,n){for(var r=0,i=e.length;r<i;r++)if(e[r]==n)return!t;return t}var t=!1,n=null,r=parseFloat,i=Math.min,s=/(-?\d+\.?\d*)$/g,o=[],u=[];e.tinysort={id:"TinySort",version:"1.4.29",copyright:"Copyright (c) 2008-2012 Ron Valstar",uri:"http://tinysort.sjeiti.com/",licensed:{MIT:"http://www.opensource.org/licenses/mit-license.php",GPL:"http://www.gnu.org/licenses/gpl.html"},plugin:function(e,t){o.push(e),u.push(t)},defaults:{order:"asc",attr:n,data:n,useVal:t,place:"start",returns:t,cases:t,forceStrings:t,sortFunction:n}},e.fn.extend({tinysort:function(l,c){l&&typeof l!="string"&&(c=l,l=n);var h=e.extend({},e.tinysort.defaults,c),p,d=this,v=e(this).length,m={},g=!!l&&l!="",y=h.attr!==n&&h.attr!="",b=h.data!==n,w=g&&l[0]==":",E=w?d.filter(l):d,S=h.sortFunction,x=h.order=="asc"?1:-1,T=[];e.each(o,function(e,t){t.call(t,h)}),S||(S=h.order=="rand"?function(){return Math.random()<.5?1:-1}:function(n,i){var o=t,f=h.cases?n.s:a(n.s),l=h.cases?i.s:a(i.s);if(!h.forceStrings){var c=f&&f.match(s),p=l&&l.match(s);if(c&&p){var d=f.substr(0,f.length-c[0].length),v=l.substr(0,l.length-p[0].length);d==v&&(o=!t,f=r(c[0]),l=r(p[0]))}}var m=x*(f<l?-1:f>l?1:0);return e.each(u,function(e,t){m=t.call(t,o,f,l,m)}),m}),d.each(function(t,n){var r=e(n),i=g?w?E.filter(n):r.find(l):r,s=b?""+i.data(h.data):y?i.attr(h.attr):h.useVal?i.val():i.text(),o=r.parent();m[o]||(m[o]={s:[],n:[]}),i.length>0?m[o].s.push({s:s,e:r,n:t}):m[o].n.push({e:r,n:t})});for(p in m)m[p].s.sort(S);for(p in m){var N=m[p],C=[],k=v,L=[0,0],A;switch(h.place){case"first":e.each(N.s,function(e,t){k=i(k,t.n)});break;case"org":e.each(N.s,function(e,t){C.push(t.n)});break;case"end":k=N.n.length;break;default:k=0}for(A=0;A<v;A++){var O=f(C,A)?!t:A>=k&&A<k+N.s.length,M=(O?N.s:N.n)[L[O?0:1]].e;M.parent().append(M),(O||!h.returns)&&T.push(M.get(0)),L[O?0:1]++}}return d.length=0,Array.prototype.push.apply(d,T),d}}),e.fn.TinySort=e.fn.Tinysort=e.fn.tsort=e.fn.tinysort}(jQuery),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t=this.length,n=Number(arguments[1])||0;n=n<0?Math.ceil(n):Math.floor(n),n<0&&(n+=t);for(;n<t;n++)if(n in this&&this[n]===e)return n;return-1}),define("tinysort",function(){});var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(e){this.toString=function(){return"CORRUPT: "+this.message},this.message=e},invalid:function(e){this.toString=function(){return"INVALID: "+this.message},this.message=e},bug:function(e){this.toString=function(){return"BUG: "+this.message},this.message=e},notReady:function(e){this.toString=function(){return"NOT READY: "+this.message},this.message=e}}};typeof module!="undefined"&&module.exports&&(module.exports=sjcl),sjcl.cipher.aes=function(e){this.h[0][0][0]||this.z();var t,n,r,i,s=this.h[0][4],o=this.h[1];t=e.length;var u=1;if(t!==4&&t!==6&&t!==8)throw new sjcl.exception.invalid("invalid aes key size");this.a=[r=e.slice(0),i=[]];for(e=t;e<4*t+28;e++){n=r[e-1];if(e%t===0||t===8&&e%t===4)n=s[n>>>24]<<24^s[n>>16&255]<<16^s[n>>8&255]<<8^s[n&255],e%t===0&&(n=n<<8^n>>>24^u<<24,u=u<<1^(u>>7)*283);r[e]=r[e-t]^n}for(t=0;e;t++,e--)n=r[t&3?e:e-4],i[t]=e<=4||t<4?n:o[0][s[n>>>24]]^o[1][s[n>>16&255]]^o[2][s[n>>8&255]]^o[3][s[n&255]]},sjcl.cipher.aes.prototype={encrypt:function(e){return this.I(e,0)},decrypt:function(e){return this.I(e,1)},h:[[[],[],[],[],[]],[[],[],[],[],[]]],z:function(){var e=this.h[0],t=this.h[1],n=e[4],r=t[4],i,s,o,u=[],a=[],f,l,c,h;for(i=0;i<256;i++)a[(u[i]=i<<1^(i>>7)*283)^i]=i;for(s=o=0;!n[s];s^=f||1,o=a[o]||1){c=o^o<<1^o<<2^o<<3^o<<4,c=c>>8^c&255^99,n[s]=c,r[c]=s,l=u[i=u[f=u[s]]],h=l*16843009^i*65537^f*257^s*16843008,l=u[c]*257^c*16843008;for(i=0;i<4;i++)e[i][s]=l=l<<24^l>>>8,t[i][c]=h=h<<24^h>>>8}for(i=0;i<5;i++)e[i]=e[i].slice(0),t[i]=t[i].slice(0)},I:function(e,t){if(e.length!==4)throw new sjcl.exception.invalid("invalid aes block size");var n=this.a[t],r=e[0]^n[0],i=e[t?3:1]^n[1],s=e[2]^n[2];e=e[t?1:3]^n[3];var o,u,a,f=n.length/4-2,l,c=4,h=[0,0,0,0];o=this.h[t];var p=o[0],d=o[1],v=o[2],m=o[3],g=o[4];for(l=0;l<f;l++)o=p[r>>>24]^d[i>>16&255]^v[s>>8&255]^m[e&255]^n[c],u=p[i>>>24]^d[s>>16&255]^v[e>>8&255]^m[r&255]^n[c+1],a=p[s>>>24]^d[e>>16&255]^v[r>>8&255]^m[i&255]^n[c+2],e=p[e>>>24]^d[r>>16&255]^v[i>>8&255]^m[s&255]^n[c+3],c+=4,r=o,i=u,s=a;for(l=0;l<4;l++)h[t?3&-l:l]=g[r>>>24]<<24^g[i>>16&255]<<16^g[s>>8&255]<<8^g[e&255]^n[c++],o=r,r=i,i=s,s=e,e=o;return h}},sjcl.bitArray={bitSlice:function(e,t,n){return e=sjcl.bitArray.P(e.slice(t/32),32-(t&31)).slice(1),n===undefined?e:sjcl.bitArray.clamp(e,n-t)},extract:function(e,t,n){var r=Math.floor(-t-n&31);return((t+n-1^t)&-32?e[t/32|0]<<32-r^e[t/32+1|0]>>>r:e[t/32|0]>>>r)&(1<<n)-1},concat:function(e,t){if(e.length===0||t.length===0)return e.concat(t);var n=e[e.length-1],r=sjcl.bitArray.getPartial(n);return r===32?e.concat(t):sjcl.bitArray.P(t,r,n|0,e.slice(0,e.length-1))},bitLength:function(e){var t=e.length;return t===0?0:(t-1)*32+sjcl.bitArray.getPartial(e[t-1])},clamp:function(e,t){if(e.length*32<t)return e;e=e.slice(0,Math.ceil(t/32));var n=e.length;return t&=31,n>0&&t&&(e[n-1]=sjcl.bitArray.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:function(e,t,n){return e===32?t:(n?t|0:t<<32-e)+e*1099511627776},getPartial:function(e){return Math.round(e/1099511627776)||32},equal:function(e,t){if(sjcl.bitArray.bitLength(e)!==sjcl.bitArray.bitLength(t))return!1;var n=0,r;for(r=0;r<e.length;r++)n|=e[r]^t[r];return n===0},P:function(e,t,n,r){var i;i=0,r===undefined&&(r=[]);for(;t>=32;t-=32)r.push(n),n=0;if(t===0)return r.concat(e);for(i=0;i<e.length;i++)r.push(n|e[i]>>>t),n=e[i]<<32-t;return i=e.length?e[e.length-1]:0,e=sjcl.bitArray.getPartial(i),r.push(sjcl.bitArray.partial(t+e&31,t+e>32?n:r.pop(),1)),r},k:function(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}},sjcl.codec.utf8String={fromBits:function(e){var t="",n=sjcl.bitArray.bitLength(e),r,i;for(r=0;r<n/8;r++)(r&3)===0&&(i=e[r/4]),t+=String.fromCharCode(i>>>24),i<<=8;return decodeURIComponent(escape(t))},toBits:function(e){e=unescape(encodeURIComponent(e));var t=[],n,r=0;for(n=0;n<e.length;n++)r=r<<8|e.charCodeAt(n),(n&3)===3&&(t.push(r),r=0);return n&3&&t.push(sjcl.bitArray.partial(8*(n&3),r)),t}},sjcl.codec.hex={fromBits:function(e){var t="",n;for(n=0;n<e.length;n++)t+=((e[n]|0)+0xf00000000000).toString(16).substr(4);return t.substr(0,sjcl.bitArray.bitLength(e)/4)},toBits:function(e){var t,n=[],r;e=e.replace(/\s|0x/g,""),r=e.length,e+="00000000";for(t=0;t<e.length;t+=8)n.push(parseInt(e.substr(t,8),16)^0);return sjcl.bitArray.clamp(n,r*4)}},sjcl.codec.base64={F:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(e,t,n){var r="",i=0,s=sjcl.codec.base64.F,o=0,u=sjcl.bitArray.bitLength(e);n&&(s=s.substr(0,62)+"-_");for(n=0;r.length*6<u;)r+=s.charAt((o^e[n]>>>i)>>>26),i<6?(o=e[n]<<6-i,i+=26,n++):(o<<=6,i-=6);for(;r.length&3&&!t;)r+="=";return r},toBits:function(e,t){e=e.replace(/\s|=/g,"");var n=[],r=0,i=sjcl.codec.base64.F,s=0,o;t&&(i=i.substr(0,62)+"-_");for(t=0;t<e.length;t++){o=i.indexOf(e.charAt(t));if(o<0)throw new sjcl.exception.invalid("this isn't base64!");r>26?(r-=26,n.push(s^o>>>r),s=o<<32-r):(r+=6,s^=o<<32-r)}return r&56&&n.push(sjcl.bitArray.partial(r&56,s,1)),n}},sjcl.codec.base64url={fromBits:function(e){return sjcl.codec.base64.fromBits(e,1,1)},toBits:function(e){return sjcl.codec.base64.toBits(e,1)}},sjcl.hash.sha256=function(e){this.a[0]||this.z(),e?(this.n=e.n.slice(0),this.i=e.i.slice(0),this.e=e.e):this.reset()},sjcl.hash.sha256.hash=function(e){return(new sjcl.hash.sha256).update(e).finalize()},sjcl.hash.sha256.prototype={blockSize:512,reset:function(){return this.n=this.N.slice(0),this.i=[],this.e=0,this},update:function(e){typeof e=="string"&&(e=sjcl.codec.utf8String.toBits(e));var t,n=this.i=sjcl.bitArray.concat(this.i,e);t=this.e,e=this.e=t+sjcl.bitArray.bitLength(e);for(t=512+t&-512;t<=e;t+=512)this.D(n.splice(0,16));return this},finalize:function(){var e,t=this.i,n=this.n;t=sjcl.bitArray.concat(t,[sjcl.bitArray.partial(1,1)]);for(e=t.length+2;e&15;e++)t.push(0);t.push(Math.floor(this.e/4294967296));for(t.push(this.e|0);t.length;)this.D(t.splice(0,16));return this.reset(),n},N:[],a:[],z:function(){function e(e){return(e-Math.floor(e))*4294967296|0}var t=0,n=2,r;e:for(;t<64;n++){for(r=2;r*r<=n;r++)if(n%r===0)continue e;t<8&&(this.N[t]=e(Math.pow(n,.5))),this.a[t]=e(Math.pow(n,1/3)),t++}},D:function(e){var t,n,r=e.slice(0),i=this.n,s=this.a,o=i[0],u=i[1],a=i[2],f=i[3],l=i[4],c=i[5],h=i[6],p=i[7];for(e=0;e<64;e++)e<16?t=r[e]:(t=r[e+1&15],n=r[e+14&15],t=r[e&15]=(t>>>7^t>>>18^t>>>3^t<<25^t<<14)+(n>>>17^n>>>19^n>>>10^n<<15^n<<13)+r[e&15]+r[e+9&15]|0),t=t+p+(l>>>6^l>>>11^l>>>25^l<<26^l<<21^l<<7)+(h^l&(c^h))+s[e],p=h,h=c,c=l,l=f+t|0,f=a,a=u,u=o,o=t+(u&a^f&(u^a))+(u>>>2^u>>>13^u>>>22^u<<30^u<<19^u<<10)|0;i[0]=i[0]+o|0,i[1]=i[1]+u|0,i[2]=i[2]+a|0,i[3]=i[3]+f|0,i[4]=i[4]+l|0,i[5]=i[5]+c|0,i[6]=i[6]+h|0,i[7]=i[7]+p|0}},sjcl.mode.ccm={name:"ccm",encrypt:function(e,t,n,r,i){var s,o=t.slice(0),u=sjcl.bitArray,a=u.bitLength(n)/8,f=u.bitLength(o)/8;i=i||64,r=r||[];if(a<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(s=2;s<4&&f>>>8*s;s++);return s<15-a&&(s=15-a),n=u.clamp(n,8*(15-s)),t=sjcl.mode.ccm.H(e,t,n,r,i,s),o=sjcl.mode.ccm.J(e,o,n,t,i,s),u.concat(o.data,o.tag)},decrypt:function(e,t,n,r,i){i=i||64,r=r||[];var s=sjcl.bitArray,o=s.bitLength(n)/8,u=s.bitLength(t),a=s.clamp(t,u-i),f=s.bitSlice(t,u-i);u=(u-i)/8;if(o<7)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(t=2;t<4&&u>>>8*t;t++);t<15-o&&(t=15-o),n=s.clamp(n,8*(15-t)),a=sjcl.mode.ccm.J(e,a,n,f,i,t),e=sjcl.mode.ccm.H(e,a.data,n,r,i,t);if(!s.equal(a.tag,e))throw new sjcl.exception.corrupt("ccm: tag doesn't match");return a.data},H:function(e,t,n,r,i,s){var o=[],u=sjcl.bitArray,a=u.k;i/=8;if(i%2||i<4||i>16)throw new sjcl.exception.invalid("ccm: invalid tag length");if(r.length>4294967295||t.length>4294967295)throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data");s=[u.partial(8,(r.length?64:0)|i-2<<2|s-1)],s=u.concat(s,n),s[3]|=u.bitLength(t)/8,s=e.encrypt(s);if(r.length){n=u.bitLength(r)/8,n<=65279?o=[u.partial(16,n)]:n<=4294967295&&(o=u.concat([u.partial(16,65534)],[n])),o=u.concat(o,r);for(r=0;r<o.length;r+=4)s=e.encrypt(a(s,o.slice(r,r+4).concat([0,0,0])))}for(r=0;r<t.length;r+=4)s=e.encrypt(a(s,t.slice(r,r+4).concat([0,0,0])));return u.clamp(s,i*8)},J:function(e,t,n,r,i,s){var o,u=sjcl.bitArray;o=u.k;var a=t.length,f=u.bitLength(t);n=u.concat([u.partial(8,s-1)],n).concat([0,0,0]).slice(0,4),r=u.bitSlice(o(r,e.encrypt(n)),0,i);if(!a)return{tag:r,data:[]};for(o=0;o<a;o+=4)n[3]++,i=e.encrypt(n),t[o]^=i[0],t[o+1]^=i[1],t[o+2]^=i[2],t[o+3]^=i[3];return{tag:r,data:u.clamp(t,f)}}},sjcl.mode.ocb2={name:"ocb2",encrypt:function(e,t,n,r,i,s){if(sjcl.bitArray.bitLength(n)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");var o,u=sjcl.mode.ocb2.B,a=sjcl.bitArray,f=a.k,l=[0,0,0,0];n=u(e.encrypt(n));var c,h=[];r=r||[],i=i||64;for(o=0;o+4<t.length;o+=4)c=t.slice(o,o+4),l=f(l,c),h=h.concat(f(n,e.encrypt(f(n,c)))),n=u(n);return c=t.slice(o),t=a.bitLength(c),o=e.encrypt(f(n,[0,0,0,t])),c=a.clamp(f(c.concat([0,0,0]),o),t),l=f(l,f(c.concat([0,0,0]),o)),l=e.encrypt(f(l,f(n,u(n)))),r.length&&(l=f(l,s?r:sjcl.mode.ocb2.pmac(e,r))),h.concat(a.concat(c,a.clamp(l,i)))},decrypt:function(e,t,n,r,i,s){if(sjcl.bitArray.bitLength(n)!==128)throw new sjcl.exception.invalid("ocb iv must be 128 bits");i=i||64;var o=sjcl.mode.ocb2.B,u=sjcl.bitArray,a=u.k,f=[0,0,0,0],l=o(e.encrypt(n)),c,h,p=sjcl.bitArray.bitLength(t)-i,d=[];r=r||[];for(n=0;n+4<p/32;n+=4)c=a(l,e.decrypt(a(l,t.slice(n,n+4)))),f=a(f,c),d=d.concat(c),l=o(l);h=p-n*32,c=e.encrypt(a(l,[0,0,0,h])),c=a(c,u.clamp(t.slice(n),h).concat([0,0,0])),f=a(f,c),f=e.encrypt(a(f,a(l,o(l)))),r.length&&(f=a(f,s?r:sjcl.mode.ocb2.pmac(e,r)));if(!u.equal(u.clamp(f,i),u.bitSlice(t,p)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return d.concat(u.clamp(c,h))},pmac:function(e,t){var n,r=sjcl.mode.ocb2.B,i=sjcl.bitArray,s=i.k,o=[0,0,0,0],u=e.encrypt([0,0,0,0]);u=s(u,r(r(u)));for(n=0;n+4<t.length;n+=4)u=r(u),o=s(o,e.encrypt(s(u,t.slice(n,n+4))));return t=t.slice(n),i.bitLength(t)<128&&(u=s(u,r(u)),t=i.concat(t,[-2147483648,0,0,0])),o=s(o,t),e.encrypt(s(r(s(u,r(u))),o))},B:function(e){return[e[0]<<1^e[1]>>>31,e[1]<<1^e[2]>>>31,e[2]<<1^e[3]>>>31,e[3]<<1^(e[0]>>>31)*135]}},sjcl.misc.hmac=function(e,t){this.M=t=t||sjcl.hash.sha256;var n=[[],[]],r=t.prototype.blockSize/32;this.l=[new t,new t],e.length>r&&(e=t.hash(e));for(t=0;t<r;t++)n[0][t]=e[t]^909522486,n[1][t]=e[t]^1549556828;this.l[0].update(n[0]),this.l[1].update(n[1])},sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(e,t){return e=(new this.M(this.l[0])).update(e,t).finalize(),(new this.M(this.l[1])).update(e).finalize()},sjcl.misc.pbkdf2=function(e,t,n,r,i){n=n||1e3;if(r<0||n<0)throw sjcl.exception.invalid("invalid params to pbkdf2");typeof e=="string"&&(e=sjcl.codec.utf8String.toBits(e)),i=i||sjcl.misc.hmac,e=new i(e);var s,o,u,a,f=[],l=sjcl.bitArray;for(a=1;32*f.length<(r||1);a++){i=s=e.encrypt(l.concat(t,[a]));for(o=1;o<n;o++){s=e.encrypt(s);for(u=0;u<s.length;u++)i[u]^=s[u]}f=f.concat(i)}return r&&(f=l.clamp(f,r)),f},sjcl.random={randomWords:function(e,t){var n=[];t=this.isReady(t);var r;if(t===0)throw new sjcl.exception.notReady("generator isn't seeded");t&2&&this.U(!(t&1));for(t=0;t<e;t+=4)(t+1)%65536===0&&this.L(),r=this.w(),n.push(r[0],r[1],r[2],r[3]);return this.L(),n.slice(0,e)},setDefaultParanoia:function(e){this.t=e},addEntropy:function(e,t,n){n=n||"user";var r,i,s=(new Date).valueOf(),o=this.q[n],u=this.isReady(),a=0;r=this.G[n],r===undefined&&(r=this.G[n]=this.R++),o===undefined&&(o=this.q[n]=0),this.q[n]=(this.q[n]+1)%this.b.length;switch(typeof e){case"number":t===undefined&&(t=1),this.b[o].update([r,this.u++,1,t,s,1,e|0]);break;case"object":n=Object.prototype.toString.call(e);if(n==="[object Uint32Array]"){i=[];for(n=0;n<e.length;n++)i.push(e[n]);e=i}else{n!=="[object Array]"&&(a=1);for(n=0;n<e.length&&!a;n++)typeof e[n]!="number"&&(a=1)}if(!a){if(t===undefined)for(n=t=0;n<e.length;n++)for(i=e[n];i>0;)t++,i>>>=1;this.b[o].update([r,this.u++,2,t,s,e.length].concat(e))}break;case"string":t===undefined&&(t=e.length),this.b[o].update([r,this.u++,3,t,s,e.length]),this.b[o].update(e);break;default:a=1}if(a)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.j[o]+=t,this.f+=t,u===0&&(this.isReady()!==0&&this.K("seeded",Math.max(this.g,this.f)),this.K("progress",this.getProgress()))},isReady:function(e){return e=this.C[e!==undefined?e:this.t],this.g&&this.g>=e?this.j[0]>80&&(new Date).valueOf()>this.O?3:1:this.f>=e?2:0},getProgress:function(e){return e=this.C[e?e:this.t],this.g>=e?1:this.f>e?1:this.f/e},startCollectors:function(){if(!this.m){if(window.addEventListener)window.addEventListener("load",this.o,!1),window.addEventListener("mousemove",this.p,!1);else{if(!document.attachEvent)throw new sjcl.exception.bug("can't attach event");document.attachEvent("onload",this.o),document.attachEvent("onmousemove",this.p)}this.m=!0}},stopCollectors:function(){this.m&&(window.removeEventListener?(window.removeEventListener("load",this.o,!1),window.removeEventListener("mousemove",this.p,!1)):window.detachEvent&&(window.detachEvent("onload",this.o),window.detachEvent("onmousemove",this.p)),this.m=!1)},addEventListener:function(e,t){this.r[e][this.Q++]=t},removeEventListener:function(e,t){var n;e=this.r[e];var r=[];for(n in e)e.hasOwnProperty(n)&&e[n]===t&&r.push(n);for(t=0;t<r.length;t++)n=r[t],delete e[n]},b:[new sjcl.hash.sha256],j:[0],A:0,q:{},u:0,G:{},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:!1,r:{progress:{},seeded:{}},Q:0,C:[0,48,64,96,128,192,256,384,512,768,1024],w:function(){for(var e=0;e<4;e++){this.d[e]=this.d[e]+1|0;if(this.d[e])break}return this.s.encrypt(this.d)},L:function(){this.a=this.w().concat(this.w()),this.s=new sjcl.cipher.aes(this.a)},T:function(e){this.a=sjcl.hash.sha256.hash(this.a.concat(e)),this.s=new sjcl.cipher.aes(this.a);for(e=0;e<4;e++){this.d[e]=this.d[e]+1|0;if(this.d[e])break}},U:function(e){var t=[],n=0,r;this.O=t[0]=(new Date).valueOf()+3e4;for(r=0;r<16;r++)t.push(Math.random()*4294967296|0);for(r=0;r<this.b.length;r++){t=t.concat(this.b[r].finalize()),n+=this.j[r],this.j[r]=0;if(!e&&this.A&1<<r)break}this.A>=1<<this.b.length&&(this.b.push(new sjcl.hash.sha256),this.j.push(0)),this.f-=n,n>this.g&&(this.g=n),this.A++,this.T(t)},p:function(e){sjcl.random.addEntropy([e.x||e.clientX||e.offsetX||0,e.y||e.clientY||e.offsetY||0],2,"mouse")},o:function(){sjcl.random.addEntropy((new Date).valueOf(),2,"loadtime")},K:function(e,t){var n;e=sjcl.random.r[e];var r=[];for(n in e)e.hasOwnProperty(n)&&r.push(e[n]);for(n=0;n<r.length;n++)r[n](t)}};try{var s=new Uint32Array(32);crypto.getRandomValues(s),sjcl.random.addEntropy(s,1024,"crypto['getRandomValues']")}catch(t){}sjcl.json={defaults:{v:1,iter:1e3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},encrypt:function(e,t,n,r){n=n||{},r=r||{};var i=sjcl.json,s=i.c({iv:sjcl.random.randomWords(4,0)},i.defaults),o;i.c(s,n),n=s.adata,typeof s.salt=="string"&&(s.salt=sjcl.codec.base64.toBits(s.salt)),typeof s.iv=="string"&&(s.iv=sjcl.codec.base64.toBits(s.iv));if(!sjcl.mode[s.mode]||!sjcl.cipher[s.cipher]||typeof e=="string"&&s.iter<=100||s.ts!==64&&s.ts!==96&&s.ts!==128||s.ks!==128&&s.ks!==192&&s.ks!==256||s.iv.length<2||s.iv.length>4)throw new sjcl.exception.invalid("json encrypt: invalid parameters");return typeof e=="string"&&(o=sjcl.misc.cachedPbkdf2(e,s),e=o.key.slice(0,s.ks/32),s.salt=o.salt),typeof t=="string"&&(t=sjcl.codec.utf8String.toBits(t)),typeof n=="string"&&(n=sjcl.codec.utf8String.toBits(n)),o=new sjcl.cipher[s.cipher](e),i.c(r,s),r.key=e,s.ct=sjcl.mode[s.mode].encrypt(o,t,s.iv,n,s.ts),i.encode(s)},decrypt:function(e,t,n,r){n=n||{},r=r||{};var i=sjcl.json;t=i.c(i.c(i.c({},i.defaults),i.decode(t)),n,!0);var s;n=t.adata,typeof t.salt=="string"&&(t.salt=sjcl.codec.base64.toBits(t.salt)),typeof t.iv=="string"&&(t.iv=sjcl.codec.base64.toBits(t.iv));if(!sjcl.mode[t.mode]||!sjcl.cipher[t.cipher]||typeof e=="string"&&t.iter<=100||t.ts!==64&&t.ts!==96&&t.ts!==128||t.ks!==128&&t.ks!==192&&t.ks!==256||!t.iv||t.iv.length<2||t.iv.length>4)throw new sjcl.exception.invalid("json decrypt: invalid parameters");return typeof e=="string"&&(s=sjcl.misc.cachedPbkdf2(e,t),e=s.key.slice(0,t.ks/32),t.salt=s.salt),typeof n=="string"&&(n=sjcl.codec.utf8String.toBits(n)),s=new sjcl.cipher[t.cipher](e),n=sjcl.mode[t.mode].decrypt(s,t.ct,t.iv,n,t.ts),i.c(r,t),r.key=e,sjcl.codec.utf8String.fromBits(n)},encode:function(e){var t,n="{",r="";for(t in e)if(e.hasOwnProperty(t)){if(!t.match(/^[a-z0-9]+$/i))throw new sjcl.exception.invalid("json encode: invalid property name");n+=r+'"'+t+'":',r=",";switch(typeof e[t]){case"number":case"boolean":n+=e[t];break;case"string":n+='"'+escape(e[t])+'"';break;case"object":n+='"'+sjcl.codec.base64.fromBits(e[t],1)+'"';break;default:throw new sjcl.exception.bug("json encode: unsupported type")}}return n+"}"},decode:function(e){e=e.replace(/\s/g,"");if(!e.match(/^\{.*\}$/))throw new sjcl.exception.invalid("json decode: this isn't json!");e=e.replace(/^\{|\}$/g,"").split(/,/);var t={},n,r;for(n=0;n<e.length;n++){if(!(r=e[n].match(/^(?:(["']?)([a-z][a-z0-9]*)\1):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i)))throw new sjcl.exception.invalid("json decode: this isn't json!");t[r[2]]=r[3]?parseInt(r[3],10):r[2].match(/^(ct|salt|iv)$/)?sjcl.codec.base64.toBits(r[4]):unescape(r[4])}return t},c:function(e,t,n){e===undefined&&(e={});if(t===undefined)return e;var r;for(r in t)if(t.hasOwnProperty(r)){if(n&&e[r]!==undefined&&e[r]!==t[r])throw new sjcl.exception.invalid("required parameter overridden");e[r]=t[r]}return e},W:function(e,t){var n={},r;for(r in e)e.hasOwnProperty(r)&&e[r]!==t[r]&&(n[r]=e[r]);return n},V:function(e,t){var n={},r;for(r=0;r<t.length;r++)e[t[r]]!==undefined&&(n[t[r]]=e[t[r]]);return n}},sjcl.encrypt=sjcl.json.encrypt,sjcl.decrypt=sjcl.json.decrypt,sjcl.misc.S={},sjcl.misc.cachedPbkdf2=function(e,t){var n=sjcl.misc.S,r;return t=t||{},r=t.iter||1e3,n=n[e]=n[e]||{},r=n[r]=n[r]||{firstSalt:t.salt&&t.salt.length?t.salt.slice(0):sjcl.random.randomWords(2,0)},n=t.salt===undefined?r.firstSalt:t.salt,r[n]=r[n]||sjcl.misc.pbkdf2(e,n,t.iter),{key:r[n].slice(0),salt:n.slice(0)}},define("sjcl",function(){});var Base64=function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",t={encode:function(t){var n="",r,i,s,o,u,a,f,l=0;do r=t.charCodeAt(l++),i=t.charCodeAt(l++),s=t.charCodeAt(l++),o=r>>2,u=(r&3)<<4|i>>4,a=(i&15)<<2|s>>6,f=s&63,isNaN(i)?a=f=64:isNaN(s)&&(f=64),n=n+e.charAt(o)+e.charAt(u)+e.charAt(a)+e.charAt(f);while(l<t.length);return n},decode:function(t){var n="",r,i,s,o,u,a,f,l=0;t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");do o=e.indexOf(t.charAt(l++)),u=e.indexOf(t.charAt(l++)),a=e.indexOf(t.charAt(l++)),f=e.indexOf(t.charAt(l++)),r=o<<2|u>>4,i=(u&15)<<4|a>>2,s=(a&3)<<6|f,n+=String.fromCharCode(r),a!=64&&(n+=String.fromCharCode(i)),f!=64&&(n+=String.fromCharCode(s));while(l<t.length);return n}};return t}(),hexcase=0,b64pad="=",chrsz=8,MD5=function(){var e=0,t="",n=8,r=function(e,t){var n=(e&65535)+(t&65535),r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535},i=function(e,t){return e<<t|e>>>32-t},s=function(e){var t=[],r=(1<<n)-1;for(var i=0;i<e.length*n;i+=n)t[i>>5]|=(e.charCodeAt(i/n)&r)<<i%32;return t},o=function(e){var t="",r=(1<<n)-1;for(var i=0;i<e.length*32;i+=n)t+=String.fromCharCode(e[i>>5]>>>i%32&r);return t},u=function(t){var n=e?"0123456789ABCDEF":"0123456789abcdef",r="";for(var i=0;i<t.length*4;i++)r+=n.charAt(t[i>>2]>>i%4*8+4&15)+n.charAt(t[i>>2]>>i%4*8&15);return r},a=function(e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="",i,s;for(var o=0;o<e.length*4;o+=3){i=(e[o>>2]>>8*(o%4)&255)<<16|(e[o+1>>2]>>8*((o+1)%4)&255)<<8|e[o+2>>2]>>8*((o+2)%4)&255;for(s=0;s<4;s++)o*8+s*6>e.length*32?r+=t:r+=n.charAt(i>>6*(3-s)&63)}return r},f=function(e,t,n,s,o,u){return r(i(r(r(t,e),r(s,u)),o),n)},l=function(e,t,n,r,i,s,o){return f(t&n|~t&r,e,t,i,s,o)},c=function(e,t,n,r,i,s,o){return f(t&r|n&~r,e,t,i,s,o)},h=function(e,t,n,r,i,s,o){return f(t^n^r,e,t,i,s,o)},p=function(e,t,n,r,i,s,o){return f(n^(t|~r),e,t,i,s,o)},d=function(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;var n=1732584193,i=-271733879,s=-1732584194,o=271733878,u,a,f,d;for(var v=0;v<e.length;v+=16)u=n,a=i,f=s,d=o,n=l(n,i,s,o,e[v+0],7,-680876936),o=l(o,n,i,s,e[v+1],12,-389564586),s=l(s,o,n,i,e[v+2],17,606105819),i=l(i,s,o,n,e[v+3],22,-1044525330),n=l(n,i,s,o,e[v+4],7,-176418897),o=l(o,n,i,s,e[v+5],12,1200080426),s=l(s,o,n,i,e[v+6],17,-1473231341),i=l(i,s,o,n,e[v+7],22,-45705983),n=l(n,i,s,o,e[v+8],7,1770035416),o=l(o,n,i,s,e[v+9],12,-1958414417),s=l(s,o,n,i,e[v+10],17,-42063),i=l(i,s,o,n,e[v+11],22,-1990404162),n=l(n,i,s,o,e[v+12],7,1804603682),o=l(o,n,i,s,e[v+13],12,-40341101),s=l(s,o,n,i,e[v+14],17,-1502002290),i=l(i,s,o,n,e[v+15],22,1236535329),n=c(n,i,s,o,e[v+1],5,-165796510),o=c(o,n,i,s,e[v+6],9,-1069501632),s=c(s,o,n,i,e[v+11],14,643717713),i=c(i,s,o,n,e[v+0],20,-373897302),n=c(n,i,s,o,e[v+5],5,-701558691),o=c(o,n,i,s,e[v+10],9,38016083),s=c(s,o,n,i,e[v+15],14,-660478335),i=c(i,s,o,n,e[v+4],20,-405537848),n=c(n,i,s,o,e[v+9],5,568446438),o=c(o,n,i,s,e[v+14],9,-1019803690),s=c(s,o,n,i,e[v+3],14,-187363961),i=c(i,s,o,n,e[v+8],20,1163531501),n=c(n,i,s,o,e[v+13],5,-1444681467),o=c(o,n,i,s,e[v+2],9,-51403784),s=c(s,o,n,i,e[v+7],14,1735328473),i=c(i,s,o,n,e[v+12],20,-1926607734),n=h(n,i,s,o,e[v+5],4,-378558),o=h(o,n,i,s,e[v+8],11,-2022574463),s=h(s,o,n,i,e[v+11],16,1839030562),i=h(i,s,o,n,e[v+14],23,-35309556),n=h(n,i,s,o,e[v+1],4,-1530992060),o=h(o,n,i,s,e[v+4],11,1272893353),s=h(s,o,n,i,e[v+7],16,-155497632),i=h(i,s,o,n,e[v+10],23,-1094730640),n=h(n,i,s,o,e[v+13],4,681279174),o=h(o,n,i,s,e[v+0],11,-358537222),s=h(s,o,n,i,e[v+3],16,-722521979),i=h(i,s,o,n,e[v+6],23,76029189),n=h(n,i,s,o,e[v+9],4,-640364487),o=h(o,n,i,s,e[v+12],11,-421815835),s=h(s,o,n,i,e[v+15],16,530742520),i=h(i,s,o,n,e[v+2],23,-995338651),n=p(n,i,s,o,e[v+0],6,-198630844),o=p(o,n,i,s,e[v+7],10,1126891415),s=p(s,o,n,i,e[v+14],15,-1416354905),i=p(i,s,o,n,e[v+5],21,-57434055),n=p(n,i,s,o,e[v+12],6,1700485571),o=p(o,n,i,s,e[v+3],10,-1894986606),s=p(s,o,n,i,e[v+10],15,-1051523),i=p(i,s,o,n,e[v+1],21,-2054922799),n=p(n,i,s,o,e[v+8],6,1873313359),o=p(o,n,i,s,e[v+15],10,-30611744),s=p(s,o,n,i,e[v+6],15,-1560198380),i=p(i,s,o,n,e[v+13],21,1309151649),n=p(n,i,s,o,e[v+4],6,-145523070),o=p(o,n,i,s,e[v+11],10,-1120210379),s=p(s,o,n,i,e[v+2],15,718787259),i=p(i,s,o,n,e[v+9],21,-343485551),n=r(n,u),i=r(i,a),s=r(s,f),o=r(o,d);return[n,i,s,o]},v=function(e,t){var r=s(e);r.length>16&&(r=d(r,e.length*n));var i=new Array(16),o=new Array(16);for(var u=0;u<16;u++)i[u]=r[u]^909522486,o[u]=r[u]^1549556828;var a=d(i.concat(s(t)),512+t.length*n);return d(o.concat(a),640)},m={hexdigest:function(e){return u(d(s(e),e.length*n))},b64digest:function(e){return a(d(s(e),e.length*n))},hash:function(e){return o(d(s(e),e.length*n))},hmac_hexdigest:function(e,t){return u(v(e,t))},hmac_b64digest:function(e,t){return a(v(e,t))},hmac_hash:function(e,t){return o(v(e,t))},test:function(){return MD5.hexdigest("abc")==="900150983cd24fb0d6963f7d28e17f72"}};return m}();Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice,r=Array.prototype.concat,i=n.call(arguments,1);return function(){return t.apply(e?e:this,r.call(i,n.call(arguments,0)))}}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){var t=this.length,n=Number(arguments[1])||0;n=n<0?Math.ceil(n):Math.floor(n),n<0&&(n+=t);for(;n<t;n++)if(n in this&&this[n]===e)return n;return-1}),function(e){function n(e,n){return new t.Builder(e,n)}function r(e){return new t.Builder("message",e)}function s(e){return new t.Builder("iq",e)}function o(e){return new t.Builder("presence",e)}var t;t={VERSION:"e9eced8",NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",BOSH:"urn:xmpp:xbosh",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session",VERSION:"jabber:iq:version",STANZAS:"urn:ietf:params:xml:ns:xmpp-stanzas",XHTML_IM:"http://jabber.org/protocol/xhtml-im",XHTML:"http://www.w3.org/1999/xhtml"},XHTML:{tags:["a","blockquote","br","cite","em","img","li","ol","p","span","strong","ul","body"],attributes:{a:["href"],blockquote:["style"],br:[],cite:["style"],em:[],img:["src","alt","style","height","width"],li:["style"],ol:["style"],p:["style"],span:["style"],strong:[],ul:["style"],body:[]},css:["background-color","color","font-family","font-size","font-style","font-weight","margin-left","margin-right","text-align","text-decoration"],validTag:function(e){for(var n=0;n<t.XHTML.tags.length;n++)if(e==t.XHTML.tags[n])return!0;return!1},validAttribute:function(e,n){if(typeof t.XHTML.attributes[e]!="undefined"&&t.XHTML.attributes[e].length>0)for(var r=0;r<t.XHTML.attributes[e].length;r++)if(n==t.XHTML.attributes[e][r])return!0;return!1},validCSS:function(e){for(var n=0;n<t.XHTML.css.length;n++)if(e==t.XHTML.css[n])return!0;return!1}},addNamespace:function(e,n){t.NS[e]=n},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7,ATTACHED:8},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3,CDATA:4,FRAGMENT:11},TIMEOUT:1.1,SECONDARY_TIMEOUT:.1,forEachChild:function(e,n,r){var i,s;for(i=0;i<e.childNodes.length;i++)s=e.childNodes[i],s.nodeType==t.ElementType.NORMAL&&(!n||this.isTagEqual(s,n))&&r(s)},isTagEqual:function(e,t){return e.tagName.toLowerCase()==t.toLowerCase()},_xmlGenerator:null,_makeGenerator:function(){var e;return document.implementation.createDocument===undefined||document.implementation.createDocument&&document.documentMode&&document.documentMode<10?(e=this._getIEXmlDom(),e.appendChild(e.createElement("strophe"))):e=document.implementation.createDocument("jabber:client","strophe",null),e},xmlGenerator:function(){return t._xmlGenerator||(t._xmlGenerator=t._makeGenerator()),t._xmlGenerator},_getIEXmlDom:function(){var e=null,t=["Msxml2.DOMDocument.6.0","Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","MSXML2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(var n=0;n<t.length;n++){if(e!==null)break;try{e=new ActiveXObject(t[n])}catch(r){e=null}}return e},xmlElement:function(e){if(!e)return null;var n=t.xmlGenerator().createElement(e),r,i,s;for(r=1;r<arguments.length;r++){if(!arguments[r])continue;if(typeof arguments[r]=="string"||typeof arguments[r]=="number")n.appendChild(t.xmlTextNode(arguments[r]));else if(typeof arguments[r]=="object"&&typeof arguments[r].sort=="function")for(i=0;i<arguments[r].length;i++)typeof arguments[r][i]=="object"&&typeof arguments[r][i].sort=="function"&&n.setAttribute(arguments[r][i][0],arguments[r][i][1]);else if(typeof arguments[r]=="object")for(s in arguments[r])arguments[r].hasOwnProperty(s)&&n.setAttribute(s,arguments[r][s])}return n},xmlescape:function(e){return e=e.replace(/\&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/'/g,"'"),e=e.replace(/"/g,"""),e},xmlTextNode:function(e){return t.xmlGenerator().createTextNode(e)},xmlHtmlNode:function(e){return window.DOMParser?(parser=new DOMParser,node=parser.parseFromString(e,"text/xml")):(node=new ActiveXObject("Microsoft.XMLDOM"),node.async="false",node.loadXML(e)),node},getText:function(e){if(!e)return null;var n="";e.childNodes.length===0&&e.nodeType==t.ElementType.TEXT&&(n+=e.nodeValue);for(var r=0;r<e.childNodes.length;r++)e.childNodes[r].nodeType==t.ElementType.TEXT&&(n+=e.childNodes[r].nodeValue);return t.xmlescape(n)},copyElement:function(e){var n,r;if(e.nodeType==t.ElementType.NORMAL){r=t.xmlElement(e.tagName);for(n=0;n<e.attributes.length;n++)r.setAttribute(e.attributes[n].nodeName.toLowerCase(),e.attributes[n].value);for(n=0;n<e.childNodes.length;n++)r.appendChild(t.copyElement(e.childNodes[n]))}else e.nodeType==t.ElementType.TEXT&&(r=t.xmlGenerator().createTextNode(e.nodeValue));return r},createHtml:function(e){var n,r,i,s,o,u,a,f,l,c,h,p,d;if(e.nodeType==t.ElementType.NORMAL){s=e.nodeName.toLowerCase();if(t.XHTML.validTag(s))try{r=t.xmlElement(s);for(n=0;n<t.XHTML.attributes[s].length;n++){o=t.XHTML.attributes[s][n],u=e.getAttribute(o);if(typeof u=="undefined"||u===null||u===""||u===!1||u===0)continue;o=="style"&&typeof u=="object"&&typeof u.cssText!="undefined"&&(u=u.cssText);if(o=="style"){a=[],f=u.split(";");for(i=0;i<f.length;i++)l=f[i].split(":"),c=l[0].replace(/^\s*/,"").replace(/\s*$/,"").toLowerCase(),t.XHTML.validCSS(c)&&(h=l[1].replace(/^\s*/,"").replace(/\s*$/,""),a.push(c+": "+h));a.length>0&&(u=a.join("; "),r.setAttribute(o,u))}else r.setAttribute(o,u)}for(n=0;n<e.childNodes.length;n++)r.appendChild(t.createHtml(e.childNodes[n]))}catch(v){r=t.xmlTextNode("")}else{r=t.xmlGenerator().createDocumentFragment();for(n=0;n<e.childNodes.length;n++)r.appendChild(t.createHtml(e.childNodes[n]))}}else if(e.nodeType==t.ElementType.FRAGMENT){r=t.xmlGenerator().createDocumentFragment();for(n=0;n<e.childNodes.length;n++)r.appendChild(t.createHtml(e.childNodes[n]))}else e.nodeType==t.ElementType.TEXT&&(r=t.xmlTextNode(e.nodeValue));return r},escapeNode:function(e){return e.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(e){return e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(e){return e.indexOf("@")<0?null:e.split("@")[0]},getDomainFromJid:function(e){var n=t.getBareJidFromJid(e);if(n.indexOf("@")<0)return n;var r=n.split("@");return r.splice(0,1),r.join("@")},getResourceFromJid:function(e){var t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:function(e){return e?e.split("/")[0]:null},log:function(e,t){return},debug:function(e){this.log(this.LogLevel.DEBUG,e)},info:function(e){this.log(this.LogLevel.INFO,e)},warn:function(e){this.log(this.LogLevel.WARN,e)},error:function(e){this.log(this.LogLevel.ERROR,e)},fatal:function(e){this.log(this.LogLevel.FATAL,e)},serialize:function(e){var n;if(!e)return null;typeof e.tree=="function"&&(e=e.tree());var r=e.nodeName,i,s;e.getAttribute("_realname")&&(r=e.getAttribute("_realname")),n="<"+r;for(i=0;i<e.attributes.length;i++)e.attributes[i].nodeName!="_realname"&&(n+=" "+e.attributes[i].nodeName.toLowerCase()+"='"+e.attributes[i].value.replace(/&/g,"&").replace(/\'/g,"'").replace(/>/g,">").replace(/</g,"<")+"'");if(e.childNodes.length>0){n+=">";for(i=0;i<e.childNodes.length;i++){s=e.childNodes[i];switch(s.nodeType){case t.ElementType.NORMAL:n+=t.serialize(s);break;case t.ElementType.TEXT:n+=t.xmlescape(s.nodeValue);break;case t.ElementType.CDATA:n+="<![CDATA["+s.nodeValue+"]]>"}}n+="</"+r+">"}else n+="/>";return n},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(e,n){t._connectionPlugins[e]=n}},t.Builder=function(e,n){if(e=="presence"||e=="message"||e=="iq")n&&!n.xmlns?n.xmlns=t.NS.CLIENT:n||(n={xmlns:t.NS.CLIENT});this.nodeTree=t.xmlElement(e,n),this.node=this.nodeTree},t.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return t.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},attrs:function(e){for(var t in e)e.hasOwnProperty(t)&&this.node.setAttribute(t,e[t]);return this},c:function(e,n,r){var i=t.xmlElement(e,n,r);return this.node.appendChild(i),r||(this.node=i),this},cnode:function(e){var n=t.xmlGenerator();try{var r=n.importNode!==undefined}catch(i){var r=!1}var s=r?n.importNode(e,!0):t.copyElement(e);return this.node.appendChild(s),this.node=s,this},t:function(e){var n=t.xmlTextNode(e);return this.node.appendChild(n),this},h:function(e){var n=document.createElement("body");n.innerHTML=e;var r=t.createHtml(n);while(r.childNodes.length>0)this.node.appendChild(r.childNodes[0]);return this}},t.Handler=function(e,n,r,i,s,o,u){this.handler=e,this.ns=n,this.name=r,this.type=i,this.id=s,this.options=u||{matchbare:!1},this.options.matchBare||(this.options.matchBare=!1),this.options.matchBare?this.from=o?t.getBareJidFromJid(o):null:this.from=o,this.user=!0},t.Handler.prototype={isMatch:function(e){var n,r=null;this.options.matchBare?r=t.getBareJidFromJid(e.getAttribute("from")):r=e.getAttribute("from"),n=!1;if(!this.ns)n=!0;else{var i=this;t.forEachChild(e,null,function(e){e.getAttribute("xmlns")==i.ns&&(n=!0)}),n=n||e.getAttribute("xmlns")==this.ns}return!n||!!this.name&&!t.isTagEqual(e,this.name)||!!this.type&&e.getAttribute("type")!=this.type||!!this.id&&e.getAttribute("id")!=this.id||!!this.from&&r!=this.from?!1:!0},run:function(e){var n=null;try{n=this.handler(e)}catch(r){throw r.sourceURL?t.fatal("error: "+this.handler+" "+r.sourceURL+":"+r.line+" - "+r.name+": "+r.message):r.fileName?(typeof console!="undefined"&&(console.trace(),console.error(this.handler," - error - ",r,r.message)),t.fatal("error: "+this.handler+" "+r.fileName+":"+r.lineNumber+" - "+r.name+": "+r.message)):t.fatal("error: "+r.message+"\n"+r.stack),r}return n},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},t.TimedHandler=function(e,t){this.period=e,this.handler=t,this.lastCalled=(new Date).getTime(),this.user=!0},t.TimedHandler.prototype={run:function(){return this.lastCalled=(new Date).getTime(),this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},t.Request=function(e,n,r,i){this.id=++t._requestId,this.xmlData=e,this.data=t.serialize(e),this.origFunc=n,this.func=n,this.rid=r,this.date=NaN,this.sends=i||0,this.abort=!1,this.dead=null,this.age=function(){if(!this.date)return 0;var e=new Date;return(e-this.date)/1e3},this.timeDead=function(){if(!this.dead)return 0;var e=new Date;return(e-this.dead)/1e3},this.xhr=this._newXHR()},t.Request.prototype={getResponse:function(){var e=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){e=this.xhr.responseXML.documentElement;if(e.tagName=="parsererror")throw t.error("invalid response received"),t.error("responseText: "+this.xhr.responseText),t.error("responseXML: "+t.serialize(this.xhr.responseXML)),"parsererror"}else this.xhr.responseText&&(t.error("invalid response received"),t.error("responseText: "+this.xhr.responseText),t.error("responseXML: "+t.serialize(this.xhr.responseXML)));return e},_newXHR:function(){var e=null;return window.XMLHttpRequest?(e=new XMLHttpRequest,e.overrideMimeType&&e.overrideMimeType("text/xml")):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLHTTP")),e.onreadystatechange=this.func.bind(null,this),e}},t.Connection=function(e){this.service=e,this.jid="",this.domain=null,this.rid=Math.floor(Math.random()*4294967295),this.sid=null,this.streamId=null,this.features=null,this._sasl_data=[],this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this._idleTimeout=null,this._disconnectTimeout=null,this.do_authentication=!0,this.authenticated=!1,this.disconnecting=!1,this.connected=!1,this.errors=0,this.paused=!1,this.hold=1,this.wait=60,this.window=5,this._data=[],this._requests=[],this._uniqueId=Math.round(Math.random()*1e4),this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var n in t._connectionPlugins)if(t._connectionPlugins.hasOwnProperty(n)){var r=t._connectionPlugins[n],i=function(){};i.prototype=r,this[n]=new i,this[n].init(this)}},t.Connection.prototype={reset:function(){this.rid=Math.floor(Math.random()*4294967295),this.sid=null,this.streamId=null,this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this.authenticated=!1,this.disconnecting=!1,this.connected=!1,this.errors=0,this._requests=[],this._uniqueId=Math.round(Math.random()*1e4)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},getUniqueId:function(e){return typeof e=="string"||typeof e=="number"?++this._uniqueId+":"+e:++this._uniqueId+""},connect:function(e,n,r,i,s,o){this.jid=e,this.pass=n,this.connect_callback=r,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.errors=0,this.wait=i||this.wait,this.hold=s||this.hold,this.domain=this.domain||t.getDomainFromJid(this.jid);var u=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:this.wait,hold:this.hold,content:"text/xml; charset=utf-8",ver:"1.6","xmpp:version":"1.0","xmlns:xmpp":t.NS.BOSH});o&&u.attrs({route:o}),this._changeConnectStatus(t.Status.CONNECTING,null);var a=this._connect_callback||this._connect_cb;this._connect_callback=null,this._requests.push(new t.Request(u.tree(),this._onRequestStateChange.bind(this,a.bind(this)),u.tree().getAttribute("rid"))),this._throttledRequestHandler()},attach:function(e,n,r,i,s,o,u){this.jid=e,this.sid=n,this.rid=r,this.connect_callback=i,this.domain=t.getDomainFromJid(this.jid),this.authenticated=!0,this.connected=!0,this.wait=s||this.wait,this.hold=o||this.hold,this.window=u||this.window,this._changeConnectStatus(t.Status.ATTACHED,null)},xmlInput:function(e){return},xmlOutput:function(e){return},rawInput:function(e){return},rawOutput:function(e){return},send:function(e){if(e===null)return;if(typeof e.sort=="function")for(var t=0;t<e.length;t++)this._queueData(e[t]);else typeof e.tree=="function"?this._queueData(e.tree()):this._queueData(e);this._throttledRequestHandler(),clearTimeout(this._idleTimeout),this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},flush:function(){clearTimeout(this._idleTimeout),this._onIdle()},sendIQ:function(e,t,n,r){var i=null,s=this;typeof e.tree=="function"&&(e=e.tree());var o=e.getAttribute("id");o||(o=this.getUniqueId("sendIQ"),e.setAttribute("id",o));var u=this.addHandler(function(e){i&&s.deleteTimedHandler(i);var r=e.getAttribute("type");if(r=="result")t&&t(e);else{if(r!="error")throw{name:"StropheError",message:"Got bad IQ type of "+r};n&&n(e)}},null,"iq",null,o);return r&&(i=this.addTimedHandler(r,function(){return s.deleteHandler(u),n&&n(null),!1})),this.send(e),o},_queueData:function(e){if(e===null||!e.tagName||!e.childNodes)throw{name:"StropheError",message:"Cannot queue non-DOMElement."};this._data.push(e)},_sendRestart:function(){this._data.push("restart"),this._throttledRequestHandler(),clearTimeout(this._idleTimeout),this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(e,n){var r=new t.TimedHandler(e,n);return this.addTimeds.push(r),r},deleteTimedHandler:function(e){this.removeTimeds.push(e)},addHandler:function(e,n,r,i,s,o,u){var a=new t.Handler(e,n,r,i,s,o,u);return this.addHandlers.push(a),a},deleteHandler:function(e){this.removeHandlers.push(e)},disconnect:function(e){this._changeConnectStatus(t.Status.DISCONNECTING,e),t.info("Disconnect was called because: "+e),this.connected&&(this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._sendTerminate())},_changeConnectStatus:function(e,n){for(var r in t._connectionPlugins)if(t._connectionPlugins.hasOwnProperty(r)){var i=this[r];if(i.statusChanged)try{i.statusChanged(e,n)}catch(s){t.error(""+r+" plugin caused an exception "+"changing status: "+s)}}if(this.connect_callback)try{this.connect_callback(e,n)}catch(o){t.error("User connection callback caused an exception: "+o)}},_buildBody:function(){var e=n("body",{rid:this.rid++,xmlns:t.NS.HTTPBIND});return this.sid!==null&&e.attrs({sid:this.sid}),e},_removeRequest:function(e){t.debug("removing request");var n;for(n=this._requests.length-1;n>=0;n--)e==this._requests[n]&&this._requests.splice(n,1);e.xhr.onreadystatechange=function(){},this._throttledRequestHandler()},_restartRequest:function(e){var t=this._requests[e];t.dead===null&&(t.dead=new Date),this._processRequest(e)},_processRequest:function(e){var n=this._requests[e],r=-1;try{n.xhr.readyState==4&&(r=n.xhr.status)}catch(i){t.error("caught an error in _requests["+e+"], reqStatus: "+r)}typeof r=="undefined"&&(r=-1);if(n.sends>this.maxRetries){this._onDisconnectTimeout();return}var s=n.age(),o=!isNaN(s)&&s>Math.floor(t.TIMEOUT*this.wait),u=n.dead!==null&&n.timeDead()>Math.floor(t.SECONDARY_TIMEOUT*this.wait),a=n.xhr.readyState==4&&(r<1||r>=500);if(o||u||a)u&&t.error("Request "+this._requests[e].id+" timed out (secondary), restarting"),n.abort=!0,n.xhr.abort(),n.xhr.onreadystatechange=function(){},this._requests[e]=new t.Request(n.xmlData,n.origFunc,n.rid,n.sends),n=this._requests[e];if(n.xhr.readyState===0){t.debug("request id "+n.id+"."+n.sends+" posting");try{n.xhr.open("POST",this.service,!0)}catch(f){t.error("XHR open failed."),this.connected||this._changeConnectStatus(t.Status.CONNFAIL,"bad-service"),this.disconnect();return}var l=function(){n.date=new Date,n.xhr.send(n.data)};if(n.sends>1){var c=Math.min(Math.floor(t.TIMEOUT*this.wait),Math.pow(n.sends,3))*1e3;setTimeout(l,c)}else l();n.sends++,this.xmlOutput!==t.Connection.prototype.xmlOutput&&this.xmlOutput(n.xmlData),this.rawOutput!==t.Connection.prototype.rawOutput&&this.rawOutput(n.data)}else t.debug("_processRequest: "+(e===0?"first":"second")+" request has readyState of "+n.xhr.readyState)},_throttledRequestHandler:function(){this._requests?t.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):t.debug("_throttledRequestHandler called with undefined requests");if(!this._requests||this._requests.length===0)return;this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window&&this._processRequest(1)},_onRequestStateChange:function(e,n){t.debug("request id "+n.id+"."+n.sends+" state changed to "+n.xhr.readyState);if(n.abort){n.abort=!1;return}var r;if(n.xhr.readyState==4){r=0;try{r=n.xhr.status}catch(i){}typeof r=="undefined"&&(r=0);if(this.disconnecting&&r>=400){this._hitError(r);return}var s=this._requests[0]==n,o=this._requests[1]==n;if(r>0&&r<500||n.sends>5)this._removeRequest(n),t.debug("request id "+n.id+" should now be removed");if(r==200)(o||s&&this._requests.length>0&&this._requests[0].age()>Math.floor(t.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),t.debug("request id "+n.id+"."+n.sends+" got 200"),e(n),this.errors=0;else{t.error("request id "+n.id+"."+n.sends+" error "+r+" happened");if(r===0||r>=400&&r<600||r>=12e3)this._hitError(r),r>=400&&r<500&&(this._changeConnectStatus(t.Status.DISCONNECTING,null),this._doDisconnect())}r>0&&r<500||n.sends>5||this._throttledRequestHandler()}},_hitError:function(e){this.errors++,t.warn("request errored, status: "+e+", number of errors: "+this.errors),this.errors>4&&this._onDisconnectTimeout()},_doDisconnect:function(){t.info("_doDisconnect was called"),this.authenticated=!1,this.disconnecting=!1,this.sid=null,this.streamId=null,this.rid=Math.floor(Math.random()*4294967295),this.connected&&(this._changeConnectStatus(t.Status.DISCONNECTED,null),this.connected=!1),this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[]},_dataRecv:function(e){try{var n=e.getResponse()}catch(r){if(r!="parsererror")throw r;this.disconnect("strophe-parsererror")}if(n===null)return;this.xmlInput!==t.Connection.prototype.xmlInput&&this.xmlInput(n),this.rawInput!==t.Connection.prototype.rawInput&&this.rawInput(t.serialize(n));var i,s;while(this.removeHandlers.length>0)s=this.removeHandlers.pop(),i=this.handlers.indexOf(s),i>=0&&this.handlers.splice(i,1);while(this.addHandlers.length>0)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._requests.length===0){this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null,this._doDisconnect();return}var o=n.getAttribute("type"),u,a;if(o!==null&&o=="terminate"){if(this.disconnecting)return;u=n.getAttribute("condition"),a=n.getElementsByTagName("conflict"),u!==null?(u=="remote-stream-error"&&a.length>0&&(u="conflict"),this._changeConnectStatus(t.Status.CONNFAIL,u)):this._changeConnectStatus(t.Status.CONNFAIL,"unknown"),this.disconnect();return}var f=this;t.forEachChild(n,null,function(e){var t,n;n=f.handlers,f.handlers=[];for(t=0;t<n.length;t++){var r=n[t];try{r.isMatch(e)&&(f.authenticated||!r.user)?r.run(e)&&f.handlers.push(r):f.handlers.push(r)}catch(i){}}})},_sendTerminate:function(){t.info("_sendTerminate was called");var e=this._buildBody().attrs({type:"terminate"});this.authenticated&&e.c("presence",{xmlns:t.NS.CLIENT,type:"unavailable"}),this.disconnecting=!0;var n=new t.Request(e.tree(),this._onRequestStateChange.bind(this,this._dataRecv.bind(this)),e.tree().getAttribute("rid"));this._requests.push(n),this._throttledRequestHandler()},_connect_cb:function(e,n){t.info("_connect_cb was called"),this.connected=!0;var r=e.getResponse();if(!r)return;this.xmlInput!==t.Connection.prototype.xmlInput&&this.xmlInput(r),this.rawInput!==t.Connection.prototype.rawInput&&this.rawInput(t.serialize(r));var i=r.getAttribute("type"),s,o;if(i!==null&&i=="terminate"){s=r.getAttribute("condition"),o=r.getElementsByTagName("conflict"),s!==null?(s=="remote-stream-error"&&o.length>0&&(s="conflict"),this._changeConnectStatus(t.Status.CONNFAIL,s)):this._changeConnectStatus(t.Status.CONNFAIL,"unknown");return}this.sid||(this.sid=r.getAttribute("sid")),this.stream_id||(this.stream_id=r.getAttribute("authid"));var u=r.getAttribute("requests");u&&(this.window=parseInt(u,10));var a=r.getAttribute("hold");a&&(this.hold=parseInt(a,10));var f=r.getAttribute("wait");f&&(this.wait=parseInt(f,10)),this._authentication.sasl_scram_sha1=!1,this._authentication.sasl_plain=!1,this._authentication.sasl_digest_md5=!1,this._authentication.sasl_anonymous=!1,this._authentication.legacy_auth=!1;var l=r.getElementsByTagName("stream:features").length>0;l||(l=r.getElementsByTagName("features").length>0);var c=r.getElementsByTagName("mechanism"),h,p,d,v,m=!1;if(l&&c.length>0){var g=0;for(h=0;h<c.length;h++)p=t.getText(c[h]),p=="SCRAM-SHA-1"?this._authentication.sasl_scram_sha1=!0:p=="DIGEST-MD5"?this._authentication.sasl_digest_md5=!0:p=="PLAIN"?this._authentication.sasl_plain=!0:p=="ANONYMOUS"?this._authentication.sasl_anonymous=!0:g++;this._authentication.legacy_auth=r.getElementsByTagName("auth").length>0,m=this._authentication.legacy_auth||g<c.length}if(!m){n=n||this._connect_cb;var y=this._buildBody();this._requests.push(new t.Request(y.tree(),this._onRequestStateChange.bind(this,n.bind(this)),y.tree().getAttribute("rid"))),this._throttledRequestHandler();return}this.do_authentication!==!1&&this.authenticate()},authenticate:function(){if(t.getNodeFromJid(this.jid)===null&&this._authentication.sasl_anonymous)this._changeConnectStatus(t.Status.AUTHENTICATING,null),this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this.send(n("auth",{xmlns:t.NS.SASL,mechanism:"ANONYMOUS"}).tree());else if(t.getNodeFromJid(this.jid)===null)this._changeConnectStatus(t.Status.CONNFAIL,"x-strophe-bad-non-anon-jid"),this.disconnect();else if(this._authentication.sasl_scram_sha1){var e=MD5.hexdigest(Math.random()*1234567890),r="n="+t.getNodeFromJid(this.jid);r+=",r=",r+=e,this._sasl_data.cnonce=e,this._sasl_data["client-first-message-bare"]=r,r="n,,"+r,this._changeConnectStatus(t.Status.AUTHENTICATING,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_scram_challenge_cb.bind(this),null,"challenge",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this.send(n("auth",{xmlns:t.NS.SASL,mechanism:"SCRAM-SHA-1"}).t(Base64.encode(r)).tree())}else this._authentication.sasl_digest_md5?(this._changeConnectStatus(t.Status.AUTHENTICATING,null),this._sasl_challenge_handler=this._addSysHandler(this._sasl_digest_challenge1_cb.bind(this),null,"challenge",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this.send(n("auth",{xmlns:t.NS.SASL,mechanism:"DIGEST-MD5"}).tree())):this._authentication.sasl_plain?(r=t.getBareJidFromJid(this.jid),r+="\0",r+=t.getNodeFromJid(this.jid),r+="\0",r+=this.pass,this._changeConnectStatus(t.Status.AUTHENTICATING,null),this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),hashed_auth_str=Base64.encode(r),this.send(n("auth",{xmlns:t.NS.SASL,mechanism:"PLAIN"}).t(hashed_auth_str).tree())):(this._changeConnectStatus(t.Status.AUTHENTICATING,null),this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1"),this.send(s({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:t.NS.AUTH}).c("username",{}).t(t.getNodeFromJid(this.jid)).tree()))},_sasl_digest_challenge1_cb:function(e){var r=/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/,i=Base64.decode(t.getText(e)),s=MD5.hexdigest(""+Math.random()*1234567890),o="",u=null,a="",f="",l;this.deleteHandler(this._sasl_failure_handler);while(i.match(r)){l=i.match(r),i=i.replace(l[0],""),l[2]=l[2].replace(/^"(.+)"$/,"$1");switch(l[1]){case"realm":o=l[2];break;case"nonce":a=l[2];break;case"qop":f=l[2];break;case"host":u=l[2]}}var c="xmpp/"+this.domain;u!==null&&(c=c+"/"+u);var h=MD5.hash(t.getNodeFromJid(this.jid)+":"+o+":"+this.pass)+":"+a+":"+s,p="AUTHENTICATE:"+c,d="";return d+="username="+this._quote(t.getNodeFromJid(this.jid))+",",d+="realm="+this._quote(o)+",",d+="nonce="+this._quote(a)+",",d+="cnonce="+this._quote(s)+",",d+='nc="00000001",',d+='qop="auth",',d+="digest-uri="+this._quote(c)+",",d+="response="+this._quote(MD5.hexdigest(MD5.hexdigest(h)+":"+a+":00000001:"+s+":auth:"+MD5.hexdigest(p)))+",",d+='charset="utf-8"',this._sasl_challenge_handler=this._addSysHandler(this._sasl_digest_challenge2_cb.bind(this),null,"challenge",null,null),this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this.send(n("response",{xmlns:t.NS.SASL}).t(Base64.encode(d)).tree()),!1},_quote:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'},_sasl_digest_challenge2_cb:function(e){return this.deleteHandler(this._sasl_success_handler),this.deleteHandler(this._sasl_failure_handler),this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this.send(n("response",{xmlns:t.NS.SASL}).tree()),!1},_sasl_scram_challenge_cb:function(e){var r,s,o,u,a,f,l,c,h,p="c=biws,",d=Base64.decode(t.getText(e)),v=this._sasl_data["client-first-message-bare"]+","+d+",",m=this._sasl_data.cnonce,g=/([a-z]+)=([^,]+)(,|$)/;this.deleteHandler(this._sasl_failure_handler);while(d.match(g)){matches=d.match(g),d=d.replace(matches[0],"");switch(matches[1]){case"r":r=matches[2];break;case"s":s=matches[2];break;case"i":o=matches[2]}}if(r.substr(0,m.length)!==m)return this._sasl_data=[],this._sasl_failure_cb(null);p+="r="+r,v+=p,s=Base64.decode(s),s+="\0\0\0",u=f=core_hmac_sha1(this.pass,s);for(i=1;i<o;i++){a=core_hmac_sha1(this.pass,binb2str(f));for(k=0;k<5;k++)u[k]^=a[k];f=a}u=binb2str(u),l=core_hmac_sha1(u,"Client Key"),c=str_hmac_sha1(u,"Server Key"),h=core_hmac_sha1(str_sha1(binb2str(l)),v),this._sasl_data["server-signature"]=b64_hmac_sha1(c,v);for(k=0;k<5;k++)l[k]^=h[k];return p+=",p="+Base64.encode(binb2str(l)),this._sasl_success_handler=this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null),this._sasl_failure_handler=this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null),this.send(n("response",{xmlns:t.NS.SASL}).t(Base64.encode(p)).tree()),!1},_auth1_cb:function(e){var n=s({type:"set",id:"_auth_2"}).c("query",{xmlns:t.NS.AUTH}).c("username",{}).t(t.getNodeFromJid(this.jid)).up().c("password").t(this.pass);return t.getResourceFromJid(this.jid)||(this.jid=t.getBareJidFromJid(this.jid)+"/strophe"),n.up().c("resource",{}).t(t.getResourceFromJid(this.jid)),this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2"),this.send(n.tree()),!1},_sasl_success_cb:function(e){if(this._sasl_data["server-signature"]){var n,r=Base64.decode(t.getText(e)),i=/([a-z]+)=([^,]+)(,|$)/;matches=r.match(i),matches[1]=="v"&&(n=matches[2]);if(n!=this._sasl_data["server-signature"])return this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_data=[],this._sasl_failure_cb(null)}return t.info("SASL authentication succeeded."),this.deleteHandler(this._sasl_failure_handler),this._sasl_failure_handler=null,this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null),this._sendRestart(),!1},_sasl_auth1_cb:function(e){this.features=e;var n,r;for(n=0;n<e.childNodes.length;n++)r=e.childNodes[n],r.nodeName=="bind"&&(this.do_bind=!0),r.nodeName=="session"&&(this.do_session=!0);if(!this.do_bind)return this._changeConnectStatus(t.Status.AUTHFAIL,null),!1;this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");var i=t.getResourceFromJid(this.jid);return i?this.send(s({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:t.NS.BIND}).c("resource",{}).t(i).tree()):this.send(s({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:t.NS.BIND}).tree()),!1},_sasl_bind_cb:function(e){if(e.getAttribute("type")=="error"){t.info("SASL binding failed.");var n=e.getElementsByTagName("conflict"),r;return n.length>0&&(r="conflict"),this._changeConnectStatus(t.Status.AUTHFAIL,r),!1}var i=e.getElementsByTagName("bind"),o;if(!(i.length>0))return t.info("SASL binding failed."),this._changeConnectStatus(t.Status.AUTHFAIL,null),!1;o=i[0].getElementsByTagName("jid"),o.length>0&&(this.jid=t.getText(o[0]),this.do_session?(this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2"),this.send(s({type:"set",id:"_session_auth_2"}).c("session",{xmlns:t.NS.SESSION}).tree())):(this.authenticated=!0,this._changeConnectStatus(t.Status.CONNECTED,null)))},_sasl_session_cb:function(e){if(e.getAttribute("type")=="result")this.authenticated=!0,this._changeConnectStatus(t.Status.CONNECTED,null);else if(e.getAttribute("type")=="error")return t.info("Session creation failed."),this._changeConnectStatus(t.Status.AUTHFAIL,null),!1;return!1},_sasl_failure_cb:function(e){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._changeConnectStatus(t.Status.AUTHFAIL,null),!1},_auth2_cb:function(e){return e.getAttribute("type")=="result"?(this.authenticated=!0,this._changeConnectStatus(t.Status.CONNECTED,null)):e.getAttribute("type")=="error"&&(this._changeConnectStatus(t.Status.AUTHFAIL,null),this.disconnect()),!1},_addSysTimedHandler:function(e,n){var r=new t.TimedHandler(e,n);return r.user=!1,this.addTimeds.push(r),r},_addSysHandler:function(e,n,r,i,s){var o=new t.Handler(e,n,r,i,s);return o.user=!1,this.addHandlers.push(o),o},_onDisconnectTimeout:function(){t.info("_onDisconnectTimeout was called");var e;while(this._requests.length>0)e=this._requests.pop(),e.abort=!0,e.xhr.abort(),e.xhr.onreadystatechange=function(){};return this._doDisconnect(),!1},_onIdle:function(){var e,n,r,i;while(this.addTimeds.length>0)this.timedHandlers.push(this.addTimeds.pop());while(this.removeTimeds.length>0)n=this.removeTimeds.pop(),e=this.timedHandlers.indexOf(n),e>=0&&this.timedHandlers.splice(e,1);var s=(new Date).getTime();i=[];for(e=0;e<this.timedHandlers.length;e++){n=this.timedHandlers[e];if(this.authenticated||!n.user)r=n.lastCalled+n.period,r-s<=0?n.run()&&i.push(n):i.push(n)}this.timedHandlers=i;var o,u;this.authenticated&&this._requests.length===0&&this._data.length===0&&!this.disconnecting&&(t.info("no requests during idle cycle, sending blank request"),this._data.push(null));if(this._requests.length<2&&this._data.length>0&&!this.paused){o=this._buildBody();for(e=0;e<this._data.length;e++)this._data[e]!==null&&(this._data[e]==="restart"?o.attrs({to:this.domain,"xml:lang":"en","xmpp:restart":"true","xmlns:xmpp":t.NS.BOSH}):o.cnode(this._data[e]).up());delete this._data,this._data=[],this._requests.push(new t.Request(o.tree(),this._onRequestStateChange.bind(this,this._dataRecv.bind(this)),o.tree().getAttribute("rid"))),this._processRequest(this._requests.length-1)}this._requests.length>0&&(u=this._requests[0].age(),this._requests[0].dead!==null&&this._requests[0].timeDead()>Math.floor(t.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),u>Math.floor(t.TIMEOUT*this.wait)&&(t.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(t.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())),clearTimeout(this._idleTimeout),this.connected&&(this._idleTimeout=setTimeout(this._onIdle.bind(this),100))}},e&&e(t,n,r,s,o)}(function(){window.Strophe=arguments[0],window.$build=arguments[1],window.$msg=arguments[2],window.$iq=arguments[3],window.$pres=arguments[4]}),define("strophe",function(){}),function(e,t){if(typeof console===undefined||typeof console.log===undefined)console={log:function(){},error:function(){}};if(typeof define!="function"||!define.amd)return t(jQuery,console);define("strophe.muc",["strophe"],function(){if(console===undefined||console.log===undefined)console={log:function(){},error:function(){}};return t(jQuery,console)})}(this,function(e,t){(function(){var t,n,r,i=function(e,t){return function(){return e.apply(t,arguments)}};Strophe.addConnectionPlugin("muc",{_connection:null,rooms:[],init:function(e){return this._connection=e,this._muc_handler=null,Strophe.addNamespace("MUC_OWNER",Strophe.NS.MUC+"#owner"),Strophe.addNamespace("MUC_ADMIN",Strophe.NS.MUC+"#admin"),Strophe.addNamespace("MUC_USER",Strophe.NS.MUC+"#user"),Strophe.addNamespace("MUC_ROOMCONF",Strophe.NS.MUC+"#roomconfig")},join:function(e,t,n,i,s,o){var u,a,f=this;return a=this.test_append_nick(e,t),u=$pres({from:this._connection.jid,to:a}).c("x",{xmlns:Strophe.NS.MUC}),o!==null&&u.cnode(Strophe.xmlElement("password",[],o)),this._muc_handler===null&&(this._muc_handler=this._connection.addHandler(function(t){var n,r,i,s,o,u,a,l,c,h;n=t.getAttribute("from");if(!n)return!0;o=n.split("/")[0];if(!f.rooms[o])return!0;e=f.rooms[o],i={};if(t.nodeName==="message")i=e._message_handlers;else if(t.nodeName==="presence"){l=t.getElementsByTagName("x");if(l.length>0)for(c=0,h=l.length;c<h;c++){u=l[c],a=u.getAttribute("xmlns");if(a&&a.match(Strophe.NS.MUC)){i=e._presence_handlers;break}}}return _.each(i,function(n,r,i){n(t,e)||delete i[r]}),!0})),_.has(this.rooms,e)||(this.rooms[e]=new r(this,e,t,o)),i&&this.rooms[e].addHandler("presence",i),n&&this.rooms[e].addHandler("message",n),s&&this.rooms[e].addHandler("roster",s),this._connection.send(u)},removeRoom:function(e){delete this.rooms[e],this.rooms.length===0&&(this._connection.deleteHandler(this._muc_handler),this._muc_handler=null)},leave:function(e,t,n,r){var i,s,o;return this.removeRoom(e),o=this.test_append_nick(e,t),s=this._connection.getUniqueId(),i=$pres({type:"unavailable",id:s,from:this._connection.jid,to:o}),r!==null&&i.c("status",r),n!==null&&this._connection.addHandler(n,null,"presence",null,s),this._connection.send(i),s},message:function(e,t,n,r,i){var s,o,u,a;return a=this.test_append_nick(e,t),i=i||(t!==null?"chat":"groupchat"),o=this._connection.getUniqueId(),s=$msg({to:a,from:this._connection.jid,type:i,id:o}).c("body",{xmlns:Strophe.NS.CLIENT}).t(n),s.up(),r!==null&&(s.c("html",{xmlns:Strophe.NS.XHTML_IM}).c("body",{xmlns:Strophe.NS.XHTML}).h(r),s.node.childNodes.length===0?(u=s.node.parentNode,s.up().up(),s.node.removeChild(u)):s.up().up()),s.c("x",{xmlns:"jabber:x:event"}).c("composing"),this._connection.send(s),o},groupchat:function(e,t,n){return this.message(e,null,t,n)},invite:function(e,t,n){var r,i;return i=this._connection.getUniqueId(),r=$msg({from:this._connection.jid,to:e,id:i}).c("x",{xmlns:Strophe.NS.MUC_USER}).c("invite",{to:t}),n!==null&&r.c("reason",n),this._connection.send(r),i},directInvite:function(e,t,n,r){var i,s,o;return o=this._connection.getUniqueId(),i={xmlns:"jabber:x:conference",jid:e},n!==null&&(i.reason=n),r!==null&&(i.password=r),s=$msg({from:this._connection.jid,to:t,id:o}).c("x",i),this._connection.send(s),o},queryOccupants:function(e,t,n){var r,i;return r={xmlns:Strophe.NS.DISCO_ITEMS},i=$iq({from:this._connection.jid,to:e,type:"get"}).c("query",r),this._connection.sendIQ(i,t,n)},configure:function(e,t){var n,r,i;return n=$iq({to:e,type:"get"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}),i=n.tree(),r=this._connection.sendIQ(i),t!==null&&this._connection.addHandler(function(e){return t(e),!1},Strophe.NS.MUC_OWNER,"iq",null,r),r},cancelConfigure:function(e){var t,n;return t=$iq({to:e,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"cancel"}),n=t.tree(),this._connection.sendIQ(n)},saveConfiguration:function(e,t,n,r){var i,s,o,u,a;s=$iq({to:e,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"});for(u=0,a=t.length;u<a;u++)i=t[u],s.cnode(i).up();return o=s.tree(),this._connection.sendIQ(o,n,r)},createInstantRoom:function(e){var t;return t=$iq({to:e,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_OWNER}).c("x",{xmlns:"jabber:x:data",type:"submit"}),this._connection.sendIQ(t.tree())},setTopic:function(e,t){var n;return n=$msg({to:e,from:this._connection.jid,type:"groupchat"}).c("subject",{xmlns:"jabber:client"}).t(t),this._connection.send(n.tree())},_modifyPrivilege:function(e,t,n,r,i){var s;return s=$iq({to:e,type:"set"}).c("query",{xmlns:Strophe.NS.MUC_ADMIN}).cnode(t.node),n!==null&&s.c("reason",n),this._connection.sendIQ(s.tree(),r,i)},modifyRole:function(e,t,n,r,i,s){var o;return o=$build("item",{nick:t,role:n}),this._modifyPrivilege(e,o,r,i,s)},kick:function(e,t,n,r,i){return this.modifyRole(e,t,"none",n,r,i)},voice:function(e,t,n,r,i){return this.modifyRole(e,t,"participant",n,r,i)},mute:function(e,t,n,r,i){return this.modifyRole(e,t,"visitor",n,r,i)},op:function(e,t,n,r,i){return this.modifyRole(e,t,"moderator",n,r,i)},deop:function(e,t,n,r,i){return this.modifyRole(e,t,"participant",n,r,i)},modifyAffiliation:function(e,t,n,r,i,s){var o;return o=$build("item",{jid:t,affiliation:n}),this._modifyPrivilege(e,o,r,i,s)},ban:function(e,t,n,r,i){return this.modifyAffiliation(e,t,"outcast",n,r,i)},member:function(e,t,n,r,i){return this.modifyAffiliation(e,t,"member",n,r,i)},revoke:function(e,t,n,r,i){return this.modifyAffiliation(e,t,"none",n,r,i)},owner:function(e,t,n,r,i){return this.modifyAffiliation(e,t,"owner",n,r,i)},admin:function(e,t,n,r,i){return this.modifyAffiliation(e,t,"admin",n,r,i)},changeNick:function(e,t){var n,r;return r=this.test_append_nick(e,t),n=$pres({from:this._connection.jid,to:r,id:this._connection.getUniqueId()}),this._connection.send(n.tree())},setStatus:function(e,t,n,r){var i,s;return s=this.test_append_nick(e,t),i=$pres({from:this._connection.jid,to:s}),n!==null&&i.c("show",n).up(),r!==null&&i.c("status",r),this._connection.send(i.tree())},listRooms:function(e,t,n){var r;return r=$iq({to:e,from:this._connection.jid,type:"get"}).c("query",{xmlns:Strophe.NS.DISCO_ITEMS}),this._connection.sendIQ(r,t,n)},test_append_nick:function(e,t){return e+(t!==null?"/"+Strophe.escapeNode(t):"")}}),r=function(){function n(e,t,n,r){this.roster={},this._message_handlers={},this._presence_handlers={},this._roster_handlers={},this._handler_ids=0,this.client=e,this.name=t,this.nick=n,this.password=r,this._roomRosterHandler=i(this._roomRosterHandler,this),this._addOccupant=i(this._addOccupant,this),e.muc&&(this.client=e.muc),this.name=Strophe.getBareJidFromJid(t),this.client.rooms[this.name]=this,this.addHandler("presence",this._roomRosterHandler)}return n.prototype.join=function(e,t){if(!this.client.rooms[this.name])return this.client.join(this.name,this.nick,e,t,this.password)},n.prototype.leave=function(e,t){return this.client.leave(this.name,this.nick,e,t),delete this.client.rooms[this.name]},n.prototype.message=function(e,t,n,r){return this.client.message(this.name,e,t,n,r)},n.prototype.groupchat=function(e,t){return this.client.groupchat(this.name,e,t)},n.prototype.invite=function(e,t){return this.client.invite(this.name,e,t)},n.prototype.directInvite=function(e,t){return this.client.directInvite(this.name,e,t,this.password)},n.prototype.configure=function(e){return this.client.configure(this.name,e)},n.prototype.cancelConfigure=function(){return this.client.cancelConfigure(this.name)},n.prototype.saveConfiguration=function(e){return this.client.saveConfiguration(this.name,e)},n.prototype.queryOccupants=function(e,t){return this.client.queryOccupants(this.name,e,t)},n.prototype.setTopic=function(e){return this.client.setTopic(this.name,e)},n.prototype.modifyRole=function(e,t,n,r,i){return this.client.modifyRole(this.name,e,t,n,r,i)},n.prototype.kick=function(e,t,n,r){return this.client.kick(this.name,e,t,n,r)},n.prototype.voice=function(e,t,n,r){return this.client.voice(this.name,e,t,n,r)},n.prototype.mute=function(e,t,n,r){return this.client.mute(this.name,e,t,n,r)},n.prototype.op=function(e,t,n,r){return this.client.op(this.name,e,t,n,r)},n.prototype.deop=function(e,t,n,r){return this.client.deop(this.name,e,t,n,r)},n.prototype.modifyAffiliation=function(e,t,n,r,i){return this.client.modifyAffiliation(this.name,e,t,n,r,i)},n.prototype.ban=function(e,t,n,r){return this.client.ban(this.name,e,t,n,r)},n.prototype.member=function(e,t,n,r){return this.client.member(this.name,e,t,n,r)},n.prototype.revoke=function(e,t,n,r){return this.client.revoke(this.name,e,t,n,r)},n.prototype.owner=function(e,t,n,r){return this.client.owner(this.name,e,t,n,r)},n.prototype.admin=function(e,t,n,r){return this.client.admin(this.name,e,t,n,r)},n.prototype.changeNick=function(e){return this.nick=e,this.client.changeNick(this.name,e)},n.prototype.setStatus=function(e,t){return this.client.setStatus(this.name,this.nick,e,t)},n.prototype.addHandler=function(e,t){var n;n=this._handler_ids++;switch(e){case"presence":this._presence_handlers[n]=t;break;case"message":this._message_handlers[n]=t;break;case"roster":this._roster_handlers[n]=t;break;default:return this._handler_ids--,null}return n},n.prototype.removeHandler=function(e){return delete this._presence_handlers[e],delete this._message_handlers[e],delete this._roster_handlers[e]},n.prototype._addOccupant=function(e){var n;return n=new t(e,this),this.roster[n.nick]=n,n},n.prototype._roomRosterHandler=function(e){var t,r,i,s,o,u;t=n._parsePresence(e),o=t.nick,s=t.newnick||null;switch(t.type){case"error":return;case"unavailable":s&&(t.nick=s,this.roster[o]&&this.roster[s]&&(this.roster[o].update(this.roster[s]),this.roster[s]=this.roster[o]),this.roster[o]&&!this.roster[s]&&(this.roster[s]=this.roster[o].update(t))),delete this.roster[o];break;default:this.roster[o]?this.roster[o].update(t):this._addOccupant(t)}u=this._roster_handlers;for(i in u)r=u[i],r(this.roster,this)||delete this._roster_handlers[i];return!0},n._parsePresence=function(t){var n,r,i,s,o,u;n=e(t),r={},r.nick=Strophe.getResourceFromJid(n.attr("from")),r.type=n.attr("type"),r.states=[];for(i=0;i<n.children().length;i++){child=n.children()[0];switch(child.nodeName){case"status":r.status=child.textContent||null;break;case"show":r.show=child.textContent||null;break;case"x":if(e(child).attr("xmlns")===Strophe.NS.MUC_USER){o=e(child).children();for(s=0;s<o.length;s++){u=o[0];switch(u.nodeName){case"item":a=u.attributes,r.affiliation=e(u).attr("affiliation")||null,r.role=e(u).attr("role")||null,r.jid=e(u).attr("jid")||null,r.newnick=e(u).attr("nick")||null;break;case"status":e(u).attr("code")&&r.states.push(e(u).attr("code"))}}}}}return r},n}(),n=function(){function e(e){this.parse=i(this.parse,this),e!==null&&this.parse(e)}return e.prototype.parse=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p;o=e.getElementsByTagName("query")[0].childNodes,this.identities=[],this.features=[],this.x=[];for(u=0,l=o.length;u<l;u++){r=o[u],n=r.attributes;switch(r.nodeName){case"identity":s={};for(a=0,c=n.length;a<c;a++)t=n[a],s[t.name]=t.textContent;this.identities.push(s);break;case"feature":this.features.push(n["var"].textContent);break;case"x":n=r.childNodes[0].attributes;if(!n["var"].textContent==="FORM_TYPE"||!n.type.textContent==="hidden")break;p=r.childNodes;for(f=0,h=p.length;f<h;f++){i=p[f];if(!!i.attributes.type)continue;n=i.attributes,this.x.push({"var":n["var"].textContent,label:n.label.textContent||"",value:i.firstChild.textContent||""})}}}return{identities:this.identities,features:this.features,x:this.x}},e}(),t=function(){function e(e,t){this.room=t,this.update=i(this.update,this),this.admin=i(this.admin,this),this.owner=i(this.owner,this),this.revoke=i(this.revoke,this),this.member=i(this.member,this),this.ban=i(this.ban,this),this.modifyAffiliation=i(this.modifyAffiliation,this),this.deop=i(this.deop,this),this.op=i(this.op,this),this.mute=i(this.mute,this),this.voice=i(this.voice,this),this.kick=i(this.kick,this),this.modifyRole=i(this.modifyRole,this),this.update(e)}return e.prototype.modifyRole=function(e,t,n,r){return this.room.modifyRole(this.nick,e,t,n,r)},e.prototype.kick=function(e,t,n){return this.room.kick(this.nick,e,t,n)},e.prototype.voice=function(e,t,n){return this.room.voice(this.nick,e,t,n)},e.prototype.mute=function(e,t,n){return this.room.mute(this.nick,e,t,n)},e.prototype.op=function(e,t,n){return this.room.op(this.nick,e,t,n)},e.prototype.deop=function(e,t,n){return this.room.deop(this.nick,e,t,n)},e.prototype.modifyAffiliation=function(e,t,n,r){return this.room.modifyAffiliation(this.jid,e,t,n,r)},e.prototype.ban=function(e,t,n){return this.room.ban(this.jid,e,t,n)},e.prototype.member=function(e,t,n){return this.room.member(this.jid,e,t,n)},e.prototype.revoke=function(e,t,n){return this.room.revoke(this.jid,e,t,n)},e.prototype.owner=function(e,t,n){return this.room.owner(this.jid,e,t,n)},e.prototype.admin=function(e,t,n){return this.room.admin(this.jid,e,t,n)},e.prototype.update=function(e){return this.nick=e.nick||null,this.affiliation=e.affiliation||null,this.role=e.role||null,this.jid=e.jid||null,this.status=e.status||null,this.show=e.show||null,this},e}()}).call(this)}),Strophe.addConnectionPlugin("roster",{_connection:null,_callbacks:[],items:[],ver:null,init:function(e){this._connection=e,this.items=[];var t,n=this,r=e.connect,i=e.attach,s=function(r){if(r==Strophe.Status.ATTACHED||r==Strophe.Status.CONNECTED)try{e.addHandler(n._onReceivePresence.bind(n),null,"presence",null,null,null),e.addHandler(n._onReceiveIQ.bind(n),Strophe.NS.ROSTER,"iq","set",null,null)}catch(i){Strophe.error(i)}t!==null&&t.apply(this,arguments)};e.connect=function(n,i,o,u,a){t=o,typeof arguments[0]=="undefined"&&(arguments[0]=null),typeof arguments[1]=="undefined"&&(arguments[1]=null),arguments[2]=s,r.apply(e,arguments)},e.attach=function(n,r,o,u,a,f,l){t=u,typeof arguments[0]=="undefined"&&(arguments[0]=null),typeof arguments[1]=="undefined"&&(arguments[1]=null),typeof arguments[2]=="undefined"&&(arguments[2]=null),arguments[3]=s,i.apply(e,arguments)},Strophe.addNamespace("ROSTER_VER","urn:xmpp:features:rosterver"),Strophe.addNamespace("NICK","http://jabber.org/protocol/nick")},supportVersioning:function(){return this._connection.features&&this._connection.features.getElementsByTagName("ver").length>0},get:function(e,t,n){var r={xmlns:Strophe.NS.ROSTER};this.items=[],this.supportVersioning()&&(r.ver=t||"",this.items=n||[]);var i=$iq({type:"get",id:this._connection.getUniqueId("roster")}).c("query",r);return this._connection.sendIQ(i,this._onReceiveRosterSuccess.bind(this,e),this._onReceiveRosterError.bind(this,e))},registerCallback:function(e){this._callbacks.push(e)},findItem:function(e){for(var t=0;t<this.items.length;t++)if(this.items[t]&&this.items[t].jid==e)return this.items[t];return!1},removeItem:function(e){for(var t=0;t<this.items.length;t++)if(this.items[t]&&this.items[t].jid==e)return this.items.splice(t,1),!0;return!1},subscribe:function(e,t,n){var r=$pres({to:e,type:"subscribe"});t&&t!==""&&r.c("status").t(t),n&&n!==""&&r.c("nick",{xmlns:Strophe.NS.NICK}).t(n),this._connection.send(r)},unsubscribe:function(e,t){var n=$pres({to:e,type:"unsubscribe"});t&&t!=""&&n.c("status").t(t),this._connection.send(n)},authorize:function(e,t){var n=$pres({to:e,type:"subscribed"});t&&t!=""&&n.c("status").t(t),this._connection.send(n)},unauthorize:function(e,t){var n=$pres({to:e,type:"unsubscribed"});t&&t!=""&&n.c("status").t(t),this._connection.send(n)},add:function(e,t,n,r){var i=$iq({type:"set"}).c("query",{xmlns:Strophe.NS.ROSTER}).c("item",{jid:e,name:t});for(var s=0;s<n.length;s++)i.c("group").t(n[s]).up();this._connection.sendIQ(i,r,r)},update:function(e,t,n,r){var i=this.findItem(e);if(!i)throw"item not found";var s=t||i.name,o=n||i.groups,u=$iq({type:"set"}).c("query",{xmlns:Strophe.NS.ROSTER}).c("item",{jid:i.jid,name:s});for(var a=0;a<o.length;a++)u.c("group").t(o[a]).up();return this._connection.sendIQ(u,r,r)},remove:function(e,t){var n=this.findItem(e);if(!n)throw"item not found";var r=$iq({type:"set"}).c("query",{xmlns:Strophe.NS.ROSTER}).c("item",{jid:n.jid,subscription:"remove"});this._connection.sendIQ(r,t,t)},_onReceiveRosterSuccess:function(e,t){this._updateItems(t),e(this.items)},_onReceiveRosterError:function(e,t){e(this.items)},_onReceivePresence:function(e){var t=e.getAttribute("from"),n=Strophe.getBareJidFromJid(t),r=this.findItem(n);if(!r)return!0;var i=e.getAttribute("type");if(i=="unavailable")delete r.resources[Strophe.getResourceFromJid(t)];else{if(!!i)return!0;r.resources[Strophe.getResourceFromJid(t)]={show:e.getElementsByTagName("show").length!=0?Strophe.getText(e.getElementsByTagName("show")[0]):"",status:e.getElementsByTagName("status").length!=0?Strophe.getText(e.getElementsByTagName("status")[0]):"",priority:e.getElementsByTagName("priority").length!=0?Strophe.getText(e.getElementsByTagName("priority")[0]):""}}return this._call_backs(this.items,r),!0},_call_backs:function(e,t){for(var n=0;n<this._callbacks.length;n++)this._callbacks[n](e,t)},_onReceiveIQ:function(e){var t=e.getAttribute("id"),n=e.getAttribute("from");if(n&&n!=""&&n!=this._connection.jid&&n!=Strophe.getBareJidFromJid(this._connection.jid))return!0;var r=$iq({type:"result",id:t,from:this._connection.jid});return this._connection.send(r),this._updateItems(e),!0},_updateItems:function(e){var t=e.getElementsByTagName("query");if(t.length!=0){this.ver=t.item(0).getAttribute("ver");var n=this;Strophe.forEachChild(t.item(0),"item",function(e){n._updateItem(e)})}this._call_backs(this.items)},_updateItem:function(e){var t=e.getAttribute("jid"),n=e.getAttribute("name"),r=e.getAttribute("subscription"),i=e.getAttribute("ask"),s=[];Strophe.forEachChild(e,"group",function(e){s.push(Strophe.getText(e))});if(r=="remove"){this.removeItem(t);return}var e=this.findItem(t);e?(e.name=n,e.subscription=r,e.ask=i,e.groups=s):this.items.push({name:n,jid:t,subscription:r,ask:i,groups:s,resources:{}})}}),define("strophe.roster",function(){});var buildIq;buildIq=function(e,t,n){var r;return r=$iq(t?{type:e,to:t}:{type:e}),r.c("vCard",{xmlns:Strophe.NS.VCARD}),n&&r.cnode(n),r},Strophe.addConnectionPlugin("vcard",{_connection:null,init:function(e){return this._connection=e,Strophe.addNamespace("VCARD","vcard-temp")},get:function(e,t,n){var r;return r=buildIq("get",t),this._connection.sendIQ(r,e,n)},set:function(e,t,n,r){var i;return i=buildIq("set",n,t),this._connection.sendIQ(i,e,error_rb)}}),define("strophe.vcard",function(){}),Strophe.addConnectionPlugin("disco",{_connection:null,_identities:[],_features:[],_items:[],init:function(e){this._connection=e,this._identities=[],this._features=[],this._items=[],e.addHandler(this._onDiscoInfo.bind(this),Strophe.NS.DISCO_INFO,"iq","get",null,null),e.addHandler(this._onDiscoItems.bind(this),Strophe.NS.DISCO_ITEMS,"iq","get",null,null)},addIdentity:function(e,t,n,r){for(var i=0;i<this._identities.length;i++)if(this._identities[i].category==e&&this._identities[i].type==t&&this._identities[i].name==n&&this._identities[i].lang==r)return!1;return this._identities.push({category:e,type:t,name:n,lang:r}),!0},addFeature:function(e){for(var t=0;t<this._features.length;t++)if(this._features[t]==e)return!1;return this._features.push(e),!0},removeFeature:function(e){for(var t=0;t<this._features.length;t++)if(this._features[t]===e)return this._features.splice(t,1),!0;return!1},addItem:function(e,t,n,r){return n&&!r?!1:(this._items.push({jid:e,name:t,node:n,call_back:r}),!0)},info:function(e,t,n,r,i){var s={xmlns:Strophe.NS.DISCO_INFO};t&&(s.node=t);var o=$iq({from:this._connection.jid,to:e,type:"get"}).c("query",s);this._connection.sendIQ(o,n,r,i)},items:function(e,t,n,r,i){var s={xmlns:Strophe.NS.DISCO_ITEMS};t&&(s.node=t);var o=$iq({from:this._connection.jid,to:e,type:"get"}).c("query",s);this._connection.sendIQ(o,n,r,i)},_buildIQResult:function(e,t){var n=e.getAttribute("id"),r=e.getAttribute("from"),i=$iq({type:"result",id:n});return r!==null&&i.attrs({to:r}),i.c("query",t)},_onDiscoInfo:function(e){var t=e.getElementsByTagName("query")[0].getAttribute("node"),n={xmlns:Strophe.NS.DISCO_INFO};t&&(n.node=t);var r=this._buildIQResult(e,n);for(var i=0;i<this._identities.length;i++){var n={category:this._identities[i].category,type:this._identities[i].type};this._identities[i].name&&(n.name=this._identities[i].name),this._identities[i].lang&&(n["xml:lang"]=this._identities[i].lang),r.c("identity",n).up()}for(var i=0;i<this._features.length;i++)r.c("feature",{"var":this._features[i]}).up();return this._connection.send(r.tree()),!0},_onDiscoItems:function(e){var t={xmlns:Strophe.NS.DISCO_ITEMS},n=e.getElementsByTagName("query")[0].getAttribute("node");if(n){t.node=n;var r=[];for(var i=0;i<this._items.length;i++)if(this._items[i].node==n){r=this._items[i].call_back(e);break}}else var r=this._items;var s=this._buildIQResult(e,t);for(var i=0;i<r.length;i++){var o={jid:r[i].jid};r[i].name&&(o.name=r[i].name),r[i].node&&(o.node=r[i].node),s.c("item",o).up()}return this._connection.send(s.tree()),!0}}),define("strophe.disco",function(){}),function(e,t){if(console===undefined||console.log===undefined)console={log:function(){},error:function(){}};typeof define=="function"&&define.amd?(require.config({paths:{jed:"Libraries/jed",locales:"Libraries/locales",af:"locale/af/LC_MESSAGES/af",en:"locale/en/LC_MESSAGES/en",sjcl:"Libraries/sjcl",tinysort:"Libraries/jquery.tinysort",underscore:"Libraries/underscore",backbone:"Libraries/backbone",localstorage:"Libraries/backbone.localStorage",strophe:"Libraries/strophe","strophe.muc":"Libraries/strophe.muc","strophe.roster":"Libraries/strophe.roster","strophe.vcard":"Libraries/strophe.vcard","strophe.disco":"Libraries/strophe.disco"},shim:{backbone:{deps:["underscore","jquery"],exports:"Backbone"},underscore:{exports:"_"},"strophe.muc":{deps:["strophe","jquery"]},"strophe.roster":{deps:["strophe","jquery"]},"strophe.vcard":{deps:["strophe","jquery"]},"strophe.disco":{deps:["strophe","jquery"]}}}),define("converse",["locales","localstorage","tinysort","sjcl","strophe.muc","strophe.roster","strophe.vcard","strophe.disco"],function(){return _.templateSettings={evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g},t(jQuery,_,console)})):(_.templateSettings={evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g},e.converse=t(jQuery,_,console||{log:function(){}}))}(this,function(e,t,n){var r={};return r.initialize=function(i){this.bosh_service_url="",this.animate=!0,this.auto_list_rooms=!1,this.auto_subscribe=!1,this.hide_muc_server=!1,this.prebind=!1,this.xhr_user_search=!1,this.i18n=locales.en,t.extend(this,i);var s=function(e){var t=r.i18n.translate(e);return arguments.length>1?t.fetch.apply(t,[].slice.call(arguments,1)):t.fetch()};this.msg_counter=0,this.autoLink=function(e){var t=/((http|https|ftp):\/\/[\w?=&.\/\-;#~%\-]+(?![\w\s?&.\/;#~%"=\-]*>))/g;return e.replace(t,'<a target="_blank" href="$1">$1</a>')},this.toISOString=function(e){var t;return typeof e.toISOString!="undefined"?e.toISOString():(t=function(e){return e<10?"0"+e:""+e},e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())+".000Z")},this.parseISO8601=function(e){var t=[1,4,5,6,7,10,11],n=/^\s*(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}\.?\d*)Z\s*$/.exec(e),r=0,i,s;for(i=0;s=t[i];++i)n[s]=+n[s]||0;return n[2]=(+n[2]||1)-1,n[3]=+n[3]||1,n[8]!=="Z"&&n[9]!==undefined&&(r=n[10]*60+n[11],n[9]==="+"&&(r=0-r)),new Date(Date.UTC(n[1],n[2],n[3],n[4],n[5]+r,n[6],n[7]))},this.updateMsgCounter=function(){this.msg_counter>0?(document.title.search(/^Messages \(\d+\) /)==-1?document.title="Messages ("+this.msg_counter+") "+document.title:document.title=document.title.replace(/^Messages \(\d+\) /,"Messages ("+this.msg_counter+") "),window.blur(),window.focus()):document.title.search(/^Messages \(\d+\) /)!=-1&&(document.title=document.title.replace(/^Messages \(\d+\) /,""))},this.incrementMsgCounter=function(){this.msg_counter+=1,this.updateMsgCounter()},this.clearMsgCounter=function(){this.msg_counter=0,this.updateMsgCounter()},this.collections={URI:"http://www.xmpp.org/extensions/xep-0136.html#ns"},this.collections.getLastCollection=function(e,t){var i=Strophe.getBareJidFromJid(e),s=$iq({type:"get"}).c("list",{xmlns:this.URI,"with":i}).c("set",{xmlns:"http://jabber.org/protocol/rsm"}).c("before").up().c("max").t("1");r.connection.sendIQ(s,t,function(){n.log("Error while retrieving collections")})},this.collections.getLastMessages=function(t,n){var i=this;this.getLastCollection(t,function(t){var s=e(t).find("chat"),o=s.attr("with"),u=s.attr("start"),a=$iq({type:"get"}).c("retrieve",{start:u,xmlns:i.URI,"with":o}).c("set",{xmlns:"http://jabber.org/protocol/rsm"}).c("max").t("30");r.connection.sendIQ(a,n)})},this.Message=Backbone.Model.extend(),this.Messages=Backbone.Collection.extend({model:r.Message}),this.ChatBox=Backbone.Model.extend({initialize:function(){this.get("box_id")!=="controlbox"&&(this.messages=new r.Messages,this.messages.localStorage=new Backbone.LocalStorage(hex_sha1("converse.messages"+this.get("jid"))),this.set({user_id:Strophe.getNodeFromJid(this.get("jid")),box_id:hex_sha1(this.get("jid")),fullname:this.get("fullname"),url:this.get("url"),image_type:this.get("image_type"),image:this.get("image")}))},messageReceived:function(t){var n=e(t),i=r.autoLink(n.children("body").text()),s=Strophe.getBareJidFromJid(n.attr("from")),o=n.find("composing"),u=n.find("delay").length>0,a=(this.get("fullname")||"").split(" ")[0],f,l,c;i?(u?(f=n.find("delay").attr("stamp"),l=f):l=r.toISOString(new Date),s==r.bare_jid?c="me":c="them",this.messages.create({fullname:a,sender:c,delayed:u,time:l,message:i})):o.length&&this.messages.add({fullname:a,sender:"them",delayed:u,time:r.toISOString(new Date),composing:o.length})}}),this.ChatBoxView=Backbone.View.extend({length:200,tagName:"div",className:"chatbox",events:{"click .close-chatbox-button":"closeChat","keypress textarea.chat-textarea":"keyPressed"},message_template:t.template('<div class="chat-message {{extra_classes}}"><span class="chat-message-{{sender}}">{{time}} {{username}}: </span><span class="chat-message-content">{{message}}</span></div>'),action_template:t.template('<div class="chat-message {{extra_classes}}"><span class="chat-message-{{sender}}">{{time}} **{{username}} </span><span class="chat-message-content">{{message}}</span></div>'),new_day_template:t.template('<time class="chat-date" datetime="{{isodate}}">{{datestring}}</time>'),appendMessage:function(e,t){var n=r.parseISO8601(t.time),i=t.message,s=i.match(/^\/(.*?)(?: (.*))?$/),o=t.sender,u,a;s&&s[1]==="me"?(i=i.replace(/^\/me/,""),u=this.action_template,a=t.fullname):(u=this.message_template,a=o==="me"&&o||t.fullname),e.find("div.chat-event").remove(),e.append(u({sender:o,time:n.toLocaleTimeString().substring(0,4),message:i,username:a,extra_classes:t.delayed&&"delayed"||""}))},insertStatusNotification:function(t,n){var r=this.$el.find(".chat-content");r.find("div.chat-event").remove().end().append(e('<div class="chat-event"></div>').text(t)),this.scrollDown()},showMessage:function(e){var n=e.get("time"),i=this.model.messages.pluck("time"),s=r.parseISO8601(n),o=this.$el.find(".chat-content"),u,a,f,l,c,h;a=t.indexOf(i,n)-1,a>=0&&(u=this.model.messages.at(a),f=r.parseISO8601(u.get("time")),l=new Date(s.getTime()),l.setUTCHours(0,0,0,0),l=r.toISOString(l),this.isDifferentDay(f,s)&&o.append(this.new_day_template({isodate:l,datestring:s.toString().substring(0,15)})));if(e.get("composing")){this.insertStatusNotification(e.get("fullname")+" "+"is typing");return}this.appendMessage(o,t.clone(e.attributes)),e.get("sender")!="me"&&r.windowState=="blur"&&r.incrementMsgCounter(),this.scrollDown()},isDifferentDay:function(e,t){return t.getDate()!=e.getDate()||t.getFullYear()!=e.getFullYear()||t.getMonth()!=e.getMonth()},addHelpMessages:function(t){var n=this.$el.find(".chat-content"),r,i=t.length;for(r=0;r<i;r++)n.append(e('<div class="chat-info">'+t[r]+"</div>"));this.scrollDown()},sendMessage:function(e){var t=(new Date).getTime(),n=this.model.get("jid"),i=e.replace(/^\s*/,"").match(/^\/(.*)\s*$/),o;if(i){if(i[1]==="clear"){this.$el.find(".chat-content").empty(),this.model.messages.reset();return}if(i[1]==="help"){o=["<strong>/help</strong>:"+s("Show this menu")+"","<strong>/me</strong>:"+s("Write in the third person")+"","<strong>/clear</strong>:"+s("Remove messages")+""],this.addHelpMessages(o);return}}var u=$msg({from:r.bare_jid,to:n,type:"chat",id:t}).c("body").t(e).up().c("active",{xmlns:"http://jabber.org/protocol/chatstates"}),a=$msg({to:r.bare_jid,type:"chat",id:t}).c("forwarded",{xmlns:"urn:xmpp:forward:0"}).c("delay",{xmns:"urn:xmpp:delay",stamp:t}).up().cnode(u.tree());r.connection.send(u),r.connection.send(a),this.model.messages.create({fullname:r.xmppstatus.get("fullname")||r.bare_jid,sender:"me",time:r.toISOString(new Date),message:e})},keyPressed:function(t){var n=e(t.target),i,s,o;t.keyCode==13?(t.preventDefault(),i=n.val(),n.val("").focus(),i!==""&&(this.model.get("chatroom")?this.sendChatRoomMessage(i):this.sendMessage(i)),this.$el.data("composing",!1)):this.model.get("chatroom")||(o=this.$el.data("composing"),o||(t.keyCode!=47&&(s=$msg({to:this.model.get("jid"),type:"chat"}).c("composing",{xmlns:"http://jabber.org/protocol/chatstates"}),r.connection.send(s)),this.$el.data("composing",!0)))},onChange:function(e,n){if(t.has(e.changed,"chat_status")){var r=e.get("chat_status"),i=e.get("fullname");this.$el.is(":visible")&&(r==="offline"?this.insertStatusNotification(i+" "+"has gone offline"):r==="away"?this.insertStatusNotification(i+" "+"has gone away"):r==="dnd"?this.insertStatusNotification(i+" "+"is busy"):r==="online"&&this.$el.find("div.chat-event").remove())}t.has(e.changed,"status")&&this.showStatusMessage(e.get("status")),t.has(e.changed,"image")&&this.renderAvatar()},showStatusMessage:function(e){this.$el.find("p.user-custom-message").text(e).attr("title",e)},closeChat:function(){r.connection?this.model.destroy():this.model.trigger("hide")},updateVCard:function(){var t=this.model.get("jid"),i=r.roster.get(t);i&&!i.get("vcard_updated")&&r.getVCard(t,e.proxy(function(e,t,n,i,s){this.model.save({fullname:t||e,url:s,image_type:i,image:n,vcard_updated:r.toISOString(new Date)})},this),e.proxy(function(e){n.log("ChatBoxView.initialize: An error occured while fetching vcard")},this))},initialize:function(){this.model.messages.on("add",this.showMessage,this),this.model.on("show",this.show,this),this.model.on("destroy",this.hide,this),this.model.on("change",this.onChange,this),this.updateVCard(),this.$el.appendTo(r.chatboxesview.$el),this.render().show().model.messages.fetch({add:!0}),this.model.get("status")&&this.showStatusMessage(this.model.get("status"))},template:t.template('<div class="chat-head chat-head-chatbox"><a class="close-chatbox-button">X</a><a href="{{url}}" target="_blank" class="user"><div class="chat-title"> {{ fullname }} </div></a><p class="user-custom-message"><p/></div><div class="chat-content"></div><form class="sendXMPPMessage" action="" method="post"><textarea type="text" class="chat-textarea" placeholder="'+s("Personal message")+'"/>'+"</form>"),renderAvatar:function(){if(!this.model.get("image"))return;var t="data:"+this.model.get("image_type")+";base64,"+this.model.get("image"),n=e('<canvas height="35px" width="35px" class="avatar"></canvas>'),r=n.get(0).getContext("2d"),i=new Image;i.onload=function(){var e=i.width/i.height;r.drawImage(i,0,0,35*e,35)},i.src=t,this.$el.find(".chat-title").before(n)},render:function(){return this.$el.attr("id",this.model.get("box_id")).html(this.template(this.model.toJSON())),this.renderAvatar(),this},focus:function(){return this.$el.find(".chat-textarea").focus(),this},hide:function(){r.animate?this.$el.hide("fast"):this.$el.hide()},show:function(){return this.$el.is(":visible")&&this.$el.css("opacity")=="1"?this.focus():(r.animate?this.$el.css({opacity:0,display:"inline"}).animate({opacity:"1"},200):this.$el.css({opacity:1,display:"inline"}),r.connection&&this.model.save(),this)},scrollDown:function(){var e=this.$el.find(".chat-content");return e.scrollTop(e[0].scrollHeight),this}}),this.ContactsPanel=Backbone.View.extend({tagName:"div",className:"oc-chat-content",id:"users",events:{"click a.toggle-xmpp-contact-form":"toggleContactForm","submit form.add-xmpp-contact":"addContactFromForm","submit form.search-xmpp-contact":"searchContacts","click a.subscribe-to-user":"addContactFromList"},tab_template:t.template('<li><a class="s current" href="#users">'+s("Contacts")+"</a></li>"),template:t.template('<form class="set-xmpp-status" action="" method="post"><span id="xmpp-status-holder"><select id="select-xmpp-status" style="display:none"><option value="online">'+s("Online")+"</option>"+'<option value="dnd">'+s("Busy")+"</option>"+'<option value="away">'+s("Away")+"</option>"+'<option value="offline">'+s("Offline")+"</option>"+"</select>"+"</span>"+"</form>"+'<dl class="add-converse-contact dropdown">'+'<dt id="xmpp-contact-search" class="fancy-dropdown">'+'<a class="toggle-xmpp-contact-form" href="#"'+'title="'+s("Click to add new chat contacts")+'">'+s("Add a contact")+"</a>"+"</dt>"+'<dd class="search-xmpp" style="display:none"><ul></ul></dd>'+"</dl>"),add_contact_template:t.template('<li><form class="add-xmpp-contact"><input type="text" name="identifier" class="username" placeholder="'+s("Contact username")+'"/>'+'<button type="submit">'+s("Add")+"</button>"+"</form>"+"<li>"),search_contact_template:t.template('<li><form class="search-xmpp-contact"><input type="text" name="identifier" class="username" placeholder="'+s("Contact name")+'"/>'+'<button type="submit">'+s("Search")+"</button>"+"</form>"+"<li>"),render:function(){var e;return this.$parent.find("#controlbox-tabs").append(this.tab_template()),this.$parent.find("#controlbox-panes").append(this.$el.html(this.template())),r.xhr_user_search?e=this.search_contact_template():e=this.add_contact_template(),this.$el.find(".search-xmpp ul").append(e),this.$el.append(r.rosterview.$el),this},toggleContactForm:function(t){t.preventDefault(),this.$el.find(".search-xmpp").toggle("fast",function(){e(this).is(":visible")&&e(this).find("input.username").focus()})},searchContacts:function(t){t.preventDefault(),e.getJSON(portal_url+"/search-users?q="+e(t.target).find("input.username").val(),function(t){var n=e(".search-xmpp ul");n.find("li.found-user").remove(),n.find("li.chat-info").remove(),t.length||n.append('<li class="chat-info">'+s("No users found")+"</li>"),e(t).each(function(t,i){n.append(e('<li class="found-user"></li>').append(e('<a class="subscribe-to-user" href="#" title="'+s("Click to add as a chat contact")+'"></a>').attr("data-recipient",Strophe.escapeNode(i.id)+"@"+r.domain).text(i.fullname)))})})},addContactFromForm:function(t){t.preventDefault();var i=e(t.target).find("input"),s=i.val();if(!s){i.addClass("error");return}r.getVCard(s,e.proxy(function(e,t,n,r,i){this.addContact(e,t)},this),e.proxy(function(t){n.log("An error occured while fetching vcard");if(e(t).find("error").attr("code")=="503"){var r=e(t).attr("from");this.addContact(r,r)}},this)),e(".search-xmpp").hide()},addContactFromList:function(t){t.preventDefault();var n=e(t.target),r=n.attr("data-recipient"),i=n.text();this.addContact(r,i),n.parent().remove(),e(".search-xmpp").hide()},addContact:function(e,t){r.connection.roster.add(e,t,[],function(t){r.connection.roster.subscribe(e,null,r.xmppstatus.get("fullname"))})}}),this.RoomsPanel=Backbone.View.extend({tagName:"div",id:"chatrooms",events:{"submit form.add-chatroom":"createChatRoom","click input#show-rooms":"showRooms","click a.open-room":"createChatRoom","click a.room-info":"showRoomInfo"},room_template:t.template('<dd class="available-chatroom"><a class="open-room" data-room-jid="{{jid}}"title="'+s("Click to open this room")+'" href="#">{{name}}</a>'+'<a class="room-info" data-room-jid="{{jid}}"'+'title="'+s("Show more information on this room")+'" href="#"> </a>'+"</dd>"),room_description_template:t.template('<div class="room-info"><p class="room-info"><strong>'+s("Description:")+"</strong> {{desc}}</p>"+'<p class="room-info"><strong>'+s("Occupants:")+"</strong> {{occ}}</p>"+'<p class="room-info"><strong>'+s("Features:")+"</strong> <ul>"+"{[ if (passwordprotected) { ]}"+'<li class="room-info locked">'+s("Requires authentication")+"</li>"+"{[ } ]}"+"{[ if (hidden) { ]}"+'<li class="room-info">'+s("Hidden")+"</li>"+"{[ } ]}"+"{[ if (membersonly) { ]}"+'<li class="room-info">'+s("Requires an invitation")+"</li>"+"{[ } ]}"+"{[ if (moderated) { ]}"+'<li class="room-info">'+s("Moderated")+"</li>"+"{[ } ]}"+"{[ if (nonanonymous) { ]}"+'<li class="room-info">'+s("Non-anonymous")+"</li>"+"{[ } ]}"+"{[ if (open) { ]}"+'<li class="room-info">'+s("Open room")+"</li>"+"{[ } ]}"+"{[ if (persistent) { ]}"+'<li class="room-info">'+s("Permanent room")+"</li>"+"{[ } ]}"+"{[ if (publicroom) { ]}"+'<li class="room-info">'+s("Public")+"</li>"+"{[ } ]}"+"{[ if (semianonymous) { ]}"+'<li class="room-info">'+s("Semi-anonymous")+"</li>"+"{[ } ]}"+"{[ if (temporary) { ]}"+'<li class="room-info">'+s("Temporary room")+"</li>"+"{[ } ]}"+"{[ if (unmoderated) { ]}"+'<li class="room-info">'+s("Unmoderated")+"</li>"+"{[ } ]}"+"</p>"+"</div>"),tab_template:t.template('<li><a class="s" href="#chatrooms">'+s("Rooms")+"</a></li>"),template:t.template('<form class="add-chatroom" action="" method="post"><input type="text" name="chatroom" class="new-chatroom-name" placeholder="'+s("Room name")+'"/>'+'<input type="text" name="nick" class="new-chatroom-nick" placeholder="'+s("Nickname")+'"/>'+'<input type="{{ server_input_type }}" name="server" class="new-chatroom-server" placeholder="'+s("Server")+'"/>'+'<input type="submit" name="join" value="'+s("Join")+'"/>'+'<input type="button" name="show" id="show-rooms" value="'+s("Show rooms")+'"/>'+"</form>"+'<dl id="available-chatrooms"></dl>'),render:function(){return this.$parent.find("#controlbox-tabs").append(this.tab_template()),this.$parent.find("#controlbox-panes").append(this.$el.html(this.template({server_input_type:r.hide_muc_server&&"hidden"||"text"})).hide()),this},initialize:function(){this.on("update-rooms-list",function(e){this.updateRoomsList()}),r.xmppstatus.on("change",e.proxy(function(e){if(!t.has(e.changed,"fullname"))return;var n=this.$el.find("input.new-chatroom-nick");n.is(":focus")||n.val(e.get("fullname"))},this))},informNoRoomsFound:function(){var t=this.$el.find("#available-chatrooms");t.html("<dt>"+s("No rooms on %1$s",this.muc_domain)+"</dt>"),e("input#show-rooms").show().siblings("span.spinner").remove()},updateRoomsList:function(t){r.connection.muc.listRooms(this.muc_domain,e.proxy(function(t){var n,r,i,o,u=this,a=this.$el.find("#available-chatrooms");this.rooms=e(t).find("query").find("item");if(this.rooms.length){a.html("<dt>"+s("Rooms on %1$s",this.muc_domain)+"</dt>"),o=document.createDocumentFragment();for(i=0;i<this.rooms.length;i++)n=Strophe.unescapeNode(e(this.rooms[i]).attr("name")||e(this.rooms[i]).attr("jid")),r=e(this.rooms[i]).attr("jid"),o.appendChild(e(this.room_template({name:n,jid:r}))[0]);a.append(o),e("input#show-rooms").show().siblings("span.spinner").remove()}else this.informNoRoomsFound();return!0},this),e.proxy(function(e){this.informNoRoomsFound()},this))},showRooms:function(t){var n=this.$el.find("#available-chatrooms"),r=this.$el.find("input.new-chatroom-server"),i=r.val();if(!i){r.addClass("error");return}this.$el.find("input.new-chatroom-name").removeClass("error"),r.removeClass("error"),n.empty(),e("input#show-rooms").hide().after('<span class="spinner"/>'),this.muc_domain=i,this.updateRoomsList()},showRoomInfo:function(t){var n=t.target,i=e(n).parent("dd"),s=i.find("div.room-info");s.length?s.remove():(i.find("span.spinner").remove(),i.append('<span class="spinner hor_centered"/>'),r.connection.disco.info(e(n).attr("data-room-jid"),null,e.proxy(function(t){var n=e(t);i.find("span.spinner").replaceWith(this.room_description_template({desc:n.find('field[var="muc#roominfo_description"] value').text(),occ:n.find('field[var="muc#roominfo_occupants"] value').text(),hidden:n.find('feature[var="muc_hidden"]').length,membersonly:n.find('feature[var="muc_membersonly"]').length,moderated:n.find('feature[var="muc_moderated"]').length,nonanonymous:n.find('feature[var="muc_nonanonymous"]').length,open:n.find('feature[var="muc_open"]').length,passwordprotected:n.find('feature[var="muc_passwordprotected"]').length,persistent:n.find('feature[var="muc_persistent"]').length,publicroom:n.find('feature[var="muc_public"]').length,semianonymous:n.find('feature[var="muc_semianonymous"]').length,temporary:n.find('feature[var="muc_temporary"]').length,unmoderated:n.find('feature[var="muc_unmoderated"]').length}))},this)))},createChatRoom:function(t){t.preventDefault();var n,i,s,o,u,a=this.$el.find("input.new-chatroom-nick"),f=a.val(),l;f?a.removeClass("error"):a.addClass("error");if(t.type==="click")u=e(t.target).attr("data-room-jid");else{i=this.$el.find("input.new-chatroom-name"),o=this.$el.find("input.new-chatroom-server"),s=o.val(),n=i.val().trim().toLowerCase(),i.val("");if(!n||!s){n||i.addClass("error"),s||o.addClass("error");return}u=Strophe.escapeNode(n)+"@"+s,i.removeClass("error"),o.removeClass("error"),this.muc_domain=s}if(!f)return;l=r.chatboxes.createChatBox({id:u,jid:u,name:Strophe.unescapeNode(Strophe.getNodeFromJid(u)),nick:f,chatroom:!0,box_id:hex_sha1(u)}),l.get("connected")||r.chatboxesview.views[u].connect(null)}}),this.ControlBoxView=r.ChatBoxView.extend({tagName:"div",className:"chatbox",id:"controlbox",events:{"click a.close-chatbox-button":"closeChat","click ul#controlbox-tabs li a":"switchTab"},initialize:function(){this.$el.appendTo(r.chatboxesview.$el),this.model.on("change",e.proxy(function(n,i){var s;if(t.has(n.changed,"connected")){this.render(),r.features.on("add",e.proxy(this.featureAdded,this));var o=r.features.findWhere({"var":"http://jabber.org/protocol/muc"});o&&this.featureAdded(o)}t.has(n.changed,"visible")&&n.changed.visible===!0&&this.show()},this)),this.model.on("show",this.show,this),this.model.on("destroy",this.hide,this),this.model.on("hide",this.hide,this),this.model.get("visible")&&this.show()},featureAdded:function(e){if(e.get("var")=="http://jabber.org/protocol/muc"){this.roomspanel.muc_domain=e.get("from");var t=this.$el.find("input.new-chatroom-server");t.is(":focus")||t.val(this.roomspanel.muc_domain),r.auto_list_rooms&&this.roomspanel.trigger("update-rooms-list")}},template:t.template('<div class="chat-head oc-chat-head"><ul id="controlbox-tabs"></ul><a class="close-chatbox-button">X</a></div><div id="controlbox-panes"></div>'),switchTab:function(t){t.preventDefault();var n=e(t.target),r=n.parent().siblings("li").children("a"),i=e(n.attr("href")),s=e(r.attr("href"));s.fadeOut("fast",function(){r.removeClass("current"),n.addClass("current"),i.fadeIn("fast",function(){})})},addHelpMessages:function(e){return},render:function(){return this.$el.html(this.template(this.model.toJSON())),!r.prebind&&!r.connection?(this.loginpanel=new r.LoginPanel,this.loginpanel.$parent=this.$el,this.loginpanel.render()):(this.contactspanel=new r.ContactsPanel,this.contactspanel.$parent=this.$el,this.contactspanel.render(),r.xmppstatus=new r.XMPPStatus,r.xmppstatus.localStorage=new Backbone.LocalStorage(hex_sha1("converse.xmppstatus-"+r.bare_jid)),r.xmppstatus.fetch({success:function(e,t){e.get("fullname")||r.getVCard(null,function(e,t,n,i,s){r.xmppstatus.save({fullname:t})})}}),r.xmppstatusview=new r.XMPPStatusView({model:r.xmppstatus}),r.xmppstatusview.render(),this.roomspanel=new r.RoomsPanel,this.roomspanel.$parent=this.$el,this.roomspanel.render()),this}}),this.ChatRoomView=r.ChatBoxView.extend({length:300,tagName:"div",className:"chatroom",events:{"click a.close-chatbox-button":"closeChat","click a.configure-chatroom-button":"configureChatRoom","keypress textarea.chat-textarea":"keyPressed"},info_template:t.template('<div class="chat-info">{{message}}</div>'),sendChatRoomMessage:function(e){var t=e.replace(/^\s*/,"").match(/^\/(.*?)(?: (.*))?$/)||[!1],n;switch(t[1]){case"msg":break;case"clear":this.$el.find(".chat-content").empty();break;case"topic":r.connection.muc.setTopic(this.model.get("jid"),t[2]);break;case"kick":r.connection.muc.kick(this.model.get("jid"),t[2]);break;case"ban":r.connection.muc.ban(this.model.get("jid"),t[2]);break;case"op":r.connection.muc.op(this.model.get("jid"),t[2]);break;case"deop":r.connection.muc.deop(this.model.get("jid"),t[2]);break;case"help":n=this.$el.find(".chat-content"),msgs=["<strong>/help</strong>:"+s("Show this menu")+"","<strong>/me</strong>:"+s("Write in the third person")+"","<strong>/topic</strong>:"+s("Set chatroom topic")+"","<strong>/kick</strong>:"+s("Kick user from chatroom")+"","<strong>/ban</strong>:"+s("Ban user from chatroom")+"","<strong>/clear</strong>:"+s("Remove messages")+""],this.addHelpMessages(msgs);break;default:this.last_msgid=r.connection.muc.groupchat(this.model.get("jid"),e)}},template:t.template('<div class="chat-head chat-head-chatroom"><a class="close-chatbox-button">X</a><a class="configure-chatroom-button" style="display:none"> </a><div class="chat-title"> {{ name }} </div><p class="chatroom-topic"><p/></div><div class="chat-body"><img class="spinner centered" src="images/spinner.gif"/></div>'),chatarea_template:t.template('<div class="chat-area"><div class="chat-content"></div><form class="sendXMPPMessage" action="" method="post"><textarea type="text" class="chat-textarea" placeholder="'+s("Message")+'"/>'+"</form>"+"</div>"+'<div class="participants">'+'<ul class="participant-list"></ul>'+"</div>"),render:function(){return this.$el.attr("id",this.model.get("box_id")).html(this.template(this.model.toJSON())),this},renderChatArea:function(){return this.$el.find(".chat-area").length||this.$el.find(".chat-body").empty().append(this.chatarea_template()),this},connect:function(n){t.has(r.connection.muc.rooms,this.model.get("jid"))?r.connection.muc.join(this.model.get("jid"),this.model.get("nick"),null,null,null,n):r.connection.muc.join(this.model.get("jid"),this.model.get("nick"),e.proxy(this.onChatRoomMessage,this),e.proxy(this.onChatRoomPresence,this),e.proxy(this.onChatRoomRoster,this),n)},initialize:function(){this.connect(null),this.model.messages.on("add",this.showMessage,this),this.model.on("destroy",function(t,n,i){this.$el.hide("fast"),r.connection.muc.leave(this.model.get("jid"),this.model.get("nick"),e.proxy(this.onLeave,this),undefined)},this),this.$el.appendTo(r.chatboxesview.$el),this.render().show().model.messages.fetch({add:!0})},onLeave:function(){this.model.set("connected",!1)},form_input_template:t.template('<label>{{label}}<input name="{{name}}" type="{{type}}" value="{{value}}"></label>'),select_option_template:t.template('<option value="{{value}}">{{label}}</option>'),form_select_template:t.template('<label>{{label}}<select name="{{name}}">{{options}}</select></label>'),form_checkbox_template:t.template('<label>{{label}}<input name="{{name}}" type="{{type}}" {{checked}}"></label>'),renderConfigurationForm:function(t){var n=this.$el.find("form.chatroom-form"),r=e(t),i=r.find("field"),o=r.find("title").text(),u=r.find("instructions").text(),a,f,l=[],c={"text-private":"password","text-single":"textline","boolean":"checkbox",hidden:"hidden","list-single":"dropdown"};n.find("img.spinner").remove(),n.append(e("<legend>").text(o)),u!=o&&n.append(e("<p>").text(u));for(a=0;a<i.length;a++){$field=e(i[a]);if($field.attr("type")=="list-single"){l=[],$options=$field.find("option");for(f=0;f<$options.length;f++)l.push(this.select_option_template({value:e($options[f]).find("value").text(),label:e($options[f]).attr("label")}));n.append(this.form_select_template({name:$field.attr("var"),label:$field.attr("label"),options:l.join("")}))}else $field.attr("type")=="boolean"?n.append(this.form_checkbox_template({name:$field.attr("var"),type:c[$field.attr("type")],label:$field.attr("label")||"",checked:$field.find("value").text()==="1"&&'checked="1"'||""})):n.append(this.form_input_template({name:$field.attr("var"),type:c[$field.attr("type")],label:$field.attr("label")||"",value:$field.find("value").text()}))}n.append('<input type="submit" value="'+s("Save")+'"/>'),n.append('<input type="button" value="'+s("Cancel")+'"/>'),n.on("submit",e.proxy(this.saveConfiguration,this)),n.find("input[type=button]").on("click",e.proxy(this.cancelConfiguration,this))},field_template:t.template('<field var="{{name}}"><value>{{value}}</value></field>'),saveConfiguration:function(t){t.preventDefault();var n=this,i=e(t.target).find(":input:not([type=button]):not([type=submit])"),s=i.length,o=[];i.each(function(){var t=e(this),i;t.is("[type=checkbox]")?i=t.is(":checked")&&1||0:i=t.val();var u=e(n.field_template({name:t.attr("name"),value:i}))[0];o.push(u),--s||r.connection.muc.saveConfiguration(n.model.get("jid"),o,e.proxy(n.onConfigSaved,n),e.proxy(n.onErrorConfigSaved,n))}),this.$el.find("div.chatroom-form-container").hide(function(){e(this).remove(),n.$el.find(".chat-area").show(),n.$el.find(".participants").show()})},onConfigSaved:function(e){},onErrorConfigSaved:function(e){this.insertStatusNotification(s("An error occurred while trying to save the form."))},cancelConfiguration:function(t){t.preventDefault();var n=this;this.$el.find("div.chatroom-form-container").hide(function(){e(this).remove(),n.$el.find(".chat-area").show(),n.$el.find(".participants").show()})},configureChatRoom:function(t){t.preventDefault();if(this.$el.find("div.chatroom-form-container").length)return;this.$el.find(".chat-area").hide(),this.$el.find(".participants").hide(),this.$el.find(".chat-body").append(e('<div class="chatroom-form-container"><form class="chatroom-form"><img class="spinner centered" src="images/spinner.gif"/></form></div>')),r.connection.muc.configure(this.model.get("jid"),e.proxy(this.renderConfigurationForm,this))},submitPassword:function(e){e.preventDefault();var t=this.$el.find(".chatroom-form").find("input[type=password]").val();this.$el.find(".chatroom-form-container").replaceWith('<img class="spinner centered" src="images/spinner.gif"/>'),this.connect(t)},renderPasswordForm:function(){this.$el.find("img.centered.spinner").remove(),this.$el.find(".chat-body").append(e('<div class="chatroom-form-container"><form class="chatroom-form"><legend>'+s("This chatroom requires a password")+"</legend>"+"<label>"+s("Password: ")+'<input type="password" name="password"/></label>'+'<input type="submit" value="'+s("Submit")+"/>"+"</form>"+"</div>")),this.$el.find(".chatroom-form").on("submit",e.proxy(this.submitPassword,this))},showDisconnectMessage:function(t){this.$el.find(".chat-area").remove(),this.$el.find(".participants").remove(),this.$el.find("img.centered.spinner").remove(),this.$el.find(".chat-body").append(e("<p>"+t+"</p>"))},infoMessages:{100:s("This room is not anonymous"),102:s("This room now shows unavailable members"),103:s("This room does not show unavailable members"),104:s("Non-privacy-related room configuration has changed"),170:s("Room logging is now enabled"),171:s("Room logging is now disabled"),172:s("This room is now non-anonymous"),173:s("This room is now semi-anonymous"),174:s("This room is now fully-anonymous"),201:s("A new room has been created"),210:s("Your nickname has been changed")},actionInfoMessages:{301:r.i18n.translate("<strong>%1$s</strong> has been banned"),307:r.i18n.translate("<strong>%1$s</strong> has been kicked out"),321:r.i18n.translate("<strong>%1$s</strong> has been removed because of an affiliation change"),322:r.i18n.translate("<strong>%1$s</strong> has been removed for not being a member")},disconnectMessages:{301:s("You have been banned from this room"),307:s("You have been kicked from this room"),321:s("You have been removed from this room because of an affiliation change"),322:s("You have been removed from this room because the room has changed to members-only and you're not a member"),332:s("You have been removed from this room because the MUC (Multi-user chat) service is being shut down.")},showStatusMessages:function(e,n){var r=this.$el.find(".chat-content"),i=e.find("status"),s=[],o=[],u=[],a,f;for(f=0;f<i.length;f++){var l=i[f].getAttribute("code");n?t.contains(t.keys(this.disconnectMessages),l)&&s.push(this.disconnectMessages[l]):t.contains(t.keys(this.infoMessages),l)?o.push(this.infoMessages[l]):t.contains(t.keys(this.actionInfoMessages),l)&&u.push(this.actionInfoMessages[l].fetch(Strophe.unescapeNode(Strophe.getResourceFromJid(e.attr("from")))))}if(s.length>0){for(f=0;f<s.length;f++)this.showDisconnectMessage(s[f]);this.model.set("connected",!1);return}this.renderChatArea();for(f=0;f<o.length;f++)r.append(this.info_template({message:o[f]}));for(f=0;f<u.length;f++)r.append(this.info_template({message:u[f]}));this.scrollDown()},showErrorMessage:function(e,t){var n=this.$el.find(".chat-content");r.connection.muc.removeRoom(t.name),e.attr("type")=="auth"?e.find("not-authorized").length?this.renderPasswordForm():e.find("registration-required").length?this.showDisconnectMessage(s("You are not on the member list of this room")):e.find("forbidden").length&&this.showDisconnectMessage(s("You have been banned from this room")):e.attr("type")=="modify"?e.find("jid-malformed").length&&this.showDisconnectMessage(s("No nickname was specified")):e.attr("type")=="cancel"&&(e.find("not-allowed").length?this.showDisconnectMessage(s("You are not allowed to create new rooms")):e.find("not-acceptable").length?this.showDisconnectMessage(s("Your nickname doesn't conform to this room's policies")):e.find("conflict").length?this.showDisconnectMessage(s("Your nickname is already taken")):e.find("item-not-found").length?this.showDisconnectMessage(s("This room does not (yet) exist")):e.find("service-unavailable").length&&this.showDisconnectMessage(s("This room has reached it's maximum number of occupants")))},onChatRoomPresence:function(t,n){var i=n.nick,s=e(t),o=s.attr("from"),u=s.find("status[code='110']").length||o==n.name+"/"+Strophe.escapeNode(i),a;if(s.attr("type")==="error")this.model.set("connected",!1),this.showErrorMessage(s.find("error"),n);else{this.model.set("connected",!0),this.showStatusMessages(s,u);if(!this.model.get("connected"))return!0;s.find("status[code='201']").length&&r.connection.muc.createInstantRoom(n.name),u&&(a=s.find("item"),a.length&&a.attr("affiliation")=="owner"&&this.$el.find("a.configure-chatroom-button").show(),s.find("status[code='210']").length&&this.model.set({nick:Strophe.getResourceFromJid(o)}))}return!0},onChatRoomMessage:function(n){var i=e(n),o=i.children("body").text(),u=i.attr("from"),a=this.$el.find(".chat-content"),f=Strophe.getResourceFromJid(u),l=f&&Strophe.unescapeNode(f)||"",c=i.find("delay").length>0,h=i.children("subject").text(),p,d,v,m,g,y,b;return c?(b=i.find("delay").attr("stamp"),v=r.parseISO8601(b)):v=new Date,g=a.find("time").map(function(){return e(this).attr("datetime")}).get(),m=new Date(v.getTime()),m.setUTCHours(0,0,0,0),y=r.toISOString(m),t.indexOf(g,y)==-1&&a.append(this.new_day_template({isodate:y,datestring:m.toString().substring(0,15)})),this.showStatusMessages(i),h&&(this.$el.find(".chatroom-topic").text(h).attr("title",h),a.append(this.info_template({message:s("Topic set by %1$s to: %2$s",l,h)}))),o?(this.appendMessage(a,{message:o,sender:l===this.model.get("nick")&&"me"||"room",fullname:l,time:r.toISOString(v)}),this.scrollDown(),!0):!0},occupant_template:t.template('<li class="{{role}}" {[ if (role === "moderator") { ]}title="'+s("This user is a moderator")+'"'+"{[ } ]}"+'{[ if (role === "participant") { ]}'+'title="'+s("This user can send messages in this room")+'"'+"{[ } ]}"+'{[ if (role === "visitor") { ]}'+'title="'+s("This user can NOT send messages in this room")+'"'+"{[ } ]}"+">{{nick}}</li>"),onChatRoomRoster:function(e,n){this.renderChatArea();var i=r.chatboxesview.views.controlbox,s=t.size(e),o=this.$el.find(".participant-list"),u=[],a=t.keys(e),f;this.$el.find(".participant-list").empty();for(f=0;f<s;f++)u.push(this.occupant_template({role:e[a[f]].role,nick:Strophe.unescapeNode(a[f])}));return o.append(u.join("")),!0}}),this.ChatBoxes=Backbone.Collection.extend({model:r.ChatBox,onConnected:function(){this.localStorage=new Backbone.LocalStorage(hex_sha1("converse.chatboxes-"+r.bare_jid)),this.get("controlbox")?this.get("controlbox").save():this.add({id:"controlbox",box_id:"controlbox"}),this.get("controlbox").set({connected:!0}),this.fetch({add:!0,success:e.proxy(function(e,n){t.include(t.pluck(n,"id"),"controlbox")&&this.get("controlbox").set({visible:!0}).save()},this)})},createChatBox:function(e){var t=this.get(e.jid);return t?t.trigger("show"):t=this.create(e),t},messageReceived:function(t){var n,i=e(t),s=i.attr("from");if(s==r.connection.jid)return!0;var o=i.children("forwarded");o.length&&(i=o.children("message"));var u=Strophe.getBareJidFromJid(s),a=Strophe.getBareJidFromJid(i.attr("to")),f,l,c;return u==r.bare_jid?(n=a,f=Strophe.getResourceFromJid(i.attr("to"))):(n=u,f=Strophe.getResourceFromJid(s)),l=this.get(n),c=r.roster.get(n),l||(l=this.create({id:n,jid:n,fullname:c.get("fullname")||jid,image_type:c.get("image_type"),image:c.get("image"),url:c.get("url")})),l.messageReceived(t),r.roster.addResource(n,f),!0}}),this.ChatBoxesView=Backbone.View.extend({el:"#collective-xmpp-chat-data",initialize:function(){this.views={},this.model.on("add",function(e){var t=this.views[e.get("id")];t?(delete t.model,t.model=e,t.initialize(),e.get("id")!=="controlbox"&&t.$el.appendTo(this.$el)):(e.get("chatroom")?t=new r.ChatRoomView({model:e}):e.get("box_id")==="controlbox"?(t=new r.ControlBoxView({model:e}),t.render()):t=new r.ChatBoxView({model:e}),this.views[e.get("id")]=t)},this)}}),this.RosterItem=Backbone.Model.extend({initialize:function(e,n){var r=e.jid;e.fullname||(e.fullname=r);var i=t.extend({id:r,user_id:Strophe.getNodeFromJid(r),resources:[],status:""},e);i.sorted=!1,i.chat_status="offline",this.set(i)}}),this.RosterItemView=Backbone.View.extend({tagName:"dd",events:{"click .accept-xmpp-request":"acceptRequest","click .decline-xmpp-request":"declineRequest","click .open-chat":"openChat","click .remove-xmpp-contact":"removeContact"},openChat:function(e){e.preventDefault(),r.chatboxes.createChatBox({id:this.model.get("jid"),jid:this.model.get("jid"),fullname:this.model.get("fullname"),image_type:this.model.get("image_type"),image:this.model.get("image"),url:this.model.get("url"),status:this.model.get("status")})},removeContact:function(e){e.preventDefault();var t=confirm("Are you sure you want to remove this contact?");if(t===!0){var n=this.model.get("jid");r.connection.roster.remove(n,function(e){r.connection.roster.unauthorize(n),r.rosterview.model.remove(n)})}},acceptRequest:function(e){var t=this.model.get("jid");r.connection.roster.authorize(t),r.connection.roster.add(t,this.model.get("fullname"),[],function(e){r.connection.roster.subscribe(t,null,r.xmppstatus.get("fullname"))}),e.preventDefault()},declineRequest:function(e){e.preventDefault(),r.connection.roster.unauthorize(this.model.get("jid")),this.model.destroy()},template:t.template('<a class="open-chat" title="'+s("Click to chat with this contact")+'" href="#">{{ fullname }}</a>'+'<a class="remove-xmpp-contact" title="'+s("Click to remove this contact")+'" href="#"></a>'),pending_template:t.template('<span>{{ fullname }}</span><a class="remove-xmpp-contact" title="'+s("Click to remove this contact")+'" href="#"></a>'),request_template:t.template('<div>{{ fullname }}</div><button type="button" class="accept-xmpp-request">Accept</button><button type="button" class="decline-xmpp-request">Decline</button>'),render:function(){var e=this.model,t=e.get("ask"),n=e.get("subscription");this.$el.addClass(e.get("chat_status"));if(t==="subscribe")this.$el.addClass("pending-xmpp-contact"),this.$el.html(this.pending_template(e.toJSON()));else if(t==="request")this.$el.addClass("requesting-xmpp-contact"),this.$el.html(this.request_template(e.toJSON())),r.showControlBox();else if(n==="both"||n==="to")this.$el.addClass("current-xmpp-contact"),this.$el.html(this.template(e.toJSON()));return this},initialize:function(){this.options.model.on("change",function(e,n){t.has(e.changed,"chat_status")&&this.$el.attr("class",e.changed.chat_status)},this)}}),this.getVCard=function(t,n,i){r.connection.vcard.get(e.proxy(function(i){$vcard=e(i).find("vCard");var s=$vcard.find("FN").text(),o=$vcard.find("BINVAL").text(),u=$vcard.find("TYPE").text(),a=$vcard.find("URL").text(),f=r.roster.get(t);f&&f.save({fullname:s||t,image_type:u,image:o,url:a,vcard_updated:r.toISOString(new Date)}),n(t,s,o,u,a)},this),t,i)},this.RosterItems=Backbone.Collection.extend({model:r.RosterItem,comparator:function(e){var t=e.get("chat_status"),n=4;switch(t){case"offline":n=0;break;case"unavailable":n=1;break;case"xa":n=2;break;case"away":n=3;break;case"dnd":n=4;break;case"online":n=5}return n},subscribeToSuggestedItems:function(t){return e(t).find("item").each(function(){var t=e(this),n=t.attr("jid"),i=t.attr("action"),s=t.attr("name");i==="add"&&r.connection.roster.add(n,s,[],function(e){r.connection.roster.subscribe(n,null,r.xmppstatus.get("fullname"))})}),!0},isSelf:function(e){return Strophe.getBareJidFromJid(e)===Strophe.getBareJidFromJid(r.connection.jid)},getItem:function(e){return Backbone.Collection.prototype.get.call(this,e)},addResource:function(e,n){var r=this.getItem(e),i;r&&(i=r.get("resources"),i?t.indexOf(i,n)==-1&&(i.push(n),r.set({resources:i})):r.set({resources:[n]}))},removeResource:function(e,n){var r=this.getItem(e),i,s;if(r){i=r.get("resources"),s=t.indexOf(i,n);if(s!==-1)return i.splice(s,1),r.set({resources:i}),i.length}return 0},subscribeBack:function(e){var t=Strophe.getBareJidFromJid(e);r.connection.roster.findItem(t)?(r.connection.roster.authorize(t),r.connection.roster.subscribe(e,null,r.xmppstatus.get("fullname"))):r.connection.roster.add(e,"",[],function(n){r.connection.roster.authorize(t),r.connection.roster.subscribe(e,null,r.xmppstatus.get("fullname"))})},unsubscribe:function(e){r.xmppstatus.sendPresence("unsubscribe"),r.connection.roster.findItem(e)&&r.connection.roster.remove(e,function(t){r.rosterview.model.remove(e)})},getNumOnlineContacts:function(){var e=0,n=this.models,r=n.length,i;for(i=0;i<r;i++)t.indexOf(["offline","unavailable"],n[i].get("chat_status"))===-1&&e++;return e},cleanCache:function(e){var n,r,i=[];for(r=0;r<e.length;++r)i.push(e[r].jid);for(r=0;r<this.models.length;++r)n=this.models[r].get("id"),t.indexOf(i,n)===-1&&this.getItem(n).destroy()},rosterHandler:function(e){this.cleanCache(e),t.each(e,function(e,t,n){if(this.isSelf(e.jid))return;var r=this.getItem(e.jid);if(!r)is_last=!1,t===n.length-1&&(is_last=!0),this.create({jid:e.jid,subscription:e.subscription,ask:e.ask,fullname:e.name||e.jid,is_last:is_last});else if(e.subscription==="none"&&e.ask===null)r.destroy();else if(r.get("subscription")!==e.subscription||r.get("ask")!==e.ask)r.set({subscription:e.subscription,ask:e.ask}),r.save()},this)},presenceHandler:function(t){var i=e(t),s=i.attr("type");if(s==="error")return!0;var o=i.attr("from"),u=Strophe.getBareJidFromJid(o),a=Strophe.getResourceFromJid(o),f=i.find("show"),l=f.text()||"online",c=i.find("status"),h;return this.isSelf(u)?(r.connection.jid!==o&&s!=="unavailabe"&&r.xmppstatus.save({status:l}),!0):(i.find("x").attr("xmlns")||"").indexOf(Strophe.NS.MUC)===0?!0:(h=this.getItem(u),h&&c.text()!=h.get("status")&&h.save({status:c.text()}),s==="subscribed"||s==="unsubscribe"?!0:(s==="subscribe"?r.auto_subscribe?!h||h.get("subscription")!="to"?this.subscribeBack(o):r.connection.roster.authorize(u):h&&h.get("subscription")!="none"?r.connection.roster.authorize(u):r.getVCard(u,e.proxy(function(e,t,n,r,i){this.add({jid:u,subscription:"none",ask:"request",fullname:t,image:n,image_type:r,url:i,is_last:!0})},this),e.proxy(function(e,t,r,i,s){n.log("Error while retrieving vcard"),this.add({jid:u,subscription:"none",ask:"request",fullname:e,is_last:!0})},this)):s==="unsubscribed"?this.unsubscribe(u):s==="unavailable"?this.removeResource(u,a)===0&&h&&h.set({chat_status:"offline"}):h&&(this.addResource(u,a),h.set({chat_status:l})),!0))}}),this.RosterView=Backbone.View.extend({tagName:"dl",id:"converse-roster",rosteritemviews:{},removeRosterItem:function(e){var t=this.rosteritemviews[e.id];t&&(t.$el.remove(),delete this.rosteritemviews[e.id],this.render())},initialize:function(){this.model.on("add",function(e){var t=new r.RosterItemView({model:e});this.rosteritemviews[e.id]=t,this.render(e)},this),this.model.on("change",function(e,n){if(t.size(e.changed)===1&&t.contains(t.keys(e.changed),"sorted"))return;this.updateChatBox(e,n),this.render(e)},this),this.model.on("remove",function(e){this.removeRosterItem(e)},this),this.model.on("destroy",function(e){this.removeRosterItem(e)},this),this.$el.hide().html(this.template()),this.model.fetch({add:!0})},updateChatBox:function(e,n){var i=r.chatboxes.get(e.get("jid")),s={};if(!i)return;t.has(e.changed,"chat_status")&&(s.chat_status=e.get("chat_status")),t.has(e.changed,"status")&&(s.status=e.get("status")),i.save(s)},template:t.template('<dt id="xmpp-contact-requests">'+s("Contact requests")+"</dt>"+'<dt id="xmpp-contacts">'+s("My contacts")+"</dt>"+'<dt id="pending-xmpp-contacts">'+s("Pending contacts")+"</dt>"),render:function(n){var i=this.$el.find("#xmpp-contacts"),s=this.$el.find("#xmpp-contact-requests"),o=this.$el.find("#pending-xmpp-contacts"),u,a;if(n){var f=n.id,l=this.rosteritemviews[n.id],c=n.get("ask"),h=n.get("subscription"),p={order:"asc"};if(c==="subscribe")o.after(l.render().el),o.after(o.siblings("dd.pending-xmpp-contact").tsort(p));else if(c==="request")s.after(l.render().el),s.after(s.siblings("dd.requesting-xmpp-contact").tsort(p));else if(h==="both"||h==="to")n.get("sorted")?l.render():i.after(l.render().el);a=l.model.changed.chat_status,a&&(i.after(i.siblings("dd.current-xmpp-contact.offline").tsort("a",p)),i.after(i.siblings("dd.current-xmpp-contact.unavailable").tsort("a",p)),i.after(i.siblings("dd.current-xmpp-contact.away").tsort("a",p)),i.after(i.siblings("dd.current-xmpp-contact.dnd").tsort("a",p)),i.after(i.siblings("dd.current-xmpp-contact.online").tsort("a",p))),n.get("is_last")&&!n.get("sorted")&&(n.set("sorted",!0),this.initialSort(),this.$el.show(function(){r.xmppstatus.initStatus()}))}return t.each([i,s,o],function(e){e.nextUntil("dt").length?e.show():e.hide()}),u=e("#online-count"),u.text("("+this.model.getNumOnlineContacts()+")"),u.is(":visible")||u.show(),this},initialSort:function(){var e=this.$el.find("#xmpp-contacts"),t={order:"asc"};e.after(e.siblings("dd.current-xmpp-contact.offline").tsort("a",t)),e.after(e.siblings("dd.current-xmpp-contact.unavailable").tsort("a",t))}}),this.XMPPStatus=Backbone.Model.extend({initialize:function(){this.set({status:this.get("status"),status_message:this.get("status_message"),fullname:this.get("fullname")})},initStatus:function(){var e=this.get("status");e===undefined&&(e="online",this.save({status:e})),this.sendPresence(e)},sendPresence:function(e){var t=this.get("status_message"),n;e==="unavailable"||e==="probe"||e==="error"||e==="unsubscribe"||e==="unsubscribed"||e==="subscribe"||e==="subscribed"?n=$pres({type:e}):(e==="online"?n=$pres():n=$pres().c("show").t(e).up(),t&&n.c("status").t(t)),r.connection.send(n)},setStatus:function(e){this.sendPresence(e),this.save({status:e})},setStatusMessage:function(e){r.connection.send($pres().c("show").t(this.get("status")).up().c("status").t(e)),this.save({status_message:e})}}),this.XMPPStatusView=Backbone.View.extend({el:"span#xmpp-status-holder",events:{"click a.choose-xmpp-status":"toggleOptions","click #fancy-xmpp-status-select a.change-xmpp-status-message":"renderStatusChangeForm","submit #set-custom-xmpp-status":"setStatusMessage","click .dropdown dd ul li a":"setStatus"},toggleOptions:function(t){t.preventDefault(),e(t.target).parent().parent().siblings("dd").find("ul").toggle("fast")},change_status_message_template:t.template('<form id="set-custom-xmpp-status"><input type="text" class="custom-xmpp-status" {{ status_message }}"placeholder="'+s("Custom status")+'"/>'+'<button type="submit">'+s("Save")+"</button>"+"</form>"),status_template:t.template('<div class="xmpp-status"><a class="choose-xmpp-status {{ chat_status }}" data-value="{{status_message}}" href="#" title="'+s("Click to change your chat status")+'">'+"{{ status_message }}"+"</a>"+'<a class="change-xmpp-status-message" href="#" title="'+s("Click here to write a custom status message")+'"></a>'+"</div>"),renderStatusChangeForm:function(e){e.preventDefault();var t=this.model.get("status")||"offline",n=this.change_status_message_template({status_message:t});this.$el.find(".xmpp-status").replaceWith(n),this.$el.find(".custom-xmpp-status").focus().focus()},setStatusMessage:function(t){t.preventDefault();var n=e(t.target).find("input").attr("value");n==="",this.model.setStatusMessage(n)},setStatus:function(t){t.preventDefault();var n=e(t.target),r=n.attr("data-value");this.model.setStatus(r),this.$el.find(".dropdown dd ul").hide()},getPrettyStatus:function(e){return e==="chat"?pretty_status=s("online"):e==="dnd"?pretty_status=s("busy"):e==="xa"?pretty_status=s("away for long"):e==="away"?pretty_status=s("away"):pretty_status=s(e)||s("online"),pretty_status},updateStatusUI:function(e){if(!t.has(e.changed,"status")&&!t.has(e.changed,"status_message"))return;var n=e.get("status"),r=e.get("status_message")||s("I am %1$s",this.getPrettyStatus(n));this.$el.find("#fancy-xmpp-status-select").html(this.status_template({chat_status:n,status_message:r}))},choose_template:t.template('<dl id="target" class="dropdown"><dt id="fancy-xmpp-status-select" class="fancy-dropdown"></dt><dd><ul></ul></dd></dl>'),option_template:t.template('<li><a href="#" class="{{ value }}" data-value="{{ value }}">{{ text }}</a></li>'),initialize:function(){this.model.on("change",this.updateStatusUI,this)},render:function(){var t=this.$el.find("select#select-xmpp-status"),n=this.model.get("status")||"offline",r=e("option",t),i,o=[],u=this;return this.$el.html(this.choose_template()),this.$el.find("#fancy-xmpp-status-select").html(this.status_template({status_message:s("I am %1$s",this.getPrettyStatus(n)),chat_status:n})),r.each(function(){o.push(u.option_template({value:e(this).val(),text:this.text}))}),i=this.$el.find("#target dd ul").hide(),i.append(o.join("")),t.remove(),this}}),this.Feature=Backbone.Model.extend(),this.Features=Backbone.Collection.extend({model:r.Feature,initialize:function(){this.localStorage=new Backbone.LocalStorage(hex_sha1("converse.features"+r.bare_jid)),this.localStorage.records.length===0?(r.connection.disco.info(r.domain,null,e.proxy(this.onInfo,this)),r.connection.disco.items(r.domain,null,e.proxy(this.onItems,this))):this.fetch({add:!0})},onItems:function(t){e(t).find("query item").each(e.proxy(function(t,n){r.connection.disco.info(e(n).attr("jid"),null,e.proxy(this.onInfo,this))},this))},onInfo:function(t){var n=e(t);if(n.find("identity[category=server][type=im]").length===0&&n.find("identity[category=conference][type=text]").length===0)return;n.find("feature").each(e.proxy(function(t,r){this.create({"var":e(r).attr("var"),from:n.attr("from")})},this))}}),this.LoginPanel=Backbone.View.extend({tagName:"div",id:"login-dialog",events:{"submit form#converse-login":"authenticate"},tab_template:t.template('<li><a class="current" href="#login">'+s("Sign in")+"</a></li>"),template:t.template('<form id="converse-login"><label>'+s("XMPP/Jabber Username:")+"</label>"+'<input type="text" id="jid">'+"<label>"+s("Password:")+"</label>"+'<input type="password" id="password">'+'<input class="login-submit" type="submit" value="'+s("Log In")+'">'+'</form">'),bosh_url_input:t.template("<label>"+s("BOSH Service URL:")+"</label>"+'<input type="text" id="bosh_service_url">'),connect:function(t,i,o){var u=null,a=new Strophe.Connection(r.bosh_service_url);t&&($button=t.find("input[type=submit]"),$button.hide().after('<img class="spinner login-submit" src="images/spinner.gif"/>')),a.connect(i,o,e.proxy(function(e,t){e===Strophe.Status.CONNECTED?(n.log(s("Connected")),r.onConnected(a)):e===Strophe.Status.DISCONNECTED?($button&&$button.show().siblings("img").remove(),r.giveFeedback(s("Disconnected"),"error"),this.connect(null,a.jid,a.pass)):e===Strophe.Status.Error?($button&&$button.show().siblings("img").remove(),r.giveFeedback(s("Error"),"error")):e===Strophe.Status.CONNECTING?r.giveFeedback(s("Connecting")):e===Strophe.Status.CONNFAIL?($button&&$button.show().siblings("img").remove(),r.giveFeedback(s("Connection Failed"),"error")):e===Strophe.Status.AUTHENTICATING?r.giveFeedback(s("Authenticating")):e===Strophe.Status.AUTHFAIL?($button&&$button.show().siblings("img").remove(),r.giveFeedback(s("Authentication Failed"),"error")):e===Strophe.Status.DISCONNECTING?r.giveFeedback(s("Disconnecting"),"error"):e===Strophe.Status.ATTACHED&&n.log(s("Attached"))},this))},authenticate:function(t){t.preventDefault();var n=e(t.target),i=n.find("input#jid"),s=i.val(),o=n.find("input#password"),u=o.val(),a=null,f=!1;r.bosh_service_url||(a=n.find("input#bosh_service_url"),r.bosh_service_url=a.val(),r.bosh_service_url||(f=!0,a.addClass("error"))),s||(f=!0,i.addClass("error")),u||(f=!0,o.addClass("error"));if(f)return;this.connect(n,s,u)},remove:function(){this.$parent.find("#controlbox-tabs").empty(),this.$parent.find("#controlbox-panes").empty()},render:function(){this.$parent.find("#controlbox-tabs").append(this.tab_template());var e=this.template();return this.bosh_url_input||e.find("form").append(this.bosh_url_input),this.$parent.find("#controlbox-panes").append(this.$el.html(e)),this.$el.find("input#jid").focus(),this}}),this.showControlBox=function(){var e=this.chatboxes.get("controlbox");e?e.trigger("show"):(this.chatboxes.add({id:"controlbox",box_id:"controlbox",visible:!0}),this.connection&&this.chatboxes.get("controlbox").save())},this.toggleControlBox=function(){if(e("div#controlbox").is(":visible")){var t=this.chatboxes.get("controlbox");this.connection?t.destroy():t.trigger("hide")}else this.showControlBox()},this.giveFeedback=function(t,n){e(".conn-feedback").text(t),e(".conn-feedback").attr("class","conn-feedback"),n&&e(".conn-feedback").addClass(n)},this.onConnected=function(t){this.connection=t,this.connection.xmlInput=function(e){n.log(e)},this.connection.xmlOutput=function(e){n.log(e)},this.bare_jid=Strophe.getBareJidFromJid(this.connection.jid),this.domain=Strophe.getDomainFromJid(this.connection.jid),this.features=new this.Features,this.roster=new this.RosterItems,this.roster.localStorage=new Backbone.LocalStorage(hex_sha1("converse.rosteritems-"+this.bare_jid)),this.connection.roster.registerCallback(e.proxy(this.roster.rosterHandler,this.roster),null,"presence",null),this.rosterview=new this.RosterView({model:this.roster}),this.chatboxes.onConnected(),this.connection.addHandler(e.proxy(this.roster.subscribeToSuggestedItems,this.roster),"http://jabber.org/protocol/rosterx","message",null),this.connection.roster.get(e.proxy(function(t){this.connection.addHandler(e.proxy(function(e){return this.presenceHandler(e),!0},this.roster),null,"presence",null),this.connection.addHandler(e.proxy(function(e){return this.chatboxes.messageReceived(e),!0},this),null,"message","chat")},this)),e(window).on("blur focus",e.proxy(function(e){this.windowState!=e.type&&e.type=="focus"&&r.clearMsgCounter(),this.windowState=e.type},this)),this.giveFeedback(s("Online Contacts"))},this.chatboxes=new this.ChatBoxes,this.chatboxesview=new this.ChatBoxesView({model:this.chatboxes}),e("a.toggle-online-users").bind("click",e.proxy(function(e){e.preventDefault(),this.toggleControlBox()},this))},r}),require(["jquery","converse"],function(e,t){t.initialize({bosh_service_url:"https://bind.opkode.im"})}),define("main",function(){}); |