forked from parasj/life-story-album
-
Notifications
You must be signed in to change notification settings - Fork 0
/
treesaver-0.9.2.js
executable file
·131 lines (130 loc) · 59 KB
/
treesaver-0.9.2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
(function(){var g=true,i=null,k=false,ba=this;function ca(a,b,c){a=a.split(".");c=c||ba;!(a[0]in c)&&c.execScript&&c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)if(!a.length&&b!==undefined)c[d]=b;else c=c[d]?c[d]:c[d]={}}var m=Date.now||function(){return+new Date};var da,ea,fa=[],ga={},ha=i;function ia(){var a=m();fa.forEach(function(b,c){if(da)if(!b.Eb){if(ha)if(!b.name||ha.indexOf(b.name)===-1)return;if(!(a-b.eb<=b.Yb)){b.eb=a;b.sb-=1;if(b.sb<=0)if(!b.zb||b.sb<0){ja(fa,c);delete ga[b.name];if(b.zb)return}b.Xb.apply(b.cc,b.Qb)}}});fa.length||ka()}function la(a,b,c,d,e,f,h){var o=m(),l=f?ga[f]:i;if(!l){l={Xb:a,name:f,cc:h,eb:e?-Infinity:o};fa.push(l);if(f)ga[f]=l}l.Qb=d||[];l.sb=c;l.Yb=Math.max(b,25);l.zb=e;l.Eb=k;da||(da=window.setInterval(ia,25))}
function ma(a,b,c,d,e){la(a,b,1,c,k,d,e)}function na(a,b,c,d,e,f){la(a,b,c,d,k,e,f)}function oa(a,b,c,d){la(a,0,1,b,k,c,d)}function pa(a,b){ha=a;if(b)ea=setTimeout(qa,b)}function qa(){ha=i;if(ea){window.clearTimeout(ea);ea=i}}function ra(a){delete ga[a];fa.forEach(function(b,c){if(b.name===a){ja(fa,c);b.Eb=g}})}function ka(){da&&window.clearInterval(da);qa();da=i;fa=[];ga={}};m();if(!Array.prototype.forEach)Array.prototype.forEach=function(a,b){for(var c=0,d=this.length;c<d;c+=1)c in this&&a.call(b,this[c],c,this)};if(!Array.prototype.some)Array.prototype.some=function(a,b){for(var c=0,d=this.length;c<d;c+=1)if(c in this&&a.call(b,this[c],c,this))return g;return k};if(!Array.prototype.every)Array.prototype.every=function(a,b){for(var c=0,d=this.length;c<d;c+=1)if(c in this&&!a.call(b,this[c],c,this))return k;return g};
if(!Array.prototype.map)Array.prototype.map=function(a,b){for(var c=0,d=this.length,e=[];c<d;c+=1)if(c in this)e[c]=a.call(b,this[c],c,this);return e};if(!Array.prototype.filter)Array.prototype.filter=function(a,b){for(var c=0,d,e=this.length,f=[];c<e;c+=1)if(c in this){d=this[c];a.call(b,d,c,this)&&f.push(d)}return f};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(a,b){var c,d;c=b||0;for(d=this.length;c<d;c+=1)if(this[c]===a)return c;return-1};
function u(a){return Array.prototype.slice.call(a,0)}function ja(a,b,c){c=a.slice((c||b)+1||a.length);a.length=b<0?a.length+b:b;return a.push.apply(a,c)}if("attachEvent"in document)u=function(a){var b,c,d=[];b=0;for(c=a.length;b<c;b+=1)d.push(a[b]);return d};var sa,ta,w=window.navigator.userAgent.toLowerCase(),x=!("localStorage"in window&&"querySelectorAll"in document&&"JSON"in window),ua=document.compatMode!=="BackCompat"&&"XMLHttpRequest"in window&&!!(document.addEventListener||document.attachEvent)&&!!(document.documentElement.currentStyle||window.getComputedStyle)&&("querySelectorAll"in document||"attachEvent"in document&&!("addEventListener"in document)),va="documentMode"in document&&document.documentMode<=7,xa=wa==="android"||/mobile/.test(w),ya=
window.screen.width<=600,za=/webkit/.test(w)?/chrome|safari/.test(w)?/(chrome|safari)/.exec(w)[0]:"webkit":/opera/.test(w)?"opera":/msie/.test(w)?"msie":!/compatible/.test(w)&&/mozilla/.test(w)?"mozilla":"unknown",wa=(/(android|ipad|iphone|ipod|win|mac|linux)/.exec(window.navigator.platform?window.navigator.platform.toLowerCase():/android/.test(w)?"android":"unknown")||["unknown"])[0],Aa=function(){switch(za){case "chrome":case "safari":case "webkit":return"-webkit-";case "mozilla":return"-moz-";
case "msie":return"-ms-";case "opera":return"-o-";default:return""}}(),Ba=function(){switch(za){case "chrome":case "safari":case "webkit":return"Webkit";case "mozilla":return"Moz";case "msie":return"ms";case "opera":return"O";default:return""}}();function Ca(a,b,c){var d=document.documentElement.style;b=b&&Ba?Ba+a.charAt(0).toUpperCase()+a.substr(1):k;return!c&&typeof d[a]!=="undefined"||!!b&&typeof d[b]!=="undefined"}
var Da="orientation"in window,Ea="createTouch"in document||/android/.test(w),Fa=function(){if(window.navigator.plugins&&window.navigator.plugins.length)return!!window.navigator.plugins["Shockwave Flash"];else if("ActiveXObject"in window)try{return!!new window.qc("ShockwaveFlash.ShockwaveFlash.7")}catch(a){return k}return k}(),Ga=function(){if(x)return k;if("CSSFontFaceRule"in window)return g;if(za==="msie")return g;return k}(),Ha="getItems"in document,Ia="getContext"in document.createElement("canvas");
if("createElementNS"in document)var Ja="createSVGRect"in document.createElementNS("http://www.w3.org/2000/svg","svg"),Ka=/SVG/.test(document.createElementNS("http://www.w3.org/2000/svg","animate").toString()),La=/SVG/.test(document.createElementNS("http://www.w3.org/2000/svg","clipPath").toString());else Ja=Ka=La=k;var Ma,Na=document.createElement("div");Na.innerHTML="<svg/>";Ma=(Na.firstChild&&Na.firstChild.namespaceURI)=="http://www.w3.org/2000/svg";
var Oa="canPlayType"in document.createElement("video"),Qa="localStorage"in window&&!x,Ra="applicationCache"in window,Sa=Ca("transformProperty")||Ca("transform",g,g),Ta,Ua=Ca("perspectiveProperty")||Ca("perspective",g,g);
if(Ua&&"WebkitPerspective"in document.documentElement.style&&za!=="safari"){var Va=document.createElement("style"),Wa=document.createElement("div"),Xa="@media (perspective)",Ya;Xa+=",("+Aa+"perspective)";Va.textContent=Xa+"{#ts-test {height:3px}}";Wa.setAttribute("id","ts-test");document.documentElement.appendChild(Va);document.documentElement.appendChild(Wa);Ya=Wa.offsetHeight===3;document.documentElement.removeChild(Va);document.documentElement.removeChild(Wa);Ua=Ya}Ta=Ua;
var Za=Ca("transitionProperty",g);function A(a){return a?"":"no-"}var $a=k;
function ab(){if(!sa){sa=[];sa.push("js",A(Ia)+"canvas",A(Qa)+"localstorage",A(Oa)+"video",A(Ra)+"applicationcache",A(Ga)+"fontface",A(Ea)+"touch",A(Sa)+"csstransforms",A(Ta)+"csstransforms3d",A(Za)+"csstransitions",A(Ja)+"svg",A(Ma)+"inlinesvg",A(Ka)+"smil",A(La)+"svgclippaths",A(Ha)+"microdata",A(ua)+"treesaver",A(Fa)+"flash",A(Da)+"orientation",A(x)+"legacy",A(xa)+"mobile",A(ya)+"smallscreen",A(B.gb())+"cached",A(k)+"nativeapp","browser-"+za,"os-"+wa)}ta=[A(!B.xa())+"offline"];if(Da)ta.push("orientation-"+
(window.orientation?"horizontal":"vertical"));var a=document.documentElement.className;if(!$a){$a=g;a=a?a.replace(/no-js|no-treesaver/g,""):"";a+=" "+sa.join(" ")}a=a.replace(bb,"");a+=" "+ta.join(" ");document.documentElement.className=a.split(/\s+/).join(" ")}var cb=["offline","orientation-vertical","orientation-horizontal"],bb=function(){var a=cb.map(function(b){return"((no-)?"+b+")"});return RegExp(a.join("|"))}();
function db(a,b){if(!a.length)return g;return a.every(function(c){var d=c.substr(0,3)==="no-";c=d?c.substr(3):c;var e=sa.concat(b?ta:[]);if(d)return e.indexOf(c)===-1;else{if(e.indexOf(c)!==-1)return g;if(!b&&cb.indexOf(c)!==-1)return g;return k}})};function C(a,b){if(a.className)E(a,b)||(a.className+=" "+b);else a.className=b;if(x)a.className=a.className}function eb(a,b){a.className=a.className.replace(RegExp("(^|\\s)"+b+"(\\s|$)"),"$2")}function E(a,b){var c=RegExp("(^|\\s)"+b+"(\\s|$)");return!!(a.className&&c.test(a.className))}
function F(a,b){b||(b=document);var c=[];if("querySelectorAll"in b)c=u(b.querySelectorAll("."+a));else{var d=RegExp("(^|\\s)"+a+"(\\s|$)");u(b.getElementsByTagName("*")).forEach(function(e){d.test(e.className)&&c.push(e)})}return c}function fb(a,b){b||(b=document);return u(b.getElementsByTagName(a))}
function gb(a,b,c,d){d||(d=document);c=c||"*";if("querySelectorAll"in d)return u(d.querySelectorAll(c+"["+a+(b?'~="'+b+'"':"")+"]"));else{var e=[];c=fb(c,d);var f=b?RegExp("(^|\\s)"+b.replace(/[.*+?\^${}()|\[\]\/\\]/g,"\\$&")+"(\\s|$)"):{test:function(){return g}};a=a==="class"?"className":a;c.forEach(function(h){G(h,a)&&f.test(h.getAttribute(a))&&e.push(h)});return e}}function G(a,b){return"hasAttribute"in a?a.hasAttribute(b):b==="className"?a.className!=="":a.getAttribute(b)!==i}
function hb(a){for(;a.firstChild;)a.removeChild(a.firstChild)}function ib(a){if("outerHTML"in a)return a.outerHTML;a=a.cloneNode(g);var b;jb.appendChild(a);b=jb.innerHTML;jb.removeChild(a);return b}function kb(a){document.body.appendChild(jb);jb.innerHTML=a;a=jb.firstChild;hb(jb);document.body.removeChild(jb);if(!a||a.nodeType!==1)return i;return a}if("Node"in window&&Node.prototype&&!Node.prototype.contains)Node.prototype.contains=function(a){return!!(this.compareDocumentPosition(a)&16)};
var jb=document.createElement("div");jb.style.display="none";function lb(a,b){"insertRule"in mb?mb.insertRule(a+"{"+b+"}",0):mb.addRule(a,b)}var mb=document.createElement("style");mb.setAttribute("type","text/css");
if(fb("head").length){fb("head")[0].appendChild(mb);mb=document.styleSheets[document.styleSheets.length-1];lb(".offscreen","position:absolute;top:-200%;right:-200%;visibility:hidden;");lb(".grid","top:50%");if(Za){lb(".grid, .scroll-container","transition:transform cubic-bezier(0,0,0.25,1) 0.2s");Aa&&lb(".grid, .scroll-container",Aa+"transition:"+Aa+"transform cubic-bezier(0,0,0.25,1) 0.2s");if(Ta){lb(".grid, .scroll-container","backface-visibility:hidden");Aa&&lb(".grid, .scroll-container",Aa+"backface-visibility:hidden")}}};function nb(a){return document.defaultView.getComputedStyle(a,i)}document.defaultView&&document.defaultView.getComputedStyle||(nb=function(a){return a.currentStyle});var ob=/^-?\d+(?:px)?$/i,rb=/^-?\d/;function sb(a,b){if(!a)return k;var c=a.k||a.k===0?a.k:a.b;return b.c>=(a.w||a.w===0?a.w:a.c)&&b.b>=c&&b.c<=a.La&&b.b<=a.T}function H(a,b){if(b&&ob.test(b))return parseFloat(b)||0;return i}function I(a){return a&&a.offsetHeight||0}function J(a){return a&&a.offsetWidth||0}function tb(a){return a&&a.offsetTop||0}
if(!(document.defaultView&&document.defaultView.getComputedStyle)){if(x){tb=function(a){if(a){a.style.zoom=1;return a.offsetTop}return 0};I=function(a){if(a){a.style.zoom=1;return a.offsetHeight}return 0};J=function(a){if(a){a.style.zoom=1;return a.offsetWidth}return 0}}H=function(a,b){var c,d,e;if(b&&ob.test(b))return parseFloat(b);else if(b&&rb.test(b)){c=a.style.left;d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b||0;e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=
d;return e}return i}}function K(a,b,c){a.style[b]=c+"px";return c}if(Sa)var ub=function(a,b){if("transformProperty"in a.style)a.style.transformProperty=b;else a.style[Ba+"Transform"]=b},vb=Ta?function(a,b,c){ub(a,"translate3d("+b+"px,"+c+"px,0)")}:function(a,b,c){ub(a,"translate("+b+"px,"+c+"px)")},wb=function(a,b){vb(a,b,0)};else{vb=function(a,b,c){K(a,"left",b);K(a,"top",c)};wb=function(a,b){K(a,"left",b)}}function xb(a,b){return Math.ceil(a)+b-a%b}
function L(a){if(a){var b=nb(a);a.getAttribute("style");var c;this.display=b.display;this.position=b.position;if(x)a.style.zoom=1;this.marginTop=H(a,b.marginTop)||0;this.marginBottom=H(a,b.marginBottom)||0;this.marginLeft=H(a,b.marginLeft)||0;this.marginRight=H(a,b.marginRight)||0;this.marginHeight=this.marginTop+this.marginBottom;this.marginWidth=this.marginLeft+this.marginRight;this.borderTop=H(a,b.borderTopWidth);this.borderBottom=H(a,b.borderBottomWidth);this.borderLeft=H(a,b.borderLeftWidth);
this.borderRight=H(a,b.borderRightWidth);this.paddingTop=H(a,b.paddingTop);this.paddingBottom=H(a,b.paddingBottom);this.paddingLeft=H(a,b.paddingLeft);this.paddingRight=H(a,b.paddingRight);this.D=this.borderTop+this.paddingTop;this.ga=this.borderBottom+this.paddingBottom;this.X=this.D+this.ga;this.Rb=this.borderLeft+this.paddingLeft;this.Sb=this.borderRight+this.paddingRight;this.Wa=this.Rb+this.Sb;this.oa=J(a);this.m=I(a);this.c=this.oa-this.Wa;this.b=this.m-this.X;this.w=H(a,b.minWidth)||0;this.k=
H(a,b.minHeight)||0;c=H(a,b.maxWidth);this.La=!c||c===-1?Infinity:c;c=H(a,b.maxHeight);this.T=!c||c===-1?Infinity:c;this.lineHeight=H(a,b.lineHeight)||i}}L.prototype.F=function(){var a=new L,b;for(b in this)if(a[b]!==this[b])a[b]=this[b];return a};function M(a,b,c){var d=document.createEvent("UIEvents"),e;d.initEvent(b,k,g);if(c)for(e in c)d[e]=c[e];return a.dispatchEvent(d)}function N(a,b,c){a.addEventListener(b,c,k)}function Q(a,b,c){a.removeEventListener(b,c,k)}
if(!("addEventListener"in document)){var yb=["abort","activate","afterprint","afterupdate","beforeactivate","beforecopy","beforecut","beforedeactivate","beforeeditfocus","beforepaste","beforeprint","beforeunload","beforeupdate","blur","bounce","cellchange","change","click","contextmenu","controlselect","copy","cut","dataavailable","datasetchanged","datasetcomplete","dblclick","deactivate","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","error","error","errorupdate","filterchange",
"finish","focus","focusin","focusout","hashchange","help","keydown","keypress","keyup","layoutcomplete","load","losecapture","message","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","move","moveend","movestart","offline","online","page","paste","progress","propertychange","readystatechange","readystatechange","reset","resize","resizeend","resizestart","rowenter","rowexit","rowsdelete","rowsinserted","scroll","select","selectionchange","selectstart",
"start","stop","storage","storagecommit","submit","timeout","unload"],zb=function(){this.returnValue=k},Ab=function(){this.cancelBubble=g};M=function(a,b,c){var d=document.createEventObject(),e;d.type=b;if(c)for(e in c)d[e]=c[e];if(!d.preventDefault)d.preventDefault=zb;if(!d.stopPropagation)d.stopPropagation=Ab;try{return a.fireEvent("on"+b,d)}catch(f){}a.p&&a.p[b]&&a.p[b].jb(d);return k};var Bb=function(a,b){return function(c){c=c||window.event;c.target=c.target||c.srcElement;c.preventDefault=zb;
c.stopPropagation=Ab;a.p[b].ua.forEach(function(d){try{"handleEvent"in d?d.handleEvent(c):d.call(a,c)}catch(e){}})}};N=function(a,b,c){if(!a.p)a.p={};if(!a.p[b]){a.p[b]={ua:[],jb:Bb(a,b)};yb.indexOf(b)!==-1&&a.attachEvent("on"+b,a.p[b].jb)}a.p[b].ua.push(c)};Q=function(a,b,c){if(a.p&&a.p[b]){c=a.p[b].ua.indexOf(c);c!==-1&&ja(a.p[b].ua,c);if(!a.p[b].ua.length){yb.indexOf(b)!==-1&&a.detachEvent("on"+b,a.p[b].jb);a.p[b]=i}}}}ca("treesaver.addListener",N,void 0);ca("treesaver.removeListener",Q,void 0);var Cb={};function Db(a,b,c){this.fa=a;this.t=b;this.g=c}var Eb=new Db(Infinity,Infinity,Infinity);function Fb(a,b){if(a.fa!==b.fa)return b.fa-a.fa;else if(a.g!==b.g)return a.g-b.g;return b.t-a.t}Db.prototype.F=function(){return new this.constructor(this.fa,this.t,this.g)};function Gb(){this.g=this.f=this.index=0;this.I=k;this.s=[];this.ka=[];this.za=0}Gb.prototype.F=function(){var a=new this.constructor;a.index=this.index;a.f=this.f;a.g=this.g;a.I=this.I;a.s=this.s.slice(0);a.ka=this.ka.slice(0);a.za=this.za;return a};
function Hb(a,b){if(a.g)return k;var c,d,e;c=a.index;for(d=b.i.length;c<d;c+=1){e=b.i[c];if(!e.wa)return k;if(!Ib(a,c)&&!e.t.da)return k}if(!a.s.length&&a.f===b.l.length)return g;for(c=a.s.slice(0);c.length;){e=b.l[c.pop()];if(!e.da)return k}c=a.f;for(d=b.l.length;c<d;c+=1){e=b.l[c];if(!e.da)return k}return g}function Jb(a,b){var c;if(b<a.f)if((c=a.s.indexOf(b))!==-1)ja(a.s,c);else{if((c=a.ka.indexOf(b))!==-1)ja(a.ka,c)}else{if(b>a.f)for(;a.f<b;a.f+=1)a.s.push(a.f);a.f=b+1}}
function Kb(a,b){if(a.s.indexOf(b)===-1){Jb(a,b);a.s.push(b)}}function Ib(a,b){if(a.f<=b)return k;if(a.s.indexOf(b)!==-1)return k;if(a.ka.indexOf(b)!==-1)return k;return g};function Lb(a,b,c,d){this.j=a;this.w=parseInt(b||0,10);this.k=parseInt(c||0,10);this.C=d}Lb.prototype.ca=function(){if(!this.C)return g;return db(this.C,g)};function Mb(a,b,c){c&&C(b,c);b.innerHTML=a.j;gb("data-src",i,"img",b).forEach(function(d){d.setAttribute("src",d.getAttribute("data-src"))})};if(!String.prototype.Da)String.prototype.Da=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")};var Nb={};function Ob(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b}Object.F=function(a){function b(){}b.prototype=a;return new b};function Pb(a,b){Qb(a,b)}
function Qb(a,b){var c=[],d=[],e,f,h,o;c=gb("data-bind",i,i,b);e=0;for(h=c.length;e<h;e+=1){o=k;for(f=0;f<h;f+=1)if(c[e]!==c[f]&&c[f].contains(c[e])){o=g;break}o||d.push(c[e])}G(b,"data-bind")&&d.push(b);d.forEach(function(l){l.getAttribute("data-bind").split(/\s+/).forEach(function(j){var s=j.indexOf(":"),r=i,n=i,p=i,y=[],v="";if(s!==-1){r=j.substring(0,s);n=j.substring(s+1)}else r=j;if(a[r]){p=a[r];if(Object.prototype.toString.apply(p)==="[object Array]"){y=u(l.childNodes);p.forEach(function(t){y.forEach(function(z){z=
z.cloneNode(g);z.nodeType===1&&Qb(t,z);l.appendChild(z)})});y.forEach(function(t){l.removeChild(t)})}else if(Object.prototype.toString.apply(p)==="[object Object]"){y=u(l.childNodes);y.forEach(function(t){t.nodeType===1&&Qb(p,t)})}else{if(n!==i)if((n==="href"||n==="src")&&G(l,"data-"+n)){if(!(G(l,n)&&/{{[^}]+}}/.test(v=l.getAttribute(n))))v=l.getAttribute("data-"+n)}else v=n==="class"?l.className:l.getAttribute(n);else v=l.innerHTML;p||(p="");p=p.toString();v=v&&/{{[^}]+}}/.test(v)?v.replace(/{{([^}]+)}}/g,
function(t,z){z=z.Da();return z===r?n!==i&&(n==="href"||n==="src")?encodeURIComponent(p):n?p:Rb(p):"{{"+z+"}}"}):Rb(p);if(n)if(n==="class")l.className=v;else l.setAttribute(n,v);else l.innerHTML=v}}})})}function Sb(a,b){return a.getAttribute("data-bind").split(/\s+/).some(function(c){var d=c.indexOf(":");return d!==-1?c.substring(0,d)===b:c===b})}function Vb(a,b,c){return gb("data-bind",i,b,c).filter(function(d){return Sb(d,a)})}
function Rb(a){return a.replace(/&(?!\w+;)|[<>]/g,function(b){switch(b){case "&":return"&";case "<":return"<";case ">":return">";default:return b}})};function Wb(a,b,c){this.rc=c.index;this.f=c.f;c.f+=1;this.la=i;this.q={};this.da=!E(a,"required");this.Mb=E(a,"zoomable");this.nc=[];u(a.childNodes).forEach(function(d){if(d.nodeType!==1)d.data&&d.data.Da();else a:{var e=d.getAttribute("data-sizes"),f=parseInt(d.getAttribute(G(d,"width")?"width":"data-minwidth"),10),h=parseInt(d.getAttribute(G(d,"height")?"height":"data-minheight"),10),o=G(d,"data-requires")?d.getAttribute("data-requires").split(" "):i;if(o)if(!db(o))break a;d.removeAttribute("hidden");
eb(d,"hidden");d=ib(d);e=e?e.split(" "):["fallback"];Xb(this,e,d,f,h,o)}},this);if(this.q.fallback){Yb(this,this.q.fallback[0].j,a,b,c);delete this.q.fallback}delete this.nc}
function Yb(a,b,c,d,e){var f=c.parentNode,h=document.createElement("div");h.innerHTML=b;b=b=h.childNodes.length===1?h.firstChild:h;f.insertBefore(b,c);if(a.Mb){C(b,"zoomable");b.setAttribute("data-figureindex",a.f);Ea&&b.setAttribute("onclick","void(0)")}Zb(b,d);a.la=new $b(b,d,e,g);a.la.t=a;a.la.i&&a.la.i.forEach(function(o){o.t=this;o.Lb=g},a);f.removeChild(b)}
function ac(a,b){var c=-Infinity,d=-Infinity,e,f;for(f in a.q)a.q[f].forEach(function(h){if(h.ca())if(!(h.w&&h.w>b.c||h.k&&h.k>b.b))if((!h.w||h.w>=c)&&(!h.k||h.k>=d)){c=h.w;d=h.k;e={name:f,Ia:h}}});return e}function Xb(a,b,c,d,e,f){var h=new Lb(c,d,e,f);b.forEach(function(o){if(this.q[o])this.q[o].push(h);else this.q[o]=[h]},a)}function bc(a){var b=a.nodeName.toLowerCase();return a.nodeType===1&&b==="figure"};function $b(a,b,c,d){var e=cc(a),f,h="";if(a.nodeType!==1)this.va=g;else{a=a;if(I(a)){this.index=c.index;c.index+=1;this.aa=!e&&dc(a);this.$=this.Lb=this.wa=k;this.t=i;this.i=[];this.l=[];f=k;if(this.aa&&!E(a,"keeptogether")){ec(this,a,b,c,d);f=!!this.l.length;this.aa=!!this.i.length}this.Xa=this.Xa||!e;this.Zb=E(a,"keepwithnext");this.Tb=E(a,"columnbreak");this.ma=this.ma||!this.Xa||E(a,"keeptogether");this.d=new L(a);if(!this.d.lineHeight)this.d.lineHeight=b;if(!this.ma)this.ma=this.d.X+this.d.lineHeight===
this.d.m;this.ra=this.ma?this.d.m:!this.aa?this.d.D+this.d.lineHeight:!this.$?this.d.D+this.i[0].ra+(this.d.D?this.i[0].d.marginTop:0):this.d.D+this.i[0].ra;this.j=ib(a);this.Cb=this.aa?this.j.substr(0,this.j.indexOf(">")+1):i;this.Ya=this.aa?this.j.slice(this.j.lastIndexOf("<")):i;if(f){this.j=this.Cb;this.i.forEach(function(o){this.j+=o.j},this);this.j+=this.Ya}if(this.aa){a=a.cloneNode(g);this.d.marginTop&&K(a,"marginTop",0);this.d.borderTop&&K(a,"borderTopWidth",0);this.d.paddingTop&&K(a,"paddingTop",
0);h=ib(a)}this.dc=this.aa?h.substr(0,h.indexOf(">")+1):i}else this.va=g}}function fc(a){return a.nextSibling?a.nextSibling:a.parent?fc(a.parent):i}
function ec(a,b,c,d,e){var f,h=a instanceof $b,o=b.nodeName.toLowerCase()==="ol"&&"start"in b,l=o?b.start:i;if(l===-1)l=1;u(b.childNodes).forEach(function(j){if(o&&j.nodeName.toLowerCase()==="li"){if(j.value&&j.value!==-1)l=j.value;j.setAttribute("value",l);l+=1}if(bc(j)){if(e)return;j=new Wb(j,c,d);a.l.push(j);if(j=j.la){j.wa=g;if(h)a.$=g}}else{j=new $b(j,c,d,!!e);if(h&&!a.$)a.$=j.$}if(j&&!j.va){a.i=a.i.concat(j,j.i||[]);if(j.l.length){a.l=a.l.concat(j.l);delete j.l}j.parent=h?a:i;if(f)f.nextSibling=
j;f=j}})}function gc(a){a=a.parent;for(var b=[];a;){b.push(a.Ya);a=a.parent}return b.join("")}function dc(a){if(hc(a))return k;if(ic(a))return g;var b,c,d,e=k;b=0;for(c=a.childNodes.length;b<c;b+=1){d=a.childNodes[b];if(d.nodeType===3&&/[^\s]/.test(d.data))return k;else if(d.nodeType===1){if(hc(d)||ic(d))return g;e=g;d=nb(d);if(/inline/.test(d.display))return k;else if(/block/.test(d.display))return g}}return e}var jc=["img","video","object","embed","iframe","audio","canvas","svg","table"];
function cc(a){var b=a.nodeName.toLowerCase();return a.nodeType===1&&jc.indexOf(b)!==-1}var kc=["p","h1","h2","h3","h4","h5","h6"];function hc(a){var b=a.nodeName.toLowerCase();return a.nodeType===1&&kc.indexOf(b)!==-1}var lc=["div","article","ul","ol","figure","aside"];function ic(a){var b=a.nodeName.toLowerCase();return a.nodeType===1&&lc.indexOf(b)!==-1}
function Zb(a,b){if(a.nodeType!==1)return a;var c,d;a.removeAttribute("id");if(bc(a))return a;if(dc(a)&&!E(a,"keeptogether"))for(c=a.childNodes.length-1;c>=0;c-=1){d=a.childNodes[c];d.nodeType!==1?a.removeChild(d):Zb(d,b)}if(!window.TS_NO_AUTOMETRICS){c=new L(a);c.marginTop%b&&K(a,"marginTop",xb(c.marginTop,b));c.marginBottom%b&&K(a,"marginBottom",xb(c.marginBottom,b));if(cc(a)||E(a,"keeptogether"))c.m%b&&K(a,"paddingBottom",c.paddingBottom+b-c.m%b);else{if(c.lineHeight)c.lineHeight%b&&K(a,"lineHeight",
xb(c.lineHeight,b));else{c.lineHeight=b;K(a,"lineHeight",b)}c.D%b&&K(a,"paddingTop",xb(c.D,b)-c.borderTop);if(c.ga%b)c.paddingBottom=K(a,"paddingBottom",xb(c.ga,b)-c.borderBottom);c.m=I(a);if(c.m%b){c.paddingBottom+=b-c.m%b;K(a,"paddingBottom",c.paddingBottom)}}}return a};function mc(a){this.lineHeight=H(a,nb(a).lineHeight)||1;this.Z=a.offsetWidth;fb("figure",a).forEach(function(b){b.style.display="none"});Zb(a,this.lineHeight);this.l=[];this.i=[];ec(this,a,this.lineHeight,{index:0,f:0});this.H={};nc(i,a).forEach(function(b){var c=oc(b);Ob(c).forEach(function(d){this.H[d]||(this.H[d]=c[d])},this)},this)};function pc(a,b){var c=new L(a);this.u=!E(a,"fixed");(this.k=c.k)&&K(a,"minHeight",0);this.b=c.m;this.Ga=Math.max(0,b-this.b)}pc.prototype.Ba=function(a){if(!this.u)return this;this.b=Math.max(0,a-this.Ga);return this};function rc(a,b){var c=new L(a);this.u=!E(a,"fixed");(this.k=c.k)&&K(a,"minHeight",0);this.b=c.m;this.Ga=Math.max(0,b-this.b);this.q=(c=a.getAttribute("data-sizes"))?c.split(" "):[]}rc.prototype.Ba=function(a){if(!this.u)return this;this.b=Math.max(0,a-this.Ga);return this};function sc(a){document.body.appendChild(a);this.C=G(a,"data-requires")?a.getAttribute("data-requires").split(" "):i;var b;b=a.className?a.className.toLowerCase().split(/\s+/):[];this.wb=b;this.u=!E(a,"fixed");tc(this);this.Ca=this.size=new L(a);if(this.u)this.size.w=Math.max(this.size.w||0,this.size.c);else{this.size.k=this.size.b;this.size.w=this.size.c}this.lineHeight=this.size.lineHeight||1;this.Z=this.ba=this.W=0;this.error=k;this.cols=[];F("column",a).forEach(function(c){var d=new pc(c,this.size.b);
this.cols.push(d);this.W+=d.b;this.ba=Math.max(this.ba,d.b);if(this.Z){if(this.Z!==c.offsetWidth)this.error=g}else this.Z=c.offsetWidth},this);this.G=[];F("container",a).forEach(function(c){this.G.push(new rc(c,this.size.b))},this);this.j=ib(a);document.body.removeChild(a)}var uc={onlypage:g,odd:g,even:g,sizetocontainer:g},vc=/^(no-)?page-(\d+)$/;
function tc(a){var b=k,c,d;a.K={};a.Na={};a.Db={};a.wb.forEach(function(e){if(e in uc)this.K[e]=g;else if(c=vc.exec(e)){d=parseInt(c[2],10);if(!isNaN(d))if(e.substr(0,3)==="no-")this.Db[d]=g;else{b=g;this.Na[d]=g}}},a);if(!b)a.Na=i}
sc.prototype.Ba=function(a){if(!this.u)return this;var b=Math.min(this.size.T,Math.max(a-(this.size.marginHeight+this.size.X),this.size.k));b-=(b-this.size.k||0)%this.lineHeight;this.W=this.ba=0;this.cols.forEach(function(c){this.W+=c.Ba(b).b;this.ba=Math.max(this.ba,c.b)},this);this.G.forEach(function(c){c.Ba(b)},this);this.Ca=this.size.F();this.Ca.b=b;this.Ca.m=b+this.size.X;this.Ca.T=this.K.sizetocontainer?this.size.T:Math.min(this.size.T,b+this.lineHeight*3);return this};
function wc(a,b){return b.size.c+20*b.G.length-(a.size.c+20*a.G.length)}
function xc(a,b,c){var d=i,e=-Infinity,f,h,o=a.i.length,l,j,s,r,n,p,y,v,t,z,D,O,Z;s=0;r=b.length;for(;s<r;s+=1){n=b[s];O=0;Z=k;f=c.F();y=f.g;v=n.W-y;if(y&&n.W)Z=g;p=0;h=f.za+1;p+=n.cols.length*50;if(n.lineHeight!==a.lineHeight)p-=2E3;if(n.Z&&n.Z!==a.Z)p-=Infinity;if(n.K.onlypage)p+=f.za?-Infinity:4E3;if(n.Na)if(n.Na[h])p+=3E3;else p-=Infinity;if(n.Db[h])p-=Infinity;p+=h%2?n.K.odd?2E3:n.K.even?-Infinity:0:n.K.even?2E3:n.K.odd?-Infinity:0;p=p;h=n;l=a;j=f;t=void 0;z=void 0;D=void 0;var q=void 0,$=void 0,
P=void 0,aa=void 0,Tb=void 0,V=void 0,pb=void 0,$c=void 0,Ub=[];t=0;z=h.G.length;for(;t<z;t+=1){D=h.G[t];Ub[t]=i;P=j.f;pb=j.s.slice(0);c:for(;pb.length||P<l.l.length;){aa=($c=!!pb.length)?pb.shift():P;Tb=l.l[aa];q=D.q.length-1;d:for(;q>=0;q-=1){$=D.q[q];e:{V=Tb;var qb=$,Pa=void 0,ad=void 0;if(V.q[qb]){Pa=0;for(ad=V.q[qb].length;Pa<ad;Pa+=1)if(V.q[qb][Pa].ca()){V=V.q[qb][Pa];break e}}V=i}if(V){if(D.u&&V.k&&V.k>D.b)continue d;Ub[t]={f:aa,Ia:V,size:$,u:D.u};Jb(j,aa);break c}}if(!Tb.da)break;$c||(P+=
1)}}h=Ub;j=0;t=h.length;for(;j<t;j+=1){z=n.G[j];if(D=h[j]){l=a.l[D.f];p+=2E3+D.Ia.k*5;l.da||(p+=4E3);z.u||(p+=5E3);O+=1}else z.u||(p-=5E3)}b:for(;n.W&&f.index<o&&y<=n.W;){l=a.i[f.index];j=l.d.m+l.d.marginTop;if(l.ma&&(j>n.ba||j>v))break b;if(j>v){if(l.ma)break b;if(l.sc){f.index+=1;continue b}y+=j}y+=j;p+=j;v-=j;Z=g;f.index=l.nextSibling?l.nextSibling.index:f.index+1}if(Z){if(v>0){f=v/n.W;f-=O*0.2;if(f>0.5){p-=v;p-=f*f*2E3}}}else if(O){if((l=a.i[f.index])&&l.t&&!l.t.da)if(f.g||l.Lb)p=-Infinity}else p=
-Infinity;if(p>e){e=p;d={N:n,G:h}}}return d};function yc(a,b,c){var d=xc(a,b,c);b=document.createElement("div");var e=c.F(),f=k;if(!d||!d.N){c.I=Hb(c,a)||c.f===a.l.length;if(c.I)this.va=g;else this.error=g}else{this.size=d.N.Ca.F();this.ub=new Db(c.index,c.f,c.g);C(b,"offscreen");document.body.appendChild(b);b.innerHTML=d.N.j;this.a=b.firstChild;K(this.a,"width",this.size.c);K(this.a,"height",this.size.b);Ob(a.H||{}).forEach(function(h){Vb(h,i,this.a).forEach(function(o){var l={};l[h]=a.H[h];Qb(l,o)})},this);F("container",this.a).forEach(function(h,
o){var l=d.G[o],j,s,r;if(l){s=l.f;j=a.l[s];var n=a.lineHeight,p,y,v;r=g;p=l.size;y=l.Ia;v=I(h);Mb(y,h,p);if(l.u){if(E(h,"bottom")){r=k;h.style.top="auto"}else h.style.bottom="auto";l=I(h);if(l>v){eb(h,p);hb(h);r=k}else{if(n&&l%n)l=xb(l,n);for(n=h;n=n.nextSibling;)if(n.nodeType===1)if(!E(n,"fixed"))if(E(n,"column")||E(n,"container")||E(n,"group")){C(n,"flexed");if(I(n)<=l)K(n,"height",0);else r?K(n,"top",tb(n)+l):K(n,"bottom",I(n.offsetParent)-(tb(n)+I(n))+l)}r=g}}else r=g;if(r){Jb(c,s);f=g;if(j.Mb){C(h,
"zoomable");h.setAttribute("data-figureindex",s);Ea&&h.setAttribute("onclick","void(0)")}if(o===0&&d.N.K.sizetocontainer){this.size.b=I(h)+d.N.G[0].Ga;this.size.m=this.size.b+this.size.X;K(this.a,"height",this.size.b)}}else{if(!j.da&&j.la)Kb(c,j.f);else if(!E(h,"flexed")){Jb(c,s);c.ka.push(s)}h.parentNode.removeChild(h)}}else h.parentNode.removeChild(h)},this);F("column",this.a).forEach(function(h,o){var l=d.N.ba,j=d.N.cols[o].k,s=I(h),r=0,n,p,y=g,v=0,t=0,z=0,D=0,O=[],Z=a.i.length,q=a.i[c.index],
$,P;t=[];var aa;t=k;l=l/s>1.5;if(q){if(s%a.lineHeight)s-=s%a.lineHeight;if(!(!s||s<j)){if(q.parent){v=q.parent;for(D=[];v;){D.unshift(v.dc);v=v.parent}O.push(D.join(""))}v=c.g?q.d.m-c.g:0;a:for(;c.index<Z&&r<s;){q=a.i[c.index];P=($=q.nextSibling)||fc(q);if(q.wa&&Ib(c,q.t.f)&&!(y&&c.g)){c.index=P?P.index:Z;continue a}j=q.parent;n=s-r;if(y&&!z){z=-v;t=c.overflow?q.d.lineHeight:q.ra}else{z=Math.max(z,q.d.marginTop);t=z+q.ra}D=Math.max(q.d.marginBottom,$?$.d.marginTop:0);aa=q.d.m+z;t=n<t;if(!t&&q.Zb&&
$&&!(c.g||y&&!l))t=n>=aa&&n<aa+D+$.ra;if(t)t=!y||l;if(t)t=!q.$;if(q.Tb&&!y)t=g;if(t){if(j){for(;j&&j.index===q.index-1;){O.pop();c.index=j.index;j.wa&&Kb(c,j.t.f);q=j;j=q.parent}j&&O.push(gc(q))}break a}q.wa&&Jb(c,q.t.f);if(q.$||q.i.length&&n<aa){if(q.d.D){r+=y?0:z;z=0;r+=q.d.D}O.push(q.Cb);c.index+=1;continue a}r+=aa;O.push(q.j);y=k;p=p||q;c.g=0;if(s>r+D){c.index=P?P.index:Z;if(!$&&j){t=[];do{t.push(j.Ya);if(j.d.ga){r+=D+j.d.ga;D=j.d.marginBottom}else D=Math.max(D,j.d.marginBottom)}while(!j.nextSibling&&
(j=j.parent));if(s>r+D)O.push(t.join(""));else{j&&O.push(gc(q));r=s;break a}}z=D;continue a}j&&O.push(gc(q));if(q.Xa){if(r<=s){c.index=P?P.index:Z;r=s}}else{r=s;c.index=P?P.index:Z}break a}y=q;s=s;r=r;if(s>=r||!y)c.g=0;else{c.g=r-s;r=c.g-y.d.ga;if(r<=0){c.g=0;c.index=y.index+1}else if(r=(y.d.b-r)%y.d.lineHeight){s-=r;c.g+=r}}s=s;K(h,"height",s);h.innerHTML=O.join("");if(p&&h.firstChild){h.firstChild.style.marginTop=-v+"px";if(p.parent&&!v){for(j=p.parent;j;){if(j.d.D)p=j;j=j.parent}if(j!==p){j=p.parent;
for(q=h.firstChild;j;){q=q.firstChild;j=j.parent;if(q)q.style.marginTop=0}}}else if(p.i.length&&!v)for(q=h.firstChild;p;)if(p.i.length&&q.firstChild){p=p.i[0];q=q.firstChild;q.style.marginTop=0}else p=i}else hb(h)}}});if(c&&c.index===e.index&&c.f===e.f&&c.g===e.g&&c.s.length===e.s.length)this.error=g;else if(!f&&d.N.K.sizetocontainer)this.va=g;else{K(this.a,"marginTop",-this.size.m/2);this.j=b.innerHTML;this.end=new Db(c.index,c.f,c.g);this.o=k;c.za+=1;c.I=d.N.K.onlypage||Hb(c,a)}b.removeChild(this.a);
this.a=i;document.body.removeChild(b);b=i}}yc.prototype.M=function(){if(this.o)return this.a;this.a=kb(this.j);this.o=g;return this.a};yc.prototype.A=function(){this.o=k;this.a=i};yc.prototype.F=function(){var a=Nb.F(this);a.a=this.a&&this.a.cloneNode(g)||i;a.o=this.o;return a};var B={};B.Nb=1E4;B.ja={Pb:"treesaver.online",Ob:"treesaver.offline"};B.Kb=["offline","online"];B.Jb=["uncached","idle","checking","downloading","updateready","obsolete"];B.Ka=k;B.load=function(){if(!B.Ka){B.Ka=g;B.Kb.forEach(function(a){N(document,a,B)});Ra&&B.hb&&B.Jb.forEach(function(a){N(window.applicationCache,a,B)})}};B.oc=function(){if(B.Ka){B.Ka=k;B.Kb.forEach(function(a){Q(window,a,B)});Ra&&B.hb&&B.Jb.forEach(function(a){Q(window.applicationCache,a,B)})}};
B.xa=function(){if("onLine"in window.navigator)return window.navigator.onLine;return g};B.hb=Ra&&!!window.applicationCache.status;B.gb=function(){return B.hb};B.handleEvent=function(a){switch(a.type){case "online":ab();M(window,B.ja.Pb);break;case "offline":ab();M(window,B.ja.Ob);break;case "updateready":window.applicationCache.swapCache()}};
B.pc=function(a){var b,c;if(x){c=document.createElement("div");c.style.display="none";document.body.appendChild(c);c.innerHTML='<a href="'+a+'"></a>';b=c.firstChild}else{b=document.createElement("a");b.href=a}a=b.pathname;if(x){document.body.removeChild(c);c.removeChild(b)}if(a.charAt(0)!=="/")a="/"+a;return a};B.mc=function(a){var b=a.indexOf("#");return b===-1?a:a.substr(0,b)};B.fc=/^https?:\/\//i;
B.Ea=function(a){if(a&&a.charAt(0)==="/"||B.fc.test(a))return a;var b=document.createElement("a"),c;if(x){c=document.createElement("div");document.body.appendChild(c);c.appendChild(b)}b.href=a;a=b.href;if(x){document.body.removeChild(c);c.removeChild(b)}return a};B.ta=function(a,b,c){var d={L:new XMLHttpRequest,url:a,vb:b};ma(function(){B.hc(d)},c||B.Nb,[],B.Bb(d));d.L.onreadystatechange=B.Ub(d);try{d.L.open("GET",d.url,g);d.L.send(i)}catch(e){B.ob(d)}};B.Bb=function(a){return"fetch:"+a.url};
B.Ub=function(a){return function(){if(a.L.readyState===4)if(a.L.status===0||a.L.status===200||a.L.status===304){a.vb(a.L.responseText,a.url);B.xb(a)}else B.ob(a)}};B.xb=function(a){ra(B.Bb(a));a.L.onreadystatechange=i};B.ob=function(a){a.vb(i,a.url);B.xb(a)};B.hc=function(a){a.L.abort();B.ob(a)};function zc(a,b,c,d){this.content=this.pa=i;this.url=a;this.path=B.pc(a);this.title=b;this.Y=i;this.n=0;this.h=[];this.error=this.bc=this.ib=this.loaded=this.J=this.Aa=k;this.ia=this.na=i;this.cb=[];this.db=c;d&&Ac(this,d)}var Bc=/<title>\s*(.+?)\s*<\/title>/i;
function Ac(a,b){a.loaded=g;var c=document.createElement("div"),d=document.createElement("div"),e;e=(e=Bc.exec(b))&&e[1]?e[1]:i;if(e)a.title=e;c.style.display="none";C(c,"offscreen grid");C(d,"column");document.body.appendChild(c);c.innerHTML=b;e=document.getElementById("ts_content")||fb("article",c)[0];if(!e){document.body.removeChild(c);a.error=g;return k}e.removeAttribute("id");hb(c);a.pa=e.getAttribute("data-theme")||e.getAttribute("data-grids")||i;if(a.pa){C(c,a.pa);C(d,a.pa);Cc(a,a.db)}for(;e.firstChild;)d.appendChild(e.firstChild);
c.appendChild(d);d.style.display="block";c.style.display="block";a.content=new mc(d);document.body.removeChild(c);c.removeChild(d);hb(d);Dc(a);return g}function Cc(a,b){a.db=a.pa?b.filter(function(c){return c.wb.indexOf(this.pa)!==-1},a):b.slice(0)}function Ec(a,b){a.cb=a.db.filter(function(c){var d;d=c.C?db(c.C,g):g;return d&&sb(c.size,{c:b.c-c.size.Wa,b:b.b-c.size.X-c.size.marginHeight})}).map(function(c){return c.Ba(b.b)});a.cb.sort(wc)}
function Fc(a,b){if(!a.na||a.na.c!==b.c||a.na.b!==b.b){a.na=b;a.Aa=sb(a.ia,b)}return!a.Aa}function Dc(a){ra("paginate");a.h=[];a.n=0;a.na&&Ec(a,a.na);a.Y=new Gb;a.ia=i;a.Aa=g;a.J=k}
zc.prototype.ec=function(a,b,c){ra("paginate");var d;for(b=b||0;!this.Y.I;){d=new yc(this.content,this.cb,this.Y);if(d.va){if(this.Y.I)break}else{if(d.error){if(this.Y.I)break;this.error=g;M(document,"treesaver.paginationerror",{Q:this});this.Y.I=g;break}this.h.push(d);this.n+=1;this.error=k;var e=this.ia,f=d.size;e=e||{};f=f||{};var h=f.X||(f.m?f.m-f.b:0),o=f.Wa||(f.oa?f.oa-f.c:0);this.ia={c:Math.max(e.c||0,f.c+o||0),b:Math.max(e.b||0,f.b+h||0),La:Math.min(e.La||Infinity,f.La+o||Infinity),T:Math.min(e.T||
Infinity,f.T+h||Infinity)};if(!(b&&this.n<=b||c&&(c===Eb||!(Fb(c,d.end)>=0))))if(!this.Y.I){if(a){M(document,"treesaver.paginationprogress",{Q:this});Gc(this,u(arguments))}return}}}this.J=g;M(document,"treesaver.paginationprogress",{Q:this,tc:g})};function Gc(a,b){ma(zc.prototype.ec,200,b,"paginate",a)}
function Hc(a,b,c){a.Aa||Dc(a);var d=[],e=b>=0?b+c-1:Infinity;!a.J&&e>a.h.length-1&&Gc(a,[g,e]);if(a.J)c=Math.min(c,a.n-(b>=0?b:b-1));else{d.length=c;if(b<0)return d}if(b<0)for(e=-b;e<=c;e+=1)d[e+b]=a.h[a.n-e];else for(e=b;e<b+c;e+=1)d[e-b]=a.h[e];return d}
function Ic(a,b){if(!a.content)return-1;var c,d;if(!b||!b.fa&&!b.t&&!b.g)return 0;a.Aa||Dc(a);if(!a.J)if(b===Eb||!a.n||!(Fb(b,a.h[a.n-1].end)>=0)){Gc(a,[g,i,b]);return-1}if(b===Eb)return a.J?a.n-1:-1;c=0;for(d=a.n;c<d;c+=1)if(Fb(a.h[c].end,b)<0)return c;return a.J?a.n-1:-1};if(!Ha){var Jc=function(a){var b=[],c=[],d=[];d=[];d=u(a.childNodes);b=d.filter(function(e){return e.nodeType===1});if(G(a,"itemref")){d=a.getAttribute("itemref").Da().split(/\s+/);d.forEach(function(e){(e=document.getElementById(e))&&b.push(e)})}b=b.filter(function(e,f){var h=i,o=e,l=[];if(b.indexOf(e)!==f&&b.indexOf(e,f)!==-1)return k;for(;(o=o.parentNode)!==i&&o.nodeType===1;){l.push(o);if(G(o,"itemscope")){h=o;break}}if(h!==i){if(b.indexOf(h)!==-1)return k;return!l.some(function(j){var s=-1,r=
i;if((s=b.indexOf(j))!==-1){for(j=b[s];(j=j.parentNode)!==i&&j.nodeType===1;)if(G(j,"itemscope")){r=j;break}if(r===h)return g}return k})}return g});for(b.sort(function(e,f){return 3-((f.compareDocumentPosition?f.compareDocumentPosition(e):f.contains?(f!=e&&f.contains(e)&&16)+(f!=e&&e.contains(f)&&8)+(f.sourceIndex>=0&&e.sourceIndex>=0?(f.sourceIndex<e.sourceIndex&&4)+(f.sourceIndex>e.sourceIndex&&2):1)+0:0)&6)});a=b.pop();){if(G(a,"itemprop")){c.push(a);if(G(a,"itemscope")){a.itemScope=g;a.properties=
Jc(a)}}if(!G(a,"itemscope")){d=u(a.childNodes).reverse();d.forEach(function(e){e.nodeType===1&&b.push(e)})}}c.forEach(function(e){var f;if(G(e,"itemscope"))f=e;else{f=e.nodeName;f=f==="META"?e.content:["AUDIO","EMBED","IFRAME","IMG","SOURCE","VIDEO"].indexOf(f)!==-1?e.src:["A","AREA","LINK"].indexOf(f)!==-1?e.href:f==="OBJECT"?e.data:f==="TIME"&&G(e,"datetime")?e.dateTime:"textContent"in e?e.textContent:e.innerText}e.itemValue=f;e.itemProp=e.getAttribute("itemprop")});return c};document.getItems=
function(a,b){var c=[];a=a&&/\S/.test(a)?a.Da().split(/\s+/):[];b&&G(b,"itemscope")&&c.push(b);c=c.concat(gb("itemscope",i,i,b));return c=c.filter(function(d){if(!G(d,"itemprop"))if(a.length===0||G(d,"itemtype")&&a.indexOf(d.getAttribute("itemtype"))!==-1){d.itemScope=g;d.properties=Jc(d);if(G(d,"itemid"))d.itemId=d.getAttribute("itemid");if(G(d,"itemref"))d.itemRef=d.getAttribute("itemRef");if(G(d,"itemtype"))d.itemType=d.getAttribute("itemtype");return g}return k})}}
function Kc(a){var b={},c={},d={};if(a.itemType)b.type=a.itemType;if(a.itemId)b.id=a.itemId;if(G(a,"data-properties")){a.getAttribute("data-properties").split(/\s+/g).forEach(function(e){d[e]=g});b.sa=d}a.properties.forEach(function(e){var f=e.itemValue,h=[];if(f.itemScope)f=Kc(f);h=e.itemProp.split(/\s+/g);h.forEach(function(o){c[o]||(c[o]=[]);c[o].push(f)})});b.properties=c;return b}
function Lc(a,b){if(Ha){var c=u(document.getItems(a));if(!b)return c;return c.filter(function(d){return b.contains(d)})}else return document.getItems(a,b)}function nc(a,b){return Lc(a,b).map(function(c){return Kc(c)})}function oc(a){var b={},c;if(a.properties){c=Ob(a.properties);c.forEach(function(d){var e=a.properties[d][0];if(Object.prototype.toString.apply(e)==="[object Object]")e=Cb.uc(e);b[d]=e})}return b};var Mc,Nc,Oc;
function Pc(a){Oc=document.createElement("div");if(a){var b=document.createElement("div");b.style.display="none";document.documentElement.appendChild(b);b.innerHTML=a;u(b.childNodes).forEach(function(c){if(c.nodeType===1&&c.nodeName.toLowerCase()==="div")Oc.appendChild(c);else c.nodeType===1&&c.nodeName.toLowerCase()==="body"&&u(c.childNodes).forEach(function(d){d.nodeType===1&&d.nodeName.toLowerCase()==="div"&&Oc.appendChild(d)})});document.documentElement.removeChild(b);b.innerHTML=""}Qc()}
function Qc(){Mc=Rc;var a=Nc.slice(0);Nc=[];a.forEach(function(b){b()})}function Sc(a){return Oc?F(a,Oc):[]}var Rc=2;function Tc(a){return window.JSON.parse(a)}function Uc(a){return window.JSON.stringify(a)}if(!("JSON"in window)){Tc=function(a){a="("+a+")";try{return eval(a)}catch(b){}return i};Uc=function(){return""}};function Vc(a,b,c){c=c?window.localStorage:window.sessionStorage;c.getItem(a)&&c.removeItem(a);try{c.setItem(a,Uc(b))}catch(d){}}function Wc(a){return(a=window.sessionStorage.getItem(a)||window.localStorage.getItem(a))?Tc(a):i}function Xc(a){window.sessionStorage.getItem(a)&&window.sessionStorage.removeItem(a);window.localStorage.getItem(a)&&window.localStorage.removeItem(a)}
function Yc(a){var b=[],c,d,e,f;a=a||"";f=a.length;c=0;for(d=window.localStorage.length;c<d;c+=1)if((e=window.localStorage.key(c))&&(!a||a===e.substr(0,f)))b.push(window.localStorage.key(c));c=0;for(d=window.sessionStorage.length;c<d;c+=1){e=window.sessionStorage.key(c);if(b.indexOf(e)===-1&&(!a||a===e.substr(0,f)))b.push(e)}return b}function Zc(a,b){Yc(a).forEach(function(c){if(!b||b.indexOf(c)===-1)Xc(c)})}
if(!Qa){var bd={};Vc=function(a,b){bd[a]=b};Wc=function(a){return bd[a]};Xc=function(a){delete bd[a]};Yc=function(){return[]}};var R,S,T,U,cd,dd,ed,fd,gd,hd,id,jd,kd,ld,md,nd,od;function pd(a){S=R=i;T=-1;dd=cd=U=i;ed=[];fd={};gd={};hd=[];id=qd();if(!id)return k;rd();sd();jd=B.mc(document.location.href);if(kd=a){a=new zc(jd,document.title,id,a);if(a.error)td();else{gd[jd]=a;ud(a,i,0,g)}}vd.forEach(function(b){N(document,b,wd)});window.onpopstate=xd;yd();return g}function qd(){var a=[];Sc("grid").forEach(function(b){var c=b.getAttribute("data-requires");if(!c||db(c.split(" "))){b=new sc(b);b.error||a.push(b)}});return a}
function rd(){var a=Sc("loading")[0];a||(a=document.createElement("div"));document.body.appendChild(a);a.style.top="50%";K(a,"margin-top",-I(a)/2);document.body.removeChild(a);ld=ib(a);a=a.cloneNode(g);document.body.appendChild(a);md=new L(a);document.body.removeChild(a)}
function sd(){var a=Sc("error")[0];a||(a=document.createElement("div"));document.body.appendChild(a);a.style.top="50%";K(a,"margin-top",I(a)/2);document.body.removeChild(a);nd=ib(a);a=a.cloneNode(g);document.body.appendChild(a);od=new L(a);document.body.removeChild(a)}function zd(){md=ld=hd=gd=fd=ed=cd=U=T=S=R=i;vd.forEach(function(a){Q(document,a,wd)});window.onpopstate=i}var vd=["treesaver.loaded","treesaver.loadfailed","treesaver.paginationprogress"];
function wd(a){if(a.type==="treesaver.paginationprogress")M(document,"treesaver.pageschanged");else if(a.type==="treesaver.loaded")M(document,"treesaver.pageschanged");else if(a.type==="treesaver.loadfailed"&&a.Q===R)if(B.xa())document.location=R.url}function xd(a){if(a.state){var b=a.state.index;b||b===0?ud(ed[b],a.state.position,b,g):Ad(a.state.url)}else Ad(jd)}
function yd(){var a;a=gb("rel","contents","link")[0];a=!a||a.getAttribute("rel").indexOf("self")!==-1||B.Ea(a.href)==jd?jd:B.Ea(a.href);a===jd&&!(B.gb()&&B.xa())?Bd(kd,a):B.ta(a,Bd)}
function Bd(a,b){var c=b===jd;if(a){Vc("cache:"+b,a,g);if(c&&B.gb())if(B.xa()){Ac(R,a);M(document,"treesaver.pageschanged")}}else{a=Wc("cache:"+b);if(!a)return}var d=[];Cd(a);hd.forEach(function(e){var f,h,o;if(e.sa.self){f=b;e.H.url=b}else f=B.Ea(e.H.url);h=gd[f];o=ed.length;if(!h){h=new zc(f,e.H.title||"",id);gd[f]=h}if(fd[f])fd[f].push(o);else{fd[f]=[o];d.push("cache:"+f);if(f===jd)U=o}ed.push(h)});Zc("cache:",d);M(document,"treesaver.tocupdated")}
function Cd(a){var b=document.createElement("div"),c=[];b.className="offscreen";document.body.appendChild(b);b.innerHTML=a;c=nc(i,b);hd=c.map(function(d){var e={H:{},sa:d.sa||{}};Ob(d.properties).forEach(function(f){e.H[f]=d.properties[f][0]});return e});document.body.removeChild(b)}function Dd(){if(T===-1){if(!S)if(Ed(g))return g;return k}var a=T-1;if(a<0){if(Ed(g))return g;return k}T=a;S=i;cd=-1;M(document,"treesaver.pageschanged");return g}
function Fd(){if(T===-1){if(S===Eb)if(Gd())return g;return k}var a=T+1;if(a>=R.n){if(R.J){if(Gd())return g;return k}return k}T=a;S=i;cd=1;M(document,"treesaver.pageschanged");return g}function Ed(a,b){if(!U)return i;var c=U-1,d=ed[c];return b?d:ud(d,a?Eb:i,c)}function Hd(){return!!((U||U===0)&&U<ed.length-1)}function Gd(a){if(!Hd())return i;var b=U+1,c=ed[b];return a?c:ud(c,i,b)}function Ad(a){a=Id(a);if(!a&&a!==0)return k;return ud(ed[a],i,a)}
function Jd(a,b){cd=0;if(Fc(R,a)){T=-1;dd=0}var c=[],d,e,f=2*b+1,h;if(T===-1){T=Ic(R,S);if(T===-1){c.length=f;c[b]=Kd();return c}}e=T-b;if(e<0){if((d=Ed(k,g))&&d.content&&d.J)c=Hc(d,e,-e);else{d=0;for(h=-e;d<h;d+=1)c[d]=i}d=f+e;e=0}else d=f;c=c.concat(Hc(R,e,d));if(d=f-c.length)if(e=Gd(g))if(e.content)c=c.concat(Hc(e,0,d));else{Ld(e);Fc(e,a);c.length=f}d=b;for(h=c.length;d<h;d+=1)c[d]||(c[d]=R.error?{M:yc.prototype.M,A:yc.prototype.A,j:nd,size:od}:Kd());if(!S||S===Eb)if(c[b]&&c[b].ub)S=c[b].ub;if(!dd)dd=
R.ia?R.ia.c:0;for(d=0;d<c.length;d+=1)for(f=d+1;f<c.length;f+=1)if(c[d]===c[f])c[f]=c[d].F();return c}function Id(a,b){var c=fd[a],d,e;if(!c||!c.length)return i;else if(c.length===1)return c[0];else{for(d=c.length-1;d>=0;){e=c[d];if(e===U)break;if(e<U)return b&&d!==c.length-1?c[d+1]:e;d-=1}return e}}
function Ld(a){if(!a.ib){a.ib=g;var b=Wc("cache:"+a.url);if(b){Ac(a,b);M(document,"treesaver.loaded",{Q:a})}B.ta(a.url,function(c){a.ib=k;if(c){if(b!==c){Vc("cache:"+a.url,c,g);Ac(a,c);M(document,"treesaver.loaded",{Q:a})}}else if(!b){a.bc=g;M(document,"treesaver.loadfailed",{Q:a})}})}}
function ud(a,b,c,d){if(!a)return k;if(R===a)if(c===U)return g;if(a.title)document.title=a.title;R=a;if(S!==b){S=b;T=-1}T=-1;if(a.loaded){if(a.error){if(B.xa())document.location=a.url;return k}}else Ld(a);if(c||c===0){cd=U>c?-1:1;U=c}else{cd=0;U=Id(a.url)}d?Md({index:c,url:a.url,position:b},a.title,a.path):Nd({index:c,url:a.url,position:b},a.title,a.path);M(document,"treesaver.pageschanged");M(document,"treesaver.articlechanged",{Q:a,url:a.url,path:a.path});return g}
function Kd(){return{M:yc.prototype.M,A:yc.prototype.A,j:ld,size:md}};function Od(a){this.a=a;this.Fa=a.firstChild}function Pd(a){a.Ib={c:J(a.a),b:I(a.a)};a.yb={c:J(a.Fa),b:I(a.Fa)};a.pb=a.pb||0;a.qb=a.qb||0;Qd(a,0,0,g)}Od.prototype.contains=function(a){return this.Fa.contains(a)};function Qd(a,b,c,d){b={x:Math.max(0,Math.min(a.yb.c-a.Ib.c,a.pb+b)),y:Math.max(0,Math.min(a.yb.b-a.Ib.b,a.qb+c))};if(d){a.qb=b.y;a.pb=b.x}vb(a.Fa,-b.x,-b.y)}
function Rd(a){var b=document.createElement("div");C(b,"scroll-container");for(Ea&&a.setAttribute("onclick","void(0)");a.firstChild;)b.appendChild(a.firstChild);a.appendChild(b)};function Sd(a){this.C=G(a,"data-requires")?a.getAttribute("data-requires").split(" "):i;F("scroll",a).forEach(Rd);this.Sa=[];this.a=i;this.j=a.parentNode.innerHTML;this.size=new L(a);delete this.size.c;delete this.size.b;this.ya=i;this.o=k;this.h=this.tb=this.P=this.mb=this.n=this.lb=this.z=i;this.qa=k;this.kb=[];this.O=k;this.Oa=this.Pa=this.Ma=this.nextPage=this.Ta=this.Za=this.v=i}
Sd.prototype.M=function(){var a=[];if(!this.o){this.o=g;this.a=kb(this.j);this.z=F("viewer",this.a)[0];this.lb=Vb("pagenumber",i,this.a);this.n=Vb("pagecount",i,this.a);this.mb=F("pagewidth",this.a);this.Za=Vb("current-url",i,this.a);this.nextPage=F("next",this.a);this.Ma=F("nextArticle",this.a);this.Pa=F("prev",this.a);this.Oa=F("prevArticle",this.a);this.Sa=F("scroll",this.a).map(function(b){return new Od(b)});this.kb=F("menu",this.a);this.Ta=F("sidebar",this.a);a=Vb("toc",i,this.a);if(a.length>=
1){this.P=a[0];this.tb=this.P.cloneNode(g)}this.h=[];Td.forEach(function(b){N(document,b,this)},this);this.qa=k;Ud(this)}return this.a};Sd.prototype.A=function(){if(this.o){Vd(this);this.o=k;Td.forEach(function(a){Q(document,a,this)},this);this.Oa=this.Pa=this.Ma=this.nextPage=this.Ta=this.tb=this.P=this.Za=this.kb=this.mb=this.n=this.lb=this.z=this.a=i;this.h.forEach(function(a){a&&a.A()});this.ya=this.h=i}};function Vd(){ra("selectPages");ra("animatePages")}
var Td=["treesaver.tocupdated","treesaver.pageschanged","treesaver.articlechanged","keydown","click","mousewheel","DOMMouseScroll"];Ea?Td.push("touchstart","touchmove","touchend","touchcancel"):Td.push("mouseover");
Sd.prototype.handleEvent=function(a){switch(a.type){case "treesaver.pageschanged":return Wd(this);case "treesaver.tocupdated":oa(this.Gb,[],"updateTOC",this);return Wd(this);case "treesaver.articlechanged":Xd(this,a);return Yd(this,a);case "mouseover":a.touches||Ud(this);break;case "touchstart":return Zd(this,a);case "touchmove":if(this.e){a.stopPropagation();a.preventDefault();this.e.fb=m();this.e.$b=a.touches[0].pageX;this.e.ac=a.touches[0].pageY;this.e.Vb=this.e.fb-this.e.startTime;this.e.S=this.e.$b-
this.e.ic;this.e.Ha=this.e.ac-this.e.kc;this.e.ea=Math.min(a.touches.length,this.e.ea);this.e.rb=this.e.ea===1&&Math.abs(this.e.S)>=30;if(this.e.Ra)Qd(this.e.Ra,this.e.S,-this.e.Ha);else if(this.e.rb){this.B=this.e.S;$d(this,g)}else if(this.B){this.Va=m();$d(this,Za)}else if(this.e.ea===2)this.e.$a=a.touches[1].pageX-this.e.jc}break;case "touchend":var b=this.e,c=k;qa();this.e=i;if(b){a.stopPropagation();a.preventDefault();if(b.Ra&&b.fb)Qd(b.Ra,b.S,-b.Ha,g);else if(b.ea===1)if(b.fb){if(b.rb||b.Ha<=
-30)(c=b.rb&&b.S>0?Dd():Fd())?this.V():Ud(this)}else{b=ae(a.target);c=this.O||this.z.contains(b);var d=document.createEvent("MouseEvents");d.initMouseEvent("click",g,g,a.view,1,a.changedTouches[0].screenX,a.changedTouches[0].screenY,a.changedTouches[0].clientX,a.changedTouches[0].clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,0,i);if(b.dispatchEvent(d)&&c)this.qa?this.V():Ud(this);else c?this.V():Ud(this);c=g}else if(b.ea===2)if(Math.abs(b.$a)>=30){if(b.S<0&&b.$a<0)c=Gd();else if(b.S>0&&b.$a>0)c=
Ed();c?this.V():Ud(this)}if(!c){this.Va=m();this.B=0;$d(this,Za)}}break;case "touchcancel":qa();this.e=i;break;case "keydown":a:if(this.O){be(this);a.preventDefault()}else if(!ce(a)){switch(a.keyCode){case 34:case 39:case 40:case 74:case 32:Fd();break;case 33:case 37:case 38:case 75:Dd();break;case 72:Ed();break;case 76:Gd();break;default:c=void 0;break a}this.V();a.preventDefault()}return c;case "click":return this.click(a);case "mousewheel":case "DOMMouseScroll":if(ce(a))b=g;else if(this.O){be(this);
a.preventDefault()}else{c=m();if(!(this.Ab&&c-this.Ab<1500)){this.Ab=c;c=a.wheelDelta?a.wheelDelta:a.detail?-a.detail:0;d=this.z.contains(ae(a.target));if(c&&d){a.preventDefault();a.stopPropagation();c>0?Dd():Fd();this.V()}}}return b}};function ce(a){return a.ctrlKey||a.shiftKey||a.altKey||a.metaKey}
Sd.prototype.click=function(a){if(this.O){be(this);a.stopPropagation();a.preventDefault()}else{if(ce(a))return g;if(!("which"in a&&a.which!==1||a.button)){var b=ae(a.target),c,d=k,e=d=c=k,f=i;this.kb.forEach(function(h){if(E(h,"menu-active")){e=h.contains(b);eb(h,"menu-active")}},this);(d=this.Ta.some(function(h){return h.contains(b)}))||this.Ta.forEach(function(h){eb(h,"sidebar-active")},this);b=b;if(this.h[0]&&this.h[0].a.contains(b)){Dd();c=g}else if(this.h[2]&&this.h[2].a.contains(b)){Fd();c=
g}else for(d=this.h[1]&&this.h[1].a.contains(b);!c&&b&&b!==W;){if(d){if(E(b,"zoomable"))c=de(this,b)}else if(E(b,"prev")){Dd();c=g}else if(E(b,"next")){Fd();c=g}else if(E(b,"prevArticle")){Ed();c=g}else if(E(b,"nextArticle")){Gd();c=g}else if(E(b,"menu")){e||C(b,"menu-active");c=g}else if(E(b,"sidebar")||E(b,"open-sidebar")){(f=ee(this,b))&&!E(f,"sidebar-active")&&C(f,"sidebar-active");c=g}else if(E(b,"close-sidebar"))if((f=ee(this,b))&&E(f,"sidebar-active")){eb(f,"sidebar-active");c=g}if(!c&&b.href&&
b.nodeName.toLowerCase()!=="img"){if(b.getAttribute("target")==="lightbox"){b=b.parentNode;continue}c=B.Ea(b.href);if(!Ad(c))return;c=g}b=b.parentNode}if(c){a.stopPropagation();a.preventDefault()}}}};function ae(a){if(a){if(a.nodeType!==1&&a.parentNode)a=a.parentNode||W}else a=W;return a}
function Zd(a,b){if(W.contains(ae(b.target))){b.stopPropagation();b.preventDefault();if(a.O)be(a);else{a.e={startTime:m(),Vb:0,ic:b.touches[0].pageX,kc:b.touches[0].pageY,S:0,Ha:0,ea:b.touches.length};if(a.e.ea===2)a.e.jc=b.touches[1].pageX;a.Sa.forEach(function(c){if(c.contains(ae(b.target)))this.e.Ra=c},a);pa([],4E3)}}}function Ud(a){if(!a.qa){a.qa=g;C(a.a,"active");M(document,"treesaver.active")}var b=a.V,c=ga.idletimer;if(c)c.eb=m();else la(b,5E3,1,i,k,"idletimer",a)}
Sd.prototype.V=function(){if(this.qa){this.qa=k;eb(this.a,"active");M(document,"treesaver.idle")}ra("idletimer")};function ee(a,b){var c=b;if(E(c,"sidebar"))return c;for(;(c=c.parentNode)!==i&&c.nodeType===1;)if(E(c,"sidebar"))return c;return i}
function de(a,b){var c;c=parseInt(b.getAttribute("data-figureindex"),10);c=isNaN(c)?i:R.content.l[c];if(!c)return k;a.V();if(!a.O){var d=fe(),e=ge,f,h,o,l=i;f=0;for(h=e.length;f<h;f+=1){o=e[f];if(o.ca()&&o.Ja(d)){l=o;break}}a.v=l;if(!a.v)return k;a.O=g;a.v.M();a.a.parentNode.appendChild(a.v.a)}a.v.a=a.v.a;K(a.v.a,"width",J(a.a));K(a.v.a,"height",I(a.a));d=a.v;c=ac(c,{c:J(d.r),b:I(d.r)});e=J(d.r.offsetParent);f=I(d.r.offsetParent);d.r=d.r;if(d.o&&c){Mb(c.Ia,d.r,c.name);d.r.style.bottom="auto";d.r.style.right=
"auto";K(d.r,"left",(e-J(d.r))/2);K(d.r,"top",(f-I(d.r))/2);c=g}else c=k;if(!c){be(a);return k}return g}function be(a){if(a.O){a.O=k;a.a.parentNode.removeChild(a.v.a);a.v.A();a.v=i}}Sd.prototype.ca=function(){if(!this.C)return g;return db(this.C,g)};Sd.prototype.Ja=function(a){return sb(this.size,a)};function he(a){a.ya={c:J(a.z),b:I(a.z)}}function ie(a,b){K(a.a,"width",b.c);K(a.a,"height",b.b);a.ya=i;he(a);a.Sa.forEach(function(c){Pd(c)});if(R){Wd(a);oa(a.Gb,[],"updateTOC",a)}}
function Yd(a,b){a.Za.forEach(function(c){Qb({"current-url":b.url},c)})}function Xd(a){if(a.P){var b=hd||[],c=Vb("article",i,a.P),d=0;b.forEach(function(e,f){if(!e.sa.hidden&&c[d]){f===U?C(c[d],"current"):eb(c[d],"current");d+=1}});a.Sa.forEach(function(e){Pd(e)})}}function je(a,b){a.lb.forEach(function(c){Qb({pagenumber:b},c)})}function ke(a,b){a.n.forEach(function(c){Qb({pagecount:b},c)})}function le(a,b){b&&a.mb.forEach(function(c){K(c,"width",b)},a)}
function me(a,b,c){if(b.nodeName==="BUTTON")b.disabled=!c;else c?eb(b,"disabled"):C(b,"disabled")}function ne(a){if(a.nextPage){var b=T!==-1?T<R.n-1?g:R.J&&Hd():S===Eb?Hd():k;a.nextPage.forEach(function(c){me(this,c,b)},a)}}function oe(a){if(a.Ma){var b=Hd();a.Ma.forEach(function(c){me(this,c,b)},a)}}function pe(a){if(a.Pa){var b=T!==-1?T>=1?g:!!U:!S&&!!U;a.Pa.forEach(function(c){me(this,c,b)},a)}}function qe(a){if(a.Oa){var b=!!U;a.Oa.forEach(function(c){me(this,c,b)},a)}}
function Wd(a){oa(a.Fb,[],"selectPages",a)}
Sd.prototype.Fb=function(){Vd(this);var a=cd;re(this,a);var b=this.h[0],c=this.h[1],d=this.h[2],e,f=Math.max(c.size.marginRight,d?d.size.marginLeft:0),h=Math.max(c.size.marginLeft,b?b.size.marginRight:0),o=this.B;c.a.setAttribute("id","currentPage");e=(this.ya.c-c.size.oa)/2-f;c=e+c.size.oa+f+h;this.U=[];this.U[1]=e;if(b){this.U[0]=e-(b.size.oa+b.size.marginLeft);b.a.setAttribute("id","previousPage")}if(d){this.U[2]=c-d.size.marginLeft;d.a.setAttribute("id","nextPage")}if(a!==0){this.Va=m();this.B=
a===-1?d?this.U[1]-this.U[2]:0:b?this.U[1]-this.U[0]:0;if(o)this.B+=o}else if(!this.B)this.B=0;if(Za&&this.B)this.B=0;$d(this,Za);je(this,T+1||1);ke(this,R.n||1);le(this,dd);ne(this);oe(this);pe(this);qe(this)};
Sd.prototype.Gb=function(){ra("updateTOC");if(this.P){var a=hd||[],b=this.tb.cloneNode(g),c=this.P.parentNode;a=a.filter(function(d){return!d.sa.hidden});a=a.map(function(d){return{article:d.H}});Pb({toc:a},b);c.replaceChild(b,this.P);this.P=b;M(document,"treesaver.articlechanged",{Q:R,url:R.url,path:R.path})}};
function re(a,b){var c=a.h;a.h=Jd(a.ya,1);c.forEach(function(d){if(d)if(this.h.indexOf(d)===-1){d.a&&d.a.parentNode===this.z&&this.z.removeChild(d.a);d.A()}},a);a.h.forEach(function(d){if(d){d.a||d.M();if(d.a.parentNode!==this.z)b===-1?this.z.insertBefore(d.a,this.z.firstChild):this.z.appendChild(d.a)}},a)}
function $d(a,b){var c=a.B;if(!b){pa(["animatePages"],400);var d=m();c*=-Math.cos((!b?Math.max(0,(a.Va||0)+200-d)/200:1)*Math.PI)/2+0.5;if(Math.abs(c)<5){a.B=c=0;qa()}else oa(a.Fb,[],"animatePages",a)}a.h.forEach(function(e,f){e&&e.a&&wb(e.a,this.U[f]+c)},a)};function se(a){F("container",a);this.C=G(a,"data-requires")?a.getAttribute("data-requires").split(" "):i;this.j=a.parentNode.innerHTML;this.size=new L(a);delete this.size.c;delete this.size.b;this.o=k;this.r=this.a=i}se.prototype.M=function(){if(!this.o){this.o=g;this.a=kb(this.j);this.r=F("container",this.a)[0]}return this.a};se.prototype.A=function(){if(this.o){this.o=k;this.a=i}};se.prototype.Ja=function(a){return sb(this.size,a)};
se.prototype.ca=function(){if(!this.C)return g;return db(this.C,g)};var X,te,ge;function ue(){X={orientation:0,size:{c:0,b:0}};hb(W);X.ha=ve();X.Hb=we();te=xe();ge=ye();if(!te.length)return k;ze();na(ze,100,Infinity,[],"checkState");if(Da&&!Ae){N(window,"orientationchange",Be);ma(function(){window.scrollTo(0,1)},100)}return g}function ve(){if(Ae)return W;else{var a=document.createElement("div");a.setAttribute("id","chromeContainer");W.appendChild(a);return a}}
function we(){var a=gb("name","viewport","meta")[0];if(!a){a=document.createElement("meta");a.setAttribute("name","viewport");fb("head")[0].appendChild(a)}return a}function xe(){var a=[];Sc("chrome").forEach(function(b){var c;c=b.getAttribute("data-requires");if(!(c&&!db(c.split(" ")))){X.ha.appendChild(b);c=new Sd(b);a.push(c);X.ha.removeChild(b)}});return a}
function ye(){var a=[];Sc("lightbox").forEach(function(b){var c;c=b.getAttribute("data-requires");if(!(c&&!db(c.split(" ")))){X.ha.appendChild(b);c=new se(b);a.push(c);X.ha.removeChild(b)}});return a}function Be(){if(X.orientation!==window.orientation){ab();X.orientation=window.orientation;X.orientation%180?X.Hb.setAttribute("content","width=device-height, height=device-width"):X.Hb.setAttribute("content","width=device-width, height=device-height");window.scrollTo(0,1)}}
function fe(){if(Ae)return{c:J(W),b:I(W)};else{if(window.pageYOffset||window.pageXOffset)window.scrollTo(0,1);return"innerWidth"in window?{c:window.innerWidth,b:window.innerHeight}:{c:document.documentElement.clientWidth,b:document.documentElement.clientHeight}}}
function ze(){var a=fe(),b;if(a.b!==X.size.b||a.c!==X.size.c){X.size=a;if(!X.R||!X.R.ca()||!X.R.Ja(a)){b=te;var c,d,e,f=i;c=0;for(d=b.length;c<d;c+=1){e=b[c];if(e.ca()&&e.Ja(a)){f=e;break}}b=f;if(!b)return;hb(X.ha);X.R&&X.R.A();X.ha.appendChild(b.M());X.R=b}ie(X.R,a)}};function td(){Q(window,"unload",td);zd();Da&&!Ae&&Q(window,"orientationchange",Be);X.R&&X.R.A();ge=te=X=i;Ce()};var Y={};Y.ja={Ua:"treesaver.ready"};Y.gc=function(){return Y.ab};Y.loaded=function(){return Y.Wb};Y.ab=k;Y.Wb=k;Y.Qa=function(){if(!Y.ab)if(document.body){Y.ab=g;Q(document,"DOMContentLoaded",Y);Q(document,"readystatechange",Y);Q(window,"load",Y);delete Y.bb;M(document,Y.ja.Ua)}else oa(Y.Qa)};Y.nb=function(){if("readyState"in document)/complete|loaded/.test(document.readyState)&&Y.Qa();else{var a=document.getElementsByTagName("*").length;if(Y.bb)a===Y.bb&&Y.Qa();else{Y.bb=a;ma(Y.nb,100)}}};
Y.handleEvent=function(a){/load|DOMContentLoaded/.test(a.type)?Y.Qa():Y.nb()};N(document,"DOMContentLoaded",Y);N(document,"readystatechange",Y);N(window,"load",Y);Y.nb();var De={"treesaver-init":{target:"treesaver-init-0.9.2.js",src:"init.js"},"treesaver-core":{target:"treesaver-core-0.9.2.js",src:"core.js"}};De.ta=function(a){return De[a].target};De.ta("treesaver-init");var W,Ae,Ee,Fe,Ge,He;function Ce(){if(Ae)W.innerHTML=Ge;else if(Ee)W.innerHTML=Ee;Ie();ka();Oc=i;Mc=0;Nc=[];B.oc();document.documentElement.className="js no-treesaver";document.documentElement.style.display="block"}function Ie(){ra("unboot");Q(document,Y.ja.Ua,Je);delete Fe;delete He}
function Je(){He=g;if(W=document.getElementById("ts_container")){Ae=g;Ge=W.innerHTML}else{Ae=k;W=document.body}Ee=document.body.innerHTML;hb(W);W.innerHTML='<div id="loading">Loading '+document.title+"...</div>";document.documentElement.style.display="block";Ke()}function Ke(){if(Fe)if(He)if(document.body){Ie();N(window,"unload",td);ue()&&pd(Ee)||td()}};var Le,Me="pushState"in window.history;function Ne(){var a=document.location.href.indexOf("#");return a===-1?"":document.location.href.substr(a+1)}if(document.location.hash){var Oe=Ne();Oe.charAt(0)==="-"&&Oe.length>=2&&document.location.replace(Oe.substr(1))}function Nd(a,b,c){window.history.pushState(a,b,c)}function Md(a,b,c){window.history.replaceState(a,b,c)}
if(!Me){Nd=function(a,b,c){Pe(a,b,c,k)};Md=function(a,b,c){Pe(a,b,c,g)};var Qe=function(a){document.location.hash="#"+a},Re=function(a){document.location.replace("#"+a)},Pe=function(a,b,c,d){var e="-"+window.escape(c);Vc("history:"+e,{lc:a,title:b});if(c===document.location.pathname)e="";Le=e;d?Re(e):Qe(e)},Se=function(){var a=Ne();if(a!==Le){a=(Le=a)?Wc("history:"+a):{};"onpopstate"in window&&typeof window.onpopstate==="function"&&window.onpopstate.apply(window,[{state:a?a.lc:i}])}},Te=function(){return Ne()!==
Le};if("onhashchange"in window&&!va)window.onhashchange=Se;else{na(function(){Te()&&Se()},100,Infinity);if(za==="msie"){var Ue=document.createElement("iframe");document.documentElement.appendChild(Ue);Te=function(){var a=Ue.contentWindow.document.body.innerHTML;if(a!==Le){document.location.hash="#"+(a||"");return g}};Re=function(a){var b=Ue.contentWindow.document;if(a!==b.body.innerHTML)b.body.innerHTML=a;document.location.replace("#"+a)};Qe=function(a){var b=Ue.contentWindow.document;b.open();b.write("<html><body>"+
a+"</body></html>");b.close();document.location.hash="#"+a}}}};eval("/*@cc_on (function(a,b,c){while(b--)a.createElement(c[b])})(document,21,['abbr','article','aside','audio','canvas','details','figcaption','figure','footer','header','hgroup','mark','menu','meter','nav','output','progress','section','summary','time','video'])@*/");/*
Copyright 2011 Filipe Fortes ( www.fortes.com ).
Version: 0.1.
Licensed under MIT and GPLv2.
*/
if(ua){document.documentElement.style.display="none";B.load();ab();var Ve=function(){Fe=g;Ke()},We;a:{var Xe=document.getElementsByTagName("link"),Ye,Ze=Xe.length;for(Ye=0;Ye<Ze;Ye+=1)if(Xe[Ye].rel.toLowerCase().indexOf("resources")!==-1){We=Xe[Ye].getAttribute("href");break a}We=i}if(We)if(Mc)Mc===Rc?Ve():Nc.push(Ve);else{Mc=1;Nc=[Ve];B.ta(We,Pc)}else Ve();Y.gc()?Je():N(document,Y.ja.Ua,Je);ma(Ce,5E3,[],"unboot")}ca("treesaver.VERSION","0.9.2-9-g8dccfe7",void 0);}());