UNPKG

575 kBJavaScriptView Raw
1var t,e,n,i,r=(t=require("fast-diff"))&&"object"==typeof t&&"default"in t?t.default:t;function o(t){exports.isDebug=t}function a(t){switch(t){case"ltr":return exports.PageProgression.LTR;case"rtl":return exports.PageProgression.RTL;default:throw new Error("unknown PageProgression: "+t)}}function s(t){var e=Array.from(t),n=null;return e[0]instanceof Error&&(n=e.shift()),{error:n,messages:e}}function l(t){var e=t.error,n=e&&(e.frameTrace||e.stack),i=[].concat(t.messages);return e&&(i.length>0&&(i=i.concat(["\n"])),i=i.concat([e.toString()]),n&&(i=i.concat(["\n"]).concat(n))),i}exports.isDebug=!1,function(t){t.LTR="ltr",t.RTL="rtl"}(exports.PageProgression||(exports.PageProgression={})),(e=exports.PageSide||(exports.PageSide={})).LEFT="left",e.RIGHT="right",(n=exports.ReadyState||(exports.ReadyState={})).LOADING="loading",n.INTERACTIVE="interactive",n.COMPLETE="complete",function(t){t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR"}(i||(i={}));var u,h=new(function(){function t(t){this.opt_console=t,this.listeners={}}var e=t.prototype;return e.consoleDebug=function(t){var e,n,i;this.opt_console?this.opt_console.debug?(e=this.opt_console).debug.apply(e,t):(n=this.opt_console).log.apply(n,t):(i=console).debug.apply(i,t)},e.consoleInfo=function(t){var e,n,i;this.opt_console?this.opt_console.info?(e=this.opt_console).info.apply(e,t):(n=this.opt_console).log.apply(n,t):(i=console).info.apply(i,t)},e.consoleWarn=function(t){var e,n,i;this.opt_console?this.opt_console.warn?(e=this.opt_console).warn.apply(e,t):(n=this.opt_console).log.apply(n,t):(i=console).warn.apply(i,t)},e.consoleError=function(t){var e,n,i;this.opt_console?this.opt_console.error?(e=this.opt_console).error.apply(e,t):(n=this.opt_console).log.apply(n,t):(i=console).error.apply(i,t)},e.triggerListeners=function(t,e){var n=this.listeners[t];n&&n.forEach(function(t){t(e)})},e.addListener=function(t,e){var n=this.listeners[t];n||(n=this.listeners[t]=[]),n.push(e)},e.debug=function(){var t=s(arguments);this.consoleDebug(l(t)),this.triggerListeners(i.DEBUG,t)},e.info=function(){var t=s(arguments);this.consoleInfo(l(t)),this.triggerListeners(i.INFO,t)},e.warn=function(){var t=s(arguments);this.consoleWarn(l(t)),this.triggerListeners(i.WARN,t)},e.error=function(){var t=s(arguments);this.consoleError(l(t)),this.triggerListeners(i.ERROR,t)},t}());(u=exports.HOOKS||(exports.HOOKS={})).SIMPLE_PROPERTY="SIMPLE_PROPERTY",u.PREPROCESS_SINGLE_DOCUMENT="PREPROCESS_SINGLE_DOCUMENT",u.PREPROCESS_TEXT_CONTENT="PREPROCESS_TEXT_CONTENT",u.PREPROCESS_ELEMENT_STYLE="PREPROCESS_ELEMENT_STYLE",u.POLYFILLED_INHERITED_PROPS="POLYFILLED_INHERITED_PROPS",u.CONFIGURATION="CONFIGURATION",u.RESOLVE_TEXT_NODE_BREAKER="RESOLVE_TEXT_NODE_BREAKER",u.RESOLVE_FORMATTING_CONTEXT="RESOLVE_FORMATTING_CONTEXT",u.RESOLVE_LAYOUT_PROCESSOR="RESOLVE_LAYOUT_PROCESSOR",u.POST_LAYOUT_BLOCK="POST_LAYOUT_BLOCK";var c={};function f(t,e){if(exports.HOOKS[t]){var n=c[t];n||(n=c[t]=[]),n.push(e)}else h.warn(new Error("Skipping unknown plugin hook '"+t+"'."))}function d(t,e){if(exports.HOOKS[t]){var n=c[t];if(n){var i=n.indexOf(e);i>=0&&n.splice(i,1)}}else h.warn(new Error("Ignoring unknown plugin hook '"+t+"'."))}function p(t){return c[t]||[]}var g={registerHook:f,removeHook:d},m=function(){function t(t){this.performanceInstance=t,this.timestamps={},this.registerTiming=v,this.registerStartTiming=this.registerStartTiming=v,this.registerEndTiming=this.registerEndTiming=v}var e=t.prototype;return e.forceRegisterStartTiming=function(t,e){E.call(this,t,"start",e)},e.forceRegisterEndTiming=function(t,e){E.call(this,t,"end",e)},e.printTimings=function(){var t=this.timestamps,e="";Object.keys(t).forEach(function(n){for(var i=t[n],r=i.length,o=0;o<r;o++){var a=i[o];e+=n,r>1&&(e+="("+o+")"),e+=" => start: "+a.start+", end: "+a.end+", duration: "+(a.end-a.start)+"\n"}}),h.info(e)},e.disable=function(){this.registerTiming=v,this.registerStartTiming=this.registerStartTiming=v,this.registerEndTiming=this.registerEndTiming=v},e.enable=function(){this.registerTiming=E,this.registerStartTiming=this.registerStartTiming=w,this.registerEndTiming=this.registerEndTiming=y},e.isEnabled=function(){return this.registerStartTiming===w},t}();function v(){}function E(t,e,n){n||(n=this.performanceInstance.now());var i,r=this.timestamps[t];r||(r=this.timestamps[t]=[]);for(var o=r.length-1;o>=0&&(!(i=r[o])||i[e]);o--)i=null;i||r.push(i={}),i[e]=n}function w(t,e){this.registerTiming(t,"start",e)}function y(t,e){this.registerTiming(t,"end",e)}var N={now:Date.now},b=new m(window&&window.performance||N);b.forceRegisterStartTiming("load_vivliostyle");var S={profiler:{registerStartTiming:b.registerStartTiming,registerEndTiming:b.registerEndTiming,printTimings:b.printTimings,disable:b.disable,enable:b.enable}};function C(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function T(t,e,n){return e&&C(t.prototype,e),n&&C(t,n),t}function x(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function I(t){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function P(t,e){return(P=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function A(t,e,n){return(A=R()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&P(r,n.prototype),r}).apply(null,arguments)}function L(t){var e="function"==typeof Map?new Map:void 0;return(L=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return A(t,arguments,I(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),P(n,t)})(t)}function O(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function D(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return k(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}var F={};function _(t){return JSON.parse(t)}function B(t){var e=t.match(/^([^#]*)/);return e?e[1]:t}var M=window.location.href;function U(t){M=t}var V,H=window.location.href;function z(t){H=t}function G(t,e){if(/^data:/i.test(e))return t||e;if(!e||t.match(/^\w{2,}:/))return t.toLowerCase().match("^javascript:")?"#":(t.match(/^\w{2,}:\/\/[^\/]+$/)&&(t+="/"),t);var n;if(e.match(/^\w{2,}:\/\/[^\/]+$/)&&(e+="/"),t.match(/^\/\//))return(n=e.match(/^(\w{2,}:)\/\//))?n[1]+t:t;if(t.match(/^\//))return(n=e.match(/^(\w{2,}:\/\/[^\/]+)\//))?n[1]+t:t;if(t.match(/^\.(\/|$)/)&&(t=t.substr(2)),e=function(t){var e=t.match(/^([^#?]*)/);return e?e[1]:t}(e),t.match(/^#/))return e+t;var i=e.lastIndexOf("/");if(i<0)return t;if(i<e.length-1&&e.lastIndexOf(".")<i){if(""==t)return e;i=(e+="/").length-1}var r=e.substr(0,i+1)+t,o="";for((n=r.match(/^([^?#]*)([?#].*)$/))&&(r=n[1],o=n[2]);!((i=r.indexOf("/../"))<=0);){var a=r.lastIndexOf("/",i-1);if(a<=0)break;r=r.substr(0,a)+r.substr(i+3)}return r.replace(/\/(\.\/)+/g,"/")+o}function W(t){var e;return(e=/^(https?:)\/\/github\.com\/([^/]+\/[^/]+)\/(blob\/|tree\/|raw\/)?(.*)$/.exec(t))?t=e[1]+"//raw.githubusercontent.com/"+e[2]+"/"+(e[3]?"":"master/")+e[4]:(e=/^(https?:)\/\/www\.aozora\.gr\.jp\/(cards\/[^/]+\/files\/[^/.]+\.html)$/.exec(t))?t=e[1]+"//raw.githubusercontent.com/aozorabunko/aozorabunko/master/"+e[2]:(e=/^(https?:)\/\/gist\.github\.com\/([^/]+\/\w+)(\/|$)(raw(\/|$))?(.*)$/.exec(t))?t=e[1]+"//gist.githubusercontent.com/"+e[2]+"/raw/"+e[6]:(e=/^(https?:)\/\/(?:[^/.]+\.)?jsbin\.com\/(?!(?:blog|help)\b)(\w+)((\/\d+)?).*$/.exec(t))&&(t=e[1]+"//output.jsbin.com/"+e[2]+e[3]+"/"),t}function X(t){return null==t?t:t.toString()}!function(t){t.epub="http://www.idpf.org/2007/ops",t.EV="http://www.w3.org/2001/xml-events",t.MATHML="http://www.w3.org/1998/Math/MathML",t.XML="http://www.w3.org/XML/1998/namespace",t.XHTML="http://www.w3.org/1999/xhtml",t.XLINK="http://www.w3.org/1999/xlink",t.SHADOW="http://www.pyroxy.com/ns/shadow",t.SVG="http://www.w3.org/2000/svg",t.DC="http://purl.org/dc/elements/1.1/",t.NCX="http://www.daisy.org/z3986/2005/ncx/"}(V||(V={}));var j=function(){function t(){this.queue=[null]}var e=t.prototype;return e.length=function(){return this.queue.length-1},e.add=function(t){for(var e=this.queue.length;e>1;){var n=Math.floor(e/2),i=this.queue[n];if(i.compare(t)>0)return void(this.queue[e]=t);this.queue[e]=i,e=n}this.queue[1]=t},e.peek=function(){return this.queue[1]},e.remove=function(){var t=this.queue[1],e=this.queue.pop(),n=this.queue.length;if(n>1){for(var i=1;;){var r=2*i;if(r>=n)break;if(this.queue[r].compare(e)>0)r+1<n&&this.queue[r+1].compare(this.queue[r])>0&&r++;else{if(!(r+1<n&&this.queue[r+1].compare(e)>0))break;r++}this.queue[i]=this.queue[r],i=r}this.queue[i]=e}return t},t}(),Y=["","-webkit-","-moz-","-ms-","-o-","-epub-"],K={};function q(t,e){if("writing-mode"===e){var n=document.createElement("span");return"-ms-"===t?(n.style.setProperty(t+e,"tb-rl"),"tb-rl"===n.style["writing-mode"]):(n.style.setProperty(t+e,"vertical-rl"),"vertical-rl"===n.style[t+e])}return"string"==typeof document.documentElement.style[function(t,e){return t&&(e="-"+e,"moz"===(t=t.replace(/-/g,""))&&(t="Moz")),t+e.replace(/-[a-z]/g,function(t){return t.substr(1).toUpperCase()})}(t,e)]}function Q(t){var e=K[t];if(e||null===e)return e;switch(t){case"text-combine-upright":if(q("-webkit-","text-combine")&&!q("","text-combine-upright"))return K[t]=["-webkit-text-combine"],["-webkit-text-combine"];break;case"writing-mode":if(q("-ms-","writing-mode"))return K[t]=["-ms-writing-mode"],["-ms-writing-mode"];break;case"filter":if(q("-webkit-","filter"))return K[t]=["-webkit-filter"],["-webkit-filter"];break;case"clip-path":if(q("-webkit-","clip-path"))return K[t]=["-webkit-clip-path","clip-path"];break;case"margin-inline-start":if(q("-webkit-","margin-start"))return K[t]=["-webkit-margin-start"],["-webkit-margin-start"];break;case"margin-inline-end":if(q("-webkit-","margin-end"))return K[t]=["-webkit-margin-end"],["-webkit-margin-end"];break;case"padding-inline-start":if(q("-webkit-","padding-start"))return K[t]=["-webkit-padding-start"],["-webkit-padding-start"];break;case"padding-inline-end":if(q("-webkit-","padding-end"))return K[t]=["-webkit-padding-end"],["-webkit-padding-end"]}for(var n,i=D(Y);!(n=i()).done;){var r=n.value;if(q(r,t))return K[t]=[e=r+t],[e]}return h.warn("Property not supported by the browser: ",t),K[t]=null,null}function Z(t,e,n){try{var i=Q(e);if(!i)return;i.forEach(function(e){if("-ms-writing-mode"===e)switch(n){case"horizontal-tb":n="lr-tb";break;case"vertical-rl":n="tb-rl";break;case"vertical-lr":n="tb-lr"}else if("-webkit-text-combine"===e)switch(n){case"all":n="horizontal"}t&&t.style&&t.style.setProperty(e,n)})}catch(t){h.warn(t)}}function $(t,e,n){try{var i=K[e];return t.style.getPropertyValue(i?i[0]:e)}catch(t){}return n||""}function J(t){var e=t.getAttributeNS(V.XML,"lang");return e||t.namespaceURI!=V.XHTML||(e=t.getAttribute("lang")),e}var tt=function(){function t(){this.list=[]}var e=t.prototype;return e.append=function(t){return this.list.push(t),this},e.clear=function(){this.list=[]},e.toString=function(){var t=this.list.join("");return this.list=[t],t},t}();function et(t){return"\\"+t.charCodeAt(0).toString(16)+" "}function nt(t){return t.replace(/[^-_a-zA-Z0-9\u0080-\uFFFF]/g,et)}function it(t){return t.replace(/[\u0000-\u001F"\\]/g,et)}function rt(t){return t.replace(/[\s+&?=#\u007F-\uFFFF]+/g,encodeURIComponent)}function ot(t){return!!t.match(/^[a-zA-Z\u009E\u009F\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u024F\u037B-\u037D\u0386\u0388-\u0482\u048A-\u0527]$/)}function at(t,e){return t.replace(/[^-a-zA-Z0-9_]/g,function(t){return function(t,e){return(e="string"==typeof e?e:"\\u")+(65536|t.charCodeAt(0)).toString(16).substr(1)}(t,e)})}function st(t){return at(t)}function lt(t,e){for(var n=0,i=t;;){if(0==n||e(n-1),i==t||e(i),n==i)return n;var r=n+i>>1;e(r)?i=r:n=r+1}}function ut(t,e){return t-e}function ht(t,e){for(var n,i={},r=D(t);!(n=r()).done;){var o=n.value,a=e(o);a&&!i[a]&&(i[a]=o)}return i}function ct(t,e){for(var n,i={},r=D(t);!(n=r()).done;){var o=n.value,a=e(o);a&&(i[a]?i[a].push(o):i[a]=[o])}return i}var ft=function(){function t(){this.listeners={}}var e=t.prototype;return e.dispatchEvent=function(t){var e=this.listeners[t.type];if(e){t.target=this,t.currentTarget=this;for(var n=0;n<e.length;n++)e[n](t)}},e.addEventListener=function(t,e,n){if(!n){var i=this.listeners[t];i?i.push(e):this.listeners[t]=[e]}},e.removeEventListener=function(t,e,n){if(!n){var i=this.listeners[t];if(i){var r=i.indexOf(e);r>=0&&i.splice(r,1)}}},t}(),dt=null,pt=null,gt=null,mt=null;function vt(t){if(1==t.nodeType){var e=t.getAttribute("id");if(e)return e}return null}function Et(t){return"^"+t}function wt(t){return t.replace(/[\[\]\(\),=;^]/g,Et)}function yt(t){return t.substr(1)}function Nt(t){return t?t.replace(/\^[\[\]\(\),=;^]/g,yt):t}function bt(t){var e=[];do{var n=t.match(/^(\^,|[^,])*/),i=Nt(n[0]);if(!(t=t.substr(n[0].length+1))&&!e.length)return i;e.push(i)}while(t);return e}function St(t){for(var e={};t;){var n=t.match(/^;([^;=]+)=(([^;]|\^;)*)/);if(!n)return e;e[n[1]]=bt(n[2]),t=t.substr(n[0].length)}return e}var Ct=function(){function t(){}var e=t.prototype;return e.appendTo=function(t){t.append("!")},e.applyTo=function(t){return!1},t}(),Tt=function(){function t(t,e,n){this.index=t,this.id=e,this.sideBias=n}var e=t.prototype;return e.appendTo=function(t){t.append("/"),t.append(this.index.toString()),(this.id||this.sideBias)&&(t.append("["),this.id&&t.append(this.id),this.sideBias&&(t.append(";s="),t.append(this.sideBias)),t.append("]"))},e.applyTo=function(t){if(1!=t.node.nodeType)throw new Error("E_CFI_NOT_ELEMENT");var e,n=t.node,i=n.children,r=i.length,o=Math.floor(this.index/2)-1;if(o<0||0==r)t.node=(e=n.firstChild)||n;else{if(e=i[Math.min(o,r-1)],1&this.index){var a=e.nextSibling;a&&1!=a.nodeType?e=a:t.after=!0}t.node=e}if(this.id&&(t.after||this.id!=vt(t.node)))throw new Error("E_CFI_ID_MISMATCH");return t.sideBias=this.sideBias,!0},t}(),xt=function(){function t(t,e,n,i){this.offset=t,this.textBefore=e,this.textAfter=n,this.sideBias=i}var e=t.prototype;return e.applyTo=function(t){if(this.offset>0&&!t.after){for(var e=this.offset,n=t.node;;){var i=n.nodeType;if(1==i)break;var r=n.nextSibling;if(3<=i&&i<=5){var o=n.textContent.length;if(e<=o)break;if(!r){e=o;break}e-=o}if(!r){e=0;break}n=r}t.node=n,t.offset=e}return t.sideBias=this.sideBias,!0},e.appendTo=function(t){t.append(":"),t.append(this.offset.toString()),(this.textBefore||this.textAfter||this.sideBias)&&(t.append("["),(this.textBefore||this.textAfter)&&(this.textBefore&&t.append(wt(this.textBefore)),t.append(","),this.textAfter&&t.append(wt(this.textAfter))),this.sideBias&&(t.append(";s="),t.append(this.sideBias)),t.append("]"))},t}(),It=function(){function t(){this.steps=null}var e=t.prototype;return e.fromString=function(t){var e=t.match(/^#?epubcfi\((.*)\)$/);if(!e)throw new Error("E_CFI_NOT_CFI");for(var n=decodeURIComponent(e[1]),i=0,r=[];;){var o=void 0;switch(n.charAt(i)){case"/":if(i++,!(e=n.substr(i).match(/^(0|[1-9][0-9]*)(\[(.*?)(;([^\]]|\^\])*)?\])?/)))throw new Error("E_CFI_NUMBER_EXPECTED");i+=e[0].length;var a=parseInt(e[1],10),s=e[3];o=St(e[4]),r.push(new Tt(a,s,X(o.s)));break;case":":if(i++,!(e=n.substr(i).match(/^(0|[1-9][0-9]*)(\[((([^\];,]|\^[\];,])*)(,(([^\];,]|\^[\];,])*))?)(;([^]]|\^\])*)?\])?/)))throw new Error("E_CFI_NUMBER_EXPECTED");i+=e[0].length;var l=parseInt(e[1],10),u=e[4];u&&(u=Nt(u));var h=e[7];h&&(h=Nt(h)),o=St(e[10]),r.push(new xt(l,u,h,X(o.s)));break;case"!":i++,r.push(new Ct);break;case"~":case"@":case"":return void(this.steps=r);default:throw new Error("E_CFI_PARSE_ERROR")}}},e.navigate=function(e){for(var n={node:e.documentElement,offset:0,after:!1,sideBias:null,ref:null},i=0;i<this.steps.length;i++)if(!this.steps[i].applyTo(n)){n.ref=new t,n.ref.steps=this.steps.slice(i+1);break}return n},e.trim=function(t,e){return t.replace(/\s+/g," ").match(e?/^[ -\uD7FF\uE000-\uFFFF]{0,8}/:/[ -\uD7FF\uE000-\uFFFF]{0,8}$/)[0].replace(/^\s/,"").replace(/\s$/,"")},e.prependPathFromNode=function(t,e,n,i){for(var r=[],o=t.parentNode,a="",s="";t;){switch(t.nodeType){case 3:case 4:case 5:var l=t.textContent,u=l.length;n?(e+=u,a||(a=l)):(e>u&&(e=u),n=!0,a=l.substr(0,e),s=l.substr(e)),t=t.previousSibling;continue;case 8:t=t.previousSibling;continue}break}for((e>0||a||s)&&(a=this.trim(a,!1),s=this.trim(s,!0),r.push(new xt(e,a,s,i)),i=null);o&&o&&9!=o.nodeType;){for(var h=n?null:vt(t),c=n?1:0;t;)1==t.nodeType&&(c+=2),t=t.previousSibling;r.push(new Tt(c,h,i)),i=null,t=o,o=o.parentNode,n=!1}r.reverse(),this.steps?(r.push(new Ct),this.steps=r.concat(this.steps)):this.steps=r},e.toString=function(){if(!this.steps)return"";var t=new tt;t.append("epubcfi(");for(var e=0;e<this.steps.length;e++)this.steps[e].appendTo(t);return t.append(")"),t.toString().replace(/%/g,"%25")},t}();function Pt(t){return{fontFamily:t.fontFamily,lineHeight:t.lineHeight,margin:t.margin,hyphenate:t.hyphenate,columnWidth:t.columnWidth,horizontal:t.horizontal,nightMode:t.nightMode,spreadView:t.spreadView,pageBorder:t.pageBorder,enabledMediaTypes:Object.assign({},t.enabledMediaTypes),defaultPaperSize:t.defaultPaperSize?Object.assign({},t.defaultPaperSize):void 0}}var Rt={fontFamily:"serif",lineHeight:1.25,margin:8,hyphenate:!1,columnWidth:25,horizontal:!1,nightMode:!1,spreadView:!1,pageBorder:1,enabledMediaTypes:{vivliostyle:!0,print:!0},defaultPaperSize:void 0},At={};function Lt(t,e,n,i){var r=Math.min((t-0)/n,(e-0)/i);return"matrix("+r+",0,0,"+r+",0,0)"}function Ot(t){return'"'+it(""+t)+'"'}function kt(t){return nt(""+t)}function Dt(t,e){return t?nt(t)+"."+nt(e):nt(e)}var Ft=0,_t=function(){function t(t,e){if(this.parent=t,this.resolver=e,this.children=[],this.values={},this.funcs={},this.builtIns={},this.scopeKey="S"+Ft++,this.zero=new ve(this,0),this.one=new ve(this,1),this._true=new ve(this,!0),this._false=new ve(this,!1),t&&t.children.push(this),!t){var n=this.builtIns;n.floor=Math.floor,n.ceil=Math.ceil,n.round=Math.round,n.sqrt=Math.sqrt,n.min=Math.min,n.max=Math.max,n.letterbox=Lt,n["css-string"]=Ot,n["css-name"]=kt,n.typeof=function(t){return typeof t},this.defineBuiltInName("page-width",function(){return this.pageWidth()}),this.defineBuiltInName("page-height",function(){return this.pageHeight()}),this.defineBuiltInName("pref-font-family",function(){return this.pref.fontFamily}),this.defineBuiltInName("pref-night-mode",function(){return this.pref.nightMode}),this.defineBuiltInName("pref-hyphenate",function(){return this.pref.hyphenate}),this.defineBuiltInName("pref-margin",function(){return this.pref.margin}),this.defineBuiltInName("pref-line-height",function(){return this.pref.lineHeight}),this.defineBuiltInName("pref-column-width",function(){return this.pref.columnWidth*this.fontSize}),this.defineBuiltInName("pref-horizontal",function(){return this.pref.horizontal}),this.defineBuiltInName("pref-spread-view",function(){return this.pref.spreadView}),this.defineBuiltInName("pub-title",function(){return Ot(this.pubTitle?this.pubTitle:"")}),this.defineBuiltInName("doc-title",function(){return Ot(this.docTitle?this.docTitle:"")})}}var e=t.prototype;return e.defineBuiltInName=function(t,e){this.values[t]=new pe(this,e,t)},e.defineName=function(t,e){this.values[t]=e},e.defineFunc=function(t,e){this.funcs[t]=e},e.defineBuiltIn=function(t,e){this.builtIns[t]=e},t}();function Bt(t){switch(t.toLowerCase()){case"vw":case"vh":case"vi":case"vb":case"vmin":case"vmax":case"pvw":case"pvh":case"pvi":case"pvb":case"pvmin":case"pvmax":return!0;default:return!1}}var Mt={px:1,in:96,pt:4/3,pc:16,cm:96/2.54,mm:96/25.4,q:96/2.54/40,em:16,rem:16,ex:8,dppx:1,dpi:1/96,dpcm:2.54/96};function Ut(t){switch(t){case"q":case"rem":return!0;default:return!1}}var Vt=function(){function t(t,e,n,i){this.rootScope=t,this.viewportWidth=e,this.viewportHeight=n,this.actualPageWidth=null,this.actualPageHeight=null,this.rootFontSize=null,this.scopes={},this.pageAreaWidth=null,this.pageAreaHeight=null,this.pageVertical=null,this.pubTitle=null,this.docTitle=null,this.pageWidth=function(){return this.actualPageWidth?this.actualPageWidth:this.pref.spreadView?Math.floor(e/2)-this.pref.pageBorder:e},this.pageHeight=function(){return this.actualPageHeight?this.actualPageHeight:n},this.initialFontSize=i,this.fontSize=function(){return this.rootFontSize?this.rootFontSize:i},this.pref=Rt}var e=t.prototype;return e.getScopeContext=function(t){var e=this.scopes[t.scopeKey];return e||(this.scopes[t.scopeKey]=e={}),e},e.clearScope=function(t){this.scopes[t.scopeKey]={};for(var e=0;e<t.children.length;e++)this.clearScope(t.children[e])},e.queryUnitSize=function(t,e){if(Bt(t)){var n=this.pageWidth()/100,i=this.pageHeight()/100,r=null!=this.pageAreaWidth?this.pageAreaWidth/100:n,o=null!=this.pageAreaHeight?this.pageAreaHeight/100:i;switch(t){case"vw":return r;case"vh":return o;case"vi":return this.pageVertical?o:r;case"vb":return this.pageVertical?r:o;case"vmin":return r<o?r:o;case"vmax":return r>o?r:o;case"pvw":return n;case"pvh":return i;case"pvi":return this.pageVertical?i:n;case"pvb":return this.pageVertical?n:i;case"pvmin":return n<i?n:i;case"pvmax":return n>i?n:i}}return"em"==t||"rem"==t?e?this.initialFontSize:this.fontSize():"ex"==t?Mt.ex*(e?this.initialFontSize:this.fontSize())/Mt.em:Mt[t]},e.evalName=function(t,e){do{var n=t.values[e];if(n)return n;if(t.resolver&&(n=t.resolver.call(this,e,!1)))return n;t=t.parent}while(t);throw new Error("Name '"+e+"' is undefined")},e.evalCall=function(t,e,n,i){do{var r=t.funcs[e];if(r)return r;if(t.resolver&&(r=t.resolver.call(this,e,!0)))return r;var o=t.builtIns[e];if(o){if(i)return t.zero;for(var a=Array(n.length),s=0;s<n.length;s++)a[s]=n[s].evaluate(this);return new ve(t,o.apply(this,a))}t=t.parent}while(t);throw new Error("Function '"+e+"' is undefined")},e.evalMediaName=function(t,e){var n="all"===t||!!this.pref.enabledMediaTypes[t];return e?!n:n},e.evalMediaTest=function(t,e){var n="",i=t.match(/^(min|max)-(.*)$/);i&&(n=i[1],t=i[2]);var r=null,o=null;switch(t){case"width":case"height":case"device-width":case"device-height":case"color":e&&(r=e.evaluate(this))}switch(t){case"width":o=this.pageWidth();break;case"height":o=this.pageHeight();break;case"device-width":o=window.screen.availWidth;break;case"device-height":o=window.screen.availHeight;break;case"color":o=window.screen.pixelDepth}if(null!=o&&null!=r)switch(n){case"min":return o>=r;case"max":return o<=r;default:return o==r}else if(null!=o&&null==e)return 0!==o;return!1},e.queryVal=function(t,e){var n=this.scopes[t.scopeKey];return n?n[e]:void 0},e.storeVal=function(t,e,n){this.getScopeContext(t)[e]=n},t}(),Ht=function(){function t(t){this.scope=t,this.scope=t,this.key="_"+Ft++}var e=t.prototype;return e.toString=function(){var t=new tt;return this.appendTo(t,0),t.toString()},e.appendTo=function(t,e){throw new Error("F_ABSTRACT")},e.evaluateCore=function(t){throw new Error("F_ABSTRACT")},e.expand=function(t,e){return this},e.dependCore=function(t,e,n){return t===this},e.dependOuter=function(t,e,n){var i=n[this.key];if(null!=i)return i!==At&&i;n[this.key]=At;var r=this.dependCore(t,e,n);return n[this.key]=r,r},e.depend=function(t,e){return this.dependOuter(t,e,{})},e.evaluate=function(t){var e=t.queryVal(this.scope,this.key);return void 0!==e||(e=this.evaluateCore(t),t.storeVal(this.scope,this.key,e)),e},e.isMediaName=function(){return!1},t}(),zt=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).val=n,i}x(e,t);var n=e.prototype;return n.getOp=function(){throw new Error("F_ABSTRACT")},n.evalPrefix=function(t){throw new Error("F_ABSTRACT")},n.evaluateCore=function(t){var e=this.val.evaluate(t);return this.evalPrefix(e)},n.dependCore=function(t,e,n){return t===this||this.val.dependOuter(t,e,n)},n.appendTo=function(t,e){10<e&&t.append("("),t.append(this.getOp()),this.val.appendTo(t,10),10<e&&t.append(")")},n.expand=function(t,e){var n=this.val.expand(t,e);return n===this.val?this:new this.constructor(this.scope,n)},e}(Ht),Gt=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).lhs=n,r.rhs=i,r}x(e,t);var n=e.prototype;return n.getPriority=function(){throw new Error("F_ABSTRACT")},n.getOp=function(){throw new Error("F_ABSTRACT")},n.evalInfix=function(t,e){throw new Error("F_ABSTRACT")},n.evaluateCore=function(t){var e=this.lhs.evaluate(t),n=this.rhs.evaluate(t);return this.evalInfix(e,n)},n.dependCore=function(t,e,n){return t===this||this.lhs.dependOuter(t,e,n)||this.rhs.dependOuter(t,e,n)},n.appendTo=function(t,e){var n=this.getPriority();n<=e&&t.append("("),this.lhs.appendTo(t,n),t.append(this.getOp()),this.rhs.appendTo(t,n),n<=e&&t.append(")")},n.expand=function(t,e){var n=this.lhs.expand(t,e),i=this.rhs.expand(t,e);return n===this.lhs&&i===this.rhs?this:new this.constructor(this.scope,n,i)},e}(Ht),Wt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}return x(e,t),e.prototype.getPriority=function(){return 1},e}(Gt),Xt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}return x(e,t),e.prototype.getPriority=function(){return 2},e}(Gt),jt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}return x(e,t),e.prototype.getPriority=function(){return 3},e}(Gt),Yt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}return x(e,t),e.prototype.getPriority=function(){return 4},e}(Gt),Kt=function(t){function e(e,n){return t.call(this,e,n)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"!"},n.evalPrefix=function(t){return!t},e}(zt),qt=function(t){function e(e,n){return t.call(this,e,n)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"-"},n.evalPrefix=function(t){return-t},e}(zt),Qt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"&&"},n.evaluateCore=function(t){return this.lhs.evaluate(t)&&this.rhs.evaluate(t)},e}(Wt),Zt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}return x(e,t),e.prototype.getOp=function(){return" and "},e}(Qt),$t=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"||"},n.evaluateCore=function(t){return this.lhs.evaluate(t)||this.rhs.evaluate(t)},e}(Wt),Jt=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}return x(e,t),e.prototype.getOp=function(){return", "},e}($t),te=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"<"},n.evalInfix=function(t,e){return t<e},e}(Xt),ee=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"<="},n.evalInfix=function(t,e){return t<=e},e}(Xt),ne=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return">"},n.evalInfix=function(t,e){return t>e},e}(Xt),ie=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return">="},n.evalInfix=function(t,e){return t>=e},e}(Xt),re=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"=="},n.evalInfix=function(t,e){return t==e},e}(Xt),oe=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"!="},n.evalInfix=function(t,e){return t!=e},e}(Xt),ae=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"+"},n.evalInfix=function(t,e){return t+e},e}(jt),se=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return" - "},n.evalInfix=function(t,e){return t-e},e}(jt),le=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"*"},n.evalInfix=function(t,e){return t*e},e}(Yt),ue=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"/"},n.evalInfix=function(t,e){return t/e},e}(Yt),he=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.getOp=function(){return"%"},n.evalInfix=function(t,e){return t%e},e}(Yt),ce=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).num=n,r.unit=i.toLowerCase(),r}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append(this.num.toString()),t.append(nt(this.unit))},n.evaluateCore=function(t){return this.num*t.queryUnitSize(this.unit,!1)},e}(Ht),fe=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).qualifiedName=n,i}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append(this.qualifiedName)},n.evaluateCore=function(t){return t.evalName(this.scope,this.qualifiedName).evaluate(t)},n.dependCore=function(t,e,n){return t===this||e.evalName(this.scope,this.qualifiedName).dependOuter(t,e,n)},e}(Ht),de=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).not=n,r.name=i,r}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){this.not&&t.append("not "),t.append(nt(this.name))},n.evaluateCore=function(t){return t.evalMediaName(this.name,this.not)},n.dependCore=function(t,e,n){return t===this||this.value.dependOuter(t,e,n)},n.isMediaName=function(){return!0},e}(Ht),pe=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).fn=n,r.str=i,r}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append(this.str)},n.evaluateCore=function(t){return this.fn.call(t)},e}(Ht),ge=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).qualifiedName=n,r.params=i,r}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append(this.qualifiedName),function(t,e){t.append("(");for(var n=0;n<e.length;n++)n&&t.append(","),e[n].appendTo(t,0);t.append(")")}(t,this.params)},n.evaluateCore=function(t){return t.evalCall(this.scope,this.qualifiedName,this.params,!1).expand(t,this.params).evaluate(t)},n.dependCore=function(t,e,n){if(t===this)return!0;for(var i=0;i<this.params.length;i++)if(this.params[i].dependOuter(t,e,n))return!0;return e.evalCall(this.scope,this.qualifiedName,this.params,!0).dependOuter(t,e,n)},n.expand=function(t,n){var i=function(t,e,n){for(var i=e,r=0;r<e.length;r++){var o=e[r].expand(t,n);if(e!==i)i[r]=o;else if(o!==e[r]){i=Array(e.length);for(var a=0;a<r;a++)i[a]=e[a];i[r]=o}}return i}(t,this.params,n);return i===this.params?this:new e(this.scope,this.qualifiedName,i)},e}(Ht),me=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e)||this).cond=n,o.ifTrue=i,o.ifFalse=r,o}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){e>0&&t.append("("),this.cond.appendTo(t,0),t.append("?"),this.ifTrue.appendTo(t,0),t.append(":"),this.ifFalse.appendTo(t,0),e>0&&t.append(")")},n.evaluateCore=function(t){return this.cond.evaluate(t)?this.ifTrue.evaluate(t):this.ifFalse.evaluate(t)},n.dependCore=function(t,e,n){return t===this||this.cond.dependOuter(t,e,n)||this.ifTrue.dependOuter(t,e,n)||this.ifFalse.dependOuter(t,e,n)},n.expand=function(t,n){var i=this.cond.expand(t,n),r=this.ifTrue.expand(t,n),o=this.ifFalse.expand(t,n);return i===this.cond&&r===this.ifTrue&&o===this.ifFalse?this:new e(this.scope,i,r,o)},e}(Ht),ve=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).val=n,i}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){switch(typeof this.val){case"number":case"boolean":t.append(this.val.toString());break;case"string":t.append('"'),t.append(it(this.val)),t.append('"');break;default:throw new Error("F_UNEXPECTED_STATE")}},n.evaluateCore=function(t){return this.val},e}(Ht),Ee=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).name=n,r.value=i,r}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append("("),t.append(it(this.name.name)),t.append(":"),this.value.appendTo(t,0),t.append(")")},n.evaluateCore=function(t){return t.evalMediaTest(this.name.name,this.value)},n.dependCore=function(t,e,n){return t===this||this.value.dependOuter(t,e,n)},n.expand=function(t,n){var i=this.value.expand(t,n);return i===this.value?this:new e(this.scope,this.name,i)},e}(Ht),we=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).index=n,i}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append("$"),t.append(this.index.toString())},n.expand=function(t,e){var n=e[this.index];if(!n)throw new Error("Parameter missing: "+this.index);return n},e}(Ht);function ye(t,e,n){return e===t._false||e===t.zero||n==t._false||n==t.zero?t._false:e===t._true||e===t.one?n:n===t._true||n===t.one?e:new Qt(t,e,n)}function Ne(t,e,n){return e===t.zero?n:n===t.zero?e:new ae(t,e,n)}function be(t,e,n){return e===t.zero?new qt(t,n):n===t.zero?e:new se(t,e,n)}function Se(t,e,n){return e===t.zero||n===t.zero?t.zero:e===t.one?n:n===t.one?e:new le(t,e,n)}function Ce(t,e,n){return e===t.zero?t.zero:n===t.one?e:new ue(t,e,n)}var Te=function(){function t(){}var e=t.prototype;return e.visitValues=function(t){for(var e=0;e<t.length;e++)t[e].visit(this)},e.visitEmpty=function(t){throw new Error("E_CSS_EMPTY_NOT_ALLOWED")},e.visitSlash=function(t){throw new Error("E_CSS_SLASH_NOT_ALLOWED")},e.visitStr=function(t){throw new Error("E_CSS_STR_NOT_ALLOWED")},e.visitIdent=function(t){throw new Error("E_CSS_IDENT_NOT_ALLOWED")},e.visitNumeric=function(t){throw new Error("E_CSS_NUMERIC_NOT_ALLOWED")},e.visitNum=function(t){throw new Error("E_CSS_NUM_NOT_ALLOWED")},e.visitInt=function(t){return this.visitNum(t)},e.visitColor=function(t){throw new Error("E_CSS_COLOR_NOT_ALLOWED")},e.visitURL=function(t){throw new Error("E_CSS_URL_NOT_ALLOWED")},e.visitSpaceList=function(t){throw new Error("E_CSS_LIST_NOT_ALLOWED")},e.visitCommaList=function(t){throw new Error("E_CSS_COMMA_NOT_ALLOWED")},e.visitFunc=function(t){throw new Error("E_CSS_FUNC_NOT_ALLOWED")},e.visitExpr=function(t){throw new Error("E_CSS_EXPR_NOT_ALLOWED")},t}(),xe=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.visitValues=function(t){for(var e=null,n=0;n<t.length;n++){var i=t[n],r=i.visit(this);if(e)e[n]=r;else if(i!==r){e=new Array(t.length);for(var o=0;o<n;o++)e[o]=t[o];e[n]=r}}return e||t},n.visitStr=function(t){return t},n.visitIdent=function(t){return t},n.visitSlash=function(t){return t},n.visitNumeric=function(t){return t},n.visitNum=function(t){return t},n.visitInt=function(t){return t},n.visitColor=function(t){return t},n.visitURL=function(t){return t},n.visitSpaceList=function(t){var e=this.visitValues(t.values);return e===t.values?t:new Ve(e)},n.visitCommaList=function(t){var e=this.visitValues(t.values);return e===t.values?t:new He(e)},n.visitFunc=function(t){var e=this.visitValues(t.values);return e===t.values?t:new ze(t.name,e)},n.visitExpr=function(t){return t},e}(Te),Ie=function(){function t(){}var e=t.prototype;return e.toString=function(){var t=new tt;return this.appendTo(t,!0),t.toString()},e.stringValue=function(){var t=new tt;return this.appendTo(t,!1),t.toString()},e.toExpr=function(t,e){throw new Error("F_ABSTRACT")},e.appendTo=function(t,e){t.append("[error]")},e.isExpr=function(){return!1},e.isNumeric=function(){return!1},e.isNum=function(){return!1},e.isIdent=function(){return!1},e.isSpaceList=function(){return!1},e.visit=function(t){throw new Error("F_ABSTRACT")},t}(),Pe=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.toExpr=function(t,e){return new ve(t,"")},n.appendTo=function(t,e){},n.visit=function(t){return t.visitEmpty(this)},T(e,null,[{key:"instance",get:function(){return this.empty||(this.empty=new e),this.empty}}]),e}(Ie).instance,Re=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.toExpr=function(t,e){return new ve(t,"/")},n.appendTo=function(t,e){t.append("/")},n.visit=function(t){return t.visitSlash(this)},T(e,null,[{key:"instance",get:function(){return this.slash||(this.slash=new e),this.slash}}]),e}(Ie).instance,Ae=function(t){function e(e){var n;return(n=t.call(this)||this).str=e,n}x(e,t);var n=e.prototype;return n.toExpr=function(t,e){return new ve(t,this.str)},n.appendTo=function(t,e){e?(t.append('"'),t.append(it(this.str)),t.append('"')):t.append(this.str)},n.visit=function(t){return t.visitStr(this)},e}(Ie),Le={},Oe=function(t){function e(e){var n;if((n=t.call(this)||this).name=e,Le[e])throw new Error("E_INVALID_CALL");return Le[e]=O(n),n}x(e,t);var n=e.prototype;return n.toExpr=function(t,e){return new ve(t,this.name)},n.appendTo=function(t,e){t.append(e?nt(this.name):this.name)},n.visit=function(t){return t.visitIdent(this)},n.isIdent=function(){return!0},e}(Ie);function ke(t){var e=Le[t];return e||(e=new Oe(t)),e}var De=function(t){function e(e,n){var i;return(i=t.call(this)||this).num=e,i.unit=n.toLowerCase(),i}x(e,t);var n=e.prototype;return n.toExpr=function(t,e){return 0==this.num?t.zero:e&&"%"==this.unit?100==this.num?e:new le(t,e,new ve(t,this.num/100)):new ce(t,this.num,this.unit)},n.appendTo=function(t,e){t.append(this.num.toString()),t.append(this.unit)},n.visit=function(t){return t.visitNumeric(this)},n.isNumeric=function(){return!0},e}(Ie),Fe=function(t){function e(e){var n;return(n=t.call(this)||this).num=e,n}x(e,t);var n=e.prototype;return n.toExpr=function(t,e){return 0==this.num?t.zero:1==this.num?t.one:new ve(t,this.num)},n.appendTo=function(t,e){t.append(this.num.toString())},n.visit=function(t){return t.visitNum(this)},n.isNum=function(){return!0},e}(Ie),_e=function(t){function e(e){return t.call(this,e)||this}return x(e,t),e.prototype.visit=function(t){return t.visitInt(this)},e}(Fe),Be=function(t){function e(e){var n;return(n=t.call(this)||this).rgb=e,n}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append("#");var n=this.rgb.toString(16);t.append("000000".substr(n.length)),t.append(n)},n.visit=function(t){return t.visitColor(this)},e}(Ie),Me=function(t){function e(e){var n;return(n=t.call(this)||this).url=e,n}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append('url("'),t.append(it(this.url)),t.append('")')},n.visit=function(t){return t.visitURL(this)},e}(Ie);function Ue(t,e,n,i){var r=e.length;e[0].appendTo(t,i);for(var o=1;o<r;o++)t.append(n),e[o].appendTo(t,i)}var Ve=function(t){function e(e){var n;return(n=t.call(this)||this).values=e,n}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){Ue(t,this.values," ",e)},n.visit=function(t){return t.visitSpaceList(this)},n.isSpaceList=function(){return!0},e}(Ie),He=function(t){function e(e){var n;return(n=t.call(this)||this).values=e,n}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){Ue(t,this.values,",",e)},n.visit=function(t){return t.visitCommaList(this)},e}(Ie),ze=function(t){function e(e,n){var i;return(i=t.call(this)||this).name=e,i.values=n,i}x(e,t);var n=e.prototype;return n.appendTo=function(t,e){t.append(nt(this.name)),t.append("("),Ue(t,this.values,",",e),t.append(")")},n.visit=function(t){return t.visitFunc(this)},e}(Ie),Ge=function(t){function e(e){var n;return(n=t.call(this)||this).expr=e,n}x(e,t);var n=e.prototype;return n.toExpr=function(){return this.expr},n.appendTo=function(t,e){t.append("-epubx-expr("),this.expr.appendTo(t,0),t.append(")")},n.visit=function(t){return t.visitExpr(this)},n.isExpr=function(){return!0},e}(Ie);function We(t,e){if(t){if(t.isNumeric()){var n=t;return e.queryUnitSize(n.unit,!1)*n.num}if(t.isNum())return t.num}return 0}function Xe(t,e){return new De(We(t,e),"px")}var je={absolute:ke("absolute"),all:ke("all"),always:ke("always"),auto:ke("auto"),avoid:ke("avoid"),balance:ke("balance"),balance_all:ke("balance-all"),block:ke("block"),block_end:ke("block-end"),block_start:ke("block-start"),both:ke("both"),bottom:ke("bottom"),border_box:ke("border-box"),break_all:ke("break-all"),break_word:ke("break-word"),crop:ke("crop"),cross:ke("cross"),column:ke("column"),exclusive:ke("exclusive"),_false:ke("false"),fixed:ke("fixed"),flex:ke("flex"),footnote:ke("footnote"),footer:ke("footer"),header:ke("header"),hidden:ke("hidden"),horizontal_tb:ke("horizontal-tb"),inherit:ke("inherit"),inline:ke("inline"),inline_block:ke("inline-block"),inline_end:ke("inline-end"),inline_start:ke("inline-start"),landscape:ke("landscape"),left:ke("left"),line:ke("line"),list_item:ke("list-item"),ltr:ke("ltr"),manual:ke("manual"),none:ke("none"),normal:ke("normal"),oeb_page_foot:ke("oeb-page-foot"),oeb_page_head:ke("oeb-page-head"),page:ke("page"),relative:ke("relative"),right:ke("right"),same:ke("same"),scale:ke("scale"),snap_block:ke("snap-block"),spread:ke("spread"),_static:ke("static"),rtl:ke("rtl"),table:ke("table"),table_caption:ke("table-caption"),table_cell:ke("table-cell"),table_footer_group:ke("table-footer-group"),table_header_group:ke("table-header-group"),table_row:ke("table-row"),top:ke("top"),transparent:ke("transparent"),vertical_lr:ke("vertical-lr"),vertical_rl:ke("vertical-rl"),visible:ke("visible"),_true:ke("true")},Ye=new De(100,"%"),Ke=new De(100,"pvw"),qe=new De(100,"pvh"),Qe=new De(0,"px"),Ze={"font-size":1,color:2};function $e(t,e){return(Ze[t]||Number.MAX_VALUE)-(Ze[e]||Number.MAX_VALUE)}var Je=function(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i},tn=function(t,e){this.x=t,this.y=e},en=function(t,e,n,i){this.left=t,this.top=e,this.right=n,this.bottom=i},nn=function(t,e,n,i){this.low=t,this.high=e,this.winding=n,this.shapeId=i},rn=function(t,e,n,i){this.y1=t,this.y2=e,this.x1=n,this.x2=i,this.left=null,this.right=null};function on(t,e){return t.low.y-e.low.y||t.low.x-e.low.x}var an=function(){function t(t){this.points=t}var e=t.prototype;return e.addSegments=function(t,e){for(var n=this.points,i=n.length,r=n[i-1],o=0;o<i;o++){var a,s=n[o];a=r.y<s.y?new nn(r,s,1,e):new nn(s,r,-1,e),t.push(a),r=s}},e.withOffset=function(e,n){for(var i,r=[],o=D(this.points);!(i=o()).done;){var a=i.value;r.push(new tn(a.x+e,a.y+n))}return new t(r)},t}();function sn(t,e,n,i){for(var r=[],o=0;o<20;o++){var a=2*o*Math.PI/20;r.push(new tn(t+n*Math.sin(a),e+i*Math.cos(a)))}return new an(r)}function ln(t,e,n,i){return new an([new tn(t,e),new tn(n,e),new tn(n,i),new tn(t,i)])}var un=function(t,e,n,i){this.x=t,this.winding=e,this.shapeId=n,this.lowOrHigh=i};function hn(t,e){var n=t.low.x+(t.high.x-t.low.x)*(e-t.low.y)/(t.high.y-t.low.y);if(isNaN(n))throw new Error("Bad intersection");return n}function cn(t,e,n,i){var r,o,a,s;e.high.y<n&&h.warn("Error: inconsistent segment (1)"),e.low.y<=n?(r=hn(e,n),o=e.winding):(r=e.low.x,o=0),e.high.y>=i?(a=hn(e,i),s=e.winding):(a=e.high.x,s=0),r<a?(t.push(new un(r,o,e.shapeId,-1)),t.push(new un(a,s,e.shapeId,1))):(t.push(new un(a,s,e.shapeId,-1)),t.push(new un(r,o,e.shapeId,1)))}function fn(t,e,n){var i,r=e+n,o=Array(r),a=Array(r);for(i=0;i<=r;i++)o[i]=0,a[i]=0;for(var s=[],l=!1,u=t.length,h=0;h<u;h++){var c=t[h];o[c.shapeId]+=c.winding,a[c.shapeId]+=c.lowOrHigh;var f=!1;for(i=0;i<e;i++)if(o[i]&&!a[i]){f=!0;break}if(f)for(i=e;i<=r;i++)if(o[i]||a[i]){f=!1;break}l!=f&&(s.push(c.x),l=f)}return s}function dn(t,e){return e?Math.floor(t/e)*e:t}function pn(t){return new Je(t.y1,-t.x2,t.y2,-t.x1)}function gn(t){return new Je(-t.y2,t.x1,-t.y1,t.x2)}function mn(t){return new an(t.points.map(function(t){return function(t){return new tn(t.y,-t.x)}(t)}))}function vn(t,e){for(var n=e.length-1,i=new rn(t.y2,t.y2,t.x1,t.x2);n>=0;){var r=i;((i=e[n]).y2-i.y1<1||i.x1==r.x1&&i.x2==r.x2)&&(r.y1=i.y1,e.splice(n,1),i=r),n--}}function En(t,e){for(var n=0,i=t.length;n<i;){var r=Math.floor((n+i)/2);e>=t[r].y2?n=r+1:i=r}return n}function wn(t,e){if(!t.length)return e;var n,i,r=e.y1;for(i=0;i<t.length&&!((n=t[i]).y2>e.y1&&n.x1-.1<=e.x1&&n.x2+.1>=e.x2);i++)r=Math.max(r,n.y2);for(var o=r;i<t.length&&!((n=t[i]).y1>=e.y2||n.x1-.1>e.x1||n.x2+.1<e.x2);i++)o=n.y2;return(o=i===t.length?e.y2:Math.min(o,e.y2))<=r?null:new Je(e.x1,r,e.x2,o)}function yn(t,e){if(!t.length)return e;var n,i,r=e.y2;for(i=t.length-1;i>=0&&(n=t[i],!(i===t.length-1&&n.y2<e.y2))&&!(n.y1<e.y2&&n.x1-.1<=e.x1&&n.x2+.1>=e.x2);i--)r=Math.min(r,n.y1);for(var o=Math.min(r,n.y2);i>=0&&!((n=t[i]).y2<=e.y1||n.x1-.1>e.x1||n.x2+.1<e.x2);i--)o=n.y1;return r<=(o=Math.max(o,e.y1))?null:new Je(e.x1,o,e.x2,r)}var Nn=function(t){function e(){var e;return(e=t.call(this)||this).propSet={},e}x(e,t);var n=e.prototype;return n.visitIdent=function(t){return this.propSet[t.name]=!0,t},n.visitSpaceList=function(t){return this.visitValues(t.values),t},e}(Te),bn=function(t){function e(e){var n;return(n=t.call(this)||this).value=e,n}return x(e,t),e.prototype.visitInt=function(t){return this.value=t.num,t},e}(Te);function Sn(t,e){if(t){var n=new bn(e);try{return t.visit(n),n.value}catch(t){h.warn(t,"toInt: ")}}return e}var Cn=function(t){function e(){var e;return(e=t.call(this)||this).collect=!1,e.coords=[],e.name=null,e}x(e,t);var n=e.prototype;return n.visitNumeric=function(t){return this.collect&&this.coords.push(t),null},n.visitNum=function(t){return this.collect&&0==t.num&&this.coords.push(new De(0,"px")),null},n.visitSpaceList=function(t){return this.visitValues(t.values),null},n.visitFunc=function(t){return this.collect||(this.collect=!0,this.visitValues(t.values),this.collect=!1,this.name=t.name.toLowerCase()),null},n.getShape=function(t,e,n,i,r){var o=this;if(this.coords.length>0){var a=[];switch(this.coords.forEach(function(t,e){if("%"==t.unit){var s=e%2==0?n:i;3==e&&"circle"==o.name&&(s=Math.sqrt((n*n+i*i)/2)),a.push(t.num*s/100)}else a.push(t.num*r.queryUnitSize(t.unit,!1))}),this.name){case"polygon":if(a.length%2==0){for(var s=[],l=0;l<a.length;l+=2)s.push(new tn(t+a[l],e+a[l+1]));return new an(s)}break;case"rectangle":if(4==a.length)return ln(t+a[0],e+a[1],t+a[0]+a[2],e+a[1]+a[3]);break;case"ellipse":if(4==a.length)return sn(t+a[0],e+a[1],a[2],a[3]);break;case"circle":if(3==a.length)return sn(t+a[0],e+a[1],a[2],a[2])}}return null},e}(Te);function Tn(t,e,n,i,r,o){if(t){var a=new Cn;try{return t.visit(a),a.getShape(e,n,i,r,o)}catch(t){h.warn(t,"toShape:")}}return ln(e,n,e+i,n+r)}var xn=function(t){function e(e){var n;return(n=t.call(this)||this).reset=e,n.counters={},n.name=null,n}x(e,t);var n=e.prototype;return n.visitIdent=function(t){return this.name=t.toString(),this.counters[this.name]=this.reset?0:(this.counters[this.name]||0)+1,t},n.visitInt=function(t){return this.name&&(this.counters[this.name]+=t.num-(this.reset?0:1)),t},n.visitSpaceList=function(t){return this.visitValues(t.values),t},e}(Te);function In(t,e){var n=new xn(e);try{t.visit(n)}catch(t){h.warn(t,"toCounters:")}return n.counters}var Pn=function(t){function e(e,n){var i;return(i=t.call(this)||this).baseUrl=e,i.transformer=n,i}return x(e,t),e.prototype.visitURL=function(t){return new Me(this.transformer.transformURL(t.url,this.baseUrl))},e}(xe);function Rn(t){var e={};return Object.keys(t).forEach(function(n){e[n]=Array.from(t[n])}),e}var An,Ln=function(){function t(t,e){this.targetId=t,this.resolved=e,this.pageCounters=null,this.spineIndex=-1,this.pageIndex=-1}var e=t.prototype;return e.equals=function(t){return this===t||!!t&&this.targetId===t.targetId&&this.resolved===t.resolved&&this.spineIndex===t.spineIndex&&this.pageIndex===t.pageIndex},e.isResolved=function(){return this.resolved},e.resolve=function(){this.resolved=!0},e.unresolve=function(){this.resolved=!1},t}(),On=function(){function t(t,e){this.counterStore=t,this.baseURL=e}var e=t.prototype;return e.countersOfId=function(t,e){t=this.counterStore.documentURLTransformer.transformFragment(encodeURIComponent(t),this.baseURL),this.counterStore.countersById[t]=e},e.getExprContentListener=function(){return this.counterStore.getExprContentListener()},t}(),kn=function(){function t(t,e,n,i){this.counterStore=t,this.baseURL=e,this.rootScope=n,this.pageScope=i,this.styler=null}var e=t.prototype;return e.setStyler=function(t){this.styler=t},e.getFragment=function(t){var e=t.match(/^[^#]*#(.*)$/);return e?e[1]:null},e.getTransformedId=function(t){var e=this.counterStore.documentURLTransformer.transformURL(G(t,this.baseURL),this.baseURL);return"#"===e.charAt(0)&&(e=e.substring(1)),e},e.getPageCounterVal=function(t,e){var n=this,i=new pe(this.pageScope,function(){return e(function(){var e=n.counterStore.currentPageCounters[t];return e&&e.length?e[e.length-1]:null}())},"page-counter-"+t);return this.counterStore.registerPageCounterExpr(t,function(t){return e(t[0])},i),i},e.getPageCountersVal=function(t,e){var n=this,i=new pe(this.pageScope,function(){return e(n.counterStore.currentPageCounters[t]||[])},"page-counters-"+t);return this.counterStore.registerPageCounterExpr(t,e,i),i},e.getTargetCounters=function(t,e,n){var i=this.counterStore.countersById[e];return!i&&n&&t&&(this.styler.styleUntilIdIsReached(t),i=this.counterStore.countersById[e]),i||null},e.getTargetPageCounters=function(t){return this.counterStore.currentPage.elementsById[t]?this.counterStore.currentPageCounters:this.counterStore.pageCountersById[t]||null},e.getTargetCounterVal=function(t,e,n){var i=this,r=this.getFragment(t),o=this.getTransformedId(t),a=this.getTargetCounters(r,o,!1);if(a&&a[e]){var s=a[e];return new ve(this.rootScope,n(s[s.length-1]||null))}return new pe(this.pageScope,function(){if(a=i.getTargetCounters(r,o,!0)){if(a[e]){var t=a[e];return n(t[t.length-1]||null)}var s=i.getTargetPageCounters(o);if(s){if(i.counterStore.resolveReference(o),s[e]){var l=s[e];return n(l[l.length-1]||null)}return n(0)}return i.counterStore.saveReferenceOfCurrentPage(o,!1),"??"}return i.counterStore.saveReferenceOfCurrentPage(o,!1),"??"},"target-counter-"+e+"-of-"+t)},e.getTargetCountersVal=function(t,e,n){var i=this,r=this.getFragment(t),o=this.getTransformedId(t);return new pe(this.pageScope,function(){var t=i.getTargetPageCounters(o);if(t){i.counterStore.resolveReference(o);var a=t[e]||[],s=i.getTargetCounters(r,o,!0);return n(a.concat(s[e]||[]))}return i.counterStore.saveReferenceOfCurrentPage(o,!1),"??"},"target-counters-"+e+"-of-"+t)},t}(),Dn=function(){function t(t){this.documentURLTransformer=t,this.countersById={},this.pageCountersById={},this.currentPageCounters={},this.previousPageCounters={},this.currentPageCountersStack=[],this.pageIndicesById={},this.currentPage=null,this.newReferencesOfCurrentPage=[],this.referencesToSolve=[],this.referencesToSolveStack=[],this.unresolvedReferences={},this.resolvedReferences={},this.pagesCounterExprs=[],this.currentPageCounters.page=[0]}var e=t.prototype;return e.createCounterListener=function(t){return new On(this,t)},e.createCounterResolver=function(t,e,n){return new kn(this,t,e,n)},e.setCurrentPage=function(t){this.currentPage=t},e.definePageCounter=function(t,e){this.currentPageCounters[t]?this.currentPageCounters[t].push(e):this.currentPageCounters[t]=[e]},e.forceSetPageCounter=function(t){var e=this.currentPageCounters.page;e&&e.length?e[e.length-1]=t:this.currentPageCounters.page=[t]},e.updatePageCounters=function(t,e){var n;this.previousPageCounters=Rn(this.currentPageCounters);var i,r=t["counter-reset"];if(r){var o=r.evaluate(e);o&&(n=In(o,!0))}if(n)for(var a in n)this.definePageCounter(a,n[a]);var s=t["counter-increment"];if(s){var l=s.evaluate(e);l&&(i=In(l,!1))}for(var u in i?"page"in i||(i.page=1):(i={}).page=1,i){this.currentPageCounters[u]||this.definePageCounter(u,0);var h=this.currentPageCounters[u];h[h.length-1]+=i[u]}},e.pushPageCounters=function(t){this.currentPageCountersStack.push(this.currentPageCounters),this.currentPageCounters=Rn(t)},e.popPageCounters=function(){this.currentPageCounters=this.currentPageCountersStack.pop()},e.resolveReference=function(t){var e=this.unresolvedReferences[t],n=this.resolvedReferences[t];n||(n=this.resolvedReferences[t]=[]);for(var i=!1,r=0;r<this.referencesToSolve.length;){var o=this.referencesToSolve[r];if(o.targetId===t){if(o.resolve(),this.referencesToSolve.splice(r,1),e){var a=e.indexOf(o);a>=0&&e.splice(a,1)}n.push(o),i=!0}else r++}i||this.saveReferenceOfCurrentPage(t,!0)},e.saveReferenceOfCurrentPage=function(t,e){if(!this.newReferencesOfCurrentPage.some(function(e){return e.targetId===t})){var n=new Ln(t,e);this.newReferencesOfCurrentPage.push(n)}},e.finishPage=function(t,e){var n=this,i=Object.keys(this.currentPage.elementsById);if(i.length>0){var r=Rn(this.currentPageCounters);i.forEach(function(i){n.pageCountersById[i]=r;var o=n.pageIndicesById[i];if(o&&o.pageIndex<e){var a=n.resolvedReferences[i];if(a){var s,l=n.unresolvedReferences[i];for(l||(l=n.unresolvedReferences[i]=[]);s=a.shift();)s.unresolve(),l.push(s)}}n.pageIndicesById[i]={spineIndex:t,pageIndex:e}})}for(var o,a=this.previousPageCounters;o=this.newReferencesOfCurrentPage.shift();){o.pageCounters=a,o.spineIndex=t,o.pageIndex=e;var s=void 0;o.isResolved()?(s=this.resolvedReferences[o.targetId])||(s=this.resolvedReferences[o.targetId]=[]):(s=this.unresolvedReferences[o.targetId])||(s=this.unresolvedReferences[o.targetId]=[]),s.every(function(t){return!o.equals(t)})&&s.push(o)}this.currentPage=null},e.getUnresolvedRefsToPage=function(t){var e=this,n=[];Object.keys(t.elementsById).forEach(function(t){var i=e.unresolvedReferences[t];i&&(n=n.concat(i))}),n.sort(function(t,e){return t.spineIndex-e.spineIndex||t.pageIndex-e.pageIndex});var i=[],r=null;return n.forEach(function(t){r&&r.spineIndex===t.spineIndex&&r.pageIndex===t.pageIndex?r.refs.push(t):i.push(r={spineIndex:t.spineIndex,pageIndex:t.pageIndex,pageCounters:t.pageCounters,refs:[t]})}),i},e.pushReferencesToSolve=function(t){this.referencesToSolveStack.push(this.referencesToSolve),this.referencesToSolve=t},e.popReferencesToSolve=function(){this.referencesToSolve=this.referencesToSolveStack.pop()},e.registerPageCounterExpr=function(t,e,n){"pages"===t&&this.pagesCounterExprs.push({expr:n,format:e})},e.getExprContentListener=function(){return this.exprContentListener.bind(this)},e.exprContentListener=function(t,e,n){if(this.pagesCounterExprs.findIndex(function(e){return e.expr===t})>=0){var i=n.createElement("span");return i.textContent=e,i.setAttribute(Fn,t.key),i}return null},e.finishLastPage=function(t){for(var e,n=this,i=t.root.querySelectorAll("["+Fn+"]"),r=this.currentPageCounters.page[0],o=function(){var t=e.value,i=t.getAttribute(Fn),o=n.pagesCounterExprs.findIndex(function(t){return t.expr.key===i});t.textContent=n.pagesCounterExprs[o].format([r])},a=D(i);!(e=a()).done;)o()},e.createLayoutConstraint=function(t){return new _n(this,t)},t}(),Fn="data-vivliostyle-pages-counter",_n=function(){function t(t,e){this.counterStore=t,this.pageIndex=e}return t.prototype.allowLayout=function(t){if(!t||t.after)return!0;var e=t.viewNode;if(!e||1!==e.nodeType)return!0;var n=e.getAttribute("id")||e.getAttribute("name");if(!n)return!0;if(!this.counterStore.resolvedReferences[n]&&!this.counterStore.unresolvedReferences[n])return!0;var i=this.counterStore.pageIndicesById[n];return!i||this.pageIndex>=i.pageIndex},t}();function Bn(t){if((t=t.substr(1)).match(/^[^0-9a-fA-F\n\r]$/))return t;var e=parseInt(t,16);return isNaN(e)?"":e<=65535?String.fromCharCode(e):e<=1114111?String.fromCharCode(55296|e>>10&1023,56320|1023&e):"�"}function Mn(t){return t.replace(/\\([0-9a-fA-F]{0,6}(\r\n|[ \n\r\t\f])?|[^0-9a-fA-F\n\r])/g,Bn)}!function(t){t[t.EOF=0]="EOF",t[t.IDENT=1]="IDENT",t[t.STR=2]="STR",t[t.NUMERIC=3]="NUMERIC",t[t.NUM=4]="NUM",t[t.INT=5]="INT",t[t.FUNC=6]="FUNC",t[t.HASH=7]="HASH",t[t.URL=8]="URL",t[t.CLASS=9]="CLASS",t[t.O_PAR=10]="O_PAR",t[t.C_PAR=11]="C_PAR",t[t.O_BRC=12]="O_BRC",t[t.C_BRC=13]="C_BRC",t[t.O_BRK=14]="O_BRK",t[t.C_BRK=15]="C_BRK",t[t.COMMA=16]="COMMA",t[t.SEMICOL=17]="SEMICOL",t[t.COLON=18]="COLON",t[t.SLASH=19]="SLASH",t[t.AT=20]="AT",t[t.PERCENT=21]="PERCENT",t[t.QMARK=22]="QMARK",t[t.PLUS=23]="PLUS",t[t.MINUS=24]="MINUS",t[t.BAR_BAR=25]="BAR_BAR",t[t.AMP_AMP=26]="AMP_AMP",t[t.BANG=31]="BANG",t[t.DOLLAR=32]="DOLLAR",t[t.HAT=33]="HAT",t[t.BAR=34]="BAR",t[t.TILDE=35]="TILDE",t[t.STAR=36]="STAR",t[t.GT=37]="GT",t[t.LT=38]="LT",t[t.EQ=39]="EQ",t[t.BANG_EQ=41]="BANG_EQ",t[t.DOLLAR_EQ=42]="DOLLAR_EQ",t[t.HAT_EQ=43]="HAT_EQ",t[t.BAR_EQ=44]="BAR_EQ",t[t.TILDE_EQ=45]="TILDE_EQ",t[t.STAR_EQ=46]="STAR_EQ",t[t.GT_EQ=47]="GT_EQ",t[t.LT_EQ=48]="LT_EQ",t[t.EQ_EQ=49]="EQ_EQ",t[t.COL_COL=50]="COL_COL",t[t.INVALID=51]="INVALID",t[t.LAST=51]="LAST"}(An||(An={}));var Un,Vn=function(){this.precededBySpace=!1,this.num=0,this.text="",this.position=0,this.type=An.EOF};function Hn(t,e){var n,i=Array(128);for(n=0;n<128;n++)i[n]=t;for(i.NaN=t==Un.END?Un.END:Un.INVALID,n=0;n<e.length;n+=2)i[e[n]]=e[n+1];return i}!function(t){t[t.SPACE=1]="SPACE",t[t.INT=2]="INT",t[t.IDENT=3]="IDENT",t[t.BANG=4]="BANG",t[t.HASH=6]="HASH",t[t.DOLLAR=7]="DOLLAR",t[t.PERCENT=8]="PERCENT",t[t.AMP=9]="AMP",t[t.O_PAR=10]="O_PAR",t[t.C_PAR=11]="C_PAR",t[t.STAR=12]="STAR",t[t.PLUS=13]="PLUS",t[t.COMMA=14]="COMMA",t[t.MINUS=15]="MINUS",t[t.DOT=16]="DOT",t[t.SLASH=17]="SLASH",t[t.COLON=18]="COLON",t[t.SEMICOL=19]="SEMICOL",t[t.LT=20]="LT",t[t.EQ=21]="EQ",t[t.GT=22]="GT",t[t.QMARK=23]="QMARK",t[t.AT=24]="AT",t[t.O_BRK=25]="O_BRK",t[t.C_BRK=26]="C_BRK",t[t.O_BRC=27]="O_BRC",t[t.C_BRC=28]="C_BRC",t[t.BSLASH=29]="BSLASH",t[t.HAT=30]="HAT",t[t.BAR=31]="BAR",t[t.TILDE=32]="TILDE",t[t.STR1=33]="STR1",t[t.STR2=34]="STR2",t[t.END=35]="END",t[t.EQTAIL=36]="EQTAIL",t[t.ENDINT=37]="ENDINT",t[t.ENDNUM=38]="ENDNUM",t[t.CONT=39]="CONT",t[t.UNIT=40]="UNIT",t[t.PCUNIT=41]="PCUNIT",t[t.NUMBER=42]="NUMBER",t[t.ENDIDNT=43]="ENDIDNT",t[t.IDNTESC=44]="IDNTESC",t[t.ENDIDES=45]="ENDIDES",t[t.ENDSTR=46]="ENDSTR",t[t.ENDESTR=47]="ENDESTR",t[t.STR1ESC=48]="STR1ESC",t[t.STR2ESC=49]="STR2ESC",t[t.BAR_BAR=50]="BAR_BAR",t[t.AMP_AMP=51]="AMP_AMP",t[t.FUNC=52]="FUNC",t[t.FUNCES=53]="FUNCES",t[t.COMMENT=54]="COMMENT",t[t.COMMST=55]="COMMST",t[t.ENDNOTK=56]="ENDNOTK",t[t.MINMIN=57]="MINMIN",t[t.TOINT=58]="TOINT",t[t.TONUM=59]="TONUM",t[t.TOIDENT=60]="TOIDENT",t[t.TOIDES=61]="TOIDES",t[t.KILL1=62]="KILL1",t[t.KILL2=63]="KILL2",t[t.URL=64]="URL",t[t.URL1=65]="URL1",t[t.URL2=66]="URL2",t[t.ENDURL=67]="ENDURL",t[t.TERMURL=68]="TERMURL",t[t.FINURL=69]="FINURL",t[t.LT_BG=70]="LT_BG",t[t.LT_BG_M=71]="LT_BG_M",t[t.INVALID=72]="INVALID",t[t.CHKPOSS=73]="CHKPOSS",t[t.CHKPOSN=74]="CHKPOSN",t[t.URLESC=75]="URLESC",t[t.IDESCH=76]="IDESCH",t[t.COL_COL=77]="COL_COL",t[t.TOCLASS=78]="TOCLASS",t[t.CHKSP=79]="CHKSP",t[t.EOF=80]="EOF"}(Un||(Un={}));var zn=[Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.SPACE,Un.SPACE,Un.INVALID,Un.SPACE,Un.SPACE,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.SPACE,Un.BANG,Un.STR2,Un.HASH,Un.DOLLAR,Un.PERCENT,Un.AMP,Un.STR1,Un.O_PAR,Un.C_PAR,Un.STAR,Un.PLUS,Un.COMMA,Un.MINUS,Un.DOT,Un.SLASH,Un.INT,Un.INT,Un.INT,Un.INT,Un.INT,Un.INT,Un.INT,Un.INT,Un.INT,Un.INT,Un.COLON,Un.SEMICOL,Un.LT,Un.EQ,Un.GT,Un.QMARK,Un.AT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.O_BRK,Un.BSLASH,Un.C_BRK,Un.HAT,Un.IDENT,Un.INVALID,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.IDENT,Un.O_BRC,Un.BAR,Un.C_BRC,Un.TILDE,Un.INVALID];zn.NaN=Un.EOF;var Gn=[Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.FUNC,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.CONT,Un.ENDIDNT,Un.ENDIDNT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDIDNT,Un.IDNTESC,Un.ENDIDNT,Un.ENDIDNT,Un.CONT,Un.ENDIDNT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT,Un.ENDIDNT];Gn.NaN=Un.ENDIDNT;var Wn=[Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.TOCLASS,Un.TONUM,Un.INVALID,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.TONUM,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.INVALID,Un.TOIDES,Un.INVALID,Un.INVALID,Un.TOCLASS,Un.INVALID,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.TOCLASS,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID,Un.INVALID];Gn.NaN=Un.ENDIDNT;var Xn=[Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.MINMIN,Un.TONUM,Un.END,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.TOINT,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.END,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.END,Un.TOIDES,Un.END,Un.END,Un.TOIDENT,Un.END,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.TOIDENT,Un.END,Un.END,Un.END,Un.END,Un.END];Xn.NaN=Un.END;var jn=[Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.CHKPOSS,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.CHKPOSS,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.FUNCES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDIDES,Un.IDNTESC,Un.ENDIDES,Un.ENDIDES,Un.CONT,Un.ENDIDES,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES,Un.ENDIDES];jn.NaN=Un.ENDIDES;var Yn=[Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.PCUNIT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.NUMBER,Un.ENDINT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.UNIT,Un.ENDINT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT,Un.ENDINT];Yn.NaN=Un.ENDINT;var Kn=[Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.PCUNIT,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.CONT,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.UNIT,Un.ENDNUM,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.UNIT,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM,Un.ENDNUM];Kn.NaN=Un.ENDNUM;var qn,Qn=Hn(Un.END,[61,Un.EQTAIL]),Zn=Hn(Un.END,[58,Un.COL_COL]),$n=Hn(Un.END,[61,Un.EQTAIL,124,Un.BAR_BAR]),Jn=Hn(Un.END,[38,Un.AMP_AMP]),ti=Hn(Un.END,[42,Un.COMMENT]),ei=Hn(Un.CONT,[42,Un.COMMST]),ni=Hn(Un.COMMENT,[42,Un.COMMST,47,Un.ENDNOTK]),ii=Hn(Un.KILL1,[62,Un.ENDNOTK]),ri=Hn(Un.END,[61,Un.EQTAIL,33,Un.LT_BG]),oi=Hn(Un.KILL1,[45,Un.LT_BG_M]),ai=Hn(Un.KILL2,[45,Un.ENDNOTK]),si=Hn(Un.IDESCH,[9,Un.INVALID,10,Un.INVALID,13,Un.INVALID,32,Un.INVALID]),li=Hn(Un.CONT,[39,Un.ENDSTR,10,Un.INVALID,13,Un.INVALID,92,Un.STR1ESC]),ui=Hn(Un.CONT,[34,Un.ENDSTR,10,Un.INVALID,13,Un.INVALID,92,Un.STR2ESC]),hi=Hn(Un.CONT,[39,Un.ENDESTR,10,Un.CHKPOSN,13,Un.CHKPOSN,92,Un.STR1ESC]),ci=Hn(Un.CONT,[34,Un.ENDESTR,10,Un.CHKPOSN,13,Un.CHKPOSN,92,Un.STR2ESC]),fi=Hn(Un.URL,[9,Un.CONT,32,Un.CONT,34,Un.URL2,39,Un.URL1,41,Un.INVALID,10,Un.CONT,13,Un.CONT]),di=Hn(Un.CONT,[41,Un.ENDURL,9,Un.CHKSP,10,Un.CHKSP,13,Un.CHKSP,32,Un.CHKSP,92,Un.URLESC,40,Un.INVALID,91,Un.INVALID,93,Un.INVALID,123,Un.INVALID,125,Un.INVALID,NaN,Un.ENDURL]),pi=Hn(Un.CONT,[39,Un.TERMURL,10,Un.CHKPOSN,13,Un.CHKPOSN,92,Un.URLESC,NaN,Un.ENDURL]),gi=Hn(Un.CONT,[34,Un.TERMURL,10,Un.CHKPOSN,13,Un.CHKPOSN,92,Un.URLESC,NaN,Un.ENDURL]),mi=Hn(Un.INVALID,[9,Un.CONT,10,Un.CONT,13,Un.CONT,32,Un.CONT,41,Un.FINURL]),vi=function(){function t(t,e){this.input=t,this.handler=e,this.head=-1,this.tail=0,this.curr=0,this.position=0,this.indexMask=15,this.buffer=Array(this.indexMask+1);for(var n=0;n<=this.indexMask;n++)this.buffer[n]=new Vn}var e=t.prototype;return e.token=function(){return this.tail==this.curr&&this.fillBuffer(),this.buffer[this.curr]},e.nthToken=function(t){return(this.tail-this.curr&this.indexMask)<=t&&this.fillBuffer(),this.buffer[this.curr+t&this.indexMask]},e.consume=function(){this.curr=this.curr+1&this.indexMask},e.mark=function(){if(this.head>=0)throw new Error("F_CSSTOK_BAD_CALL mark");this.head=this.curr},e.reset=function(){if(this.head<0)throw new Error("F_CSSTOK_BAD_CALL reset");this.curr=this.head,this.head=-1},e.unmark=function(){this.head=-1},e.hasMark=function(){return this.head>=0},e.reallocate=function(){for(var t=2*(this.indexMask+1)-1,e=Array(t+1),n=this.head,i=0;n!=this.tail;)e[i]=this.buffer[n],n==this.curr&&(this.curr=i),n=n+1&this.indexMask,i++;for(this.head=0,this.tail=i,this.indexMask=t,this.buffer=e;i<=t;)e[i++]=new Vn},e.error=function(t,e,n){this.handler&&this.handler.error(n,e)},e.fillBuffer=function(){var t=this.tail,e=this.head>=0?this.head:this.curr,n=this.indexMask;if(t>=e?e+=n:e--,e==t){if(this.head<0)throw new Error("F_CSSTOK_INTERNAL");this.reallocate(),t=this.tail,e=n=this.indexMask}for(var i=zn,r=this.input,o=this.position,a=this.buffer,s=An.EOF,l=0,u="",h=0,c=!1,f=a[t],d=-9;;){var p=r.charCodeAt(o);switch(i[p]||i[65]){case Un.INVALID:s=An.INVALID,u=isNaN(p)?"E_CSS_UNEXPECTED_EOF":"E_CSS_UNEXPECTED_CHAR",i=zn,o++;break;case Un.SPACE:o++,c=!0;continue;case Un.INT:l=o++,i=Yn;continue;case Un.IDENT:s=An.IDENT,l=o++,i=Gn;continue;case Un.BANG:l=o++,s=An.BANG,i=Qn;continue;case Un.STR1:s=An.STR,l=++o,i=li;continue;case Un.STR2:s=An.STR,l=++o,i=ui;continue;case Un.HASH:l=++o,s=An.HASH,i=Gn;continue;case Un.DOLLAR:l=o++,s=An.DOLLAR,i=Qn;continue;case Un.PERCENT:l=o++,s=An.PERCENT;break;case Un.AMP:l=o++,s=An.DOLLAR,i=Jn;continue;case Un.O_PAR:l=o++,s=An.O_PAR;break;case Un.C_PAR:l=o++,s=An.C_PAR;break;case Un.STAR:l=o++,s=An.STAR,i=Qn;continue;case Un.PLUS:l=o++,s=An.PLUS;break;case Un.COMMA:l=o++,s=An.COMMA;break;case Un.MINUS:s=An.MINUS,l=o++,i=Xn;continue;case Un.DOT:l=o++,i=Wn;continue;case Un.TOCLASS:l=o++,s=An.CLASS,i=Gn;continue;case Un.SLASH:l=o++,s=An.SLASH,i=ti;continue;case Un.COLON:l=o++,s=An.COLON,i=Zn;continue;case Un.COL_COL:o++,s=An.COL_COL;break;case Un.SEMICOL:l=o++,s=An.SEMICOL;break;case Un.LT:l=o++,s=An.LT,i=ri;continue;case Un.EQ:l=o++,s=An.EQ,i=Qn;continue;case Un.GT:l=o++,s=An.GT,i=Qn;continue;case Un.QMARK:l=o++,s=An.QMARK;break;case Un.AT:l=++o,s=An.AT,i=Gn;continue;case Un.O_BRK:l=o++,s=An.O_BRK;break;case Un.C_BRK:l=o++,s=An.C_BRK;break;case Un.O_BRC:l=o++,s=An.O_BRC;break;case Un.C_BRC:l=o++,s=An.C_BRC;break;case Un.BSLASH:d=l=o++,s=An.IDENT,i=si;continue;case Un.HAT:l=o++,s=An.HAT,i=Qn;continue;case Un.BAR:l=o++,s=An.BAR,i=$n;continue;case Un.TILDE:l=o++,s=An.TILDE,i=Qn;continue;case Un.END:break;case Un.EQTAIL:o++,s=s+An.BANG_EQ-An.BANG;break;case Un.ENDINT:s=An.INT,h=parseInt(r.substring(l,o),10);break;case Un.ENDNUM:s=An.NUM,h=parseFloat(r.substring(l,o));break;case Un.CONT:o++;continue;case Un.UNIT:s=An.NUMERIC,h=parseFloat(r.substring(l,o)),l=o++,i=Gn;continue;case Un.PCUNIT:s=An.NUMERIC,h=parseFloat(r.substring(l,o)),u="%",l=o++;break;case Un.NUMBER:o++,i=Kn;continue;case Un.ENDIDNT:u=r.substring(l,o);break;case Un.IDNTESC:d=o++,i=si;continue;case Un.ENDIDES:u=Mn(r.substring(l,o));break;case Un.ENDSTR:u=r.substring(l,o),o++;break;case Un.ENDESTR:u=Mn(r.substring(l,o)),o++;break;case Un.STR1ESC:d=o,o+=2,i=hi;continue;case Un.STR2ESC:d=o,o+=2,i=ci;continue;case Un.BAR_BAR:o++,s=An.BAR_BAR;break;case Un.AMP_AMP:o++,s=An.AMP_AMP;break;case Un.FUNC:if(u=r.substring(l,o),s==An.IDENT){if(o++,"url"==u.toLowerCase()){i=fi;continue}s=An.FUNC}break;case Un.FUNCES:if(u=Mn(r.substring(l,o)),s==An.IDENT){if(o++,"url"==u.toLowerCase()){i=fi;continue}s=An.FUNC}break;case Un.COMMENT:i=ei,o++;continue;case Un.COMMST:i=ni,o++;continue;case Un.ENDNOTK:i=zn,o++;continue;case Un.MINMIN:i=ii,o++;continue;case Un.TOINT:s=An.INT,i=Yn,o++;continue;case Un.TONUM:s=An.NUM,i=Kn,o++;continue;case Un.TOIDENT:s=An.IDENT,i=Gn,o++;continue;case Un.TOIDES:s=An.IDENT,i=si,d=o++;continue;case Un.KILL1:o--;break;case Un.KILL2:o-=2;break;case Un.URL:l=o++,i=di;continue;case Un.URL1:l=++o,i=pi;continue;case Un.URL2:l=++o,i=gi;continue;case Un.ENDURL:s=An.URL,u=Mn(r.substring(l,o)),o++;break;case Un.FINURL:o++;break;case Un.LT_BG:i=oi,o++;continue;case Un.LT_BG_M:i=ai,o++;continue;case Un.CHKSP:if(o-d<8&&r.substring(d+1,o+1).match(/^[0-9a-fA-F]{0,6}(\r\n|[\n\r])|[ \t]$/)){o++;continue}case Un.TERMURL:s=An.URL,u=Mn(r.substring(l,o)),o++,i=mi;continue;case Un.CHKPOSN:if(++o-d<9&&r.substring(d+1,o).match(/^[0-9a-fA-F]{0,6}(\r\n|[\n\r])$/))continue;s=An.INVALID,u="E_CSS_UNEXPECTED_NEWLINE",i=zn;break;case Un.CHKPOSS:if(o-d<9&&r.substring(d+1,o+1).match(/^[0-9a-fA-F]{0,6}[ \t]$/)){o++;continue}u=Mn(r.substring(l,o));break;case Un.URLESC:d=o++;continue;case Un.IDESCH:o++,i=jn;continue;default:if(i!==zn){s=An.INVALID,u="E_CSS_UNEXPECTED_STATE";break}l=o,s=An.EOF}if(f.type=s,f.precededBySpace=c,f.num=h,f.text=u,f.position=l,++t>=e)break;i=zn,c=!1,f=a[t&n]}this.position=o,this.tail=t&n},t}(),Ei=null,wi=null;function yi(){return Ei}function Ni(t){if(!Ei)throw new Error("E_TASK_NO_CONTEXT");Ei.name||(Ei.name=t);var e=Ei,n=new Ai(e,e.top,t);return e.top=n,n.state=qn.ACTIVE,n}function bi(t){return new Pi(t)}function Si(t,e,n){var i=Ni(t);i.handler=n;try{e(i)}catch(t){i.task.raise(t,i)}return i.result()}!function(t){t[t.INIT=0]="INIT",t[t.ACTIVE=1]="ACTIVE",t[t.FINISHED=2]="FINISHED",t[t.DEAD=3]="DEAD"}(qn||(qn={}));var Ci=function(){function t(){}var e=t.prototype;return e.currentTime=function(){return(new Date).valueOf()},e.setTimeout=function(t){function e(e,n){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t,e){return setTimeout(t,e)}),e.clearTimeout=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(t){clearTimeout(t)}),t}(),Ti=function(){function t(t){this.timer=t,this.timeout=1,this.slice=25,this.sliceOverTime=0,this.wakeupTime=null,this.timeoutToken=null,this.inTimeSlice=!1,this.order=0,this.queue=new j,wi||(wi=this)}var e=t.prototype;return e.setSlice=function(t){this.slice=t},e.setTimeout=function(t){this.timeout=t},e.isTimeSliceOver=function(){return this.timer.currentTime()>=this.sliceOverTime},e.arm=function(){var t=this;if(!this.inTimeSlice){var e=this.queue.peek().scheduledTime,n=this.timer.currentTime();if(null!=this.timeoutToken){if(n+this.timeout>this.wakeupTime)return;this.timer.clearTimeout(this.timeoutToken)}var i=e-n;i<=this.timeout&&(i=this.timeout),this.wakeupTime=n+i,this.timeoutToken=this.timer.setTimeout(function(){t.timeoutToken=null,t.doTimeSlice()},i)}},e.schedule=function(t,e){var n=t,i=this.timer.currentTime();n.order=this.order++,n.scheduledTime=i+(e||0),this.queue.add(n),this.arm()},e.doTimeSlice=function(){null!=this.timeoutToken&&(this.timer.clearTimeout(this.timeoutToken),this.timeoutToken=null),this.inTimeSlice=!0;try{var t=this.timer.currentTime();for(this.sliceOverTime=t+this.slice;this.queue.length();){var e=this.queue.peek();if(e.scheduledTime>t)break;if(this.queue.remove(),e.canceled||e.resumeInternal(),(t=this.timer.currentTime())>=this.sliceOverTime)break}}catch(t){h.error(t)}this.inTimeSlice=!1,this.queue.length()&&this.arm()},e.run=function(t,e){var n=new Ii(this,e||"");n.top=new Ai(n,null,"bootstrap"),n.top.state=qn.ACTIVE,n.top.then(function(){var e=function(){n.running=!1;for(var t,e=D(n.callbacks);!(t=e()).done;){var i=t.value;try{i()}catch(t){h.error(t)}}};try{t().then(function(t){n.result=t,e()})}catch(t){n.raise(t),e()}});var i=Ei;return Ei=n,this.schedule(n.top.suspend("bootstrap")),Ei=i,n},t}(),xi=function(){function t(t){this.task=t,this.scheduledTime=0,this.order=0,this.result=null,this.canceled=!1}var e=t.prototype;return e.compare=function(t){return t.scheduledTime-this.scheduledTime||t.order-this.order},e.getTask=function(){return this.task},e.schedule=function(t,e){this.result=t,this.task.scheduler.schedule(this,e)},e.resumeInternal=function(){var t=this.task;if(this.task=null,t&&t.continuation==this){t.continuation=null;var e=Ei;return Ei=t,t.top.finish(this.result),Ei=e,!0}return!1},e.cancel=function(){this.canceled=!0},t}(),Ii=function(){function t(t,e){this.scheduler=t,this.name=e,this.callbacks=[],this.exception=null,this.running=!0,this.result=null,this.waitTarget=null,this.top=null,this.continuation=null}var e=t.prototype;return e.getName=function(){return this.name},e.interrupt=function(t){if(this.raise(t||new Error("E_TASK_INTERRUPT")),this!==Ei&&this.continuation){this.continuation.cancel();var e=new xi(this);this.waitTarget="interrupt",this.continuation=e,this.scheduler.schedule(e)}},e.getScheduler=function(){return this.scheduler},e.isRunning=function(){return this.running},e.whenDone=function(t){this.callbacks.push(t)},e.join=function(){var t=this,e=Ni("Task.join");if(this.running){var n=e.suspend(this);this.whenDone(function(){n.schedule(t.result)})}else e.finish(this.result);return e.result()},e.unwind=function(){for(;this.top&&!this.top.handler;)this.top=this.top.parent;if(this.top&&this.top.handler&&this.exception){var t=this.exception;this.exception=null,this.top.handler(this.top,t)}else this.exception&&h.error(this.exception,"Unhandled exception in task",this.name)},e.raise=function(t,e){if(this.fillStack(t),e){for(var n=this.top;n&&n!=e;)n=n.parent;n==e&&(this.top=n)}this.exception=t,this.unwind()},e.fillStack=function(t){var e=t.frameTrace;if(!e){e=t.stack?t.stack+"\n\t---- async ---\n":"";for(var n=this.top;n;n=n.parent)e+="\t",e+=n.getName(),e+="\n";t.frameTrace=e}},t}(),Pi=function(){function t(t){this.value=t}var e=t.prototype;return e.then=function(t){t(this.value)},e.thenAsync=function(t){return t(this.value)},e.thenReturn=function(e){return new t(e)},e.thenFinish=function(t){t.finish(this.value)},e.isPending=function(){return!1},e.get=function(){return this.value},t}(),Ri=function(){function t(t){this.frame=t}var e=t.prototype;return e.then=function(t){this.frame.then(t)},e.thenAsync=function(t){if(this.isPending()){var e=new Ai(this.frame.task,this.frame.parent,"AsyncResult.thenAsync");return e.state=qn.ACTIVE,this.frame.parent=e,this.frame.then(function(n){t(n).then(function(t){e.finish(t)})}),e.result()}return t(this.frame.res)},e.thenReturn=function(t){return this.isPending()?this.thenAsync(function(){return new Pi(t)}):new Pi(t)},e.thenFinish=function(t){this.isPending()?this.then(function(e){t.finish(e)}):t.finish(this.frame.res)},e.isPending=function(){return this.frame.state==qn.ACTIVE},e.get=function(){if(this.isPending())throw new Error("Result is pending");return this.frame.res},t}(),Ai=function(){function t(t,e,n){this.task=t,this.parent=e,this.name=n,this.res=null,this.callback=null,this.handler=null,this.state=qn.INIT}var e=t.prototype;return e.checkEnvironment=function(){if(!Ei)throw new Error("F_TASK_NO_CONTEXT");if(this!==Ei.top)throw new Error("F_TASK_NOT_TOP_FRAME")},e.result=function(){return new Ri(this)},e.finish=function(t){this.checkEnvironment(),Ei&&!Ei.exception&&(this.res=t),this.state=qn.FINISHED;var e=this.parent;if(Ei&&(Ei.top=e),this.callback){try{this.callback(t)}catch(t){this.task.raise(t,e)}this.state=qn.DEAD}},e.getTask=function(){return this.task},e.getName=function(){return this.name},e.getScheduler=function(){return this.task.scheduler},e.then=function(t){switch(this.state){case qn.ACTIVE:if(this.callback)throw new Error("F_TASK_FRAME_ALREADY_HAS_CALLBACK");this.callback=t;break;case qn.FINISHED:var e=this.task,n=this.parent;try{t(this.res),this.state=qn.DEAD}catch(t){this.state=qn.DEAD,e.raise(t,n)}break;case qn.DEAD:throw new Error("F_TASK_DEAD_FRAME");default:throw new Error("F_TASK_UNEXPECTED_FRAME_STATE "+this.state)}},e.timeSlice=function(){var t=Ni("Frame.timeSlice");return t.getScheduler().isTimeSliceOver()?(h.debug("-- time slice --"),t.suspend().schedule(!0)):t.finish(!0),t.result()},e.sleep=function(t){var e=Ni("Frame.sleep");return e.suspend().schedule(!0,t),e.result()},e.loop=function(t){var e=Ni("Frame.loop");return function n(i){try{for(;i;){var r=t();if(r.isPending())return void r.then(n);r.then(function(t){i=t})}e.finish(!0)}catch(t){e.task.raise(t,e)}}(!0),e.result()},e.loopWithFrame=function(t){var e=Ei;if(!e)throw new Error("E_TASK_NO_CONTEXT");return this.loop(function(){var n;do{var i=new Li(e,e.top);e.top=i,i.state=qn.ACTIVE,t(i),n=i.result()}while(!n.isPending()&&n.get());return n})},e.suspend=function(t){if(this.checkEnvironment(),this.task.continuation)throw new Error("E_TASK_ALREADY_SUSPENDED");var e=new xi(this.task);return this.task.continuation=e,Ei=null,this.task.waitTarget=t||null,e},t}(),Li=function(t){function e(e,n){return t.call(this,e,n,"loop")||this}x(e,t);var n=e.prototype;return n.continueLoop=function(){this.finish(!0)},n.breakLoop=function(){this.finish(!1)},e}(Ai),Oi=function(){function t(t,e){this.fetch=t,this.arrived=!1,this.resource=null,this.task=null,this.piggybacks=[],this.name=e}var e=t.prototype;return e.start=function(){var t=this;this.task||(this.task=yi().getScheduler().run(function(){var e=Ni("Fetcher.run");return t.fetch().then(function(n){var i=t.piggybacks;if(t.arrived=!0,t.resource=n,t.task=null,t.piggybacks=[],i)for(var r=0;r<i.length;r++)try{i[r](n)}catch(t){h.error(t,"Error:")}e.finish(n)}),e.result()},this.name))},e.piggyback=function(t){this.arrived?t(this.resource):this.piggybacks.push(t)},e.get=function(){return this.arrived?bi(this.resource):(this.start(),this.task.join())},e.hasArrived=function(){return this.arrived},t}(),ki=function(t){if(0==t.length)return bi(!0);if(1==t.length)return t[0].get().thenReturn(!0);var e=Ni("waitForFetches"),n=0;return e.loop(function(){for(;n<t.length;){var e=t[n++];if(!e.hasArrived())return e.get().thenReturn(!0)}return bi(!1)}).then(function(){e.finish(!0)}),e.result()};function Di(t,e){var n=null,i=null;"img"==t.localName&&(n=t.getAttribute("width"),i=t.getAttribute("height"));var r=new Oi(function(){var r=Ni("loadImage"),o=r.suspend(t),a=!1,s=function(e){a||(a=!0,"img"==t.localName&&(n||t.removeAttribute("width"),i||t.removeAttribute("height")),o.schedule(e?e.type:"timeout"))};return t.addEventListener("load",s,!1),t.addEventListener("error",s,!1),t.addEventListener("abort",s,!1),t.namespaceURI==V.SVG?(t.setAttributeNS(V.XLINK,"xlink:href",e),setTimeout(s,300)):t.src=e,r.result()},"loadElement "+e);return r.start(),r}var Fi,_i="\n/*\n * Copyright 2017 Trim-marks Inc.\n *\n * Vivliostyle.js is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Vivliostyle.js is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n@media screen {\n\n [data-vivliostyle-viewer-viewport] {\n background: #AAAAAA;\n }\n\n [data-vivliostyle-page-container] {\n background: white;\n }\n\n [data-vivliostyle-viewer-viewport] {\n display: -webkit-flex;\n display: flex;\n overflow: auto;\n position: relative;\n }\n\n [data-vivliostyle-outer-zoom-box] {\n margin: auto;\n overflow: hidden;\n -webkit-flex: none;\n flex: none;\n }\n\n [data-vivliostyle-viewer-viewport] [data-vivliostyle-spread-container] {\n display: -webkit-flex;\n display: flex;\n -webkit-flex: none;\n flex: none;\n -webkit-justify-content: center;\n justify-content: center;\n -moz-transform-origin: left top;\n -ms-transform-origin: left top;\n -webkit-transform-origin: left top;\n transform-origin: left top;\n }\n\n [data-vivliostyle-viewer-viewport][data-vivliostyle-page-progression=ltr] [data-vivliostyle-spread-container] {\n -webkit-flex-direction: row;\n flex-direction: row;\n }\n\n [data-vivliostyle-viewer-viewport][data-vivliostyle-page-progression=rtl] [data-vivliostyle-spread-container] {\n -webkit-flex-direction: row-reverse;\n flex-direction: row-reverse;\n }\n\n [data-vivliostyle-viewer-viewport] [data-vivliostyle-page-container] {\n margin: 0 auto;\n -webkit-flex: none;\n flex: none;\n transform-origin: center top;\n }\n\n [data-vivliostyle-viewer-viewport][data-vivliostyle-spread-view=true] [data-vivliostyle-page-container][data-vivliostyle-page-side=left] {\n margin-right: 1px;\n transform-origin: right top;\n }\n\n [data-vivliostyle-viewer-viewport][data-vivliostyle-spread-view=true] [data-vivliostyle-page-container][data-vivliostyle-page-side=right] {\n margin-left: 1px;\n transform-origin: left top;\n }\n\n [data-vivliostyle-viewer-viewport][data-vivliostyle-spread-view=true] [data-vivliostyle-page-container][data-vivliostyle-unpaired-page=true] {\n margin-left: auto;\n margin-right: auto;\n transform-origin: center top;\n }\n\n}\n",Bi="\n/*\n * Copyright 2015 Trim-marks Inc.\n * Copyright 2019 Vivliostyle Foundation\n *\n * Vivliostyle.js is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * Vivliostyle.js is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n[data-vivliostyle-layout-box] {\n position: absolute;\n left: 0;\n top: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n z-index: -1;\n}\n\n[data-vivliostyle-debug] [data-vivliostyle-layout-box] {\n right: auto;\n bottom: auto;\n overflow: visible;\n z-index: auto;\n}\n\n[data-vivliostyle-page-container] {\n position: relative;\n overflow: hidden;\n}\n\n[data-vivliostyle-bleed-box] {\n position: absolute;\n overflow: hidden;\n max-width: 100%;\n max-height: 100%;\n box-sizing: border-box;\n}\n\n[data-vivliostyle-page-box] ~ [data-vivliostyle-page-box] {\n display: none;\n}\n\n[data-vivliostyle-toc-box] {\n position: absolute;\n left: 3px;\n top: 3px;\n overflow: scroll;\n overflow-x: hidden;\n background: rgba(248,248,248,0.9);\n border-radius: 2px;\n box-shadow: 1px 1px 2px rgba(0,0,0,0.4);\n}\n\n@media print {\n [data-vivliostyle-toc-box] {\n display: none;\n }\n\n [data-vivliostyle-outer-zoom-box], [data-vivliostyle-spread-container] {\n width: 100% !important;\n height: 100% !important;\n }\n\n [data-vivliostyle-spread-container], [data-vivliostyle-page-container] {\n -moz-transform: none !important;\n -ms-transform: none !important;\n -webkit-transform: none !important;\n transform: none !important;\n }\n\n [data-vivliostyle-page-container] {\n display: block !important;\n max-width: 100%;\n height: 100% !important;\n max-height: 100%;\n }\n\n /* Workaround for Chrome printing problem */\n /* [data-vivliostyle-page-box] {\n padding-bottom: 0 !important;\n overflow: visible !important;\n } */\n [data-vivliostyle-bleed-box] > div > div::before {\n display: block;\n content: \"\";\n padding-top: 0.015625px;\n margin-bottom: -0.015625px;\n }\n\n /* Gecko-only hack, see https://bugzilla.mozilla.org/show_bug.cgi?id=267029#c17 */\n @-moz-document regexp('.*') {\n [data-vivliostyle-page-container]:nth-last-child(n+2) {\n top: -1px;\n margin-top: 1px;\n margin-bottom: -1px;\n }\n }\n}\n",Mi="\n/*\n * Copyright 2013 Google, Inc.\n * Copyright 2015 Trim-marks Inc.\n * Copyright 2019 Vivliostyle Foundation\n *\n * CSS property validation.\n */\nNUM = POS_NUM | ZERO | NEGATIVE;\nNNEG_NUM = POS_NUM | ZERO;\nINT = POS_INT | ZERO | NEGATIVE;\nNNEG_INT = POS_INT | ZERO;\nPERCENTAGE = POS_PERCENTAGE | ZERO | NEGATIVE;\nSTRICT_PERCENTAGE = POS_PERCENTAGE | ZERO_PERCENTAGE | NEGATIVE;\nNNEG_PERCENTAGE = POS_PERCENTAGE | ZERO;\nLENGTH = POS_LENGTH | ZERO | NEGATIVE;\nNNEG_LENGTH = POS_LENGTH | ZERO | NEGATIVE;\nPLENGTH = LENGTH | PERCENTAGE;\nPPLENGTH = POS_LENGTH | ZERO | POS_PERCENTAGE;\nALENGTH = LENGTH | auto;\nAPLENGTH = PLENGTH | auto;\nPAPLENGTH = PPLENGTH | auto;\nANGLE = POS_ANGLE | ZERO | NEGATIVE;\nLENGTH_OR_NUM = LENGTH | NUM;\nANGLE_OR_NUM = ANGLE | NUM;\nSCOLOR = HASHCOLOR | aliceblue: #F0F8FF | antiquewhite: #FAEBD7 | aqua: #00FFFF | aquamarine: #7FFFD4 | azure: #F0FFFF |\n beige: #F5F5DC | bisque: #FFE4C4 | black: #000000 | blanchedalmond: #FFEBCD | blue: #0000FF | blueviolet: #8A2BE2 | brown: #A52A2A |\n burlywood: #DEB887 | cadetblue: #5F9EA0 | chartreuse: #7FFF00 | chocolate: #D2691E | coral: #FF7F50 | cornflowerblue: #6495ED |\n cornsilk: #FFF8DC | crimson: #DC143C | cyan: #00FFFF | darkblue: #00008B | darkcyan: #008B8B | darkgoldenrod: #B8860B |\n darkgray: #A9A9A9 | darkgreen: #006400 | darkgrey: #A9A9A9 | darkkhaki: #BDB76B | darkmagenta: #8B008B | darkolivegreen: #556B2F |\n darkorange: #FF8C00 | darkorchid: #9932CC | darkred: #8B0000 | darksalmon: #E9967A | darkseagreen: #8FBC8F | darkslateblue: #483D8B |\n darkslategray: #2F4F4F | darkslategrey: #2F4F4F | darkturquoise: #00CED1 | darkviolet: #9400D3 | deeppink: #FF1493 |\n deepskyblue: #00BFFF | dimgray: #696969 | dimgrey: #696969 | dodgerblue: #1E90FF | firebrick: #B22222 | floralwhite: #FFFAF0 |\n forestgreen: #228B22 | fuchsia: #FF00FF | gainsboro: #DCDCDC | ghostwhite: #F8F8FF | gold: #FFD700 | goldenrod: #DAA520 |\n gray: #808080 | green: #008000 | greenyellow: #ADFF2F | grey: #808080 | honeydew: #F0FFF0 | hotpink: #FF69B4 | indianred: #CD5C5C |\n indigo: #4B0082 | ivory: #FFFFF0 | khaki: #F0E68C | lavender: #E6E6FA | lavenderblush: #FFF0F5 | lawngreen: #7CFC00 |\n lemonchiffon: #FFFACD | lightblue: #ADD8E6 | lightcoral: #F08080 | lightcyan: #E0FFFF | lightgoldenrodyellow: #FAFAD2 |\n lightgray: #D3D3D3 | lightgreen: #90EE90 | lightgrey: #D3D3D3 | lightpink: #FFB6C1 | lightsalmon: #FFA07A | lightseagreen: #20B2AA |\n lightskyblue: #87CEFA | lightslategray: #778899 | lightslategrey: #778899 | lightsteelblue: #B0C4DE | lightyellow: #FFFFE0 |\n lime: #00FF00 | limegreen: #32CD32 | linen: #FAF0E6 | magenta: #FF00FF | maroon: #800000 | mediumaquamarine: #66CDAA |\n mediumblue: #0000CD | mediumorchid: #BA55D3 | mediumpurple: #9370DB | mediumseagreen: #3CB371 | mediumslateblue: #7B68EE |\n mediumspringgreen: #00FA9A | mediumturquoise: #48D1CC | mediumvioletred: #C71585 | midnightblue: #191970 | mintcream: #F5FFFA |\n mistyrose: #FFE4E1 | moccasin: #FFE4B5 | navajowhite: #FFDEAD | navy: #000080 | oldlace: #FDF5E6 | olive: #808000 |\n olivedrab: #6B8E23 | orange: #FFA500 | orangered: #FF4500 | orchid: #DA70D6 | palegoldenrod: #EEE8AA | palegreen: #98FB98 |\n paleturquoise: #AFEEEE | palevioletred: #DB7093 | papayawhip: #FFEFD5 | peachpuff: #FFDAB9 | peru: #CD853F | pink: #FFC0CB |\n plum: #DDA0DD | powderblue: #B0E0E6 | purple: #800080 | rebeccapurple: #663399 | red: #FF0000 | rosybrown: #BC8F8F | royalblue: #4169E1 |\n saddlebrown: #8B4513 | salmon: #FA8072 | sandybrown: #F4A460 | seagreen: #2E8B57 | seashell: #FFF5EE | sienna: #A0522D |\n silver: #C0C0C0 | skyblue: #87CEEB | slateblue: #6A5ACD | slategray: #708090 | slategrey: #708090 | snow: #FFFAFA |\n springgreen: #00FF7F | steelblue: #4682B4 | tan: #D2B48C | teal: #008080 | thistle: #D8BFD8 | tomato: #FF6347 |\n turquoise: #40E0D0 | violet: #EE82EE | wheat: #F5DEB3 | white: #FFFFFF | whitesmoke: #F5F5F5 | yellow: #FFFF00 |\n yellowgreen: #9ACD32 | transparent | currentcolor;\nRGBCOLOR = rgb(INT{3}) | rgb(STRICT_PERCENTAGE{3});\nRGBACOLOR = rgba(NUM{4}) | rgba(STRICT_PERCENTAGE{3} NUM);\nHSLCOLOR = hsl(NUM PERCENTAGE{2});\nHSLACOLOR = hsl(NUM PERCENTAGE{2} NUM);\nCOLOR = SCOLOR | RGBCOLOR | RGBACOLOR | HSLCOLOR | HSLACOLOR;\nBG_POSITION_TERM = PLENGTH | left | center | right | top | bottom;\nSIDE_OR_CORNER = [left | right] || [top | bottom];\nCOLOR_STOP = SPACE(COLOR [PERCENTAGE | LENGTH]?);\nLINEAR_GRADIENT = linear-gradient([ANGLE | SPACE(to SIDE_OR_CORNER)]? COLOR_STOP+) |\n repeating-linear-gradient([ANGLE | SPACE(to SIDE_OR_CORNER)]? COLOR_STOP+) |;\nGRADIENT_EXTENT = closest-corner | closest-side | farthest-corner | farthest-side;\nGRADIENT_POSITION = at BG_POSITION_TERM{1,4};\nGRADIENT_SHAPE = SPACE(circle LENGTH? GRADIENT_POSITION?) | SPACE(ellipse PLENGTH{2}? GRADIENT_POSITION?)| SPACE([circle | ellipse] GRADIENT_EXTENT? GRADIENT_POSITION?);\nRADIAL_GRADIENT = radial-gradient([GRADIENT_SHAPE | SPACE(GRADIENT_POSITION)]? COLOR_STOP+) |\n repeating-radial-gradient([GRADIENT_SHAPE | SPACE(GRADIENT_POSITION)]? COLOR_STOP+);\nURI_OR_NONE = URI | none;\nIMAGE = URI | LINEAR_GRADIENT | RADIAL_GRADIENT | none;\nazimuth = ANGLE | [[ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards;\nbackground-attachment = COMMA( [scroll | fixed | local]+ );\nbackground-color = COLOR;\nbackground-image = COMMA( IMAGE+ );\nbackground-position = COMMA( SPACE(BG_POSITION_TERM{1,4})+ ); /* relaxed */\nbackground-repeat = COMMA( [repeat | repeat-x | repeat-y | no-repeat]+ );\nborder-collapse = collapse | separate;\nBORDER_SIDE_COLOR = COLOR;\nBORDER_SIDE_STYLE = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset;\nBORDER_SIDE_WIDTH = thin: 1px | medium: 3px | thick: 5px | NNEG_LENGTH;\nborder-spacing = LENGTH LENGTH?;\nborder-top-color = BORDER_SIDE_COLOR;\nborder-right-color = BORDER_SIDE_COLOR;\nborder-bottom-color = BORDER_SIDE_COLOR;\nborder-left-color = BORDER_SIDE_COLOR;\nborder-top-style = BORDER_SIDE_STYLE;\nborder-right-style = BORDER_SIDE_STYLE;\nborder-bottom-style = BORDER_SIDE_STYLE;\nborder-left-style = BORDER_SIDE_STYLE;\nborder-top-width = BORDER_SIDE_WIDTH;\nborder-right-width = BORDER_SIDE_WIDTH;\nborder-bottom-width = BORDER_SIDE_WIDTH;\nborder-left-width = BORDER_SIDE_WIDTH;\nBORDER_RADIUS = PLENGTH{1,2};\nborder-top-left-radius = BORDER_RADIUS;\nborder-top-right-radius = BORDER_RADIUS;\nborder-bottom-right-radius = BORDER_RADIUS;\nborder-bottom-left-radius = BORDER_RADIUS;\nborder-image-source = IMAGE;\nborder-image-slice = [NUM | PERCENTAGE]{1,4} || fill; /* relaxed */\nborder-image-width = [NUM | PLENGTH | auto]{1,4};\nborder-image-outset = [NUM | LENGTH]{1,4};\nborder-image-repeat = [ stretch | repeat | round | space ]{1,2};\nbottom = APLENGTH;\ncaption-side = top | bottom;\nclear = none | left | right | top | bottom | both | all | same;\nclip = rect(ALENGTH{4}) | rect(SPACE(ALENGTH{4})) | auto;\ncolor = COLOR;\nLIST_STYLE_TYPE = disc | circle | square | decimal | decimal-leading-zero | lower-roman |\n upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha |\n upper-alpha | russian | upper-russian | lower-russian | cjk-ideographic | trad-chinese-informal |\n hebrew | none;\nTYPE_OR_UNIT_IN_ATTR = string | color | url | integer | number | length | angle | time | frequency;\nATTR = attr(SPACE(IDENT TYPE_OR_UNIT_IN_ATTR?) [ STRING | IDENT | COLOR | INT | NUM | PLENGTH | ANGLE | POS_TIME | FREQUENCY]?);\nCONTENT = normal | none |\n [ STRING | URI | counter(IDENT LIST_STYLE_TYPE?) |\n counters(IDENT STRING LIST_STYLE_TYPE?) | ATTR |\n target-counter([ STRING | URI ] IDENT LIST_STYLE_TYPE?) |\n target-counter(ATTR IDENT LIST_STYLE_TYPE?) |\n target-counters([ STRING | URI ] IDENT STRING LIST_STYLE_TYPE?) |\n target-counters(ATTR IDENT STRING LIST_STYLE_TYPE?) |\n open-quote | close-quote | no-open-quote | no-close-quote ]+;\ncontent = CONTENT;\nCOUNTER = [ IDENT INT? ]+ | none;\ncounter-increment = COUNTER;\ncounter-reset = COUNTER;\ncounter-set = COUNTER;\ncue-after = URI_OR_NONE;\ncue-before = URI_OR_NONE;\ncursor = COMMA(URI* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize |\n n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress ]);\ndirection = ltr | rtl;\ndisplay = inline | block | list-item | inline-block | table | inline-table | table-row-group |\n table-header-group | table-footer-group | table-row | table-column-group | table-column |\n table-cell | table-caption | none | oeb-page-head | oeb-page-foot | flex | inline-flex |\n ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | run-in | compact | marker;\nelevation = ANGLE | below | level | above | higher | lower;\nempty-cells = show | hide;\nFAMILY = SPACE(IDENT+) | STRING;\nFAMILY_LIST = COMMA( FAMILY+ );\nfont-family = FAMILY_LIST;\nfont-size = xx-small | x-small | small | medium | large | x-large | xx-large | larger | smaller | PPLENGTH | POS_NUM;\nfont-style = normal | italic | oblique;\nfont-variant = normal | small-caps;\nfont-weight = normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\nheight = PAPLENGTH | POS_NUM ;\nleft = APLENGTH;\nletter-spacing = normal | LENGTH_OR_NUM;\nline-height = normal | POS_NUM | PPLENGTH;\nlist-style-image = IMAGE;\nlist-style-position = inside | outside;\nlist-style-type = LIST_STYLE_TYPE;\nmargin-right = APLENGTH;\nmargin-left = APLENGTH;\nmargin-top = APLENGTH;\nmargin-bottom = APLENGTH;\nNPLENGTH = none | PLENGTH;\nmax-height = NPLENGTH;\nmax-width = NPLENGTH;\nmin-height = auto | PLENGTH;\nmin-width = auto | PLENGTH;\norphans = POS_INT;\noutline-offset = LENGTH;\noutline-color = COLOR | invert;\noutline-style = BORDER_SIDE_STYLE;\noutline-width = BORDER_SIDE_WIDTH;\noverflow = visible | hidden | scroll | auto;\npadding-right = PPLENGTH;\npadding-left = PPLENGTH;\npadding-top = PPLENGTH;\npadding-bottom = PPLENGTH;\nPAGE_BREAK = auto | always | avoid | left | right | recto | verso;\npage-break-after = PAGE_BREAK;\npage-break-before = PAGE_BREAK;\npage-break-inside = avoid | auto;\nPAUSE = POS_TIME | ZERO | POS_PERCENTAGE;\npause-after = PAUSE;\npause-before = PAUSE;\npitch-range = NUM;\npitch = FREQUENCY | x-low | low | medium | high | x-high;\nplay-during = [URI [ mix || repeat ]?] | auto | none;\nposition = static | relative | absolute | fixed;\nquotes = [STRING STRING]+ | none;\nrichness = NUM;\nright = APLENGTH;\nspeak-header = once | always;\nspeak-numeral = digits | continuous;\nspeak-punctuation = code | none;\nspeech-rate = NUM | x-slow | slow | medium | fast | x-fast | faster | slower;\nstress = NUM;\ntable-layout = auto | fixed;\ntext-align = left | right | center | justify | start | end;\ntext-decoration = none | [ underline || overline || line-through || blink ];\ntext-indent = PLENGTH;\ntext-transform = capitalize | uppercase | lowercase | none;\ntop = APLENGTH;\nvertical-align = baseline | sub | super | top | text-top | middle | bottom | text-bottom | PLENGTH;\nvisibility = visible | hidden | collapse;\nvoice-family = FAMILY_LIST;\nvolume = NUM | PERCENTAGE | silent | x-soft | soft | medium | loud | x-loud;\nwhite-space = normal | pre | nowrap | pre-wrap | pre-line;\nwidows = POS_INT;\nwidth = PAPLENGTH | POS_NUM ;\nword-spacing = normal | LENGTH_OR_NUM;\nz-index = auto | INT;\n\n[epub,moz,ms,webkit]hyphens = auto | manual | none;\n[webkit]hyphenate-character = auto | STRING;\n\n/* css-logical */\nmargin-block-start = APLENGTH;\nmargin-block-end = APLENGTH;\nmargin-inline-start = APLENGTH;\nmargin-inline-end = APLENGTH;\npadding-block-start = APLENGTH;\npadding-block-end = APLENGTH;\npadding-inline-start = APLENGTH;\npadding-inline-end = APLENGTH;\nborder-block-start-color = BORDER_SIDE_COLOR;\nborder-block-end-color = BORDER_SIDE_COLOR;\nborder-inline-start-color = BORDER_SIDE_COLOR;\nborder-inline-end-color = BORDER_SIDE_COLOR;\nborder-block-start-style = BORDER_SIDE_STYLE;\nborder-block-end-style = BORDER_SIDE_STYLE;\nborder-inline-start-style = BORDER_SIDE_STYLE;\nborder-inline-end-style = BORDER_SIDE_STYLE;\nborder-block-start-width = BORDER_SIDE_WIDTH;\nborder-block-end-width = BORDER_SIDE_WIDTH;\nborder-inline-start-width = BORDER_SIDE_WIDTH;\nborder-inline-end-width = BORDER_SIDE_WIDTH;\nblock-start = APLENGTH;\nblock-end = APLENGTH;\ninline-start = APLENGTH;\ninline-end = APLENGTH;\nblock-size = PAPLENGTH | POS_NUM;\ninline-size = PAPLENGTH | POS_NUM;\nmax-block-size = NPLENGTH;\nmax-inline-size = NPLENGTH;\nmin-block-size = auto | PLENGTH;\nmin-inline-size = auto | PLENGTH;\n\nSHAPE = auto | rectangle( PLENGTH{4} ) | ellipse( PLENGTH{4} ) | circle( PLENGTH{3} ) |\n polygon( SPACE(PLENGTH+)+ );\n[epubx]shape-inside = SHAPE;\n[epubx,webkit]shape-outside = SHAPE;\n[epubx,ms]wrap-flow = auto | both | start | end | maximum | clear | around /* epub al */;\n\nTRANSFORM_FUNCTION = matrix(NUM{6}) | translate(PLENGTH{1,2}) | translateX(PLENGTH) | translateY(PLENGTH) |\n scale(NUM{1,2}) | scaleX(NUM) | scaleY(NUM) | rotate(ANGLE) | skewX(ANGLE) | skewY(ANGLE);\n[epub,ms]transform = none | TRANSFORM_FUNCTION+;\n[epub,ms]transform-origin = [[[ top | bottom | left | right] PLENGTH?] | center | PLENGTH]{1,2}; /* relaxed */\n\nBOX = border-box | padding-box | content-box;\nSHADOW = SPACE(inset || LENGTH{2,4} || COLOR); /* relaxed */\n[webkit]background-size = COMMA( SPACE( [PLENGTH | auto ]{1,2} | cover | contain)+ );\n[webkit]background-origin = COMMA( BOX+ );\n[webkit]background-clip = COMMA( BOX+ );\n[webkit]box-shadow = none | COMMA( SHADOW+ );\ntext-shadow = none | COMMA( SHADOW+ );\n[webkit]box-decoration-break = slice | clone;\nFILTER_FUNCTION = blur(LENGTH) | brightness(NUM | PERCENTAGE) | contrast(NUM | PERCENTAGE) | drop-shadow(SPACE(LENGTH{2,3} COLOR?))\n | grayscale(NUM | PERCENTAGE) | hue-rotate(ANGLE) | invert(NUM | PERCENTAGE) | opacity(NUM | PERCENTAGE)\n | saturate(NUM | PERCENTAGE) | sepia(NUM | PERCENTAGE);\nFILTER_FUNCTION_LIST = FILTER_FUNCTION+;\n[webkit]filter = none | FILTER_FUNCTION_LIST;\n\nopacity = NUM;\n\n[moz,webkit]column-width = LENGTH | auto;\n[moz,webkit]column-count = INT | auto;\n[moz,webkit]column-gap = LENGTH | normal;\n[moz,webkit]column-rule-color = COLOR;\n[moz,webkit]column-rule-style = BORDER_SIDE_STYLE;\n[moz,webkit]column-rule-width = BORDER_SIDE_WIDTH;\nBREAK = auto | avoid | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region;\nbreak-before = BREAK;\nbreak-after = BREAK;\nbreak-inside = auto | avoid | avoid-page | avoid-column | avoid-region;\n[webkit]column-span = none | auto | all;\n[moz]column-fill = auto | balance | balance-all;\n\nsrc = COMMA([SPACE(URI format(STRING+)?) | local(FAMILY)]+); /* for font-face */\n\n[epubx,webkit]flow-from = IDENT;\n[epubx,webkit]flow-into = IDENT;\n[epubx]flow-linger = INT | none;\n[epubx]flow-priority = INT;\n[epubx]flow-options = none | [ exclusive || last || static ];\n[epubx]page = INT | auto;\n[epubx]min-page-width = LENGTH;\n[epubx]min-page-height = LENGTH;\n[epubx]required = true | false;\n[epubx]enabled = true | false;\n[epubx]conflicting-partitions = COMMA(IDENT+);\n[epubx]required-partitions = COMMA(IDENT+);\n[epubx]snap-height = LENGTH | none;\n[epubx]snap-width = LENGTH | none;\n[epubx]flow-consume = all | some;\n[epubx]utilization = NUM;\n[epubx]text-zoom = font-size | scale;\n\n[adapt]template = URI_OR_NONE;\n[adapt]behavior = IDENT;\n\n/* CSS Fonts */\nfont-size-adjust = none | NNEG_NUM;\n[webkit]font-kerning = auto | normal | none;\nfont-variant-east-asian = normal | [[ jis78 | jis83 | jis90 | jis04 | simplified | traditional ] || [ full-width | proportional-width ] || ruby];\nfont-feature-settings = COMMA( SPACE( STRING [ on | off | INT ]? )+ );\nfont-stretch = normal | wider | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded;\n\n/* CSS Images */\nimage-resolution = RESOLUTION;\nobject-fit = fill | contain | cover | none | scale-down;\nobject-position = COMMA( SPACE(BG_POSITION_TERM{1,4})+ ); /* relaxed */\n\n/* CSS Paged Media */\nPAGE_SIZE = a5 | a4 | a3 | b5 | b4 | jis-b5 | jis-b4 | letter | legal | ledger;\nbleed = auto | LENGTH;\nmarks = none | [ crop || cross ];\nsize = POS_LENGTH{1,2} | auto | [ PAGE_SIZE || [ portrait | landscape ] ];\n\n/* CSS Page Floats */\nfloat-reference = inline | column | region | page;\nfloat = block-start | block-end | inline-start | inline-end | snap-block | snap-inline | left | right | top | bottom | none | footnote;\nfloat-min-wrap-block = PPLENGTH;\n\n/* CSS Ruby */\nruby-align = start | center | space-between | space-around;\nruby-position = over | under | inter-character;\n\n/* CSS Size Adjust */\n[moz,ms]text-size-adjust = auto | none | POS_PERCENTAGE;\n\n/* CSS Text */\n[ms,webkit]line-break = auto | loose | normal | strict;\noverflow-wrap = normal | break-word;\n[moz]tab-size = NNEG_INT | NNEG_LENGTH;\n[moz,ms]text-align-last = auto | start | end | left | right | center | justify;\n[ms]text-justify = auto | none | inter-word | inter-character | inter-ideograph /* specified in UA stylesheet for IE */;\n[ms]word-break = normal | keep-all | break-all | break-word;\n[ms]word-wrap = normal | break-word;\n\n/* CSS Text Decoration */\n[webkit]text-decoration-color = COLOR;\n[webkit]text-decoration-line = none | [ underline || overline || line-through || blink ];\n[webkit]text-decoration-skip = none | [ objects || spaces || ink || edges || box-decoration ];\n[webkit]text-decoration-style = solid | double | dotted | dashed | wavy;\n[epub,webkit]text-emphasis-color = COLOR;\n[webkit]text-emphasis-position = [ over | under ] [ right | left ];\n[epub,webkit]text-emphasis-style = none | [[ filled | open ] || [ dot | circle | double-circle | triangle | sesame ]] | STRING;\n[ms,webkit]text-underline-position = auto | [ under || [ left | right ]];\n\n/* CSS Transforms */\n[ms,webkit]backface-visibility = visible | hidden;\n\n/* CSS UI */\nbox-sizing = content-box | padding-box | border-box;\n[ms]text-overflow = [clip | ellipsis | STRING]{1,2};\n\n/* CSS Writing Modes */\n[webkit]text-combine = none | horizontal;\n[epub,ms]text-combine-horizontal = none | all | [ digits POS_INT? ]; /* relaxed */\ntext-combine-upright = none | all | [ digits POS_INT? ]; /* relaxed */\n[epub,webkit]text-orientation = mixed | upright | sideways-right | sideways-left | sideways | use-glyph-orientation /* the following values are kept for backward-compatibility */ | vertical-right | rotate-right | rotate-left | rotate-normal | auto;\nunicode-bidi = normal | embed | isolate | bidi-override | isolate-override | plaintext;\n[epub,webkit]writing-mode = horizontal-tb | vertical-rl | lr-tb | rl-tb | tb-rl | lr | rl | tb;\n\n/* CSS Flex box */\nFLEX_BASIS = content | PAPLENGTH;\nflex-direction = row | row-reverse | column | column-reverse;\nflex-wrap = nowrap | wrap | wrap-reverse;\norder = INT;\nflex-grow = NNEG_NUM;\nflex-shrink = NNEG_NUM;\nflex-basis = FLEX_BASIS;\nflex = none | [ [ NNEG_NUM NNEG_NUM? ] || FLEX_BASIS ];\njustify-content = flex-start | flex-end | center | space-between | space-around;\nalign-items = flex-start | flex-end | center | baseline | stretch;\nalign-self = auto | flex-start | flex-end | center | baseline | stretch;\nalign-content = flex-start | flex-end | center | space-between | space-around | stretch;\n\n/* Pointer Events */\n[ms]touch-action = auto | none | [ pan-x || pan-y ] | manipulation;\n\n/* SVG 2 */\nOPACITY_VALUE = NUM | PERCENTAGE;\nDASH_ARRAY = COMMA( SPACE( [ LENGTH | PERCENTAGE | NUM ]+ )+ );\nPAINT = none | child | child(INT) | COLOR | SPACE( URI [none | COLOR]? ) | context-fill | context-stroke;\ncolor-interpolation = auto | sRGB | linearRGB;\ncolor-rendering = auto | optimizeSpeed | optimizeQuality;\nfill = PAINT;\nfill-opacity = OPACITY_VALUE;\nfill-rule = nonzero | evenodd;\nglyph-orientation-vertical = auto | NUM | ANGLE;\nimage-rendering = auto | optimizeSpeed | optimizeQuality | crisp-edges | pixelated;\nmarker-start = none | URI;\nmarker-mid = none | URI;\nmarker-end = none | URI;\npointer-events = bounding-box | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | none;\npaint-order = normal | [ fill || stroke || markers ];\nshape-rendering = auto | optimizeSpeed | crispEdges | geometricPrecision;\nstop-color = COLOR;\nstop-opacity = OPACITY_VALUE;\nstroke = PAINT;\nstroke-dasharray = none | DASH_ARRAY;\nstroke-dashoffset = PERCENTAGE | LENGTH_OR_NUM;\nstroke-linecap = butt | round | square;\nstroke-linejoin = miter | round | bevel;\nstroke-miterlimit = NUM;\nstroke-opacity = OPACITY_VALUE;\nstroke-width = PERCENTAGE | LENGTH_OR_NUM;\ntext-anchor = start | middle | end;\ntext-rendering = auto | optimizeSpeed | optimizeLegibility | geometricPrecision;\nvector-effect = none | SPACE( [ non-scaling-stroke | non-scaling-size | non-rotation | fixed-position ]+ [ viewport | screen ]? );\n\n/* SVG 1.1 */\nalignment-baseline = auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical;\nbaseline-shift = baseline | sub | super | PERCENTAGE | LENGTH_OR_NUM;\ndominant-baseline = auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge;\nmask = none | URI;\n\n/* css-masking-1 */\nSHAPE_RADIUS = PLENGTH | closest-side | farthest-side;\nFILL_RULE = nonzero | evenodd;\nSHAPE_BOX = BOX | margin-box;\nGEOMETRY_BOX = SHAPE_BOX | fill-box | stroke-box | view-box;\nBASIC_SHAPE =\n inset( SPACE( PLENGTH{1,4} [ round PLENGTH{1,4} [ SLASH PLENGTH{1,4} ]? ]? ) )\n | circle( SPACE( [SHAPE_RADIUS]? [at BG_POSITION_TERM{1,4}]? ) )\n | ellipse( SPACE( SHAPE_RADIUS{2}? [at BG_POSITION_TERM{1,4}]? ) )\n | polygon( FILL_RULE? COMMA( SPACE( PLENGTH{2} )+ )+ );\n[webkit]clip-path = none | URI | [ BASIC_SHAPE || GEOMETRY_BOX ];\nclip-rule = nonzero | evenodd;\n\n/* filters */\nflood-color = COLOR;\nflood-opacity = OPACITY_VALUE;\nlighting-color = COLOR;\n\n/* compositing-1 */\nBLEND_MODE = normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity;\nmix-blend-mode = BLEND_MODE;\nisolation = auto | isolate;\nbackground-blend-mode = COMMA( BLEND_MODE+ );\n\n/* CSS GCPM */\nfootnote-policy = auto | line;\n\n[viv]repeat-on-break = auto | none | header | footer;\n\nDEFAULTS\n\nbackground-attachment: scroll;\nbackground-color: transparent;\nbackground-image: none;\nbackground-repeat: repeat;\nbackground-position: 0% 0%;\nbackground-clip: border-box;\nbackground-origin: padding-box;\nbackground-size: auto;\nborder-top-color: currentColor;\nborder-right-color: currentColor;\nborder-bottom-color: currentColor;\nborder-left-color: currentColor;\nborder-top-style: none;\nborder-right-style: none;\nborder-bottom-style: none;\nborder-left-style: none;\nborder-top-width: 3px;\nborder-right-width: 3px;\nborder-bottom-width: 3px;\nborder-left-width: 3px;\nborder-top-left-radius: 0;\nborder-top-right-radius: 0;\nborder-bottom-right-radius: 0;\nborder-bottom-left-radius: 0;\nborder-image-source: none;\nborder-image-slice: 100%;\nborder-image-width: 1;\nborder-image-outset: 0;\nborder-image-repeat: stretch;\ncolumn-count: auto;\ncolumn-gap: normal;\ncolumn-width: auto;\ncolumn-rule-color: currentColor;\ncolumn-rule-style: none;\ncolumn-rule-width: 3px;\ncolumn-fill: balance;\noutline-color: currentColor;\noutline-style: none;\noutline-width: 3px;\nflex-direction: row;\nflex-wrap: nowrap;\nfont-family: serif;\nfont-style: normal;\nfont-size: medium;\nfont-variant: normal;\nfont-weight: normal;\nfont-stretch: normal;\nline-height: normal;\nlist-style-image: none;\nlist-style-position: outside;\nlist-style-type: disc;\nmargin-bottom: auto;\nmargin-left: auto;\nmargin-right: auto;\nmargin-top: auto;\npadding-bottom: auto;\npadding-left: auto;\npadding-right: auto;\npadding-top: auto;\ntext-emphasis-color: currentColor;\ntext-emphasis-style: none;\nmarker-start: none;\nmarker-mid: none;\nmarker-end: none;\n\n/* css-logical */\nborder-block-start-color: currentColor;\nborder-block-end-color: currentColor;\nborder-inline-start-color: currentColor;\nborder-inline-end-color: currentColor;\nborder-block-start-style: none;\nborder-block-end-style: none;\nborder-inline-start-style: none;\nborder-inline-end-style: none;\nborder-block-start-width: 3px;\nborder-block-end-width: 3px;\nborder-inline-start-width: 3px;\nborder-inline-end-width: 3px;\n\nSHORTHANDS\n\nbackground = COMMA background-image [background-position [ / background-size ]] background-repeat\n background-attachment [background-origin background-clip] background-color; /* background-color is a special case, see the code */\nborder-top = border-top-width border-top-style border-top-color;\nborder-right = border-right-width border-right-style border-right-color;\nborder-bottom = border-bottom-width border-bottom-style border-bottom-color;\nborder-left = border-left-width border-left-style border-left-color;\nborder-width = INSETS border-top-width border-right-width border-bottom-width border-left-width;\nborder-style = INSETS border-top-style border-right-style border-bottom-style border-left-style;\nborder-color = INSETS border-top-color border-right-color border-bottom-color border-left-color;\nborder = border-width border-style border-color;\nborder-image = border-image-source border-image-slice [ / border-image-width [ / border-image-outset ] ]\n border-image-repeat;\nborder-radius = INSETS_SLASH border-top-left-radius border-top-right-radius\n border-bottom-right-radius border-bottom-left-radius;\n[moz,webkit]columns = column-width column-count;\n[moz,webkit]column-rule = column-rule-width column-rule-style column-rule-color;\nflex-flow = flex-direction flex-wrap;\noeb-column-number = column-count;\noutline = outline-width outline-style outline-color;\nlist-style = list-style-type list-style-position list-style-image;\nmargin = INSETS margin-top margin-right margin-bottom margin-left;\npadding = INSETS padding-top padding-right padding-bottom padding-left;\npause = INSETS pause-before pause-after;\nfont = FONT font-style font-variant font-weight font-stretch /* font-size line-height font-family are special-cased */;\n[epub,webkit]text-emphasis = text-emphasis-style text-emphasis-color;\nmarker = INSETS marker-start marker-mid marker-end;\n\n/* css-logical */\nmargin-block = INSETS margin-block-start margin-block-end;\nmargin-inline = INSETS margin-inline-start margin-inline-end;\npadding-block = INSETS padding-block-start padding-block-end;\npadding-inline = INSETS padding-inline-start padding-inline-end;\nborder-block-width = INSETS border-block-start-width border-block-end-width;\nborder-block-style = INSETS border-block-start-style border-block-end-style;\nborder-block-color = INSETS border-block-start-color border-block-end-color;\nborder-inline-width = INSETS border-inline-start-width border-inline-end-width;\nborder-inline-style = INSETS border-inline-start-style border-inline-end-style;\nborder-inline-color = INSETS border-inline-start-color border-inline-end-color;\nborder-block = border-block-width border-block-style border-block-color;\nborder-inline = border-inline-width border-inline-style border-inline-color;\nborder-block-start = border-block-start-width border-block-start-style border-block-start-color;\nborder-block-end = border-block-end-width border-block-end-style border-block-end-color;\nborder-inline-start = border-inline-start-width border-inline-start-style border-inline-start-color;\nborder-inline-end = border-inline-end-width border-inline-end-style border-inline-end-color;\ninset-block-start = block-start;\ninset-block-end = block-end;\ninset-inline-start = inline-start;\ninset-inline-end = inline-end;\ninset-block = INSETS block-start block-end;\ninset-inline = INSETS inline-start inline-end;\n\n/* old names */\n[adapt,webkit]margin-before = margin-block-start;\n[adapt,webkit]margin-after = margin-block-end;\n[adapt,webkit]margin-start = margin-inline-start;\n[adapt,webkit]margin-end = margin-inline-end;\n[adapt,webkit]padding-before = padding-block-start;\n[adapt,webkit]padding-after = padding-block-end;\n[adapt,webkit]padding-start = padding-inline-start;\n[adapt,webkit]padding-end = padding-inline-end;\n[adapt,webkit]border-before-color = border-block-start-color;\n[adapt,webkit]border-after-color = border-block-end-color;\n[adapt,webkit]border-start-color = border-inline-start-color;\n[adapt,webkit]border-end-color = border-inline-end-color;\n[adapt,webkit]border-before-style = border-block-start-style;\n[adapt,webkit]border-after-style = border-block-end-style;\n[adapt,webkit]border-start-style = border-inline-start-style;\n[adapt,webkit]border-end-style = border-inline-end-style;\n[adapt,webkit]border-before-width = border-block-start-width;\n[adapt,webkit]border-after-width = border-block-end-width;\n[adapt,webkit]border-start-width = border-inline-start-width;\n[adapt,webkit]border-end-width = border-inline-end-width;\n[adapt,webkit]before = block-start;\n[adapt,webkit]after = block-end;\n[adapt,webkit]start = inline-start;\n[adapt,webkit]end = inline-end;\n\n",Ui='\n<!DOCTYPE html>\n<html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://www.pyroxy.com/ns/shadow">\n<head>\n<style><![CDATA[\n\n.footnote-content {\n float: footnote;\n}\n\n.table-cell-container {\n display: block;\n}\n\n]]></style>\n</head>\n<body>\n\n<s:template id="footnote"><s:content/><s:include class="footnote-content"/></s:template>\n\n<s:template id="table-cell"><div data-vivliostyle-flow-root="true" class="table-cell-container"><s:content/></div></s:template>\n\n</body>\n</html>',Vi='\n@namespace html "http://www.w3.org/1999/xhtml";\n\nhtml|body {\n hyphens: -epubx-expr(pref-hyphenate? "auto": "manual");\n}\n\n@-adapt-footnote-area {\n display: block;\n margin-block-start: 0.5em;\n margin-block-end: 0.5em;\n}\n\n@-adapt-footnote-area ::before {\n display: block;\n border-block-start-width: 1px;\n border-block-start-style: solid;\n border-block-start-color: black;\n margin-block-end: 0.4em;\n margin-inline-start: 0;\n margin-inline-end: 60%;\n}\n\n/* default page master */\n@-epubx-page-master :background-host {\n @-epubx-partition :layout-host {\n -epubx-flow-from: body;\n top: -epubx-expr(header.margin-bottom-edge);\n bottom: -epubx-expr(page-height - footer.margin-top-edge);\n left: 0px;\n right: 0px;\n column-width: 25em;\n }\n @-epubx-partition footer :oeb-page-foot {\n writing-mode: horizontal-tb;\n -epubx-flow-from: oeb-page-foot;\n bottom: 0px;\n left: 0px;\n right: 0px;\n }\n @-epubx-partition header :oeb-page-head {\n writing-mode: horizontal-tb;\n -epubx-flow-from: oeb-page-head;\n top: 0px;\n left: 0px;\n right: 0px;\n }\n}\n\n@page {\n @top-left-corner {\n text-align: right;\n vertical-align: middle;\n }\n @top-left {\n text-align: left;\n vertical-align: middle;\n }\n @top-center {\n text-align: center;\n vertical-align: middle;\n }\n @top-right {\n text-align: right;\n vertical-align: middle;\n }\n @top-right-corner {\n text-align: left;\n vertical-align: middle;\n }\n @left-top {\n text-align: center;\n vertical-align: top;\n }\n @left-middle {\n text-align: center;\n vertical-align: middle;\n }\n @left-bottom {\n text-align: center;\n vertical-align: bottom;\n }\n @right-top {\n text-align: center;\n vertical-align: top;\n }\n @right-middle {\n text-align: center;\n vertical-align: middle;\n }\n @right-bottom {\n text-align: center;\n vertical-align: bottom;\n }\n @bottom-left-corner {\n text-align: right;\n vertical-align: middle;\n }\n @bottom-left {\n text-align: left;\n vertical-align: middle;\n }\n @bottom-center {\n text-align: center;\n vertical-align: middle;\n }\n @bottom-right {\n text-align: right;\n vertical-align: middle;\n }\n @bottom-right-corner {\n text-align: left;\n vertical-align: middle;\n }\n}\n\n@media print {\n @page {\n margin: 10%;\n }\n}\n',Hi='\n@namespace html "http://www.w3.org/1999/xhtml";\n\nhtml|html,\nhtml|address,\nhtml|blockquote,\nhtml|body,\nhtml|dd,\nhtml|div,\nhtml|dl,\nhtml|dt,\nhtml|fieldset,\nhtml|form,\nhtml|frame,\nhtml|frameset,\nhtml|h1,\nhtml|h2,\nhtml|h3,\nhtml|h4,\nhtml|h5,\nhtml|h6,\nhtml|noframes,\nhtml|ol,\nhtml|p,\nhtml|ul,\nhtml|center,\nhtml|dir,\nhtml|hr,\nhtml|menu,\nhtml|pre,\nhtml|article,\nhtml|section,\nhtml|nav,\nhtml|aside,\nhtml|hgroup,\nhtml|footer,\nhtml|header,\nhtml|figure,\nhtml|figcaption,\nhtml|main {\n display: block;\n unicode-bidi: normal;\n}\nhtml|li {\n display: list-item;\n}\nhtml|head {\n display: none !important;\n}\nhtml|table {\n display: table;\n}\nhtml|tr {\n display: table-row;\n}\nhtml|thead {\n display: table-header-group;\n break-after: avoid;\n}\nhtml|tbody {\n display: table-row-group;\n}\nhtml|tfoot {\n display: table-footer-group;\n break-before: avoid;\n}\nhtml|col {\n display: table-column;\n}\nhtml|colgroup {\n display: table-column-group;\n}\nhtml|td,\nhtml|th {\n display: table-cell;\n}\nhtml|caption {\n display: table-caption;\n text-align: center;\n}\nhtml|th {\n font-weight: bolder;\n text-align: center;\n}\nhtml|*[hidden],\nhtml|link,\nhtml|style,\nhtml|script {\n display: none;\n}\nhtml|body {\n margin: 8px;\n}\nhtml|h1 {\n font-size: 2em;\n margin-block-start: 0.67em;\n margin-block-end: 0.67em;\n margin-inline-start: 0em;\n margin-inline-end: 0em;\n}\nhtml|h2 {\n font-size: 1.5em;\n margin-block-start: 0.75em;\n margin-block-end: 0.75em;\n margin-inline-start: 0em;\n margin-inline-end: 0em;\n}\nhtml|h3 {\n font-size: 1.17em;\n margin-block-start: 0.83em;\n margin-block-end: 0.83em;\n margin-inline-start: 0em;\n margin-inline-end: 0em;\n}\nhtml|h4,\nhtml|p,\nhtml|blockquote,\nhtml|ul,\nhtml|fieldset,\nhtml|form,\nhtml|ol,\nhtml|dl,\nhtml|dir,\nhtml|menu,\nhtml|h5,\nhtml|h6 {\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0em;\n margin-inline-end: 0em;\n}\nhtml|h5 {\n font-size: 0.83em;\n}\nhtml|h6 {\n font-size: 0.75em;\n}\nhtml|h1,\nhtml|h2,\nhtml|h3,\nhtml|h4,\nhtml|h5,\nhtml|h6,\nhtml|b,\nhtml|strong {\n font-weight: bolder;\n}\nhtml|h1,\nhtml|h2,\nhtml|h3,\nhtml|h4,\nhtml|h5,\nhtml|h6 {\n break-after: avoid;\n}\nhtml|blockquote {\n margin-block-start: 0px;\n margin-block-end: 0px;\n margin-inline-start: 40px;\n margin-inline-end: 40px;\n}\nhtml|i,\nhtml|cite,\nhtml|em,\nhtml|var,\nhtml|address {\n font-style: italic;\n}\nhtml|pre,\nhtml|tt,\nhtml|code,\nhtml|kbd,\nhtml|samp {\n font-family: monospace;\n}\nhtml|pre {\n white-space: pre;\n}\nhtml|button,\nhtml|textarea,\nhtml|input,\nhtml|select {\n display: inline-block;\n}\nhtml|big {\n font-size: 1.17em;\n}\nhtml|small,\nhtml|sub,\nhtml|sup {\n font-size: 0.83em;\n}\nhtml|sub {\n vertical-align: sub;\n}\nhtml|sup {\n vertical-align: super;\n}\nhtml|table {\n border-spacing: 2px;\n}\nhtml|thead,\nhtml|tbody,\nhtml|tfoot {\n vertical-align: middle;\n}\n/* for XHTML tables without tbody */\nhtml|table > html|tr {\n vertical-align: middle;\n}\nhtml|td,\nhtml|th {\n vertical-align: inherit;\n}\nhtml|s,\nhtml|strike,\nhtml|del {\n text-decoration: line-through;\n}\nhtml|hr {\n border: 1px inset;\n}\nhtml|ol,\nhtml|ul,\nhtml|dir,\nhtml|menu,\nhtml|dd {\n margin: 0px;\n margin-inline-start: 40px;\n}\nhtml|ol html|ul,\nhtml|ul html|ol,\nhtml|ul html|ul,\nhtml|ol html|ol {\n margin-block-start: 0;\n margin-block-end: 0;\n}\nhtml|u,\nhtml|ins {\n text-decoration: underline;\n}\nhtml|center {\n text-align: center;\n}\nhtml|q:before {\n content: open-quote;\n}\nhtml|q:after {\n content: close-quote;\n}\n\nhtml|audio,\nhtml|video {\n break-inside: avoid;\n}\n\nhtml|ruby {\n display: ruby;\n}\nhtml|rp {\n display: none;\n}\nhtml|rbc {\n display: ruby-base-container;\n}\nhtml|rtc {\n display: ruby-text-container;\n}\nhtml|rb {\n display: ruby-base;\n white-space: nowrap;\n}\nhtml|rt {\n display: ruby-text;\n}\nhtml|ruby,\nhtml|rb,\nhtml|rt,\nhtml|rbc,\nhtml|rtc {\n unicode-bidi: isolate;\n}\n\nhtml|rtc,\nhtml|rt {\n font-variant-east-asian: ruby;\n text-emphasis: none;\n white-space: nowrap;\n line-height: 1;\n}\n\nhtml|rtc:lang(zh),\nhtml|rt:lang(zh) {\n ruby-align: center;\n}\n\nhtml|rtc,\nhtml|rt {\n font-size: 50%;\n}\n\nhtml|rtc:lang(zh-TW),\nhtml|rt:lang(zh-TW) {\n font-size: 30%;\n}\n\nhtml|rtc > html|rt,\nhtml|rtc > html|rt:lang(zh-TW) {\n font-size: 100%;\n}\n\n/* Bidi settings */\nhtml|bdo[dir="ltr"] {\n direction: ltr;\n unicode-bidi: bidi-override;\n}\nhtml|bdo[dir="rtl"] {\n direction: rtl;\n unicode-bidi: bidi-override;\n}\nhtml|*[dir="ltr"] {\n direction: ltr;\n unicode-bidi: embed;\n}\nhtml|*[dir="rtl"] {\n direction: rtl;\n unicode-bidi: embed;\n}\n\n/*------------------ epub-specific ---------------------*/\n\n@namespace epub "http://www.idpf.org/2007/ops";\n\nhtml|a[epub|type="noteref"] {\n font-size: 0.75em;\n vertical-align: super;\n line-height: 0.01;\n}\n\nhtml|a[epub|type="noteref"]:href-epub-type(footnote) {\n -adapt-template: url(user-agent.xml#footnote);\n text-decoration: none;\n}\n\nhtml|aside[epub|type="footnote"] {\n display: none;\n}\n\nhtml|aside[epub|type="footnote"]:footnote-content {\n display: block;\n margin: 0.25em;\n font-size: 1.2em;\n line-height: 1.2;\n}\n\nepub|trigger {\n display: none;\n}\n\nepub|switch {\n display: inline;\n}\n\nepub|default {\n display: inline;\n}\n\nepub|case {\n display: none;\n}\n\nepub|case[required-namespace::supported] {\n display: inline;\n}\n\nepub|case[required-namespace::supported] ~ epub|case {\n display: none;\n}\n\nepub|case[required-namespace::supported] ~ epub|default {\n display: none;\n}\n\n/*--------------- ncx and toc ----------------------*/\n\n@namespace ncx "http://www.daisy.org/z3986/2005/ncx/";\n\nncx|ncx {\n display: block;\n padding-top: 10px;\n padding-bottom: 10px;\n}\n\nncx|content {\n display: none;\n}\n\nbody > * {\n -adapt-behavior: body-child;\n}\n\n[role="doc-toc"],\n[role="directory"],\nnav,\n.toc,\n#toc,\n#table-of-contents,\n#contents {\n -adapt-behavior: toc-root;\n}\n\n[role="doc-toc"] a,\n[role="directory"] a,\nnav a,\n.toc a,\n#toc a,\nncx|navLabel {\n -adapt-behavior: toc-node-anchor;\n}\n\n[role="doc-toc"] li,\n[role="directory"] li,\nnav li,\n.toc li,\n#toc li,\nncx|navPoint {\n -adapt-behavior: toc-node;\n}\n\n[role="doc-toc"] li > *:first-child,\n[role="directory"] li > *:first-child,\nnav li > *:first-child,\n.toc li > *:first-child,\n#toc li > *:first-child {\n -adapt-behavior: toc-node-first-child;\n}\n\n[role="doc-toc"] ol,\n[role="directory"] ol,\nnav ol,\n.toc ol,\n#toc ol,\n[role="doc-toc"] ul,\n[role="directory"] ul,\nnav ul,\n.toc ul,\n#toc ul,\nol[role="doc-toc"],\nol[role="directory"],\nol.toc,\nol#toc,\nul[role="doc-toc"],\nul[role="directory"],\nul.toc,\nul#toc {\n -adapt-behavior: toc-container;\n}\n';function zi(t,e,n,i,r){var o=Ni("ajax"),a=new XMLHttpRequest,s=o.suspend(a),l={status:0,statusText:"",url:t,contentType:null,responseText:null,responseXML:null,responseBlob:null};a.open(n||"GET",t,!0),e&&(a.responseType=e),a.onreadystatechange=function(){if(4===a.readyState){if(l.status=a.status,l.statusText=a.statusText||404==a.status&&"Not Found"||"",200==l.status||0==l.status)if(e&&e!==Fi.DOCUMENT||!a.responseXML||"parsererror"==a.responseXML.documentElement.localName)if((!e||e===Fi.DOCUMENT)&&a.response instanceof HTMLDocument)l.responseXML=a.response,l.contentType=a.response.contentType;else{var n=a.response;e&&e!==Fi.TEXT||"string"!=typeof n?n?l.responseBlob="string"==typeof n?Gi([n]):n:h.warn("Unexpected empty success response for",t):l.responseText=n;var i=a.getResponseHeader("Content-Type");i&&(l.contentType=i.replace(/(.*);.*$/,"$1"))}else l.responseXML=a.responseXML,l.contentType=a.responseXML.contentType;s.schedule(l)}};try{i?(a.setRequestHeader("Content-Type",r||"text/plain; charset=UTF-8"),a.send(i)):(/^file:|^https?:\/\/[^/]+\.githubusercontent\.com|\.(xhtml|xht|opf)$/i.test(t)?/\/aozorabunko\/[^/]+\/cards\/[^/]+\/files\/[^/.]+\.html$/.test(t)?a.overrideMimeType("text/html; charset=Shift_JIS"):/\.(html|htm)$/i.test(t)?a.overrideMimeType("text/html; charset=UTF-8"):/\.(xhtml|xht|xml|opf)$/i.test(t)?a.overrideMimeType("application/xml; charset=UTF-8"):/\.(txt|css)$/i.test(t)?a.overrideMimeType("text/plain; charset=UTF-8"):a.overrideMimeType("text/html; charset=UTF-8"):/^data:,(<|%3c)/i.test(t)?a.overrideMimeType("text/html; charset=UTF-8"):/^data:,/i.test(t)&&a.overrideMimeType("text/plain; charset=UTF-8"),a.send(null))}catch(e){h.warn(e,"Error fetching "+t),s.schedule(l)}return o.result()}function Gi(t,e){var n=e||"application/octet-stream",i=window.WebKitBlobBuilder||window.MSBlobBuilder;if(i){for(var r=new i,o=0;o<t.length;o++)r.append(t[o]);return r.getBlob(n)}return new Blob(t,{type:n})}!function(t){t.DEFAULT="",t.ARRAYBUFFER="arraybuffer",t.BLOB="blob",t.DOCUMENT="document",t.JSON="json",t.TEXT="text"}(Fi||(Fi={}));var Wi,Xi=function(){function t(t,e){this.parser=t,this.type=e,this.resources={},this.fetchers={}}var e=t.prototype;return e.load=function(t,e,n){t=B(t);var i=this.resources[t];return void 0!==i?bi(i):this.fetch(t,e,n).get()},e.fetchInner=function(t,e,n){var i=this,r=Ni("fetch"),o=t.endsWith("?viv-toc-box");o&&(t=t.replace("?viv-toc-box",""));var a=G("user-agent.xml",H),s=!o&&t===a;return s&&(t="data:application/xml,"+encodeURIComponent(Ui)),zi(t,this.type).then(function(l){if(l.status>=400&&e)throw new Error((n||"Failed to fetch required resource: "+t)+" ("+l.status+(l.statusText?" "+l.statusText:"")+")");o?(t+="?viv-toc-box",l.url+="?viv-toc-box"):s&&(l.url=t=a),i.parser(l,i).then(function(e){delete i.fetchers[t],i.resources[t]=e,r.finish(e)})}),r.result()},e.fetch=function(t,e,n){var i=this;if(t=B(t),this.resources[t])return null;var r=this.fetchers[t];return r||(r=new Oi(function(){return i.fetchInner(t,e,n)},"Fetch "+t),this.fetchers[t]=r,r.start()),r},e.get=function(t){return this.resources[B(t)]},e.delete=function(t){delete this.resources[B(t)]},t}();function ji(t,e){var n=t.responseText;return bi(n?_(n):null)}function Yi(t){var e=parseInt(t,16);if(isNaN(e))throw new Error("E_CSS_COLOR");if(6==t.length)return new Be(e);if(3==t.length)return new Be(e=15&e|(15&e)<<4|(240&e)<<4|(240&e)<<8|(3840&e)<<8|(3840&e)<<12);throw new Error("E_CSS_COLOR")}!function(t){t.USER_AGENT="UA",t.USER="User",t.AUTHOR="Author"}(Wi||(Wi={}));var Ki,qi=function(){function t(t){this.scope=t,this.flavor=Wi.AUTHOR}var e=t.prototype;return e.getCurrentToken=function(){return null},e.getScope=function(){return this.scope},e.error=function(t,e){},e.startStylesheet=function(t){this.flavor=t},e.tagSelector=function(t,e){},e.classSelector=function(t){},e.pseudoclassSelector=function(t,e){},e.pseudoelementSelector=function(t,e){},e.idSelector=function(t){},e.attributeSelector=function(t,e,n,i){},e.descendantSelector=function(){},e.childSelector=function(){},e.adjacentSiblingSelector=function(){},e.followingSiblingSelector=function(){},e.nextSelector=function(){},e.startSelectorRule=function(){},e.startFontFaceRule=function(){},e.startFootnoteRule=function(t){},e.startViewportRule=function(){},e.startDefineRule=function(){},e.startRegionRule=function(){},e.startPageRule=function(){},e.startPageMarginBoxRule=function(t){},e.startWhenRule=function(t){},e.startMediaRule=function(t){this.startWhenRule(t)},e.startFlowRule=function(t){},e.startPageTemplateRule=function(){},e.startPageMasterRule=function(t,e,n){},e.startPartitionRule=function(t,e,n){},e.startPartitionGroupRule=function(t,e,n){},e.startRuleBody=function(){},e.property=function(t,e,n){},e.endRule=function(){},e.startFuncWithSelector=function(t){},e.endFuncWithSelector=function(){},e.getImportantSpecificity=function(){switch(this.flavor){case Wi.USER_AGENT:return 0;case Wi.USER:return 100663296;default:return 83886080}},e.getBaseSpecificity=function(){switch(this.flavor){case Wi.USER_AGENT:return 0;case Wi.USER:return 16777216;default:return 33554432}},t}(),Qi=function(t){function e(){var e;return(e=t.call(this,null)||this).stack=[],e.tokenizer=null,e.slave=null,e}x(e,t);var n=e.prototype;return n.pushHandler=function(t){this.stack.push(this.slave),this.slave=t},n.popHandler=function(){this.slave=this.stack.pop()},n.getCurrentToken=function(){return this.tokenizer?this.tokenizer.token():null},n.getScope=function(){return this.slave.getScope()},n.error=function(t,e){this.slave.error(t,e)},n.errorMsg=function(t,e){h.warn(t)},n.startStylesheet=function(e){t.prototype.startStylesheet.call(this,e),this.stack.length>0&&(this.slave=this.stack[0],this.stack=[]),this.slave.startStylesheet(e)},n.tagSelector=function(t,e){this.slave.tagSelector(t,e)},n.classSelector=function(t){this.slave.classSelector(t)},n.pseudoclassSelector=function(t,e){this.slave.pseudoclassSelector(t,e)},n.pseudoelementSelector=function(t,e){this.slave.pseudoelementSelector(t,e)},n.idSelector=function(t){this.slave.idSelector(t)},n.attributeSelector=function(t,e,n,i){this.slave.attributeSelector(t,e,n,i)},n.descendantSelector=function(){this.slave.descendantSelector()},n.childSelector=function(){this.slave.childSelector()},n.adjacentSiblingSelector=function(){this.slave.adjacentSiblingSelector()},n.followingSiblingSelector=function(){this.slave.followingSiblingSelector()},n.nextSelector=function(){this.slave.nextSelector()},n.startSelectorRule=function(){this.slave.startSelectorRule()},n.startFontFaceRule=function(){this.slave.startFontFaceRule()},n.startFootnoteRule=function(t){this.slave.startFootnoteRule(t)},n.startViewportRule=function(){this.slave.startViewportRule()},n.startDefineRule=function(){this.slave.startDefineRule()},n.startRegionRule=function(){this.slave.startRegionRule()},n.startPageRule=function(){this.slave.startPageRule()},n.startPageMarginBoxRule=function(t){this.slave.startPageMarginBoxRule(t)},n.startWhenRule=function(t){this.slave.startWhenRule(t)},n.startFlowRule=function(t){this.slave.startFlowRule(t)},n.startPageTemplateRule=function(){this.slave.startPageTemplateRule()},n.startPageMasterRule=function(t,e,n){this.slave.startPageMasterRule(t,e,n)},n.startPartitionRule=function(t,e,n){this.slave.startPartitionRule(t,e,n)},n.startPartitionGroupRule=function(t,e,n){this.slave.startPartitionGroupRule(t,e,n)},n.startRuleBody=function(){this.slave.startRuleBody()},n.property=function(t,e,n){this.slave.property(t,e,n)},n.endRule=function(){this.slave.endRule()},n.startFuncWithSelector=function(t){this.slave.startFuncWithSelector(t)},n.endFuncWithSelector=function(){this.slave.endFuncWithSelector()},e}(qi),Zi=function(t){function e(e,n,i){var r;return(r=t.call(this,e)||this).owner=n,r.topLevel=i,r.depth=0,n&&(r.flavor=n.flavor),r}x(e,t);var n=e.prototype;return n.getCurrentToken=function(){return this.owner.getCurrentToken()},n.error=function(t,e){this.owner.errorMsg(t,e)},n.startRuleBody=function(){this.depth++},n.endRule=function(){0!=--this.depth||this.topLevel||this.owner.popHandler()},e}(qi),$i=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.report=function(t){this.error(t,this.getCurrentToken())},n.reportAndSkip=function(t){this.report(t),this.owner.pushHandler(new Zi(this.scope,this.owner,!1))},n.startSelectorRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_SELECTOR")},n.startFontFaceRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_FONT_FACE")},n.startFootnoteRule=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_FOOTNOTE")},n.startViewportRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_VIEWPORT")},n.startDefineRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_DEFINE")},n.startRegionRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_REGION")},n.startPageRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_PAGE")},n.startWhenRule=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_WHEN")},n.startFlowRule=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_FLOW")},n.startPageTemplateRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_PAGE_TEMPLATE")},n.startPageMasterRule=function(t,e,n){this.reportAndSkip("E_CSS_UNEXPECTED_PAGE_MASTER")},n.startPartitionRule=function(t,e,n){this.reportAndSkip("E_CSS_UNEXPECTED_PARTITION")},n.startPartitionGroupRule=function(t,e,n){this.reportAndSkip("E_CSS_UNEXPECTED_PARTITION_GROUP")},n.startFuncWithSelector=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_SELECTOR_FUNC")},n.endFuncWithSelector=function(){this.reportAndSkip("E_CSS_UNEXPECTED_END_SELECTOR_FUNC")},n.property=function(t,e,n){this.error("E_CSS_UNEXPECTED_PROPERTY",this.getCurrentToken())},e}(Zi),Ji=[],tr=[],er=[],nr=[],ir=[],rr=[],or=[],ar=[],sr=[],lr=[],ur=[],hr=[],cr=[];!function(t){t[t.SELECTOR_NAME_1=1]="SELECTOR_NAME_1",t[t.SELECTOR_NAME=2]="SELECTOR_NAME",t[t.SELECTOR_ANY_1=3]="SELECTOR_ANY_1",t[t.SELECTOR_ANY=4]="SELECTOR_ANY",t[t.SELECTOR_ID_1=5]="SELECTOR_ID_1",t[t.SELECTOR_ID=6]="SELECTOR_ID",t[t.SELECTOR_CLASS_1=7]="SELECTOR_CLASS_1",t[t.SELECTOR_CLASS=8]="SELECTOR_CLASS",t[t.SELECTOR_ATTR_1=9]="SELECTOR_ATTR_1",t[t.SELECTOR_ATTR=10]="SELECTOR_ATTR",t[t.SELECTOR_CHILD=11]="SELECTOR_CHILD",t[t.SELECTOR_SIBLING=12]="SELECTOR_SIBLING",t[t.SELECTOR_BODY=13]="SELECTOR_BODY",t[t.SELECTOR_PSEUDOCLASS=14]="SELECTOR_PSEUDOCLASS",t[t.VAL_IDENT=15]="VAL_IDENT",t[t.VAL_HASH=16]="VAL_HASH",t[t.VAL_NUM=17]="VAL_NUM",t[t.VAL_INT=18]="VAL_INT",t[t.VAL_NUMERIC=19]="VAL_NUMERIC",t[t.VAL_STR=20]="VAL_STR",t[t.VAL_URL=21]="VAL_URL",t[t.VAL_COMMA=22]="VAL_COMMA",t[t.VAL_SLASH=23]="VAL_SLASH",t[t.VAL_FUNC=24]="VAL_FUNC",t[t.VAL_C_PAR=25]="VAL_C_PAR",t[t.VAL_END=26]="VAL_END",t[t.RULE_END=27]="RULE_END",t[t.IDENT=28]="IDENT",t[t.SELECTOR_START=29]="SELECTOR_START",t[t.AT=30]="AT",t[t.EXPR_IDENT=31]="EXPR_IDENT",t[t.EXPR_NUM=32]="EXPR_NUM",t[t.EXPR_NUMERIC=33]="EXPR_NUMERIC",t[t.EXPR_STR=34]="EXPR_STR",t[t.EXPR_PARAM=35]="EXPR_PARAM",t[t.EXPR_PREFIX=36]="EXPR_PREFIX",t[t.EXPR_INFIX=37]="EXPR_INFIX",t[t.EXPR_FUNC=38]="EXPR_FUNC",t[t.EXPR_C_PAR=39]="EXPR_C_PAR",t[t.EXPR_O_PAR=40]="EXPR_O_PAR",t[t.SELECTOR_NEXT=41]="SELECTOR_NEXT",t[t.SELECTOR_PSEUDOELEM=42]="SELECTOR_PSEUDOELEM",t[t.EXPR_O_BRC=43]="EXPR_O_BRC",t[t.VAL_FINISH=44]="VAL_FINISH",t[t.EXPR_INFIX_NAME=45]="EXPR_INFIX_NAME",t[t.PROP=46]="PROP",t[t.VAL_BANG=47]="VAL_BANG",t[t.VAL_BRC=48]="VAL_BRC",t[t.EXPR_SEMICOL=49]="EXPR_SEMICOL",t[t.ERROR_PUSH=50]="ERROR_PUSH",t[t.ERROR_POP=51]="ERROR_POP",t[t.ERROR_POP_DECL=52]="ERROR_POP_DECL",t[t.ERROR_SEMICOL=53]="ERROR_SEMICOL",t[t.VAL_PLUS=54]="VAL_PLUS",t[t.SELECTOR_PSEUDOCLASS_1=55]="SELECTOR_PSEUDOCLASS_1",t[t.SELECTOR_FOLLOWING_SIBLING=56]="SELECTOR_FOLLOWING_SIBLING",t[t.DONE=200]="DONE"}(Ki||(Ki={}));var fr,dr=An.LAST+1;Ji[An.IDENT]=Ki.IDENT,Ji[An.STAR]=Ki.SELECTOR_START,Ji[An.HASH]=Ki.SELECTOR_START,Ji[An.CLASS]=Ki.SELECTOR_START,Ji[An.O_BRK]=Ki.SELECTOR_START,Ji[An.COLON]=Ki.SELECTOR_START,Ji[An.AT]=Ki.AT,Ji[An.C_BRC]=Ki.RULE_END,Ji[An.EOF]=Ki.DONE,tr[An.IDENT]=Ki.PROP,tr[An.EOF]=Ki.DONE,rr[An.IDENT]=Ki.SELECTOR_NAME,rr[An.STAR]=Ki.SELECTOR_ANY,rr[An.HASH]=Ki.SELECTOR_ID,rr[An.CLASS]=Ki.SELECTOR_CLASS,rr[An.O_BRK]=Ki.SELECTOR_ATTR,rr[An.COLON]=Ki.SELECTOR_PSEUDOCLASS,er[An.GT]=Ki.SELECTOR_CHILD,er[An.PLUS]=Ki.SELECTOR_SIBLING,er[An.TILDE]=Ki.SELECTOR_FOLLOWING_SIBLING,er[An.IDENT]=Ki.SELECTOR_NAME_1,er[An.STAR]=Ki.SELECTOR_ANY_1,er[An.HASH]=Ki.SELECTOR_ID_1,er[An.CLASS]=Ki.SELECTOR_CLASS_1,er[An.O_BRK]=Ki.SELECTOR_ATTR_1,er[An.O_BRC]=Ki.SELECTOR_BODY,er[An.COLON]=Ki.SELECTOR_PSEUDOCLASS_1,er[An.COL_COL]=Ki.SELECTOR_PSEUDOELEM,er[An.COMMA]=Ki.SELECTOR_NEXT,nr[An.IDENT]=Ki.SELECTOR_NAME_1,nr[An.STAR]=Ki.SELECTOR_ANY_1,nr[An.HASH]=Ki.SELECTOR_ID_1,nr[An.CLASS]=Ki.SELECTOR_CLASS_1,nr[An.O_BRK]=Ki.SELECTOR_ATTR_1,nr[An.C_PAR]=Ki.DONE,nr[An.COLON]=Ki.SELECTOR_PSEUDOCLASS_1,ir[An.IDENT]=Ki.SELECTOR_NAME,ir[An.STAR]=Ki.SELECTOR_ANY,ir[An.HASH]=Ki.SELECTOR_ID,ir[An.CLASS]=Ki.SELECTOR_CLASS,ir[An.COLON]=Ki.SELECTOR_PSEUDOCLASS,ir[An.COL_COL]=Ki.SELECTOR_PSEUDOELEM,ir[An.O_BRK]=Ki.SELECTOR_ATTR,ir[An.O_BRC]=Ki.SELECTOR_BODY,or[An.IDENT]=Ki.VAL_IDENT,or[An.HASH]=Ki.VAL_HASH,or[An.NUM]=Ki.VAL_NUM,or[An.INT]=Ki.VAL_INT,or[An.NUMERIC]=Ki.VAL_NUMERIC,or[An.STR]=Ki.VAL_STR,or[An.URL]=Ki.VAL_URL,or[An.COMMA]=Ki.VAL_COMMA,or[An.SLASH]=Ki.VAL_SLASH,or[An.FUNC]=Ki.VAL_FUNC,or[An.C_PAR]=Ki.VAL_C_PAR,or[An.SEMICOL]=Ki.VAL_END,or[An.C_BRC]=Ki.VAL_BRC,or[An.BANG]=Ki.VAL_BANG,or[An.PLUS]=Ki.VAL_PLUS,or[An.EOF]=Ki.VAL_FINISH,ar[An.IDENT]=Ki.EXPR_IDENT,ar[An.NUM]=Ki.EXPR_NUM,ar[An.INT]=Ki.EXPR_NUM,ar[An.NUMERIC]=Ki.EXPR_NUMERIC,ar[An.STR]=Ki.EXPR_STR,ar[An.O_PAR]=Ki.EXPR_O_PAR,ar[An.FUNC]=Ki.EXPR_FUNC,ar[An.BANG]=Ki.EXPR_PREFIX,ar[An.MINUS]=Ki.EXPR_PREFIX,ar[An.DOLLAR]=Ki.EXPR_PARAM,sr[An.IDENT]=Ki.EXPR_INFIX_NAME,sr[An.COMMA]=Ki.EXPR_INFIX,sr[An.GT]=Ki.EXPR_INFIX,sr[An.LT]=Ki.EXPR_INFIX,sr[An.GT_EQ]=Ki.EXPR_INFIX,sr[An.LT_EQ]=Ki.EXPR_INFIX,sr[An.EQ]=Ki.EXPR_INFIX,sr[An.EQ_EQ]=Ki.EXPR_INFIX,sr[An.BANG_EQ]=Ki.EXPR_INFIX,sr[An.AMP_AMP]=Ki.EXPR_INFIX,sr[An.BAR_BAR]=Ki.EXPR_INFIX,sr[An.PLUS]=Ki.EXPR_INFIX,sr[An.MINUS]=Ki.EXPR_INFIX,sr[An.SLASH]=Ki.EXPR_INFIX,sr[An.PERCENT]=Ki.EXPR_INFIX,sr[An.STAR]=Ki.EXPR_INFIX,sr[An.COLON]=Ki.EXPR_INFIX,sr[An.QMARK]=Ki.EXPR_INFIX,sr[An.C_PAR]=Ki.EXPR_C_PAR,sr[An.O_BRC]=Ki.EXPR_O_BRC,sr[An.SEMICOL]=Ki.EXPR_SEMICOL,lr[An.EOF]=Ki.DONE,lr[An.O_BRC]=Ki.ERROR_PUSH,lr[An.C_BRC]=Ki.ERROR_POP,lr[An.O_BRK]=Ki.ERROR_PUSH,lr[An.C_BRK]=Ki.ERROR_POP,lr[An.O_PAR]=Ki.ERROR_PUSH,lr[An.C_PAR]=Ki.ERROR_POP,lr[An.SEMICOL]=Ki.ERROR_SEMICOL,ur[An.EOF]=Ki.DONE,ur[An.O_BRC]=Ki.ERROR_PUSH,ur[An.C_BRC]=Ki.ERROR_POP_DECL,ur[An.O_BRK]=Ki.ERROR_PUSH,ur[An.C_BRK]=Ki.ERROR_POP,ur[An.O_PAR]=Ki.ERROR_PUSH,ur[An.C_PAR]=Ki.ERROR_POP,ur[An.SEMICOL]=Ki.ERROR_SEMICOL,hr[An.EOF]=Ki.DONE,hr[An.O_BRC]=Ki.ERROR_PUSH,hr[An.C_BRC]=Ki.ERROR_POP,hr[An.O_BRK]=Ki.ERROR_PUSH,hr[An.C_BRK]=Ki.ERROR_POP,hr[An.O_PAR]=Ki.ERROR_PUSH,hr[An.C_PAR]=Ki.ERROR_POP,cr[An.C_PAR]=0,cr[An.COMMA]=0,cr[An.QMARK]=1,cr[An.COLON]=1,cr[An.AMP_AMP]=2,cr[An.BAR_BAR]=2,cr[An.LT]=3,cr[An.GT]=3,cr[An.LT_EQ]=3,cr[An.GT_EQ]=3,cr[An.EQ]=3,cr[An.EQ_EQ]=3,cr[An.BANG_EQ]=3,cr[An.PLUS]=4,cr[An.MINUS]=4,cr[An.STAR]=5,cr[An.SLASH]=5,cr[An.PERCENT]=5,cr[An.EOF]=6,cr[dr]=2,function(t){t[t.PROP=0]="PROP",t[t.WHEN=1]="WHEN",t[t.MEDIA=2]="MEDIA",t[t.IMPORT=3]="IMPORT"}(fr||(fr={}));var pr=function(){function t(t,e,n,i){this.actions=t,this.tokenizer=e,this.handler=n,this.baseURL=i,this.valStack=[],this.namespacePrefixToURI={},this.defaultNamespaceURI=null,this.propName=null,this.propImportant=!1,this.result=null,this.importReady=!1,this.importURL=null,this.importCondition=null,this.errorBrackets=[],this.ruleStack=[],this.regionRule=!1,this.pageRule=!1,this.exprContext=fr.MEDIA}var e=t.prototype;return e.extractVals=function(t,e){for(var n=[],i=this.valStack;n.push(i[e++]),e!=i.length;)if(i[e++]!=t)throw new Error("Unexpected state");return n},e.valStackReduce=function(t,e){var n,i=this.valStack,r=i.length;do{n=i[--r]}while(void 0!==n&&"string"!=typeof n);var o=i.length-(r+1);if(o>1&&i.splice(r+1,o,new Ve(i.slice(r+1,i.length))),","==t)return null;r++;do{n=i[--r]}while(void 0!==n&&("string"!=typeof n||","==n));if(o=i.length-(r+1),"("==n){if(")"!=t)return this.handler.error("E_CSS_MISMATCHED_C_PAR",e),this.actions=ur,null;var a=new ze(i[r-1],this.extractVals(",",r+1));return i.splice(r-1,o+2,a),null}return";"!=t||r>=0?(this.handler.error("E_CSS_UNEXPECTED_VAL_END",e),this.actions=ur,null):o>1?new He(this.extractVals(",",r+1)):i[0]},e.exprError=function(t,e){this.actions=this.propName?ur:lr,this.handler.error(t,e)},e.exprStackReduce=function(t,e){for(var n,i=this.valStack,r=this.handler,o=i.pop();;){var a=i.pop();if(t==An.C_PAR){for(var s=[o];a==An.COMMA;)s.unshift(i.pop()),a=i.pop();if("string"==typeof a){if("{"==a){for(;s.length>=2;){var l=s.shift(),u=s.shift(),h=new Jt(r.getScope(),l,u);s.unshift(h)}return i.push(new Ge(s[0])),!0}if("("==a){var c=i.pop(),f=i.pop();o=new ge(r.getScope(),Dt(f,c),s),t=An.EOF;continue}}if(a==An.O_PAR){o.isMediaName()&&(o=new Ee(r.getScope(),o,null)),t=An.EOF;continue}}else if("string"==typeof a){i.push(a);break}if(a<0)if(a==-An.BANG)o=new Kt(r.getScope(),o);else{if(a!=-An.MINUS)return this.exprError("F_UNEXPECTED_STATE",e),!1;o=new qt(r.getScope(),o)}else{if(cr[t]>cr[a]){i.push(a);break}switch(n=i.pop(),a){case An.AMP_AMP:o=new Qt(r.getScope(),n,o);break;case dr:o=new Zt(r.getScope(),n,o);break;case An.BAR_BAR:o=new $t(r.getScope(),n,o);break;case An.LT:o=new te(r.getScope(),n,o);break;case An.GT:o=new ne(r.getScope(),n,o);break;case An.LT_EQ:o=new ee(r.getScope(),n,o);break;case An.GT_EQ:o=new ie(r.getScope(),n,o);break;case An.EQ:case An.EQ_EQ:o=new re(r.getScope(),n,o);break;case An.BANG_EQ:o=new oe(r.getScope(),n,o);break;case An.PLUS:o=new ae(r.getScope(),n,o);break;case An.MINUS:o=new se(r.getScope(),n,o);break;case An.STAR:o=new le(r.getScope(),n,o);break;case An.SLASH:o=new ue(r.getScope(),n,o);break;case An.PERCENT:o=new he(r.getScope(),n,o);break;case An.COLON:if(!(i.length>1))return this.exprError("E_CSS_EXPR_COND",e),!1;switch(i[i.length-1]){case An.QMARK:i.pop(),o=new me(r.getScope(),i.pop(),n,o);break;case An.O_PAR:if(!n.isMediaName())return this.exprError("E_CSS_MEDIA_TEST",e),!1;o=new Ee(r.getScope(),n,o)}break;case An.QMARK:if(t!=An.COLON)return this.exprError("E_CSS_EXPR_COND",e),!1;case An.O_PAR:return i.push(n),i.push(a),i.push(o),!1;default:return this.exprError("F_UNEXPECTED_STATE",e),!1}}}return i.push(o),!1},e.readPseudoParams=function(){for(var t=[];;){var e=this.tokenizer.token();switch(e.type){case An.IDENT:t.push(e.text);break;case An.PLUS:t.push("+");break;case An.NUM:case An.INT:t.push(e.num);break;default:return t}this.tokenizer.consume()}},e.readNthPseudoParams=function(){var t=!1,e=this.tokenizer.token();if(e.type===An.PLUS)t=!0,this.tokenizer.consume(),e=this.tokenizer.token();else if(e.type===An.IDENT&&("even"===e.text||"odd"===e.text))return this.tokenizer.consume(),[2,"odd"===e.text?1:0];switch(e.type){case An.NUMERIC:if(t&&e.num<0)return null;case An.IDENT:if(t&&"-"===e.text.charAt(0))return null;if("n"===e.text||"-n"===e.text){if(t&&e.precededBySpace)return null;var n="-n"===e.text?-1:1;e.type===An.NUMERIC&&(n=e.num);var i=0;this.tokenizer.consume();var r=(e=this.tokenizer.token()).type===An.MINUS,o=e.type===An.PLUS||r;if(o&&(this.tokenizer.consume(),e=this.tokenizer.token()),e.type===An.INT){if(1/(i=e.num)==1/-0){if(i=0,o)return null}else if(i<0){if(o)return null}else if(i>=0&&!o)return null;this.tokenizer.consume()}else if(o)return null;return[n,r&&i>0?-i:i]}if("n-"===e.text||"-n-"===e.text){if(t&&e.precededBySpace)return null;var a="-n-"===e.text?-1:1;if(e.type===An.NUMERIC&&(a=e.num),this.tokenizer.consume(),(e=this.tokenizer.token()).type===An.INT)return e.num<0||1/e.num==1/-0?null:(this.tokenizer.consume(),[a,e.num])}else{var s=e.text.match(/^n(-[0-9]+)$/);if(s)return t&&e.precededBySpace?null:(this.tokenizer.consume(),[e.type===An.NUMERIC?e.num:1,parseInt(s[1],10)]);if(s=e.text.match(/^-n(-[0-9]+)$/))return this.tokenizer.consume(),[-1,parseInt(s[1],10)]}return null;case An.INT:return t&&(e.precededBySpace||e.num<0)?null:(this.tokenizer.consume(),[0,e.num])}return null},e.makeCondition=function(t,e){var n=this.handler.getScope();if(!n)return null;if(e=e||n._true,t)for(var i,r=D(t.split(/\s+/));!(i=r()).done;)switch(i.value){case"vertical":e=ye(n,e,new Kt(n,new fe(n,"pref-horizontal")));break;case"horizontal":e=ye(n,e,new fe(n,"pref-horizontal"));break;case"day":e=ye(n,e,new Kt(n,new fe(n,"pref-night-mode")));break;case"night":e=ye(n,e,new fe(n,"pref-night-mode"));break;default:e=n._false}return e===n._true?null:new Ge(e)},e.isInsidePropertyOnlyRule=function(){switch(this.ruleStack[this.ruleStack.length-1]){case"[selector]":case"font-face":case"-epubx-flow":case"-epubx-viewport":case"-epubx-define":case"-adapt-footnote-area":return!0}return!1},e.runParser=function(t,e,n,i,r){var o,a,s,l,u,h,c,f=this.handler,d=this.tokenizer,p=this.valStack;i&&(this.exprContext=fr.MEDIA,this.valStack.push("{"));t:for(;t>0;--t)switch(o=d.token(),this.actions[o.type]){case Ki.IDENT:if(d.nthToken(1).type!=An.COLON){this.isInsidePropertyOnlyRule()?(f.error("E_CSS_COLON_EXPECTED",d.nthToken(1)),this.actions=ur):(this.actions=rr,f.startSelectorRule());continue}(a=d.nthToken(2)).precededBySpace||a.type!=An.IDENT&&a.type!=An.FUNC||d.mark(),this.propName=o.text,this.propImportant=!1,d.consume(),d.consume(),this.actions=or,p.splice(0,p.length);continue;case Ki.PROP:if(d.nthToken(1).type!=An.COLON){this.actions=ur,f.error("E_CSS_COLON_EXPECTED",d.nthToken(1));continue}this.propName=o.text,this.propImportant=!1,d.consume(),d.consume(),this.actions=or,p.splice(0,p.length);continue;case Ki.SELECTOR_START:this.actions=rr,f.startSelectorRule();continue;case Ki.SELECTOR_NAME_1:if(!o.precededBySpace){this.actions=hr,f.error("E_CSS_SPACE_EXPECTED",o);continue}f.descendantSelector();case Ki.SELECTOR_NAME:if(d.nthToken(1).type==An.BAR)if(d.consume(),d.consume(),null!=(s=this.namespacePrefixToURI[o.text]))switch((o=d.token()).type){case An.IDENT:f.tagSelector(s,o.text),this.actions=r?nr:er,d.consume();break;case An.STAR:f.tagSelector(s,null),this.actions=r?nr:er,d.consume();break;default:this.actions=lr,f.error("E_CSS_NAMESPACE",o)}else this.actions=lr,f.error("E_CSS_UNDECLARED_PREFIX",o);else f.tagSelector(this.defaultNamespaceURI,o.text),this.actions=r?nr:er,d.consume();continue;case Ki.SELECTOR_ANY_1:if(!o.precededBySpace){this.actions=hr,f.error("E_CSS_SPACE_EXPECTED",o);continue}f.descendantSelector();case Ki.SELECTOR_ANY:if(d.nthToken(1).type==An.BAR)switch(d.consume(),d.consume(),(o=d.token()).type){case An.IDENT:f.tagSelector(null,o.text),this.actions=r?nr:er,d.consume();break;case An.STAR:f.tagSelector(null,null),this.actions=r?nr:er,d.consume();break;default:this.actions=lr,f.error("E_CSS_NAMESPACE",o)}else f.tagSelector(this.defaultNamespaceURI,null),this.actions=r?nr:er,d.consume();continue;case Ki.SELECTOR_ID_1:o.precededBySpace&&f.descendantSelector();case Ki.SELECTOR_ID:f.idSelector(o.text),this.actions=r?nr:er,d.consume();continue;case Ki.SELECTOR_CLASS_1:o.precededBySpace&&f.descendantSelector();case Ki.SELECTOR_CLASS:f.classSelector(o.text),this.actions=r?nr:er,d.consume();continue;case Ki.SELECTOR_PSEUDOCLASS_1:o.precededBySpace&&f.descendantSelector();case Ki.SELECTOR_PSEUDOCLASS:d.consume();e:switch((o=d.token()).type){case An.IDENT:f.pseudoclassSelector(o.text,null),d.consume(),this.actions=r?nr:er;continue;case An.FUNC:switch(l=o.text,d.consume(),l){case"not":this.actions=rr,f.startFuncWithSelector("not"),this.actions=this.runParser(Number.POSITIVE_INFINITY,!1,!1,!1,!0)?er:hr;break t;case"lang":case"href-epub-type":if((o=d.token()).type===An.IDENT){c=[o.text],d.consume();break}break e;case"nth-child":case"nth-of-type":case"nth-last-child":case"nth-last-of-type":if(c=this.readNthPseudoParams())break;break e;default:c=this.readPseudoParams()}if((o=d.token()).type==An.C_PAR){f.pseudoclassSelector(l,c),d.consume(),this.actions=r?nr:er;continue}}f.error("E_CSS_PSEUDOCLASS_SYNTAX",o),this.actions=lr;continue;case Ki.SELECTOR_PSEUDOELEM:switch(d.consume(),(o=d.token()).type){case An.IDENT:f.pseudoelementSelector(o.text,null),this.actions=r?nr:er,d.consume();continue;case An.FUNC:if(l=o.text,d.consume(),"nth-fragment"==l){if(null===(c=this.readNthPseudoParams()))break}else c=this.readPseudoParams();if((o=d.token()).type==An.C_PAR){f.pseudoelementSelector(l,c),this.actions=r?nr:er,d.consume();continue}}f.error("E_CSS_PSEUDOELEM_SYNTAX",o),this.actions=lr;continue;case Ki.SELECTOR_ATTR_1:o.precededBySpace&&f.descendantSelector();case Ki.SELECTOR_ATTR:if(d.consume(),(o=d.token()).type==An.IDENT)l=o.text,d.consume();else if(o.type==An.STAR)l=null,d.consume();else{if(o.type!=An.BAR){this.actions=hr,f.error("E_CSS_ATTR",o),d.consume();continue}l=""}if((o=d.token()).type==An.BAR){if(null==(s=l?this.namespacePrefixToURI[l]:l)){this.actions=hr,f.error("E_CSS_UNDECLARED_PREFIX",o),d.consume();continue}if(d.consume(),(o=d.token()).type!=An.IDENT){this.actions=hr,f.error("E_CSS_ATTR_NAME_EXPECTED",o);continue}l=o.text,d.consume(),o=d.token()}else s="";switch(o.type){case An.EQ:case An.TILDE_EQ:case An.BAR_EQ:case An.HAT_EQ:case An.DOLLAR_EQ:case An.STAR_EQ:case An.COL_COL:u=o.type,d.consume(),o=d.token();break;case An.C_BRK:f.attributeSelector(s,l,An.EOF,null),this.actions=r?nr:er,d.consume();continue;default:this.actions=hr,f.error("E_CSS_ATTR_OP_EXPECTED",o);continue}switch(o.type){case An.IDENT:case An.STR:f.attributeSelector(s,l,u,o.text),d.consume(),o=d.token();break;default:this.actions=hr,f.error("E_CSS_ATTR_VAL_EXPECTED",o);continue}if(o.type!=An.C_BRK){this.actions=hr,f.error("E_CSS_ATTR",o);continue}this.actions=r?nr:er,d.consume();continue;case Ki.SELECTOR_CHILD:f.childSelector(),this.actions=ir,d.consume();continue;case Ki.SELECTOR_SIBLING:f.adjacentSiblingSelector(),this.actions=ir,d.consume();continue;case Ki.SELECTOR_FOLLOWING_SIBLING:f.followingSiblingSelector(),this.actions=ir,d.consume();continue;case Ki.SELECTOR_BODY:this.regionRule?(this.ruleStack.push("-epubx-region"),this.regionRule=!1):this.pageRule?(this.ruleStack.push("page"),this.pageRule=!1):this.ruleStack.push("[selector]"),f.startRuleBody(),this.actions=Ji,d.consume();continue;case Ki.SELECTOR_NEXT:f.nextSelector(),this.actions=rr,d.consume();continue;case Ki.VAL_IDENT:p.push(ke(o.text)),d.consume();continue;case Ki.VAL_HASH:u=parseInt(o.text,16);try{p.push(Yi(o.text))}catch(t){f.error("E_CSS_COLOR",o),this.actions=lr}d.consume();continue;case Ki.VAL_NUM:p.push(new Fe(o.num)),d.consume();continue;case Ki.VAL_INT:p.push(new _e(o.num)),d.consume();continue;case Ki.VAL_NUMERIC:Bt(o.text)?p.push(new Ge(new ce(f.getScope(),o.num,o.text))):p.push(new De(o.num,o.text)),d.consume();continue;case Ki.VAL_STR:p.push(new Ae(o.text)),d.consume();continue;case Ki.VAL_URL:p.push(new Me(G(o.text,this.baseURL))),d.consume();continue;case Ki.VAL_COMMA:this.valStackReduce(",",o),p.push(","),d.consume();continue;case Ki.VAL_SLASH:p.push(Re),d.consume();continue;case Ki.VAL_FUNC:"-epubx-expr"==(l=o.text.toLowerCase())||"calc"==l||"env"==l?(this.actions=ar,this.exprContext=fr.PROP,p.push("{")):(p.push(l),p.push("(")),d.consume();continue;case Ki.VAL_C_PAR:this.valStackReduce(")",o),d.consume();continue;case Ki.VAL_BANG:if(d.consume(),o=d.token(),a=d.nthToken(1),o.type==An.IDENT&&"important"==o.text.toLowerCase()&&(a.type==An.SEMICOL||a.type==An.EOF||a.type==An.C_BRC)){d.consume(),this.propImportant=!0;continue}this.exprError("E_CSS_SYNTAX",o);continue;case Ki.VAL_PLUS:switch((a=d.nthToken(1)).type){case An.NUM:case An.NUMERIC:case An.INT:if(!a.precededBySpace){d.consume();continue}}if(this.actions===or&&d.hasMark()){d.reset(),this.actions=rr,f.startSelectorRule();continue}this.exprError("E_CSS_UNEXPECTED_PLUS",o);continue;case Ki.VAL_END:d.consume();case Ki.VAL_BRC:d.unmark(),(h=this.valStackReduce(";",o))&&this.propName&&f.property(this.propName,h,this.propImportant),this.actions=n?tr:Ji;continue;case Ki.VAL_FINISH:if(d.consume(),d.unmark(),h=this.valStackReduce(";",o),e)return this.result=h,!0;if(this.propName&&h&&f.property(this.propName,h,this.propImportant),n)return!0;this.exprError("E_CSS_SYNTAX",o);continue;case Ki.EXPR_IDENT:(a=d.nthToken(1)).type==An.CLASS?(d.nthToken(2).type!=An.O_PAR||d.nthToken(2).precededBySpace?(p.push(new fe(f.getScope(),Dt(o.text,a.text))),this.actions=sr):(p.push(o.text,a.text,"("),d.consume()),d.consume()):(this.exprContext==fr.MEDIA||this.exprContext==fr.IMPORT?"not"==o.text.toLowerCase()?(d.consume(),p.push(new de(f.getScope(),!0,a.text))):("only"==o.text.toLowerCase()&&(d.consume(),o=a),p.push(new de(f.getScope(),!1,o.text))):p.push(new fe(f.getScope(),o.text)),this.actions=sr),d.consume();continue;case Ki.EXPR_FUNC:p.push(null,o.text,"("),d.consume();continue;case Ki.EXPR_NUM:p.push(new ve(f.getScope(),o.num)),d.consume(),this.actions=sr;continue;case Ki.EXPR_NUMERIC:"%"==(l=o.text)&&(l=this.propName&&this.propName.match(/height|^(top|bottom)$/)?"vh":"vw"),p.push(new ce(f.getScope(),o.num,l)),d.consume(),this.actions=sr;continue;case Ki.EXPR_STR:p.push(new ve(f.getScope(),o.text)),d.consume(),this.actions=sr;continue;case Ki.EXPR_PARAM:d.consume(),(o=d.token()).type!=An.INT||o.precededBySpace?this.exprError("E_CSS_SYNTAX",o):(p.push(new we(f.getScope(),o.num)),d.consume(),this.actions=sr);continue;case Ki.EXPR_PREFIX:p.push(-o.type),d.consume();continue;case Ki.EXPR_INFIX:this.actions=ar,this.exprStackReduce(o.type,o),p.push(o.type),d.consume();continue;case Ki.EXPR_INFIX_NAME:"and"==o.text.toLowerCase()?(this.actions=ar,this.exprStackReduce(dr,o),p.push(dr),d.consume()):this.exprError("E_CSS_SYNTAX",o);continue;case Ki.EXPR_C_PAR:this.exprStackReduce(o.type,o)&&(this.propName?this.actions=or:this.exprError("E_CSS_UNBALANCED_PAR",o)),d.consume();continue;case Ki.EXPR_O_BRC:this.exprStackReduce(An.C_PAR,o)&&(this.propName||this.exprContext==fr.IMPORT?this.exprError("E_CSS_UNEXPECTED_BRC",o):(this.exprContext==fr.WHEN?f.startWhenRule(p.pop()):f.startMediaRule(p.pop()),this.ruleStack.push("media"),f.startRuleBody(),this.actions=Ji)),d.consume();continue;case Ki.EXPR_SEMICOL:if(this.exprStackReduce(An.C_PAR,o)){if(!this.propName&&this.exprContext==fr.IMPORT)return this.importCondition=p.pop(),this.importReady=!0,this.actions=Ji,d.consume(),!1;this.exprError("E_CSS_UNEXPECTED_SEMICOL",o)}d.consume();continue;case Ki.EXPR_O_PAR:p.push(o.type),d.consume();continue;case Ki.RULE_END:this.actions=Ji,d.consume(),f.endRule(),this.ruleStack.length&&this.ruleStack.pop();continue;case Ki.AT:switch(l=o.text.toLowerCase()){case"import":if(d.consume(),(o=d.token()).type==An.STR||o.type==An.URL){if(this.importURL=o.text,d.consume(),(o=d.token()).type==An.SEMICOL||o.type==An.EOF)return this.importReady=!0,d.consume(),!1;this.propName=null,this.exprContext=fr.IMPORT,this.actions=ar,p.push("{");continue}f.error("E_CSS_IMPORT_SYNTAX",o),this.actions=lr;continue;case"namespace":switch(d.consume(),(o=d.token()).type){case An.IDENT:if(l=o.text,d.consume(),((o=d.token()).type==An.STR||o.type==An.URL)&&d.nthToken(1).type==An.SEMICOL){this.namespacePrefixToURI[l]=o.text,d.consume(),d.consume();continue}break;case An.STR:case An.URL:if(d.nthToken(1).type==An.SEMICOL){this.defaultNamespaceURI=o.text,d.consume(),d.consume();continue}}f.error("E_CSS_NAMESPACE_SYNTAX",o),this.actions=lr;continue;case"charset":if(d.consume(),(o=d.token()).type==An.STR&&d.nthToken(1).type==An.SEMICOL){"utf-8"!=(l=o.text.toLowerCase())&&"utf-16"!=l&&f.error("E_CSS_UNEXPECTED_CHARSET "+l,o),d.consume(),d.consume();continue}f.error("E_CSS_CHARSET_SYNTAX",o),this.actions=lr;continue;case"font-face":case"-epubx-page-template":case"-epubx-define":case"-epubx-viewport":if(d.nthToken(1).type==An.O_BRC){switch(d.consume(),d.consume(),l){case"font-face":f.startFontFaceRule();break;case"-epubx-page-template":f.startPageTemplateRule();break;case"-epubx-define":f.startDefineRule();break;case"-epubx-viewport":f.startViewportRule()}this.ruleStack.push(l),f.startRuleBody();continue}break;case"-adapt-footnote-area":switch(d.consume(),(o=d.token()).type){case An.O_BRC:d.consume(),f.startFootnoteRule(null),this.ruleStack.push(l),f.startRuleBody();continue;case An.COL_COL:if(d.consume(),(o=d.token()).type==An.IDENT&&d.nthToken(1).type==An.O_BRC){l=o.text,d.consume(),d.consume(),f.startFootnoteRule(l),this.ruleStack.push("-adapt-footnote-area"),f.startRuleBody();continue}}break;case"-epubx-region":d.consume(),f.startRegionRule(),this.regionRule=!0,this.actions=rr;continue;case"page":d.consume(),f.startPageRule(),this.pageRule=!0,this.actions=ir;continue;case"top-left-corner":case"top-left":case"top-center":case"top-right":case"top-right-corner":case"right-top":case"right-middle":case"right-bottom":case"bottom-right-corner":case"bottom-right":case"bottom-center":case"bottom-left":case"bottom-left-corner":case"left-bottom":case"left-middle":case"left-top":if(d.consume(),(o=d.token()).type==An.O_BRC){d.consume(),f.startPageMarginBoxRule(l),this.ruleStack.push(l),f.startRuleBody();continue}break;case"-epubx-when":d.consume(),this.propName=null,this.exprContext=fr.WHEN,this.actions=ar,p.push("{");continue;case"media":d.consume(),this.propName=null,this.exprContext=fr.MEDIA,this.actions=ar,p.push("{");continue;case"-epubx-flow":if(d.nthToken(1).type==An.IDENT&&d.nthToken(2).type==An.O_BRC){f.startFlowRule(d.nthToken(1).text),d.consume(),d.consume(),d.consume(),this.ruleStack.push(l),f.startRuleBody();continue}break;case"-epubx-page-master":case"-epubx-partition":case"-epubx-partition-group":d.consume();var g=null,m=null,v=[];for((o=d.token()).type==An.IDENT&&(g=o.text,d.consume(),o=d.token()),o.type==An.COLON&&d.nthToken(1).type==An.IDENT&&(m=d.nthToken(1).text,d.consume(),d.consume(),o=d.token());o.type==An.FUNC&&"class"==o.text.toLowerCase()&&d.nthToken(1).type==An.IDENT&&d.nthToken(2).type==An.C_PAR;)v.push(d.nthToken(1).text),d.consume(),d.consume(),d.consume(),o=d.token();if(o.type==An.O_BRC){switch(d.consume(),l){case"-epubx-page-master":f.startPageMasterRule(g,m,v);break;case"-epubx-partition":f.startPartitionRule(g,m,v);break;case"-epubx-partition-group":f.startPartitionGroupRule(g,m,v)}this.ruleStack.push(l),f.startRuleBody();continue}break;case"":f.error("E_CSS_UNEXPECTED_AT"+l,o),this.actions=hr;continue;default:f.error("E_CSS_AT_UNKNOWN "+l,o),this.actions=lr;continue}f.error("E_CSS_AT_SYNTAX "+l,o),this.actions=lr;continue;case Ki.ERROR_PUSH:if(e||n)return!0;this.errorBrackets.push(o.type+1),d.consume();continue;case Ki.ERROR_POP_DECL:if(e||n)return!0;if(0==this.errorBrackets.length){this.actions=Ji;continue}case Ki.ERROR_POP:this.errorBrackets.length>0&&this.errorBrackets[this.errorBrackets.length-1]==o.type&&this.errorBrackets.pop(),0==this.errorBrackets.length&&o.type==An.C_BRC&&(this.actions=Ji),d.consume();continue;case Ki.ERROR_SEMICOL:if(e||n)return!0;0==this.errorBrackets.length&&(this.actions=Ji),d.consume();continue;case Ki.DONE:return r&&(d.consume(),f.endFuncWithSelector()),!0;default:if(e||n)return!0;if(i)return!!this.exprStackReduce(An.C_PAR,o)&&(this.result=p.pop(),!0);if(r)return f.error(o.type==An.INVALID?o.text:"E_CSS_SYNTAX",o),!1;if(this.actions===or&&d.hasMark()){d.reset(),this.actions=rr,f.startSelectorRule();continue}if(this.actions!==lr&&this.actions!==hr&&this.actions!==ur){f.error(o.type==An.INVALID?o.text:"E_CSS_SYNTAX",o),this.actions=this.isInsidePropertyOnlyRule()?ur:hr;continue}d.consume();continue}return!1},t}(),gr=function(t){function e(e){var n;return(n=t.call(this,null)||this).scope=e,n}x(e,t);var n=e.prototype;return n.error=function(t,e){throw new Error(t)},n.getScope=function(){return this.scope},e}(qi);function mr(t,e,n,i,r){return Si("parseStylesheetFromText",function(o){(function(t,e,n,i,r){var o=Ni("parseStylesheet"),a=new pr(Ji,t,e,n),s=null;return r&&(s=function(t,e,n){var i=new pr(ar,t,e,n);return i.runParser(Number.POSITIVE_INFINITY,!1,!1,!0,!1),i.result}(new vi(r,e),e,n)),(s=a.makeCondition(i,s&&s.toExpr()))&&(e.startMediaRule(s),e.startRuleBody()),o.loop(function(){for(;!a.runParser(100,!1,!1,!1,!1);){if(a.importReady){var t=function(){var t=G(a.importURL,n);a.importCondition&&(e.startMediaRule(a.importCondition),e.startRuleBody());var i=Ni("parseStylesheet.import");return vr(t,e,null,null).then(function(){a.importCondition&&e.endRule(),a.importReady=!1,a.importURL=null,a.importCondition=null,i.finish(!0)}),{v:i.result()}}();if("object"==typeof t)return t.v}var i=o.timeSlice();if(i.isPending)return i}return bi(!1)}).then(function(){s&&e.endRule(),o.finish(!0)}),o.result()})(new vi(t,e),e,n,i,r).thenFinish(o)},function(e,n){h.warn(n,"Failed to parse stylesheet text: "+t),e.finish(!1)})}function vr(t,e,n,i){return Si("parseStylesheetFromURL",function(r){zi(t).then(function(o){o.responseText?mr(o.responseText,e,t,n,i).then(function(e){e||h.warn("Failed to parse stylesheet from "+t),r.finish(!0)}):r.finish(!0)})},function(e,n){h.warn(n,"Exception while fetching and parsing:",t),e.finish(!0)})}function Er(t,e,n){var i=new pr(or,e,new gr(t),n);return i.runParser(Number.POSITIVE_INFINITY,!0,!1,!1,!1),i.result}var wr={"z-index":!0,"column-count":!0,"flow-linger":!0,opacity:!0,page:!0,"flow-priority":!0,utilization:!0};function yr(t,e,n){return e.isExpr()?function(t,e,n){var i=e.evaluate(t);switch(typeof i){case"number":return function(t){return!!wr[t]}(n)?i==Math.round(i)?new _e(i):new Fe(i):new De(i,"px");case"string":return i?Er(e.scope,new vi(i,null),""):Pe;case"boolean":return i?je._true:je._false;case"undefined":return Pe}throw new Error("E_UNEXPECTED")}(t,e.expr,n):e}function Nr(t,e,n){return t-=n,0===e?0===t:t%e==0&&t/e>=0}var br=function(){function t(t){this.matchers=t}return t.prototype.matches=function(){return this.matchers.some(function(t){return t.matches()})},t}(),Sr=function(){function t(t){this.matchers=t}return t.prototype.matches=function(){return this.matchers.every(function(t){return t.matches()})},t}(),Cr=function(){function t(t,e,n){this.elementOffset=t,this.a=e,this.b=n}return t.registerFragmentIndex=function(e,n,i){var r=t.fragmentIndices;(!r[e]||r[e].priority<=i)&&(r[e]={fragmentIndex:n,priority:i})},t.clearFragmentIndices=function(){t.fragmentIndices={}},t.prototype.matches=function(){var e=t.fragmentIndices[this.elementOffset];return null!=e&&null!=e.fragmentIndex&&Nr(e.fragmentIndex,this.a,this.b)},t}();Cr.fragmentIndices={};var Tr=function(){function t(){}return t.buildViewConditionMatcher=function(t,e){var n=e.split("_");return"NFS"==n[0]?new Cr(t,parseInt(n[1],10),parseInt(n[2],10)):null},t.buildAllMatcher=function(t){return new Sr(t)},t.buildAnyMatcher=function(t){return new br(t)},t}(),xr={azimuth:!0,"border-collapse":!0,"border-spacing":!0,"caption-side":!0,"clip-rule":!0,color:!0,"color-interpolation":!0,"color-rendering":!0,cursor:!0,direction:!0,elevation:!0,"empty-cells":!0,fill:!0,"fill-opacity":!0,"fill-rule":!0,"font-kerning":!0,"font-size":!0,"font-size-adjust":!0,"font-family":!0,"font-feature-settings":!0,"font-style":!0,"font-stretch":!0,"font-variant":!0,"font-weight":!0,"glyph-orientation-vertical":!0,hyphens:!0,"hyphenate-character":!0,"hyphenate-limit-chars":!0,"hyphenate-limit-last":!0,"image-rendering":!0,"image-resolution":!0,"letter-spacing":!0,"line-break":!0,"line-height":!0,"list-style-image":!0,"list-style-position":!0,"list-style-type":!0,marker:!0,"marker-end":!0,"marker-mid":!0,"marker-start":!0,orphans:!0,"overflow-wrap":!0,"paint-order":!0,"pointer-events":!0,"pitch-range":!0,quotes:!0,richness:!0,"ruby-align":!0,"ruby-position":!0,"speak-header":!0,"speak-numeral":!0,"speak-punctuation":!0,"speech-rate":!0,"shape-rendering":!0,stress:!0,stroke:!0,"stroke-dasharray":!0,"stroke-dashoffset":!0,"stroke-linecap":!0,"stroke-linejoin":!0,"stroke-miterlimit":!0,"stroke-opacity":!0,"stroke-width":!0,"tab-size":!0,"text-align":!0,"text-align-last":!0,"text-anchor":!0,"text-decoration-skip":!0,"text-emphasis-color":!0,"text-emphasis-position":!0,"text-emphasis-style":!0,"text-combine-upright":!0,"text-indent":!0,"text-justify":!0,"text-rendering":!0,"text-size-adjust":!0,"text-transform":!0,"text-underline-position":!0,visibility:!0,"voice-family":!0,volume:!0,"white-space":!0,widows:!0,"word-break":!0,"word-spacing":!0,"word-wrap":!0,"writing-mode":!0},Ir=["box-decoration-break","image-resolution","orphans","widows"];function Pr(){return p(exports.HOOKS.POLYFILLED_INHERITED_PROPS).reduce(function(t,e){return t.concat(e())},[].concat(Ir))}var Rr={"http://www.idpf.org/2007/ops":!0,"http://www.w3.org/1999/xhtml":!0,"http://www.w3.org/2000/svg":!0},Ar=["margin-%","padding-%","border-%-width","border-%-style","border-%-color","%"],Lr=["max-%","min-%","%"],Or=function(){for(var t=["left","right","top","bottom"],e={width:!0,height:!0,"max-width":!0,"max-height":!0,"min-width":!0,"min-height":!0},n=0;n<Ar.length;n++)for(var i=0;i<t.length;i++)e[Ar[n].replace("%",t[i])]=!0;return e}();function kr(t,e){for(var n,i={},r=D(Ar);!(n=r()).done;){var o=n.value;for(var a in t){var s=o.replace("%",a),l=o.replace("%",t[a]);i[s]=l,i[l]=s}}for(var u,h=D(Lr);!(u=h()).done;){var c=u.value;for(var f in e){var d=c.replace("%",f),p=c.replace("%",e[f]);i[d]=p,i[p]=d}}return i}var Dr=kr({"block-start":"right","block-end":"left","inline-start":"top","inline-end":"bottom"},{"block-size":"width","inline-size":"height"}),Fr=kr({"block-start":"top","block-end":"bottom","inline-start":"left","inline-end":"right"},{"block-size":"height","inline-size":"width"}),_r=kr({"block-start":"right","block-end":"left","inline-start":"bottom","inline-end":"top"},{"block-size":"width","inline-size":"height"}),Br=kr({"block-start":"top","block-end":"bottom","inline-start":"right","inline-end":"left"},{"block-size":"height","inline-size":"width"}),Mr=function(){function t(t,e){this.value=t,this.priority=e}var e=t.prototype;return e.getBaseValue=function(){return this},e.filterValue=function(e){var n=this.value.visit(e);return n===this.value?this:new t(n,this.priority)},e.increaseSpecificity=function(e){return 0==e?this:new t(this.value,this.priority+e)},e.evaluate=function(t,e){return yr(t,this.value,e)},e.isEnabled=function(t){return!0},t}(),Ur=function(t){function e(e,n,i){var r;return(r=t.call(this,e,n)||this).condition=i,r}x(e,t);var n=e.prototype;return n.getBaseValue=function(){return new Mr(this.value,this.priority)},n.filterValue=function(t){var n=this.value.visit(t);return n===this.value?this:new e(n,this.priority,this.condition)},n.increaseSpecificity=function(t){return 0==t?this:new e(this.value,this.priority+t,this.condition)},n.isEnabled=function(t){return!!this.condition.evaluate(t)},e}(Mr);function Vr(t,e,n){return(null==e||n.priority>e.priority)&&n.isEnabled(t)?n.getBaseValue():e}var Hr={"region-id":!0,"fragment-selector-id":!0};function zr(t){return!!Hr[t]}function Gr(t){return"_"!=t.charAt(0)&&!Hr[t]}function Wr(t){return!!xr[t]}function Xr(t,e){return t[e]}function jr(t,e,n){n?t[e]=n:delete t[e]}function Yr(t,e){return t[e]}function Kr(t,e){var n=t[e];return n||(t[e]=n={}),n}var qr=function(t){var e=t._viewConditionalStyles;return e||(t._viewConditionalStyles=e=[]),e};function Qr(t,e){return t[e]}function Zr(t,e){var n=t[e];return n||(t[e]=n=[]),n}function $r(t,e,n,i,r,o,a){for(var s in[{id:r,styleKey:"_pseudos"},{id:o,styleKey:"_regions"}].forEach(function(t){if(t.id){var n=Kr(e,t.styleKey);(e=n[t.id])||(n[t.id]=e={})}}),a&&qr(e).push({styles:e={},matcher:a}),n)if("_"!=s.charAt(0))if(zr(s)){var l=Qr(n,s),u=Zr(e,s);Array.prototype.push.apply(u,l)}else{var h=Xr(n,s).increaseSpecificity(i),c=Xr(e,s);jr(e,s,Vr(t,c,h))}}function Jr(t,e){if(t.length>0){t.sort(function(t,e){return e.getPriority()-t.getPriority()});for(var n=null,i=t.length-1;i>=0;i--)(n=t[i]).chained=e,e=n;return n}return e}var to=function(t){function e(e,n){var i;return(i=t.call(this)||this).props=e,i.context=n,i.propName="",i}x(e,t);var n=e.prototype;return n.setPropName=function(t){this.propName=t},n.getFontSize=function(){var t=Xr(this.props,"font-size").value;if(!function(t){switch(t.toLowerCase()){case"px":case"in":case"pt":case"pc":case"cm":case"mm":case"q":return!0;default:return!1}}(t.unit))throw new Error("Unexpected state");return t.num*Mt[t.unit]},n.visitNumeric=function(t){if("font-size"===this.propName)return function(t,e,n){var i=(t=eo(t,e,n)).unit,r=t.num;return"px"===i?t:new De("%"===i?r/100*e:r*n.queryUnitSize(i,!1),"px")}(t,this.getFontSize(),this.context);if("em"==t.unit||"ex"==t.unit||"rem"==t.unit)return eo(t,this.getFontSize(),this.context);if("%"==t.unit){if("line-height"===this.propName)return t;var e=this.propName.match(/height|^(top|bottom)$/)?"vh":"vw";return new De(t.num,e)}return t},n.visitExpr=function(t){return"font-size"==this.propName?yr(this.context,t,this.propName).visit(this):t},e}(xe);function eo(t,e,n){var i=t.unit,r=t.num;return"em"===i||"ex"===i?new De(r*(Mt[i]/Mt.em)*e,"px"):"rem"===i?new De(r*n.fontSize(),"px"):t}var no=function(){function t(){}var e=t.prototype;return e.apply=function(t){},e.mergeWith=function(t){return new ro([this,t])},e.clone=function(){return this},t}(),io=function(t){function e(e){var n;return(n=t.call(this)||this).conditionItem=e,n}return x(e,t),e.prototype.apply=function(t){t.pushConditionItem(this.conditionItem.fresh(t))},e}(no),ro=function(t){function e(e){var n;return(n=t.call(this)||this).list=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){for(var e=0;e<this.list.length;e++)this.list[e].apply(t)},n.mergeWith=function(t){return this.list.push(t),this},n.clone=function(){return new e([].concat(this.list))},e}(no),oo=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this)||this).style=e,a.specificity=n,a.pseudoelement=i,a.regionId=r,a.viewConditionId=o,a}return x(e,t),e.prototype.apply=function(t){$r(t.context,t.currentStyle,this.style,this.specificity,this.pseudoelement,this.regionId,t.buildViewConditionMatcher(this.viewConditionId))},e}(no),ao=function(t){function e(){var e;return(e=t.call(this)||this).chained=null,e}x(e,t);var n=e.prototype;return n.apply=function(t){this.chained.apply(t)},n.getPriority=function(){return 0},n.makePrimary=function(t){return!1},e}(no),so=function(t){function e(e){var n;return(n=t.call(this)||this).className=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){t.currentClassNames.includes(this.className)&&this.chained.apply(t)},n.getPriority=function(){return 10},n.makePrimary=function(t){return this.chained&&t.insertInTable(t.classes,this.className,this.chained),!0},e}(ao),lo=function(t){function e(e){var n;return(n=t.call(this)||this).id=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){t.currentId!=this.id&&t.currentXmlId!=this.id||this.chained.apply(t)},n.getPriority=function(){return 11},n.makePrimary=function(t){return this.chained&&t.insertInTable(t.ids,this.id,this.chained),!0},e}(ao),uo=function(t){function e(e){var n;return(n=t.call(this)||this).localName=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){t.currentLocalName==this.localName&&this.chained.apply(t)},n.getPriority=function(){return 8},n.makePrimary=function(t){return this.chained&&t.insertInTable(t.tags,this.localName,this.chained),!0},e}(ao),ho=function(t){function e(e,n){var i;return(i=t.call(this)||this).ns=e,i.localName=n,i}x(e,t);var n=e.prototype;return n.apply=function(t){t.currentLocalName==this.localName&&t.currentNamespace==this.ns&&this.chained.apply(t)},n.getPriority=function(){return 8},n.makePrimary=function(t){if(this.chained){var e=t.nsPrefix[this.ns];e||(e="ns"+t.nsCount+++":",t.nsPrefix[this.ns]=e),t.insertInTable(t.nstags,e+this.localName,this.chained)}return!0},e}(ao),co=function(t){function e(e){var n;return(n=t.call(this)||this).epubTypePatt=e,n}return x(e,t),e.prototype.apply=function(t){var e=t.currentElement;if(e&&"a"==t.currentLocalName){var n=e.getAttribute("href");if(n&&n.match(/^#/)){var i=n.substring(1),r=e.ownerDocument.getElementById(i);if(r){var o=r.getAttributeNS(V.epub,"type");o&&o.match(this.epubTypePatt)&&this.chained.apply(t)}}}},e}(ao),fo=function(t){function e(e){var n;return(n=t.call(this)||this).ns=e,n}return x(e,t),e.prototype.apply=function(t){t.currentNamespace==this.ns&&this.chained.apply(t)},e}(ao),po=function(t){function e(e,n){var i;return(i=t.call(this)||this).ns=e,i.name=n,i}return x(e,t),e.prototype.apply=function(t){t.currentElement&&t.currentElement.hasAttributeNS(this.ns,this.name)&&this.chained.apply(t)},e}(ao),go=function(t){function e(e,n,i){var r;return(r=t.call(this)||this).ns=e,r.name=n,r.value=i,r}x(e,t);var n=e.prototype;return n.apply=function(t){t.currentElement&&t.currentElement.getAttributeNS(this.ns,this.name)==this.value&&this.chained.apply(t)},n.getPriority=function(){return"type"==this.name&&this.ns==V.epub?9:0},n.makePrimary=function(t){return"type"==this.name&&this.ns==V.epub&&(this.chained&&t.insertInTable(t.epubtypes,this.value,this.chained),!0)},e}(ao),mo=function(t){function e(e,n){var i;return(i=t.call(this)||this).ns=e,i.name=n,i}x(e,t);var n=e.prototype;return n.apply=function(t){if(t.currentElement){var e=t.currentElement.getAttributeNS(this.ns,this.name);e&&Rr[e]&&this.chained.apply(t)}},n.getPriority=function(){return 0},n.makePrimary=function(t){return!1},e}(ao),vo=function(t){function e(e,n,i){var r;return(r=t.call(this)||this).ns=e,r.name=n,r.regexp=i,r}return x(e,t),e.prototype.apply=function(t){if(t.currentElement){var e=t.currentElement.getAttributeNS(this.ns,this.name);e&&e.match(this.regexp)&&this.chained.apply(t)}},e}(ao),Eo=function(t){function e(e){var n;return(n=t.call(this)||this).langRegExp=e,n}return x(e,t),e.prototype.apply=function(t){t.lang.match(this.langRegExp)&&this.chained.apply(t)},e}(ao),wo=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.apply=function(t){t.isFirst&&this.chained.apply(t)},n.getPriority=function(){return 6},e}(ao),yo=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.apply=function(t){t.isRoot&&this.chained.apply(t)},n.getPriority=function(){return 12},e}(ao),No=function(t){function e(e,n){var i;return(i=t.call(this)||this).a=e,i.b=n,i}return x(e,t),e.prototype.matchANPlusB=function(t){return Nr(t,this.a,this.b)},e}(ao),bo=function(t){function e(e,n){return t.call(this,e,n)||this}x(e,t);var n=e.prototype;return n.apply=function(t){this.matchANPlusB(t.currentSiblingOrder)&&this.chained.apply(t)},n.getPriority=function(){return 5},e}(No),So=function(t){function e(e,n){return t.call(this,e,n)||this}x(e,t);var n=e.prototype;return n.apply=function(t){this.matchANPlusB(t.currentSiblingTypeCounts[t.currentNamespace][t.currentLocalName])&&this.chained.apply(t)},n.getPriority=function(){return 5},e}(No),Co=function(t){function e(e,n){return t.call(this,e,n)||this}x(e,t);var n=e.prototype;return n.apply=function(t){var e=t.currentFollowingSiblingOrder;null===e&&(e=t.currentFollowingSiblingOrder=t.currentElement.parentNode.childElementCount-t.currentSiblingOrder+1),this.matchANPlusB(e)&&this.chained.apply(t)},n.getPriority=function(){return 4},e}(No),To=function(t){function e(e,n){return t.call(this,e,n)||this}x(e,t);var n=e.prototype;return n.apply=function(t){var e=t.currentFollowingSiblingTypeCounts;if(!e[t.currentNamespace]){var n=t.currentElement;do{var i=n.namespaceURI,r=n.localName,o=e[i];o||(o=e[i]={}),o[r]=(o[r]||0)+1}while(n=n.nextElementSibling)}this.matchANPlusB(e[t.currentNamespace][t.currentLocalName])&&this.chained.apply(t)},n.getPriority=function(){return 4},e}(No),xo=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.apply=function(t){for(var e=t.currentElement.firstChild;e;){switch(e.nodeType){case Node.ELEMENT_NODE:return;case Node.TEXT_NODE:if(e.length>0)return}e=e.nextSibling}this.chained.apply(t)},n.getPriority=function(){return 4},e}(ao),Io=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.apply=function(t){!1===t.currentElement.disabled&&this.chained.apply(t)},n.getPriority=function(){return 5},e}(ao),Po=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.apply=function(t){!0===t.currentElement.disabled&&this.chained.apply(t)},n.getPriority=function(){return 5},e}(ao),Ro=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.apply=function(t){var e=t.currentElement;!0!==e.selected&&!0!==e.checked||this.chained.apply(t)},n.getPriority=function(){return 5},e}(ao),Ao=function(t){function e(e){var n;return(n=t.call(this)||this).condition=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){if(t.conditions[this.condition])try{t.dependentConditions.push(this.condition),this.chained.apply(t)}finally{t.dependentConditions.pop()}},n.getPriority=function(){return 5},e}(ao),Lo=function(t){function e(){var e;return(e=t.call(this)||this).applied=!1,e}x(e,t);var n=e.prototype;return n.apply=function(t){this.applied=!0},n.clone=function(){var t=new e;return t.applied=this.applied,t},e}(no),Oo=function(t){function e(e){var n;return(n=t.call(this)||this).checkAppliedAction=new Lo,n.firstAction=Jr(e,n.checkAppliedAction),n}x(e,t);var n=e.prototype;return n.apply=function(t){this.firstAction.apply(t),this.checkAppliedAction.applied||this.chained.apply(t),this.checkAppliedAction.applied=!1},n.getPriority=function(){return this.firstAction.getPriority()},e}(ao),ko=function(){function t(t,e,n){this.condition=t,this.viewConditionId=e,this.viewCondition=n}var e=t.prototype;return e.increment=function(t){t.increment(this.condition,this.viewCondition)},e.decrement=function(t){t.decrement(this.condition,this.viewCondition)},e.buildViewConditionMatcher=function(t){return t.buildViewConditionMatcher(this.viewConditionId)},t}(),Do=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.fresh=function(t){return new e(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},n.push=function(t,e){return 0==e&&this.increment(t),!1},n.pop=function(t,e){return 0==e&&(this.decrement(t),!0)},e}(ko),Fo=function(t){function e(e,n,i){return t.call(this,e,n,i)||this}x(e,t);var n=e.prototype;return n.fresh=function(t){return new e(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},n.push=function(t,e){return 0==e?this.increment(t):1==e&&this.decrement(t),!1},n.pop=function(t,e){return 0==e?(this.decrement(t),!0):(1==e&&this.increment(t),!1)},e}(ko),_o=function(t){function e(e,n,i){var r;return(r=t.call(this,e,n,i)||this).fired=!1,r}x(e,t);var n=e.prototype;return n.fresh=function(t){return new e(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},n.push=function(t,e){return!!this.fired&&(this.decrement(t),!0)},n.pop=function(t,e){return this.fired?(this.decrement(t),!0):(0==e&&(this.fired=!0,this.increment(t)),!1)},e}(ko),Bo=function(t){function e(e,n,i){var r;return(r=t.call(this,e,n,i)||this).fired=!1,r}x(e,t);var n=e.prototype;return n.fresh=function(t){return new e(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},n.push=function(t,e){return this.fired&&(-1==e?this.increment(t):0==e&&this.decrement(t)),!1},n.pop=function(t,e){if(this.fired){if(-1==e)return this.decrement(t),!0;0==e&&this.increment(t)}else 0==e&&(this.fired=!0,this.increment(t));return!1},e}(ko),Mo=function(){function t(t,e){this.afterprop=t,this.element=e}var e=t.prototype;return e.fresh=function(t){return this},e.push=function(t,e){return!1},e.pop=function(t,e){return 0==e&&(t.processPseudoelementProps(this.afterprop,this.element),!0)},t}(),Uo=function(){function t(t){this.lang=t}var e=t.prototype;return e.fresh=function(t){return this},e.push=function(t,e){return!1},e.pop=function(t,e){return 0==e&&(t.lang=this.lang,!0)},t}(),Vo=function(){function t(t){this.oldQuotes=t}var e=t.prototype;return e.fresh=function(t){return this},e.push=function(t,e){return!1},e.pop=function(t,e){return 0==e&&(t.quotes=this.oldQuotes,!0)},t}(),Ho=function(t){function e(e){var n;return(n=t.call(this)||this).element=e,n}x(e,t);var n=e.prototype;return n.createValueFromString=function(t,e){switch(e){case"url":return new Me(t||"about:invalid");case"string":default:return new Ae(t||"")}},n.visitFunc=function(e){if("attr"!==e.name)return t.prototype.visitFunc.call(this,e);var n,i="string",r=null;if(e.values[0]instanceof Ve){var o=e.values[0].values;o.length>=2&&(i=o[1].stringValue()),r=o[0].stringValue()}else r=e.values[0].stringValue();return n=this.createValueFromString(e.values.length>1?e.values[1].stringValue():null,i),this.element&&this.element.hasAttribute(r)?this.createValueFromString(this.element.getAttribute(r),i):n},e}(xe),zo=function(t){function e(e,n,i){var r;return(r=t.call(this)||this).cascade=e,r.element=n,r.counterResolver=i,r}x(e,t);var n=e.prototype;return n.visitIdent=function(t){var e=this.cascade,n=e.quotes,i=Math.floor(n.length/2)-1;switch(t.name){case"open-quote":var r=n[2*Math.min(i,e.quoteDepth)];return e.quoteDepth++,r;case"close-quote":return e.quoteDepth>0&&e.quoteDepth--,n[2*Math.min(i,e.quoteDepth)+1];case"no-open-quote":return e.quoteDepth++,new Ae("");case"no-close-quote":return e.quoteDepth>0&&e.quoteDepth--,new Ae("")}return t},n.format=function(t,e){var n,i=!1,r=!1;null!=(n=e.match(/^upper-(.*)/))?(i=!0,e=n[1]):null!=(n=e.match(/^lower-(.*)/))&&(r=!0,e=n[1]);var o="";return Go[e]?o=function(t,e){if(e>t[0]||e<=0||e!=Math.round(e))return"";for(var n="",i=1;i<t.length;i+=2){var r=t[i],o=Math.floor(e/r);if(o>20)return"";for(e-=o*r;o>0;)n+=t[i+1],o--}return n}(Go[e],t):Wo[e]?o=function(t,e){if(e<=0||e!=Math.round(e))return"";var n=function(t){for(var e=[],n=0;n<t.length;)if("-"==t.substr(n+1,1)){var i=t.charCodeAt(n),r=t.charCodeAt(n+2);n+=3;for(var o=i;o<=r;o++)e.push(String.fromCharCode(o))}else e.push(t.substr(n++,1));return e}(t),i="";do{var r=--e%n.length;i=n[r]+i,e=(e-r)/n.length}while(e>0);return i}(Wo[e],t):null!=Xo[e]?o=Xo[e]:"decimal-leading-zero"==e?1==(o=""+t).length&&(o="0"+o):o="cjk-ideographic"==e||"trad-chinese-informal"==e?function(t,e){if(t>9999||t<-9999)return""+t;if(0==t)return e.digits.charAt(0);var n=new tt;if(t<0&&(n.append(e.negative),t=-t),t<10)n.append(e.digits.charAt(t));else if(!e.formal&&t<=19)n.append(e.markers.charAt(0)),0!=t&&n.append(e.digits.charAt(t-10));else{var i=Math.floor(t/1e3);i&&(n.append(e.digits.charAt(i)),n.append(e.markers.charAt(2)));var r=Math.floor(t/100)%10;r&&(n.append(e.digits.charAt(r)),n.append(e.markers.charAt(1)));var o=Math.floor(t/10)%10;o&&(n.append(e.digits.charAt(o)),n.append(e.markers.charAt(0)));var a=t%10;a&&n.append(e.digits.charAt(a))}return n.toString()}(t,jo):""+t,i?o.toUpperCase():r?o.toLowerCase():o},n.visitFuncCounter=function(t){var e=this,n=t[0].toString(),i=t.length>1?t[1].stringValue():"decimal",r=this.cascade.counters[n];if(r&&r.length)return new Ae(this.format(r&&r.length&&r[r.length-1]||0,i));var o=new Ge(this.counterResolver.getPageCounterVal(n,function(t){return e.format(t||0,i)}));return new Ve([o])},n.visitFuncCounters=function(t){var e=this,n=t[0].toString(),i=t[1].stringValue(),r=t.length>2?t[2].stringValue():"decimal",o=this.cascade.counters[n],a=new tt;if(o&&o.length)for(var s=0;s<o.length;s++)s>0&&a.append(i),a.append(this.format(o[s],r));var l=new Ge(this.counterResolver.getPageCountersVal(n,function(t){var n=[];if(t.length)for(var o=0;o<t.length;o++)n.push(e.format(t[o],r));var s=a.toString();return s.length&&n.push(s),n.length?n.join(i):e.format(0,r)}));return new Ve([l])},n.visitFuncTargetCounter=function(t){var e,n=this,i=t[0];e=i instanceof Me?i.url:i.stringValue();var r=t[1].toString(),o=t.length>2?t[2].stringValue():"decimal",a=new Ge(this.counterResolver.getTargetCounterVal(e,r,function(t){return n.format(t||0,o)}));return new Ve([a])},n.visitFuncTargetCounters=function(t){var e,n=this,i=t[0];e=i instanceof Me?i.url:i.stringValue();var r=t[1].toString(),o=t[2].stringValue(),a=t.length>3?t[3].stringValue():"decimal",s=new Ge(this.counterResolver.getTargetCountersVal(e,r,function(t){var e=t.map(function(t){return n.format(t,a)});return e.length?e.join(o):n.format(0,a)}));return new Ve([s])},n.visitFunc=function(t){switch(t.name){case"counter":if(t.values.length<=2)return this.visitFuncCounter(t.values);break;case"counters":if(t.values.length<=3)return this.visitFuncCounters(t.values);break;case"target-counter":if(t.values.length<=3)return this.visitFuncTargetCounter(t.values);break;case"target-counters":if(t.values.length<=4)return this.visitFuncTargetCounters(t.values)}return h.warn("E_CSS_CONTENT_PROP:",t.toString()),new Ae("")},e}(xe),Go={roman:[4999,1e3,"M",900,"CM",500,"D",400,"CD",100,"C",90,"XC",50,"L",40,"XL",10,"X",9,"IX",5,"V",4,"IV",1,"I"],armenian:[9999,9e3,"ք",8e3,"փ",7e3,"ւ",6e3,"ց",5e3,"ր",4e3,"տ",3e3,"վ",2e3,"ս",1e3,"ռ",900,"ջ",800,"պ",700,"չ",600,"ո",500,"շ",400,"ն",300,"յ",200,"մ",100,"ճ",90,"ղ",80,"ձ",70,"հ",60,"կ",50,"ծ",40,"խ",30,"լ",20,"ի",10,"ժ",9,"թ",8,"ը",7,"է",6,"զ",5,"ե",4,"դ",3,"գ",2,"բ",1,"ա"],georgian:[19999,1e4,"ჵ",9e3,"ჰ",8e3,"ჯ",7e3,"ჴ",6e3,"ხ",5e3,"ჭ",4e3,"წ",3e3,"ძ",2e3,"ც",1e3,"ჩ",900,"შ",800,"ყ",700,"ღ",600,"ქ",500,"ფ",400,"ჳ",300,"ტ",200,"ს",100,"რ",90,"ჟ",80,"პ",70,"ო",60,"ჲ",50,"ნ",40,"მ",30,"ლ",20,"კ",10,"ი",9,"თ",8,"ჱ",7,"ზ",6,"ვ",5,"ე",4,"დ",3,"გ",2,"ბ",1,"ა"],hebrew:[999,400,"ת",300,"ש",200,"ר",100,"ק",90,"צ",80,"פ",70,"ע",60,"ס",50,"נ",40,"מ",30,"ל",20,"כ",19,"יט",18,"יח",17,"יז",16,"טז",15,"טו",10,"י",9,"ט",8,"ח",7,"ז",6,"ו",5,"ה",4,"ד",3,"ג",2,"ב",1,"א"]},Wo={latin:"a-z",alpha:"a-z",greek:"α-ρσ-ω",russian:"а-ик-щэ-я"},Xo={square:"■",disc:"•",circle:"◦",none:""},jo={formal:!1,digits:"零一二三四五六七八九",markers:"十百千",negative:"負"};function Yo(t,e){for(var n in t)e[n]=t[n].clone()}var Ko,qo=function(){function t(){this.nsCount=0,this.nsPrefix={},this.tags={},this.nstags={},this.epubtypes={},this.classes={},this.ids={},this.pagetypes={},this.order=0}var e=t.prototype;return e.clone=function(){var e=new t;for(var n in e.nsCount=this.nsCount,this.nsPrefix)e.nsPrefix[n]=this.nsPrefix[n];return Yo(this.tags,e.tags),Yo(this.nstags,e.nstags),Yo(this.epubtypes,e.epubtypes),Yo(this.classes,e.classes),Yo(this.ids,e.ids),Yo(this.pagetypes,e.pagetypes),e.order=this.order,e},e.insertInTable=function(t,e,n){var i=t[e];i&&(n=i.mergeWith(n)),t[e]=n},e.createInstance=function(t,e,n,i){return new Qo(this,t,e,n,i)},e.nextOrder=function(){return this.order+=1/1048576},t}(),Qo=function(){function t(t,e,n,i,r){this.context=e,this.counterListener=n,this.counterResolver=i,this.stack=[[],[]],this.conditions={},this.currentElement=null,this.currentElementOffset=null,this.currentStyle=null,this.currentClassNames=null,this.currentLocalName="",this.currentNamespace="",this.currentId="",this.currentXmlId="",this.currentNSTag="",this.currentEpubTypes=null,this.currentPageType=null,this.isFirst=!0,this.isRoot=!0,this.counters={},this.counterScoping=[{}],this.quoteDepth=0,this.lang="",this.siblingOrderStack=[0],this.currentSiblingOrder=0,this.siblingTypeCountsStack=[{}],this.currentFollowingSiblingOrder=null,this.followingSiblingTypeCountsStack=[{}],this.viewConditions={},this.dependentConditions=[],this.code=t,this.quotes=[new Ae("“"),new Ae("”"),new Ae("‘"),new Ae("’")],this.currentSiblingTypeCounts=this.siblingTypeCountsStack[0],this.followingSiblingOrderStack=[this.currentFollowingSiblingOrder],this.currentFollowingSiblingTypeCounts=this.siblingTypeCountsStack[0]}var e=t.prototype;return e.pushConditionItem=function(t){this.stack[this.stack.length-1].push(t)},e.increment=function(t,e){this.conditions[t]=(this.conditions[t]||0)+1,e&&(this.viewConditions[t]?this.viewConditions[t].push(e):this.viewConditions[t]=[e])},e.decrement=function(t,e){this.conditions[t]--,this.viewConditions[t]&&(this.viewConditions[t]=this.viewConditions[t].filter(function(t){return t!==e}),0===this.viewConditions[t].length&&delete this.viewConditions[t])},e.buildViewConditionMatcher=function(t){var e=this,n=null;t&&(n=Tr.buildViewConditionMatcher(this.currentElementOffset,t));var i=this.dependentConditions.map(function(t){var n=e.viewConditions[t];return n&&n.length>0?1===n.length?n[0]:Tr.buildAnyMatcher([].concat(n)):null}).filter(function(t){return t});return i.length<=0?n:null===n?1===i.length?i[0]:Tr.buildAllMatcher(i):Tr.buildAllMatcher([n].concat(i))},e.applyAction=function(t,e){var n=t[e];n&&n.apply(this)},e.pushRule=function(t,e,n){this.currentElement=null,this.currentElementOffset=null,this.currentStyle=n,this.currentNamespace="",this.currentLocalName="",this.currentId="",this.currentXmlId="",this.currentClassNames=t,this.currentNSTag="",this.currentEpubTypes=Zo,this.currentPageType=e,this.applyActions()},e.defineCounter=function(t,e){this.counters[t]?this.counters[t].push(e):this.counters[t]=[e];var n=this.counterScoping[this.counterScoping.length-1];n||(this.counterScoping[this.counterScoping.length-1]=n={}),n[t]=!0},e.pushCounters=function(t){var e=je.inline,n=t.display;n&&(e=n.evaluate(this.context));var i=null,r=null,o=null,a=t["counter-reset"];if(a){var s=a.evaluate(this.context);s&&(i=In(s,!0))}var l=t["counter-set"];if(l){var u=l.evaluate(this.context);u&&(o=In(u,!1))}var h,c,f,d,p=t["counter-increment"];if(p){var g=p.evaluate(this.context);g&&(r=In(g,!1))}if("ol"!=this.currentLocalName&&"ul"!=this.currentLocalName||this.currentNamespace!=V.XHTML||(i||(i={}),i["ua-list-item"]=(null!=(h=null==(c=this.currentElement)?void 0:c.start)?h:1)-1),e===je.list_item&&(r||(r={}),r["ua-list-item"]=1,/^\s*[-+]?\d/.test(null!=(f=null==(d=this.currentElement)?void 0:d.getAttribute("value"))?f:"")&&(i||(i={}),i["ua-list-item"]=this.currentElement.value-1)),i)for(var m in i)this.defineCounter(m,i[m]);if(o)for(var v in o)if(this.counters[v]){var E=this.counters[v];E[E.length-1]=o[v]}else this.defineCounter(v,o[v]);if(r)for(var w in r){this.counters[w]||this.defineCounter(w,0);var y=this.counters[w];y[y.length-1]+=r[w]}if(e===je.list_item){var N=this.counters["ua-list-item"];t["ua-list-item-count"]=new Mr(new Fe(N[N.length-1]),0)}this.counterScoping.push(null)},e.popCounters=function(){var t=this.counterScoping.pop();if(t)for(var e in t){var n=this.counters[e];n&&(1==n.length?delete this.counters[e]:n.pop())}},e.processPseudoelementProps=function(t,e){this.pushCounters(t),t.content&&(t.content=t.content.filterValue(new zo(this,e,this.counterResolver))),this.popCounters()},e.pushElement=function(t,e,n){var i=this;this.currentPageType=null,this.currentElement=t,this.currentElementOffset=n,this.currentStyle=e,this.currentNamespace=t.namespaceURI,this.currentLocalName=t.localName;var r=this.code.nsPrefix[this.currentNamespace];this.currentNSTag=r?r+this.currentLocalName:"",this.currentId=t.getAttribute("id"),this.currentXmlId=t.getAttributeNS(V.XML,"id");var o=t.getAttribute("class");this.currentClassNames=o?o.split(/\s+/):Zo;var a=t.getAttributeNS(V.epub,"type");this.currentEpubTypes=a?a.split(/\s+/):Zo;var s=J(t);s&&(this.stack[this.stack.length-1].push(new Uo(this.lang)),this.lang=s.toLowerCase());var l=this.isRoot,u=this.siblingOrderStack;this.currentSiblingOrder=++u[u.length-1],u.push(0);var h=this.siblingTypeCountsStack,c=this.currentSiblingTypeCounts=h[h.length-1],f=c[this.currentNamespace];f||(f=c[this.currentNamespace]={}),f[this.currentLocalName]=(f[this.currentLocalName]||0)+1,h.push({});var d=this.followingSiblingOrderStack;this.currentFollowingSiblingOrder=null!==d[d.length-1]?--d[d.length-1]:null,d.push(null);var p=this.followingSiblingTypeCountsStack,g=this.currentFollowingSiblingTypeCounts=p[p.length-1];g&&g[this.currentNamespace]&&g[this.currentNamespace][this.currentLocalName]--,p.push({}),this.applyActions(),this.applyAttrFilter(t);var m=e.quotes,v=null;if(m){var E=m.evaluate(this.context);E&&(v=new Vo(this.quotes),E===je.none?this.quotes=[new Ae(""),new Ae("")]:E instanceof Ve&&(this.quotes=E.values))}this.pushCounters(this.currentStyle);var w=this.currentId||this.currentXmlId||t.getAttribute("name")||"";if(l||w){var y={};Object.keys(this.counters).forEach(function(t){y[t]=Array.from(i.counters[t])}),this.counterListener.countersOfId(w,y)}var N=Yr(this.currentStyle,"_pseudos");if(N)for(var b,S=!0,C=D($o);!(b=C()).done;){var T=b.value;T||(S=!1);var x=N[T];x&&(S?this.processPseudoelementProps(x,t):this.stack[this.stack.length-2].push(new Mo(x,t)))}v&&this.stack[this.stack.length-2].push(v)},e.applyAttrFilterInner=function(t,e){for(var n in e)Gr(n)&&(e[n]=e[n].filterValue(t))},e.applyAttrFilter=function(t){var e=new Ho(t),n=this.currentStyle,i=Yr(n,"_pseudos");for(var r in i)this.applyAttrFilterInner(e,i[r]);this.applyAttrFilterInner(e,n)},e.applyActions=function(){var t;for(t=0;t<this.currentClassNames.length;t++)this.applyAction(this.code.classes,this.currentClassNames[t]);for(t=0;t<this.currentEpubTypes.length;t++)this.applyAction(this.code.epubtypes,this.currentEpubTypes[t]);this.applyAction(this.code.ids,this.currentId),this.applyAction(this.code.tags,this.currentLocalName),""!=this.currentLocalName&&this.applyAction(this.code.tags,"*"),this.applyAction(this.code.nstags,this.currentNSTag),null!==this.currentPageType&&(this.applyAction(this.code.pagetypes,this.currentPageType),this.applyAction(this.code.pagetypes,"*")),this.stack.push([]);for(var e=1;e>=-1;--e){var n=this.stack[this.stack.length-e-2];for(t=0;t<n.length;)n[t].push(this,e)?n.splice(t,1):t++}this.isFirst=!0,this.isRoot=!1},e.pop=function(){for(var t=1;t>=-1;--t)for(var e=this.stack[this.stack.length-t-2],n=0;n<e.length;)e[n].pop(this,t)?e.splice(n,1):n++;this.stack.pop(),this.isFirst=!1},e.popRule=function(){this.pop()},e.popElement=function(t){this.siblingOrderStack.pop(),this.siblingTypeCountsStack.pop(),this.followingSiblingOrderStack.pop(),this.followingSiblingTypeCountsStack.pop(),this.pop(),this.popCounters()},t}(),Zo=[],$o=["before","transclusion-before","footnote-call","footnote-marker","inner","first-letter","first-line","","transclusion-after","after"];!function(t){t[t.TOP=0]="TOP",t[t.SELECTOR=1]="SELECTOR",t[t.RULE=2]="RULE"}(Ko||(Ko={}));var Jo=null,ta=function(t){function e(e,n,i,r,o,a,s){var l;return(l=t.call(this,e,n,s)||this).condition=i,l.regionId=o,l.validatorSet=a,l.chain=null,l.specificity=0,l.elementStyle=null,l.conditionCount=0,l.pseudoelement=null,l.footnoteContent=!1,l.viewConditionId=null,l.cascade=r?r.cascade:Jo?Jo.clone():new qo,l.state=Ko.TOP,l}x(e,t);var n=e.prototype;return n.insertNonPrimary=function(t){this.cascade.insertInTable(this.cascade.tags,"*",t)},n.processChain=function(t){var e=Jr(this.chain,t);e!==t&&e.makePrimary(this.cascade)||this.insertNonPrimary(e)},n.isInsideSelectorRule=function(t){return this.state!=Ko.TOP&&(this.reportAndSkip(t),!0)},n.tagSelector=function(t,e){(e||t)&&(this.specificity+=1,this.chain.push(e&&t?new ho(t,e.toLowerCase()):e?new uo(e.toLowerCase()):new fo(t)))},n.classSelector=function(t){if(this.pseudoelement)return h.warn("::"+this.pseudoelement,"followed by ."+t),void this.chain.push(new Ao(""));this.specificity+=256,this.chain.push(new so(t))},n.pseudoclassSelector=function(t,e){if(this.pseudoelement)return h.warn("::"+this.pseudoelement,"followed by :"+t),void this.chain.push(new Ao(""));switch(t.toLowerCase()){case"enabled":this.chain.push(new Io);break;case"disabled":this.chain.push(new Po);break;case"checked":this.chain.push(new Ro);break;case"root":this.chain.push(new yo);break;case"link":this.chain.push(new uo("a")),this.chain.push(new po("","href"));break;case"-adapt-href-epub-type":case"href-epub-type":if(e&&1==e.length&&"string"==typeof e[0]){var n=new RegExp("(^|s)"+st(e[0])+"($|s)");this.chain.push(new co(n))}else this.chain.push(new Ao(""));break;case"-adapt-footnote-content":case"footnote-content":this.footnoteContent=!0;break;case"visited":case"active":case"hover":case"focus":this.chain.push(new Ao(""));break;case"lang":this.chain.push(e&&1==e.length&&"string"==typeof e[0]?new Eo(new RegExp("^"+st(e[0].toLowerCase())+"($|-)")):new Ao(""));break;case"nth-child":case"nth-last-child":case"nth-of-type":case"nth-last-of-type":var i=ea[t.toLowerCase()];this.chain.push(e&&2==e.length?new i(e[0],e[1]):new Ao(""));break;case"first-child":this.chain.push(new wo);break;case"last-child":this.chain.push(new Co(0,1));break;case"first-of-type":this.chain.push(new So(0,1));break;case"last-of-type":this.chain.push(new To(0,1));break;case"only-child":this.chain.push(new wo),this.chain.push(new Co(0,1));break;case"only-of-type":this.chain.push(new So(0,1)),this.chain.push(new To(0,1));break;case"empty":this.chain.push(new xo);break;case"before":case"after":case"first-line":case"first-letter":return void this.pseudoelementSelector(t,e);default:h.warn("unknown pseudo-class selector: "+t),this.chain.push(new Ao(""))}this.specificity+=256},n.pseudoelementSelector=function(t,e){switch(t){case"before":case"after":case"first-line":case"first-letter":case"footnote-call":case"footnote-marker":case"inner":case"after-if-continues":this.pseudoelement?(h.warn("Double pseudoelement ::"+this.pseudoelement+"::"+t),this.chain.push(new Ao(""))):this.pseudoelement=t;break;case"first-n-lines":if(e&&1==e.length&&"number"==typeof e[0]){var n=Math.round(e[0]);if(n>0&&n==e[0]){this.pseudoelement?(h.warn("Double pseudoelement ::"+this.pseudoelement+"::"+t),this.chain.push(new Ao(""))):this.pseudoelement="first-"+n+"-lines";break}}this.chain.push(new Ao(""));break;case"nth-fragment":e&&2==e.length?this.viewConditionId="NFS_"+e[0]+"_"+e[1]:this.chain.push(new Ao(""));break;default:h.warn("Unrecognized pseudoelement: ::"+t),this.chain.push(new Ao(""))}this.specificity+=1},n.idSelector=function(t){this.specificity+=65536,this.chain.push(new lo(t))},n.attributeSelector=function(t,e,n,i){var r;switch(this.specificity+=256,e=e.toLowerCase(),i=i||"",n){case An.EOF:r=new po(t,e);break;case An.EQ:r=new go(t,e,i);break;case An.TILDE_EQ:r=!i||i.match(/\s/)?new Ao(""):new vo(t,e,new RegExp("(^|\\s)"+st(i)+"($|\\s)"));break;case An.BAR_EQ:r=new vo(t,e,new RegExp("^"+st(i)+"($|-)"));break;case An.HAT_EQ:r=i?new vo(t,e,new RegExp("^"+st(i))):new Ao("");break;case An.DOLLAR_EQ:r=i?new vo(t,e,new RegExp(st(i)+"$")):new Ao("");break;case An.STAR_EQ:r=i?new vo(t,e,new RegExp(st(i))):new Ao("");break;case An.COL_COL:"supported"==i?r=new mo(t,e):(h.warn("Unsupported :: attr selector op:",i),r=new Ao(""));break;default:h.warn("Unsupported attr selector:",n),r=new Ao("")}this.chain.push(r)},n.descendantSelector=function(){var t="d"+na++;this.processChain(new io(new Do(t,this.viewConditionId,null))),this.chain=[new Ao(t)],this.viewConditionId=null},n.childSelector=function(){var t="c"+na++;this.processChain(new io(new Fo(t,this.viewConditionId,null))),this.chain=[new Ao(t)],this.viewConditionId=null},n.adjacentSiblingSelector=function(){var t="a"+na++;this.processChain(new io(new _o(t,this.viewConditionId,null))),this.chain=[new Ao(t)],this.viewConditionId=null},n.followingSiblingSelector=function(){var t="f"+na++;this.processChain(new io(new Bo(t,this.viewConditionId,null))),this.chain=[new Ao(t)],this.viewConditionId=null},n.nextSelector=function(){this.finishChain(),this.pseudoelement=null,this.footnoteContent=!1,this.specificity=0,this.chain=[]},n.startSelectorRule=function(){this.isInsideSelectorRule("E_CSS_UNEXPECTED_SELECTOR")||(this.state=Ko.SELECTOR,this.elementStyle={},this.pseudoelement=null,this.specificity=0,this.footnoteContent=!1,this.chain=[])},n.error=function(e,n){t.prototype.error.call(this,e,n),this.state==Ko.SELECTOR&&(this.state=Ko.TOP)},n.startStylesheet=function(e){t.prototype.startStylesheet.call(this,e),this.state=Ko.TOP},n.startRuleBody=function(){this.finishChain(),t.prototype.startRuleBody.call(this),this.state==Ko.SELECTOR&&(this.state=Ko.TOP)},n.endRule=function(){t.prototype.endRule.call(this),this.insideSelectorRule=Ko.TOP},n.finishChain=function(){if(this.chain){var t=this.specificity+this.cascade.nextOrder();this.processChain(this.makeApplyRuleAction(t)),this.chain=null,this.pseudoelement=null,this.viewConditionId=null,this.footnoteContent=!1,this.specificity=0}},n.makeApplyRuleAction=function(t){var e=this.regionId;return this.footnoteContent&&(e=e?"xxx-bogus-xxx":"footnote"),new oo(this.elementStyle,t,this.pseudoelement,e,this.viewConditionId)},n.special=function(t,e){var n;n=this.condition?new Ur(e,0,this.condition):new Mr(e,0),Zr(this.elementStyle,t).push(n)},n.property=function(t,e,n){this.validatorSet.validatePropertyAndHandleShorthand(t,e,n,this)},n.invalidPropertyValue=function(t,e){this.report("E_INVALID_PROPERTY_VALUE "+t+": "+e.toString())},n.unknownProperty=function(t,e){this.report("E_INVALID_PROPERTY "+t+": "+e.toString())},n.simpleProperty=function(t,e,n){"display"!=t||e!==je.oeb_page_head&&e!==je.oeb_page_foot||(this.simpleProperty("flow-options",new Ve([je.exclusive,je._static]),n),this.simpleProperty("flow-into",e,n),e=je.block),p("SIMPLE_PROPERTY").forEach(function(i){var r=i({name:t,value:e,important:n});t=r.name,e=r.value,n=r.important});var i=n?this.getImportantSpecificity():this.getBaseSpecificity(),r=this.condition?new Ur(e,i,this.condition):new Mr(e,i);jr(this.elementStyle,t,r)},n.finish=function(){return this.cascade},n.startFuncWithSelector=function(t){switch(t){case"not":var e=new ia(this);e.startSelectorRule(),this.owner.pushHandler(e)}},e}($i),ea={"nth-child":bo,"nth-of-type":So,"nth-last-child":Co,"nth-last-of-type":To},na=0,ia=function(t){function e(e){var n;return(n=t.call(this,e.scope,e.owner,e.condition,e,e.regionId,e.validatorSet,!1)||this).parent=e,n.parentChain=e.chain,n}x(e,t);var n=e.prototype;return n.startFuncWithSelector=function(t){"not"==t&&this.reportAndSkip("E_CSS_UNEXPECTED_NOT")},n.startRuleBody=function(){this.reportAndSkip("E_CSS_UNEXPECTED_RULE_BODY")},n.nextSelector=function(){this.reportAndSkip("E_CSS_UNEXPECTED_NEXT_SELECTOR")},n.endFuncWithSelector=function(){this.chain&&this.chain.length>0&&this.parentChain.push(new Oo(this.chain)),this.parent.specificity+=this.specificity,this.owner.popHandler()},n.error=function(e,n){t.prototype.error.call(this,e,n),this.owner.popHandler()},e}(ta),ra=function(t){function e(e,n){return t.call(this,e,n,!1)||this}return x(e,t),e.prototype.property=function(t,e,n){if(this.scope.values[t])this.error("E_CSS_NAME_REDEFINED "+t,this.getCurrentToken());else{var i=t.match(/height|^(top|bottom)$/)?"vh":"vw",r=new ce(this.scope,100,i);this.scope.defineName(t,e.toExpr(this.scope,r))}},e}($i),oa=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this,e,n,!1)||this).condition=i,a.elementStyle=r,a.validatorSet=o,a.order=0,a}x(e,t);var n=e.prototype;return n.property=function(t,e,n){n?h.warn("E_IMPORTANT_NOT_ALLOWED"):this.validatorSet.validatePropertyAndHandleShorthand(t,e,n,this)},n.invalidPropertyValue=function(t,e){h.warn("E_INVALID_PROPERTY_VALUE",t+":",e.toString())},n.unknownProperty=function(t,e){h.warn("E_INVALID_PROPERTY",t+":",e.toString())},n.simpleProperty=function(t,e,n){var i=n?this.getImportantSpecificity():this.getBaseSpecificity();i+=this.order,this.order+=1/1048576;var r=this.condition?new Ur(e,i,this.condition):new Mr(e,i);jr(this.elementStyle,t,r)},e}($i),aa=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).validatorSet=n,i.elementStyle={},i.order=0,i}x(e,t);var n=e.prototype;return n.property=function(t,e,n){this.validatorSet.validatePropertyAndHandleShorthand(t,e,n,this)},n.invalidPropertyValue=function(t,e){h.warn("E_INVALID_PROPERTY_VALUE",t+":",e.toString())},n.unknownProperty=function(t,e){h.warn("E_INVALID_PROPERTY",t+":",e.toString())},n.simpleProperty=function(t,e,n){var i=n?67108864:50331648;i+=this.order,this.order+=1/1048576;var r=new Mr(e,i);jr(this.elementStyle,t,r)},e}(gr);function sa(t,e){var n=qr(t);n&&n.forEach(function(t){t.matcher.matches()&&e(t.styles)})}function la(t,e,n){sa(n,function(n){da(t,n,e)})}function ua(t,e,n){var i=t["writing-mode"];if(i){var r=i.evaluate(e,"writing-mode");if(r&&r!==je.inherit)return r===je.vertical_rl}return n}function ha(t,e,n){var i=t.direction;if(i){var r=i.evaluate(e,"direction");if(r&&r!==je.inherit)return r===je.rtl}return n}function ca(t,e,n,i,r){var o={};for(var a in t)Gr(a)&&(o[a]=Xr(t,a));return la(o,e,t),fa(t,n,i,function(t,n){da(o,n,e),la(o,e,n)}),o}function fa(t,e,n,i){var r=Yr(t,"_regions");if((e||n)&&r){if(n){var o=["footnote"];e=e?e.concat(o):o}for(var a,s=D(e);!(a=s()).done;){var l=a.value,u=r[l];u&&i(l,u)}}}function da(t,e,n){for(var i in e)if(Gr(i)){var r=Xr(e,i);t[i]=Vr(n,t[i],r)}}var pa=function(t,e,n,i,r){var o=n?i?_r:Dr:i?Br:Fr;for(var a in t)if(t.hasOwnProperty(a)){var s=t[a];if(!s)continue;var l=o[a],u=void 0;if(l){var h=t[l];if(h&&h.priority>s.priority)continue;u=Or[l]?l:a}else u=a;e[u]=r(a,s)}};function ga(t,e){var n={};return Object.keys(t).forEach(function(i){var r=n[i]={},o=t[i];Object.keys(o).forEach(function(t){r[t]=o[t].map(function(t){var n=e?t.physical:t.logical;return{regexp:new RegExp("(-?)"+(e?t.logical:t.physical)+"(-?)"),to:"$1"+n+"$2"}})})}),n}function ma(t,e,n,i){var r=i[e];if(!r)throw new Error("unknown writing-mode: "+e);var o=r[n||"ltr"];if(!o)throw new Error("unknown direction: "+n);for(var a,s=D(o);!(a=s()).done;){var l=a.value,u=t.replace(l.regexp,l.to);if(u!==t)return u}return t}var va,Ea,wa,ya,Na,ba,Sa,Ca={"horizontal-tb":{ltr:[{logical:"inline-start",physical:"left"},{logical:"inline-end",physical:"right"},{logical:"block-start",physical:"top"},{logical:"block-end",physical:"bottom"},{logical:"inline-size",physical:"width"},{logical:"block-size",physical:"height"}],rtl:[{logical:"inline-start",physical:"right"},{logical:"inline-end",physical:"left"},{logical:"block-start",physical:"top"},{logical:"block-end",physical:"bottom"},{logical:"inline-size",physical:"width"},{logical:"block-size",physical:"height"}]},"vertical-rl":{ltr:[{logical:"inline-start",physical:"top"},{logical:"inline-end",physical:"bottom"},{logical:"block-start",physical:"right"},{logical:"block-end",physical:"left"},{logical:"inline-size",physical:"height"},{logical:"block-size",physical:"width"}],rtl:[{logical:"inline-start",physical:"bottom"},{logical:"inline-end",physical:"top"},{logical:"block-start",physical:"right"},{logical:"block-end",physical:"left"},{logical:"inline-size",physical:"height"},{logical:"block-size",physical:"width"}]},"vertical-lr":{ltr:[{logical:"inline-start",physical:"top"},{logical:"inline-end",physical:"bottom"},{logical:"block-start",physical:"left"},{logical:"block-end",physical:"right"},{logical:"inline-size",physical:"height"},{logical:"block-size",physical:"width"}],rtl:[{logical:"inline-start",physical:"bottom"},{logical:"inline-end",physical:"top"},{logical:"block-start",physical:"left"},{logical:"block-end",physical:"right"},{logical:"inline-size",physical:"height"},{logical:"block-size",physical:"width"}]}},Ta=ga(Ca,!0),xa=ga(Ca,!1);function Ia(t,e,n){var i={display:e.style.display,position:e.style.position,width:e.style.width,maxWidth:e.style.maxWidth,minWidth:e.style.minWidth,height:e.style.height,maxHeight:e.style.maxHeight,minHeight:e.style.minHeight},r=e.parentNode,o=e.ownerDocument.createElement("div");function a(n){return t.getElementComputedStyle(e).getPropertyValue(n)}Z(o,"position",i.position),r.insertBefore(o,e),o.appendChild(e),Z(e,"width","auto"),Z(e,"max-width","none"),Z(e,"min-width","0"),Z(e,"height","auto"),Z(e,"max-height","none"),Z(e,"min-height","0");var s=Q("writing-mode"),l=(s?a(s[0]):null)||a("writing-mode"),u="vertical-rl"===l||"tb-rl"===l||"vertical-lr"===l||"tb-lr"===l,h=u?"height":"width",c=u?"width":"height";function f(){return Z(e,"display","block"),Z(e,"position","static"),a(h)}function d(){Z(e,"display","inline-block"),Z(o,h,"99999999px");var t=a(h);return Z(o,h,""),t}function p(){Z(e,"display","inline-block"),Z(o,h,"0");var t=a(h);return Z(o,h,""),t}function g(){var t=f(),e=p(),n=parseFloat(t);if(n<=parseFloat(e))return e;var i=d();return n<=parseFloat(i)?t:i}function m(){return a(c)}function v(){throw new Error("Getting fill-available block size is not implemented")}var E={};return n.forEach(function(t){var n;switch(t){case va.FILL_AVAILABLE_INLINE_SIZE:n=f();break;case va.MAX_CONTENT_INLINE_SIZE:n=d();break;case va.MIN_CONTENT_INLINE_SIZE:n=p();break;case va.FIT_CONTENT_INLINE_SIZE:n=g();break;case va.FILL_AVAILABLE_BLOCK_SIZE:n=v();break;case va.MAX_CONTENT_BLOCK_SIZE:case va.MIN_CONTENT_BLOCK_SIZE:case va.FIT_CONTENT_BLOCK_SIZE:n=m();break;case va.FILL_AVAILABLE_WIDTH:n=u?v():f();break;case va.FILL_AVAILABLE_HEIGHT:n=u?f():v();break;case va.MAX_CONTENT_WIDTH:n=u?m():d();break;case va.MAX_CONTENT_HEIGHT:n=u?d():m();break;case va.MIN_CONTENT_WIDTH:n=u?m():p();break;case va.MIN_CONTENT_HEIGHT:n=u?p():m();break;case va.FIT_CONTENT_WIDTH:n=u?m():g();break;case va.FIT_CONTENT_HEIGHT:n=u?g():m()}E[t]=parseFloat(n),Z(e,"position",i.position),Z(e,"display",i.display)}),Z(e,"width",i.width),Z(e,"max-width",i.maxWidth),Z(e,"min-width",i.minWidth),Z(e,"height",i.height),Z(e,"max-height",i.maxHeight),Z(e,"min-height",i.minHeight),r.insertBefore(e,o),r.removeChild(o),E}function Pa(t){return t.reduce(function(t,e){return e[0]===r.DELETE?t:t+e[1]},"")}function Ra(t,e,n){var i=0,o=0;return t.some(function(t){for(var a=0;a<t[1].length;a++){switch(t[0]*n){case r.INSERT:i++;break;case r.DELETE:i--,o++;break;case r.EQUAL:o++}if(o>e)return!0}return!1}),Math.max(Math.min(e,o-1)+i,0)}!function(t){t.FILL_AVAILABLE_INLINE_SIZE="fill-available inline size",t.FILL_AVAILABLE_BLOCK_SIZE="fill-available block size",t.FILL_AVAILABLE_WIDTH="fill-available width",t.FILL_AVAILABLE_HEIGHT="fill-available height",t.MAX_CONTENT_INLINE_SIZE="max-content inline size",t.MAX_CONTENT_BLOCK_SIZE="max-content block size",t.MAX_CONTENT_WIDTH="max-content width",t.MAX_CONTENT_HEIGHT="max-content height",t.MIN_CONTENT_INLINE_SIZE="min-content inline size",t.MIN_CONTENT_BLOCK_SIZE="min-content block size",t.MIN_CONTENT_WIDTH="min-content width",t.MIN_CONTENT_HEIGHT="min-content height",t.FIT_CONTENT_INLINE_SIZE="fit-content inline size",t.FIT_CONTENT_BLOCK_SIZE="fit-content block size",t.FIT_CONTENT_WIDTH="fit-content width",t.FIT_CONTENT_HEIGHT="fit-content height"}(va||(va={})),function(t){t.isInstanceOfBlockFormattingContext=function(t){return t&&"Block"===t.formattingContextType}}(Ea||(Ea={})),function(t){!function(t){t.INLINE="inline",t.COLUMN="column",t.REGION="region",t.PAGE="page"}(t.FloatReference||(t.FloatReference={}))}(wa||(wa={})),function(t){t.isInstanceOfAfterIfContinuesLayoutConstraint=function(t){return t&&"AfterIfContinue"==t.flagmentLayoutConstraintType}}(ya||(ya={})),function(t){t.isInstanceOfRepetitiveElementsOwnerFormattingContext=function(t){return!!t&&("RepetitiveElementsOwner"===t.formattingContextType||ba.isInstanceOfTableFormattingContext(t))},t.isInstanceOfRepetitiveElementsOwnerLayoutConstraint=function(t){return!!t&&("RepetitiveElementsOwner"===t.flagmentLayoutConstraintType||ba.isInstanceOfTableRowLayoutConstraint(t))}}(Na||(Na={})),function(t){t.isInstanceOfTableFormattingContext=function(t){return t&&"Table"===t.formattingContextType},t.isInstanceOfTableRowLayoutConstraint=function(t){return t&&"TableRow"===t.flagmentLayoutConstraintType}}(ba||(ba={})),function(t){!function(t){t[t.IGNORE=0]="IGNORE",t[t.NEWLINE=1]="NEWLINE",t[t.PRESERVE=2]="PRESERVE"}(t.Whitespace||(t.Whitespace={})),function(t){t[t.NONE=0]="NONE",t[t.CONTENT=1]="CONTENT",t[t.ROOTLESS=2]="ROOTLESS",t[t.ROOTED=3]="ROOTED"}(t.ShadowType||(t.ShadowType={}))}(Sa||(Sa={}));var Aa={transform:!0,"transform-origin":!0},La={top:!0,bottom:!0,left:!0,right:!0},Oa=function(t,e,n){this.target=t,this.name=e,this.value=n},ka={show:function(t){t.style.visibility="visible"},hide:function(t){t.style.visibility="hidden"},play:function(t){t.currentTime=0,t.play()},pause:function(t){t.pause()},resume:function(t){t.play()},mute:function(t){t.muted=!0},unmute:function(t){t.muted=!1}};function Da(t,e){var n=ka[e];return n?function(){for(var e=0;e<t.length;e++)try{n(t[e])}catch(t){}}:null}var Fa=function(t){function e(e,n){var i;return(i=t.call(this)||this).container=e,i.bleedBox=n,i.pageAreaElement=null,i.delayedItems=[],i.elementsById={},i.dimensions={width:0,height:0},i.isFirstPage=!1,i.isLastPage=!1,i.isAutoPageWidth=!0,i.isAutoPageHeight=!0,i.spineIndex=0,i.position=null,i.offset=-1,i.side=null,i.fetchers=[],i.marginBoxes={top:{},bottom:{},left:{},right:{}},i.hrefHandler=function(t){var e=t.currentTarget,n=e.getAttribute("href")||e.getAttributeNS(V.XLINK,"href");n&&i.dispatchEvent({type:"hyperlink",target:null,currentTarget:null,anchorElement:e,href:n,preventDefault:function(){t.preventDefault()}})},i}x(e,t);var n=e.prototype;return n.setAutoPageWidth=function(t){this.isAutoPageWidth=t,t?this.container.setAttribute(e.AUTO_PAGE_WIDTH_ATTRIBUTE,"true"):this.container.removeAttribute(e.AUTO_PAGE_WIDTH_ATTRIBUTE)},n.setAutoPageHeight=function(t){this.isAutoPageHeight=t,t?this.container.setAttribute(e.AUTO_PAGE_HEIGHT_ATTRIBUTE,"true"):this.container.removeAttribute(e.AUTO_PAGE_HEIGHT_ATTRIBUTE)},n.registerElementWithId=function(t,e){var n=this.elementsById[e];n?n.push(t):this.elementsById[e]=[t]},n.finish=function(t,e){var n=this;Object.keys(this.elementsById).forEach(function(t){for(var e=n.elementsById[t],i=0;i<e.length;)n.container.contains(e[i])?i++:e.splice(i,1);0===e.length&&delete n.elementsById[t]});for(var i=this.delayedItems,r=0;r<i.length;r++){var o=i[r];(o.target!==this.container||"transform"!==o.name||this.isAutoPageWidth||this.isAutoPageHeight)&&Z(o.target,o.name,o.value.toString())}var a=e.getElementClientRect(this.container);this.dimensions.width=a.width,this.dimensions.height=a.height;for(var s=0;s<t.length;s++){var l=t[s],u=this.elementsById[l.ref],h=this.elementsById[l.observer];if(u&&h){var c=Da(u,l.action);if(c)for(var f=0;f<h.length;f++)h[f].addEventListener(l.event,c,!1)}}},n.zoom=function(t){Z(this.container,"transform","scale("+t+")")},n.getPageAreaElement=function(){return this.pageAreaElement||this.container},e}(ft);Fa.AUTO_PAGE_WIDTH_ATTRIBUTE="data-vivliostyle-auto-page-width",Fa.AUTO_PAGE_HEIGHT_ATTRIBUTE="data-vivliostyle-auto-page-height";var _a=Sa.Whitespace;function Ba(t){switch(t){case"normal":case"nowrap":return _a.IGNORE;case"pre-line":return _a.NEWLINE;case"pre":case"pre-wrap":return _a.PRESERVE;default:return null}}function Ma(t,e){if(1==t.nodeType)return!1;var n=t.textContent;switch(e){case _a.IGNORE:return!!n.match(/^\s*$/);case _a.NEWLINE:return!!n.match(/^[ \t\f]*$/);case _a.PRESERVE:return 0==n.length}throw new Error("Unexpected whitespace: "+e)}var Ua=function(t,e){this.flowName=t,this.parentFlowName=e,this.forcedBreakOffsets=[],this.formattingContext=null},Va=function(){function t(t,e,n,i,r,o,a,s,l){this.flowName=t,this.element=e,this.startOffset=n,this.priority=i,this.linger=r,this.exclusive=o,this.repeated=a,this.last=s,this.breakBefore=l,this.startPage=-1}return t.prototype.isBetter=function(t){return!!this.exclusive&&(!t.exclusive||this.priority>t.priority||this.last)},t}();function Ha(t,e){return t.top-e.top}function za(t,e){return e.right-t.right}function Ga(t,e){return t===e||!(!t||!e)&&t.node===e.node&&t.shadowType===e.shadowType&&qa(t.shadowContext,e.shadowContext)&&qa(t.nodeShadow,e.nodeShadow)&&Ga(t.shadowSibling,e.shadowSibling)}function Wa(t,e){if(t===e)return!0;if(!t||!e)return!1;if(t.offsetInNode!==e.offsetInNode||t.after!==e.after||t.steps.length!==e.steps.length)return!1;for(var n=0;n<t.steps.length;n++)if(!Ga(t.steps[n],e.steps[n]))return!1;return!0}function Xa(t,e){return{steps:[{node:t.sourceNode,shadowType:Ya.NONE,shadowContext:t.shadowContext,nodeShadow:null,shadowSibling:null,formattingContext:null,fragmentIndex:null!=e?e:t.fragmentIndex}],offsetInNode:0,after:!1,preprocessedTextContent:t.preprocessedTextContent}}function ja(t,e){var n=new Za(t.node,e,0);return n.shadowType=t.shadowType,n.shadowContext=t.shadowContext,n.nodeShadow=t.nodeShadow,n.shadowSibling=t.shadowSibling?ja(t.shadowSibling,e.copy()):null,n.formattingContext=t.formattingContext,n.fragmentIndex=t.fragmentIndex+1,n}var Ya=Sa.ShadowType,Ka=function(){function t(t,e,n,i,r,o,a){this.owner=t,this.root=e,this.xmldoc=n,this.parentShadow=i,this.type=o,this.styler=a,this.subShadow=null,r&&(r.subShadow=this)}return t.prototype.equals=function(t){return!!t&&this.owner===t.owner&&this.xmldoc===t.xmldoc&&this.type===t.type&&qa(this.parentShadow,t.parentShadow)},t}();function qa(t,e){return t===e||!!t&&!!e&&t.equals(e)}var Qa=function(t,e){this.outer=t,this.count=e},Za=function(){function t(t,e,n){this.sourceNode=t,this.parent=e,this.boxOffset=n,this.offsetInNode=0,this.after=!1,this.nodeShadow=null,this.shadowSibling=null,this.shared=!1,this.inline=!0,this.overflow=!1,this.display=null,this.floatSide=null,this.clearSide=null,this.floatMinWrapBlock=null,this.columnSpan=null,this.verticalAlign="baseline",this.captionSide="top",this.inlineBorderSpacing=0,this.blockBorderSpacing=0,this.flexContainer=!1,this.establishesBFC=!1,this.containingBlockForAbsolute=!1,this.breakBefore=null,this.breakAfter=null,this.viewNode=null,this.clearSpacer=null,this.lang=null,this.preprocessedTextContent=null,this.repeatOnBreak=null,this.pluginProps={},this.fragmentIndex=1,this.afterIfContinues=null,this.footnotePolicy=null,this.shadowType=Ya.NONE,this.shadowContext=e?e.shadowContext:null,this.breakPenalty=e?e.breakPenalty:0,this.floatReference=wa.FloatReference.INLINE,this.whitespace=e?e.whitespace:_a.IGNORE,this.hyphenateCharacter=e?e.hyphenateCharacter:null,this.breakWord=!!e&&e.breakWord,this.inheritedProps=e?e.inheritedProps:{},this.vertical=!!e&&e.vertical,this.direction=e?e.direction:"ltr",this.firstPseudo=e?e.firstPseudo:null,this.formattingContext=e?e.formattingContext:null}var e=t.prototype;return e.resetView=function(){this.inline=!0,this.breakPenalty=this.parent?this.parent.breakPenalty:0,this.viewNode=null,this.clearSpacer=null,this.offsetInNode=0,this.after=!1,this.display=null,this.floatReference=wa.FloatReference.INLINE,this.floatSide=null,this.clearSide=null,this.floatMinWrapBlock=null,this.columnSpan=null,this.verticalAlign="baseline",this.flexContainer=!1,this.whitespace=this.parent?this.parent.whitespace:_a.IGNORE,this.hyphenateCharacter=this.parent?this.parent.hyphenateCharacter:null,this.breakWord=!!this.parent&&this.parent.breakWord,this.breakBefore=null,this.breakAfter=null,this.nodeShadow=null,this.establishesBFC=!1,this.containingBlockForAbsolute=!1,this.vertical=!!this.parent&&this.parent.vertical,this.nodeShadow=null,this.preprocessedTextContent=null,this.formattingContext=this.parent?this.parent.formattingContext:null,this.repeatOnBreak=null,this.pluginProps={},this.fragmentIndex=1,this.afterIfContinues=null,this.footnotePolicy=null},e.cloneItem=function(){var e=new t(this.sourceNode,this.parent,this.boxOffset);return e.offsetInNode=this.offsetInNode,e.after=this.after,e.nodeShadow=this.nodeShadow,e.shadowType=this.shadowType,e.shadowContext=this.shadowContext,e.shadowSibling=this.shadowSibling,e.inline=this.inline,e.breakPenalty=this.breakPenalty,e.display=this.display,e.floatReference=this.floatReference,e.floatSide=this.floatSide,e.clearSide=this.clearSide,e.floatMinWrapBlock=this.floatMinWrapBlock,e.columnSpan=this.columnSpan,e.verticalAlign=this.verticalAlign,e.captionSide=this.captionSide,e.inlineBorderSpacing=this.inlineBorderSpacing,e.blockBorderSpacing=this.blockBorderSpacing,e.establishesBFC=this.establishesBFC,e.containingBlockForAbsolute=this.containingBlockForAbsolute,e.flexContainer=this.flexContainer,e.whitespace=this.whitespace,e.hyphenateCharacter=this.hyphenateCharacter,e.breakWord=this.breakWord,e.breakBefore=this.breakBefore,e.breakAfter=this.breakAfter,e.viewNode=this.viewNode,e.clearSpacer=this.clearSpacer,e.firstPseudo=this.firstPseudo,e.vertical=this.vertical,e.overflow=this.overflow,e.preprocessedTextContent=this.preprocessedTextContent,e.formattingContext=this.formattingContext,e.repeatOnBreak=this.repeatOnBreak,e.pluginProps=Object.create(this.pluginProps),e.fragmentIndex=this.fragmentIndex,e.afterIfContinues=this.afterIfContinues,e.footnotePolicy=this.footnotePolicy,e},e.modify=function(){return this.shared?this.cloneItem():this},e.copy=function(){var t=this;do{if(t.shared)break;t.shared=!0,t=t.parent}while(t);return this},e.clone=function(){for(var t,e=this.cloneItem(),n=e;null!=(t=n.parent);)t=t.cloneItem(),n.parent=t,n=t;return e},e.toNodePositionStep=function(){return{node:this.sourceNode,shadowType:this.shadowType,shadowContext:this.shadowContext,nodeShadow:this.nodeShadow,shadowSibling:this.shadowSibling?this.shadowSibling.toNodePositionStep():null,formattingContext:this.formattingContext,fragmentIndex:this.fragmentIndex}},e.toNodePosition=function(){var t=this,e=[];do{t.firstPseudo&&t.parent&&t.parent.firstPseudo!==t.firstPseudo||e.push(t.toNodePositionStep()),t=t.parent}while(t);return{steps:e,offsetInNode:this.preprocessedTextContent?Ra(this.preprocessedTextContent,this.offsetInNode,-1):this.offsetInNode,after:this.after,preprocessedTextContent:this.preprocessedTextContent}},e.isInsideBFC=function(){for(var t=this.parent;t;){if(t.establishesBFC)return!0;t=t.parent}return!1},e.getContainingBlockForAbsolute=function(){for(var t=this.parent;t;){if(t.containingBlockForAbsolute)return t;t=t.parent}return null},e.walkUpBlocks=function(t){for(var e=this;e;)e.inline||t(e),e=e.parent},e.belongsTo=function(t){return this.formattingContext===t&&!!this.parent&&this.parent.formattingContext===t},t}(),$a=function(){function t(t){this.primary=t,this.floats=null}var e=t.prototype;return e.clone=function(){var e=new t(this.primary);if(this.floats){e.floats=[];for(var n=0;n<this.floats.length;++n)e.floats[n]=this.floats[n]}return e},e.isSamePosition=function(t){if(!t)return!1;if(this===t)return!0;if(!Wa(this.primary,t.primary))return!1;if(this.floats){if(!t.floats||this.floats.length!==t.floats.length)return!1;for(var e=0;e<this.floats.length;e++)if(!Wa(this.floats[e],t.floats[e]))return!1}else if(t.floats)return!1;return!0},t}(),Ja=function(){function t(t,e){this.chunkPosition=t,this.flowChunk=e}var e=t.prototype;return e.clone=function(){return new t(this.chunkPosition.clone(),this.flowChunk)},e.isSamePosition=function(t){return!!t&&(this===t||this.chunkPosition.isSamePosition(t.chunkPosition))},t}(),ts=function(){function t(){this.positions=[],this.startSide="any",this.breakAfter=null}var e=t.prototype;return e.clone=function(){for(var e=new t,n=this.positions,i=e.positions,r=0;r<n.length;r++)i[r]=n[r].clone();return e.startSide=this.startSide,e.breakAfter=this.breakAfter,e},e.isSamePosition=function(t){if(this===t)return!0;if(!t||this.positions.length!==t.positions.length)return!1;for(var e=0;e<this.positions.length;e++)if(!this.positions[e].isSamePosition(t.positions[e]))return!1;return!0},e.hasContent=function(t){return this.positions.length>0&&this.positions[0].flowChunk.startOffset<=t},t}(),es=function(){function t(){this.page=0,this.flows={},this.flowPositions={},this.highestSeenOffset=0}var e=t.prototype;return e.clone=function(){var e=new t;for(var n in e.page=this.page,e.highestSeenNode=this.highestSeenNode,e.highestSeenOffset=this.highestSeenOffset,e.lookupPositionOffset=this.lookupPositionOffset,e.flows=this.flows,this.flowPositions)e.flowPositions[n]=this.flowPositions[n].clone();return e},e.isSamePosition=function(t){if(this===t)return!0;if(!t||this.page!==t.page||this.highestSeenOffset!==t.highestSeenOffset)return!1;var e=Object.keys(this.flowPositions),n=Object.keys(t.flowPositions);if(e.length!==n.length)return!1;for(var i=0,r=e;i<r.length;i++){var o=r[i];if(!this.flowPositions[o].isSamePosition(t.flowPositions[o]))return!1}return!0},e.hasContent=function(t,e){var n=this.flowPositions[t];return!!n&&n.hasContent(e)},e.startSideOfFlow=function(t){var e=this.flowPositions[t];return e?e.startSide:"any"},e.firstFlowChunkOfFlow=function(t){var e=this.flowPositions[t];if(!e)return null;var n=e.positions[0];return n?n.flowChunk:null},t}(),ns=function(){function t(t){this.element=t,this.left=0,this.top=0,this.marginLeft=0,this.marginRight=0,this.marginTop=0,this.marginBottom=0,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.paddingLeft=0,this.paddingRight=0,this.paddingTop=0,this.paddingBottom=0,this.width=0,this.height=0,this.originX=0,this.originY=0,this.exclusions=null,this.innerShape=null,this.computedBlockSize=0,this.snapWidth=0,this.snapHeight=0,this.snapOffsetX=0,this.snapOffsetY=0,this.vertical=!1}var e=t.prototype;return e.getInsetTop=function(){return this.marginTop+this.borderTop+this.paddingTop},e.getInsetBottom=function(){return this.marginBottom+this.borderBottom+this.paddingBottom},e.getInsetLeft=function(){return this.marginLeft+this.borderLeft+this.paddingLeft},e.getInsetRight=function(){return this.marginRight+this.borderRight+this.paddingRight},e.getInsetBefore=function(){return this.vertical?this.getInsetRight():this.getInsetTop()},e.getInsetAfter=function(){return this.vertical?this.getInsetLeft():this.getInsetBottom()},e.getInsetStart=function(){return this.vertical?this.getInsetTop():this.getInsetLeft()},e.getInsetEnd=function(){return this.vertical?this.getInsetBottom():this.getInsetRight()},e.getBeforeEdge=function(t){return this.vertical?t.right:t.top},e.getAfterEdge=function(t){return this.vertical?t.left:t.bottom},e.getStartEdge=function(t){return this.vertical?t.top:t.left},e.getEndEdge=function(t){return this.vertical?t.bottom:t.right},e.getInlineSize=function(t){return this.vertical?t.bottom-t.top:t.right-t.left},e.getBoxSize=function(t){return this.vertical?t.right-t.left:t.bottom-t.top},e.getBoxDir=function(){return this.vertical?-1:1},e.getInlineDir=function(){return 1},e.copyFrom=function(t){this.element=t.element,this.left=t.left,this.top=t.top,this.marginLeft=t.marginLeft,this.marginRight=t.marginRight,this.marginTop=t.marginTop,this.marginBottom=t.marginBottom,this.borderLeft=t.borderLeft,this.borderRight=t.borderRight,this.borderTop=t.borderTop,this.borderBottom=t.borderBottom,this.paddingLeft=t.paddingLeft,this.paddingRight=t.paddingRight,this.paddingTop=t.paddingTop,this.paddingBottom=t.paddingBottom,this.width=t.width,this.height=t.height,this.originX=t.originX,this.originY=t.originY,this.innerShape=t.innerShape,this.exclusions=t.exclusions,this.computedBlockSize=t.computedBlockSize,this.snapWidth=t.snapWidth,this.snapHeight=t.snapHeight,this.vertical=t.vertical},e.setVerticalPosition=function(t,e){this.top=t,this.height=e,Z(this.element,"top",t+"px"),Z(this.element,"height",e+"px")},e.setHorizontalPosition=function(t,e){this.left=t,this.width=e,Z(this.element,"left",t+"px"),Z(this.element,"width",e+"px")},e.setBlockPosition=function(t,e){this.vertical?this.setHorizontalPosition(t+e*this.getBoxDir(),e):this.setVerticalPosition(t,e)},e.setInlinePosition=function(t,e){this.vertical?this.setVerticalPosition(t,e):this.setHorizontalPosition(t,e)},e.clear=function(){for(var t,e=this.element;t=e.lastChild;)e.removeChild(t)},e.getInnerShape=function(){var t=this.getInnerRect();return this.innerShape?this.innerShape.withOffset(t.x1,t.y1):ln(t.x1,t.y1,t.x2,t.y2)},e.getInnerRect=function(){var t=this.originX+this.left+this.getInsetLeft(),e=this.originY+this.top+this.getInsetTop();return new Je(t,e,t+this.width,e+this.height)},e.getPaddingRect=function(){var t=this.originX+this.left+this.marginLeft+this.borderLeft,e=this.originY+this.top+this.marginTop+this.borderTop;return new Je(t,e,t+(this.paddingLeft+this.width+this.paddingRight),e+(this.paddingTop+this.height+this.paddingBottom))},e.getOuterShape=function(t,e){var n=this.getOuterRect();return Tn(t,n.x1,n.y1,n.x2-n.x1,n.y2-n.y1,e)},e.getOuterRect=function(){var t=this.originX+this.left,e=this.originY+this.top,n=this.getInsetLeft()+this.width+this.getInsetRight(),i=this.getInsetTop()+this.height+this.getInsetBottom();return new Je(t,e,t+n,e+i)},t}(),is=function(t){function e(e,n,i,r){var o;return(o=t.call(this)||this).elem=e,o.context=n,o.rootContentValue=i,o.exprContentListener=r,o}x(e,t);var n=e.prototype;return n.visitStrInner=function(t,e){e||(e=this.elem.ownerDocument.createTextNode(t)),this.elem.appendChild(e)},n.visitStr=function(t){return this.visitStrInner(t.str),null},n.visitURL=function(t){if(this.rootContentValue.url)this.elem.setAttribute("src",t.url);else{var e=this.elem.ownerDocument.createElementNS(V.XHTML,"img");e.setAttribute("src",t.url),this.elem.appendChild(e)}return null},n.visitSpaceList=function(t){return this.visitValues(t.values),null},n.visitExpr=function(t){var e=t.toExpr(),n=e.evaluate(this.context);if("string"==typeof n){e instanceof fe&&(n=Er(e.scope,new vi(n,null),"").stringValue());var i=this.exprContentListener(e,n,this.elem.ownerDocument);this.visitStrInner(n,i)}return null},e}(Te);function rs(t){return null!=t&&t!==je.normal&&t!==je.none&&t!==je.inherit}var os=wa.FloatReference;function as(t){switch(t){case os.INLINE:return!1;case os.COLUMN:case os.REGION:case os.PAGE:return!0;default:throw new Error("Unknown float-reference: "+t)}}var ss=function(){function t(t,e,n,i,r,o){this.nodePosition=t,this.floatReference=e,this.floatSide=n,this.clearSide=i,this.flowName=r,this.floatMinWrapBlock=o,this.order=null,this.id=null}var e=t.prototype;return e.getOrder=function(){if(null===this.order)throw new Error("The page float is not yet added");return this.order},e.getId=function(){if(!this.id)throw new Error("The page float is not yet added");return this.id},e.isAllowedOnContext=function(t){return t.isAnchorAlreadyAppeared(this.getId())},e.isAllowedToPrecede=function(t){return!1},t}(),ls=function(){function t(){this.floats=[],this.nextPageFloatIndex=0}var e=t.prototype;return e.nextOrder=function(){return this.nextPageFloatIndex++},e.createPageFloatId=function(t){return"pf"+t},e.addPageFloat=function(t){if(this.floats.findIndex(function(e){return Wa(e.nodePosition,t.nodePosition)})>=0)throw new Error("A page float with the same source node is already registered");var e=t.order=this.nextOrder();t.id=this.createPageFloatId(e),this.floats.push(t)},e.findPageFloatByNodePosition=function(t){var e=this.floats.findIndex(function(e){return Wa(e.nodePosition,t)});return e>=0?this.floats[e]:null},e.findPageFloatById=function(t){var e=this.floats.findIndex(function(e){return e.id===t});return e>=0?this.floats[e]:null},t}(),us=function(){function t(t,e,n,i,r){this.floatReference=t,this.floatSide=e,this.continuations=n,this.area=i,this.continues=r}var e=t.prototype;return e.hasFloat=function(t){return this.continuations.some(function(e){return e.float===t})},e.findNotAllowedFloat=function(t){for(var e=this.continuations.length-1;e>=0;e--){var n=this.continuations[e].float;if(!n.isAllowedOnContext(t))return n}return null},e.getOuterShape=function(){return this.area.getOuterShape(null,null)},e.getOuterRect=function(){return this.area.getOuterRect()},e.getOrder=function(){var t=this.continuations.map(function(t){return t.float});return Math.min.apply(null,t.map(function(t){return t.getOrder()}))},e.shouldBeStashedBefore=function(t){return this.getOrder()<t.getOrder()},e.addContinuations=function(t){var e=this;t.forEach(function(t){e.continuations.push(t)})},e.getFlowName=function(){var t=this.continuations[0].float.flowName;return this.continuations.every(function(e){return e.float.flowName===t}),t},t}(),hs=function(){function t(t,e){this.float=t,this.nodePosition=e}return t.prototype.equals=function(t){return!!t&&(this===t||this.float===t.float&&Wa(this.nodePosition,t.nodePosition))},t}(),cs=function(){function t(t,e,n,i,r,o,a){this.parent=t,this.floatReference=e,this.container=n,this.flowName=i,this.generatingNodePosition=r,this.children=[],this.invalidated=!1,this.forbiddenFloats=[],this.floatFragments=[],this.stashedFloatFragments=[],this.floatAnchors={},this.floatsDeferredToNext=[],this.layoutConstraints=[],this.locked=!1,t&&t.children.push(this),this.writingMode=o||t&&t.writingMode||je.horizontal_tb,this.direction=a||t&&t.direction||je.ltr,this.floatStore=t?t.floatStore:new ls;var s=this.getPreviousSibling();this.floatsDeferredFromPrevious=s?[].concat(s.floatsDeferredToNext):[]}var e=t.prototype;return e.getParent=function(t){if(!this.parent)throw new Error("No PageFloatLayoutContext for "+t);return this.parent},e.getPreviousSiblingOf=function(t,e,n,i){var r=this.children.indexOf(t);r<0&&(r=this.children.length);for(var o=r-1;o>=0;o--){var a=this.children[o];if(a.floatReference===e&&a.flowName===n&&Wa(a.generatingNodePosition,i))return a;if(a=a.getPreviousSiblingOf(null,e,n,i))return a}return null},e.getPreviousSibling=function(){for(var t,e=this,n=this.parent;n;){if(t=n.getPreviousSiblingOf(e,this.floatReference,this.flowName,this.generatingNodePosition))return t;e=n,n=n.parent}return null},e.getContainer=function(t){return t&&t!==this.floatReference?this.getParent(t).getContainer(t):this.container},e.setContainer=function(t){this.container=t,this.reattachFloatFragments()},e.addPageFloat=function(t){this.floatStore.addPageFloat(t)},e.getPageFloatLayoutContext=function(t){return t===this.floatReference?this:this.getParent(t).getPageFloatLayoutContext(t)},e.findPageFloatByNodePosition=function(t){return this.floatStore.findPageFloatByNodePosition(t)},e.forbid=function(t){var e=t.getId(),n=t.floatReference;n===this.floatReference?this.forbiddenFloats.includes(e)||(this.forbiddenFloats.push(e),(new ds).findByFloat(t).forbid(t,this)):this.getParent(n).forbid(t)},e.isForbidden=function(t){var e=t.getId(),n=t.floatReference;return n===this.floatReference?this.forbiddenFloats.includes(e):this.getParent(n).isForbidden(t)},e.addPageFloatFragment=function(t,e){var n=t.floatReference;n!==this.floatReference?this.getParent(n).addPageFloatFragment(t,e):this.floatFragments.includes(t)||(this.floatFragments.push(t),this.floatFragments.sort(function(t,e){return t.getOrder()-e.getOrder()})),e||this.invalidate()},e.removePageFloatFragment=function(t,e){var n=t.floatReference;if(n!==this.floatReference)this.getParent(n).removePageFloatFragment(t,e);else{var i=this.floatFragments.indexOf(t);if(i>=0){var r=this.floatFragments.splice(i,1)[0],o=r.area&&r.area.element;o&&o.parentNode&&o.parentNode.removeChild(o),e||this.invalidate()}}},e.findPageFloatFragment=function(t){if(t.floatReference!==this.floatReference)return this.getParent(t.floatReference).findPageFloatFragment(t);var e=this.floatFragments.findIndex(function(e){return e.hasFloat(t)});return e>=0?this.floatFragments[e]:null},e.hasFloatFragments=function(t){return!(!(this.floatFragments.length>0)||t&&!this.floatFragments.some(t))||!!this.parent&&this.parent.hasFloatFragments(t)},e.hasContinuingFloatFragmentsInFlow=function(t){return this.hasFloatFragments(function(e){return e.continues&&e.getFlowName()===t})},e.registerPageFloatAnchor=function(t,e){this.floatAnchors[t.getId()]=e},e.collectPageFloatAnchors=function(){var t=Object.assign({},this.floatAnchors);return this.children.reduce(function(t,e){return Object.assign(t,e.collectPageFloatAnchors())},t)},e.isAnchorAlreadyAppeared=function(t){if(this.getDeferredPageFloatContinuations().some(function(e){return e.float.getId()===t}))return!0;var e=this.collectPageFloatAnchors()[t];return!!e&&!(!this.container||!this.container.element)&&this.container.element.contains(e)},e.deferPageFloat=function(t){var e=t.float;if(e.floatReference===this.floatReference){var n=this.floatsDeferredToNext.findIndex(function(t){return t.float===e});n>=0?this.floatsDeferredToNext.splice(n,1,t):this.floatsDeferredToNext.push(t)}else this.getParent(e.floatReference).deferPageFloat(t)},e.hasPrecedingFloatsDeferredToNext=function(t,e){if(!e&&t.floatReference!==this.floatReference)return this.getParent(t.floatReference).hasPrecedingFloatsDeferredToNext(t,!1);var n=t.getOrder();return!!this.floatsDeferredToNext.some(function(e){return e.float.getOrder()<n&&!t.isAllowedToPrecede(e.float)})||!!this.parent&&this.parent.hasPrecedingFloatsDeferredToNext(t,!0)},e.getLastFollowingFloatInFragments=function(t){var e=t.getOrder(),n=null;if(this.floatFragments.forEach(function(t){t.continuations.forEach(function(t){var i=t.float,r=i.getOrder();r>e&&(!n||r>n.getOrder())&&(n=i)})}),this.parent){var i=this.parent.getLastFollowingFloatInFragments(t);i&&(!n||i.getOrder()>n.getOrder())&&(n=i)}return n},e.getDeferredPageFloatContinuations=function(t){t=t||this.flowName;var e=this.floatsDeferredFromPrevious.filter(function(e){return!t||e.float.flowName===t});return this.parent&&(e=this.parent.getDeferredPageFloatContinuations(t).concat(e)),e.sort(function(t,e){return t.float.getOrder()-e.float.getOrder()})},e.getPageFloatContinuationsDeferredToNext=function(t){t=t||this.flowName;var e=this.floatsDeferredToNext.filter(function(e){return!t||e.float.flowName===t});return this.parent?this.parent.getPageFloatContinuationsDeferredToNext(t).concat(e):e},e.getFloatsDeferredToNextInChildContexts=function(){for(var t=[],e=[],n=this.children.length-1;n>=0;n--){var i=this.children[n];e.includes(i.flowName)||(e.push(i.flowName),t=(t=t.concat(i.floatsDeferredToNext.map(function(t){return t.float}))).concat(i.getFloatsDeferredToNextInChildContexts()))}return t},e.checkAndForbidNotAllowedFloat=function(){if(this.checkAndForbidFloatFollowingDeferredFloat())return!0;for(var t=this.floatFragments.length-1;t>=0;t--){var e=this.floatFragments[t],n=e.findNotAllowedFloat(this);if(n)return this.locked?this.invalidate():(this.removePageFloatFragment(e),this.forbid(n),this.removeEndFloatFragments(e.floatSide)),!0}return!(this.floatReference!==os.REGION||!this.parent.locked)&&this.parent.checkAndForbidNotAllowedFloat()},e.checkAndForbidFloatFollowingDeferredFloat=function(){var t=this,e=this.getFloatsDeferredToNextInChildContexts(),n=this.floatFragments.reduce(function(t,e){return t.concat(e.continuations.map(function(t){return t.float}))},[]);n.sort(function(t,e){return e.getOrder()-t.getOrder()});for(var i,r=function(){var n=i.value,r=n.getOrder();if(e.some(function(t){return!n.isAllowedToPrecede(t)&&r>t.getOrder()})){if(t.locked)t.invalidate();else{t.forbid(n);var o=t.findPageFloatFragment(n);t.removePageFloatFragment(o)}return{v:!0}}},o=D(n);!(i=o()).done;){var a=r();if("object"==typeof a)return a.v}return!1},e.finish=function(){var t=this;if(!this.checkAndForbidNotAllowedFloat()){for(var e=this.floatsDeferredToNext.length-1;e>=0;e--)if(!this.floatsDeferredToNext[e].float.isAllowedOnContext(this)){if(this.locked)return void this.invalidate();this.floatsDeferredToNext.splice(e,1)}this.floatsDeferredFromPrevious.forEach(function(e){t.floatsDeferredToNext.findIndex(function(t){return e.equals(t)})>=0||t.floatFragments.some(function(t){return t.hasFloat(e.float)})||t.floatsDeferredToNext.push(e)})}},e.hasSameContainerAs=function(t){return!!this.container&&!!t.container&&this.container.element===t.container.element},e.invalidate=function(){var t=this;this.invalidated=!0,this.locked||(this.container&&(this.children.forEach(function(e){t.hasSameContainerAs(e)&&e.floatFragments.forEach(function(t){var e=t.area.element;e&&e.parentNode&&e.parentNode.removeChild(e)})}),this.container.clear()),this.children.forEach(function(t){t.layoutConstraints.splice(0)}),this.children.splice(0),Object.keys(this.floatAnchors).forEach(function(e){delete t.floatAnchors[e]}))},e.detachChildren=function(){var t=this.children.splice(0);return t.forEach(function(t){t.floatFragments.forEach(function(t){var e=t.area.element;e&&e.parentNode&&e.parentNode.removeChild(e)})}),t},e.attachChildren=function(t){var e=this;t.forEach(function(t){e.children.push(t),t.reattachFloatFragments()})},e.isInvalidated=function(){return this.invalidated||!!this.parent&&this.parent.isInvalidated()},e.validate=function(){this.invalidated=!1},e.toLogical=function(t){return ma(t,this.writingMode.toString(),this.direction.toString()||null,xa)},e.toPhysical=function(t){return ma(t,this.writingMode.toString(),this.direction.toString()||null,Ta)},e.removeEndFloatFragments=function(t){var e=this.toLogical(t);if("block-end"===e||"inline-end"===e)for(var n=0;n<this.floatFragments.length;){var i=this.floatFragments[n];this.toLogical(i.floatSide)===e?this.removePageFloatFragment(i):n++}},e.stashEndFloatFragments=function(t){var e=t.floatReference;if(e===this.floatReference){var n=this.toLogical(t.floatSide);if("block-end"===n||"snap-block"===n||"inline-end"===n)for(var i=0;i<this.floatFragments.length;){var r=this.floatFragments[i],o=this.toLogical(r.floatSide);(o===n||"snap-block"===n&&"block-end"===o)&&r.shouldBeStashedBefore(t)?(this.stashedFloatFragments.push(r),this.floatFragments.splice(i,1)):i++}}else this.getParent(e).stashEndFloatFragments(t)},e.restoreStashedFragments=function(t){var e=this;t===this.floatReference?(this.stashedFloatFragments.forEach(function(t){e.addPageFloatFragment(t,!0)}),this.stashedFloatFragments.splice(0)):this.getParent(t).restoreStashedFragments(t)},e.discardStashedFragments=function(t){t===this.floatReference?this.stashedFloatFragments.splice(0):this.getParent(t).discardStashedFragments(t)},e.getStashedFloatFragments=function(t){return t===this.floatReference?this.stashedFloatFragments.concat().sort(function(t,e){return e.getOrder()-t.getOrder()}):this.getParent(t).getStashedFloatFragments(t)},e.getLimitValue=function(t,e,n,i){var r=this.toLogical(t),o=this.toPhysical(t),a=this.getLimitValueInner(r,e,n,i);if(this.parent&&this.parent.container){var s=this.parent.getLimitValue(o,e,n,i);switch(o){case"top":case"left":return Math.max(a,s);case"bottom":case"right":return Math.min(a,s)}}return a},e.getLimitValueInner=function(t,e,n,i){var r=this.getLimitValuesInner(e,n,i);switch(t){case"block-start":return this.container.vertical?r.right:r.top;case"block-end":return this.container.vertical?r.left:r.bottom;case"inline-start":return this.container.vertical?r.top:r.left;case"inline-end":return this.container.vertical?r.bottom:r.right;default:throw new Error("Unknown logical side: "+t)}},e.getLimitValuesInner=function(t,e,n){var i=this,r=this.container.originX,o=this.container.originY,a=this.container.getPaddingRect(),s={top:a.y1-o,left:a.x1-r,bottom:a.y2-o,right:a.x2-r,floatMinWrapBlockStart:0,floatMinWrapBlockEnd:0};function l(n,i,r){return"%"===n.unit?r*n.num/100:t.convertLengthToPx(n,i,e)}var u=this.floatFragments;return u.length>0&&(s=u.reduce(function(t,e){if(n&&!n(e,i))return t;var r=i.toLogical(e.floatSide),o=e.area,s=e.continuations[0].float.floatMinWrapBlock,u=t.top,h=t.left,c=t.bottom,f=t.right,d=t.floatMinWrapBlockStart,p=t.floatMinWrapBlockEnd;switch(r){case"inline-start":o.vertical?u=Math.max(u,o.top+o.height):h=Math.max(h,o.left+o.width);break;case"block-start":o.vertical?(s&&o.left<f&&(d=l(s,o.rootViewNodes[0],a.x2-a.x1)),f=Math.min(f,o.left)):(s&&o.top+o.height>u&&(d=l(s,o.rootViewNodes[0],a.y2-a.y1)),u=Math.max(u,o.top+o.height));break;case"inline-end":o.vertical?c=Math.min(c,o.top):f=Math.min(f,o.left);break;case"block-end":o.vertical?(s&&o.left+o.width>h&&(p=l(s,o.rootViewNodes[0],a.x2-a.x1)),h=Math.max(h,o.left+o.width)):(s&&o.top<c&&(p=l(s,o.rootViewNodes[0],a.y2-a.y1)),c=Math.min(c,o.top));break;default:throw new Error("Unknown logical float side: "+r)}return{top:u,left:h,bottom:c,right:f,floatMinWrapBlockStart:d,floatMinWrapBlockEnd:p}},s)),s.left+=r,s.right+=r,s.top+=o,s.bottom+=o,s},e.setFloatAreaDimensions=function(t,e,n,i,r,o,a){if(e!==this.floatReference)return this.getParent(e).setFloatAreaDimensions(t,e,n,i,r,o,a);var s=this.toLogical(n);if("snap-block"===s){if(!a["block-start"]&&!a["block-end"])return null}else if(!a[s])return null;var l,u,h,c,f=this.getLimitValue("block-start",t.layoutContext,t.clientLayout),d=this.getLimitValue("block-end",t.layoutContext,t.clientLayout),p=this.getLimitValue("inline-start",t.layoutContext,t.clientLayout),g=this.getLimitValue("inline-end",t.layoutContext,t.clientLayout),m=t.vertical?t.originX:t.originY,v=t.vertical?t.originY:t.originX;function E(e,n){var i=e(t.bands,n);return i?(t.vertical&&(i=gn(i)),f=t.vertical?Math.min(f,i.x2):Math.max(f,i.y1),d=t.vertical?Math.max(d,i.x1):Math.min(d,i.y2),!0):o}if(f=t.vertical?Math.min(f,t.left+t.getInsetLeft()+t.width+t.getInsetRight()+m):Math.max(f,t.top+m),d=t.vertical?Math.max(d,t.left+m):Math.min(d,t.top+t.getInsetTop()+t.height+t.getInsetBottom()+m),r){var w=t.vertical?pn(new Je(d,p,f,g)):new Je(p,f,g,d);if(("block-start"===s||"snap-block"===s||"inline-start"===s)&&!E(wn,w))return null;if(("block-end"===s||"snap-block"===s||"inline-end"===s)&&!E(yn,w))return null;if(l=(h=(d-f)*t.getBoxDir())-t.getInsetBefore()-t.getInsetAfter(),u=(c=g-p)-t.getInsetStart()-t.getInsetEnd(),!o&&(l<=0||u<=0))return null}else{h=(l=t.computedBlockSize)+t.getInsetBefore()+t.getInsetAfter();var y=(d-f)*t.getBoxDir();if("snap-block"===s){if(null===i)s="block-start";else{var N=this.container.getPaddingRect();s=this.container.getBoxDir()*(i-(this.container.vertical?N.x2:N.y1))<=this.container.getBoxDir()*((this.container.vertical?N.x1:N.y2)-i-h)?"block-start":"block-end"}if(!a[s]){if(!a["block-end"])return null;s="block-end"}}if(!o&&y<h)return null;if(c=(u="inline-start"===s||"inline-end"===s?Ia(t.clientLayout,t.element,[va.FIT_CONTENT_INLINE_SIZE])[va.FIT_CONTENT_INLINE_SIZE]:t.adjustContentRelativeSize?t.getContentInlineSize():t.vertical?t.height:t.width)+t.getInsetStart()+t.getInsetEnd(),!o&&g-p<c)return null}switch(f-=m,d-=m,p-=v,g-=v,s){case"inline-start":case"block-start":case"snap-block":t.setInlinePosition(p,u),t.setBlockPosition(f,l);break;case"inline-end":case"block-end":t.setInlinePosition(g-c,u),t.setBlockPosition(d-h*t.getBoxDir(),l);break;default:throw new Error("unknown float direction: "+n)}return s},e.getFloatFragmentExclusions=function(){var t=this.floatFragments.map(function(t){return t.getOuterShape()});return this.parent?this.parent.getFloatFragmentExclusions().concat(t):t},e.reattachFloatFragments=function(){var t=this.container.element&&this.container.element.parentNode;t&&this.floatFragments.forEach(function(e){t.appendChild(e.area.element)})},e.getMaxReachedAfterEdge=function(){var t=this.getContainer().vertical;return this.floatFragments.reduce(function(e,n){var i=n.getOuterRect();return t?Math.min(e,i.x1):Math.max(e,i.y2)},t?Infinity:0)},e.getBlockStartEdgeOfBlockEndFloats=function(){var t=this.getContainer().vertical;return this.floatFragments.filter(function(t){return"block-end"===t.floatSide}).reduce(function(e,n){var i=n.getOuterRect();return t?Math.max(e,i.x2):Math.min(e,i.y1)},t?0:Infinity)},e.getPageFloatClearEdge=function(t,e){function n(t){return function(e){return t.isAnchorAlreadyAppeared(e.float.getId())}}function i(t,e){return t.continuations.some(n(e))}for(var r=e.getPaddingRect(),o=e.vertical?r.x1:r.y2,a=this;a;){if(a.floatsDeferredToNext.some(n(a)))return o;a=a.parent}var s=this.getLimitValue("block-start",e.layoutContext,e.clientLayout,i);return this.getLimitValue("block-end",e.layoutContext,e.clientLayout,i)*e.getBoxDir()<o*e.getBoxDir()?o:s},e.getPageFloatPlacementCondition=function(t,e,n){var i=this;if(t.floatReference!==this.floatReference)return this.getParent(t.floatReference).getPageFloatPlacementCondition(t,e,n);var r={"block-start":!0,"block-end":!0,"inline-start":!0,"inline-end":!0};if(!n)return r;var o,a=this.toLogical(e),s=this.toLogical(n);o="all"===s?["block-start","block-end","inline-start","inline-end"]:"both"===s?["inline-start","inline-end"]:"same"===s?"snap-block"===a?["block-start","block-end"]:[a]:[s];var l=t.getOrder();function u(t){return function(e){return e.floatSide===t&&e.getOrder()<l}}return o.forEach(function(t){switch(t){case"block-start":case"inline-start":r[t]=!function t(e,n){return e.children.some(function(e){return e.floatFragments.some(u(n))||t(e,n)})}(i,t);break;case"block-end":case"inline-end":r[t]=!function t(e,n){var i=e.parent;return!!i&&(i.floatFragments.some(u(n))||t(i,n))}(i,t);break;default:throw new Error("Unexpected side: "+t)}}),r},e.getLayoutConstraints=function(){return(this.parent?this.parent.getLayoutConstraints():[]).concat(this.layoutConstraints)},e.addLayoutConstraint=function(t,e){e===this.floatReference?this.layoutConstraints.push(t):this.getParent(e).addLayoutConstraint(t,e)},e.isColumnFullWithPageFloats=function(t){for(var e=t.layoutContext,n=t.clientLayout,i=this,r=null;i&&i.container;){var o=i.getLimitValuesInner(e,n);r?t.vertical?(o.right<r.right&&(r.right=o.right,r.floatMinWrapBlockStart=o.floatMinWrapBlockStart),o.left>r.left&&(r.left=o.left,r.floatMinWrapBlockEnd=o.floatMinWrapBlockEnd)):(o.top>r.top&&(r.top=o.top,r.floatMinWrapBlockStart=o.floatMinWrapBlockStart),o.bottom<r.bottom&&(r.bottom=o.bottom,r.floatMinWrapBlockEnd=o.floatMinWrapBlockEnd)):r=o,i=i.parent}var a=Math.max(r.floatMinWrapBlockStart,r.floatMinWrapBlockEnd);return(t.vertical?r.right-r.left:r.bottom-r.top)<=a},e.getMaxBlockSizeOfPageFloats=function(){var t=this.getContainer().vertical;return this.floatFragments.length?Math.max.apply(null,this.floatFragments.map(function(e){var n=e.area;return t?n.width:n.height})):0},e.lock=function(){this.locked=!0},e.unlock=function(){this.locked=!1},e.isLocked=function(){return this.locked},t}(),fs=[],ds=function(){function t(){}t.register=function(t){fs.push(t)};var e=t.prototype;return e.findByNodeContext=function(t){for(var e=fs.length-1;e>=0;e--){var n=fs[e];if(n.appliesToNodeContext(t))return n}throw new Error("No PageFloatLayoutStrategy found for "+t)},e.findByFloat=function(t){for(var e=fs.length-1;e>=0;e--){var n=fs[e];if(n.appliesToFloat(t))return n}throw new Error("No PageFloatLayoutStrategy found for "+t)},t}();ds.register(new(function(){function t(){}var e=t.prototype;return e.appliesToNodeContext=function(t){return as(t.floatReference)},e.appliesToFloat=function(t){return!0},e.createPageFloat=function(t,e,n){var i=t.floatReference,r=t.floatSide,o=t.toNodePosition();return n.resolveFloatReferenceFromColumnSpan(i,t.columnSpan,t).thenAsync(function(n){var a=new ss(o,i=n,r,t.clearSide,e.flowName,t.floatMinWrapBlock);return e.addPageFloat(a),bi(a)})},e.createPageFloatFragment=function(t,e,n,i){return new us(t[0].float.floatReference,e,t,n,i)},e.findPageFloatFragment=function(t,e){return e.findPageFloatFragment(t)},e.adjustPageFloatArea=function(t,e,n){},e.forbid=function(t,e){},t}()));var ps=us,gs=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this,e,n,"block-end",null,i,o)||this).footnotePolicy=r,a}return x(e,t),e.prototype.isAllowedToPrecede=function(t){return!(t instanceof e)},e}(ss),ms=function(t){function e(e,n,i,r){return t.call(this,e,"block-end",n,i,r)||this}x(e,t);var n=e.prototype;return n.getOrder=function(){return Infinity},n.shouldBeStashedBefore=function(t){return t instanceof gs||this.getOrder()<t.getOrder()},e}(ps),vs=function(){function t(t){this.footnote=t}return t.prototype.allowLayout=function(t){return!Wa(t.toNodePosition(),this.footnote.nodePosition)},t}();ds.register(new(function(){function t(){}var e=t.prototype;return e.appliesToNodeContext=function(t){return"footnote"===t.floatSide},e.appliesToFloat=function(t){return t instanceof gs},e.createPageFloat=function(t,e,n){var i=os.REGION,r=e.getPageFloatLayoutContext(i);e.getPageFloatLayoutContext(os.PAGE).hasSameContainerAs(r)&&(i=os.PAGE);var o=t.toNodePosition(),a=new gs(o,i,e.flowName,t.footnotePolicy,t.floatMinWrapBlock);return e.addPageFloat(a),bi(a)},e.createPageFloatFragment=function(t,e,n,i){return new ms(t[0].float.floatReference,t,n,i)},e.findPageFloatFragment=function(t,e){return e.getPageFloatLayoutContext(t.floatReference).floatFragments.filter(function(t){return t instanceof ms})[0]||null},e.adjustPageFloatArea=function(t,e,n){t.isFootnote=!0,t.adjustContentRelativeSize=!1;var i=t.element;t.vertical=n.layoutContext.applyFootnoteStyle(e.vertical,n.layoutContext.nodeContext&&"rtl"===n.layoutContext.nodeContext.direction,i),t.convertPercentageSizesToPx(i),n.setComputedInsets(i,t),n.setComputedWidthAndHeight(i,t)},e.forbid=function(t,e){var n=t;switch(n.footnotePolicy){case je.line:var i=new vs(n);e.addLayoutConstraint(i,n.floatReference)}},t}()));var Es={page:!0,left:!0,right:!0,recto:!0,verso:!0,column:!0,region:!0};function ws(t){return!!Es[t]}var ys={avoid:!0,"avoid-page":!0,"avoid-column":!0,"avoid-region":!0};function Ns(t){return!!ys[t]}function bs(t,e){if(!t)return e;if(!e)return t;var n=ws(t),i=ws(e);if(!n||!i)return i?e:n?t:Ns(e)?e:Ns(t)?t:e;switch(e){case"column":return t;case"region":return"column"===t?e:t;default:return e}}function Ss(t){switch(t){case"left":case"right":case"recto":case"verso":return t;default:return"any"}}function Cs(t){switch(t){case"left":case"right":case"recto":case"verso":return t;default:return null}}function Ts(t,e,n,i){var r=t.viewNode;if(!r)return NaN;if(1==r.nodeType){if(t.after||!t.inline){var o=e.getElementClientRect(r);if(o.right>=o.left&&o.bottom>=o.top)return t.after?i?o.left:o.bottom:i?o.right:o.top}return NaN}var a=NaN,s=r.ownerDocument.createRange(),l=r.textContent.length;if(!l)return NaN;t.after&&(n+=l),n>=l&&(n=l-1),s.setStart(r,n),s.setEnd(r,n+1);var u=e.getRangeClientRects(s);i&&function(t){if(null==dt){var e=t.ownerDocument,n=e.createElement("div");n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.width="100px",n.style.height="100px",n.style.overflow="hidden",n.style.lineHeight="16px",n.style.fontSize="16px",Z(n,"writing-mode","vertical-rl"),t.appendChild(n);var i=e.createTextNode("a a a a a a a a a a a a a a a a");n.appendChild(i);var r=e.createRange();r.setStart(i,0),r.setEnd(i,1);var o=r.getBoundingClientRect();dt=o.right-o.left<10,t.removeChild(n)}return dt}(document.body)&&(u=function(t,e,n){var i=n.ownerDocument.createRange();i.setStart(n,0),i.setEnd(n,n.textContent.length);for(var r,o=t.getRangeClientRects(i),a=[],s=D(e);!(r=s()).done;){var l=r.value,u=void 0;for(u=0;u<o.length;u++){var c=o[u];if(l.top>=c.top&&l.bottom<=c.bottom&&Math.abs(l.left-c.left)<1){a.push({top:l.top,left:c.left,bottom:l.bottom,right:c.right});break}}u==o.length&&(h.warn("Could not fix character box"),a.push(l))}return a}(e,u,r));for(var c,f=0,d=D(u);!(c=d()).done;){var p=c.value,g=i?p.bottom-p.top:p.right-p.left;p.right>p.left&&p.bottom>p.top&&(isNaN(a)||g>f)&&(a=i?p.left:p.bottom,f=g)}return a}function xs(t,e,n){var i=e.clientLayout.getElementClientRect(t),r=e.getComputedMargin(t);return n?i.width+r.left+r.right:i.height+r.top+r.bottom}function Is(t){for(;t;){if(t.parentNode===t.ownerDocument)return!1;t=t.parentNode}return!0}function Ps(t,e){if(t)for(var n;(n=t.lastChild)!=e;)t.removeChild(n)}function Rs(t){return!!t.getAttribute("data-adapt-spec")}function As(t){if(!t)return!1;var e=t.viewNode;return!(!e||1!==e.nodeType)&&Rs(e)}f("SIMPLE_PROPERTY",function(t){var e=t.name,n=t.value;switch(e){case"page-break-before":case"page-break-after":case"page-break-inside":return{name:e.replace(/^page-/,""),value:n===je.always?je.page:n,important:t.important};default:return t}});var Ls=function(){function t(){}var e=t.prototype;return e.calculateOffset=function(t){return Os(this.getNodeContext(),t.collectElementsOffset())},e.breakPositionChosen=function(t){},e.getNodeContext=function(){return null},t}();function Os(t,e){return{current:e.reduce(function(e,n){return e+n.calculateOffset(t)},0),minimum:e.reduce(function(e,n){return e+n.calculateMinimumOffset(t)},0)}}var ks=function(t){function e(e,n,i,r){var o;return(o=t.call(this)||this).position=e,o.breakOnEdge=n,o.overflows=i,o.computedBlockSize=r,o.isEdgeUpdated=!1,o.edge=0,o.overflowIfRepetitiveElementsDropped=i,o}x(e,t);var n=e.prototype;return n.findAcceptableBreak=function(t,e){return this.updateOverflows(t),e<this.getMinBreakPenalty()?null:t.findEdgeBreakPosition(this)},n.getMinBreakPenalty=function(){if(!this.isEdgeUpdated)throw new Error("EdgeBreakPosition.prototype.updateEdge not called");var t=this.isFirstContentOfRepetitiveElementsOwner()&&!this.overflowIfRepetitiveElementsDropped;return(Ns(this.breakOnEdge)?1:0)+(this.overflows&&!t?3:0)+(this.position.parent?this.position.parent.breakPenalty:0)},n.updateEdge=function(t){var e=t.calculateClonedPaddingBorder(this.position);this.edge=Ts(this.position,t.clientLayout,0,t.vertical)+e,this.isEdgeUpdated=!0},n.updateOverflows=function(t){this.isEdgeUpdated||this.updateEdge(t);var e=this.edge,n=this.calculateOffset(t);this.overflowIfRepetitiveElementsDropped=t.isOverflown(e+(t.vertical?-1:1)*n.minimum),this.overflows=this.position.overflow=t.isOverflown(e+(t.vertical?-1:1)*n.current)},n.getNodeContext=function(){return this.position},n.isFirstContentOfRepetitiveElementsOwner=function(){var t=this.getNodeContext();if(!t||!t.parent)return!1;var e=t.parent.formattingContext;if(!Na.isInstanceOfRepetitiveElementsOwnerFormattingContext(e))return!1;var n=e.getRepetitiveElements();return!!n&&n.isFirstContentNode(t)},e}(Ls);function Ds(t){var e,n=t.toString();switch(n){case"inline-flex":e="flex";break;case"inline-grid":e="grid";break;case"inline-table":e="table";break;case"inline":case"table-row-group":case"table-column":case"table-column-group":case"table-header-group":case"table-footer-group":case"table-row":case"table-cell":case"table-caption":case"inline-block":e="block";break;default:e=n}return ke(e)}function Fs(t){return t===je.absolute||t===je.fixed}function _s(t,e,n,i){return t===je.none||(Fs(e)?(n=je.none,t=Ds(t)):(n&&n!==je.none||i)&&(t=Ds(t))),{display:t,position:e,float:n}}function Bs(t,e,n,i){return _s(t,e,n,i).display===je.block}function Ms(t){switch(t.toString()){case"inline":case"inline-block":case"inline-list-item":case"inline-flex":case"inline-grid":case"ruby":case"inline-table":return!0;default:return!1}}var Us=function(){function t(){}return t.prototype.find=function(t){for(var e=p(exports.HOOKS.RESOLVE_LAYOUT_PROCESSOR),n=0;n<e.length;n++){var i=e[n](t);if(i)return i}throw new Error("No processor found for a formatting context: "+t.getName())},t}(),Vs=function(){function t(){}var e=t.prototype;return e.layout=function(t,e,n){return e.isFloatNodeContext(t)?e.layoutFloatOrFootnote(t):e.isBreakable(t)?e.layoutBreakableBlock(t):e.layoutUnbreakable(t)},e.createEdgeBreakPosition=function(t,e,n,i){return new ks(t.copy(),e,n,i)},e.startNonInlineElementNode=function(t){return!1},e.afterNonInlineElementNode=function(t,e){return!1},e.clearOverflownViewNodes=function(t,e,n,i){if(n.viewNode&&n.viewNode.parentNode){var r=n.viewNode.parentNode;Ps(r,n.viewNode),i&&r.removeChild(n.viewNode)}},e.finishBreak=function(t,e,n,i){var r=n||null!=e.viewNode&&1==e.viewNode.nodeType&&!e.after;return t.clearOverflownViewNodes(e,r),i&&(t.fixJustificationIfNeeded(e,!0),t.layoutContext.processFragmentedBlockEdge(r?e:e.parent)),bi(!0)},t}(),Hs=function(){function t(t){this.parent=t,this.formattingContextType="Block"}var e=t.prototype;return e.getName=function(){return"Block formatting context (BlockFormattingContext)"},e.isFirstTime=function(t,e){return e},e.getParent=function(){return this.parent},e.saveState=function(){},e.restoreState=function(t){},t}(),zs=new Vs,Gs=Ea.isInstanceOfBlockFormattingContext;f(exports.HOOKS.RESOLVE_FORMATTING_CONTEXT,function(t,e,n,i,r,o){var a=t.parent;return!a&&t.formattingContext||a&&t.formattingContext!==a.formattingContext?null:t.establishesBFC||!t.formattingContext&&Bs(n,i,r,o)?new Hs(a?a.formattingContext:null):null}),f(exports.HOOKS.RESOLVE_LAYOUT_PROCESSOR,function(t){return t instanceof Hs?zs:null});var Ws=function(){function t(){this.initialBreakPositions=null,this.initialStateOfFormattingContext=null}var e=t.prototype;return e.layout=function(t,e){return this.prepareLayout(t,e),this.tryLayout(t,e)},e.tryLayout=function(t,e){var n=this,i=Ni("AbstractLayoutRetryer.tryLayout");this.saveState(t,e);var r=this.resolveLayoutMode(t);return r.doLayout(t,e).then(function(o){var a=r.accept(o,e);(a=r.postLayout(o,n.initialPosition,e,a))?i.finish(o):(n.clearNodes(n.initialPosition),n.restoreState(t,e),n.tryLayout(n.initialPosition,e).thenFinish(i))}),i.result()},e.prepareLayout=function(t,e){},e.clearNodes=function(t){for(var e,n,i=t.viewNode||t.parent.viewNode;e=i.lastChild;)i.removeChild(e);for(;n=i.nextSibling;)n.parentNode.removeChild(n)},e.saveState=function(t,e){this.initialPosition=t.copy(),this.initialBreakPositions=[].concat(e.breakPositions),this.initialFragmentLayoutConstraints=[].concat(e.fragmentLayoutConstraints),t.formattingContext&&(this.initialStateOfFormattingContext=t.formattingContext.saveState())},e.restoreState=function(t,e){e.breakPositions=this.initialBreakPositions,e.fragmentLayoutConstraints=this.initialFragmentLayoutConstraints,t.formattingContext&&t.formattingContext.restoreState(this.initialStateOfFormattingContext)},t}(),Xs=function(){function t(){}var e=t.prototype;return e.initialState=function(t){return{nodeContext:t,atUnforcedBreak:!1,break:!1}},e.startNonDisplayableNode=function(t){},e.afterNonDisplayableNode=function(t){},e.startIgnoredTextNode=function(t){},e.afterIgnoredTextNode=function(t){},e.startNonElementNode=function(t){},e.afterNonElementNode=function(t){},e.startInlineElementNode=function(t){},e.afterInlineElementNode=function(t){},e.startNonInlineElementNode=function(t){},e.afterNonInlineElementNode=function(t){},e.finish=function(t){},t}(),js=function(){function t(t,e){this.strategy=t,this.layoutContext=e}return t.prototype.iterate=function(t){var e=this,n=this.strategy,i=n.initialState(t),r=Ni("LayoutIterator");return r.loopWithFrame(function(t){for(var r;i.nodeContext;){var o=((r=i.nodeContext.viewNode?1!==i.nodeContext.viewNode.nodeType?Ma(i.nodeContext.viewNode,i.nodeContext.whitespace)?i.nodeContext.after?n.afterIgnoredTextNode(i):n.startIgnoredTextNode(i):i.nodeContext.after?n.afterNonElementNode(i):n.startNonElementNode(i):i.nodeContext.inline?i.nodeContext.after?n.afterInlineElementNode(i):n.startInlineElementNode(i):i.nodeContext.after?n.afterNonInlineElementNode(i):n.startNonInlineElementNode(i):i.nodeContext.after?n.afterNonDisplayableNode(i):n.startNonDisplayableNode(i))&&r.isPending()?r:bi(!0)).thenAsync(function(){return i.break?bi(null):e.layoutContext.nextInTree(i.nodeContext,i.atUnforcedBreak)});if(o.isPending())return void o.then(function(e){i.break?t.breakLoop():(i.nodeContext=e,t.continueLoop())});if(i.break)return void t.breakLoop();i.nodeContext=o.get()}n.finish(i),t.breakLoop()}).then(function(){r.finish(i.nodeContext)}),r.result()},t}(),Ys=function(t){function e(e){var n;return(n=t.call(this)||this).leadingEdge=e,n}x(e,t);var n=e.prototype;return n.startNonInlineBox=function(t){},n.endEmptyNonInlineBox=function(t){},n.endNonInlineBox=function(t){},n.initialState=function(t){return{nodeContext:t,atUnforcedBreak:!!this.leadingEdge&&t.after,break:!1,leadingEdge:this.leadingEdge,breakAtTheEdge:null,onStartEdges:!1,leadingEdgeContexts:[],lastAfterNodeContext:null}},n.processForcedBreak=function(t,e){var n=!t.leadingEdge&&ws(t.breakAtTheEdge);if(n){var i=t.nodeContext=t.leadingEdgeContexts[0]||t.nodeContext;i.viewNode.parentNode.removeChild(i.viewNode),e.pageBreakType=t.breakAtTheEdge}return n},n.saveEdgeAndProcessOverflow=function(t,e){var n=e.checkOverflowAndSaveEdgeAndBreakPosition(t.lastAfterNodeContext,null,!0,t.breakAtTheEdge);return n&&(t.nodeContext=(t.lastAfterNodeContext||t.nodeContext).modify(),t.nodeContext.overflow=!0),n},n.processLayoutConstraint=function(t,e,n){var i=t.nodeContext,r=!e.allowLayout(i);return r&&(n.checkOverflowAndSaveEdgeAndBreakPosition(t.lastAfterNodeContext,null,!1,t.breakAtTheEdge),(i=t.nodeContext=i.modify()).overflow=!0),r},n.startNonElementNode=function(t){t.onStartEdges=!1},n.startNonInlineElementNode=function(t){return t.leadingEdgeContexts.push(t.nodeContext.copy()),t.breakAtTheEdge=bs(t.breakAtTheEdge,t.nodeContext.breakBefore),t.onStartEdges=!0,this.startNonInlineBox(t)},n.afterNonInlineElementNode=function(t){var e;return(t.onStartEdges?((e=this.endEmptyNonInlineBox(t))&&e.isPending()?e:bi(!0)).thenAsync(function(){return t.break||(t.leadingEdgeContexts=[],t.leadingEdge=!1,t.atUnforcedBreak=!1,t.breakAtTheEdge=null),bi(!0)}):(e=this.endNonInlineBox(t))&&e.isPending()?e:bi(!0)).thenAsync(function(){return t.break||(t.onStartEdges=!1,t.lastAfterNodeContext=t.nodeContext.copy(),t.breakAtTheEdge=bs(t.breakAtTheEdge,t.nodeContext.breakAfter)),bi(!0)})},e}(Xs),Ks=[],qs=(new DOMParser).parseFromString('<root xmlns="'+V.SHADOW+'"/>',"text/xml"),Qs=["footnote-marker","first-5-lines","first-4-lines","first-3-lines","first-2-lines","first-line","first-letter","before","","after"];function Zs(t){return t.getAttribute("data-adapt-pseudo")||""}function $s(t,e){t.setAttribute("data-adapt-pseudo",e)}var Js=function(){function t(t,e,n,i,r){this.element=t,this.style=e,this.styler=n,this.context=i,this.exprContentListener=r,this.contentProcessed={}}var e=t.prototype;return e.getStyle=function(t,e){var n=Zs(t);this.styler&&n&&n.match(/after$/)&&(this.style=this.styler.getStyle(this.element,!0),this.styler=null);var i=Yr(this.style,"_pseudos")[n]||{};if(n.match(/^first-/)&&!i["x-first-pseudo"]){var r,o=1;"first-letter"==n?o=0:null!=(r=n.match(/^first-([0-9]+)-lines$/))&&(o=r[1]-0),i["x-first-pseudo"]=new Mr(new _e(o),0)}return i},e.processContent=function(t,e){var n=Zs(t);if(!this.contentProcessed[n]){this.contentProcessed[n]=!0;var i=e.content;i&&rs(i)&&i.visit(new is(t,this.context,i,this.exprContentListener))}},t}(),tl=Cr.registerFragmentIndex,el=function(){function t(t,e){this.sourceNode=t,this.styler=e}var e=t.prototype;return e.createElement=function(t,e){var n=this,i=e.viewNode.ownerDocument.createElement("div"),r=new cl(t,i,e),o=r.getColumn().pageBreakType;return r.getColumn().pageBreakType=null,r.layout(this.createNodePositionForPseudoElement(),!0).thenAsync(function(){n.styler.contentProcessed["after-if-continues"]=!1,r.getColumn().pageBreakType=o;var t=i.firstChild;return Z(t,"display","block"),bi(t)})},e.createNodePositionForPseudoElement=function(){var t=qs.createElementNS(V.XHTML,"div");$s(t,"after-if-continues");var e=this.createShadowContext(t);return new $a({steps:[{node:t,shadowType:e.type,shadowContext:e,nodeShadow:null,shadowSibling:null}],offsetInNode:0,after:!1,preprocessedTextContent:null})},e.createShadowContext=function(t){return new Ka(this.sourceNode,t,null,null,null,Sa.ShadowType.ROOTED,this.styler)},t}(),nl=function(){function t(t,e,n){this.nodeContext=t,this.afterIfContinues=e,this.pseudoElementHeight=n,this.flagmentLayoutConstraintType="AfterIfContinue"}var e=t.prototype;return e.allowLayout=function(t,e,n){return!(e&&!t||t&&t.overflow)},e.nextCandidate=function(t){return!1},e.postLayout=function(t,e,n,i){},e.finishBreak=function(t,e){var n=this;return this.getRepetitiveElements().affectTo(t)?this.afterIfContinues.createElement(e,this.nodeContext).thenAsync(function(t){return n.nodeContext.viewNode.appendChild(t),bi(!0)}):bi(!0)},e.getRepetitiveElements=function(){return new il(this.nodeContext,this.pseudoElementHeight)},e.equalsTo=function(e){return e instanceof t&&this.afterIfContinues==e.afterIfContinues},e.getPriorityOfFinishBreak=function(){return 9},t}(),il=function(){function t(t,e){this.nodeContext=t,this.pseudoElementHeight=e}var e=t.prototype;return e.calculateOffset=function(t){return this.affectTo(t)?this.pseudoElementHeight:0},e.calculateMinimumOffset=function(t){return this.calculateOffset(t)},e.affectTo=function(t){if(!t)return!1;var e=t.shadowContext?t.shadowContext.owner:t.sourceNode;if(e===this.nodeContext.sourceNode)return!!t.after;for(var n=e.parentNode;n;n=n.parentNode)if(n===this.nodeContext.sourceNode)return!0;return!1},t}();function rl(t,e){if(!t||!t.afterIfContinues||t.after||e.isFloatNodeContext(t))return bi(t);var n=t.afterIfContinues;return n.createElement(e,t).thenAsync(function(i){var r=function(t,e,n){var i=t.viewNode;i.appendChild(n);var r=xs(n,e,t.vertical);return i.removeChild(n),r}(t,e,i);return e.fragmentLayoutConstraints.push(new nl(t,n,r)),bi(t)})}function ol(t,e){return t.thenAsync(function(t){return rl(t,e)})}var al={img:!0,svg:!0,audio:!0,video:!0},sl=function(){function t(t){this.constraints=t}return t.prototype.allowLayout=function(t){return this.constraints.every(function(e){return e.allowLayout(t)})},t}(),ll=function(t){function e(e,n){var i;return(i=t.call(this)||this).checkPoints=e,i.penalty=n,i.alreadyEvaluated=!1,i.breakNodeContext=null,i}x(e,t);var n=e.prototype;return n.findAcceptableBreak=function(t,e){return e<this.getMinBreakPenalty()?null:(this.alreadyEvaluated||(this.breakNodeContext=t.findBoxBreakPosition(this,e>0),this.alreadyEvaluated=!0),this.breakNodeContext)},n.getMinBreakPenalty=function(){return this.penalty},n.getNodeContext=function(){return this.alreadyEvaluated?this.breakNodeContext:this.checkPoints[this.checkPoints.length-1]},e}(Ls);function ul(t){switch(t){case"ruby":case"inline-block":case"inline-flex":case"inline-grid":case"inline-list-item":case"inline-table":return!0}return!1}var hl=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this,e)||this).layoutContext=n,a.clientLayout=i,a.layoutConstraint=r,a.pageFloatLayoutContext=o,a.flowRootFormattingContext=null,a.isFloat=!1,a.isFootnote=!1,a.startEdge=0,a.endEdge=0,a.beforeEdge=0,a.afterEdge=0,a.footnoteEdge=0,a.box=null,a.chunkPositions=null,a.bands=null,a.overflown=!1,a.breakPositions=null,a.pageBreakType=null,a.forceNonfitting=!0,a.leftFloatEdge=0,a.rightFloatEdge=0,a.bottommostFloatTop=0,a.stopAtOverflow=!0,a.lastAfterPosition=null,a.fragmentLayoutConstraints=[],a.pseudoParent=null,a.nodeContextOverflowingDueToRepetitiveElements=null,a.blockDistanceToBlockEndFloats=NaN,a.last=e.lastChild,a.viewDocument=e.ownerDocument,o.setContainer(O(a)),a}x(e,t);var n=e.prototype;return n.getTopEdge=function(){return this.vertical?this.startEdge:this.beforeEdge},n.getBottomEdge=function(){return this.vertical?this.endEdge:this.afterEdge},n.getLeftEdge=function(){return this.vertical?this.afterEdge:this.startEdge},n.getRightEdge=function(){return this.vertical?this.beforeEdge:this.endEdge},n.isFloatNodeContext=function(t){return!(!t.floatSide||this.isFloat&&!t.parent)},n.stopByOverflow=function(t){return this.stopAtOverflow&&!!t&&t.overflow},n.isOverflown=function(t){return this.vertical?t<this.footnoteEdge:t>this.footnoteEdge},n.getExclusions=function(){var t=this.pageFloatLayoutContext.getFloatFragmentExclusions();return this.exclusions.concat(t)},n.openAllViews=function(t){var e=this,n=Ni("openAllViews"),i=t.steps;this.layoutContext.setViewRoot(this.element,this.isFootnote);var r=i.length-1,o=null;return n.loop(function(){for(;r>=0&&(o=ja(i[r],o),r!==i.length-1||o.formattingContext||(o.formattingContext=e.flowRootFormattingContext),0!=r||(o.offsetInNode=e.calculateOffsetInNodeForNodeContext(t),o.after=t.after,o.preprocessedTextContent=t.preprocessedTextContent,!o.after));){var n=e.layoutContext.setCurrent(o,0==r&&0==o.offsetInNode);if(r--,n.isPending())return n}return bi(!1)}).then(function(){n.finish(o)}),n.result()},n.calculateOffsetInNodeForNodeContext=function(t){return t.preprocessedTextContent?Ra(t.preprocessedTextContent,t.offsetInNode,1):t.offsetInNode},n.maybePeelOff=function(t,e){if(t.firstPseudo&&t.inline&&!t.after&&0==t.firstPseudo.count&&1!=t.viewNode.nodeType){var n=t.viewNode.textContent.match(fl);return this.layoutContext.peelOff(t,n[0].length)}return bi(t)},n.buildViewToNextBlockEdge=function(t,e){var n=this,i=!1,r=Ni("buildViewToNextBlockEdge");return r.loopWithFrame(function(r){t.viewNode&&!As(t)&&e.push(t.copy()),n.maybePeelOff(t,0).then(function(o){o!==t&&(As(t=o)||e.push(t.copy())),n.nextInTree(t).then(function(e){(t=e)?(!i&&n.layoutConstraint.allowLayout(t)||(i=!0,(t=t.modify()).overflow=!0),n.isFloatNodeContext(t)&&!n.vertical?n.layoutFloatOrFootnote(t).then(function(e){t=e,n.pageFloatLayoutContext.isInvalidated()&&(t=null),t?r.continueLoop():r.breakLoop()}):t.inline?r.continueLoop():r.breakLoop()):r.breakLoop()})})}).then(function(){r.finish(t)}),r.result()},n.nextInTree=function(t,e){return ol(this.layoutContext.nextInTree(t,e),this)},n.buildDeepElementView=function(t){var e=this;if(!t.viewNode)return bi(t);var n=[],i=t.sourceNode,r=Ni("buildDeepElementView");return r.loopWithFrame(function(r){t.viewNode&&t.inline&&!As(t)?n.push(t.copy()):(n.length>0&&e.postLayoutBlock(t,n),n=[]),e.maybePeelOff(t,0).then(function(o){var a=o;if(a!==t){for(var s=a;s&&s.sourceNode!=i;)s=s.parent;if(null==s)return t=a,void r.breakLoop();As(a)||n.push(a.copy())}e.nextInTree(a).then(function(n){(t=n)&&t.sourceNode!=i?e.layoutConstraint.allowLayout(t)?r.continueLoop():((t=t.modify()).overflow=!0,e.stopAtOverflow?r.breakLoop():r.continueLoop()):r.breakLoop()})})}).then(function(){n.length>0&&e.postLayoutBlock(t,n),r.finish(t)}),r.result()},n.createFloat=function(t,e,n,i){var r=this.viewDocument.createElement("div");return this.vertical?(i>=this.height&&(i-=.1),Z(r,"height",n+"px"),Z(r,"width",i+"px")):(n>=this.width&&(n-=.1),Z(r,"width",n+"px"),Z(r,"height",i+"px")),Z(r,"float",e),Z(r,"clear",e),this.element.insertBefore(r,t),r},n.killFloats=function(){for(var t=this.element.firstChild;t;){var e=t.nextSibling;if(1==t.nodeType){var n=t,i=n.style.cssFloat;if("left"!=i&&"right"!=i)break;this.element.removeChild(n)}t=e}},n.createFloats=function(){for(var t,e=this.element.firstChild,n=this.bands,i=this.vertical?this.getTopEdge():this.getLeftEdge(),r=this.vertical?this.getBottomEdge():this.getRightEdge(),o=D(n);!(t=o()).done;){var a=t.value,s=a.y2-a.y1;a.left=this.createFloat(e,"left",a.x1-i,s),a.right=this.createFloat(e,"right",r-a.x2,s)}},n.calculateEdge=function(t,e,n,i){var r;if(t&&Is(t.viewNode))return NaN;if(t&&t.after&&!t.inline&&(r=Ts(t,this.clientLayout,0,this.vertical),!isNaN(r)))return r;for(var o=i-(t=e[n]).boxOffset;;){if(r=Ts(t,this.clientLayout,o,this.vertical),!isNaN(r))return r;if(o>0)o--;else{if(--n<0)return this.beforeEdge;1!=(t=e[n]).viewNode.nodeType&&(o=t.viewNode.textContent.length)}}},n.parseComputedLength=function(t){if("number"==typeof t)return t;var e=t.match(/^(-?[0-9]*(\.[0-9]*)?)px$/);return e?parseFloat(e[0]):0},n.getComputedMargin=function(t){var e=this.clientLayout.getElementComputedStyle(t),n=new en(0,0,0,0);return e&&(n.left=this.parseComputedLength(e.marginLeft),n.top=this.parseComputedLength(e.marginTop),n.right=this.parseComputedLength(e.marginRight),n.bottom=this.parseComputedLength(e.marginBottom)),n},n.getComputedPaddingBorder=function(t){var e=this.clientLayout.getElementComputedStyle(t),n=new en(0,0,0,0);return e&&(n.left=this.parseComputedLength(e.borderLeftWidth)+this.parseComputedLength(e.paddingLeft),n.top=this.parseComputedLength(e.borderTopWidth)+this.parseComputedLength(e.paddingTop),n.right=this.parseComputedLength(e.borderRightWidth)+this.parseComputedLength(e.paddingRight),n.bottom=this.parseComputedLength(e.borderBottomWidth)+this.parseComputedLength(e.paddingBottom)),n},n.getComputedInsets=function(t){var e=this.clientLayout.getElementComputedStyle(t),n=new en(0,0,0,0);if(e){if("border-box"==e.boxSizing)return this.getComputedMargin(t);n.left=this.parseComputedLength(e.marginLeft)+this.parseComputedLength(e.borderLeftWidth)+this.parseComputedLength(e.paddingLeft),n.top=this.parseComputedLength(e.marginTop)+this.parseComputedLength(e.borderTopWidth)+this.parseComputedLength(e.paddingTop),n.right=this.parseComputedLength(e.marginRight)+this.parseComputedLength(e.borderRightWidth)+this.parseComputedLength(e.paddingRight),n.bottom=this.parseComputedLength(e.marginBottom)+this.parseComputedLength(e.borderBottomWidth)+this.parseComputedLength(e.paddingBottom)}return n},n.setComputedInsets=function(t,e){var n=this.clientLayout.getElementComputedStyle(t);n&&(e.marginLeft=this.parseComputedLength(n.marginLeft),e.borderLeft=this.parseComputedLength(n.borderLeftWidth),e.paddingLeft=this.parseComputedLength(n.paddingLeft),e.marginTop=this.parseComputedLength(n.marginTop),e.borderTop=this.parseComputedLength(n.borderTopWidth),e.paddingTop=this.parseComputedLength(n.paddingTop),e.marginRight=this.parseComputedLength(n.marginRight),e.borderRight=this.parseComputedLength(n.borderRightWidth),e.paddingRight=this.parseComputedLength(n.paddingRight),e.marginBottom=this.parseComputedLength(n.marginBottom),e.borderBottom=this.parseComputedLength(n.borderBottomWidth),e.paddingBottom=this.parseComputedLength(n.paddingBottom))},n.setComputedWidthAndHeight=function(t,e){var n=this.clientLayout.getElementComputedStyle(t);n&&(e.width=this.parseComputedLength(n.width),e.height=this.parseComputedLength(n.height))},n.layoutUnbreakable=function(t){return this.buildDeepElementView(t)},n.layoutFloat=function(t){var e=this,n=Ni("layoutFloat"),i=t.viewNode,r=t.floatSide;return Z(i,"float","none"),Z(i,"display","inline-block"),Z(i,"vertical-align","top"),this.buildDeepElementView(t).then(function(o){for(var a=e.clientLayout.getElementClientRect(i),s=e.getComputedMargin(i),l=new Je(a.left-s.left,a.top-s.top,a.right+s.right,a.bottom+s.bottom),u=e.startEdge,h=e.endEdge,c=t.parent;c&&c.inline;)c=c.parent;if(c){var f=c.viewNode.ownerDocument.createElement("div");f.style.left="0px",f.style.top="0px",e.vertical?(f.style.bottom="0px",f.style.width="1px"):(f.style.right="0px",f.style.height="1px"),c.viewNode.appendChild(f);var d=e.clientLayout.getElementClientRect(f);u=Math.max(e.getStartEdge(d),u),h=Math.min(e.getEndEdge(d),h),c.viewNode.removeChild(f);var p=e.vertical?l.y2-l.y1:l.x2-l.x1;"left"==r?h=Math.max(h,u+p):u=Math.min(u,h-p),c.viewNode.appendChild(t.viewNode)}var g=new Je(u,e.getBoxDir()*e.beforeEdge,h,e.getBoxDir()*e.afterEdge),m=l;e.vertical&&(m=pn(l));var v=e.getBoxDir();if(m.y1<e.bottommostFloatTop*v){var E=m.y2-m.y1;m.y1=e.bottommostFloatTop*v,m.y2=m.y1+E}!function(t,e,n,i){for(var r=n.y1,o=n.x2-n.x1,a=n.y2-n.y1,s=En(e,r);;){var l=r+a;if(l>t.y2)return!1;for(var u=t.x1,h=t.x2,c=s;c<e.length&&e[c].y1<l;c++){var f=e[c];f.x1>u&&(u=f.x1),f.x2<h&&(h=f.x2)}if(u+o<=h||s>=e.length)return"left"==i?(n.x1=u,n.x2=u+o):(n.x1=h-o,n.x2=h),n.y2+=r-n.y1,n.y1=r,!0;r=e[s].y2,s++}}(g,e.bands,m,r),e.vertical&&(l=gn(m));var w,y=e.getComputedInsets(i);Z(i,"width",l.x2-l.x1-y.left-y.right+"px"),Z(i,"height",l.y2-l.y1-y.top-y.bottom+"px"),Z(i,"position","absolute"),Z(i,"display",t.display);var N=null;if(c&&(N=c.containingBlockForAbsolute?c:c.getContainingBlockForAbsolute()),N){var b=N.viewNode.ownerDocument.createElement("div");b.style.position="absolute",N.vertical?b.style.right="0":b.style.left="0",b.style.top="0",N.viewNode.appendChild(b),w=e.clientLayout.getElementClientRect(b),N.viewNode.removeChild(b)}else w={left:e.getLeftEdge()-e.paddingLeft,right:e.getRightEdge()+e.paddingRight,top:e.getTopEdge()-e.paddingTop};(N?N.vertical:e.vertical)?Z(i,"right",w.right-l.x2+"px"):Z(i,"left",l.x1-w.left+"px"),Z(i,"top",l.y1-w.top+"px"),t.clearSpacer&&(t.clearSpacer.parentNode.removeChild(t.clearSpacer),t.clearSpacer=null);var S=e.vertical?l.x1:l.y2,C=e.vertical?l.x2:l.y1;e.isOverflown(S)&&0!=e.breakPositions.length?((t=t.modify()).overflow=!0,n.finish(t)):(e.killFloats(),g=new Je(e.getLeftEdge(),e.getTopEdge(),e.getRightEdge(),e.getBottomEdge()),e.vertical&&(g=pn(g)),function(t,e,n,i,r){for(i||(i=[new rn(n.y1,n.y2,n.x1,n.x2)]);i.length>0&&i[0].y2<=t.y1;)i.shift();if(0!=i.length){var o;i[0].y1<t.y1&&(i[0].y1=t.y1);var a=0==e.length?t.y1:e[e.length-1].y2;a<t.y2&&e.push(new rn(a,t.y2,t.x1,t.x2));for(var s,l=En(e,i[0].y1),u=D(i);!(s=u()).done;){var h=s.value;if(l==e.length)break;for(e[l].y1<h.y1&&(o=e[l],l++,e.splice(l,0,new rn(h.y1,o.y2,o.x1,o.x2)),o.y2=h.y1);l<e.length&&((o=e[l++]).y2>h.y2&&(e.splice(l,0,new rn(h.y2,o.y2,o.x1,o.x2)),o.y2=h.y2),h.x1!=h.x2&&("left"==r?o.x1=Math.min(h.x2,t.x2):o.x2=Math.max(h.x1,t.x1)),o.y2!=h.y2););}vn(t,e)}}(g,e.bands,m,null,r),e.createFloats(),"left"==r?e.leftFloatEdge=S:e.rightFloatEdge=S,e.bottommostFloatTop=C,e.updateMaxReachedAfterEdge(S),n.finish(o))}),n.result()},n.setupFloatArea=function(t,e,n,i,r,o){var a=this.pageFloatLayoutContext,s=a.getContainer(e),l=t.element;s.element.parentNode.appendChild(l),t.isFloat=!0,t.originX=s.originX,t.originY=s.originY,t.vertical=s.vertical,t.marginLeft=t.marginRight=t.marginTop=t.marginBottom=0,t.borderLeft=t.borderRight=t.borderTop=t.borderBottom=0,t.paddingLeft=t.paddingRight=t.paddingTop=t.paddingBottom=0,t.exclusions=(s.exclusions||[]).concat(),t.forceNonfitting=!a.hasFloatFragments(),t.innerShape=null;var u=s.getPaddingRect();t.setHorizontalPosition(u.x1-s.originX,u.x2-u.x1),t.setVerticalPosition(u.y1-s.originY,u.y2-u.y1),r.adjustPageFloatArea(t,s,this),t.init();var h=!!a.setFloatAreaDimensions(t,e,n,i,!0,!a.hasFloatFragments(),o);return h?(t.killFloats(),t.init()):s.element.parentNode.removeChild(l),h},n.createPageFloatArea=function(t,e,n,i,r){var o=this.element.ownerDocument.createElement("div");Z(o,"position","absolute");var a=this.pageFloatLayoutContext.getPageFloatLayoutContext(t.floatReference),s=new cs(null,os.COLUMN,null,this.pageFloatLayoutContext.flowName,t.nodePosition,null,null),l=a.getContainer(),u=new vl(e,o,this.layoutContext.clone(),this.clientLayout,this.layoutConstraint,s,l);return s.setContainer(u),this.setupFloatArea(u,t.floatReference,e,n,i,r)?u:null},n.layoutSinglePageFloatFragment=function(t,e,n,i,r,o,a){var s=this.pageFloatLayoutContext,l=(t=(a?a.continuations:[]).concat(t))[0].float,u=s.getPageFloatPlacementCondition(l,e,n),h=this.createPageFloatArea(l,e,o,r,u),c={floatArea:h,pageFloatFragment:null,newPosition:null};if(!h)return bi(c);var f=Ni("layoutSinglePageFloatFragment"),d=!1,p=0;return f.loopWithFrame(function(e){if(p>=t.length)e.breakLoop();else{var n=new $a(t[p].nodePosition);h.layout(n,!0).then(function(t){c.newPosition=t,!t||i?(p++,e.continueLoop()):(d=!0,e.breakLoop())})}}).then(function(){if(!d){var n=s.setFloatAreaDimensions(h,l.floatReference,e,o,!1,i,u);if(n){var a=r.createPageFloatFragment(t,n,h,!!c.newPosition);s.addPageFloatFragment(a,!0),c.pageFloatFragment=a}else d=!0}f.finish(c)}),f.result()},n.layoutPageFloatInner=function(t,e,n,i){var r=this,o=this.pageFloatLayoutContext,a=t.float;function s(e,n){n?o.removePageFloatFragment(n,!0):e&&e.element.parentNode.removeChild(e.element),o.restoreStashedFragments(a.floatReference),o.deferPageFloat(t)}o.stashEndFloatFragments(a);var l=Ni("layoutPageFloatInner");return this.layoutSinglePageFloatFragment([t],a.floatSide,a.clearSide,!o.hasFloatFragments(),e,n,i).then(function(t){var e=t.floatArea,n=t.pageFloatFragment,u=t.newPosition;n?r.layoutStashedPageFloats(a.floatReference,[i]).then(function(t){if(t){if(o.addPageFloatFragment(n),o.discardStashedFragments(a.floatReference),u){var i=new hs(a,u.primary);o.deferPageFloat(i)}l.finish(!0)}else s(e,n),l.finish(!1)}):(s(e,n),l.finish(!1))}),l.result()},n.layoutStashedPageFloats=function(t,e){var n=this,i=this.pageFloatLayoutContext,r=i.getStashedFloatFragments(t),o=[],a=[],s=!1,l=Ni("layoutStashedPageFloats"),u=0;return l.loopWithFrame(function(t){if(u>=r.length)t.breakLoop();else{var i=r[u];if(e.includes(i))return u++,void t.continueLoop();var l=(new ds).findByFloat(i.continuations[0].float);n.layoutSinglePageFloatFragment(i.continuations,i.floatSide,null,!1,l,null).then(function(e){var n=e.floatArea;n&&o.push(n);var i=e.pageFloatFragment;i?(a.push(i),u++,t.continueLoop()):(s=!0,t.breakLoop())})}}).then(function(){s?(a.forEach(function(t){i.removePageFloatFragment(t,!0)}),o.forEach(function(t){var e=t.element;e&&e.parentNode&&e.parentNode.removeChild(e)})):r.forEach(function(t){var e=t.area.element;e&&e.parentNode&&e.parentNode.removeChild(e)}),l.finish(!s)}),l.result()},n.setFloatAnchorViewNode=function(t){var e=t.viewNode.parentNode,n=e.ownerDocument.createElement("span");n.setAttribute("data-adapt-spec","1"),"footnote"===t.floatSide&&this.layoutContext.applyPseudoelementStyle(t,"footnote-call",n),e.appendChild(n),e.removeChild(t.viewNode);var i=t.modify();return i.after=!0,i.viewNode=n,i},n.resolveFloatReferenceFromColumnSpan=function(t,e,n){var i=this,r=Ni("resolveFloatReferenceFromColumnSpan"),o=this.pageFloatLayoutContext,a=o.getPageFloatLayoutContext(os.REGION);return o.getContainer().width<a.getContainer().width&&t===os.COLUMN?e===je.auto?this.buildDeepElementView(n.copy()).then(function(e){var n=e.viewNode,o=Ia(i.clientLayout,n,[va.MIN_CONTENT_INLINE_SIZE])[va.MIN_CONTENT_INLINE_SIZE],a=i.getComputedMargin(n);r.finish((o+=i.vertical?a.top+a.bottom:a.left+a.right)>i.width?os.REGION:t)}):r.finish(e===je.all?os.REGION:t):r.finish(t),r.result()},n.layoutPageFloat=function(t){var e=this,n=this.pageFloatLayoutContext,i=(new ds).findByNodeContext(t),r=n.findPageFloatByNodePosition(t.toNodePosition());return(r?bi(r):i.createPageFloat(t,n,this)).thenAsync(function(r){var o=Xa(t,0),a=e.setFloatAnchorViewNode(t),s=i.findPageFloatFragment(r,n),l=new hs(r,o);if(s&&s.hasFloat(r))return n.registerPageFloatAnchor(r,a.viewNode),bi(a);if(n.isForbidden(r)||n.hasPrecedingFloatsDeferredToNext(r))return n.deferPageFloat(l),n.registerPageFloatAnchor(r,a.viewNode),bi(a);if(e.nodeContextOverflowingDueToRepetitiveElements)return bi(null);var u=Ts(a,e.clientLayout,0,e.vertical);return e.isOverflown(u)?bi(a):e.layoutPageFloatInner(l,i,u,s).thenAsync(function(t){return t?bi(null):(n.registerPageFloatAnchor(r,a.viewNode),bi(a))})})},n.createJustificationAdjustmentElement=function(t,e,n,i){var r=e.createElement("span");r.style.visibility="hidden",r.style.verticalAlign="top",r.setAttribute("data-adapt-spec","1");var o=e.createElement("span");o.style.fontSize="0",o.style.lineHeight="0",o.textContent=" #",r.appendChild(o),r.style.display="block",r.style.textIndent="0",r.style.textAlign="left",n.insertBefore(r,t);var a=this.clientLayout.getElementClientRect(o);r.style.textAlign="right";var s=this.clientLayout.getElementClientRect(o);r.style.textAlign="",r.style.display=function(t){if(null===pt){var e=t.ownerDocument,n=e.createElement("div");n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.width="30px",n.style.height="100px",n.style.lineHeight="16px",n.style.fontSize="16px",n.style.textAlign="justify",t.appendChild(n);var i=e.createTextNode("a | ");n.appendChild(i);var r=e.createElement("span");r.style.display="inline-block",r.style.width="30px",n.appendChild(r);var o=e.createRange();o.setStart(i,0),o.setEnd(i,3);var a=o.getBoundingClientRect();pt=a.right<27,t.removeChild(n)}return pt}(document.body)?"inline":"inline-block";var l=i?s.top-a.top:s.left-a.left,u=l>=1?l-1+"px":"100%";return i?r.style.paddingTop=u:r.style.paddingLeft=u,r},n.addAndAdjustJustificationElement=function(t,e,n,i,r,o){return function(t,e,n,i){if(function(t){if(null===gt){var e=t.ownerDocument,n=e.createElement("div");n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.width="40px",n.style.height="100px",n.style.lineHeight="16px",n.style.fontSize="16px",n.style.textAlign="justify",t.appendChild(n);var i=e.createTextNode("a a-");n.appendChild(i);var r=e.createElement("span");r.style.display="inline-block",r.style.width="40px",n.appendChild(r);var o=e.createRange();o.setStart(i,2),o.setEnd(i,4);var a=o.getBoundingClientRect();gt=a.right<37,t.removeChild(n)}return gt}(document.body)){var r=pl(t),o=e?n:n.previousSibling,a=o?o.textContent:"";if(a.charAt(a.length-1)===r){var s=n.ownerDocument,l=n.parentNode;!function(t){if(null===mt){var e=t.ownerDocument,n=e.createElement("div");n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.style.width="40px",n.style.height="100px",n.style.lineHeight="16px",n.style.fontSize="16px",n.style.textAlign="justify",t.appendChild(n);var i=e.createTextNode("a a-");n.appendChild(i),n.appendChild(e.createElement("wbr"));var r=e.createElement("span");r.style.display="inline-block",r.style.width="40px",n.appendChild(r);var o=e.createRange();o.setStart(i,2),o.setEnd(i,4);var a=o.getBoundingClientRect();mt=a.right<37,t.removeChild(n)}return mt}(document.body)?l.insertBefore(s.createElement("wbr"),i):l.insertBefore(s.createTextNode(" "),i)}}}(t,e,n,i),this.createJustificationAdjustmentElement(i,r,o,t.vertical)},n.compensateJustificationLineHeight=function(t,e,n){var i=this.clientLayout.getElementClientRect(t),r=this.clientLayout.getElementClientRect(e);n.vertical?(e.style.marginRight=r.right-i.right+"px",e.style.width="0px"):(e.style.marginTop=i.top-r.top+"px",e.style.height="0px"),e.setAttribute("data-adapt-spec","1")},n.fixJustificationIfNeeded=function(t,e){if(!t.after||t.inline){if(e){for(var n="",i=t.parent;i&&!n;i=i.parent)!i.inline&&i.viewNode&&(n=i.viewNode.style.textAlign);if("justify"!==n)return}var r=t.viewNode,o=r.ownerDocument,a=e&&(t.after||1!=r.nodeType),s=a?r.nextSibling:r;s&&!s.parentNode&&(s=null);var l=r.parentNode||t.parent&&t.parent.viewNode;if(l){var u=this.addAndAdjustJustificationElement(t,a,r,s,o,l);if(!e){var h=o.createElement("div");l.insertBefore(h,s),this.compensateJustificationLineHeight(u,h,t)}}}},n.processLineStyling=function(t,e,n){var i=this,r=Ni("processLineStyling"),o=n.concat([]);n.splice(0,n.length);var a=0,s=t.firstPseudo;return 0==s.count&&(s=s.outer),r.loopWithFrame(function(n){if(s){var r=i.findLinePositions(o),l=s.count-a;if(r.length<=l)n.breakLoop();else{var u=i.findAcceptableBreakInside(o,r[l-1],!0);null!=u?i.finishBreak(u,!1,!1).then(function(){a+=l,i.layoutContext.peelOff(u,0).then(function(r){i.fixJustificationIfNeeded(t=r,!1),s=t.firstPseudo,i.buildViewToNextBlockEdge(t,o=[]).then(function(t){e=t,n.continueLoop()})})}):n.breakLoop()}}else n.breakLoop()}).then(function(){Array.prototype.push.apply(n,o),r.finish(e)}),r.result()},n.isLoneImage=function(t){return!(2!=t.length&&this.breakPositions.length>0)&&t[0].sourceNode==t[1].sourceNode&&al[t[0].sourceNode.localName]},n.getTrailingMarginEdgeAdjustment=function(t){for(var e=0,n=0,i=t.length-1;i>=0;i--){var r=t[i];if(!r.after||!r.viewNode||1!=r.viewNode.nodeType)break;var o=this.getComputedMargin(r.viewNode),a=this.vertical?-o.left:o.bottom;a>0?e=Math.max(e,a):n=Math.min(n,a)}return e-n},n.layoutBreakableBlock=function(t){var e=this,n=Ni("layoutBreakableBlock"),i=[];return this.buildViewToNextBlockEdge(t,i).then(function(r){var o=i.length-1;if(o<0)n.finish(r);else{var a=e.calculateEdge(r,i,o,i[o].boxOffset),s=!1;if(!r||!Is(r.viewNode)){var l=Os(r,e.collectElementsOffset());s=e.isOverflown(a+(e.vertical?-1:1)*l.minimum),e.isOverflown(a+(e.vertical?-1:1)*l.current)&&!e.nodeContextOverflowingDueToRepetitiveElements&&(e.nodeContextOverflowingDueToRepetitiveElements=r)}null==r&&(a+=e.getTrailingMarginEdgeAdjustment(i)),e.updateMaxReachedAfterEdge(a),(t.firstPseudo?e.processLineStyling(t,r,i):bi(r)).then(function(t){e.postLayoutBlock(t,i),i.length>0&&(e.saveBoxBreakPosition(i),s&&!e.isLoneImage(i)&&t&&((t=t.modify()).overflow=!0)),n.finish(t)})}}),n.result()},n.postLayoutBlock=function(t,e){var n=this;p(exports.HOOKS.POST_LAYOUT_BLOCK).forEach(function(i){i(t,e,n)})},n.findEndOfLine=function(t,e,n){for(var i,r=this.vertical?t-1:t+1,o=0,a=e[0].boxOffset,s=o,l=e.length-1,u=e[l].boxOffset;a<u;){i=a+Math.ceil((u-a)/2),s=o;for(var h=l;s<h;){var c=s+Math.ceil((h-s)/2);e[c].boxOffset>i?h=c-1:s=c}var f=this.calculateEdge(null,e,s,i);if(this.vertical?f<=r:f>=r){for(u=i-1;e[s].boxOffset==i;)s--;l=s}else n&&this.updateMaxReachedAfterEdge(f),a=i,o=s}return{nodeContext:e[s],index:a,checkPointIndex:s}},n.findAcceptableBreakInside=function(t,e,n){var i=this.findEndOfLine(e,t,!0),r=i.nodeContext,o=r.viewNode;if(1!=o.nodeType){var a=o;r=this.resolveTextNodeBreaker(r).breakTextNode(a,r,i.index,t,i.checkPointIndex,n)}return this.clearOverflownViewNodes(r,!1),r},n.resolveTextNodeBreaker=function(t){return p(exports.HOOKS.RESOLVE_TEXT_NODE_BREAKER).reduce(function(e,n){return n(t)||e},dl.instance)},n.getRangeBoxes=function(t,e){for(var n=[],i=t.ownerDocument.createRange(),r=!1,o=t,a=null,s=!1,l=!0;l;){var u=!0;do{var h=null;o==e&&(l=1===e.nodeType&&!(!e.firstChild||r)),1!=o.nodeType?(s||(i.setStartBefore(o),s=!0),a=o):r?r=!1:Rs(o)?u=!s:"ruby"==o.localName||ul(this.clientLayout.getElementComputedStyle(o).display)?((u=!s)&&(i.setStartBefore(o),s=!0,a=o),o.contains(e)&&(l=!1)):h=o.firstChild,h||(h=o.nextSibling)||(r=!0,h=o.parentNode),o=h}while(u&&l);if(s){i.setEndAfter(a);for(var c=this.clientLayout.getRangeClientRects(i),f=0;f<c.length;f++)n.push(c[f]);s=!1}}return n},n.findLinePositions=function(t){var e=[],n=this.getRangeBoxes(t[0].viewNode,t[t.length-1].viewNode);n.sort(this.vertical?za:Ha);for(var i=0,r=0,o=0,a=0,s=0,l=this.getBoxDir();;){if(s<n.length){var u=n[s],h=1;if(a>0){var c=Math.max(this.getBoxSize(u),1);h=l*this.getBeforeEdge(u)<l*i?l*(this.getAfterEdge(u)-i)/c:l*this.getAfterEdge(u)>l*r?l*(r-this.getBeforeEdge(u))/c:1}if(0==a||h>=.6||h>=.2&&this.getStartEdge(u)>=o-1){o=this.getEndEdge(u),this.vertical?(i=0==a?u.right:Math.max(i,u.right),r=0==a?u.left:Math.min(r,u.left)):(i=0==a?u.top:Math.min(i,u.top),r=0==a?u.bottom:Math.max(r,u.bottom)),a++,s++;continue}}if(a>0&&(e.push(r),a=0),s>=n.length)break}return e.sort(ut),this.vertical&&e.reverse(),e},n.calculateClonedPaddingBorder=function(t){var e=this,n=0;return t.walkUpBlocks(function(t){if("clone"===t.inheritedProps["box-decoration-break"]){var i=e.getComputedPaddingBorder(t.viewNode);n+=t.vertical?-i.left:i.bottom,"table"===t.display&&(n+=t.blockBorderSpacing)}}),n},n.getOffsetByRepetitiveElements=function(t){return(t?t.calculateOffset(this):Os(null,this.collectElementsOffset())).current},n.findBoxBreakPosition=function(t,e){for(var n,i,r=this,o=t.checkPoints,a=o[0];a.parent&&a.inline;)a=a.parent;e?(n=1,i=1):(n=Math.max((a.inheritedProps.widows||2)-0,1),i=Math.max((a.inheritedProps.orphans||2)-0,1));var s=this.calculateClonedPaddingBorder(a),l=this.findLinePositions(o),u=this.footnoteEdge-s,h=this.getBoxDir(),c=this.getOffsetByRepetitiveElements(t);u-=h*c;var f=this.findFirstOverflowingEdgeAndCheckPoint(o);isNaN(f.edge)&&(f.edge=Infinity*h);var d,p=lt(l.length,function(t){var e=l[t];return r.vertical?e<u||e<=f.edge:e>u||e>=f.edge}),g=p<=0;if(g&&(p=lt(l.length,function(t){return r.vertical?l[t]<u:l[t]>u})),(p=Math.min(l.length-n,p))<i)return null;if(u=l[p-1],d=g?f.checkPoint:this.findAcceptableBreakInside(t.checkPoints,u,e)){var m=this.getAfterEdgeOfBlockContainer(d);!isNaN(m)&&m<u&&(u=m),this.computedBlockSize=h*(u-this.beforeEdge)+c}return d},n.getAfterEdgeOfBlockContainer=function(t){var e=t;do{e=e.parent}while(e&&e.inline);return e?((e=e.copy().modify()).after=!0,Ts(e,this.clientLayout,0,this.vertical)):NaN},n.findFirstOverflowingEdgeAndCheckPoint=function(t){var e=t.findIndex(function(t){return t.overflow});if(e<0)return{edge:NaN,checkPoint:null};var n=t[e];return{edge:this.calculateEdge(null,t,e,n.boxOffset),checkPoint:n}},n.findEdgeBreakPosition=function(t){return this.computedBlockSize=t.computedBlockSize+this.getOffsetByRepetitiveElements(t),t.position},n.finishBreak=function(t,e,n){var i=(new Us).find(t.formattingContext).finishBreak(this,t,e,n);return i||(i=zs.finishBreak(this,t,e,n)),i},n.findAcceptableBreakPosition=function(){var t=null,e=null,n=0,i=0;do{n=i,i=Number.MAX_VALUE;for(var r=this.breakPositions.length-1;r>=0&&!e;--r){e=(t=this.breakPositions[r]).findAcceptableBreak(this,n);var o=t.getMinBreakPenalty();o>n&&(i=Math.min(i,o))}}while(i>n&&!e&&this.forceNonfitting);return{breakPosition:e?t:null,nodeContext:e}},n.doFinishBreak=function(t,e,n,i){var r=this;if(this.pageFloatLayoutContext.isInvalidated()||this.pageBreakType||!e)return bi(t);var o=Ni("doFinishBreak"),a=!1;if(!t){if(this.forceNonfitting)return h.warn("Could not find any page breaks?!!"),this.skipTailEdges(e).then(function(t){t?((t=t.modify()).overflow=!1,r.finishBreak(t,a,!0).then(function(){o.finish(t)})):o.finish(t)}),o.result();t=n,a=!0,this.computedBlockSize=i}return this.finishBreak(t,a,!0).then(function(){o.finish(t)}),o.result()},n.isBreakable=function(t){if(t.after)return!0;switch(t.sourceNode.namespaceURI){case V.SVG:return!1}return!t.flexContainer},n.zeroIndent=function(t){var e=t.toString();return""==e||"auto"==e||!!e.match(/^0+(.0*)?[^0-9]/)},n.checkOverflowAndSaveEdge=function(t,e){if(!t)return!1;if(Is(t.viewNode))return!1;var n=Ts(t,this.clientLayout,0,this.vertical),i=Os(t,this.collectElementsOffset()),r=this.isOverflown(n+(this.vertical?-1:1)*i.minimum);if(this.isOverflown(n+(this.vertical?-1:1)*i.current)&&!this.nodeContextOverflowingDueToRepetitiveElements)this.nodeContextOverflowingDueToRepetitiveElements=t;else if(e){var o=n+this.getTrailingMarginEdgeAdjustment(e),a=this.footnoteEdge-this.getBoxDir()*i.current;n=this.vertical?Math.min(n,Math.max(o,a)):Math.max(n,Math.min(o,a))}return this.updateMaxReachedAfterEdge(n),r},n.checkOverflowAndSaveEdgeAndBreakPosition=function(t,e,n,i){if(!t)return!1;if(Is(t.viewNode))return!1;var r=this.checkOverflowAndSaveEdge(t,e);return!n&&r||this.saveEdgeBreakPosition(t,i,r),r},n.applyClearance=function(t){if(!t.viewNode.parentNode)return!1;var e=this.getComputedMargin(t.viewNode),n=t.viewNode.ownerDocument.createElement("div");this.vertical?(n.style.bottom="0px",n.style.width="1px",n.style.marginRight=e.right+"px"):(n.style.right="0px",n.style.height="1px",n.style.marginTop=e.top+"px"),t.viewNode.parentNode.insertBefore(n,t.viewNode);var i=this.clientLayout.getElementClientRect(n),r=this.getBeforeEdge(i),o=this.getBoxDir(),a=t.clearSide,s=Infinity*-this.getBoxDir();switch("all"===a&&(s=this.pageFloatLayoutContext.getPageFloatClearEdge(a,this)),a){case"left":s=o*Math.max(s*o,this.leftFloatEdge*o);break;case"right":s=o*Math.max(s*o,this.rightFloatEdge*o);break;default:s=o*Math.max(s*o,Math.max(this.rightFloatEdge*o,this.leftFloatEdge*o))}if(r*o>=s*o)return t.viewNode.parentNode.removeChild(n),!1;var l=Math.max(1,(s-r)*o);this.vertical?n.style.width=l+"px":n.style.height=l+"px",i=this.clientLayout.getElementClientRect(n);var u=this.getAfterEdge(i);if(this.vertical){var h=u+e.right-s;h>0==e.right>=0&&(h+=e.right),n.style.marginLeft=h+"px"}else{var c=s-(u+e.top);c>0==e.top>=0&&(c+=e.top),n.style.marginBottom=c+"px"}return t.clearSpacer=n,!0},n.isBFC=function(t){return!!Gs(t)||!!Na.isInstanceOfRepetitiveElementsOwnerFormattingContext(t)},n.skipEdges=function(t,e,n){var i=this,r=t.after?t.parent&&t.parent.formattingContext:t.formattingContext;if(r&&!this.isBFC(r))return bi(t);var o=Ni("skipEdges"),a=!n&&e&&t&&t.after,s=n,l=null,u=[],h=[],c=!1;function f(){return!!n||!e&&ws(s)}var d=function(){(t=u[0]||t).viewNode.parentNode.removeChild(t.viewNode),i.pageBreakType=s};return o.loopWithFrame(function(n){for(;t;){var r=(new Us).find(t.formattingContext);do{if(!t.viewNode)break;if(t.inline&&1!=t.viewNode.nodeType){if(Ma(t.viewNode,t.whitespace))break;if(!t.after)return f()?d():i.checkOverflowAndSaveEdgeAndBreakPosition(l,null,!0,s)?(t=(i.stopAtOverflow&&l||t).modify()).overflow=!0:(t=t.modify()).breakBefore=s,void n.breakLoop()}if(!t.after){if(r&&r.startNonInlineElementNode(t))break;if(t.clearSide&&i.applyClearance(t)&&e&&0===i.breakPositions.length&&i.saveEdgeBreakPosition(t.copy(),s,!1),!i.isBFC(t.formattingContext)||Na.isInstanceOfRepetitiveElementsOwnerFormattingContext(t.formattingContext)||i.isFloatNodeContext(t)||t.flexContainer)return u.push(t.copy()),s=bs(s,t.breakBefore),f()?d():!i.checkOverflowAndSaveEdgeAndBreakPosition(l,null,!0,s)&&i.layoutConstraint.allowLayout(t)||((t=(i.stopAtOverflow&&l||t).modify()).overflow=!0),void n.breakLoop()}if(1!=t.viewNode.nodeType)break;var o=t.viewNode.style;if(t.after){if(t.inline)break;if(r&&r.afterNonInlineElementNode(t,i.stopAtOverflow))break;if(c){if(f())return d(),void n.breakLoop();u=[],e=!1,a=!1,s=null}c=!1,l=t.copy(),h.push(l),s=bs(s,t.breakAfter),!o||i.zeroIndent(o.paddingBottom)&&i.zeroIndent(o.borderBottomWidth)||(h=[l])}else{if(u.push(t.copy()),s=bs(s,t.breakBefore),!i.layoutConstraint.allowLayout(t)&&(i.checkOverflowAndSaveEdgeAndBreakPosition(l,null,!i.stopAtOverflow,s),(t=t.modify()).overflow=!0,i.stopAtOverflow))return void n.breakLoop();if(al[t.viewNode.localName])return f()?d():i.checkOverflowAndSaveEdgeAndBreakPosition(l,null,!0,s)&&((t=(i.stopAtOverflow&&l||t).modify()).overflow=!0),void n.breakLoop();!o||i.zeroIndent(o.paddingTop)&&i.zeroIndent(o.borderTopWidth)||(a=!1,h=[]),c=!0}}while(0);var p=i.nextInTree(t,a);if(p.isPending())return void p.then(function(e){t=e,n.continueLoop()});t=p.get()}i.checkOverflowAndSaveEdgeAndBreakPosition(l,h,!i.stopAtOverflow,s)?l&&i.stopAtOverflow&&((t=l.modify()).overflow=!0):ws(s)&&(i.pageBreakType=s),n.breakLoop()}).then(function(){l&&(i.lastAfterPosition=l.toNodePosition()),o.finish(t)}),o.result()},n.skipTailEdges=function(t){var e=this,n=t.copy(),i=Ni("skipEdges"),r=null,o=!1;return i.loopWithFrame(function(i){for(;t;){do{if(!t.viewNode)break;if(t.inline&&1!=t.viewNode.nodeType){if(Ma(t.viewNode,t.whitespace))break;if(!t.after)return ws(r)&&(e.pageBreakType=r),void i.breakLoop()}if(!t.after&&(e.isFloatNodeContext(t)||t.flexContainer))return ws(r=bs(r,t.breakBefore))&&(e.pageBreakType=r),void i.breakLoop();if(1!=t.viewNode.nodeType)break;var a=t.viewNode.style;if(t.after){if(o){if(ws(r))return e.pageBreakType=r,void i.breakLoop();r=null}o=!1,r=bs(r,t.breakAfter)}else{if(r=bs(r,t.breakBefore),al[t.viewNode.localName])return ws(r)&&(e.pageBreakType=r),void i.breakLoop();if(a&&(!e.zeroIndent(a.paddingTop)||!e.zeroIndent(a.borderTopWidth)))return void i.breakLoop()}o=!0}while(0);var s=e.layoutContext.nextInTree(t);if(s.isPending())return void s.then(function(e){t=e,i.continueLoop()});t=s.get()}n=null,i.breakLoop()}).then(function(){i.finish(n)}),i.result()},n.layoutFloatOrFootnote=function(t){return as(t.floatReference)||"footnote"===t.floatSide?this.layoutPageFloat(t):this.layoutFloat(t)},n.layoutNext=function(t,e,n){var i=this,r=Ni("layoutNext");return this.skipEdges(t,e,n||null).then(function(n){if(!(t=n)||i.pageBreakType||i.stopByOverflow(t))r.finish(t);else{var o=t.formattingContext;(new Us).find(o).layout(t,i,e).thenFinish(r)}}),r.result()},n.clearOverflownViewNodes=function(t,e){if(t)for(var n=t.parent;t;t=n,n=n?n.parent:null){var i=(n||t).formattingContext;(new Us).find(i).clearOverflownViewNodes(this,n,t,e),e=!1}},n.initGeom=function(){var t=this.element.ownerDocument.createElement("div");t.style.position="absolute",t.style.top=this.paddingTop+"px",t.style.right=this.paddingRight+"px",t.style.bottom=this.paddingBottom+"px",t.style.left=this.paddingLeft+"px",this.element.appendChild(t);var e=this.clientLayout.getElementClientRect(t);this.element.removeChild(t);var n=this.originX+this.left+this.getInsetLeft(),i=this.originY+this.top+this.getInsetTop();this.box=new Je(n,i,n+this.width,i+this.height),this.startEdge=e?this.vertical?e.top:e.left:0,this.endEdge=e?this.vertical?e.bottom:e.right:0,this.beforeEdge=e?this.vertical?e.right:e.top:0,this.afterEdge=e?this.vertical?e.left:e.bottom:0,this.leftFloatEdge=this.beforeEdge,this.rightFloatEdge=this.beforeEdge,this.bottommostFloatTop=this.beforeEdge,this.footnoteEdge=this.afterEdge,this.bands=function(t,e,n,i,r,o){o&&(t=pn(t),e=e.map(function(t){return mn(t)}),n=n.map(function(t){return mn(t)}));var a,s,l,u=e.length,h=n?n.length:0,c=[],f=[];for(a=0;a<u;a++)e[a].addSegments(f,a);for(a=0;a<h;a++)n[a].addSegments(f,a+u);var d=f.length;f.sort(on);for(var p=0;f[p].shapeId>=u;)p++;var g=f[p].low.y;g>t.y1&&c.push(new rn(t.y1,g,t.x2,t.x2));for(var m,v,E=0,w=[];E<d&&(l=f[E]).low.y<g;)l.high.y>g&&w.push(l),E++;for(;E<d||w.length>0;){var y=t.y2,N=Math.min((m=Math.ceil(g+8),(v=r)?Math.ceil(m/v)*v:m),t.y2);for(s=0;s<w.length&&y>N;s++)(l=w[s]).low.x==l.high.x?l.high.y<y&&(y=Math.max(dn(l.high.y,r),N)):l.low.x!=l.high.x&&(y=N);for(y>t.y2&&(y=t.y2);E<d&&(l=f[E]).low.y<y;)if(l.high.y<g)E++;else{if(!(l.low.y<N)){var b=dn(l.low.y,r);b<y&&(y=b);break}l.low.y==l.high.y&&l.low.y==g||(w.push(l),y=N),E++}var S=[];for(s=0;s<w.length;s++)cn(S,w[s],g,y);S.sort(function(t,e){return t.x-e.x||t.lowOrHigh-e.lowOrHigh});var C=fn(S,u,h);if(0==C.length)c.push(new rn(g,y,t.x2,t.x2));else{var T=0,x=t.x1;for(s=0;s<C.length;s+=2){var I=Math.max(t.x1,C[s]),P=Math.min(t.x2,C[s+1])-I;P>T&&(T=P,x=I)}c.push(0==T?new rn(g,y,t.x2,t.x2):new rn(g,y,Math.max(x,t.x1),Math.min(x+T,t.x2)))}if(y==t.y2)break;for(g=y,s=w.length-1;s>=0;s--)w[s].high.y<=y&&w.splice(s,1)}return vn(t,c),c}(this.box,[this.getInnerShape()],this.getExclusions(),0,this.snapHeight,this.vertical),this.createFloats()},n.init=function(){this.chunkPositions=[],Z(this.element,"width",this.width+"px"),Z(this.element,"height",this.height+"px"),this.initGeom(),this.computedBlockSize=0,this.overflown=!1,this.pageBreakType=null,this.lastAfterPosition=null},n.saveEdgeBreakPosition=function(t,e,n){var i=t.copy(),r=(new Us).find(t.formattingContext),o=this.calculateClonedPaddingBorder(i),a=r.createEdgeBreakPosition(i,e,n,this.computedBlockSize+o);this.breakPositions.push(a)},n.saveBoxBreakPosition=function(t){var e=new ll(t,t[0].breakPenalty);this.breakPositions.push(e)},n.updateMaxReachedAfterEdge=function(t){if(!isNaN(t)){var e=this.getBoxDir()*(t-this.beforeEdge);this.computedBlockSize=Math.max(e,this.computedBlockSize)}},n.layout=function(t,e,n){var i=this;if(this.chunkPositions.push(t),t.primary.after&&(this.lastAfterPosition=t.primary),this.stopAtOverflow&&this.overflown)return bi(t);if(this.isFullWithPageFloats())return bi(t.primary.after&&1===t.primary.steps.length?null:t);var r=Ni("layout");return this.openAllViews(t.primary).then(function(t){var o=null;t.viewNode?o=t.copy():i.layoutContext.addEventListener("nextInTree",function t(e){e.nodeContext.viewNode&&(o=e.nodeContext,i.layoutContext.removeEventListener("nextInTree",t))});var a=new gl(e,n);a.layout(t,i).then(function(t){i.doFinishBreak(t,a.context.overflownNodeContext,o,a.initialComputedBlockSize).then(function(t){(i.pseudoParent?bi(null):i.doFinishBreakOfFragmentLayoutConstraints(t)).then(function(){if(i.pageFloatLayoutContext.isInvalidated())r.finish(null);else if(t){i.overflown=!0;var e=new $a(t.toNodePosition());r.finish(e)}else r.finish(null)})})})}),r.result()},n.isFullWithPageFloats=function(){return this.pageFloatLayoutContext.isColumnFullWithPageFloats(this)},n.getMaxBlockSizeOfPageFloats=function(){return this.pageFloatLayoutContext.getMaxBlockSizeOfPageFloats()},n.doFinishBreakOfFragmentLayoutConstraints=function(t){var e=this,n=Ni("doFinishBreakOfFragmentLayoutConstraints"),i=[].concat(this.fragmentLayoutConstraints);i.sort(function(t,e){return t.getPriorityOfFinishBreak()-e.getPriorityOfFinishBreak()});var r=0;return n.loop(function(){return r<i.length?i[r++].finishBreak(t,e).thenReturn(!0):bi(!1)}).then(function(){n.finish(!0)}),n.result()},n.doLayout=function(t,e,n){var i=this,r=Ni("doLayout"),o=null;return this.breakPositions=[],this.nodeContextOverflowingDueToRepetitiveElements=null,r.loopWithFrame(function(r){for(var a=function(){var a=!0;if(i.layoutNext(t,e,n||null).then(function(s){if(e=!1,n=null,i.nodeContextOverflowingDueToRepetitiveElements&&i.stopAtOverflow?(i.pageBreakType=null,(t=i.nodeContextOverflowingDueToRepetitiveElements).overflow=!0):t=s,i.pageFloatLayoutContext.isInvalidated())r.breakLoop();else if(i.pageBreakType)r.breakLoop();else if(t&&i.stopByOverflow(t)){o=t;var l=i.findAcceptableBreakPosition();t=l.nodeContext,l.breakPosition&&l.breakPosition.breakPositionChosen(i),r.breakLoop()}else a?a=!1:r.continueLoop()}),a)return a=!1,{v:void 0}};t;){var s=a();if("object"==typeof s)return s.v}i.computedBlockSize+=i.getOffsetByRepetitiveElements(),r.breakLoop()}).then(function(){r.finish({nodeContext:t,overflownNodeContext:o})}),r.result()},n.redoLayout=function(){for(var t=this,e=this.chunkPositions,n=this.element.lastChild;n!=this.last;){var i=n.previousSibling;this.element===n.parentNode&&this.layoutContext.isPseudoelement(n)||this.element.removeChild(n),n=i}this.killFloats(),this.init();var r=Ni("redoLayout"),o=0,a=null,s=!0;return r.loopWithFrame(function(n){if(o<e.length){var i=e[o++];t.layout(i,s).then(function(t){s=!1,t?(a=t,n.breakLoop()):n.continueLoop()})}else n.breakLoop()}).then(function(){r.finish(a)}),r.result()},n.saveDistanceToBlockEndFloats=function(){var t=this.pageFloatLayoutContext.getBlockStartEdgeOfBlockEndFloats();t>0&&isFinite(t)&&(this.blockDistanceToBlockEndFloats=this.getBoxDir()*(t-this.beforeEdge-this.computedBlockSize))},n.collectElementsOffset=function(){for(var t=this,e=[],n=this;n;n=n.pseudoParent)n.fragmentLayoutConstraints.forEach(function(n){if(Na.isInstanceOfRepetitiveElementsOwnerLayoutConstraint(n)){var i=n.getRepetitiveElements();e.push(i)}if(ya.isInstanceOfAfterIfContinuesLayoutConstraint(n)){var r=n.getRepetitiveElements();e.push(r)}ba.isInstanceOfTableRowLayoutConstraint(n)&&n.getElementsOffsetsForTableCell(t).forEach(function(t){e.push(t)})});return e},e}(ns),cl=function(){function t(t,e,n){this.startNodeContexts=[],this.column=Object.create(t),this.column.element=e,this.column.layoutContext=t.layoutContext.clone(),this.column.stopAtOverflow=!1,this.column.flowRootFormattingContext=n.formattingContext,this.column.pseudoParent=t;var i=this.column.calculateClonedPaddingBorder(n);this.column.footnoteEdge=this.column.footnoteEdge-i;var r=this;this.column.openAllViews=function(t){return hl.prototype.openAllViews.call(this,t).thenAsync(function(t){return r.startNodeContexts.push(t.copy()),bi(t)})}}var e=t.prototype;return e.layout=function(t,e){return this.column.layout(t,e)},e.findAcceptableBreakPosition=function(t){var e=this.column.findAcceptableBreakPosition();if(t){var n=this.startNodeContexts[0].copy(),i=new ks(n,null,n.overflow,0);if(i.findAcceptableBreak(this.column,0),!e.nodeContext)return{breakPosition:i,nodeContext:n}}return e},e.finishBreak=function(t,e,n){return this.column.finishBreak(t,e,n)},e.doFinishBreakOfFragmentLayoutConstraints=function(t){this.column.doFinishBreakOfFragmentLayoutConstraints(t)},e.isStartNodeContext=function(t){var e=this.startNodeContexts[0];return e.viewNode===t.viewNode&&e.after===t.after&&e.offsetInNode===t.offsetInNode},e.isLastAfterNodeContext=function(t){return Wa(t.toNodePosition(),this.column.lastAfterPosition)},e.getColumnElement=function(){return this.column.element},e.getColumn=function(){return this.column},t}(),fl=/^[^A-Za-z0-9_\u009E\u009F\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02AF\u037B-\u037D\u0386\u0388-\u0482\u048A-\u0527]*([A-Za-z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02AF\u037B-\u037D\u0386\u0388-\u0482\u048A-\u0527][^A-Za-z0-9_\u009E\u009F\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02AF\u037B-\u037D\u0386\u0388-\u0482\u048A-\u0527]*)?/,dl=function(){function t(){}var e=t.prototype;return e.breakTextNode=function(t,e,n,i,r,o){if(e.after)e.offsetInNode=t.length;else{var a=n-e.boxOffset,s=t.data;(a=173==s.charCodeAt(a)?this.breakAfterSoftHyphen(t,s,a,e):this.breakAfterOtherCharacter(t,s,a,e))>0&&(e=this.updateNodeContext(e,a,t))}return e},e.breakAfterSoftHyphen=function(t,e,n,i){return t.replaceData(n,e.length-n,i.breakWord?"":pl(i)),n+1},e.breakAfterOtherCharacter=function(t,e,n,i){var r=e.charAt(n);n++;var o=e.charAt(n);return t.replaceData(n,e.length-n,!i.breakWord&&ot(r)&&ot(o)?pl(i):""),n},e.updateNodeContext=function(t,e,n){return(t=t.modify()).offsetInNode+=e,t.breakBefore=null,t},t}();function pl(t){return t.hyphenateCharacter||t.parent&&t.parent.hyphenateCharacter||"-"}dl.instance=new dl;var gl=function(t){function e(e,n){var i;return(i=t.call(this)||this).leadingEdge=e,i.initialPageBreakType=null,i.initialComputedBlockSize=0,i.initialOverflown=!1,i.context={overflownNodeContext:null},i.breakAfter=n||null,i}x(e,t);var n=e.prototype;return n.resolveLayoutMode=function(t){return new ml(this.leadingEdge,this.breakAfter,this.context)},n.prepareLayout=function(t,e){e.fragmentLayoutConstraints=[],e.pseudoParent||(Ks=[])},n.clearNodes=function(e){t.prototype.clearNodes.call(this,e);for(var n=e;n;){var i=n.viewNode;i&&Ps(i.parentNode,i),n=n.parent}},n.saveState=function(e,n){t.prototype.saveState.call(this,e,n),this.initialPageBreakType=n.pageBreakType,this.initialComputedBlockSize=n.computedBlockSize,this.initialOverflown=n.overflown},n.restoreState=function(e,n){t.prototype.restoreState.call(this,e,n),n.pageBreakType=this.initialPageBreakType,n.computedBlockSize=this.initialComputedBlockSize,n.overflown=this.initialOverflown},e}(Ws),ml=function(){function t(t,e,n){this.leadingEdge=t,this.breakAfter=e,this.context=n}var e=t.prototype;return e.doLayout=function(t,e){var n=this,i=Ni("DefaultLayoutMode.doLayout");return function(t,e){var n=Ni("processAfterIfContinuesOfAncestors"),i=t;return n.loop(function(){if(null!==i){var t=rl(i,e);return i=i.parent,t.thenReturn(!0)}return bi(!1)}).then(function(){n.finish(!0)}),n.result()}(t,e).then(function(){e.doLayout(t,n.leadingEdge,n.breakAfter).then(function(t){n.context.overflownNodeContext=t.overflownNodeContext,i.finish(t.nodeContext)})}),i.result()},e.accept=function(t,e){var n=this;return!(!e.pageFloatLayoutContext.isInvalidated()&&!e.pageBreakType)||e.fragmentLayoutConstraints.length<=0||e.fragmentLayoutConstraints.every(function(i){return i.allowLayout(t,n.context.overflownNodeContext,e)})},e.postLayout=function(t,e,n,i){if(!i){var r=n.fragmentLayoutConstraints.some(function(e){return e.nextCandidate(t)});i=!r}return n.fragmentLayoutConstraints.forEach(function(r){r.postLayout(i,t,e,n)}),i},t}(),vl=function(t){function e(e,n,i,r,o,a,s){var l;return(l=t.call(this,n,i,r,o,a)||this).floatSide=e,l.parentContainer=s,l.rootViewNodes=[],l.floatMargins=[],l.adjustContentRelativeSize=!0,l}x(e,t);var n=e.prototype;return n.openAllViews=function(e){var n=this;return t.prototype.openAllViews.call(this,e).thenAsync(function(t){return t&&n.fixFloatSizeAndPosition(t),bi(t)})},n.convertPercentageSizesToPx=function(t){var e=this.parentContainer.getPaddingRect(),n=e.x2-e.x1,i=e.y2-e.y1;function r(e,n){e.forEach(function(e){var i=$(t,e);if(i&&"%"===i.charAt(i.length-1)){var r=parseFloat(i);Z(t,e,n*r/100+"px")}})}r(["width","max-width","min-width"],n),r(["height","max-height","min-height"],i),r(["margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left"],this.vertical?i:n),["margin-top","margin-right","margin-bottom","margin-left"].forEach(function(e){"auto"===$(t,e)&&Z(t,e,"0")})},n.fixFloatSizeAndPosition=function(t){for(;t.parent;)t=t.parent;var e=t.viewNode;if(this.rootViewNodes.push(e),this.adjustContentRelativeSize&&this.convertPercentageSizesToPx(e),this.floatMargins.push(this.getComputedMargin(e)),this.adjustContentRelativeSize){var n=this.floatSide;if(this.parentContainer.vertical){if("block-end"===n||"left"===n){var i=$(e,"height");""!==i&&"auto"!==i&&Z(e,"margin-top","auto")}}else if("block-end"===n||"bottom"===n){var r=$(e,"width");""!==r&&"auto"!==r&&Z(e,"margin-left","auto")}}},n.getContentInlineSize=function(){var t=this;return Math.max.apply(null,this.rootViewNodes.map(function(e,n){var i=t.clientLayout.getElementClientRect(e),r=t.floatMargins[n];return t.vertical?r.top+i.height+r.bottom:r.left+i.width+r.right}))},e}(hl),El=function(){function t(t,e){this.parent=t,this.rootSourceNode=e,this.formattingContextType="RepetitiveElementsOwner",this.isRoot=!1,this.repetitiveElements=null}var e=t.prototype;return e.getName=function(){return"Repetitive elements owner formatting context (RepetitiveElementsOwnerFormattingContext)"},e.isFirstTime=function(t,e){return e},e.getParent=function(){return this.parent},e.getRepetitiveElements=function(){return this.repetitiveElements},e.getRootViewNode=function(t){var e=this.getRootNodeContext(t);return e?e.viewNode:null},e.getRootNodeContext=function(t){do{if(!t.belongsTo(this)&&t.sourceNode===this.rootSourceNode)return t}while(t=t.parent);return null},e.initializeRepetitiveElements=function(t){var e=this;this.repetitiveElements||Ks.some(function(t){return t.root===e.rootSourceNode&&(e.repetitiveElements=t.elements,!0)})||(this.repetitiveElements=new wl(t,this.rootSourceNode),Ks.push({root:this.rootSourceNode,elements:this.repetitiveElements}))},e.saveState=function(){},e.restoreState=function(t){},t}(),wl=function(){function t(t,e){this.vertical=t,this.ownerSourceNode=e,this.headerSourceNode=null,this.footerSourceNode=null,this.headerViewNode=null,this.footerViewNode=null,this.headerNodePosition=null,this.footerNodePosition=null,this.headerHeight=0,this.footerHeight=0,this.isSkipHeader=!1,this.isSkipFooter=!1,this.enableSkippingFooter=!0,this.enableSkippingHeader=!0,this.doneInitialLayout=!1,this.firstContentSourceNode=null,this.lastContentSourceNode=null,this.affectedNodeCache=[],this.afterLastContentNodeCache=[],this.allowInsert=!1}var e=t.prototype;return e.setHeaderNodeContext=function(t){this.headerNodePosition||(this.headerNodePosition=Xa(t,0),this.headerSourceNode=t.sourceNode,this.headerViewNode=t.viewNode)},e.setFooterNodeContext=function(t){this.footerNodePosition||(this.footerNodePosition=Xa(t,0),this.footerSourceNode=t.sourceNode,this.footerViewNode=t.viewNode)},e.updateHeight=function(t){this.headerViewNode&&(this.headerHeight=xs(this.headerViewNode,t,this.vertical),this.headerViewNode=null),this.footerViewNode&&(this.footerHeight=xs(this.footerViewNode,t,this.vertical),this.footerViewNode=null)},e.prepareLayoutFragment=function(){this.isSkipHeader=this.isSkipFooter=!1,this.enableSkippingFooter=!0,this.enableSkippingHeader=!0},e.appendHeaderToFragment=function(t,e,n){return!this.headerNodePosition||this.isSkipHeader?bi(!0):this.appendElementToFragment(this.headerNodePosition,t,e,n)},e.appendFooterToFragment=function(t,e,n){return!this.footerNodePosition||this.isSkipFooter?bi(!0):this.appendElementToFragment(this.footerNodePosition,t,e,n)},e.appendElementToFragment=function(t,e,n,i){var r=this,o=e.viewNode,a=e.viewNode.ownerDocument.createElement("div");o.appendChild(a);var s=new cl(i,a,e),l=s.getColumn().pageBreakType;return s.getColumn().pageBreakType=null,this.allowInsertRepeatitiveElements=!0,s.layout(new $a(t),!0).thenAsync(function(){return r.allowInsertRepeatitiveElements=!1,o.removeChild(a),r.moveChildren(a,o,n),s.getColumn().pageBreakType=l,bi(!0)})},e.moveChildren=function(t,e,n){if(e)for(;t.firstChild;){var i=t.firstChild;t.removeChild(i),i.setAttribute("data-adapt-spec","1"),n?e.insertBefore(i,n):e.appendChild(i)}},e.calculateOffset=function(t){var e=0;return t&&!this.affectTo(t)||((!this.isSkipFooter||t&&this.isAfterLastContent(t))&&(e+=this.footerHeight),this.isSkipHeader||(e+=this.headerHeight)),e},e.calculateMinimumOffset=function(t){var e=0;return t&&!this.affectTo(t)||(t&&this.isAfterLastContent(t)&&(e+=this.footerHeight),this.enableSkippingHeader||(e+=this.headerHeight)),e},e.isAfterLastContent=function(t){var e=this;return this.findResultFromCache(t,this.afterLastContentNodeCache,function(n){return e.isAfterNodeContextOf(e.lastContentSourceNode,t,!1)})},e.affectTo=function(t){var e=this;return this.findResultFromCache(t,this.affectedNodeCache,function(n){return e.isAfterNodeContextOf(e.ownerSourceNode,t,!0)})},e.findResultFromCache=function(t,e,n){var i=e.filter(function(e){return e.nodeContext.sourceNode===t.sourceNode&&e.nodeContext.after===t.after});if(i.length>0)return i[0].result;var r=n(t);return e.push({nodeContext:t,result:r}),r},e.isAfterNodeContextOf=function(t,e,n){for(var i=[],r=t;r;r=r.parentNode){if(e.sourceNode===r)return e.after;i.push(r)}for(var o=e.sourceNode;o;o=o.parentNode){var a=i.indexOf(o);if(a>=0)return!!n&&0===a;for(var s=o;s;s=s.previousElementSibling)if(i.includes(s))return!0}return e.after},e.isFirstContentNode=function(t){return t&&this.firstContentSourceNode===t.sourceNode},e.isEnableToUpdateState=function(){return!!(!this.isSkipFooter&&this.enableSkippingFooter&&this.footerNodePosition||!this.isSkipHeader&&this.enableSkippingHeader&&this.headerNodePosition)},e.updateState=function(){!this.isSkipFooter&&this.enableSkippingFooter&&this.footerNodePosition?this.isSkipFooter=!0:!this.isSkipHeader&&this.enableSkippingHeader&&this.headerNodePosition&&(this.isSkipHeader=!0)},e.preventSkippingHeader=function(){this.isSkipHeader=!1,this.enableSkippingHeader=!1},e.preventSkippingFooter=function(){this.isSkipFooter=!1,this.enableSkippingFooter=!1},e.isHeaderRegistered=function(){return!!this.headerNodePosition},e.isFooterRegistered=function(){return!!this.footerNodePosition},e.isHeaderSourceNode=function(t){return this.headerSourceNode===t},e.isFooterSourceNode=function(t){return this.footerSourceNode===t},t}(),yl=function(){function t(t){this.formattingContext=t}var e=t.prototype;return e.accept=function(t,e){return!!t},e.postLayout=function(t,e,n,i){var r=this.formattingContext.getRepetitiveElements();return r&&(r.doneInitialLayout||(r.updateHeight(n),r.doneInitialLayout=!0)),i},t}(),Nl=function(){function t(t){this.formattingContext=t}var e=t.prototype;return e.accept=function(t,e){return!0},e.postLayout=function(t,e,n,i){return i},t}(),bl=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).processor=n,i}x(e,t);var n=e.prototype;return n.doLayout=function(t,e){return this.processor.doInitialLayout(t,e)},n.accept=function(t,e){return!1},e}(yl),Sl=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).processor=n,i}return x(e,t),e.prototype.doLayout=function(t,e){return t.belongsTo(this.formattingContext)||t.after||e.fragmentLayoutConstraints.unshift(new Cl(t)),this.processor.doLayout(t,e)},e}(Nl),Cl=function(){function t(t){this.flagmentLayoutConstraintType="RepetitiveElementsOwner",this.nodeContext=t.formattingContext.getRootNodeContext(t)}var e=t.prototype;return e.allowLayout=function(t,e,n){var i=this.getRepetitiveElements();return!(i&&!Is(this.nodeContext.viewNode)&&i.isEnableToUpdateState()&&(e&&!t||t&&t.overflow))},e.nextCandidate=function(t){var e=this.getRepetitiveElements();return!!e&&!!e.isEnableToUpdateState()&&(e.updateState(),!0)},e.postLayout=function(t,e,n,i){var r=this.getRepetitiveElements();r&&t&&i.stopAtOverflow&&(null==e||r.isAfterLastContent(e))&&r.preventSkippingFooter()},e.finishBreak=function(t,e){var n=this.nodeContext.formattingContext,i=this.getRepetitiveElements();if(!i)return bi(!0);var r=this.nodeContext;return function(t,e,n){var i=t.getRepetitiveElements();if(i){var r=t.getRootNodeContext(e);if(r.viewNode)return i.appendHeaderToFragment(r,r.viewNode.firstChild,n)}return bi(!0)}(n,r,e).thenAsync(function(){return function(t,e,n){var i=t.getRepetitiveElements();if(i&&!i.isSkipFooter){var r=t.getRootNodeContext(e);if(r.viewNode)return i.appendFooterToFragment(r,null,n)}return bi(!0)}(n,r,e).thenAsync(function(){return i.prepareLayoutFragment(),bi(!0)})})},e.getRepetitiveElements=function(){return this.nodeContext.formattingContext.getRepetitiveElements()},e.equalsTo=function(e){return e instanceof t&&this.nodeContext.formattingContext===e.nodeContext.formattingContext},e.getPriorityOfFinishBreak=function(){return 10},t}(),Tl=function(t){function e(e,n){var i;return(i=t.call(this)||this).formattingContext=e,i.processor=n,i}return x(e,t),e.prototype.resolveLayoutMode=function(t){var e=this.formattingContext.getRepetitiveElements();return t.belongsTo(this.formattingContext)||e.doneInitialLayout?(t.belongsTo(this.formattingContext)||t.after||e&&e.preventSkippingHeader(),new Sl(this.formattingContext,this.processor)):new bl(this.formattingContext,this.processor)},e}(Ws),xl=function(t){function e(e,n){var i;return(i=t.call(this)||this).formattingContext=e,i.column=n,i}x(e,t);var n=e.prototype;return n.startNonInlineElementNode=function(t){var e=this.formattingContext,n=t.nodeContext,i=e.getRepetitiveElements();if(n.parent&&e.rootSourceNode===n.parent.sourceNode){switch(n.repeatOnBreak){case"header":if(!i.isHeaderRegistered())return i.setHeaderNodeContext(n),bi(!0);n.repeatOnBreak="none";break;case"footer":if(!i.isFooterRegistered())return i.setFooterNodeContext(n),bi(!0);n.repeatOnBreak="none"}i.firstContentSourceNode||(i.firstContentSourceNode=n.sourceNode)}return Ys.prototype.startNonInlineElementNode.call(this,t)},n.afterNonInlineElementNode=function(t){var e=this.formattingContext,n=t.nodeContext;return n.sourceNode===e.rootSourceNode&&(e.getRepetitiveElements().lastContentSourceNode=t.lastAfterNodeContext&&t.lastAfterNodeContext.sourceNode,t.break=!0),"header"===n.repeatOnBreak||"footer"===n.repeatOnBreak?bi(!0):Ys.prototype.afterNonInlineElementNode.call(this,t)},e}(Ys);function Il(t,e){t&&function(t,e){for(var n=t;n;n=n.parent){var i=n.formattingContext;i&&i instanceof El&&!n.belongsTo(i)&&e(i,n)}}(t.after?t.parent:t,function(t,n){ba.isInstanceOfTableFormattingContext(t)||e.fragmentLayoutConstraints.push(new Cl(n))})}var Pl=new(function(t){function e(){return t.apply(this,arguments)||this}x(e,t);var n=e.prototype;return n.layout=function(t,e,n){if(e.isFloatNodeContext(t))return e.layoutFloatOrFootnote(t);var i=t.formattingContext;return i.getRootViewNode(t)?(n&&Il(t.parent,e),t.belongsTo(i)?Vs.prototype.layout.call(this,t,e,n):new Tl(i,this).layout(t,e)):e.buildDeepElementView(t)},n.startNonInlineElementNode=function(t){var e=function(t){var e=t.formattingContext;return e&&e instanceof El?e:null}(t).getRepetitiveElements();return!!e&&(e.allowInsertRepeatitiveElements||!e.isHeaderSourceNode(t.sourceNode)&&!e.isFooterSourceNode(t.sourceNode)||t.viewNode.parentNode.removeChild(t.viewNode),!1)},n.doInitialLayout=function(t,e){var n=Ni("BlockLayoutProcessor.doInitialLayout");return this.layoutEntireBlock(t,e).thenFinish(n),n.result()},n.layoutEntireBlock=function(t,e){var n=new xl(t.formattingContext,e);return new js(n,e.layoutContext).iterate(t)},n.doLayout=function(t,e){var n=t.formattingContext,i=Ni("doLayout");return ol(e.layoutContext.nextInTree(t,!1),e).then(function(t){var r=t;i.loopWithFrame(function(t){for(var i=function(){var i=!0;if(e.layoutNext(r,!1).then(function(o){r=o,e.pageFloatLayoutContext.isInvalidated()||e.pageBreakType||r&&e.stopByOverflow(r)||r&&r.after&&r.sourceNode==n.rootSourceNode?t.breakLoop():i?i=!1:t.continueLoop()}),i)return i=!1,{v:void 0}};r;){var o=i();if("object"==typeof o)return o.v}t.breakLoop()}).then(function(){i.finish(r)})}),i.result()},n.finishBreak=function(t,e,n,i){return Vs.prototype.finishBreak.call(this,t,e,n,i)},n.clearOverflownViewNodes=function(t,e,n,i){Vs.prototype.clearOverflownViewNodes(t,e,n,i)},e}(Vs));f(exports.HOOKS.RESOLVE_LAYOUT_PROCESSOR,function(t){return t instanceof El&&!ba.isInstanceOfTableFormattingContext(t)?Pl:null});var Rl=function(){function t(t,e){this.rowIndex=t,this.sourceNode=e,this.cells=[]}var e=t.prototype;return e.addCell=function(t){this.cells.push(t)},e.getMinimumHeight=function(){return Math.min.apply(null,this.cells.map(function(t){return t.height}))},t}(),Al=function(){function t(t,e,n){this.rowIndex=t,this.columnIndex=e,this.height=0,this.anchorSlot=null,this.viewElement=n,this.colSpan=n.colSpan||1,this.rowSpan=n.rowSpan||1}var e=t.prototype;return e.setHeight=function(t){this.height=t},e.setAnchorSlot=function(t){this.anchorSlot=t},t}(),Ll=function(t,e,n){this.rowIndex=t,this.columnIndex=e,this.cell=n},Ol=function(){function t(t,e,n){this.column=t,this.cellNodeContext=n,this.empty=!1,this.pseudoColumn=new cl(t,e,n)}return t.prototype.findAcceptableBreakPosition=function(){var t=this.cellNodeContext.viewNode,e=this.cellNodeContext.verticalAlign;"middle"!==e&&"bottom"!==e||Z(t,"vertical-align","top");var n=this.pseudoColumn.findAcceptableBreakPosition(!0);return Z(t,"vertical-align",e),n},t}(),kl=function(t,e){this.viewNode=t,this.side=e},Dl=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e,n,i,r)||this).acceptableCellBreakPositions=null,o.rowIndex=null,o.formattingContext=e.formattingContext,o}x(e,t);var n=e.prototype;return n.findAcceptableBreak=function(e,n){var i=t.prototype.findAcceptableBreak.call(this,e,n);return n<this.getMinBreakPenalty()?null:this.getAcceptableCellBreakPositions().every(function(t){return!!t.nodeContext})?i:null},n.getMinBreakPenalty=function(){var e=t.prototype.getMinBreakPenalty.call(this);return this.getAcceptableCellBreakPositions().forEach(function(t){e+=t.breakPosition.getMinBreakPenalty()}),e},n.getAcceptableCellBreakPositions=function(){if(!this.acceptableCellBreakPositions){var t=this.getCellFragments();this.acceptableCellBreakPositions=t.map(function(t){return t.findAcceptableBreakPosition()})}return this.acceptableCellBreakPositions},n.getRowIndex=function(){return null!=this.rowIndex?this.rowIndex:this.rowIndex=this.formattingContext.findRowIndexBySourceNode(this.position.sourceNode)},n.getCellFragments=function(){return this.formattingContext.getRowSpanningCellsOverflowingTheRow(this.getRowIndex()).map(this.formattingContext.getCellFragmentOfCell,this.formattingContext)},e}(ks),Fl=function(t){function e(e,n,i){var r;return(r=t.call(this)||this).rowIndex=e,r.beforeNodeContext=n,r.formattingContext=i,r.acceptableCellBreakPositions=null,r}x(e,t);var n=e.prototype;return n.findAcceptableBreak=function(t,e){if(e<this.getMinBreakPenalty())return null;var n=this.getCellFragments(),i=this.getAcceptableCellBreakPositions(),r=i.every(function(t){return!!t.nodeContext})&&i.some(function(t,e){var i=n[e].pseudoColumn,r=t.nodeContext;return!i.isStartNodeContext(r)&&!i.isLastAfterNodeContext(r)});return this.beforeNodeContext.overflow=i.some(function(t){return t.nodeContext&&t.nodeContext.overflow}),r?this.beforeNodeContext:null},n.getMinBreakPenalty=function(){var t=this.formattingContext,e=t.getRowByIndex(this.rowIndex),n=0;return t.isFreelyFragmentableRow(e)||(n+=10),this.getAcceptableCellBreakPositions().forEach(function(t){n+=t.breakPosition.getMinBreakPenalty()}),n},n.getAcceptableCellBreakPositions=function(){if(!this.acceptableCellBreakPositions){var t=this.getCellFragments();this.acceptableCellBreakPositions=t.map(function(t){return t.findAcceptableBreakPosition()})}return this.acceptableCellBreakPositions},n.getCellFragments=function(){return this.formattingContext.getCellsFallingOnRow(this.rowIndex).map(this.formattingContext.getCellFragmentOfCell,this.formattingContext)},e}(Ls),_l=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).tableSourceNode=n,i.formattingContextType="Table",i.vertical=!1,i.columnCount=-1,i.tableWidth=0,i.captions=[],i.colGroups=null,i.colWidths=null,i.inlineBorderSpacing=0,i.rows=[],i.slots=[],i.cellFragments=[],i.lastRowViewNode=null,i.cellBreakPositions=[],i.repetitiveElements=null,i}x(e,t);var n=e.prototype;return n.getName=function(){return"Table formatting context (Table.TableFormattingContext)"},n.isFirstTime=function(t,e){if(!e)return e;switch(t.display){case"table-row":return 0===this.cellBreakPositions.length;case"table-cell":return!this.cellBreakPositions.some(function(e){return e.cellNodePosition.steps[0].node===t.sourceNode});default:return e}},n.getParent=function(){return this.parent},n.finishFragment=function(){this.cellFragments=[]},n.addRow=function(t,e){this.rows[t]=e},n.getRowSlots=function(t){var e=this.slots[t];return e||(e=this.slots[t]=[]),e},n.addCell=function(t,e){var n=this.rows[t];n||(this.addRow(t,new Rl(t,null)),n=this.rows[t]),n.addCell(e);for(var i=t+e.rowSpan,r=this.getRowSlots(t),o=0;r[o];)o++;for(;t<i;t++){r=this.getRowSlots(t);for(var a=o;a<o+e.colSpan;a++){var s=r[a]=new Ll(t,a,e);e.anchorSlot||e.setAnchorSlot(s)}}},n.getRowByIndex=function(t){return this.rows[t]},n.findRowIndexBySourceNode=function(t){return this.rows.findIndex(function(e){return t===e.sourceNode})},n.addCellFragment=function(t,e,n){var i=this.cellFragments[t];i||(i=this.cellFragments[t]=[]),i[e]=n},n.getCellsFallingOnRow=function(t){return this.getRowSlots(t).reduce(function(t,e){return e.cell!==t[t.length-1]?t.concat(e.cell):t},[])},n.getRowSpanningCellsOverflowingTheRow=function(t){return this.getCellsFallingOnRow(t).filter(function(e){return e.rowIndex+e.rowSpan-1>t})},n.getCellFragmentOfCell=function(t){return this.cellFragments[t.rowIndex]&&this.cellFragments[t.rowIndex][t.columnIndex]},n.isFreelyFragmentableRow=function(t){return t.getMinimumHeight()>this.tableWidth/2},n.getColumnCount=function(){return this.columnCount<0&&(this.columnCount=Math.max.apply(null,this.rows.map(function(t){return t.cells.reduce(function(t,e){return t+e.colSpan},0)}))),this.columnCount},n.updateCellSizes=function(t){var e=this;this.rows.forEach(function(n){n.cells.forEach(function(n){var i=t.getElementClientRect(n.viewElement);n.viewElement=null,n.setHeight(e.vertical?i.width:i.height)})})},n.findCellFromColumn=function(t){if(!t)return null;var e=null,n=0,i=0;t:for(n=0;n<this.cellFragments.length;n++)if(this.cellFragments[n])for(i=0;i<this.cellFragments[n].length;i++)if(this.cellFragments[n][i]&&t===this.cellFragments[n][i].pseudoColumn.getColumn()){e=this.rows[n].cells[i];break t}if(!e)return null;for(;n<this.slots.length;n++)for(;i<this.slots[n].length;i++){var r=this.slots[n][i];if(r.cell===e)return{rowIndex:r.rowIndex,columnIndex:r.columnIndex}}return null},n.collectElementsOffsetOfUpperCells=function(t){var e=this,n=[];return this.slots.reduce(function(i,r,o){if(o>=t.rowIndex)return i;var a=r[t.columnIndex]&&e.getCellFragmentOfCell(r[t.columnIndex].cell);return!a||n.includes(a)||(e.collectElementsOffsetFromColumn(a.pseudoColumn.getColumn(),i),n.push(a)),i},[])},n.collectElementsOffsetOfHighestColumn=function(){var t=this,e=[];return this.rows.forEach(function(n){n.cells.forEach(function(n,i){e[i]||(e[i]={collected:[],elements:[]});var r=e[i],o=t.getCellFragmentOfCell(n);o&&!r.collected.includes(o)&&(t.collectElementsOffsetFromColumn(o.pseudoColumn.getColumn(),r.elements),r.collected.push(o))})}),[new Bl(e.map(function(t){return t.elements}))]},n.collectElementsOffsetFromColumn=function(t,e){t.fragmentLayoutConstraints.forEach(function(t){if(Na.isInstanceOfRepetitiveElementsOwnerLayoutConstraint(t)){var n=t.getRepetitiveElements();e.push(n)}ba.isInstanceOfTableRowLayoutConstraint(t)&&t.getElementsOffsetsForTableCell(null).forEach(function(t){e.push(t)})})},n.saveState=function(){return[].concat(this.cellBreakPositions)},n.restoreState=function(t){this.cellBreakPositions=t},e}(El),Bl=function(){function t(t){this.repeatitiveElementsInColumns=t}var e=t.prototype;return e.calculateOffset=function(t){return this.calculateMaxOffsetOfColumn(t,function(t){return t.current})},e.calculateMinimumOffset=function(t){return this.calculateMaxOffsetOfColumn(t,function(t){return t.minimum})},e.calculateMaxOffsetOfColumn=function(t,e){var n=0;return this.repeatitiveElementsInColumns.forEach(function(i){var r=Os(t,i);n=Math.max(n,e(r))}),n},t}();function Ml(t){return function(t){return"table-row-group"===t||"table-header-group"===t||"table-footer-group"===t}(t)||function(t){return"table"===t||"inline-table"===t}(t)}function Ul(t,e,n){var i=t.nodeContext,r=i.display,o=i.parent?i.parent.display:null,a=!1;if("inline-table"===o&&!(i.formattingContext instanceof _l))for(var s=i.parent;s;s=s.parent)if(s.formattingContext instanceof _l){a=s.formattingContext===e;break}return a||"table-row"===r&&!Ml(o)||"table-cell"===r&&"table-row"!==o&&!Ml(o)||i.formattingContext instanceof _l&&i.formattingContext!==e?n.buildDeepElementView(i).thenAsync(function(e){return t.nodeContext=e,bi(!0)}):null}var Vl=function(t){function e(e,n){var i;return(i=t.call(this)||this).formattingContext=e,i.column=n,i.rowIndex=-1,i.columnIndex=0,i.inRow=!1,i.checkPoints=[],i.inHeaderOrFooter=!1,i}x(e,t);var n=e.prototype;return n.startNonInlineElementNode=function(e){var n=this.formattingContext,i=Ul(e,n,this.column);if(i)return i;this.postLayoutBlockContents(e);var r=e.nodeContext,o=r.display,a=n.getRepetitiveElements();switch(o){case"table":n.inlineBorderSpacing=r.inlineBorderSpacing;break;case"table-caption":var s=new kl(r.viewNode,r.captionSide);n.captions.push(s);break;case"table-header-group":return a.isHeaderRegistered()||(this.inHeaderOrFooter=!0,a.setHeaderNodeContext(r)),bi(!0);case"table-footer-group":return a.isFooterRegistered()||(this.inHeaderOrFooter=!0,a.setFooterNodeContext(r)),bi(!0);case"table-row":this.inHeaderOrFooter||(this.inRow=!0,this.rowIndex++,this.columnIndex=0,n.addRow(this.rowIndex,new Rl(this.rowIndex,r.sourceNode)),a.firstContentSourceNode||(a.firstContentSourceNode=r.sourceNode))}return t.prototype.startNonInlineElementNode.call(this,e)},n.afterNonInlineElementNode=function(e){var n=this.formattingContext,i=e.nodeContext,r=i.display,o=this.column.clientLayout;if(this.postLayoutBlockContents(e),i.sourceNode===n.tableSourceNode){var a=o.getElementComputedStyle(n.getRootViewNode(i));n.tableWidth=parseFloat(a[n.vertical?"height":"width"]),n.getRepetitiveElements().lastContentSourceNode=e.lastAfterNodeContext&&e.lastAfterNodeContext.sourceNode,e.break=!0}else switch(r){case"table-header-group":case"table-footer-group":if(this.inHeaderOrFooter)return this.inHeaderOrFooter=!1,bi(!0);break;case"table-row":this.inHeaderOrFooter||(n.lastRowViewNode=i.viewNode,this.inRow=!1);break;case"table-cell":this.inHeaderOrFooter||(this.inRow||(this.rowIndex++,this.columnIndex=0,this.inRow=!0),n.addCell(this.rowIndex,new Al(this.rowIndex,this.columnIndex,i.viewNode)),this.columnIndex++)}return t.prototype.afterNonInlineElementNode.call(this,e)},n.startNonElementNode=function(t){this.registerCheckPoint(t)},n.afterNonElementNode=function(t){this.registerCheckPoint(t)},n.startInlineElementNode=function(t){this.registerCheckPoint(t)},n.afterInlineElementNode=function(t){this.registerCheckPoint(t)},n.registerCheckPoint=function(t){var e=t.nodeContext;e&&e.viewNode&&!As(e)&&this.checkPoints.push(e.clone())},n.postLayoutBlockContents=function(t){this.checkPoints.length>0&&this.column.postLayoutBlock(t.nodeContext,this.checkPoints),this.checkPoints=[]},e}(Ys),Hl=function(t){function e(e,n){var i;return(i=t.call(this,!0)||this).formattingContext=e,i.column=n,i.inRow=!1,i.currentRowIndex=-1,i.currentColumnIndex=0,i.originalStopAtOverflow=n.stopAtOverflow,n.stopAtOverflow=!1,i}x(e,t);var n=e.prototype;return n.resetColumn=function(){this.column.stopAtOverflow=this.originalStopAtOverflow},n.getColSpanningCellWidth=function(t){for(var e=this.formattingContext.colWidths,n=0,i=0;i<t.colSpan;i++)n+=e[t.anchorSlot.columnIndex+i];return n+this.formattingContext.inlineBorderSpacing*(t.colSpan-1)},n.layoutCell=function(t,e,n){var i=t.rowIndex,r=t.columnIndex,o=e.viewNode;t.colSpan>1&&(Z(o,"box-sizing","border-box"),Z(o,this.formattingContext.vertical?"height":"width",this.getColSpanningCellWidth(t)+"px"));var a=o.ownerDocument.createElement("div");o.appendChild(a);var s=new Ol(this.column,a,e);return this.formattingContext.addCellFragment(i,r,s),1===n.primary.steps.length&&n.primary.after&&(s.empty=!0),s.pseudoColumn.layout(n,!0).thenReturn(!0)},n.hasBrokenCellAtSlot=function(t){var e=this.formattingContext.cellBreakPositions[0];return!!e&&e.cell.anchorSlot.columnIndex===t},n.extractRowSpanningCellBreakPositions=function(){var t=this.formattingContext.cellBreakPositions;if(0===t.length)return[];var e=[],n=0;do{var i=t[n],r=i.cell.rowIndex;if(r<this.currentRowIndex){var o=e[r];o||(o=e[r]=[]),o.push(i),t.splice(n,1)}else n++}while(n<t.length);return e},n.layoutRowSpanningCellsFromPreviousFragment=function(t){var e=this,n=this.formattingContext,i=this.extractRowSpanningCellBreakPositions(),r=i.reduce(function(t){return t+1},0);if(0===r)return bi(!0);var o=this.column.layoutContext,a=t.nodeContext;a.viewNode.parentNode.removeChild(a.viewNode);var s=Ni("layoutRowSpanningCellsFromPreviousFragment"),l=bi(!0),u=0,h=[];return i.forEach(function(t){l=l.thenAsync(function(){var i=ja(t[0].cellNodePosition.steps[1],a.parent);return o.setCurrent(i,!1).thenAsync(function(){var a=bi(!0),s=0;function l(t){for(;s<t;){if(!h.includes(s)){var e=i.viewNode.ownerDocument.createElement("td");Z(e,"padding","0"),i.viewNode.appendChild(e)}s++}}return t.forEach(function(t){a=a.thenAsync(function(){var n=t.cell;l(n.anchorSlot.columnIndex);var a=t.cellNodePosition,c=ja(a.steps[0],i);return c.offsetInNode=a.offsetInNode,c.after=a.after,c.fragmentIndex=a.steps[0].fragmentIndex+1,o.setCurrent(c,!1).thenAsync(function(){for(var i=t.breakChunkPosition,o=0;o<n.colSpan;o++)h.push(s+o);return s+=n.colSpan,e.layoutCell(n,c,i).thenAsync(function(){return c.viewNode.rowSpan=n.rowIndex+n.rowSpan-e.currentRowIndex+r-u,bi(!0)})})})}),a.thenAsync(function(){return l(n.getColumnCount()),u++,bi(!0)})})})}),l.then(function(){o.setCurrent(a,!0,t.atUnforcedBreak).then(function(){s.finish(!0)})}),s.result()},n.startTableRow=function(t){var e=this;if(this.inHeader||this.inFooter)return bi(!0);var n=t.nodeContext,i=this.formattingContext;return this.currentRowIndex<0?this.currentRowIndex=i.findRowIndexBySourceNode(n.sourceNode):this.currentRowIndex++,this.currentColumnIndex=0,this.inRow=!0,this.layoutRowSpanningCellsFromPreviousFragment(t).thenAsync(function(){return e.registerCellFragmentIndex(),e.column.checkOverflowAndSaveEdgeAndBreakPosition(t.lastAfterNodeContext,null,!0,t.breakAtTheEdge)&&0===i.getRowSpanningCellsOverflowingTheRow(e.currentRowIndex-1).length&&(e.resetColumn(),n.overflow=!0,t.break=!0),bi(!0)})},n.registerCellFragmentIndex=function(){var t=this;this.formattingContext.getRowByIndex(this.currentRowIndex).cells.forEach(function(e){var n=t.formattingContext.cellBreakPositions[e.columnIndex];if(n&&n.cell.anchorSlot.columnIndex==e.anchorSlot.columnIndex){var i=n.cellNodePosition.steps[0],r=t.column.layoutContext.xmldoc.getElementOffset(i.node);tl(r,i.fragmentIndex+1,1)}})},n.startTableCell=function(t){var e=this;if(this.inHeader||this.inFooter)return bi(!0);var n=t.nodeContext;this.inRow||(this.currentRowIndex<0?this.currentRowIndex=0:this.currentRowIndex++,this.currentColumnIndex=0,this.inRow=!0);var i=this.formattingContext.getRowByIndex(this.currentRowIndex).cells[this.currentColumnIndex],r=n.copy().modify();r.after=!0,t.nodeContext=r;var o,a=Ni("startTableCell");if(this.hasBrokenCellAtSlot(i.anchorSlot.columnIndex)){var s=this.formattingContext.cellBreakPositions.shift();n.fragmentIndex=s.cellNodePosition.steps[0].fragmentIndex+1,o=bi(s.breakChunkPosition)}else o=this.column.nextInTree(n,t.atUnforcedBreak).thenAsync(function(t){t.viewNode&&n.viewNode.removeChild(t.viewNode);var e=Xa(t,0);return bi(new $a(e))});return o.then(function(r){e.layoutCell(i,n,r).then(function(){e.afterNonInlineElementNode(t),e.currentColumnIndex++,a.finish(!0)})}),a.result()},n.startNonInlineBox=function(t){var e=Ul(t,this.formattingContext,this.column);if(e)return e;var n=t.nodeContext,i=this.formattingContext.getRepetitiveElements(),r=n.display;return"table-header-group"===r&&i&&i.isHeaderSourceNode(n.sourceNode)?(this.inHeader=!0,bi(!0)):"table-footer-group"===r&&i&&i.isFooterSourceNode(n.sourceNode)?(this.inFooter=!0,bi(!0)):"table-row"===r?this.startTableRow(t):"table-cell"===r?this.startTableCell(t):bi(!0)},n.endNonInlineBox=function(t){var e=t.nodeContext;if("table-row"===e.display&&(this.inRow=!1,!this.inHeader&&!this.inFooter)){var n=e.copy().modify();n.after=!1;var i=new Fl(this.currentRowIndex,n,this.formattingContext);this.column.breakPositions.push(i)}return bi(!0)},n.afterNonInlineElementNode=function(n){var i=n.nodeContext,r=this.formattingContext.getRepetitiveElements(),o=i.display;if("table-header-group"===o?r&&!r.allowInsertRepeatitiveElements&&r.isHeaderSourceNode(i.sourceNode)?(this.inHeader=!1,i.viewNode.parentNode.removeChild(i.viewNode)):Z(i.viewNode,"display","table-row-group"):"table-footer-group"===o&&(r&&!r.allowInsertRepeatitiveElements&&r.isFooterSourceNode(i.sourceNode)?(this.inFooter=!1,i.viewNode.parentNode.removeChild(i.viewNode)):Z(i.viewNode,"display","table-row-group")),o&&e.ignoreList[o])i.viewNode.parentNode.removeChild(i.viewNode);else{if(i.sourceNode!==this.formattingContext.tableSourceNode)return t.prototype.afterNonInlineElementNode.call(this,n);i.overflow=this.column.checkOverflowAndSaveEdge(i,null),this.resetColumn(),n.break=!0}return bi(!0)},e}(Ys);Hl.ignoreList={"table-caption":!0,"table-column-group":!0,"table-column":!0};var zl=[],Gl=function(){function t(){}var e=t.prototype;return e.layoutEntireTable=function(t,e){var n=new Vl(t.formattingContext,e);return new js(n,e.layoutContext).iterate(t)},e.getColumnWidths=function(t,e,n,i){for(var r=t.ownerDocument,o=r.createElement("tr"),a=[],s=0;s<e;s++){var l=r.createElement("td");o.appendChild(l),a.push(l)}t.parentNode.insertBefore(o,t.nextSibling);var u=a.map(function(t){var e=i.getElementClientRect(t);return n?e.height:e.width});return t.parentNode.removeChild(o),u},e.getColGroupElements=function(t){for(var e=[],n=t.firstElementChild;n;)"colgroup"===n.localName&&e.push(n),n=n.nextElementSibling;return e},e.normalizeAndGetColElements=function(t){var e=[];return t.forEach(function(t){var n=t.span;t.removeAttribute("span");for(var i=t.firstElementChild;i;){if("col"===i.localName){var r=i.span;for(i.removeAttribute("span"),n-=r;r-- >1;){var o=i.cloneNode(!0);t.insertBefore(o,i),e.push(o)}e.push(i)}i=i.nextElementSibling}for(;n-- >0;)i=t.ownerDocument.createElement("col"),t.appendChild(i),e.push(i)}),e},e.addMissingColElements=function(t,e,n,i){if(t.length<n){var r=i.ownerDocument.createElement("colgroup");e.push(r);for(var o=t.length;o<n;o++){var a=i.ownerDocument.createElement("col");r.appendChild(a),t.push(a)}}},e.normalizeColGroups=function(t,e,n){var i=t.vertical,r=t.lastRowViewNode;if(r){t.lastRowViewNode=null;var o=r.ownerDocument.createDocumentFragment(),a=t.getColumnCount();if(a>0){var s=t.colWidths=this.getColumnWidths(r,a,i,n.clientLayout),l=this.getColGroupElements(e),u=this.normalizeAndGetColElements(l);this.addMissingColElements(u,l,a,e),u.forEach(function(t,e){Z(t,i?"height":"width",s[e]+"px")}),l.forEach(function(t){o.appendChild(t.cloneNode(!0))}),t.colGroups=o}else t.colGroups=o}},e.doInitialLayout=function(t,e){var n=this,i=t.formattingContext;i.vertical=t.vertical,i.initializeRepetitiveElements(t.vertical);var r,o,a,s=(r=t.sourceNode,o=zl.findIndex(function(t){return t.root===r}),(a=zl[o])?a.tableLayoutOption:null);!function(t){var e=zl.findIndex(function(e){return e.root===t});e>=0&&zl.splice(e,1)}(t.sourceNode);var l=Ni("TableLayoutProcessor.doInitialLayout"),u=t.copy();return this.layoutEntireTable(t,e).then(function(r){var o=r.viewNode,a=e.clientLayout.getElementClientRect(o),h=e.vertical?a.left:a.bottom;if(h+=(e.vertical?-1:1)*Os(t,e.collectElementsOffset()).current,!(e.isOverflown(h)||s&&s.calculateBreakPositionsInside))return e.breakPositions.push(new jl(u)),void l.finish(r);n.normalizeColGroups(i,o,e),i.updateCellSizes(e.clientLayout),l.finish(null)}),l.result()},e.addCaptions=function(t,e,n){var i=t.captions;i.forEach(function(t,r){t&&(e.insertBefore(t.viewNode,n),"top"===t.side&&(i[r]=null))})},e.addColGroups=function(t,e,n){t.colGroups&&0===this.getColGroupElements(e).length&&e.insertBefore(t.colGroups.cloneNode(!0),n)},e.removeColGroups=function(t,e){if(t.colGroups&&e){var n=this.getColGroupElements(e);n&&n.forEach(function(t){e.removeChild(t)})}},e.doLayout=function(t,e){var n=t.formattingContext,i=n.getRootViewNode(t),r=i.firstChild;this.addCaptions(n,i,r),this.addColGroups(n,i,r);var o=new Hl(n,e),a=new js(o,e.layoutContext),s=Ni("TableFormattingContext.doLayout");return a.iterate(t).thenFinish(s),s.result()},e.layout=function(t,e,n){var i=t.formattingContext;return i.getRootViewNode(t)?(n&&Il(t.parent,e),new Wl(i,this).layout(t,e)):e.buildDeepElementView(t)},e.createEdgeBreakPosition=function(t,e,n,i){return new Dl(t,e,n,i)},e.startNonInlineElementNode=function(t){return!1},e.afterNonInlineElementNode=function(t,e){return!1},e.finishBreak=function(t,e,n,i){var r=e.formattingContext;if("table-row"===e.display){var o,a=r.findRowIndexBySourceNode(e.sourceNode);if(r.cellBreakPositions=[],(o=e.after?r.getRowSpanningCellsOverflowingTheRow(a):r.getCellsFallingOnRow(a)).length){var s=Ni("TableLayoutProcessor.finishBreak"),l=0;return s.loopWithFrame(function(t){if(l!==o.length){var e=o[l++],n=r.getCellFragmentOfCell(e),i=n.findAcceptableBreakPosition().nodeContext,s=n.cellNodeContext,u=s.toNodePosition(),h=new $a(i.toNodePosition());r.cellBreakPositions.push({cellNodePosition:u,breakChunkPosition:h,cell:e});var c=s.viewNode;n.column.layoutContext.processFragmentedBlockEdge(n.cellNodeContext),a<e.rowIndex+e.rowSpan-1&&(c.rowSpan=a-e.rowIndex+1),n.empty?t.continueLoop():n.pseudoColumn.finishBreak(i,!1,!0).then(function(){!function(t,e,n){var i=e.getRepetitiveElements();if(i){var r=e.vertical,o=t.column,a=t.pseudoColumn.getColumnElement(),s=t.cellNodeContext.viewNode,l=o.clientLayout.getElementClientRect(s),u=o.getComputedPaddingBorder(s);r?Z(a,"max-width",l.right-o.footnoteEdge-i.calculateOffset(n)-u.right+"px"):Z(a,"max-height",o.footnoteEdge-i.calculateOffset(n)-l.top-u.top+"px"),Z(a,"overflow","hidden")}}(n,r,i),t.continueLoop()})}else t.breakLoop()}).then(function(){t.clearOverflownViewNodes(e,!1),t.layoutContext.processFragmentedBlockEdge(e),r.finishFragment(),s.finish(!0)}),s.result()}}return r.finishFragment(),zs.finishBreak(t,e,n,i)},e.clearOverflownViewNodes=function(t,e,n,i){Vs.prototype.clearOverflownViewNodes(t,e,n,i)},t}(),Wl=function(t){function e(e,n){var i;return(i=t.call(this)||this).tableFormattingContext=e,i.processor=n,i}x(e,t);var n=e.prototype;return n.resolveLayoutMode=function(t){var e=this.tableFormattingContext.getRepetitiveElements();return e&&e.doneInitialLayout?(t.sourceNode!==this.tableFormattingContext.tableSourceNode||t.after||e&&e.preventSkippingHeader(),new Kl(this.tableFormattingContext,this.processor)):new Xl(this.tableFormattingContext,this.processor)},n.clearNodes=function(e){t.prototype.clearNodes.call(this,e);var n=this.tableFormattingContext.getRootViewNode(e);this.processor.removeColGroups(this.tableFormattingContext,n)},n.restoreState=function(e,n){t.prototype.restoreState.call(this,e,n),this.tableFormattingContext.finishFragment()},e}(Ws),Xl=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).processor=n,i}return x(e,t),e.prototype.doLayout=function(t,e){return this.processor.doInitialLayout(t,e)},e}(yl),jl=function(t){function e(e){return t.call(this,e,null,e.overflow,0)||this}x(e,t);var n=e.prototype;return n.getMinBreakPenalty=function(){if(!this.isEdgeUpdated)throw new Error("EdgeBreakPosition.prototype.updateEdge not called");return(this.overflows?3:0)+(this.position.parent?this.position.parent.breakPenalty:0)},n.breakPositionChosen=function(t){t.fragmentLayoutConstraints.push(new Yl(this.position.sourceNode))},e}(ks),Yl=function(){function t(t){this.tableRootNode=t,this.flagmentLayoutConstraintType="EntireTable"}var e=t.prototype;return e.allowLayout=function(t,e,n){return!1},e.nextCandidate=function(t){return!0},e.postLayout=function(t,e,n,i){zl.push({root:e.sourceNode,tableLayoutOption:{calculateBreakPositionsInside:!0}})},e.finishBreak=function(t,e){return bi(!0)},e.equalsTo=function(e){return e instanceof t&&e.tableRootNode===this.tableRootNode},e.getPriorityOfFinishBreak=function(){return 0},t}(),Kl=function(t){function e(e,n){var i;return(i=t.call(this,e)||this).processor=n,i}return x(e,t),e.prototype.doLayout=function(t,e){var n=this.formattingContext.getRepetitiveElements();if(n&&!n.isAfterLastContent(t)){var i=new ql(t);e.fragmentLayoutConstraints.some(function(t){return i.equalsTo(t)})||e.fragmentLayoutConstraints.unshift(i)}return this.processor.doLayout(t,e)},e}(Nl),ql=function(t){function e(e){var n;return(n=t.call(this,e)||this).flagmentLayoutConstraintType="TableRow",n.cellFragmentLayoutConstraints=[],n}x(e,t);var n=e.prototype;return n.allowLayout=function(t,e,n){var i=this.getRepetitiveElements();return!(i&&!n.pseudoParent&&!Is(this.nodeContext.viewNode)&&i.isEnableToUpdateState()&&(e&&!t||t&&t.overflow))},n.nextCandidate=function(e){return!!this.collectCellFragmentLayoutConstraints(e,this.nodeContext.formattingContext).some(function(t){return t.constraints.some(function(t){return t.nextCandidate(e)})})||t.prototype.nextCandidate.call(this,e)},n.postLayout=function(e,n,i,r){var o=this.nodeContext.formattingContext;if(this.cellFragmentLayoutConstraints=this.collectCellFragmentLayoutConstraints(n,o),this.cellFragmentLayoutConstraints.forEach(function(t){t.constraints.forEach(function(n){n.postLayout(e,t.breakPosition,i,r)})}),!e){var a=o.getRootViewNode(this.nodeContext);(new Gl).removeColGroups(o,a),this.removeDummyRowNodes(i)}t.prototype.postLayout.call(this,e,n,i,r)},n.finishBreak=function(e,n){var i=this,r=Ni("finishBreak"),o=this.cellFragmentLayoutConstraints.reduce(function(t,e){return t.concat(e.constraints.map(function(t){return{constraint:t,breakPosition:e.breakPosition}}))},[]),a=0;return r.loop(function(){if(a<o.length){var t=o[a++];return t.constraint.finishBreak(t.breakPosition,n).thenReturn(!0)}return bi(!1)}).then(function(){r.finish(!0)}),r.result().thenAsync(function(){return t.prototype.finishBreak.call(i,e,n)})},n.removeDummyRowNodes=function(t){if(t&&"table-row"===t.display&&t.viewNode)for(;t.viewNode.previousElementSibling;){var e=t.viewNode.previousElementSibling;e.parentNode&&e.parentNode.removeChild(e)}},n.collectCellFragmentLayoutConstraints=function(t,e){return this.getCellFragemnts(t,e).map(function(t){return{constraints:t.fragment.pseudoColumn.getColumn().fragmentLayoutConstraints,breakPosition:t.breakPosition}})},n.getCellFragemnts=function(t,e){var n=Number.MAX_VALUE;t&&"table-row"===t.display&&(n=e.findRowIndexBySourceNode(t.sourceNode)+1),n=Math.min(e.cellFragments.length,n);for(var i=[],r=0;r<n;r++)e.cellFragments[r]&&e.cellFragments[r].forEach(function(t){t&&i.push({fragment:t,breakPosition:t.findAcceptableBreakPosition().nodeContext})});return i},n.getElementsOffsetsForTableCell=function(t){var e=this.nodeContext.formattingContext,n=e.findCellFromColumn(t);return n?e.collectElementsOffsetOfUpperCells(n):e.collectElementsOffsetOfHighestColumn()},n.equalsTo=function(t){return t instanceof e&&this.nodeContext.formattingContext===t.nodeContext.formattingContext},e}(Cl),Ql=new Gl;function Zl(t){return t.reduce(function(t,e){return t+e},0)/t.length}f(exports.HOOKS.RESOLVE_FORMATTING_CONTEXT,function(t,e,n,i,r,o){if(!e)return null;if(n===je.table){var a=t.parent;return new _l(a?a.formattingContext:null,t.sourceNode)}return null}),f(exports.HOOKS.RESOLVE_LAYOUT_PROCESSOR,function(t){return t instanceof _l?Ql:null});var $l=function(t,e){this.layoutResult=t,this.penalty=e};function Jl(t){return t.vertical?t.width:t.height}function tu(t,e){t.vertical?t.width=e:t.height=e}var eu=function(){function t(t,e,n){this.layoutContainer=t,this.columnGenerator=e,this.regionPageFloatLayoutContext=n,this.originalContainerBlockSize=Jl(t)}var e=t.prototype;return e.balanceColumns=function(t){var e=this,n=Ni("ColumnBalancer#balanceColumns");this.preBalance(t),this.savePageFloatLayoutContexts(t),this.layoutContainer.clear();var i=[this.createTrialResult(t)];return n.loopWithFrame(function(t){e.hasNextCandidate(i)?(e.updateCondition(i),e.columnGenerator().then(function(n){e.savePageFloatLayoutContexts(n),e.layoutContainer.clear(),n?(i.push(e.createTrialResult(n)),t.continueLoop()):t.breakLoop()})):t.breakLoop()}).then(function(){var t=i.reduce(function(t,e){return e.penalty<t.penalty?e:t},i[0]);e.restoreContents(t.layoutResult),e.postBalance(),n.finish(t.layoutResult)}),n.result()},e.createTrialResult=function(t){var e=this.calculatePenalty(t);return new $l(t,e)},e.preBalance=function(t){},e.postBalance=function(){tu(this.layoutContainer,this.originalContainerBlockSize)},e.savePageFloatLayoutContexts=function(t){var e=this.regionPageFloatLayoutContext.detachChildren();t&&(t.columnPageFloatLayoutContexts=e)},e.restoreContents=function(t){var e=this.layoutContainer.element;t.columns.forEach(function(t){e.appendChild(t.element)}),this.regionPageFloatLayoutContext.attachChildren(t.columnPageFloatLayoutContexts)},t}();function nu(t){var e=t[t.length-1];if(0===e.penalty)return!1;var n=t[t.length-2];if(n&&e.penalty>=n.penalty)return!1;var i=e.layoutResult.columns;return Math.max.apply(null,i.map(function(t){return t.computedBlockSize}))>Math.max.apply(null,i.map(function(t){return t.getMaxBlockSizeOfPageFloats()}))+1}function iu(t,e){var n=Math.max.apply(null,t[t.length-1].layoutResult.columns.map(function(t){return isNaN(t.blockDistanceToBlockEndFloats)?t.computedBlockSize:t.computedBlockSize-t.blockDistanceToBlockEndFloats+1}))-1;n<Jl(e)?tu(e,n):tu(e,Jl(e)-1)}var ru=function(t){function e(e,n,i,r){var o;return(o=t.call(this,i,e,n)||this).columnCount=r,o.originalPosition=null,o.foundUpperBound=!1,o}x(e,t);var n=e.prototype;return n.preBalance=function(t){var e=t.columns.reduce(function(t,e){return t+e.computedBlockSize},0);tu(this.layoutContainer,e/this.columnCount),this.originalPosition=t.position},n.checkPosition=function(t){return this.originalPosition?this.originalPosition.isSamePosition(t):null===t},n.calculatePenalty=function(t){if(!this.checkPosition(t.position))return Infinity;var e=t.columns;return ou(e)?Infinity:Math.max.apply(null,e.map(function(t){return t.computedBlockSize}))},n.hasNextCandidate=function(t){if(1===t.length)return!0;if(this.foundUpperBound)return nu(t);var e=t[t.length-1];return this.checkPosition(e.layoutResult.position)&&!ou(e.layoutResult.columns)?(this.foundUpperBound=!0,!0):Jl(this.layoutContainer)<this.originalContainerBlockSize},n.updateCondition=function(t){if(this.foundUpperBound)iu(t,this.layoutContainer);else{var e=Math.min(this.originalContainerBlockSize,Jl(this.layoutContainer)+.1*this.originalContainerBlockSize);tu(this.layoutContainer,e)}},e}(eu);function ou(t){if(t.length<=1)return!1;var e=t[t.length-1].computedBlockSize;return t.slice(0,t.length-1).every(function(t){return e>t.computedBlockSize})}var au,su=function(t){function e(e,n,i){return t.call(this,i,e,n)||this}x(e,t);var n=e.prototype;return n.calculatePenalty=function(t){if(t.columns.every(function(t){return 0===t.computedBlockSize}))return Infinity;var e,n,i=t.columns.filter(function(t){return!t.pageBreakType}).map(function(t){return t.computedBlockSize});return n=Zl(e=i),Zl(e.map(function(t){var e=t-n;return e*e}))},n.hasNextCandidate=function(t){return nu(t)},n.updateCondition=function(t){iu(t,this.layoutContainer)},e}(eu),lu=function(t,e,n){this.endStuckFixed=t,this.endFixed=e,this.endSlipped=n},uu=function(){function t(){this.map=[]}var e=t.prototype;return e.getMaxFixed=function(){return 0==this.map.length?0:this.map[this.map.length-1].endFixed},e.getMaxSlipped=function(){return 0==this.map.length?0:this.map[this.map.length-1].endSlipped},e.addStuckRange=function(t){if(0==this.map.length)this.map.push(new lu(t,t,t));else{var e=this.map[this.map.length-1],n=e.endSlipped+t-e.endFixed;e.endFixed==e.endStuckFixed?(e.endFixed=t,e.endStuckFixed=t,e.endSlipped=n):this.map.push(new lu(t,t,n))}},e.addSlippedRange=function(t){0==this.map.length?this.map.push(new lu(t,0,0)):this.map[this.map.length-1].endFixed=t},e.slippedByFixed=function(t){var e=this,n=lt(this.map.length,function(n){return t<=e.map[n].endFixed}),i=this.map[n];return i.endSlipped-Math.max(0,i.endStuckFixed-t)},e.fixedBySlipped=function(t){var e=this,n=lt(this.map.length,function(n){return t<=e.map[n].endSlipped}),i=this.map[n];return i.endStuckFixed-(i.endSlipped-t)},t}(),hu=function(){function t(e,n,i,r,o,a,s,l){if(this.context=e,this.style=n,this.offset=i,this.isRoot=r,this.flowChunk=o,this.atBlockStart=a,this.atFlowStart=s,this.isParentBoxDisplayed=l,this.isBlockValue=null,this.hasBoxValue=null,this.styleValues={},this.beforeBox=null,this.afterBox=null,this.breakBefore=null,this.flowName=o.flowName,this.hasBox()){var u=n._pseudos;if(u&&u.before){var h=new t(e,u.before,i,!1,o,this.isBlock(),s,!0);rs(h.styleValue("content"))&&(this.beforeBox=h,this.breakBefore=h.breakBefore)}}this.breakBefore=bs(this.getBreakValue("before"),this.breakBefore),this.atFlowStart&&ws(this.breakBefore)&&(o.breakBefore=bs(o.breakBefore,this.breakBefore))}var e=t.prototype;return e.buildAfterPseudoElementBox=function(e,n,i){if(this.hasBox()){var r=this.style._pseudos;if(r&&r.after){var o=new t(this.context,r.after,e,!1,this.flowChunk,n,i,!0);rs(o.styleValue("content"))&&(this.afterBox=o)}}},e.styleValue=function(t,e){if(!(t in this.styleValues)){var n=this.style[t];this.styleValues[t]=n?n.evaluate(this.context,t):e||null}return this.styleValues[t]},e.displayValue=function(){return this.styleValue("display",je.inline)},e.isBlock=function(){if(null===this.isBlockValue){var t=this.displayValue(),e=this.styleValue("position"),n=this.styleValue("float");this.isBlockValue=Bs(t,e,n,this.isRoot)}return this.isBlockValue},e.hasBox=function(){return null===this.hasBoxValue&&(this.hasBoxValue=this.isParentBoxDisplayed&&this.displayValue()!==je.none),this.hasBoxValue},e.getBreakValue=function(t){var e=null;if(this.isBlock()){var n=this.styleValue("break-"+t);n&&(e=n.toString())}return e},t}(),cu=function(){function t(t){this.context=t,this.stack=[],this.atBlockStart=!0,this.atFlowStart=!0,this.atStartStack=[]}var e=t.prototype;return e.empty=function(){return 0===this.stack.length},e.lastBox=function(){return this.stack[this.stack.length-1]},e.lastFlowName=function(){var t=this.lastBox();return t?t.flowChunk.flowName:null},e.isCurrentBoxDisplayed=function(){return this.stack.every(function(t){return t.displayValue()!==je.none})},e.push=function(t,e,n,i){var r=this.lastBox();i&&r&&i.flowName!==r.flowName&&this.atStartStack.push({atBlockStart:this.atBlockStart,atFlowStart:this.atFlowStart});var o=i||r.flowChunk,a=this.atFlowStart||!!i,s=this.isCurrentBoxDisplayed(),l=new hu(this.context,t,e,n,o,a||this.atBlockStart,a,s);return this.stack.push(l),this.atBlockStart=l.hasBox()?!l.beforeBox&&l.isBlock():this.atBlockStart,this.atFlowStart=l.hasBox()?!l.beforeBox&&a:this.atFlowStart,l},e.encounteredTextNode=function(t){var e=this.lastBox();(this.atBlockStart||this.atFlowStart)&&e.hasBox()&&(Ma(t,Ba(e.styleValue("white-space",je.normal).toString()))||(this.atBlockStart=!1,this.atFlowStart=!1))},e.pop=function(t){var e=this.stack.pop();if(e.buildAfterPseudoElementBox(t,this.atBlockStart,this.atFlowStart),this.atFlowStart&&e.afterBox){var n=e.afterBox.getBreakValue("before");e.flowChunk.breakBefore=bs(e.flowChunk.breakBefore,n)}var i=this.lastBox();if(i)if(i.flowName===e.flowName)e.hasBox()&&(this.atBlockStart=this.atFlowStart=!1);else{var r=this.atStartStack.pop();this.atBlockStart=r.atBlockStart,this.atFlowStart=r.atFlowStart}return e},e.nearestBlockStartOffset=function(t){if(!t.atBlockStart)return t.offset;var e=this.stack.length-1,n=this.stack[e];for(n===t&&(e--,n=this.stack[e]);e>=0;){if(n.flowName!==t.flowName)return t.offset;if(!n.atBlockStart)return n.offset;if(n.isRoot)return n.offset;t=n,n=this.stack[--e]}throw new Error("No block start offset found!")},t}(),fu=function(){function t(t,e,n,i,r,o,a,s){this.xmldoc=t,this.scope=n,this.context=i,this.primaryFlows=r,this.validatorSet=o,this.counterListener=a,this.rootStyle={},this.styleMap={},this.flows={},this.flowChunks=[],this.flowListener=null,this.flowToReach=null,this.idToReach=null,this.primary=!0,this.primaryStack=[],this.rootBackgroundAssigned=!1,this.rootLayoutAssigned=!1,this.breakBeforeValues={},this.bodyReached=!0,this.root=t.root,this.cascadeHolder=e,this.last=this.root,this.cascade=e.createInstance(i,a,s,t.lang),this.offsetMap=new uu;var l=t.getElementOffset(this.root);this.lastOffset=l,this.boxStack=new cu(i),this.offsetMap.addStuckRange(l);var u=this.getAttrStyle(this.root);switch(this.cascade.pushElement(this.root,u,l),this.postprocessTopStyle(u,!1),this.root.namespaceURI){case V.XHTML:this.bodyReached=!1}this.primaryStack.push(!0),this.styleMap={},this.styleMap["e"+l]=u,this.lastOffset++,this.replayFlowElementsFromOffset(-1)}var e=t.prototype;return e.hasProp=function(t,e,n){var i=t[n];return i&&i.evaluate(this.context)!==e[n]},e.transferPropsToRoot=function(t,e){for(var n in e){var i=t[n];if(i)this.rootStyle[n]=i,delete t[n];else{var r=e[n];r&&(this.rootStyle[n]=new Mr(r,33554432))}}},e.postprocessTopStyle=function(t,e){var n=this;if(["writing-mode","direction"].forEach(function(i){!t[i]||e&&n.rootStyle[i]||(n.rootStyle[i]=t[i])}),!this.rootBackgroundAssigned){var i=this.hasProp(t,this.validatorSet.backgroundProps,"background-color")?t["background-color"].evaluate(this.context):null,r=this.hasProp(t,this.validatorSet.backgroundProps,"background-image")?t["background-image"].evaluate(this.context):null;(i&&i!==je.inherit||r&&r!==je.inherit)&&(this.transferPropsToRoot(t,this.validatorSet.backgroundProps),this.rootBackgroundAssigned=!0)}if(!this.rootLayoutAssigned)for(var o=0;o<du.length;o++)if(this.hasProp(t,this.validatorSet.layoutProps,du[o])){this.transferPropsToRoot(t,this.validatorSet.layoutProps),this.rootLayoutAssigned=!0;break}if(!e){var a=t["font-size"];if(a){var s=a.evaluate(this.context),l=s.num;switch(s.unit){case"em":case"rem":l*=this.context.initialFontSize;break;case"ex":l*=this.context.initialFontSize*Mt.ex/Mt.em;break;case"%":l*=this.context.initialFontSize/100;break;default:var u=Mt[s.unit];u&&(l*=u)}this.context.rootFontSize=l}}},e.getTopContainerStyle=function(){for(var t=0;!this.bodyReached&&this.styleUntil(t+=5e3,0)!=Number.POSITIVE_INFINITY;);return this.rootStyle},e.getAttrStyle=function(t){if(t.style instanceof CSSStyleDeclaration){var e=t.getAttribute("style");if(e)return function(t,e,n,i){var r=new aa(t,e),o=new vi(i,r);try{!function(t,e,n){new pr(tr,t,e,n).runParser(Number.POSITIVE_INFINITY,!1,!0,!1,!1)}(o,r,n)}catch(t){h.warn(t,"Style attribute parse error:")}return r.elementStyle}(this.scope,this.validatorSet,this.xmldoc.url,e)}return{}},e.getReachedOffset=function(){return this.lastOffset},e.replayFlowElementsFromOffset=function(t){if(!(t>=this.lastOffset)){var e=this.context,n=this.xmldoc.getElementOffset(this.root);if(t<n){var i=this.getStyle(this.root,!1),r=Xr(i,"flow-into"),o=r?r.evaluate(e,"flow-into").toString():"body",a=this.encounteredFlowElement(o,i,this.root,n);this.boxStack.empty()&&this.boxStack.push(i,n,!0,a)}var s=this.xmldoc.getNodeByOffset(t),l=this.xmldoc.getNodeOffset(s,0,!1);if(!(l>=this.lastOffset))for(;;){if(1!=s.nodeType)l+=s.textContent.length;else{var u=s,h=this.getStyle(u,!1),c=h["flow-into"];if(c){var f=c.evaluate(e,"flow-into").toString();this.encounteredFlowElement(f,h,u,l)}l++}if(l>=this.lastOffset)break;var d=s.firstChild;if(null==d)for(;!(d=s.nextSibling);)if((s=s.parentNode)===this.root)return;s=d}}},e.resetFlowChunkStream=function(t){this.flowListener=t;for(var e=0;e<this.flowChunks.length;e++)this.flowListener.encounteredFlowChunk(this.flowChunks[e],this.flows[this.flowChunks[e].flowName])},e.styleUntilFlowIsReached=function(t){this.flowToReach=t;for(var e=0;null!=this.flowToReach&&this.styleUntil(e+=5e3,0)!=Number.POSITIVE_INFINITY;);},e.styleUntilIdIsReached=function(t){if(t){this.idToReach=t;for(var e=0;this.idToReach&&this.styleUntil(e+=5e3,0)!==Number.POSITIVE_INFINITY;);this.idToReach=null}},e.encounteredFlowElement=function(t,e,n,i){var r=0,o=Number.POSITIVE_INFINITY,a=!1,s=!1,l=!1,u=e["flow-options"];if(u){var c=function(t){if(t){var e=new Nn;try{return t.visit(e),e.propSet}catch(t){h.warn(t,"toSet:")}}return{}}(u.evaluate(this.context,"flow-options"));a=!!c.exclusive,s=!!c.static,l=!!c.last}var f=e["flow-linger"];f&&(o=Sn(f.evaluate(this.context,"flow-linger"),Number.POSITIVE_INFINITY));var d=e["flow-priority"];d&&(r=Sn(d.evaluate(this.context,"flow-priority"),0));var p=this.breakBeforeValues[i]||null,g=this.flows[t];if(!g){var m=this.boxStack.lastFlowName();g=this.flows[t]=new Ua(t,m)}var v=new Va(t,n,i,r,o,a,s,l,p);return this.flowChunks.push(v),this.flowToReach==t&&(this.flowToReach=null),this.flowListener&&this.flowListener.encounteredFlowChunk(v,g),v},e.registerForcedBreakOffset=function(t,e,n){if(ws(t)){var i=this.flows[n].forcedBreakOffsets;(0===i.length||i[i.length-1]<e)&&i.push(e)}this.breakBeforeValues[e]=bs(this.breakBeforeValues[e],t)},e.styleUntil=function(t,e){var n=-1;if(t<=this.lastOffset&&(n=this.offsetMap.slippedByFixed(t)+e)<this.offsetMap.getMaxSlipped())return this.offsetMap.fixedBySlipped(n);if(null==this.last)return Number.POSITIVE_INFINITY;for(var i=this.context;;){var r=this.last.firstChild;if(null==r)for(;;){if(1==this.last.nodeType){this.cascade.popElement(this.last),this.primary=this.primaryStack.pop();var o=this.boxStack.pop(this.lastOffset),a=null;if(o.afterBox){var s=o.afterBox.getBreakValue("before");this.registerForcedBreakOffset(s,o.afterBox.atBlockStart?this.boxStack.nearestBlockStartOffset(o):o.afterBox.offset,o.flowName),a=o.afterBox.getBreakValue("after")}a=bs(a,o.getBreakValue("after")),this.registerForcedBreakOffset(a,this.lastOffset,o.flowName)}if(r=this.last.nextSibling)break;if(this.last=this.last.parentNode,this.last===this.root)return this.last=null,t<this.lastOffset&&(n<0&&(n=this.offsetMap.slippedByFixed(t)+e),n<=this.offsetMap.getMaxSlipped())?this.offsetMap.fixedBySlipped(n):Number.POSITIVE_INFINITY}if(this.last=r,1!=this.last.nodeType)this.lastOffset+=this.last.textContent.length,this.boxStack.encounteredTextNode(this.last),this.primary?this.offsetMap.addStuckRange(this.lastOffset):this.offsetMap.addSlippedRange(this.lastOffset);else{var l=this.last,u=this.getAttrStyle(l);this.primaryStack.push(this.primary),this.cascade.pushElement(l,u,this.lastOffset);var h=l.getAttribute("id")||l.getAttributeNS(V.XML,"id");h&&h===this.idToReach&&(this.idToReach=null),this.bodyReached||"body"!=l.localName||l.parentNode!=this.root||(this.postprocessTopStyle(u,!0),this.bodyReached=!0);var c=void 0,f=u["flow-into"];if(f){var d=f.evaluate(i,"flow-into").toString(),p=this.encounteredFlowElement(d,u,l,this.lastOffset);this.primary=!!this.primaryFlows[d],c=this.boxStack.push(u,this.lastOffset,l===this.root,p)}else c=this.boxStack.push(u,this.lastOffset,l===this.root);var g=this.boxStack.nearestBlockStartOffset(c);if(this.registerForcedBreakOffset(c.breakBefore,g,c.flowName),c.beforeBox){var m=c.beforeBox.getBreakValue("after");this.registerForcedBreakOffset(m,c.beforeBox.atBlockStart?g:c.offset,c.flowName)}if(this.primary&&c.displayValue()===je.none&&(this.primary=!1),this.styleMap["e"+this.lastOffset]=u,this.lastOffset++,this.primary?this.offsetMap.addStuckRange(this.lastOffset):this.offsetMap.addSlippedRange(this.lastOffset),t<this.lastOffset&&(n<0&&(n=this.offsetMap.slippedByFixed(t)+e),n<=this.offsetMap.getMaxSlipped()))return this.offsetMap.fixedBySlipped(n)}}},e.getStyle=function(t,e){var n=this.xmldoc.getElementOffset(t),i="e"+n;return e&&(n=this.xmldoc.getNodeOffset(t,0,!0)),this.lastOffset<=n&&this.styleUntil(n,0),this.styleMap[i]},e.processContent=function(t,e){},t}(),du=["column-count","column-width","column-fill"],pu=function(){function t(t){this.validator=t,this.success=null,this.failure=null,this.code=0}var e=t.prototype;return e.isSpecial=function(){return 0!=this.code},e.markAsStartGroup=function(){this.code=-1},e.isStartGroup=function(){return-1==this.code},e.markAsEndGroup=function(){this.code=-2},e.isEndGroup=function(){return-2==this.code},e.markAsStartAlternate=function(t){this.code=2*t+1},e.isStartAlternate=function(){return this.code>0&&this.code%2!=0},e.markAsEndAlternate=function(t){this.code=2*t+2},e.isEndAlternate=function(){return this.code>0&&this.code%2==0},e.getAlternate=function(){return Math.floor((this.code-1)/2)},t}(),gu=function(t,e){this.where=t,this.success=e,this.what=-1};!function(t){t[t.FOLLOW=1]="FOLLOW",t[t.OPTIONAL=2]="OPTIONAL",t[t.REPEATED=3]="REPEATED",t[t.ALTERNATE=4]="ALTERNATE"}(au||(au={}));var mu=function(){function t(){this.nodes=[],this.connections=[],this.match=[],this.nomatch=[],this.error=[],this.emptyHead=!0}var e=t.prototype;return e.connect=function(t,e){for(var n=0;n<t.length;n++)this.connections[t[n]].what=e;t.splice(0,t.length)},e.clone=function(){for(var e,n,i,r=new t,o=0;o<this.nodes.length;o++){var a=this.nodes[o],s=new pu(a.validator);s.code=a.code,r.nodes.push(s)}for(var l=0;l<this.connections.length;l++){var u=this.connections[l],h=new gu(u.where,u.success);h.what=u.what,r.connections.push(h)}return(e=r.match).push.apply(e,this.match),(n=r.nomatch).push.apply(n,this.nomatch),(i=r.error).push.apply(i,this.error),r},e.addSpecialToArr=function(t,e,n){var i=this.nodes.length,r=new pu(yu);n>=0?e?r.markAsStartAlternate(n):r.markAsEndAlternate(n):e?r.markAsStartGroup():r.markAsEndGroup(),this.nodes.push(r),this.connect(t,i);var o=new gu(i,!0),a=new gu(i,!1);t.push(this.connections.length),this.connections.push(a),t.push(this.connections.length),this.connections.push(o)},e.endSpecialGroup=function(){for(var t=[this.match,this.nomatch,this.error],e=0;e<t.length;e++)this.addSpecialToArr(t[e],!1,-1)},e.startSpecialGroup=function(){if(this.nodes.length)throw new Error("invalid call");this.addSpecialToArr(this.match,!0,-1)},e.endClause=function(t){this.addSpecialToArr(this.match,!1,t)},e.startClause=function(t){if(this.nodes.length)throw new Error("invalid call");var e=new pu(yu);e.markAsStartAlternate(t),this.nodes.push(e);var n=new gu(0,!0),i=new gu(0,!1);this.nomatch.push(this.connections.length),this.connections.push(i),this.match.push(this.connections.length),this.connections.push(n)},e.addPrimitive=function(t){var e=this.nodes.length;this.nodes.push(new pu(t));var n=new gu(e,!0),i=new gu(e,!1);this.connect(this.match,e),this.emptyHead?(this.nomatch.push(this.connections.length),this.emptyHead=!1):this.error.push(this.connections.length),this.connections.push(i),this.match.push(this.connections.length),this.connections.push(n)},e.isSimple=function(){return 1==this.nodes.length&&!this.nodes[0].isSpecial()},e.isPrimitive=function(){return this.isSimple()&&this.nodes[0].validator instanceof Eu},e.addGroup=function(t,e){if(0!=t.nodes.length){var n=this.nodes.length;if(e==au.ALTERNATE&&1==n&&t.isPrimitive()&&this.isPrimitive())this.nodes[0].validator=this.nodes[0].validator.combine(t.nodes[0].validator);else{for(var i=0;i<t.nodes.length;i++)this.nodes.push(t.nodes[i]);e==au.ALTERNATE?(this.emptyHead=!0,this.connect(this.nomatch,n)):this.connect(this.match,n);for(var r=this.connections.length,o=0;o<t.connections.length;o++){var a=t.connections[o];a.where+=n,a.what>=0&&(a.what+=n),this.connections.push(a)}for(var s=0;s<t.match.length;s++)this.match.push(t.match[s]+r);if(e==au.REPEATED&&this.connect(this.match,n),e==au.OPTIONAL||e==au.REPEATED)for(var l=0;l<t.nomatch.length;l++)this.match.push(t.nomatch[l]+r);else if(this.emptyHead){for(var u=0;u<t.nomatch.length;u++)this.nomatch.push(t.nomatch[u]+r);this.emptyHead=t.emptyHead}else for(var h=0;h<t.nomatch.length;h++)this.error.push(t.nomatch[h]+r);for(var c=0;c<t.error.length;c++)this.error.push(t.error[c]+r);t.nodes=null,t.connections=null}}},e.finish=function(t,e){var n=this.nodes.length;this.nodes.push(t),this.nodes.push(e),this.connect(this.match,n),this.connect(this.nomatch,n+1),this.connect(this.error,n+1);for(var i,r=D(this.connections);!(i=r()).done;){var o=i.value;o.success?this.nodes[o.where].success=this.nodes[o.what]:this.nodes[o.where].failure=this.nodes[o.what]}for(var a=0;a<n;a++)if(null==this.nodes[a].failure||null==this.nodes[a].success)throw new Error("Invalid validator state");return this.nodes[0]},t}(),vu=function(t){function e(){return t.call(this)||this}return x(e,t),e.prototype.validateForShorthand=function(t,e){var n=t[e].visit(this);return n?[n]:null},e}(Te),Eu=function(t){function e(e,n,i){var r;return(r=t.call(this)||this).allowed=e,r.idents=n,r.units=i,r}x(e,t);var n=e.prototype;return n.visitEmpty=function(t){return 1&this.allowed?t:null},n.visitSlash=function(t){return 2048&this.allowed?t:null},n.visitStr=function(t){return 2&this.allowed?t:null},n.visitIdent=function(t){return this.idents[t.name.toLowerCase()]||(4&this.allowed?t:null)},n.visitNumeric=function(t){return 0!=t.num||512&this.allowed?t.num<0&&!(256&this.allowed)?null:this.units[t.unit]?t:null:"%"==t.unit&&1024&this.allowed?t:null},n.visitNum=function(t){return 0==t.num?512&this.allowed?t:null:t.num<=0&&!(256&this.allowed)?null:16&this.allowed?t:null},n.visitInt=function(t){return 0==t.num?512&this.allowed?t:null:t.num<=0&&!(256&this.allowed)?null:48&this.allowed?t:this.idents[""+t.num]||null},n.visitColor=function(t){return 64&this.allowed?t:null},n.visitURL=function(t){return 128&this.allowed?t:null},n.visitSpaceList=function(t){return null},n.visitCommaList=function(t){return null},n.visitFunc=function(t){return null},n.visitExpr=function(t){return 2046&this.allowed?t:null},n.combine=function(t){var n={},i={};for(var r in this.idents)n[r]=this.idents[r];for(var o in t.idents)n[o]=t.idents[o];for(var a in this.units)i[a]=this.units[a];for(var s in t.units)i[s]=t.units[s];return new e(this.allowed|t.allowed,n,i)},e}(vu),wu={},yu=new Eu(0,wu,wu),Nu=function(t){function e(e){var n;return(n=t.call(this)||this).successTerminal=new pu(null),n.failureTerminal=new pu(null),n.first=e.finish(n.successTerminal,n.failureTerminal),n}x(e,t);var n=e.prototype;return n.validateList=function(t,e,n){for(var i=e?[]:t,r=this.first,o=n,a=null,s=null;r!==this.successTerminal&&r!==this.failureTerminal;)if(o>=t.length)r=r.failure;else{var l=t[o],u=l;if(r.isSpecial()){var h=!0;r.isStartGroup()?(a?a.push(s):a=[s],s=[]):r.isEndGroup()?s=a.length>0?a.pop():null:r.isEndAlternate()?s[r.getAlternate()]="taken":h=null==s[r.getAlternate()],r=h?r.success:r.failure}else{if(0==o&&!e&&r.validator instanceof bu&&this instanceof bu){if(u=new Ve(t).visit(r.validator)){o=t.length,r=r.success;continue}}else if(0==o&&!e&&r.validator instanceof Su&&this instanceof bu){if(u=new He(t).visit(r.validator)){o=t.length,r=r.success;continue}}else u=l.visit(r.validator);if(!u){r=r.failure;continue}if(u!==l&&t===i){i=[];for(var c=0;c<o;c++)i[c]=t[c]}t!==i&&(i[o-n]=u),o++,r=r.success}}return r===this.successTerminal&&(e?i.length>0:o==t.length)?i:null},n.validateSingle=function(t){for(var e=null,n=this.first;n!==this.successTerminal&&n!==this.failureTerminal;)t?n.isSpecial()?n=n.success:(e=t.visit(n.validator))?(t=null,n=n.success):n=n.failure:n=n.failure;return n===this.successTerminal?e:null},n.visitEmpty=function(t){return this.validateSingle(t)},n.visitSlash=function(t){return this.validateSingle(t)},n.visitStr=function(t){return this.validateSingle(t)},n.visitIdent=function(t){return this.validateSingle(t)},n.visitNumeric=function(t){return this.validateSingle(t)},n.visitNum=function(t){return this.validateSingle(t)},n.visitInt=function(t){return this.validateSingle(t)},n.visitColor=function(t){return this.validateSingle(t)},n.visitURL=function(t){return this.validateSingle(t)},n.visitSpaceList=function(t){return null},n.visitCommaList=function(t){return null},n.visitFunc=function(t){return this.validateSingle(t)},n.visitExpr=function(t){return null},e}(vu),bu=function(t){function e(e){return t.call(this,e)||this}x(e,t);var n=e.prototype;return n.visitSpaceList=function(t){var e=this.validateList(t.values,!1,0);return e===t.values?t:e?new Ve(e):null},n.visitCommaList=function(t){for(var e=this.first,n=!1;e;){if(e.validator instanceof Su){n=!0;break}e=e.failure}if(n){var i=this.validateList(t.values,!1,0);return i===t.values?t:i?new He(i):null}return null},n.validateForShorthand=function(t,e){return this.validateList(t,!0,e)},e}(Nu),Su=function(t){function e(e){return t.call(this,e)||this}x(e,t);var n=e.prototype;return n.visitSpaceList=function(t){return this.validateSingle(t)},n.visitCommaList=function(t){var e=this.validateList(t.values,!1,0);return e===t.values?t:e?new He(e):null},n.validateForShorthand=function(t,e){for(var n,i=this.first;i!==this.failureTerminal;){if(n=i.validator.validateForShorthand(t,e))return n;i=i.failure}return null},e}(Nu),Cu=function(t){function e(e,n){var i;return(i=t.call(this,n)||this).name=e,i}x(e,t);var n=e.prototype;return n.validateSingle=function(t){return null},n.visitFunc=function(t){if(t.name.toLowerCase()!=this.name)return null;var e=this.validateList(t.values,!1,0);return e===t.values?t:e?new ze(t.name,e):null},e}(Nu),Tu=function(){function t(){}var e=t.prototype;return e.tryParse=function(t,e,n){return e},e.success=function(t,e){},t}(),xu=function(t){function e(e,n){var i;return(i=t.call(this)||this).name=n,i.validator=e.validators[i.name],i}x(e,t);var n=e.prototype;return n.tryParse=function(t,e,n){if(n.values[this.name])return e;var i=this.validator.validateForShorthand(t,e);if(i){var r=i.length,o=r>1?new Ve(i):i[0];return this.success(o,n),e+r}return e},n.success=function(t,e){e.values[this.name]=t},e}(Tu),Iu=function(t){function e(e,n){var i;return(i=t.call(this,e,n[0])||this).names=n,i}return x(e,t),e.prototype.success=function(t,e){for(var n=0;n<this.names.length;n++)e.values[this.names[n]]=t},e}(xu),Pu=function(t){function e(e,n){var i;return(i=t.call(this)||this).nodes=e,i.slash=n,i}return x(e,t),e.prototype.tryParse=function(t,e,n){var i=e;if(this.slash){if(t[e]!=Re)return i;if(++e==t.length)return i}var r=this.nodes[0].tryParse(t,e,n);if(r==e)return i;e=r;for(var o=1;o<this.nodes.length&&e<t.length&&(r=this.nodes[o].tryParse(t,e,n))!=e;o++)e=r;return e},e}(Tu),Ru=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).syntax=null,e.propList=null,e.error=!1,e.values={},e.validatorSet=null,e}x(e,t);var n=e.prototype;return n.setOwner=function(t){this.validatorSet=t},n.syntaxNodeForProperty=function(t){return new xu(this.validatorSet,t)},n.clone=function(){var t=new this.constructor;return t.syntax=this.syntax,t.propList=this.propList,t.validatorSet=this.validatorSet,t},n.init=function(t,e){this.syntax=t,this.propList=e},n.finish=function(t,e){if(!this.error){for(var n,i=D(this.propList);!(n=i()).done;){var r=n.value;e.simpleProperty(r,this.values[r]||this.validatorSet.defaultValues[r],t)}return!0}return!1},n.propagateInherit=function(t,e){for(var n,i=D(this.propList);!(n=i()).done;)e.simpleProperty(n.value,je.inherit,t)},n.validateList=function(t){return this.error=!0,0},n.validateSingle=function(t){return this.validateList([t]),null},n.visitEmpty=function(t){return this.validateSingle(t)},n.visitStr=function(t){return this.validateSingle(t)},n.visitIdent=function(t){return this.validateSingle(t)},n.visitNumeric=function(t){return this.validateSingle(t)},n.visitNum=function(t){return this.validateSingle(t)},n.visitInt=function(t){return this.validateSingle(t)},n.visitColor=function(t){return this.validateSingle(t)},n.visitURL=function(t){return this.validateSingle(t)},n.visitSpaceList=function(t){return this.validateList(t.values),null},n.visitCommaList=function(t){return this.error=!0,null},n.visitFunc=function(t){return this.validateSingle(t)},n.visitExpr=function(t){return this.error=!0,null},e}(Te),Au=function(t){function e(){return t.call(this)||this}return x(e,t),e.prototype.validateList=function(t){for(var e=0,n=0;e<t.length;){var i=this.syntax[n].tryParse(t,e,this);if(i>e)e=i,n=0;else if(++n==this.syntax.length){this.error=!0;break}}return e},e}(Ru),Lu=function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.validateList=function(t){if(t.length>this.syntax.length||0==t.length)return this.error=!0,0;for(var e=0;e<this.syntax.length;e++){for(var n=e;n>=t.length;)n=1==n?0:n-2;if(this.syntax[e].tryParse(t,n,this)!=n+1)return this.error=!0,0}return t.length},n.createSyntaxNode=function(){return new Iu(this.validatorSet,this.propList)},e}(Ru),Ou={SIMPLE:Au,INSETS:Lu,INSETS_SLASH:function(t){function e(){return t.call(this)||this}return x(e,t),e.prototype.validateList=function(t){for(var e=t.length,n=0;n<t.length;n++)if(t[n]===Re){e=n;break}if(e>this.syntax.length||0==t.length)return this.error=!0,0;for(var i=0;i<this.syntax.length;i++){for(var r=i;r>=e;)r=1==r?0:r-2;var o=void 0;if(e+1<t.length)for(o=e+i+1;o>=t.length;)o-=o==e+2?1:2;else o=r;if(2!=this.syntax[i].tryParse([t[r],t[o]],0,this))return this.error=!0,0}return t.length},e}(Ru),COMMA:function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.mergeIn=function(t,e){for(var n,i=D(this.propList);!(n=i()).done;){var r=n.value,o=e[r]||this.validatorSet.defaultValues[r],a=t[r];a||(t[r]=a=[]),a.push(o)}},n.visitCommaList=function(t){for(var e={},n=0;n<t.values.length;n++)if(this.values={},t.values[n]instanceof He?this.error=!0:(t.values[n].visit(this),this.mergeIn(e,this.values),this.values["background-color"]&&n!=t.values.length-1&&(this.error=!0)),this.error)return null;for(var i in this.values={},e)this.values[i]="background-color"==i?e[i].pop():new He(e[i]);return null},e}(Au),FONT:function(t){function e(){return t.call(this)||this}x(e,t);var n=e.prototype;return n.init=function(e,n){t.prototype.init.call(this,e,n),this.propList.push("font-family","line-height","font-size")},n.validateList=function(e){var n=t.prototype.validateList.call(this,e);if(n+2>e.length)return this.error=!0,n;this.error=!1;var i=this.validatorSet.validators;if(!e[n].visit(i["font-size"]))return this.error=!0,n;if(this.values["font-size"]=e[n++],e[n]===Re){if(2+ ++n>e.length)return this.error=!0,n;if(!e[n].visit(i["line-height"]))return this.error=!0,n;this.values["line-height"]=e[n++]}var r=n==e.length-1?e[n]:new Ve(e.slice(n,e.length));return r.visit(i["font-family"])?(this.values["font-family"]=r,e.length):(this.error=!0,n)},n.visitCommaList=function(t){if(t.values[0].visit(this),this.error)return null;for(var e=[this.values["font-family"]],n=1;n<t.values.length;n++)e.push(t.values[n]);var i=new He(e);return i.visit(this.validatorSet.validators["font-family"])?this.values["font-family"]=i:this.error=!0,null},n.visitIdent=function(t){var e=this.validatorSet.systemFonts[t.name];if(e)for(var n in e)this.values[n]=e[n];else this.error=!0;return null},e}(Au)},ku=function(){function t(){this.validators={},this.prefixes={},this.defaultValues={},this.namedValidators={},this.systemFonts={},this.shorthands={},this.layoutProps={},this.backgroundProps={}}var e=t.prototype;return e.addReplacement=function(t,e){var n;if(e.type==An.NUMERIC)n=new De(e.num,e.text);else if(e.type==An.HASH)n=Yi(e.text);else{if(e.type!=An.IDENT)throw new Error("unexpected replacement");n=ke(e.text)}if(t.isPrimitive()){var i=t.nodes[0].validator.idents;for(var r in i)i[r]=n;return t}throw new Error("unexpected replacement")},e.newGroup=function(t,e){var n,i=new mu;if("||"==t){for(var r=0;r<e.length;r++){var o=new mu;o.startClause(r),o.addGroup(e[r],au.FOLLOW),o.endClause(r),i.addGroup(o,0==r?au.FOLLOW:au.ALTERNATE)}var a=new mu;return a.startSpecialGroup(),a.addGroup(i,au.REPEATED),a.endSpecialGroup(),a}switch(t){case" ":n=au.FOLLOW;break;case"|":case"||":n=au.ALTERNATE;break;default:throw new Error("unexpected op")}for(var s=0;s<e.length;s++)i.addGroup(e[s],0==s?au.FOLLOW:n);return i},e.addCounts=function(t,e,n){for(var i=new mu,r=0;r<e;r++)i.addGroup(t.clone(),au.FOLLOW);if(n==Number.POSITIVE_INFINITY)i.addGroup(t,au.REPEATED);else for(var o=e;o<n;o++)i.addGroup(t.clone(),au.OPTIONAL);return i},e.primitive=function(t){var e=new mu;return e.addPrimitive(t),e},e.newFunc=function(t,e){var n;switch(t){case"COMMA":n=new Su(e);break;case"SPACE":n=new bu(e);break;default:n=new Cu(t.toLowerCase(),e)}return this.primitive(n)},e.initBuiltInValidators=function(){this.namedValidators.HASHCOLOR=this.primitive(new Eu(64,wu,wu)),this.namedValidators.POS_INT=this.primitive(new Eu(32,wu,wu)),this.namedValidators.POS_NUM=this.primitive(new Eu(16,wu,wu)),this.namedValidators.POS_PERCENTAGE=this.primitive(new Eu(8,wu,{"%":Pe})),this.namedValidators.NEGATIVE=this.primitive(new Eu(256,wu,wu)),this.namedValidators.ZERO=this.primitive(new Eu(512,wu,wu)),this.namedValidators.ZERO_PERCENTAGE=this.primitive(new Eu(1024,wu,wu)),this.namedValidators.POS_LENGTH=this.primitive(new Eu(8,wu,{em:Pe,ex:Pe,ch:Pe,rem:Pe,vw:Pe,vh:Pe,vi:Pe,vb:Pe,vmin:Pe,vmax:Pe,pvw:Pe,pvh:Pe,pvi:Pe,pvb:Pe,pvmin:Pe,pvmax:Pe,cm:Pe,mm:Pe,in:Pe,px:Pe,pt:Pe,pc:Pe,q:Pe})),this.namedValidators.POS_ANGLE=this.primitive(new Eu(8,wu,{deg:Pe,grad:Pe,rad:Pe,turn:Pe})),this.namedValidators.POS_TIME=this.primitive(new Eu(8,wu,{s:Pe,ms:Pe})),this.namedValidators.FREQUENCY=this.primitive(new Eu(8,wu,{Hz:Pe,kHz:Pe})),this.namedValidators.RESOLUTION=this.primitive(new Eu(8,wu,{dpi:Pe,dpcm:Pe,dppx:Pe})),this.namedValidators.URI=this.primitive(new Eu(128,wu,wu)),this.namedValidators.IDENT=this.primitive(new Eu(4,wu,wu)),this.namedValidators.STRING=this.primitive(new Eu(2,wu,wu)),this.namedValidators.SLASH=this.primitive(new Eu(2048,wu,wu));var t={"font-family":ke("sans-serif")};this.systemFonts.caption=t,this.systemFonts.icon=t,this.systemFonts.menu=t,this.systemFonts["message-box"]=t,this.systemFonts["small-caption"]=t,this.systemFonts["status-bar"]=t},e.isBuiltIn=function(t){return!!t.match(/^[A-Z_0-9]+$/)},e.readNameAndPrefixes=function(t,e){var n=t.token();if(n.type==An.EOF)return null;var i={"":!0};if(n.type==An.O_BRK){do{if(t.consume(),(n=t.token()).type!=An.IDENT)throw new Error("Prefix name expected");i[n.text]=!0,t.consume(),n=t.token()}while(n.type==An.COMMA);if(n.type!=An.C_BRK)throw new Error("']' expected");t.consume(),n=t.token()}if(n.type!=An.IDENT)throw new Error("Property name expected");if(2==e?"SHORTHANDS"==n.text:"DEFAULTS"==n.text)return t.consume(),null;var r=n.text;if(t.consume(),2!=e){if(t.token().type!=An.EQ)throw new Error("'=' expected");this.isBuiltIn(r)||(this.prefixes[r]=i)}else if(t.token().type!=An.COLON)throw new Error("':' expected");return r},e.parseValidators=function(t){for(var e=this,n=function(){var n=e.readNameAndPrefixes(t,1);if(!n)return{v:void 0};for(var i=[],r=[],o="",a=void 0,s=!0,l=function(){if(0==i.length)throw new Error("No values");return 1==i.length?i[0]:e.newGroup(o,i)},u=function(t){if(s)throw new Error("'"+t+"': unexpected");if(o&&o!=t)throw new Error("mixed operators: '"+t+"' and '"+o+"'");o=t,s=!0},h=null;!h;){t.consume();var c=t.token();switch(c.type){case An.IDENT:if(s||u(" "),e.isBuiltIn(c.text)){var f=e.namedValidators[c.text];if(!f)throw new Error("'"+c.text+"' unexpected");i.push(f.clone())}else{var d={};d[c.text.toLowerCase()]=ke(c.text),i.push(e.primitive(new Eu(0,d,wu)))}s=!1;break;case An.INT:var p={};p[""+c.num]=new _e(c.num),i.push(e.primitive(new Eu(0,p,wu))),s=!1;break;case An.BAR:u("|");break;case An.BAR_BAR:u("||");break;case An.O_BRK:s||u(" "),r.push({vals:i,op:o,b:"["}),o="",i=[],s=!0;break;case An.FUNC:s||u(" "),r.push({vals:i,op:o,b:"(",fn:c.text}),o="",i=[],s=!0;break;case An.C_BRK:a=l();var g=r.pop();if("["!=g.b)throw new Error("']' unexpected");(i=g.vals).push(a),o=g.op,s=!1;break;case An.C_PAR:a=l();var m=r.pop();if("("!=m.b)throw new Error("')' unexpected");(i=m.vals).push(e.newFunc(m.fn,a)),o=m.op,s=!1;break;case An.COLON:if(s)throw new Error("':' unexpected");t.consume(),i.push(e.addReplacement(i.pop(),t.token()));break;case An.QMARK:if(s)throw new Error("'?' unexpected");i.push(e.addCounts(i.pop(),0,1));break;case An.STAR:if(s)throw new Error("'*' unexpected");i.push(e.addCounts(i.pop(),0,Number.POSITIVE_INFINITY));break;case An.PLUS:if(s)throw new Error("'+' unexpected");i.push(e.addCounts(i.pop(),1,Number.POSITIVE_INFINITY));break;case An.O_BRC:if(t.consume(),(c=t.token()).type!=An.INT)throw new Error("<int> expected");var v=c.num,E=v;if(t.consume(),(c=t.token()).type==An.COMMA){if(t.consume(),(c=t.token()).type!=An.INT)throw new Error("<int> expected");E=c.num,t.consume(),c=t.token()}if(c.type!=An.C_BRC)throw new Error("'}' expected");i.push(e.addCounts(i.pop(),v,E));break;case An.SEMICOL:if(h=l(),r.length>0)throw new Error("unclosed '"+r.pop().b+"'");break;default:throw new Error("unexpected token")}}t.consume(),e.isBuiltIn(n)?e.namedValidators[n]=h:e.validators[n]=h.isSimple()?h.nodes[0].validator:new bu(h)};;){var i=n();if("object"==typeof i)return i.v}},e.parseDefaults=function(t){for(;;){var e=this.readNameAndPrefixes(t,2);if(!e)return;for(var n=[];;){t.consume();var i=t.token();if(i.type==An.SEMICOL){t.consume();break}switch(i.type){case An.IDENT:n.push(ke(i.text));break;case An.NUM:n.push(new Fe(i.num));break;case An.INT:n.push(new _e(i.num));break;case An.NUMERIC:n.push(new De(i.num,i.text));break;default:throw new Error("unexpected token")}}this.defaultValues[e]=n.length>1?new Ve(n):n[0]}},e.parseShorthands=function(t){for(;;){var e=this.readNameAndPrefixes(t,3);if(!e)return;var n=t.nthToken(1),i=void 0;n.type==An.IDENT&&Ou[n.text]?(i=new Ou[n.text],t.consume()):i=new Au,i.setOwner(this);for(var r=!1,o=[],a=!1,s=[],l=[];!r;)switch(t.consume(),(n=t.token()).type){case An.IDENT:if(this.validators[n.text])o.push(i.syntaxNodeForProperty(n.text)),l.push(n.text);else{if(!(this.shorthands[n.text]instanceof Lu))throw new Error("'"+n.text+"' is neither a simple property nor an inset shorthand");var u=this.shorthands[n.text];o.push(u.createSyntaxNode()),l.push.apply(l,u.propList)}break;case An.SLASH:if(o.length>0||a)throw new Error("unexpected slash");a=!0;break;case An.O_BRK:s.push({slash:a,syntax:o}),o=[],a=!1;break;case An.C_BRK:var h=new Pu(o,a),c=s.pop();a=c.slash,(o=c.syntax).push(h);break;case An.SEMICOL:r=!0,t.consume();break;default:throw new Error("unexpected token")}i.init(o,l),this.shorthands[e]=i}},e.parse=function(t){var e=new vi(t,null);this.parseValidators(e),this.parseDefaults(e),this.parseShorthands(e),this.backgroundProps=this.makePropSet(["background"]),this.layoutProps=this.makePropSet(["margin","border","padding","columns","column-gap","column-rule","column-fill"])},e.makePropSet=function(t){for(var e,n={},i=D(t);!(e=i()).done;)for(var r,o=e.value,a=this.shorthands[o],s=D(a?a.propList:[o]);!(r=s()).done;){var l=r.value,u=this.defaultValues[l];u?n[l]=u:h.warn("Unknown property in makePropSet:",l)}return n},e.validatePropertyAndHandleShorthand=function(t,e,n,i){var r="",o=t,a=(t=t.toLowerCase()).match(/^-([a-z]+)-([-a-z0-9]+)$/);a&&(r=a[1],t=a[2]);var s=this.prefixes[t];if(s&&s[r]){var l=this.validators[t];if(l){var u=e===je.inherit||e.isExpr()?e:e.visit(l);u?i.simpleProperty(t,u,n):i.invalidPropertyValue(o,e)}else{var h=this.shorthands[t].clone();e===je.inherit?h.propagateInherit(n,i):(e.visit(h),h.finish(n,i)||i.invalidPropertyValue(o,e))}}else i.unknownProperty(o,e)},t}();function Du(){var t=new ku;return t.initBuiltInValidators(),t.parse(Mi),t}var Fu={"font-style":je.normal,"font-variant":je.normal,"font-weight":je.normal},_u="OTTO"+(new Date).valueOf(),Bu=1;function Mu(t,e){var n={};for(var i in t)n[i]=Xr(t,i).evaluate(e,i);return function(t){for(var e in Fu)t[e]||(t[e]=Fu[e])}(n),n}var Uu=function(){function t(t){this.properties=t,this.blobURLs=[],this.blobs=[],this.fontTraitKey=function(t){var e=new tt;for(var n in Fu)e.append(" "),e.append(t[n].toString());return e.toString()}(this.properties),this.src=this.properties.src?this.properties.src.toString():null;var e=this.properties["font-family"];this.family=e?e.stringValue():null}var e=t.prototype;return e.traitsEqual=function(t){return this.fontTraitKey==t.fontTraitKey},e.makeAtRule=function(t,e){var n=new tt;for(var i in n.append("@font-face {\n font-family: "),n.append(this.family),n.append(";\n "),Fu)n.append(i),n.append(": "),this.properties[i].appendTo(n,!0),n.append(";\n ");if(e){n.append('src: url("');var r=(window.URL||window.webkitURL).createObjectURL(e);n.append(r),this.blobURLs.push(r),this.blobs.push(e),n.append('")')}else n.append("src: "),n.append(t);return n.append(";\n}\n"),n.toString()},t}(),Vu=function(){function t(t){this.deobfuscator=t,this.familyMap={}}var e=t.prototype;return e.registerFamily=function(t,e){var n=t.family,i=this.familyMap[n],r=e.family;if(i){if(i!=r)throw new Error("E_FONT_FAMILY_INCONSISTENT "+t.family)}else this.familyMap[n]=r},e.filterFontFamily=function(t){if(t instanceof He){for(var e,n=[],i=D(t.values);!(e=i()).done;){var r=e.value,o=this.familyMap[r.stringValue()];o&&n.push(ke(o)),n.push(r)}return new He(n)}var a=this.familyMap[t.stringValue()];return a?new He([ke(a),t]):t},t}(),Hu=function(){function t(t,e,n){this.head=t,this.body=e,this.srcURLMap={},this.familyCounter=0,this.familyPrefix=n||"Fnt_"}var e=t.prototype;return e.getViewFontFamily=function(t,e){var n=t.family,i=e.familyMap[n];return i||(i=this.familyPrefix+ ++this.familyCounter,e.familyMap[n]=i,i)},e.initFont=function(t,e,n){var i=this,r=Ni("initFont"),o=t.src,a={};for(var s in Fu)a[s]=t.properties[s];var l=this.getViewFontFamily(t,n);a["font-family"]=ke(l);var u=new Uu(a),c=this.body.ownerDocument.createElement("span");c.textContent="M";var f=(new Date).valueOf()+1e3,d=this.head.ownerDocument.createElement("style"),p=_u+Bu++;for(var g in d.textContent=u.makeAtRule("",Gi([p])),this.head.appendChild(d),this.body.appendChild(c),c.style.visibility="hidden",c.style.fontFamily=l,Fu)Z(c,g,a[g].toString());var m=c.getBoundingClientRect(),v=m.right-m.left,E=m.bottom-m.top;d.textContent=u.makeAtRule(o,e),h.info("Starting to load font:",o);var w=!1;return r.loop(function(){var t=c.getBoundingClientRect();return v!=t.right-t.left||E!=t.bottom-t.top?(w=!0,bi(!1)):(new Date).valueOf()>f?bi(!1):r.sleep(10)}).then(function(){w?h.info("Loaded font:",o):h.warn("Failed to load font:",o),i.body.removeChild(c),r.finish(u)}),r.result()},e.loadFont=function(t,e){var n=this,i=t.src,r=this.srcURLMap[i];return r?r.piggyback(function(n){var r=n;r.traitsEqual(t)?(e.registerFamily(t,r),h.warn("Found already-loaded font:",i)):h.warn("E_FONT_FACE_INCOMPATIBLE",t.src)}):(r=new Oi(function(){var r=Ni("loadFont"),o=e.deobfuscator?e.deobfuscator(i):null;return o?zi(i,Fi.BLOB).then(function(i){i.responseBlob?o(i.responseBlob).then(function(i){n.initFont(t,i,e).thenFinish(r)}):r.finish(null)}):n.initFont(t,null,e).thenFinish(r),r.result()},"loadFont "+i),this.srcURLMap[i]=r,r.start()),r},e.findOrLoadFonts=function(t,e){for(var n,i=[],r=D(t);!(n=r()).done;){var o=n.value;o.src&&o.family?i.push(this.loadFont(o,e)):h.warn("E_FONT_FACE_INVALID")}return ki(i)},t}(),zu=1,Gu=function(){function t(t,e,n,i,r){this.name=e,this.pseudoName=n,this.classes=i,this.parent=r,this.specified={},this.children=[],this.pageMaster=null,this.index=0,this._scope=t,this.key="p"+zu++,r&&(this.index=r.children.length,r.children.push(this))}var e=t.prototype;return e.createInstance=function(t){throw new Error("E_UNEXPECTED_CALL")},e.clone=function(t){throw new Error("E_UNEXPECTED_CALL")},e.copySpecified=function(t){var e=this.specified,n=t.specified;for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])},e.cloneChildren=function(t){for(var e=0;e<this.children.length;e++)this.children[e].clone({parent:t})},T(t,[{key:"scope",get:function(){return this._scope}}]),t}(),Wu=function(t){function e(e){var n;return(n=t.call(this,e,null,null,[],null)||this).specified.width=new Mr(Ke,0),n.specified.height=new Mr(qe,0),n}return x(e,t),e}(Gu),Xu=function(t){function e(e,n){var i;(i=t.call(this,e,function(t,e){var n=t.match(/^([^.]+)\.([^.]+)$/);if(n){var i=r.pageMaster.keyMap[n[1]];if(i){var o=this.lookupInstance(i);if(o)return e?o.resolveFunc(n[2]):o.resolveName(n[2])}}return null})||this).pageMaster=n;var r=O(i);return i}return x(e,t),e}(_t),ju=function(t){function e(e,n,i,r,o,a,s){var l;return(l=t.call(this,e,n,i,r,o)||this).condition=a,l.specificity=s,l.keyMap={},e instanceof Xu||(l._scope=new Xu(e,O(l))),l.pageMaster=O(l),l.specified.width=new Mr(Ke,0),l.specified.height=new Mr(qe,0),l.specified["wrap-flow"]=new Mr(je.auto,0),l.specified.position=new Mr(je.relative,0),l.specified.overflow=new Mr(je.visible,0),l}x(e,t);var n=e.prototype;return n.createInstance=function(t){return new lh(t,this)},n.clone=function(t){var n=new e(this.scope,this.name,t.pseudoName||this.pseudoName,this.classes,this.parent,this.condition,this.specificity);return this.copySpecified(n),this.cloneChildren(n),n},n.resetScope=function(){this.scope.pageMaster=this},e}(Gu),Yu=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this,e,n,i,r,o)||this).pageMaster=o.pageMaster,n&&(a.pageMaster.keyMap[n]=a.key),a.specified["wrap-flow"]=new Mr(je.auto,0),a}x(e,t);var n=e.prototype;return n.createInstance=function(t){return new uh(t,this)},n.clone=function(t){var n=new e(t.parent.scope,this.name,this.pseudoName,this.classes,t.parent);return this.copySpecified(n),this.cloneChildren(n),n},e}(Gu),Ku=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this,e,n,i,r,o)||this).pageMaster=o.pageMaster,n&&(a.pageMaster.keyMap[n]=a.key),a}x(e,t);var n=e.prototype;return n.createInstance=function(t){return new hh(t,this)},n.clone=function(t){var n=new e(t.parent.scope,this.name,this.pseudoName,this.classes,t.parent);return this.copySpecified(n),this.cloneChildren(n),n},e}(Gu);function qu(t,e,n){return e&&e!==je.auto?e.toExpr(t,n):null}function Qu(t,e,n){return e&&e!==je.auto?e.toExpr(t,n):t.zero}function Zu(t,e,n){return e?e===je.auto?null:e.toExpr(t,n):t.zero}function $u(t,e,n,i){return e&&n!==je.none?e.toExpr(t,i):t.zero}function Ju(t,e,n){return e?e===je._true?t._true:e===je._false?t._false:e.toExpr(t,t.zero):n}var th=function(){function t(t,e){this.parentInstance=t,this.pageBox=e,this.cascaded={},this.style={},this.autoWidth=null,this.autoHeight=null,this.children=[],this.isAutoWidth=!1,this.isAutoHeight=!1,this.isTopDependentOnAutoHeight=!1,this.isRightDependentOnAutoWidth=!1,this.calculatedWidth=0,this.calculatedHeight=0,this.pageMasterInstance=null,this.namedValues={},this.namedFuncs={},this.vertical=!1,this.rtl=!1,this.suppressEmptyBoxGeneration=!1,t&&t.children.push(this)}var e=t.prototype;return e.reset=function(){this.calculatedWidth=0,this.calculatedHeight=0},e.addNamedValues=function(t,e){var n=this.resolveName(t),i=this.resolveName(e);if(!n||!i)throw new Error("E_INTERNAL");return Ne(this.pageBox.scope,n,i)},e.resolveName=function(t){var e=this.namedValues[t];if(e)return e;var n=this.style[t];switch(n&&(e=n.toExpr(this.pageBox.scope,this.pageBox.scope.zero)),t){case"margin-left-edge":e=this.resolveName("left");break;case"margin-top-edge":e=this.resolveName("top");break;case"margin-right-edge":e=this.addNamedValues("border-right-edge","margin-right");break;case"margin-bottom-edge":e=this.addNamedValues("border-bottom-edge","margin-bottom");break;case"border-left-edge":e=this.addNamedValues("margin-left-edge","margin-left");break;case"border-top-edge":e=this.addNamedValues("margin-top-edge","margin-top");break;case"border-right-edge":e=this.addNamedValues("padding-right-edge","border-right-width");break;case"border-bottom-edge":e=this.addNamedValues("padding-bottom-edge","border-bottom-width");break;case"padding-left-edge":e=this.addNamedValues("border-left-edge","border-left-width");break;case"padding-top-edge":e=this.addNamedValues("border-top-edge","border-top-width");break;case"padding-right-edge":e=this.addNamedValues("right-edge","padding-right");break;case"padding-bottom-edge":e=this.addNamedValues("bottom-edge","padding-bottom");break;case"left-edge":e=this.addNamedValues("padding-left-edge","padding-left");break;case"top-edge":e=this.addNamedValues("padding-top-edge","padding-top");break;case"right-edge":e=this.addNamedValues("left-edge","width");break;case"bottom-edge":e=this.addNamedValues("top-edge","height")}if(!e){var i;if("extent"==t)i=this.vertical?"width":"height";else if("measure"==t)i=this.vertical?"height":"width";else{var r=this.vertical?Dr:Fr;for(var o in i=t,r)i=i.replace(o,r[o])}i!=t&&(e=this.resolveName(i))}return e&&(this.namedValues[t]=e),e},e.resolveFunc=function(t){var e=this.namedFuncs[t];if(e)return e;switch(t){case"columns":var n=this.pageBox.scope,i=new we(n,0),r=this.resolveName("column-count"),o=this.resolveName("column-width"),a=this.resolveName("column-gap");e=be(n,Se(n,new ge(n,"min",[i,r]),Ne(n,o,a)),a)}return e&&(this.namedFuncs[t]=e),e},e.initEnabled=function(){var t=this.pageBox.scope,e=this.style,n=Ju(t,e.enabled,t._true),i=qu(t,e.page,t.zero);if(i){var r=new fe(t,"page-number");n=ye(t,n,new re(t,i,r))}var o=qu(t,e["min-page-width"],t.zero);o&&(n=ye(t,n,new ie(t,new fe(t,"page-width"),o)));var a=qu(t,e["min-page-height"],t.zero);a&&(n=ye(t,n,new ie(t,new fe(t,"page-height"),a))),n=this.boxSpecificEnabled(n),e.enabled=new Ge(n)},e.boxSpecificEnabled=function(t){return t},e.initHorizontal=function(){var t=this.pageBox.scope,e=this.style,n=this.parentInstance?this.parentInstance.style.width.toExpr(t,null):null,i=qu(t,e.left,n),r=qu(t,e["margin-left"],n),o=$u(t,e["border-left-width"],e["border-left-style"],n),a=Qu(t,e["padding-left"],n),s=qu(t,e.width,n),l=qu(t,e["max-width"],n),u=Qu(t,e["padding-right"],n),h=$u(t,e["border-right-width"],e["border-right-style"],n),c=qu(t,e["margin-right"],n),f=qu(t,e.right,n),d=Ne(t,o,a),p=Ne(t,o,u);if(i&&f&&s){var g=be(t,n,Ne(t,s,Ne(t,Ne(t,i,d),p)));r?c?f=be(t,g,c):c=be(t,g,Ne(t,f,r)):(g=be(t,g,f),c?r=be(t,g,c):c=r=Se(t,g,new ve(t,.5)))}else{r||(r=t.zero),c||(c=t.zero),i||f||s||(i=t.zero),i||s?i||f?s||f||(s=this.autoWidth,this.isAutoWidth=!0):i=t.zero:(s=this.autoWidth,this.isAutoWidth=!0);var m=be(t,n,Ne(t,Ne(t,r,d),Ne(t,c,p)));this.isAutoWidth&&(l||(l=be(t,m,i||f)),this.vertical||!qu(t,e["column-width"],null)&&!qu(t,e["column-count"],null)||(s=l,this.isAutoWidth=!1)),i?s?f||(f=be(t,m,Ne(t,i,s))):s=be(t,m,Ne(t,i,f)):i=be(t,m,Ne(t,f,s))}var v=Qu(t,e["snap-width"]||(this.parentInstance?this.parentInstance.style["snap-width"]:null),n);e.left=new Ge(i),e["margin-left"]=new Ge(r),e["border-left-width"]=new Ge(o),e["padding-left"]=new Ge(a),e.width=new Ge(s),e["max-width"]=new Ge(l||s),e["padding-right"]=new Ge(u),e["border-right-width"]=new Ge(h),e["margin-right"]=new Ge(c),e.right=new Ge(f),e["snap-width"]=new Ge(v)},e.initVertical=function(){var t=this.pageBox.scope,e=this.style,n=this.parentInstance?this.parentInstance.style.width.toExpr(t,null):null,i=this.parentInstance?this.parentInstance.style.height.toExpr(t,null):null,r=qu(t,e.top,i),o=qu(t,e["margin-top"],n),a=$u(t,e["border-top-width"],e["border-top-style"],n),s=Qu(t,e["padding-top"],n),l=qu(t,e.height,i),u=qu(t,e["max-height"],i),h=Qu(t,e["padding-bottom"],n),c=$u(t,e["border-bottom-width"],e["border-bottom-style"],n),f=qu(t,e["margin-bottom"],n),d=qu(t,e.bottom,i),p=Ne(t,a,s),g=Ne(t,c,h);if(r&&d&&l){var m=be(t,i,Ne(t,l,Ne(t,Ne(t,r,p),g)));o?f?d=be(t,m,o):f=be(t,m,Ne(t,d,o)):(m=be(t,m,d),f?o=be(t,m,f):f=o=Se(t,m,new ve(t,.5)))}else{o||(o=t.zero),f||(f=t.zero),r||d||l||(r=t.zero),r||l?r||d?l||d||(l=this.autoHeight,this.isAutoHeight=!0):r=t.zero:(l=this.autoHeight,this.isAutoHeight=!0);var v=be(t,i,Ne(t,Ne(t,o,p),Ne(t,f,g)));this.isAutoHeight&&(u||(u=be(t,v,r||d)),this.vertical&&(qu(t,e["column-width"],null)||qu(t,e["column-count"],null))&&(l=u,this.isAutoHeight=!1)),r?l?d||(d=be(t,v,Ne(t,r,l))):l=be(t,v,Ne(t,d,r)):r=be(t,v,Ne(t,d,l))}var E=Qu(t,e["snap-height"]||(this.parentInstance?this.parentInstance.style["snap-height"]:null),n);e.top=new Ge(r),e["margin-top"]=new Ge(o),e["border-top-width"]=new Ge(a),e["padding-top"]=new Ge(s),e.height=new Ge(l),e["max-height"]=new Ge(u||l),e["padding-bottom"]=new Ge(h),e["border-bottom-width"]=new Ge(c),e["margin-bottom"]=new Ge(f),e.bottom=new Ge(d),e["snap-height"]=new Ge(E)},e.initColumns=function(){var t=this.pageBox.scope,e=this.style,n=qu(t,e[this.vertical?"height":"width"],null),i=qu(t,e["column-width"],n),r=qu(t,e["column-count"],null),o=function(t,e,n){return e&&e!==je.normal?e.toExpr(t,null):null}(t,e["column-gap"]);o||(o=new ce(t,1,"em")),i&&!r&&(r=new ge(t,"floor",[Ce(t,Ne(t,n,o),Ne(t,i,o))]),r=new ge(t,"max",[t.one,r])),r||(r=t.one),i=be(t,Ce(t,Ne(t,n,o),r),o),e["column-width"]=new Ge(i),e["column-count"]=new Ge(r),e["column-gap"]=new Ge(o)},e.depends=function(t,e,n){return this.style[t].toExpr(this.pageBox.scope,null).depend(e,n)},e.init=function(t){var e=this;t.registerInstance(this.pageBox.key,this);var n=this.pageBox.scope,i=this.style,r=this.parentInstance?this.parentInstance.getActiveRegions(t):null,o=ca(this.cascaded,t,r,!1);this.vertical=ua(o,t,!!this.parentInstance&&this.parentInstance.vertical),this.rtl=ha(o,t,!!this.parentInstance&&this.parentInstance.rtl),pa(o,i,this.vertical,this.rtl,function(t,e){return e.value}),this.autoWidth=new pe(n,function(){return e.calculatedWidth},"autoWidth"),this.autoHeight=new pe(n,function(){return e.calculatedHeight},"autoHeight"),this.initHorizontal(),this.initVertical(),this.initColumns(),this.initEnabled()},e.getProp=function(t,e){var n=this.style[e];return n&&(n=yr(t,n,e)),n},e.getPropAsNumber=function(t,e){var n=this.style[e];return n&&(n=yr(t,n,e)),We(n,t)},e.getSpecial=function(t,e){var n=Qr(this.cascaded,e);if(n){for(var i=[],r=0;r<n.length;r++){var o=n[r].evaluate(t,"");o&&o!==Pe&&i.push(o)}if(i.length)return i}return null},e.getActiveRegions=function(t){var e=this.getSpecial(t,"region-id");if(e){for(var n=[],i=0;i<e.length;i++)n[i]=e[i].toString();return n}return null},e.propagateProperty=function(t,e,n,i){this.propagatePropertyToElement(t,e.element,n,i)},e.propagatePropertyToElement=function(t,e,n,i){var r=this.getProp(t,n);r&&(r.isNumeric()&&Ut(r.unit)&&(r=Xe(r,t)),"font-family"===n&&(r=i.filterFontFamily(r)),Z(e,n,r.toString()))},e.propagateDelayedProperty=function(t,e,n,i){var r=this.getProp(t,n);r&&i.push(new Oa(e.element,n,r))},e.assignLeftPosition=function(t,e){var n=this.getPropAsNumber(t,"left"),i=this.getPropAsNumber(t,"margin-left"),r=this.getPropAsNumber(t,"padding-left"),o=this.getPropAsNumber(t,"border-left-width"),a=this.getPropAsNumber(t,"width");e.setHorizontalPosition(n,a),Z(e.element,"margin-left",i+"px"),Z(e.element,"padding-left",r+"px"),Z(e.element,"border-left-width",o+"px"),e.marginLeft=i,e.borderLeft=o,e.paddingLeft=r},e.assignRightPosition=function(t,e){var n=this.getPropAsNumber(t,"right"),i=this.getPropAsNumber(t,"snap-height"),r=this.getPropAsNumber(t,"margin-right"),o=this.getPropAsNumber(t,"padding-right"),a=this.getPropAsNumber(t,"border-right-width");if(Z(e.element,"margin-right",r+"px"),Z(e.element,"padding-right",o+"px"),Z(e.element,"border-right-width",a+"px"),e.marginRight=r,e.borderRight=a,this.vertical&&i>0){var s=n+e.getInsetRight(),l=s-Math.floor(s/i)*i;l>0&&(e.snapOffsetX=i-l,o+=e.snapOffsetX)}e.paddingRight=o,e.snapWidth=i},e.assignTopPosition=function(t,e){var n=this.getPropAsNumber(t,"snap-height"),i=this.getPropAsNumber(t,"top"),r=this.getPropAsNumber(t,"margin-top"),o=this.getPropAsNumber(t,"padding-top"),a=this.getPropAsNumber(t,"border-top-width");if(e.top=i,e.marginTop=r,e.borderTop=a,e.snapHeight=n,!this.vertical&&n>0){var s=i+e.getInsetTop(),l=s-Math.floor(s/n)*n;l>0&&(e.snapOffsetY=n-l,o+=e.snapOffsetY)}e.paddingTop=o,Z(e.element,"top",i+"px"),Z(e.element,"margin-top",r+"px"),Z(e.element,"padding-top",o+"px"),Z(e.element,"border-top-width",a+"px")},e.assignBottomPosition=function(t,e){var n=this.getPropAsNumber(t,"margin-bottom"),i=this.getPropAsNumber(t,"padding-bottom"),r=this.getPropAsNumber(t,"border-bottom-width"),o=this.getPropAsNumber(t,"height")-e.snapOffsetY;Z(e.element,"height",o+"px"),Z(e.element,"margin-bottom",n+"px"),Z(e.element,"padding-bottom",i+"px"),Z(e.element,"border-bottom-width",r+"px"),e.height=o-e.snapOffsetY,e.marginBottom=n,e.borderBottom=r,e.paddingBottom=i},e.assignBeforePosition=function(t,e){this.vertical?this.assignRightPosition(t,e):this.assignTopPosition(t,e)},e.assignAfterPosition=function(t,e){this.vertical?this.assignLeftPosition(t,e):this.assignBottomPosition(t,e)},e.assignStartEndPosition=function(t,e){this.vertical?(this.assignTopPosition(t,e),this.assignBottomPosition(t,e)):(this.assignRightPosition(t,e),this.assignLeftPosition(t,e))},e.sizeWithMaxHeight=function(t,e){Z(e.element,"border-top-width","0px");var n=this.getPropAsNumber(t,"max-height");this.isTopDependentOnAutoHeight?e.setVerticalPosition(0,n):(this.assignTopPosition(t,e),e.height=n-=e.snapOffsetY,Z(e.element,"height",n+"px"))},e.sizeWithMaxWidth=function(t,e){Z(e.element,"border-left-width","0px");var n=this.getPropAsNumber(t,"max-width");if(this.isRightDependentOnAutoWidth)e.setHorizontalPosition(0,n);else{this.assignRightPosition(t,e),e.width=n-=e.snapOffsetX;var i=this.getPropAsNumber(t,"right");Z(e.element,"right",i+"px"),Z(e.element,"width",n+"px")}},e.prepareContainer=function(t,e,n,i,r){this.parentInstance&&this.vertical==this.parentInstance.vertical||Z(e.element,"writing-mode",this.vertical?"vertical-rl":"horizontal-tb"),(this.vertical?this.isAutoWidth:this.isAutoHeight)?this.vertical?this.sizeWithMaxWidth(t,e):this.sizeWithMaxHeight(t,e):(this.assignBeforePosition(t,e),this.assignAfterPosition(t,e)),(this.vertical?this.isAutoHeight:this.isAutoWidth)?this.vertical?this.sizeWithMaxHeight(t,e):this.sizeWithMaxWidth(t,e):this.assignStartEndPosition(t,e);for(var o=0;o<eh.length;o++)this.propagateProperty(t,e,eh[o],i)},e.transferContentProps=function(t,e,n,i){for(var r=0;r<ih.length;r++)this.propagateProperty(t,e,ih[r],i)},e.transferSinglUriContentProps=function(t,e,n){for(var i=0;i<rh.length;i++)this.propagatePropertyToElement(t,e,rh[i],n)},e.finishContainer=function(t,e,n,i,r,o,a){this.vertical?this.calculatedWidth=e.computedBlockSize+e.snapOffsetX:this.calculatedHeight=e.computedBlockSize+e.snapOffsetY;var s=(this.vertical||!i)&&this.isAutoHeight,l=(!this.vertical||!i)&&this.isAutoWidth,u=null;if((l||s)&&(l&&Z(e.element,"width","auto"),s&&Z(e.element,"height","auto"),u=o.getElementClientRect(i?i.element:e.element),l&&(this.calculatedWidth=Math.ceil(u.right-u.left-e.paddingLeft-e.borderLeft-e.paddingRight-e.borderRight),this.vertical&&(this.calculatedWidth+=e.snapOffsetX)),s&&(this.calculatedHeight=u.bottom-u.top-e.paddingTop-e.borderTop-e.paddingBottom-e.borderBottom,this.vertical||(this.calculatedHeight+=e.snapOffsetY))),(this.vertical?this.isAutoHeight:this.isAutoWidth)&&this.assignStartEndPosition(t,e),(this.vertical?this.isAutoWidth:this.isAutoHeight)&&((this.vertical?this.isRightDependentOnAutoWidth:this.isTopDependentOnAutoHeight)&&this.assignBeforePosition(t,e),this.assignAfterPosition(t,e)),r>1){var h=this.getPropAsNumber(t,"column-rule-width"),c=this.getProp(t,"column-rule-style"),f=this.getProp(t,"column-rule-color");if(h>0&&c&&c!=je.none&&f!=je.transparent)for(var d=this.getPropAsNumber(t,"column-gap"),p=this.vertical?e.height:e.width,g=this.vertical?"border-top":"border-left",m=1;m<r;m++){var v=(p+d)*m/r-d/2+e.paddingLeft-h/2,E=e.height+e.paddingTop+e.paddingBottom,w=e.element.ownerDocument.createElement("div");Z(w,"position","absolute"),Z(w,this.vertical?"left":"top","0px"),Z(w,this.vertical?"top":"left",v+"px"),Z(w,this.vertical?"height":"width","0px"),Z(w,this.vertical?"width":"height",E+"px"),Z(w,g,h+"px "+c.toString()+(f?" "+f.toString():"")),e.element.insertBefore(w,e.element.firstChild)}}for(var y=0;y<nh.length;y++)this.propagateProperty(t,e,nh[y],a);for(var N=0;N<oh.length;N++)this.propagateDelayedProperty(t,e,oh[N],n.delayedItems)},e.applyCascadeAndInit=function(t,e){var n=this.cascaded,i=this.pageBox.specified;for(var r in i)Gr(r)&&jr(n,r,Xr(i,r));if(this.pageBox.pseudoName==ah)for(var o in e)(o.match(/^background-/)||"writing-mode"==o)&&(n[o]=e[o]);if("layout-host"==this.pageBox.pseudoName)for(var a in e)a.match(/^background-/)||"writing-mode"==a||(n[a]=e[a]);t.pushRule(this.pageBox.classes,null,n),n.content&&(n.content=n.content.filterValue(new zo(t,null,t.counterResolver))),this.init(t.context);for(var s,l=D(this.pageBox.children);!(s=l()).done;)s.value.createInstance(this).applyCascadeAndInit(t,e);t.popRule()},e.resolveAutoSizing=function(t){this.isAutoWidth&&(this.isRightDependentOnAutoWidth=this.depends("right",this.autoWidth,t)||this.depends("margin-right",this.autoWidth,t)||this.depends("border-right-width",this.autoWidth,t)||this.depends("padding-right",this.autoWidth,t)),this.isAutoHeight&&(this.isTopDependentOnAutoHeight=this.depends("top",this.autoHeight,t)||this.depends("margin-top",this.autoHeight,t)||this.depends("border-top-width",this.autoHeight,t)||this.depends("padding-top",this.autoHeight,t));for(var e,n=D(this.children);!(e=n()).done;)e.value.resolveAutoSizing(t)},t}(),eh=["border-left-style","border-right-style","border-top-style","border-bottom-style","border-left-color","border-right-color","border-top-color","border-bottom-color","outline-style","outline-color","outline-width","overflow","visibility"],nh=["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat","background-attachment","background-color","background-image","background-repeat","background-position","background-clip","background-origin","background-size","opacity","z-index","background-blend-mode","isolation","mix-blend-mode","filter"],ih=["color","font-family","font-size","font-style","font-weight","font-variant","line-height","letter-spacing","text-align","text-decoration","text-indent","text-transform","white-space","word-spacing","font-feature-settings","font-kerning","font-size-adjust","font-variant-east-asian","font-stretch","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-shadow","text-underline-position"],rh=["width","height","image-resolution","object-fit","object-position"],oh=["transform","transform-origin"],ah="background-host",sh=function(t){function e(e){return t.call(this,null,e)||this}return x(e,t),e.prototype.applyCascadeAndInit=function(e,n){t.prototype.applyCascadeAndInit.call(this,e,n),this.children.sort(function(t,e){return e.pageBox.specificity-t.pageBox.specificity||t.pageBox.index-e.pageBox.index})},e}(th),lh=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).pageMasterInstance=O(i),i}x(e,t);var n=e.prototype;return n.boxSpecificEnabled=function(t){var e=this.pageBox.pageMaster;return e.condition&&(t=ye(e.scope,t,e.condition)),t},n.adjustPageLayout=function(t,e,n){},e}(th),uh=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).pageMasterInstance=e.pageMasterInstance,i}return x(e,t),e}(th),hh=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).pageMasterInstance=e.pageMasterInstance,i}x(e,t);var n=e.prototype;return n.processPartitionList=function(t,e,n){var i=null;if(e instanceof Oe&&(i=[e]),e instanceof He&&(i=e.values),i)for(var r=this.pageBox.scope,o=0;o<i.length;o++)if(i[o]instanceof Oe){var a=Dt(i[o].name,"enabled"),s=new fe(r,a);n&&(s=new Kt(r,s)),t=ye(r,t,s)}return t},n.boxSpecificEnabled=function(t){var e=this.pageBox.scope,n=this.style,i=Ju(e,n.required,e._false)!==e._false;if(i||this.isAutoHeight){var r=function(t,e,n){return e?e.toExpr(t,t.zero):new ve(t,"body")}(e,n["flow-from"]);t=ye(e,t,new ge(e,"has-content",[r]))}if(t=this.processPartitionList(t,n["required-partitions"],!1),t=this.processPartitionList(t,n["conflicting-partitions"],!0),i){var o=this.pageMasterInstance.style.enabled,a=o?o.toExpr(e,null):e._true;a=ye(e,a,t),this.pageMasterInstance.style.enabled=new Ge(a)}return t},n.prepareContainer=function(e,n,i,r,o){Z(n.element,"overflow","hidden"),t.prototype.prepareContainer.call(this,e,n,i,r,o)},e}(th),ch=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e,n,!1)||this).target=i,o.validatorSet=r,o}x(e,t);var n=e.prototype;return n.property=function(t,e,n){this.validatorSet.validatePropertyAndHandleShorthand(t,e,n,this)},n.unknownProperty=function(t,e){this.report("E_INVALID_PROPERTY "+t+": "+e.toString())},n.invalidPropertyValue=function(t,e){this.report("E_INVALID_PROPERTY_VALUE "+t+": "+e.toString())},n.simpleProperty=function(t,e,n){this.target.specified[t]=new Mr(e,n?50331648:67108864)},e}($i),fh=function(t){function e(e,n,i,r){return t.call(this,e,n,i,r)||this}return x(e,t),e}(ch),dh=function(t){function e(e,n,i,r){var o;return o=t.call(this,e,n,i,r)||this,i.specified.width=new Mr(Ye,0),i.specified.height=new Mr(Ye,0),o}x(e,t);var n=e.prototype;return n.startPartitionRule=function(t,e,n){var i=new Ku(this.scope,t,e,n,this.target),r=new fh(this.scope,this.owner,i,this.validatorSet);this.owner.pushHandler(r)},n.startPartitionGroupRule=function(t,n,i){var r=new Yu(this.scope,t,n,i,this.target),o=new e(this.scope,this.owner,r,this.validatorSet);this.owner.pushHandler(o)},e}(ch),ph=function(t){function e(e,n,i,r){return t.call(this,e,n,i,r)||this}x(e,t);var n=e.prototype;return n.startPartitionRule=function(t,e,n){var i=new Ku(this.scope,t,e,n,this.target),r=new fh(this.scope,this.owner,i,this.validatorSet);this.owner.pushHandler(r)},n.startPartitionGroupRule=function(t,e,n){var i=new Yu(this.scope,t,e,n,this.target),r=new dh(this.scope,this.owner,i,this.validatorSet);this.owner.pushHandler(r)},e}(ch);function gh(t){var e=t["writing-mode"],n=t.direction;return n=n&&n.value,(e=e&&e.value)===je.vertical_lr||e!==je.vertical_rl&&n!==je.rtl?exports.PageProgression.LTR:exports.PageProgression.RTL}var mh,vh,Eh={a5:{width:new De(148,"mm"),height:new De(210,"mm")},a4:{width:new De(210,"mm"),height:new De(297,"mm")},a3:{width:new De(297,"mm"),height:new De(420,"mm")},b5:{width:new De(176,"mm"),height:new De(250,"mm")},b4:{width:new De(250,"mm"),height:new De(353,"mm")},"jis-b5":{width:new De(182,"mm"),height:new De(257,"mm")},"jis-b4":{width:new De(257,"mm"),height:new De(364,"mm")},letter:{width:new De(8.5,"in"),height:new De(11,"in")},legal:{width:new De(8.5,"in"),height:new De(14,"in")},ledger:{width:new De(11,"in"),height:new De(17,"in")}},wh=new De(.24,"pt"),yh=new De(3,"mm"),Nh=new De(10,"mm"),bh=new De(13,"mm");function Sh(t){var e={width:Ke,height:qe,bleed:Qe,bleedOffset:Qe},n=t.size;if(n&&n.value!==je.auto){var i,r,o=n.value;if(o.isSpaceList()?(i=o.values[0],r=o.values[1]):(i=o,r=null),i.isNumeric())e.width=i,e.height=r||i;else{var a=i.name&&Eh[i.name.toLowerCase()];a&&(r&&r===je.landscape?(e.width=a.height,e.height=a.width):(e.width=a.width,e.height=a.height))}}var s=t.marks;s&&s.value!==je.none&&(e.bleedOffset=bh);var l=t.bleed;return l&&l.value!==je.auto?l.value&&l.value.isNumeric()&&(e.bleed=l.value):s&&(s.value.isSpaceList()?s.value.values.some(function(t){return t===je.crop}):s.value===je.crop)&&(e.bleed=new De(6,"pt")),e}function Ch(t,e){var n={},i=t.bleed.num*e.queryUnitSize(t.bleed.unit,!1),r=t.bleedOffset.num*e.queryUnitSize(t.bleedOffset.unit,!1),o=i+r,a=t.width;n.pageWidth=a===Ke?e.pref.defaultPaperSize?e.pref.defaultPaperSize.width*e.queryUnitSize("px",!1):(e.pref.spreadView?Math.floor(e.viewportWidth/2)-e.pref.pageBorder:e.viewportWidth)-2*o:a.num*e.queryUnitSize(a.unit,!1);var s=t.height;return n.pageHeight=s===qe?e.pref.defaultPaperSize?e.pref.defaultPaperSize.height*e.queryUnitSize("px",!1):e.viewportHeight-2*o:s.num*e.queryUnitSize(s.unit,!1),n.bleed=i,n.bleedOffset=r,n.cropOffset=o,n}function Th(t,e,n){var i=t.createElementNS(V.SVG,"svg");return i.setAttribute("width",e),i.setAttribute("height",n),i.style.position="absolute",i}function xh(t,e,n){var i=t.createElementNS(V.SVG,n=n||"polyline");return i.setAttribute("stroke","black"),i.setAttribute("stroke-width",e),i.setAttribute("fill","none"),i}!function(t){t.TOP_LEFT="top left",t.TOP_RIGHT="top right",t.BOTTOM_LEFT="bottom left",t.BOTTOM_RIGHT="bottom right"}(mh||(mh={})),function(t){t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right"}(vh||(vh={}));var Ih,Ph,Rh=(Ih={width:!0,height:!0,"block-size":!0,"inline-size":!0,margin:!0,padding:!0,border:!0,outline:!0,"outline-width":!0,"outline-style":!0,"outline-color":!0},["left","right","top","bottom","before","after","start","end","block-start","block-end","inline-start","inline-end"].forEach(function(t){Ih["margin-"+t]=!0,Ih["padding-"+t]=!0,Ih["border-"+t+"-width"]=!0,Ih["border-"+t+"-style"]=!0,Ih["border-"+t+"-color"]=!0}),Ih);!function(t){t.START="start",t.CENTER="center",t.END="end"}(Ph||(Ph={}));var Ah,Lh={"top-left-corner":{order:1,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!0,isInRightColumn:!0,positionAlongVariableDimension:null},"top-left":{order:2,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Ph.START},"top-center":{order:3,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Ph.CENTER},"top-right":{order:4,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Ph.END},"top-right-corner":{order:5,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:null},"right-top":{order:6,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:Ph.START},"right-middle":{order:7,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:Ph.CENTER},"right-bottom":{order:8,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:Ph.END},"bottom-right-corner":{order:9,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:null},"bottom-right":{order:10,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Ph.END},"bottom-center":{order:11,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Ph.CENTER},"bottom-left":{order:12,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Ph.START},"bottom-left-corner":{order:13,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!0,isInRightColumn:!1,positionAlongVariableDimension:null},"left-bottom":{order:14,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!0,isInRightColumn:!1,positionAlongVariableDimension:Ph.END},"left-middle":{order:15,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!0,isInRightColumn:!1,positionAlongVariableDimension:Ph.CENTER},"left-top":{order:16,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!0,isInRightColumn:!1,positionAlongVariableDimension:Ph.START}},Oh=(Ah=Lh,Object.keys(Ah).sort(function(t,e){return Ah[t].order-Ah[e].order})),kh=function(t){function e(e,n,i){var r;(r=t.call(this,e,null,"vivliostyle-page-rule-master",[],n,null,0)||this).pageMarginBoxes={};var o=Sh(i),a=new Dh(r.scope,O(r),i,o);return r.bodyPartitionKey=a.key,r.createPageMarginBoxes(i),r.applySpecified(i,o),r}x(e,t);var n=e.prototype;return n.createPageMarginBoxes=function(t){var e=this,n=t._marginBoxes;n&&Oh.forEach(function(i){n[i]&&(e.pageMarginBoxes[i]=new Fh(e.scope,e,i,t))})},n.applySpecified=function(t,e){for(var n in this.specified.position=new Mr(je.relative,0),this.specified.width=new Mr(e.width,0),this.specified.height=new Mr(e.height,0),t)Rh[n]||"background-clip"===n||(this.specified[n]=t[n])},n.createInstance=function(t){return new _h(t,this)},e}(ju),Dh=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e,null,null,[],n)||this).pageSize=r,o.specified["z-index"]=new Mr(new _e(0),0),o.applySpecified(i),o}x(e,t);var n=e.prototype;return n.applySpecified=function(t){for(var e in this.specified["flow-from"]=new Mr(ke("body"),0),this.specified.position=new Mr(je.absolute,0),this.specified.overflow=new Mr(je.visible,0),Rh)Rh.hasOwnProperty(e)&&(this.specified[e]=t[e])},n.createInstance=function(t){return new Vh(t,this)},e}(Ku),Fh=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e,null,null,[],n)||this).marginBoxName=i,o.applySpecified(r),o}x(e,t);var n=e.prototype;return n.applySpecified=function(t){var e=t._marginBoxes[this.marginBoxName];for(var n in t){var i=e[n];(xr[n]||i&&i.value===je.inherit)&&(this.specified[n]=t[n])}for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var o=e[r];o&&o.value!==je.inherit&&(this.specified[r]=o)}},n.createInstance=function(t){return new Hh(t,this)},e}(Ku),_h=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).pageAreaDimension=null,i.pageMarginBoxInstances={},i}x(e,t);var n=e.prototype;return n.applyCascadeAndInit=function(e,n){var i=this.cascaded;for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r))switch(r){case"writing-mode":case"direction":i[r]=n[r]}t.prototype.applyCascadeAndInit.call(this,e,n)},n.initHorizontal=function(){var t=this.style;t.left=Qe,t["margin-left"]=Qe,t["border-left-width"]=Qe,t["padding-left"]=Qe,t["padding-right"]=Qe,t["border-right-width"]=Qe,t["margin-right"]=Qe,t.right=Qe},n.initVertical=function(){var t=this.style;t.top=Qe,t["margin-top"]=Qe,t["border-top-width"]=Qe,t["padding-top"]=Qe,t["padding-bottom"]=Qe,t["border-bottom-width"]=Qe,t["margin-bottom"]=Qe,t.bottom=Qe},n.setPageAreaDimension=function(t){this.pageAreaDimension=t;var e=this.style;e.width=new Ge(t.borderBoxWidth),e.height=new Ge(t.borderBoxHeight),e["padding-left"]=new Ge(t.marginLeft),e["padding-right"]=new Ge(t.marginRight),e["padding-top"]=new Ge(t.marginTop),e["padding-bottom"]=new Ge(t.marginBottom)},n.adjustPageLayout=function(t,e,n){var i=e.marginBoxes,r={start:this.pageAreaDimension.marginLeft,end:this.pageAreaDimension.marginRight,extent:this.pageAreaDimension.borderBoxWidth},o={start:this.pageAreaDimension.marginTop,end:this.pageAreaDimension.marginBottom,extent:this.pageAreaDimension.borderBoxHeight};this.sizeMarginBoxesAlongVariableDimension(i.top,!0,r,t,n),this.sizeMarginBoxesAlongVariableDimension(i.bottom,!0,r,t,n),this.sizeMarginBoxesAlongVariableDimension(i.left,!1,o,t,n),this.sizeMarginBoxesAlongVariableDimension(i.right,!1,o,t,n)},n.sizeMarginBoxesAlongVariableDimension=function(t,e,n,i,r){var o=Ph.START,a=Ph.CENTER,s=Ph.END,l=this.pageBox.scope,u={},h={},c={};for(var f in t){var d=Lh[f];if(d){var p=t[f],g=this.pageMarginBoxInstances[f],m=new Bh(p,g.style,e,l,r);u[d.positionAlongVariableDimension]=p,h[d.positionAlongVariableDimension]=g,c[d.positionAlongVariableDimension]=m}}var v={start:n.start.evaluate(i),end:n.end.evaluate(i),extent:n.extent.evaluate(i)},E=this.getSizesOfMarginBoxesAlongVariableDimension(c,v.extent),w=!1,y={};Object.keys(u).forEach(function(t){var o=t,a=qu(l,h[o].style[e?"max-width":"max-height"],n.extent);if(a){var s=a.evaluate(i);if(E[o]>s){var f=c[o]=new Uh(u[o],h[o].style,e,l,r,s);y[o]=f.getOuterSize(),w=!0}}}),w&&(E=this.getSizesOfMarginBoxesAlongVariableDimension(c,v.extent),w=!1,[o,a,s].forEach(function(t){E[t]=y[t]||E[t]}));var N={};Object.keys(u).forEach(function(t){var o=t,a=qu(l,h[o].style[e?"min-width":"min-height"],n.extent);if(a){var s=a.evaluate(i);if(E[o]<s){var f=c[o]=new Uh(u[o],h[o].style,e,l,r,s);N[o]=f.getOuterSize(),w=!0}}}),w&&(E=this.getSizesOfMarginBoxesAlongVariableDimension(c,v.extent),[o,a,s].forEach(function(t){E[t]=N[t]||E[t]}));var b=v.start+v.extent,S=v.start+(v.start+v.extent);[o,a,s].forEach(function(t){var n=E[t];if(n){var i=u[t],r=0;switch(t){case o:r=e?i.left:i.top;break;case a:r=(S-n)/2;break;case s:r=b-n}e?i.setHorizontalPosition(r,n-i.getInsetLeft()-i.getInsetRight()):i.setVerticalPosition(r,n-i.getInsetTop()-i.getInsetBottom())}})},n.getSizesOfMarginBoxesAlongVariableDimension=function(t,e){var n=t[Ph.START],i=t[Ph.CENTER],r=t[Ph.END],o={};if(i){var a=[n,r].filter(function(t){return t}),s=a.length?new Mh(a):null,l=this.distributeAutoMarginBoxSizes(i,s,e);l.xSize&&(o[Ph.CENTER]=l.xSize);var u=(e-(l.xSize||i.getOuterSize()))/2;n&&n.hasAutoSize()&&(o[Ph.START]=u),r&&r.hasAutoSize()&&(o[Ph.END]=u)}else{var h=this.distributeAutoMarginBoxSizes(n,r,e);h.xSize&&(o[Ph.START]=h.xSize),h.ySize&&(o[Ph.END]=h.ySize)}return o},n.distributeAutoMarginBoxSizes=function(t,e,n){var i={xSize:null,ySize:null};if(t&&e)if(t.hasAutoSize()&&e.hasAutoSize()){var r=t.getOuterMaxContentSize(),o=e.getOuterMaxContentSize();if(r>0&&o>0){var a=r+o;if(a<n)i.xSize=n*r/a;else{var s=t.getOuterMinContentSize(),l=s+e.getOuterMinContentSize();l<n?i.xSize=s+(n-l)*(r-s)/(a-l):l>0&&(i.xSize=n*s/l)}i.xSize>0&&(i.ySize=n-i.xSize)}else r>0?i.xSize=n:o>0&&(i.ySize=n)}else t.hasAutoSize()?i.xSize=Math.max(n-e.getOuterSize(),0):e.hasAutoSize()&&(i.ySize=Math.max(n-t.getOuterSize(),0));else t?t.hasAutoSize()&&(i.xSize=n):e&&e.hasAutoSize()&&(i.ySize=n);return i},n.prepareContainer=function(e,n,i,r,o){t.prototype.prepareContainer.call(this,e,n,i,r,o),n.element.setAttribute("data-vivliostyle-page-box",!0)},e}(lh),Bh=function(){function t(t,e,n,i,r){this.container=t,this.isHorizontal=n,this.clientLayout=r,this.size=null,this.hasAutoSize_=!qu(i,e[n?"width":"height"],new ce(i,0,"px"))}var e=t.prototype;return e.hasAutoSize=function(){return this.hasAutoSize_},e.getSize=function(){return this.size||(this.size=Ia(this.clientLayout,this.container.element,this.isHorizontal?[va.MAX_CONTENT_WIDTH,va.MIN_CONTENT_WIDTH]:[va.MAX_CONTENT_HEIGHT,va.MIN_CONTENT_HEIGHT])),this.size},e.getOuterMaxContentSize=function(){var t=this.getSize();return this.isHorizontal?this.container.getInsetLeft()+t[va.MAX_CONTENT_WIDTH]+this.container.getInsetRight():this.container.getInsetTop()+t[va.MAX_CONTENT_HEIGHT]+this.container.getInsetBottom()},e.getOuterMinContentSize=function(){var t=this.getSize();return this.isHorizontal?this.container.getInsetLeft()+t[va.MIN_CONTENT_WIDTH]+this.container.getInsetRight():this.container.getInsetTop()+t[va.MIN_CONTENT_HEIGHT]+this.container.getInsetBottom()},e.getOuterSize=function(){return this.isHorizontal?this.container.getInsetLeft()+this.container.width+this.container.getInsetRight():this.container.getInsetTop()+this.container.height+this.container.getInsetBottom()},t}(),Mh=function(){function t(t){this.params=t}var e=t.prototype;return e.hasAutoSize=function(){return this.params.some(function(t){return t.hasAutoSize()})},e.getOuterMaxContentSize=function(){var t=this.params.map(function(t){return t.getOuterMaxContentSize()});return Math.max.apply(null,t)*t.length},e.getOuterMinContentSize=function(){var t=this.params.map(function(t){return t.getOuterMinContentSize()});return Math.max.apply(null,t)*t.length},e.getOuterSize=function(){var t=this.params.map(function(t){return t.getOuterSize()});return Math.max.apply(null,t)*t.length},t}(),Uh=function(t){function e(e,n,i,r,o,a){var s;return(s=t.call(this,e,n,i,r,o)||this).fixedSize=a,s}x(e,t);var n=e.prototype;return n.hasAutoSize=function(){return!1},n.getOuterMaxContentSize=function(){return this.getOuterSize()},n.getOuterMinContentSize=function(){return this.getOuterSize()},n.getOuterSize=function(){return this.isHorizontal?this.container.getInsetLeft()+this.fixedSize+this.container.getInsetRight():this.container.getInsetTop()+this.fixedSize+this.container.getInsetBottom()},e}(Bh),Vh=function(t){function e(e,n){var i;return(i=t.call(this,e,n)||this).borderBoxWidth=null,i.borderBoxHeight=null,i.marginTop=null,i.marginRight=null,i.marginBottom=null,i.marginLeft=null,i}x(e,t);var n=e.prototype;return n.applyCascadeAndInit=function(e,n){var i=this.cascaded;for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(r.match(/^column.*$/)||r.match(/^background-/))&&(i[r]=n[r]);t.prototype.applyCascadeAndInit.call(this,e,n),this.parentInstance.setPageAreaDimension({borderBoxWidth:this.borderBoxWidth,borderBoxHeight:this.borderBoxHeight,marginTop:this.marginTop,marginRight:this.marginRight,marginBottom:this.marginBottom,marginLeft:this.marginLeft})},n.initHorizontal=function(){var t=this.resolvePageBoxDimensions({start:"left",end:"right",extent:"width"});this.borderBoxWidth=t.borderBoxExtent,this.marginLeft=t.marginStart,this.marginRight=t.marginEnd},n.initVertical=function(){var t=this.resolvePageBoxDimensions({start:"top",end:"bottom",extent:"height"});this.borderBoxHeight=t.borderBoxExtent,this.marginTop=t.marginStart,this.marginBottom=t.marginEnd},n.resolvePageBoxDimensions=function(t){var e=this.style,n=this.pageBox.scope,i=t.start,r=t.end,o=t.extent,a=this.pageBox.pageSize[o].toExpr(n,null),s=qu(n,e[o],a),l=qu(n,e["margin-"+i],a),u=qu(n,e["margin-"+r],a),h=Qu(n,e["padding-"+i],a),c=Qu(n,e["padding-"+r],a),f=$u(n,e["border-"+i+"-width"],e["border-"+i+"-style"],a),d=$u(n,e["border-"+r+"-width"],e["border-"+r+"-style"],a),p=be(n,a,Ne(n,Ne(n,f,h),Ne(n,d,c)));return s?(p=be(n,p,s),l||u?l?u=be(n,p,l):l=be(n,p,u):u=l=Se(n,p,new ve(n,.5))):(l||(l=n.zero),u||(u=n.zero),s=be(n,p,Ne(n,l,u))),e[i]=new Ge(l),e[r]=new Ge(u),e["margin-"+i]=Qe,e["margin-"+r]=Qe,e["padding-"+i]=new Ge(h),e["padding-"+r]=new Ge(c),e["border-"+i+"-width"]=new Ge(f),e["border-"+r+"-width"]=new Ge(d),e[o]=new Ge(s),e["max-"+o]=new Ge(s),{borderBoxExtent:be(n,a,Ne(n,l,u)),marginStart:l,marginEnd:u}},n.prepareContainer=function(e,n,i,r,o){t.prototype.prepareContainer.call(this,e,n,i,r,o),i.pageAreaElement=n.element,e.pageAreaWidth=parseFloat(i.pageAreaElement.style.width),e.pageAreaHeight=parseFloat(i.pageAreaElement.style.height)},e}(hh),Hh=function(t){function e(e,n){var i;(i=t.call(this,e,n)||this).suppressEmptyBoxGeneration=!0;var r=n.marginBoxName;return i.boxInfo=Lh[r],e.pageMarginBoxInstances[r]=O(i),i}x(e,t);var n=e.prototype;return n.prepareContainer=function(e,n,i,r,o){this.applyVerticalAlign(e,n.element),t.prototype.prepareContainer.call(this,e,n,i,r,o)},n.applyVerticalAlign=function(t,e){Z(e,"display","flex");var n=this.getProp(t,"vertical-align"),i=null;n===ke("middle")?i="center":n===ke("top")?i="flex-start":n===ke("bottom")&&(i="flex-end"),i&&(Z(e,"flex-flow",this.vertical?"row":"column"),Z(e,"justify-content",i))},n.positionAlongVariableDimension=function(t,e){var n=this.style,i=this.pageBox.scope,r=t.start,o=t.end,a="left"===r,s=a?e.borderBoxWidth:e.borderBoxHeight,l=qu(i,n[t.extent],s),u=a?e.marginLeft:e.marginTop;if(this.boxInfo.positionAlongVariableDimension===Ph.START)n[r]=new Ge(u);else if(l){var h=Qu(i,n["margin-"+r],s),c=Qu(i,n["margin-"+o],s),f=Qu(i,n["padding-"+r],s),d=Qu(i,n["padding-"+o],s),p=$u(i,n["border-"+r+"-width"],n["border-"+r+"-style"],s),g=$u(i,n["border-"+o+"-width"],n["border-"+o+"-style"],s),m=Ne(i,l,Ne(i,Ne(i,f,d),Ne(i,Ne(i,p,g),Ne(i,h,c))));switch(this.boxInfo.positionAlongVariableDimension){case Ph.CENTER:n[r]=new Ge(Ne(i,u,Ce(i,be(i,s,m),new ve(i,2))));break;case Ph.END:n[r]=new Ge(be(i,Ne(i,u,s),m))}}},n.positionAndSizeAlongFixedDimension=function(t,e){var n=this.style,i=this.pageBox.scope,r=t.inside,o=t.outside,a=t.extent,s=e["margin"+o.charAt(0).toUpperCase()+o.substring(1)],l=Zu(i,n["margin-"+r],s),u=Zu(i,n["margin-"+o],s),h=Qu(i,n["padding-"+r],s),c=Qu(i,n["padding-"+o],s),f=$u(i,n["border-"+r+"-width"],n["border-"+r+"-style"],s),d=$u(i,n["border-"+o+"-width"],n["border-"+o+"-style"],s),p=qu(i,n[a],s),g=null;function m(t){if(g)return g;g={extent:p?p.evaluate(t):null,marginInside:l?l.evaluate(t):null,marginOutside:u?u.evaluate(t):null};var e=s.evaluate(t),n=0;return[f,h,c,d].forEach(function(e){e&&(n+=e.evaluate(t))}),(null===g.marginInside||null===g.marginOutside)&&n+g.extent+g.marginInside+g.marginOutside>e&&(null===g.marginInside&&(g.marginInside=0),null===g.marginOutside&&(g.marginOutside=0)),null!==g.extent&&null!==g.marginInside&&null!==g.marginOutside&&(g.marginOutside=null),null===g.extent&&null!==g.marginInside&&null!==g.marginOutside?g.extent=e-n-g.marginInside-g.marginOutside:null!==g.extent&&null===g.marginInside&&null!==g.marginOutside?g.marginInside=e-n-g.extent-g.marginOutside:null!==g.extent&&null!==g.marginInside&&null===g.marginOutside?g.marginOutside=e-n-g.extent-g.marginInside:null===g.extent?(g.marginInside=g.marginOutside=0,g.extent=e-n):g.marginInside=g.marginOutside=(e-n-g.extent)/2,g}n[a]=new Ge(new pe(i,function(){var t=m(this).extent;return null===t?0:t},a)),n["margin-"+r]=new Ge(new pe(i,function(){var t=m(this).marginInside;return null===t?0:t},"margin-"+r)),n["margin-"+o]=new Ge(new pe(i,function(){var t=m(this).marginOutside;return null===t?0:t},"margin-"+o)),"left"===r?n.left=new Ge(Ne(i,e.marginLeft,e.borderBoxWidth)):"top"===r&&(n.top=new Ge(Ne(i,e.marginTop,e.borderBoxHeight)))},n.initHorizontal=function(){var t=this.parentInstance.pageAreaDimension;this.boxInfo.isInLeftColumn?this.positionAndSizeAlongFixedDimension({inside:"right",outside:"left",extent:"width"},t):this.boxInfo.isInRightColumn?this.positionAndSizeAlongFixedDimension({inside:"left",outside:"right",extent:"width"},t):this.positionAlongVariableDimension({start:"left",end:"right",extent:"width"},t)},n.initVertical=function(){var t=this.parentInstance.pageAreaDimension;this.boxInfo.isInTopRow?this.positionAndSizeAlongFixedDimension({inside:"bottom",outside:"top",extent:"height"},t):this.boxInfo.isInBottomRow?this.positionAndSizeAlongFixedDimension({inside:"top",outside:"bottom",extent:"height"},t):this.positionAlongVariableDimension({start:"top",end:"bottom",extent:"height"},t)},n.finishContainer=function(e,n,i,r,o,a,s){t.prototype.finishContainer.call(this,e,n,i,r,o,a,s);var l=i.marginBoxes,u=this.pageBox.marginBoxName,h=this.boxInfo;h.isInLeftColumn||h.isInRightColumn?h.isInTopRow||h.isInBottomRow||(h.isInLeftColumn?l.left[u]=n:h.isInRightColumn&&(l.right[u]=n)):h.isInTopRow?l.top[u]=n:h.isInBottomRow&&(l.bottom[u]=n)},e}(hh),zh=function(){function t(t,e,n,i,r){this.cascadeInstance=t,this.pageScope=e,this.rootPageBoxInstance=n,this.context=i,this.docElementStyle=r,this.pageMasterCache={},this.definePageProgression()}var e=t.prototype;return e.definePageProgression=function(){var t=this.pageScope,e=new fe(t,"page-number"),n=new re(t,new he(t,e,new ve(t,2)),t.zero);t.defineName("recto-page",new Kt(t,n)),t.defineName("verso-page",n),(this.context.pageProgression||gh(this.docElementStyle))===exports.PageProgression.LTR?(t.defineName("left-page",n),t.defineName("right-page",new Kt(t,n))):(t.defineName("left-page",new Kt(t,n)),t.defineName("right-page",n))},e.getCascadedPageStyle=function(){var t={};return this.cascadeInstance.pushRule([],"",t),this.cascadeInstance.popRule(),t},e.getPageRulePageMaster=function(t,e){var n=t.pageBox;if(0===Object.keys(e).length)return n.resetScope(),t;var i=this.makeCacheKey(e,n),r=this.pageMasterCache[i];return r||(r=n.pseudoName===ah?this.generatePageRuleMaster(e):this.generateCascadedPageMaster(e,n),this.pageMasterCache[i]=r),r.pageBox.resetScope(),r},e.makeCacheKey=function(t,e){var n=this.makeCascadeValueObjectKey(t);return e.key+"^"+n},e.makeCascadeValueObjectKey=function(t){var e=[];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i,r=t[n];i=r instanceof Mr?""+r.value:this.makeCascadeValueObjectKey(r),e.push(n+i+(r.priority||""))}return e.sort().join("^")},e.generatePageRuleMaster=function(t){var e=new kh(this.pageScope,this.rootPageBoxInstance.pageBox,t).createInstance(this.rootPageBoxInstance);return e.applyCascadeAndInit(this.cascadeInstance,this.docElementStyle),e.resolveAutoSizing(this.context),e},e.generateCascadedPageMaster=function(t,e){var n=e.clone({pseudoName:"vivliostyle-page-rule-master"}),i=n.specified,r=t.size;if(r){var o=Sh(t),a=r.priority;i.width=Vr(this.context,i.width,new Mr(o.width,a)),i.height=Vr(this.context,i.height,new Mr(o.height,a))}["counter-reset","counter-increment"].forEach(function(e){i[e]&&(t[e]=i[e])});var s=n.createInstance(this.rootPageBoxInstance);return s.applyCascadeAndInit(this.cascadeInstance,this.docElementStyle),s.resolveAutoSizing(this.context),s},t}(),Gh=function(t){function e(e){var n;return(n=t.call(this)||this).pageType=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){t.currentPageType===this.pageType&&this.chained.apply(t)},n.getPriority=function(){return 3},n.makePrimary=function(t){return this.chained&&t.insertInTable(t.pagetypes,this.pageType,this.chained),!0},e}(ao),Wh=function(t){function e(e){var n;return(n=t.call(this)||this).scope=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){1===new fe(this.scope,"page-number").evaluate(t.context)&&this.chained.apply(t)},n.getPriority=function(){return 2},e}(ao),Xh=function(t){function e(e){var n;return(n=t.call(this)||this).scope=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){new fe(this.scope,"left-page").evaluate(t.context)&&this.chained.apply(t)},n.getPriority=function(){return 1},e}(ao),jh=function(t){function e(e){var n;return(n=t.call(this)||this).scope=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){new fe(this.scope,"right-page").evaluate(t.context)&&this.chained.apply(t)},n.getPriority=function(){return 1},e}(ao),Yh=function(t){function e(e){var n;return(n=t.call(this)||this).scope=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){new fe(this.scope,"recto-page").evaluate(t.context)&&this.chained.apply(t)},n.getPriority=function(){return 1},e}(ao),Kh=function(t){function e(e){var n;return(n=t.call(this)||this).scope=e,n}x(e,t);var n=e.prototype;return n.apply=function(t){new fe(this.scope,"verso-page").evaluate(t.context)&&this.chained.apply(t)},n.getPriority=function(){return 1},e}(ao),qh=function(t){function e(e,n){return t.call(this,e,n,null,null,null)||this}return x(e,t),e.prototype.apply=function(t){!function(t,e,n,i,r){$r(t,e,n,i,null,null,null);var o=n._marginBoxes;if(o){var a=Kr(e,"_marginBoxes");for(var s in o)if(o.hasOwnProperty(s)){var l=a[s];l||(a[s]=l={}),$r(t,l,o[s],i,null,null,null)}}}(t.context,t.currentStyle,this.style,this.specificity)},e}(oo),Qh=function(t){function e(e,n,i,r,o){var a;return(a=t.call(this,e,n,null,i,null,r,!1)||this).pageProps=o,a.currentPageSelectors=[],a.currentNamedPageSelector="",a.currentPseudoPageClassSelectors=[],a}x(e,t);var n=e.prototype;return n.startPageRule=function(){this.startSelectorRule()},n.tagSelector=function(t,e){this.currentNamedPageSelector=e,e&&(this.chain.push(new Gh(e)),this.specificity+=65536)},n.pseudoclassSelector=function(t,e){switch(e&&this.reportAndSkip("E_INVALID_PAGE_SELECTOR :"+t+"("+e.join("")+")"),this.currentPseudoPageClassSelectors.push(":"+t),t.toLowerCase()){case"first":this.chain.push(new Wh(this.scope)),this.specificity+=256;break;case"left":this.chain.push(new Xh(this.scope)),this.specificity+=1;break;case"right":this.chain.push(new jh(this.scope)),this.specificity+=1;break;case"recto":this.chain.push(new Yh(this.scope)),this.specificity+=1;break;case"verso":this.chain.push(new Kh(this.scope)),this.specificity+=1;break;default:this.reportAndSkip("E_INVALID_PAGE_SELECTOR :"+t)}},n.finishSelector=function(){var t;t=this.currentNamedPageSelector||this.currentPseudoPageClassSelectors.length?[this.currentNamedPageSelector].concat(this.currentPseudoPageClassSelectors.sort()):null,this.currentPageSelectors.push({selectors:t,specificity:this.specificity}),this.currentNamedPageSelector="",this.currentPseudoPageClassSelectors=[]},n.nextSelector=function(){this.finishSelector(),t.prototype.nextSelector.call(this)},n.startRuleBody=function(){this.finishSelector(),t.prototype.startRuleBody.call(this)},n.simpleProperty=function(e,n,i){if("bleed"!==e&&"marks"!==e||this.currentPageSelectors.some(function(t){return null===t.selectors})){t.prototype.simpleProperty.call(this,e,n,i);var r=Xr(this.elementStyle,e),o=this.pageProps;if("bleed"===e||"marks"===e)o[""]||(o[""]={}),Object.keys(o).forEach(function(t){jr(o[t],e,r)});else if("size"===e){var a=o[""];this.currentPageSelectors.forEach(function(t){var n=new Mr(r.value,r.priority+t.specificity),i=t.selectors?t.selectors.join(""):"",s=o[i];if(s){var l=Xr(s,e);n=l?Vr(null,n,l):n,jr(s,e,n)}else jr(s=o[i]={},e,n),a&&["bleed","marks"].forEach(function(t){a[t]&&jr(s,t,a[t])})})}}},n.insertNonPrimary=function(t){this.cascade.insertInTable(this.cascade.pagetypes,"*",t)},n.makeApplyRuleAction=function(t){return new qh(this.elementStyle,t)},n.startPageMarginBoxRule=function(t){var e=Kr(this.elementStyle,"_marginBoxes"),n=e[t];n||(e[t]=n={});var i=new Zh(this.scope,this.owner,this.validatorSet,n);this.owner.pushHandler(i)},e}(ta),Zh=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e,n,!1)||this).validatorSet=i,o.boxStyle=r,o}x(e,t);var n=e.prototype;return n.property=function(t,e,n){this.validatorSet.validatePropertyAndHandleShorthand(t,e,n,this)},n.invalidPropertyValue=function(t,e){this.report("E_INVALID_PROPERTY_VALUE "+t+": "+e.toString())},n.unknownProperty=function(t,e){this.report("E_INVALID_PROPERTY "+t+": "+e.toString())},n.simpleProperty=function(t,e,n){var i=n?this.getImportantSpecificity():this.getBaseSpecificity(),r=new Mr(e,i);jr(this.boxStyle,t,r)},e}($i),$h=function(t,e,n){return t.replace(/[uU][rR][lL]\(\s*"((\\([^0-9a-fA-F]+|[0-9a-fA-F]+\s*)|[^"\r\n])+)"/gm,function(t,i){return'url("'+n.transformURL(i,e)+'"'}).replace(/[uU][rR][lL]\(\s*'((\\([^0-9a-fA-F]+|[0-9a-fA-F]+\s*)|[^'\r\n])+)'/gm,function(t,i){return"url('"+n.transformURL(i,e)+"'"}).replace(/[uU][rR][lL]\(\s*((\\([^0-9a-fA-F]+|[0-9a-fA-F]+\s*)|[^"'\r\n\)\s])+)/gm,function(t,i){return"url("+n.transformURL(i,e)})},Jh={},tc={"text-indent":"0px","margin-top":"0px","padding-top":"0px","border-top-width":"0px","border-top-style":"none","border-top-color":"transparent","border-top-left-radius":"0px","border-top-right-radius":"0px"},ec={"text-indent":"0px","margin-right":"0px","padding-right":"0px","border-right-width":"0px","border-right-style":"none","border-right-color":"transparent","border-top-right-radius":"0px","border-bottom-right-radius":"0px"},nc={"margin-top":"0px"},ic={"margin-right":"0px"},rc=function(t){function e(e,n,i,r,o,a,s,l,u,h,c,f,d){var p;return(p=t.call(this)||this).flowName=e,p.context=n,p.viewport=i,p.styler=r,p.regionIds=o,p.xmldoc=a,p.docFaces=s,p.footnoteStyle=l,p.stylerProducer=u,p.page=h,p.customRenderer=c,p.fallbackMap=f,p.documentURLTransformer=d,p.nodeContext=null,p.viewRoot=null,p.isFootnote=!1,p.sourceNode=null,p.offsetInNode=0,p.viewNode=null,p.document=i.document,p.exprContentListener=r.counterListener.getExprContentListener(),p}x(e,t);var n=e.prototype;return n.clone=function(){return new e(this.flowName,this.context,this.viewport,this.styler,this.regionIds,this.xmldoc,this.docFaces,this.footnoteStyle,this.stylerProducer,this.page,this.customRenderer,this.fallbackMap,this.documentURLTransformer)},n.createPseudoelementShadow=function(t,e,n,i,r,o,a,s){var l=this.getPseudoMap(n,this.regionIds,this.isFootnote,this.nodeContext,o);if(!l)return s;for(var u,h=[],c=qs.createElementNS(V.SHADOW,"root"),f=c,d=D(Qs);!(u=d()).done;){var p=u.value,g=void 0;if(p){if(!l[p])continue;if(!("footnote-marker"!=p||e&&this.isFootnote))continue;if(p.match(/^first-/)){var m=i.display;if(!m||m===je.inline)continue}if("before"===p||"after"===p){var v=l[p].content;if(!v||v===je.normal||v===je.none)continue}h.push(p),$s(g=qs.createElementNS(V.XHTML,"span"),p)}else g=qs.createElementNS(V.SHADOW,"content");f.appendChild(g),p.match(/^first-/)&&(f=g)}if(!h.length)return s;var E=new Js(t,n,r,o,this.exprContentListener);return new Ka(t,c,null,a,s,Ya.ROOTLESS,E)},n.getPseudoMap=function(t,e,n,i,r){var o=Yr(t,"_pseudos");if(!o)return null;var a={},s=function(t){var i=a[t]={};da(i,o[t],r),la(i,r,o[t]),fa(o[t],e,n,function(t,e){da(i,e,r),sa(e,function(t){da(i,t,r)})})};for(var l in o)s(l);return a},n.createRefShadow=function(t,e,n,i,r){var o=this,a=Ni("createRefShadow");return this.xmldoc.store.load(t).then(function(s){var l=s;if(l){var u=l.getElement(t);if(u){var h=o.stylerProducer.getStylerForDoc(l);r=new Ka(n,u,l,i,r,e,h)}}a.finish(r)}),a.result()},n.createShadows=function(t,e,n,i,r,o,a){var s=this,l=Ni("createShadows"),u=i.template;return(u instanceof Me?this.createRefShadow(u.url,Ya.ROOTLESS,t,a,null):bi(null)).then(function(u){var h=null;if(t.namespaceURI==V.SHADOW&&"include"==t.localName){var c=t.getAttribute("href"),f=null;c?f=a?a.xmldoc:s.xmldoc:a&&(c=a.owner.namespaceURI==V.XHTML?a.owner.getAttribute("href"):a.owner.getAttributeNS(V.XLINK,"href"),f=a.parentShadow?a.parentShadow.xmldoc:s.xmldoc),c&&(c=G(c,f.url),h=s.createRefShadow(c,Ya.ROOTED,t,a,u))}null==h&&(h=bi(u));var d=null;h.then(function(e){if(i.display===je.table_cell){var n=G("user-agent.xml#table-cell",H);d=s.createRefShadow(n,Ya.ROOTLESS,t,a,e)}else d=bi(e)}),d.then(function(u){u=s.createPseudoelementShadow(t,e,n,i,r,o,a,u),l.finish(u)})}),l.result()},n.setViewRoot=function(t,e){this.viewRoot=t,this.isFootnote=e},n.computeStyle=function(t,e,n,i){var r=this,o=this.context,a=ca(n,o,this.regionIds,this.isFootnote);t=ua(a,o,t),e=ha(a,o,e),pa(a,i,t,e,function(t,e){var n=e.evaluate(o,t);return"font-family"==t&&(n=r.docFaces.filterFontFamily(n)),n});var s=_s(i.display||je.inline,i.position,i.float,this.sourceNode===this.xmldoc.root);return["display","position","float"].forEach(function(t){s[t]&&(i[t]=s[t])}),t},n.inheritFromSourceParent=function(t){for(var e=this.nodeContext.sourceNode,n=[],i=null,r=this.nodeContext.shadowContext,o=-1;e&&1==e.nodeType;){var a=r&&r.root==e;if(!a||r.type==Ya.ROOTLESS){var s=(r?r.styler:this.styler).getStyle(e,!1);n.push(s),i=i||J(e)}a?(e=r.owner,r=r.parentShadow):(e=e.parentNode,o++)}for(var l=this.context.queryUnitSize("em",0===o),u={"font-size":new Mr(new De(l,"px"),0)},h=new to(u,this.context),c=n.length-1;c>=0;--c){var f=n[c],d=[];for(var p in f)Wr(p)&&d.push(p);d.sort($e);for(var g=0,m=d;g<m.length;g++){var v=m[g];h.setPropName(v);var E=Xr(f,v);E.value!==je.inherit&&(u[v]=E.filterValue(h))}}for(var w in t)Wr(w)||(u[w]=t[w]);return{lang:i,elementStyle:u}},n.resolveURL=function(t){return t=G(t,this.xmldoc.url),this.fallbackMap[t]||t},n.inheritLangAttribute=function(){this.nodeContext.lang=J(this.nodeContext.sourceNode)||this.nodeContext.parent&&this.nodeContext.parent.lang||this.nodeContext.lang},n.transferPolyfilledInheritedProps=function(t){var e=Pr().filter(function(e){return t[e]});if(e.length){var n=this.nodeContext.inheritedProps;if(this.nodeContext.parent)for(var i in n=this.nodeContext.inheritedProps={},this.nodeContext.parent.inheritedProps)n[i]=this.nodeContext.parent.inheritedProps[i];e.forEach(function(e){var i=t[e];if(i){if(i instanceof _e)n[e]=i.num;else if(i instanceof Oe)n[e]=i.name;else if(i instanceof De){var r=i;switch(r.unit){case"dpi":case"dpcm":case"dppx":n[e]=r.num*Mt[r.unit]}}else n[e]=i;delete t[e]}})}},n.resolveFormattingContext=function(t,e,n,i,r,o){for(var a=p(exports.HOOKS.RESOLVE_FORMATTING_CONTEXT),s=0;s<a.length;s++){var l=a[s](t,e,n,i,r,o);if(l)return void(t.formattingContext=l)}},n.createElementView=function(t,e){var n=this,i=!0,r=Ni("createElementView"),o=this.sourceNode,a=this.nodeContext.shadowContext?this.nodeContext.shadowContext.styler:this.styler,s=a.getStyle(o,!1);if(!this.nodeContext.shadowContext){var l=this.xmldoc.getElementOffset(o);Cr.registerFragmentIndex(l,this.nodeContext.fragmentIndex,0)}var u={};if(!this.nodeContext.parent){var h=this.inheritFromSourceParent(s);s=h.elementStyle,this.nodeContext.lang=h.lang}var c=s["float-reference"]&&function(t){switch(t){case"inline":return os.INLINE;case"column":return os.COLUMN;case"region":return os.REGION;case"page":return os.PAGE;default:throw new Error("Unknown float-reference: "+t)}}(s["float-reference"].value.toString());if(this.nodeContext.parent&&c&&as(c)){var f=this.inheritFromSourceParent(s);s=f.elementStyle,this.nodeContext.lang=f.lang}this.nodeContext.vertical=this.computeStyle(this.nodeContext.vertical,"rtl"===this.nodeContext.direction,s,u),a.processContent(o,u),this.transferPolyfilledInheritedProps(u),this.inheritLangAttribute(),u.direction&&(this.nodeContext.direction=u.direction.toString());var d=u["flow-into"];if(d&&d.toString()!=this.flowName)return r.finish(!1),r.result();var p=u.display;if(p===je.none)return r.finish(!1),r.result();var g=null==this.nodeContext.parent;return this.nodeContext.flexContainer=p===je.flex,this.createShadows(o,g,s,u,a,this.context,this.nodeContext.shadowContext).then(function(l){n.nodeContext.nodeShadow=l;var h=u.position,f=u.float,d=u.clear,m=n.nodeContext.vertical?je.vertical_rl:je.horizontal_tb,v=n.nodeContext.parent?n.nodeContext.parent.vertical?je.vertical_rl:je.horizontal_tb:m,E=function(t){return"true"===t.getAttribute("data-vivliostyle-flow-root")}(o);n.nodeContext.establishesBFC=function(t,e,n,i,r,o,a){return r=r||o||je.horizontal_tb,!!a||!!n&&n!==je.none||Fs(e)||t===je.inline_block||t===je.table_cell||t===je.table_caption||t==je.flex||(t===je.block||t===je.list_item)&&!!i&&i!==je.visible||!!o&&r!==o}(p,h,f,u.overflow,m,v,E),n.nodeContext.containingBlockForAbsolute=function(t){return t===je.relative||t===je.absolute||t===je.fixed}(h),!n.nodeContext.isInsideBFC()||f===je.footnote||c&&as(c)||(f=null,d=null);var w=f===je.left||f===je.right||f===je.top||f===je.bottom||f===je.inline_start||f===je.inline_end||f===je.block_start||f===je.block_end||f===je.snap_block||f===je.footnote;f&&(delete u.float,f===je.footnote&&(n.isFootnote?(w=!1,u.display=je.block):u.display=je.inline)),d&&(d===je.inherit&&n.nodeContext.parent&&n.nodeContext.parent.clearSide&&(d=ke(n.nodeContext.parent.clearSide)),d!==je.left&&d!==je.right&&d!==je.top&&d!==je.bottom&&d!==je.both&&d!==je.all&&d!==je.same||(delete u.clear,u.display&&u.display!=je.inline&&(n.nodeContext.clearSide=d.toString())));var y=p===je.list_item&&u["ua-list-item-count"];if((w||u["break-inside"]&&u["break-inside"]!==je.auto)&&n.nodeContext.breakPenalty++,p&&p!==je.inline&&Ms(p)&&n.nodeContext.breakPenalty++,n.nodeContext.inline=!w&&!p||Ms(p)||function(t){switch(t.toString()){case"ruby-base":case"ruby-text":case"ruby-base-container":case"ruby-text-container":return!0;default:return!1}}(p),n.nodeContext.display=p?p.toString():"inline",n.nodeContext.floatSide=w?f.toString():null,n.nodeContext.floatReference=c||os.INLINE,n.nodeContext.floatMinWrapBlock=u["float-min-wrap-block"]||null,n.nodeContext.columnSpan=u["column-span"],!n.nodeContext.inline){var N=u["break-after"];N&&(n.nodeContext.breakAfter=N.toString());var b=u["break-before"];b&&(n.nodeContext.breakBefore=b.toString())}n.nodeContext.verticalAlign=u["vertical-align"]&&u["vertical-align"].toString()||"baseline",n.nodeContext.captionSide=u["caption-side"]&&u["caption-side"].toString()||"top";var S=u["border-collapse"];if(!S||S===ke("separate")){var C,T,x=u["border-spacing"];x&&(x.isSpaceList()?(C=x.values[0],T=x.values[1]):C=T=x,C.isNumeric()&&(n.nodeContext.inlineBorderSpacing=We(C,n.context)),T.isNumeric()&&(n.nodeContext.blockBorderSpacing=We(T,n.context)))}n.nodeContext.footnotePolicy=u["footnote-policy"];var I=u["x-first-pseudo"];I&&(n.nodeContext.firstPseudo=new Qa(n.nodeContext.parent?n.nodeContext.parent.firstPseudo:null,I.num)),n.nodeContext.inline||n.processAfterIfcontinues(o,s,a,n.context);var P=u["white-space"];if(P){var R=Ba(P.toString());null!==R&&(n.nodeContext.whitespace=R)}var A=u["hyphenate-character"];A&&A!==je.auto&&(n.nodeContext.hyphenateCharacter=A.str),n.nodeContext.breakWord=u["word-break"]===je.break_all||(u["overflow-wrap"]||["word-wrap"])===je.break_word,n.resolveFormattingContext(n.nodeContext,t,p,h,f,g),n.nodeContext.parent&&n.nodeContext.parent.formattingContext&&(t=n.nodeContext.parent.formattingContext.isFirstTime(n.nodeContext,t)),n.nodeContext.inline||(n.nodeContext.repeatOnBreak=n.processRepeatOnBreak(u),n.findAndProcessRepeatingElements(o,a));var L=!1,O=[],k=o.namespaceURI,D=o.localName;if(k==V.XHTML)"html"==D||"body"==D||"script"==D||"link"==D||"meta"==D?D="div":"vide_"==D?D="video":"audi_"==D?D="audio":"object"==D&&(L=!!n.customRenderer),o.getAttribute("data-adapt-pseudo")&&s.content&&s.content.value&&s.content.value.url&&(D="img");else if(k==V.epub)D="span",k=V.XHTML;else if(k==V.NCX)if(k=V.XHTML,"ncx"==D||"navPoint"==D)D="div";else if("navLabel"==D){D="span";var F=o.parentNode;if(F){for(var _=null,B=F.firstChild;B;B=B.nextSibling)if(1==B.nodeType&&B.namespaceURI==V.NCX&&"content"==B.localName){_=B.getAttribute("src");break}_&&(D="a",(o=o.ownerDocument.createElementNS(k,"a")).setAttribute("href",_))}}else D="span";else k==V.SHADOW?(k=V.XHTML,D=n.nodeContext.inline?"span":"div"):L=!!n.customRenderer;if(y)t?D="li":(D="div",u.display=p=je.block);else if("body"==D||"li"==D)D="div";else if("q"==D)D="span";else if("a"==D){var M=u["hyperlink-processing"];M&&"normal"!=M.toString()&&(D="span")}u.behavior&&"none"!=u.behavior.toString()&&n.customRenderer&&(L=!0),o.dataset&&"true"===o.getAttribute("data-math-typeset")&&(L=!0),(L?n.customRenderer(o,n.nodeContext.parent?n.nodeContext.parent.viewNode:null,u):bi(null)).then(function(a){var s;a?L&&(i="true"==a.getAttribute("data-adapt-process-children")):a=n.createElement(k,D),"a"==D&&a.addEventListener("click",n.page.hrefHandler,!1),"iframe"==a.localName&&a.namespaceURI==V.XHTML&&(s=a).addEventListener("load",function(){s.contentWindow.navigator.epubReadingSystem={name:"adapt",version:"0.1",layoutStyle:"paginated",hasFeature:function(t,e){switch(t){case"mouse-events":return!0}return!1}}},!1);for(var l=n.nodeContext.inheritedProps["image-resolution"],h=[],c=u.width,f=u.height,d=o.getAttribute("width"),p=o.getAttribute("height"),g=c===je.auto||!c&&!d,m=f===je.auto||!f&&!p,v=o.attributes,E=v.length,w=null,N=0;N<E;N++){var b=v[N],S=b.namespaceURI,C=b.localName,T=b.nodeValue;if(S){if("http://www.w3.org/2000/xmlns/"==S)continue;S==V.XLINK&&"href"==C&&(T=n.resolveURL(T))}else{if(C.match(/^on/))continue;if("style"==C)continue;if(("id"==C||"name"==C)&&t){T=n.documentURLTransformer.transformFragment(encodeURIComponent(T),n.xmldoc.url),a.setAttribute(C,T),n.page.registerElementWithId(a,T);continue}if("src"==C||"href"==C||"poster"==C?(T=n.resolveURL(T),"href"===C&&(T=n.documentURLTransformer.transformURL(T,n.xmldoc.url))):"srcset"==C&&(T=T.split(",").map(function(t){return n.resolveURL(t.trim())}).join(",")),"poster"===C&&"video"===D&&k===V.XHTML&&g&&m){var x=new Image,I=Di(x,T);O.push(I),h.push({image:x,element:a,fetcher:I})}}if(k==V.SVG&&/^[A-Z\-]+$/.test(C)&&(C=C.toLowerCase()),n.isSVGUrlAttribute(C)&&(T=$h(T,n.xmldoc.url,n.documentURLTransformer)),S){var P=Jh[S];P&&(C=P+":"+C)}"src"!=C||S||"img"!=D&&"input"!=D||k!=V.XHTML?"href"==C&&"image"==D&&k==V.SVG&&S==V.XLINK?n.page.fetchers.push(Di(a,T)):S?a.setAttributeNS(S,C,T):a.setAttribute(C,T):w=T}if(w){var R="input"===D?new Image:a,A=Di(R,w);R!==a&&(a.src=w),g||m?(g&&m&&l&&1!==l&&h.push({image:R,element:a,fetcher:A}),O.push(A)):n.page.fetchers.push(A)}delete u.content;var F=u["list-style-image"];if(F&&F instanceof Me){var _=F.url;O.push(Di(new Image,_))}if(n.preprocessElementStyle(u),n.applyComputedStyles(a,u),!n.nodeContext.inline){var B=null;if(t?e&&(B=n.nodeContext.vertical?ic:nc):B="clone"!==n.nodeContext.inheritedProps["box-decoration-break"]?n.nodeContext.vertical?ec:tc:n.nodeContext.vertical?ic:nc,B)for(var M in B)Z(a,M,B[M])}y&&a.setAttribute("value",u["ua-list-item-count"].stringValue()),n.viewNode=a,O.length?ki(O).then(function(){l>0&&n.modifyElemDimensionWithImageResolution(h,l,u,n.nodeContext.vertical),r.finish(i)}):r.timeSlice().then(function(){r.finish(i)})})}),r.result()},n.processAfterIfcontinues=function(t,e,n,i){var r=this.getPseudoMap(e,this.regionIds,this.isFootnote,this.nodeContext,i);if(r&&r["after-if-continues"]&&r["after-if-continues"].content){var o=new Js(t,e,n,i,this.exprContentListener);this.nodeContext.afterIfContinues=new el(t,o)}},n.isSVGUrlAttribute=function(t){return e.SVG_URL_ATTRIBUTES.includes(t.toLowerCase())},n.modifyElemDimensionWithImageResolution=function(t,e,n,i){var r=this;t.forEach(function(t){if("load"===t.fetcher.get().get()){var o=t.image,a=o.width/e,s=o.height/e,l=t.element;if(a>0&&s>0)if(n["box-sizing"]===je.border_box&&(n["border-left-style"]!==je.none&&(a+=We(n["border-left-width"],r.context)),n["border-right-style"]!==je.none&&(a+=We(n["border-right-width"],r.context)),n["border-top-style"]!==je.none&&(s+=We(n["border-top-width"],r.context)),n["border-bottom-style"]!==je.none&&(s+=We(n["border-bottom-width"],r.context))),e>1){var u=n["max-width"]||je.none,h=n["max-height"]||je.none;if(u===je.none&&h===je.none)Z(l,"max-width",a+"px");else if(u!==je.none&&h===je.none)Z(l,"width",a+"px");else if(u===je.none&&h!==je.none)Z(l,"height",s+"px");else{u.isNumeric(),h.isNumeric();var c=h;"%"!==u.unit?Z(l,"max-width",Math.min(a,We(u,r.context))+"px"):"%"!==c.unit?Z(l,"max-height",Math.min(s,We(c,r.context))+"px"):i?Z(l,"height",s+"px"):Z(l,"width",a+"px")}}else if(e<1){var f=n["min-width"]||Qe,d=n["min-height"]||Qe;f.isNumeric(),f.isNumeric();var p=f,g=d;0===p.num&&0===g.num?Z(l,"min-width",a+"px"):0!==p.num&&0===g.num?Z(l,"width",a+"px"):0===p.num&&0!==g.num?Z(l,"height",s+"px"):"%"!==p.unit?Z(l,"min-width",Math.max(a,We(p,r.context))+"px"):"%"!==g.unit?Z(l,"min-height",Math.max(s,We(g,r.context))+"px"):i?Z(l,"height",s+"px"):Z(l,"width",a+"px")}}})},n.preprocessElementStyle=function(t){var e=this;p(exports.HOOKS.PREPROCESS_ELEMENT_STYLE).forEach(function(n){n(e.nodeContext,t)})},n.findAndProcessRepeatingElements=function(t,e){for(var n=t.firstChild;n;n=n.nextSibling)if(1===n.nodeType){var i={},r=e.getStyle(n,!1);if(this.computeStyle(this.nodeContext.vertical,"rtl"===this.nodeContext.direction,r,i),this.processRepeatOnBreak(i)){if(this.nodeContext.formattingContext instanceof El&&!this.nodeContext.belongsTo(this.nodeContext.formattingContext))return;var o=this.nodeContext.parent;return this.nodeContext.formattingContext=new El(o&&o.formattingContext,this.nodeContext.sourceNode),void this.nodeContext.formattingContext.initializeRepetitiveElements(this.nodeContext.vertical)}}},n.processRepeatOnBreak=function(t){var e=t["repeat-on-break"];return e!==je.none&&(e===je.auto&&(e=t.display===je.table_header_group?je.header:t.display===je.table_footer_group?je.footer:je.none),e&&e!==je.none)?e.toString():null},n.createTextNodeView=function(){var t=this,e=Ni("createTextNodeView");return this.preprocessTextContent().then(function(){var n=t.offsetInNode||0,i=Pa(t.nodeContext.preprocessedTextContent).substr(n);t.viewNode=document.createTextNode(i),e.finish(!0)}),e.result()},n.preprocessTextContent=function(){var t,e=this;if(null!=this.nodeContext.preprocessedTextContent)return bi(!0);var n=t=this.sourceNode.textContent,i=Ni("preprocessTextContent"),o=p(exports.HOOKS.PREPROCESS_TEXT_CONTENT),a=0;return i.loop(function(){return a>=o.length?bi(!1):o[a++](e.nodeContext,n).thenAsync(function(t){return n=t,bi(!0)})}).then(function(){e.nodeContext.preprocessedTextContent=r(t,n,0),i.finish(!0)}),i.result()},n.createNodeView=function(t,e){var n,i=this,r=Ni("createNodeView"),o=!0;return 1==this.sourceNode.nodeType?n=this.createElementView(t,e):8==this.sourceNode.nodeType?(this.viewNode=null,n=bi(!0)):n=this.createTextNodeView(),n.then(function(t){if(o=t,i.nodeContext.viewNode=i.viewNode,i.viewNode){var e=i.nodeContext.parent?i.nodeContext.parent.viewNode:i.viewRoot;e&&e.appendChild(i.viewNode)}r.finish(o)}),r.result()},n.setCurrent=function(t,e,n){return this.nodeContext=t,t?(this.sourceNode=t.sourceNode,this.offsetInNode=t.offsetInNode):(this.sourceNode=null,this.offsetInNode=-1),this.viewNode=null,this.nodeContext?this.createNodeView(e,!!n):bi(!0)},n.processShadowContent=function(t){if(null==t.shadowContext||"content"!=t.sourceNode.localName||t.sourceNode.namespaceURI!=V.SHADOW)return t;var e,n,i,r=t.boxOffset,o=t.shadowContext,a=t.parent;o.subShadow?(i=o.subShadow,e=o.root,(n=o.type)==Ya.ROOTLESS&&(e=e.firstChild)):(i=o.parentShadow,e=o.owner.firstChild,n=Ya.ROOTLESS);var s=t.sourceNode.nextSibling;if(s?(t.sourceNode=s,t.resetView()):t.shadowSibling?t=t.shadowSibling:e?t=null:(t=t.parent.modify()).after=!0,e){var l=new Za(e,a,r);return l.shadowContext=i,l.shadowType=n,l.shadowSibling=t,l}return t.boxOffset=r,t},n.nextPositionInTree=function(t){var e=t.boxOffset+1;if(t.after){if(!t.parent)return null;if(t.shadowType!=Ya.ROOTED){var n=t.sourceNode.nextSibling;if(n)return(t=t.modify()).boxOffset=e,t.sourceNode=n,t.resetView(),this.processShadowContent(t)}return t.shadowSibling?((t=t.shadowSibling.modify()).boxOffset=e,t):((t=t.parent.modify()).boxOffset=e,t.after=!0,t)}if(t.nodeShadow){var i=t.nodeShadow.root;if(t.nodeShadow.type==Ya.ROOTLESS&&(i=i.firstChild),i){var r=new Za(i,t,e);return r.shadowContext=t.nodeShadow,r.shadowType=t.nodeShadow.type,this.processShadowContent(r)}}var o=t.sourceNode.firstChild;return o?this.processShadowContent(new Za(o,t,e)):(1!=t.sourceNode.nodeType&&(e+=Pa(t.preprocessedTextContent).length-1-t.offsetInNode),(t=t.modify()).boxOffset=e,t.after=!0,t)},n.isTransclusion=function(t,e,n){var i=Xr(e,"hyperlink-processing");if(!i)return!1;var r=i.evaluate(this.context,"hyperlink-processing");return!!r&&r.toString()==n},n.nextInTree=function(t,e){var n=this,i=this.nextPositionInTree(t);if(!i||i.after)return bi(i);var r=Ni("nextInTree");return this.setCurrent(i,!0,e).then(function(t){i.viewNode&&t||((i=i.modify()).after=!0,i.viewNode||(i.inline=!0)),n.dispatchEvent({type:"nextInTree",nodeContext:i}),r.finish(i)}),r.result()},n.addImageFetchers=function(t){if(t instanceof He)for(var e=t.values,n=0;n<e.length;n++)this.addImageFetchers(e[n]);else if(t instanceof Me){var i=t.url;this.page.fetchers.push(Di(new Image,i))}},n.applyComputedStyles=function(t,e){var n=e["background-image"];n&&this.addImageFetchers(n);var i=e.position===je.relative;for(var r in e)if(!ac[r]){var o=e[r];(o=o.visit(new Pn(this.xmldoc.url,this.documentURLTransformer))).isNumeric()&&Ut(o.unit)&&(o=Xe(o,this.context)),Aa[r]||i&&La[r]?this.page.delayedItems.push(new Oa(t,r,o)):Z(t,r,o.toString())}},n.applyPseudoelementStyle=function(t,e,n){if(!t.after){var i=(t.shadowContext?t.shadowContext.styler:this.styler).getStyle(this.sourceNode,!1),r=Yr(i,"_pseudos");if(r&&(i=r[e])){var o={};t.vertical=this.computeStyle(t.vertical,"rtl"===t.direction,i,o);var a=o.content;rs(a)&&(a.visit(new is(n,this.context,a,this.exprContentListener)),delete o.content),this.applyComputedStyles(n,o)}}},n.peelOff=function(t,e){var n=this,i=Ni("peelOff"),r=t.firstPseudo,o=t.offsetInNode,a=t.after;if(e>0)t.viewNode.textContent=t.viewNode.textContent.substr(0,e),o+=e;else if(!a&&t.viewNode&&0==o){var s=t.viewNode.parentNode;s&&s.removeChild(t.viewNode)}for(var l=t.boxOffset+e,u=[];t.firstPseudo===r;)u.push(t),t=t.parent;var h=u.pop(),c=h.shadowSibling;return i.loop(function(){for(;u.length>0;){h=u.pop(),t=new Za(h.sourceNode,t,l),0==u.length&&(t.offsetInNode=o,t.after=a),t.shadowType=h.shadowType,t.shadowContext=h.shadowContext,t.nodeShadow=h.nodeShadow,t.shadowSibling=h.shadowSibling?h.shadowSibling:c,c=null;var e=n.setCurrent(t,!1);if(e.isPending())return e}return bi(!1)}).then(function(){i.finish(t)}),i.result()},n.createElement=function(t,e){return t==V.XHTML?this.document.createElement(e):this.document.createElementNS(t,e)},n.applyFootnoteStyle=function(t,e,n){var i={},r=Yr(this.footnoteStyle,"_pseudos");if(t=this.computeStyle(t,e,this.footnoteStyle,i),r&&r.before){var o={},a=this.createElement(V.XHTML,"span");$s(a,"before"),n.appendChild(a),this.computeStyle(t,e,r.before,o),delete o.content,this.applyComputedStyles(a,o)}return delete i.content,this.applyComputedStyles(n,i),t},n.processFragmentedBlockEdge=function(t){t&&t.walkUpBlocks(function(t){var e=t.inheritedProps["box-decoration-break"];if(!e||"slice"===e){var n=t.viewNode;t.vertical?(Z(n,"padding-left","0"),Z(n,"border-left","none"),Z(n,"border-top-left-radius","0"),Z(n,"border-bottom-left-radius","0")):(Z(n,"padding-bottom","0"),Z(n,"border-bottom","none"),Z(n,"border-bottom-left-radius","0"),Z(n,"border-bottom-right-radius","0"))}})},n.convertLengthToPx=function(t,e,n){var i=t.num,r=t.unit;if(function(t){switch(t.toLowerCase()){case"em":case"ex":case"rem":return!0;default:return!1}}(r)){for(var o=e;o&&1!==o.nodeType;)o=o.parentNode;return eo(t,parseFloat(n.getElementComputedStyle(o)["font-size"]),this.context).num}var a=this.context.queryUnitSize(r,!1);return a?i*a:t},n.isSameNodePositionStep=function(t,e){if(t.shadowContext){if(!e.shadowContext)return!1;var n=1===e.node.nodeType?e.node:e.node.parentElement;return t.shadowContext.owner===e.shadowContext.owner&&Zs(1===t.node.nodeType?t.node:t.node.parentElement)===Zs(n)}return t.node===e.node},n.isSameNodePosition=function(t,e){var n=this;return t.offsetInNode===e.offsetInNode&&t.after==e.after&&t.steps.length===e.steps.length&&t.steps.every(function(t,i){return n.isSameNodePositionStep(t,e.steps[i])})},n.isPseudoelement=function(t){return!!Zs(t)},e}(ft);rc.SVG_URL_ATTRIBUTES=["color-profile","clip-path","cursor","filter","marker","marker-start","marker-end","marker-mid","fill","stroke","mask"];var oc,ac={"box-decoration-break":!0,"float-min-wrap-block":!0,"float-reference":!0,"flow-into":!0,"flow-linger":!0,"flow-options":!0,"flow-priority":!0,"footnote-policy":!0,page:!0},sc=function(){function t(t){this.layoutBox=t.layoutBox,this.window=t.window}var e=t.prototype;return e.subtractOffsets=function(t,e){var n=e.left,i=e.top;return{left:t.left-n,top:t.top-i,right:t.right-n,bottom:t.bottom-i,width:t.width,height:t.height}},e.getRangeClientRects=function(t){var e=this,n=t.getClientRects(),i=this.layoutBox.getBoundingClientRect();return Array.from(n).map(function(t){return e.subtractOffsets(t,i)})},e.getElementClientRect=function(t){var e=t.getBoundingClientRect(),n=this.layoutBox.getBoundingClientRect();return this.subtractOffsets(e,n)},e.getElementComputedStyle=function(t){return this.window.getComputedStyle(t,null)},t}(),lc=function(){function t(t,e,n,i,r){this.window=t,this.fontSize=e,this.document=t.document,this.root=n||this.document.body;var o=this.root.firstElementChild;o||((o=this.document.createElement("div")).setAttribute("data-vivliostyle-outer-zoom-box","true"),this.root.appendChild(o));var a=o.firstElementChild;a||((a=this.document.createElement("div")).setAttribute("data-vivliostyle-spread-container","true"),o.appendChild(a));var s=o.nextElementSibling;s||((s=this.document.createElement("div")).setAttribute("data-vivliostyle-layout-box","true"),this.root.appendChild(s)),this.outerZoomBox=o,this.contentContainer=a,this.layoutBox=s;var l=new sc(this).getElementComputedStyle(this.root);this.width=i||parseFloat(l.width)||t.innerWidth,this.height=r||parseFloat(l.height)||t.innerHeight}var e=t.prototype;return e.resetZoom=function(){Z(this.outerZoomBox,"width",""),Z(this.outerZoomBox,"height",""),Z(this.contentContainer,"width",""),Z(this.contentContainer,"height",""),Z(this.contentContainer,"transform","")},e.zoom=function(t,e,n){Z(this.outerZoomBox,"width",t*n+"px"),Z(this.outerZoomBox,"height",e*n+"px"),Z(this.contentContainer,"width",t+"px"),Z(this.contentContainer,"height",e+"px"),Z(this.contentContainer,"transform","scale("+n+")")},e.clear=function(){for(var t=this.root;t.lastChild;)t.removeChild(t.lastChild)},t}(),uc=function(){function t(t,e,n){this.store=t,this.url=e,this.document=n,this.lang=null,this.totalOffset=-1,this.lastOffset=1,this.root=n.documentElement;var i=null,r=null;if(this.root.namespaceURI==V.XHTML){for(var o=this.root.firstChild;o;o=o.nextSibling)if(1==o.nodeType){var a=o;if(a.namespaceURI==V.XHTML)switch(a.localName){case"head":r=a;break;case"body":i=a}}this.lang=this.root.getAttribute("lang")}this.body=i,this.head=r,this.last=this.root,this.last.setAttribute("data-adapt-eloff","0")}var e=t.prototype;return e.doc=function(){return new dc([this.document])},e.getElementOffset=function(t){var e=t.getAttribute("data-adapt-eloff");if(e)return parseInt(e,10);for(var n=this.lastOffset,i=this.last;i!=t;){var r=i.firstChild;if(!r)for(;!(r=i.nextSibling);)if(null==(i=i.parentNode))throw new Error("Internal error");i=r,1==r.nodeType?(r.setAttribute("data-adapt-eloff",n.toString()),++n):n+=r.textContent.length}return this.lastOffset=n,this.last=t,n-1},e.getNodeOffset=function(t,e,n){var i=0,r=t,o=null;if(1==r.nodeType){if(!n)return this.getElementOffset(r)}else{if(i=e,!(o=r.previousSibling))return i+=1,this.getElementOffset(r=r.parentNode)+i;r=o}for(;;){for(;r.lastChild;)r=r.lastChild;if(1==r.nodeType)break;if(i+=r.textContent.length,!(o=r.previousSibling)){r=r.parentNode;break}r=o}return i+=1,this.getElementOffset(r)+i},e.getTotalOffset=function(){return this.totalOffset<0&&(this.totalOffset=this.getNodeOffset(this.root,0,!0)),this.totalOffset},e.getNodeByOffset=function(t){for(var e,n=this,i=this.root,r=function(){if((e=n.getElementOffset(i))>=t)return{v:i};var r=i.children;if(!r)return"break";var o=lt(r.length,function(e){return n.getElementOffset(r[e])>t});if(0==o)return"break";i=r[o-1]};;){var o=r();if("break"===o)break;if("object"==typeof o)return o.v}for(var a=e+1,s=i,l=s.firstChild||s.nextSibling,u=null;;){if(l){if(1==l.nodeType)break;if(u=s=l,(a+=l.textContent.length)>t&&!/^\s*$/.test(l.textContent))break}else if(!(s=s.parentNode))break;l=s.nextSibling}return l&&u&&/^\s*$/.test(u.textContent)&&(u=l),u||i},e.buildIdMap=function(t){var e=t.getAttribute("id");e&&!this.idMap[e]&&(this.idMap[e]=t);var n=t.getAttributeNS(V.XML,"id");n&&!this.idMap[n]&&(this.idMap[n]=t);for(var i=t.firstElementChild;i;i=i.nextElementSibling)this.buildIdMap(i)},e.getElement=function(t){var e=t.match(/([^#]*)#(.+)$/);if(!e||e[1]&&e[1]!=this.url)return null;var n=e[2],i=this.document.getElementById(n);return!i&&this.document.getElementsByName&&(i=this.document.getElementsByName(n)[0]),i||(this.idMap||(this.idMap={},this.buildIdMap(this.document.documentElement)),i=this.idMap[n]),i},t}();function hc(t,e,n){var i,r=n||new DOMParser;try{i=r.parseFromString(t,e)}catch(t){}if(!i)return null;var o=i.documentElement;if("parsererror"===o.localName)return null;for(var a=o.firstElementChild;a;a=a.nextElementSibling)if("parsererror"===a.localName)return null;return i}function cc(t,e){var n=t.responseXML;if(!n){var i=new DOMParser,r=t.responseText;if(r){var o=function(t){var e=t.contentType;if(e){for(var n=Object.keys(oc),i=0;i<n.length;i++)if(oc[n[i]]===e)return e;if(e.match(/\+xml$/))return oc.APPLICATION_XML}var r=t.url.match(/\.([^./]+)$/);if(r)switch(r[1]){case"html":case"htm":return oc.TEXT_HTML;case"xhtml":case"xht":return oc.APPLICATION_XHTML_XML;case"svg":case"svgz":return oc.IMAGE_SVG_XML;case"opf":case"xml":return oc.APPLICATION_XML}return null}(t);if((n=hc(r,o||oc.APPLICATION_XML,i))&&!o){var a=n.documentElement;"html"!==a.localName.toLowerCase()||a.namespaceURI?"svg"===a.localName.toLowerCase()&&n.contentType!==oc.IMAGE_SVG_XML&&(n=hc(r,oc.IMAGE_SVG_XML,i)):n=hc(r,oc.TEXT_HTML,i)}n||(n=hc(r,oc.TEXT_HTML,i))}}return bi(n?new uc(e,t.url,n):null)}!function(t){t.TEXT_HTML="text/html",t.TEXT_XML="text/xml",t.APPLICATION_XML="application/xml",t.APPLICATION_XHTML_XML="application/xhtml+xml",t.IMAGE_SVG_XML="image/svg+xml"}(oc||(oc={}));var fc=new(function(){function t(t){this.fn=t}var e=t.prototype;return e.check=function(t){return this.fn(t)},e.withAttribute=function(e,n){var i=this;return new t(function(t){return i.check(t)&&1==t.nodeType&&t.getAttribute(e)==n})},e.withChild=function(e,n){var i=this;return new t(function(t){if(!i.check(t))return!1;var r=new dc([t]);return r=r.child(e),n&&(r=r.predicate(n)),r.size()>0})},t}())(function(t){return!0}),dc=function(){function t(t){this.nodes=t}var e=t.prototype;return e.asArray=function(){return this.nodes},e.size=function(){return this.nodes.length},e.predicate=function(e){for(var n,i=[],r=D(this.nodes);!(n=r()).done;){var o=n.value;e.check(o)&&i.push(o)}return new t(i)},e.forEachNode=function(e){for(var n=[],i=function(t){n.push(t)},r=0;r<this.nodes.length;r++)e(this.nodes[r],i);return new t(n)},e.forEach=function(t){for(var e=[],n=0;n<this.nodes.length;n++)e.push(t(this.nodes[n]));return e},e.forEachNonNull=function(t){for(var e=[],n=0;n<this.nodes.length;n++){var i=t(this.nodes[n]);null!=i&&e.push(i)}return e},e.child=function(t){return this.forEachNode(function(e,n){for(var i=e.firstChild;i;i=i.nextSibling)1==i.nodeType&&i.localName==t&&n(i)})},e.childElements=function(){return this.forEachNode(function(t,e){for(var n=t.firstChild;n;n=n.nextSibling)1==n.nodeType&&e(n)})},e.attribute=function(t){return this.forEachNonNull(function(e){return 1==e.nodeType?e.getAttribute(t):null})},e.textContent=function(){return this.forEach(function(t){return t.textContent})},t}(),pc=new Oi(function(){var t=Ni("uaStylesheetBase"),e=Du(),n=G("user-agent-base.css",H),i=new ta(null,null,null,null,null,e,!0);return i.startStylesheet(Wi.USER_AGENT),Jo=i.cascade,mr(Hi,i,n,null,null).thenFinish(t),t.result()},"uaStylesheetBaseFetcher"),gc=function(){function t(t,e,n,i,r,o,a,s,l,u){this.store=t,this.rootScope=e,this.pageScope=n,this.cascade=i,this.rootBox=r,this.fontFaces=o,this.footnoteProps=a,this.flowProps=s,this.viewportProps=l,this.pageProps=u,this.fontDeobfuscator=t.fontDeobfuscator,this.validatorSet=t.validatorSet,this.pageScope.defineBuiltIn("has-content",function(t){var e=this.currentLayoutPosition,n=e.firstFlowChunkOfFlow(t=t);return this.matchPageSide(e.startSideOfFlow(t))&&e.hasContent(t,this.lookupOffset)&&!!n&&!this.flowChunkIsAfterParentFlowForcedBreak(n)}),this.pageScope.defineName("page-number",new pe(this.pageScope,function(){return this.pageNumberOffset+this.currentLayoutPosition.page},"page-number"))}return t.prototype.sizeViewport=function(t,e,n,i){if(this.viewportProps.length){var r=new Vt(this.rootScope,t,e,n),o=function(t,e){for(var n={},i=0;i<e.length;i++)$r(t,n,e[i],0,null,null,null);return n}(r,this.viewportProps),a=o.width,s=o.height,l=o["text-zoom"],u=1;if(a&&s||l){var h=Mt.em;if((l?l.evaluate(r,"text-zoom"):null)===je.scale&&(u=h/n,n=h,t*=u,e*=u),a&&s){var c=We(a.evaluate(r,"width"),r),f=We(s.evaluate(r,"height"),r);if(c>0&&f>0)return{width:i&&i.spreadView?2*(c+i.pageBorder):c,height:f,fontSize:n}}}}return{width:t,height:e,fontSize:n}},t}(),mc=function(t){function e(e,n,i,r,o,a,s,l,u,h,c,f){var d;for(var p in(d=t.call(this,e.rootScope,r.width,r.height,r.fontSize)||this).style=e,d.xmldoc=n,d.viewport=r,d.clientLayout=o,d.fontMapper=a,d.customRenderer=s,d.fallbackMap=l,d.pageNumberOffset=u,d.documentURLTransformer=h,d.counterStore=c,d.primaryFlows={body:!0},d.rootPageBoxInstance=null,d.styler=null,d.stylerMap=null,d.currentLayoutPosition=null,d.layoutPositionAtPageStart=null,d.lookupOffset=0,d.pageBoxInstances={},d.pageManager=null,d.pageBreaks={},d.pageProgression=null,d.pageSheetSize={},d.pageSheetHeight=0,d.pageSheetWidth=0,d.lang=n.lang||i,d.faces=new Vu(d.style.fontDeobfuscator),d.rootPageFloatLayoutContext=new cs(null,null,null,null,null,null,null),d.pageProgression=f||null,e.flowProps){var g=Xr(e.flowProps[p],"flow-consume");g&&(g.evaluate(O(d),"flow-consume")==je.all?d.primaryFlows[p]=!0:delete d.primaryFlows[p])}return d}x(e,t);var n=e.prototype;return n.init=function(){var t=this,e=Ni("StyleInstance.init"),n=this.counterStore.createCounterListener(this.xmldoc.url),i=this.counterStore.createCounterResolver(this.xmldoc.url,this.style.rootScope,this.style.pageScope);this.styler=new fu(this.xmldoc,this.style.cascade,this.style.rootScope,this,this.primaryFlows,this.style.validatorSet,n,i),i.setStyler(this.styler),this.styler.resetFlowChunkStream(this),this.stylerMap={},this.stylerMap[this.xmldoc.url]=this.styler;var r=this.styler.getTopContainerStyle();this.pageProgression||(this.pageProgression=gh(r)),this.rootPageBoxInstance=new sh(this.style.rootBox);var o=this.style.cascade.createInstance(this,n,i,this.lang);this.rootPageBoxInstance.applyCascadeAndInit(o,r),this.rootPageBoxInstance.resolveAutoSizing(this),this.pageManager=new zh(o,this.style.pageScope,this.rootPageBoxInstance,this,r);for(var a,s=[],l=D(this.style.fontFaces);!(a=l()).done;){var u=a.value;if(!u.condition||u.condition.evaluate(this)){var h=Mu(u.properties,this),c=new Uu(h);s.push(c)}}this.fontMapper.findOrLoadFonts(s,this.faces).thenFinish(e);var f=this.style.pageProps;return Object.keys(f).forEach(function(e){var n=Ch(Sh(f[e]),t);t.pageSheetSize[e]={width:n.pageWidth+2*n.cropOffset,height:n.pageHeight+2*n.cropOffset}}),e.result()},n.getStylerForDoc=function(t){var e=this.stylerMap[t.url];if(!e){var n=this.style.store.getStyleForDoc(t),i=new Vt(n.rootScope,this.pageWidth(),this.pageHeight(),this.initialFontSize),r=this.counterStore.createCounterListener(t.url),o=this.counterStore.createCounterResolver(t.url,n.rootScope,n.pageScope);e=new fu(t,n.cascade,n.rootScope,i,this.primaryFlows,n.validatorSet,r,o),this.stylerMap[t.url]=e}return e},n.registerInstance=function(t,e){this.pageBoxInstances[t]=e},n.lookupInstance=function(t){return this.pageBoxInstances[t]},n.encounteredFlowChunk=function(t,e){var n=this.currentLayoutPosition;if(n){n.flows[t.flowName]?e=n.flows[t.flowName]:n.flows[t.flowName]=e;var i=n.flowPositions[t.flowName];i||(i=new ts,n.flowPositions[t.flowName]=i);var r=new $a({steps:[{node:t.element,shadowType:Ya.NONE,shadowContext:null,nodeShadow:null,shadowSibling:null,formattingContext:null,fragmentIndex:0}],offsetInNode:0,after:!1,preprocessedTextContent:null}),o=new Ja(r,t);i.positions.push(o)}},n.getConsumedOffset=function(t){for(var e=Number.POSITIVE_INFINITY,n=0;n<t.positions.length;n++){for(var i=t.positions[n].chunkPosition.primary,r=i.steps[0].node,o=i.offsetInNode,a=i.after,s=0;r.ownerDocument!=this.xmldoc.document;)s++,r=i.steps[s].node,a=!1,o=0;var l=this.xmldoc.getNodeOffset(r,o,a);l<e&&(e=l)}return e},n.getPosition=function(t,e){if(!t)return 0;var n=Number.POSITIVE_INFINITY;for(var i in this.primaryFlows){var r=t.flowPositions[i];if(e||r&&0!=r.positions.length||!this.currentLayoutPosition||(this.styler.styleUntilFlowIsReached(i),r=this.currentLayoutPosition.flowPositions[i],t!=this.currentLayoutPosition&&r&&(r=r.clone(),t.flowPositions[i]=r)),r){var o=this.getConsumedOffset(r);o<n&&(n=o)}}return n},n.dumpLocation=function(t){for(var e in h.debug("Location - page",this.currentLayoutPosition.page),h.debug(" current:",t),h.debug(" lookup:",this.lookupOffset),this.currentLayoutPosition.flowPositions)for(var n,i=D(this.currentLayoutPosition.flowPositions[e].positions);!(n=i()).done;)h.debug(" Chunk",e+":",n.value.flowChunk.startOffset)},n.matchPageSide=function(t){switch(t){case"left":case"right":case"recto":case"verso":return new fe(this.style.pageScope,t+"-page").evaluate(this);default:return!0}},n.updateStartSide=function(t){for(var e in t.flowPositions){var n=t.flowPositions[e];if(n&&n.positions.length>0){var i=n.positions[0].flowChunk;if(this.getConsumedOffset(n)===i.startOffset){var r=n.positions[0].flowChunk.breakBefore,o=Cs(n.startSide);n.startSide=Ss(bs(o,r))}}}},n.selectPageMaster=function(t){var e=this.currentLayoutPosition,n=this.getPosition(e);if(n==Number.POSITIVE_INFINITY)return null;for(var i,r=this.rootPageBoxInstance.children,o=0;o<r.length;o++)if("vivliostyle-page-rule-master"!==(i=r[o]).pageBox.pseudoName){var a=1,s=i.getProp(this,"utilization");s&&s.isNum()&&(a=s.num);var l=this.queryUnitSize("em",!1),u=this.pageWidth()*this.pageHeight(),h=Math.ceil(a*u/(l*l));this.lookupOffset=this.styler.styleUntil(n,h),this.updateStartSide(e),this.layoutPositionAtPageStart=e.clone(),this.initLingering(),this.clearScope(this.style.pageScope);var c=i.getProp(this,"enabled");if(!c||c===je._true)return this.pageManager.getPageRulePageMaster(i,t)}throw new Error("No enabled page masters")},n.flowChunkIsAfterParentFlowForcedBreak=function(t){var e=this.layoutPositionAtPageStart.flows,n=e[t.flowName].parentFlowName;if(n){var i=t.startOffset,r=e[n].forcedBreakOffsets;if(!r.length||i<r[0])return!1;var o=lt(r.length,function(t){return r[t]>i})-1,a=r[o],s=this.layoutPositionAtPageStart.flowPositions[n],l=this.getConsumedOffset(s);return!(a<l)&&(l<a||!this.matchPageSide(s.startSide))}return!1},n.setFormattingContextToColumn=function(t,e){var n=this.currentLayoutPosition.flows[e];n.formattingContext||(n.formattingContext=new Hs(null)),t.flowRootFormattingContext=n.formattingContext},n.layoutDeferredPageFloats=function(t){var e=t.pageFloatLayoutContext,n=e.getDeferredPageFloatContinuations(),i=Ni("layoutDeferredPageFloats"),r=!1,o=0;return i.loopWithFrame(function(i){if(o!==n.length){var a=n[o++],s=a.float,l=(new ds).findByFloat(s),u=l.findPageFloatFragment(s,e);if(!u||!u.hasFloat(s))return e.isForbidden(s)||e.hasPrecedingFloatsDeferredToNext(s)?(e.deferPageFloat(a),void i.breakLoop()):void t.layoutPageFloatInner(a,l,null,u).then(function(t){if(t){var n=e.parent.isInvalidated();n?i.breakLoop():(e.isInvalidated()&&!n&&(r=!0,e.validate()),i.continueLoop())}else i.breakLoop()});i.continueLoop()}else i.breakLoop()}).then(function(){r&&e.invalidate(),i.finish(!0)}),i.result()},n.getLastAfterPositionIfDeferredFloatsExists=function(t,e){var n;return t.pageFloatLayoutContext.getPageFloatContinuationsDeferredToNext().length>0&&t.lastAfterPosition?(e?(n=e.clone()).primary=t.lastAfterPosition:n=new $a(t.lastAfterPosition),n):null},n.layoutColumn=function(t,e){var n=this,i=this.currentLayoutPosition.flowPositions[e];if(!i||!this.matchPageSide(i.startSide))return bi(!0);i.startSide="any",this.setFormattingContextToColumn(t,e),t.init(),this.primaryFlows[e]&&t.bands.length>0&&(t.forceNonfitting=!1);var r=Ni("layoutColumn");return this.layoutDeferredPageFloats(t).then(function(){if(t.pageFloatLayoutContext.isInvalidated())r.finish(!0);else{var o=[],a=[],s=!0;r.loopWithFrame(function(r){if(t.pageFloatLayoutContext.hasContinuingFloatFragmentsInFlow(e))r.breakLoop();else{for(var l=function(){for(var e=0;a.includes(e);)e++;var l=i.positions[e];if(l.flowChunk.startOffset>n.lookupOffset||n.flowChunkIsAfterParentFlowForcedBreak(l.flowChunk))return"break";for(var u=e+1;u<i.positions.length;u++)if(!a.includes(u)){var h=i.positions[u];if(h.flowChunk.startOffset>n.lookupOffset||n.flowChunkIsAfterParentFlowForcedBreak(h.flowChunk))break;h.flowChunk.isBetter(l.flowChunk)&&(l=h,e=u)}var c=l.flowChunk,f=!0;return t.layout(l.chunkPosition,s,i.breakAfter).then(function(u){if(t.pageFloatLayoutContext.isInvalidated())r.breakLoop();else{if(s=!1,l.flowChunk.repeated&&(null===u||c.exclusive)&&o.push(e),c.exclusive)return a.push(e),void r.breakLoop();var h=!!u||!!t.pageBreakType,d=n.getLastAfterPositionIfDeferredFloatsExists(t,u);t.pageBreakType&&d?(l.chunkPosition=d,i.breakAfter=t.pageBreakType,t.pageBreakType=null):(a.push(e),(u||d)&&(l.chunkPosition=u||d,o.push(e)),t.pageBreakType&&(i.startSide=Ss(t.pageBreakType))),h?r.breakLoop():(t.forceNonfitting=!1,f?f=!1:r.continueLoop())}}),f?(f=!1,{v:void 0}):void 0};i.positions.length-a.length>0;){var u=l();if("break"===u)break;if("object"==typeof u)return u.v}r.breakLoop()}}).then(function(){if(!t.pageFloatLayoutContext.isInvalidated()){i.positions=i.positions.filter(function(t,e){return o.includes(e)||!a.includes(e)}),"column"===i.breakAfter&&(i.breakAfter=null),t.saveDistanceToBlockEndFloats();var e=t.pageFloatLayoutContext.getMaxReachedAfterEdge();t.updateMaxReachedAfterEdge(e)}r.finish(!0)})}}),r.result()},n.createLayoutConstraint=function(t){var e=this.counterStore.createLayoutConstraint(this.currentLayoutPosition.page-1);return new sl([e].concat(t.getLayoutConstraints()))},n.createAndLayoutColumn=function(t,e,n,i,r,o,a,s,l,u,h,c,f,d){var p,g=this,m=t.vertical?t.isAutoWidth&&t.isRightDependentOnAutoWidth:t.isAutoHeight&&t.isTopDependentOnAutoHeight,v=r.element,E=new cs(s,os.COLUMN,null,a,null,null,null),w=this.currentLayoutPosition.clone(),y=Ni("createAndLayoutColumn");return y.loopWithFrame(function(t){var y=g.createLayoutConstraint(E);if(l>1){var N=g.viewport.document.createElement("div");if(Z(N,"position","absolute"),v.appendChild(N),(p=new hl(N,f,g.clientLayout,y,E)).forceNonfitting=d,p.vertical=r.vertical,p.snapHeight=r.snapHeight,p.snapWidth=r.snapWidth,r.vertical){var b=o*(h+u)+r.paddingTop;p.setHorizontalPosition(r.paddingLeft,r.width),p.setVerticalPosition(b,h)}else{var S=o*(h+u)+r.paddingLeft;p.setVerticalPosition(r.paddingTop,r.height),p.setHorizontalPosition(S,h)}p.originX=e,p.originY=n}else(p=new hl(v,f,g.clientLayout,y,E)).copyFrom(r);p.exclusions=m?[]:i.concat(),p.innerShape=c,E.setContainer(p),p.width>=0?g.layoutColumn(p,a).then(function(){E.isInvalidated()||E.finish(),p.pageFloatLayoutContext.isInvalidated()&&!s.isInvalidated()?(p.pageFloatLayoutContext.validate(),g.currentLayoutPosition=w.clone(),p.element!==v&&v.removeChild(p.element),t.continueLoop()):t.breakLoop()}):(E.finish(),t.breakLoop())}).then(function(){y.finish(p)}),y.result()},n.setPagePageFloatLayoutContextContainer=function(t,e,n){(e instanceof Vh||e instanceof lh&&!(e instanceof _h))&&t.setContainer(n)},n.getRegionPageFloatLayoutContext=function(t,e,n,i){var r=e.getProp(this,"writing-mode")||null,o=e.getProp(this,"direction")||null;return new cs(t,os.REGION,n,i,null,r,o)},n.layoutFlowColumnsWithBalancing=function(t,e,n,i,r,o,a,s,l){var u=this,h=this.currentLayoutPosition.clone(),c=this.getRegionPageFloatLayoutContext(o,e,a,s),f=!0,d=function(){return u.currentLayoutPosition=h.clone(),u.layoutFlowColumns(t,e,n,i,r,o,c,a,s,l,f).thenAsync(function(t){return bi(t?{columns:t,position:u.currentLayoutPosition}:null)})};return d().thenAsync(function(t){if(!t)return bi(null);if(l<=1)return bi(t.columns);var n=e.getProp(u,"column-fill")||je.balance,i=function(t,e,n,i,r,o,a){if(e===je.auto)return null;var s=o[o.length-1];return 0===a.positions.length||s&&s.pageBreakType?new ru(n,i,r,t):e===je.balance_all?new su(n,i,r):null}(l,n,d,c,a,t.columns,u.currentLayoutPosition.flowPositions[s]);return i?(f=!1,o.lock(),c.lock(),i.balanceColumns(t).thenAsync(function(t){return o.unlock(),o.validate(),c.unlock(),u.currentLayoutPosition=t.position,bi(t.columns)})):bi(t.columns)})},n.layoutFlowColumns=function(t,e,n,i,r,o,a,s,l,u,h){var c=this,f=Ni("layoutFlowColumns"),d=this.currentLayoutPosition.clone(),p=e.getPropAsNumber(this,"column-gap"),g=u>1?e.getPropAsNumber(this,"column-width"):s.width,m=e.getActiveRegions(this),v=Tn(e.getProp(this,"shape-inside"),0,0,s.width,s.height,this),E=new rc(l,this,this.viewport,this.styler,m,this.xmldoc,this.faces,this.style.footnoteProps,this,t,this.customRenderer,this.fallbackMap,this.documentURLTransformer),w=0,y=null,N=[];return f.loopWithFrame(function(t){c.createAndLayoutColumn(e,n,i,r,s,w++,l,a,u,p,g,v,E,h).then(function(e){return o.isInvalidated()?(N=null,void t.breakLoop()):(!(e.pageBreakType&&"column"!==e.pageBreakType)&&w!==u||a.isInvalidated()||a.finish(),a.isInvalidated()?(w=0,c.currentLayoutPosition=d.clone(),a.validate(),void(a.isLocked()?(N=null,t.breakLoop()):t.continueLoop())):(N[w-1]=y=e,y.pageBreakType&&"column"!=y.pageBreakType&&(w=u,"region"!=y.pageBreakType&&(c.pageBreaks[l]=!0)),void(w<u?t.continueLoop():t.breakLoop())))})}).then(function(){f.finish(N)}),f.result()},n.layoutContainer=function(t,e,n,i,r,o,a){var s=this;e.reset();var l=e.getProp(this,"enabled");if(l&&l!==je._true)return bi(!0);var u=Ni("layoutContainer"),h=e.getProp(this,"wrap-flow")===je.auto,c=e.getProp(this,"flow-from"),f=this.viewport.document.createElement("div"),d=e.getProp(this,"position");Z(f,"position",d?d.name:"absolute"),n.insertBefore(f,n.firstChild);var p,g=new ns(f);g.vertical=e.vertical,g.exclusions=o,e.prepareContainer(this,g,t,this.faces,this.clientLayout),g.originX=i,g.originY=r,i+=g.left+g.marginLeft+g.borderLeft,r+=g.top+g.marginTop+g.borderTop,this.setPagePageFloatLayoutContextContainer(a,e,g);var m=!1;if(c&&c.isIdent())if(this.pageBreaks[c.toString()])a.isInvalidated()||e.finishContainer(this,g,t,null,1,this.clientLayout,this.faces),p=bi(!0);else{var v=Ni("layoutContainer.inner"),E=c.toString(),w=e.getPropAsNumber(this,"column-count");this.layoutFlowColumnsWithBalancing(t,e,i,r,o,a,g,E,w).then(function(n){if(!a.isInvalidated()){var i=n[0];i.element===f&&(g=i),g.computedBlockSize=Math.max.apply(null,n.map(function(t){return t.computedBlockSize})),e.finishContainer(s,g,t,i,w,s.clientLayout,s.faces);var r=s.currentLayoutPosition.flowPositions[E];r&&"region"===r.breakAfter&&(r.breakAfter=null)}v.finish(!0)}),p=v.result()}else{var y=e.getProp(this,"content");if(y&&rs(y)){var N="span";y.url&&(N="img");var b=this.viewport.document.createElement(N);y.visit(new is(b,this,y,this.counterStore.getExprContentListener())),f.appendChild(b),"img"==N&&e.transferSinglUriContentProps(this,b,this.faces),e.transferContentProps(this,g,t,this.faces)}else e.suppressEmptyBoxGeneration&&(n.removeChild(f),m=!0);m||e.finishContainer(this,g,t,null,1,this.clientLayout,this.faces),p=bi(!0)}return p.then(function(){if(a.isInvalidated())u.finish(!0);else{if(!e.isAutoHeight||Math.floor(g.computedBlockSize)>0){if(!m&&!h){var l=e.getProp(s,"shape-outside"),c=g.getOuterShape(l,s);o.push(c)}}else if(0==e.children.length)return n.removeChild(f),void u.finish(!0);var d=e.children.length-1;u.loop(function(){for(;d>=0;){var n=e.children[d--],l=s.layoutContainer(t,n,f,i,r,o,a);if(l.isPending())return l.thenAsync(function(){return bi(!a.isInvalidated())});if(a.isInvalidated())break}return bi(!1)}).then(function(){u.finish(!0)})}}),u.result()},n.processLinger=function(){var t=this.currentLayoutPosition.page;for(var e in this.currentLayoutPosition.flowPositions)for(var n=this.currentLayoutPosition.flowPositions[e],i=n.positions.length-1;i>=0;i--){var r=n.positions[i];r.flowChunk.startPage>=0&&r.flowChunk.startPage+r.flowChunk.linger-1<=t&&n.positions.splice(i,1)}},n.initLingering=function(){var t=this.currentLayoutPosition.page;for(var e in this.currentLayoutPosition.flowPositions)for(var n=this.currentLayoutPosition.flowPositions[e],i=n.positions.length-1;i>=0;i--){var r=n.positions[i];r.flowChunk.startPage<0&&r.flowChunk.startOffset<this.lookupOffset&&(r.flowChunk.startPage=t)}},n.noMorePrimaryFlows=function(t){for(var e in this.primaryFlows){var n=t.flowPositions[e];if(n&&n.positions.length>0)return!1}return!0},n.layoutNextPage=function(t,e){var n=this,i=t.container===t.bleedBox;this.pageBreaks={},e?(this.currentLayoutPosition=e.clone(),this.styler.replayFlowElementsFromOffset(e.highestSeenOffset)):(this.currentLayoutPosition=new es,this.styler.replayFlowElementsFromOffset(-1)),this.lang&&t.bleedBox.setAttribute("lang",this.lang),(e=this.currentLayoutPosition).page++,this.clearScope(this.style.pageScope),this.layoutPositionAtPageStart=e.clone();var r=i?{}:this.pageManager.getCascadedPageStyle(),o=this.selectPageMaster(r);if(!o)return bi(null);var a=0;if(!i){t.setAutoPageWidth(o.pageBox.specified.width.value===Ke),t.setAutoPageHeight(o.pageBox.specified.height.value===qe),this.counterStore.setCurrentPage(t),this.counterStore.updatePageCounters(r,this);var s=Ch(Sh(r),this);this.setPageSizeAndBleed(s,t),function(t,e,n,i){var r=!1,o=!1,a=t.marks;if(a){var s=a.value;s.isSpaceList()?s.values.forEach(function(t){t===je.crop?r=!0:t===je.cross&&(o=!0)}):s===je.crop?r=!0:s===je.cross&&(o=!0)}if(r||o){var l=n.container,u=l.ownerDocument,h=e.bleed,c=We(wh,i),f=We(yh,i),d=We(Nh,i);if(h){var p=t["background-color"];p&&p.value&&(n.bleedBox.style.backgroundColor=p.value.stringValue())}r&&Object.keys(mh).forEach(function(t){var e=function(t,e,n,i,r,o){var a=i;a<=r+2*Mt.mm&&(a=r+i/2);var s=Math.max(i,a),l=r+s+n/2,u=Th(t,l,l),h=[[0,r+i],[i,r+i],[i,r+i-a]],c=h.map(function(t){return[t[1],t[0]]});e!==mh.TOP_RIGHT&&e!==mh.BOTTOM_RIGHT||(h=h.map(function(t){return[r+s-t[0],t[1]]}),c=c.map(function(t){return[r+s-t[0],t[1]]})),e!==mh.BOTTOM_LEFT&&e!==mh.BOTTOM_RIGHT||(h=h.map(function(t){return[t[0],r+s-t[1]]}),c=c.map(function(t){return[t[0],r+s-t[1]]}));var f=xh(t,n);f.setAttribute("points",h.map(function(t){return t.join(",")}).join(" ")),u.appendChild(f);var d=xh(t,n);return d.setAttribute("points",c.map(function(t){return t.join(",")}).join(" ")),u.appendChild(d),e.split(" ").forEach(function(t){u.style[t]=o+"px"}),u}(u,mh[t],c,d,h,f);l.appendChild(e)}),o&&Object.keys(vh).forEach(function(t){var e=function(t,e,n,i,r){var o,a,s=2*i;e===vh.TOP||e===vh.BOTTOM?(o=s,a=i):(o=i,a=s);var l=Th(t,o,a),u=xh(t,n);u.setAttribute("points","0,"+a/2+" "+o+","+a/2),l.appendChild(u);var h=xh(t,n);h.setAttribute("points",o/2+",0 "+o/2+","+a),l.appendChild(h);var c,f=xh(t,n,"circle");switch(f.setAttribute("cx",o/2),f.setAttribute("cy",a/2),f.setAttribute("r",i/4),l.appendChild(f),e){case vh.TOP:c=vh.BOTTOM;break;case vh.BOTTOM:c=vh.TOP;break;case vh.LEFT:c=vh.RIGHT;break;case vh.RIGHT:c=vh.LEFT}return Object.keys(vh).forEach(function(t){var n=vh[t];n===e?l.style[n]=r+"px":n!==c&&(l.style[n]="0",l.style["margin-"+n]="auto")}),l}(u,vh[t],c,d,f);l.appendChild(e)})}}(r,s,t,this),a=s.bleedOffset+s.bleed}var l=!i&&o.getProp(this,"writing-mode")||je.horizontal_tb;this.pageVertical=l!=je.horizontal_tb;var u=o.getProp(this,"direction")||je.ltr,h=new cs(this.rootPageFloatLayoutContext,os.PAGE,null,null,null,l,u),c=Ni("layoutNextPage");return c.loopWithFrame(function(e){n.layoutContainer(t,o,t.bleedBox,a,a,[],h).then(function(){h.isInvalidated()||h.finish(),h.isInvalidated()?(n.currentLayoutPosition=n.layoutPositionAtPageStart.clone(),h.validate(),e.continueLoop()):e.breakLoop()})}).then(function(){if(o.adjustPageLayout(n,t,n.clientLayout),!i){var r=new fe(o.pageBox.scope,"left-page");t.side=r.evaluate(n)?exports.PageSide.LEFT:exports.PageSide.RIGHT,n.processLinger(),e=n.currentLayoutPosition,Object.keys(e.flowPositions).forEach(function(t){var i=e.flowPositions[t],r=i.breakAfter;!r||"page"!==r&&n.matchPageSide(r)||(i.breakAfter=null)})}n.currentLayoutPosition=n.layoutPositionAtPageStart=null,e.highestSeenOffset=n.styler.getReachedOffset();var a=n.style.store.getTriggersForDoc(n.xmldoc);t.finish(a,n.clientLayout),n.noMorePrimaryFlows(e)&&(e=null),c.finish(e)}),c.result()},n.setPageSizeAndBleed=function(t,e){this.actualPageWidth=t.pageWidth,this.actualPageHeight=t.pageHeight,this.pageSheetWidth=t.pageWidth+2*t.cropOffset,this.pageSheetHeight=t.pageHeight+2*t.cropOffset,e.container.style.width=this.pageSheetWidth+"px",e.container.style.height=this.pageSheetHeight+"px",e.bleedBox.style.left=t.bleedOffset+"px",e.bleedBox.style.right=t.bleedOffset+"px",e.bleedBox.style.top=t.bleedOffset+"px",e.bleedBox.style.bottom=t.bleedOffset+"px",e.bleedBox.style.padding=t.bleed+"px",e.bleedBox.style.paddingTop=t.bleed+.01+"px"},e}(Vt),vc=function(t){function e(e,n,i,r){var o;return(o=t.call(this,e.rootScope,e,n,i,r,e.validatorSet,!i)||this).masterHandler=e,o.insideRegion=!1,o}x(e,t);var n=e.prototype;return n.startPageTemplateRule=function(){},n.startPageMasterRule=function(t,e,n){var i=new ju(this.masterHandler.pageScope,t,e,n,this.masterHandler.rootBox,this.condition,this.owner.getBaseSpecificity());this.masterHandler.pushHandler(new ph(i.scope,this.masterHandler,i,this.validatorSet))},n.startWhenRule=function(t){var n=t.expr;null!=this.condition&&(n=ye(this.scope,this.condition,n)),this.masterHandler.pushHandler(new e(this.masterHandler,n,this,this.regionId))},n.startDefineRule=function(){this.masterHandler.pushHandler(new ra(this.scope,this.owner))},n.startFontFaceRule=function(){var t={};this.masterHandler.fontFaces.push({properties:t,condition:this.condition}),this.masterHandler.pushHandler(new oa(this.scope,this.owner,null,t,this.masterHandler.validatorSet))},n.startFlowRule=function(t){var e=this.masterHandler.flowProps[t];e||(this.masterHandler.flowProps[t]=e={}),this.masterHandler.pushHandler(new oa(this.scope,this.owner,null,e,this.masterHandler.validatorSet))},n.startViewportRule=function(){var t={};this.masterHandler.viewportProps.push(t),this.masterHandler.pushHandler(new oa(this.scope,this.owner,this.condition,t,this.masterHandler.validatorSet))},n.startFootnoteRule=function(t){var e=this.masterHandler.footnoteProps;if(t){var n=Kr(e,"_pseudos");(e=n[t])||(n[t]=e={})}this.masterHandler.pushHandler(new oa(this.scope,this.owner,null,e,this.masterHandler.validatorSet))},n.startRegionRule=function(){this.insideRegion=!0,this.startSelectorRule()},n.startPageRule=function(){var t=new Qh(this.masterHandler.pageScope,this.masterHandler,this,this.validatorSet,this.masterHandler.pageProps);this.masterHandler.pushHandler(t),t.startPageRule()},n.startRuleBody=function(){if(ta.prototype.startRuleBody.call(this),this.insideRegion){this.insideRegion=!1;var t="R"+this.masterHandler.regionCount++;this.special("region-id",ke(t)),this.endRule();var n=new e(this.masterHandler,this.condition,this,t);this.masterHandler.pushHandler(n),n.startRuleBody()}},e}(ta);function Ec(t){var e=t.getAttribute("content");if(!e)return"";for(var n,i={};null!=(n=e.match(/^,?\s*([-A-Za-z_.][-A-Za-z_0-9.]*)\s*=\s*([-+A-Za-z_0-9.]*)\s*/));)e=e.substr(n[0].length),i[n[1]]=n[2];var r=i.width-0,o=i.height-0;return r&&o?"@-epubx-viewport{width:"+r+"px;height:"+o+"px;}":""}var wc=function(t){function e(e){var n;return(n=t.call(this)||this).validatorSet=e,n.regionCount=0,n.fontFaces=[],n.footnoteProps={},n.flowProps={},n.viewportProps=[],n.pageProps={},n.rootScope=new _t(null),n.pageScope=new _t(n.rootScope),n.rootBox=new Wu(n.rootScope),n.cascadeParserHandler=new vc(O(n),null,null,null),n.slave=n.cascadeParserHandler,n}return x(e,t),e.prototype.error=function(t,e){h.warn("CSS parser:",t)},e}(Qi);function yc(t,e){return e.parseOPSResource(t)}var Nc=function(t){function e(e){var n;return(n=t.call(this,yc,Fi.DOCUMENT)||this).fontDeobfuscator=e,n.styleByKey={},n.styleFetcherByKey={},n.styleByDocURL={},n.triggersByDocURL={},n.validatorSet=null,n.styleSheets=[],n.triggerSingleDocumentPreprocessing=!1,n}x(e,t);var n=e.prototype;return n.init=function(t,e){var n=this;this.setStyleSheets(t,e);var i=G("user-agent.xml",H),r=Ni("OPSDocStore.init");return this.validatorSet=Du(),pc.get().then(function(){n.load(i).then(function(){n.triggerSingleDocumentPreprocessing=!0,r.finish(!0)})}),r.result()},n.getStyleForDoc=function(t){return this.styleByDocURL[t.url]},n.getTriggersForDoc=function(t){return this.triggersByDocURL[t.url]},n.setStyleSheets=function(t,e){this.clearStyleSheets(),t&&t.forEach(this.addAuthorStyleSheet,this),e&&e.forEach(this.addUserStyleSheet,this)},n.clearStyleSheets=function(){this.styleSheets.splice(0)},n.addAuthorStyleSheet=function(t){var e=t.url;e&&(e=G(W(e),M)),this.styleSheets.push({url:e,text:t.text,flavor:Wi.AUTHOR,classes:null,media:null})},n.addUserStyleSheet=function(t){var e=t.url;e&&(e=G(W(e),M)),this.styleSheets.push({url:e,text:t.text,flavor:Wi.USER,classes:null,media:null})},n.parseOPSResource=function(t){var e=this,n=Ni("OPSDocStore.load"),i=t.url,r=i.endsWith("?viv-toc-box");return cc(t,this).then(function(t){if(t){if(e.triggerSingleDocumentPreprocessing)for(var o=p(exports.HOOKS.PREPROCESS_SINGLE_DOCUMENT),a=0;a<o.length;a++)try{o[a](t.document)}catch(t){h.warn("Error during single document preprocessing:",t)}for(var s=[],l=t.document.getElementsByTagNameNS(V.epub,"trigger"),u=0;u<l.length;u++){var c=l[u],f=c.getAttributeNS(V.EV,"observer"),d=c.getAttributeNS(V.EV,"event"),g=c.getAttribute("action"),m=c.getAttribute("ref");f&&d&&g&&m&&s.push({observer:f,event:d,action:g,ref:m})}e.triggersByDocURL[i]=s;var v=[],E=G("user-agent-page.css",H);if(v.push({url:E,text:Vi,flavor:Wi.USER_AGENT,classes:null,media:null}),!r){for(var w,y=D(t.document.querySelectorAll("style, link, meta"));!(w=y()).done;){var N=w.value,b=N.localName;if(N.namespaceURI==V.XHTML)if("style"==b){var S=N.getAttribute("class"),C=N.getAttribute("media"),T=N.getAttribute("title");v.push({url:i,text:N.textContent,flavor:Wi.AUTHOR,classes:T?S:null,media:C})}else if("link"==b){var x=N.getAttribute("rel"),I=N.getAttribute("class"),P=N.getAttribute("media");if("stylesheet"==x||"alternate stylesheet"==x&&I){var R=N.getAttribute("href");R=G(R,i);var A=N.getAttribute("title");v.push({url:R,text:null,classes:A?I:null,media:P,flavor:Wi.AUTHOR})}}else"meta"==b&&"viewport"==N.getAttribute("name")&&v.push({url:i,text:Ec(N),flavor:Wi.AUTHOR,classes:null,media:null})}for(var L=0;L<e.styleSheets.length;L++)v.push(e.styleSheets[L])}for(var O="",k=0;k<v.length;k++)O+=v[k].url,O+="^",v[k].text&&(O+=v[k].text),O+="^";var F=e.styleByKey[O];if(F)return e.styleByDocURL[i]=F,void n.finish(t);var _=e.styleFetcherByKey[O];_||(_=new Oi(function(){var t=Ni("fetchStylesheet"),n=0,i=new wc(e.validatorSet);return t.loop(function(){if(n<v.length){var t=v[n++];return i.startStylesheet(t.flavor),null!==t.text?mr(t.text,i,t.url,t.classes,t.media).thenReturn(!0):vr(t.url,i,t.classes,t.media)}return bi(!1)}).then(function(){var n=i.cascadeParserHandler.finish();F=new gc(e,i.rootScope,i.pageScope,n,i.rootBox,i.fontFaces,i.footnoteProps,i.flowProps,i.viewportProps,i.pageProps),e.styleByKey[O]=F,delete e.styleFetcherByKey[O],t.finish(F)}),t.result()},"FetchStylesheet "+i),e.styleFetcherByKey[O]=_,_.start()),_.get().then(function(r){e.styleByDocURL[i]=r,n.finish(t)})}else n.finish(null)}),n.result()},e}(Xi);function bc(t){return String.fromCharCode(t>>>24&255,t>>>16&255,t>>>8&255,255&t)}function Sc(t){return(255&t.charCodeAt(0))<<24|(255&t.charCodeAt(1))<<16|(255&t.charCodeAt(2))<<8|255&t.charCodeAt(3)}function Cc(t){var e=new tt;e.append(t);var n=55-t.length&63;for(e.append("€");n>0;)n--,e.append("\0");e.append("\0\0\0\0"),e.append(bc(8*t.length)),t=e.toString();for(var i,r=[1732584193,4023233417,2562383102,271733878,3285377520],o=[],a=0;a<t.length;a+=64){for(i=0;i<16;i++)o[i]=Sc(t.substr(a+4*i,4));for(;i<80;i++){var s=o[i-3]^o[i-8]^o[i-14]^o[i-16];o[i]=s<<1|s>>>31}var l=r[0],u=r[1],h=r[2],c=r[3],f=r[4],d=void 0;for(i=0;i<80;i++)d=i<20?1518500249+(u&h|~u&c):i<40?1859775393+(u^h^c):i<60?2400959708+(u&h|u&c|h&c):3395469782+(u^h^c),d+=(l<<5|l>>>27)+f+o[i],f=c,c=h,h=u<<30|u>>>2,u=l,l=d;r[0]=r[0]+l|0,r[1]=r[1]+u|0,r[2]=r[2]+h|0,r[3]=r[3]+c|0,r[4]=r[4]+f|0}return r}var Tc=function(){function t(t,e,n,i,r,o,a,s,l,u){this.store=t,this.url=e,this.lang=n,this.clientLayout=i,this.fontMapper=r,this.rendererFactory=a,this.fallbackMap=s,this.documentURLTransformer=l,this.counterStore=u,this.page=null,this.instance=null,this.pref=Pt(o),this.pref.spreadView=!1}var e=t.prototype;return e.setAutoHeight=function(t,e){if(0!=e--)for(var n=t.firstChild;n;n=n.nextSibling)if(1==n.nodeType){var i=n;"auto"!=$(i,"height","auto")&&(Z(i,"height","auto"),this.setAutoHeight(i,e)),"absolute"==$(i,"position","static")&&(Z(i,"position","relative"),this.setAutoHeight(i,e))}},e.makeCustomRenderer=function(t){var e=this.rendererFactory.makeCustomRenderer(t);return function(t,n,i){var r=i.behavior;if(r)switch(r.toString()){case"body-child":t.parentElement.getAttribute("data-vivliostyle-primary-entry")&&(t.querySelector("[role=doc-toc], [role=directory], nav li a, .toc, #toc")||(i.display=je.none));break;case"toc-node-anchor":i.color=je.inherit,i["text-decoration"]=je.none;break;case"toc-node":i.display=je.block,i.margin=Qe,i.padding=Qe,i["padding-inline-start"]=new De(1.25,"em");break;case"toc-node-first-child":i.display=je.inline_block,i.margin=new De(.2,"em"),i["vertical-align"]=je.top,i.color=je.inherit,i["text-decoration"]=je.none}if(!r||"toc-node"!=r.toString()&&"toc-container"!=r.toString())return e(t,n,i);var o=t.firstChild;o&&1!==o.nodeType&&""===o.textContent.trim()&&t.replaceChild(t.ownerDocument.createComment(o.textContent),o);var a=n.getAttribute("data-adapt-class");if("toc-node"==a){var s=n.firstChild;"▸"!=s.textContent&&(s.textContent="▸",Z(s,"cursor","pointer"),s.addEventListener("click",xc,!1),s.setAttribute("role","button"),s.setAttribute("aria-expanded","false"),n.setAttribute("aria-expanded","false"),"0px"!==n.style.height&&(s.tabIndex=0))}var l=n.ownerDocument.createElement("div");if(l.setAttribute("data-adapt-process-children","true"),"toc-node"==r.toString()){var u=n.ownerDocument.createElement("div");if(u.textContent="▹",Z(u,"margin","0.2em 0 0 -1em"),Z(u,"margin-inline-start","-1em"),Z(u,"margin-inline-end","0"),Z(u,"display","inline-block"),Z(u,"width","1em"),Z(u,"text-align","center"),Z(u,"vertical-align","top"),Z(u,"cursor","default"),Z(u,"font-family","Menlo,sans-serif"),l.appendChild(u),Z(l,"overflow","hidden"),l.setAttribute("data-adapt-class","toc-node"),l.setAttribute("role","treeitem"),"toc-node"==a||"toc-container"==a){Z(l,"height","0px");var h=t.firstElementChild;h&&"a"===h.localName&&(h.tabIndex=-1)}else n.setAttribute("role","tree")}else"toc-node"==a&&(l.setAttribute("data-adapt-class","toc-container"),l.setAttribute("role","group"),l.setAttribute("aria-hidden","true"));return bi(l)}},e.showTOC=function(t,e,n,i,r){var o=this;if(this.page)return bi(this.page);var a=Ni("showTOC"),s=new Fa(t,t);return this.page=s,this.store.load(this.url+"?viv-toc-box").then(function(i){var l=o.store.resources[o.url];l&&l.body&&l.body.getAttribute("data-vivliostyle-primary-entry")&&i.body.setAttribute("data-vivliostyle-primary-entry",!0);for(var u,h=D(i.document.querySelectorAll("[role=doc-toc], [role=directory], nav, .toc, #toc"));!(u=h()).done;){var c=u.value;c.hasAttribute("hidden")&&c.removeAttribute("hidden")}var f=o.store.getStyleForDoc(i),d=f.sizeViewport(n,1e5,r);e=new lc(e.window,d.fontSize,e.root,d.width,d.height);var p=o.makeCustomRenderer(i),g=new mc(f,i,o.lang,e,o.clientLayout,o.fontMapper,p,o.fallbackMap,0,o.documentURLTransformer,o.counterStore);o.instance=g,g.pref=o.pref,g.init().then(function(){g.layoutNextPage(s,null).then(function(){Array.from(s.container.querySelectorAll("[data-vivliostyle-toc-box]>*>*>*>*>*[style*='display: none']")).forEach(function(t){t.setAttribute("aria-hidden","true"),t.setAttribute("hidden","hidden")}),o.setAutoHeight(t,2),a.finish(s)})})}),a.result()},e.hideTOC=function(){this.page&&(this.page.container.style.visibility="hidden",this.page.container.setAttribute("aria-hidden","true"))},e.isTOCVisible=function(){return!!this.page&&"visible"===this.page.container.style.visibility},e.getTOC=function(){if(!this.page)return[];function t(t){if(!t)return[];var n=t.querySelectorAll(":scope > [role=treeitem] > a[href]");return Array.from(n).map(e)}function e(e){return{id:new URL(e.href).hash.match(/^#(.*)$/)[1],title:e.innerText,children:t(e.parentElement.querySelector("[role=group]"))}}return t(this.page.container.querySelector("[role=tree]"))},t}();function xc(t){var e=t.target,n="▸"==e.textContent;e.textContent=n?"▾":"▸";var i=e.parentNode;e.setAttribute("aria-expanded",n?"true":"false"),i.setAttribute("aria-expanded",n?"true":"false");for(var r=i.firstChild;r;){if(1===r.nodeType){var o=r,a=o.getAttribute("data-adapt-class");if("toc-container"===a){if(o.setAttribute("aria-hidden",n?"false":"true"),o.firstChild){r=o.firstChild;continue}}else if("toc-node"===a&&(o.style.height=n?"auto":"0px",o.children.length>=2&&(o.children[1].tabIndex=n?0:-1),o.children.length>=3&&(o.children[0].tabIndex=n?0:-1,!n))){var s=o.children[0];if("▾"==s.textContent){s.textContent="▸",s.setAttribute("aria-expanded","false"),o.setAttribute("aria-expanded","false"),r=o.children[2];continue}}}for(;!r.nextSibling&&r.parentNode!==i;)r=r.parentNode;r=r.nextSibling}t.stopPropagation()}var Ic=function(t){function e(){var e;return(e=t.call(this,null)||this).opfByURL={},e.primaryOPFByEPubURL={},e.deobfuscators={},e.documents={},e.fontDeobfuscator=e.makeDeobfuscatorFactory(),e.plainXMLStore=new Xi(cc,Fi.DOCUMENT),e.jsonStore=new Xi(ji,Fi.TEXT),e}x(e,t);var n=e.prototype;return n.makeDeobfuscatorFactory=function(){var t=this;return function(e){return t.deobfuscators[e]}},n.loadAsPlainXML=function(t,e,n){return this.plainXMLStore.load(t,e,n)},n.startLoadingAsPlainXML=function(t){this.plainXMLStore.fetch(t)},n.loadAsJSON=function(t,e,n){return this.jsonStore.load(t,e,n)},n.startLoadingAsJSON=function(t){this.jsonStore.fetch(t)},n.loadPubDoc=function(t,e){var n=this,i=Ni("loadPubDoc");return zi(t,null,"HEAD").then(function(r){if(r.status>=400)n.loadEPUBDoc(t,e).then(function(e){e?i.finish(e):(h.error("Failed to fetch a source document from "+t+" ("+r.status+(r.statusText?" "+r.statusText:"")+")"),i.finish(null))});else if(r.status||r.responseXML||r.responseText||r.responseBlob||r.contentType||/\/[^/.]+(?:[#?]|$)/.test(t)&&(t=t.replace(/([#?]|$)/,"/$1")),"application/oebps-package+xml"==r.contentType||/\.opf(?:[#?]|$)/.test(t)){var o=t.match(/^((?:.*\/)?)([^/]*)$/);n.loadOPF(o[1],o[2],e).thenFinish(i)}else"application/ld+json"==r.contentType||"application/webpub+json"==r.contentType||"application/audiobook+json"==r.contentType||"application/json"==r.contentType||/\.json(?:ld)?(?:[#?]|$)/.test(t)?n.loadAsJSON(t,!0).then(function(e){if(!e)return n.reportLoadError(t),void i.finish(null);var r=new Bc(n,t);r.initWithWebPubManifest(e,void 0,t).then(function(){i.finish(r)})}):n.loadWebPub(t).then(function(r){r?i.finish(r):n.loadEPUBDoc(t,e).then(function(e){e?i.finish(e):(h.error("Failed to load "+t+"."),i.finish(null))})})}),i.result()},n.loadEPUBDoc=function(t,e){var n=this,i=Ni("loadEPUBDoc");return t.endsWith("/")||(t+="/"),e&&this.startLoadingAsJSON(t+"?r=list"),this.startLoadingAsPlainXML(t+"META-INF/encryption.xml"),this.loadAsPlainXML(t+"META-INF/container.xml").then(function(r){if(r)for(var o,a=D(r.doc().child("container").child("rootfiles").child("rootfile").attribute("full-path"));!(o=a()).done;){var s=o.value;if(s)return void n.loadOPF(t,s,e).thenFinish(i)}i.finish(null)}),i.result()},n.loadOPF=function(t,e,n){var i=this,r=t+e,o=this.opfByURL[r];if(o)return bi(o);var a=Ni("loadOPF");return this.loadAsPlainXML(r,!0,"Failed to fetch EPUB OPF "+r).then(function(e){e?i.loadAsPlainXML(t+"META-INF/encryption.xml").then(function(s){(n?i.loadAsJSON(t+"?r=list"):bi(null)).then(function(n){(o=new Bc(i,t)).initWithXMLDoc(e,s,n,t+"?r=manifest").then(function(){i.opfByURL[r]=o,i.primaryOPFByEPubURL[t]=o,a.finish(o)})})}):i.reportLoadError(r)}),a.result()},n.loadWebPub=function(t){var e=this,n=Ni("loadWebPub");return this.load(t).then(function(i){if(i)if(i.document.querySelector("a[href='META-INF/'],a[href$='/META-INF/']"))n.finish(null);else{var r=i.document,o=new Bc(e,t);r.body&&r.body.setAttribute("data-vivliostyle-primary-entry",!0);var a=r.querySelector("link[rel='publication'],link[rel='manifest'][type='application/webpub+json']");if(a){var s=a.getAttribute("href");if(/^#/.test(s)){var l=_(r.getElementById(s.substr(1)).textContent);o.initWithWebPubManifest(l,r).then(function(){n.finish(o)})}else{var u=G(a.getAttribute("href"),t);e.loadAsJSON(u).then(function(t){o.initWithWebPubManifest(t,r,u).then(function(){n.finish(o)})})}}else o.initWithWebPubManifest({},r).then(function(){o.xhtmlToc&&o.xhtmlToc.src===i.url&&(r.querySelector("[role=doc-toc], [role=directory], nav, .toc, #toc")||(o.xhtmlToc=null)),n.finish(o)})}else e.reportLoadError(t)}),n.result()},n.addDocument=function(t,e){var n=Ni("EPUBDocStore.load"),i=B(t);return(this.documents[i]=this.parseOPSResource({status:200,statusText:"",url:i,contentType:e.contentType,responseText:null,responseXML:e,responseBlob:null})).thenFinish(n),n.result()},n.reportLoadError=function(t){var e,n=this,i=function(t){return t.replace(/(?<![:/])[/?#].*/,"")};t.startsWith("data:")?h.error("Failed to load "+t+". Invalid data."):t.startsWith("http:")&&M.startsWith("https:")?h.error("Failed to load "+t+'. Mixed Content ("http:" content on "https:" context) is not allowed.'):(e=i(t))===i(M)||Object.keys(n.resources).find(function(t){return n.resources[t]&&i(t)===e})||/\.(xhtml|xht|xml|opf)$/i.test(t)?h.error("Failed to load "+t+". The target resource is invalid."):h.error("Failed to load "+t+". This may be caused by the server not allowing cross-origin resource sharing (CORS).")},n.load=function(e){var n=this,i=B(e),r=this.documents[i];if(r)return r.isPending()?r:bi(r.get());var o=Ni("EPUBDocStore.load");return(r=t.prototype.load.call(this,i,!0,"Failed to fetch a source document from "+i)).then(function(t){t?o.finish(t):n.reportLoadError(i)}),o.result()},e}(Nc),Pc=function(){function t(){this.id=null,this.src="",this.mediaType=null,this.title=null,this.itemRefElement=null,this.spineIndex=-1,this.compressedSize=0,this.compressed=null,this.epage=0,this.epageCount=0,this.startPage=null,this.skipPagesBefore=null,this.itemProperties=F}var e=t.prototype;return e.initWithElement=function(t,e){this.id=t.getAttribute("id"),this.src=G(t.getAttribute("href"),e),this.mediaType=t.getAttribute("media-type");var n=t.getAttribute("properties");n&&(this.itemProperties=function(t){for(var e={},n=0;n<t.length;n++)e[t[n]]=!0;return e}(n.split(/\s+/)))},e.initWithParam=function(t){this.spineIndex=t.index,this.id="item"+(t.index+1),this.src=t.url,this.startPage=t.startPage,this.skipPagesBefore=t.skipPagesBefore},t}();function Rc(t){return t.id}var Ac={dcterms:"http://purl.org/dc/terms/",marc:"http://id.loc.gov/vocabulary/",media:"http://www.idpf.org/epub/vocab/overlays/#",rendition:"http://www.idpf.org/vocab/rendition/#",onix:"http://www.editeur.org/ONIX/book/codelists/current.html#",xsd:"http://www.w3.org/2001/XMLSchema#",opf:"http://www.idpf.org/2007/opf"},Lc="http://idpf.org/epub/vocab/package/meta/#",Oc={language:Ac.dcterms+"language",title:Ac.dcterms+"title",creator:Ac.dcterms+"creator",layout:Ac.rendition+"layout",titleType:Lc+"title-type",displaySeq:Lc+"display-seq",alternateScript:Lc+"alternate-script",role:Lc+"role"};function kc(t,e){var n={};return function(i,r){var o,a,s,l,u,h=i.r||n,c=r.r||n;if(t==Oc.title&&(s="main"==(null==(l=h[Oc.titleType])?void 0:l[0].v))!=("main"==(null==(u=c[Oc.titleType])?void 0:u[0].v)))return s?-1:1;var f=parseInt(null==(o=h[Oc.displaySeq])?void 0:o[0].v,10);isNaN(f)&&(f=Number.MAX_VALUE);var d,p,g=parseInt(null==(a=c[Oc.displaySeq])?void 0:a[0].v,10);return isNaN(g)&&(g=Number.MAX_VALUE),f!=g?f-g:t!=Oc.language&&e&&(s=(null==(d=h[Oc.language]||h[Oc.alternateScript])?void 0:d[0].v)==e)!=((null==(p=c[Oc.language]||c[Oc.alternateScript])?void 0:p[0].v)==e)?s?-1:1:i.o-r.o}}function Dc(){var t=window.MathJax;return t?t.Hub:null}var Fc,_c={"application/xhtml+xml":!0,"image/jpeg":!0,"image/png":!0,"image/svg+xml":!0,"image/gif":!0,"audio/mp3":!0},Bc=function(){function t(t,e){this.store=t,this.pubURL=e,this.opfXML=null,this.encXML=null,this.items=null,this.spine=null,this.itemMap=null,this.itemMapByPath=null,this.uid=null,this.bindings={},this.lang=null,this.epageCount=0,this.prePaginated=!1,this.epageIsRenderedPage=!0,this.epageCountCallback=null,this.metadata={},this.ncxToc=null,this.xhtmlToc=null,this.cover=null,this.fallbackMap={},this.pageProgression=null,this.documentURLTransformer=this.createDocumentURLTransformer(),Dc()&&(Rr[V.MATHML]=!0)}var e=t.prototype;return e.createDocumentURLTransformer=function(){var t=this;return new(function(){function e(){}var n=e.prototype;return n.transformFragment=function(t,e){return"viv-id-"+at(decodeURI(e+(t?"#"+t:"")),":")},n.transformURL=function(e,n){var i=e.match(/^([^#]*)#?(.*)$/);if(i){var r=i[1]||n,o=i[2];if(r&&t.items.some(function(t){return t.src===r}))return"#"+this.transformFragment(o,r)}return e},n.restoreURL=function(t){"#"===t.charAt(0)&&(t=t.substring(1)),0===t.indexOf("viv-id-")&&(t=t.substring("viv-id-".length));var e=function(t,e){e="string"==typeof e?e:"\\u";var n=new RegExp(st(e)+"[0-9a-fA-F]{4}","g");return t.replace(n,function(t){return function(t,e){return 0===t.indexOf(e="string"==typeof e?e:"\\u")?String.fromCharCode(parseInt(t.substring(e.length),16)):t}(t,e)})}(t,":").match(/^([^#]*)#?(.*)$/);return e?[e[1],e[2]]:[]},e}())},e.getMetadata=function(){return this.metadata},e.getPathFromURL=function(t){if(t.startsWith("data:"))return t===this.pubURL?"":t;if(this.pubURL){var e=G("",this.pubURL);return t===e||t+"/"===e?"":("/"!=e.charAt(e.length-1)&&(e+="/"),t.substr(0,e.length)==e?decodeURI(t.substr(e.length)):null)}return t},e.initWithXMLDoc=function(t,e,n,i){var r=this;this.opfXML=t,this.encXML=e;var o=t.doc().child("package"),s=o.attribute("unique-identifier")[0];if(s){var l=t.getElement(t.url+"#"+s);l&&(this.uid=l.textContent.replace(/[ \n\r\t]/g,""))}var u={};for(var h in this.items=o.child("manifest").child("item").asArray().map(function(e){var n=new Pc,i=e;n.initWithElement(i,t.url);var o=i.getAttribute("fallback");return o&&!_c[n.mediaType]&&(u[n.src]=o),!r.xhtmlToc&&n.itemProperties.nav&&(r.xhtmlToc=n),!r.cover&&n.itemProperties["cover-image"]&&(r.cover=n),n}),this.itemMap=ht(this.items,Rc),this.itemMapByPath=ht(this.items,function(t){return r.getPathFromURL(t.src)}),u)for(var c=h;;){var f=this.itemMap[u[c]];if(!f)break;if(_c[f.mediaType]){this.fallbackMap[h]=f.src;break}c=f.src}this.spine=o.child("spine").child("itemref").asArray().map(function(t,e){var n=t,i=n.getAttribute("idref"),o=r.itemMap[i];return o&&(o.itemRefElement=n,o.spineIndex=e),o});var d=o.child("spine").attribute("toc")[0];d&&(this.ncxToc=this.itemMap[d]);var p=o.child("spine").attribute("page-progression-direction")[0];p&&(this.pageProgression=a(p));for(var g=e?e.doc().child("encryption").child("EncryptedData").predicate(fc.withChild("EncryptionMethod",fc.withAttribute("Algorithm","http://www.idpf.org/2008/embedding"))).child("CipherData").child("CipherReference").attribute("URI"):[],m=o.child("bindings").child("mediaType").asArray(),v=0;v<m.length;v++){var E=m[v].getAttribute("handler"),w=m[v].getAttribute("media-type");w&&E&&this.itemMap[E]&&(this.bindings[w]=this.itemMap[E].src)}if(this.metadata=function(t,e){var n;if(e){for(var i in n={},Ac)n[i]=Ac[i];for(var r;null!=(r=e.match(/^\s*([A-Z_a-z\u007F-\uFFFF][-.A-Z_a-z0-9\u007F-\uFFFF]*):\s*(\S+)/));)e=e.substr(r[0].length),n[r[1]]=r[2]}else n=Ac;var o=function(t){if(t){var e=t.match(/^\s*(([^:]*):)?(\S+)\s*$/);if(e){var i=e[2]?n[e[2]]:Lc;if(i)return i+e[3]}}return null},a=1,s=t.childElements().forEachNonNull(function(t){if("meta"==t.localName){var e=o(t.getAttribute("property"));if(e)return{name:e,value:t.textContent,id:t.getAttribute("id"),order:a++,refines:t.getAttribute("refines"),lang:null,scheme:o(t.getAttribute("scheme")),role:null}}else if(t.namespaceURI==V.DC)return{name:Ac.dcterms+t.localName,order:a++,lang:t.getAttribute("xml:lang"),value:t.textContent,id:t.getAttribute("id"),refines:null,scheme:null,role:t.getAttribute("role")||t.getAttribute("opf:role")};return null}),l=ct(s,function(t){return t.refines}),u=function t(e){return function(e,n){var i={};for(var r in e)i[r]=e[r].map(function(e){var n={v:e.value,o:e.order};e.scheme&&(n.s=e.scheme);var i=l["#"+e.id]||[];if(i.length||e.lang||e.role){e.lang&&i.push({name:Oc.language,value:e.lang,lang:null,id:null,refines:e.id,scheme:null,order:e.order,role:null}),e.role&&i.push({name:Oc.role,value:e.role,lang:null,id:null,refines:e.id,scheme:null,order:e.order,role:null});var r=ct(i,function(t){return t.name});n.r=t(r)}return n});return i}(e)}(ct(s,function(t){return t.refines?null:t.name})),h=null;return u[Oc.language]&&(h=u[Oc.language][0].v),function t(e){for(var n in e){var i=e[n];i.sort(kc(n,h));for(var r=0;r<i.length;r++){var o=i[r].r;o&&t(o)}}}(u),u}(o.child("metadata"),o.attribute("prefix")[0]),this.metadata[Oc.language]&&(this.lang=this.metadata[Oc.language][0].v),this.metadata[Oc.layout]&&(this.prePaginated="pre-paginated"===this.metadata[Oc.layout][0].v),!n){if(g.length>0&&this.uid)for(var y=function(t){var e=function(t){for(var e,n=[],i=D(Cc(t));!(e=i()).done;){var r=e.value;n.push(r>>>24&255,r>>>16&255,r>>>8&255,255&r)}return n}(t);return function(t){var n,i,r=Ni("deobfuscator");return t.slice?(n=t.slice(0,1040),i=t.slice(1040,t.size)):(n=t.webkitSlice(0,1040),i=t.webkitSlice(1040,t.size-1040)),function(t){var e=Ni("readBlob"),n=new FileReader,i=e.suspend(n);return n.addEventListener("load",function(){i.schedule(n.result)},!1),n.readAsArrayBuffer(t),e.result()}(n).then(function(t){for(var n=new DataView(t),o=0;o<n.byteLength;o++){var a=n.getUint8(o);n.setUint8(o,a^=e[o%20])}r.finish(Gi([n,i]))}),r.result()}}(this.uid),N=0;N<g.length;N++)this.store.deobfuscators[this.pubURL+g[N]]=y;return this.prePaginated&&this.assignAutoPages(),bi(!0)}var b=new tt,S={};if(g.length>0&&this.uid)for(var C="1040:"+function(t){for(var e=function(t){for(var e=Cc(t),n=new tt,i=0;i<e.length;i++)n.append(bc(e[i]));return n.toString()}(t),n=new tt,i=0;i<e.length;i++)n.append((256|e.charCodeAt(i)).toString(16).substr(1));return n.toString()}(this.uid),T=0;T<g.length;T++)S[g[T]]=C;for(var x=0;x<n.length;x++){var I=n[x],P=I.n;if(P){var R=decodeURI(P),A=this.itemMapByPath[R],L=null;A&&(A.compressed=0!=I.m,A.compressedSize=I.c,A.mediaType&&(L=A.mediaType.replace(/\s+/g,"")));var O=S[R];(L||O)&&(b.append(P),b.append(" "),b.append(L||"application/octet-stream"),O&&(b.append(" "),b.append(O)),b.append("\n"))}}return this.assignAutoPages(),zi(i,Fi.DEFAULT,"POST",b.toString(),"text/plain")},e.assignAutoPages=function(){for(var t,e=0,n=D(this.spine);!(t=n()).done;){var i=t.value,r=this.prePaginated?1:Math.ceil(i.compressedSize/1024);i.epage=e,i.epageCount=r,e+=r}this.epageCount=e,this.epageCountCallback&&this.epageCountCallback(this.epageCount)},e.setEPageCountMode=function(t){this.epageIsRenderedPage=t||this.prePaginated},e.countEPages=function(t){var e=this;if(this.epageCountCallback=t,this.epageIsRenderedPage)return this.prePaginated&&0==this.epageCount&&this.assignAutoPages(),bi(!0);var n=0,i=0,r=Ni("countEPages");return r.loopWithFrame(function(t){if(i!==e.spine.length){var r=e.spine[i++];r.epage=n,e.store.load(r.src).then(function(i){var o=1800,a=i.lang||e.lang;a&&a.match(/^(ja|ko|zh)/)&&(o/=3),r.epageCount=Math.ceil(i.getTotalOffset()/o),e.epageCount=n+=r.epageCount,e.epageCountCallback&&e.epageCountCallback(e.epageCount),t.continueLoop()})}else t.breakLoop()}).thenFinish(r),r.result()},e.initWithChapters=function(t,e){var n=this;this.itemMap={},this.itemMapByPath={},this.items=[],this.spine=this.items;var i=this.opfXML=new uc(null,"",(new DOMParser).parseFromString("<spine></spine>","text/xml"));return t.forEach(function(t){var e=new Pc;e.initWithParam(t);var r=i.document.createElement("itemref");r.setAttribute("idref",e.id),i.root.appendChild(r),e.itemRefElement=r,n.itemMap[e.id]=e;var o=n.getPathFromURL(t.url);null==o&&(o=t.url),n.itemMapByPath[o]=e,n.items.push(e)}),e?this.store.addDocument(t[0].url,e):bi(null)},e.initWithWebPubManifest=function(t,e,n){var i=this;t.readingProgression&&(this.pageProgression=t.readingProgression),void 0===this.metadata&&(this.metadata={});var r=e&&e.title||t.name||t.metadata&&t.metadata.title;r&&(this.metadata[Oc.title]=[{v:r}]);var o=this.getPathFromURL(this.pubURL);if(!t.readingOrder&&e&&null!==o){t.readingOrder=[encodeURI(o)];for(var a,s=D(e.querySelectorAll("[role=doc-toc] a[href],[role=directory] a[href],nav li a[href],.toc a[href],#toc a[href]"));!(a=s()).done;){var l=a.value.getAttribute("href");if(!/^(https?:)?\/\//.test(l)){var u=B(G(l,this.pubURL)),h=this.getPathFromURL(u),c=null!==h?encodeURI(h):u;-1==t.readingOrder.indexOf(c)&&t.readingOrder.push(c)}}}var f=[],d=0,p=-1;[t.readingOrder,t.resources].forEach(function(e){e instanceof Array&&e.forEach(function(e){var r=t.readingOrder.includes(e),o="string"==typeof e?e:e.url||e.href,a="string"==typeof e?"":e.encodingFormat||e.href&&e.type||"";if(r||"text/html"===a||"application/xhtml+xml"===a||/(^|\/)([^/]+\.(x?html|htm|xht)|[^/.]*)([#?]|$)/.test(o)){var s={url:G(W(o),n||i.pubURL),index:d++,startPage:null,skipPagesBefore:null};"contents"===e.rel&&-1===p&&(p=s.index),f.push(s)}})});var g=Ni("initWithWebPubManifest");return this.initWithChapters(f).then(function(){var t;-1!==p&&(i.xhtmlToc=i.items[p]),i.xhtmlToc||(i.xhtmlToc=n?null==(t=i.items)?void 0:t[0]:i.itemMapByPath[o]),g.finish(!0)}),g.result()},e.getCFI=function(t,e){var n=this.spine[t],i=Ni("getCFI");return this.store.load(n.src).then(function(t){var r=t.getNodeByOffset(e),o=null;if(r){var a=t.getNodeOffset(r,0,!1),s=e-a,l=new It;l.prependPathFromNode(r,s,!1,null),n.itemRefElement&&l.prependPathFromNode(n.itemRefElement,0,!1,null),o=l.toString()}i.finish(o)}),i.result()},e.resolveFragment=function(t){var e=this;return Si("resolveFragment",function(n){if(t){var i,r=new It;if(r.fromString(t),e.opfXML){var o=r.navigate(e.opfXML.document);if(1!=o.node.nodeType||o.after||!o.ref)return void n.finish(null);var a=o.node,s=a.getAttribute("idref");if("itemref"!=a.localName||!s||!e.itemMap[s])return void n.finish(null);i=e.itemMap[s],r=o.ref}else i=e.spine[0];e.store.load(i.src).then(function(t){var e=r.navigate(t.document),o=t.getNodeOffset(e.node,e.offset,e.after);n.finish({spineIndex:i.spineIndex,offsetInItem:o,pageIndex:-1})})}else n.finish(null)},function(e,n){h.warn(n,"Cannot resolve fragment:",t),e.finish(null)})},e.resolveEPage=function(t){var e=this;return Si("resolveEPage",function(n){if(t<=0)n.finish({spineIndex:0,offsetInItem:0,pageIndex:-1});else if(e.epageIsRenderedPage){var i=e.spine.findIndex(function(e){return 0==e.epage&&0==e.epageCount||e.epage<=t&&e.epage+e.epageCount>t});-1==i&&(i=e.spine.length-1);var r=e.spine[i];r&&0!=r.epageCount||(r=e.spine[--i]);var o=Math.floor(t-r.epage);n.finish({spineIndex:i,offsetInItem:-1,pageIndex:o})}else{var a=lt(e.spine.length,function(n){var i=e.spine[n];return i.epage+i.epageCount>t});a==e.spine.length&&a--;var s=e.spine[a];e.store.load(s.src).then(function(e){(t-=s.epage)>s.epageCount&&(t=s.epageCount);var i=0;if(t>0){var r=e.getTotalOffset();(i=Math.round(r*t/s.epageCount))==r&&i--}n.finish({spineIndex:a,offsetInItem:i,pageIndex:-1})})}},function(e,n){h.warn(n,"Cannot resolve epage:",t),e.finish(null)})},e.getEPageFromPosition=function(t){var e=this.spine[t.spineIndex];if(this.epageIsRenderedPage)return bi(e.epage+t.pageIndex);if(t.offsetInItem<=0)return bi(e.epage);var n=Ni("getEPage");return this.store.load(e.src).then(function(i){var r=i.getTotalOffset(),o=Math.min(r,t.offsetInItem);n.finish(e.epage+o*e.epageCount/r)}),n.result()},t}(),Mc=function(t,e){return{page:t,position:{spineIndex:t.spineIndex,pageIndex:e,offsetInItem:t.offset}}},Uc=function(){function t(t,e,n,i,r){this.opf=t,this.viewport=e,this.fontMapper=n,this.pageSheetSizeReporter=r,this.spineItems=[],this.spineItemLoadingContinuations=[],this.tocAutohide=!1,this.pref=Pt(i),this.clientLayout=new sc(e),this.counterStore=new Dn(t.documentURLTransformer)}var e=t.prototype;return e.getPage=function(t){var e=this.spineItems[t.spineIndex];return e?e.pages[t.pageIndex]:null},e.getCurrentPageProgression=function(t){if(this.opf.pageProgression)return this.opf.pageProgression;var e=this.spineItems[t?t.spineIndex:0];return e?e.instance.pageProgression:null},e.finishPageContainer=function(t,e,n){e.container.style.display="none",e.container.style.visibility="visible",e.container.style.position="",e.container.style.top="",e.container.style.left="",e.container.setAttribute("data-vivliostyle-page-side",e.side);var i=t.pages[n];if(e.isFirstPage=0==t.item.spineIndex&&0==n,t.pages[n]=e,this.opf.epageIsRenderedPage){if(0==n&&t.item.spineIndex>0){var r=this.opf.spine[t.item.spineIndex-1];t.item.epage=r.epage+r.epageCount}t.item.epageCount=t.pages.length,this.opf.epageCount=this.opf.spine.reduce(function(t,e){return t+e.epageCount},0),this.opf.epageCountCallback&&this.opf.epageCountCallback(this.opf.epageCount)}if(i)t.instance.viewport.contentContainer.replaceChild(e.container,i.container),i.dispatchEvent({type:"replaced",target:null,currentTarget:null,preventDefault:null,newPage:e});else{var o=null;if(n>0)o=t.pages[n-1].container.nextElementSibling;else for(var a=t.item.spineIndex+1;a<this.spineItems.length;a++){var s=this.spineItems[a];if(s&&s.pages[0]){o=s.pages[0].container;break}}t.instance.viewport.contentContainer.insertBefore(e.container,o)}this.pageSheetSizeReporter({width:t.instance.pageSheetWidth,height:t.instance.pageSheetHeight},t.instance.pageSheetSize,t.item.spineIndex,t.instance.pageNumberOffset+n)},e.renderSinglePage=function(t,e){var n=this,i=Ni("renderSinglePage"),r=this.makePage(t,e);return t.instance.layoutNextPage(r,e).then(function(o){var a=(e=o)?e.page-1:t.layoutPositions.length-1;n.finishPageContainer(t,r,a),n.counterStore.finishPage(r.spineIndex,a);var s=null;if(e){var l=t.layoutPositions[e.page];t.layoutPositions[e.page]=e,l&&t.pages[e.page]&&(e.isSamePosition(l)||(s=n.renderSinglePage(t,e)))}s||(s=bi(!0)),s.then(function(){var o=n.counterStore.getUnresolvedRefsToPage(r),s=0;i.loopWithFrame(function(t){if(++s>o.length)t.breakLoop();else{var e=o[s-1];e.refs=e.refs.filter(function(t){return!t.isResolved()}),0!==e.refs.length?n.getPageViewItem(e.spineIndex).then(function(i){i?(n.counterStore.pushPageCounters(e.pageCounters),n.counterStore.pushReferencesToSolve(e.refs),n.renderSinglePage(i,i.layoutPositions[e.pageIndex]).then(function(e){n.counterStore.popPageCounters(),n.counterStore.popReferencesToSolve();var i=e.pageAndPosition.position;i.spineIndex===r.spineIndex&&i.pageIndex===a&&(r=e.pageAndPosition.page),t.continueLoop()})):t.continueLoop()}):t.continueLoop()}}).then(function(){r.container.parentElement||(r=t.pages[a]),r.isLastPage=!e&&t.item.spineIndex===n.opf.spine.length-1,r.isLastPage&&n.counterStore.finishLastPage(n.viewport),i.finish({pageAndPosition:Mc(r,a),nextLayoutPosition:e})})})}),i.result()},e.normalizeSeekPosition=function(t,e){var n=t.pageIndex,i=-1;if(n<0){i=t.offsetInItem;var r=lt(e.layoutPositions.length,function(t){return e.instance.getPosition(e.layoutPositions[t],!0)>i});n=r===e.layoutPositions.length?e.complete?e.layoutPositions.length-1:Number.POSITIVE_INFINITY:r-1}else n===Number.POSITIVE_INFINITY&&-1!==t.offsetInItem&&(i=t.offsetInItem);return{spineIndex:t.spineIndex,pageIndex:n,offsetInItem:i}},e.findPage=function(t,e){var n=this,i=Ni("findPage");return this.getPageViewItem(t.spineIndex).then(function(r){if(r){var o,a=null;i.loopWithFrame(function(s){var l=n.normalizeSeekPosition(t,r);(a=r.pages[o=l.pageIndex])?s.breakLoop():r.complete?(a=r.pages[o=r.layoutPositions.length-1],s.breakLoop()):e?n.renderPage(l).then(function(t){t&&(a=t.page,o=t.position.pageIndex),s.breakLoop()}):i.sleep(100).then(function(){s.continueLoop()})}).then(function(){i.finish(Mc(a,o))})}else i.finish(null)}),i.result()},e.renderPage=function(t){var e=this,n=Ni("renderPage");return this.getPageViewItem(t.spineIndex).then(function(i){if(i){var r=e.normalizeSeekPosition(t,i),o=r.pageIndex,a=r.offsetInItem,s=i.pages[o];s?n.finish(Mc(s,o)):n.loopWithFrame(function(t){if(o<i.layoutPositions.length)t.breakLoop();else{if(i.complete)return o=i.layoutPositions.length-1,void t.breakLoop();var n=i.layoutPositions[i.layoutPositions.length-1];e.renderSinglePage(i,n).then(function(e){var r=e.pageAndPosition.page;if(n=e.nextLayoutPosition){if(a>=0&&i.instance.getPosition(n)>a)return s=r,o=i.layoutPositions.length-2,void t.breakLoop();t.continueLoop()}else s=r,o=e.pageAndPosition.position.pageIndex,i.complete=!0,t.breakLoop()})}}).then(function(){var t=i.layoutPositions[o];(s=s||i.pages[o])?n.finish(Mc(s,o)):e.renderSinglePage(i,t).then(function(t){t.nextLayoutPosition||(i.complete=!0),n.finish(t.pageAndPosition)})})}else n.finish(null)}),n.result()},e.renderAllPages=function(){return this.renderPagesUpto({spineIndex:this.opf.spine.length-1,pageIndex:Number.POSITIVE_INFINITY,offsetInItem:-1},!1)},e.renderPagesUpto=function(t,e){var n=this,i=Ni("renderPagesUpto");t||(t={spineIndex:0,pageIndex:0,offsetInItem:0});var r,o=t.spineIndex,a=t.pageIndex,s=0;return e&&(s=o),i.loopWithFrame(function(e){n.renderPage({spineIndex:s,pageIndex:s===o?a:Number.POSITIVE_INFINITY,offsetInItem:s===o?t.offsetInItem:-1}).then(function(t){r=t,++s>o?e.breakLoop():e.continueLoop()})}).then(function(){i.finish(r)}),i.result()},e.firstPage=function(t,e){return this.findPage({spineIndex:0,pageIndex:0,offsetInItem:-1},e)},e.lastPage=function(t,e){return this.findPage({spineIndex:this.opf.spine.length-1,pageIndex:Number.POSITIVE_INFINITY,offsetInItem:-1},e)},e.nextPage=function(t,e){var n=this,i=t.spineIndex,r=t.pageIndex,o=Ni("nextPage");return this.getPageViewItem(i).then(function(t){if(t){if(t.complete&&r==t.layoutPositions.length-1){if(i>=n.opf.spine.length-1)return void o.finish(null);i++,r=0;var a=n.spineItems[i],s=a&&a.pages[0],l=t.pages[t.pages.length-1];s&&l&&s.side==l.side&&(a.pages.forEach(function(t){t.container&&t.container.remove()}),n.spineItems[i]=null,n.spineItemLoadingContinuations[i]=null)}else r++;n.findPage({spineIndex:i,pageIndex:r,offsetInItem:-1},e).thenFinish(o)}else o.finish(null)}),o.result()},e.previousPage=function(t,e){var n=t.spineIndex,i=t.pageIndex;if(0==i){if(0==n)return bi(null);n--,i=Number.POSITIVE_INFINITY}else i--;return this.findPage({spineIndex:n,pageIndex:i,offsetInItem:-1},e)},e.isRectoPage=function(t,e){var n=t.side===exports.PageSide.LEFT,i=this.getCurrentPageProgression(e)===exports.PageProgression.LTR;return!n&&i||n&&!i},e.getSpread=function(t,e){var n=this,i=Ni("getCurrentSpread"),r=this.getPage(t);if(!r)return bi({left:null,right:null});var o=r.side===exports.PageSide.LEFT;return(this.isRectoPage(r,t)?this.previousPage(t,e):this.nextPage(t,e)).then(function(e){var r=n.getPage(t),a=e&&e.page;a&&a.side===r.side&&(a=null),i.finish(o?{left:r,right:a}:{left:a,right:r})}),i.result()},e.nextSpread=function(t,e){var n=this,i=this.getPage(t);if(!i)return bi(null);var r=this.isRectoPage(i,t),o=this.nextPage(t,e);return r?o:o.thenAsync(function(t){if(t){if(t.page.side===i.side)return o;var r=n.nextPage(t.position,e);return r.thenAsync(function(t){return t?r:o})}return bi(null)})},e.previousSpread=function(t,e){var n=this,i=this.getPage(t);if(!i)return bi(null);var r=this.isRectoPage(i,t),o=this.previousPage(t,e),a=i.container.previousElementSibling;return r?o.thenAsync(function(t){return t?t.page.side===i.side||t.page.container!==a?o:n.previousPage(t.position,e):bi(null)}):o},e.navigateToEPage=function(t,e,n){var i=this,r=Ni("navigateToEPage");return this.opf.resolveEPage(t).then(function(t){t?i.findPage(t,n).thenFinish(r):r.finish(null)}),r.result()},e.navigateToFragment=function(t,e,n){var i=this,r=Ni("navigateToCFI");return this.opf.resolveFragment(t).then(function(t){t?i.findPage(t,n).thenFinish(r):r.finish(null)}),r.result()},e.navigateTo=function(t,e,n){var i=this;h.debug("Navigate to",t);var r=this.opf.getPathFromURL(B(t));if(!r){if(this.opf.opfXML&&t.match(/^#epubcfi\(/))r=this.opf.getPathFromURL(this.opf.opfXML.url);else if("#"===t.charAt(0)){var o=this.opf.documentURLTransformer.restoreURL(t);this.opf.opfXML?null==(r=this.opf.getPathFromURL(o[0]))&&(r=o[0]):r=o[0],t=o[0]+(o[1]?"#"+o[1]:"")}if(null==r)return bi(null)}var a=this.opf.itemMapByPath[r];if(!a){if(this.opf.opfXML&&r==this.opf.getPathFromURL(this.opf.opfXML.url)){var s=t.indexOf("#");if(s>=0)return this.navigateToFragment(t.substr(s+1),e,n)}return bi(null)}var l=Ni("navigateTo");return this.getPageViewItem(a.spineIndex).then(function(r){if(r){var o=r.xmldoc.getElement(t);o?i.findPage({spineIndex:a.spineIndex,pageIndex:-1,offsetInItem:r.xmldoc.getElementOffset(o)},n).thenFinish(l):e.spineIndex!==a.spineIndex?i.findPage({spineIndex:a.spineIndex,pageIndex:0,offsetInItem:-1},n).thenFinish(l):l.finish(null)}else l.finish(null)}),l.result()},e.makePage=function(t,e){var n=t.instance.viewport,i=n.document.createElement("div");i.setAttribute("data-vivliostyle-page-container","true"),i.setAttribute("role","region"),i.style.position="absolute",i.style.top="0",i.style.left="0",exports.isDebug||(i.style.visibility="hidden",i.setAttribute("aria-hidden","true")),n.layoutBox.appendChild(i);var r=n.document.createElement("div");r.setAttribute("data-vivliostyle-bleed-box","true"),i.appendChild(r);var o=new Fa(i,r);if(o.spineIndex=t.item.spineIndex,o.position=e,o.offset=t.instance.getPosition(e),0===o.offset){var a=this.opf.documentURLTransformer.transformFragment("",t.item.src);r.setAttribute("id",a),o.registerElementWithId(r,a)}if(n!==this.viewport){var s=Lt(this.viewport.width,this.viewport.height,n.width,n.height),l=Er(null,new vi(s,null),"");o.delayedItems.push(new Oa(i,"transform",l))}return o},e.makeObjectView=function(t,e,n,i){var r=e.getAttribute("data"),o=null;if(r){r=G(r,t.url);var a=e.getAttribute("media-type");if(!a){var s=this.opf.getPathFromURL(r);if(s){var l=this.opf.itemMapByPath[s];l&&(a=l.mediaType)}}if(a){var u=this.opf.bindings[a];if(u){(o=this.viewport.document.createElement("iframe")).style.border="none";var h=rt(r),c=rt(a),f=new tt;f.append(u),f.append("?src="),f.append(h),f.append("&type="),f.append(c);for(var d=e.firstChild;d;d=d.nextSibling)if(1==d.nodeType){var p=d;if("param"==p.localName&&p.namespaceURI==V.XHTML){var g=p.getAttribute("name"),m=p.getAttribute("value");g&&m&&(f.append("&"),f.append(encodeURIComponent(g)),f.append("="),f.append(encodeURIComponent(m)))}}o.setAttribute("src",f.toString());var v=e.getAttribute("width");v&&o.setAttribute("width",v);var E=e.getAttribute("height");E&&o.setAttribute("height",E)}}}return o||(o=this.viewport.document.createElement("span")).setAttribute("data-adapt-process-children","true"),bi(o)},e.makeMathJaxView=function(t,e,n,i){var r=Dc();if(r){var o=n.ownerDocument,a=o.createElement("span");n.appendChild(a);var s=o.importNode(e,!0);this.resolveURLsInMathML(s,t),a.appendChild(s);var l=r.queue;l.Push(["Typeset",r,a]);var u=Ni("makeMathJaxView"),h=u.suspend();return l.Push(function(){h.schedule(a)}),u.result()}return bi(null)},e.resolveURLsInMathML=function(t,e){if(null!=t){if(1===t.nodeType&&"mglyph"===t.tagName)for(var n=0,i=Array.from(t.attributes);n<i.length;n++){var r=i[n];if("src"===r.name){var o=G(r.nodeValue,e.url);r.namespaceURI?t.setAttributeNS(r.namespaceURI,r.name,o):t.setAttribute(r.name,o)}}t.firstChild&&this.resolveURLsInMathML(t.firstChild,e),t.nextSibling&&this.resolveURLsInMathML(t.nextSibling,e)}},e.makeCustomRenderer=function(t){var e=this;return function(n,i,r){return"object"==n.localName&&n.namespaceURI==V.XHTML?e.makeObjectView(t,n,i,r):n.namespaceURI==V.MATHML||n.dataset&&"true"==n.dataset.mathTypeset?e.makeMathJaxView(t,n,i,r):bi(null)}},e.getPageViewItem=function(t){var e=this;if(-1===t||t>=this.opf.spine.length)return bi(null);var n=this.spineItems[t];if(n)return bi(n);var i=Ni("getPageViewItem"),r=this.spineItemLoadingContinuations[t];if(r){var o=i.suspend();return r.push(o),i.result()}r=this.spineItemLoadingContinuations[t]=[];var a=this.opf.spine[t],s=this.opf.store;return s.load(a.src).then(function(o){a.title=o.document.title;var l=s.getStyleForDoc(o),u=e.makeCustomRenderer(o),h=e.viewport,c=l.sizeViewport(h.width,h.height,h.fontSize,e.pref);c.width==h.width&&c.height==h.height&&c.fontSize==h.fontSize||(h=new lc(h.window,c.fontSize,h.root,c.width,c.height));var f,d=e.spineItems[t-1];null!==a.startPage?f=a.startPage-1:(!(t>0)||d&&d.complete?f=d?d.instance.pageNumberOffset+d.pages.length:0:(f=a.epage||t,e.opf.prePaginated||f%2!=0||f++),null!==a.skipPagesBefore&&(f+=a.skipPagesBefore)),e.counterStore.forceSetPageCounter(f);var p=new mc(l,o,e.opf.lang,h,e.clientLayout,e.fontMapper,u,e.opf.fallbackMap,f,e.opf.documentURLTransformer,e.counterStore,e.opf.pageProgression);p.pref=e.pref;var g=e.opf.metadata&&e.opf.metadata[Oc.title];p.pubTitle=g&&g[0]&&g[0].v||"",p.docTitle=a.title||"",p.init().then(function(){e.spineItems[t]=n={item:a,xmldoc:o,instance:p,layoutPositions:[null],pages:[],complete:!1},i.finish(n),r.forEach(function(t){t.schedule(n)})})}),i.result()},e.removeRenderedPages=function(){for(var t,e=D(this.spineItems);!(t=e()).done;){var n=t.value;n&&n.pages.splice(0)}this.viewport.clear()},e.hasAutoSizedPages=function(){for(var t,e=D(this.spineItems);!(t=e()).done;){var n=t.value;if(n)for(var i,r=D(n.pages);!(i=r()).done;){var o=i.value;if(o.isAutoPageWidth&&o.isAutoPageHeight)return!0}}return!1},e.hasPages=function(){return this.spineItems.some(function(t){return t&&t.pages.length>0})},e.showTOC=function(t){var e=this.opf,n=e.xhtmlToc||e.ncxToc;if(this.tocAutohide=t,!n)return bi(null);if(this.tocView&&this.tocView.page)return this.tocView.page.container.style.visibility="visible",this.tocView.page.container.setAttribute("aria-hidden","false"),bi(this.tocView.page);var i=Ni("showTOC");this.tocView||(this.tocView=new Tc(e.store,n.src,e.lang,this.clientLayout,this.fontMapper,this.pref,this,e.fallbackMap,e.documentURLTransformer,this.counterStore));var r=this.viewport,o=Math.min(350,Math.round(.67*r.width)-16),a=r.height-6,s=r.document.createElement("div");return r.root.appendChild(s),s.style.visibility="hidden",s.style.width=o+10+"px",s.style.maxHeight=a+"px",s.setAttribute("data-vivliostyle-toc-box","true"),s.setAttribute("role","navigation"),this.tocView.showTOC(s,r,o,a,this.viewport.fontSize).then(function(t){s.style.visibility="visible",s.setAttribute("aria-hidden","false"),i.finish(t)}),i.result()},e.hideTOC=function(){this.tocView&&this.tocView.hideTOC()},e.isTOCVisible=function(){return!!this.tocView&&this.tocView.isTOCVisible()},t}();!function(t){t.SINGLE_PAGE="singlePage",t.SPREAD="spread",t.AUTO_SPREAD="autoSpread"}(Fc||(Fc={}));var Vc,Hc=function(){function t(t,e,n,i){var r=this;this.window=t,this.viewportElement=e,this.instanceId=n,this.callbackFn=i,this.pageSheetSizeAlreadySet=!1,this.renderTask=null,e.setAttribute("data-vivliostyle-viewer-viewport",!0),exports.isDebug&&e.setAttribute("data-vivliostyle-debug",!0),e.setAttribute("data-vivliostyle-viewer-status","loading");var o=t.document;this.fontMapper=new Hu(o.head,e),this.init(),this.kick=function(){},this.sendCommand=function(){},this.resizeListener=function(){r.needResize=!0,r.kick()},this.pageReplacedListener=this.pageReplacedListener.bind(this),this.hyperlinkListener=function(t){},this.pageRuleStyleElement=o.getElementById("vivliostyle-page-rules"),this.actions={loadPublication:this.loadPublication,loadXML:this.loadXML,configure:this.configure,moveTo:this.moveTo,toc:this.showTOC},this.addLogListeners()}var e=t.prototype;return e.init=function(){this.readyState=exports.ReadyState.LOADING,this.packageURL=[],this.opf=null,this.haveZipMetadata=!1,this.touchActive=!1,this.touchX=0,this.touchY=0,this.needResize=!1,this.needRefresh=!1,this.viewportSize=null,this.currentPage=null,this.currentSpread=null,this.pagePosition=null,this.fontSize=16,this.zoom=1,this.fitToScreen=!1,this.pageViewMode=Fc.SINGLE_PAGE,this.waitForLoading=!1,this.renderAllPages=!0,this.pref={fontFamily:"serif",lineHeight:1.25,margin:8,hyphenate:!1,columnWidth:25,horizontal:!1,nightMode:!1,spreadView:!1,pageBorder:1,enabledMediaTypes:{vivliostyle:!0,print:!0},defaultPaperSize:void 0},this.pageSizes=[]},e.addLogListeners=function(){var t=this,e=i;h.addListener(e.DEBUG,function(e){t.callback({t:"debug",content:e})}),h.addListener(e.INFO,function(e){t.callback({t:"info",content:e})}),h.addListener(e.WARN,function(e){t.callback({t:"warn",content:e})}),h.addListener(e.ERROR,function(e){t.callback({t:"error",content:e})})},e.callback=function(t){t.i=this.instanceId,this.callbackFn(t)},e.setReadyState=function(t){this.readyState!==t&&(this.readyState=t,this.viewportElement.setAttribute("data-vivliostyle-viewer-status",t),this.callback({t:"readystatechange"}))},e.loadPublication=function(t){var e=this;b.registerStartTiming("beforeRender"),this.setReadyState(exports.ReadyState.LOADING);var n=t.url,i=t.fragment,r=!!t.zipmeta,o=t.authorStyleSheet,a=t.userStyleSheet;this.viewport=null;var s=Ni("loadPublication");return this.configure(t).then(function(){var t=new Ic;t.init(o,a).then(function(){var o=G(W(n),e.window.location.href);e.packageURL=[o],t.loadPubDoc(o,r).then(function(t){t?(e.opf=t,e.render(i).then(function(){s.finish(!0)})):s.finish(!1)})})}),s.result()},e.loadXML=function(t){var e=this;b.registerStartTiming("beforeRender"),this.setReadyState(exports.ReadyState.LOADING);var n=t.url,i=t.document,r=t.fragment,o=t.authorStyleSheet,a=t.userStyleSheet;this.viewport=null;var s=Ni("loadXML");return this.configure(t).then(function(){var t=new Ic;t.init(o,a).then(function(){var o=n.map(function(t,n){return{url:G(W(t.url),e.window.location.href),index:n,startPage:t.startPage,skipPagesBefore:t.skipPagesBefore}});e.packageURL=o.map(function(t){return t.url}),e.opf=new Bc(t,""),e.opf.initWithChapters(o,i).then(function(){e.render(r).then(function(){s.finish(!0)})})})}),s.result()},e.render=function(t){var e=this;return this.cancelRenderingTask(),(t?this.opf.resolveFragment(t).thenAsync(function(t){return e.pagePosition=t,bi(!0)}):bi(!0)).thenAsync(function(){return b.registerEndTiming("beforeRender"),e.resize()})},e.resolveLength=function(t){var e,n=parseFloat(t);if("string"==typeof t&&(e=t.match(/[a-z]+$/))){var i=e[0];if("em"===i||"rem"===i)return n*this.fontSize;if("ex"===i)return n*Mt.ex*this.fontSize/Mt.em;var r=Mt[i];if(r)return n*r}return n},e.configure=function(t){if("boolean"==typeof t.autoresize&&(t.autoresize?(this.viewportSize=null,this.window.addEventListener("resize",this.resizeListener,!1),this.needResize=!0):this.window.removeEventListener("resize",this.resizeListener,!1)),"number"==typeof t.fontSize){var e=t.fontSize;e>=5&&e<=72&&this.fontSize!=e&&(this.fontSize=e,this.needResize=!0)}if("object"==typeof t.viewport&&t.viewport){var n=t.viewport,i={marginLeft:this.resolveLength(n["margin-left"])||0,marginRight:this.resolveLength(n["margin-right"])||0,marginTop:this.resolveLength(n["margin-top"])||0,marginBottom:this.resolveLength(n["margin-bottom"])||0,width:this.resolveLength(n.width)||0,height:this.resolveLength(n.height)||0};(i.width>=200||i.height>=200)&&(this.window.removeEventListener("resize",this.resizeListener,!1),this.viewportSize=i,this.needResize=!0)}return"boolean"==typeof t.hyphenate&&(this.pref.hyphenate=t.hyphenate,this.needResize=!0),"boolean"==typeof t.horizontal&&(this.pref.horizontal=t.horizontal,this.needResize=!0),"boolean"==typeof t.nightMode&&(this.pref.nightMode=t.nightMode,this.needResize=!0),"number"==typeof t.lineHeight&&(this.pref.lineHeight=t.lineHeight,this.needResize=!0),"number"==typeof t.columnWidth&&(this.pref.columnWidth=t.columnWidth,this.needResize=!0),"string"==typeof t.fontFamily&&(this.pref.fontFamily=t.fontFamily,this.needResize=!0),"boolean"==typeof t.load&&(this.waitForLoading=t.load),"boolean"==typeof t.renderAllPages&&(this.renderAllPages=t.renderAllPages),"string"==typeof t.userAgentRootURL&&(U(t.userAgentRootURL.replace(/resources\/?$/,"")),z(t.userAgentRootURL)),"string"==typeof t.rootURL&&(U(t.rootURL),z(M+"resources/")),"string"==typeof t.pageViewMode&&t.pageViewMode!==this.pageViewMode&&(this.pageViewMode=t.pageViewMode,this.needResize=!0),"number"==typeof t.pageBorder&&t.pageBorder!==this.pref.pageBorder&&(this.viewport=null,this.pref.pageBorder=t.pageBorder,this.needResize=!0),"number"==typeof t.zoom&&t.zoom!==this.zoom&&(this.zoom=t.zoom,this.needRefresh=!0),"boolean"==typeof t.fitToScreen&&t.fitToScreen!==this.fitToScreen&&(this.fitToScreen=t.fitToScreen,this.needRefresh=!0),"object"==typeof t.defaultPaperSize&&"number"==typeof t.defaultPaperSize.width&&"number"==typeof t.defaultPaperSize.height&&(this.viewport=null,this.pref.defaultPaperSize=t.defaultPaperSize,this.needResize=!0),this.configurePlugins(t),bi(!0)},e.configurePlugins=function(t){var e=this;p(exports.HOOKS.CONFIGURATION).forEach(function(n){var i=n(t);e.needResize=i.needResize||e.needResize,e.needRefresh=i.needRefresh||e.needRefresh})},e.pageReplacedListener=function(t){var e=this.currentPage,n=this.currentSpread,i=t.target;n?n.left!==i&&n.right!==i||this.showCurrent(t.newPage):e===t.target&&this.showCurrent(t.newPage)},e.forCurrentPages=function(t){var e=[];this.currentPage&&e.push(this.currentPage),this.currentSpread&&(e.push(this.currentSpread.left),e.push(this.currentSpread.right)),e.forEach(function(e){e&&t(e)})},e.removePageListeners=function(){var t=this;this.forCurrentPages(function(e){e.removeEventListener("hyperlink",t.hyperlinkListener,!1),e.removeEventListener("replaced",t.pageReplacedListener,!1)})},e.hidePages=function(){this.removePageListeners(),this.forCurrentPages(function(t){Z(t.container,"display","none"),t.container.setAttribute("aria-hidden","true")}),this.currentPage=null,this.currentSpread=null},e.showSinglePage=function(t){t.addEventListener("hyperlink",this.hyperlinkListener,!1),t.addEventListener("replaced",this.pageReplacedListener,!1),Z(t.container,"visibility","visible"),Z(t.container,"display","block"),t.container.setAttribute("aria-hidden","false")},e.showPage=function(t){this.hidePages(),this.currentPage=t,t.container.style.marginLeft="",t.container.style.marginRight="",this.showSinglePage(t)},e.showSpread=function(t){if(this.hidePages(),this.currentSpread=t,t.left&&t.right){var e=parseFloat(t.left.container.style.width),n=parseFloat(t.right.container.style.width);e&&n&&e!==n&&(e<n?t.left.container.style.marginLeft=n-e+"px":t.right.container.style.marginRight=e-n+"px")}t.left&&(this.showSinglePage(t.left),t.right?t.left.container.removeAttribute("data-vivliostyle-unpaired-page"):t.left.container.setAttribute("data-vivliostyle-unpaired-page",!0)),t.right&&(this.showSinglePage(t.right),t.left?t.right.container.removeAttribute("data-vivliostyle-unpaired-page"):t.right.container.setAttribute("data-vivliostyle-unpaired-page",!0))},e.reportPosition=function(){var t=this,e=Ni("reportPosition");return this.opf.getCFI(this.pagePosition.spineIndex,this.pagePosition.offsetInItem).then(function(n){var i=t.currentPage;(t.waitForLoading&&i.fetchers.length>0?ki(i.fetchers):bi(!0)).then(function(){t.sendLocationNotification(i,n).thenFinish(e)})}),e.result()},e.createViewport=function(){var t=this.viewportElement;if(this.viewportSize){var e=this.viewportSize;return t.style.marginLeft=e.marginLeft+"px",t.style.marginRight=e.marginRight+"px",t.style.marginTop=e.marginTop+"px",t.style.marginBottom=e.marginBottom+"px",new lc(this.window,this.fontSize,t,e.width,e.height)}return new lc(this.window,this.fontSize,t)},e.resolveSpreadView=function(t){switch(this.pageViewMode){case Fc.SINGLE_PAGE:return!1;case Fc.SPREAD:return!0;case Fc.AUTO_SPREAD:default:return t.width/t.height>=1.45&&t.width>800}},e.updateSpreadView=function(t){this.pref.spreadView=t,this.viewportElement.setAttribute("data-vivliostyle-spread-view",t.toString())},e.sizeIsGood=function(){var t=this.createViewport(),e=this.resolveSpreadView(t),n=this.pref.spreadView!==e;return this.updateSpreadView(e),!(this.viewportSize||!this.viewport||this.viewport.fontSize!=this.fontSize||(n||t.width!=this.viewport.width||t.height!=this.viewport.height)&&(n||t.width!=this.viewport.width||t.height==this.viewport.height||!/Android|iPhone|iPad|iPod/.test(navigator.userAgent))&&(!this.opfView||!this.opfView.hasPages()||this.opfView.hasAutoSizedPages()||(this.viewport.width=t.width,this.viewport.height=t.height,this.needRefresh=!0,0)))},e.setPageSize=function(t,e,n,i){this.pageSizes[i]=t,this.setPageSizePageRules(e,n,i)},e.setPageSizePageRules=function(t,e,n){if(!this.pageSheetSizeAlreadySet&&this.pageRuleStyleElement){var i="";Object.keys(t).forEach(function(e){i+="@page "+e+"{margin:0;size:";var n=t[e];i+=n.width+"px "+n.height+"px;}"}),this.pageRuleStyleElement.textContent=i,this.pageSheetSizeAlreadySet=!0}},e.removePageSizePageRules=function(){this.pageRuleStyleElement&&(this.pageRuleStyleElement.textContent="",this.pageSheetSizeAlreadySet=!1)},e.reset=function(){var t=!1,e=!1;this.opfView&&(t=this.opfView.isTOCVisible(),e=this.opfView.tocAutohide,this.opfView.hideTOC(),this.opfView.removeRenderedPages()),this.removePageSizePageRules(),this.viewport=this.createViewport(),this.viewport.resetZoom(),this.opfView=new Uc(this.opf,this.viewport,this.fontMapper,this.pref,this.setPageSize.bind(this)),t&&this.sendCommand({a:"toc",v:"show",autohide:e})},e.showCurrent=function(t,e){var n=this;return this.needRefresh=!1,this.removePageListeners(),this.pref.spreadView?this.opfView.getSpread(this.pagePosition,e).thenAsync(function(e){return n.showSpread(e),n.setSpreadZoom(e),n.currentPage=t,bi(null)}):(this.showPage(t),this.setPageZoom(t),this.currentPage=t,bi(null))},e.setPageZoom=function(t){var e=this.getAdjustedZoomFactor(t.dimensions);this.viewport.zoom(t.dimensions.width,t.dimensions.height,e)},e.setSpreadZoom=function(t){var e=this.getSpreadDimensions(t);this.viewport.zoom(e.width,e.height,this.getAdjustedZoomFactor(e))},e.getAdjustedZoomFactor=function(t){return this.fitToScreen?this.calculateZoomFactorToFitInsideViewPort(t):this.zoom},e.getSpreadDimensions=function(t){var e=0,n=0;return t.left&&(e+=t.left.dimensions.width,n=t.left.dimensions.height),t.right&&(e+=t.right.dimensions.width,n=Math.max(n,t.right.dimensions.height)),t.left&&t.right&&(e+=2*this.pref.pageBorder,e+=Math.abs(t.left.dimensions.width-t.right.dimensions.width)),{width:e,height:n}},e.queryZoomFactor=function(t){if(!this.currentPage)throw new Error("no page exists.");switch(t){case Vc.FIT_INSIDE_VIEWPORT:var e;return e=this.pref.spreadView?this.getSpreadDimensions(this.currentSpread):this.currentPage.dimensions,this.calculateZoomFactorToFitInsideViewPort(e);default:throw new Error("unknown zoom type: "+t)}},e.calculateZoomFactorToFitInsideViewPort=function(t){return Math.min(this.viewport.width/t.width,this.viewport.height/t.height)},e.cancelRenderingTask=function(){this.renderTask&&this.renderTask.interrupt(new zc),this.renderTask=null},e.resize=function(){var t=this;if(this.needResize=!1,this.needRefresh=!1,this.sizeIsGood())return bi(!0);this.setReadyState(exports.ReadyState.LOADING),this.cancelRenderingTask();var e=yi().getScheduler().run(function(){return Si("resize",function(n){t.opf?(t.renderTask=e,b.registerStartTiming("render (resize)"),t.reset(),t.pagePosition&&(0==t.pagePosition.pageIndex&&0==t.pagePosition.offsetInItem||(t.pagePosition.pageIndex=-1)),t.opf.setEPageCountMode(t.renderAllPages),t.opfView.renderPagesUpto(t.pagePosition,!t.renderAllPages).then(function(i){i?(t.pagePosition=i.position,t.showCurrent(i.page,!0).then(function(){t.setReadyState(exports.ReadyState.INTERACTIVE),t.opf.countEPages(function(e){var n={t:"nav",epageCount:e,first:t.currentPage.isFirstPage,last:t.currentPage.isLastPage,metadata:t.opf.metadata,docTitle:t.opf.spine[t.pagePosition.spineIndex].title};(t.currentPage.isFirstPage||0==t.pagePosition.pageIndex&&t.opf.spine[t.pagePosition.spineIndex].epage)&&(n.epage=t.opf.spine[t.pagePosition.spineIndex].epage),t.callback(n)}).then(function(){t.reportPosition().then(function(i){(t.renderAllPages?t.opfView.renderAllPages():bi(null)).then(function(){t.renderTask===e&&(t.renderTask=null),b.registerEndTiming("render (resize)"),t.renderAllPages&&t.setReadyState(exports.ReadyState.COMPLETE),t.callback({t:"loaded"}),n.finish(i)})})})})):n.finish(!1)})):n.finish(!1)},function(t,e){if(!(e instanceof zc))throw e;b.registerEndTiming("render (resize)"),h.debug(e.message)})});return bi(!0)},e.sendLocationNotification=function(t,e){var n=this,i=Ni("sendLocationNotification"),r={t:"nav",first:t.isFirstPage,last:t.isLastPage,metadata:this.opf.metadata,docTitle:this.opf.spine[t.spineIndex].title};return this.opf.getEPageFromPosition(this.pagePosition).then(function(t){r.epage=t,r.epageCount=n.opf.epageCount,e&&(r.cfi=e),n.callback(r),i.finish(!0)}),i.result()},e.getCurrentPageProgression=function(){return this.opfView?this.opfView.getCurrentPageProgression(this.pagePosition):null},e.moveTo=function(t){var e,n=this;if(this.readyState!==exports.ReadyState.COMPLETE&&"next"!==t.where&&this.setReadyState(exports.ReadyState.LOADING),"string"==typeof t.where){var i;switch(t.where){case"next":i=this.pref.spreadView?this.opfView.nextSpread:this.opfView.nextPage;break;case"previous":i=this.pref.spreadView?this.opfView.previousSpread:this.opfView.previousPage;break;case"last":i=this.opfView.lastPage;break;case"first":i=this.opfView.firstPage;break;default:return bi(!0)}i&&(e=function(){return i.call(n.opfView,n.pagePosition,!n.renderAllPages)})}else if("number"==typeof t.epage){var r=t.epage;e=function(){return n.opfView.navigateToEPage(r,n.pagePosition,!n.renderAllPages)}}else{if("string"!=typeof t.url)return bi(!0);var o=t.url;e=function(){return n.opfView.navigateTo(o,n.pagePosition,!n.renderAllPages)}}var a=Ni("moveTo");return e.call(this.opfView).then(function(t){var e;if(t){n.pagePosition=t.position;var i=Ni("moveTo.showCurrent");e=i.result(),n.showCurrent(t.page,!n.renderAllPages).then(function(){n.reportPosition().thenFinish(i)})}else e=bi(!0);e.then(function(t){n.readyState===exports.ReadyState.LOADING&&n.setReadyState(exports.ReadyState.INTERACTIVE),a.finish(t)})}),a.result()},e.showTOC=function(t){var e=this,n=!!t.autohide,i=t.v,r=this.opfView.isTOCVisible(),o=n!=this.opfView.tocAutohide&&"hide"!=i;if(r){if("show"==i&&!o)return bi(!0)}else if("hide"==i)return bi(!0);if(r&&"show"!=i)return this.opfView.hideTOC(),bi(!0);var a=Ni("showTOC");return this.opfView.showTOC(n).then(function(t){t&&(o&&(t.listeners={}),n&&t.addEventListener("hyperlink",function(){e.opfView.hideTOC()},!1),t.addEventListener("hyperlink",e.hyperlinkListener,!1)),a.finish(!0)}),a.result()},e.runCommand=function(t){var e=this,n=t.a||"";return Si("runCommand",function(i){var r=e.actions[n];r?r.call(e,t).then(function(){e.callback({t:"done",a:n}),i.finish(!0)}):(h.error("No such action:",n),i.finish(!0))},function(t,e){h.error(e,"Error during action:",n),t.finish(!0)})},e.initEmbed=function(t){var e,n=this,i=Gc(t),r=null,o=this;e=function(){var t=Ni("commandLoop"),e=yi().getScheduler();return o.hyperlinkListener=function(t){var n=t,i="#"===n.href.charAt(0)||o.packageURL.some(function(t){return n.href.substr(0,t.length)==t});if(i){t.preventDefault();var r={t:"hyperlink",href:n.href,internal:i};e.run(function(){return o.callback(r),bi(!0)})}},t.loopWithFrame(function(t){if(o.needResize)o.resize().then(function(){t.continueLoop()});else if(o.needRefresh)o.currentPage&&o.showCurrent(o.currentPage).then(function(){t.continueLoop()});else if(i){var e=i;i=null,o.runCommand(e).then(function(){t.continueLoop()})}else{var a=Ni("waitForCommand");r=a.suspend(n),a.result().then(function(){t.continueLoop()})}}).thenFinish(t),t.result()},(Ei?Ei.getScheduler():wi||new Ti(new Ci)).run(e,void 0),o.kick=function(){var t=r;t&&(r=null,t.schedule(!0))},o.sendCommand=function(t){return!i&&(i=Gc(t),o.kick(),!0)},this.window.adapt_command=o.sendCommand},t}();!function(t){t.FIT_INSIDE_VIEWPORT="fit inside viewport"}(Vc||(Vc={}));var zc=function(t){function e(){var n;return(n=t.call(this)||this).name="RenderingCanceledError",n.message="Page rendering has been canceled",Object.setPrototypeOf(O(n),e.prototype),n.stack=(new Error).stack,n}return x(e,t),e}(L(Error));function Gc(t){return"string"==typeof t?_(t):t}var Wc=exports.PageProgression;function Xc(t){var e={};return Object.keys(t).forEach(function(n){var i=t[n];switch(n){case"autoResize":e.autoresize=i;break;case"pageBorderWidth":e.pageBorder=i;break;default:e[n]=i}}),e}var jc,Yc=function(){function t(t,e){this.settings=t,this.initialized=!1,o(t.debug),this.adaptViewer_=new Hc(t.window||window,t.viewportElement,"main",this.dispatcher.bind(this)),this.options={autoResize:!0,fontSize:16,pageBorderWidth:1,renderAllPages:!0,pageViewMode:Fc.AUTO_SPREAD,zoom:1,fitToScreen:!1,defaultPaperSize:void 0},e&&this.setOptions(e),this.eventTarget=new ft,Object.defineProperty(this,"readyState",{get:function(){return this.adaptViewer_.readyState}})}var e=t.prototype;return e.setOptions=function(t){var e=Object.assign({a:"configure"},Xc(t));this.adaptViewer_.sendCommand(e),Object.assign(this.options,t)},e.dispatcher=function(t){var e={type:t.t},n=t;Object.keys(n).forEach(function(t){"t"!==t&&(e[t]=n[t])}),this.eventTarget.dispatchEvent(e)},e.addListener=function(t,e){this.eventTarget.addEventListener(t,e,!1)},e.removeListener=function(t,e){this.eventTarget.removeEventListener(t,e,!1)},e.loadDocument=function(t,e,n){t||this.eventTarget.dispatchEvent({type:"error",content:"No URL specified"}),this.loadDocumentOrPublication(t,null,e,n)},e.loadPublication=function(t,e,n){t||this.eventTarget.dispatchEvent({type:"error",content:"No URL specified"}),this.loadDocumentOrPublication(null,t,e,n)},e.loadDocumentOrPublication=function(t,e,n,i){var r=n||{};function o(t){return t?t.map(function(t){return{url:t.url||null,text:t.text||null}}):void 0}var a=o(r.authorStyleSheet),s=o(r.userStyleSheet);i&&Object.assign(this.options,i);var l=Object.assign({a:t?"loadXML":"loadPublication",userAgentRootURL:this.settings.userAgentRootURL,url:Kc(t)||e,document:r.documentObject,fragment:r.fragment,authorStyleSheet:a,userStyleSheet:s},Xc(this.options));this.initialized?this.adaptViewer_.sendCommand(l):(this.initialized=!0,this.adaptViewer_.initEmbed(l))},e.getCurrentPageProgression=function(){return this.adaptViewer_.getCurrentPageProgression()},e.resolveNavigation=function(t){switch(t){case exports.Navigation.LEFT:return this.getCurrentPageProgression()===Wc.LTR?exports.Navigation.PREVIOUS:exports.Navigation.NEXT;case exports.Navigation.RIGHT:return this.getCurrentPageProgression()===Wc.LTR?exports.Navigation.NEXT:exports.Navigation.PREVIOUS;default:return t}},e.navigateToPage=function(t,e){t===exports.Navigation.EPAGE?this.adaptViewer_.sendCommand({a:"moveTo",epage:e}):this.adaptViewer_.sendCommand({a:"moveTo",where:this.resolveNavigation(t)})},e.navigateToInternalUrl=function(t){this.adaptViewer_.sendCommand({a:"moveTo",url:t})},e.isTOCVisible=function(){return this.adaptViewer_.opfView&&this.adaptViewer_.opfView.opf&&(this.adaptViewer_.opfView.opf.xhtmlToc||this.adaptViewer_.opfView.opf.ncxToc)?!!this.adaptViewer_.opfView.isTOCVisible():null},e.showTOC=function(t,e){this.adaptViewer_.sendCommand({a:"toc",v:null==t?"toggle":t?"show":"hide",autohide:e})},e.queryZoomFactor=function(t){return this.adaptViewer_.queryZoomFactor(t)},e.getPageSizes=function(){return this.adaptViewer_.pageSizes},e.getTOC=function(){var t,e;return null==(t=this.adaptViewer_.opfView)||null==(e=t.tocView)?void 0:e.getTOC()},e.getMetadata=function(){return this.adaptViewer_.opf.getMetadata()},e.getCover=function(){return this.adaptViewer_.opf.cover},t}();function Kc(t){function e(t){return"number"==typeof t?t:null}function n(t){return"string"==typeof t?{url:t,startPage:null,skipPagesBefore:null}:{url:t.url,startPage:e(t.startPage),skipPagesBefore:e(t.skipPagesBefore)}}return Array.isArray(t)?t.map(n):t?[n(t)]:null}(jc=exports.Navigation||(exports.Navigation={})).PREVIOUS="previous",jc.NEXT="next",jc.LEFT="left",jc.RIGHT="right",jc.FIRST="first",jc.LAST="last",jc.EPAGE="epage";var qc=Vc,Qc=Fc;b.forceRegisterEndTiming("load_vivliostyle");var Zc=function(){function t(t,e){var n=e.title,i=void 0===n?"":n,r=e.printCallback,o=void 0===r?function(t){return t.print()}:r,a=e.hideIframe,s=void 0===a||a,l=e.removeIframe,u=void 0===l||l;this.htmlDoc=t,this.title=i,this.printCallback=o,this.hideIframe=s,this.removeIframe=u}var e=t.prototype;return e.init=function(){this.iframe=document.createElement("iframe"),this.hideIframe&&(this.iframe.style.width="0",this.iframe.style.height="0",this.iframe.style.borderWidth="0"),this.window=window,this.window.printInstance=this,this.iframe.srcdoc="\n <!DOCTYPE html>\n <html data-vivliostyle-paginated=\"true\">\n <head>\n <meta charset='utf-8'/>\n <meta name='viewport' content='width=device-width, initial-scale=1.0'/>\n <title>"+this.title+"</title>\n <style>"+Bi+"</style>\n <style>"+_i+"</style>\n <style>\n html[data-vivliostyle-paginated] {\n width: 100%;\n height: 100%;\n }\n html[data-vivliostyle-paginated] body,\n html[data-vivliostyle-paginated] [data-vivliostyle-viewer-viewport] {\n width: 100% !important;\n height: 100% !important;\n }\n html[data-vivliostyle-paginated],\n html[data-vivliostyle-paginated] body {\n margin: 0;\n padding: 0;\n }\n </style>\n <style id='vivliostyle-page-rules'></style>\n </head>\n <body onload='parent.printInstance.runInIframe(window)'>\n <div id=\"vivliostyle-viewer-viewport\"></div>\n </body>\n </html>",document.body.appendChild(this.iframe)},e.runInIframe=function(t){var e=this;return this.iframeWin=t,this.preparePrint().then(function(){return e.browserPrint()}).then(function(){return e.cleanUp()})},e.preparePrint=function(){this.iframeWin.document.title=this.title;var t=new Blob([this.htmlDoc],{type:"text/html"}),e=URL.createObjectURL(t),n=new Yc({viewportElement:this.iframeWin.document.body.firstElementChild,window:this.iframeWin,debug:!0},{defaultPaperSize:{width:794,height:1122}});return new Promise(function(t){n.addListener("readystatechange",function(){"complete"===n.readyState&&t()}),n.loadDocument({url:e})})},e.browserPrint=function(){this.printCallback(this.iframeWin)},e.cleanUp=function(){delete this.window.printInstance,this.removeIframe&&this.iframe.parentElement.removeChild(this.iframe)},t}();exports.CoreViewer=Yc,exports.PageViewMode=Qc,exports.Profiler=m,exports.UserAgentBaseCss=Hi,exports.UserAgentPageCss=Vi,exports.UserAgentXml=Ui,exports.ValidationTxt=Mi,exports.VivliostyleViewportCss=Bi,exports.VivliostyleViewportScreenCss=_i,exports.ZoomType=qc,exports.getHooksForName=p,exports.pageProgressionOf=a,exports.plugin=g,exports.printHTML=function(t,e){new Zc(t,e).init()},exports.profile=S,exports.profiler=b,exports.registerHook=f,exports.removeHook=d,exports.setDebug=o;
2//# sourceMappingURL=vivliostyle.js.map