Team:SUSTC-Shenzhen/static/js/jquery.pjax.js

From 2014.igem.org

(Difference between revisions)
(Created page with "- ! jquery.pjax.js v2.13.0 | (c) 2012, falsandtru | MIT Licence: !new function(window,document,undefined,$){"use strict";var MODULE;!function(a){a.NAME="pjax",a.NAMESPACE=jQuer...")
 
Line 1: Line 1:
-
/*! jquery.pjax.js v2.13.0 | (c) 2012, falsandtru | MIT Licence */
+
/*! jquery.pjax.js v2.21.0 | (c) 2012, falsandtru | MIT Licence */
-
!new function(window,document,undefined,$){"use strict";var MODULE;!function(a){a.NAME="pjax",a.NAMESPACE=jQuery,function(a){a[a.wait=-1]="wait",a[a.ready=0]="ready",a[a.lock=1]="lock",a[a.seal=2]="seal",a[a.error=3]="error"}(a.State||(a.State={}));a.State;a.GEN_UUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16).toUpperCase()})}}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d=function(){function b(b,d,e){this.model_=b,this.controller_=d,this.state_=-1,this.queue_=[],this.HANDLERS={},c=d,this.UUID=a.GEN_UUID(),this.CONTEXT=e,this.OBSERVE(),this.state_=0}return b.prototype.OBSERVE=function(){},b.prototype.RELEASE=function(){},b.prototype.BIND=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];return this.UNBIND(),this},b.prototype.UNBIND=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];return this},b.EVENTS={},b.TRIGGERS={},b}();b.Template=d}(a.VIEW||(a.VIEW={}));a.VIEW}(MODULE||(MODULE={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},MODULE;!function(a){!function(a){var b,c=function(a){function c(c,d,e){a.call(this,c,d,e),this.model_=c,this.controller_=d,this.HANDLERS={CLICK:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.CLICK.apply(b,a)},SUBMIT:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.SUBMIT.apply(b,a)},POPSTATE:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.POPSTATE.apply(b,a)},SCROLL:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.SCROLL.apply(b,a)}},b=d}return __extends(c,a),c.prototype.BIND=function(a){return this.UNBIND(a),this.CONTEXT.delegate(a.link,a.nss.click,this.HANDLERS.CLICK).delegate(a.form,a.nss.submit,this.HANDLERS.SUBMIT),jQuery(window).bind(a.nss.popstate,this.HANDLERS.POPSTATE),a.fix.scroll&&jQuery(window).bind(a.nss.scroll,this.HANDLERS.SCROLL),this},c.prototype.UNBIND=function(a){return this.CONTEXT.undelegate(a.link,a.nss.click).undelegate(a.form,a.nss.submit),jQuery(window).unbind(a.nss.popstate),a.fix.scroll&&jQuery(window).unbind(a.nss.scroll),this},c.prototype.OBSERVE=function(){return this.RELEASE(),this},c.prototype.RELEASE=function(){return this},c.EVENTS={},c.TRIGGERS={},c}(a.Template);a.Main=c}(a.VIEW||(a.VIEW={}));a.VIEW}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d,e=function(){function b(a,b){c=b,d=a}return b.prototype.enable=function(){return c.enable(),this},b.prototype.disable=function(){return c.disable(),this},b.prototype.click=function(b,e){var f,g=c.getActiveSetting();switch(typeof b){case"undefined":f=this.end().filter("a").first().clone();break;case"object":f=jQuery(b).clone();break;case"string":e=e||{},e.href=b,f=jQuery("<a/>",e);break;default:return this}return f.first().one(g.nss.click,function(b){return new a.VIEW.Main(c,d,null).HANDLERS.CLICK(b)}).click()},b.prototype.submit=function(b,e,f){var g,h,i,j=c.getActiveSetting(),k=document.createDocumentFragment();switch(!0){case"undefined"==typeof b:g=this.end().filter("form").first().clone();break;case"object"==typeof b:g=jQuery(b).clone();break;case!!f:e=e||{},e.action=b,h=f instanceof Array&&Array||f instanceof Object&&Object||undefined;for(var l in f){switch(h){case Object:i=jQuery("<textarea/>",{name:l}).val(f[l]);break;case Array:f[l].attr=f[l].attr||{},f[l].attr.name=f[l].name,i=jQuery(f[l].tag.indexOf("<")?"<"+f[l].tag+"/>":f[l].tag,f[l].attr||{}).val(f[l].value);break;default:continue}k.appendChild(i[0])}g=jQuery("<form/>",e).append(k);break;default:return this}return g.first().one(j.nss.submit,function(b){return new a.VIEW.Main(c,d,null).HANDLERS.SUBMIT(b)}).submit()},b.prototype.getCache=function(a){"undefined"==typeof a&&(a=window.location.href);var b=c.getCache(a);return b&&(b={data:b.data,textStatus:b.textStatus,jqXHR:b.jqXHR,expires:b.expires}),b},b.prototype.setCache=function(a,b,d,e){switch("undefined"==typeof a&&(a=window.location.href),arguments.length){case 0:return this.setCache(a,document.documentElement.outerHTML);case 1:return this.setCache(a,null);case 2:case 3:case 4:default:c.setCache(a,b,d,e)}return this},b.prototype.removeCache=function(a){return"undefined"==typeof a&&(a=window.location.href),c.removeCache(a),this},b.prototype.clearCache=function(){return c.clearCache(),this},b.prototype.follow=function(b,d,e,f){if(!c.isDeferrable)return!1;var g=b.currentTarget;return d.follow=!0,d.host=e||"",isFinite(b.timeStamp)&&(d.timeStamp=f||b.timeStamp),c.setActiveXHR(d),jQuery.when(d).done(function(){!c.getCache(g.href)&&c.isImmediateLoadable(b)&&c.setCache(g.href,undefined,undefined,d)}),jQuery[a.NAME].click(g.href),!0},b.prototype.host=function(){return c.requestHost},b}();b.ControllerFunction=e}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(b,c){a.call(this,b,c)}return __extends(b,a),b}(a.ControllerFunction);a.ControllerMethod=b}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d,e=function(){function e(e){this.state_=-1,this.HANDLERS={},c=e,d=this,this.UUID=a.GEN_UUID(),a.NAMESPACE[a.NAME]=a.NAMESPACE&&a.NAMESPACE==a.NAMESPACE.window?this.EXEC:a.NAMESPACE.prototype[a.NAME]=this.EXEC;var f=new b.ControllerFunction(d,c);this.REGISTER_FUNCTIONS(a.NAMESPACE[a.NAME],f),this.UPDATE_PROPERTIES(a.NAMESPACE[a.NAME],f),this.OBSERVE(),this.state_=0}return e.prototype.EXTEND=function(e){if(e===a.NAMESPACE||a.NAMESPACE&&a.NAMESPACE==a.NAMESPACE.window){var f=new b.ControllerFunction(d,c);e=a.NAMESPACE[a.NAME]}else var f=new b.ControllerMethod(d,c);return e instanceof a.NAMESPACE&&(e instanceof jQuery&&(e=e.add()),this.REGISTER_FUNCTIONS(e,f)),this.UPDATE_PROPERTIES(e,f),e},e.prototype.EXEC=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];var e=d.EXTEND(this);return a=[e].concat(a),a=d.exec_.apply(d,a),a=a instanceof Array?a:[a],c.MAIN.apply(c,a)},e.prototype.exec_=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return[a].concat(b)},e.prototype.REGISTER_FUNCTIONS=function(a,c){{var d;b.Template.PROPERTIES}for(d in c)a[d]=c[d];return a},e.prototype.UPDATE_PROPERTIES=function(a,c){var d,e,f,g=b.Template.PROPERTIES;for(d=0,e=g.length;e>d;d++)f=g[d],c[f]&&(a[f]=c[f].call(a));return a},e.prototype.OBSERVE=function(){},e.prototype.RELEASE=function(){},e.EVENTS={},e.FUNCTIONS={},e.METHODS={},e.PROPERTIES=[],e.TRIGGERS={},e}();b.Template=e}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(b){function c(a){b.call(this,a),this.model_=a,this.HANDLERS={}}return __extends(c,b),c.prototype.exec_=function(b,c){b=b instanceof jQuery?b:this.EXTEND(jQuery(document));var d;return d=b instanceof a.NAMESPACE?"m:":"f:",d+=c?{}.toString.call(c).split(" ").pop().slice(0,-1).toLowerCase():c,d.toLowerCase(),[b,c]},c.prototype.OBSERVE=function(){},c.prototype.CLICK=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.CLICK.apply(this.model_,a)},c.prototype.SUBMIT=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.SUBMIT.apply(this.model_,a)},c.prototype.POPSTATE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.POPSTATE.apply(this.model_,a)},c.prototype.SCROLL=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.SCROLL.apply(this.model_,a)},c.EVENTS={},c.PROPERTIES=[],c.TRIGGERS={},c}(b.Template);b.Main=c}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function b(){this.NAME=a.NAME,this.NAMESPACE=a.NAMESPACE,this.state_=-1,this.stock=function c(d,e,f){if(this instanceof c)switch(typeof d){case"object":case"function":return this.uuid=a.GEN_UUID(),c[this.uuid]=this,jQuery.extend.apply(jQuery,[!0,this].concat([].slice.call(arguments)).concat({uuid:this.uuid}));case"string":return delete c[d]}else if("object"==typeof d){var g,h=d;for(g in h)b.store(g,h[g])}else switch(arguments.length){case 0:return new this.stock;case 1:return this.stock[d]||b.store(d);case 2:return b.store(d,e);case 3:return b.store(d,e,f)}},this.UUID=a.GEN_UUID()}return b.prototype.MAIN=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return this.main_.apply(this,[a].concat(b))},b.prototype.main_=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return this.state_=0,a},b.store=function(a,c){switch(arguments.length){case 0:break;case 1:return b.store[a];case 2:return b.store[a]=c;case 3:return b.store[a]=jQuery.extend(!0,b.store[a],c)}},b}();b.Template=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(){}return a.canonicalizeUrl=function(a){var b;return b=this.trim(a),b=b.replace(/["`^|\\<>{}\[\]\s].*/,""),b=/^https?:/i.test(b)?b:function(a,b){return b.href=a,b.href}(b,document.createElement("a")),b=encodeURI(decodeURI(b)),b=b.replace(/(?:%\w{2})+/g,function(b){return a.match(b.toLowerCase())||b})},a.trim=function(a){if(a=a||"",String.prototype.trim)a=a.toString().trim();else if(a=String(a).replace(/^[\s\uFEFF\xA0]+/,""))for(var b=a.length;--b;)if(/[^\s\uFEFF\xA0]/.test(a.charAt(b))){a=a.substring(0,b+1);break}return a},a.fire=function(a,b,c,d){return"undefined"==typeof b&&(b=window),"undefined"==typeof c&&(c=[]),"undefined"==typeof d&&(d=!1),"function"==typeof a?d?setTimeout(function(){a.apply(b||window,c)},0):a.apply(b||window,c):a},a}();a.Util=b,a.UTIL=a.Util}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function c(a,b,c,d,e,f){this.model_=a,this.app_=b,this.loadwaits_=[],this.ready_(c,d,e,f)}return c.prototype.ready_=function(a,c,d,e){function f(d){b.UTIL.fire(a.callbacks.ajax.done,this,[c,a.param].concat(d))}function g(d){k.errorThrown_=d[2],b.UTIL.fire(a.callbacks.ajax.fail,this,[c,a.param].concat(d))}function h(d){b.UTIL.fire(a.callbacks.ajax.fail,this,[c,a.param].concat(d)),k.model_.setActiveXHR(null);k.errorThrown_?a.fallback&&"abort"!==d[0].statusText&&(a.balance.self&&(k.app_.data.saveServerToDB(a.balance.server.host,(new Date).getTime()),k.app_.disableBalance()),k.model_.fallback(c,a)):(k.data_=d[0],k.textStatus_=d[1],k.jqXHR_=d[2],k.update_())}var i=a.speedcheck,j=this.model_.stock("speed");i&&(j.fire=c.timeStamp),i&&j.time.splice(0,100,0),i&&j.name.splice(0,100,"pjax("+j.time.slice(-1)+")");var k=this;if(b.UTIL.fire(a.callbacks.before,null,[c,a.param])!==!1){this.app_.isScrollPosSavable=!1,a.fix.reset&&/click|submit/.test(c.type.toLowerCase())&&window.scrollTo(jQuery(window).scrollLeft(),0);var l=this.model_.getActiveXHR();if(c=jQuery.extend(!0,{},c),this.setting_=a,this.cache_=e,this.event_=c,this.register_=d,e&&e.jqXHR)i&&j.name.splice(0,1,"cache("+j.time.slice(-1)+")"),a.loadtime=0,this.model_.setActiveXHR(null),this.host_=e.host||"",this.data_=e.data,this.textStatus_=e.textStatus,this.jqXHR_=e.jqXHR,this.model_.isDeferrable?jQuery.when(jQuery.Deferred().resolve(),k.wait_(b.UTIL.fire(a.wait,null,[c,a.param,a.origLocation.href,a.destLocation.href]))).done(function(){return k.update_()})&&undefined:k.update_();else if(l&&l.follow&&"abort"!==l.statusText&&"error"!==l.statusText){i&&j.time.splice(0,1,l.timeStamp-j.fire),i&&j.name.splice(0,1,"preload("+j.time.slice(-1)+")"),i&&j.time.push(j.now()-j.fire),i&&j.name.push("continue("+j.time.slice(-1)+")"),this.host_=l.host||"",a.loadtime=l.timeStamp;var m=a.wait&&isFinite(l.timeStamp)?Math.max(a.wait-(new Date).getTime()+l.timeStamp,0):0;jQuery.when(l,k.wait_(m)).done(f).fail(g).always(h)}else{a.loadtime=c.timeStamp;var n=a.destLocation.cloneNode(),o={},p={};switch(this.app_.chooseRequestServer(a),this.host_=a.balance.self&&this.model_.requestHost.split("//").pop()||"",n.host=this.host_||a.destLocation.host,o.url=a.server.query?[n.protocol,"//",n.host,"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname,(1<n.search.length?n.search+"&":"?")+a.server.query,n.hash].join(""):n.href,c.type.toLowerCase()){case"click":o.type="GET";break;case"submit":switch(o.type=c.currentTarget.method.toUpperCase(),o.type){case"POST":jQuery(c.currentTarget).has(":file").length?"function"==typeof FormData&&(o.data=new FormData(c.currentTarget),o.contentType=!1,o.processData=!1):o.data=jQuery(c.currentTarget).serializeArray();break;case"GET":}break;case"popstate":o.type="GET"}p={xhr:a.callbacks.ajax.xhr?function(){var d;return d=b.UTIL.fire(a.callbacks.ajax.xhr,this,[c,a.param]),d="object"==typeof d&&d||jQuery.ajaxSettings.xhr()}:undefined,beforeSend:a.callbacks.ajax.beforeSend||a.server.header?function(d,e){a.server.header&&d.setRequestHeader(a.nss.requestHeader,"true"),"object"==typeof a.server.header&&(d.setRequestHeader(a.nss.requestHeader,"true"),a.server.header.area&&d.setRequestHeader(a.nss.requestHeader+"-Area",this.app_.chooseArea(a.area,document,document)),a.server.header.head&&d.setRequestHeader(a.nss.requestHeader+"-Head",a.load.head),a.server.header.css&&d.setRequestHeader(a.nss.requestHeader+"-CSS",a.load.css.toString()),a.server.header.script&&d.setRequestHeader(a.nss.requestHeader+"-Script",a.load.script.toString())),b.UTIL.fire(a.callbacks.ajax.beforeSend,this,[c,a.param,d,e])}:undefined,dataFilter:a.callbacks.ajax.dataFilter?function(d,e){return b.UTIL.fire(a.callbacks.ajax.dataFilter,this,[c,a.param,d,e])||d}:undefined,success:function(d,e,f){k.data_=d,b.UTIL.fire(a.callbacks.ajax.success,this,[c,a.param,d,e,f])},error:function(d,e,f){k.errorThrown_=f,b.UTIL.fire(a.callbacks.ajax.error,this,[c,a.param,d,e,f])},complete:function(d,e){b.UTIL.fire(a.callbacks.ajax.complete,this,[c,a.param,d,e]),k.model_.setActiveXHR(null),k.errorThrown_?a.fallback&&"abort"!==e&&(a.balance.self&&k.app_.disableBalance(),k.model_.fallback(c,a)):k.model_.isDeferrable||(k.textStatus_=e,k.jqXHR_=d,k.update_())}},o=jQuery.extend(!0,{},a.ajax,p,o),i&&j.time.push(j.now()-j.fire),i&&j.name.push("request("+j.time.slice(-1)+")"),l=this.model_.setActiveXHR(jQuery.ajax(o)),jQuery(document).trigger(jQuery.Event(a.gns+".request",l)),this.model_.isDeferrable&&jQuery.when(l,k.wait_(b.UTIL.fire(a.wait,null,[c,a.param,a.origLocation.href,a.destLocation.href]))).done(f).fail(g).always(h)}b.UTIL.fire(a.callbacks.after,null,[c,a.param])===!1}},c.prototype.update_=function(){a:{var a=this.app_,c=this.setting_,d=this.event_,e=(this.register_,this.data_,this.textStatus_,this.jqXHR_),f=c.callbacks.update;c.loadtime=c.loadtime&&(new Date).getTime()-c.loadtime,c.loadtime=c.loadtime<100?0:c.loadtime;var g=c.speedcheck,h=this.model_.stock("speed");if(g&&h.time.push(h.now()-h.fire),g&&h.name.push("load("+h.time.slice(-1)+")"),this.model_.setActiveSetting(c),b.UTIL.fire(f.before,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_,this.cache_])!==!1){if(c.cache.mix&&"popstate"!==d.type.toLowerCase()&&(new Date).getTime()-d.timeStamp<=c.cache.mix)return this.model_.fallback(d,c);try{if(a.landing=null,!~(e.getResponseHeader("Content-Type")||"").toLowerCase().search(c.contentType))throw new Error("throw: content-type mismatch");this.srcDocument_=a.createHTMLDocument(e.responseText),this.dstDocument_=document;var i=this.srcDocument_,j=this.dstDocument_;if(c.area=this.app_.chooseArea(c.area,i,j),!c.area)throw new Error("throw: area notfound");if(c.areas=c.area.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g),g&&h.time.push(h.now()-h.fire),g&&h.name.push("parse("+h.time.slice(-1)+")"),this.updateRewrite_(),this.updateCache_(),jQuery("noscript",i).children().parent().each(function(){this.children.length&&jQuery(this).text(this.innerHTML)}),this.updateRedirect_(),jQuery(window).trigger(c.gns+".unload"),this.updateUrl_(),c.origLocation.href=c.destLocation.href,this.updateVerify_(),this.updateTitle_(),this.updateHead_(),g&&h.time.push(h.now()-h.fire),g&&h.name.push("head("+h.time.slice(-1)+")"),this.loadwaits_=this.updateContent_(),g&&h.time.push(h.now()-h.fire),g&&h.name.push("content("+h.time.slice(-1)+")"),jQuery("noscript",i).remove(),this.updateBalance_(),this.updateLoad_(),b.UTIL.fire(f.success,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1)break a;if(b.UTIL.fire(f.complete,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1)break a;if(b.UTIL.fire(c.callback,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1)break a}catch(k){if(!k)return;if(this.cache_&&this.model_.removeCache(c.destLocation.href),b.UTIL.fire(f.error,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1)break a;if(b.UTIL.fire(f.complete,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1)break a;this.model_.fallback(d,c)}b.UTIL.fire(f.after,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1}}},c.prototype.updateRewrite_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;a.rewrite&&b.UTIL.fire(d.rewrite.before,null,[c,a.param])!==!1&&(b.UTIL.fire(a.rewrite,null,[this.srcDocument_,a.area,this.host_]),b.UTIL.fire(d.rewrite.before,null,[c,a.param])===!1)},c.prototype.updateCache_=function(){var a=this.setting_,c=this.cache_,d=this.event_,e=(this.data_,this.textStatus_),f=this.jqXHR_,g=a.callbacks.update;if((a.cache.click||a.cache.submit||a.cache.popstate)&&("submit"!==d.type.toLowerCase()||a.cache[d.currentTarget.method.toLowerCase()])&&b.UTIL.fire(g.cache.before,null,[d,a.param,c])!==!1){if(this.model_.setCache(a.destLocation.href,c&&c.data||null,e,f),c=this.model_.getCache(a.destLocation.href),this.cache_=c,c&&c.data){var h=this.app_.createHTMLDocument(c.data),i=this.srcDocument_;i.title=h.title;for(var j,k,l=-1;a.areas[++l];){j=jQuery(a.areas[l],h).clone(),k=jQuery(a.areas[l],i);for(var m=-1;j[++m];)k.eq(m).replaceWith(j.eq(m))}}b.UTIL.fire(g.cache.after,null,[d,a.param,c])===!1}},c.prototype.updateRedirect_=function(){var c=this.setting_,d=this.event_,e=this.register_,f=c.callbacks.update;if(jQuery('head meta[http-equiv="Refresh"][content*="URL="]',this.srcDocument_).length&&b.UTIL.fire(f.redirect.before,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var g=c.destLocation.cloneNode();switch(g.href=jQuery(g).attr("content").match(/\w+:\/\/[^;\s]+/i).shift(),!0){case!c.redirect:case g.protocol!==c.destLocation.protocol:case g.host!==c.destLocation.host:case"submit"===d.type.toLowerCase()&&"GET"===d.currentTarget.method.toUpperCase():switch(d.type.toLowerCase()){case"click":case"submit":return window.location.assign(g.href);case"popstate":return window.location.replace(g.href)}default:switch(jQuery[a.NAME].enable(),d.type.toLowerCase()){case"click":return void jQuery[a.NAME].click(g.href);case"submit":return void 0===d.currentTarget.method.toUpperCase()?jQuery[a.NAME].click(g):window.location.assign(g.href);case"popstate":return window.history.replaceState(window.history.state,this.srcDocument_.title,g.href),e&&c.fix.location&&(jQuery[a.NAME].disable(),window.history.back(),window.history.forward(),jQuery[a.NAME].enable()),void jQuery(window).trigger("popstate."+c.gns)}}b.UTIL.fire(f.redirect.after,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},c.prototype.updateUrl_=function(){var c=this.setting_,d=this.event_,e=this.register_,f=c.callbacks.update;b.UTIL.fire(f.url.before,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1&&(e&&window.history.pushState(b.UTIL.fire(c.state,null,[d,c.param,c.origLocation.href,c.destLocation.href]),window.opera||~window.navigator.userAgent.toLowerCase().indexOf("opera")?this.dstDocument_.title:this.srcDocument_.title,c.destLocation.href),e&&c.fix.location&&(jQuery[a.NAME].disable(),window.history.back(),window.history.forward(),jQuery[a.NAME].enable()),b.UTIL.fire(f.url.after,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1)},c.prototype.updateTitle_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;b.UTIL.fire(d.title.before,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])!==!1&&(this.dstDocument_.title=this.srcDocument_.title,a.database&&a.fix.history&&this.app_.data.saveTitleToDB(a.destLocation.href,this.srcDocument_.title),b.UTIL.fire(d.title.after,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])===!1)},c.prototype.updateHead_=function(){var a=this.setting_,c=this.event_,d=this.srcDocument_,e=this.dstDocument_,f=a.callbacks.update;if(a.load.head&&b.UTIL.fire(f.head.before,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var g,h,i=jQuery("title"),j=[];g=jQuery("head",d).find(a.load.head).not(a.load.ignore).not('link[rel~="stylesheet"], style, script'),h=jQuery("head",e).find(a.load.head).not(a.load.ignore).not('link[rel~="stylesheet"], style, script');for(var k,l,m=0;k=g[m];m++){switch(k=e.importNode?e.importNode(k,!0):jQuery(k.outerHTML),k.tagName.toLowerCase()){case"base":l="*";break;case"link":switch(l='[rel="'+k.getAttribute("rel")+'"]',(k.getAttribute("rel")||"").toLowerCase()){case"alternate":l+="string"==typeof k.getAttribute("type")?'[type="'+k.getAttribute("type")+'"]':":not([type])"}break;case"meta":if(k.getAttribute("charset"))l="[charset]";else if(k.getAttribute("http-equiv"))l='[http-equiv="'+k.getAttribute("http-equiv")+'"]';else if(k.getAttribute("name"))l='[name="'+k.getAttribute("name")+'"]';else{if(!k.getAttribute("property"))continue;l='[property="'+k.getAttribute("property")+'"]'}break;default:l=null}if(l){for(var n=h.filter(k.tagName).filter(l),o=n.length;o--;)if(n[o].outerHTML===k.outerHTML){h=h.not(n[o]),k=null;break}k&&j.push(k)}}i.before(j),h.remove(),b.UTIL.fire(f.head.after,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},c.prototype.updateContent_=function(){function a(){return this?(l=l.add(this),k.clone()):void 0}function c(){if(l.length){var a=l.first()[0];l=l.not(a);var b=jQuery(a).is("[type]")?a.type:undefined;a.type=e.gns+"/noexec",this.parentNode.insertBefore(a,this.nextSibling),this.parentNode.removeChild(this),"string"==typeof b?a.type=b:a.removeAttribute("type")}}function d(){var a=jQuery.Deferred();return jQuery(this).one("load error",a.resolve),a}var e=this.setting_,f=this.event_,g=this.srcDocument_,h=this.dstDocument_,i=e.callbacks.update,j=jQuery(),k=jQuery(),l=jQuery(),m=[];if(b.UTIL.fire(i.content.before,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return m;jQuery(e.area).children("."+e.nss.class4html+"-check").remove(),j=jQuery("<div/>",{"class":e.nss.class4html+"-check",style:"background: none !important; display: block !important; visibility: hidden !important; position: absolute !important; top: 0 !important; left: 0 !important; z-index: -9999 !important; width: auto !important; height: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; font-size: 12px !important; text-indent: 0 !important;"}).text(e.gns),k=j.clone().removeAttr("class").addClass(e.nss.class4html+"-mark");for(var n,o,p=-1;e.areas[++p];){if(n=jQuery(e.areas[p],g).clone(),o=jQuery(e.areas[p],h),!n.length||!o.length||n.length!==o.length)throw new Error("throw: area mismatch");l=jQuery(),n.find("script").replaceWith(a),jQuery.when&&m.concat(n.find("img, iframe, frame").map(d).get());for(var q=-1;n[++q];)o.eq(q).replaceWith(n.eq(q).append(j.clone()));jQuery(e.areas[p],h).find("."+e.nss.class4html+"-mark").each(c)}return jQuery(h).trigger(e.gns+".DOMContentLoaded"),b.UTIL.fire(i.content.after,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])===!1?m:m},c.prototype.updateLoad_=function(){var a=this,c=this.setting_,d=this.dstDocument_;this.updateCSS_('link[rel~="stylesheet"], style'),jQuery(window).one(c.gns+".rendering",function(e){e.preventDefault(),e.stopImmediatePropagation(),a.updateScroll_(!1);var f=a.updateScript_(":not([defer]), :not([src])"),g=function(){jQuery(d).trigger(c.gns+".ready");var e=jQuery(c.area).children("."+c.nss.class4html+"-check"),f=(new Date).getTime()+5e3,g=function(){switch(!0){case c.destLocation.href!==b.UTIL.canonicalizeUrl(window.location.href).replace(/(?:%\w{2})+/g,function(a){return String(c.destLocation.href.match(a.toLowerCase())||a)}):break;case(new Date).getTime()>f:case e.length===e.filter(function(){return this.clientWidth||this.clientHeight||jQuery(this).is(":hidden")}).length:a.updateRender_();break;default:setTimeout(g,100)}};g()};a.model_.isDeferrable?jQuery.when.apply(jQuery,f).always(function(){return g()}):g()}).trigger(c.gns+".rendering")},c.prototype.updateScroll_=function(a){var c=this.setting_,d=this.event_,e=c.callbacks.update;if(b.UTIL.fire(e.scroll.before,null,[d,c.param])!==!1){var f,g;switch(d.type.toLowerCase()){case"click":case"submit":f=a&&"function"==typeof c.scrollLeft?b.UTIL.fire(c.scrollLeft,null,[d,c.param,c.origLocation.href,c.destLocation.href]):c.scrollLeft,f=f>=0?f:0,f=f===!1||null===f?jQuery(window).scrollLeft():parseInt(Number(f)+"",10),g=a&&"function"==typeof c.scrollTop?b.UTIL.fire(c.scrollTop,null,[d,c.param,c.origLocation.href,c.destLocation.href]):c.scrollTop,g=g>=0?g:0,g=g===!1||null===g?jQuery(window).scrollTop():parseInt(Number(g)+"",10),jQuery(window).scrollTop()===g&&jQuery(window).scrollLeft()===f||window.scrollTo(f,g),a&&c.database&&this.app_.isScrollPosSavable&&c.fix.scroll&&this.app_.data.saveScrollPositionToCacheAndDB(c.destLocation.href,f,g);break;case"popstate":a&&c.fix.scroll&&c.database&&this.app_.data.loadScrollPositionFromCacheOrDB(c.destLocation.href)}b.UTIL.fire(e.scroll.after,null,[d,c.param])===!1}},c.prototype.updateCSS_=function(a){var c=this.setting_,d=this.event_,e=this.srcDocument_,f=this.dstDocument_,g=c.callbacks.update;if(c.load.css&&b.UTIL.fire(g.css.before,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){for(var h,i=jQuery(a,e).not(jQuery(c.area,e).find(a)).not(c.load.ignore),j=jQuery(a,f).not(jQuery(c.area,f).find(a)).not(c.load.ignore),k=[],l=0;h=i[l];l++){for(var m,n=0;j[n];n++){switch(h.tagName.toLowerCase()){case"link":m=h.href===j[n].href;break;case"style":m=b.UTIL.trim(h.innerHTML)===b.UTIL.trim(j[n].innerHTML)}if(m){k.length&&(h=j.eq(n).prevAll(a)[0],h?jQuery(h).after(jQuery(k).clone()):j.eq(n).before(jQuery(k).clone()),k=[]),j=j.not(j[n]),n-=Number(!!n),h=null;break}}h&&k.push(h)}if(jQuery("head",f).append(jQuery(jQuery.grep(k,function(a){return e.head===a.parentElement})).clone()),jQuery("body",f).append(jQuery(jQuery.grep(k,function(a){return e.head!==a.parentElement})).clone()),j.remove(),b.UTIL.fire(g.css.after,null,[d,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var o=c.speedcheck,p=this.model_.stock("speed");o&&p.time.push(p.now()-p.fire),o&&p.name.push("css("+p.time.slice(-1)+")")}}},c.prototype.updateScript_=function(a){var c=this,d=this.setting_,e=this.event_,f=this.srcDocument_,g=this.dstDocument_,h=d.callbacks.update;if(d.load.script&&b.UTIL.fire(h.script.before,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){for(var i,j=jQuery("script",f).not(d.load.ignore),k=[],l=[],m=/^$|(?:application|text)\/(?:java|ecma)script/i,n=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,o=this.app_.stock("executed"),p=0;i=j[p];p++)if(jQuery(i).is(a)&&(i.src||b.UTIL.trim(i.innerHTML))&&!(i.src in o)){var q=jQuery(i).parent(d.load.log);if(q.length&&!jQuery(i).parents(d.area).length){var r=jQuery(i).is("[type]")?i.type:undefined;i.type=d.gns+"/noexec",jQuery(q[0].id||q[0].tagName,g)[0].appendChild(i),"string"==typeof r?i.type=r:i.removeAttribute("type")}this.model_.isDeferrable?!function(a){if(i.src){if(d.load.reload&&jQuery(i).is(d.load.reload)||(o[i.src]=!0),"string"==typeof i.getAttribute("async"))return void jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:i.src,async:!0,global:!1}));jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:i.src,dataType:"text",async:!0,global:!1})).always(function(){return"string"==typeof arguments[0]&&a.resolve(arguments[0])})}else a.resolve("object"==typeof i&&(!i.type||m.test(i.type))&&(i.text||i.textContent||i.innerHTML||"").replace(n,""));l.push(a)}(jQuery.Deferred()):k.push(i)}try{if(this.model_.isDeferrable)jQuery.when.apply(jQuery,l).always(function(){for(var a=0,b=arguments.length;b>a;a++)arguments[a]&&eval.call(window,arguments[a])});else for(var i,p=0;i=k[p];p++)i.src?(d.load.reload&&jQuery(i).is(d.load.reload)||(o[i.src]=!0),jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:i.src,async:"string"==typeof i.getAttribute("async"),global:!1}))):"object"==typeof i&&(!i.type||m.test(i.type))&&eval.call(window,(i.text||i.textContent||i.innerHTML||"").replace(n,""))}catch(s){throw setTimeout(function(){return c.model_.fallback(e,d)},50),s}if(b.UTIL.fire(h.script.after,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var t=d.speedcheck,u=this.model_.stock("speed");return t&&u.time.push(u.now()-u.fire),t&&u.name.push(("[src][defer]"===a?"defer":"script")+"("+u.time.slice(-1)+")"),l}}},c.prototype.updateRender_=function(){var a=this,c=this.setting_,d=this.event_,e=jQuery(c.area).children("."+c.nss.class4html+"-check"),f=this.loadwaits_,g=c.callbacks.update,h=c.speedcheck,i=this.model_.stock("speed");if(h&&i.time.push(i.now()-i.fire),h&&i.name.push("renderd("+i.time.slice(-1)+")"),b.UTIL.fire(g.render.before,null,[d,c.param])!==!1){e.remove(),setTimeout(function(){a.app_.isScrollPosSavable=!0,"popstate"!==d.type.toLowerCase()?a.scrollByHash_(c.destLocation.hash)||a.updateScroll_(!0):a.updateScroll_(!0)},100),jQuery(document).trigger(c.gns+".render");var j=function(){jQuery(window).trigger(c.gns+".load"),a.updateScript_("[src][defer]")};jQuery.when&&f.length?jQuery.when.apply(jQuery,f).always(j):j(),h&&console.log(i.time),h&&console.log(i.name),b.UTIL.fire(g.render.after,null,[d,c.param])===!1}},c.prototype.updateVerify_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;if(b.UTIL.fire(d.verify.before,null,[c,a.param])!==!1){if(a.destLocation.href!==b.UTIL.canonicalizeUrl(window.location.href).replace(/(?:%\w{2})+/g,function(b){return String(a.destLocation.href.match(b.toLowerCase())||b)}))throw a.retriable?(a.retriable=!1,a.destLocation.href=b.UTIL.canonicalizeUrl(window.location.href),new this.app_.Update(this.model_,this.app_,a,c,!1,a.cache[c.type.toLowerCase()]&&this.model_.getCache(a.destLocation.href)),!1):new Error("throw: location mismatch");a.retriable=!0,b.UTIL.fire(d.verify.after,null,[c,a.param])===!1}},c.prototype.updateBalance_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;if(a.balance.self&&a.loadtime&&b.UTIL.fire(d.balance.before,null,[c,a.param])!==!1){var e=(this.jqXHR_.getResponseHeader(a.balance.server.header)||"").split("//").pop();this.app_.data.saveLogToDB({host:e,performance:Math.ceil(a.loadtime/(this.jqXHR_.responseText.length||1)*1e5),date:(new Date).getTime()}),this.app_.data.saveServerToDB(e,0,a.destLocation.href,this.app_.calExpires(this.jqXHR_)),this.app_.chooseRequestServer(a),b.UTIL.fire(d.balance.after,null,[c,a.param])===!1}},c.prototype.wait_=function(a){var b=jQuery.Deferred();return a?(setTimeout(function(){b.resolve()},a),b):b.resolve()},c.prototype.scrollByHash_=function(a){if(a="#"===a.charAt(0)?a.slice(1):a,!a)return!1;var b=jQuery("#"+(a?a:", [name~="+a+"]")).first();return b.length?(isFinite(b.offset().top)&&window.scrollTo(jQuery(window).scrollLeft(),parseInt(Number(b.offset().top)+"",10)),!0):!1},c}();b.AppUpdate=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a){this.buffer_=[],this.DB_=a}return a.prototype.accessStore=function(a,b){var c=this;"undefined"==typeof b&&(b="readwrite"),this.DB_.conExtend();try{var d=this.DB_.database(),e=d.transaction(this.name,b).objectStore(this.name)}catch(f){}e?a(e):this.DB_.opendb(function(){c.accessStore(a)})},a.prototype.accessRecord=function(a,b,c){"undefined"==typeof c&&(c="readwrite"),this.accessStore(function(c){c.get(a).onsuccess=b},c)},a.prototype.loadBuffer=function(a){var b=this,c=this;this.accessStore(function(d){var e=d.indexNames.length?d.indexNames[0]:d.keyPath;
+
!new function(window,document,undefined,$){"use strict";var MODULE;!function(a){a.NAME="pjax",a.NAMESPACE=jQuery,function(a){a[a.wait=-1]="wait",a[a.ready=0]="ready",a[a.lock=1]="lock",a[a.seal=2]="seal",a[a.error=3]="error"}(a.State||(a.State={}));a.State;a.GEN_UUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16).toUpperCase()})}}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d=function(){function b(b,d,e){for(var f=[],g=0;g<arguments.length-3;g++)f[g]=arguments[g+3];this.model_=b,this.controller_=d,this.state_=-1,this.queue_=[],this.HANDLERS={},c=d,this.UUID=a.GEN_UUID(),this.CONTEXT=e,this.OBSERVE.apply(this,f),this.state_=0}return b.prototype.OBSERVE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},b.prototype.RELEASE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},b.prototype.BIND=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];return this.UNBIND(),this},b.prototype.UNBIND=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];return this},b.EVENTS={},b.TRIGGERS={},b}();b.Template=d}(a.VIEW||(a.VIEW={}));a.VIEW}(MODULE||(MODULE={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},MODULE;!function(a){!function(a){var b,c=function(a){function c(c,d,e){a.call(this,c,d,e),this.model_=c,this.controller_=d,this.HANDLERS={CLICK:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.CLICK.apply(b,a)},SUBMIT:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.SUBMIT.apply(b,a)},POPSTATE:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.POPSTATE.apply(b,a)},SCROLL:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.SCROLL.apply(b,a)}},b=d}return __extends(c,a),c.prototype.BIND=function(a){return this.UNBIND(a),this.CONTEXT.delegate(a.link,a.nss.click,this.HANDLERS.CLICK).delegate(a.form,a.nss.submit,this.HANDLERS.SUBMIT),jQuery(window).bind(a.nss.popstate,this.HANDLERS.POPSTATE),a.fix.scroll&&jQuery(window).bind(a.nss.scroll,this.HANDLERS.SCROLL),this},c.prototype.UNBIND=function(a){return this.CONTEXT.undelegate(a.link,a.nss.click).undelegate(a.form,a.nss.submit),jQuery(window).unbind(a.nss.popstate),a.fix.scroll&&jQuery(window).unbind(a.nss.scroll),this},c.prototype.OBSERVE=function(){return this.RELEASE(),this},c.prototype.RELEASE=function(){return this},c.EVENTS={},c.TRIGGERS={},c}(a.Template);a.Main=c}(a.VIEW||(a.VIEW={}));a.VIEW}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d,e=function(){function b(a,b){c=b,d=a}return b.prototype.enable=function(){return c.enable(),this},b.prototype.disable=function(){return c.disable(),this},b.prototype.click=function(b,e){var f,g=c.getGlobalSetting();switch(typeof b){case"undefined":f=this.end().filter("a").first().clone();break;case"object":f=jQuery(b).clone();break;case"string":e=e||{},e.href=b,f=jQuery("<a/>",e);break;default:return this}return f.first().one(g.nss.click,function(b){return new a.VIEW.Main(c,d,null).HANDLERS.CLICK(b)}).click()},b.prototype.submit=function(b,e,f){var g,h,i,j=c.getGlobalSetting(),k=document.createDocumentFragment();switch(!0){case"undefined"==typeof b:g=this.end().filter("form").first().clone();break;case"object"==typeof b:g=jQuery(b).clone();break;case!!f:e=e||{},e.action=b,h=f instanceof Array&&Array||f instanceof Object&&Object||undefined;for(var l in f){switch(h){case Object:i=jQuery("<textarea/>",{name:l}).val(f[l]);break;case Array:f[l].attr=f[l].attr||{},f[l].attr.name=f[l].name,i=jQuery(f[l].tag.indexOf("<")?"<"+f[l].tag+"/>":f[l].tag,f[l].attr||{}).val(f[l].value);break;default:continue}k.appendChild(i[0])}g=jQuery("<form/>",e).append(k);break;default:return this}return g.first().one(j.nss.submit,function(b){return new a.VIEW.Main(c,d,null).HANDLERS.SUBMIT(b)}).submit()},b.prototype.getCache=function(a){"undefined"==typeof a&&(a=window.location.href);var b=c.getCache(a);return b&&(b={data:b.data,textStatus:b.textStatus,jqXHR:b.jqXHR,expires:b.expires}),b},b.prototype.setCache=function(a,b,d,e){switch("undefined"==typeof a&&(a=window.location.href),arguments.length){case 0:return this.setCache(a,document.documentElement.outerHTML);case 1:return this.setCache(a,null);case 2:case 3:case 4:default:c.setCache(a,b,d,e)}return this},b.prototype.removeCache=function(a){return"undefined"==typeof a&&(a=window.location.href),c.removeCache(a),this},b.prototype.clearCache=function(){return c.clearCache(),this},b.prototype.follow=function(b,d,e,f){if(!c.isDeferrable)return!1;var g=b.currentTarget;return d.follow=!0,d.host=e||"",isFinite(b.timeStamp)&&(d.timeStamp=f||b.timeStamp),c.setGlobalXHR(d),jQuery.when(d).done(function(){!c.getCache(g.href)&&c.isImmediateLoadable(b)&&c.setCache(g.href,undefined,undefined,d)}),jQuery[a.NAME].click(g.href),!0},b.prototype.host=function(){return c.host()},b}();b.ControllerFunction=e}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(b,c){a.call(this,b,c)}return __extends(b,a),b}(a.ControllerFunction);a.ControllerMethod=b}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d,e=function(){function e(e){for(var f=[],g=0;g<arguments.length-1;g++)f[g]=arguments[g+1];this.state_=-1,this.HANDLERS={},c=e,d=this,this.UUID=a.GEN_UUID(),a.NAMESPACE[a.NAME]=a.NAMESPACE&&a.NAMESPACE==a.NAMESPACE.window?this.EXEC:a.NAMESPACE.prototype[a.NAME]=this.EXEC;var h=new b.ControllerFunction(d,c);this.REGISTER_FUNCTIONS(a.NAMESPACE[a.NAME],h),this.UPDATE_PROPERTIES(a.NAMESPACE[a.NAME],h),this.OBSERVE.apply(this,f),this.state_=0}return e.prototype.EXTEND=function(e){if(e===a.NAMESPACE||a.NAMESPACE&&a.NAMESPACE==a.NAMESPACE.window){var f=new b.ControllerFunction(d,c);e=a.NAMESPACE[a.NAME]}else var f=new b.ControllerMethod(d,c);return e instanceof a.NAMESPACE&&(e instanceof jQuery&&(e=e.add()),this.REGISTER_FUNCTIONS(e,f)),this.UPDATE_PROPERTIES(e,f),e},e.prototype.EXEC=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];var e=d.EXTEND(this);return a=[e].concat(a),a=d.exec_.apply(d,a),a=a instanceof Array?a:[a],c.MAIN.apply(c,a)},e.prototype.exec_=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return[a].concat(b)},e.prototype.REGISTER_FUNCTIONS=function(a,c){{var d;b.Template.PROPERTIES}for(d in c)a[d]=c[d];return a},e.prototype.UPDATE_PROPERTIES=function(a,c){var d,e,f,g=b.Template.PROPERTIES;for(d=0,e=g.length;e>d;d++)f=g[d],c[f]&&(a[f]=c[f].call(a));return a},e.prototype.OBSERVE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},e.prototype.RELEASE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},e.EVENTS={},e.FUNCTIONS={},e.METHODS={},e.PROPERTIES=[],e.TRIGGERS={},e}();b.Template=e}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(b){function c(a){b.call(this,a),this.model_=a,this.HANDLERS={}}return __extends(c,b),c.prototype.exec_=function(b,c){b=b instanceof jQuery?b:this.EXTEND(jQuery(document));var d;return d=b instanceof a.NAMESPACE?"m:":"f:",d+=c?{}.toString.call(c).split(" ").pop().slice(0,-1).toLowerCase():c,d.toLowerCase(),[b,c]},c.prototype.OBSERVE=function(){},c.prototype.CLICK=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.CLICK.apply(this.model_,a)},c.prototype.SUBMIT=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.SUBMIT.apply(this.model_,a)},c.prototype.POPSTATE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.POPSTATE.apply(this.model_,a)},c.prototype.SCROLL=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.SCROLL.apply(this.model_,a)},c.EVENTS={},c.PROPERTIES=[],c.TRIGGERS={},c}(b.Template);b.Main=c}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function b(){this.NAME=a.NAME,this.NAMESPACE=a.NAMESPACE,this.state_=-1,this.stock=function c(d,e,f){if(this instanceof c)switch(typeof d){case"object":case"function":return this.uuid=a.GEN_UUID(),c[this.uuid]=this,jQuery.extend.apply(jQuery,[!0,this].concat([].slice.call(arguments)).concat({uuid:this.uuid}));case"string":return delete c[d]}else if("object"==typeof d){var g,h=d;for(g in h)b.store(g,h[g])}else switch(arguments.length){case 0:return new this.stock;case 1:return this.stock[d]||b.store(d);case 2:return b.store(d,e);case 3:return b.store(d,e,f)}},this.UUID=a.GEN_UUID()}return b.prototype.MAIN=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return this.main_.apply(this,[a].concat(b))},b.prototype.main_=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return this.state_=0,a},b.store=function(a,c){switch(arguments.length){case 0:break;case 1:return b.store[a];case 2:return b.store[a]=c;case 3:return b.store[a]=jQuery.extend(!0,b.store[a],c)}},b}();b.Template=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a){this.buffer_=[],this.DB_=a}return a.prototype.accessStore=function(a,b){var c=this;"undefined"==typeof b&&(b="readwrite"),this.DB_.conExtend();try{var d=this.DB_.database(),e=d&&d.transaction(this.name,b).objectStore(this.name)}catch(f){}e?a(e):this.DB_.opendb(function(){return c.accessStore(a)})},a.prototype.accessRecord=function(a,b,c){"undefined"==typeof c&&(c="readwrite"),this.accessStore(function(c){c.get(a).onsuccess=b},c)},a.prototype.loadBuffer=function(a){var b=this;"undefined"==typeof a&&(a=0);var c=this;this.accessStore(function(d){var e=d.indexNames.length?d.indexNames[0]:d.keyPath;d.index(e).openCursor(b.DB_.IDBKeyRange.lowerBound(0),"prev").onsuccess=function(){if(this.result){var b=this.result,e=b.value;c.buffer_[e[d.keyPath]]=e,--a&&b["continue"]&&b["continue"]()}}})},a.prototype.saveBuffer=function(){},a.prototype.getBuffer=function(a){return a?this.buffer_[a]:this.buffer_},a.prototype.setBuffer=function(a,b){var c=a[this.keyPath];return this.buffer_[c]=b?jQuery.extend(!0,{},this.buffer_[c],a):a,this.buffer_[a[this.keyPath]]},a.prototype.addBuffer=function(a){return a[this.keyPath]=this.buffer_.length||1,this.buffer_.push(a),a},a.prototype.add=function(a){var b=a[this.keyPath];delete a[this.keyPath],this.accessRecord(b,function(){"undefined"!=typeof b&&this.source["delete"](b),this.source.add(a)})},a.prototype.set=function(a){var b=a[this.keyPath];this.accessRecord(b,function(){this.source.put(jQuery.extend(!0,{},this.result,a))})},a.prototype.get=function(a,b){this.accessRecord(a,b)},a.prototype.del=function(a){this.accessRecord(a,function(){this.source["delete"](a)})},a}();a.DataStore=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="meta",this.keyPath="id"}return __extends(b,a),b}(a.DataStore);a.DataStoreMeta=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="history",this.keyPath="id"}return __extends(b,a),b.prototype.clean=function(){var a=this;this.accessStore(function(b){b.count().onsuccess=function(){this.result>1e3&&(b.index("date").openCursor(a.DB_.IDBKeyRange.upperBound((new Date).getTime()-2592e5)).onsuccess=function(){if(this.result){var a=this.result;a?(a["delete"](a.value[b.keyPath]),a["continue"]&&a["continue"]()):b.count().onsuccess=function(){1e3<this.result&&b.clear()}}})}})},b}(a.DataStore);a.DataStoreHistory=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="log",this.keyPath="id"}return __extends(b,a),b.prototype.clean=function(){this.accessStore(function(a){var b=50;a.count().onsuccess=function(){this.result>b+10&&(b=this.result-b,a.index(a.keyPath).openCursor(this.DB_.IDBKeyRange.lowerBound(0)).onsuccess=function(){if(this.result){var c=this.result;c&&(0>--b&&c["delete"](c.value[a.keyPath]),c["continue"]&&c["continue"]())}})}})},b}(a.DataStore);a.DataStoreLog=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="server",this.keyPath="id"}return __extends(b,a),b}(a.DataStore);a.DataStoreServer=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function c(){var c=this;this.IDBFactory=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.mozIDBKeyRange||window.msIDBKeyRange,this.name_=a.NAME,this.version_=4,this.refresh_=10,this.upgrade_=1,this.state_=-1,this.database=function(){return c.database_},this.state=function(){return c.state_},this.nowInitializing=!1,this.nowRetrying=!1,this.conAge_=1e4,this.conInterval_=1e3,this.tasks_=[],this.store={meta:new b.DataStoreMeta(this),history:new b.DataStoreHistory(this),log:new b.DataStoreLog(this),server:new b.DataStoreServer(this)},this.metaNames={version:"version",update:"update"};var d=function(){var a=(new Date).getTime(),b=c.conExpires_;b&&a>b&&(c.closedb(),c.conExpires_=0),setTimeout(d,Math.max(c.conExpires_-a+100,c.conInterval_)),c.tasks_.length&&!c.nowInitializing&&!c.nowRetrying&&c.opendb(null,!0)};this.conAge_&&setTimeout(d,this.conInterval_)}return c.prototype.opendb=function(a,b){var c=this;if(c.conExtend(),c.IDBFactory&&(a||c.tasks_.length)&&("function"==typeof a&&c.reserveTask_(a),!c.nowInitializing&&!c.nowRetrying))try{c.nowInitializing=!0;var d=c.IDBFactory.open(c.name_,c.upgrade_?c.version_:1);d.onblocked=function(){c.closedb(1);try{this.result.close(),!b&&setTimeout(function(){return c.opendb(null,!0)},1e3)}catch(a){!b&&c.initdb_(1e3)}},d.onupgradeneeded=function(){try{for(var a=this.result,d=a.objectStoreNames?a.objectStoreNames.length:0;d--;)a.deleteObjectStore(a.objectStoreNames[d]);a.createObjectStore(c.store.meta.name,{keyPath:c.store.meta.keyPath,autoIncrement:!1}).createIndex(c.store.meta.keyPath,c.store.meta.keyPath,{unique:!0}),a.createObjectStore(c.store.history.name,{keyPath:c.store.history.keyPath,autoIncrement:!1}).createIndex("date","date",{unique:!1}),a.createObjectStore(c.store.log.name,{keyPath:c.store.log.keyPath,autoIncrement:!0}).createIndex("date","date",{unique:!1}),a.createObjectStore(c.store.server.name,{keyPath:c.store.server.keyPath,autoIncrement:!1}).createIndex(c.store.server.keyPath,c.store.server.keyPath,{unique:!0})}catch(e){!b&&c.initdb_(1e3)}},d.onsuccess=function(){try{var a=this.result;c.checkdb_(a,c.version_,function(){c.database_=a,c.state_=0,c.conExtend(),c.nowInitializing=!1,c.digestTask_(),c.nowRetrying=!1},function(){!b&&c.initdb_()})}catch(d){a.close(),!b&&c.initdb_(1e3)}},d.onerror=function(){c.closedb(3);try{this.result.close(),!b&&setTimeout(function(){return c.opendb(null,!0)},1e3)}catch(a){!b&&c.initdb_(1e3)}}}catch(e){c.closedb(3),!b&&c.initdb_(1e3)}},c.prototype.closedb=function(a){"undefined"==typeof a&&(a=-1),this.database_=null,this.state_=a;var b=this.database_;b&&b.close&&b.close()},c.prototype.deletedb_=function(){this.closedb();var a=this.IDBFactory;a&&a.deleteDatabase&&a.deleteDatabase(this.name_)},c.prototype.initdb_=function(a){var b=this,c=function(){b.nowRetrying||(b.nowRetrying=!0,b.deletedb_()),b.opendb(null,!0)};a?void setTimeout(c,a):c()},c.prototype.checkdb_=function(a,b,c,d){var e=this,f=a.transaction(e.store.meta.name,"readwrite").objectStore(e.store.meta.name).get(e.metaNames.version);f.onsuccess=function(){var f=this.result;if(!f||e.upgrade_)this.source.put({id:e.metaNames.version,value:b});else if(f.value!==b)return void d();if(e.refresh_){var g=a.transaction(e.store.meta.name,"readwrite").objectStore(e.store.meta.name).get(e.metaNames.update);g.onsuccess=function(){var a=this.result,b=Math.floor((new Date).getTime()/864e5);if(a){if(a.value<=b)return void d()}else this.source.put({id:e.metaNames.update,value:b+e.refresh_});c()}}else c()}},c.prototype.conExtend=function(){this.conExpires_=(new Date).getTime()+this.conAge_},c.prototype.reserveTask_=function(a){(3!==this.state()||this.tasks_.length<100)&&this.tasks_.push(a)},c.prototype.digestTask_=function(a){"undefined"==typeof a&&(a=0),a=a||-1;for(var b;b=a--&&this.tasks_.pop();)b()},c}();b.DataDB=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a){this.age_=a}return a.prototype.getCookie=function(a){if(a&&window.navigator.cookieEnabled){var b=new RegExp("(?:^|; )("+encodeURIComponent(a)+"=[^;]*)"),c=(document.cookie.match(b)||[]).pop();return c&&decodeURIComponent(c.split("=").pop())}},a.prototype.setCookie=function(a,b,c){return"undefined"==typeof c&&(c={}),a&&window.navigator.cookieEnabled?(c.age=c.age||this.age_,document.cookie=[encodeURIComponent(a)+"="+encodeURIComponent(b),c.age?"; expires="+new Date((new Date).getTime()+1e3*c.age).toUTCString():"",c.secure?"; secure":""].join(""),this.getCookie(a)):void 0},a}();a.DataCookie=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function b(){this.DB=new a.DataDB,this.Cookie=new a.DataCookie(864e3)}return b}();a.Data=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){function b(a,b){function c(b){var c=~a.indexOf(b.toUpperCase())||~a.indexOf(b.toLowerCase());return c?a.substr(~c,b.length):b}return a===b?b:b.replace(/(?:%\w{2})+/g,c)}var c=function(){function a(){}return a.trim=function(a){if(a="string"==typeof a?a:String(0===a&&a.toString()||""),a.trim)a=a.trim();else if(a=a.replace(/^[\s\uFEFF\xA0]+/,"")){var b=/[\s\uFEFF\xA0]/,c=a.length,d=c%8;a:{for(;d--;)if(!b.test(a.charAt(--c)))break a;for(;c;){if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a}}a=a.substring(0,c+1)}return a},a.repeat=function(a,b){switch(a instanceof Array&&"array"||typeof a){case"string":var c=a;return Array(b+1).join(c);case"array":var e=a.length;if(300>b){var f=Array(b);d.duff(-b,function(b){return f[b]=a[b%e]})}else{for(var f=a.slice();2*f.length<=b;)f=f.concat(f);f=f.concat(f.slice(0,b-f.length))}return f}},a.fire=function(a,b,c,d){return"undefined"==typeof b&&(b=window),"undefined"==typeof c&&(c=[]),"function"==typeof a?d?setTimeout(function(){a.apply(b||window,c)},0):a.apply(b||window,c):a},a.duff=function(a,b){if(0>a){for(var c=-a,d=c%8;d--;)b(--c);for(;c;)b(--c),b(--c),b(--c),b(--c),b(--c),b(--c),b(--c),b(--c)}else{for(var e=a,c=0,d=e%8,f=e/8^0;d--;)b(c++);for(;f--;)b(c++),b(c++),b(c++),b(c++),b(c++),b(c++),b(c++),b(c++)}},a.duffEx=function(a,b){if(0>a){var c=-a,d=c%8;a:{for(;d--;)if(!1===b(--c))break a;for(;c;){if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a}}}else{var e=a,c=0,d=e%8,f=e/8^0;a:{for(;d--;)if(!1===b(c++))break a;for(;f--;){if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a}}}},a.normalizeUrl=function(a,c){"undefined"==typeof c&&(c=!0);var e;return e=d.trim(a),e=/^([^:/?#]+):\/\/[^/?#.]+\.[^/?#]+/i.test(e)?e:function(a,b){return b.href=a,b.href}(e,document.createElement("a")),e=encodeURI(decodeURI(e)),e=e.replace(/["`^|\\<>{}\[\]\s].*/,""),e=c?b(a,e):e},a.canonicalizeUrl=function(a){function b(a){return a.toUpperCase()}var c=d.normalizeUrl(a,!1);return c=c.replace(/(?:%\w{2})+/g,b)},a.compareUrl=function(a,c,e){return e&&(a=d.canonicalizeUrl(a),c=d.canonicalizeUrl(c)),a===b(a,c)},a}();a.Utility=c;var d=c;a.Util=a.Utility}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function b(b,c){this.model_=b,this.app_=c,this.data_=new a.Data,this.storeNames={meta:this.data_.DB.store.meta.name,history:this.data_.DB.store.history.name,log:this.data_.DB.store.log.name,server:this.data_.DB.store.server.name}}return b.prototype.getCookie=function(a){return this.data_.Cookie.getCookie(a)},b.prototype.setCookie=function(a,b,c){return this.data_.Cookie.setCookie(a,b,c)},b.prototype.opendb=function(a){var b=this;a.database=!1,this.data_.DB.opendb(function(){b.saveTitleToDB(a.origLocation.href,document.title),b.saveScrollPositionToDB(a.origLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop()),a.database=!0})},b.prototype.getBuffer=function(a,b){return this.data_.DB.store[a].getBuffer(b)},b.prototype.setBuffer=function(a,b,c,d){return this.data_.DB.store[a].setBuffer(b,c,d)},b.prototype.loadBuffer=function(a,b){return"undefined"==typeof b&&(b=0),this.data_.DB.store[a].loadBuffer(b)},b.prototype.saveBuffer=function(a){return this.data_.DB.store[a].saveBuffer()},b.prototype.loadBufferAll=function(a){"undefined"==typeof a&&(a=0);for(var b in this.storeNames)this.loadBuffer(b,a)},b.prototype.saveBufferAll=function(){for(var a in this.storeNames)this.saveBuffer(a)},b.prototype.loadTitleFromDB=function(b){var c=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),d=this,e=this.data_.DB.store.history.getBuffer(c);e&&"string"==typeof e.title?document.title=e.title:this.data_.DB.store.history.get(c,function(){e=this.result,e&&e.title&&a.Util.compareUrl(c,d.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(window.location.href)))&&(document.title=e.title)})},b.prototype.saveTitleToDB=function(b,c){var d=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),e={id:d,title:c,date:(new Date).getTime()};this.data_.DB.store.history.setBuffer(e,!0),this.data_.DB.store.history.set(e),this.data_.DB.store.history.clean()},b.prototype.loadScrollPositionFromDB=function(b){function c(a,b){"number"==typeof a&&"number"==typeof b&&window.scrollTo(parseInt(Number(a)+"",10),parseInt(Number(b)+"",10))}var d=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),e=this,f=this.data_.DB.store.history.getBuffer(d);f&&"number"==typeof f.scrollX?c(f.scrollX,f.scrollY):this.data_.DB.store.history.get(d,function(){f=this.result,f&&"number"==typeof f.scrollX&&a.Util.compareUrl(d,e.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(window.location.href)))&&c(f.scrollX,f.scrollY)})},b.prototype.saveScrollPositionToDB=function(b,c,d){var e=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),f={id:e,scrollX:c,scrollY:d,date:(new Date).getTime()};this.data_.DB.store.history.setBuffer(f,!0),this.data_.DB.store.history.set(f)},b.prototype.loadExpiresFromDB=function(){},b.prototype.saveExpiresToDB=function(a,b,c){var d={id:a,host:b,expires:c};this.data_.DB.store.history.setBuffer(d,!0),this.data_.DB.store.history.set(d)},b.prototype.loadLogFromDB=function(){},b.prototype.saveLogToDB=function(a){this.data_.DB.store.log.addBuffer(a),this.data_.DB.store.log.add(a),this.data_.DB.store.log.clean()},b.prototype.loadServerFromDB=function(){},b.prototype.saveServerToDB=function(a,b,c,d){"undefined"==typeof b&&(b=0),"undefined"==typeof d&&(d=0);var e={id:a||"",state:b};this.data_.DB.store.server.accessRecord(a,function(){var c=this.result;c&&b?c.state&&this.source["delete"](a):this.source.put(e)}),c&&this.saveExpiresToDB(c,a,d)},b}();a.AppData=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a,b){var c=this;this.model_=a,this.app_=b,this.host_="",this.host=function(){return c.host_}}return a.prototype.check=function(a){return a.balance.self&&!!Number(this.app_.data.getCookie(a.balance.client.cookie.balance))},a.prototype.enable=function(a){return!a.balance.client.support.userAgent.test(window.navigator.userAgent)||a.balance.client.exclude.test(window.navigator.userAgent)?void this.disable(a):Number(!this.app_.data.setCookie(a.balance.client.cookie.balance,"1"))?void this.disable(a):void(a.balance.client.support.redirect.test(window.navigator.userAgent)&&this.app_.data.setCookie(a.balance.client.cookie.redirect,"1"))},a.prototype.disable=function(a){this.app_.data.setCookie(a.balance.client.cookie.balance,"0"),this.app_.data.setCookie(a.balance.client.cookie.redirect,"0"),this.changeServer(null,a)},a.prototype.changeServer=function(a,b){"undefined"==typeof b&&(b=this.model_.getGlobalSetting()),this.check(b)&&(a=a||"",this.host_=a,b.balance.server.host=a,this.app_.data.setCookie(b.balance.client.cookie.host,a))},a.prototype.chooseServer=function(a){function b(a,b){return a-b}if(this.check(a)){var c,d=this.app_.data.getBuffer(this.app_.data.storeNames.history,this.model_.convertUrlToKeyUrl(a.destLocation.href));if(c=d&&d.expires,c&&c>=(new Date).getTime())return void this.changeServer(d.host,a);var e=this.app_.data.getBuffer(this.app_.data.storeNames.log),f=[],g={},h=(new Date).getTime();if(!e)return l=this.app_.data.getCookie(a.balance.client.cookie.host),void(l?(this.enable(a),this.changeServer(l)):this.disable(a));var i;for(var j in e)h>e[j].date+a.balance.log.expires||(f.push(e[j].performance),g[e[j].performance]=e[j]);f=f.sort(b).slice(0,15);var k=this.app_.data.getBuffer(this.app_.data.storeNames.server);if(!k)return void this.disable(a);for(var i,l="";f.length;)if(m=Math.floor(Math.random()*f.length),i=f[m],f.splice(m,1),l=g[i].host.split("//").pop()||"",k[l]&&!(k[l].state&&(new Date).getTime()<k[l].state+a.balance.server.error)&&(l||!a.balance.weight||Math.floor(Math.random())*a.balance.weight))return void this.changeServer(l,a);for(var l,m,n=Object.keys(k);n.length;)if(m=Math.floor(Math.random()*n.length),l=n[m],n.splice(m,1),!(k[l].state&&(new Date).getTime()<k[l].state+a.balance.server.error))return void this.changeServer(l,a);this.disable(a)}},a}();a.AppBalance=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(){}return a.prototype.chooseArea=function(a,b,c){a=a instanceof Array?a:[a];var d,e=-1;a:for(;d=a[++e];){for(var f=d.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g),g=-1;f[++g];)if(!jQuery(f[g],b).length||!jQuery(f[g],c).length)continue a;return d}},a.prototype.movePageNormally=function(a){switch(a.type.toLowerCase()){case"click":window.location.assign(a.currentTarget.href);break;case"submit":switch(a.currentTarget.method.toUpperCase()){case"GET":window.location.assign(a.currentTarget.action.replace(/[?#].*/,"")+"?"+jQuery(a.currentTarget).serialize());break;case"POST":window.location.assign(a.currentTarget.action)}break;case"popstate":window.location.reload()}},a.prototype.calAge=function(a){switch(!0){case/no-store|no-cache/.test(a.getResponseHeader("Cache-Control")):return 0;case!!~String(a.getResponseHeader("Cache-Control")).indexOf("max-age="):return 1e3*Number(a.getResponseHeader("Cache-Control").match(/max-age=(\d+)/).pop());case!!String(a.getResponseHeader("Expires")):return new Date(a.getResponseHeader("Expires")).getTime()-(new Date).getTime();default:return 0}},a.prototype.calExpires=function(a){return(new Date).getTime()+this.calAge(a)},a.prototype.dispatchEvent_=function(a,b,c,d){var e=document.createEvent("HTMLEvents");e.initEvent(b,c,d),a.dispatchEvent(e)},a.prototype.wait_=function(a){var b=jQuery.Deferred();return a?(setTimeout(function(){b.resolve()},a),b):b.resolve()},a}();a.AppPageUtility=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(b){function c(a,c,d,e,f,g,h,i){b.call(this),this.model_=a,this.app_=c,this.setting_=d,this.event_=e,this.register_=f,this.cache_=g,this.done_=h,this.fail_=i,this.main_()}return __extends(c,b),c.prototype.main_=function(){function b(b){h.data_=b[0],h.textStatus_=b[1],h.jqXHR_=b[2],a.Util.fire(i.callbacks.ajax.done,this,[j,i.param].concat(b))}function c(b,c,d){h.jqXHR_=b,h.textStatus_=c,h.errorThrown_=d,a.Util.fire(i.callbacks.ajax.fail,this,[j,i.param].concat(arguments))}function d(){a.Util.fire(i.callbacks.ajax.always,this,[j,i.param].concat(arguments)),h.model_.setGlobalXHR(null),h.model_.isDeferrable&&(h.data_?h.done_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_):h.fail_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_))}function e(b,c,d){h.data_=b,h.textStatus_=c,h.jqXHR_=d,a.Util.fire(i.callbacks.ajax.success,this,[j,i.param,b,c,d])}function f(b,c,d){h.jqXHR_=b,h.textStatus_=c,h.errorThrown_=d,a.Util.fire(i.callbacks.ajax.error,this,[j,i.param,b,c,d])}function g(b,c){a.Util.fire(i.callbacks.ajax.complete,this,[j,i.param,b,c]),h.model_.setGlobalXHR(null),h.model_.isDeferrable||(h.data_?h.done_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_):h.fail_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_))}var h=this,i=this.setting_,j=this.event_=jQuery.extend(!0,{},this.event_),k=this.register_,l=this.cache_,m=this.model_.getGlobalXHR(),n=a.Util.fire(i.wait,null,[j,i.param,i.origLocation.href,i.destLocation.href]),o=i.speedcheck,p=this.model_.stock("speed");if(o&&(p.fire=j.timeStamp),o&&p.time.splice(0,100,0),o&&p.name.splice(0,100,"pjax("+p.time.slice(-1)+")"),this.app_.page.isScrollPosSavable=!1,i.fix.reset&&/click|submit/.test(j.type.toLowerCase())&&window.scrollTo(jQuery(window).scrollLeft(),0),this.dispatchEvent_(document,i.gns+":fetch",!1,!0),jQuery(document).trigger(i.gns+".fetch"),l&&l.jqXHR)if(o&&p.name.splice(0,1,"cache("+p.time.slice(-1)+")"),i.loadtime=0,this.model_.setGlobalXHR(null),this.host_=l.host||"",this.data_=l.jqXHR.responseText,this.textStatus_=l.textStatus,this.jqXHR_=l.jqXHR,this.model_.isDeferrable)jQuery.when(jQuery.Deferred().resolve([h.data_,h.textStatus_,h.jqXHR_]),this.wait_(n)).done(b).fail(c).always(d);else{var q=jQuery.extend({},jQuery.ajaxSettings,i.ajax);q=q.context||q,e.call(q,h.data_,h.textStatus_,h.jqXHR_),g.call(q,h.jqXHR_,h.textStatus_)}else if(m&&m.follow&&"abort"!==m.statusText&&"error"!==m.statusText){o&&p.time.splice(0,1,m.timeStamp-p.fire),o&&p.name.splice(0,1,"preload("+p.time.slice(-1)+")"),o&&p.time.push(p.now()-p.fire),o&&p.name.push("continue("+p.time.slice(-1)+")"),this.host_=m.host||"",i.loadtime=m.timeStamp;var n=i.wait&&isFinite(m.timeStamp)?Math.max(n-(new Date).getTime()+m.timeStamp,0):0;jQuery.when(m,h.wait_(n)).done(b).fail(c).always(d)}else{i.loadtime=j.timeStamp;var r=i.destLocation.cloneNode(),s={},t={};switch(this.app_.balance.chooseServer(i),this.host_=i.balance.self&&this.app_.balance.host().split("//").pop()||"",r.host=this.host_||i.destLocation.host,s.url=i.server.query?[r.protocol,"//",r.host,"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname,(1<r.search.length?r.search+"&":"?")+i.server.query,r.hash].join(""):r.href,j.type.toLowerCase()){case"click":s.type="GET";break;case"submit":switch(s.type=j.currentTarget.method.toUpperCase(),s.type){case"POST":jQuery(j.currentTarget).has(":file").length?"function"==typeof FormData&&(s.data=new FormData(j.currentTarget),s.contentType=!1,s.processData=!1):s.data=jQuery(j.currentTarget).serializeArray();break;case"GET":}break;case"popstate":s.type="GET"}t={xhr:i.callbacks.ajax.xhr?function(){var b;return b=a.Util.fire(i.callbacks.ajax.xhr,this,[j,i.param]),b="object"==typeof b&&b||jQuery.ajaxSettings.xhr()}:undefined,beforeSend:i.callbacks.ajax.beforeSend||i.server.header?function(b,c){i.server.header&&b.setRequestHeader(i.nss.requestHeader,"true"),"object"==typeof i.server.header&&(b.setRequestHeader(i.nss.requestHeader,"true"),i.server.header.area&&b.setRequestHeader(i.nss.requestHeader+"-Area",this.app_.chooseArea(i.area,document,document)),i.server.header.head&&b.setRequestHeader(i.nss.requestHeader+"-Head",i.load.head),i.server.header.css&&b.setRequestHeader(i.nss.requestHeader+"-CSS",i.load.css.toString()),i.server.header.script&&b.setRequestHeader(i.nss.requestHeader+"-Script",i.load.script.toString())),a.Util.fire(i.callbacks.ajax.beforeSend,this,[j,i.param,b,c])
-
d.index(e).openCursor(b.DB_.IDBKeyRange.lowerBound(0),"prev").onsuccess=function(){if(this.result){var b=this.result,e=b.value;c.buffer_[e[d.keyPath]]=e,--a&&b["continue"]&&b["continue"]()}}})},a.prototype.saveBuffer=function(){},a.prototype.getBuffer=function(a){return a?this.buffer_[a]:this.buffer_},a.prototype.setBuffer=function(a,b){var c=a[this.keyPath];return this.buffer_[c]=b?jQuery.extend(!0,{},this.buffer_[c],a):a,this.buffer_[a[this.keyPath]]},a.prototype.addBuffer=function(a){return a[this.keyPath]=this.buffer_.length||1,this.buffer_.push(a),a},a.prototype.add=function(a){var b=a[this.keyPath];delete a[this.keyPath],this.accessRecord(b,function(){"undefined"!=typeof b&&this.source["delete"](b),this.source.add(a)})},a.prototype.set=function(a){var b=a[this.keyPath];this.accessRecord(b,function(){this.source.put(jQuery.extend(!0,{},this.result,a))})},a.prototype.get=function(a,b){this.accessRecord(a,b)},a.prototype.del=function(a){this.accessRecord(a,function(){this.source["delete"](a)})},a}();a.DataStore=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="meta",this.keyPath="id"}return __extends(b,a),b}(a.DataStore);a.DataStoreMeta=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="history",this.keyPath="id"}return __extends(b,a),b.prototype.clean=function(){var a=this;this.accessStore(function(b){b.count().onsuccess=function(){this.result>1e3&&(b.index("date").openCursor(a.DB_.IDBKeyRange.upperBound((new Date).getTime()-2592e5)).onsuccess=function(){if(this.result){var a=this.result;a?(a["delete"](a.value[b.keyPath]),a["continue"]&&a["continue"]()):b.count().onsuccess=function(){1e3<this.result&&b.clear()}}})}})},b}(a.DataStore);a.DataStoreHistory=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="log",this.keyPath="id"}return __extends(b,a),b.prototype.clean=function(){this.accessStore(function(a){var b=50;a.count().onsuccess=function(){this.result>b+10&&(b=this.result-b,a.index(a.keyPath).openCursor(this.DB_.IDBKeyRange.lowerBound(0)).onsuccess=function(){if(this.result){var c=this.result;c&&(0>--b&&c["delete"](c.value[a.keyPath]),c["continue"]&&c["continue"]())}})}})},b}(a.DataStore);a.DataStoreLog=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="server",this.keyPath="id"}return __extends(b,a),b}(a.DataStore);a.DataStoreServer=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function c(){var c=this;this.IDBFactory=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.mozIDBKeyRange||window.msIDBKeyRange,this.name_=a.NAME,this.version_=4,this.refresh_=10,this.upgrade_=1,this.state_=-1,this.database=function(){return c.database_},this.state=function(){return c.state_},this.nowInitializing=!1,this.nowRetrying=!1,this.conAge_=1e4,this.conInterval_=1e3,this.tasks_=[],this.store={meta:new b.DataStoreMeta(this),history:new b.DataStoreHistory(this),log:new b.DataStoreLog(this),server:new b.DataStoreServer(this)},this.metaNames={version:"version",update:"update"};var d=function(){var a=(new Date).getTime(),b=c.conExpires_;b&&a>b&&(c.closedb(),c.conExpires_=0),setTimeout(d,Math.max(c.conExpires_-a+100,c.conInterval_)),c.tasks_.length&&!c.nowInitializing&&!c.nowRetrying&&c.opendb(null,!0)};this.conAge_&&setTimeout(d,this.conInterval_)}return c.prototype.opendb=function(a,b){var c=this;if(c.conExtend(),c.IDBFactory&&(a||c.tasks_.length)&&("function"==typeof a&&c.reserveTask_(a),!c.nowInitializing&&!c.nowRetrying))try{c.nowInitializing=!0;var d=c.IDBFactory.open(c.name_,c.upgrade_?c.version_:1);d.onblocked=function(){c.closedb(1);try{this.result.close(),!b&&setTimeout(function(){return c.opendb(null,!0)},1e3)}catch(a){!b&&c.initdb_(1e3)}},d.onupgradeneeded=function(){try{for(var a=this.result,d=a.objectStoreNames?a.objectStoreNames.length:0;d--;)a.deleteObjectStore(a.objectStoreNames[d]);a.createObjectStore(c.store.meta.name,{keyPath:c.store.meta.keyPath,autoIncrement:!1}).createIndex(c.store.meta.keyPath,c.store.meta.keyPath,{unique:!0}),a.createObjectStore(c.store.history.name,{keyPath:c.store.history.keyPath,autoIncrement:!1}).createIndex("date","date",{unique:!1}),a.createObjectStore(c.store.log.name,{keyPath:c.store.log.keyPath,autoIncrement:!0}).createIndex("date","date",{unique:!1}),a.createObjectStore(c.store.server.name,{keyPath:c.store.server.keyPath,autoIncrement:!1}).createIndex(c.store.server.keyPath,c.store.server.keyPath,{unique:!0})}catch(e){!b&&c.initdb_(1e3)}},d.onsuccess=function(){try{var a=this.result;c.checkdb_(a,c.version_,function(){c.database_=a,c.state_=0,c.conExtend(),c.nowInitializing=!1,c.digestTask_(),c.nowRetrying=!1},function(){!b&&c.initdb_()})}catch(d){a.close(),!b&&c.initdb_(1e3)}},d.onerror=function(){c.closedb(3);try{this.result.close(),!b&&setTimeout(function(){return c.opendb(null,!0)},1e3)}catch(a){!b&&c.initdb_(1e3)}}}catch(e){c.closedb(3),!b&&c.initdb_(1e3)}},c.prototype.closedb=function(a){"undefined"==typeof a&&(a=-1),this.database_=null,this.state_=a;var b=this.database_;b&&b.close&&b.close()},c.prototype.deletedb_=function(){this.closedb();var a=this.IDBFactory;a&&a.deleteDatabase&&a.deleteDatabase(this.name_)},c.prototype.initdb_=function(a){var b=this,c=function(){b.nowRetrying||(b.nowRetrying=!0,b.deletedb_()),b.opendb(null,!0)};a?void setTimeout(c,a):c()},c.prototype.checkdb_=function(a,b,c,d){var e=this,f=a.transaction(e.store.meta.name,"readwrite").objectStore(e.store.meta.name).get(e.metaNames.version);f.onsuccess=function(){var f=this.result;if(!f||e.upgrade_)this.source.put({id:e.metaNames.version,value:b});else if(f.value!==b)return void d();if(e.refresh_){var g=a.transaction(e.store.meta.name,"readwrite").objectStore(e.store.meta.name).get(e.metaNames.update);g.onsuccess=function(){var a=this.result,b=Math.floor((new Date).getTime()/864e5);if(a){if(a.value<=b)return void d()}else this.source.put({id:e.metaNames.update,value:b+e.refresh_});c()}}else c()}},c.prototype.conExtend=function(){this.conExpires_=(new Date).getTime()+this.conAge_},c.prototype.reserveTask_=function(a){(3!==this.state()||this.tasks_.length<100)&&this.tasks_.push(a)},c.prototype.digestTask_=function(a){"undefined"==typeof a&&(a=0),a=a||-1;for(var b;b=a--&&this.tasks_.pop();)b()},c}();b.DataDB=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a){this.age_=a}return a.prototype.getCookie=function(a){if(window.navigator.cookieEnabled){var b=new RegExp("(?:^|; )("+encodeURIComponent(a)+"=[^;]*)"),c=(document.cookie.match(b)||[]).pop();return c&&decodeURIComponent(c.split("=").pop())}},a.prototype.setCookie=function(a,b,c){return"undefined"==typeof c&&(c={}),window.navigator.cookieEnabled?(c.age=c.age||this.age_,document.cookie=[encodeURIComponent(a)+"="+encodeURIComponent(b),c.age?"; expires="+new Date((new Date).getTime()+1e3*c.age).toUTCString():"",c.secure?"; secure":""].join(""),this.getCookie(a)):void 0},a}();a.DataCookie=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function b(){this.DB=new a.DataDB,this.Cookie=new a.DataCookie(864e3)}return b}();a.Data=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function b(b,c){this.model_=b,this.app_=c,this.data_=new a.Data,this.storeNames={meta:this.data_.DB.store.meta.name,history:this.data_.DB.store.history.name,log:this.data_.DB.store.log.name,server:this.data_.DB.store.server.name}}return b.prototype.getCookie=function(a){return this.data_.Cookie.getCookie(a)},b.prototype.setCookie=function(a,b,c){return this.data_.Cookie.setCookie(a,b,c)},b.prototype.opendb=function(a){var b=this;a.database=!1,this.data_.DB.opendb(function(){b.saveTitleToDB(a.origLocation.href,document.title),b.saveScrollPositionToCacheAndDB(a.origLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop()),a.database=!0})},b.prototype.getBuffer=function(a,b){return this.data_.DB.store[a].getBuffer(b)},b.prototype.setBuffer=function(a,b,c,d){return this.data_.DB.store[a].setBuffer(b,c,d)},b.prototype.loadBuffer=function(a,b){return"undefined"==typeof b&&(b=0),this.data_.DB.store[a].loadBuffer(b)},b.prototype.saveBuffer=function(a){return this.data_.DB.store[a].saveBuffer()},b.prototype.loadBufferAll=function(a){"undefined"==typeof a&&(a=0);for(var b in this.storeNames)this.loadBuffer(b,a)},b.prototype.saveBufferAll=function(){for(var a in this.storeNames)this.saveBuffer(a)},b.prototype.loadTitleFromDB=function(b){var c=this.model_.convertUrlToKeyUrl(a.UTIL.canonicalizeUrl(b)),d=this,e=this.data_.DB.store.history.getBuffer(c);e&&"string"==typeof e.title?document.title=e.title:this.data_.DB.store.history.get(c,function(){c===d.model_.convertUrlToKeyUrl(a.UTIL.canonicalizeUrl(window.location.href))&&this.result&&this.result.title&&(document.title=this.result.title)})},b.prototype.saveTitleToDB=function(b,c){var d=this.model_.convertUrlToKeyUrl(a.UTIL.canonicalizeUrl(b)),e={id:d,title:c,date:(new Date).getTime()};this.data_.DB.store.history.setBuffer(e,!0),this.data_.DB.store.history.set(e),this.data_.DB.store.history.clean()},b.prototype.loadScrollPositionFromCacheOrDB=function(b){function c(a,b){"number"==typeof a&&"number"==typeof b&&window.scrollTo(parseInt(Number(a)+"",10),parseInt(Number(b)+"",10))}var d=this.model_.convertUrlToKeyUrl(a.UTIL.canonicalizeUrl(b)),e=this.data_.DB.store.history.getBuffer(d);e&&"number"==typeof e.scrollX?c(e.scrollX,e.scrollY):this.data_.DB.store.history.get(d,function(){this.result&&d===this.result.id&&(e=this.result,c(e.scrollX,e.scrollY))})},b.prototype.saveScrollPositionToCacheAndDB=function(b,c,d){var e=this.model_.convertUrlToKeyUrl(a.UTIL.canonicalizeUrl(b)),f={id:e,scrollX:c,scrollY:d,date:(new Date).getTime()};this.data_.DB.store.history.setBuffer(f,!0),this.data_.DB.store.history.set(f)},b.prototype.loadExpiresFromDB=function(){},b.prototype.saveExpiresToDB=function(a,b,c){var d={id:a,host:b,expires:c};this.data_.DB.store.history.setBuffer(d,!0),this.data_.DB.store.history.set(d)},b.prototype.loadLogFromDB=function(){},b.prototype.saveLogToDB=function(a){this.data_.DB.store.log.addBuffer(a),this.data_.DB.store.log.add(a),this.data_.DB.store.log.clean()},b.prototype.loadServerFromDB=function(){},b.prototype.saveServerToDB=function(a,b,c,d){"undefined"==typeof b&&(b=0),"undefined"==typeof d&&(d=0);var e={id:a||"",state:b};this.data_.DB.store.server.setBuffer(e),this.data_.DB.store.server.set(e),c&&this.saveExpiresToDB(c,a,d)},b}();a.AppData=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(MODULE){!function(MODEL){var App=function(_super){function App(a,b){_super.call(this),this.model_=a,this.controller_=b,this.Update=MODEL.AppUpdate,this.data=new MODEL.AppData(this.model_,this),this.landing=MODEL.UTIL.canonicalizeUrl(window.location.href),this.recent={order:[],data:{},size:0},this.isScrollPosSavable=!0}return __extends(App,_super),App.prototype.configure=function(option,origURL,destURL){origURL=MODEL.UTIL.canonicalizeUrl(origURL||option.origLocation.href),destURL=MODEL.UTIL.canonicalizeUrl(destURL||option.destLocation.href),option=option.option||option;var scope=option.scope?jQuery.extend(!0,{},option,this.scope_(option,origURL,destURL)||{disable:!0}):jQuery.extend(!0,{},option),initial={gns:MODULE.NAME,ns:"",disable:!1,area:"body",link:"a:not([target])",filter:function(){return/(\/[^.]*|\.html?|\.php)$/.test("/"+this.pathname)},form:null,scope:null,rewrite:null,state:null,scrollTop:0,scrollLeft:0,ajax:{dataType:"text"},contentType:"text/html",cache:{click:!1,submit:!1,popstate:!1,get:!0,post:!0,mix:0,limit:100,size:1048576,expires:{max:null,min:3e5}},buffer:{limit:30,delay:500},load:{head:"",css:!1,script:!1,execute:!0,log:"head, body",reload:"",ignore:'[src*="jquery.js"], [src*="jquery.min.js"], [href^="chrome-extension://"]',ajax:{dataType:"script",cache:!0}},balance:{self:!1,weight:3,client:{support:{userAgent:/msie|trident.+ rv:|chrome|firefox|safari/i,redirect:/chrome|firefox|safari/i},exclude:/mobile|phone|android|iphone|blackberry/i,cookie:{balance:"ajax_balanceable",redirect:"ajax_redirectable",host:"ajax_host"}},server:{header:"X-Ajax-Host",filter:null,error:6e5},log:{expires:864e6,limit:30},option:{server:{header:!1},ajax:{crossDomain:!0},callbacks:{ajax:{beforeSend:null}}}},callback:null,callbacks:{ajax:{},update:{rewrite:{},cache:{},redirect:{},url:{},title:{},head:{},content:{},scroll:{},css:{},script:{},render:{},verify:{},balance:{}}},param:null,redirect:!0,wait:0,scroll:{delay:300},fix:{location:!0,history:!0,scroll:!0,reset:!1},fallback:!0,database:!0,server:{query:"pjax=1",header:!0},speedcheck:!1},force={origLocation:function(a,b){return b.href=a,b}(origURL,document.createElement("a")),destLocation:function(a,b){return b.href=a,b}(destURL,document.createElement("a")),balance:{server:{host:""}},scroll:{queue:[]},loadtime:null,retriable:!0,option:option},compute=function(){var nsArray=[setting.gns||MODULE.NAME].concat(setting.ns&&String(setting.ns).split(".")||[]),query=setting.server.query;switch(query&&typeof query){case"string":query=eval("({"+query.replace(/"/g,'\\"').replace(/([^?=&]+)=([^&]*)/g,'"$1": "$2"').replace(/&/g,",")+"})");case"object":query=jQuery.param(query)}return{nss:{name:setting.ns||"",array:nsArray,event:nsArray.join("."),data:nsArray.join("-"),class4html:nsArray.join("-"),click:["click"].concat(nsArray.join(":")).join("."),submit:["submit"].concat(nsArray.join(":")).join("."),popstate:["popstate"].concat(nsArray.join(":")).join("."),scroll:["scroll"].concat(nsArray.join(":")).join("."),requestHeader:["X",nsArray[0].replace(/^\w/,function(a){return a.toUpperCase()})].join("-")},fix:/android|iphone os|like mac os x/i.test(window.navigator.userAgent)?{}:{location:!1,reset:!1},contentType:setting.contentType.replace(/\s*[,;]\s*/g,"|").toLowerCase(),server:{query:query},timeStamp:(new Date).getTime()}},setting;return setting=jQuery.extend(!0,initial,scope),setting=jQuery.extend(!0,setting,setting.balance.self&&setting.balance.option,force),setting=jQuery.extend(!0,setting,compute())},App.prototype.registrate=function(a,b){var c=this,d=this.stock("executed");b.load.script&&jQuery("script").each(function(){var a=this;a.src in d||!a.src||b.load.reload&&jQuery(a).is(b.load.reload)||(d[a.src]=!0)}),new MODULE.VIEW.Main(this.model_,this.controller_,a).BIND(b),setTimeout(function(){return c.createHTMLDocument("")},50),setTimeout(function(){return c.data.loadBufferAll(b.buffer.limit)},b.buffer.delay),b.balance.self&&setTimeout(function(){return c.enableBalance()},b.buffer.delay),setTimeout(function(){return c.landing=null},1500)},App.prototype.enableBalance=function(a){var b=this.model_.getActiveSetting();return!b.balance.client.support.userAgent.test(window.navigator.userAgent)||b.balance.client.exclude.test(window.navigator.userAgent)?void this.disableBalance():Number(!this.data.setCookie(b.balance.client.cookie.balance,"1"))?void this.disableBalance():(b.balance.client.support.redirect.test(window.navigator.userAgent)&&this.data.setCookie(b.balance.client.cookie.redirect,"1"),void(a&&this.switchRequestServer(a,b)))},App.prototype.disableBalance=function(){var a=this.model_.getActiveSetting();this.data.setCookie(a.balance.client.cookie.balance,"0"),this.data.setCookie(a.balance.client.cookie.redirect,"0"),this.switchRequestServer(null,a)},App.prototype.switchRequestServer=function(a,b){a=a||"",b=b||this.model_.getActiveSetting(),this.model_.requestHost=a,b.balance.server.host=a,this.data.setCookie(b.balance.client.cookie.host,a)},App.prototype.chooseRequestServer=function(a){function b(a,b){return a-b}if(a.balance.self&&this.enableBalance(),!a.balance.self||"1"!==this.data.getCookie(a.balance.client.cookie.balance))return void this.disableBalance();this.data.loadBufferAll(a.buffer.limit);var c,d=this.data.getBuffer(this.data.storeNames.history,this.model_.convertUrlToKeyUrl(a.destLocation.href));if(c=d&&d.expires,c&&c>=(new Date).getTime())return void this.switchRequestServer(d.host,a);var e=this.data.getBuffer(this.data.storeNames.log),f=[],g={},h=(new Date).getTime();if(!e)return l=this.data.getCookie(a.balance.client.cookie.host),void(l?this.enableBalance(l):this.disableBalance());var i;for(var j in e)h>e[j].date+a.balance.log.expires||(f.push(e[j].performance),g[e[j].performance]=e[j]);f=f.sort(b);var k=this.data.getBuffer(this.data.storeNames.server),i=f.shift();if(!k)return void this.disableBalance();var i,l="";for(a.balance.log.limit;i=j--&&f.shift();)if(l=g[i].host.split("//").pop()||"",k[l]&&!(k[l].state&&(new Date).getTime()<k[l].state+a.balance.server.error)&&(l||!a.balance.weight||Math.floor(Math.random())*a.balance.weight))return void this.switchRequestServer(l,a);this.disableBalance()},App.prototype.chooseArea=function(a,b,c){a=a instanceof Array?a:[a];var d,e=-1;a:for(;d=a[++e];){for(var f=d.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g),g=-1;f[++g];)if(!jQuery(f[g],b).length||!jQuery(f[g],c).length)continue a;return d}},App.prototype.scope_=function(a,b,c,d){"undefined"==typeof d&&(d="");var e,f,g,h,i,j,k,l,m,n,o,p=a.scope;if(e=this.model_.convertUrlToKeyUrl(b).match(/.+?\w(\/.*)/).pop(),f=this.model_.convertUrlToKeyUrl(c).match(/.+?\w(\/.*)/).pop(),d=d.replace(/[#?].*/,""),h=(d||f).replace(/^\/|\/$/g,"").split("/"),d){if(!~d.indexOf("*"))return undefined;g=[];for(var q=e.replace(/^\/|\/$/g,"").split("/"),r=0,s=h.length;s>r;r++)"*"===h[r]&&g.push(q[r])}for(var r=h.length+1;r--;)if(l=o=m=n=undefined,i=h.slice(0,r).join("/"),i="/"+i+("/"===(d||e).charAt(i.length+1)?"/":""),i&&i in p){if(p[i]instanceof Array?(j="",k=p[i]):(j=p[i],k=p[j]),!k||!k.length)return!1;k=k.concat();for(var t,u=0;(t=k[u])&&(m!==!1&&n!==!1);u++)if("#"===t[0]&&(j=t.slice(1),[].splice.apply(k,[u,1].concat(p[j])),t=k[u]),"inherit"===t)l=!0;else if("rewrite"!==t||"function"!=typeof p.rewrite||d){if("string"==typeof t){var v="!"===t[0];t=v?t.slice(1):t;var w="*"===t[0];if(t=w?t.slice(1):t,d&&~t.indexOf("/*/"))for(var x=0,s=g.length;s>x;x++)t=t.replace("/*/","/"+g[x]+"/");if(w?!e.search(t):!e.indexOf(t)){if(v)return!1;m=!0}if(w?!f.search(t):!f.indexOf(t)){if(v)return!1;n=!0,o=p["$"+j]||p["$"+t]||null}}}else{var y=this.scope_.apply(this,[].slice.call(arguments).slice(0,3).concat([MODEL.UTIL.fire(p.rewrite,null,[f])]));if(y){m=n=!0,o=y;break}if(!1===y)return!1}if(m&&n)return jQuery.extend(!0,{},a,o);if(!l)break}},App.prototype.movePageNormally=function(a){switch(a.type.toLowerCase()){case"click":window.location.assign(a.currentTarget.href);break;case"submit":a.currentTarget.submit();break;case"popstate":window.location.reload()}},App.prototype.createHTMLDocument=function(a){function b(a){try{var b=a&&a('<html lang="en" class="html"><head><link href="/"><noscript><style>/**/</style></noscript></head><body><noscript>noscript</noscript><a href="/"></a></body></html>');return b&&jQuery("html",b).is(".html[lang=en]")&&jQuery("head>link",b)[0].href&&jQuery("head>noscript",b).html()&&"noscript"===jQuery("body>noscript",b).text()&&jQuery("body>a",b)[0].href}catch(c){}}return this.createHTMLDocument=function(a){return window.DOMParser&&window.DOMParser.prototype&&(new window.DOMParser).parseFromString(a,"text/html")},b(this.createHTMLDocument)?this.createHTMLDocument(a):(this.createHTMLDocument=function(a){if(document.implementation&&document.implementation.createHTMLDocument){var b=document.implementation.createHTMLDocument("");"object"==typeof b.activeElement&&b.activeElement&&(b.open(),b.write(a),b.close())}return b},b(this.createHTMLDocument)?this.createHTMLDocument(a):(this.createHTMLDocument=function(a){if(document.implementation&&document.implementation.createHTMLDocument){var b=document.implementation.createHTMLDocument(""),c=document.createElement("html"),d=document.createElement("div");d.innerHTML=(a.match(/<html(?: [^>]*)?>/i)||["<html>"]).shift().replace(/html/i,"div")+"</div>";for(var e,f=d.firstChild.attributes,g=0;e=f[g];g++)b.documentElement.setAttribute(e.name,e.value);for(c.innerHTML=a.replace(/^.*?<html(?: [^>]*)?>/im,""),b.documentElement.removeChild(b.head),b.documentElement.removeChild(b.body);c.childNodes[0];)b.documentElement.appendChild(c.childNodes[0])}return b},b(this.createHTMLDocument)?this.createHTMLDocument(a):void 0))},App.prototype.calAge=function(a){switch(!0){case/no-store|no-cache/.test(a.getResponseHeader("Cache-Control")):return 0;case!!~String(a.getResponseHeader("Cache-Control")).indexOf("max-age="):return 1e3*Number(a.getResponseHeader("Cache-Control").match(/max-age=(\d+)/).pop());case!!String(a.getResponseHeader("Expires")):return new Date(a.getResponseHeader("Expires")).getTime()-(new Date).getTime();default:return 0}},App.prototype.calExpires=function(a){return(new Date).getTime()+this.calAge(a)},App}(MODEL.Template);MODEL.App=App}(MODULE.MODEL||(MODULE.MODEL={}));var MODEL=MODULE.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(c){function d(){c.apply(this,arguments),this.controller_=new a.CONTROLLER.Main(this),this.app_=new b.App(this,this.controller_),this.state_=-1,this.isDeferrable=jQuery.when&&1.06<=Number(jQuery().jquery.replace(/\D*(\d+)\.(\d+).*$/,"$1.0$2").replace(/\d+(\d{2})$/,"$1")),this.requestHost=""}return __extends(d,c),d.prototype.main_=function(b,c){var d,e=this;switch(d=b instanceof a.NAMESPACE?"m:":"f:",d+=c?{}.toString.call(c).split(" ").pop().slice(0,-1).toLowerCase():c,d.toLowerCase()){case"m:object":break;case"m:undefined":if(b.is("a, form"))return b;c={};break;default:return b}var f=this.app_.configure(c,window.location.href,window.location.href);return this.setActiveSetting(f),f.database&&this.app_.data.opendb(f),this.app_.stock({executed:{},speed:{fire:0,time:[],name:[],now:function(){return(new Date).getTime()}}}),"pushState"in window.history&&window.history.pushState&&jQuery(function(){e.app_.registrate(b,f),e.state_=-1===e.state()?0:e.state()}),b},d.prototype.state=function(){return this.state_},d.prototype.convertUrlToKeyUrl=function(a){return a.replace(/#.*/,"")},d.prototype.isImmediateLoadable=function(a,c){if(0===this.state()){var d,e,f=b.UTIL.canonicalizeUrl(window.location.href);switch(typeof a){case"string":e=null,d=b.UTIL.canonicalizeUrl(a);break;case"object":switch(e=a,e.type.toLowerCase()){case"click":d=b.UTIL.canonicalizeUrl(e.currentTarget.href);break;case"submit":d=b.UTIL.canonicalizeUrl(e.currentTarget.action);break;case"popstate":return!0}if(e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1}var g=jQuery("<a/>",{href:f})[0],h=jQuery("<a/>",{href:d})[0];if(g.protocol!==h.protocol||g.host!==h.host)return!1;if(c=c||this.app_.configure(this.getActiveSetting(),g.href,h.href),!c.disable)return h.hash&&g.href.replace(/#.*/,"")===h.href.replace(/#.*/,"")?!1:this.app_.chooseArea(c.area,document,document)&&jQuery(e.currentTarget).filter(c.filter).length?!0:!1}},d.prototype.getActiveSetting=function(){return this.app_.activeSetting},d.prototype.setActiveSetting=function(a){return this.app_.activeSetting=a},d.prototype.getActiveXHR=function(){return this.app_.activeXHR},d.prototype.setActiveXHR=function(a){return this.app_.activeXHR&&this.app_.activeXHR.readyState<4&&this.app_.activeXHR.abort(),this.app_.activeXHR=a},d.prototype.CLICK=function(a){a.timeStamp=(new Date).getTime();var b=a.currentTarget,c=(jQuery(b),this.app_.configure(this.getActiveSetting(),window.location.href,b.href));if(!(0!==this.state()||c.disable||a.isDefaultPrevented()||!this.isImmediateLoadable(a,c)||c.cache.mix&&this.getCache(c.destLocation.href))){c.database&&this.app_.isScrollPosSavable&&this.app_.data.saveScrollPositionToCacheAndDB(c.destLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop());var d;return c.cache[a.type.toLowerCase()]&&(d=this.getCache(c.destLocation.href)),new this.app_.Update(this,this.app_,c,a,c.destLocation.href!==c.origLocation.href,d),void a.preventDefault()}!a.originalEvent&&!a.isDefaultPrevented()&&!jQuery(document).has(b).length&&this.fallback(a,c)},d.prototype.SUBMIT=function(a){a.timeStamp=(new Date).getTime();var c=a.currentTarget,d=(jQuery(c),this.app_.configure(this.getActiveSetting(),window.location.href,c.action));if(0===this.state()&&!d.disable&&!a.isDefaultPrevented()&&this.isImmediateLoadable(a,d)){var e=d.destLocation.href.replace(/[?#].*/,"")+("GET"===c.method.toUpperCase()?"?"+jQuery(c).serialize():"");if(d.destLocation.href=b.UTIL.canonicalizeUrl(e),!d.cache.mix||!this.getCache(d.destLocation.href)){d.database&&this.app_.isScrollPosSavable&&this.app_.data.saveScrollPositionToCacheAndDB(d.destLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop());var f;return d.cache[a.type.toLowerCase()]&&d.cache[c.method.toLowerCase()]&&(f=this.getCache(d.destLocation.href)),new this.app_.Update(this,this.app_,d,a,d.destLocation.href!==d.origLocation.href,f),void a.preventDefault()}}!a.originalEvent&&!a.isDefaultPrevented()&&!jQuery(document).has(c).length&&this.fallback(a,d)},d.prototype.POPSTATE=function(a){a.timeStamp=(new Date).getTime();var c=this.app_.configure(this.getActiveSetting(),null,window.location.href);if((!this.app_.landing||this.app_.landing!==b.UTIL.canonicalizeUrl(window.location.href))&&c.origLocation.href!==c.destLocation.href){if(0===this.state()&&!c.disable&&this.isImmediateLoadable(a,c)&&(c.origLocation.hash===c.destLocation.hash||c.origLocation.pathname+c.origLocation.search!==c.destLocation.pathname+c.destLocation.search)){c.database&&c.fix.history&&this.app_.data.loadTitleFromDB(c.destLocation.href);var d;return c.cache[a.type.toLowerCase()]&&(d=this.getCache(c.destLocation.href)),void new this.app_.Update(this,this.app_,c,a,!1,d)}(!a.originalEvent||c.gns===a.namespace)&&this.fallback(a,c)}},d.prototype.SCROLL=function(a){var b=this,c=this.getActiveSetting();if(0===this.state()&&!a.isDefaultPrevented())if(c.scroll.delay){for(var d;d=c.scroll.queue.shift();)clearTimeout(d);d=setTimeout(function(){for(;d=c.scroll.queue.shift();)clearTimeout(d);b.app_.isScrollPosSavable&&b.app_.data.saveScrollPositionToCacheAndDB(window.location.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop())},c.scroll.delay),c.scroll.queue.push(d)}else this.app_.isScrollPosSavable&&this.app_.data.saveScrollPositionToCacheAndDB(window.location.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop())},d.prototype.fallback=function(a,c){"function"==typeof c.fallback?b.UTIL.fire(c.fallback,null,[a,c.param,c.origLocation.href,c.destLocation.href]):this.app_.movePageNormally(a)},d.prototype.enable=function(){this.state_=0},d.prototype.disable=function(){this.state_=1},d.prototype.getCache=function(a){var c=this.getActiveSetting(),d=this.app_.recent;if(!c||!d)return null;var e=this.convertUrlToKeyUrl(b.UTIL.canonicalizeUrl(a));return a=null,d.data[e]&&(new Date).getTime()>d.data[e].expires&&this.removeCache(e),d.data[e]&&!d.data[e].data&&!d.data[e].jqXHR&&this.removeCache(e),d.data[e]},d.prototype.setCache=function(a,c,d,e,f){var g=this,h=this.getActiveSetting(),i=this.app_.recent;if(!h||!i)return this;var j,k,l,m,n=this.convertUrlToKeyUrl(b.UTIL.canonicalizeUrl(a));a=null,i.order.unshift(n);for(var o,p=1;o=i.order[p];p++)n===o&&i.order.splice(p,1);if(i.size>h.cache.size&&this.cleanCache(),j=this.getCache(n),c||e||j&&(j.data||j.jqXHR)){var q=(e||{}).responseText||"";if(k=parseInt(1.8*q.length+""||"1048576",10),l=(new Date).getTime(),m=function(a){{var b;h.cache.expires}return h.cache.expires?i.data[n]&&!e?i.data[n].expires:(b=e&&g.app_.calAge(e)||Number(h.cache.expires),b=Math.max(b,0)||0,b="object"==typeof h.cache.expires&&"number"==typeof h.cache.expires.min?Math.max(h.cache.expires.min,b):b,b="object"==typeof h.cache.expires&&"number"==typeof h.cache.expires.max?Math.min(h.cache.expires.max,b):b,a+b):0}(l),i.size=i.size||0,i.size+=i.data[n]?0:k,i.data[n]=jQuery.extend(!0,{},j,{jqXHR:e,textStatus:d,data:c,size:k,expires:m,host:f||"",timeStamp:l}),i.data[n].data||i.data[n].jqXHR||this.removeCache(n),e||j&&j.jqXHR){var r=((e||j&&j.jqXHR).responseText||"").slice(0,1e4).match(/<title[^>]*>(.*?)<\/title>/i).pop()||"";h.database&&h.fix.history&&this.app_.data.saveTitleToDB(n,r)}}},d.prototype.removeCache=function(a){var c=this.getActiveSetting(),d=this.app_.recent;if(c&&d){var e=this.convertUrlToKeyUrl(b.UTIL.canonicalizeUrl(a));a=null;for(var f,g=0;f=d.order[g];g++)e===f&&(d.order.splice(g,1),d.size-=d.data[f].size,d.data[f]=null,delete d.data[f])}},d.prototype.clearCache=function(){var a=this.getActiveSetting(),b=this.app_.recent;if(a&&b)for(var c,d=b.order.length;c=b.order[--d];)b.order.splice(d,1),b.size-=b.data[c].size,delete b.data[c]},d.prototype.cleanCache=function(){var a=this.getActiveSetting(),b=this.app_.recent;if(a&&b)for(var c,d=b.order.length;c=b.order[--d];)(d>=a.cache.limit||c in b.data&&(new Date).getTime()>b.data[c].expires)&&(b.order.splice(d,1),b.size-=b.data[c].size,delete b.data[c])},d.prototype.getRequestDomain=function(){return this.requestHost},d.prototype.setRequestDomain=function(a){return this.app_.switchRequestServer(a.split("//").pop(),null)},d}(b.Template);b.Main=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={})),new MODULE.MODEL.Main}(window,window.document,void 0,jQuery);
+
}:undefined,dataFilter:i.callbacks.ajax.dataFilter?function(b,c){return a.Util.fire(i.callbacks.ajax.dataFilter,this,[j,i.param,b,c])||b}:undefined,success:e,error:f,complete:g},s=jQuery.extend(!0,{},i.ajax,t,s),m=this.model_.setGlobalXHR(jQuery.ajax(s)),this.model_.isDeferrable&&jQuery.when(m,h.wait_(n)).done(b).fail(c).always(d)}},c}(a.AppPageUtility);a.AppPageFetch=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){setTimeout(function(){return c.createHTMLDocument_("","")},50);var c=function(c){function d(a,b,e,f,g,h,i,j,k,l,m){c.call(this),this.model_=a,this.app_=b,this.setting_=e,this.event_=f,this.register_=g,this.cache_=h,this.data_=i,this.textStatus_=j,this.jqXHR_=k,this.errorThrown_=l,this.host_=m,this.loadwaits_=[],this.createHTMLDocument_=d.createHTMLDocument_,this.main_()}return __extends(d,c),d.prototype.main_=function(){var a=this.app_,b=this.setting_,c=this.event_,d=(this.register_,this.cache_),b=this.setting_,c=this.event_,e=(this.register_,this.data_,this.textStatus_,this.jqXHR_),f=(b.callbacks.update,b.speedcheck),g=this.model_.stock("speed");if(f&&g.time.push(g.now()-g.fire),f&&g.name.push("fetch("+g.time.slice(-1)+")"),b.loadtime=b.loadtime&&(new Date).getTime()-b.loadtime,b.loadtime=b.loadtime<100?0:b.loadtime,b.cache.mix&&"popstate"!==c.type.toLowerCase()&&(new Date).getTime()-c.timeStamp<=b.cache.mix)return this.model_.fallback(c,b);try{if(a.page.landing=null,!~(e.getResponseHeader("Content-Type")||"").toLowerCase().search(b.contentType))throw new Error("throw: content-type mismatch");if(this.srcDocument_=this.createHTMLDocument_(e.responseText,b.destLocation.href),this.dstDocument_=document,b.area=this.chooseArea(b.area,this.srcDocument_,this.dstDocument_),!b.area)throw new Error("throw: area notfound");b.areas=b.area.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g),this.isCacheUsable_(b,c)&&(this.model_.setCache(b.destLocation.href,d&&d.data||null,this.textStatus_,this.jqXHR_),d=this.model_.getCache(b.destLocation.href),this.cache_=d),f&&g.time.push(g.now()-g.fire),f&&g.name.push("parse("+g.time.slice(-1)+")"),this.checkRedirect_(),this.dispatchEvent_(window,b.gns+":unload",!1,!0),jQuery(window).trigger(b.gns+".unload"),this.updateUrl_(),this.model_.setGlobalSetting(jQuery.extend(!0,{},b,{origLocation:b.destLocation.cloneNode()})),this.updateDocument_()}catch(h){if(!h)return;this.cache_&&this.model_.removeCache(b.destLocation.href),this.model_.fallback(c,b)}},d.prototype.isCacheUsable_=function(a,b){switch(!0){case!a.cache.click&&!a.cache.submit&&!a.cache.popstate:case"submit"===b.type.toLowerCase()&&!a.cache[b.currentTarget.method.toLowerCase()]:return!1;default:return!0}},d.prototype.checkRedirect_=function(){var c=this,d=this.setting_,e=this.event_,f=this.register_,g=d.callbacks.update;if(jQuery('head meta[http-equiv="Refresh"][content*="URL="]',this.srcDocument_).length&&b.Util.fire(g.redirect.before,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var h=d.destLocation.cloneNode();switch(h.href=jQuery(h).attr("content").match(/\w+:\/\/[^;\s]+/i).shift(),!0){case!d.redirect:case h.protocol!==d.destLocation.protocol:case h.host!==d.destLocation.host:case"submit"===e.type.toLowerCase()&&"GET"!==e.currentTarget.method.toUpperCase():switch(e.type.toLowerCase()){case"click":case"submit":window.location.assign(h.href);break;case"popstate":window.location.replace(h.href)}throw!1;default:switch(jQuery[a.NAME].enable(),e.type.toLowerCase()){case"click":case"submit":setTimeout(function(){return jQuery[a.NAME].click(h.href)},0);break;case"popstate":window.history.replaceState(window.history.state,this.srcDocument_.title,h.href),f&&d.fix.location&&(jQuery[a.NAME].disable(),window.history.back(),window.history.forward(),jQuery[a.NAME].enable()),setTimeout(function(){return c.dispatchEvent_(window,"popstate",!1,!1)},0)}throw!1}b.Util.fire(g.redirect.after,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},d.prototype.updateUrl_=function(){var c=this.setting_,e=this.event_,f=this.register_,g=c.callbacks.update;if(b.Util.fire(g.url.before,null,[e,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){if(f&&window.history.pushState(b.Util.fire(c.state,null,[e,c.param,c.origLocation.href,c.destLocation.href]),window.opera||~window.navigator.userAgent.toLowerCase().indexOf("opera")?this.dstDocument_.title:this.srcDocument_.title,c.destLocation.href),f&&c.fix.location&&(jQuery[a.NAME].disable(),window.history.back(),window.history.forward(),jQuery[a.NAME].enable()),!b.Util.compareUrl(c.destLocation.href,b.Util.normalizeUrl(window.location.href)))throw c.retriable?(c.retriable=!1,c.destLocation.href=b.Util.normalizeUrl(window.location.href),new d(this.model_,this.app_,c,e,!1,c.cache[e.type.toLowerCase()]&&this.model_.getCache(c.destLocation.href),this.data_,this.textStatus_,this.jqXHR_,this.errorThrown_,this.host_),!1):new Error("throw: location mismatch");c.retriable=!0,b.Util.fire(g.url.after,null,[e,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},d.prototype.updateDocument_=function(){var a=this,c=this.setting_,d=this.event_;this.overwriteDocumentByCache_(),c.fix.noscript&&this.escapeNoscript_(this.srcDocument_),this.rewrite_(),this.title_(),this.head_();var e=c.speedcheck,f=this.model_.stock("speed");e&&f.time.push(f.now()-f.fire),e&&f.name.push("head("+f.time.slice(-1)+")"),this.loadwaits_=this.area_(),e&&f.time.push(f.now()-f.fire),e&&f.name.push("content("+f.time.slice(-1)+")"),this.balance_(),this.css_('link[rel~="stylesheet"], style'),jQuery(window).one(c.gns+":rendering",function(g){g.preventDefault(),g.stopImmediatePropagation();var h=function(e){return a.dispatchEvent_(document,c.gns+":ready",!1,!0),jQuery(document).trigger(c.gns+".ready"),b.Util.fire(c.callback,null,[d,c.param,a.data_,a.textStatus_,a.jqXHR_]),a.waitRender_(jQuery.when?jQuery.Deferred().resolve:e)},i=function(b){return setTimeout(function(){a.app_.page.isScrollPosSavable=!0,"popstate"!==d.type.toLowerCase()?a.scrollByHash_(c.destLocation.hash)||a.scroll_(!0):a.scroll_(!0)},100),a.dispatchEvent_(document,c.gns+":render",!1,!0),jQuery(document).trigger(c.gns+".render"),e&&f.time.push(f.now()-f.fire),e&&f.name.push("render("+f.time.slice(-1)+")"),jQuery.when?jQuery.when.apply(jQuery,a.loadwaits_):b()},j=function(){return a.dispatchEvent_(window,c.gns+":load",!1,!0),jQuery(window).trigger(c.gns+".load"),e&&f.time.push(f.now()-f.fire),e&&f.name.push("load("+f.time.slice(-1)+")"),e&&console.log(f.time),e&&console.log(f.name),a.script_("[src][defer]"),jQuery.when&&jQuery.Deferred()};a.scroll_(!1);var k=a.script_(":not([defer]), :not([src])");if(jQuery.when){var l=jQuery.Deferred().pipe?"pipe":"then";jQuery.when.apply(jQuery,k)[l](function(){return h()},function(){return h()})[l](function(){return i()},function(){return i()})[l](function(){return j()},function(){return j()})}else h(function(){return i(function(){return j()})})}).trigger(c.gns+":rendering")},d.prototype.overwriteDocumentByCache_=function(){var a=this.setting_,b=this.event_,c=this.cache_;if(this.isCacheUsable_(a,b)&&c&&c.data){var d=a.fix.noscript?this.restoreNoscript_(c.data):c.data,e=this.createHTMLDocument_(d,a.destLocation.href),f=this.srcDocument_;f.title=e.title;for(var g,h,i=0;a.areas[i];i++){if(g=jQuery(a.areas[i],e).clone(),h=jQuery(a.areas[i],f),!g.length||!h.length||g.length!==h.length)throw new Error("throw: area mismatch");for(var j=0;g[j];j++)h[j].parentNode.replaceChild(g[j],h[j])}}},d.prototype.rewrite_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;a.rewrite&&b.Util.fire(d.rewrite.before,null,[c,a.param])!==!1&&(b.Util.fire(a.rewrite,null,[this.srcDocument_,a.area,this.host_]),b.Util.fire(d.rewrite.before,null,[c,a.param])===!1)},d.prototype.title_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;b.Util.fire(d.title.before,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])!==!1&&(this.dstDocument_.title=this.srcDocument_.title,a.database&&a.fix.history&&this.app_.data.saveTitleToDB(a.destLocation.href,this.srcDocument_.title),b.Util.fire(d.title.after,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])===!1)},d.prototype.head_=function(){var a=this.setting_,c=this.event_,d=this.srcDocument_,e=this.dstDocument_,f=a.callbacks.update;if(a.load.head&&b.Util.fire(f.head.before,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){for(var g,h="base, meta, link",i=jQuery(d.head).children(h).filter(a.load.head).not(a.load.ignore).not('link[rel~="stylesheet"], style, script'),j=jQuery(e.head).children(h).filter(a.load.head).not(a.load.ignore).not('link[rel~="stylesheet"], style, script'),k=jQuery(),l=j,m=0;g=i[m];m++){for(var n=0;l[n];n++)if(l[n].tagName===g.tagName&&l[n].outerHTML===g.outerHTML){if(k.length){var o=j[j.index(l[n])-1];o?jQuery(o).after(k.clone()):l.eq(n).before(k.clone()),k=jQuery()}l=l.not(l[n]),g=null;break}k=k.add(g)}jQuery("title",e).before(k.clone()),l.remove(),b.Util.fire(f.head.after,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},d.prototype.area_=function(){function a(){var a=jQuery.Deferred();return jQuery(this).one("load error",a.resolve),a}var c,d=this,e=this.setting_,f=this.event_,g=this.srcDocument_,h=this.dstDocument_,i=e.callbacks.update,j=[];if(b.Util.fire(i.content.before,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return j;jQuery(e.area).children("."+e.nss.class4html+"-check").remove(),c=jQuery("<div/>",{"class":e.nss.class4html+"-check",style:"background: none !important; display: block !important; visibility: hidden !important; position: absolute !important; top: 0 !important; left: 0 !important; z-index: -9999 !important; width: auto !important; height: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; font-size: 12px !important; text-indent: 0 !important;"}).text(e.gns);for(var k,l,m=0;e.areas[m];m++){if(k=jQuery(e.areas[m],g).clone(),l=jQuery(e.areas[m],h),!k.length||!l.length||k.length!==l.length)throw new Error("throw: area mismatch");k.find("script").each(function(a,b){return d.escapeScript_(b)}),jQuery.when&&(j=j.concat(k.find("img, iframe, frame").map(a).get()));for(var n=0;k[n];n++)l[n].parentNode.replaceChild(k[n],l[n]);l=jQuery(e.areas[m],h),l.append(c.clone()),l.find("script").each(function(a,b){return d.restoreScript_(b)})}return this.dispatchEvent_(document,e.gns+":DOMContentLoaded",!1,!0),jQuery(document).trigger(e.gns+".DOMContentLoaded"),b.Util.fire(i.content.after,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])===!1?j:j},d.prototype.balance_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;if(a.balance.self&&a.loadtime&&b.Util.fire(d.balance.before,null,[c,a.param])!==!1){var e=(this.jqXHR_.getResponseHeader(a.balance.server.header)||"").split("//").pop();this.app_.data.saveLogToDB({host:e,performance:Math.ceil(a.loadtime/(this.jqXHR_.responseText.length||1)*1e5),date:(new Date).getTime()}),this.app_.data.saveServerToDB(e,0,a.destLocation.href,this.calExpires(this.jqXHR_)),this.app_.balance.chooseServer(a),this.app_.data.loadBufferAll(a.buffer.limit),b.Util.fire(d.balance.after,null,[c,a.param])===!1}},d.prototype.css_=function(a){function c(){return jQuery.contains(g.head,this)}function d(){return jQuery.contains(g.body,this)}var e=this.setting_,f=this.event_,g=this.srcDocument_,h=this.dstDocument_,i=e.callbacks.update;if(e.load.css&&b.Util.fire(i.css.before,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){for(var j,k="link, style",l=jQuery(k,g).filter(a).not(e.load.ignore).not(jQuery("noscript",g).find(k)),m=jQuery(k,h).filter(a).not(e.load.ignore).not(jQuery("noscript",g).find(k)),n=jQuery(),o=m,p=0;j=l[p];p++){for(var q,r=0;o[r];r++){switch(j.tagName.toLowerCase()){case"link":q=j.href===o[r].href;break;case"style":q=j.innerHTML.trim()===o[r].innerHTML.trim()}if(q){if(n.length){if(jQuery.contains(h.body,o[r])&&n.first().parents("head").length)jQuery(h.head).append(n.filter(c).clone()),o.eq(r).before(n.filter(d).clone());else{var s=m[m.index(o[r])-1];s?jQuery(s).after(n.clone()):o.eq(r).before(n.clone())}n=jQuery()}o=o.not(o[r]),r-=Number(!!r),j=null;break}}n=n.add(j)}if(jQuery(h.head).append(n.filter(c).clone()),jQuery(h.body).append(n.filter(d).clone()),o.remove(),b.Util.fire(i.css.after,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var t=e.speedcheck,u=this.model_.stock("speed");t&&u.time.push(u.now()-u.fire),t&&u.name.push("css("+u.time.slice(-1)+")")}}},d.prototype.script_=function(a){var c=this,d=this.setting_,e=this.event_,f=this.srcDocument_,g=this.dstDocument_,h=d.callbacks.update,i=[];if(!d.load.script)return i;if(b.Util.fire(h.script.before,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return i;for(var j,k="script",l=jQuery(k,f).filter(a).not(d.load.ignore).not(jQuery("noscript",f).find(k)),m=jQuery(),n=this.app_.page.loadedScripts,o=/^$|(?:application|text)\/(?:java|ecma)script/i,p=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,q=0;j=l[q];q++)if(o.test(j.type||"")&&(j.hasAttribute("src")?!n[j.src]:j.innerHTML.trim())){var r=jQuery(j).parent(d.load.log)[0];if(r&&!jQuery(j).parents(d.area).length){var s=jQuery(r.id||r.tagName,g)[0],t=j.cloneNode(!0);this.escapeScript_(t),s.appendChild(t),this.restoreScript_(t)}if(this.model_.isDeferrable)!function(a,b){if(b.hasAttribute("src")){if(!b.getAttribute("src"))return;b.hasAttribute("async")?jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:b.src,async:!0,global:!1})).done(function(){return c.dispatchEvent_(b,"load",!1,!0)}).fail(function(){return c.dispatchEvent_(b,"error",!1,!0)}):(jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:b.src,dataType:"text",async:!0,global:!1})).done(function(){return a.resolve([b,arguments[0]])}).fail(function(){return a.resolve([b,new Error])}),i.push(a))}else a.resolve([b,(b.text||b.textContent||b.innerHTML||"").replace(p,"")]),i.push(a)}(jQuery.Deferred(),j);else if(j.hasAttribute("src")){if(!j.getAttribute("src"))continue;m=m.add(j)}else m=m.add(j)}try{if(this.model_.isDeferrable)jQuery.when.apply(jQuery,i).always(function(){for(var a=0,b=arguments.length;b>a;a++){var e=arguments[a],f=e[0],g=e[1];f.src&&(n[f.src]=!d.load.reload||!jQuery(f).is(d.load.reload)),"string"==typeof g?(eval.call(window,g),f.hasAttribute("src")&&c.dispatchEvent_(f,"load",!1,!0)):f.hasAttribute("src")&&c.dispatchEvent_(f,"error",!1,!0)}});else for(var j,q=0;j=m[q];q++)j.hasAttribute("src")?(j.src&&(n[j.src]=!d.load.reload||!jQuery(j).is(d.load.reload)),function(a){jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:a.src,async:a.hasAttribute("async"),global:!1},{success:function(){return c.dispatchEvent_(a,"load",!1,!0)},error:function(){return c.dispatchEvent_(a,"error",!1,!0)}}))}(j)):eval.call(window,(j.text||j.textContent||j.innerHTML||"").replace(p,""))}catch(u){throw setTimeout(function(){return c.model_.fallback(e,d)},50),u}if(b.Util.fire(h.script.after,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return i;var v=d.speedcheck,w=this.model_.stock("speed");return v&&w.time.push(w.now()-w.fire),v&&w.name.push("script("+w.time.slice(-1)+")"),i},d.prototype.scroll_=function(a){var c=this.setting_,d=this.event_,e=c.callbacks.update;if(b.Util.fire(e.scroll.before,null,[d,c.param])!==!1){var f,g;switch(d.type.toLowerCase()){case"click":case"submit":f=a&&"function"==typeof c.scrollLeft?b.Util.fire(c.scrollLeft,null,[d,c.param,c.origLocation.href,c.destLocation.href]):c.scrollLeft,f=f>=0?f:0,f=f===!1||null===f?jQuery(window).scrollLeft():parseInt(Number(f)+"",10),g=a&&"function"==typeof c.scrollTop?b.Util.fire(c.scrollTop,null,[d,c.param,c.origLocation.href,c.destLocation.href]):c.scrollTop,g=g>=0?g:0,g=g===!1||null===g?jQuery(window).scrollTop():parseInt(Number(g)+"",10),jQuery(window).scrollTop()===g&&jQuery(window).scrollLeft()===f||window.scrollTo(f,g),a&&c.database&&this.app_.page.isScrollPosSavable&&c.fix.scroll&&this.app_.data.saveScrollPositionToDB(c.destLocation.href,f,g);break;case"popstate":a&&c.fix.scroll&&c.database&&this.app_.data.loadScrollPositionFromDB(c.destLocation.href)}b.Util.fire(e.scroll.after,null,[d,c.param])===!1}},d.prototype.waitRender_=function(a){function c(){return this.clientWidth||this.clientHeight||jQuery(this).is(":hidden")}var d=this.setting_,e=(this.event_,d.callbacks.update,jQuery(d.area)),f=e.children("."+d.nss.class4html+"-check"),g=(new Date).getTime()+5e3,h=function(){switch(!0){case!b.Util.compareUrl(d.destLocation.href,b.Util.normalizeUrl(window.location.href)):break;case(new Date).getTime()>g:case f.length!==e.length:case f.length===f.filter(c).length:f.remove(),a();break;default:setTimeout(h,100)}};return h(),jQuery.when&&a},d.prototype.scrollByHash_=function(a){if(a="#"===a.charAt(0)?a.slice(1):a,!a)return!1;var b=jQuery("#"+(a?a:", [name~="+a+"]")).first();return b.length?(isFinite(b.offset().top)&&window.scrollTo(jQuery(window).scrollLeft(),parseInt(Number(b.offset().top)+"",10)),!0):!1},d.prototype.escapeNoscript_=function(a){function b(){jQuery(this).text(this.innerHTML)}jQuery("noscript",a).children().parent().each(b)},d.prototype.restoreNoscript_=function(a){var b=jQuery("<span/>");return a.replace(/(<noscript>)([^<>]+?)(<\/noscript>)/gim,function(a,c,d,e){return c+b.html(d).text()+e})},d.prototype.escapeScript_=function(a){jQuery.data(a,"source",a.src),jQuery.data(a,"code",a.innerHTML),a.removeAttribute("src"),a.innerHTML=""},d.prototype.restoreScript_=function(a){undefined!==jQuery.data(a,"code")&&(a.innerHTML=" ",jQuery.data(a,"source")?(a.src=jQuery.data(a,"source"),jQuery.removeData(a,"source")):a.removeAttribute("src"),a.innerHTML=jQuery.data(a,"code"),jQuery.removeData(a,"code"))},d.createHTMLDocument_=function(a,b){var c,d=this;return this.createHTMLDocument_=function(a,b){function e(a){for(var c=[],d=0;d<arguments.length-1;d++)c[d]=arguments[d+1];try{var e='<html lang="en" class="html"><head><link href="/"><noscript><style>/**/</style></noscript></head><body><noscript>noscript</noscript><a href="/"></a></body></html>',f=a(e,"");return f&&f.URL&&decodeURI(f.URL)===decodeURI(b||window.location.href)&&f.querySelector('html.html[lang="en"]')&&f.querySelector("head>link").href&&f.querySelector("head>noscript").innerHTML&&"noscript"===f.querySelector("body>noscript").innerHTML&&f.querySelector("body>a").href&&!0||!1}catch(g){return!1}}function f(a,b){var c=document.createElement("div");c.innerHTML=(b.match(/<html(?:\s.*?[^\\])?>/i)||["<html>"]).shift().replace(/html/i,"div")+"</div>";for(var d,e=c.firstChild.attributes,f=0;d=e[f];f++)a.documentElement.setAttribute(d.name,d.value);var c=document.createElement("html");for(c.innerHTML=b.replace(/^.*?<html(?:\s.*?[^\\])?>/im,""),a.documentElement.removeChild(a.head),a.documentElement.removeChild(a.body);c.childNodes.length;)a.documentElement.appendChild(c.childNodes[0]);return a}var g=window.location.href;b&&window.history.replaceState(window.history.state,document.title,b);var h;switch(c){case"dom":"function"==typeof window.DOMParser&&(h=(new window.DOMParser).parseFromString(a,"text/html"));break;case"doc":if(document.implementation&&document.implementation.createHTMLDocument){if(h=document.implementation.createHTMLDocument(""),"object"!=typeof h.activeElement||!h.activeElement)break;h.open(),h.write(a),h.close()}break;case"manipulate":document.implementation&&document.implementation.createHTMLDocument&&(h=f(document.implementation.createHTMLDocument(""),a));break;default:var i=function(a){return e(d.createHTMLDocument_,c=a)};switch(/webkit|firefox|trident|$/i.exec(window.navigator.userAgent.toLowerCase()).shift()){case"webkit":i("doc")||i("dom")||i("manipulate");break;case"firefox":i("dom")||i("doc")||i("manipulate");break;case"trident":i("manipulate")||i("dom")||i("doc");break;default:i("dom")||i("doc")||i("manipulate")}h=d.createHTMLDocument_(a,b)}return b&&window.history.replaceState(window.history.state,document.title,g),h},this.createHTMLDocument_(a,b)},d}(b.AppPageUtility);b.AppPageUpdate=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(b){function c(c,d){b.call(this),this.model_=c,this.app_=d,this.landing=a.Util.normalizeUrl(window.location.href),this.recent={order:[],data:{},size:0},this.loadedScripts={},this.isScrollPosSavable=!0}return __extends(c,b),c.prototype.transfer=function(a,b,c,d){var e=this,f=function(a,b,c,d,f,g,h,i,j){e.update(a,b,c,d,f,g,h,i,j)},g=function(a,b,c,d,f,g){a.fallback&&"abort"!==g&&(a.balance.self&&e.app_.balance.disable(a),e.model_.fallback(b,a))};this.fetch(a,b,c,d,f,g)},c.prototype.fetch=function(b,c,d,e,f,g){new a.AppPageFetch(this.model_,this.app_,b,c,d,e,f,g)},c.prototype.update=function(b,c,d,e,f,g,h,i,j){new a.AppPageUpdate(this.model_,this.app_,b,c,d,e,f,g,h,i,j)},c}(a.AppPageUtility);a.AppPage=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(MODULE){!function(MODEL){var App=function(_super){function App(a,b){_super.call(this),this.model_=a,this.controller_=b,this.balance=new MODEL.AppBalance(this.model_,this),this.page=new MODEL.AppPage(this.model_,this),this.data=new MODEL.AppData(this.model_,this)}return __extends(App,_super),App.prototype.initialize=function(a,b){var c=this,d=this.page.loadedScripts;b.load.script&&jQuery("script").each(function(){var a=this;a.src&&(d[a.src]=!b.load.reload||!jQuery(a).is(b.load.reload))}),new MODULE.VIEW.Main(this.model_,this.controller_,a).BIND(b),setTimeout(function(){return c.data.loadBufferAll(b.buffer.limit)},b.buffer.delay),b.balance.self&&setTimeout(function(){return c.balance.enable(b)},b.buffer.delay),setTimeout(function(){return c.page.landing=null},1500)},App.prototype.configure=function(option,origURL,destURL){function scope(a,b,c,d){"undefined"==typeof d&&(d="");var e,f,g,h,i,j,k,l,m,n,o,p=a.scope;if(e=that.model_.convertUrlToKeyUrl(b).match(/.+?\w(\/.*)/).pop(),f=that.model_.convertUrlToKeyUrl(c).match(/.+?\w(\/.*)/).pop(),d=d.replace(/[#?].*/,""),h=(d||f).replace(/^\/|\/$/g,"").split("/"),d){if(!~d.indexOf("*"))return undefined;g=[];for(var q=e.replace(/^\/|\/$/g,"").split("/"),r=0,s=h.length;s>r;r++)"*"===h[r]&&g.push(q[r])}for(var r=h.length+1;r--;)if(l=o=m=n=undefined,i=h.slice(0,r).join("/"),i="/"+i+("/"===(d||e).charAt(i.length+1)?"/":""),i&&i in p){if(p[i]instanceof Array?(j="",k=p[i]):(j=p[i],k=p[j]),!k||!k.length)return!1;k=k.concat();for(var t,u=0;(t=k[u])&&(m!==!1&&n!==!1);u++)if("#"===t[0]&&(j=t.slice(1),[].splice.apply(k,[u,1].concat(p[j])),t=k[u]),"inherit"===t)l=!0;else if("rewrite"!==t||"function"!=typeof p.rewrite||d){if("string"==typeof t){var v="!"===t[0];t=v?t.slice(1):t;var w="*"===t[0];if(t=w?t.slice(1):t,d&&~t.indexOf("/*/"))for(var x=0,s=g.length;s>x;x++)t=t.replace("/*/","/"+g[x]+"/");if(w?!e.search(t):!e.indexOf(t)){if(v)return!1;m=!0}if(w?!f.search(t):!f.indexOf(t)){if(v)return!1;n=!0,o=p["$"+j]||p["$"+t]||null}}}else{var y=scope.apply(this,[].slice.call(arguments).slice(0,3).concat([MODEL.Util.fire(p.rewrite,null,[f])]));if(y){m=n=!0,o=y;break}if(!1===y)return!1}if(m&&n)return jQuery.extend(!0,{},a,o);if(!l)break}}var that=this;origURL=MODEL.Util.normalizeUrl(origURL||option.origLocation.href),destURL=MODEL.Util.normalizeUrl(destURL||option.destLocation.href),option=jQuery.extend(!0,{},option.option||option,{option:option.option||option}),option=option.scope?jQuery.extend(!0,{},option,scope(option,origURL,destURL)||{disable:!0}):jQuery.extend(!0,{},option);var initial={gns:MODULE.NAME,ns:"",disable:!1,area:"body",link:"a:not([target])",filter:function(){return/^https?:/.test(this.href)&&/(\/[^.]*|\.html?|\.php)$/.test("/"+this.pathname)},form:null,scope:null,rewrite:null,state:null,scrollTop:0,scrollLeft:0,ajax:{dataType:"text"},contentType:"text/html",cache:{click:!1,submit:!1,popstate:!1,get:!0,post:!0,mix:0,limit:100,size:1048576,expires:{max:null,min:3e5}},buffer:{limit:30,delay:500},load:{head:"",css:!1,script:!1,execute:!0,log:"head, body",reload:"",ignore:'[src*="jquery.js"], [src*="jquery.min.js"], [href^="chrome-extension://"]',ajax:{dataType:"script",cache:!0}},balance:{self:!1,weight:3,client:{support:{userAgent:/msie|trident.+ rv:|chrome|firefox|safari/i,redirect:/chrome|firefox|safari/i},exclude:/mobile|phone|android|iphone|blackberry/i,cookie:{balance:"ajax_balanceable",redirect:"ajax_redirectable",host:"ajax_host"}},server:{header:"X-Ajax-Host",filter:null,error:6e5},log:{expires:864e6,limit:30},option:{server:{header:!1},ajax:{crossDomain:!0},callbacks:{ajax:{beforeSend:null}}}},callback:null,callbacks:{ajax:{},update:{redirect:{},rewrite:{},url:{},title:{},head:{},content:{},scroll:{},css:{},script:{},balance:{}}},param:null,redirect:!0,wait:0,scroll:{delay:300},fix:{location:!0,history:!0,scroll:!0,noscript:!0,reset:!1},fallback:!0,database:!0,server:{query:"pjax=1",header:!0},speedcheck:!1},force={origLocation:function(a,b){return b.href=a,b}(origURL,document.createElement("a")),destLocation:function(a,b){return b.href=a,b}(destURL,document.createElement("a")),balance:{server:{host:""}},scroll:{queue:[]},loadtime:null,retriable:!0,option:option.option},compute=function(){var nsArray=[setting.gns||MODULE.NAME].concat(setting.ns&&String(setting.ns).split(".")||[]),query=setting.server.query;switch(query&&typeof query){case"string":query=eval("({"+query.replace(/"/g,'\\"').replace(/([^?=&]+)=([^&]*)/g,'"$1": "$2"').replace(/&/g,",")+"})");case"object":query=jQuery.param(query)}return{nss:{name:setting.ns||"",array:nsArray,event:nsArray.join("."),data:nsArray.join("-"),class4html:nsArray.join("-"),click:["click"].concat(nsArray.join(":")).join("."),submit:["submit"].concat(nsArray.join(":")).join("."),popstate:["popstate"].concat(nsArray.join(":")).join("."),scroll:["scroll"].concat(nsArray.join(":")).join("."),requestHeader:["X",nsArray[0].replace(/^\w/,function(a){return a.toUpperCase()})].join("-")},fix:/android|iphone os|like mac os x/i.test(window.navigator.userAgent)?{}:{location:!1,reset:!1},contentType:setting.contentType.replace(/\s*[,;]\s*/g,"|").toLowerCase(),server:{query:query},timeStamp:(new Date).getTime()}},setting;return setting=jQuery.extend(!0,initial,option),setting=jQuery.extend(!0,setting,setting.balance.self&&setting.balance.option,force),setting=jQuery.extend(!0,setting,compute())},App}(MODEL.Template);MODEL.App=App}(MODULE.MODEL||(MODULE.MODEL={}));var MODEL=MODULE.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(c){function d(){c.apply(this,arguments);var d=this;this.controller_=new a.CONTROLLER.Main(this),this.app_=new b.App(this,this.controller_),this.state_=-1,this.isDeferrable=jQuery.when&&1.06<=Number(jQuery().jquery.replace(/\D*(\d+)\.(\d+).*$/,"$1.0$2").replace(/\d+(\d{2})$/,"$1")),this.host=function(){return d.app_.balance.host()}}return __extends(d,c),d.prototype.main_=function(b,c){var d,e=this;switch(d=b instanceof a.NAMESPACE?"m:":"f:",d+=c?{}.toString.call(c).split(" ").pop().slice(0,-1).toLowerCase():c,d.toLowerCase()){case"m:object":break;case"m:undefined":if(b.is("a, form"))return b;c={};break;default:return b}var f=this.app_.configure(c,window.location.href,window.location.href);return this.setGlobalSetting(f),f.database&&this.app_.data.opendb(f),this.app_.stock({speed:{fire:0,time:[],name:[],now:function(){return(new Date).getTime()}}}),"pushState"in window.history&&window.history.pushState&&jQuery(function(){e.app_.initialize(b,f),e.state_=-1===e.state()?0:e.state()}),b},d.prototype.state=function(){return this.state_},d.prototype.convertUrlToKeyUrl=function(a){return a.replace(/#.*/,"")},d.prototype.isImmediateLoadable=function(a,c){if(0===this.state()){var d,e,f=b.Util.normalizeUrl(window.location.href);switch(typeof a){case"string":e=null,d=b.Util.normalizeUrl(a);break;case"object":switch(e=a,e.type.toLowerCase()){case"click":d=b.Util.normalizeUrl(e.currentTarget.href);break;case"submit":d=b.Util.normalizeUrl(e.currentTarget.action);break;case"popstate":return!0}if(e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1}var g=jQuery("<a/>",{href:f})[0],h=jQuery("<a/>",{href:d})[0];if(g.protocol!==h.protocol||g.host!==h.host)return!1;if(c=c||this.app_.configure(this.getGlobalSetting(),g.href,h.href),!c.disable)return h.hash&&g.href.replace(/#.*/,"")===h.href.replace(/#.*/,"")?!1:this.app_.page.chooseArea(c.area,document,document)&&jQuery(e.currentTarget).filter(c.filter).length?!0:!1}},d.prototype.getGlobalSetting=function(){return this.app_.page.globalSetting},d.prototype.setGlobalSetting=function(a){return this.app_.page.globalSetting=a},d.prototype.getGlobalXHR=function(){return this.app_.page.globalXHR},d.prototype.setGlobalXHR=function(a){return this.app_.page.globalXHR&&this.app_.page.globalXHR.readyState<4&&this.app_.page.globalXHR.abort(),this.app_.page.globalXHR=a},d.prototype.CLICK=function(a){a.timeStamp=(new Date).getTime();var b=a.currentTarget,c=(jQuery(b),this.app_.configure(this.getGlobalSetting(),window.location.href,b.href));if(!(0!==this.state()||c.disable||a.isDefaultPrevented()||!this.isImmediateLoadable(a,c)||c.cache.mix&&this.getCache(c.destLocation.href))){c.database&&this.app_.page.isScrollPosSavable&&this.app_.data.saveScrollPositionToDB(c.destLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop());var d;return c.cache[a.type.toLowerCase()]&&(d=this.getCache(c.destLocation.href)),this.app_.page.transfer(c,a,c.destLocation.href!==c.origLocation.href,d),void a.preventDefault()}!a.originalEvent&&!a.isDefaultPrevented()&&!jQuery(document).has(b).length&&this.fallback(a,c)},d.prototype.SUBMIT=function(a){a.timeStamp=(new Date).getTime();var c=a.currentTarget,d=(jQuery(c),this.app_.configure(this.getGlobalSetting(),window.location.href,c.action));if(0===this.state()&&!d.disable&&!a.isDefaultPrevented()&&this.isImmediateLoadable(a,d)){var e=d.destLocation.href.replace(/[?#].*/,"")+("GET"===c.method.toUpperCase()?"?"+jQuery(c).serialize():"");if(d.destLocation.href=b.Util.normalizeUrl(e),!d.cache.mix||!this.getCache(d.destLocation.href)){d.database&&this.app_.page.isScrollPosSavable&&this.app_.data.saveScrollPositionToDB(d.destLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop());var f;return d.cache[a.type.toLowerCase()]&&d.cache[c.method.toLowerCase()]&&(f=this.getCache(d.destLocation.href)),this.app_.page.transfer(d,a,d.destLocation.href!==d.origLocation.href,f),void a.preventDefault()}}!a.originalEvent&&!a.isDefaultPrevented()&&!jQuery(document).has(c).length&&this.fallback(a,d)},d.prototype.POPSTATE=function(a){a.timeStamp=(new Date).getTime();var c=this.app_.configure(this.getGlobalSetting(),null,window.location.href);if(!(this.app_.page.landing&&this.app_.page.landing===b.Util.normalizeUrl(window.location.href)||c.origLocation.href===c.destLocation.href||0!==this.state()||c.disable||!this.isImmediateLoadable(a,c)||c.origLocation.hash!==c.destLocation.hash&&c.origLocation.pathname+c.origLocation.search===c.destLocation.pathname+c.destLocation.search)){c.database&&c.fix.history&&this.app_.data.loadTitleFromDB(c.destLocation.href);var d;return c.cache[a.type.toLowerCase()]&&(d=this.getCache(c.destLocation.href)),void this.app_.page.transfer(c,a,!1,d)}},d.prototype.SCROLL=function(a){var b=this,c=this.getGlobalSetting();if(0===this.state()&&!a.isDefaultPrevented())if(c.scroll.delay){for(var d;d=c.scroll.queue.shift();)clearTimeout(d);d=setTimeout(function(){for(;d=c.scroll.queue.shift();)clearTimeout(d);b.app_.page.isScrollPosSavable&&b.app_.data.saveScrollPositionToDB(window.location.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop())},c.scroll.delay),c.scroll.queue.push(d)}else this.app_.page.isScrollPosSavable&&this.app_.data.saveScrollPositionToDB(window.location.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop())},d.prototype.fallback=function(a,c){switch(!0){case!c.fallback:case!1===b.Util.fire(c.fallback,null,[a,c.param,c.origLocation.href,c.destLocation.href]):break;default:this.app_.page.movePageNormally(a)}},d.prototype.enable=function(){this.state_=0},d.prototype.disable=function(){this.state_=1},d.prototype.getCache=function(a){var c=this.getGlobalSetting(),d=this.app_.page.recent;
 +
if(!c||!d)return null;var e=this.convertUrlToKeyUrl(b.Util.normalizeUrl(a));return a=null,d.data[e]&&(new Date).getTime()>d.data[e].expires&&this.removeCache(e),d.data[e]&&!d.data[e].data&&!d.data[e].jqXHR&&this.removeCache(e),d.data[e]},d.prototype.setCache=function(a,c,d,e,f){var g=this,h=this.getGlobalSetting(),i=this.app_.page.recent;if(!h||!i)return this;var j,k,l,m,n=this.convertUrlToKeyUrl(b.Util.normalizeUrl(a));a=null,i.order.unshift(n);for(var o,p=1;o=i.order[p];p++)n===o&&i.order.splice(p,1);if(i.size>h.cache.size&&this.cleanCache(),j=this.getCache(n),c||e||j&&(j.data||j.jqXHR)){var q=(e||{}).responseText||"";if(k=parseInt(1.8*q.length+""||"1048576",10),l=(new Date).getTime(),m=function(a){{var b;h.cache.expires}return h.cache.expires?i.data[n]&&!e?i.data[n].expires:(b=e&&g.app_.page.calAge(e)||Number(h.cache.expires),b=Math.max(b,0)||0,b="object"==typeof h.cache.expires&&"number"==typeof h.cache.expires.min?Math.max(h.cache.expires.min,b):b,b="object"==typeof h.cache.expires&&"number"==typeof h.cache.expires.max?Math.min(h.cache.expires.max,b):b,a+b):0}(l),i.size=i.size||0,i.size+=i.data[n]?0:k,i.data[n]=jQuery.extend(!0,{},j,{jqXHR:e,textStatus:d,data:c,size:k,expires:m,host:f||"",timeStamp:l}),i.data[n].data||i.data[n].jqXHR||this.removeCache(n),e||j&&j.jqXHR){var r=((e||j&&j.jqXHR).responseText||"").slice(0,1e4).match(/<title[^>]*>(.*?)<\/title>/i).pop()||"";h.database&&h.fix.history&&this.app_.data.saveTitleToDB(n,r)}}},d.prototype.removeCache=function(a){var c=this.getGlobalSetting(),d=this.app_.page.recent;if(c&&d){var e=this.convertUrlToKeyUrl(b.Util.normalizeUrl(a));a=null;for(var f,g=0;f=d.order[g];g++)e===f&&(d.order.splice(g,1),d.size-=d.data[f].size,d.data[f]=null,delete d.data[f])}},d.prototype.clearCache=function(){var a=this.getGlobalSetting(),b=this.app_.page.recent;if(a&&b)for(var c,d=b.order.length;c=b.order[--d];)b.order.splice(d,1),b.size-=b.data[c].size,delete b.data[c]},d.prototype.cleanCache=function(){var a=this.getGlobalSetting(),b=this.app_.page.recent;if(a&&b)for(var c,d=b.order.length;c=b.order[--d];)(d>=a.cache.limit||c in b.data&&(new Date).getTime()>b.data[c].expires)&&(b.order.splice(d,1),b.size-=b.data[c].size,delete b.data[c])},d.prototype.getRequestDomain=function(){return this.host()},d.prototype.setRequestDomain=function(a){return this.app_.balance.changeServer(a.split("//").pop(),null)},d}(b.Template);b.Main=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={})),new MODULE.MODEL.Main}(window,window.document,void 0,jQuery);

Latest revision as of 08:51, 26 August 2014

/*! jquery.pjax.js v2.21.0 | (c) 2012, falsandtru | MIT Licence */ !new function(window,document,undefined,$){"use strict";var MODULE;!function(a){a.NAME="pjax",a.NAMESPACE=jQuery,function(a){a[a.wait=-1]="wait",a[a.ready=0]="ready",a[a.lock=1]="lock",a[a.seal=2]="seal",a[a.error=3]="error"}(a.State||(a.State={}));a.State;a.GEN_UUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16).toUpperCase()})}}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d=function(){function b(b,d,e){for(var f=[],g=0;g<arguments.length-3;g++)f[g]=arguments[g+3];this.model_=b,this.controller_=d,this.state_=-1,this.queue_=[],this.HANDLERS={},c=d,this.UUID=a.GEN_UUID(),this.CONTEXT=e,this.OBSERVE.apply(this,f),this.state_=0}return b.prototype.OBSERVE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},b.prototype.RELEASE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},b.prototype.BIND=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];return this.UNBIND(),this},b.prototype.UNBIND=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];return this},b.EVENTS={},b.TRIGGERS={},b}();b.Template=d}(a.VIEW||(a.VIEW={}));a.VIEW}(MODULE||(MODULE={}));var __extends=this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);c.prototype=b.prototype,a.prototype=new c},MODULE;!function(a){!function(a){var b,c=function(a){function c(c,d,e){a.call(this,c,d,e),this.model_=c,this.controller_=d,this.HANDLERS={CLICK:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.CLICK.apply(b,a)},SUBMIT:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.SUBMIT.apply(b,a)},POPSTATE:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.POPSTATE.apply(b,a)},SCROLL:function(){for(var a=[],c=0;c<arguments.length-0;c++)a[c]=arguments[c+0];b.SCROLL.apply(b,a)}},b=d}return __extends(c,a),c.prototype.BIND=function(a){return this.UNBIND(a),this.CONTEXT.delegate(a.link,a.nss.click,this.HANDLERS.CLICK).delegate(a.form,a.nss.submit,this.HANDLERS.SUBMIT),jQuery(window).bind(a.nss.popstate,this.HANDLERS.POPSTATE),a.fix.scroll&&jQuery(window).bind(a.nss.scroll,this.HANDLERS.SCROLL),this},c.prototype.UNBIND=function(a){return this.CONTEXT.undelegate(a.link,a.nss.click).undelegate(a.form,a.nss.submit),jQuery(window).unbind(a.nss.popstate),a.fix.scroll&&jQuery(window).unbind(a.nss.scroll),this},c.prototype.OBSERVE=function(){return this.RELEASE(),this},c.prototype.RELEASE=function(){return this},c.EVENTS={},c.TRIGGERS={},c}(a.Template);a.Main=c}(a.VIEW||(a.VIEW={}));a.VIEW}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d,e=function(){function b(a,b){c=b,d=a}return b.prototype.enable=function(){return c.enable(),this},b.prototype.disable=function(){return c.disable(),this},b.prototype.click=function(b,e){var f,g=c.getGlobalSetting();switch(typeof b){case"undefined":f=this.end().filter("a").first().clone();break;case"object":f=jQuery(b).clone();break;case"string":e=e||{},e.href=b,f=jQuery("<a/>",e);break;default:return this}return f.first().one(g.nss.click,function(b){return new a.VIEW.Main(c,d,null).HANDLERS.CLICK(b)}).click()},b.prototype.submit=function(b,e,f){var g,h,i,j=c.getGlobalSetting(),k=document.createDocumentFragment();switch(!0){case"undefined"==typeof b:g=this.end().filter("form").first().clone();break;case"object"==typeof b:g=jQuery(b).clone();break;case!!f:e=e||{},e.action=b,h=f instanceof Array&&Array||f instanceof Object&&Object||undefined;for(var l in f){switch(h){case Object:i=jQuery("<textarea/>",{name:l}).val(f[l]);break;case Array:f[l].attr=f[l].attr||{},f[l].attr.name=f[l].name,i=jQuery(f[l].tag.indexOf("<")?"<"+f[l].tag+"/>":f[l].tag,f[l].attr||{}).val(f[l].value);break;default:continue}k.appendChild(i[0])}g=jQuery("<form/>",e).append(k);break;default:return this}return g.first().one(j.nss.submit,function(b){return new a.VIEW.Main(c,d,null).HANDLERS.SUBMIT(b)}).submit()},b.prototype.getCache=function(a){"undefined"==typeof a&&(a=window.location.href);var b=c.getCache(a);return b&&(b={data:b.data,textStatus:b.textStatus,jqXHR:b.jqXHR,expires:b.expires}),b},b.prototype.setCache=function(a,b,d,e){switch("undefined"==typeof a&&(a=window.location.href),arguments.length){case 0:return this.setCache(a,document.documentElement.outerHTML);case 1:return this.setCache(a,null);case 2:case 3:case 4:default:c.setCache(a,b,d,e)}return this},b.prototype.removeCache=function(a){return"undefined"==typeof a&&(a=window.location.href),c.removeCache(a),this},b.prototype.clearCache=function(){return c.clearCache(),this},b.prototype.follow=function(b,d,e,f){if(!c.isDeferrable)return!1;var g=b.currentTarget;return d.follow=!0,d.host=e||"",isFinite(b.timeStamp)&&(d.timeStamp=f||b.timeStamp),c.setGlobalXHR(d),jQuery.when(d).done(function(){!c.getCache(g.href)&&c.isImmediateLoadable(b)&&c.setCache(g.href,undefined,undefined,d)}),jQuery[a.NAME].click(g.href),!0},b.prototype.host=function(){return c.host()},b}();b.ControllerFunction=e}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(b,c){a.call(this,b,c)}return __extends(b,a),b}(a.ControllerFunction);a.ControllerMethod=b}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c,d,e=function(){function e(e){for(var f=[],g=0;g<arguments.length-1;g++)f[g]=arguments[g+1];this.state_=-1,this.HANDLERS={},c=e,d=this,this.UUID=a.GEN_UUID(),a.NAMESPACE[a.NAME]=a.NAMESPACE&&a.NAMESPACE==a.NAMESPACE.window?this.EXEC:a.NAMESPACE.prototype[a.NAME]=this.EXEC;var h=new b.ControllerFunction(d,c);this.REGISTER_FUNCTIONS(a.NAMESPACE[a.NAME],h),this.UPDATE_PROPERTIES(a.NAMESPACE[a.NAME],h),this.OBSERVE.apply(this,f),this.state_=0}return e.prototype.EXTEND=function(e){if(e===a.NAMESPACE||a.NAMESPACE&&a.NAMESPACE==a.NAMESPACE.window){var f=new b.ControllerFunction(d,c);e=a.NAMESPACE[a.NAME]}else var f=new b.ControllerMethod(d,c);return e instanceof a.NAMESPACE&&(e instanceof jQuery&&(e=e.add()),this.REGISTER_FUNCTIONS(e,f)),this.UPDATE_PROPERTIES(e,f),e},e.prototype.EXEC=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];var e=d.EXTEND(this);return a=[e].concat(a),a=d.exec_.apply(d,a),a=a instanceof Array?a:[a],c.MAIN.apply(c,a)},e.prototype.exec_=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return[a].concat(b)},e.prototype.REGISTER_FUNCTIONS=function(a,c){{var d;b.Template.PROPERTIES}for(d in c)a[d]=c[d];return a},e.prototype.UPDATE_PROPERTIES=function(a,c){var d,e,f,g=b.Template.PROPERTIES;for(d=0,e=g.length;e>d;d++)f=g[d],c[f]&&(a[f]=c[f].call(a));return a},e.prototype.OBSERVE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},e.prototype.RELEASE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0]},e.EVENTS={},e.FUNCTIONS={},e.METHODS={},e.PROPERTIES=[],e.TRIGGERS={},e}();b.Template=e}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(b){function c(a){b.call(this,a),this.model_=a,this.HANDLERS={}}return __extends(c,b),c.prototype.exec_=function(b,c){b=b instanceof jQuery?b:this.EXTEND(jQuery(document));var d;return d=b instanceof a.NAMESPACE?"m:":"f:",d+=c?{}.toString.call(c).split(" ").pop().slice(0,-1).toLowerCase():c,d.toLowerCase(),[b,c]},c.prototype.OBSERVE=function(){},c.prototype.CLICK=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.CLICK.apply(this.model_,a)},c.prototype.SUBMIT=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.SUBMIT.apply(this.model_,a)},c.prototype.POPSTATE=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.POPSTATE.apply(this.model_,a)},c.prototype.SCROLL=function(){for(var a=[],b=0;b<arguments.length-0;b++)a[b]=arguments[b+0];this.model_.SCROLL.apply(this.model_,a)},c.EVENTS={},c.PROPERTIES=[],c.TRIGGERS={},c}(b.Template);b.Main=c}(a.CONTROLLER||(a.CONTROLLER={}));a.CONTROLLER}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function b(){this.NAME=a.NAME,this.NAMESPACE=a.NAMESPACE,this.state_=-1,this.stock=function c(d,e,f){if(this instanceof c)switch(typeof d){case"object":case"function":return this.uuid=a.GEN_UUID(),c[this.uuid]=this,jQuery.extend.apply(jQuery,[!0,this].concat([].slice.call(arguments)).concat({uuid:this.uuid}));case"string":return delete c[d]}else if("object"==typeof d){var g,h=d;for(g in h)b.store(g,h[g])}else switch(arguments.length){case 0:return new this.stock;case 1:return this.stock[d]||b.store(d);case 2:return b.store(d,e);case 3:return b.store(d,e,f)}},this.UUID=a.GEN_UUID()}return b.prototype.MAIN=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return this.main_.apply(this,[a].concat(b))},b.prototype.main_=function(a){for(var b=[],c=0;c<arguments.length-1;c++)b[c]=arguments[c+1];return this.state_=0,a},b.store=function(a,c){switch(arguments.length){case 0:break;case 1:return b.store[a];case 2:return b.store[a]=c;case 3:return b.store[a]=jQuery.extend(!0,b.store[a],c)}},b}();b.Template=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a){this.buffer_=[],this.DB_=a}return a.prototype.accessStore=function(a,b){var c=this;"undefined"==typeof b&&(b="readwrite"),this.DB_.conExtend();try{var d=this.DB_.database(),e=d&&d.transaction(this.name,b).objectStore(this.name)}catch(f){}e?a(e):this.DB_.opendb(function(){return c.accessStore(a)})},a.prototype.accessRecord=function(a,b,c){"undefined"==typeof c&&(c="readwrite"),this.accessStore(function(c){c.get(a).onsuccess=b},c)},a.prototype.loadBuffer=function(a){var b=this;"undefined"==typeof a&&(a=0);var c=this;this.accessStore(function(d){var e=d.indexNames.length?d.indexNames[0]:d.keyPath;d.index(e).openCursor(b.DB_.IDBKeyRange.lowerBound(0),"prev").onsuccess=function(){if(this.result){var b=this.result,e=b.value;c.buffer_[e[d.keyPath]]=e,--a&&b["continue"]&&b["continue"]()}}})},a.prototype.saveBuffer=function(){},a.prototype.getBuffer=function(a){return a?this.buffer_[a]:this.buffer_},a.prototype.setBuffer=function(a,b){var c=a[this.keyPath];return this.buffer_[c]=b?jQuery.extend(!0,{},this.buffer_[c],a):a,this.buffer_[a[this.keyPath]]},a.prototype.addBuffer=function(a){return a[this.keyPath]=this.buffer_.length||1,this.buffer_.push(a),a},a.prototype.add=function(a){var b=a[this.keyPath];delete a[this.keyPath],this.accessRecord(b,function(){"undefined"!=typeof b&&this.source["delete"](b),this.source.add(a)})},a.prototype.set=function(a){var b=a[this.keyPath];this.accessRecord(b,function(){this.source.put(jQuery.extend(!0,{},this.result,a))})},a.prototype.get=function(a,b){this.accessRecord(a,b)},a.prototype.del=function(a){this.accessRecord(a,function(){this.source["delete"](a)})},a}();a.DataStore=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="meta",this.keyPath="id"}return __extends(b,a),b}(a.DataStore);a.DataStoreMeta=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="history",this.keyPath="id"}return __extends(b,a),b.prototype.clean=function(){var a=this;this.accessStore(function(b){b.count().onsuccess=function(){this.result>1e3&&(b.index("date").openCursor(a.DB_.IDBKeyRange.upperBound((new Date).getTime()-2592e5)).onsuccess=function(){if(this.result){var a=this.result;a?(a["delete"](a.value[b.keyPath]),a["continue"]&&a["continue"]()):b.count().onsuccess=function(){1e3<this.result&&b.clear()}}})}})},b}(a.DataStore);a.DataStoreHistory=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="log",this.keyPath="id"}return __extends(b,a),b.prototype.clean=function(){this.accessStore(function(a){var b=50;a.count().onsuccess=function(){this.result>b+10&&(b=this.result-b,a.index(a.keyPath).openCursor(this.DB_.IDBKeyRange.lowerBound(0)).onsuccess=function(){if(this.result){var c=this.result;c&&(0>--b&&c["delete"](c.value[a.keyPath]),c["continue"]&&c["continue"]())}})}})},b}(a.DataStore);a.DataStoreLog=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(a){function b(){a.apply(this,arguments),this.name="server",this.keyPath="id"}return __extends(b,a),b}(a.DataStore);a.DataStoreServer=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(){function c(){var c=this;this.IDBFactory=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,this.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.mozIDBKeyRange||window.msIDBKeyRange,this.name_=a.NAME,this.version_=4,this.refresh_=10,this.upgrade_=1,this.state_=-1,this.database=function(){return c.database_},this.state=function(){return c.state_},this.nowInitializing=!1,this.nowRetrying=!1,this.conAge_=1e4,this.conInterval_=1e3,this.tasks_=[],this.store={meta:new b.DataStoreMeta(this),history:new b.DataStoreHistory(this),log:new b.DataStoreLog(this),server:new b.DataStoreServer(this)},this.metaNames={version:"version",update:"update"};var d=function(){var a=(new Date).getTime(),b=c.conExpires_;b&&a>b&&(c.closedb(),c.conExpires_=0),setTimeout(d,Math.max(c.conExpires_-a+100,c.conInterval_)),c.tasks_.length&&!c.nowInitializing&&!c.nowRetrying&&c.opendb(null,!0)};this.conAge_&&setTimeout(d,this.conInterval_)}return c.prototype.opendb=function(a,b){var c=this;if(c.conExtend(),c.IDBFactory&&(a||c.tasks_.length)&&("function"==typeof a&&c.reserveTask_(a),!c.nowInitializing&&!c.nowRetrying))try{c.nowInitializing=!0;var d=c.IDBFactory.open(c.name_,c.upgrade_?c.version_:1);d.onblocked=function(){c.closedb(1);try{this.result.close(),!b&&setTimeout(function(){return c.opendb(null,!0)},1e3)}catch(a){!b&&c.initdb_(1e3)}},d.onupgradeneeded=function(){try{for(var a=this.result,d=a.objectStoreNames?a.objectStoreNames.length:0;d--;)a.deleteObjectStore(a.objectStoreNames[d]);a.createObjectStore(c.store.meta.name,{keyPath:c.store.meta.keyPath,autoIncrement:!1}).createIndex(c.store.meta.keyPath,c.store.meta.keyPath,{unique:!0}),a.createObjectStore(c.store.history.name,{keyPath:c.store.history.keyPath,autoIncrement:!1}).createIndex("date","date",{unique:!1}),a.createObjectStore(c.store.log.name,{keyPath:c.store.log.keyPath,autoIncrement:!0}).createIndex("date","date",{unique:!1}),a.createObjectStore(c.store.server.name,{keyPath:c.store.server.keyPath,autoIncrement:!1}).createIndex(c.store.server.keyPath,c.store.server.keyPath,{unique:!0})}catch(e){!b&&c.initdb_(1e3)}},d.onsuccess=function(){try{var a=this.result;c.checkdb_(a,c.version_,function(){c.database_=a,c.state_=0,c.conExtend(),c.nowInitializing=!1,c.digestTask_(),c.nowRetrying=!1},function(){!b&&c.initdb_()})}catch(d){a.close(),!b&&c.initdb_(1e3)}},d.onerror=function(){c.closedb(3);try{this.result.close(),!b&&setTimeout(function(){return c.opendb(null,!0)},1e3)}catch(a){!b&&c.initdb_(1e3)}}}catch(e){c.closedb(3),!b&&c.initdb_(1e3)}},c.prototype.closedb=function(a){"undefined"==typeof a&&(a=-1),this.database_=null,this.state_=a;var b=this.database_;b&&b.close&&b.close()},c.prototype.deletedb_=function(){this.closedb();var a=this.IDBFactory;a&&a.deleteDatabase&&a.deleteDatabase(this.name_)},c.prototype.initdb_=function(a){var b=this,c=function(){b.nowRetrying||(b.nowRetrying=!0,b.deletedb_()),b.opendb(null,!0)};a?void setTimeout(c,a):c()},c.prototype.checkdb_=function(a,b,c,d){var e=this,f=a.transaction(e.store.meta.name,"readwrite").objectStore(e.store.meta.name).get(e.metaNames.version);f.onsuccess=function(){var f=this.result;if(!f||e.upgrade_)this.source.put({id:e.metaNames.version,value:b});else if(f.value!==b)return void d();if(e.refresh_){var g=a.transaction(e.store.meta.name,"readwrite").objectStore(e.store.meta.name).get(e.metaNames.update);g.onsuccess=function(){var a=this.result,b=Math.floor((new Date).getTime()/864e5);if(a){if(a.value<=b)return void d()}else this.source.put({id:e.metaNames.update,value:b+e.refresh_});c()}}else c()}},c.prototype.conExtend=function(){this.conExpires_=(new Date).getTime()+this.conAge_},c.prototype.reserveTask_=function(a){(3!==this.state()||this.tasks_.length<100)&&this.tasks_.push(a)},c.prototype.digestTask_=function(a){"undefined"==typeof a&&(a=0),a=a||-1;for(var b;b=a--&&this.tasks_.pop();)b()},c}();b.DataDB=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a){this.age_=a}return a.prototype.getCookie=function(a){if(a&&window.navigator.cookieEnabled){var b=new RegExp("(?:^|; )("+encodeURIComponent(a)+"=[^;]*)"),c=(document.cookie.match(b)||[]).pop();return c&&decodeURIComponent(c.split("=").pop())}},a.prototype.setCookie=function(a,b,c){return"undefined"==typeof c&&(c={}),a&&window.navigator.cookieEnabled?(c.age=c.age||this.age_,document.cookie=[encodeURIComponent(a)+"="+encodeURIComponent(b),c.age?"; expires="+new Date((new Date).getTime()+1e3*c.age).toUTCString():"",c.secure?"; secure":""].join(""),this.getCookie(a)):void 0},a}();a.DataCookie=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function b(){this.DB=new a.DataDB,this.Cookie=new a.DataCookie(864e3)}return b}();a.Data=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){function b(a,b){function c(b){var c=~a.indexOf(b.toUpperCase())||~a.indexOf(b.toLowerCase());return c?a.substr(~c,b.length):b}return a===b?b:b.replace(/(?:%\w{2})+/g,c)}var c=function(){function a(){}return a.trim=function(a){if(a="string"==typeof a?a:String(0===a&&a.toString()||""),a.trim)a=a.trim();else if(a=a.replace(/^[\s\uFEFF\xA0]+/,"")){var b=/[\s\uFEFF\xA0]/,c=a.length,d=c%8;a:{for(;d--;)if(!b.test(a.charAt(--c)))break a;for(;c;){if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a;if(!b.test(a.charAt(--c)))break a}}a=a.substring(0,c+1)}return a},a.repeat=function(a,b){switch(a instanceof Array&&"array"||typeof a){case"string":var c=a;return Array(b+1).join(c);case"array":var e=a.length;if(300>b){var f=Array(b);d.duff(-b,function(b){return f[b]=a[b%e]})}else{for(var f=a.slice();2*f.length<=b;)f=f.concat(f);f=f.concat(f.slice(0,b-f.length))}return f}},a.fire=function(a,b,c,d){return"undefined"==typeof b&&(b=window),"undefined"==typeof c&&(c=[]),"function"==typeof a?d?setTimeout(function(){a.apply(b||window,c)},0):a.apply(b||window,c):a},a.duff=function(a,b){if(0>a){for(var c=-a,d=c%8;d--;)b(--c);for(;c;)b(--c),b(--c),b(--c),b(--c),b(--c),b(--c),b(--c),b(--c)}else{for(var e=a,c=0,d=e%8,f=e/8^0;d--;)b(c++);for(;f--;)b(c++),b(c++),b(c++),b(c++),b(c++),b(c++),b(c++),b(c++)}},a.duffEx=function(a,b){if(0>a){var c=-a,d=c%8;a:{for(;d--;)if(!1===b(--c))break a;for(;c;){if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a;if(!1===b(--c))break a}}}else{var e=a,c=0,d=e%8,f=e/8^0;a:{for(;d--;)if(!1===b(c++))break a;for(;f--;){if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a;if(!1===b(c++))break a}}}},a.normalizeUrl=function(a,c){"undefined"==typeof c&&(c=!0);var e;return e=d.trim(a),e=/^([^:/?#]+):\/\/[^/?#.]+\.[^/?#]+/i.test(e)?e:function(a,b){return b.href=a,b.href}(e,document.createElement("a")),e=encodeURI(decodeURI(e)),e=e.replace(/["`^|\\<>{}\[\]\s].*/,""),e=c?b(a,e):e},a.canonicalizeUrl=function(a){function b(a){return a.toUpperCase()}var c=d.normalizeUrl(a,!1);return c=c.replace(/(?:%\w{2})+/g,b)},a.compareUrl=function(a,c,e){return e&&(a=d.canonicalizeUrl(a),c=d.canonicalizeUrl(c)),a===b(a,c)},a}();a.Utility=c;var d=c;a.Util=a.Utility}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function b(b,c){this.model_=b,this.app_=c,this.data_=new a.Data,this.storeNames={meta:this.data_.DB.store.meta.name,history:this.data_.DB.store.history.name,log:this.data_.DB.store.log.name,server:this.data_.DB.store.server.name}}return b.prototype.getCookie=function(a){return this.data_.Cookie.getCookie(a)},b.prototype.setCookie=function(a,b,c){return this.data_.Cookie.setCookie(a,b,c)},b.prototype.opendb=function(a){var b=this;a.database=!1,this.data_.DB.opendb(function(){b.saveTitleToDB(a.origLocation.href,document.title),b.saveScrollPositionToDB(a.origLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop()),a.database=!0})},b.prototype.getBuffer=function(a,b){return this.data_.DB.store[a].getBuffer(b)},b.prototype.setBuffer=function(a,b,c,d){return this.data_.DB.store[a].setBuffer(b,c,d)},b.prototype.loadBuffer=function(a,b){return"undefined"==typeof b&&(b=0),this.data_.DB.store[a].loadBuffer(b)},b.prototype.saveBuffer=function(a){return this.data_.DB.store[a].saveBuffer()},b.prototype.loadBufferAll=function(a){"undefined"==typeof a&&(a=0);for(var b in this.storeNames)this.loadBuffer(b,a)},b.prototype.saveBufferAll=function(){for(var a in this.storeNames)this.saveBuffer(a)},b.prototype.loadTitleFromDB=function(b){var c=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),d=this,e=this.data_.DB.store.history.getBuffer(c);e&&"string"==typeof e.title?document.title=e.title:this.data_.DB.store.history.get(c,function(){e=this.result,e&&e.title&&a.Util.compareUrl(c,d.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(window.location.href)))&&(document.title=e.title)})},b.prototype.saveTitleToDB=function(b,c){var d=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),e={id:d,title:c,date:(new Date).getTime()};this.data_.DB.store.history.setBuffer(e,!0),this.data_.DB.store.history.set(e),this.data_.DB.store.history.clean()},b.prototype.loadScrollPositionFromDB=function(b){function c(a,b){"number"==typeof a&&"number"==typeof b&&window.scrollTo(parseInt(Number(a)+"",10),parseInt(Number(b)+"",10))}var d=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),e=this,f=this.data_.DB.store.history.getBuffer(d);f&&"number"==typeof f.scrollX?c(f.scrollX,f.scrollY):this.data_.DB.store.history.get(d,function(){f=this.result,f&&"number"==typeof f.scrollX&&a.Util.compareUrl(d,e.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(window.location.href)))&&c(f.scrollX,f.scrollY)})},b.prototype.saveScrollPositionToDB=function(b,c,d){var e=this.model_.convertUrlToKeyUrl(a.Util.normalizeUrl(b)),f={id:e,scrollX:c,scrollY:d,date:(new Date).getTime()};this.data_.DB.store.history.setBuffer(f,!0),this.data_.DB.store.history.set(f)},b.prototype.loadExpiresFromDB=function(){},b.prototype.saveExpiresToDB=function(a,b,c){var d={id:a,host:b,expires:c};this.data_.DB.store.history.setBuffer(d,!0),this.data_.DB.store.history.set(d)},b.prototype.loadLogFromDB=function(){},b.prototype.saveLogToDB=function(a){this.data_.DB.store.log.addBuffer(a),this.data_.DB.store.log.add(a),this.data_.DB.store.log.clean()},b.prototype.loadServerFromDB=function(){},b.prototype.saveServerToDB=function(a,b,c,d){"undefined"==typeof b&&(b=0),"undefined"==typeof d&&(d=0);var e={id:a||"",state:b};this.data_.DB.store.server.accessRecord(a,function(){var c=this.result;c&&b?c.state&&this.source["delete"](a):this.source.put(e)}),c&&this.saveExpiresToDB(c,a,d)},b}();a.AppData=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(a,b){var c=this;this.model_=a,this.app_=b,this.host_="",this.host=function(){return c.host_}}return a.prototype.check=function(a){return a.balance.self&&!!Number(this.app_.data.getCookie(a.balance.client.cookie.balance))},a.prototype.enable=function(a){return!a.balance.client.support.userAgent.test(window.navigator.userAgent)||a.balance.client.exclude.test(window.navigator.userAgent)?void this.disable(a):Number(!this.app_.data.setCookie(a.balance.client.cookie.balance,"1"))?void this.disable(a):void(a.balance.client.support.redirect.test(window.navigator.userAgent)&&this.app_.data.setCookie(a.balance.client.cookie.redirect,"1"))},a.prototype.disable=function(a){this.app_.data.setCookie(a.balance.client.cookie.balance,"0"),this.app_.data.setCookie(a.balance.client.cookie.redirect,"0"),this.changeServer(null,a)},a.prototype.changeServer=function(a,b){"undefined"==typeof b&&(b=this.model_.getGlobalSetting()),this.check(b)&&(a=a||"",this.host_=a,b.balance.server.host=a,this.app_.data.setCookie(b.balance.client.cookie.host,a))},a.prototype.chooseServer=function(a){function b(a,b){return a-b}if(this.check(a)){var c,d=this.app_.data.getBuffer(this.app_.data.storeNames.history,this.model_.convertUrlToKeyUrl(a.destLocation.href));if(c=d&&d.expires,c&&c>=(new Date).getTime())return void this.changeServer(d.host,a);var e=this.app_.data.getBuffer(this.app_.data.storeNames.log),f=[],g={},h=(new Date).getTime();if(!e)return l=this.app_.data.getCookie(a.balance.client.cookie.host),void(l?(this.enable(a),this.changeServer(l)):this.disable(a));var i;for(var j in e)h>e[j].date+a.balance.log.expires||(f.push(e[j].performance),g[e[j].performance]=e[j]);f=f.sort(b).slice(0,15);var k=this.app_.data.getBuffer(this.app_.data.storeNames.server);if(!k)return void this.disable(a);for(var i,l="";f.length;)if(m=Math.floor(Math.random()*f.length),i=f[m],f.splice(m,1),l=g[i].host.split("//").pop()||"",k[l]&&!(k[l].state&&(new Date).getTime()<k[l].state+a.balance.server.error)&&(l||!a.balance.weight||Math.floor(Math.random())*a.balance.weight))return void this.changeServer(l,a);for(var l,m,n=Object.keys(k);n.length;)if(m=Math.floor(Math.random()*n.length),l=n[m],n.splice(m,1),!(k[l].state&&(new Date).getTime()<k[l].state+a.balance.server.error))return void this.changeServer(l,a);this.disable(a)}},a}();a.AppBalance=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(){function a(){}return a.prototype.chooseArea=function(a,b,c){a=a instanceof Array?a:[a];var d,e=-1;a:for(;d=a[++e];){for(var f=d.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g),g=-1;f[++g];)if(!jQuery(f[g],b).length||!jQuery(f[g],c).length)continue a;return d}},a.prototype.movePageNormally=function(a){switch(a.type.toLowerCase()){case"click":window.location.assign(a.currentTarget.href);break;case"submit":switch(a.currentTarget.method.toUpperCase()){case"GET":window.location.assign(a.currentTarget.action.replace(/[?#].*/,"")+"?"+jQuery(a.currentTarget).serialize());break;case"POST":window.location.assign(a.currentTarget.action)}break;case"popstate":window.location.reload()}},a.prototype.calAge=function(a){switch(!0){case/no-store|no-cache/.test(a.getResponseHeader("Cache-Control")):return 0;case!!~String(a.getResponseHeader("Cache-Control")).indexOf("max-age="):return 1e3*Number(a.getResponseHeader("Cache-Control").match(/max-age=(\d+)/).pop());case!!String(a.getResponseHeader("Expires")):return new Date(a.getResponseHeader("Expires")).getTime()-(new Date).getTime();default:return 0}},a.prototype.calExpires=function(a){return(new Date).getTime()+this.calAge(a)},a.prototype.dispatchEvent_=function(a,b,c,d){var e=document.createEvent("HTMLEvents");e.initEvent(b,c,d),a.dispatchEvent(e)},a.prototype.wait_=function(a){var b=jQuery.Deferred();return a?(setTimeout(function(){b.resolve()},a),b):b.resolve()},a}();a.AppPageUtility=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(b){function c(a,c,d,e,f,g,h,i){b.call(this),this.model_=a,this.app_=c,this.setting_=d,this.event_=e,this.register_=f,this.cache_=g,this.done_=h,this.fail_=i,this.main_()}return __extends(c,b),c.prototype.main_=function(){function b(b){h.data_=b[0],h.textStatus_=b[1],h.jqXHR_=b[2],a.Util.fire(i.callbacks.ajax.done,this,[j,i.param].concat(b))}function c(b,c,d){h.jqXHR_=b,h.textStatus_=c,h.errorThrown_=d,a.Util.fire(i.callbacks.ajax.fail,this,[j,i.param].concat(arguments))}function d(){a.Util.fire(i.callbacks.ajax.always,this,[j,i.param].concat(arguments)),h.model_.setGlobalXHR(null),h.model_.isDeferrable&&(h.data_?h.done_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_):h.fail_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_))}function e(b,c,d){h.data_=b,h.textStatus_=c,h.jqXHR_=d,a.Util.fire(i.callbacks.ajax.success,this,[j,i.param,b,c,d])}function f(b,c,d){h.jqXHR_=b,h.textStatus_=c,h.errorThrown_=d,a.Util.fire(i.callbacks.ajax.error,this,[j,i.param,b,c,d])}function g(b,c){a.Util.fire(i.callbacks.ajax.complete,this,[j,i.param,b,c]),h.model_.setGlobalXHR(null),h.model_.isDeferrable||(h.data_?h.done_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_):h.fail_(i,j,k,h.cache_,h.data_,h.textStatus_,h.jqXHR_,h.errorThrown_,h.host_))}var h=this,i=this.setting_,j=this.event_=jQuery.extend(!0,{},this.event_),k=this.register_,l=this.cache_,m=this.model_.getGlobalXHR(),n=a.Util.fire(i.wait,null,[j,i.param,i.origLocation.href,i.destLocation.href]),o=i.speedcheck,p=this.model_.stock("speed");if(o&&(p.fire=j.timeStamp),o&&p.time.splice(0,100,0),o&&p.name.splice(0,100,"pjax("+p.time.slice(-1)+")"),this.app_.page.isScrollPosSavable=!1,i.fix.reset&&/click|submit/.test(j.type.toLowerCase())&&window.scrollTo(jQuery(window).scrollLeft(),0),this.dispatchEvent_(document,i.gns+":fetch",!1,!0),jQuery(document).trigger(i.gns+".fetch"),l&&l.jqXHR)if(o&&p.name.splice(0,1,"cache("+p.time.slice(-1)+")"),i.loadtime=0,this.model_.setGlobalXHR(null),this.host_=l.host||"",this.data_=l.jqXHR.responseText,this.textStatus_=l.textStatus,this.jqXHR_=l.jqXHR,this.model_.isDeferrable)jQuery.when(jQuery.Deferred().resolve([h.data_,h.textStatus_,h.jqXHR_]),this.wait_(n)).done(b).fail(c).always(d);else{var q=jQuery.extend({},jQuery.ajaxSettings,i.ajax);q=q.context||q,e.call(q,h.data_,h.textStatus_,h.jqXHR_),g.call(q,h.jqXHR_,h.textStatus_)}else if(m&&m.follow&&"abort"!==m.statusText&&"error"!==m.statusText){o&&p.time.splice(0,1,m.timeStamp-p.fire),o&&p.name.splice(0,1,"preload("+p.time.slice(-1)+")"),o&&p.time.push(p.now()-p.fire),o&&p.name.push("continue("+p.time.slice(-1)+")"),this.host_=m.host||"",i.loadtime=m.timeStamp;var n=i.wait&&isFinite(m.timeStamp)?Math.max(n-(new Date).getTime()+m.timeStamp,0):0;jQuery.when(m,h.wait_(n)).done(b).fail(c).always(d)}else{i.loadtime=j.timeStamp;var r=i.destLocation.cloneNode(),s={},t={};switch(this.app_.balance.chooseServer(i),this.host_=i.balance.self&&this.app_.balance.host().split("//").pop()||"",r.host=this.host_||i.destLocation.host,s.url=i.server.query?[r.protocol,"//",r.host,"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname,(1<r.search.length?r.search+"&":"?")+i.server.query,r.hash].join(""):r.href,j.type.toLowerCase()){case"click":s.type="GET";break;case"submit":switch(s.type=j.currentTarget.method.toUpperCase(),s.type){case"POST":jQuery(j.currentTarget).has(":file").length?"function"==typeof FormData&&(s.data=new FormData(j.currentTarget),s.contentType=!1,s.processData=!1):s.data=jQuery(j.currentTarget).serializeArray();break;case"GET":}break;case"popstate":s.type="GET"}t={xhr:i.callbacks.ajax.xhr?function(){var b;return b=a.Util.fire(i.callbacks.ajax.xhr,this,[j,i.param]),b="object"==typeof b&&b||jQuery.ajaxSettings.xhr()}:undefined,beforeSend:i.callbacks.ajax.beforeSend||i.server.header?function(b,c){i.server.header&&b.setRequestHeader(i.nss.requestHeader,"true"),"object"==typeof i.server.header&&(b.setRequestHeader(i.nss.requestHeader,"true"),i.server.header.area&&b.setRequestHeader(i.nss.requestHeader+"-Area",this.app_.chooseArea(i.area,document,document)),i.server.header.head&&b.setRequestHeader(i.nss.requestHeader+"-Head",i.load.head),i.server.header.css&&b.setRequestHeader(i.nss.requestHeader+"-CSS",i.load.css.toString()),i.server.header.script&&b.setRequestHeader(i.nss.requestHeader+"-Script",i.load.script.toString())),a.Util.fire(i.callbacks.ajax.beforeSend,this,[j,i.param,b,c]) }:undefined,dataFilter:i.callbacks.ajax.dataFilter?function(b,c){return a.Util.fire(i.callbacks.ajax.dataFilter,this,[j,i.param,b,c])||b}:undefined,success:e,error:f,complete:g},s=jQuery.extend(!0,{},i.ajax,t,s),m=this.model_.setGlobalXHR(jQuery.ajax(s)),this.model_.isDeferrable&&jQuery.when(m,h.wait_(n)).done(b).fail(c).always(d)}},c}(a.AppPageUtility);a.AppPageFetch=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){setTimeout(function(){return c.createHTMLDocument_("","")},50);var c=function(c){function d(a,b,e,f,g,h,i,j,k,l,m){c.call(this),this.model_=a,this.app_=b,this.setting_=e,this.event_=f,this.register_=g,this.cache_=h,this.data_=i,this.textStatus_=j,this.jqXHR_=k,this.errorThrown_=l,this.host_=m,this.loadwaits_=[],this.createHTMLDocument_=d.createHTMLDocument_,this.main_()}return __extends(d,c),d.prototype.main_=function(){var a=this.app_,b=this.setting_,c=this.event_,d=(this.register_,this.cache_),b=this.setting_,c=this.event_,e=(this.register_,this.data_,this.textStatus_,this.jqXHR_),f=(b.callbacks.update,b.speedcheck),g=this.model_.stock("speed");if(f&&g.time.push(g.now()-g.fire),f&&g.name.push("fetch("+g.time.slice(-1)+")"),b.loadtime=b.loadtime&&(new Date).getTime()-b.loadtime,b.loadtime=b.loadtime<100?0:b.loadtime,b.cache.mix&&"popstate"!==c.type.toLowerCase()&&(new Date).getTime()-c.timeStamp<=b.cache.mix)return this.model_.fallback(c,b);try{if(a.page.landing=null,!~(e.getResponseHeader("Content-Type")||"").toLowerCase().search(b.contentType))throw new Error("throw: content-type mismatch");if(this.srcDocument_=this.createHTMLDocument_(e.responseText,b.destLocation.href),this.dstDocument_=document,b.area=this.chooseArea(b.area,this.srcDocument_,this.dstDocument_),!b.area)throw new Error("throw: area notfound");b.areas=b.area.match(/(?:[^,\(\[]+|\(.*?\)|\[.*?\])+/g),this.isCacheUsable_(b,c)&&(this.model_.setCache(b.destLocation.href,d&&d.data||null,this.textStatus_,this.jqXHR_),d=this.model_.getCache(b.destLocation.href),this.cache_=d),f&&g.time.push(g.now()-g.fire),f&&g.name.push("parse("+g.time.slice(-1)+")"),this.checkRedirect_(),this.dispatchEvent_(window,b.gns+":unload",!1,!0),jQuery(window).trigger(b.gns+".unload"),this.updateUrl_(),this.model_.setGlobalSetting(jQuery.extend(!0,{},b,{origLocation:b.destLocation.cloneNode()})),this.updateDocument_()}catch(h){if(!h)return;this.cache_&&this.model_.removeCache(b.destLocation.href),this.model_.fallback(c,b)}},d.prototype.isCacheUsable_=function(a,b){switch(!0){case!a.cache.click&&!a.cache.submit&&!a.cache.popstate:case"submit"===b.type.toLowerCase()&&!a.cache[b.currentTarget.method.toLowerCase()]:return!1;default:return!0}},d.prototype.checkRedirect_=function(){var c=this,d=this.setting_,e=this.event_,f=this.register_,g=d.callbacks.update;if(jQuery('head meta[http-equiv="Refresh"][content*="URL="]',this.srcDocument_).length&&b.Util.fire(g.redirect.before,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var h=d.destLocation.cloneNode();switch(h.href=jQuery(h).attr("content").match(/\w+:\/\/[^;\s]+/i).shift(),!0){case!d.redirect:case h.protocol!==d.destLocation.protocol:case h.host!==d.destLocation.host:case"submit"===e.type.toLowerCase()&&"GET"!==e.currentTarget.method.toUpperCase():switch(e.type.toLowerCase()){case"click":case"submit":window.location.assign(h.href);break;case"popstate":window.location.replace(h.href)}throw!1;default:switch(jQuery[a.NAME].enable(),e.type.toLowerCase()){case"click":case"submit":setTimeout(function(){return jQuery[a.NAME].click(h.href)},0);break;case"popstate":window.history.replaceState(window.history.state,this.srcDocument_.title,h.href),f&&d.fix.location&&(jQuery[a.NAME].disable(),window.history.back(),window.history.forward(),jQuery[a.NAME].enable()),setTimeout(function(){return c.dispatchEvent_(window,"popstate",!1,!1)},0)}throw!1}b.Util.fire(g.redirect.after,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},d.prototype.updateUrl_=function(){var c=this.setting_,e=this.event_,f=this.register_,g=c.callbacks.update;if(b.Util.fire(g.url.before,null,[e,c.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){if(f&&window.history.pushState(b.Util.fire(c.state,null,[e,c.param,c.origLocation.href,c.destLocation.href]),window.opera||~window.navigator.userAgent.toLowerCase().indexOf("opera")?this.dstDocument_.title:this.srcDocument_.title,c.destLocation.href),f&&c.fix.location&&(jQuery[a.NAME].disable(),window.history.back(),window.history.forward(),jQuery[a.NAME].enable()),!b.Util.compareUrl(c.destLocation.href,b.Util.normalizeUrl(window.location.href)))throw c.retriable?(c.retriable=!1,c.destLocation.href=b.Util.normalizeUrl(window.location.href),new d(this.model_,this.app_,c,e,!1,c.cache[e.type.toLowerCase()]&&this.model_.getCache(c.destLocation.href),this.data_,this.textStatus_,this.jqXHR_,this.errorThrown_,this.host_),!1):new Error("throw: location mismatch");c.retriable=!0,b.Util.fire(g.url.after,null,[e,c.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},d.prototype.updateDocument_=function(){var a=this,c=this.setting_,d=this.event_;this.overwriteDocumentByCache_(),c.fix.noscript&&this.escapeNoscript_(this.srcDocument_),this.rewrite_(),this.title_(),this.head_();var e=c.speedcheck,f=this.model_.stock("speed");e&&f.time.push(f.now()-f.fire),e&&f.name.push("head("+f.time.slice(-1)+")"),this.loadwaits_=this.area_(),e&&f.time.push(f.now()-f.fire),e&&f.name.push("content("+f.time.slice(-1)+")"),this.balance_(),this.css_('link[rel~="stylesheet"], style'),jQuery(window).one(c.gns+":rendering",function(g){g.preventDefault(),g.stopImmediatePropagation();var h=function(e){return a.dispatchEvent_(document,c.gns+":ready",!1,!0),jQuery(document).trigger(c.gns+".ready"),b.Util.fire(c.callback,null,[d,c.param,a.data_,a.textStatus_,a.jqXHR_]),a.waitRender_(jQuery.when?jQuery.Deferred().resolve:e)},i=function(b){return setTimeout(function(){a.app_.page.isScrollPosSavable=!0,"popstate"!==d.type.toLowerCase()?a.scrollByHash_(c.destLocation.hash)||a.scroll_(!0):a.scroll_(!0)},100),a.dispatchEvent_(document,c.gns+":render",!1,!0),jQuery(document).trigger(c.gns+".render"),e&&f.time.push(f.now()-f.fire),e&&f.name.push("render("+f.time.slice(-1)+")"),jQuery.when?jQuery.when.apply(jQuery,a.loadwaits_):b()},j=function(){return a.dispatchEvent_(window,c.gns+":load",!1,!0),jQuery(window).trigger(c.gns+".load"),e&&f.time.push(f.now()-f.fire),e&&f.name.push("load("+f.time.slice(-1)+")"),e&&console.log(f.time),e&&console.log(f.name),a.script_("[src][defer]"),jQuery.when&&jQuery.Deferred()};a.scroll_(!1);var k=a.script_(":not([defer]), :not([src])");if(jQuery.when){var l=jQuery.Deferred().pipe?"pipe":"then";jQuery.when.apply(jQuery,k)[l](function(){return h()},function(){return h()})[l](function(){return i()},function(){return i()})[l](function(){return j()},function(){return j()})}else h(function(){return i(function(){return j()})})}).trigger(c.gns+":rendering")},d.prototype.overwriteDocumentByCache_=function(){var a=this.setting_,b=this.event_,c=this.cache_;if(this.isCacheUsable_(a,b)&&c&&c.data){var d=a.fix.noscript?this.restoreNoscript_(c.data):c.data,e=this.createHTMLDocument_(d,a.destLocation.href),f=this.srcDocument_;f.title=e.title;for(var g,h,i=0;a.areas[i];i++){if(g=jQuery(a.areas[i],e).clone(),h=jQuery(a.areas[i],f),!g.length||!h.length||g.length!==h.length)throw new Error("throw: area mismatch");for(var j=0;g[j];j++)h[j].parentNode.replaceChild(g[j],h[j])}}},d.prototype.rewrite_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;a.rewrite&&b.Util.fire(d.rewrite.before,null,[c,a.param])!==!1&&(b.Util.fire(a.rewrite,null,[this.srcDocument_,a.area,this.host_]),b.Util.fire(d.rewrite.before,null,[c,a.param])===!1)},d.prototype.title_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;b.Util.fire(d.title.before,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])!==!1&&(this.dstDocument_.title=this.srcDocument_.title,a.database&&a.fix.history&&this.app_.data.saveTitleToDB(a.destLocation.href,this.srcDocument_.title),b.Util.fire(d.title.after,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])===!1)},d.prototype.head_=function(){var a=this.setting_,c=this.event_,d=this.srcDocument_,e=this.dstDocument_,f=a.callbacks.update;if(a.load.head&&b.Util.fire(f.head.before,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){for(var g,h="base, meta, link",i=jQuery(d.head).children(h).filter(a.load.head).not(a.load.ignore).not('link[rel~="stylesheet"], style, script'),j=jQuery(e.head).children(h).filter(a.load.head).not(a.load.ignore).not('link[rel~="stylesheet"], style, script'),k=jQuery(),l=j,m=0;g=i[m];m++){for(var n=0;l[n];n++)if(l[n].tagName===g.tagName&&l[n].outerHTML===g.outerHTML){if(k.length){var o=j[j.index(l[n])-1];o?jQuery(o).after(k.clone()):l.eq(n).before(k.clone()),k=jQuery()}l=l.not(l[n]),g=null;break}k=k.add(g)}jQuery("title",e).before(k.clone()),l.remove(),b.Util.fire(f.head.after,null,[c,a.param,this.data_,this.textStatus_,this.jqXHR_])===!1}},d.prototype.area_=function(){function a(){var a=jQuery.Deferred();return jQuery(this).one("load error",a.resolve),a}var c,d=this,e=this.setting_,f=this.event_,g=this.srcDocument_,h=this.dstDocument_,i=e.callbacks.update,j=[];if(b.Util.fire(i.content.before,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return j;jQuery(e.area).children("."+e.nss.class4html+"-check").remove(),c=jQuery("<div/>",{"class":e.nss.class4html+"-check",style:"background: none !important; display: block !important; visibility: hidden !important; position: absolute !important; top: 0 !important; left: 0 !important; z-index: -9999 !important; width: auto !important; height: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; font-size: 12px !important; text-indent: 0 !important;"}).text(e.gns);for(var k,l,m=0;e.areas[m];m++){if(k=jQuery(e.areas[m],g).clone(),l=jQuery(e.areas[m],h),!k.length||!l.length||k.length!==l.length)throw new Error("throw: area mismatch");k.find("script").each(function(a,b){return d.escapeScript_(b)}),jQuery.when&&(j=j.concat(k.find("img, iframe, frame").map(a).get()));for(var n=0;k[n];n++)l[n].parentNode.replaceChild(k[n],l[n]);l=jQuery(e.areas[m],h),l.append(c.clone()),l.find("script").each(function(a,b){return d.restoreScript_(b)})}return this.dispatchEvent_(document,e.gns+":DOMContentLoaded",!1,!0),jQuery(document).trigger(e.gns+".DOMContentLoaded"),b.Util.fire(i.content.after,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])===!1?j:j},d.prototype.balance_=function(){var a=this.setting_,c=this.event_,d=a.callbacks.update;if(a.balance.self&&a.loadtime&&b.Util.fire(d.balance.before,null,[c,a.param])!==!1){var e=(this.jqXHR_.getResponseHeader(a.balance.server.header)||"").split("//").pop();this.app_.data.saveLogToDB({host:e,performance:Math.ceil(a.loadtime/(this.jqXHR_.responseText.length||1)*1e5),date:(new Date).getTime()}),this.app_.data.saveServerToDB(e,0,a.destLocation.href,this.calExpires(this.jqXHR_)),this.app_.balance.chooseServer(a),this.app_.data.loadBufferAll(a.buffer.limit),b.Util.fire(d.balance.after,null,[c,a.param])===!1}},d.prototype.css_=function(a){function c(){return jQuery.contains(g.head,this)}function d(){return jQuery.contains(g.body,this)}var e=this.setting_,f=this.event_,g=this.srcDocument_,h=this.dstDocument_,i=e.callbacks.update;if(e.load.css&&b.Util.fire(i.css.before,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){for(var j,k="link, style",l=jQuery(k,g).filter(a).not(e.load.ignore).not(jQuery("noscript",g).find(k)),m=jQuery(k,h).filter(a).not(e.load.ignore).not(jQuery("noscript",g).find(k)),n=jQuery(),o=m,p=0;j=l[p];p++){for(var q,r=0;o[r];r++){switch(j.tagName.toLowerCase()){case"link":q=j.href===o[r].href;break;case"style":q=j.innerHTML.trim()===o[r].innerHTML.trim()}if(q){if(n.length){if(jQuery.contains(h.body,o[r])&&n.first().parents("head").length)jQuery(h.head).append(n.filter(c).clone()),o.eq(r).before(n.filter(d).clone());else{var s=m[m.index(o[r])-1];s?jQuery(s).after(n.clone()):o.eq(r).before(n.clone())}n=jQuery()}o=o.not(o[r]),r-=Number(!!r),j=null;break}}n=n.add(j)}if(jQuery(h.head).append(n.filter(c).clone()),jQuery(h.body).append(n.filter(d).clone()),o.remove(),b.Util.fire(i.css.after,null,[f,e.param,this.data_,this.textStatus_,this.jqXHR_])!==!1){var t=e.speedcheck,u=this.model_.stock("speed");t&&u.time.push(u.now()-u.fire),t&&u.name.push("css("+u.time.slice(-1)+")")}}},d.prototype.script_=function(a){var c=this,d=this.setting_,e=this.event_,f=this.srcDocument_,g=this.dstDocument_,h=d.callbacks.update,i=[];if(!d.load.script)return i;if(b.Util.fire(h.script.before,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return i;for(var j,k="script",l=jQuery(k,f).filter(a).not(d.load.ignore).not(jQuery("noscript",f).find(k)),m=jQuery(),n=this.app_.page.loadedScripts,o=/^$|(?:application|text)\/(?:java|ecma)script/i,p=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,q=0;j=l[q];q++)if(o.test(j.type||"")&&(j.hasAttribute("src")?!n[j.src]:j.innerHTML.trim())){var r=jQuery(j).parent(d.load.log)[0];if(r&&!jQuery(j).parents(d.area).length){var s=jQuery(r.id||r.tagName,g)[0],t=j.cloneNode(!0);this.escapeScript_(t),s.appendChild(t),this.restoreScript_(t)}if(this.model_.isDeferrable)!function(a,b){if(b.hasAttribute("src")){if(!b.getAttribute("src"))return;b.hasAttribute("async")?jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:b.src,async:!0,global:!1})).done(function(){return c.dispatchEvent_(b,"load",!1,!0)}).fail(function(){return c.dispatchEvent_(b,"error",!1,!0)}):(jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:b.src,dataType:"text",async:!0,global:!1})).done(function(){return a.resolve([b,arguments[0]])}).fail(function(){return a.resolve([b,new Error])}),i.push(a))}else a.resolve([b,(b.text||b.textContent||b.innerHTML||"").replace(p,"")]),i.push(a)}(jQuery.Deferred(),j);else if(j.hasAttribute("src")){if(!j.getAttribute("src"))continue;m=m.add(j)}else m=m.add(j)}try{if(this.model_.isDeferrable)jQuery.when.apply(jQuery,i).always(function(){for(var a=0,b=arguments.length;b>a;a++){var e=arguments[a],f=e[0],g=e[1];f.src&&(n[f.src]=!d.load.reload||!jQuery(f).is(d.load.reload)),"string"==typeof g?(eval.call(window,g),f.hasAttribute("src")&&c.dispatchEvent_(f,"load",!1,!0)):f.hasAttribute("src")&&c.dispatchEvent_(f,"error",!1,!0)}});else for(var j,q=0;j=m[q];q++)j.hasAttribute("src")?(j.src&&(n[j.src]=!d.load.reload||!jQuery(j).is(d.load.reload)),function(a){jQuery.ajax(jQuery.extend(!0,{},d.ajax,d.load.ajax,{url:a.src,async:a.hasAttribute("async"),global:!1},{success:function(){return c.dispatchEvent_(a,"load",!1,!0)},error:function(){return c.dispatchEvent_(a,"error",!1,!0)}}))}(j)):eval.call(window,(j.text||j.textContent||j.innerHTML||"").replace(p,""))}catch(u){throw setTimeout(function(){return c.model_.fallback(e,d)},50),u}if(b.Util.fire(h.script.after,null,[e,d.param,this.data_,this.textStatus_,this.jqXHR_])===!1)return i;var v=d.speedcheck,w=this.model_.stock("speed");return v&&w.time.push(w.now()-w.fire),v&&w.name.push("script("+w.time.slice(-1)+")"),i},d.prototype.scroll_=function(a){var c=this.setting_,d=this.event_,e=c.callbacks.update;if(b.Util.fire(e.scroll.before,null,[d,c.param])!==!1){var f,g;switch(d.type.toLowerCase()){case"click":case"submit":f=a&&"function"==typeof c.scrollLeft?b.Util.fire(c.scrollLeft,null,[d,c.param,c.origLocation.href,c.destLocation.href]):c.scrollLeft,f=f>=0?f:0,f=f===!1||null===f?jQuery(window).scrollLeft():parseInt(Number(f)+"",10),g=a&&"function"==typeof c.scrollTop?b.Util.fire(c.scrollTop,null,[d,c.param,c.origLocation.href,c.destLocation.href]):c.scrollTop,g=g>=0?g:0,g=g===!1||null===g?jQuery(window).scrollTop():parseInt(Number(g)+"",10),jQuery(window).scrollTop()===g&&jQuery(window).scrollLeft()===f||window.scrollTo(f,g),a&&c.database&&this.app_.page.isScrollPosSavable&&c.fix.scroll&&this.app_.data.saveScrollPositionToDB(c.destLocation.href,f,g);break;case"popstate":a&&c.fix.scroll&&c.database&&this.app_.data.loadScrollPositionFromDB(c.destLocation.href)}b.Util.fire(e.scroll.after,null,[d,c.param])===!1}},d.prototype.waitRender_=function(a){function c(){return this.clientWidth||this.clientHeight||jQuery(this).is(":hidden")}var d=this.setting_,e=(this.event_,d.callbacks.update,jQuery(d.area)),f=e.children("."+d.nss.class4html+"-check"),g=(new Date).getTime()+5e3,h=function(){switch(!0){case!b.Util.compareUrl(d.destLocation.href,b.Util.normalizeUrl(window.location.href)):break;case(new Date).getTime()>g:case f.length!==e.length:case f.length===f.filter(c).length:f.remove(),a();break;default:setTimeout(h,100)}};return h(),jQuery.when&&a},d.prototype.scrollByHash_=function(a){if(a="#"===a.charAt(0)?a.slice(1):a,!a)return!1;var b=jQuery("#"+(a?a:", [name~="+a+"]")).first();return b.length?(isFinite(b.offset().top)&&window.scrollTo(jQuery(window).scrollLeft(),parseInt(Number(b.offset().top)+"",10)),!0):!1},d.prototype.escapeNoscript_=function(a){function b(){jQuery(this).text(this.innerHTML)}jQuery("noscript",a).children().parent().each(b)},d.prototype.restoreNoscript_=function(a){var b=jQuery("<span/>");return a.replace(/(<noscript>)([^<>]+?)(<\/noscript>)/gim,function(a,c,d,e){return c+b.html(d).text()+e})},d.prototype.escapeScript_=function(a){jQuery.data(a,"source",a.src),jQuery.data(a,"code",a.innerHTML),a.removeAttribute("src"),a.innerHTML=""},d.prototype.restoreScript_=function(a){undefined!==jQuery.data(a,"code")&&(a.innerHTML=" ",jQuery.data(a,"source")?(a.src=jQuery.data(a,"source"),jQuery.removeData(a,"source")):a.removeAttribute("src"),a.innerHTML=jQuery.data(a,"code"),jQuery.removeData(a,"code"))},d.createHTMLDocument_=function(a,b){var c,d=this;return this.createHTMLDocument_=function(a,b){function e(a){for(var c=[],d=0;d<arguments.length-1;d++)c[d]=arguments[d+1];try{var e='',f=a(e,"");return f&&f.URL&&decodeURI(f.URL)===decodeURI(b||window.location.href)&&f.querySelector('html.html[lang="en"]')&&f.querySelector("head>link").href&&f.querySelector("head>noscript").innerHTML&&"noscript"===f.querySelector("body>noscript").innerHTML&&f.querySelector("body>a").href&&!0||!1}catch(g){return!1}}function f(a,b){var c=document.createElement("div");c.innerHTML=(b.match(/<html(?:\s.*?[^\\])?>/i)||[""]).shift().replace(/html/i,"div")+"

";for(var d,e=c.firstChild.attributes,f=0;d=e[f];f++)a.documentElement.setAttribute(d.name,d.value);var c=document.createElement("html");for(c.innerHTML=b.replace(/^.*?/im,""),a.documentElement.removeChild(a.head),a.documentElement.removeChild(a.body);c.childNodes.length;)a.documentElement.appendChild(c.childNodes[0]);return a}var g=window.location.href;b&&window.history.replaceState(window.history.state,document.title,b);var h;switch(c){case"dom":"function"==typeof window.DOMParser&&(h=(new window.DOMParser).parseFromString(a,"text/html"));break;case"doc":if(document.implementation&&document.implementation.createHTMLDocument){if(h=document.implementation.createHTMLDocument(""),"object"!=typeof h.activeElement||!h.activeElement)break;h.open(),h.write(a),h.close()}break;case"manipulate":document.implementation&&document.implementation.createHTMLDocument&&(h=f(document.implementation.createHTMLDocument(""),a));break;default:var i=function(a){return e(d.createHTMLDocument_,c=a)};switch(/webkit|firefox|trident|$/i.exec(window.navigator.userAgent.toLowerCase()).shift()){case"webkit":i("doc")||i("dom")||i("manipulate");break;case"firefox":i("dom")||i("doc")||i("manipulate");break;case"trident":i("manipulate")||i("dom")||i("doc");break;default:i("dom")||i("doc")||i("manipulate")}h=d.createHTMLDocument_(a,b)}return b&&window.history.replaceState(window.history.state,document.title,g),h},this.createHTMLDocument_(a,b)},d}(b.AppPageUtility);b.AppPageUpdate=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(a){var b=function(b){function c(c,d){b.call(this),this.model_=c,this.app_=d,this.landing=a.Util.normalizeUrl(window.location.href),this.recent={order:[],data:{},size:0},this.loadedScripts={},this.isScrollPosSavable=!0}return __extends(c,b),c.prototype.transfer=function(a,b,c,d){var e=this,f=function(a,b,c,d,f,g,h,i,j){e.update(a,b,c,d,f,g,h,i,j)},g=function(a,b,c,d,f,g){a.fallback&&"abort"!==g&&(a.balance.self&&e.app_.balance.disable(a),e.model_.fallback(b,a))};this.fetch(a,b,c,d,f,g)},c.prototype.fetch=function(b,c,d,e,f,g){new a.AppPageFetch(this.model_,this.app_,b,c,d,e,f,g)},c.prototype.update=function(b,c,d,e,f,g,h,i,j){new a.AppPageUpdate(this.model_,this.app_,b,c,d,e,f,g,h,i,j)},c}(a.AppPageUtility);a.AppPage=b}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={}));var MODULE;!function(MODULE){!function(MODEL){var App=function(_super){function App(a,b){_super.call(this),this.model_=a,this.controller_=b,this.balance=new MODEL.AppBalance(this.model_,this),this.page=new MODEL.AppPage(this.model_,this),this.data=new MODEL.AppData(this.model_,this)}return __extends(App,_super),App.prototype.initialize=function(a,b){var c=this,d=this.page.loadedScripts;b.load.script&&jQuery("script").each(function(){var a=this;a.src&&(d[a.src]=!b.load.reload||!jQuery(a).is(b.load.reload))}),new MODULE.VIEW.Main(this.model_,this.controller_,a).BIND(b),setTimeout(function(){return c.data.loadBufferAll(b.buffer.limit)},b.buffer.delay),b.balance.self&&setTimeout(function(){return c.balance.enable(b)},b.buffer.delay),setTimeout(function(){return c.page.landing=null},1500)},App.prototype.configure=function(option,origURL,destURL){function scope(a,b,c,d){"undefined"==typeof d&&(d="");var e,f,g,h,i,j,k,l,m,n,o,p=a.scope;if(e=that.model_.convertUrlToKeyUrl(b).match(/.+?\w(\/.*)/).pop(),f=that.model_.convertUrlToKeyUrl(c).match(/.+?\w(\/.*)/).pop(),d=d.replace(/[#?].*/,""),h=(d||f).replace(/^\/|\/$/g,"").split("/"),d){if(!~d.indexOf("*"))return undefined;g=[];for(var q=e.replace(/^\/|\/$/g,"").split("/"),r=0,s=h.length;s>r;r++)"*"===h[r]&&g.push(q[r])}for(var r=h.length+1;r--;)if(l=o=m=n=undefined,i=h.slice(0,r).join("/"),i="/"+i+("/"===(d||e).charAt(i.length+1)?"/":""),i&&i in p){if(p[i]instanceof Array?(j="",k=p[i]):(j=p[i],k=p[j]),!k||!k.length)return!1;k=k.concat();for(var t,u=0;(t=k[u])&&(m!==!1&&n!==!1);u++)if("#"===t[0]&&(j=t.slice(1),[].splice.apply(k,[u,1].concat(p[j])),t=k[u]),"inherit"===t)l=!0;else if("rewrite"!==t||"function"!=typeof p.rewrite||d){if("string"==typeof t){var v="!"===t[0];t=v?t.slice(1):t;var w="*"===t[0];if(t=w?t.slice(1):t,d&&~t.indexOf("/*/"))for(var x=0,s=g.length;s>x;x++)t=t.replace("/*/","/"+g[x]+"/");if(w?!e.search(t):!e.indexOf(t)){if(v)return!1;m=!0}if(w?!f.search(t):!f.indexOf(t)){if(v)return!1;n=!0,o=p["$"+j]||p["$"+t]||null}}}else{var y=scope.apply(this,[].slice.call(arguments).slice(0,3).concat([MODEL.Util.fire(p.rewrite,null,[f])]));if(y){m=n=!0,o=y;break}if(!1===y)return!1}if(m&&n)return jQuery.extend(!0,{},a,o);if(!l)break}}var that=this;origURL=MODEL.Util.normalizeUrl(origURL||option.origLocation.href),destURL=MODEL.Util.normalizeUrl(destURL||option.destLocation.href),option=jQuery.extend(!0,{},option.option||option,{option:option.option||option}),option=option.scope?jQuery.extend(!0,{},option,scope(option,origURL,destURL)||{disable:!0}):jQuery.extend(!0,{},option);var initial={gns:MODULE.NAME,ns:"",disable:!1,area:"body",link:"a:not([target])",filter:function(){return/^https?:/.test(this.href)&&/(\/[^.]*|\.html?|\.php)$/.test("/"+this.pathname)},form:null,scope:null,rewrite:null,state:null,scrollTop:0,scrollLeft:0,ajax:{dataType:"text"},contentType:"text/html",cache:{click:!1,submit:!1,popstate:!1,get:!0,post:!0,mix:0,limit:100,size:1048576,expires:{max:null,min:3e5}},buffer:{limit:30,delay:500},load:{head:"",css:!1,script:!1,execute:!0,log:"head, body",reload:"",ignore:'[src*="jquery.js"], [src*="jquery.min.js"], [href^="chrome-extension://"]',ajax:{dataType:"script",cache:!0}},balance:{self:!1,weight:3,client:{support:{userAgent:/msie|trident.+ rv:|chrome|firefox|safari/i,redirect:/chrome|firefox|safari/i},exclude:/mobile|phone|android|iphone|blackberry/i,cookie:{balance:"ajax_balanceable",redirect:"ajax_redirectable",host:"ajax_host"}},server:{header:"X-Ajax-Host",filter:null,error:6e5},log:{expires:864e6,limit:30},option:{server:{header:!1},ajax:{crossDomain:!0},callbacks:{ajax:{beforeSend:null}}}},callback:null,callbacks:{ajax:{},update:{redirect:{},rewrite:{},url:{},title:{},head:{},content:{},scroll:{},css:{},script:{},balance:{}}},param:null,redirect:!0,wait:0,scroll:{delay:300},fix:{location:!0,history:!0,scroll:!0,noscript:!0,reset:!1},fallback:!0,database:!0,server:{query:"pjax=1",header:!0},speedcheck:!1},force={origLocation:function(a,b){return b.href=a,b}(origURL,document.createElement("a")),destLocation:function(a,b){return b.href=a,b}(destURL,document.createElement("a")),balance:{server:{host:""}},scroll:{queue:[]},loadtime:null,retriable:!0,option:option.option},compute=function(){var nsArray=[setting.gns||MODULE.NAME].concat(setting.ns&&String(setting.ns).split(".")||[]),query=setting.server.query;switch(query&&typeof query){case"string":query=eval("({"+query.replace(/"/g,'\\"').replace(/([^?=&]+)=([^&]*)/g,'"$1": "$2"').replace(/&/g,",")+"})");case"object":query=jQuery.param(query)}return{nss:{name:setting.ns||"",array:nsArray,event:nsArray.join("."),data:nsArray.join("-"),class4html:nsArray.join("-"),click:["click"].concat(nsArray.join(":")).join("."),submit:["submit"].concat(nsArray.join(":")).join("."),popstate:["popstate"].concat(nsArray.join(":")).join("."),scroll:["scroll"].concat(nsArray.join(":")).join("."),requestHeader:["X",nsArray[0].replace(/^\w/,function(a){return a.toUpperCase()})].join("-")},fix:/android|iphone os|like mac os x/i.test(window.navigator.userAgent)?{}:{location:!1,reset:!1},contentType:setting.contentType.replace(/\s*[,;]\s*/g,"|").toLowerCase(),server:{query:query},timeStamp:(new Date).getTime()}},setting;return setting=jQuery.extend(!0,initial,option),setting=jQuery.extend(!0,setting,setting.balance.self&&setting.balance.option,force),setting=jQuery.extend(!0,setting,compute())},App}(MODEL.Template);MODEL.App=App}(MODULE.MODEL||(MODULE.MODEL={}));var MODEL=MODULE.MODEL}(MODULE||(MODULE={}));var MODULE;!function(a){!function(b){var c=function(c){function d(){c.apply(this,arguments);var d=this;this.controller_=new a.CONTROLLER.Main(this),this.app_=new b.App(this,this.controller_),this.state_=-1,this.isDeferrable=jQuery.when&&1.06<=Number(jQuery().jquery.replace(/\D*(\d+)\.(\d+).*$/,"$1.0$2").replace(/\d+(\d{2})$/,"$1")),this.host=function(){return d.app_.balance.host()}}return __extends(d,c),d.prototype.main_=function(b,c){var d,e=this;switch(d=b instanceof a.NAMESPACE?"m:":"f:",d+=c?{}.toString.call(c).split(" ").pop().slice(0,-1).toLowerCase():c,d.toLowerCase()){case"m:object":break;case"m:undefined":if(b.is("a, form"))return b;c={};break;default:return b}var f=this.app_.configure(c,window.location.href,window.location.href);return this.setGlobalSetting(f),f.database&&this.app_.data.opendb(f),this.app_.stock({speed:{fire:0,time:[],name:[],now:function(){return(new Date).getTime()}}}),"pushState"in window.history&&window.history.pushState&&jQuery(function(){e.app_.initialize(b,f),e.state_=-1===e.state()?0:e.state()}),b},d.prototype.state=function(){return this.state_},d.prototype.convertUrlToKeyUrl=function(a){return a.replace(/#.*/,"")},d.prototype.isImmediateLoadable=function(a,c){if(0===this.state()){var d,e,f=b.Util.normalizeUrl(window.location.href);switch(typeof a){case"string":e=null,d=b.Util.normalizeUrl(a);break;case"object":switch(e=a,e.type.toLowerCase()){case"click":d=b.Util.normalizeUrl(e.currentTarget.href);break;case"submit":d=b.Util.normalizeUrl(e.currentTarget.action);break;case"popstate":return!0}if(e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1}var g=jQuery("",{href:f})[0],h=jQuery("",{href:d})[0];if(g.protocol!==h.protocol||g.host!==h.host)return!1;if(c=c||this.app_.configure(this.getGlobalSetting(),g.href,h.href),!c.disable)return h.hash&&g.href.replace(/#.*/,"")===h.href.replace(/#.*/,"")?!1:this.app_.page.chooseArea(c.area,document,document)&&jQuery(e.currentTarget).filter(c.filter).length?!0:!1}},d.prototype.getGlobalSetting=function(){return this.app_.page.globalSetting},d.prototype.setGlobalSetting=function(a){return this.app_.page.globalSetting=a},d.prototype.getGlobalXHR=function(){return this.app_.page.globalXHR},d.prototype.setGlobalXHR=function(a){return this.app_.page.globalXHR&&this.app_.page.globalXHR.readyState<4&&this.app_.page.globalXHR.abort(),this.app_.page.globalXHR=a},d.prototype.CLICK=function(a){a.timeStamp=(new Date).getTime();var b=a.currentTarget,c=(jQuery(b),this.app_.configure(this.getGlobalSetting(),window.location.href,b.href));if(!(0!==this.state()||c.disable||a.isDefaultPrevented()||!this.isImmediateLoadable(a,c)||c.cache.mix&&this.getCache(c.destLocation.href))){c.database&&this.app_.page.isScrollPosSavable&&this.app_.data.saveScrollPositionToDB(c.destLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop());var d;return c.cache[a.type.toLowerCase()]&&(d=this.getCache(c.destLocation.href)),this.app_.page.transfer(c,a,c.destLocation.href!==c.origLocation.href,d),void a.preventDefault()}!a.originalEvent&&!a.isDefaultPrevented()&&!jQuery(document).has(b).length&&this.fallback(a,c)},d.prototype.SUBMIT=function(a){a.timeStamp=(new Date).getTime();var c=a.currentTarget,d=(jQuery(c),this.app_.configure(this.getGlobalSetting(),window.location.href,c.action));if(0===this.state()&&!d.disable&&!a.isDefaultPrevented()&&this.isImmediateLoadable(a,d)){var e=d.destLocation.href.replace(/[?#].*/,"")+("GET"===c.method.toUpperCase()?"?"+jQuery(c).serialize():"");if(d.destLocation.href=b.Util.normalizeUrl(e),!d.cache.mix||!this.getCache(d.destLocation.href)){d.database&&this.app_.page.isScrollPosSavable&&this.app_.data.saveScrollPositionToDB(d.destLocation.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop());var f;return d.cache[a.type.toLowerCase()]&&d.cache[c.method.toLowerCase()]&&(f=this.getCache(d.destLocation.href)),this.app_.page.transfer(d,a,d.destLocation.href!==d.origLocation.href,f),void a.preventDefault()}}!a.originalEvent&&!a.isDefaultPrevented()&&!jQuery(document).has(c).length&&this.fallback(a,d)},d.prototype.POPSTATE=function(a){a.timeStamp=(new Date).getTime();var c=this.app_.configure(this.getGlobalSetting(),null,window.location.href);if(!(this.app_.page.landing&&this.app_.page.landing===b.Util.normalizeUrl(window.location.href)||c.origLocation.href===c.destLocation.href||0!==this.state()||c.disable||!this.isImmediateLoadable(a,c)||c.origLocation.hash!==c.destLocation.hash&&c.origLocation.pathname+c.origLocation.search===c.destLocation.pathname+c.destLocation.search)){c.database&&c.fix.history&&this.app_.data.loadTitleFromDB(c.destLocation.href);var d;return c.cache[a.type.toLowerCase()]&&(d=this.getCache(c.destLocation.href)),void this.app_.page.transfer(c,a,!1,d)}},d.prototype.SCROLL=function(a){var b=this,c=this.getGlobalSetting();if(0===this.state()&&!a.isDefaultPrevented())if(c.scroll.delay){for(var d;d=c.scroll.queue.shift();)clearTimeout(d);d=setTimeout(function(){for(;d=c.scroll.queue.shift();)clearTimeout(d);b.app_.page.isScrollPosSavable&&b.app_.data.saveScrollPositionToDB(window.location.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop())},c.scroll.delay),c.scroll.queue.push(d)}else this.app_.page.isScrollPosSavable&&this.app_.data.saveScrollPositionToDB(window.location.href,jQuery(window).scrollLeft(),jQuery(window).scrollTop())},d.prototype.fallback=function(a,c){switch(!0){case!c.fallback:case!1===b.Util.fire(c.fallback,null,[a,c.param,c.origLocation.href,c.destLocation.href]):break;default:this.app_.page.movePageNormally(a)}},d.prototype.enable=function(){this.state_=0},d.prototype.disable=function(){this.state_=1},d.prototype.getCache=function(a){var c=this.getGlobalSetting(),d=this.app_.page.recent; if(!c||!d)return null;var e=this.convertUrlToKeyUrl(b.Util.normalizeUrl(a));return a=null,d.data[e]&&(new Date).getTime()>d.data[e].expires&&this.removeCache(e),d.data[e]&&!d.data[e].data&&!d.data[e].jqXHR&&this.removeCache(e),d.data[e]},d.prototype.setCache=function(a,c,d,e,f){var g=this,h=this.getGlobalSetting(),i=this.app_.page.recent;if(!h||!i)return this;var j,k,l,m,n=this.convertUrlToKeyUrl(b.Util.normalizeUrl(a));a=null,i.order.unshift(n);for(var o,p=1;o=i.order[p];p++)n===o&&i.order.splice(p,1);if(i.size>h.cache.size&&this.cleanCache(),j=this.getCache(n),c||e||j&&(j.data||j.jqXHR)){var q=(e||{}).responseText||"";if(k=parseInt(1.8*q.length+""||"1048576",10),l=(new Date).getTime(),m=function(a){{var b;h.cache.expires}return h.cache.expires?i.data[n]&&!e?i.data[n].expires:(b=e&&g.app_.page.calAge(e)||Number(h.cache.expires),b=Math.max(b,0)||0,b="object"==typeof h.cache.expires&&"number"==typeof h.cache.expires.min?Math.max(h.cache.expires.min,b):b,b="object"==typeof h.cache.expires&&"number"==typeof h.cache.expires.max?Math.min(h.cache.expires.max,b):b,a+b):0}(l),i.size=i.size||0,i.size+=i.data[n]?0:k,i.data[n]=jQuery.extend(!0,{},j,{jqXHR:e,textStatus:d,data:c,size:k,expires:m,host:f||"",timeStamp:l}),i.data[n].data||i.data[n].jqXHR||this.removeCache(n),e||j&&j.jqXHR){var r=((e||j&&j.jqXHR).responseText||"").slice(0,1e4).match(/]*>(.*?)<\/title>/i).pop()||"";h.database&&h.fix.history&&this.app_.data.saveTitleToDB(n,r)}}},d.prototype.removeCache=function(a){var c=this.getGlobalSetting(),d=this.app_.page.recent;if(c&&d){var e=this.convertUrlToKeyUrl(b.Util.normalizeUrl(a));a=null;for(var f,g=0;f=d.order[g];g++)e===f&&(d.order.splice(g,1),d.size-=d.data[f].size,d.data[f]=null,delete d.data[f])}},d.prototype.clearCache=function(){var a=this.getGlobalSetting(),b=this.app_.page.recent;if(a&&b)for(var c,d=b.order.length;c=b.order[--d];)b.order.splice(d,1),b.size-=b.data[c].size,delete b.data[c]},d.prototype.cleanCache=function(){var a=this.getGlobalSetting(),b=this.app_.page.recent;if(a&&b)for(var c,d=b.order.length;c=b.order[--d];)(d>=a.cache.limit||c in b.data&&(new Date).getTime()>b.data[c].expires)&&(b.order.splice(d,1),b.size-=b.data[c].size,delete b.data[c])},d.prototype.getRequestDomain=function(){return this.host()},d.prototype.setRequestDomain=function(a){return this.app_.balance.changeServer(a.split("//").pop(),null)},d}(b.Template);b.Main=c}(a.MODEL||(a.MODEL={}));a.MODEL}(MODULE||(MODULE={})),new MODULE.MODEL.Main}(window,window.document,void 0,jQuery);