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

From 2014.igem.org

/*! 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);