vivliostyle-web-component
code:mod.js
import{Fragment as pp,h as ca}from"../preact@10.5.14/mod.js";import{useEffect as Tr,useRef as da}from"../preact@10.5.14/hooks.js";import gp from"../preact-custom-element@4.2.1/mod.js";var Kf=Object.create,la=Object.defineProperty,qf=Object.getOwnPropertyDescriptor,Qf=Object.getOwnPropertyNames,Zf=Object.getPrototypeOf,$f=Object.prototype.hasOwnProperty,Jf=R=>la(R,"__esModule",{value:!0}),tp=(R,St)=>()=>(St||R((St={exports:{}}).exports,St),St.exports),ep=(R,St,Xt)=>{if(St&&typeof St=="object"||typeof St=="function")for(let Nt of Qf(St))!$f.call(R,Nt)&&Nt!=="default"&&la(R,Nt,{get:()=>StNt,enumerable:!(Xt=qf(St,Nt))||Xt.enumerable});return R},Al=R=>ep(Jf(la(R!=null?Kf(Zf(R)):{},"default",R&&R.__esModule&&"default"in R?{get:()=>R.default,enumerable:!0}:{value:R,enumerable:!0})),R),Tl=tp((R,St)=>{var Xt=-1,Nt=1,zt=0;function Ce(A,z,P,nt){if(A===z)return A?zt,A:[];if(P!=null){var J=nn(A,z,P);if(J)return J}var V=Ve(A,z),w=A.substring(0,V);A=A.substring(V),z=z.substring(V),V=de(A,z);var Q=A.substring(A.length-V);A=A.substring(0,A.length-V),z=z.substring(0,z.length-V);var rt=an(A,z);return w&&rt.unshift(zt,w),Q&&rt.push(zt,Q),He(rt,nt),rt}function an(A,z){var P;if(!A)returnNt,z;if(!z)returnXt,A;var nt=A.length>z.length?A:z,J=A.length>z.length?z:A,V=nt.indexOf(J);if(V!==-1)return P=Nt,nt.substring(0,V)],zt,J,[Nt,nt.substring(V+J.length),A.length>z.length&&(P00=P20=Xt),P;if(J.length===1)returnXt,A],[Nt,z;var w=M(A,z);if(w){var Q=w0,rt=w1,At=w2,Tt=w3,Et=w4,xt=Ce(Q,At),Vt=Ce(rt,Tt);return xt.concat(zt,Et,Vt)}return sn(A,z)}function sn(A,z){for(var P=A.length,nt=z.length,J=Math.ceil((P+nt)/2),V=J,w=2*J,Q=new Array(w),rt=new Array(w),At=0;At<w;At++)QAt=-1,rtAt=-1;QV+1=0,rtV+1=0;for(var Tt=P-nt,Et=Tt%2!=0,xt=0,Vt=0,B=0,gt=0,jt=0;jt<J;jt++){for(var It=-jt+xt;It<=jt-Vt;It+=2){var Ct=V+It,bt;It===-jt||It!==jt&&QCt-1<QCt+1?bt=QCt+1:bt=QCt-1+1;for(var Ut=bt-It;bt<P&&Ut<nt&&A.charAt(bt)===z.charAt(Ut);)bt++,Ut++;if(QCt=bt,bt>P)Vt+=2;else if(Ut>nt)xt+=2;else if(Et){var U=V+Tt-It;if(U>=0&&U<w&&rtU!==-1){var Bt=P-rtU;if(bt>=Bt)return Ke(A,z,bt,Ut)}}}for(var De=-jt+B;De<=jt-gt;De+=2){var U=V+De,Bt;De===-jt||De!==jt&&rtU-1<rtU+1?Bt=rtU+1:Bt=rtU-1+1;for(var wt=Bt-De;Bt<P&&wt<nt&&A.charAt(P-Bt-1)===z.charAt(nt-wt-1);)Bt++,wt++;if(rtU=Bt,Bt>P)gt+=2;else if(wt>nt)B+=2;else if(!Et){var Ct=V+Tt-De;if(Ct>=0&&Ct<w&&QCt!==-1){var bt=QCt,Ut=V+bt-Ct;if(Bt=P-Bt,bt>=Bt)return Ke(A,z,bt,Ut)}}}}returnXt,A],[Nt,z}function Ke(A,z,P,nt){var J=A.substring(0,P),V=z.substring(0,nt),w=A.substring(P),Q=z.substring(nt),rt=Ce(J,V),At=Ce(w,Q);return rt.concat(At)}function Ve(A,z){if(!A||!z||A.charAt(0)!==z.charAt(0))return 0;for(var P=0,nt=Math.min(A.length,z.length),J=nt,V=0;P<J;)A.substring(V,J)==z.substring(V,J)?(P=J,V=P):nt=J,J=Math.floor((nt-P)/2+P);return be(A.charCodeAt(J-1))&&J--,J}function de(A,z){if(!A||!z||A.slice(-1)!==z.slice(-1))return 0;for(var P=0,nt=Math.min(A.length,z.length),J=nt,V=0;P<J;)A.substring(A.length-J,A.length-V)==z.substring(z.length-J,z.length-V)?(P=J,V=P):nt=J,J=Math.floor((nt-P)/2+P);return un(A.charCodeAt(A.length-J))&&J--,J}function M(A,z){var P=A.length>z.length?A:z,nt=A.length>z.length?z:A;if(P.length<4||nt.length*2<P.length)return null;function J(Vt,B,gt){for(var jt=Vt.substring(gt,gt+Math.floor(Vt.length/4)),It=-1,Ct="",bt,Ut,U,Bt;(It=B.indexOf(jt,It+1))!==-1;){var De=Ve(Vt.substring(gt),B.substring(It)),wt=de(Vt.substring(0,gt),B.substring(0,It));Ct.length<wt+De&&(Ct=B.substring(It-wt,It)+B.substring(It,It+De),bt=Vt.substring(0,gt-wt),Ut=Vt.substring(gt+De),U=B.substring(0,It-wt),Bt=B.substring(It+De))}return Ct.length*2>=Vt.length?bt,Ut,U,Bt,Ct:null}var V=J(P,nt,Math.ceil(P.length/4)),w=J(P,nt,Math.ceil(P.length/2)),Q;if(!V&&!w)return null;w?V?Q=V4.length>w4.length?V:w:Q=w:Q=V;var rt,At,Tt,Et;A.length>z.length?(rt=Q0,At=Q1,Tt=Q2,Et=Q3):(Tt=Q0,Et=Q1,rt=Q2,At=Q3);var xt=Q4;returnrt,At,Tt,Et,xt}function He(A,z){A.push(zt,"");for(var P=0,nt=0,J=0,V="",w="",Q;P<A.length;){if(P<A.length-1&&!AP1){A.splice(P,1);continue}switch(AP0){case Nt:J++,w+=AP1,P++;break;case Xt:nt++,V+=AP1,P++;break;case zt:var rt=P-J-nt-1;if(z){if(rt>=0&&An(Art1)){var At=Art1.slice(-1);if(Art1=Art1.slice(0,-1),V=At+V,w=At+w,!Art1){A.splice(rt,1),P--;var Tt=rt-1;ATt&&ATt0===Nt&&(J++,w=ATt1+w,Tt--),ATt&&ATt0===Xt&&(nt++,V=ATt1+V,Tt--),rt=Tt}}if(se(AP1)){var At=AP1.charAt(0);AP1=AP1.slice(1),V+=At,w+=At}}if(P<A.length-1&&!AP1){A.splice(P,1);break}if(V.length>0||w.length>0){V.length>0&&w.length>0&&(Q=Ve(w,V),Q!==0&&(rt>=0?Art1+=w.substring(0,Q):(A.splice(0,0,zt,w.substring(0,Q)),P++),w=w.substring(Q),V=V.substring(Q)),Q=de(w,V),Q!==0&&(AP1=w.substring(w.length-Q)+AP1,w=w.substring(0,w.length-Q),V=V.substring(0,V.length-Q)));var Et=J+nt;V.length===0&&w.length===0?(A.splice(P-Et,Et),P=P-Et):V.length===0?(A.splice(P-Et,Et,Nt,w),P=P-Et+1):w.length===0?(A.splice(P-Et,Et,Xt,V),P=P-Et+1):(A.splice(P-Et,Et,Xt,V,Nt,w),P=P-Et+2)}P!==0&&AP-10===zt?(AP-11+=AP1,A.splice(P,1)):P++,J=0,nt=0,V="",w="";break}}AA.length-11===""&&A.pop();var xt=!1;for(P=1;P<A.length-1;)AP-10===zt&&AP+10===zt&&(AP1.substring(AP1.length-AP-11.length)===AP-11?(AP1=AP-11+AP1.substring(0,AP1.length-AP-11.length),AP+11=AP-11+AP+11,A.splice(P-1,1),xt=!0):AP1.substring(0,AP+11.length)==AP+11&&(AP-11+=AP+11,AP1=AP1.substring(AP+11.length)+AP+11,A.splice(P+1,1),xt=!0)),P++;xt&&He(A,z)}function be(A){return A>=55296&&A<=56319}function un(A){return A>=56320&&A<=57343}function se(A){return un(A.charCodeAt(0))}function An(A){return be(A.charCodeAt(A.length-1))}function Tn(A){for(var z=[],P=0;P<A.length;P++)AP1.length>0&&z.push(AP);return z}function Pe(A,z,P,nt){return An(A)||se(nt)?null:Tn(zt,A],Xt,z,Nt,P,[zt,nt)}function nn(A,z,P){var nt=typeof P=="number"?{index:P,length:0}:P.oldRange,J=typeof P=="number"?null:P.newRange,V=A.length,w=z.length;if(nt.length===0&&(J===null||J.length===0)){var Q=nt.index,rt=A.slice(0,Q),At=A.slice(Q),Tt=J?J.index:null;t:{var Et=Q+w-V;if(Tt!==null&&Tt!==Et||Et<0||Et>w)break t;var xt=z.slice(0,Et),Vt=z.slice(Et);if(Vt!==At)break t;var B=Math.min(Q,Et),gt=rt.slice(0,B),jt=xt.slice(0,B);if(gt!==jt)break t;var It=rt.slice(B),Ct=xt.slice(B);return Pe(gt,It,Ct,At)}t:{if(Tt!==null&&Tt!==Q)break t;var bt=Q,xt=z.slice(0,bt),Vt=z.slice(bt);if(xt!==rt)break t;var Ut=Math.min(V-bt,w-bt),U=At.slice(At.length-Ut),Bt=Vt.slice(Vt.length-Ut);if(U!==Bt)break t;var It=At.slice(0,At.length-Ut),Ct=Vt.slice(0,Vt.length-Ut);return Pe(rt,It,Ct,U)}}if(nt.length>0&&J&&J.length===0){t:{var gt=A.slice(0,nt.index),U=A.slice(nt.index+nt.length),B=gt.length,Ut=U.length;if(w<B+Ut)break t;var jt=z.slice(0,B),Bt=z.slice(w-Ut);if(gt!==jt||U!==Bt)break t;var It=A.slice(B,V-Ut),Ct=z.slice(B,w-Ut);return Pe(gt,It,Ct,U)}}return null}function Se(A,z,P){return Ce(A,z,P,!0)}Se.INSERT=Nt,Se.DELETE=Xt,Se.EQUAL=zt,St.exports=Se}),wp=Al(Tl()),np=Al(Tl());var xl=np.default;var ip=Object.create,ha=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,op=Object.getOwnPropertyNames,ap=Object.getPrototypeOf,sp=Object.prototype.hasOwnProperty,up=R=>ha(R,"__esModule",{value:!0});var lp=(R,St)=>()=>(St||R((St={exports:{}}).exports,St),St.exports),hp=(R,St,Xt)=>{if(St&&typeof St=="object"||typeof St=="function")for(let Nt of op(St))!sp.call(R,Nt)&&Nt!=="default"&&ha(R,Nt,{get:()=>StNt,enumerable:!(Xt=rp(St,Nt))||Xt.enumerable});return R},Il=R=>hp(up(ha(R!=null?ip(ap(R)):{},"default",R&&R.__esModule&&"default"in R?{get:()=>R.default,enumerable:!0}:{value:R,enumerable:!0})),R),Fl=lp(R=>{function St(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var Xt,Nt,zt,Ce=St(xl);function an(o){R.isDebug=o}function sn(o){switch(o){case"ltr":return R.PageProgression.LTR;case"rtl":return R.PageProgression.RTL;default:throw new Error("unknown PageProgression: "+o)}}function Ke(o){var r=Array.from(o),e=null;return r0instanceof Error&&(e=r.shift()),{error:e,messages:r}}function Ve(o){var r=o.error,e=r&&(r.frameTrace||r.stack),t=[].concat(o.messages);return r&&(t.length>0&&(t=t.concat([` ])),t=t.concat([r.toString()]),e&&(t=t.concat([
]).concat(e))),t}R.isDebug=!1,R.PageProgression=void 0,function(o){o.LTR="ltr",o.RTL="rtl"}(R.PageProgression||(R.PageProgression={})),R.PageSide=void 0,(Xt=R.PageSide||(R.PageSide={})).LEFT="left",Xt.RIGHT="right",R.ReadyState=void 0,(Nt=R.ReadyState||(R.ReadyState={})).LOADING="loading",Nt.INTERACTIVE="interactive",Nt.COMPLETE="complete",function(o){o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR"}(zt||(zt={}));var de,M=new(function(){function o(e){this.opt_console=void 0,this.listeners={},this.opt_console=e}var r=o.prototype;return r.consoleDebug=function(e){var t,n,i;this.opt_console?this.opt_console.debug?(t=this.opt_console).debug.apply(t,e):(n=this.opt_console).log.apply(n,e):(i=console).debug.apply(i,e)},r.consoleInfo=function(e){var t,n,i;this.opt_console?this.opt_console.info?(t=this.opt_console).info.apply(t,e):(n=this.opt_console).log.apply(n,e):(i=console).info.apply(i,e)},r.consoleWarn=function(e){var t,n,i;this.opt_console?this.opt_console.warn?(t=this.opt_console).warn.apply(t,e):(n=this.opt_console).log.apply(n,e):(i=console).warn.apply(i,e)},r.consoleError=function(e){var t,n,i;this.opt_console?this.opt_console.error?(t=this.opt_console).error.apply(t,e):(n=this.opt_console).log.apply(n,e):(i=console).error.apply(i,e)},r.triggerListeners=function(e,t){var n=this.listeners[e];n&&n.forEach(function(i){i(t)})},r.addListener=function(e,t){var n=this.listeners[e];n||(n=this.listeners[e]=[]),n.push(t)},r.debug=function(){var e=Ke(arguments);this.consoleDebug(Ve(e)),this.triggerListeners(zt.DEBUG,e)},r.info=function(){var e=Ke(arguments);this.consoleInfo(Ve(e)),this.triggerListeners(zt.INFO,e)},r.warn=function(){var e=Ke(arguments);this.consoleWarn(Ve(e)),this.triggerListeners(zt.WARN,e)},r.error=function(){var e=Ke(arguments);this.consoleError(Ve(e)),this.triggerListeners(zt.ERROR,e)},o}());R.HOOKS=void 0,(de=R.HOOKS||(R.HOOKS={})).SIMPLE_PROPERTY="SIMPLE_PROPERTY",de.PREPROCESS_SINGLE_DOCUMENT="PREPROCESS_SINGLE_DOCUMENT",de.PREPROCESS_TEXT_CONTENT="PREPROCESS_TEXT_CONTENT",de.PREPROCESS_ELEMENT_STYLE="PREPROCESS_ELEMENT_STYLE",de.POLYFILLED_INHERITED_PROPS="POLYFILLED_INHERITED_PROPS",de.CONFIGURATION="CONFIGURATION",de.RESOLVE_TEXT_NODE_BREAKER="RESOLVE_TEXT_NODE_BREAKER",de.RESOLVE_FORMATTING_CONTEXT="RESOLVE_FORMATTING_CONTEXT",de.RESOLVE_LAYOUT_PROCESSOR="RESOLVE_LAYOUT_PROCESSOR",de.POST_LAYOUT_BLOCK="POST_LAYOUT_BLOCK";var He={};function be(o,r){if(R.HOOKS[o]){var e=He[o];e||(e=He[o]=[]),e.push(r)}else M.warn(new Error("Skipping unknown plugin hook '"+o+"'."))}function un(o,r){if(R.HOOKS[o]){var e=He[o];if(e){var t=e.indexOf(r);t>=0&&e.splice(t,1)}}else M.warn(new Error("Ignoring unknown plugin hook '"+o+"'."))}function se(o){return He[o]||[]}var An={registerHook:be,removeHook:un},Tn=function(){function o(e){this.performanceInstance=void 0,this.timestamps={},this.registerTiming=void 0,this.registerStartTiming=void 0,this.registerEndTiming=void 0,this.performanceInstance=e,this.registerTiming=Pe,this.registerStartTiming=this.registerStartTiming=Pe,this.registerEndTiming=this.registerEndTiming=Pe}var r=o.prototype;return r.forceRegisterStartTiming=function(e,t){nn.call(this,e,"start",t)},r.forceRegisterEndTiming=function(e,t){nn.call(this,e,"end",t)},r.printTimings=function(){var e=this.timestamps,t="";Object.keys(e).forEach(function(n){for(var i=e[n],a=i.length,s=0;s<a;s++){var u=i[s];t+=n,a>1&&(t+="("+s+")"),t+=" => start: "+u.start+", end: "+u.end+", duration: "+(u.end-u.start)+
}}),M.info(t)},r.disable=function(){this.registerTiming=Pe,this.registerStartTiming=this.registerStartTiming=Pe,this.registerEndTiming=this.registerEndTiming=Pe},r.enable=function(){this.registerTiming=nn,this.registerStartTiming=this.registerStartTiming=Se,this.registerEndTiming=this.registerEndTiming=A},r.isEnabled=function(){return this.registerStartTiming===Se},o}();function Pe(){}function nn(o,r,e){e||(e=this.performanceInstance.now());var t,n=this.timestamps[o];n||(n=this.timestamps[o]=[]);for(var i=n.length-1;i>=0&&(!(t=n[i])||t[r]);i--)t=null;t||n.push(t={}),t[r]=e}function Se(o,r){this.registerTiming(o,"start",r)}function A(o,r){this.registerTiming(o,"end",r)}var z={now:Date.now},P=new Tn(window&&window.performance||z);P.forceRegisterStartTiming("load_vivliostyle");var nt={profiler:{registerStartTiming:P.registerStartTiming,registerEndTiming:P.registerEndTiming,printTimings:P.printTimings,disable:P.disable,enable:P.enable}};function J(o,r){for(var e=0;e<r.length;e++){var t=r[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(o,t.key,t)}}function V(o,r,e){return r&&J(o.prototype,r),e&&J(o,e),o}function w(o,r){o.prototype=Object.create(r.prototype),o.prototype.constructor=o,rt(o,r)}function Q(o){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(o)}function rt(o,r){return(rt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(o,r)}function At(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(o){return!1}}function Tt(o,r,e){return(Tt=At()?Reflect.construct:function(t,n,i){var a=[null];a.push.apply(a,n);var s=new(Function.bind.apply(t,a));return i&&rt(s,i.prototype),s}).apply(null,arguments)}function Et(o){var r=typeof Map=="function"?new Map:void 0;return(Et=function(e){if(e===null||Function.toString.call(e).indexOf("[native code]")===-1)return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(r!==void 0){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return Tt(e,arguments,Q(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),rt(t,e)})(o)}function xt(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function Vt(o,r){(r==null||r>o.length)&&(r=o.length);for(var e=0,t=new Array(r);e<r;e++)t[e]=o[e];return t}function B(o,r){var e=typeof Symbol!="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(e)return(e=e.call(o)).next.bind(e);if(Array.isArray(o)||(e=function(n,i){if(n){if(typeof n=="string")return Vt(n,i);var a=Object.prototype.toString.call(n).slice(8,-1);return a==="Object"&&n.constructor&&(a=n.constructor.name),a==="Map"||a==="Set"?Array.from(n):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Vt(n,i):void 0}}(o))||r&&o&&typeof o.length=="number"){e&&(o=e);var t=0;return function(){return t>=o.length?{done:!0}:{done:!1,value:o[t++]}}}throw new TypeError(Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a Symbol.iterator() method.)}var gt=/^(?:[\t-\r -#%-\*,-\/:;\?@\[-\]_\{\}\xA0\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u0300-\u036F\u037E\u0387\u0483-\u0487\u055A-\u055F\u0589\u058A\u0591-\u05C7\u05F3\u05F4\u0609\u060A\u060C\u060D\u0610-\u061B\u061E\u061F\u064B-\u065F\u066A-\u066D\u0670\u06D4\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0700-\u070D\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07F7-\u07F9\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0830-\u083E\u0859-\u085B\u085E\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962-\u0965\u0970\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FD\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A76\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AF0\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C77\u0C81\u0C84\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0DF4\u0E31\u0E34-\u0E3A\u0E47-\u0E4F\u0E5A\u0E5B\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F04-\u0F12\u0F14\u0F18\u0F19\u0F35\u0F37\u0F39-\u0F3D\u0F71-\u0F7E\u0F80-\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u0FD0-\u0FD4\u0FD9\u0FDA\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u104A-\u104F\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u10FB\u135D-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1712-\u1714\u1732-\u1736\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D6\u17D8-\u17DA\u17DD\u1800-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1944\u1945\u1A17\u1A18\u1A1B\u1A1E\u1A1F\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1AB0-\u1ABD\u1ABF\u1AC0\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B5A-\u1B60\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1BFC-\u1BFF\u1C2C-\u1C33\u1C36\u1C37\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD0-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CEF-\u2CF1\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2D7F\u2DE0-\u2E2E\u2E30-\u2E4F\u2E52\u3000-\u3003\u3008-\u3011\u3014-\u301F\u302A-\u302D\u3030\u303D\u3099\u309A\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA66F\uA673-\uA67E\uA69E\uA69F\uA6F0-\uA6F7\uA802\uA806\uA80B\uA825\uA826\uA82C\uA874-\uA877\uA8C4\uA8C5\uA8CE\uA8CF\uA8E0-\uA8F1\uA8F8-\uA8FA\uA8FC\uA8FF\uA926-\uA92F\uA947-\uA951\uA95F\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9C1-\uA9CD\uA9DE\uA9DF\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA5C-\uAA5F\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAADE\uAADF\uAAEC\uAAED\uAAF0\uAAF1\uAAF6\uABE5\uABE8\uABEB\uABED\uFB1E\uFD3E\uFD3F\uFE00-\uFE19\uFE20-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFEFF\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDDFD\uDEE0\uDF76-\uDF7A\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDE50-\uDE58\uDE7F\uDEE5\uDEE6\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD24-\uDD27\uDEAB-\uDEAD\uDF46-\uDF50\uDF55-\uDF59]|\uD804[\uDC01\uDC38-\uDC4D\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9-\uDCBC\uDCBE-\uDCC1\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD40-\uDD43\uDD73-\uDD75\uDD80\uDD81\uDDB6-\uDDBE\uDDC5-\uDDCD\uDDCF\uDDDB\uDDDD-\uDDDF\uDE2F-\uDE31\uDE34\uDE36-\uDE3E\uDEA9\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDC5E\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDCC6\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF-\uDDD7\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F-\uDE43\uDE60-\uDE6C\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B\uDF3C-\uDF3E]|\uD806[\uDC2F-\uDC37\uDC39-\uDC3B\uDD3B\uDD3C\uDD3E\uDD43-\uDD46\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDDE2\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC41-\uDC45\uDC70\uDC71\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF0-\uDEF5\uDF30-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDF4F\uDF8F-\uDF92\uDFE2\uDFE4]|\uD82F[\uDC9D-\uDC9F]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE87-\uDE8B\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A\uDD5E\uDD5F]|\uDB40[\uDD00-\uDDEF])*(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])(?:[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABF\u1AC0\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])*(?:[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?:[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDFFF]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F])(?:[\u0300-\u036F\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABF\u1AC0\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDF46-\uDF50]|\uD804[\uDC01\uDC38-\uDC46\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF40\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB3-\uDCB8\uDCBA\uDCBF\uDCC0\uDCC2\uDCC3\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD67-\uDD69\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])*)*/,jt={};function It(o){return JSON.parse(o)}function Ct(o){var r=o.match(/^([^#]*)/);return r?r[1]:o}var bt=window.location.href;function Ut(o){bt=o}var U,Bt=window.location.href;function De(o){Bt=o}function wt(o,r){if(/^data:/i.test(r))return o||r;if(!r||o.match(/^\w{2,}:/))return o.toLowerCase().match("^javascript:")?"#":(o.match(/^\w{2,}:\/\/[^\/]+$/)&&(o+="/"),o);var e;if(r.match(/^\w{2,}:\/\/[^\/]+$/)&&(r+="/"),o.match(/^\/\//))return(e=r.match(/^(\w{2,}:)\/\//))?e[1]+o:o;if(o.match(/^\//))return(e=r.match(/^(\w{2,}:\/\/[^\/]+)\//))?e[1]+o:o;if(o.match(/^\.(\/|$)/)&&(o=o.substr(2)),r=function(s){var u=s.match(/^([^#?]*)/);return u?u[1]:s}(r),o.match(/^#/))return r+o;var t=r.lastIndexOf("/");if(t<0)return o;if(t<r.length-1&&r.lastIndexOf(".")<t){if(o=="")return r;t=(r+="/").length-1}var n=r.substr(0,t+1)+o,i="";for((e=n.match(/^([^?#]*)([?#].*)$/))&&(n=e[1],i=e[2]);!((t=n.indexOf("/../"))<=0);){var a=n.lastIndexOf("/",t-1);if(a<=0)break;n=n.substr(0,a)+n.substr(t+3)}return n.replace(/\/(\.\/)+/g,"/")+i}function ei(o){var r;return(r=/^(https?:)\/\/github\.com\/([^/]+\/[^/]+)\/(blob\/|tree\/|raw\/)?(.*)$/.exec(o))?o=r[1]+"//raw.githubusercontent.com/"+r[2]+"/"+(r[3]?"":"master/")+r[4]:(r=/^(https?:)\/\/www\.aozora\.gr\.jp\/(cards\/[^/]+\/files\/[^/.]+\.html)$/.exec(o))?o=r[1]+"//raw.githubusercontent.com/aozorabunko/aozorabunko/master/"+r[2]:(r=/^(https?:)\/\/gist\.github\.com\/([^/]+\/\w+)(\/|$)(raw(\/|$))?(.*)$/.exec(o))?o=r[1]+"//gist.githubusercontent.com/"+r[2]+"/raw/"+r[6]:(r=/^(https?:)\/\/(?:[^/.]+\.)?jsbin\.com\/(?!(?:blog|help)\b)(\w+)((\/\d+)?).*$/.exec(o))&&(o=r[1]+"//output.jsbin.com/"+r[2]+r[3]+"/"),o}function fa(o){return o==null?o:o.toString()}(function(o){o.epub="http://www.idpf.org/2007/ops",o.EV="http://www.w3.org/2001/xml-events",o.MATHML="http://www.w3.org/1998/Math/MathML",o.XML="http://www.w3.org/XML/1998/namespace",o.XHTML="http://www.w3.org/1999/xhtml",o.XLINK="http://www.w3.org/1999/xlink",o.SHADOW="http://www.pyroxy.com/ns/shadow",o.SVG="http://www.w3.org/2000/svg",o.DC="http://purl.org/dc/elements/1.1/",o.NCX="http://www.daisy.org/z3986/2005/ncx/"})(U||(U={}));var Bl=function(){function o(){this.queue=[null]}var r=o.prototype;return r.length=function(){return this.queue.length-1},r.add=function(e){for(var t=this.queue.length;t>1;){var n=Math.floor(t/2),i=this.queue[n];if(i.compare(e)>0)return void(this.queue[t]=e);this.queue[t]=i,t=n}this.queue[1]=e},r.peek=function(){return this.queue[1]},r.remove=function(){var e=this.queue[1],t=this.queue.pop(),n=this.queue.length;if(n>1){for(var i=1;;){var a=2*i;if(a>=n)break;if(this.queue[a].compare(t)>0)a+1<n&&this.queue[a+1].compare(this.queue[a])>0&&a++;else{if(!(a+1<n&&this.queue[a+1].compare(t)>0))break;a++}this.queue[i]=this.queue[a],i=a}this.queue[i]=t}return e},o}(),_l=["","-webkit-","-moz-","-ms-","-o-","-epub-"],ze={};function Ze(o,r){if(r==="writing-mode"){var e=document.createElement("span");return o==="-ms-"?(e.style.setProperty(o+r,"tb-rl"),e.style["writing-mode"]==="tb-rl"):(e.style.setProperty(o+r,"vertical-rl"),e.style[o+r]==="vertical-rl")}return typeof document.documentElement.style[function(t,n){return t&&(n="-"+n,(t=t.replace(/-/g,""))==="moz"&&(t="Moz")),t+n.replace(/-[a-z]/g,function(i){return i.substr(1).toUpperCase()})}(o,r)]=="string"}function pa(o){var r=ze[o];if(r||r===null)return r;switch(o){case"text-combine-upright":if(Ze("-webkit-","text-combine")&&!Ze("","text-combine-upright"))return ze[o]=["-webkit-text-combine"],["-webkit-text-combine"];break;case"writing-mode":if(Ze("-ms-","writing-mode"))return ze[o]=["-ms-writing-mode"],["-ms-writing-mode"];break;case"filter":if(Ze("-webkit-","filter"))return ze[o]=["-webkit-filter"],["-webkit-filter"];break;case"clip-path":if(Ze("-webkit-","clip-path"))return ze[o]=["-webkit-clip-path","clip-path"];break;case"margin-inline-start":if(Ze("-webkit-","margin-start"))return ze[o]=["-webkit-margin-start"],["-webkit-margin-start"];break;case"margin-inline-end":if(Ze("-webkit-","margin-end"))return ze[o]=["-webkit-margin-end"],["-webkit-margin-end"];break;case"padding-inline-start":if(Ze("-webkit-","padding-start"))return ze[o]=["-webkit-padding-start"],["-webkit-padding-start"];break;case"padding-inline-end":if(Ze("-webkit-","padding-end"))return ze[o]=["-webkit-padding-end"],["-webkit-padding-end"]}for(var e,t=B(_l);!(e=t()).done;){var n=e.value;if(Ze(n,o))return ze[o]=[r=n+o],[r]}return M.warn("Property not supported by the browser: ",o),ze[o]=null,null}function T(o,r,e){try{var t=pa(r);if(!t)return;t.forEach(function(n){if(n==="-ms-writing-mode")switch(e){case"horizontal-tb":e="lr-tb";break;case"vertical-rl":e="tb-rl";break;case"vertical-lr":e="tb-lr"}else if(n==="-webkit-text-combine")switch(e){case"all":e="horizontal"}o&&o.style&&o.style.setProperty(n,e)})}catch(n){M.warn(n)}}function Bn(o,r,e){try{var t=ze[r];return o.style.getPropertyValue(t?t[0]:r)}catch(n){}return e||""}function xr(o){var r=o.getAttributeNS(U.XML,"lang");return r||o.namespaceURI!=U.XHTML||(r=o.getAttribute("lang")),r}var Re=function(){function o(){this.list=[]}var r=o.prototype;return r.append=function(e){return this.list.push(e),this},r.clear=function(){this.list=[]},r.toString=function(){var e=this.list.join("");return this.list=[e],e},o}();function ga(o){return"\\"+o.charCodeAt(0).toString(16)+" "}function ln(o){return o.replace(/[^-_a-zA-Z0-9\u0080-\uFFFF]/g,ga)}function ni(o){return o.replace(/[\u0000-\u001F"\\]/g,ga)}function va(o){return o.replace(/[\s+&?=#\u007F-\uFFFF]+/g,encodeURIComponent)}function ma(o){return!!o.match(/^[a-zA-Z\u009E\u009F\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u024F\u037B-\u037D\u0386\u0388-\u0482\u048A-\u0527]$/)}function Ea(o,r){return o.replace(/[^-a-zA-Z0-9_]/g,function(e){return function(t,n){return(n=typeof n=="string"?n:"\\u")+(65536|t.charCodeAt(0)).toString(16).substr(1)}(e,r)})}function hn(o){return Ea(o)}function cn(o,r){for(var e=0,t=o;;){if(e==0||r(e-1),t==o||r(t),e==t)return e;var n=e+t>>1;r(n)?t=n:e=n+1}}function Ca(o,r){return o-r}function Da(o,r){for(var e,t={},n=B(o);!(e=n()).done;){var i=e.value,a=r(i);a&&!t[a]&&(t[a]=i)}return t}function Ir(o,r){for(var e,t={},n=B(o);!(e=n()).done;){var i=e.value,a=r(i);a&&(t[a]?t[a].push(i):t[a]=[i])}return t}var Fr=function(){function o(){this.listeners={}}var r=o.prototype;return r.dispatchEvent=function(e){var t=this.listeners[e.type];if(t){e.target=this,e.currentTarget=this;for(var n=0;n<t.length;n++)t[n](e)}},r.addEventListener=function(e,t,n){if(!n){var i=this.listeners[e];i?i.push(t):this.listeners[e]=[t]}},r.removeEventListener=function(e,t,n){if(!n){var i=this.listeners[e];if(i){var a=i.indexOf(t);a>=0&&i.splice(a,1)}}},o}(),Pr=null,Rr=null,Or=null,kr=null;function wa(o){if(o.nodeType==1){var r=o.getAttribute("id");if(r)return r}return null}function Ml(o){return"^"+o}function ya(o){return o.replace(/[\[\]\(\),=;^]/g,Ml)}function Ul(o){return o.substr(1)}function Lr(o){return o&&o.replace(/\^[\[\]\(\),=;^]/g,Ul)}function Vl(o){var r=[];do{var e=o.match(/^(\^,|[^,])*/),t=Lr(e[0]);if(!(o=o.substr(e[0].length+1))&&!r.length)return t;r.push(t)}while(o);return r}function Na(o){for(var r={};o;){var e=o.match(/^;([^;=]+)=(([^;]|\^;)*)/);if(!e)return r;r[e[1]]=Vl(e[2]),o=o.substr(e[0].length)}return r}var ba=function(){function o(){}var r=o.prototype;return r.appendTo=function(e){e.append("!")},r.applyTo=function(e){return!1},o}(),Sa=function(){function o(e,t,n){this.index=void 0,this.id=void 0,this.sideBias=void 0,this.index=e,this.id=t,this.sideBias=n}var r=o.prototype;return r.appendTo=function(e){e.append("/"),e.append(this.index.toString()),(this.id||this.sideBias)&&(e.append("["),this.id&&e.append(this.id),this.sideBias&&(e.append(";s="),e.append(this.sideBias)),e.append("]"))},r.applyTo=function(e){if(e.node.nodeType!=1)throw new Error("E_CFI_NOT_ELEMENT");var t,n=e.node,i=n.children,a=i.length,s=Math.floor(this.index/2)-1;if(s<0||a==0)e.node=(t=n.firstChild)||n;else{if(t=i[Math.min(s,a-1)],1&this.index){var u=t.nextSibling;u&&u.nodeType!=1?t=u:e.after=!0}e.node=t}if(this.id&&(e.after||this.id!=wa(e.node)))throw new Error("E_CFI_ID_MISMATCH");return e.sideBias=this.sideBias,!0},o}(),Aa=function(){function o(e,t,n,i){this.offset=void 0,this.textBefore=void 0,this.textAfter=void 0,this.sideBias=void 0,this.offset=e,this.textBefore=t,this.textAfter=n,this.sideBias=i}var r=o.prototype;return r.applyTo=function(e){if(this.offset>0&&!e.after){for(var t=this.offset,n=e.node;;){var i=n.nodeType;if(i==1)break;var a=n.nextSibling;if(3<=i&&i<=5){var s=n.textContent.length;if(t<=s)break;if(!a){t=s;break}t-=s}if(!a){t=0;break}n=a}e.node=n,e.offset=t}return e.sideBias=this.sideBias,!0},r.appendTo=function(e){e.append(":"),e.append(this.offset.toString()),(this.textBefore||this.textAfter||this.sideBias)&&(e.append("["),(this.textBefore||this.textAfter)&&(this.textBefore&&e.append(ya(this.textBefore)),e.append(","),this.textAfter&&e.append(ya(this.textAfter))),this.sideBias&&(e.append(";s="),e.append(this.sideBias)),e.append("]"))},o}(),Ta=function(){function o(){this.steps=null}var r=o.prototype;return r.fromString=function(e){var t=e.match(/^#?epubcfi\((.*)\)$/);if(!t)throw new Error("E_CFI_NOT_CFI");for(var n=decodeURIComponent(t[1]),i=0,a=[];;){var s=void 0;switch(n.charAt(i)){case"/":if(i++,!(t=n.substr(i).match(/^(0|[1-9][0-9]*)(\[(.*?)(;([^\]]|\^\])*)?\])?/)))throw new Error("E_CFI_NUMBER_EXPECTED");i+=t[0].length;var u=parseInt(t[1],10),h=t[3];s=Na(t[4]),a.push(new Sa(u,h,fa(s.s)));break;case":":if(i++,!(t=n.substr(i).match(/^(0|[1-9][0-9]*)(\[((([^\];,]|\^[\];,])*)(,(([^\];,]|\^[\];,])*))?)(;([^]]|\^\])*)?\])?/)))throw new Error("E_CFI_NUMBER_EXPECTED");i+=t[0].length;var c=parseInt(t[1],10),d=t[4];d&&(d=Lr(d));var f=t[7];f&&(f=Lr(f)),s=Na(t[10]),a.push(new Aa(c,d,f,fa(s.s)));break;case"!":i++,a.push(new ba);break;case"~":case"@":case"":return void(this.steps=a);default:throw new Error("E_CFI_PARSE_ERROR")}}},r.navigate=function(e){for(var t={node:e.documentElement,offset:0,after:!1,sideBias:null,ref:null},n=0;n<this.steps.length;n++)if(!this.steps[n].applyTo(t)){t.ref=new o,t.ref.steps=this.steps.slice(n+1);break}return t},r.trim=function(e,t){return e.replace(/\s+/g," ").match(t?/^[ -\uD7FF\uE000-\uFFFF]{0,8}/:/[ -\uD7FF\uE000-\uFFFF]{0,8}$/)[0].replace(/^\s/,"").replace(/\s$/,"")},r.prependPathFromNode=function(e,t,n,i){for(var a=[],s=e.parentNode,u="",h="";e;){switch(e.nodeType){case 3:case 4:case 5:var c=e.textContent,d=c.length;n?(t+=d,u||(u=c)):(t>d&&(t=d),n=!0,u=c.substr(0,t),h=c.substr(t)),e=e.previousSibling;continue;case 8:e=e.previousSibling;continue}break}for((t>0||u||h)&&(u=this.trim(u,!1),h=this.trim(h,!0),a.push(new Aa(t,u,h,i)),i=null);s&&s&&s.nodeType!=9;){for(var f=n?null:wa(e),v=n?1:0;e;)e.nodeType==1&&(v+=2),e=e.previousSibling;a.push(new Sa(v,f,i)),i=null,e=s,s=s.parentNode,n=!1}a.reverse(),this.steps?(a.push(new ba),this.steps=a.concat(this.steps)):this.steps=a},r.toString=function(){if(!this.steps)return"";var e=new Re;e.append("epubcfi(");for(var t=0;t<this.steps.length;t++)this.steps[t].appendTo(e);return e.append(")"),e.toString().replace(/%/g,"%25")},o}();function xa(o){return{fontFamily:o.fontFamily,lineHeight:o.lineHeight,margin:o.margin,hyphenate:o.hyphenate,columnWidth:o.columnWidth,horizontal:o.horizontal,nightMode:o.nightMode,spreadView:o.spreadView,pageBorder:o.pageBorder,enabledMediaTypes:Object.assign({},o.enabledMediaTypes),defaultPaperSize:o.defaultPaperSize?Object.assign({},o.defaultPaperSize):void 0}}var Hl={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},Ia={};function Fa(o,r,e,t){var n=Math.min((o-0)/e,(r-0)/t);return"matrix("+n+",0,0,"+n+",0,0)"}function Br(o){return'"'+ni(""+o)+'"'}function zl(o){return ln(""+o)}function _r(o,r){return o?ln(o)+"."+ln(r):ln(r)}var Pa=0,Mr=function(){function o(e,t){if(this.parent=void 0,this.resolver=void 0,this.scopeKey=void 0,this.children=[],this.zero=void 0,this.one=void 0,this._true=void 0,this._false=void 0,this.values={},this.funcs={},this.builtIns={},this.parent=e,this.resolver=t,this.scopeKey="S"+Pa++,this.zero=new re(this,0),this.one=new re(this,1),this._true=new re(this,!0),this._false=new re(this,!1),e&&e.children.push(this),!e){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=Fa,n["css-string"]=Br,n["css-name"]=zl,n.typeof=function(i){return typeof i},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 Br(this.pubTitle?this.pubTitle:"")}),this.defineBuiltInName("doc-title",function(){return Br(this.docTitle?this.docTitle:"")})}}var r=o.prototype;return r.defineBuiltInName=function(e,t){this.values[e]=new Oe(this,t,e)},r.defineName=function(e,t){this.values[e]=t},r.defineFunc=function(e,t){this.funcs[e]=t},r.defineBuiltIn=function(e,t){this.builtIns[e]=t},o}();function Ra(o){switch(o.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 me={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 Oa(o){switch(o){case"q":case"rem":return!0;default:return!1}}var Ur=function(){function o(e,t,n,i){this.rootScope=void 0,this.viewportWidth=void 0,this.viewportHeight=void 0,this.actualPageWidth=null,this.pageWidth=void 0,this.actualPageHeight=null,this.pageHeight=void 0,this.initialFontSize=void 0,this.rootFontSize=null,this.fontSize=void 0,this.pref=void 0,this.scopes={},this.pageAreaWidth=null,this.pageAreaHeight=null,this.pageVertical=null,this.pubTitle=null,this.docTitle=null,this.rootScope=e,this.viewportWidth=t,this.viewportHeight=n,this.pageWidth=function(){return this.actualPageWidth?this.actualPageWidth:this.pref.spreadView?Math.floor(t/2)-this.pref.pageBorder:t},this.pageHeight=function(){return this.actualPageHeight?this.actualPageHeight:n},this.initialFontSize=i,this.fontSize=function(){return this.rootFontSize?this.rootFontSize:i},this.pref=Hl}var r=o.prototype;return r.getScopeContext=function(e){var t=this.scopes[e.scopeKey];return t||(this.scopes[e.scopeKey]=t={}),t},r.clearScope=function(e){this.scopes[e.scopeKey]={};for(var t=0;t<e.children.length;t++)this.clearScope(e.children[t])},r.queryUnitSize=function(e,t){if(Ra(e)){var n=this.pageWidth()/100,i=this.pageHeight()/100,a=this.pageAreaWidth!=null?this.pageAreaWidth/100:n,s=this.pageAreaHeight!=null?this.pageAreaHeight/100:i;switch(e){case"vw":return a;case"vh":return s;case"vi":return this.pageVertical?s:a;case"vb":return this.pageVertical?a:s;case"vmin":return a<s?a:s;case"vmax":return a>s?a:s;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 e=="em"||e=="rem"?t?this.initialFontSize:this.fontSize():e=="ex"?me.ex*(t?this.initialFontSize:this.fontSize())/me.em:me[e]},r.evalName=function(e,t){do{var n=e.values[t];if(n||e.resolver&&(n=e.resolver.call(this,t,!1)))return n;e=e.parent}while(e);throw new Error("Name '"+t+"' is undefined")},r.evalCall=function(e,t,n,i){do{var a=e.funcs[t];if(a||e.resolver&&(a=e.resolver.call(this,t,!0)))return a;var s=e.builtIns[t];if(s){if(i)return e.zero;for(var u=Array(n.length),h=0;h<n.length;h++)u[h]=n[h].evaluate(this);return new re(e,s.apply(this,u))}e=e.parent}while(e);throw new Error("Function '"+t+"' is undefined")},r.evalMediaName=function(e,t){var n=e==="all"||!!this.pref.enabledMediaTypes[e];return t?!n:n},r.evalMediaTest=function(e,t){var n="",i=e.match(/^(min|max)-(.*)$/);i&&(n=i[1],e=i[2]);var a=null,s=null;switch(e){case"width":case"height":case"device-width":case"device-height":case"color":t&&(a=t.evaluate(this))}switch(e){case"width":s=this.pageWidth();break;case"height":s=this.pageHeight();break;case"device-width":s=window.screen.availWidth;break;case"device-height":s=window.screen.availHeight;break;case"color":s=window.screen.pixelDepth}if(s!=null&&a!=null)switch(n){case"min":return s>=a;case"max":return s<=a;default:return s==a}else if(s!=null&&t==null)return s!==0;return!1},r.evalSupportsTest=function(e,t,n){return!1},r.queryVal=function(e,t){var n=this.scopes[e.scopeKey];return n?n[t]:void 0},r.storeVal=function(e,t,n){this.getScopeContext(e)[t]=n},o}(),Ge=function(){function o(e){this.scope=void 0,this.key=void 0,this.scope=e,this.scope=e,this.key="_"+Pa++}var r=o.prototype;return r.toString=function(){var e=new Re;return this.appendTo(e,0),e.toString()},r.appendTo=function(e,t){throw new Error("F_ABSTRACT")},r.evaluateCore=function(e){throw new Error("F_ABSTRACT")},r.expand=function(e,t){return this},r.dependCore=function(e,t,n){return e===this},r.dependOuter=function(e,t,n){var i=n[this.key];if(i!=null)return i!==Ia&&i;n[this.key]=Ia;var a=this.dependCore(e,t,n);return n[this.key]=a,a},r.depend=function(e,t){return this.dependOuter(e,t,{})},r.evaluate=function(e){var t=e.queryVal(this.scope,this.key);return t!==void 0||(t=this.evaluateCore(e),e.storeVal(this.scope,this.key,t)),t},r.isMediaName=function(){return!1},o}(),ka=function(o){function r(t,n){var i;return(i=o.call(this,t)||this).val=void 0,i.val=n,i}w(r,o);var e=r.prototype;return e.getOp=function(){throw new Error("F_ABSTRACT")},e.evalPrefix=function(t){throw new Error("F_ABSTRACT")},e.evaluateCore=function(t){var n=this.val.evaluate(t);return this.evalPrefix(n)},e.dependCore=function(t,n,i){return t===this||this.val.dependOuter(t,n,i)},e.appendTo=function(t,n){10<n&&t.append("("),t.append(this.getOp()),this.val.appendTo(t,10),10<n&&t.append(")")},e.expand=function(t,n){var i=this.val.expand(t,n);return i===this.val?this:new this.constructor(this.scope,i)},r}(Ge),Li=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).lhs=void 0,a.rhs=void 0,a.lhs=n,a.rhs=i,a}w(r,o);var e=r.prototype;return e.getPriority=function(){throw new Error("F_ABSTRACT")},e.getOp=function(){throw new Error("F_ABSTRACT")},e.evalInfix=function(t,n){throw new Error("F_ABSTRACT")},e.evaluateCore=function(t){var n=this.lhs.evaluate(t),i=this.rhs.evaluate(t);return this.evalInfix(n,i)},e.dependCore=function(t,n,i){return t===this||this.lhs.dependOuter(t,n,i)||this.rhs.dependOuter(t,n,i)},e.appendTo=function(t,n){var i=this.getPriority();i<=n&&t.append("("),this.lhs.appendTo(t,i),t.append(this.getOp()),this.rhs.appendTo(t,i),i<=n&&t.append(")")},e.expand=function(t,n){var i=this.lhs.expand(t,n),a=this.rhs.expand(t,n);return i===this.lhs&&a===this.rhs?this:new this.constructor(this.scope,i,a)},r}(Ge),La=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getPriority=function(){return 1},r}(Li),_n=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getPriority=function(){return 2},r}(Li),Ba=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getPriority=function(){return 3},r}(Li),Vr=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getPriority=function(){return 4},r}(Li),dn=function(o){function r(t,n){return o.call(this,t,n)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"!"},e.evalPrefix=function(t){return!t},r}(ka),Gl=function(o){function r(e,t){return o.call(this,e,t)||this}return w(r,o),r.prototype.getOp=function(){return"not "},r}(dn),_a=function(o){function r(t,n){return o.call(this,t,n)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"-"},e.evalPrefix=function(t){return-t},r}(ka),Hr=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"&&"},e.evaluateCore=function(t){return this.lhs.evaluate(t)&&this.rhs.evaluate(t)},r}(La),Wl=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getOp=function(){return" and "},r}(Hr),zr=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"||"},e.evaluateCore=function(t){return this.lhs.evaluate(t)||this.rhs.evaluate(t)},r}(La),Xl=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getOp=function(){return", "},r}(zr),jl=function(o){function r(e,t,n){return o.call(this,e,t,n)||this}return w(r,o),r.prototype.getOp=function(){return" or "},r}(zr),Yl=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"<"},e.evalInfix=function(t,n){return t<n},r}(_n),Kl=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"<="},e.evalInfix=function(t,n){return t<=n},r}(_n),ql=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return">"},e.evalInfix=function(t,n){return t>n},r}(_n),Gr=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return">="},e.evalInfix=function(t,n){return t>=n},r}(_n),Wr=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"=="},e.evalInfix=function(t,n){return t==n},r}(_n),Ql=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"!="},e.evalInfix=function(t,n){return t!=n},r}(_n),Ma=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"+"},e.evalInfix=function(t,n){return t+n},r}(Ba),Ua=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return" - "},e.evalInfix=function(t,n){return t-n},r}(Ba),Xr=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"*"},e.evalInfix=function(t,n){return t*n},r}(Vr),Va=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"/"},e.evalInfix=function(t,n){return t/n},r}(Vr),Ha=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.getOp=function(){return"%"},e.evalInfix=function(t,n){return t%n},r}(Vr),Mn=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).num=void 0,a.unit=void 0,a.num=n,a.unit=i.toLowerCase(),a}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append(this.num.toString()),t.append(ln(this.unit))},e.evaluateCore=function(t){return this.num*t.queryUnitSize(this.unit,!1)},r}(Ge),ie=function(o){function r(t,n){var i;return(i=o.call(this,t)||this).qualifiedName=void 0,i.qualifiedName=n,i}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append(this.qualifiedName)},e.evaluateCore=function(t){return t.evalName(this.scope,this.qualifiedName).evaluate(t)},e.dependCore=function(t,n,i){return t===this||n.evalName(this.scope,this.qualifiedName).dependOuter(t,n,i)},r}(Ge),za=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).not=void 0,a.name=void 0,a.not=n,a.name=i,a}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){this.not&&t.append("not "),t.append(ln(this.name))},e.evaluateCore=function(t){return t.evalMediaName(this.name,this.not)},e.isMediaName=function(){return!0},r}(Ge),Oe=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).fn=void 0,a.str=void 0,a.fn=n,a.str=i,a}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append(this.str)},e.evaluateCore=function(t){return this.fn.call(t)},r}(Ge),ii=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).qualifiedName=void 0,a.params=void 0,a.qualifiedName=n,a.params=i,a}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append(this.qualifiedName),function(i,a){i.append("(");for(var s=0;s<a.length;s++)s&&i.append(","),a[s].appendTo(i,0);i.append(")")}(t,this.params)},e.evaluateCore=function(t){return t.evalCall(this.scope,this.qualifiedName,this.params,!1).expand(t,this.params).evaluate(t)},e.dependCore=function(t,n,i){if(t===this)return!0;for(var a=0;a<this.params.length;a++)if(this.params[a].dependOuter(t,n,i))return!0;return n.evalCall(this.scope,this.qualifiedName,this.params,!0).dependOuter(t,n,i)},e.expand=function(t,n){var i=function(a,s,u){for(var h=s,c=0;c<s.length;c++){var d=s[c].expand(a,u);if(s!==h)h[c]=d;else if(d!==s[c]){h=Array(s.length);for(var f=0;f<c;f++)h[f]=s[f];h[c]=d}}return h}(t,this.params,n);return i===this.params?this:new r(this.scope,this.qualifiedName,i)},r}(Ge),Zl=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t)||this).cond=void 0,s.ifTrue=void 0,s.ifFalse=void 0,s.cond=n,s.ifTrue=i,s.ifFalse=a,s}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){n>0&&t.append("("),this.cond.appendTo(t,0),t.append("?"),this.ifTrue.appendTo(t,0),t.append(":"),this.ifFalse.appendTo(t,0),n>0&&t.append(")")},e.evaluateCore=function(t){return this.cond.evaluate(t)?this.ifTrue.evaluate(t):this.ifFalse.evaluate(t)},e.dependCore=function(t,n,i){return t===this||this.cond.dependOuter(t,n,i)||this.ifTrue.dependOuter(t,n,i)||this.ifFalse.dependOuter(t,n,i)},e.expand=function(t,n){var i=this.cond.expand(t,n),a=this.ifTrue.expand(t,n),s=this.ifFalse.expand(t,n);return i===this.cond&&a===this.ifTrue&&s===this.ifFalse?this:new r(this.scope,i,a,s)},r}(Ge),re=function(o){function r(t,n){var i;return(i=o.call(this,t)||this).val=void 0,i.val=n,i}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){switch(typeof this.val){case"number":case"boolean":t.append(this.val.toString());break;case"string":t.append('"'),t.append(ni(this.val)),t.append('"');break;default:throw new Error("F_UNEXPECTED_STATE")}},e.evaluateCore=function(t){return this.val},r}(Ge),Ga=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).name=void 0,a.value=void 0,a.name=n,a.value=i,a}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append("("),t.append(ni(this.name.name)),t.append(":"),this.value.appendTo(t,0),t.append(")")},e.evaluateCore=function(t){return t.evalMediaTest(this.name.name,this.value)},e.dependCore=function(t,n,i){return t===this||this.value.dependOuter(t,n,i)},e.expand=function(t,n){var i=this.value.expand(t,n);return i===this.value?this:new r(this.scope,this.name,i)},r}(Ge),$l=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t)||this).name=void 0,s.value=void 0,s.isFunc=void 0,s.name=n,s.value=i,s.isFunc=a,s}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){this.isFunc&&t.append(this.name),t.append("("),!this.isFunc&&this.name&&(t.append(this.name),t.append(":")),t.append(this.value),t.append(")")},e.evaluateCore=function(t){return t.evalSupportsTest(this.name,this.value,this.isFunc)},r}(Ge),Wa=function(o){function r(t,n){var i;return(i=o.call(this,t)||this).index=void 0,i.index=n,i}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append("$"),t.append(this.index.toString())},e.expand=function(t,n){var i=n[this.index];if(!i)throw new Error("Parameter missing: "+this.index);return i},r}(Ge);function We(o,r,e){return r===o._false||r===o.zero||e==o._false||e==o.zero?o._false:r===o._true||r===o.one?e:e===o._true||e===o.one?r:new Hr(o,r,e)}function ut(o,r,e){return r===o.zero?e:e===o.zero?r:new Ma(o,r,e)}function Ft(o,r,e){return r===o.zero?new _a(o,e):e===o.zero?r:new Ua(o,r,e)}function Bi(o,r,e){return r===o.zero||e===o.zero?o.zero:r===o.one?e:e===o.one?r:new Xr(o,r,e)}function jr(o,r,e){return r===o.zero?o.zero:e===o.one?r:new Va(o,r,e)}var fn=function(){function o(){}var r=o.prototype;return r.visitValues=function(e){for(var t=0;t<e.length;t++)e[t].visit(this)},r.visitEmpty=function(e){throw new Error("E_CSS_EMPTY_NOT_ALLOWED")},r.visitSlash=function(e){throw new Error("E_CSS_SLASH_NOT_ALLOWED")},r.visitStr=function(e){throw new Error("E_CSS_STR_NOT_ALLOWED")},r.visitIdent=function(e){throw new Error("E_CSS_IDENT_NOT_ALLOWED")},r.visitNumeric=function(e){throw new Error("E_CSS_NUMERIC_NOT_ALLOWED")},r.visitNum=function(e){throw new Error("E_CSS_NUM_NOT_ALLOWED")},r.visitInt=function(e){return this.visitNum(e)},r.visitColor=function(e){throw new Error("E_CSS_COLOR_NOT_ALLOWED")},r.visitURL=function(e){throw new Error("E_CSS_URL_NOT_ALLOWED")},r.visitSpaceList=function(e){throw new Error("E_CSS_LIST_NOT_ALLOWED")},r.visitCommaList=function(e){throw new Error("E_CSS_COMMA_NOT_ALLOWED")},r.visitFunc=function(e){throw new Error("E_CSS_FUNC_NOT_ALLOWED")},r.visitExpr=function(e){throw new Error("E_CSS_EXPR_NOT_ALLOWED")},o}(),_i=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.visitValues=function(t){for(var n=null,i=0;i<t.length;i++){var a=t[i],s=a.visit(this);if(n)n[i]=s;else if(a!==s){n=new Array(t.length);for(var u=0;u<i;u++)n[u]=t[u];n[i]=s}}return n||t},e.visitStr=function(t){return t},e.visitIdent=function(t){return t},e.visitSlash=function(t){return t},e.visitNumeric=function(t){return t},e.visitNum=function(t){return t},e.visitInt=function(t){return t},e.visitColor=function(t){return t},e.visitURL=function(t){return t},e.visitSpaceList=function(t){var n=this.visitValues(t.values);return n===t.values?t:new fe(n)},e.visitCommaList=function(t){var n=this.visitValues(t.values);return n===t.values?t:new Te(n)},e.visitFunc=function(t){var n=this.visitValues(t.values);return n===t.values?t:new qr(t.name,n)},e.visitExpr=function(t){return t},r}(fn),Xe=function(){function o(){}var r=o.prototype;return r.toString=function(){var e=new Re;return this.appendTo(e,!0),e.toString()},r.stringValue=function(){var e=new Re;return this.appendTo(e,!1),e.toString()},r.toExpr=function(e,t){throw new Error("F_ABSTRACT")},r.appendTo=function(e,t){e.append("[error]")},r.isExpr=function(){return!1},r.isNumeric=function(){return!1},r.isNum=function(){return!1},r.isIdent=function(){return!1},r.isSpaceList=function(){return!1},r.visit=function(e){throw new Error("F_ABSTRACT")},o}(),Xa=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.toExpr=function(t,n){return new re(t,"")},e.appendTo=function(t,n){},e.visit=function(t){return t.visitEmpty(this)},V(r,null,[{key:"instance",get:function(){return this.empty||(this.empty=new r),this.empty}}]),r}(Xe);Xa.empty=void 0;var ht=Xa.instance,ja=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.toExpr=function(t,n){return new re(t,"/")},e.appendTo=function(t,n){t.append("/")},e.visit=function(t){return t.visitSlash(this)},V(r,null,[{key:"instance",get:function(){return this.slash||(this.slash=new r),this.slash}}]),r}(Xe);ja.slash=void 0;var Mi=ja.instance,Ae=function(o){function r(t){var n;return(n=o.call(this)||this).str=void 0,n.str=t,n}w(r,o);var e=r.prototype;return e.toExpr=function(t,n){return new re(t,this.str)},e.appendTo=function(t,n){n?(t.append('"'),t.append(ni(this.str)),t.append('"')):t.append(this.str)},e.visit=function(t){return t.visitStr(this)},r}(Xe),Yr={},Ui=function(o){function r(t){var n;if((n=o.call(this)||this).name=void 0,n.name=t,Yr[t])throw new Error("E_INVALID_CALL");return Yr[t]=xt(n),n}w(r,o);var e=r.prototype;return e.toExpr=function(t,n){return new re(t,this.name)},e.appendTo=function(t,n){t.append(n?ln(this.name):this.name)},e.visit=function(t){return t.visitIdent(this)},e.isIdent=function(){return!0},r}(Xe);function _(o){var r=Yr[o];return r||(r=new Ui(o)),r}var O=function(o){function r(t,n){var i;return(i=o.call(this)||this).num=void 0,i.unit=void 0,i.num=t,i.unit=n.toLowerCase(),i}w(r,o);var e=r.prototype;return e.toExpr=function(t,n){return this.num==0?t.zero:n&&this.unit=="%"?this.num==100?n:new Xr(t,n,new re(t,this.num/100)):new Mn(t,this.num,this.unit)},e.appendTo=function(t,n){t.append(this.num.toString()),t.append(this.unit)},e.visit=function(t){return t.visitNumeric(this)},e.isNumeric=function(){return!0},r}(Xe),ri=function(o){function r(t){var n;return(n=o.call(this)||this).num=void 0,n.num=t,n}w(r,o);var e=r.prototype;return e.toExpr=function(t,n){return this.num==0?t.zero:this.num==1?t.one:new re(t,this.num)},e.appendTo=function(t,n){t.append(this.num.toString())},e.visit=function(t){return t.visitNum(this)},e.isNum=function(){return!0},r}(Xe),xn=function(o){function r(e){return o.call(this,e)||this}return w(r,o),r.prototype.visit=function(e){return e.visitInt(this)},r}(ri),Ya=function(o){function r(t){var n;return(n=o.call(this)||this).rgb=void 0,n.rgb=t,n}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append("#");var i=this.rgb.toString(16);t.append("000000".substr(i.length)),t.append(i)},e.visit=function(t){return t.visitColor(this)},r}(Xe),pn=function(o){function r(t){var n;return(n=o.call(this)||this).url=void 0,n.url=t,n}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append('url("'),t.append(ni(this.url)),t.append('")')},e.visit=function(t){return t.visitURL(this)},r}(Xe);function Kr(o,r,e,t){var n=r.length;if(n>0){r[0].appendTo(o,t);for(var i=1;i<n;i++)o.append(e),r[i].appendTo(o,t)}}var fe=function(o){function r(t){var n;return(n=o.call(this)||this).values=void 0,n.values=t,n}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){Kr(t,this.values," ",n)},e.visit=function(t){return t.visitSpaceList(this)},e.isSpaceList=function(){return!0},r}(Xe),Te=function(o){function r(t){var n;return(n=o.call(this)||this).values=void 0,n.values=t,n}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){Kr(t,this.values,",",n)},e.visit=function(t){return t.visitCommaList(this)},r}(Xe),qr=function(o){function r(t,n){var i;return(i=o.call(this)||this).name=void 0,i.values=void 0,i.name=t,i.values=n,i}w(r,o);var e=r.prototype;return e.appendTo=function(t,n){t.append(ln(this.name)),t.append("("),Kr(t,this.values,",",n),t.append(")")},e.visit=function(t){return t.visitFunc(this)},r}(Xe),Z=function(o){function r(t){var n;return(n=o.call(this)||this).expr=void 0,n.expr=t,n}w(r,o);var e=r.prototype;return e.toExpr=function(){return this.expr},e.appendTo=function(t,n){t.append("-epubx-expr("),this.expr.appendTo(t,0),t.append(")")},e.visit=function(t){return t.visitExpr(this)},e.isExpr=function(){return!0},r}(Xe);function pe(o,r){if(o){if(o.isNumeric()){var e=o;return r.queryUnitSize(e.unit,!1)*e.num}if(o.isNum())return o.num}return 0}function Qr(o,r){return new O(pe(o,r),"px")}var b={absolute:_("absolute"),all:_("all"),always:_("always"),auto:_("auto"),avoid:_("avoid"),balance:_("balance"),balance_all:_("balance-all"),block:_("block"),block_end:_("block-end"),block_start:_("block-start"),both:_("both"),bottom:_("bottom"),border_box:_("border-box"),break_all:_("break-all"),break_word:_("break-word"),crop:_("crop"),cross:_("cross"),column:_("column"),exclusive:_("exclusive"),_false:_("false"),fixed:_("fixed"),flex:_("flex"),footnote:_("footnote"),footer:_("footer"),header:_("header"),hidden:_("hidden"),horizontal_tb:_("horizontal-tb"),inherit:_("inherit"),inline:_("inline"),inline_block:_("inline-block"),inline_end:_("inline-end"),inline_start:_("inline-start"),landscape:_("landscape"),left:_("left"),line:_("line"),list_item:_("list-item"),ltr:_("ltr"),manual:_("manual"),none:_("none"),normal:_("normal"),oeb_page_foot:_("oeb-page-foot"),oeb_page_head:_("oeb-page-head"),page:_("page"),relative:_("relative"),right:_("right"),same:_("same"),scale:_("scale"),snap_block:_("snap-block"),spread:_("spread"),_static:_("static"),rtl:_("rtl"),table:_("table"),table_caption:_("table-caption"),table_cell:_("table-cell"),table_footer_group:_("table-footer-group"),table_header_group:_("table-header-group"),table_row:_("table-row"),top:_("top"),transparent:_("transparent"),vertical_lr:_("vertical-lr"),vertical_rl:_("vertical-rl"),visible:_("visible"),_true:_("true")},Ka=new O(100,"%"),oi=new O(100,"pvw"),ai=new O(100,"pvh"),Gt=new O(0,"px"),qa={"font-size":1,color:2};function Jl(o,r){return(qa[o]||Number.MAX_VALUE)-(qa[r]||Number.MAX_VALUE)}var ke=function(o,r,e,t){this.x1=void 0,this.y1=void 0,this.x2=void 0,this.y2=void 0,this.x1=o,this.y1=r,this.x2=e,this.y2=t},gn=function(o,r){this.x=void 0,this.y=void 0,this.x=o,this.y=r},Zr=function(o,r,e,t){this.left=void 0,this.top=void 0,this.right=void 0,this.bottom=void 0,this.left=o,this.top=r,this.right=e,this.bottom=t},Qa=function(o,r,e,t){this.low=void 0,this.high=void 0,this.winding=void 0,this.shapeId=void 0,this.low=o,this.high=r,this.winding=e,this.shapeId=t},rn=function(o,r,e,t){this.y1=void 0,this.y2=void 0,this.x1=void 0,this.x2=void 0,this.left=null,this.right=null,this.y1=o,this.y2=r,this.x1=e,this.x2=t};function th(o,r){return o.low.y-r.low.y||o.low.x-r.low.x}var Vi=function(){function o(e){this.points=void 0,this.points=e}var r=o.prototype;return r.addSegments=function(e,t){for(var n=this.points,i=n.length,a=n[i-1],s=0;s<i;s++){var u,h=n[s];u=a.y<h.y?new Qa(a,h,1,t):new Qa(h,a,-1,t),e.push(u),a=h}},r.withOffset=function(e,t){for(var n,i=[],a=B(this.points);!(n=a()).done;){var s=n.value;i.push(new gn(s.x+e,s.y+t))}return new o(i)},o}();function Za(o,r,e,t){for(var n=[],i=0;i<20;i++){var a=2*i*Math.PI/20;n.push(new gn(o+e*Math.sin(a),r+t*Math.cos(a)))}return new Vi(n)}function $r(o,r,e,t){return new Vi([new gn(o,r),new gn(e,r),new gn(e,t),new gn(o,t)])}var Hi=function(o,r,e,t){this.x=void 0,this.winding=void 0,this.shapeId=void 0,this.lowOrHigh=void 0,this.x=o,this.winding=r,this.shapeId=e,this.lowOrHigh=t};function $a(o,r){var e=o.low.x+(o.high.x-o.low.x)*(r-o.low.y)/(o.high.y-o.low.y);if(isNaN(e))throw new Error("Bad intersection");return e}function eh(o,r,e,t){var n,i,a,s;r.high.y<e&&M.warn("Error: inconsistent segment (1)"),r.low.y<=e?(n=$a(r,e),i=r.winding):(n=r.low.x,i=0),r.high.y>=t?(a=$a(r,t),s=r.winding):(a=r.high.x,s=0),n<a?(o.push(new Hi(n,i,r.shapeId,-1)),o.push(new Hi(a,s,r.shapeId,1))):(o.push(new Hi(a,s,r.shapeId,-1)),o.push(new Hi(n,i,r.shapeId,1)))}function nh(o,r,e){var t,n=r+e,i=Array(n),a=Array(n);for(t=0;t<=n;t++)i[t]=0,a[t]=0;for(var s=[],u=!1,h=o.length,c=0;c<h;c++){var d=o[c];i[d.shapeId]+=d.winding,a[d.shapeId]+=d.lowOrHigh;var f=!1;for(t=0;t<r;t++)if(i[t]&&!a[t]){f=!0;break}if(f){for(t=r;t<=n;t++)if(i[t]||a[t]){f=!1;break}}u!=f&&(s.push(d.x),u=f)}return s}function Ja(o,r){return r?Math.floor(o/r)*r:o}function zi(o){return new ke(o.y1,-o.x2,o.y2,-o.x1)}function ts(o){return new ke(-o.y2,o.x1,-o.y1,o.x2)}function es(o){return new Vi(o.points.map(function(r){return function(e){return new gn(e.y,-e.x)}(r)}))}function ns(o,r){for(var e=r.length-1,t=new rn(o.y2,o.y2,o.x1,o.x2);e>=0;){var n=t;((t=r[e]).y2-t.y1<1||t.x1==n.x1&&t.x2==n.x2)&&(n.y1=t.y1,r.splice(e,1),t=n),e--}}function is(o,r){for(var e=0,t=o.length;e<t;){var n=Math.floor((e+t)/2);r>=o[n].y2?e=n+1:t=n}return e}function ih(o,r){if(!o.length)return r;var e,t,n=r.y1;for(t=0;t<o.length&&!((e=o[t]).y2>r.y1&&e.x1-.1<=r.x1&&e.x2+.1>=r.x2);t++)n=Math.max(n,e.y2);for(var i=n;t<o.length&&!((e=o[t]).y1>=r.y2||e.x1-.1>r.x1||e.x2+.1<r.x2);t++)i=e.y2;return(i=t===o.length?r.y2:Math.min(i,r.y2))<=n?null:new ke(r.x1,n,r.x2,i)}function rh(o,r){if(!o.length)return r;var e,t,n=r.y2;for(t=o.length-1;t>=0&&(e=o[t],!(t===o.length-1&&e.y2<r.y2))&&!(e.y1<r.y2&&e.x1-.1<=r.x1&&e.x2+.1>=r.x2);t--)n=Math.min(n,e.y1);for(var i=Math.min(n,e.y2);t>=0&&!((e=o[t]).y2<=r.y1||e.x1-.1>r.x1||e.x2+.1<r.x2);t--)i=e.y1;return n<=(i=Math.max(i,r.y1))?null:new ke(r.x1,i,r.x2,n)}var oh=function(o){function r(){var t;return(t=o.call(this)||this).propSet={},t}w(r,o);var e=r.prototype;return e.visitIdent=function(t){return this.propSet[t.name]=!0,t},e.visitSpaceList=function(t){return this.visitValues(t.values),t},r}(fn),ah=function(o){function r(e){var t;return(t=o.call(this)||this).value=void 0,t.value=e,t}return w(r,o),r.prototype.visitInt=function(e){return this.value=e.num,e},r}(fn);function rs(o,r){if(o){var e=new ah(r);try{return o.visit(e),e.value}catch(t){M.warn(t,"toInt: ")}}return r}var sh=function(o){function r(){var t;return(t=o.call(this)||this).collect=!1,t.coords=[],t.name=null,t}w(r,o);var e=r.prototype;return e.visitNumeric=function(t){return this.collect&&this.coords.push(t),null},e.visitNum=function(t){return this.collect&&t.num==0&&this.coords.push(new O(0,"px")),null},e.visitSpaceList=function(t){return this.visitValues(t.values),null},e.visitFunc=function(t){return this.collect||(this.collect=!0,this.visitValues(t.values),this.collect=!1,this.name=t.name.toLowerCase()),null},e.getShape=function(t,n,i,a,s){var u=this;if(this.coords.length>0){var h=[];switch(this.coords.forEach(function(f,v){if(f.unit=="%"){var g=v%2==0?i:a;v==3&&u.name=="circle"&&(g=Math.sqrt((i*i+a*a)/2)),h.push(f.num*g/100)}else h.push(f.num*s.queryUnitSize(f.unit,!1))}),this.name){case"polygon":if(h.length%2==0){for(var c=[],d=0;d<h.length;d+=2)c.push(new gn(t+h[d],n+h[d+1]));return new Vi(c)}break;case"rectangle":if(h.length==4)return $r(t+h[0],n+h[1],t+h[0]+h[2],n+h[1]+h[3]);break;case"ellipse":if(h.length==4)return Za(t+h[0],n+h[1],h[2],h[3]);break;case"circle":if(h.length==3)return Za(t+h[0],n+h[1],h[2],h[2])}}return null},r}(fn);function os(o,r,e,t,n,i){if(o){var a=new sh;try{return o.visit(a),a.getShape(r,e,t,n,i)}catch(s){M.warn(s,"toShape:")}}return $r(r,e,r+t,e+n)}var uh=function(o){function r(t){var n;return(n=o.call(this)||this).reset=void 0,n.counters={},n.name=null,n.reset=t,n}w(r,o);var e=r.prototype;return e.visitIdent=function(t){return this.name=t.toString(),this.counters[this.name]=this.reset?0:(this.counters[this.name]||0)+1,t},e.visitInt=function(t){return this.name&&(this.counters[this.name]+=t.num-(this.reset?0:1)),t},e.visitSpaceList=function(t){return this.visitValues(t.values),t},r}(fn);function si(o,r){var e=new uh(r);try{o.visit(e)}catch(t){M.warn(t,"toCounters:")}return e.counters}var lh=function(o){function r(e,t){var n;return(n=o.call(this)||this).baseUrl=void 0,n.transformer=void 0,n.baseUrl=e,n.transformer=t,n}return w(r,o),r.prototype.visitURL=function(e){return new pn(this.transformer.transformURL(e.url,this.baseUrl))},r}(_i);function Jr(o){var r={};return Object.keys(o).forEach(function(e){r[e]=Array.from(o[e])}),r}var m,hh=function(){function o(e,t){this.targetId=void 0,this.resolved=void 0,this.pageCounters=null,this.spineIndex=-1,this.pageIndex=-1,this.targetId=e,this.resolved=t}var r=o.prototype;return r.equals=function(e){return this===e||!!e&&this.targetId===e.targetId&&this.resolved===e.resolved&&this.spineIndex===e.spineIndex&&this.pageIndex===e.pageIndex},r.isResolved=function(){return this.resolved},r.resolve=function(){this.resolved=!0},r.unresolve=function(){this.resolved=!1},o}(),ch=function(){function o(e,t){this.counterStore=void 0,this.baseURL=void 0,this.counterStore=e,this.baseURL=t}var r=o.prototype;return r.countersOfId=function(e,t){e=this.counterStore.documentURLTransformer.transformFragment(e,this.baseURL),this.counterStore.countersById[e]=t},r.getExprContentListener=function(){return this.counterStore.getExprContentListener()},o}(),dh=function(){function o(e,t,n,i){this.counterStore=void 0,this.baseURL=void 0,this.rootScope=void 0,this.pageScope=void 0,this.styler=null,this.namedStringValues={},this.counterStore=e,this.baseURL=t,this.rootScope=n,this.pageScope=i}var r=o.prototype;return r.setStyler=function(e){this.styler=e},r.getFragment=function(e){var t=e.match(/^[^#]*#(.*)$/);return t?t[1]:null},r.getTransformedId=function(e){var t=this.counterStore.documentURLTransformer.transformURL(wt(e,this.baseURL),this.baseURL);return t.charAt(0)==="#"&&(t=t.substring(1)),t},r.getPageCounterVal=function(e,t){var n=this,i=new Oe(this.pageScope,function(){return t(function(){var a=n.counterStore.currentPageCounters[e];return a&&a.length?a[a.length-1]:null}())},"page-counter-"+e);return this.counterStore.registerPageCounterExpr(e,function(a){return t(a[0])},i),i},r.getPageCountersVal=function(e,t){var n=this,i=new Oe(this.pageScope,function(){return t(n.counterStore.currentPageCounters[e]||[])},"page-counters-"+e);return this.counterStore.registerPageCounterExpr(e,t,i),i},r.getTargetCounters=function(e,t,n){var i=this.counterStore.countersById[t];return!i&&n&&e&&(this.styler.styleUntilIdIsReached(e),i=this.counterStore.countersById[t]),i||null},r.getTargetPageCounters=function(e){return this.counterStore.currentPage.elementsById[e]?this.counterStore.currentPageCounters:this.counterStore.pageCountersById[e]||null},r.getTargetCounterVal=function(e,t,n){var i=this,a=this.getFragment(e),s=this.getTransformedId(e),u=this.getTargetCounters(a,s,!1);if(u&&u[t]){var h=u[t];return new re(this.rootScope,n(h[h.length-1]||null))}return new Oe(this.pageScope,function(){if(u=i.getTargetCounters(a,s,!0)){if(u[t]){var c=u[t];return n(c[c.length-1]||null)}var d=i.getTargetPageCounters(s);if(d){if(i.counterStore.resolveReference(s),d[t]){var f=d[t];return n(f[f.length-1]||null)}return n(0)}return i.counterStore.saveReferenceOfCurrentPage(s,!1),"??"}return i.counterStore.saveReferenceOfCurrentPage(s,!1),"??"},"target-counter-"+t+"-of-"+e)},r.getTargetCountersVal=function(e,t,n){var i=this,a=this.getFragment(e),s=this.getTransformedId(e);return new Oe(this.pageScope,function(){var u=i.getTargetPageCounters(s);if(u){i.counterStore.resolveReference(s);var h=u[t]||[],c=i.getTargetCounters(a,s,!0);return n(h.concat(c[t]||[]))}return i.counterStore.saveReferenceOfCurrentPage(s,!1),"??"},"target-counters-"+t+"-of-"+e)},r.getNamedStringVal=function(e,t){var n=this;return new Oe(this.pageScope,function(){var i=n.namedStringValues[e];if(!i)return"";for(var a=Object.keys(i).map(function(x){return parseInt(x,10)}).sort(Ca),s=n.counterStore.currentPage,u=s.isBlankPage?s.offset-1:s.offset,h=s.isBlankPage?u:Math.max.apply(Math,[u].concat(Array.from(s.container.querySelectorAll("[data-adapt-eloff]")).map(function(x){return parseInt(x.getAttribute("data-adapt-eloff"),10)}))),c=-1,d=-1,f=-1,v=-1,g=0;g<a.length;g++){var p=a[g],E=g>0?a[g-1]:-1,C=g<a.length-1?a[g+1]:-1;if(p>h)break;if(p>=u){if(c<0&&(c=p,v=-1),d<0)if(p===u)d=p;else{E<c&&(d=E);var D=s.container.querySelector('[data-adapt-eloff="'+p+'"]');if(D){var y=s.container.querySelector('[data-adapt-eloff="'+u+'"]');if(y||(y=s.container.querySelector('[data-adapt-eloff="0"]')),y){for(var N=y;N;N=N.firstElementChild)if(N===D){d=p;break}}}else d<0&&(d=p)}f=p}else(C>h||C<0)&&(c=d=f=v=p)}return i[{first:c,start:d,last:f,"first-except":v}[t]]||""},"named-string-"+t+"-"+e)},r.setNamedString=function(e,t,n){(this.namedStringValues[e]||(this.namedStringValues[e]={}))[n.currentElementOffset]=t},o}(),fh=function(){function o(e){this.documentURLTransformer=void 0,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.documentURLTransformer=e,this.currentPageCounters.page=[0]}var r=o.prototype;return r.createCounterListener=function(e){return new ch(this,e)},r.createCounterResolver=function(e,t,n){return new dh(this,e,t,n)},r.setCurrentPage=function(e){this.currentPage=e},r.definePageCounter=function(e,t){this.currentPageCounters[e]?this.currentPageCounters[e].push(t):this.currentPageCounters[e]=[t]},r.forceSetPageCounter=function(e){var t=this.currentPageCounters.page;t&&t.length?t[t.length-1]=e:this.currentPageCounters.page=[e]},r.updatePageCounters=function(e,t){var n;this.previousPageCounters=Jr(this.currentPageCounters);var i,a=e["counter-reset"];if(a){var s=a.evaluate(t);s&&(n=si(s,!0))}if(n)for(var u in n)this.definePageCounter(u,n[u]);var h=e["counter-increment"];if(h){var c=h.evaluate(t);c&&(i=si(c,!1))}for(var d in i?"page"in i||(i.page=1):(i={}).page=1,i){this.currentPageCounters[d]||this.definePageCounter(d,0);var f=this.currentPageCounters[d];f[f.length-1]+=i[d]}},r.pushPageCounters=function(e){this.currentPageCountersStack.push(this.currentPageCounters),this.currentPageCounters=Jr(e)},r.popPageCounters=function(){this.currentPageCounters=this.currentPageCountersStack.pop()},r.resolveReference=function(e){var t=this.unresolvedReferences[e],n=this.resolvedReferences[e];n||(n=this.resolvedReferences[e]=[]);for(var i=!1,a=0;a<this.referencesToSolve.length;){var s=this.referencesToSolve[a];if(s.targetId===e){if(s.resolve(),this.referencesToSolve.splice(a,1),t){var u=t.indexOf(s);u>=0&&t.splice(u,1)}n.push(s),i=!0}else a++}i||this.saveReferenceOfCurrentPage(e,!0)},r.saveReferenceOfCurrentPage=function(e,t){if(!this.newReferencesOfCurrentPage.some(function(i){return i.targetId===e})){var n=new hh(e,t);this.newReferencesOfCurrentPage.push(n)}},r.finishPage=function(e,t){var n=this,i=Object.keys(this.currentPage.elementsById);if(i.length>0){var a=Jr(this.currentPageCounters);i.forEach(function(c){n.pageCountersById[c]=a;var d=n.pageIndicesById[c];if(d&&d.pageIndex<t){var f=n.resolvedReferences[c];if(f){var v,g=n.unresolvedReferences[c];for(g||(g=n.unresolvedReferences[c]=[]);v=f.shift();)v.unresolve(),g.push(v)}}n.pageIndicesById[c]={spineIndex:e,pageIndex:t}})}for(var s,u=this.previousPageCounters;s=this.newReferencesOfCurrentPage.shift();){s.pageCounters=u,s.spineIndex=e,s.pageIndex=t;var h=void 0;s.isResolved()?(h=this.resolvedReferences[s.targetId])||(h=this.resolvedReferences[s.targetId]=[]):(h=this.unresolvedReferences[s.targetId])||(h=this.unresolvedReferences[s.targetId]=[]),h.every(function(c){return!s.equals(c)})&&h.push(s)}this.currentPage=null},r.getUnresolvedRefsToPage=function(e){var t=this,n=[];Object.keys(e.elementsById).forEach(function(s){var u=t.unresolvedReferences[s];u&&(n=n.concat(u))}),n.sort(function(s,u){return s.spineIndex-u.spineIndex||s.pageIndex-u.pageIndex});var i=[],a=null;return n.forEach(function(s){a&&a.spineIndex===s.spineIndex&&a.pageIndex===s.pageIndex?a.refs.push(s):i.push(a={spineIndex:s.spineIndex,pageIndex:s.pageIndex,pageCounters:s.pageCounters,refs:[s]})}),i},r.pushReferencesToSolve=function(e){this.referencesToSolveStack.push(this.referencesToSolve),this.referencesToSolve=e},r.popReferencesToSolve=function(){this.referencesToSolve=this.referencesToSolveStack.pop()},r.registerPageCounterExpr=function(e,t,n){e==="pages"&&this.pagesCounterExprs.push({expr:n,format:t})},r.getExprContentListener=function(){return this.exprContentListener.bind(this)},r.exprContentListener=function(e,t,n){if(this.pagesCounterExprs.findIndex(function(a){return a.expr===e})>=0){var i=n.createElement("span");return i.textContent=t,i.setAttribute(to,e.key),i}return null},r.finishLastPage=function(e){for(var t,n=this,i=e.root.querySelectorAll("["+to+"]"),a=this.currentPageCounters.page[0],s=function(){var h=t.value,c=h.getAttribute(to),d=n.pagesCounterExprs.findIndex(function(f){return f.expr.key===c});h.textContent=n.pagesCounterExprs[d].format([a])},u=B(i);!(t=u()).done;)s()},r.createLayoutConstraint=function(e){return new ph(this,e)},o}(),to="data-vivliostyle-pages-counter",ph=function(){function o(r,e){this.counterStore=void 0,this.pageIndex=void 0,this.counterStore=r,this.pageIndex=e}return o.prototype.allowLayout=function(r){if(!r||r.after)return!0;var e=r.viewNode;if(!e||e.nodeType!==1)return!0;var t=e.getAttribute("id")||e.getAttribute("name");if(!t||!this.counterStore.resolvedReferences[t]&&!this.counterStore.unresolvedReferences[t])return!0;var n=this.counterStore.pageIndicesById[t];return!n||this.pageIndex>=n.pageIndex},o}();function gh(o){if((o=o.substr(1)).match(/^[^0-9a-fA-F\n\r]$/))return o;var r=parseInt(o,16);return isNaN(r)?"":r<=65535?String.fromCharCode(r):r<=1114111?String.fromCharCode(55296|r>>10&1023,56320|1023&r):"�"}function Un(o){return o.replace(/\\([0-9a-fA-F]{0,6}(\r\n|[ \n\r\t\f])?|[^0-9a-fA-F\n\r])/g,gh)}(function(o){o[o.EOF=0]="EOF",o[o.IDENT=1]="IDENT",o[o.STR=2]="STR",o[o.NUMERIC=3]="NUMERIC",o[o.NUM=4]="NUM",o[o.INT=5]="INT",o[o.FUNC=6]="FUNC",o[o.HASH=7]="HASH",o[o.URL=8]="URL",o[o.CLASS=9]="CLASS",o[o.O_PAR=10]="O_PAR",o[o.C_PAR=11]="C_PAR",o[o.O_BRC=12]="O_BRC",o[o.C_BRC=13]="C_BRC",o[o.O_BRK=14]="O_BRK",o[o.C_BRK=15]="C_BRK",o[o.COMMA=16]="COMMA",o[o.SEMICOL=17]="SEMICOL",o[o.COLON=18]="COLON",o[o.SLASH=19]="SLASH",o[o.AT=20]="AT",o[o.PERCENT=21]="PERCENT",o[o.QMARK=22]="QMARK",o[o.PLUS=23]="PLUS",o[o.MINUS=24]="MINUS",o[o.BAR_BAR=25]="BAR_BAR",o[o.AMP_AMP=26]="AMP_AMP",o[o.BANG=31]="BANG",o[o.DOLLAR=32]="DOLLAR",o[o.HAT=33]="HAT",o[o.BAR=34]="BAR",o[o.TILDE=35]="TILDE",o[o.STAR=36]="STAR",o[o.GT=37]="GT",o[o.LT=38]="LT",o[o.EQ=39]="EQ",o[o.BANG_EQ=41]="BANG_EQ",o[o.DOLLAR_EQ=42]="DOLLAR_EQ",o[o.HAT_EQ=43]="HAT_EQ",o[o.BAR_EQ=44]="BAR_EQ",o[o.TILDE_EQ=45]="TILDE_EQ",o[o.STAR_EQ=46]="STAR_EQ",o[o.GT_EQ=47]="GT_EQ",o[o.LT_EQ=48]="LT_EQ",o[o.EQ_EQ=49]="EQ_EQ",o[o.COL_COL=50]="COL_COL",o[o.INVALID=51]="INVALID",o[o.LAST=51]="LAST"})(m||(m={}));var l,as=function(){this.type=void 0,this.precededBySpace=!1,this.num=0,this.text="",this.position=0,this.type=m.EOF};function $t(o,r){var e,t=Array(128);for(e=0;e<128;e++)t[e]=o;for(t.NaN=o==l.END?l.END:l.INVALID,e=0;e<r.length;e+=2)t[r[e]]=r[e+1];return t}(function(o){o[o.SPACE=1]="SPACE",o[o.INT=2]="INT",o[o.IDENT=3]="IDENT",o[o.BANG=4]="BANG",o[o.HASH=6]="HASH",o[o.DOLLAR=7]="DOLLAR",o[o.PERCENT=8]="PERCENT",o[o.AMP=9]="AMP",o[o.O_PAR=10]="O_PAR",o[o.C_PAR=11]="C_PAR",o[o.STAR=12]="STAR",o[o.PLUS=13]="PLUS",o[o.COMMA=14]="COMMA",o[o.MINUS=15]="MINUS",o[o.DOT=16]="DOT",o[o.SLASH=17]="SLASH",o[o.COLON=18]="COLON",o[o.SEMICOL=19]="SEMICOL",o[o.LT=20]="LT",o[o.EQ=21]="EQ",o[o.GT=22]="GT",o[o.QMARK=23]="QMARK",o[o.AT=24]="AT",o[o.O_BRK=25]="O_BRK",o[o.C_BRK=26]="C_BRK",o[o.O_BRC=27]="O_BRC",o[o.C_BRC=28]="C_BRC",o[o.BSLASH=29]="BSLASH",o[o.HAT=30]="HAT",o[o.BAR=31]="BAR",o[o.TILDE=32]="TILDE",o[o.STR1=33]="STR1",o[o.STR2=34]="STR2",o[o.END=35]="END",o[o.EQTAIL=36]="EQTAIL",o[o.ENDINT=37]="ENDINT",o[o.ENDNUM=38]="ENDNUM",o[o.CONT=39]="CONT",o[o.UNIT=40]="UNIT",o[o.PCUNIT=41]="PCUNIT",o[o.NUMBER=42]="NUMBER",o[o.ENDIDNT=43]="ENDIDNT",o[o.IDNTESC=44]="IDNTESC",o[o.ENDIDES=45]="ENDIDES",o[o.ENDSTR=46]="ENDSTR",o[o.ENDESTR=47]="ENDESTR",o[o.STR1ESC=48]="STR1ESC",o[o.STR2ESC=49]="STR2ESC",o[o.BAR_BAR=50]="BAR_BAR",o[o.AMP_AMP=51]="AMP_AMP",o[o.FUNC=52]="FUNC",o[o.FUNCES=53]="FUNCES",o[o.COMMENT=54]="COMMENT",o[o.COMMST=55]="COMMST",o[o.ENDNOTK=56]="ENDNOTK",o[o.MINMIN=57]="MINMIN",o[o.TOINT=58]="TOINT",o[o.TONUM=59]="TONUM",o[o.TOIDENT=60]="TOIDENT",o[o.TOIDES=61]="TOIDES",o[o.KILL1=62]="KILL1",o[o.KILL2=63]="KILL2",o[o.URL=64]="URL",o[o.URL1=65]="URL1",o[o.URL2=66]="URL2",o[o.ENDURL=67]="ENDURL",o[o.TERMURL=68]="TERMURL",o[o.FINURL=69]="FINURL",o[o.LT_BG=70]="LT_BG",o[o.LT_BG_M=71]="LT_BG_M",o[o.INVALID=72]="INVALID",o[o.CHKPOSS=73]="CHKPOSS",o[o.CHKPOSN=74]="CHKPOSN",o[o.URLESC=75]="URLESC",o[o.IDESCH=76]="IDESCH",o[o.COL_COL=77]="COL_COL",o[o.TOCLASS=78]="TOCLASS",o[o.CHKSP=79]="CHKSP",o[o.EOF=80]="EOF"})(l||(l={}));var In=[l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.SPACE,l.SPACE,l.INVALID,l.SPACE,l.SPACE,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.SPACE,l.BANG,l.STR2,l.HASH,l.DOLLAR,l.PERCENT,l.AMP,l.STR1,l.O_PAR,l.C_PAR,l.STAR,l.PLUS,l.COMMA,l.MINUS,l.DOT,l.SLASH,l.INT,l.INT,l.INT,l.INT,l.INT,l.INT,l.INT,l.INT,l.INT,l.INT,l.COLON,l.SEMICOL,l.LT,l.EQ,l.GT,l.QMARK,l.AT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.O_BRK,l.BSLASH,l.C_BRK,l.HAT,l.IDENT,l.INVALID,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.IDENT,l.O_BRC,l.BAR,l.C_BRC,l.TILDE,l.INVALID];In.NaN=l.EOF;var vn=[l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.FUNC,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.CONT,l.ENDIDNT,l.ENDIDNT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDIDNT,l.IDNTESC,l.ENDIDNT,l.ENDIDNT,l.CONT,l.ENDIDNT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT,l.ENDIDNT];vn.NaN=l.ENDIDNT;var vh=[l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.TOCLASS,l.TONUM,l.INVALID,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.TONUM,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.INVALID,l.TOIDES,l.INVALID,l.INVALID,l.TOCLASS,l.INVALID,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.TOCLASS,l.INVALID,l.INVALID,l.INVALID,l.INVALID,l.INVALID];vn.NaN=l.ENDIDNT;var ss=[l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.MINMIN,l.TONUM,l.END,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.TOINT,l.END,l.END,l.END,l.END,l.END,l.END,l.END,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.END,l.TOIDES,l.END,l.END,l.TOIDENT,l.END,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.TOIDENT,l.END,l.END,l.END,l.END,l.END];ss.NaN=l.END;var us=[l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.CHKPOSS,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.CHKPOSS,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.FUNCES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDIDES,l.IDNTESC,l.ENDIDES,l.ENDIDES,l.CONT,l.ENDIDES,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES,l.ENDIDES];us.NaN=l.ENDIDES;var eo=[l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.PCUNIT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.NUMBER,l.ENDINT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.UNIT,l.ENDINT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT,l.ENDINT];eo.NaN=l.ENDINT;var no=[l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.PCUNIT,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.CONT,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.UNIT,l.ENDNUM,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.UNIT,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM,l.ENDNUM];no.NaN=l.ENDNUM;var we,Fn=$t(l.END,[61,l.EQTAIL]),mh=$t(l.END,[58,l.COL_COL]),Eh=$t(l.END,[61,l.EQTAIL,124,l.BAR_BAR]),Ch=$t(l.END,[38,l.AMP_AMP]),Dh=$t(l.END,[42,l.COMMENT]),wh=$t(l.CONT,[42,l.COMMST]),yh=$t(l.COMMENT,[42,l.COMMST,47,l.ENDNOTK]),Nh=$t(l.KILL1,[62,l.ENDNOTK]),bh=$t(l.END,[61,l.EQTAIL,33,l.LT_BG]),Sh=$t(l.KILL1,[45,l.LT_BG_M]),Ah=$t(l.KILL2,[45,l.ENDNOTK]),io=$t(l.IDESCH,[9,l.INVALID,10,l.INVALID,13,l.INVALID,32,l.INVALID]),Th=$t(l.CONT,[39,l.ENDSTR,10,l.INVALID,13,l.INVALID,92,l.STR1ESC]),xh=$t(l.CONT,[34,l.ENDSTR,10,l.INVALID,13,l.INVALID,92,l.STR2ESC]),Ih=$t(l.CONT,[39,l.ENDESTR,10,l.CHKPOSN,13,l.CHKPOSN,92,l.STR1ESC]),Fh=$t(l.CONT,[34,l.ENDESTR,10,l.CHKPOSN,13,l.CHKPOSN,92,l.STR2ESC]),ls=$t(l.URL,[9,l.CONT,32,l.CONT,34,l.URL2,39,l.URL1,41,l.INVALID,10,l.CONT,13,l.CONT]),Ph=$t(l.CONT,[41,l.ENDURL,9,l.CHKSP,10,l.CHKSP,13,l.CHKSP,32,l.CHKSP,92,l.URLESC,40,l.INVALID,91,l.INVALID,93,l.INVALID,123,l.INVALID,125,l.INVALID,NaN,l.ENDURL]),Rh=$t(l.CONT,[39,l.TERMURL,10,l.CHKPOSN,13,l.CHKPOSN,92,l.URLESC,NaN,l.ENDURL]),Oh=$t(l.CONT,[34,l.TERMURL,10,l.CHKPOSN,13,l.CHKPOSN,92,l.URLESC,NaN,l.ENDURL]),kh=$t(l.INVALID,[9,l.CONT,10,l.CONT,13,l.CONT,32,l.CONT,41,l.FINURL]),mn=function(){function o(e,t){this.input=void 0,this.handler=void 0,this.indexMask=void 0,this.buffer=void 0,this.head=-1,this.tail=0,this.curr=0,this.position=0,this.input=e,this.handler=t,this.indexMask=15,this.buffer=Array(this.indexMask+1);for(var n=0;n<=this.indexMask;n++)this.buffer[n]=new as}var r=o.prototype;return r.token=function(){return this.tail==this.curr&&this.fillBuffer(),this.buffer[this.curr]},r.nthToken=function(e){return(this.tail-this.curr&this.indexMask)<=e&&this.fillBuffer(),this.buffer[this.curr+e&this.indexMask]},r.consume=function(){this.curr=this.curr+1&this.indexMask},r.mark=function(){if(this.head>=0)throw new Error("F_CSSTOK_BAD_CALL mark");this.head=this.curr},r.reset=function(){if(this.head<0)throw new Error("F_CSSTOK_BAD_CALL reset");this.curr=this.head,this.head=-1},r.unmark=function(){this.head=-1},r.hasMark=function(){return this.head>=0},r.reallocate=function(){for(var e=2*(this.indexMask+1)-1,t=Array(e+1),n=this.head,i=0;n!=this.tail;)t[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=e,this.buffer=t;i<=e;)t[i++]=new as},r.error=function(e,t,n){this.handler&&this.handler.error(n,t)},r.fillBuffer=function(){var e=this.tail,t=this.head>=0?this.head:this.curr,n=this.indexMask;if(e>=t?t+=n:t--,t==e){if(this.head<0)throw new Error("F_CSSTOK_INTERNAL");this.reallocate(),e=this.tail,t=n=this.indexMask}for(var i=In,a=this.input,s=this.position,u=this.buffer,h=m.EOF,c=0,d="",f=0,v=!1,g=u[e],p=-9;;){var E=a.charCodeAt(s);switch(i[E]||i[65]){case l.INVALID:h=m.INVALID,d=isNaN(E)?"E_CSS_UNEXPECTED_EOF":"E_CSS_UNEXPECTED_CHAR",i=In,s++;break;case l.SPACE:s++,v=!0;continue;case l.INT:c=s++,i=eo;continue;case l.IDENT:h=m.IDENT,c=s++,i=vn;continue;case l.BANG:c=s++,h=m.BANG,i=Fn;continue;case l.STR1:h=m.STR,c=++s,i=Th;continue;case l.STR2:h=m.STR,c=++s,i=xh;continue;case l.HASH:c=++s,h=m.HASH,i=vn;continue;case l.DOLLAR:c=s++,h=m.DOLLAR,i=Fn;continue;case l.PERCENT:c=s++,h=m.PERCENT;break;case l.AMP:c=s++,h=m.DOLLAR,i=Ch;continue;case l.O_PAR:c=s++,h=m.O_PAR;break;case l.C_PAR:c=s++,h=m.C_PAR;break;case l.STAR:c=s++,h=m.STAR,i=Fn;continue;case l.PLUS:c=s++,h=m.PLUS;break;case l.COMMA:c=s++,h=m.COMMA;break;case l.MINUS:h=m.MINUS,c=s++,i=ss;continue;case l.DOT:c=s++,i=vh;continue;case l.TOCLASS:c=s++,h=m.CLASS,i=vn;continue;case l.SLASH:c=s++,h=m.SLASH,i=Dh;continue;case l.COLON:c=s++,h=m.COLON,i=mh;continue;case l.COL_COL:s++,h=m.COL_COL;break;case l.SEMICOL:c=s++,h=m.SEMICOL;break;case l.LT:c=s++,h=m.LT,i=bh;continue;case l.EQ:c=s++,h=m.EQ,i=Fn;continue;case l.GT:c=s++,h=m.GT,i=Fn;continue;case l.QMARK:c=s++,h=m.QMARK;break;case l.AT:c=++s,h=m.AT,i=vn;continue;case l.O_BRK:c=s++,h=m.O_BRK;break;case l.C_BRK:c=s++,h=m.C_BRK;break;case l.O_BRC:c=s++,h=m.O_BRC;break;case l.C_BRC:c=s++,h=m.C_BRC;break;case l.BSLASH:p=c=s++,h=m.IDENT,i=io;continue;case l.HAT:c=s++,h=m.HAT,i=Fn;continue;case l.BAR:c=s++,h=m.BAR,i=Eh;continue;case l.TILDE:c=s++,h=m.TILDE,i=Fn;continue;case l.END:break;case l.EQTAIL:s++,h=h+m.BANG_EQ-m.BANG;break;case l.ENDINT:h=m.INT,f=parseInt(a.substring(c,s),10);break;case l.ENDNUM:h=m.NUM,f=parseFloat(a.substring(c,s));break;case l.CONT:s++;continue;case l.UNIT:h=m.NUMERIC,f=parseFloat(a.substring(c,s)),c=s++,i=vn;continue;case l.PCUNIT:h=m.NUMERIC,f=parseFloat(a.substring(c,s)),d="%",c=s++;break;case l.NUMBER:s++,i=no;continue;case l.ENDIDNT:d=a.substring(c,s);break;case l.IDNTESC:p=s++,i=io;continue;case l.ENDIDES:d=Un(a.substring(c,s));break;case l.ENDSTR:d=a.substring(c,s),s++;break;case l.ENDESTR:d=Un(a.substring(c,s)),s++;break;case l.STR1ESC:p=s,s+=2,i=Ih;continue;case l.STR2ESC:p=s,s+=2,i=Fh;continue;case l.BAR_BAR:s++,h=m.BAR_BAR;break;case l.AMP_AMP:s++,h=m.AMP_AMP;break;case l.FUNC:if(d=a.substring(c,s),h==m.IDENT){if(s++,d.toLowerCase()=="url"){i=ls;continue}h=m.FUNC}break;case l.FUNCES:if(d=Un(a.substring(c,s)),h==m.IDENT){if(s++,d.toLowerCase()=="url"){i=ls;continue}h=m.FUNC}break;case l.COMMENT:i=wh,s++;continue;case l.COMMST:i=yh,s++;continue;case l.ENDNOTK:i=In,s++;continue;case l.MINMIN:i=Nh,s++;continue;case l.TOINT:h=m.INT,i=eo,s++;continue;case l.TONUM:h=m.NUM,i=no,s++;continue;case l.TOIDENT:h=m.IDENT,i=vn,s++;continue;case l.TOIDES:h=m.IDENT,i=io,p=s++;continue;case l.KILL1:s--;break;case l.KILL2:s-=2;break;case l.URL:c=s++,i=Ph;continue;case l.URL1:c=++s,i=Rh;continue;case l.URL2:c=++s,i=Oh;continue;case l.ENDURL:h=m.URL,d=Un(a.substring(c,s)),s++;break;case l.FINURL:s++;break;case l.LT_BG:i=Sh,s++;continue;case l.LT_BG_M:i=Ah,s++;continue;case l.CHKSP:if(s-p<8&&a.substring(p+1,s+1).match(/^[0-9a-fA-F]{0,6}(\r\n|[\n\r])|[ \t]$/)){s++;continue}case l.TERMURL:h=m.URL,d=Un(a.substring(c,s)),s++,i=kh;continue;case l.CHKPOSN:if(++s-p<9&&a.substring(p+1,s).match(/^[0-9a-fA-F]{0,6}(\r\n|[\n\r])$/))continue;h=m.INVALID,d="E_CSS_UNEXPECTED_NEWLINE",i=In;break;case l.CHKPOSS:if(s-p<9&&a.substring(p+1,s+1).match(/^[0-9a-fA-F]{0,6}[ \t]$/)){s++;continue}d=Un(a.substring(c,s));break;case l.URLESC:p=s++;continue;case l.IDESCH:s++,i=us;continue;default:if(i!==In){h=m.INVALID,d="E_CSS_UNEXPECTED_STATE";break}c=s,h=m.EOF}if(g.type=h,g.precededBySpace=v,g.num=f,g.text=d,g.position=c,++e>=t)break;i=In,v=!1,g=u[e&n]}this.position=s,this.tail=e&n},o}(),Yt=null,ro=null;function oo(){return Yt}function L(o){if(!Yt)throw new Error("E_TASK_NO_CONTEXT");Yt.name||(Yt.name=o);var r=Yt,e=new Gi(r,r.top,o);return r.top=e,e.state=we.ACTIVE,e}function I(o){return new ao(o)}function Vn(o,r,e){var t=L(o);t.handler=e;try{r(t)}catch(n){t.task.raise(n,t)}return t.result()}(function(o){o[o.INIT=0]="INIT",o[o.ACTIVE=1]="ACTIVE",o[o.FINISHED=2]="FINISHED",o[o.DEAD=3]="DEAD"})(we||(we={}));var Lh=function(){function o(){}var r=o.prototype;return r.currentTime=function(){return new Date().valueOf()},r.setTimeout=function(e){function t(n,i){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){return setTimeout(e,t)}),r.clearTimeout=function(e){function t(n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){clearTimeout(e)}),o}(),Bh=function(){function o(e){this.timer=void 0,this.timeout=1,this.slice=25,this.sliceOverTime=0,this.queue=void 0,this.wakeupTime=null,this.timeoutToken=null,this.inTimeSlice=!1,this.order=0,this.timer=e,this.queue=new Bl,ro||(ro=this)}var r=o.prototype;return r.setSlice=function(e){this.slice=e},r.setTimeout=function(e){this.timeout=e},r.isTimeSliceOver=function(){return this.timer.currentTime()>=this.sliceOverTime},r.arm=function(){var e=this;if(!this.inTimeSlice){var t=this.queue.peek().scheduledTime,n=this.timer.currentTime();if(this.timeoutToken!=null){if(n+this.timeout>this.wakeupTime)return;this.timer.clearTimeout(this.timeoutToken)}var i=t-n;i<=this.timeout&&(i=this.timeout),this.wakeupTime=n+i,this.timeoutToken=this.timer.setTimeout(function(){e.timeoutToken=null,e.doTimeSlice()},i)}},r.schedule=function(e,t){var n=e,i=this.timer.currentTime();n.order=this.order++,n.scheduledTime=i+(t||0),this.queue.add(n),this.arm()},r.doTimeSlice=function(){this.timeoutToken!=null&&(this.timer.clearTimeout(this.timeoutToken),this.timeoutToken=null),this.inTimeSlice=!0;try{var e=this.timer.currentTime();for(this.sliceOverTime=e+this.slice;this.queue.length();){var t=this.queue.peek();if(t.scheduledTime>e||(this.queue.remove(),t.canceled||t.resumeInternal(),(e=this.timer.currentTime())>=this.sliceOverTime))break}}catch(n){M.error(n)}this.inTimeSlice=!1,this.queue.length()&&this.arm()},r.run=function(e,t){var n=new _h(this,t||"");n.top=new Gi(n,null,"bootstrap"),n.top.state=we.ACTIVE,n.top.then(function(){var a=function(){n.running=!1;for(var s,u=B(n.callbacks);!(s=u()).done;){var h=s.value;try{h()}catch(c){M.error(c)}}};try{e().then(function(s){n.result=s,a()})}catch(s){n.raise(s),a()}});var i=Yt;return Yt=n,this.schedule(n.top.suspend("bootstrap")),Yt=i,n},o}(),hs=function(){function o(e){this.task=void 0,this.scheduledTime=0,this.order=0,this.result=null,this.canceled=!1,this.task=e}var r=o.prototype;return r.compare=function(e){return e.scheduledTime-this.scheduledTime||e.order-this.order},r.getTask=function(){return this.task},r.schedule=function(e,t){this.result=e,this.task.scheduler.schedule(this,t)},r.resumeInternal=function(){var e=this.task;if(this.task=null,e&&e.continuation==this){e.continuation=null;var t=Yt;return Yt=e,e.top.finish(this.result),Yt=t,!0}return!1},r.cancel=function(){this.canceled=!0},o}(),_h=function(){function o(e,t){this.scheduler=void 0,this.name=void 0,this.callbacks=[],this.exception=null,this.running=!0,this.result=null,this.waitTarget=null,this.top=null,this.continuation=null,this.scheduler=e,this.name=t}var r=o.prototype;return r.getName=function(){return this.name},r.interrupt=function(e){if(this.raise(e||new Error("E_TASK_INTERRUPT")),this!==Yt&&this.continuation){this.continuation.cancel();var t=new hs(this);this.waitTarget="interrupt",this.continuation=t,this.scheduler.schedule(t)}},r.getScheduler=function(){return this.scheduler},r.isRunning=function(){return this.running},r.whenDone=function(e){this.callbacks.push(e)},r.join=function(){var e=this,t=L("Task.join");if(this.running){var n=t.suspend(this);this.whenDone(function(){n.schedule(e.result)})}else t.finish(this.result);return t.result()},r.unwind=function(){for(;this.top&&!this.top.handler;)this.top=this.top.parent;if(this.top&&this.top.handler&&this.exception){var e=this.exception;this.exception=null,this.top.handler(this.top,e)}else this.exception&&M.error(this.exception,"Unhandled exception in task",this.name)},r.raise=function(e,t){if(this.fillStack(e),t){for(var n=this.top;n&&n!=t;)n=n.parent;n==t&&(this.top=n)}this.exception=e,this.unwind()},r.fillStack=function(e){var t=e.frameTrace;if(!t){t=e.stack?e.stack+ ---- async ---
:"";for(var n=this.top;n;n=n.parent)t+=" ",t+=n.getName(),t+=
;e.frameTrace=t}},o}(),ao=function(){function o(e){this.value=void 0,this.value=e}var r=o.prototype;return r.then=function(e){e(this.value)},r.thenAsync=function(e){return e(this.value)},r.thenReturn=function(e){return new o(e)},r.thenFinish=function(e){e.finish(this.value)},r.isPending=function(){return!1},r.get=function(){return this.value},o}(),Mh=function(){function o(e){this.frame=void 0,this.frame=e}var r=o.prototype;return r.then=function(e){this.frame.then(e)},r.thenAsync=function(e){if(this.isPending()){var t=new Gi(this.frame.task,this.frame.parent,"AsyncResult.thenAsync");return t.state=we.ACTIVE,this.frame.parent=t,this.frame.then(function(n){e(n).then(function(i){t.finish(i)})}),t.result()}return e(this.frame.res)},r.thenReturn=function(e){return this.isPending()?this.thenAsync(function(){return new ao(e)}):new ao(e)},r.thenFinish=function(e){this.isPending()?this.then(function(t){e.finish(t)}):e.finish(this.frame.res)},r.isPending=function(){return this.frame.state==we.ACTIVE},r.get=function(){if(this.isPending())throw new Error("Result is pending");return this.frame.res},o}(),Gi=function(){function o(e,t,n){this.task=void 0,this.parent=void 0,this.name=void 0,this.res=null,this.state=void 0,this.callback=null,this.handler=null,this.task=e,this.parent=t,this.name=n,this.state=we.INIT}var r=o.prototype;return r.checkEnvironment=function(){if(!Yt)throw new Error("F_TASK_NO_CONTEXT");if(this!==Yt.top)throw new Error("F_TASK_NOT_TOP_FRAME")},r.result=function(){return new Mh(this)},r.finish=function(e){this.checkEnvironment(),Yt&&!Yt.exception&&(this.res=e),this.state=we.FINISHED;var t=this.parent;if(Yt&&(Yt.top=t),this.callback){try{this.callback(e)}catch(n){this.task.raise(n,t)}this.state=we.DEAD}},r.getTask=function(){return this.task},r.getName=function(){return this.name},r.getScheduler=function(){return this.task.scheduler},r.then=function(e){switch(this.state){case we.ACTIVE:if(this.callback)throw new Error("F_TASK_FRAME_ALREADY_HAS_CALLBACK");this.callback=e;break;case we.FINISHED:var t=this.task,n=this.parent;try{e(this.res),this.state=we.DEAD}catch(i){this.state=we.DEAD,t.raise(i,n)}break;case we.DEAD:throw new Error("F_TASK_DEAD_FRAME");default:throw new Error("F_TASK_UNEXPECTED_FRAME_STATE "+this.state)}},r.timeSlice=function(){var e=L("Frame.timeSlice");return e.getScheduler().isTimeSliceOver()?(M.debug("-- time slice --"),e.suspend().schedule(!0)):e.finish(!0),e.result()},r.sleep=function(e){var t=L("Frame.sleep");return t.suspend().schedule(!0,e),t.result()},r.loop=function(e){var t=L("Frame.loop");return function n(i){try{for(;i;){var a=e();if(a.isPending())return void a.then(n);a.then(function(s){i=s})}t.finish(!0)}catch(s){t.task.raise(s,t)}}(!0),t.result()},r.loopWithFrame=function(e){var t=Yt;if(!t)throw new Error("E_TASK_NO_CONTEXT");return this.loop(function(){var n;do{var i=new Uh(t,t.top);t.top=i,i.state=we.ACTIVE,e(i),n=i.result()}while(!n.isPending()&&n.get());return n})},r.suspend=function(e){if(this.checkEnvironment(),this.task.continuation)throw new Error("E_TASK_ALREADY_SUSPENDED");var t=new hs(this.task);return this.task.continuation=t,Yt=null,this.task.waitTarget=e||null,t},o}(),Uh=function(o){function r(t,n){return o.call(this,t,n,"loop")||this}w(r,o);var e=r.prototype;return e.continueLoop=function(){this.finish(!0)},e.breakLoop=function(){this.finish(!1)},r}(Gi),ui=function(){function o(e,t){this.fetch=void 0,this.name=void 0,this.arrived=!1,this.resource=null,this.task=null,this.piggybacks=[],this.fetch=e,this.name=t}var r=o.prototype;return r.start=function(){var e=this;this.task||(this.task=oo().getScheduler().run(function(){var t=L("Fetcher.run");return e.fetch().then(function(n){var i=e.piggybacks;if(e.arrived=!0,e.resource=n,e.task=null,e.piggybacks=[],i)for(var a=0;a<i.length;a++)try{i[a](n)}catch(s){M.error(s,"Error:")}t.finish(n)}),t.result()},this.name))},r.piggyback=function(e){this.arrived?e(this.resource):this.piggybacks.push(e)},r.get=function(){return this.arrived?I(this.resource):(this.start(),this.task.join())},r.hasArrived=function(){return this.arrived},o}(),so=function(o){if(o.length==0)return I(!0);if(o.length==1)return o[0].get().thenReturn(!0);var r=L("waitForFetches"),e=0;return r.loop(function(){for(;e<o.length;){var t=o[e++];if(!t.hasArrived())return t.get().thenReturn(!0)}return I(!1)}).then(function(){r.finish(!0)}),r.result()};function li(o,r){var e=null,t=null;o.localName=="img"&&(e=o.getAttribute("width"),t=o.getAttribute("height"));var n=new ui(function(){var i=L("loadImage"),a=i.suspend(o),s=!1,u=function(h){s||(s=!0,o.localName=="img"&&(e||o.removeAttribute("width"),t||o.removeAttribute("height")),a.schedule(h?h.type:"timeout"))};return o.addEventListener("load",u,!1),o.addEventListener("error",u,!1),o.addEventListener("abort",u,!1),o.namespaceURI==U.SVG?(o.setAttributeNS(U.XLINK,"xlink:href",r),setTimeout(u,300)):o.src=r,i.result()},"loadElement "+r);return n.start(),n}var $e,cs=
@media screen {
}
background: white;
z-index: 0;
}
display: -webkit-flex;
display: flex;
overflow: auto;
position: relative;
}
margin: auto;
overflow: hidden;
-webkit-flex: none;
flex: none;
}
display: -webkit-flex;
display: flex;
-webkit-flex: none;
flex: none;
-webkit-justify-content: center;
justify-content: center;
-moz-transform-origin: left top;
-ms-transform-origin: left top;
-webkit-transform-origin: left top;
transform-origin: left top;
}
-webkit-flex-direction: row;
flex-direction: row;
}
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
}
margin: 0 auto;
-webkit-flex: none;
flex: none;
transform-origin: center top;
}
margin-right: 1px;
transform-origin: right top;
}
margin-left: 1px;
transform-origin: left top;
}
margin-left: auto;
margin-right: auto;
transform-origin: center top;
}
}
,ds=
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: -1;
}
right: auto;
bottom: auto;
overflow: visible;
z-index: auto;
}
position: relative;
overflow: hidden;
}
position: absolute;
overflow: hidden;
max-width: 100%;
max-height: 100%;
box-sizing: border-box;
}
display: none;
}
position: absolute;
left: 3px;
top: 3px;
overflow: scroll;
overflow-x: hidden;
background: rgba(248, 248, 248, 0.9);
border-radius: 2px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}
@media print {
display: none;
}
width: 100% !important;
height: 100% !important;
}
-moz-transform: none !important;
-ms-transform: none !important;
-webkit-transform: none !important;
transform: none !important;
}
display: block !important;
max-width: 100%;
height: 100% !important;
max-height: 100%;
}
/* Workaround for Chrome printing problem */
padding-bottom: 0 !important;
overflow: visible !important;
} */
display: block;
content: "";
padding-top: 0.015625px;
margin-bottom: -0.015625px;
}
@-moz-document regexp('.*') {
top: -1px;
margin-top: 1px;
margin-bottom: -1px;
}
}
}
,fs=
/*
* Copyright 2013 Google, Inc.
* Copyright 2015 Trim-marks Inc.
* Copyright 2019 Vivliostyle Foundation
*
* CSS property validation.
*/
NUM = POS_NUM | ZERO | NEGATIVE;
NNEG_NUM = POS_NUM | ZERO;
INT = POS_INT | ZERO | NEGATIVE;
NNEG_INT = POS_INT | ZERO;
PERCENTAGE = POS_PERCENTAGE | ZERO | NEGATIVE;
STRICT_PERCENTAGE = POS_PERCENTAGE | ZERO_PERCENTAGE | NEGATIVE;
NNEG_PERCENTAGE = POS_PERCENTAGE | ZERO;
LENGTH = POS_LENGTH | ZERO | NEGATIVE;
NNEG_LENGTH = POS_LENGTH | ZERO | NEGATIVE;
PLENGTH = LENGTH | PERCENTAGE;
PPLENGTH = POS_LENGTH | ZERO | POS_PERCENTAGE;
ALENGTH = LENGTH | auto;
APLENGTH = PLENGTH | auto;
PAPLENGTH = PPLENGTH | auto;
ANGLE = POS_ANGLE | ZERO | NEGATIVE;
LENGTH_OR_NUM = LENGTH | NUM;
ANGLE_OR_NUM = ANGLE | NUM;
yellowgreen: #9ACD32 | transparent | currentcolor; RGBCOLOR = rgb(INT{3}) | rgb(STRICT_PERCENTAGE{3});
RGBACOLOR = rgba(NUM{4}) | rgba(STRICT_PERCENTAGE{3} NUM);
HSLCOLOR = hsl(NUM PERCENTAGE{2});
HSLACOLOR = hsl(NUM PERCENTAGE{2} NUM);
COLOR = SCOLOR | RGBCOLOR | RGBACOLOR | HSLCOLOR | HSLACOLOR;
BG_POSITION_TERM = PLENGTH | left | center | right | top | bottom;
GRADIENT_EXTENT = closest-corner | closest-side | farthest-corner | farthest-side;
GRADIENT_POSITION = at BG_POSITION_TERM{1,4};
GRADIENT_SHAPE = SPACE(circle LENGTH? GRADIENT_POSITION?) | SPACE(ellipse PLENGTH{2}? GRADIENT_POSITION?)| SPACE(circle | ellipse GRADIENT_EXTENT? GRADIENT_POSITION?); URI_OR_NONE = URI | none;
IMAGE = URI | LINEAR_GRADIENT | RADIAL_GRADIENT | none;
background-color = COLOR;
background-image = COMMA( IMAGE+ );
background-position = COMMA( SPACE(BG_POSITION_TERM{1,4})+ ); /* relaxed */
border-collapse = collapse | separate;
BORDER_SIDE_COLOR = COLOR;
BORDER_SIDE_STYLE = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset;
BORDER_SIDE_WIDTH = thin: 1px | medium: 3px | thick: 5px | NNEG_LENGTH;
border-spacing = LENGTH LENGTH?;
border-top-color = BORDER_SIDE_COLOR;
border-right-color = BORDER_SIDE_COLOR;
border-bottom-color = BORDER_SIDE_COLOR;
border-left-color = BORDER_SIDE_COLOR;
border-top-style = BORDER_SIDE_STYLE;
border-right-style = BORDER_SIDE_STYLE;
border-bottom-style = BORDER_SIDE_STYLE;
border-left-style = BORDER_SIDE_STYLE;
border-top-width = BORDER_SIDE_WIDTH;
border-right-width = BORDER_SIDE_WIDTH;
border-bottom-width = BORDER_SIDE_WIDTH;
border-left-width = BORDER_SIDE_WIDTH;
BORDER_RADIUS = PLENGTH{1,2};
border-top-left-radius = BORDER_RADIUS;
border-top-right-radius = BORDER_RADIUS;
border-bottom-right-radius = BORDER_RADIUS;
border-bottom-left-radius = BORDER_RADIUS;
border-image-source = IMAGE;
bottom = APLENGTH;
caption-side = top | bottom;
clear = none | left | right | top | bottom | both | all | same;
clip = rect(ALENGTH{4}) | rect(SPACE(ALENGTH{4})) | auto;
color = COLOR;
LIST_STYLE_TYPE = disc | circle | square | decimal | decimal-leading-zero | lower-roman |
upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha |
upper-alpha | russian | upper-russian | lower-russian | cjk-ideographic | trad-chinese-informal |
hebrew | none;
TYPE_OR_UNIT_IN_ATTR = string | color | url | integer | number | length | angle | time | frequency;
CONTENT_LIST = [ STRING | URI | counter(IDENT LIST_STYLE_TYPE?) |
counters(IDENT STRING LIST_STYLE_TYPE?) | ATTR |
target-counter(ATTR IDENT LIST_STYLE_TYPE?) |
target-counters( STRING | URI IDENT STRING LIST_STYLE_TYPE?) | target-counters(ATTR IDENT STRING LIST_STYLE_TYPE?) |
open-quote | close-quote | no-open-quote | no-close-quote |
CONTENT = normal | none | CONTENT_LIST;
content = CONTENT;
counter-increment = COUNTER;
counter-reset = COUNTER;
counter-set = COUNTER;
cue-after = URI_OR_NONE;
cue-before = URI_OR_NONE;
cursor = COMMA(URI* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize |
n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress ]);
direction = ltr | rtl;
display = inline | block | list-item | inline-block | table | inline-table | table-row-group |
table-header-group | table-footer-group | table-row | table-column-group | table-column |
table-cell | table-caption | none | oeb-page-head | oeb-page-foot | flex | inline-flex |
ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | run-in | compact | marker;
elevation = ANGLE | below | level | above | higher | lower;
empty-cells = show | hide;
FAMILY = SPACE(IDENT+) | STRING;
FAMILY_LIST = COMMA( FAMILY+ );
font-family = FAMILY_LIST;
font-size = xx-small | x-small | small | medium | large | x-large | xx-large | larger | smaller | PPLENGTH | POS_NUM;
font-style = normal | italic | oblique;
font-variant = normal | small-caps;
font-weight = normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
height = PAPLENGTH | POS_NUM ;
left = APLENGTH;
letter-spacing = normal | LENGTH_OR_NUM;
line-height = normal | POS_NUM | PPLENGTH;
list-style-image = IMAGE;
list-style-position = inside | outside;
list-style-type = LIST_STYLE_TYPE;
margin-right = APLENGTH;
margin-left = APLENGTH;
margin-top = APLENGTH;
margin-bottom = APLENGTH;
NPLENGTH = none | PLENGTH;
max-height = NPLENGTH;
max-width = NPLENGTH;
min-height = auto | PLENGTH;
min-width = auto | PLENGTH;
orphans = POS_INT;
outline-offset = LENGTH;
outline-color = COLOR | invert;
outline-style = BORDER_SIDE_STYLE;
outline-width = BORDER_SIDE_WIDTH;
overflow = visible | hidden | scroll | auto;
padding-right = PPLENGTH;
padding-left = PPLENGTH;
padding-top = PPLENGTH;
padding-bottom = PPLENGTH;
PAGE_BREAK = auto | always | avoid | left | right | recto | verso;
page-break-after = PAGE_BREAK;
page-break-before = PAGE_BREAK;
page-break-inside = avoid | auto;
PAUSE = POS_TIME | ZERO | POS_PERCENTAGE;
pause-after = PAUSE;
pause-before = PAUSE;
pitch-range = NUM;
pitch = FREQUENCY | x-low | low | medium | high | x-high;
position = static | relative | absolute | fixed;
richness = NUM;
right = APLENGTH;
speak-header = once | always;
speak-numeral = digits | continuous;
speak-punctuation = code | none;
speech-rate = NUM | x-slow | slow | medium | fast | x-fast | faster | slower;
stress = NUM;
table-layout = auto | fixed;
text-align = left | right | center | justify | start | end;
text-indent = PLENGTH;
text-transform = capitalize | uppercase | lowercase | none;
top = APLENGTH;
vertical-align = baseline | sub | super | top | text-top | middle | bottom | text-bottom | PLENGTH;
visibility = visible | hidden | collapse;
voice-family = FAMILY_LIST;
volume = NUM | PERCENTAGE | silent | x-soft | soft | medium | loud | x-loud;
white-space = normal | pre | nowrap | pre-wrap | pre-line;
widows = POS_INT;
width = PAPLENGTH | POS_NUM ;
word-spacing = normal | LENGTH_OR_NUM;
z-index = auto | INT;
webkithyphenate-character = auto | STRING; /* css-logical */
margin-block-start = APLENGTH;
margin-block-end = APLENGTH;
margin-inline-start = APLENGTH;
margin-inline-end = APLENGTH;
padding-block-start = APLENGTH;
padding-block-end = APLENGTH;
padding-inline-start = APLENGTH;
padding-inline-end = APLENGTH;
border-block-start-color = BORDER_SIDE_COLOR;
border-block-end-color = BORDER_SIDE_COLOR;
border-inline-start-color = BORDER_SIDE_COLOR;
border-inline-end-color = BORDER_SIDE_COLOR;
border-block-start-style = BORDER_SIDE_STYLE;
border-block-end-style = BORDER_SIDE_STYLE;
border-inline-start-style = BORDER_SIDE_STYLE;
border-inline-end-style = BORDER_SIDE_STYLE;
border-block-start-width = BORDER_SIDE_WIDTH;
border-block-end-width = BORDER_SIDE_WIDTH;
border-inline-start-width = BORDER_SIDE_WIDTH;
border-inline-end-width = BORDER_SIDE_WIDTH;
block-start = APLENGTH;
block-end = APLENGTH;
inline-start = APLENGTH;
inline-end = APLENGTH;
block-size = PAPLENGTH | POS_NUM;
inline-size = PAPLENGTH | POS_NUM;
max-block-size = NPLENGTH;
max-inline-size = NPLENGTH;
min-block-size = auto | PLENGTH;
min-inline-size = auto | PLENGTH;
SHAPE = auto | rectangle( PLENGTH{4} ) | ellipse( PLENGTH{4} ) | circle( PLENGTH{3} ) |
polygon( SPACE(PLENGTH+)+ );
epubxshape-inside = SHAPE; epubx,mswrap-flow = auto | both | start | end | maximum | clear | around /* epub al */; TRANSFORM_FUNCTION = matrix(NUM{6}) | translate(PLENGTH{1,2}) | translateX(PLENGTH) | translateY(PLENGTH) |
scale(NUM{1,2}) | scaleX(NUM) | scaleY(NUM) | rotate(ANGLE) | skewX(ANGLE) | skewY(ANGLE);
epub,mstransform = none | TRANSFORM_FUNCTION+; BOX = border-box | padding-box | content-box;
SHADOW = SPACE(inset || LENGTH{2,4} || COLOR); /* relaxed */
webkitbackground-origin = COMMA( BOX+ ); webkitbackground-clip = COMMA( BOX+ ); webkitbox-shadow = none | COMMA( SHADOW+ ); text-shadow = none | COMMA( SHADOW+ );
webkitbox-decoration-break = slice | clone; FILTER_FUNCTION = blur(LENGTH) | brightness(NUM | PERCENTAGE) | contrast(NUM | PERCENTAGE) | drop-shadow(SPACE(LENGTH{2,3} COLOR?))
| grayscale(NUM | PERCENTAGE) | hue-rotate(ANGLE) | invert(NUM | PERCENTAGE) | opacity(NUM | PERCENTAGE)
| saturate(NUM | PERCENTAGE) | sepia(NUM | PERCENTAGE);
FILTER_FUNCTION_LIST = FILTER_FUNCTION+;
webkitfilter = none | FILTER_FUNCTION_LIST; opacity = NUM;
BREAK = auto | avoid | avoid-page | page | left | right | recto | verso | avoid-column | column | avoid-region | region;
break-before = BREAK;
break-after = BREAK;
break-inside = auto | avoid | avoid-page | avoid-column | avoid-region;
webkitcolumn-span = none | auto | all; mozcolumn-fill = auto | balance | balance-all; epubxflow-linger = INT | none; epubxflow-priority = INT; epubxpage = INT | auto | IDENT; /* page: IDENT is for CSS Paged Media */ epubxmin-page-width = LENGTH; epubxmin-page-height = LENGTH; epubxrequired = true | false; epubxenabled = true | false; epubxconflicting-partitions = COMMA(IDENT+); epubxrequired-partitions = COMMA(IDENT+); epubxsnap-height = LENGTH | none; epubxsnap-width = LENGTH | none; epubxflow-consume = all | some; epubxtext-zoom = font-size | scale; adapttemplate = URI_OR_NONE; /* CSS Fonts */
font-size-adjust = none | NNEG_NUM;
webkitfont-kerning = auto | normal | none; font-feature-settings = COMMA( normal | SPACE( STRING on | off | INT ? )+ ); font-stretch = normal | wider | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded;
/* CSS Images */
image-resolution = RESOLUTION;
object-fit = fill | contain | cover | none | scale-down;
object-position = COMMA( SPACE(BG_POSITION_TERM{1,4})+ ); /* relaxed */
/* CSS Paged Media */
PAGE_SIZE = a10 | a9 | a8 | a7 | a6 | a5 | a4 | a3 | a2 | a1 | a0
| b10 | b9 | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0
| c10 | c9 | c8 | c7 | c6 | c5 | c4 | c3 | c2 | c1 | c0
| jis-b10 | jis-b9 | jis-b8 | jis-b7 | jis-b6 | jis-b5 | jis-b4 | jis-b3 | jis-b2 | jis-b1 | jis-b0
| letter | legal | ledger;
bleed = auto | LENGTH;
/* CSS Page Floats */
float-reference = inline | column | region | page;
float = block-start | block-end | inline-start | inline-end | snap-block | snap-inline | left | right | top | bottom | none | footnote;
float-min-wrap-block = PPLENGTH;
/* CSS Ruby */
ruby-align = start | center | space-between | space-around;
ruby-position = over | under | inter-character;
/* CSS Size Adjust */
moz,mstext-size-adjust = auto | none | POS_PERCENTAGE; /* CSS Text */
ms,webkitline-break = auto | loose | normal | strict; overflow-wrap = normal | break-word;
moztab-size = NNEG_INT | NNEG_LENGTH; moz,mstext-align-last = auto | start | end | left | right | center | justify; mstext-justify = auto | none | inter-word | inter-character | inter-ideograph /* specified in UA stylesheet for IE */; msword-break = normal | keep-all | break-all | break-word; msword-wrap = normal | break-word; /* CSS Text Decoration */
webkittext-decoration-color = COLOR; webkittext-decoration-style = solid | double | dotted | dashed | wavy; epub,webkittext-emphasis-style = none | filled | open ] || [ dot | circle | double-circle | triangle | sesame | STRING; /* CSS Transforms */
ms,webkitbackface-visibility = visible | hidden; /* CSS UI */
box-sizing = content-box | padding-box | border-box;
/* CSS Writing Modes */
webkittext-combine = none | horizontal; epub,webkittext-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; unicode-bidi = normal | embed | isolate | bidi-override | isolate-override | plaintext;
epub,webkitwriting-mode = horizontal-tb | vertical-rl | lr-tb | rl-tb | tb-rl | lr | rl | tb; /* CSS Flex box */
FLEX_BASIS = content | PAPLENGTH;
flex-direction = row | row-reverse | column | column-reverse;
flex-wrap = nowrap | wrap | wrap-reverse;
order = INT;
flex-grow = NNEG_NUM;
flex-shrink = NNEG_NUM;
flex-basis = FLEX_BASIS;
justify-content = flex-start | flex-end | center | space-between | space-around;
align-items = flex-start | flex-end | center | baseline | stretch;
align-self = auto | flex-start | flex-end | center | baseline | stretch;
align-content = flex-start | flex-end | center | space-between | space-around | stretch;
/* Pointer Events */
/* SVG 2 */
OPACITY_VALUE = NUM | PERCENTAGE;
PAINT = none | child | child(INT) | COLOR | SPACE( URI none | COLOR? ) | context-fill | context-stroke; color-interpolation = auto | sRGB | linearRGB;
color-rendering = auto | optimizeSpeed | optimizeQuality;
fill = PAINT;
fill-opacity = OPACITY_VALUE;
fill-rule = nonzero | evenodd;
glyph-orientation-vertical = auto | NUM | ANGLE;
image-rendering = auto | optimizeSpeed | optimizeQuality | crisp-edges | pixelated;
marker-start = none | URI;
marker-mid = none | URI;
marker-end = none | URI;
pointer-events = bounding-box | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | none;
shape-rendering = auto | optimizeSpeed | crispEdges | geometricPrecision;
stop-color = COLOR;
stop-opacity = OPACITY_VALUE;
stroke = PAINT;
stroke-dasharray = none | DASH_ARRAY;
stroke-dashoffset = PERCENTAGE | LENGTH_OR_NUM;
stroke-linecap = butt | round | square;
stroke-linejoin = miter | round | bevel;
stroke-miterlimit = NUM;
stroke-opacity = OPACITY_VALUE;
stroke-width = PERCENTAGE | LENGTH_OR_NUM;
text-anchor = start | middle | end;
text-rendering = auto | optimizeSpeed | optimizeLegibility | geometricPrecision;
/* SVG 1.1 */
alignment-baseline = auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical;
baseline-shift = baseline | sub | super | PERCENTAGE | LENGTH_OR_NUM;
dominant-baseline = auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge;
mask = none | URI;
/* css-masking-1 */
SHAPE_RADIUS = PLENGTH | closest-side | farthest-side;
FILL_RULE = nonzero | evenodd;
SHAPE_BOX = BOX | margin-box;
GEOMETRY_BOX = SHAPE_BOX | fill-box | stroke-box | view-box;
BASIC_SHAPE =
| polygon( FILL_RULE? COMMA( SPACE( PLENGTH{2} )+ )+ );
clip-rule = nonzero | evenodd;
/* filters */
flood-color = COLOR;
flood-opacity = OPACITY_VALUE;
lighting-color = COLOR;
/* compositing-1 */
BLEND_MODE = normal | multiply | screen | overlay | darken | lighten | color-dodge | color-burn | hard-light | soft-light | difference | exclusion | hue | saturation | color | luminosity;
mix-blend-mode = BLEND_MODE;
isolation = auto | isolate;
background-blend-mode = COMMA( BLEND_MODE+ );
/* CSS GCPM */
string-set = COMMA( SPACE( IDENT CONTENT_LIST )+ | none );
footnote-policy = auto | line;
/* CSS Repeated Headers and Footers */
vivrepeat-on-break = auto | none | header | footer; DEFAULTS
background-attachment: scroll;
background-color: transparent;
background-image: none;
background-repeat: repeat;
background-position: 0% 0%;
background-clip: border-box;
background-origin: padding-box;
background-size: auto;
border-top-color: currentColor;
border-right-color: currentColor;
border-bottom-color: currentColor;
border-left-color: currentColor;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
border-top-width: 3px;
border-right-width: 3px;
border-bottom-width: 3px;
border-left-width: 3px;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-image-source: none;
border-image-slice: 100%;
border-image-width: 1;
border-image-outset: 0;
border-image-repeat: stretch;
column-count: auto;
column-gap: normal;
column-width: auto;
column-rule-color: currentColor;
column-rule-style: none;
column-rule-width: 3px;
column-fill: balance;
outline-color: currentColor;
outline-style: none;
outline-width: 3px;
flex-direction: row;
flex-wrap: nowrap;
font-family: serif;
font-style: normal;
font-size: medium;
font-variant: normal;
font-weight: normal;
font-stretch: normal;
line-height: normal;
list-style-image: none;
list-style-position: outside;
list-style-type: disc;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
margin-top: auto;
padding-bottom: auto;
padding-left: auto;
padding-right: auto;
padding-top: auto;
text-emphasis-color: currentColor;
text-emphasis-style: none;
marker-start: none;
marker-mid: none;
marker-end: none;
/* css-logical */
border-block-start-color: currentColor;
border-block-end-color: currentColor;
border-inline-start-color: currentColor;
border-inline-end-color: currentColor;
border-block-start-style: none;
border-block-end-style: none;
border-inline-start-style: none;
border-inline-end-style: none;
border-block-start-width: 3px;
border-block-end-width: 3px;
border-inline-start-width: 3px;
border-inline-end-width: 3px;
SHORTHANDS
background = COMMA background-image [background-position / background-size ] background-repeat border-top = border-top-width border-top-style border-top-color;
border-right = border-right-width border-right-style border-right-color;
border-bottom = border-bottom-width border-bottom-style border-bottom-color;
border-left = border-left-width border-left-style border-left-color;
border-width = INSETS border-top-width border-right-width border-bottom-width border-left-width;
border-style = INSETS border-top-style border-right-style border-bottom-style border-left-style;
border-color = INSETS border-top-color border-right-color border-bottom-color border-left-color;
border = border-width border-style border-color;
border-image-repeat;
border-radius = INSETS_SLASH border-top-left-radius border-top-right-radius
border-bottom-right-radius border-bottom-left-radius;
moz,webkitcolumn-rule = column-rule-width column-rule-style column-rule-color; flex-flow = flex-direction flex-wrap;
oeb-column-number = column-count;
outline = outline-width outline-style outline-color;
list-style = list-style-type list-style-position list-style-image;
margin = INSETS margin-top margin-right margin-bottom margin-left;
padding = INSETS padding-top padding-right padding-bottom padding-left;
pause = INSETS pause-before pause-after;
font = FONT font-style font-variant font-weight font-stretch /* font-size line-height font-family are special-cased */;
epub,webkittext-emphasis = text-emphasis-style text-emphasis-color; marker = INSETS marker-start marker-mid marker-end;
/* css-logical */
margin-block = INSETS margin-block-start margin-block-end;
margin-inline = INSETS margin-inline-start margin-inline-end;
padding-block = INSETS padding-block-start padding-block-end;
padding-inline = INSETS padding-inline-start padding-inline-end;
border-block-width = INSETS border-block-start-width border-block-end-width;
border-block-style = INSETS border-block-start-style border-block-end-style;
border-block-color = INSETS border-block-start-color border-block-end-color;
border-inline-width = INSETS border-inline-start-width border-inline-end-width;
border-inline-style = INSETS border-inline-start-style border-inline-end-style;
border-inline-color = INSETS border-inline-start-color border-inline-end-color;
border-block = border-block-width border-block-style border-block-color;
border-inline = border-inline-width border-inline-style border-inline-color;
border-block-start = border-block-start-width border-block-start-style border-block-start-color;
border-block-end = border-block-end-width border-block-end-style border-block-end-color;
border-inline-start = border-inline-start-width border-inline-start-style border-inline-start-color;
border-inline-end = border-inline-end-width border-inline-end-style border-inline-end-color;
inset-block-start = block-start;
inset-block-end = block-end;
inset-inline-start = inline-start;
inset-inline-end = inline-end;
inset-block = INSETS block-start block-end;
inset-inline = INSETS inline-start inline-end;
/* old names */
,ps=
<!DOCTYPE html>
<head>
<style><![CDATA[
.footnote-content {
float: footnote;
}
.table-cell-container {
display: block;
}
]]></style>
</head>
<body>
<s:template id="footnote"><s:content/><s:include class="footnote-content"/></s:template>
<s:template id="table-cell"><div data-vivliostyle-flow-root="true" class="table-cell-container"><s:content/></div></s:template>
</body>
</html>,gs=
:root {
hyphens: -epubx-expr(pref-hyphenate? "auto": "manual");
}
break-before: left;
}
break-before: right;
}
@-adapt-footnote-area {
display: block;
margin-block-start: 0.5em;
margin-block-end: 0.5em;
}
@-adapt-footnote-area ::before {
display: block;
border-block-start-width: 1px;
border-block-start-style: solid;
border-block-start-color: black;
margin-block-end: 0.4em;
margin-inline-start: 0;
margin-inline-end: 60%;
}
/* default page master */
@-epubx-page-master :background-host {
@-epubx-partition :layout-host {
-epubx-flow-from: body;
top: -epubx-expr(header.margin-bottom-edge);
bottom: -epubx-expr(page-height - footer.margin-top-edge);
left: 0px;
right: 0px;
column-width: 25em;
}
@-epubx-partition footer :oeb-page-foot {
writing-mode: horizontal-tb;
-epubx-flow-from: oeb-page-foot;
bottom: 0px;
left: 0px;
right: 0px;
}
@-epubx-partition header :oeb-page-head {
writing-mode: horizontal-tb;
-epubx-flow-from: oeb-page-head;
top: 0px;
left: 0px;
right: 0px;
}
}
@page {
@top-left-corner {
text-align: right;
vertical-align: middle;
}
@top-left {
text-align: left;
vertical-align: middle;
}
@top-center {
text-align: center;
vertical-align: middle;
}
@top-right {
text-align: right;
vertical-align: middle;
}
@top-right-corner {
text-align: left;
vertical-align: middle;
}
@left-top {
text-align: center;
vertical-align: top;
}
@left-middle {
text-align: center;
vertical-align: middle;
}
@left-bottom {
text-align: center;
vertical-align: bottom;
}
@right-top {
text-align: center;
vertical-align: top;
}
@right-middle {
text-align: center;
vertical-align: middle;
}
@right-bottom {
text-align: center;
vertical-align: bottom;
}
@bottom-left-corner {
text-align: right;
vertical-align: middle;
}
@bottom-left {
text-align: left;
vertical-align: middle;
}
@bottom-center {
text-align: center;
vertical-align: middle;
}
@bottom-right {
text-align: right;
vertical-align: middle;
}
@bottom-right-corner {
text-align: left;
vertical-align: middle;
}
}
@media print {
@page {
margin: 10%;
}
}
,vs=
html|html,
html|address,
html|blockquote,
html|body,
html|dd,
html|div,
html|dl,
html|dt,
html|fieldset,
html|form,
html|frame,
html|frameset,
html|h1,
html|h2,
html|h3,
html|h4,
html|h5,
html|h6,
html|noframes,
html|ol,
html|p,
html|ul,
html|center,
html|dir,
html|hr,
html|menu,
html|pre,
html|article,
html|section,
html|nav,
html|aside,
html|hgroup,
html|footer,
html|header,
html|figure,
html|figcaption,
html|main {
display: block;
unicode-bidi: normal;
}
html|li {
display: list-item;
}
html|head {
display: none !important;
}
html|table {
display: table;
}
html|tr {
display: table-row;
}
html|thead {
display: table-header-group;
break-after: avoid;
}
html|tbody {
display: table-row-group;
}
html|tfoot {
display: table-footer-group;
break-before: avoid;
}
html|col {
display: table-column;
}
html|colgroup {
display: table-column-group;
}
html|td,
html|th {
display: table-cell;
}
html|caption {
display: table-caption;
text-align: center;
}
html|th {
font-weight: bolder;
text-align: center;
}
html|link,
html|style,
html|script {
display: none;
}
html|body {
margin: 8px;
}
html|h1 {
font-size: 2em;
margin-block-start: 0.67em;
margin-block-end: 0.67em;
margin-inline-start: 0em;
margin-inline-end: 0em;
}
html|h2 {
font-size: 1.5em;
margin-block-start: 0.75em;
margin-block-end: 0.75em;
margin-inline-start: 0em;
margin-inline-end: 0em;
}
html|h3 {
font-size: 1.17em;
margin-block-start: 0.83em;
margin-block-end: 0.83em;
margin-inline-start: 0em;
margin-inline-end: 0em;
}
html|h4,
html|p,
html|blockquote,
html|ul,
html|fieldset,
html|form,
html|ol,
html|dl,
html|dir,
html|menu,
html|h5,
html|h6 {
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0em;
margin-inline-end: 0em;
}
html|h5 {
font-size: 0.83em;
}
html|h6 {
font-size: 0.75em;
}
html|h1,
html|h2,
html|h3,
html|h4,
html|h5,
html|h6,
html|b,
html|strong {
font-weight: bolder;
}
html|h1,
html|h2,
html|h3,
html|h4,
html|h5,
html|h6 {
break-after: avoid;
}
html|blockquote {
margin-block-start: 0px;
margin-block-end: 0px;
margin-inline-start: 40px;
margin-inline-end: 40px;
}
html|i,
html|cite,
html|em,
html|var,
html|address {
font-style: italic;
}
html|pre,
html|tt,
html|code,
html|kbd,
html|samp {
font-family: monospace;
}
html|pre {
white-space: pre;
}
html|button,
html|textarea,
html|input,
html|select {
display: inline-block;
}
html|big {
font-size: 1.17em;
}
html|small,
html|sub,
html|sup {
font-size: 0.83em;
}
html|sub {
vertical-align: sub;
}
html|sup {
vertical-align: super;
}
html|table {
border-spacing: 2px;
}
html|thead,
html|tbody,
html|tfoot {
vertical-align: middle;
}
/* for XHTML tables without tbody */
html|table > html|tr {
vertical-align: middle;
}
html|td,
html|th {
vertical-align: inherit;
}
html|s,
html|strike,
html|del {
text-decoration: line-through;
}
html|hr {
border: 1px inset;
}
html|ol,
html|ul,
html|dir,
html|menu,
html|dd {
margin: 0px;
margin-inline-start: 40px;
}
html|ol html|ul,
html|ul html|ol,
html|ul html|ul,
html|ol html|ol {
margin-block-start: 0;
margin-block-end: 0;
}
html|u,
html|ins {
text-decoration: underline;
}
html|center {
text-align: center;
}
html|q:before {
content: open-quote;
}
html|q:after {
content: close-quote;
}
html|audio,
html|video {
break-inside: avoid;
}
html|ruby {
display: ruby;
}
html|rp {
display: none;
}
html|rbc {
display: ruby-base-container;
}
html|rtc {
display: ruby-text-container;
}
html|rb {
display: ruby-base;
white-space: nowrap;
}
html|rt {
display: ruby-text;
}
html|ruby,
html|rb,
html|rt,
html|rbc,
html|rtc {
unicode-bidi: isolate;
}
html|rtc,
html|rt {
font-variant-east-asian: ruby;
text-emphasis: none;
white-space: nowrap;
line-height: 1;
}
html|rtc:lang(zh),
html|rt:lang(zh) {
ruby-align: center;
}
html|rtc,
html|rt {
font-size: 50%;
}
html|rtc:lang(zh-TW),
html|rt:lang(zh-TW) {
font-size: 30%;
}
html|rtc > html|rt,
html|rtc > html|rt:lang(zh-TW) {
font-size: 100%;
}
/* Bidi settings */
direction: ltr;
unicode-bidi: bidi-override;
}
direction: rtl;
unicode-bidi: bidi-override;
}
direction: ltr;
unicode-bidi: embed;
}
direction: rtl;
unicode-bidi: embed;
}
/*------------------ epub-specific ---------------------*/
font-size: 0.75em;
vertical-align: super;
line-height: 0.01;
}
-adapt-template: url(user-agent.xml#footnote);
text-decoration: none;
}
display: none;
}
display: block;
margin: 0.25em;
font-size: 1.2em;
line-height: 1.2;
}
epub|trigger {
display: none;
}
epub|switch {
display: inline;
}
epub|default {
display: inline;
}
epub|case {
display: none;
}
display: inline;
}
display: none;
}
display: none;
}
/*--------------- ncx and toc ----------------------*/
ncx|ncx {
display: block;
padding-top: 10px;
padding-bottom: 10px;
}
ncx|content {
display: none;
}
body > * {
-adapt-behavior: body-child;
}
nav,
.toc,
-adapt-behavior: toc-root;
}
nav a,
.toc a,
ncx|navLabel {
-adapt-behavior: toc-node-anchor;
}
nav li,
.toc li,
ncx|navPoint {
-adapt-behavior: toc-node;
}
nav li > *:first-child,
.toc li > *:first-child,
#toc li > *:first-child { -adapt-behavior: toc-node-first-child;
}
nav ol,
.toc ol,
nav ul,
.toc ul,
ol.toc,
ol#toc,
ul.toc,
ul#toc {
-adapt-behavior: toc-container;
}
;function hi(o,r,e,t,n){var i=L("ajax"),a=new XMLHttpRequest,s=i.suspend(a),u={status:0,statusText:"",url:o,contentType:null,responseText:null,responseXML:null,responseBlob:null};a.open(e||"GET",o,!0),r&&(a.responseType=r),a.onreadystatechange=function(){if(a.readyState===4){if(u.status=a.status,u.statusText=a.statusText||a.status==404&&"Not Found"||"",u.status==200||u.status==0)if(r&&r!==$e.DOCUMENT||!a.responseXML||a.responseXML.documentElement.localName=="parsererror")if((!r||r===$e.DOCUMENT)&&a.response instanceof HTMLDocument)u.responseXML=a.response,u.contentType=a.response.contentType;else{var h=a.response;r&&r!==$e.TEXT||typeof h!="string"?h?u.responseBlob=typeof h=="string"?uo([h]):h:M.warn("Unexpected empty success response for",o):u.responseText=h;var c=a.getResponseHeader("Content-Type");c&&(u.contentType=c.replace(/(.*);.*$/,"$1"))}else u.responseXML=a.responseXML,u.contentType=a.responseXML.contentType;s.schedule(u)}};try{t?(a.setRequestHeader("Content-Type",n||"text/plain; charset=UTF-8"),a.send(t)):(/^file:|^https?:\/\/[^/]+\.githubusercontent\.com|\.(xhtml|xht|opf)$/i.test(o)?/\/aozorabunko\/[^/]+\/cards\/[^/]+\/files\/[^/.]+\.html$/.test(o)?a.overrideMimeType("text/html; charset=Shift_JIS"):/\.(html|htm)$/i.test(o)?a.overrideMimeType("text/html; charset=UTF-8"):/\.(xhtml|xht|xml|opf)$/i.test(o)?a.overrideMimeType("application/xml; charset=UTF-8"):/\.(txt|css)$/i.test(o)?a.overrideMimeType("text/plain; charset=UTF-8"):a.overrideMimeType("text/html; charset=UTF-8"):/^data:,(<|%3c)/i.test(o)?a.overrideMimeType("text/html; charset=UTF-8"):/^data:,/i.test(o)&&a.overrideMimeType("text/plain; charset=UTF-8"),a.send(null))}catch(h){M.warn(h,"Error fetching "+o),s.schedule(u)}return i.result()}function uo(o,r){var e=r||"application/octet-stream",t=window.WebKitBlobBuilder||window.MSBlobBuilder;if(t){for(var n=new t,i=0;i<o.length;i++)n.append(o[i]);return n.getBlob(e)}return new Blob(o,{type:e})}(function(o){o.DEFAULT="",o.ARRAYBUFFER="arraybuffer",o.BLOB="blob",o.DOCUMENT="document",o.JSON="json",o.TEXT="text"})($e||($e={}));var xe,lo=function(){function o(e,t){this.parser=void 0,this.type=void 0,this.resources={},this.fetchers={},this.parser=e,this.type=t}var r=o.prototype;return r.load=function(e,t,n){e=Ct(e);var i=this.resources[e];return i!==void 0?I(i):this.fetch(e,t,n).get()},r.fetchInner=function(e,t,n){var i=this,a=L("fetch"),s=e.endsWith("?viv-toc-box");s&&(e=e.replace("?viv-toc-box",""));var u=wt("user-agent.xml",Bt),h=!s&&e===u;return h&&(e="data:application/xml,"+encodeURIComponent(ps)),hi(e,this.type).then(function(c){if(c.status>=400&&t)throw new Error((n||"Failed to fetch required resource: "+e)+" ("+c.status+(c.statusText?" "+c.statusText:"")+")");s?(e+="?viv-toc-box",c.url+="?viv-toc-box"):h&&(c.url=e=u),i.parser(c,i).then(function(d){delete i.fetchers[e],i.resources[e]=d,a.finish(d)})}),a.result()},r.fetch=function(e,t,n){var i=this;if(e=Ct(e),this.resources[e])return null;var a=this.fetchers[e];return a||(a=new ui(function(){return i.fetchInner(e,t,n)},"Fetch "+e),this.fetchers[e]=a,a.start()),a},r.get=function(e){return this.resources[Ct(e)]},r.delete=function(e){delete this.resources[Ct(e)]},o}();function Vh(o,r){var e=o.responseText;return I(e?It(e):null)}function ms(o){var r=parseInt(o,16);if(isNaN(r))throw new Error("E_CSS_COLOR");if(o.length==6)return new Ya(r);if(o.length==3)return new Ya(r=15&r|(15&r)<<4|(240&r)<<4|(240&r)<<8|(3840&r)<<8|(3840&r)<<12);throw new Error("E_CSS_COLOR")}(function(o){o.USER_AGENT="UA",o.USER="User",o.AUTHOR="Author"})(xe||(xe={}));var S,ho=function(){function o(e){this.scope=void 0,this.flavor=void 0,this.scope=e,this.flavor=xe.AUTHOR}var r=o.prototype;return r.getCurrentToken=function(){return null},r.getScope=function(){return this.scope},r.error=function(e,t){},r.startStylesheet=function(e){this.flavor=e},r.tagSelector=function(e,t){},r.classSelector=function(e){},r.pseudoclassSelector=function(e,t){},r.pseudoelementSelector=function(e,t){},r.idSelector=function(e){},r.attributeSelector=function(e,t,n,i){},r.descendantSelector=function(){},r.childSelector=function(){},r.adjacentSiblingSelector=function(){},r.followingSiblingSelector=function(){},r.nextSelector=function(){},r.startSelectorRule=function(){},r.startFontFaceRule=function(){},r.startFootnoteRule=function(e){},r.startViewportRule=function(){},r.startDefineRule=function(){},r.startRegionRule=function(){},r.startPageRule=function(){},r.startPageMarginBoxRule=function(e){},r.startWhenRule=function(e){},r.startMediaRule=function(e){this.startWhenRule(e)},r.startFlowRule=function(e){},r.startPageTemplateRule=function(){},r.startPageMasterRule=function(e,t,n){},r.startPartitionRule=function(e,t,n){},r.startPartitionGroupRule=function(e,t,n){},r.startRuleBody=function(){},r.property=function(e,t,n){},r.endRule=function(){},r.startFuncWithSelector=function(e){},r.endFuncWithSelector=function(){},r.getImportantSpecificity=function(){switch(this.flavor){case xe.USER_AGENT:return 0;case xe.USER:return 100663296;default:return 83886080}},r.getBaseSpecificity=function(){switch(this.flavor){case xe.USER_AGENT:return 0;case xe.USER:return 16777216;default:return 33554432}},o}(),Hh=function(o){function r(){var t;return(t=o.call(this,null)||this).stack=[],t.tokenizer=null,t.slave=null,t}w(r,o);var e=r.prototype;return e.pushHandler=function(t){this.stack.push(this.slave),this.slave=t},e.popHandler=function(){this.slave=this.stack.pop()},e.getCurrentToken=function(){return this.tokenizer?this.tokenizer.token():null},e.getScope=function(){return this.slave.getScope()},e.error=function(t,n){this.slave.error(t,n)},e.errorMsg=function(t,n){M.warn(t)},e.startStylesheet=function(t){o.prototype.startStylesheet.call(this,t),this.stack.length>0&&(this.slave=this.stack[0],this.stack=[]),this.slave.startStylesheet(t)},e.tagSelector=function(t,n){this.slave.tagSelector(t,n)},e.classSelector=function(t){this.slave.classSelector(t)},e.pseudoclassSelector=function(t,n){this.slave.pseudoclassSelector(t,n)},e.pseudoelementSelector=function(t,n){this.slave.pseudoelementSelector(t,n)},e.idSelector=function(t){this.slave.idSelector(t)},e.attributeSelector=function(t,n,i,a){this.slave.attributeSelector(t,n,i,a)},e.descendantSelector=function(){this.slave.descendantSelector()},e.childSelector=function(){this.slave.childSelector()},e.adjacentSiblingSelector=function(){this.slave.adjacentSiblingSelector()},e.followingSiblingSelector=function(){this.slave.followingSiblingSelector()},e.nextSelector=function(){this.slave.nextSelector()},e.startSelectorRule=function(){this.slave.startSelectorRule()},e.startFontFaceRule=function(){this.slave.startFontFaceRule()},e.startFootnoteRule=function(t){this.slave.startFootnoteRule(t)},e.startViewportRule=function(){this.slave.startViewportRule()},e.startDefineRule=function(){this.slave.startDefineRule()},e.startRegionRule=function(){this.slave.startRegionRule()},e.startPageRule=function(){this.slave.startPageRule()},e.startPageMarginBoxRule=function(t){this.slave.startPageMarginBoxRule(t)},e.startWhenRule=function(t){this.slave.startWhenRule(t)},e.startFlowRule=function(t){this.slave.startFlowRule(t)},e.startPageTemplateRule=function(){this.slave.startPageTemplateRule()},e.startPageMasterRule=function(t,n,i){this.slave.startPageMasterRule(t,n,i)},e.startPartitionRule=function(t,n,i){this.slave.startPartitionRule(t,n,i)},e.startPartitionGroupRule=function(t,n,i){this.slave.startPartitionGroupRule(t,n,i)},e.startRuleBody=function(){this.slave.startRuleBody()},e.property=function(t,n,i){this.slave.property(t,n,i)},e.endRule=function(){this.slave.endRule()},e.startFuncWithSelector=function(t){this.slave.startFuncWithSelector(t)},e.endFuncWithSelector=function(){this.slave.endFuncWithSelector()},r}(ho),Es=function(o){function r(t,n,i){var a;return(a=o.call(this,t)||this).owner=void 0,a.topLevel=void 0,a.depth=0,a.owner=n,a.topLevel=i,n&&(a.flavor=n.flavor),a}w(r,o);var e=r.prototype;return e.getCurrentToken=function(){return this.owner.getCurrentToken()},e.error=function(t,n){this.owner.errorMsg(t,n)},e.startRuleBody=function(){this.depth++},e.endRule=function(){--this.depth!=0||this.topLevel||this.owner.popHandler()},r}(ho),ci=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.report=function(t){this.error(t,this.getCurrentToken())},e.reportAndSkip=function(t){this.report(t),this.owner.pushHandler(new Es(this.scope,this.owner,!1))},e.startSelectorRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_SELECTOR")},e.startFontFaceRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_FONT_FACE")},e.startFootnoteRule=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_FOOTNOTE")},e.startViewportRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_VIEWPORT")},e.startDefineRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_DEFINE")},e.startRegionRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_REGION")},e.startPageRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_PAGE")},e.startWhenRule=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_WHEN")},e.startFlowRule=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_FLOW")},e.startPageTemplateRule=function(){this.reportAndSkip("E_CSS_UNEXPECTED_PAGE_TEMPLATE")},e.startPageMasterRule=function(t,n,i){this.reportAndSkip("E_CSS_UNEXPECTED_PAGE_MASTER")},e.startPartitionRule=function(t,n,i){this.reportAndSkip("E_CSS_UNEXPECTED_PARTITION")},e.startPartitionGroupRule=function(t,n,i){this.reportAndSkip("E_CSS_UNEXPECTED_PARTITION_GROUP")},e.startFuncWithSelector=function(t){this.reportAndSkip("E_CSS_UNEXPECTED_SELECTOR_FUNC")},e.endFuncWithSelector=function(){this.reportAndSkip("E_CSS_UNEXPECTED_END_SELECTOR_FUNC")},e.property=function(t,n,i){this.error("E_CSS_UNEXPECTED_PROPERTY",this.getCurrentToken())},r}(Es),Jt=[],Wi=[],_t=[],te=[],je=[],Le=[],Kt=[],ue=[],kt=[],ee=[],ye=[],le=[],Wt=[];(function(o){o[o.SELECTOR_NAME_1=1]="SELECTOR_NAME_1",o[o.SELECTOR_NAME=2]="SELECTOR_NAME",o[o.SELECTOR_ANY_1=3]="SELECTOR_ANY_1",o[o.SELECTOR_ANY=4]="SELECTOR_ANY",o[o.SELECTOR_ID_1=5]="SELECTOR_ID_1",o[o.SELECTOR_ID=6]="SELECTOR_ID",o[o.SELECTOR_CLASS_1=7]="SELECTOR_CLASS_1",o[o.SELECTOR_CLASS=8]="SELECTOR_CLASS",o[o.SELECTOR_ATTR_1=9]="SELECTOR_ATTR_1",o[o.SELECTOR_ATTR=10]="SELECTOR_ATTR",o[o.SELECTOR_CHILD=11]="SELECTOR_CHILD",o[o.SELECTOR_SIBLING=12]="SELECTOR_SIBLING",o[o.SELECTOR_BODY=13]="SELECTOR_BODY",o[o.SELECTOR_PSEUDOCLASS=14]="SELECTOR_PSEUDOCLASS",o[o.VAL_IDENT=15]="VAL_IDENT",o[o.VAL_HASH=16]="VAL_HASH",o[o.VAL_NUM=17]="VAL_NUM",o[o.VAL_INT=18]="VAL_INT",o[o.VAL_NUMERIC=19]="VAL_NUMERIC",o[o.VAL_STR=20]="VAL_STR",o[o.VAL_URL=21]="VAL_URL",o[o.VAL_COMMA=22]="VAL_COMMA",o[o.VAL_SLASH=23]="VAL_SLASH",o[o.VAL_FUNC=24]="VAL_FUNC",o[o.VAL_C_PAR=25]="VAL_C_PAR",o[o.VAL_END=26]="VAL_END",o[o.RULE_END=27]="RULE_END",o[o.IDENT=28]="IDENT",o[o.SELECTOR_START=29]="SELECTOR_START",o[o.AT=30]="AT",o[o.EXPR_IDENT=31]="EXPR_IDENT",o[o.EXPR_NUM=32]="EXPR_NUM",o[o.EXPR_NUMERIC=33]="EXPR_NUMERIC",o[o.EXPR_STR=34]="EXPR_STR",o[o.EXPR_PARAM=35]="EXPR_PARAM",o[o.EXPR_PREFIX=36]="EXPR_PREFIX",o[o.EXPR_INFIX=37]="EXPR_INFIX",o[o.EXPR_FUNC=38]="EXPR_FUNC",o[o.EXPR_C_PAR=39]="EXPR_C_PAR",o[o.EXPR_O_PAR=40]="EXPR_O_PAR",o[o.SELECTOR_NEXT=41]="SELECTOR_NEXT",o[o.SELECTOR_PSEUDOELEM=42]="SELECTOR_PSEUDOELEM",o[o.EXPR_O_BRC=43]="EXPR_O_BRC",o[o.VAL_FINISH=44]="VAL_FINISH",o[o.EXPR_INFIX_NAME=45]="EXPR_INFIX_NAME",o[o.PROP=46]="PROP",o[o.VAL_BANG=47]="VAL_BANG",o[o.VAL_BRC=48]="VAL_BRC",o[o.EXPR_SEMICOL=49]="EXPR_SEMICOL",o[o.ERROR_PUSH=50]="ERROR_PUSH",o[o.ERROR_POP=51]="ERROR_POP",o[o.ERROR_POP_DECL=52]="ERROR_POP_DECL",o[o.ERROR_SEMICOL=53]="ERROR_SEMICOL",o[o.VAL_PLUS=54]="VAL_PLUS",o[o.SELECTOR_PSEUDOCLASS_1=55]="SELECTOR_PSEUDOCLASS_1",o[o.SELECTOR_FOLLOWING_SIBLING=56]="SELECTOR_FOLLOWING_SIBLING",o[o.DONE=200]="DONE"})(S||(S={}));var ge,Hn=m.LAST+1,zn=m.LAST+2,Xi=m.LAST+3;Jt[m.IDENT]=S.IDENT,Jt[m.STAR]=S.SELECTOR_START,Jt[m.HASH]=S.SELECTOR_START,Jt[m.CLASS]=S.SELECTOR_START,Jt[m.O_BRK]=S.SELECTOR_START,Jt[m.COLON]=S.SELECTOR_START,Jt[m.AT]=S.AT,Jt[m.C_BRC]=S.RULE_END,Jt[m.EOF]=S.DONE,Wi[m.IDENT]=S.PROP,Wi[m.EOF]=S.DONE,Le[m.IDENT]=S.SELECTOR_NAME,Le[m.STAR]=S.SELECTOR_ANY,Le[m.HASH]=S.SELECTOR_ID,Le[m.CLASS]=S.SELECTOR_CLASS,Le[m.O_BRK]=S.SELECTOR_ATTR,Le[m.COLON]=S.SELECTOR_PSEUDOCLASS,_t[m.GT]=S.SELECTOR_CHILD,_t[m.PLUS]=S.SELECTOR_SIBLING,_t[m.TILDE]=S.SELECTOR_FOLLOWING_SIBLING,_t[m.IDENT]=S.SELECTOR_NAME_1,_t[m.STAR]=S.SELECTOR_ANY_1,_t[m.HASH]=S.SELECTOR_ID_1,_t[m.CLASS]=S.SELECTOR_CLASS_1,_t[m.O_BRK]=S.SELECTOR_ATTR_1,_t[m.O_BRC]=S.SELECTOR_BODY,_t[m.COLON]=S.SELECTOR_PSEUDOCLASS_1,_t[m.COL_COL]=S.SELECTOR_PSEUDOELEM,_t[m.COMMA]=S.SELECTOR_NEXT,te[m.IDENT]=S.SELECTOR_NAME_1,te[m.STAR]=S.SELECTOR_ANY_1,te[m.HASH]=S.SELECTOR_ID_1,te[m.CLASS]=S.SELECTOR_CLASS_1,te[m.O_BRK]=S.SELECTOR_ATTR_1,te[m.C_PAR]=S.DONE,te[m.COLON]=S.SELECTOR_PSEUDOCLASS_1,je[m.IDENT]=S.SELECTOR_NAME,je[m.STAR]=S.SELECTOR_ANY,je[m.HASH]=S.SELECTOR_ID,je[m.CLASS]=S.SELECTOR_CLASS,je[m.COLON]=S.SELECTOR_PSEUDOCLASS,je[m.COL_COL]=S.SELECTOR_PSEUDOELEM,je[m.O_BRK]=S.SELECTOR_ATTR,je[m.O_BRC]=S.SELECTOR_BODY,Kt[m.IDENT]=S.VAL_IDENT,Kt[m.HASH]=S.VAL_HASH,Kt[m.NUM]=S.VAL_NUM,Kt[m.INT]=S.VAL_INT,Kt[m.NUMERIC]=S.VAL_NUMERIC,Kt[m.STR]=S.VAL_STR,Kt[m.URL]=S.VAL_URL,Kt[m.COMMA]=S.VAL_COMMA,Kt[m.SLASH]=S.VAL_SLASH,Kt[m.FUNC]=S.VAL_FUNC,Kt[m.C_PAR]=S.VAL_C_PAR,Kt[m.SEMICOL]=S.VAL_END,Kt[m.C_BRC]=S.VAL_BRC,Kt[m.BANG]=S.VAL_BANG,Kt[m.PLUS]=S.VAL_PLUS,Kt[m.EOF]=S.VAL_FINISH,ue[m.IDENT]=S.EXPR_IDENT,ue[m.NUM]=S.EXPR_NUM,ue[m.INT]=S.EXPR_NUM,ue[m.NUMERIC]=S.EXPR_NUMERIC,ue[m.STR]=S.EXPR_STR,ue[m.O_PAR]=S.EXPR_O_PAR,ue[m.FUNC]=S.EXPR_FUNC,ue[m.BANG]=S.EXPR_PREFIX,ue[m.MINUS]=S.EXPR_PREFIX,ue[m.DOLLAR]=S.EXPR_PARAM,kt[m.IDENT]=S.EXPR_INFIX_NAME,kt[m.COMMA]=S.EXPR_INFIX,kt[m.GT]=S.EXPR_INFIX,kt[m.LT]=S.EXPR_INFIX,kt[m.GT_EQ]=S.EXPR_INFIX,kt[m.LT_EQ]=S.EXPR_INFIX,kt[m.EQ]=S.EXPR_INFIX,kt[m.EQ_EQ]=S.EXPR_INFIX,kt[m.BANG_EQ]=S.EXPR_INFIX,kt[m.AMP_AMP]=S.EXPR_INFIX,kt[m.BAR_BAR]=S.EXPR_INFIX,kt[m.PLUS]=S.EXPR_INFIX,kt[m.MINUS]=S.EXPR_INFIX,kt[m.SLASH]=S.EXPR_INFIX,kt[m.PERCENT]=S.EXPR_INFIX,kt[m.STAR]=S.EXPR_INFIX,kt[m.COLON]=S.EXPR_INFIX,kt[m.QMARK]=S.EXPR_INFIX,kt[m.C_PAR]=S.EXPR_C_PAR,kt[m.O_BRC]=S.EXPR_O_BRC,kt[m.SEMICOL]=S.EXPR_SEMICOL,ee[m.EOF]=S.DONE,ee[m.O_BRC]=S.ERROR_PUSH,ee[m.C_BRC]=S.ERROR_POP,ee[m.O_BRK]=S.ERROR_PUSH,ee[m.C_BRK]=S.ERROR_POP,ee[m.O_PAR]=S.ERROR_PUSH,ee[m.C_PAR]=S.ERROR_POP,ee[m.SEMICOL]=S.ERROR_SEMICOL,ye[m.EOF]=S.DONE,ye[m.O_BRC]=S.ERROR_PUSH,ye[m.C_BRC]=S.ERROR_POP_DECL,ye[m.O_BRK]=S.ERROR_PUSH,ye[m.C_BRK]=S.ERROR_POP,ye[m.O_PAR]=S.ERROR_PUSH,ye[m.C_PAR]=S.ERROR_POP,ye[m.SEMICOL]=S.ERROR_SEMICOL,le[m.EOF]=S.DONE,le[m.O_BRC]=S.ERROR_PUSH,le[m.C_BRC]=S.ERROR_POP,le[m.O_BRK]=S.ERROR_PUSH,le[m.C_BRK]=S.ERROR_POP,le[m.O_PAR]=S.ERROR_PUSH,le[m.C_PAR]=S.ERROR_POP,Wt[m.C_PAR]=0,Wt[m.COMMA]=0,Wt[m.QMARK]=1,Wt[m.COLON]=1,Wt[m.AMP_AMP]=2,Wt[m.BAR_BAR]=2,Wt[m.LT]=3,Wt[m.GT]=3,Wt[m.LT_EQ]=3,Wt[m.GT_EQ]=3,Wt[m.EQ]=3,Wt[m.EQ_EQ]=3,Wt[m.BANG_EQ]=3,Wt[m.PLUS]=4,Wt[m.MINUS]=4,Wt[m.STAR]=5,Wt[m.SLASH]=5,Wt[m.PERCENT]=5,Wt[m.EOF]=6,Wt[Hn]=2,Wt[zn]=2,function(o){o[o.PROP=0]="PROP",o[o.WHEN=1]="WHEN",o[o.MEDIA=2]="MEDIA",o[o.IMPORT=3]="IMPORT",o[o.SUPPORTS=4]="SUPPORTS"}(ge||(ge={}));var ji=function(){function o(e,t,n,i){this.actions=void 0,this.tokenizer=void 0,this.handler=void 0,this.baseURL=void 0,this.valStack=[],this.namespacePrefixToURI={},this.defaultNamespaceURI=null,this.propName=null,this.propImportant=!1,this.exprContext=void 0,this.result=null,this.importReady=!1,this.importURL=null,this.importCondition=null,this.errorBrackets=[],this.ruleStack=[],this.regionRule=!1,this.pageRule=!1,this.actions=e,this.tokenizer=t,this.handler=n,this.baseURL=i,this.exprContext=ge.MEDIA}var r=o.prototype;return r.extractVals=function(e,t){for(var n=[],i=this.valStack;t<i.length&&(n.push(i[t++]),t!=i.length);)if(i[t++]!=e)throw new Error("Unexpected state");return n},r.valStackReduce=function(e,t){var n,i=this.valStack,a=i.length;do n=i[--a];while(n!==void 0&&typeof n!="string");var s=i.length-(a+1);if(s>1&&i.splice(a+1,s,new fe(i.slice(a+1,i.length))),e==",")return null;a++;do n=i[--a];while(n!==void 0&&(typeof n!="string"||n==","));if(s=i.length-(a+1),n=="("){if(e!=")")return this.handler.error("E_CSS_MISMATCHED_C_PAR",t),this.actions=ye,null;var u=new qr(i[a-1],this.extractVals(",",a+1));return i.splice(a-1,s+2,u),null}return e!=";"||a>=0?(this.handler.error("E_CSS_UNEXPECTED_VAL_END",t),this.actions=ye,null):s>1?new Te(this.extractVals(",",a+1)):i[0]},r.exprError=function(e,t){this.actions=this.propName?ye:ee,M.warn(e)},r.exprStackReduce=function(e,t){for(var n,i=this.valStack,a=this.handler,s=i.pop();;){var u=i.pop();if(e==m.C_PAR){for(var h=[s];u==m.COMMA;)h.unshift(i.pop()),u=i.pop();if(typeof u=="string"){if(u=="{"){for(;h.length>=2;){var c=h.shift(),d=h.shift(),f=new Xl(a.getScope(),c,d);h.unshift(f)}return i.push(new Z(h[0])),!0}if(u=="("){var v=i.pop(),g=i.pop();s=new ii(a.getScope(),_r(g,v),h),e=m.EOF;continue}}if(u==m.O_PAR){s.isMediaName()&&(s=new Ga(a.getScope(),s,null)),e=m.EOF;continue}}else if(typeof u=="string"){i.push(u);break}if(u<0)if(u==-m.BANG)s=new dn(a.getScope(),s);else if(u==-m.MINUS)s=new _a(a.getScope(),s);else{if(u!=-Xi)return this.exprError("F_UNEXPECTED_STATE",t),!1;s=new Gl(a.getScope(),s)}else{if(Wt[e]>Wt[u]){i.push(u);break}switch(n=i.pop(),u){case m.AMP_AMP:s=new Hr(a.getScope(),n,s);break;case Hn:s=new Wl(a.getScope(),n,s);break;case zn:s=new jl(a.getScope(),n,s);break;case m.BAR_BAR:s=new zr(a.getScope(),n,s);break;case m.LT:s=new Yl(a.getScope(),n,s);break;case m.GT:s=new ql(a.getScope(),n,s);break;case m.LT_EQ:s=new Kl(a.getScope(),n,s);break;case m.GT_EQ:s=new Gr(a.getScope(),n,s);break;case m.EQ:case m.EQ_EQ:s=new Wr(a.getScope(),n,s);break;case m.BANG_EQ:s=new Ql(a.getScope(),n,s);break;case m.PLUS:s=new Ma(a.getScope(),n,s);break;case m.MINUS:s=new Ua(a.getScope(),n,s);break;case m.STAR:s=new Xr(a.getScope(),n,s);break;case m.SLASH:s=new Va(a.getScope(),n,s);break;case m.PERCENT:s=new Ha(a.getScope(),n,s);break;case m.COLON:if(!(i.length>1))return this.exprError("E_CSS_EXPR_COND",t),!1;switch(i[i.length-1]){case m.QMARK:i.pop(),s=new Zl(a.getScope(),i.pop(),n,s);break;case m.O_PAR:if(!n.isMediaName())return this.exprError("E_CSS_MEDIA_TEST",t),!1;s=new Ga(a.getScope(),n,s)}break;case m.QMARK:if(e!=m.COLON)return this.exprError("E_CSS_EXPR_COND",t),!1;case m.O_PAR:return i.push(n),i.push(u),i.push(s),!1;default:return this.exprError("F_UNEXPECTED_STATE",t),!1}}}return i.push(s),!1},r.readSupportsTest=function(e){var t,n,i=e.type===m.FUNC,a=this.tokenizer;if(i)t=e.position+(n=e.text).length+1;else{if(e.type!==m.O_PAR)return null;var s=a.nthToken(1),u=a.nthToken(2);if(s.type===m.IDENT&&u.type===m.COLON)a.consume(),a.consume(),n=s.text,t=u.position+1;else{if(s.type===m.O_PAR||s.type===m.FUNC||s.type===m.IDENT&&s.text.toLowerCase()==="not"&&(u.type===m.O_PAR||u.type===m.FUNC))return null;t=e.position+1}}for(var h,c=0;c>=0;)switch(a.consume(),(h=a.token()).type){case m.C_PAR:c--;break;case m.O_PAR:case m.FUNC:c++;break;case m.INVALID:case m.EOF:return this.exprError("E_CSS_UNEXPECTED_EOF",h),null}a.consume();var d=a.input.substring(t,h.position).trim();return new $l(this.handler.getScope(),n,d,i)},r.readPseudoParams=function(){for(var e=[];;){var t=this.tokenizer.token();switch(t.type){case m.IDENT:e.push(t.text);break;case m.PLUS:e.push("+");break;case m.NUM:case m.INT:e.push(t.num);break;default:return e}this.tokenizer.consume()}},r.readNthPseudoParams=function(){var e=!1,t=this.tokenizer.token();if(t.type===m.PLUS)e=!0,this.tokenizer.consume(),t=this.tokenizer.token();else if(t.type===m.IDENT&&(t.text==="even"||t.text==="odd"))return this.tokenizer.consume(),[2,t.text==="odd"?1:0];switch(t.type){case m.NUMERIC:if(e&&t.num<0)return null;case m.IDENT:if(e&&t.text.charAt(0)==="-")return null;if(t.text==="n"||t.text==="-n"){if(e&&t.precededBySpace)return null;var n=t.text==="-n"?-1:1;t.type===m.NUMERIC&&(n=t.num);var i=0;this.tokenizer.consume();var a=(t=this.tokenizer.token()).type===m.MINUS,s=t.type===m.PLUS||a;if(s&&(this.tokenizer.consume(),t=this.tokenizer.token()),t.type===m.INT){if(1/(i=t.num)==1/-0){if(i=0,s)return null}else if(i<0){if(s)return null}else if(i>=0&&!s)return null;this.tokenizer.consume()}else if(s)return null;return[n,a&&i>0?-i:i]}if(t.text==="n-"||t.text==="-n-"){if(e&&t.precededBySpace)return null;var u=t.text==="-n-"?-1:1;if(t.type===m.NUMERIC&&(u=t.num),this.tokenizer.consume(),(t=this.tokenizer.token()).type===m.INT)return t.num<0||1/t.num==1/-0?null:(this.tokenizer.consume(),[u,t.num])}else{var h=t.text.match(/^n(-[0-9]+)$/);if(h)return e&&t.precededBySpace?null:(this.tokenizer.consume(),[t.type===m.NUMERIC?t.num:1,parseInt(h[1],10)]);if(h=t.text.match(/^-n(-[0-9]+)$/))return this.tokenizer.consume(),[-1,parseInt(h[1],10)]}return null;case m.INT:return e&&(t.precededBySpace||t.num<0)?null:(this.tokenizer.consume(),[0,t.num])}return null},r.makeCondition=function(e,t){var n=this.handler.getScope();if(!n)return null;if(t=t||n._true,e)for(var i,a=B(e.split(/\s+/));!(i=a()).done;)switch(i.value){case"vertical":t=We(n,t,new dn(n,new ie(n,"pref-horizontal")));break;case"horizontal":t=We(n,t,new ie(n,"pref-horizontal"));break;case"day":t=We(n,t,new dn(n,new ie(n,"pref-night-mode")));break;case"night":t=We(n,t,new ie(n,"pref-night-mode"));break;default:t=n._false}return t===n._true?null:new Z(t)},r.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},r.runParser=function(e,t,n,i,a){var s,u,h,c,d,f,v,g=this.handler,p=this.tokenizer,E=this.valStack;i&&(this.exprContext=ge.MEDIA,this.valStack.push("{"));t:for(;e>0;--e)switch(s=p.token(),this.actions[s.type]){case S.IDENT:if(p.nthToken(1).type!=m.COLON){this.isInsidePropertyOnlyRule()?(g.error("E_CSS_COLON_EXPECTED",p.nthToken(1)),this.actions=ye):(this.actions=Le,g.startSelectorRule());continue}(u=p.nthToken(2)).precededBySpace||u.type!=m.IDENT&&u.type!=m.FUNC||p.mark(),this.propName=s.text,this.propImportant=!1,p.consume(),p.consume(),this.actions=Kt,E.splice(0,E.length);continue;case S.PROP:if(p.nthToken(1).type!=m.COLON){this.actions=ye,g.error("E_CSS_COLON_EXPECTED",p.nthToken(1));continue}this.propName=s.text,this.propImportant=!1,p.consume(),p.consume(),this.actions=Kt,E.splice(0,E.length);continue;case S.SELECTOR_START:this.actions=Le,g.startSelectorRule();continue;case S.SELECTOR_NAME_1:if(!s.precededBySpace){this.actions=le,g.error("E_CSS_SPACE_EXPECTED",s);continue}g.descendantSelector();case S.SELECTOR_NAME:if(p.nthToken(1).type==m.BAR)if(p.consume(),p.consume(),(h=this.namespacePrefixToURI[s.text])!=null)switch((s=p.token()).type){case m.IDENT:g.tagSelector(h,s.text),this.actions=a?te:_t,p.consume();break;case m.STAR:g.tagSelector(h,null),this.actions=a?te:_t,p.consume();break;default:this.actions=ee,g.error("E_CSS_NAMESPACE",s)}else this.actions=ee,g.error("E_CSS_UNDECLARED_PREFIX",s);else g.tagSelector(this.defaultNamespaceURI,s.text),this.actions=a?te:_t,p.consume();continue;case S.SELECTOR_ANY_1:if(!s.precededBySpace){this.actions=le,g.error("E_CSS_SPACE_EXPECTED",s);continue}g.descendantSelector();case S.SELECTOR_ANY:if(p.nthToken(1).type==m.BAR)switch(p.consume(),p.consume(),(s=p.token()).type){case m.IDENT:g.tagSelector(null,s.text),this.actions=a?te:_t,p.consume();break;case m.STAR:g.tagSelector(null,null),this.actions=a?te:_t,p.consume();break;default:this.actions=ee,g.error("E_CSS_NAMESPACE",s)}else g.tagSelector(this.defaultNamespaceURI,null),this.actions=a?te:_t,p.consume();continue;case S.SELECTOR_ID_1:s.precededBySpace&&g.descendantSelector();case S.SELECTOR_ID:g.idSelector(s.text),this.actions=a?te:_t,p.consume();continue;case S.SELECTOR_CLASS_1:s.precededBySpace&&g.descendantSelector();case S.SELECTOR_CLASS:g.classSelector(s.text),this.actions=a?te:_t,p.consume();continue;case S.SELECTOR_PSEUDOCLASS_1:s.precededBySpace&&g.descendantSelector();case S.SELECTOR_PSEUDOCLASS:p.consume();e:switch((s=p.token()).type){case m.IDENT:g.pseudoclassSelector(s.text,null),p.consume(),this.actions=a?te:_t;continue;case m.FUNC:switch(c=s.text,p.consume(),c){case"not":this.actions=Le,g.startFuncWithSelector("not"),this.actions=this.runParser(Number.POSITIVE_INFINITY,!1,!1,!1,!0)?_t:le;break t;case"lang":case"href-epub-type":if((s=p.token()).type===m.IDENT){v=[s.text],p.consume();break}break e;case"nth-child":case"nth-of-type":case"nth-last-child":case"nth-last-of-type":case"nth":if(v=this.readNthPseudoParams())break;break e;default:v=this.readPseudoParams()}if((s=p.token()).type==m.C_PAR){g.pseudoclassSelector(c,v),p.consume(),this.actions=a?te:_t;continue}}g.error("E_CSS_PSEUDOCLASS_SYNTAX",s),this.actions=ee;continue;case S.SELECTOR_PSEUDOELEM:switch(p.consume(),(s=p.token()).type){case m.IDENT:g.pseudoelementSelector(s.text,null),this.actions=a?te:_t,p.consume();continue;case m.FUNC:if(c=s.text,p.consume(),c=="nth-fragment"){if((v=this.readNthPseudoParams())===null)break}else v=this.readPseudoParams();if((s=p.token()).type==m.C_PAR){g.pseudoelementSelector(c,v),this.actions=a?te:_t,p.consume();continue}}g.error("E_CSS_PSEUDOELEM_SYNTAX",s),this.actions=ee;continue;case S.SELECTOR_ATTR_1:s.precededBySpace&&g.descendantSelector();case S.SELECTOR_ATTR:if(p.consume(),(s=p.token()).type==m.IDENT)c=s.text,p.consume();else if(s.type==m.STAR)c=null,p.consume();else{if(s.type!=m.BAR){this.actions=le,g.error("E_CSS_ATTR",s),p.consume();continue}c=""}if((s=p.token()).type==m.BAR){if((h=c&&this.namespacePrefixToURI[c])==null){this.actions=le,g.error("E_CSS_UNDECLARED_PREFIX",s),p.consume();continue}if(p.consume(),(s=p.token()).type!=m.IDENT){this.actions=le,g.error("E_CSS_ATTR_NAME_EXPECTED",s);continue}c=s.text,p.consume(),s=p.token()}else h="";switch(s.type){case m.EQ:case m.TILDE_EQ:case m.BAR_EQ:case m.HAT_EQ:case m.DOLLAR_EQ:case m.STAR_EQ:case m.COL_COL:d=s.type,p.consume(),s=p.token();break;case m.C_BRK:g.attributeSelector(h,c,m.EOF,null),this.actions=a?te:_t,p.consume();continue;default:this.actions=le,g.error("E_CSS_ATTR_OP_EXPECTED",s);continue}switch(s.type){case m.IDENT:case m.STR:g.attributeSelector(h,c,d,s.text),p.consume(),s=p.token();break;default:this.actions=le,g.error("E_CSS_ATTR_VAL_EXPECTED",s);continue}if(s.type!=m.C_BRK){this.actions=le,g.error("E_CSS_ATTR",s);continue}this.actions=a?te:_t,p.consume();continue;case S.SELECTOR_CHILD:g.childSelector(),this.actions=je,p.consume();continue;case S.SELECTOR_SIBLING:g.adjacentSiblingSelector(),this.actions=je,p.consume();continue;case S.SELECTOR_FOLLOWING_SIBLING:g.followingSiblingSelector(),this.actions=je,p.consume();continue;case S.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]"),g.startRuleBody(),this.actions=Jt,p.consume();continue;case S.SELECTOR_NEXT:g.nextSelector(),this.actions=Le,p.consume();continue;case S.VAL_IDENT:E.push(_(s.text)),p.consume();continue;case S.VAL_HASH:d=parseInt(s.text,16);try{E.push(ms(s.text))}catch(x){g.error("E_CSS_COLOR",s),this.actions=ee}p.consume();continue;case S.VAL_NUM:E.push(new ri(s.num)),p.consume();continue;case S.VAL_INT:E.push(new xn(s.num)),p.consume();continue;case S.VAL_NUMERIC:Ra(s.text)?E.push(new Z(new Mn(g.getScope(),s.num,s.text))):E.push(new O(s.num,s.text)),p.consume();continue;case S.VAL_STR:E.push(new Ae(s.text)),p.consume();continue;case S.VAL_URL:E.push(new pn(wt(s.text,this.baseURL))),p.consume();continue;case S.VAL_COMMA:this.valStackReduce(",",s),E.push(","),p.consume();continue;case S.VAL_SLASH:E.push(Mi),p.consume();continue;case S.VAL_FUNC:(c=s.text.toLowerCase())=="-epubx-expr"||c=="calc"||c=="env"?(this.actions=ue,this.exprContext=ge.PROP,E.push("{")):(E.push(c),E.push("(")),p.consume();continue;case S.VAL_C_PAR:this.valStackReduce(")",s),p.consume();continue;case S.VAL_BANG:if(p.consume(),s=p.token(),u=p.nthToken(1),s.type==m.IDENT&&s.text.toLowerCase()=="important"&&(u.type==m.SEMICOL||u.type==m.EOF||u.type==m.C_BRC)){p.consume(),this.propImportant=!0;continue}this.exprError("E_CSS_SYNTAX",s);continue;case S.VAL_PLUS:switch((u=p.nthToken(1)).type){case m.NUM:case m.NUMERIC:case m.INT:if(!u.precededBySpace){p.consume();continue}}if(this.actions===Kt&&p.hasMark()){p.reset(),this.actions=Le,g.startSelectorRule();continue}this.exprError("E_CSS_UNEXPECTED_PLUS",s);continue;case S.VAL_END:p.consume();case S.VAL_BRC:p.unmark(),(f=this.valStackReduce(";",s))&&this.propName&&g.property(this.propName,f,this.propImportant),this.actions=n?Wi:Jt;continue;case S.VAL_FINISH:if(p.consume(),p.unmark(),f=this.valStackReduce(";",s),t)return this.result=f,!0;if(this.propName&&f&&g.property(this.propName,f,this.propImportant),n)return!0;this.exprError("E_CSS_SYNTAX",s);continue;case S.EXPR_IDENT:if((u=p.nthToken(1)).type==m.CLASS)p.nthToken(2).type!=m.O_PAR||p.nthToken(2).precededBySpace?(E.push(new ie(g.getScope(),_r(s.text,u.text))),this.actions=kt):(E.push(s.text,u.text,"("),p.consume()),p.consume();else{if(this.exprContext==ge.MEDIA||this.exprContext==ge.IMPORT)s.text.toLowerCase()=="not"?(p.consume(),E.push(new za(g.getScope(),!0,u.text))):(s.text.toLowerCase()=="only"&&(p.consume(),s=u),E.push(new za(g.getScope(),!1,s.text)));else{if(this.exprContext===ge.SUPPORTS&&s.text.toLowerCase()==="not"&&E[E.length-1]!==Hn&&E[E.length-1]!==zn&&(u.type===m.O_PAR||u.type===m.FUNC)){E.push(-Xi),p.consume();continue}E.push(new ie(g.getScope(),s.text))}this.actions=kt}p.consume();continue;case S.EXPR_FUNC:if(this.exprContext===ge.SUPPORTS){E.push(this.readSupportsTest(s)),this.actions=kt;continue}E.push(null,s.text,"("),p.consume();continue;case S.EXPR_NUM:E.push(new re(g.getScope(),s.num)),p.consume(),this.actions=kt;continue;case S.EXPR_NUMERIC:(c=s.text)=="%"&&(c=this.propName&&this.propName.match(/height|^(top|bottom)$/)?"vh":"vw"),E.push(new Mn(g.getScope(),s.num,c)),p.consume(),this.actions=kt;continue;case S.EXPR_STR:E.push(new re(g.getScope(),s.text)),p.consume(),this.actions=kt;continue;case S.EXPR_PARAM:p.consume(),(s=p.token()).type!=m.INT||s.precededBySpace?this.exprError("E_CSS_SYNTAX",s):(E.push(new Wa(g.getScope(),s.num)),p.consume(),this.actions=kt);continue;case S.EXPR_PREFIX:E.push(-s.type),p.consume();continue;case S.EXPR_INFIX:this.actions=ue,this.exprStackReduce(s.type,s),E.push(s.type),p.consume();continue;case S.EXPR_INFIX_NAME:s.text.toLowerCase()==="and"&&E[E.length-2]!==zn&&E[E.length-2]!==-Xi?(this.actions=ue,this.exprStackReduce(Hn,s),E.push(Hn),p.consume()):s.text.toLowerCase()==="or"&&E[E.length-2]!==Hn&&E[E.length-2]!==-Xi?(this.actions=ue,this.exprStackReduce(zn,s),E.push(zn),p.consume()):this.exprError("E_CSS_SYNTAX",s);continue;case S.EXPR_C_PAR:this.exprStackReduce(s.type,s)&&(this.actions=Kt),p.consume();continue;case S.EXPR_O_BRC:this.exprStackReduce(m.C_PAR,s)&&(this.propName||this.exprContext==ge.IMPORT?this.exprError("E_CSS_UNEXPECTED_BRC",s):(this.exprContext==ge.WHEN?g.startWhenRule(E.pop()):g.startMediaRule(E.pop()),this.ruleStack.push("media"),g.startRuleBody(),this.actions=Jt)),p.consume();continue;case S.EXPR_SEMICOL:if(this.exprStackReduce(m.C_PAR,s))return this.propName||this.exprContext!=ge.IMPORT?(this.exprError("E_CSS_UNEXPECTED_SEMICOL",s),this.actions=Jt,p.consume(),!1):(this.importCondition=E.pop(),this.importReady=!0,this.actions=Jt,p.consume(),!1);p.consume();continue;case S.EXPR_O_PAR:if(this.exprContext===ge.SUPPORTS){var C=this.readSupportsTest(s);if(C){E.push(C),this.actions=kt;continue}}E.push(s.type),p.consume();continue;case S.RULE_END:this.actions=Jt,p.consume(),g.endRule(),this.ruleStack.length&&this.ruleStack.pop();continue;case S.AT:switch(c=s.text.toLowerCase()){case"import":if(p.consume(),(s=p.token()).type==m.STR||s.type==m.URL){if(this.importURL=s.text,p.consume(),(s=p.token()).type==m.SEMICOL||s.type==m.EOF)return this.importReady=!0,p.consume(),!1;this.propName=null,this.exprContext=ge.IMPORT,this.actions=ue,E.push("{");continue}g.error("E_CSS_IMPORT_SYNTAX",s),this.actions=ee;continue;case"namespace":switch(p.consume(),(s=p.token()).type){case m.IDENT:if(c=s.text,p.consume(),((s=p.token()).type==m.STR||s.type==m.URL)&&p.nthToken(1).type==m.SEMICOL){this.namespacePrefixToURI[c]=s.text,p.consume(),p.consume();continue}break;case m.STR:case m.URL:if(p.nthToken(1).type==m.SEMICOL){this.defaultNamespaceURI=s.text,p.consume(),p.consume();continue}}g.error("E_CSS_NAMESPACE_SYNTAX",s),this.actions=ee;continue;case"charset":if(p.consume(),(s=p.token()).type==m.STR&&p.nthToken(1).type==m.SEMICOL){(c=s.text.toLowerCase())!="utf-8"&&c!="utf-16"&&g.error("E_CSS_UNEXPECTED_CHARSET "+c,s),p.consume(),p.consume();continue}g.error("E_CSS_CHARSET_SYNTAX",s),this.actions=ee;continue;case"font-face":case"-epubx-page-template":case"-epubx-define":case"-epubx-viewport":if(p.nthToken(1).type==m.O_BRC){switch(p.consume(),p.consume(),c){case"font-face":g.startFontFaceRule();break;case"-epubx-page-template":g.startPageTemplateRule();break;case"-epubx-define":g.startDefineRule();break;case"-epubx-viewport":g.startViewportRule()}this.ruleStack.push(c),g.startRuleBody();continue}break;case"-adapt-footnote-area":switch(p.consume(),(s=p.token()).type){case m.O_BRC:p.consume(),g.startFootnoteRule(null),this.ruleStack.push(c),g.startRuleBody();continue;case m.COL_COL:if(p.consume(),(s=p.token()).type==m.IDENT&&p.nthToken(1).type==m.O_BRC){c=s.text,p.consume(),p.consume(),g.startFootnoteRule(c),this.ruleStack.push("-adapt-footnote-area"),g.startRuleBody();continue}}break;case"-epubx-region":p.consume(),g.startRegionRule(),this.regionRule=!0,this.actions=Le;continue;case"page":p.consume(),g.startPageRule(),this.pageRule=!0,this.actions=je;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(p.consume(),(s=p.token()).type==m.O_BRC){p.consume(),g.startPageMarginBoxRule(c),this.ruleStack.push(c),g.startRuleBody();continue}break;case"-epubx-when":p.consume(),this.propName=null,this.exprContext=ge.WHEN,this.actions=ue,E.push("{");continue;case"media":p.consume(),this.propName=null,this.exprContext=ge.MEDIA,this.actions=ue,E.push("{");continue;case"supports":p.consume(),this.propName=null,this.exprContext=ge.SUPPORTS,this.actions=ue,E.push("{");continue;case"-epubx-flow":if(p.nthToken(1).type==m.IDENT&&p.nthToken(2).type==m.O_BRC){g.startFlowRule(p.nthToken(1).text),p.consume(),p.consume(),p.consume(),this.ruleStack.push(c),g.startRuleBody();continue}break;case"-epubx-page-master":case"-epubx-partition":case"-epubx-partition-group":p.consume();var D=null,y=null,N=[];for((s=p.token()).type==m.IDENT&&(D=s.text,p.consume(),s=p.token()),s.type==m.COLON&&p.nthToken(1).type==m.IDENT&&(y=p.nthToken(1).text,p.consume(),p.consume(),s=p.token());s.type==m.FUNC&&s.text.toLowerCase()=="class"&&p.nthToken(1).type==m.IDENT&&p.nthToken(2).type==m.C_PAR;)N.push(p.nthToken(1).text),p.consume(),p.consume(),p.consume(),s=p.token();if(s.type==m.O_BRC){switch(p.consume(),c){case"-epubx-page-master":g.startPageMasterRule(D,y,N);break;case"-epubx-partition":g.startPartitionRule(D,y,N);break;case"-epubx-partition-group":g.startPartitionGroupRule(D,y,N)}this.ruleStack.push(c),g.startRuleBody();continue}break;case"":g.error("E_CSS_UNEXPECTED_AT"+c,s),this.actions=le;continue;default:g.error("E_CSS_AT_UNKNOWN "+c,s),this.actions=ee;continue}g.error("E_CSS_AT_SYNTAX "+c,s),this.actions=ee;continue;case S.ERROR_PUSH:if(t||n)return!0;this.errorBrackets.push(s.type+1),p.consume();continue;case S.ERROR_POP_DECL:if(t||n)return!0;if(this.errorBrackets.length==0){this.actions=Jt;continue}case S.ERROR_POP:this.errorBrackets.length>0&&this.errorBrackets[this.errorBrackets.length-1]==s.type&&this.errorBrackets.pop(),this.errorBrackets.length==0&&s.type==m.C_BRC&&(this.actions=Jt),p.consume();continue;case S.ERROR_SEMICOL:if(t||n)return!0;this.errorBrackets.length==0&&(this.actions=Jt),p.consume();continue;case S.DONE:return a&&(p.consume(),g.endFuncWithSelector()),!0;default:if(t||n)return!0;if(i)return!!this.exprStackReduce(m.C_PAR,s)&&(this.result=E.pop(),!0);if(a)return g.error(s.type==m.INVALID?s.text:"E_CSS_SYNTAX",s),!1;if(this.actions===Kt&&p.hasMark()){p.reset(),this.actions=Le,g.startSelectorRule();continue}if(this.actions!==ee&&this.actions!==le&&this.actions!==ye){if(s.type==m.INVALID)g.error(s.text,s);else{if(s.type===m.O_BRC){g.startMediaRule(E.pop()),this.ruleStack.push("media"),g.startRuleBody(),this.actions=Jt,p.consume();continue}if(s.type===m.SEMICOL)return this.actions=Jt,p.consume(),!1;g.error("E_CSS_SYNTAX",s)}this.actions=this.isInsidePropertyOnlyRule()?ye:le;continue}p.consume();continue}return!1},o}(),Cs=function(o){function r(t){var n;return(n=o.call(this,null)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.error=function(t,n){throw new Error(t)},e.getScope=function(){return this.scope},r}(ho);function co(o,r,e,t,n){return Vn("parseStylesheetFromText",function(i){(function(a,s,u,h,c){var d=L("parseStylesheet"),f=new ji(Jt,a,s,u),v=null;return c&&(v=function(g,p,E){var C=new ji(ue,g,p,E);return C.runParser(Number.POSITIVE_INFINITY,!1,!1,!0,!1),C.result}(new mn(c,s),s,u)),(v=f.makeCondition(h,v&&v.toExpr()))&&(s.startMediaRule(v),s.startRuleBody()),d.loop(function(){for(;!f.runParser(100,!1,!1,!1,!1);){if(f.importReady){var g=function(){var E=wt(f.importURL,u);f.importCondition&&(s.startMediaRule(f.importCondition),s.startRuleBody());var C=L("parseStylesheet.import");return Ds(E,s,null,null).then(function(){f.importCondition&&s.endRule(),f.importReady=!1,f.importURL=null,f.importCondition=null,C.finish(!0)}),{v:C.result()}}();if(typeof g=="object")return g.v}var p=d.timeSlice();if(p.isPending)return p}return I(!1)}).then(function(){v&&s.endRule(),d.finish(!0)}),d.result()})(new mn(o,r),r,e,t,n).thenFinish(i)},function(i,a){M.warn(a,"Failed to parse stylesheet text: "+o),i.finish(!1)})}function Ds(o,r,e,t){return Vn("parseStylesheetFromURL",function(n){hi(o).then(function(i){i.responseText?co(i.responseText,r,o,e,t).then(function(a){a||M.warn("Failed to parse stylesheet from "+o),n.finish(!0)}):n.finish(!0)})},function(n,i){M.warn(i,"Exception while fetching and parsing:",o),n.finish(!0)})}function Yi(o,r,e){var t=new ji(Kt,r,new Cs(o),e);return t.runParser(Number.POSITIVE_INFINITY,!0,!1,!1,!1),t.result}var zh={"z-index":!0,"column-count":!0,"flow-linger":!0,opacity:!0,page:!0,"flow-priority":!0,utilization:!0};function Ki(o,r,e){if(r.isExpr()){try{return function(t,n,i){var a=n.evaluate(t);switch(typeof a){case"number":return function(s){return!!zh[s]}(i)?a==Math.round(a)?new xn(a):new ri(a):new O(a,"px");case"string":return a?Yi(n.scope,new mn(a,null),""):ht;case"boolean":return a?b._true:b._false;case"undefined":return ht}throw new Error("E_UNEXPECTED")}(o,r.expr,e)}catch(t){M.warn(t)}return ht}return r}function ws(o,r,e){return o-=e,r===0?o===0:o%r==0&&o/r>=0}var Gh=function(){function o(r){this.matchers=void 0,this.matchers=r}return o.prototype.matches=function(){return this.matchers.some(function(r){return r.matches()})},o}(),Wh=function(){function o(r){this.matchers=void 0,this.matchers=r}return o.prototype.matches=function(){return this.matchers.every(function(r){return r.matches()})},o}(),qi=function(){function o(r,e,t){this.elementOffset=void 0,this.a=void 0,this.b=void 0,this.elementOffset=r,this.a=e,this.b=t}return o.registerFragmentIndex=function(r,e,t){var n=o.fragmentIndices;(!n[r]||n[r].priority<=t)&&(n[r]={fragmentIndex:e,priority:t})},o.clearFragmentIndices=function(){o.fragmentIndices={}},o.prototype.matches=function(){var r=o.fragmentIndices[this.elementOffset];return r!=null&&r.fragmentIndex!=null&&ws(r.fragmentIndex,this.a,this.b)},o}();qi.fragmentIndices={};var fo,Gn,po,Pn,En,Rn,Qi=function(){function o(){}return o.buildViewConditionMatcher=function(r,e){var t=e.split("_");return t[0]=="NFS"?new qi(r,parseInt(t[1],10),parseInt(t[2],10)):null},o.buildAllMatcher=function(r){return new Wh(r)},o.buildAnyMatcher=function(r){return new Gh(r)},o}();function ys(o){return o.reduce(function(r,e){return e[0]===Ce.default.DELETE?r:r+e[1]},"")}function Ns(o,r,e){var t=0,n=0;return o.some(function(i){for(var a=0;a<i[1].length;a++){switch(i[0]*e){case Ce.default.INSERT:t++;break;case Ce.default.DELETE:t--,n++;break;case Ce.default.EQUAL:n++}if(n>r)return!0}return!1}),Math.max(Math.min(r,n-1)+t,0)}(function(o){o.isInstanceOfBlockFormattingContext=function(r){return r&&r.formattingContextType==="Block"}})(fo||(fo={})),function(o){(function(r){r.INLINE="inline",r.COLUMN="column",r.REGION="region",r.PAGE="page"})(o.FloatReference||(o.FloatReference={}))}(Gn||(Gn={})),function(o){o.isInstanceOfAfterIfContinuesLayoutConstraint=function(r){return r&&r.flagmentLayoutConstraintType=="AfterIfContinue"}}(po||(po={})),function(o){o.isInstanceOfRepetitiveElementsOwnerFormattingContext=function(r){return!!r&&(r.formattingContextType==="RepetitiveElementsOwner"||En.isInstanceOfTableFormattingContext(r))},o.isInstanceOfRepetitiveElementsOwnerLayoutConstraint=function(r){return!!r&&(r.flagmentLayoutConstraintType==="RepetitiveElementsOwner"||En.isInstanceOfTableRowLayoutConstraint(r))}}(Pn||(Pn={})),function(o){o.isInstanceOfTableFormattingContext=function(r){return r&&r.formattingContextType==="Table"},o.isInstanceOfTableRowLayoutConstraint=function(r){return r&&r.flagmentLayoutConstraintType==="TableRow"}}(En||(En={})),function(o){(function(r){r[r.IGNORE=0]="IGNORE",r[r.NEWLINE=1]="NEWLINE",r[r.PRESERVE=2]="PRESERVE"})(o.Whitespace||(o.Whitespace={})),function(r){r[r.NONE=0]="NONE",r[r.CONTENT=1]="CONTENT",r[r.ROOTLESS=2]="ROOTLESS",r[r.ROOTED=3]="ROOTED"}(o.ShadowType||(o.ShadowType={}))}(Rn||(Rn={}));var Xh={transform:!0,"transform-origin":!0},jh={top:!0,bottom:!0,left:!0,right:!0},go=function(o,r,e){this.target=void 0,this.name=void 0,this.value=void 0,this.target=o,this.name=r,this.value=e},Yh={show:function(o){o.style.visibility="visible"},hide:function(o){o.style.visibility="hidden"},play:function(o){o.currentTime=0,o.play()},pause:function(o){o.pause()},resume:function(o){o.play()},mute:function(o){o.muted=!0},unmute:function(o){o.muted=!1}};function Kh(o,r){var e=Yh[r];return e?function(){for(var t=0;t<o.length;t++)try{e(o[t])}catch(n){}}:null}var Zi=function(o){function r(t,n){var i;return(i=o.call(this)||this).container=void 0,i.bleedBox=void 0,i.pageAreaElement=null,i.delayedItems=[],i.hrefHandler=void 0,i.elementsById={},i.dimensions={width:0,height:0},i.isFirstPage=!1,i.isLastPage=!1,i.isBlankPage=!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.container=t,i.bleedBox=n,i.hrefHandler=function(a){var s=a.currentTarget,u=s.getAttribute("href")||s.getAttributeNS(U.XLINK,"href");u&&i.dispatchEvent({type:"hyperlink",target:null,currentTarget:null,anchorElement:s,href:u,preventDefault:function(){a.preventDefault()}})},i}w(r,o);var e=r.prototype;return e.setAutoPageWidth=function(t){this.isAutoPageWidth=t,t?this.container.setAttribute(r.AUTO_PAGE_WIDTH_ATTRIBUTE,"true"):this.container.removeAttribute(r.AUTO_PAGE_WIDTH_ATTRIBUTE)},e.setAutoPageHeight=function(t){this.isAutoPageHeight=t,t?this.container.setAttribute(r.AUTO_PAGE_HEIGHT_ATTRIBUTE,"true"):this.container.removeAttribute(r.AUTO_PAGE_HEIGHT_ATTRIBUTE)},e.registerElementWithId=function(t,n){var i=this.elementsById[n];i?i.push(t):this.elementsById[n]=[t]},e.finish=function(t,n){var i=this;Object.keys(this.elementsById).forEach(function(E){for(var C=i.elementsById[E],D=0;D<C.length;)i.container.contains(C[D])?D++:C.splice(D,1);C.length===0&&delete i.elementsById[E]});for(var a=this.delayedItems,s=0;s<a.length;s++){var u=a[s];(u.target!==this.container||u.name!=="transform"||this.isAutoPageWidth||this.isAutoPageHeight)&&T(u.target,u.name,u.value.toString())}var h=n.getElementClientRect(this.container);this.dimensions.width=h.width,this.dimensions.height=h.height;for(var c=0;c<t.length;c++){var d=t[c],f=this.elementsById[d.ref],v=this.elementsById[d.observer];if(f&&v){var g=Kh(f,d.action);if(g)for(var p=0;p<v.length;p++)v[p].addEventListener(d.event,g,!1)}}},e.zoom=function(t){T(this.container,"transform","scale("+t+")")},e.getPageAreaElement=function(){return this.pageAreaElement||this.container},r}(Fr);Zi.AUTO_PAGE_WIDTH_ATTRIBUTE="data-vivliostyle-auto-page-width",Zi.AUTO_PAGE_HEIGHT_ATTRIBUTE="data-vivliostyle-auto-page-height";var Cn=Rn.Whitespace;function bs(o){switch(o){case"normal":case"nowrap":return Cn.IGNORE;case"pre-line":return Cn.NEWLINE;case"pre":case"pre-wrap":return Cn.PRESERVE;default:return null}}function $i(o,r){if(o.nodeType==1)return!1;var e=o.textContent;switch(r){case Cn.IGNORE:return!!e.match(/^\s*$/);case Cn.NEWLINE:return!!e.match(/^[ \t\f]*$/);case Cn.PRESERVE:return e.length==0}throw new Error("Unexpected whitespace: "+r)}var qh=function(o,r){this.flowName=void 0,this.parentFlowName=void 0,this.forcedBreakOffsets=[],this.formattingContext=null,this.flowName=o,this.parentFlowName=r},Qh=function(){function o(r,e,t,n,i,a,s,u,h){this.flowName=void 0,this.element=void 0,this.startOffset=void 0,this.priority=void 0,this.linger=void 0,this.exclusive=void 0,this.repeated=void 0,this.last=void 0,this.breakBefore=void 0,this.startPage=-1,this.flowName=r,this.element=e,this.startOffset=t,this.priority=n,this.linger=i,this.exclusive=a,this.repeated=s,this.last=u,this.breakBefore=h}return o.prototype.isBetter=function(r){return!!this.exclusive&&(!r.exclusive||this.priority>r.priority||this.last)},o}();function Zh(o,r){return o.top-r.top}function $h(o,r){return r.right-o.right}function Ss(o,r){return o===r||!(!o||!r)&&o.node===r.node&&o.shadowType===r.shadowType&&mo(o.shadowContext,r.shadowContext)&&mo(o.nodeShadow,r.nodeShadow)&&Ss(o.shadowSibling,r.shadowSibling)}function Dn(o,r){if(o===r)return!0;if(!o||!r||o.offsetInNode!==r.offsetInNode||o.after!==r.after||o.steps.length!==r.steps.length)return!1;for(var e=0;e<o.steps.length;e++)if(!Ss(o.steps[e],r.steps[e]))return!1;return!0}function Ji(o,r){return{steps:[{node:o.sourceNode,shadowType:Ye.NONE,shadowContext:o.shadowContext,nodeShadow:null,shadowSibling:null,formattingContext:null,fragmentIndex:r??o.fragmentIndex}],offsetInNode:0,after:!1,preprocessedTextContent:o.preprocessedTextContent}}function tr(o,r){var e=new di(o.node,r,0);return e.shadowType=o.shadowType,e.shadowContext=o.shadowContext,e.nodeShadow=o.nodeShadow,e.shadowSibling=o.shadowSibling?tr(o.shadowSibling,r.copy()):null,e.formattingContext=o.formattingContext,e.fragmentIndex=o.fragmentIndex+1,e}var Ye=Rn.ShadowType,vo=function(){function o(r,e,t,n,i,a,s){this.owner=void 0,this.root=void 0,this.xmldoc=void 0,this.parentShadow=void 0,this.type=void 0,this.styler=void 0,this.subShadow=null,this.owner=r,this.root=e,this.xmldoc=t,this.parentShadow=n,this.type=a,this.styler=s,i&&(i.subShadow=this)}return o.prototype.equals=function(r){return!!r&&this.owner===r.owner&&this.xmldoc===r.xmldoc&&this.type===r.type&&mo(this.parentShadow,r.parentShadow)},o}();function mo(o,r){return o===r||!!o&&!!r&&o.equals(r)}var Jh=function(o,r){this.outer=void 0,this.count=void 0,this.outer=o,this.count=r},di=function(){function o(e,t,n){this.sourceNode=void 0,this.parent=void 0,this.boxOffset=void 0,this.offsetInNode=0,this.after=!1,this.shadowType=void 0,this.shadowContext=void 0,this.nodeShadow=null,this.shadowSibling=null,this.shared=!1,this.inline=!0,this.overflow=!1,this.breakPenalty=void 0,this.display=null,this.floatReference=void 0,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.whitespace=void 0,this.hyphenateCharacter=void 0,this.breakWord=void 0,this.establishesBFC=!1,this.containingBlockForAbsolute=!1,this.breakBefore=null,this.breakAfter=null,this.viewNode=null,this.clearSpacer=null,this.inheritedProps=void 0,this.vertical=void 0,this.direction=void 0,this.firstPseudo=void 0,this.lang=null,this.preprocessedTextContent=null,this.formattingContext=void 0,this.repeatOnBreak=null,this.pluginProps={},this.fragmentIndex=1,this.afterIfContinues=null,this.footnotePolicy=null,this.pageType=void 0,this.sourceNode=e,this.parent=t,this.boxOffset=n,this.shadowType=Ye.NONE,this.shadowContext=t?t.shadowContext:null,this.breakPenalty=t?t.breakPenalty:0,this.floatReference=Gn.FloatReference.INLINE,this.whitespace=t?t.whitespace:Cn.IGNORE,this.hyphenateCharacter=t?t.hyphenateCharacter:null,this.breakWord=!!t&&t.breakWord,this.inheritedProps=t?t.inheritedProps:{},this.vertical=!!t&&t.vertical,this.direction=t?t.direction:"ltr",this.firstPseudo=t?t.firstPseudo:null,this.formattingContext=t?t.formattingContext:null,this.pageType=t?t.pageType:null}var r=o.prototype;return r.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=Gn.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:Cn.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},r.cloneItem=function(){var e=new o(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},r.modify=function(){return this.shared?this.cloneItem():this},r.copy=function(){var e=this;do{if(e.shared)break;e.shared=!0,e=e.parent}while(e);return this},r.clone=function(){for(var e,t=this.cloneItem(),n=t;(e=n.parent)!=null;)e=e.cloneItem(),n.parent=e,n=e;return t},r.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}},r.toNodePosition=function(){var e,t,n,i=this,a=[];i.shadowType!==Rn.ShadowType.ROOTLESS||i.floatReference===Gn.FloatReference.INLINE&&i.floatSide!=="footnote"||(e=i.shadowContext)==null||(t=e.styler)==null||(n=t.style)==null||!n._pseudos||(i=i.parent);do i.firstPseudo&&i.parent&&i.parent.firstPseudo!==i.firstPseudo||a.push(i.toNodePositionStep()),i=i.parent;while(i);return{steps:a,offsetInNode:this.preprocessedTextContent?Ns(this.preprocessedTextContent,this.offsetInNode,-1):this.offsetInNode,after:this.after,preprocessedTextContent:this.preprocessedTextContent}},r.isInsideBFC=function(){for(var e=this.parent;e;){if(e.establishesBFC)return!0;e=e.parent}return!1},r.getContainingBlockForAbsolute=function(){for(var e=this.parent;e;){if(e.containingBlockForAbsolute)return e;e=e.parent}return null},r.walkUpBlocks=function(e){for(var t=this;t;)t.inline||e(t),t=t.parent},r.belongsTo=function(e){return this.formattingContext===e&&!!this.parent&&this.parent.formattingContext===e},o}(),wn=function(){function o(e){this.primary=void 0,this.floats=null,this.primary=e}var r=o.prototype;return r.clone=function(){var e=new o(this.primary);if(this.floats){e.floats=[];for(var t=0;t<this.floats.length;++t)e.floats[t]=this.floats[t]}return e},r.isSamePosition=function(e){if(!e)return!1;if(this===e)return!0;if(!Dn(this.primary,e.primary))return!1;if(this.floats){if(!e.floats||this.floats.length!==e.floats.length)return!1;for(var t=0;t<this.floats.length;t++)if(!Dn(this.floats[t],e.floats[t]))return!1}else if(e.floats)return!1;return!0},o}(),tc=function(){function o(e,t){this.chunkPosition=void 0,this.flowChunk=void 0,this.chunkPosition=e,this.flowChunk=t}var r=o.prototype;return r.clone=function(){return new o(this.chunkPosition.clone(),this.flowChunk)},r.isSamePosition=function(e){return!!e&&(this===e||this.chunkPosition.isSamePosition(e.chunkPosition))},o}(),ec=function(){function o(){this.positions=[],this.startSide="any",this.breakAfter=null}var r=o.prototype;return r.clone=function(){for(var e=new o,t=this.positions,n=e.positions,i=0;i<t.length;i++)n[i]=t[i].clone();return e.startSide=this.startSide,e.breakAfter=this.breakAfter,e},r.isSamePosition=function(e){if(this===e)return!0;if(!e||this.positions.length!==e.positions.length)return!1;for(var t=0;t<this.positions.length;t++)if(!this.positions[t].isSamePosition(e.positions[t]))return!1;return!0},r.hasContent=function(e){return this.positions.length>0&&this.positions[0].flowChunk.startOffset<=e},o}(),nc=function(){function o(){this.page=0,this.flows={},this.flowPositions={},this.isBlankPage=!1,this.highestSeenOffset=0,this.highestSeenNode=void 0,this.lookupPositionOffset=void 0}var r=o.prototype;return r.clone=function(){var e=new o;for(var t in e.page=this.page,e.isBlankPage=this.isBlankPage,e.highestSeenNode=this.highestSeenNode,e.highestSeenOffset=this.highestSeenOffset,e.lookupPositionOffset=this.lookupPositionOffset,e.flows=this.flows,this.flowPositions)e.flowPositions[t]=this.flowPositions[t].clone();return e},r.isSamePosition=function(e){if(this===e)return!0;if(!e||this.page!==e.page||this.highestSeenOffset!==e.highestSeenOffset)return!1;var t=Object.keys(this.flowPositions),n=Object.keys(e.flowPositions);if(t.length!==n.length)return!1;for(var i=0,a=t;i<a.length;i++){var s=a[i];if(!this.flowPositions[s].isSamePosition(e.flowPositions[s]))return!1}return!0},r.hasContent=function(e,t){var n=this.flowPositions[e];return!!n&&n.hasContent(t)},r.startSideOfFlow=function(e){var t=this.flowPositions[e];return t?t.startSide:"any"},r.firstFlowChunkOfFlow=function(e){var t=this.flowPositions[e];if(!t)return null;var n=t.positions[0];return n?n.flowChunk:null},o}(),As=function(){function o(e){this.element=void 0,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,this.element=e}var r=o.prototype;return r.getInsetTop=function(){return this.marginTop+this.borderTop+this.paddingTop},r.getInsetBottom=function(){return this.marginBottom+this.borderBottom+this.paddingBottom},r.getInsetLeft=function(){return this.marginLeft+this.borderLeft+this.paddingLeft},r.getInsetRight=function(){return this.marginRight+this.borderRight+this.paddingRight},r.getInsetBefore=function(){return this.vertical?this.getInsetRight():this.getInsetTop()},r.getInsetAfter=function(){return this.vertical?this.getInsetLeft():this.getInsetBottom()},r.getInsetStart=function(){return this.vertical?this.getInsetTop():this.getInsetLeft()},r.getInsetEnd=function(){return this.vertical?this.getInsetBottom():this.getInsetRight()},r.getBeforeEdge=function(e){return this.vertical?e.right:e.top},r.getAfterEdge=function(e){return this.vertical?e.left:e.bottom},r.getStartEdge=function(e){return this.vertical?e.top:e.left},r.getEndEdge=function(e){return this.vertical?e.bottom:e.right},r.getInlineSize=function(e){return this.vertical?e.bottom-e.top:e.right-e.left},r.getBoxSize=function(e){return this.vertical?e.right-e.left:e.bottom-e.top},r.getBoxDir=function(){return this.vertical?-1:1},r.getInlineDir=function(){return 1},r.copyFrom=function(e){this.element=e.element,this.left=e.left,this.top=e.top,this.marginLeft=e.marginLeft,this.marginRight=e.marginRight,this.marginTop=e.marginTop,this.marginBottom=e.marginBottom,this.borderLeft=e.borderLeft,this.borderRight=e.borderRight,this.borderTop=e.borderTop,this.borderBottom=e.borderBottom,this.paddingLeft=e.paddingLeft,this.paddingRight=e.paddingRight,this.paddingTop=e.paddingTop,this.paddingBottom=e.paddingBottom,this.width=e.width,this.height=e.height,this.originX=e.originX,this.originY=e.originY,this.innerShape=e.innerShape,this.exclusions=e.exclusions,this.computedBlockSize=e.computedBlockSize,this.snapWidth=e.snapWidth,this.snapHeight=e.snapHeight,this.vertical=e.vertical},r.setVerticalPosition=function(e,t){this.top=e,this.height=t,T(this.element,"top",e+"px"),T(this.element,"height",t+"px")},r.setHorizontalPosition=function(e,t){this.left=e,this.width=t,T(this.element,"left",e+"px"),T(this.element,"width",t+"px")},r.setBlockPosition=function(e,t){this.vertical?this.setHorizontalPosition(e+t*this.getBoxDir(),t):this.setVerticalPosition(e,t)},r.setInlinePosition=function(e,t){this.vertical?this.setVerticalPosition(e,t):this.setHorizontalPosition(e,t)},r.clear=function(){for(var e,t=this.element;e=t.lastChild;)t.removeChild(e)},r.getInnerShape=function(){var e=this.getInnerRect();return this.innerShape?this.innerShape.withOffset(e.x1,e.y1):$r(e.x1,e.y1,e.x2,e.y2)},r.getInnerRect=function(){var e=this.originX+this.left+this.getInsetLeft(),t=this.originY+this.top+this.getInsetTop();return new ke(e,t,e+this.width,t+this.height)},r.getPaddingRect=function(){var e=this.originX+this.left+this.marginLeft+this.borderLeft,t=this.originY+this.top+this.marginTop+this.borderTop;return new ke(e,t,e+(this.paddingLeft+this.width+this.paddingRight),t+(this.paddingTop+this.height+this.paddingBottom))},r.getOuterShape=function(e,t){var n=this.getOuterRect();return os(e,n.x1,n.y1,n.x2-n.x1,n.y2-n.y1,t)},r.getOuterRect=function(){var e=this.originX+this.left,t=this.originY+this.top,n=this.getInsetLeft()+this.width+this.getInsetRight(),i=this.getInsetTop()+this.height+this.getInsetBottom();return new ke(e,t,e+n,t+i)},o}(),Eo=function(o){function r(t,n,i,a){var s;return(s=o.call(this)||this).elem=void 0,s.context=void 0,s.rootContentValue=void 0,s.exprContentListener=void 0,s.elem=t,s.context=n,s.rootContentValue=i,s.exprContentListener=a,s}w(r,o);var e=r.prototype;return e.visitStrInner=function(t,n){n||(n=this.elem.ownerDocument.createTextNode(t)),this.elem.appendChild(n)},e.visitStr=function(t){return this.visitStrInner(t.str),null},e.visitURL=function(t){if(this.rootContentValue.url)this.elem.setAttribute("src",t.url);else{var n=this.elem.ownerDocument.createElementNS(U.XHTML,"img");n.setAttribute("src",t.url),this.elem.appendChild(n)}return null},e.visitSpaceList=function(t){return this.visitValues(t.values),null},e.visitExpr=function(t){var n=t.toExpr(),i=n.evaluate(this.context);if(typeof i=="string"){n instanceof ie&&(i=Yi(n.scope,new mn(i,null),"").stringValue());var a=this.exprContentListener(n,i,this.elem.ownerDocument);this.visitStrInner(i,a)}return null},r}(fn);function Wn(o){return o!=null&&o!==ht&&o!==b.normal&&o!==b.none&&o!==b.inherit}var Ts={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},ic=["box-decoration-break","image-resolution","orphans","widows"];function rc(){return se(R.HOOKS.POLYFILLED_INHERITED_PROPS).reduce(function(o,r){return o.concat(r())},[].concat(ic))}var xs={"http://www.idpf.org/2007/ops":!0,"http://www.w3.org/1999/xhtml":!0,"http://www.w3.org/2000/svg":!0},Co=["margin-%","padding-%","border-%-width","border-%-style","border-%-color","%"],oc=["max-%","min-%","%"],ac=function(){for(var o=["left","right","top","bottom"],r={width:!0,height:!0,"max-width":!0,"max-height":!0,"min-width":!0,"min-height":!0},e=0;e<Co.length;e++)for(var t=0;t<o.length;t++)r[Co[e].replace("%",o[t])]=!0;return r}();function er(o,r){for(var e,t={},n=B(Co);!(e=n()).done;){var i=e.value;for(var a in o){var s=i.replace("%",a),u=i.replace("%",o[a]);t[s]=u,t[u]=s}}for(var h,c=B(oc);!(h=c()).done;){var d=h.value;for(var f in r){var v=d.replace("%",f),g=d.replace("%",r[f]);t[v]=g,t[g]=v}}return t}var Is=er({"block-start":"right","block-end":"left","inline-start":"top","inline-end":"bottom"},{"block-size":"width","inline-size":"height"}),Fs=er({"block-start":"top","block-end":"bottom","inline-start":"left","inline-end":"right"},{"block-size":"height","inline-size":"width"}),sc=er({"block-start":"right","block-end":"left","inline-start":"bottom","inline-end":"top"},{"block-size":"width","inline-size":"height"}),uc=er({"block-start":"top","block-end":"bottom","inline-start":"right","inline-end":"left"},{"block-size":"height","inline-size":"width"}),Dt=function(){function o(e,t){this.value=void 0,this.priority=void 0,this.value=e,this.priority=t}var r=o.prototype;return r.getBaseValue=function(){return this},r.filterValue=function(e){var t=this.value.visit(e);return t===this.value?this:new o(t,this.priority)},r.increaseSpecificity=function(e){return e==0?this:new o(this.value,this.priority+e)},r.evaluate=function(e,t){return Ki(e,this.value,t)},r.isEnabled=function(e){return!0},o}(),Do=function(o){function r(t,n,i){var a;return(a=o.call(this,t,n)||this).condition=void 0,a.condition=i,a}w(r,o);var e=r.prototype;return e.getBaseValue=function(){return new Dt(this.value,this.priority)},e.filterValue=function(t){var n=this.value.visit(t);return n===this.value?this:new r(n,this.priority,this.condition)},e.increaseSpecificity=function(t){return t==0?this:new r(this.value,this.priority+t,this.condition)},e.isEnabled=function(t){try{return!!this.condition.evaluate(t)}catch(n){M.warn(n)}return!1},r}(Dt);function fi(o,r,e){return(r==null||e.priority>r.priority)&&e.isEnabled(o)?e.getBaseValue():r}var Ps={"region-id":!0,"fragment-selector-id":!0};function nr(o){return o.charAt(0)!="_"&&!Ps[o]}function Rs(o){return!!Ts[o]}function Be(o,r){return o[r]}function Je(o,r,e){e?o[r]=e:delete o[r]}function yn(o,r){return o[r]}function ir(o,r){var e=o[r];return e||(o[r]=e={}),e}var Os=function(o){var r=o._viewConditionalStyles;return r||(o._viewConditionalStyles=r=[]),r};function ks(o,r){return o[r]}function Ls(o,r){var e=o[r];return e||(o[r]=e=[]),e}function rr(o,r,e,t,n,i,a){for(var s in[{id:n,styleKey:"_pseudos"},{id:i,styleKey:"_regions"}].forEach(function(f){if(f.id){var v=ir(r,f.styleKey);(r=v[f.id])||(v[f.id]=r={})}}),a&&Os(r).push({styles:r={},matcher:a}),e)if(s.charAt(0)!="_")if(Ps[s]){var u=ks(e,s),h=Ls(r,s);Array.prototype.push.apply(h,u)}else{var c=Be(e,s).increaseSpecificity(t),d=Be(r,s);Je(r,s,fi(o,d,c))}}function Bs(o,r){if(o.length>0){o.sort(function(n,i){return i.getPriority()-n.getPriority()});for(var e=null,t=o.length-1;t>=0;t--)(e=o[t]).chained=r,r=e;return e}return r}var lc=function(o){function r(t,n){var i;return(i=o.call(this)||this).props=void 0,i.context=void 0,i.propName="",i.props=t,i.context=n,i}w(r,o);var e=r.prototype;return e.setPropName=function(t){this.propName=t},e.getFontSize=function(){var t=Be(this.props,"font-size");if(!t.value.isNumeric())return me.em;var n=t.value;if(!function(i){switch(i.toLowerCase()){case"px":case"in":case"pt":case"pc":case"cm":case"mm":case"q":return!0;default:return!1}}(n.unit))throw new Error("Unexpected state");return n.num*me[n.unit]},e.visitNumeric=function(t){if(this.propName==="font-size")return function(i,a,s){var u=(i=wo(i,a,s)).unit,h=i.num;return u==="px"?i:new O(u==="%"?h/100*a:h*s.queryUnitSize(u,!1),"px")}(t,this.getFontSize(),this.context);if(t.unit=="em"||t.unit=="ex"||t.unit=="rem")return wo(t,this.getFontSize(),this.context);if(t.unit=="%"){if(this.propName==="line-height")return t;var n=this.propName.match(/height|^(top|bottom)$/)?"vh":"vw";return new O(t.num,n)}return t},e.visitExpr=function(t){return this.propName=="font-size"?Ki(this.context,t,this.propName).visit(this):t},r}(_i);function wo(o,r,e){var t=o.unit,n=o.num;return t==="em"||t==="ex"?new O(n*(me[t]/me.em)*r,"px"):t==="rem"?new O(n*e.fontSize(),"px"):o}var pi=function(){function o(){}var r=o.prototype;return r.apply=function(e){},r.mergeWith=function(e){return new hc([this,e])},r.clone=function(){return this},o}(),or=function(o){function r(e){var t;return(t=o.call(this)||this).conditionItem=void 0,t.conditionItem=e,t}return w(r,o),r.prototype.apply=function(e){e.pushConditionItem(this.conditionItem.fresh(e))},r}(pi),hc=function(o){function r(t){var n;return(n=o.call(this)||this).list=void 0,n.list=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){for(var n=0;n<this.list.length;n++)this.list[n].apply(t)},e.mergeWith=function(t){return this.list.push(t),this},e.clone=function(){return new r([].concat(this.list))},r}(pi),_s=function(o){function r(e,t,n,i,a){var s;return(s=o.call(this)||this).style=void 0,s.specificity=void 0,s.pseudoelement=void 0,s.regionId=void 0,s.viewConditionId=void 0,s.style=e,s.specificity=t,s.pseudoelement=n,s.regionId=i,s.viewConditionId=a,s}return w(r,o),r.prototype.apply=function(e){rr(e.context,e.currentStyle,this.style,this.specificity,this.pseudoelement,this.regionId,e.buildViewConditionMatcher(this.viewConditionId))},r}(pi),Mt=function(o){function r(){var t;return(t=o.call(this)||this).chained=null,t}w(r,o);var e=r.prototype;return e.apply=function(t){this.chained.apply(t)},e.getPriority=function(){return 0},e.makePrimary=function(t){return!1},r}(pi),cc=function(o){function r(t){var n;return(n=o.call(this)||this).className=void 0,n.className=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentClassNames.includes(this.className)&&this.chained.apply(t)},e.getPriority=function(){return 10},e.makePrimary=function(t){return this.chained&&t.insertInTable(t.classes,this.className,this.chained),!0},r}(Mt),dc=function(o){function r(t){var n;return(n=o.call(this)||this).id=void 0,n.id=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentId!=this.id&&t.currentXmlId!=this.id||this.chained.apply(t)},e.getPriority=function(){return 11},e.makePrimary=function(t){return this.chained&&t.insertInTable(t.ids,this.id,this.chained),!0},r}(Mt),Ms=function(o){function r(t){var n;return(n=o.call(this)||this).localName=void 0,n.localName=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentLocalName==this.localName&&this.chained.apply(t)},e.getPriority=function(){return 8},e.makePrimary=function(t){return this.chained&&t.insertInTable(t.tags,this.localName,this.chained),!0},r}(Mt),fc=function(o){function r(t,n){var i;return(i=o.call(this)||this).ns=void 0,i.localName=void 0,i.ns=t,i.localName=n,i}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentLocalName==this.localName&&t.currentNamespace==this.ns&&this.chained.apply(t)},e.getPriority=function(){return 8},e.makePrimary=function(t){if(this.chained){var n=t.nsPrefix[this.ns];n||(n="ns"+t.nsCount+++":",t.nsPrefix[this.ns]=n),t.insertInTable(t.nstags,n+this.localName,this.chained)}return!0},r}(Mt),pc=function(o){function r(e){var t;return(t=o.call(this)||this).epubTypePatt=void 0,t.epubTypePatt=e,t}return w(r,o),r.prototype.apply=function(e){var t=e.currentElement;if(t&&e.currentLocalName=="a"){var n=t.getAttribute("href");if(n&&n.match(/^#/)){var i=n.substring(1),a=t.ownerDocument.getElementById(i);if(a){var s=a.getAttributeNS(U.epub,"type");s&&s.match(this.epubTypePatt)&&this.chained.apply(e)}}}},r}(Mt),gc=function(o){function r(e){var t;return(t=o.call(this)||this).ns=void 0,t.ns=e,t}return w(r,o),r.prototype.apply=function(e){e.currentNamespace==this.ns&&this.chained.apply(e)},r}(Mt),Us=function(o){function r(e,t){var n;return(n=o.call(this)||this).ns=void 0,n.name=void 0,n.ns=e,n.name=t,n}return w(r,o),r.prototype.apply=function(e){e.currentElement&&e.currentElement.hasAttributeNS(this.ns,this.name)&&this.chained.apply(e)},r}(Mt),vc=function(o){function r(t,n,i){var a;return(a=o.call(this)||this).ns=void 0,a.name=void 0,a.value=void 0,a.ns=t,a.name=n,a.value=i,a}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentElement&&t.currentElement.getAttributeNS(this.ns,this.name)==this.value&&this.chained.apply(t)},e.getPriority=function(){return this.name=="type"&&this.ns==U.epub?9:0},e.makePrimary=function(t){return this.name=="type"&&this.ns==U.epub&&(this.chained&&t.insertInTable(t.epubtypes,this.value,this.chained),!0)},r}(Mt),mc=function(o){function r(t,n){var i;return(i=o.call(this)||this).ns=void 0,i.name=void 0,i.ns=t,i.name=n,i}w(r,o);var e=r.prototype;return e.apply=function(t){if(t.currentElement){var n=t.currentElement.getAttributeNS(this.ns,this.name);n&&xs[n]&&this.chained.apply(t)}},e.getPriority=function(){return 0},e.makePrimary=function(t){return!1},r}(Mt),gi=function(o){function r(e,t,n){var i;return(i=o.call(this)||this).ns=void 0,i.name=void 0,i.regexp=void 0,i.ns=e,i.name=t,i.regexp=n,i}return w(r,o),r.prototype.apply=function(e){if(e.currentElement){var t=e.currentElement.getAttributeNS(this.ns,this.name);t&&t.match(this.regexp)&&this.chained.apply(e)}},r}(Mt),Ec=function(o){function r(e){var t;return(t=o.call(this)||this).langRegExp=void 0,t.langRegExp=e,t}return w(r,o),r.prototype.apply=function(e){e.lang.match(this.langRegExp)&&this.chained.apply(e)},r}(Mt),Vs=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.apply=function(t){t.isFirst&&this.chained.apply(t)},e.getPriority=function(){return 6},r}(Mt),Cc=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.apply=function(t){t.isRoot&&this.chained.apply(t)},e.getPriority=function(){return 12},r}(Mt),vi=function(o){function r(e,t){var n;return(n=o.call(this)||this).a=void 0,n.b=void 0,n.a=e,n.b=t,n}return w(r,o),r.prototype.matchANPlusB=function(e){return ws(e,this.a,this.b)},r}(Mt),Dc=function(o){function r(t,n){return o.call(this,t,n)||this}w(r,o);var e=r.prototype;return e.apply=function(t){this.matchANPlusB(t.currentSiblingOrder)&&this.chained.apply(t)},e.getPriority=function(){return 5},r}(vi),yo=function(o){function r(t,n){return o.call(this,t,n)||this}w(r,o);var e=r.prototype;return e.apply=function(t){this.matchANPlusB(t.currentSiblingTypeCounts[t.currentNamespace][t.currentLocalName])&&this.chained.apply(t)},e.getPriority=function(){return 5},r}(vi),No=function(o){function r(t,n){return o.call(this,t,n)||this}w(r,o);var e=r.prototype;return e.apply=function(t){var n=t.currentFollowingSiblingOrder;n===null&&(n=t.currentFollowingSiblingOrder=t.currentElement.parentNode.childElementCount-t.currentSiblingOrder+1),this.matchANPlusB(n)&&this.chained.apply(t)},e.getPriority=function(){return 4},r}(vi),bo=function(o){function r(t,n){return o.call(this,t,n)||this}w(r,o);var e=r.prototype;return e.apply=function(t){var n=t.currentFollowingSiblingTypeCounts;if(!n[t.currentNamespace]){var i=t.currentElement;do{var a=i.namespaceURI,s=i.localName,u=n[a];u||(u=n[a]={}),u[s]=(u[s]||0)+1}while(i=i.nextElementSibling)}this.matchANPlusB(n[t.currentNamespace][t.currentLocalName])&&this.chained.apply(t)},e.getPriority=function(){return 4},r}(vi),wc=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.apply=function(t){for(var n=t.currentElement.firstChild;n;){switch(n.nodeType){case Node.ELEMENT_NODE:return;case Node.TEXT_NODE:if(n.length>0)return}n=n.nextSibling}this.chained.apply(t)},e.getPriority=function(){return 4},r}(Mt),yc=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentElement.disabled===!1&&this.chained.apply(t)},e.getPriority=function(){return 5},r}(Mt),Nc=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentElement.disabled===!0&&this.chained.apply(t)},e.getPriority=function(){return 5},r}(Mt),bc=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.apply=function(t){var n=t.currentElement;n.selected!==!0&&n.checked!==!0||this.chained.apply(t)},e.getPriority=function(){return 5},r}(Mt),qt=function(o){function r(t){var n;return(n=o.call(this)||this).condition=void 0,n.condition=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){if(t.conditions[this.condition])try{t.dependentConditions.push(this.condition),this.chained.apply(t)}finally{t.dependentConditions.pop()}},e.getPriority=function(){return 5},r}(Mt),Sc=function(o){function r(){var t;return(t=o.call(this)||this).applied=!1,t}w(r,o);var e=r.prototype;return e.apply=function(t){this.applied=!0},e.clone=function(){var t=new r;return t.applied=this.applied,t},r}(pi),Ac=function(o){function r(t){var n;return(n=o.call(this)||this).checkAppliedAction=void 0,n.firstAction=void 0,n.checkAppliedAction=new Sc,n.firstAction=Bs(t,n.checkAppliedAction),n}w(r,o);var e=r.prototype;return e.apply=function(t){this.firstAction.apply(t),this.checkAppliedAction.applied||this.chained.apply(t),this.checkAppliedAction.applied=!1},e.getPriority=function(){return this.firstAction.getPriority()},r}(Mt),ar=function(){function o(e,t,n){this.condition=void 0,this.viewConditionId=void 0,this.viewCondition=void 0,this.condition=e,this.viewConditionId=t,this.viewCondition=n}var r=o.prototype;return r.increment=function(e){e.increment(this.condition,this.viewCondition)},r.decrement=function(e){e.decrement(this.condition,this.viewCondition)},r.buildViewConditionMatcher=function(e){return e.buildViewConditionMatcher(this.viewConditionId)},o}(),Tc=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.fresh=function(t){return new r(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},e.push=function(t,n){return n==0&&this.increment(t),!1},e.pop=function(t,n){return n==0&&(this.decrement(t),!0)},r}(ar),xc=function(o){function r(t,n,i){return o.call(this,t,n,i)||this}w(r,o);var e=r.prototype;return e.fresh=function(t){return new r(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},e.push=function(t,n){return n==0?this.increment(t):n==1&&this.decrement(t),!1},e.pop=function(t,n){return n==0?(this.decrement(t),!0):(n==1&&this.increment(t),!1)},r}(ar),Ic=function(o){function r(t,n,i){var a;return(a=o.call(this,t,n,i)||this).fired=!1,a}w(r,o);var e=r.prototype;return e.fresh=function(t){return new r(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},e.push=function(t,n){return!!this.fired&&(this.decrement(t),!0)},e.pop=function(t,n){return this.fired?(this.decrement(t),!0):(n==0&&(this.fired=!0,this.increment(t)),!1)},r}(ar),Fc=function(o){function r(t,n,i){var a;return(a=o.call(this,t,n,i)||this).fired=!1,a}w(r,o);var e=r.prototype;return e.fresh=function(t){return new r(this.condition,this.viewConditionId,this.buildViewConditionMatcher(t))},e.push=function(t,n){return this.fired&&(n==-1?this.increment(t):n==0&&this.decrement(t)),!1},e.pop=function(t,n){if(this.fired){if(n==-1)return this.decrement(t),!0;n==0&&this.increment(t)}else n==0&&(this.fired=!0,this.increment(t));return!1},r}(ar),Pc=function(){function o(e,t){this.afterprop=void 0,this.element=void 0,this.afterprop=e,this.element=t}var r=o.prototype;return r.fresh=function(e){return this},r.push=function(e,t){return!1},r.pop=function(e,t){return t==0&&(e.processPseudoelementProps(this.afterprop,this.element),!0)},o}(),Rc=function(){function o(e){this.lang=void 0,this.lang=e}var r=o.prototype;return r.fresh=function(e){return this},r.push=function(e,t){return!1},r.pop=function(e,t){return t==0&&(e.lang=this.lang,!0)},o}(),Oc=function(){function o(e){this.oldQuotes=void 0,this.oldQuotes=e}var r=o.prototype;return r.fresh=function(e){return this},r.push=function(e,t){return!1},r.pop=function(e,t){return t==0&&(e.quotes=this.oldQuotes,!0)},o}(),kc=function(o){function r(t){var n;return(n=o.call(this)||this).element=void 0,n.element=t,n}w(r,o);var e=r.prototype;return e.createValueFromString=function(t,n){switch(n){case"url":return new pn(t||"about:invalid");case"string":default:return new Ae(t||"")}},e.visitFunc=function(t){if(t.name!=="attr")return o.prototype.visitFunc.call(this,t);var n,i="string",a=null;if(t.values[0]instanceof fe){var s=t.values[0].values;s.length>=2&&(i=s[1].stringValue()),a=s[0].stringValue()}else a=t.values[0].stringValue();return n=this.createValueFromString(t.values.length>1?t.values[1].stringValue():null,i),this.element&&this.element.hasAttribute(a)?this.createValueFromString(this.element.getAttribute(a),i):n},r}(_i);function So(o){if(Wn(o)){if(o instanceof Ae)return o.stringValue();if(o instanceof fe)return o.values.map(function(r){return So(r)}).join("")}return""}var Ao=function(o){function r(t,n,i){var a;return(a=o.call(this)||this).cascade=void 0,a.element=void 0,a.counterResolver=void 0,a.cascade=t,a.element=n,a.counterResolver=i,a}w(r,o);var e=r.prototype;return e.visitIdent=function(t){var n=this.cascade,i=n.quotes,a=Math.floor(i.length/2)-1;switch(t.name){case"open-quote":var s=i[2*Math.min(a,n.quoteDepth)];return n.quoteDepth++,s;case"close-quote":return n.quoteDepth>0&&n.quoteDepth--,i[2*Math.min(a,n.quoteDepth)+1];case"no-open-quote":return n.quoteDepth++,new Ae("");case"no-close-quote":return n.quoteDepth>0&&n.quoteDepth--,new Ae("")}return t},e.format=function(t,n){var i,a=!1,s=!1;(i=n.match(/^upper-(.*)/))!=null?(a=!0,n=i[1]):(i=n.match(/^lower-(.*)/))!=null&&(s=!0,n=i[1]);var u="";return Hs[n]?u=function(h,c){if(c>h[0]||c<=0||c!=Math.round(c))return"";for(var d="",f=1;f<h.length;f+=2){var v=h[f],g=Math.floor(c/v);if(g>20)return"";for(c-=g*v;g>0;)d+=h[f+1],g--}return d}(Hs[n],t):zs[n]?u=function(h,c){if(c<=0||c!=Math.round(c))return"";var d=function(g){for(var p=[],E=0;E<g.length;)if(g.substr(E+1,1)=="-"){var C=g.charCodeAt(E),D=g.charCodeAt(E+2);E+=3;for(var y=C;y<=D;y++)p.push(String.fromCharCode(y))}else p.push(g.substr(E++,1));return p}(h),f="";do{var v=--c%d.length;f=d[v]+f,c=(c-v)/d.length}while(c>0);return f}(zs[n],t):Gs[n]!=null?u=Gs[n]:n=="decimal-leading-zero"?(u=""+t).length==1&&(u="0"+u):u=n=="cjk-ideographic"||n=="trad-chinese-informal"?function(h,c){if(h>9999||h<-9999)return""+h;if(h==0)return c.digits.charAt(0);var d=new Re;if(h<0&&(d.append(c.negative),h=-h),h<10)d.append(c.digits.charAt(h));else if(!c.formal&&h<=19)d.append(c.markers.charAt(0)),h!=0&&d.append(c.digits.charAt(h-10));else{var f=Math.floor(h/1e3);f&&(d.append(c.digits.charAt(f)),d.append(c.markers.charAt(2)));var v=Math.floor(h/100)%10;v&&(d.append(c.digits.charAt(v)),d.append(c.markers.charAt(1)));var g=Math.floor(h/10)%10;g&&(d.append(c.digits.charAt(g)),d.append(c.markers.charAt(0)));var p=h%10;p&&d.append(c.digits.charAt(p))}return d.toString()}(t,Lc):""+t,a?u.toUpperCase():s?u.toLowerCase():u},e.visitFuncCounter=function(t){var n=this,i=t[0].toString(),a=t.length>1?t[1].stringValue():"decimal",s=this.cascade.counters[i];if(s&&s.length)return new Ae(this.format(s&&s.length&&s[s.length-1]||0,a));var u=new Z(this.counterResolver.getPageCounterVal(i,function(h){return n.format(h||0,a)}));return new fe([u])},e.visitFuncCounters=function(t){var n=this,i=t[0].toString(),a=t[1].stringValue(),s=t.length>2?t[2].stringValue():"decimal",u=this.cascade.counters[i],h=new Re;if(u&&u.length)for(var c=0;c<u.length;c++)c>0&&h.append(a),h.append(this.format(u[c],s));var d=new Z(this.counterResolver.getPageCountersVal(i,function(f){var v=[];if(f.length)for(var g=0;g<f.length;g++)v.push(n.format(f[g],s));var p=h.toString();return p.length&&v.push(p),v.length?v.join(a):n.format(0,s)}));return new fe([d])},e.visitFuncTargetCounter=function(t){var n,i=this,a=t[0];n=a instanceof pn?a.url:a.stringValue();var s=t[1].toString(),u=t.length>2?t[2].stringValue():"decimal",h=new Z(this.counterResolver.getTargetCounterVal(n,s,function(c){return i.format(c||0,u)}));return new fe([h])},e.visitFuncTargetCounters=function(t){var n,i=this,a=t[0];n=a instanceof pn?a.url:a.stringValue();var s=t[1].toString(),u=t[2].stringValue(),h=t.length>3?t[3].stringValue():"decimal",c=new Z(this.counterResolver.getTargetCountersVal(n,s,function(d){var f=d.map(function(v){return i.format(v,h)});return f.length?f.join(u):i.format(0,h)}));return new fe([c])},e.visitFuncString=function(t){var n=t.length>0?t[0].stringValue():"",i=t.length>1?t[1].stringValue():"first",a=new Z(this.counterResolver.getNamedStringVal(n,i));return new fe([a])},e.visitFuncContent=function(t){var n=t.length>0?t[0].stringValue():"text",i="";switch(n){case"text":case"first-letter":if(i=this.element.textContent.trim().replace(/\s+/g," "),n==="first-letter"){var a=i.match(gt);i=a?a[0]:""}break;case"before":case"after":var s,u,h=yn(this.cascade.currentStyle,"_pseudos");i=So(h==null||(s=h[n])==null||(u=s.content)==null?void 0:u.value)}return new Ae(i)},e.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);break;case"string":if(t.values.length<=2)return this.visitFuncString(t.values);break;case"content":if(t.values.length<=1)return this.visitFuncContent(t.values)}return M.warn("E_CSS_CONTENT_PROP:",t.toString()),new Ae("")},r}(_i),Hs={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,"א"]},zs={latin:"a-z",alpha:"a-z",greek:"α-ρσ-ω",russian:"а-ик-щэ-я"},Gs={square:"■",disc:"•",circle:"◦",none:""},Lc={formal:!1,digits:"零一二三四五六七八九",markers:"十百千",negative:"負"};function Xn(o,r){for(var e in o)r[e]=o[e].clone()}var qe,Bc=function(){function o(){this.nsCount=0,this.nsPrefix={},this.tags={},this.nstags={},this.epubtypes={},this.classes={},this.ids={},this.pagetypes={},this.order=0}var r=o.prototype;return r.clone=function(){var e=new o;for(var t in e.nsCount=this.nsCount,this.nsPrefix)e.nsPrefix[t]=this.nsPrefix[t];return Xn(this.tags,e.tags),Xn(this.nstags,e.nstags),Xn(this.epubtypes,e.epubtypes),Xn(this.classes,e.classes),Xn(this.ids,e.ids),Xn(this.pagetypes,e.pagetypes),e.order=this.order,e},r.insertInTable=function(e,t,n){var i=e[t];i&&(n=i.mergeWith(n)),e[t]=n},r.createInstance=function(e,t,n,i){return new _c(this,e,t,n,i)},r.nextOrder=function(){return this.order+=95367431640625e-20},o}(),_c=function(){function o(e,t,n,i,a){this.context=void 0,this.counterListener=void 0,this.counterResolver=void 0,this.code=void 0,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.previousPageType=null,this.firstPageType=null,this.isFirst=!0,this.isRoot=!0,this.counters={},this.counterScoping=[{}],this.quotes=void 0,this.quoteDepth=0,this.lang="",this.siblingOrderStack=[0],this.currentSiblingOrder=0,this.siblingTypeCountsStack=[{}],this.currentSiblingTypeCounts=void 0,this.currentFollowingSiblingOrder=null,this.followingSiblingOrderStack=void 0,this.followingSiblingTypeCountsStack=[{}],this.currentFollowingSiblingTypeCounts=void 0,this.viewConditions={},this.dependentConditions=[],this.elementStack=void 0,this.context=t,this.counterListener=n,this.counterResolver=i,this.code=e,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 r=o.prototype;return r.pushConditionItem=function(e){this.stack[this.stack.length-1].push(e)},r.increment=function(e,t){this.conditions[e]=(this.conditions[e]||0)+1,t&&(this.viewConditions[e]?this.viewConditions[e].push(t):this.viewConditions[e]=[t])},r.decrement=function(e,t){this.conditions[e]--,this.viewConditions[e]&&(this.viewConditions[e]=this.viewConditions[e].filter(function(n){return n!==t}),this.viewConditions[e].length===0&&delete this.viewConditions[e])},r.buildViewConditionMatcher=function(e){var t=this,n=null;e&&(n=Qi.buildViewConditionMatcher(this.currentElementOffset,e));var i=this.dependentConditions.map(function(a){var s=t.viewConditions[a];return s&&s.length>0?s.length===1?s[0]:Qi.buildAnyMatcher([].concat(s)):null}).filter(function(a){return a});return i.length<=0?n:n===null?i.length===1?i[0]:Qi.buildAllMatcher(i):Qi.buildAllMatcher([n].concat(i))},r.applyAction=function(e,t){var n=e[t];n&&n.apply(this)},r.pushRule=function(e,t,n){this.currentElement=null,this.currentElementOffset=null,this.currentStyle=n,this.currentNamespace="",this.currentLocalName="",this.currentId="",this.currentXmlId="",this.currentClassNames=e,this.currentNSTag="",this.currentEpubTypes=To,this.currentPageType=t,this.applyActions()},r.defineCounter=function(e,t){this.counters[e]?this.counters[e].push(t):this.counters[e]=[t];var n=this.counterScoping[this.counterScoping.length-1];n||(this.counterScoping[this.counterScoping.length-1]=n={}),n[e]=!0},r.pushCounters=function(e){var t=b.inline,n=e.display;n&&(t=n.evaluate(this.context));var i=null,a=null,s=null,u=e["counter-reset"];if(u){var h=u.evaluate(this.context);h&&(i=si(h,!0))}var c=e["counter-set"];if(c){var d=c.evaluate(this.context);d&&(s=si(d,!1))}var f,v,g,p,E=e["counter-increment"];if(E){var C=E.evaluate(this.context);C&&(a=si(C,!1))}if(this.currentLocalName!="ol"&&this.currentLocalName!="ul"||this.currentNamespace!=U.XHTML||(i||(i={}),i["ua-list-item"]=((f=(v=this.currentElement)==null?void 0:v.start)!=null?f:1)-1),t===b.list_item&&(a||(a={}),a["ua-list-item"]=1,/^\s*[-+]?\d/.test((g=(p=this.currentElement)==null?void 0:p.getAttribute("value"))!=null?g:"")&&(i||(i={}),i["ua-list-item"]=this.currentElement.value-1)),i)for(var D in i)this.defineCounter(D,i[D]);if(s)for(var y in s)if(this.counters[y]){var N=this.counters[y];N[N.length-1]=s[y]}else this.defineCounter(y,s[y]);if(a)for(var x in a){this.counters[x]||this.defineCounter(x,0);var F=this.counters[x];F[F.length-1]+=a[x]}if(t===b.list_item){var k=this.counters["ua-list-item"];e["ua-list-item-count"]=new Dt(new ri(k[k.length-1]),0)}this.counterScoping.push(null)},r.popCounters=function(){var e=this.counterScoping.pop();if(e)for(var t in e){var n=this.counters[t];n&&(n.length==1?delete this.counters[t]:n.pop())}},r.setNamedStrings=function(e){var t=e["string-set"];if(t){for(var n,i=B((t=t.filterValue(new Ao(this,this.currentElement,this.counterResolver))).value instanceof Te?t.value.values:[t.value]);!(n=i()).done;){var a=n.value;if(a instanceof fe){var s=a.values[0].stringValue(),u=a.values.slice(1).map(function(h){return So(h)}).join("");this.counterResolver.setNamedString(s,u,this)}}delete e["string-set"]}},r.processPseudoelementProps=function(e,t){this.pushCounters(e),e.content&&(e.content=e.content.filterValue(new Ao(this,t,this.counterResolver))),this.popCounters()},r.pushElement=function(e,t,n){var i=this;this.currentPageType=null,this.currentElement=e,this.currentElementOffset=n,this.currentStyle=t,this.currentNamespace=e.namespaceURI,this.currentLocalName=e.localName;var a=this.code.nsPrefix[this.currentNamespace];this.currentNSTag=a?a+this.currentLocalName:"",this.currentId=e.getAttribute("id"),this.currentXmlId=e.getAttributeNS(U.XML,"id");var s=e.getAttribute("class");this.currentClassNames=s?s.split(/\s+/):To;var u=e.getAttributeNS(U.epub,"type");this.currentEpubTypes=u?u.split(/\s+/):To;var h=xr(e);h&&(this.stack[this.stack.length-1].push(new Rc(this.lang)),this.lang=h.toLowerCase());var c=this.isRoot,d=this.siblingOrderStack;this.currentSiblingOrder=++d[d.length-1],d.push(0);var f=this.siblingTypeCountsStack,v=this.currentSiblingTypeCounts=f[f.length-1],g=v[this.currentNamespace];g||(g=v[this.currentNamespace]={}),g[this.currentLocalName]=(g[this.currentLocalName]||0)+1,f.push({});var p=this.followingSiblingOrderStack;this.currentFollowingSiblingOrder=p[p.length-1]!==null?--p[p.length-1]:null,p.push(null);var E=this.followingSiblingTypeCountsStack,C=this.currentFollowingSiblingTypeCounts=E[E.length-1];C&&C[this.currentNamespace]&&C[this.currentNamespace][this.currentLocalName]--,E.push({}),this.applyActions(),this.applyAttrFilter(e);var D=t.quotes,y=null;if(D){var N=D.evaluate(this.context);N&&(y=new Oc(this.quotes),N===b.none?this.quotes=[new Ae(""),new Ae("")]:N instanceof fe&&(this.quotes=N.values))}this.pushCounters(this.currentStyle);var x=this.currentId||this.currentXmlId||e.getAttribute("name")||"";if(c||x){var F={};Object.keys(this.counters).forEach(function(X){F[X]=Array.from(i.counters[X])}),this.counterListener.countersOfId(x,F)}var k=yn(this.currentStyle,"_pseudos");if(k)for(var H,K=!0,q=B(Mc);!(H=q()).done;){var W=H.value;W||(K=!1);var G=k[W];G&&(K?this.processPseudoelementProps(G,e):this.stack[this.stack.length-2].push(new Pc(G,e)))}this.setNamedStrings(this.currentStyle),y&&this.stack[this.stack.length-2].push(y)},r.applyAttrFilterInner=function(e,t){for(var n in t)nr(n)&&(t[n]=t[n].filterValue(e))},r.applyAttrFilter=function(e){var t=new kc(e),n=this.currentStyle,i=yn(n,"_pseudos");for(var a in i)this.applyAttrFilterInner(t,i[a]);this.applyAttrFilterInner(t,n)},r.applyActions=function(){var e;for(e=0;e<this.currentClassNames.length;e++)this.applyAction(this.code.classes,this.currentClassNames[e]);for(e=0;e<this.currentEpubTypes.length;e++)this.applyAction(this.code.epubtypes,this.currentEpubTypes[e]);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),this.currentPageType!==null&&(this.applyAction(this.code.pagetypes,this.currentPageType),this.applyAction(this.code.pagetypes,"*")),this.stack.push([]);for(var t=1;t>=-1;--t){var n=this.stack[this.stack.length-t-2];for(e=0;e<n.length;)n[e].push(this,t)?n.splice(e,1):e++}this.isFirst=!0,this.isRoot=!1},r.pop=function(){for(var e=1;e>=-1;--e)for(var t=this.stack[this.stack.length-e-2],n=0;n<t.length;)t[n].pop(this,e)?t.splice(n,1):n++;this.stack.pop(),this.isFirst=!1},r.popRule=function(){this.pop()},r.popElement=function(e){this.siblingOrderStack.pop(),this.siblingTypeCountsStack.pop(),this.followingSiblingOrderStack.pop(),this.followingSiblingTypeCountsStack.pop(),this.pop(),this.popCounters()},o}(),To=[],Mc=["before","transclusion-before","footnote-call","footnote-marker","inner","first-letter","first-line","","transclusion-after","after"];(function(o){o[o.TOP=0]="TOP",o[o.SELECTOR=1]="SELECTOR",o[o.RULE=2]="RULE"})(qe||(qe={}));var xo=null,mi=function(o){function r(t,n,i,a,s,u,h){var c;return(c=o.call(this,t,n,h)||this).condition=void 0,c.regionId=void 0,c.validatorSet=void 0,c.chain=null,c.specificity=0,c.elementStyle=null,c.conditionCount=0,c.pseudoelement=null,c.footnoteContent=!1,c.cascade=void 0,c.state=void 0,c.viewConditionId=null,c.insideSelectorRule=void 0,c.condition=i,c.regionId=s,c.validatorSet=u,c.cascade=a?a.cascade:xo?xo.clone():new Bc,c.state=qe.TOP,c}w(r,o);var e=r.prototype;return e.insertNonPrimary=function(t){this.cascade.insertInTable(this.cascade.tags,"*",t)},e.processChain=function(t){var n=Bs(this.chain,t);n!==t&&n.makePrimary(this.cascade)||this.insertNonPrimary(n)},e.isInsideSelectorRule=function(t){return this.state!=qe.TOP&&(this.reportAndSkip(t),!0)},e.tagSelector=function(t,n){(n||t)&&(this.specificity+=1,this.chain.push(n&&t?new fc(t,n.toLowerCase()):n?new Ms(n.toLowerCase()):new gc(t)))},e.classSelector=function(t){if(this.pseudoelement)return M.warn("::"+this.pseudoelement,"followed by ."+t),void this.chain.push(new qt(""));this.specificity+=256,this.chain.push(new cc(t))},e.pseudoclassSelector=function(t,n){if(this.pseudoelement)return M.warn("::"+this.pseudoelement,"followed by :"+t),void this.chain.push(new qt(""));switch(t.toLowerCase()){case"enabled":this.chain.push(new yc);break;case"disabled":this.chain.push(new Nc);break;case"checked":this.chain.push(new bc);break;case"root":this.chain.push(new Cc);break;case"link":this.chain.push(new Ms("a")),this.chain.push(new Us("","href"));break;case"-adapt-href-epub-type":case"href-epub-type":if(n&&n.length==1&&typeof n[0]=="string"){var i=new RegExp("(^|s)"+hn(n[0])+"($|s)");this.chain.push(new pc(i))}else this.chain.push(new qt(""));break;case"-adapt-footnote-content":case"footnote-content":this.footnoteContent=!0;break;case"visited":case"active":case"hover":case"focus":this.chain.push(new qt(""));break;case"lang":this.chain.push(n&&n.length==1&&typeof n[0]=="string"?new Ec(new RegExp("^"+hn(n[0].toLowerCase())+"($|-)")):new qt(""));break;case"nth-child":case"nth-last-child":case"nth-of-type":case"nth-last-of-type":var a=Uc[t.toLowerCase()];this.chain.push(n&&n.length==2?new a(n[0],n[1]):new qt(""));break;case"first-child":this.chain.push(new Vs);break;case"last-child":this.chain.push(new No(0,1));break;case"first-of-type":this.chain.push(new yo(0,1));break;case"last-of-type":this.chain.push(new bo(0,1));break;case"only-child":this.chain.push(new Vs),this.chain.push(new No(0,1));break;case"only-of-type":this.chain.push(new yo(0,1)),this.chain.push(new bo(0,1));break;case"empty":this.chain.push(new wc);break;case"before":case"after":case"first-line":case"first-letter":return void this.pseudoelementSelector(t,n);default:M.warn("unknown pseudo-class selector: "+t),this.chain.push(new qt(""))}this.specificity+=256},e.pseudoelementSelector=function(t,n){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?(M.warn("Double pseudoelement ::"+this.pseudoelement+"::"+t),this.chain.push(new qt(""))):this.pseudoelement=t;break;case"first-n-lines":if(n&&n.length==1&&typeof n[0]=="number"){var i=Math.round(n[0]);if(i>0&&i==n[0]){this.pseudoelement?(M.warn("Double pseudoelement ::"+this.pseudoelement+"::"+t),this.chain.push(new qt(""))):this.pseudoelement="first-"+i+"-lines";break}}this.chain.push(new qt(""));break;case"nth-fragment":n&&n.length==2?this.viewConditionId="NFS_"+n[0]+"_"+n[1]:this.chain.push(new qt(""));break;default:M.warn("Unrecognized pseudoelement: ::"+t),this.chain.push(new qt(""))}this.specificity+=1},e.idSelector=function(t){this.specificity+=65536,this.chain.push(new dc(t))},e.attributeSelector=function(t,n,i,a){var s;switch(this.specificity+=256,n=n.toLowerCase(),a=a||"",i){case m.EOF:s=new Us(t,n);break;case m.EQ:s=new vc(t,n,a);break;case m.TILDE_EQ:s=!a||a.match(/\s/)?new qt(""):new gi(t,n,new RegExp("(^|\\s)"+hn(a)+"($|\\s)"));break;case m.BAR_EQ:s=new gi(t,n,new RegExp("^"+hn(a)+"($|-)"));break;case m.HAT_EQ:s=a?new gi(t,n,new RegExp("^"+hn(a))):new qt("");break;case m.DOLLAR_EQ:s=a?new gi(t,n,new RegExp(hn(a)+"$")):new qt("");break;case m.STAR_EQ:s=a?new gi(t,n,new RegExp(hn(a))):new qt("");break;case m.COL_COL:a=="supported"?s=new mc(t,n):(M.warn("Unsupported :: attr selector op:",a),s=new qt(""));break;default:M.warn("Unsupported attr selector:",i),s=new qt("")}this.chain.push(s)},e.descendantSelector=function(){var t="d"+sr++;this.processChain(new or(new Tc(t,this.viewConditionId,null))),this.chain=[new qt(t)],this.viewConditionId=null},e.childSelector=function(){var t="c"+sr++;this.processChain(new or(new xc(t,this.viewConditionId,null))),this.chain=[new qt(t)],this.viewConditionId=null},e.adjacentSiblingSelector=function(){var t="a"+sr++;this.processChain(new or(new Ic(t,this.viewConditionId,null))),this.chain=[new qt(t)],this.viewConditionId=null},e.followingSiblingSelector=function(){var t="f"+sr++;this.processChain(new or(new Fc(t,this.viewConditionId,null))),this.chain=[new qt(t)],this.viewConditionId=null},e.nextSelector=function(){this.finishChain(),this.pseudoelement=null,this.footnoteContent=!1,this.specificity=0,this.chain=[]},e.startSelectorRule=function(){this.isInsideSelectorRule("E_CSS_UNEXPECTED_SELECTOR")||(this.state=qe.SELECTOR,this.elementStyle={},this.pseudoelement=null,this.specificity=0,this.footnoteContent=!1,this.chain=[])},e.error=function(t,n){o.prototype.error.call(this,t,n),this.state==qe.SELECTOR&&(this.state=qe.TOP)},e.startStylesheet=function(t){o.prototype.startStylesheet.call(this,t),this.state=qe.TOP},e.startRuleBody=function(){this.finishChain(),o.prototype.startRuleBody.call(this),this.state==qe.SELECTOR&&(this.state=qe.TOP)},e.endRule=function(){o.prototype.endRule.call(this),this.insideSelectorRule=qe.TOP},e.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}},e.makeApplyRuleAction=function(t){var n=this.regionId;return this.footnoteContent&&(n=n?"xxx-bogus-xxx":"footnote"),new _s(this.elementStyle,t,this.pseudoelement,n,this.viewConditionId)},e.special=function(t,n){var i;i=this.condition?new Do(n,0,this.condition):new Dt(n,0),Ls(this.elementStyle,t).push(i)},e.property=function(t,n,i){this.validatorSet.validatePropertyAndHandleShorthand(t,n,i,this)},e.invalidPropertyValue=function(t,n){this.report("E_INVALID_PROPERTY_VALUE "+t+": "+n.toString())},e.unknownProperty=function(t,n){this.report("E_INVALID_PROPERTY "+t+": "+n.toString())},e.simpleProperty=function(t,n,i){t!="display"||n!==b.oeb_page_head&&n!==b.oeb_page_foot||(this.simpleProperty("flow-options",new fe([b.exclusive,b._static]),i),this.simpleProperty("flow-into",n,i),n=b.block),se("SIMPLE_PROPERTY").forEach(function(u){var h=u({name:t,value:n,important:i});t=h.name,n=h.value,i=h.important});var a=i?this.getImportantSpecificity():this.getBaseSpecificity(),s=this.condition?new Do(n,a,this.condition):new Dt(n,a);Je(this.elementStyle,t,s)},e.finish=function(){return this.cascade},e.startFuncWithSelector=function(t){switch(t){case"not":var n=new Vc(this);n.startSelectorRule(),this.owner.pushHandler(n)}},r}(ci),Uc={"nth-child":Dc,"nth-of-type":yo,"nth-last-child":No,"nth-last-of-type":bo},sr=0,Vc=function(o){function r(t){var n;return(n=o.call(this,t.scope,t.owner,t.condition,t,t.regionId,t.validatorSet,!1)||this).parent=void 0,n.parentChain=void 0,n.parent=t,n.parentChain=t.chain,n}w(r,o);var e=r.prototype;return e.startFuncWithSelector=function(t){t=="not"&&this.reportAndSkip("E_CSS_UNEXPECTED_NOT")},e.startRuleBody=function(){this.reportAndSkip("E_CSS_UNEXPECTED_RULE_BODY")},e.nextSelector=function(){this.reportAndSkip("E_CSS_UNEXPECTED_NEXT_SELECTOR")},e.endFuncWithSelector=function(){this.chain&&this.chain.length>0&&this.parentChain.push(new Ac(this.chain)),this.parent.specificity+=this.specificity,this.owner.popHandler()},e.error=function(t,n){o.prototype.error.call(this,t,n),this.owner.popHandler()},r}(mi),Hc=function(o){function r(e,t){return o.call(this,e,t,!1)||this}return w(r,o),r.prototype.property=function(e,t,n){if(this.scope.values[e])this.error("E_CSS_NAME_REDEFINED "+e,this.getCurrentToken());else{var i=e.match(/height|^(top|bottom)$/)?"vh":"vw",a=new Mn(this.scope,100,i);this.scope.defineName(e,t.toExpr(this.scope,a))}},r}(ci),ur=function(o){function r(t,n,i,a,s){var u;return(u=o.call(this,t,n,!1)||this).condition=void 0,u.elementStyle=void 0,u.validatorSet=void 0,u.order=void 0,u.condition=i,u.elementStyle=a,u.validatorSet=s,u.order=0,u}w(r,o);var e=r.prototype;return e.property=function(t,n,i){i?M.warn("E_IMPORTANT_NOT_ALLOWED"):this.validatorSet.validatePropertyAndHandleShorthand(t,n,i,this)},e.invalidPropertyValue=function(t,n){M.warn("E_INVALID_PROPERTY_VALUE",t+":",n.toString())},e.unknownProperty=function(t,n){M.warn("E_INVALID_PROPERTY",t+":",n.toString())},e.simpleProperty=function(t,n,i){var a=i?this.getImportantSpecificity():this.getBaseSpecificity();a+=this.order,this.order+=95367431640625e-20;var s=this.condition?new Do(n,a,this.condition):new Dt(n,a);Je(this.elementStyle,t,s)},r}(ci),zc=function(o){function r(t,n){var i;return(i=o.call(this,t)||this).validatorSet=void 0,i.elementStyle={},i.order=0,i.validatorSet=n,i}w(r,o);var e=r.prototype;return e.property=function(t,n,i){this.validatorSet.validatePropertyAndHandleShorthand(t,n,i,this)},e.invalidPropertyValue=function(t,n){M.warn("E_INVALID_PROPERTY_VALUE",t+":",n.toString())},e.unknownProperty=function(t,n){M.warn("E_INVALID_PROPERTY",t+":",n.toString())},e.simpleProperty=function(t,n,i){var a=i?67108864:50331648;a+=this.order,this.order+=95367431640625e-20;var s=new Dt(n,a);Je(this.elementStyle,t,s)},r}(Cs);function Ws(o,r){var e=Os(o);e&&e.forEach(function(t){t.matcher.matches()&&r(t.styles)})}function Io(o,r,e){Ws(e,function(t){Ei(o,t,r)})}function Xs(o,r,e){var t=o["writing-mode"];if(t){var n=t.evaluate(r,"writing-mode");if(n&&n!==b.inherit)return n===b.vertical_rl}return e}function js(o,r,e){var t=o.direction;if(t){var n=t.evaluate(r,"direction");if(n&&n!==b.inherit)return n===b.rtl}return e}function Ys(o,r,e,t,n){var i={};for(var a in o)nr(a)&&(i[a]=Be(o,a));return Io(i,r,o),Ks(o,e,t,function(s,u){Ei(i,u,r),Io(i,r,u)}),i}function Ks(o,r,e,t){var n=yn(o,"_regions");if((r||e)&&n){if(e){var i=["footnote"];r=r?r.concat(i):i}for(var a,s=B(r);!(a=s()).done;){var u=a.value,h=n[u];h&&t(u,h)}}}function Ei(o,r,e){for(var t in r)if(nr(t)){var n=Be(r,t);o[t]=fi(e,o[t],n)}}var qs=function(o,r,e,t,n){var i=e?t?sc:Is:t?uc:Fs;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];if(!s)continue;var u=i[a],h=void 0;if(u){var c=o[u];if(c&&c.priority>s.priority)continue;h=ac[u]?u:a}else h=a;r[h]=n(a,s)}};function Qs(o,r){var e={};return Object.keys(o).forEach(function(t){var n=e[t]={},i=o[t];Object.keys(i).forEach(function(a){n[a]=i[a].map(function(s){var u=r?s.physical:s.logical;return{regexp:new RegExp("(-?)"+(r?s.logical:s.physical)+"(-?)"),to:"$1"+u+"$2"}})})}),e}function Zs(o,r,e,t){var n=t[r];if(!n)throw new Error("unknown writing-mode: "+r);var i=n[e||"ltr"];if(!i)throw new Error("unknown direction: "+e);for(var a,s=B(i);!(a=s()).done;){var u=a.value,h=o.replace(u.regexp,u.to);if(h!==o)return h}return o}var Pt,$s={"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"}]}},Gc=Qs($s,!0),Wc=Qs($s,!1);function Fo(o,r,e){var t={display:r.style.display,position:r.style.position,width:r.style.width,maxWidth:r.style.maxWidth,minWidth:r.style.minWidth,height:r.style.height,maxHeight:r.style.maxHeight,minHeight:r.style.minHeight},n=r.parentNode,i=r.ownerDocument.createElement("div");function a(y){return o.getElementComputedStyle(r).getPropertyValue(y)}T(i,"position",t.position),n.insertBefore(i,r),i.appendChild(r),T(r,"width","auto"),T(r,"max-width","none"),T(r,"min-width","0"),T(r,"height","auto"),T(r,"max-height","none"),T(r,"min-height","0");var s=pa("writing-mode"),u=(s?a(s[0]):null)||a("writing-mode"),h=u==="vertical-rl"||u==="tb-rl"||u==="vertical-lr"||u==="tb-lr",c=h?"height":"width",d=h?"width":"height";function f(){return T(r,"display","block"),T(r,"position","static"),a(c)}function v(){T(r,"display","inline-block"),T(i,c,"99999999px");var y=a(c);return T(i,c,""),y}function g(){T(r,"display","inline-block"),T(i,c,"0");var y=a(c);return T(i,c,""),y}function p(){var y=f(),N=g(),x=parseFloat(y);if(x<=parseFloat(N))return N;var F=v();return x<=parseFloat(F)?y:F}function E(){return a(d)}function C(){throw new Error("Getting fill-available block size is not implemented")}var D={};return e.forEach(function(y){var N;switch(y){case Pt.FILL_AVAILABLE_INLINE_SIZE:N=f();break;case Pt.MAX_CONTENT_INLINE_SIZE:N=v();break;case Pt.MIN_CONTENT_INLINE_SIZE:N=g();break;case Pt.FIT_CONTENT_INLINE_SIZE:N=p();break;case Pt.FILL_AVAILABLE_BLOCK_SIZE:N=C();break;case Pt.MAX_CONTENT_BLOCK_SIZE:case Pt.MIN_CONTENT_BLOCK_SIZE:case Pt.FIT_CONTENT_BLOCK_SIZE:N=E();break;case Pt.FILL_AVAILABLE_WIDTH:N=h?C():f();break;case Pt.FILL_AVAILABLE_HEIGHT:N=h?f():C();break;case Pt.MAX_CONTENT_WIDTH:N=h?E():v();break;case Pt.MAX_CONTENT_HEIGHT:N=h?v():E();break;case Pt.MIN_CONTENT_WIDTH:N=h?E():g();break;case Pt.MIN_CONTENT_HEIGHT:N=h?g():E();break;case Pt.FIT_CONTENT_WIDTH:N=h?E():p();break;case Pt.FIT_CONTENT_HEIGHT:N=h?p():E()}D[y]=parseFloat(N),T(r,"position",t.position),T(r,"display",t.display)}),T(r,"width",t.width),T(r,"max-width",t.maxWidth),T(r,"min-width",t.minWidth),T(r,"height",t.height),T(r,"max-height",t.maxHeight),T(r,"min-height",t.minHeight),n.insertBefore(r,i),n.removeChild(i),D}(function(o){o.FILL_AVAILABLE_INLINE_SIZE="fill-available inline size",o.FILL_AVAILABLE_BLOCK_SIZE="fill-available block size",o.FILL_AVAILABLE_WIDTH="fill-available width",o.FILL_AVAILABLE_HEIGHT="fill-available height",o.MAX_CONTENT_INLINE_SIZE="max-content inline size",o.MAX_CONTENT_BLOCK_SIZE="max-content block size",o.MAX_CONTENT_WIDTH="max-content width",o.MAX_CONTENT_HEIGHT="max-content height",o.MIN_CONTENT_INLINE_SIZE="min-content inline size",o.MIN_CONTENT_BLOCK_SIZE="min-content block size",o.MIN_CONTENT_WIDTH="min-content width",o.MIN_CONTENT_HEIGHT="min-content height",o.FIT_CONTENT_INLINE_SIZE="fit-content inline size",o.FIT_CONTENT_BLOCK_SIZE="fit-content block size",o.FIT_CONTENT_WIDTH="fit-content width",o.FIT_CONTENT_HEIGHT="fit-content height"})(Pt||(Pt={}));var ne=Gn.FloatReference;function lr(o){switch(o){case ne.INLINE:return!1;case ne.COLUMN:case ne.REGION:case ne.PAGE:return!0;default:throw new Error("Unknown float-reference: "+o)}}var Js=function(){function o(e,t,n,i,a,s){this.nodePosition=void 0,this.floatReference=void 0,this.floatSide=void 0,this.clearSide=void 0,this.flowName=void 0,this.floatMinWrapBlock=void 0,this.order=null,this.id=null,this.nodePosition=e,this.floatReference=t,this.floatSide=n,this.clearSide=i,this.flowName=a,this.floatMinWrapBlock=s}var r=o.prototype;return r.getOrder=function(){if(this.order===null)throw new Error("The page float is not yet added");return this.order},r.getId=function(){if(!this.id)throw new Error("The page float is not yet added");return this.id},r.isAllowedOnContext=function(e){return e.isAnchorAlreadyAppeared(this.getId())},r.isAllowedToPrecede=function(e){return!1},o}(),Xc=function(){function o(){this.floats=[],this.nextPageFloatIndex=0}var r=o.prototype;return r.nextOrder=function(){return this.nextPageFloatIndex++},r.createPageFloatId=function(e){return"pf"+e},r.addPageFloat=function(e){if(this.floats.findIndex(function(n){return Dn(n.nodePosition,e.nodePosition)})>=0)throw new Error("A page float with the same source node is already registered");var t=e.order=this.nextOrder();e.id=this.createPageFloatId(t),this.floats.push(e)},r.findPageFloatByNodePosition=function(e){var t=this.floats.findIndex(function(n){return Dn(n.nodePosition,e)});return t>=0?this.floats[t]:null},r.findPageFloatById=function(e){var t=this.floats.findIndex(function(n){return n.id===e});return t>=0?this.floats[t]:null},o}(),tu=function(){function o(e,t,n,i,a){this.floatReference=void 0,this.floatSide=void 0,this.continuations=void 0,this.area=void 0,this.continues=void 0,this.floatReference=e,this.floatSide=t,this.continuations=n,this.area=i,this.continues=a}var r=o.prototype;return r.hasFloat=function(e){return this.continuations.some(function(t){return t.float===e})},r.findNotAllowedFloat=function(e){for(var t=this.continuations.length-1;t>=0;t--){var n=this.continuations[t].float;if(!n.isAllowedOnContext(e))return n}return null},r.getOuterShape=function(){return this.area.getOuterShape(null,null)},r.getOuterRect=function(){return this.area.getOuterRect()},r.getOrder=function(){var e=this.continuations.map(function(t){return t.float});return Math.min.apply(null,e.map(function(t){return t.getOrder()}))},r.shouldBeStashedBefore=function(e){return this.getOrder()<e.getOrder()},r.addContinuations=function(e){var t=this;e.forEach(function(n){t.continuations.push(n)})},r.getFlowName=function(){var e=this.continuations[0].float.flowName;return this.continuations.every(function(t){return t.float.flowName===e}),e},o}(),eu=function(){function o(r,e){this.float=void 0,this.nodePosition=void 0,this.float=r,this.nodePosition=e}return o.prototype.equals=function(r){return!!r&&(this===r||this.float===r.float&&Dn(this.nodePosition,r.nodePosition))},o}(),Ci=function(){function o(e,t,n,i,a,s,u){this.parent=void 0,this.floatReference=void 0,this.container=void 0,this.flowName=void 0,this.generatingNodePosition=void 0,this.children=[],this.writingMode=void 0,this.direction=void 0,this.invalidated=!1,this.floatStore=void 0,this.forbiddenFloats=[],this.floatFragments=[],this.stashedFloatFragments=[],this.floatAnchors={},this.floatsDeferredToNext=[],this.floatsDeferredFromPrevious=void 0,this.layoutConstraints=[],this.locked=!1,this.parent=e,this.floatReference=t,this.container=n,this.flowName=i,this.generatingNodePosition=a,e&&e.children.push(this),this.writingMode=s||e&&e.writingMode||b.horizontal_tb,this.direction=u||e&&e.direction||b.ltr,this.floatStore=e?e.floatStore:new Xc;var h=this.getPreviousSibling();this.floatsDeferredFromPrevious=h?[].concat(h.floatsDeferredToNext):[]}var r=o.prototype;return r.getParent=function(e){if(!this.parent)throw new Error("No PageFloatLayoutContext for "+e);return this.parent},r.getPreviousSiblingOf=function(e,t,n,i){var a=this.children.indexOf(e);a<0&&(a=this.children.length);for(var s=a-1;s>=0;s--){var u=this.children[s];if(u.floatReference===t&&u.flowName===n&&Dn(u.generatingNodePosition,i)||(u=u.getPreviousSiblingOf(null,t,n,i)))return u}return null},r.getPreviousSibling=function(){for(var e,t=this,n=this.parent;n;){if(e=n.getPreviousSiblingOf(t,this.floatReference,this.flowName,this.generatingNodePosition))return e;t=n,n=n.parent}return null},r.getContainer=function(e){return e&&e!==this.floatReference?this.getParent(e).getContainer(e):this.container},r.setContainer=function(e){this.container=e,this.reattachFloatFragments()},r.addPageFloat=function(e){this.floatStore.addPageFloat(e)},r.getPageFloatLayoutContext=function(e){return e===this.floatReference?this:this.getParent(e).getPageFloatLayoutContext(e)},r.findPageFloatByNodePosition=function(e){return this.floatStore.findPageFloatByNodePosition(e)},r.forbid=function(e){var t=e.getId(),n=e.floatReference;n===this.floatReference?this.forbiddenFloats.includes(t)||(this.forbiddenFloats.push(t),new jn().findByFloat(e).forbid(e,this)):this.getParent(n).forbid(e)},r.isForbidden=function(e){var t=e.getId(),n=e.floatReference;return n===this.floatReference?this.forbiddenFloats.includes(t):this.getParent(n).isForbidden(e)},r.addPageFloatFragment=function(e,t){var n=e.floatReference;n!==this.floatReference?this.getParent(n).addPageFloatFragment(e,t):this.floatFragments.includes(e)||(this.floatFragments.push(e),this.floatFragments.sort(function(i,a){return i.getOrder()-a.getOrder()})),t||this.invalidate()},r.removePageFloatFragment=function(e,t){var n=e.floatReference;if(n!==this.floatReference)this.getParent(n).removePageFloatFragment(e,t);else{var i=this.floatFragments.indexOf(e);if(i>=0){var a=this.floatFragments.splice(i,1)[0],s=a.area&&a.area.element;s&&s.parentNode&&s.parentNode.removeChild(s),t||this.invalidate()}}},r.findPageFloatFragment=function(e){if(e.floatReference!==this.floatReference)return this.getParent(e.floatReference).findPageFloatFragment(e);var t=this.floatFragments.findIndex(function(n){return n.hasFloat(e)});return t>=0?this.floatFragments[t]:null},r.hasFloatFragments=function(e){return!(!(this.floatFragments.length>0)||e&&!this.floatFragments.some(e))||!!this.parent&&this.parent.hasFloatFragments(e)},r.hasContinuingFloatFragmentsInFlow=function(e){return this.hasFloatFragments(function(t){return t.continues&&t.getFlowName()===e})},r.registerPageFloatAnchor=function(e,t){this.floatAnchors[e.getId()]=t},r.collectPageFloatAnchors=function(){var e=Object.assign({},this.floatAnchors);return this.children.reduce(function(t,n){return Object.assign(t,n.collectPageFloatAnchors())},e)},r.isAnchorAlreadyAppeared=function(e){if(this.getDeferredPageFloatContinuations().some(function(n){return n.float.getId()===e}))return!0;var t=this.collectPageFloatAnchors()[e];return!!t&&!(!this.container||!this.container.element)&&this.container.element.contains(t)},r.deferPageFloat=function(e){var t=e.float;if(t.floatReference===this.floatReference){var n=this.floatsDeferredToNext.findIndex(function(i){return i.float===t});n>=0?this.floatsDeferredToNext.splice(n,1,e):this.floatsDeferredToNext.push(e)}else this.getParent(t.floatReference).deferPageFloat(e)},r.hasPrecedingFloatsDeferredToNext=function(e,t){if(!t&&e.floatReference!==this.floatReference)return this.getParent(e.floatReference).hasPrecedingFloatsDeferredToNext(e,!1);var n=e.getOrder();return!!this.floatsDeferredToNext.some(function(i){return i.float.getOrder()<n&&!e.isAllowedToPrecede(i.float)})||!!this.parent&&this.parent.hasPrecedingFloatsDeferredToNext(e,!0)},r.getLastFollowingFloatInFragments=function(e){var t=e.getOrder(),n=null;if(this.floatFragments.forEach(function(a){a.continuations.forEach(function(s){var u=s.float,h=u.getOrder();h>t&&(!n||h>n.getOrder())&&(n=u)})}),this.parent){var i=this.parent.getLastFollowingFloatInFragments(e);i&&(!n||i.getOrder()>n.getOrder())&&(n=i)}return n},r.getDeferredPageFloatContinuations=function(e){e=e||this.flowName;var t=this.floatsDeferredFromPrevious.filter(function(n){return!e||n.float.flowName===e});return this.parent&&(t=this.parent.getDeferredPageFloatContinuations(e).concat(t)),t.sort(function(n,i){return n.float.getOrder()-i.float.getOrder()})},r.getPageFloatContinuationsDeferredToNext=function(e){e=e||this.flowName;var t=this.floatsDeferredToNext.filter(function(n){return!e||n.float.flowName===e});return this.parent?this.parent.getPageFloatContinuationsDeferredToNext(e).concat(t):t},r.getFloatsDeferredToNextInChildContexts=function(){for(var e=[],t=[],n=this.children.length-1;n>=0;n--){var i=this.children[n];t.includes(i.flowName)||(t.push(i.flowName),e=(e=e.concat(i.floatsDeferredToNext.map(function(a){return a.float}))).concat(i.getFloatsDeferredToNextInChildContexts()))}return e},r.checkAndForbidNotAllowedFloat=function(){if(this.checkAndForbidFloatFollowingDeferredFloat())return!0;for(var e=this.floatFragments.length-1;e>=0;e--){var t=this.floatFragments[e],n=t.findNotAllowedFloat(this);if(n)return this.locked?this.invalidate():(this.removePageFloatFragment(t),this.forbid(n),this.removeEndFloatFragments(t.floatSide)),!0}return!(this.floatReference!==ne.REGION||!this.parent.locked)&&this.parent.checkAndForbidNotAllowedFloat()},r.checkAndForbidFloatFollowingDeferredFloat=function(){var e=this,t=this.getFloatsDeferredToNextInChildContexts(),n=this.floatFragments.reduce(function(h,c){return h.concat(c.continuations.map(function(d){return d.float}))},[]);n.sort(function(h,c){return c.getOrder()-h.getOrder()});for(var i,a=function(){var h=i.value,c=h.getOrder();if(t.some(function(f){return!h.isAllowedToPrecede(f)&&c>f.getOrder()})){if(e.locked)e.invalidate();else{e.forbid(h);var d=e.findPageFloatFragment(h);e.removePageFloatFragment(d)}return{v:!0}}},s=B(n);!(i=s()).done;){var u=a();if(typeof u=="object")return u.v}return!1},r.finish=function(){var e=this;if(!this.checkAndForbidNotAllowedFloat()){for(var t=this.floatsDeferredToNext.length-1;t>=0;t--)if(!this.floatsDeferredToNext[t].float.isAllowedOnContext(this)){if(this.locked)return void this.invalidate();this.floatsDeferredToNext.splice(t,1)}this.floatsDeferredFromPrevious.forEach(function(n){e.floatsDeferredToNext.findIndex(function(i){return n.equals(i)})>=0||e.floatFragments.some(function(i){return i.hasFloat(n.float)})||e.floatsDeferredToNext.push(n)})}},r.hasSameContainerAs=function(e){return!!this.container&&!!e.container&&this.container.element===e.container.element},r.invalidate=function(){var e=this;this.invalidated=!0,this.locked||(this.container&&(this.children.forEach(function(t){e.hasSameContainerAs(t)&&t.floatFragments.forEach(function(n){var i=n.area.element;i&&i.parentNode&&i.parentNode.removeChild(i)})}),this.container.clear()),this.children.forEach(function(t){t.layoutConstraints.splice(0)}),this.children.splice(0),Object.keys(this.floatAnchors).forEach(function(t){delete e.floatAnchors[t]}))},r.detachChildren=function(){var e=this.children.splice(0);return e.forEach(function(t){t.floatFragments.forEach(function(n){var i=n.area.element;i&&i.parentNode&&i.parentNode.removeChild(i)})}),e},r.attachChildren=function(e){var t=this;e.forEach(function(n){t.children.push(n),n.reattachFloatFragments()})},r.isInvalidated=function(){return this.invalidated||!!this.parent&&this.parent.isInvalidated()},r.validate=function(){this.invalidated=!1},r.toLogical=function(e){return Zs(e,this.writingMode.toString(),this.direction.toString()||null,Wc)},r.toPhysical=function(e){return Zs(e,this.writingMode.toString(),this.direction.toString()||null,Gc)},r.removeEndFloatFragments=function(e){var t=this.toLogical(e);if(t==="block-end"||t==="inline-end")for(var n=0;n<this.floatFragments.length;){var i=this.floatFragments[n];this.toLogical(i.floatSide)===t?this.removePageFloatFragment(i):n++}},r.stashEndFloatFragments=function(e){var t=e.floatReference;if(t===this.floatReference){var n=this.toLogical(e.floatSide);if(n==="block-end"||n==="snap-block"||n==="inline-end")for(var i=0;i<this.floatFragments.length;){var a=this.floatFragments[i],s=this.toLogical(a.floatSide);(s===n||n==="snap-block"&&s==="block-end")&&a.shouldBeStashedBefore(e)?(this.stashedFloatFragments.push(a),this.floatFragments.splice(i,1)):i++}}else this.getParent(t).stashEndFloatFragments(e)},r.restoreStashedFragments=function(e){var t=this;e===this.floatReference?(this.stashedFloatFragments.forEach(function(n){t.addPageFloatFragment(n,!0)}),this.stashedFloatFragments.splice(0)):this.getParent(e).restoreStashedFragments(e)},r.discardStashedFragments=function(e){e===this.floatReference?this.stashedFloatFragments.splice(0):this.getParent(e).discardStashedFragments(e)},r.getStashedFloatFragments=function(e){return e===this.floatReference?this.stashedFloatFragments.concat().sort(function(t,n){return n.getOrder()-t.getOrder()}):this.getParent(e).getStashedFloatFragments(e)},r.getLimitValue=function(e,t,n,i){var a=this.toLogical(e),s=this.toPhysical(e),u=this.getLimitValueInner(a,t,n,i);if(this.parent&&this.parent.container){var h=this.parent.getLimitValue(s,t,n,i);switch(s){case"top":case"left":return Math.max(u,h);case"bottom":case"right":return Math.min(u,h)}}return u},r.getLimitValueInner=function(e,t,n,i){var a=this.getLimitValuesInner(t,n,i);switch(e){case"block-start":return this.container.vertical?a.right:a.top;case"block-end":return this.container.vertical?a.left:a.bottom;case"inline-start":return this.container.vertical?a.top:a.left;case"inline-end":return this.container.vertical?a.bottom:a.right;default:throw new Error("Unknown logical side: "+e)}},r.getLimitValuesInner=function(e,t,n){var i=this,a=this.container.originX,s=this.container.originY,u=this.container.getPaddingRect(),h={top:u.y1-s,left:u.x1-a,bottom:u.y2-s,right:u.x2-a,floatMinWrapBlockStart:0,floatMinWrapBlockEnd:0};function c(f,v,g){return f.unit==="%"?g*f.num/100:e.convertLengthToPx(f,v,t)}var d=this.floatFragments;return d.length>0&&(h=d.reduce(function(f,v){if(n&&!n(v,i))return f;var g=i.toLogical(v.floatSide),p=v.area,E=v.continuations[0].float.floatMinWrapBlock,C=f.top,D=f.left,y=f.bottom,N=f.right,x=f.floatMinWrapBlockStart,F=f.floatMinWrapBlockEnd;switch(g){case"inline-start":p.vertical?C=Math.max(C,p.top+p.height):D=Math.max(D,p.left+p.width);break;case"block-start":p.vertical?(E&&p.left<N&&(x=c(E,p.rootViewNodes[0],u.x2-u.x1)),N=Math.min(N,p.left)):(E&&p.top+p.height>C&&(x=c(E,p.rootViewNodes[0],u.y2-u.y1)),C=Math.max(C,p.top+p.height));break;case"inline-end":p.vertical?y=Math.min(y,p.top):N=Math.min(N,p.left);break;case"block-end":p.vertical?(E&&p.left+p.width>D&&(F=c(E,p.rootViewNodes[0],u.x2-u.x1)),D=Math.max(D,p.left+p.width)):(E&&p.top<y&&(F=c(E,p.rootViewNodes[0],u.y2-u.y1)),y=Math.min(y,p.top));break;default:throw new Error("Unknown logical float side: "+g)}return{top:C,left:D,bottom:y,right:N,floatMinWrapBlockStart:x,floatMinWrapBlockEnd:F}},h)),h.left+=a,h.right+=a,h.top+=s,h.bottom+=s,h},r.setFloatAreaDimensions=function(e,t,n,i,a,s,u){if(t!==this.floatReference)return this.getParent(t).setFloatAreaDimensions(e,t,n,i,a,s,u);var h=this.toLogical(n);if(h==="snap-block"){if(!u["block-start"]&&!u["block-end"])return null}else if(!u[h])return null;var c,d,f,v,g=this.getLimitValue("block-start",e.layoutContext,e.clientLayout),p=this.getLimitValue("block-end",e.layoutContext,e.clientLayout),E=this.getLimitValue("inline-start",e.layoutContext,e.clientLayout),C=this.getLimitValue("inline-end",e.layoutContext,e.clientLayout),D=e.vertical?e.originX:e.originY,y=e.vertical?e.originY:e.originX;function N(H,K){var q=H(e.bands,K);return q?(e.vertical&&(q=ts(q)),g=e.vertical?Math.min(g,q.x2):Math.max(g,q.y1),p=e.vertical?Math.max(p,q.x1):Math.min(p,q.y2),!0):s}if(g=e.vertical?Math.min(g,e.left+e.getInsetLeft()+e.width+e.getInsetRight()+D):Math.max(g,e.top+D),p=e.vertical?Math.max(p,e.left+D):Math.min(p,e.top+e.getInsetTop()+e.height+e.getInsetBottom()+D),a){var x=e.vertical?zi(new ke(p,E,g,C)):new ke(E,g,C,p);if((h==="block-start"||h==="snap-block"||h==="inline-start")&&!N(ih,x)||(h==="block-end"||h==="snap-block"||h==="inline-end")&&!N(rh,x)||(c=(f=(p-g)*e.getBoxDir())-e.getInsetBefore()-e.getInsetAfter(),d=(v=C-E)-e.getInsetStart()-e.getInsetEnd(),!s&&(c<=0||d<=0)))return null}else{f=(c=e.computedBlockSize)+e.getInsetBefore()+e.getInsetAfter();var F=(p-g)*e.getBoxDir();if(h==="snap-block"){if(i===null)h="block-start";else{var k=this.container.getPaddingRect();h=this.container.getBoxDir()*(i-(this.container.vertical?k.x2:k.y1))<=this.container.getBoxDir()*((this.container.vertical?k.x1:k.y2)-i-f)?"block-start":"block-end"}if(!u[h]){if(!u["block-end"])return null;h="block-end"}}if(!s&&F<f||(v=(d=h==="inline-start"||h==="inline-end"?Fo(e.clientLayout,e.element,[Pt.FIT_CONTENT_INLINE_SIZE])[Pt.FIT_CONTENT_INLINE_SIZE]:e.adjustContentRelativeSize?e.getContentInlineSize():e.vertical?e.height:e.width)+e.getInsetStart()+e.getInsetEnd(),!s&&C-E<v))return null}switch(g-=D,p-=D,E-=y,C-=y,h){case"inline-start":case"block-start":case"snap-block":e.setInlinePosition(E,d),e.setBlockPosition(g,c);break;case"inline-end":case"block-end":e.setInlinePosition(C-v,d),e.setBlockPosition(p-f*e.getBoxDir(),c);break;default:throw new Error("unknown float direction: "+n)}return h},r.getFloatFragmentExclusions=function(){var e=this.floatFragments.map(function(t){return t.getOuterShape()});return this.parent?this.parent.getFloatFragmentExclusions().concat(e):e},r.reattachFloatFragments=function(){var e=this.container.element&&this.container.element.parentNode;e&&this.floatFragments.forEach(function(t){e.appendChild(t.area.element)})},r.getMaxReachedAfterEdge=function(){var e=this.getContainer().vertical;return this.floatFragments.reduce(function(t,n){var i=n.getOuterRect();return e?Math.min(t,i.x1):Math.max(t,i.y2)},e?1/0:0)},r.getBlockStartEdgeOfBlockEndFloats=function(){var e=this.getContainer().vertical;return this.floatFragments.filter(function(t){return t.floatSide==="block-end"}).reduce(function(t,n){var i=n.getOuterRect();return e?Math.max(t,i.x2):Math.min(t,i.y1)},e?0:1/0)},r.getPageFloatClearEdge=function(e,t){function n(c){return function(d){return c.isAnchorAlreadyAppeared(d.float.getId())}}function i(c,d){return c.continuations.some(n(d))}for(var a=t.getPaddingRect(),s=t.vertical?a.x1:a.y2,u=this;u;){if(u.floatsDeferredToNext.some(n(u)))return s;u=u.parent}var h=this.getLimitValue("block-start",t.layoutContext,t.clientLayout,i);return this.getLimitValue("block-end",t.layoutContext,t.clientLayout,i)*t.getBoxDir()<s*t.getBoxDir()?s:h},r.getPageFloatPlacementCondition=function(e,t,n){var i=this;if(e.floatReference!==this.floatReference)return this.getParent(e.floatReference).getPageFloatPlacementCondition(e,t,n);var a={"block-start":!0,"block-end":!0,"inline-start":!0,"inline-end":!0};if(!n)return a;var s,u=this.toLogical(t),h=this.toLogical(n);s=h==="all"?["block-start","block-end","inline-start","inline-end"]:h==="both"?["inline-start","inline-end"]:h==="same"?u==="snap-block"?["block-start","block-end"]:[u]:[h];var c=e.getOrder();function d(g){return function(p){return p.floatSide===g&&p.getOrder()<c}}function f(g,p){return g.children.some(function(E){return E.floatFragments.some(d(p))||f(E,p)})}function v(g,p){var E=g.parent;return!!E&&(E.floatFragments.some(d(p))||v(E,p))}return s.forEach(function(g){switch(g){case"block-start":case"inline-start":a[g]=!f(i,g);break;case"block-end":case"inline-end":a[g]=!v(i,g);break;default:throw new Error("Unexpected side: "+g)}}),a},r.getLayoutConstraints=function(){return(this.parent?this.parent.getLayoutConstraints():[]).concat(this.layoutConstraints)},r.addLayoutConstraint=function(e,t){t===this.floatReference?this.layoutConstraints.push(e):this.getParent(t).addLayoutConstraint(e,t)},r.isColumnFullWithPageFloats=function(e){for(var t=e.layoutContext,n=e.clientLayout,i=this,a=null;i&&i.container;){var s=i.getLimitValuesInner(t,n);a?e.vertical?(s.right<a.right&&(a.right=s.right,a.floatMinWrapBlockStart=s.floatMinWrapBlockStart),s.left>a.left&&(a.left=s.left,a.floatMinWrapBlockEnd=s.floatMinWrapBlockEnd)):(s.top>a.top&&(a.top=s.top,a.floatMinWrapBlockStart=s.floatMinWrapBlockStart),s.bottom<a.bottom&&(a.bottom=s.bottom,a.floatMinWrapBlockEnd=s.floatMinWrapBlockEnd)):a=s,i=i.parent}var u=Math.max(a.floatMinWrapBlockStart,a.floatMinWrapBlockEnd);return(e.vertical?a.right-a.left:a.bottom-a.top)<=u},r.getMaxBlockSizeOfPageFloats=function(){var e=this.getContainer().vertical;return this.floatFragments.length?Math.max.apply(null,this.floatFragments.map(function(t){var n=t.area;return e?n.width:n.height})):0},r.lock=function(){this.locked=!0},r.unlock=function(){this.locked=!1},r.isLocked=function(){return this.locked},o}(),Di=[],jn=function(){function o(){}o.register=function(e){Di.push(e)};var r=o.prototype;return r.findByNodeContext=function(e){for(var t=Di.length-1;t>=0;t--){var n=Di[t];if(n.appliesToNodeContext(e))return n}throw new Error("No PageFloatLayoutStrategy found for "+e)},r.findByFloat=function(e){for(var t=Di.length-1;t>=0;t--){var n=Di[t];if(n.appliesToFloat(e))return n}throw new Error("No PageFloatLayoutStrategy found for "+e)},o}();jn.register(new(function(){function o(){}var r=o.prototype;return r.appliesToNodeContext=function(e){return lr(e.floatReference)},r.appliesToFloat=function(e){return!0},r.createPageFloat=function(e,t,n){var i=e.floatReference,a=e.floatSide,s=e.toNodePosition();return n.resolveFloatReferenceFromColumnSpan(i,e.columnSpan,e).thenAsync(function(u){var h=new Js(s,i=u,a,e.clearSide,t.flowName,e.floatMinWrapBlock);return t.addPageFloat(h),I(h)})},r.createPageFloatFragment=function(e,t,n,i){return new tu(e[0].float.floatReference,t,e,n,i)},r.findPageFloatFragment=function(e,t){return t.findPageFloatFragment(e)},r.adjustPageFloatArea=function(e,t,n){},r.forbid=function(e,t){},o}()));var jc=tu,Po=function(o){function r(e,t,n,i,a){var s;return(s=o.call(this,e,t,"block-end",null,n,a)||this).footnotePolicy=void 0,s.footnotePolicy=i,s}return w(r,o),r.prototype.isAllowedToPrecede=function(e){return!(e instanceof r)},r}(Js),nu=function(o){function r(t,n,i,a){return o.call(this,t,"block-end",n,i,a)||this}w(r,o);var e=r.prototype;return e.getOrder=function(){return 1/0},e.shouldBeStashedBefore=function(t){return t instanceof Po||this.getOrder()<t.getOrder()},r}(jc),Yc=function(){function o(r){this.footnote=void 0,this.footnote=r}return o.prototype.allowLayout=function(r){return!Dn(r.toNodePosition(),this.footnote.nodePosition)},o}();jn.register(new(function(){function o(){}var r=o.prototype;return r.appliesToNodeContext=function(e){return e.floatSide==="footnote"},r.appliesToFloat=function(e){return e instanceof Po},r.createPageFloat=function(e,t,n){var i=ne.REGION,a=t.getPageFloatLayoutContext(i);t.getPageFloatLayoutContext(ne.PAGE).hasSameContainerAs(a)&&(i=ne.PAGE);var s=e.toNodePosition(),u=new Po(s,i,t.flowName,e.footnotePolicy,e.floatMinWrapBlock);return t.addPageFloat(u),I(u)},r.createPageFloatFragment=function(e,t,n,i){return new nu(e[0].float.floatReference,e,n,i)},r.findPageFloatFragment=function(e,t){return t.getPageFloatLayoutContext(e.floatReference).floatFragments.filter(function(n){return n instanceof nu})[0]||null},r.adjustPageFloatArea=function(e,t,n){e.isFootnote=!0,e.adjustContentRelativeSize=!1;var i=e.element;e.vertical=n.layoutContext.applyFootnoteStyle(t.vertical,n.layoutContext.nodeContext&&n.layoutContext.nodeContext.direction==="rtl",i),e.convertPercentageSizesToPx(i),n.setComputedInsets(i,e),n.setComputedWidthAndHeight(i,e)},r.forbid=function(e,t){var n=e;switch(n.footnotePolicy){case b.line:var i=new Yc(n);t.addLayoutConstraint(i,n.floatReference)}},o}()));var Kc={page:!0,left:!0,right:!0,recto:!0,verso:!0,column:!0,region:!0};function _e(o){return!!Kc[o]}var qc={left:!0,right:!0,recto:!0,verso:!0};function iu(o){return!!qc[o]}var Qc={avoid:!0,"avoid-page":!0,"avoid-column":!0,"avoid-region":!0};function Ro(o){return!!Qc[o]}function Ne(o,r){if(!o)return r;if(!r)return o;if(iu(r))return r;if(iu(o))return o;var e=_e(o),t=_e(r);if(!e||!t)return t?r:e?o:Ro(r)?r:Ro(o)?o:r;switch(r){case"column":return o;case"region":return o==="column"?r:o;default:return r}}function ru(o){switch(o){case"left":case"right":case"recto":case"verso":return o;default:return"any"}}function Zc(o){switch(o){case"left":case"right":case"recto":case"verso":return o;default:return null}}function Yn(o,r,e,t){var n=o.viewNode;if(!n)return NaN;if(n.nodeType==1){if(o.after||!o.inline){var i=r.getElementClientRect(n);if(i.right>=i.left&&i.bottom>=i.top)return o.after?t?i.left:i.bottom:t?i.right:i.top}return NaN}var a=NaN,s=n.ownerDocument.createRange(),u=n.textContent.length;if(!u)return NaN;o.after&&(e+=u),e>=u&&(e=u-1),s.setStart(n,e),s.setEnd(n,e+1);var h=r.getRangeClientRects(s);t&&function(p){if(Pr==null){var E=p.ownerDocument,C=E.createElement("div");C.style.position="absolute",C.style.top="0px",C.style.left="0px",C.style.width="100px",C.style.height="100px",C.style.overflow="hidden",C.style.lineHeight="16px",C.style.fontSize="16px",T(C,"writing-mode","vertical-rl"),p.appendChild(C);var D=E.createTextNode("a a a a a a a a a a a a a a a a");C.appendChild(D);var y=E.createRange();y.setStart(D,0),y.setEnd(D,1);var N=y.getBoundingClientRect();Pr=N.right-N.left<10,p.removeChild(C)}return Pr}(document.body)&&(h=function(p,E,C){var D=C.ownerDocument.createRange();D.setStart(C,0),D.setEnd(C,C.textContent.length);for(var y,N=p.getRangeClientRects(D),x=[],F=B(E);!(y=F()).done;){var k=y.value,H=void 0;for(H=0;H<N.length;H++){var K=N[H];if(k.top>=K.top&&k.bottom<=K.bottom&&Math.abs(k.left-K.left)<1){x.push({top:k.top,left:K.left,bottom:k.bottom,right:K.right});break}}H==N.length&&(M.warn("Could not fix character box"),x.push(k))}return x}(r,h,n));for(var c,d=0,f=B(h);!(c=f()).done;){var v=c.value,g=t?v.bottom-v.top:v.right-v.left;v.right>v.left&&v.bottom>v.top&&(isNaN(a)||g>d)&&(a=t?v.left:v.bottom,d=g)}return a}function Oo(o,r,e){var t=r.clientLayout.getElementClientRect(o),n=r.getComputedMargin(o);return e?t.width+n.left+n.right:t.height+n.top+n.bottom}function Kn(o){for(;o;){if(o.parentNode===o.ownerDocument)return!1;o=o.parentNode}return!0}function ou(o,r){if(o)for(var e;(e=o.lastChild)!=r;)o.removeChild(e)}function au(o){return!!o.getAttribute("data-adapt-spec")}function qn(o){if(!o)return!1;var r=o.viewNode;return!(!r||r.nodeType!==1)&&au(r)}be("SIMPLE_PROPERTY",function(o){var r=o.name,e=o.value;switch(r){case"page-break-before":case"page-break-after":case"page-break-inside":return{name:r.replace(/^page-/,""),value:e===b.always?b.page:e,important:o.important};default:return o}});var ko=function(){function o(){}var r=o.prototype;return r.calculateOffset=function(e){return Qn(this.getNodeContext(),e.collectElementsOffset())},r.breakPositionChosen=function(e){},r.getNodeContext=function(){return null},o}();function Qn(o,r){return{current:r.reduce(function(e,t){return e+t.calculateOffset(o)},0),minimum:r.reduce(function(e,t){return e+t.calculateMinimumOffset(o)},0)}}var hr=function(o){function r(t,n,i,a){var s;return(s=o.call(this)||this).position=void 0,s.breakOnEdge=void 0,s.overflows=void 0,s.computedBlockSize=void 0,s.overflowIfRepetitiveElementsDropped=void 0,s.isEdgeUpdated=!1,s.edge=0,s.position=t,s.breakOnEdge=n,s.overflows=i,s.computedBlockSize=a,s.overflowIfRepetitiveElementsDropped=i,s}w(r,o);var e=r.prototype;return e.findAcceptableBreak=function(t,n){return this.updateOverflows(t),n<this.getMinBreakPenalty()?null:t.findEdgeBreakPosition(this)},e.getMinBreakPenalty=function(){if(!this.isEdgeUpdated)throw new Error("EdgeBreakPosition.prototype.updateEdge not called");var t=this.isFirstContentOfRepetitiveElementsOwner()&&!this.overflowIfRepetitiveElementsDropped;return(Ro(this.breakOnEdge)?1:0)+(this.overflows&&!t?3:0)+(this.position.parent?this.position.parent.breakPenalty:0)},e.updateEdge=function(t){var n=t.calculateClonedPaddingBorder(this.position);this.edge=Yn(this.position,t.clientLayout,0,t.vertical)+n,this.isEdgeUpdated=!0},e.updateOverflows=function(t){this.isEdgeUpdated||this.updateEdge(t);var n=this.edge,i=this.calculateOffset(t);this.overflowIfRepetitiveElementsDropped=t.isOverflown(n+(t.vertical?-1:1)*i.minimum),this.overflows=this.position.overflow=t.isOverflown(n+(t.vertical?-1:1)*i.current)},e.getNodeContext=function(){return this.position},e.isFirstContentOfRepetitiveElementsOwner=function(){var t=this.getNodeContext();if(!t||!t.parent)return!1;var n=t.parent.formattingContext;if(!Pn.isInstanceOfRepetitiveElementsOwnerFormattingContext(n))return!1;var i=n.getRepetitiveElements();return!!i&&i.isFirstContentNode(t)},r}(ko);function su(o){var r,e=o.toString();switch(e){case"inline-flex":r="flex";break;case"inline-grid":r="grid";break;case"inline-table":r="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":r="block";break;default:r=e}return _(r)}function uu(o){return o===b.absolute||o===b.fixed}function lu(o,r,e,t){return o===b.none||(uu(r)?(e=b.none,o=su(o)):(e&&e!==b.none||t)&&(o=su(o))),{display:o,position:r,float:e}}function hu(o,r,e,t){return lu(o,r,e,t).display===b.block}function cu(o){switch(o.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 wi=function(){function o(){}return o.prototype.find=function(r){for(var e=se(R.HOOKS.RESOLVE_LAYOUT_PROCESSOR),t=0;t<e.length;t++){var n=e[t](r);if(n)return n}throw new Error("No processor found for a formatting context: "+r.getName())},o}(),Zn=function(){function o(){}var r=o.prototype;return r.layout=function(e,t,n){return t.isFloatNodeContext(e)?t.layoutFloatOrFootnote(e):t.isBreakable(e)?t.layoutBreakableBlock(e):t.layoutUnbreakable(e)},r.createEdgeBreakPosition=function(e,t,n,i){return new hr(e.copy(),t,n,i)},r.startNonInlineElementNode=function(e){return!1},r.afterNonInlineElementNode=function(e,t){return!1},r.clearOverflownViewNodes=function(e,t,n,i){if(n.viewNode&&n.viewNode.parentNode&&(n.shadowType!==Rn.ShadowType.ROOTLESS||!qn(n))){var a=n.viewNode.parentNode;ou(a,n.viewNode),i&&a.removeChild(n.viewNode)}},r.finishBreak=function(e,t,n,i){var a=n||t.viewNode!=null&&t.viewNode.nodeType==1&&!t.after;return e.clearOverflownViewNodes(t,a),i&&(e.fixJustificationIfNeeded(t,!0),e.layoutContext.processFragmentedBlockEdge(a?t:t.parent)),I(!0)},o}(),Lo=function(){function o(e){this.parent=void 0,this.formattingContextType="Block",this.parent=e}var r=o.prototype;return r.getName=function(){return"Block formatting context (BlockFormattingContext)"},r.isFirstTime=function(e,t){return t},r.getParent=function(){return this.parent},r.saveState=function(){},r.restoreState=function(e){},o}(),Bo=new Zn,$c=fo.isInstanceOfBlockFormattingContext;be(R.HOOKS.RESOLVE_FORMATTING_CONTEXT,function(o,r,e,t,n,i){var a=o.parent;return!a&&o.formattingContext||a&&o.formattingContext!==a.formattingContext?null:o.establishesBFC||!o.formattingContext&&hu(e,t,n,i)?new Lo(a?a.formattingContext:null):null}),be(R.HOOKS.RESOLVE_LAYOUT_PROCESSOR,function(o){return o instanceof Lo?Bo:null});var _o=function(){function o(){this.initialBreakPositions=null,this.initialStateOfFormattingContext=null,this.initialPosition=void 0,this.initialFragmentLayoutConstraints=void 0}var r=o.prototype;return r.layout=function(e,t){return this.prepareLayout(e,t),this.tryLayout(e,t)},r.tryLayout=function(e,t){var n=this,i=L("AbstractLayoutRetryer.tryLayout");this.saveState(e,t);var a=this.resolveLayoutMode(e);return a.doLayout(e,t).then(function(s){var u=a.accept(s,t);(u=a.postLayout(s,n.initialPosition,t,u))?i.finish(s):(n.clearNodes(n.initialPosition),n.restoreState(e,t),n.tryLayout(n.initialPosition,t).thenFinish(i))}),i.result()},r.prepareLayout=function(e,t){},r.clearNodes=function(e){for(var t,n,i=e.viewNode||e.parent.viewNode;t=i.lastChild;)i.removeChild(t);for(;n=i.nextSibling;)n.parentNode.removeChild(n)},r.saveState=function(e,t){this.initialPosition=e.copy(),this.initialBreakPositions=[].concat(t.breakPositions),this.initialFragmentLayoutConstraints=[].concat(t.fragmentLayoutConstraints),e.formattingContext&&(this.initialStateOfFormattingContext=e.formattingContext.saveState())},r.restoreState=function(e,t){t.breakPositions=this.initialBreakPositions,t.fragmentLayoutConstraints=this.initialFragmentLayoutConstraints,e.formattingContext&&e.formattingContext.restoreState(this.initialStateOfFormattingContext)},o}(),Jc=function(){function o(){}var r=o.prototype;return r.initialState=function(e){return{nodeContext:e,atUnforcedBreak:!1,break:!1}},r.startNonDisplayableNode=function(e){},r.afterNonDisplayableNode=function(e){},r.startIgnoredTextNode=function(e){},r.afterIgnoredTextNode=function(e){},r.startNonElementNode=function(e){},r.afterNonElementNode=function(e){},r.startInlineElementNode=function(e){},r.afterInlineElementNode=function(e){},r.startNonInlineElementNode=function(e){},r.afterNonInlineElementNode=function(e){},r.finish=function(e){},o}(),Mo=function(){function o(r,e){this.strategy=void 0,this.layoutContext=void 0,this.strategy=r,this.layoutContext=e}return o.prototype.iterate=function(r){var e=this,t=this.strategy,n=t.initialState(r),i=L("LayoutIterator");return i.loopWithFrame(function(a){for(var s;n.nodeContext;){var u=((s=n.nodeContext.viewNode?n.nodeContext.viewNode.nodeType!==1?$i(n.nodeContext.viewNode,n.nodeContext.whitespace)?n.nodeContext.after?t.afterIgnoredTextNode(n):t.startIgnoredTextNode(n):n.nodeContext.after?t.afterNonElementNode(n):t.startNonElementNode(n):n.nodeContext.inline?n.nodeContext.after?t.afterInlineElementNode(n):t.startInlineElementNode(n):n.nodeContext.after?t.afterNonInlineElementNode(n):t.startNonInlineElementNode(n):n.nodeContext.after?t.afterNonDisplayableNode(n):t.startNonDisplayableNode(n))&&s.isPending()?s:I(!0)).thenAsync(function(){return n.break?I(null):e.layoutContext.nextInTree(n.nodeContext,n.atUnforcedBreak)});if(u.isPending())return void u.then(function(h){n.break?a.breakLoop():(n.nodeContext=h,a.continueLoop())});if(n.break)return void a.breakLoop();n.nodeContext=u.get()}t.finish(n),a.breakLoop()}).then(function(){i.finish(n.nodeContext)}),i.result()},o}(),yi=function(o){function r(t){var n;return(n=o.call(this)||this).leadingEdge=void 0,n.leadingEdge=t,n}w(r,o);var e=r.prototype;return e.startNonInlineBox=function(t){},e.endEmptyNonInlineBox=function(t){},e.endNonInlineBox=function(t){},e.initialState=function(t){return{nodeContext:t,atUnforcedBreak:!!this.leadingEdge&&t.after,break:!1,leadingEdge:this.leadingEdge,breakAtTheEdge:null,onStartEdges:!1,leadingEdgeContexts:[],lastAfterNodeContext:null}},e.processForcedBreak=function(t,n){var i=!t.leadingEdge&&_e(t.breakAtTheEdge);if(i){var a=t.nodeContext=t.leadingEdgeContexts[0]||t.nodeContext;a.viewNode.parentNode.removeChild(a.viewNode),n.pageBreakType=t.breakAtTheEdge}return i},e.saveEdgeAndProcessOverflow=function(t,n){var i=n.checkOverflowAndSaveEdgeAndBreakPosition(t.lastAfterNodeContext,null,!0,t.breakAtTheEdge);return i&&(t.nodeContext=(t.lastAfterNodeContext||t.nodeContext).modify(),t.nodeContext.overflow=!0),i},e.processLayoutConstraint=function(t,n,i){var a=t.nodeContext,s=!n.allowLayout(a);return s&&(i.checkOverflowAndSaveEdgeAndBreakPosition(t.lastAfterNodeContext,null,!1,t.breakAtTheEdge),(a=t.nodeContext=a.modify()).overflow=!0),s},e.startNonElementNode=function(t){t.onStartEdges=!1},e.startNonInlineElementNode=function(t){return t.leadingEdgeContexts.push(t.nodeContext.copy()),t.breakAtTheEdge=Ne(t.breakAtTheEdge,t.nodeContext.breakBefore),t.onStartEdges=!0,this.startNonInlineBox(t)},e.afterNonInlineElementNode=function(t){var n;return(t.onStartEdges?((n=this.endEmptyNonInlineBox(t))&&n.isPending()?n:I(!0)).thenAsync(function(){return t.break||(t.leadingEdgeContexts=[],t.leadingEdge=!1,t.atUnforcedBreak=!1,t.breakAtTheEdge=null),I(!0)}):(n=this.endNonInlineBox(t))&&n.isPending()?n:I(!0)).thenAsync(function(){return t.break||(t.onStartEdges=!1,t.lastAfterNodeContext=t.nodeContext.copy(),t.breakAtTheEdge=Ne(t.breakAtTheEdge,t.nodeContext.breakAfter)),I(!0)})},r}(Jc),Uo=[],cr=new DOMParser().parseFromString('<root xmlns="'+U.SHADOW+'"/>',"text/xml"),td=["footnote-marker","first-5-lines","first-4-lines","first-3-lines","first-2-lines","first-line","first-letter","before","","after"];function Ni(o){return o.getAttribute("data-adapt-pseudo")||""}function Vo(o,r){o.setAttribute("data-adapt-pseudo",r)}var du=function(){function o(e,t,n,i,a){this.element=void 0,this.style=void 0,this.styler=void 0,this.context=void 0,this.exprContentListener=void 0,this.contentProcessed={},this.element=e,this.style=t,this.styler=n,this.context=i,this.exprContentListener=a}var r=o.prototype;return r.getStyle=function(e,t){var n=Ni(e);this.styler&&n&&n.match(/after$/)&&(this.style=this.styler.getStyle(this.element,!0),this.styler=null);var i=yn(this.style,"_pseudos")[n]||{};if(n.match(/^first-/)&&!i["x-first-pseudo"]){var a,s=1;n=="first-letter"?s=0:(a=n.match(/^first-([0-9]+)-lines$/))!=null&&(s=a[1]-0),i["x-first-pseudo"]=new Dt(new xn(s),0)}return i},r.processContent=function(e,t){var n=Ni(e);if(!this.contentProcessed[n]){this.contentProcessed[n]=!0;var i=t.content;i&&Wn(i)&&i.visit(new Eo(e,this.context,i,this.exprContentListener))}},o}(),ed=qi.registerFragmentIndex,nd=function(){function o(e,t){this.sourceNode=void 0,this.styler=void 0,this.sourceNode=e,this.styler=t}var r=o.prototype;return r.createElement=function(e,t){var n=this,i=t.viewNode.ownerDocument.createElement("div"),a=new zo(e,i,t),s=a.getColumn().pageBreakType;return a.getColumn().pageBreakType=null,a.layout(this.createNodePositionForPseudoElement(),!0).thenAsync(function(){n.styler.contentProcessed["after-if-continues"]=!1,a.getColumn().pageBreakType=s;var u=i.firstChild;return T(u,"display","block"),I(u)})},r.createNodePositionForPseudoElement=function(){var e=cr.createElementNS(U.XHTML,"div");Vo(e,"after-if-continues");var t=this.createShadowContext(e);return new wn({steps:[{node:e,shadowType:t.type,shadowContext:t,nodeShadow:null,shadowSibling:null}],offsetInNode:0,after:!1,preprocessedTextContent:null})},r.createShadowContext=function(e){return new vo(this.sourceNode,e,null,null,null,Rn.ShadowType.ROOTED,this.styler)},o}(),id=function(){function o(e,t,n){this.nodeContext=void 0,this.afterIfContinues=void 0,this.pseudoElementHeight=void 0,this.flagmentLayoutConstraintType="AfterIfContinue",this.nodeContext=e,this.afterIfContinues=t,this.pseudoElementHeight=n}var r=o.prototype;return r.allowLayout=function(e,t,n){return!(t&&!e||e&&e.overflow)},r.nextCandidate=function(e){return!1},r.postLayout=function(e,t,n,i){},r.finishBreak=function(e,t){var n=this;return this.getRepetitiveElements().affectTo(e)?this.afterIfContinues.createElement(t,this.nodeContext).thenAsync(function(i){return n.nodeContext.viewNode.appendChild(i),I(!0)}):I(!0)},r.getRepetitiveElements=function(){return new rd(this.nodeContext,this.pseudoElementHeight)},r.equalsTo=function(e){return e instanceof o&&this.afterIfContinues==e.afterIfContinues},r.getPriorityOfFinishBreak=function(){return 9},o}(),rd=function(){function o(e,t){this.nodeContext=void 0,this.pseudoElementHeight=void 0,this.nodeContext=e,this.pseudoElementHeight=t}var r=o.prototype;return r.calculateOffset=function(e){return this.affectTo(e)?this.pseudoElementHeight:0},r.calculateMinimumOffset=function(e){return this.calculateOffset(e)},r.affectTo=function(e){if(!e)return!1;var t=e.shadowContext?e.shadowContext.owner:e.sourceNode;if(t===this.nodeContext.sourceNode)return!!e.after;for(var n=t.parentNode;n;n=n.parentNode)if(n===this.nodeContext.sourceNode)return!0;return!1},o}();function fu(o,r){if(!o||!o.afterIfContinues||o.after||r.isFloatNodeContext(o))return I(o);var e=o.afterIfContinues;return e.createElement(r,o).thenAsync(function(t){var n=function(i,a,s){var u=i.viewNode;u.appendChild(s);var h=Oo(s,a,i.vertical);return u.removeChild(s),h}(o,r,t);return r.fragmentLayoutConstraints.push(new id(o,e,n)),I(o)})}function pu(o,r){return o.thenAsync(function(e){return fu(e,r)})}var Ho={img:!0,svg:!0,audio:!0,video:!0},od=function(){function o(r){this.constraints=void 0,this.constraints=r}return o.prototype.allowLayout=function(r){return this.constraints.every(function(e){return e.allowLayout(r)})},o}(),ad=function(o){function r(t,n){var i;return(i=o.call(this)||this).checkPoints=void 0,i.penalty=void 0,i.alreadyEvaluated=!1,i.breakNodeContext=null,i.checkPoints=t,i.penalty=n,i}w(r,o);var e=r.prototype;return e.findAcceptableBreak=function(t,n){return n<this.getMinBreakPenalty()?null:(this.alreadyEvaluated||(this.breakNodeContext=t.findBoxBreakPosition(this,n>0),this.alreadyEvaluated=!0),this.breakNodeContext)},e.getMinBreakPenalty=function(){return this.penalty},e.getNodeContext=function(){return this.alreadyEvaluated?this.breakNodeContext:this.checkPoints[this.checkPoints.length-1]},r}(ko);function sd(o){switch(o){case"ruby":case"inline-block":case"inline-flex":case"inline-grid":case"inline-list-item":case"inline-table":return!0}return!1}var dr=function(o){function r(t,n,i,a,s){var u;return(u=o.call(this,t)||this).layoutContext=void 0,u.clientLayout=void 0,u.layoutConstraint=void 0,u.pageFloatLayoutContext=void 0,u.last=void 0,u.viewDocument=void 0,u.flowRootFormattingContext=null,u.isFloat=!1,u.isFootnote=!1,u.startEdge=0,u.endEdge=0,u.beforeEdge=0,u.afterEdge=0,u.footnoteEdge=0,u.box=null,u.chunkPositions=null,u.bands=null,u.overflown=!1,u.breakPositions=null,u.pageBreakType=null,u.forceNonfitting=!0,u.leftFloatEdge=0,u.rightFloatEdge=0,u.bottommostFloatTop=0,u.stopAtOverflow=!0,u.lastAfterPosition=null,u.fragmentLayoutConstraints=[],u.pseudoParent=null,u.nodeContextOverflowingDueToRepetitiveElements=null,u.blockDistanceToBlockEndFloats=NaN,u.layoutContext=n,u.clientLayout=i,u.layoutConstraint=a,u.pageFloatLayoutContext=s,u.last=t.lastChild,u.viewDocument=t.ownerDocument,s.setContainer(xt(u)),u}w(r,o);var e=r.prototype;return e.getTopEdge=function(){return this.vertical?this.startEdge:this.beforeEdge},e.getBottomEdge=function(){return this.vertical?this.endEdge:this.afterEdge},e.getLeftEdge=function(){return this.vertical?this.afterEdge:this.startEdge},e.getRightEdge=function(){return this.vertical?this.beforeEdge:this.endEdge},e.isFloatNodeContext=function(t){return!(!t.floatSide||this.isFloat&&!t.parent)},e.stopByOverflow=function(t){return this.stopAtOverflow&&!!t&&t.overflow},e.isOverflown=function(t){return this.vertical?t<this.footnoteEdge:t>this.footnoteEdge},e.getExclusions=function(){var t=this.pageFloatLayoutContext.getFloatFragmentExclusions();return this.exclusions.concat(t)},e.openAllViews=function(t){var n=this,i=L("openAllViews"),a=t.steps;this.layoutContext.setViewRoot(this.element,this.isFootnote);var s=a.length-1,u=null;return i.loop(function(){for(;s>=0&&(u=tr(a[s],u),s!==a.length-1||u.formattingContext||(u.formattingContext=n.flowRootFormattingContext),s!=0||(u.offsetInNode=n.calculateOffsetInNodeForNodeContext(t),u.after=t.after,u.preprocessedTextContent=t.preprocessedTextContent,!u.after));){var h=n.layoutContext.setCurrent(u,s==0&&u.offsetInNode==0);if(s--,h.isPending())return h}return I(!1)}).then(function(){i.finish(u)}),i.result()},e.calculateOffsetInNodeForNodeContext=function(t){return t.preprocessedTextContent?Ns(t.preprocessedTextContent,t.offsetInNode,1):t.offsetInNode},e.maybePeelOff=function(t,n){if(t.firstPseudo&&t.inline&&!t.after&&t.firstPseudo.count==0&&t.viewNode.nodeType!=1){var i=t.viewNode.textContent.match(gt);return this.layoutContext.peelOff(t,i?i[0].length:0)}return I(t)},e.buildViewToNextBlockEdge=function(t,n){var i=this,a=!1,s=L("buildViewToNextBlockEdge");return s.loopWithFrame(function(u){t.viewNode&&!qn(t)&&n.push(t.copy()),i.maybePeelOff(t,0).then(function(h){h!==t&&(qn(t=h)||n.push(t.copy())),i.nextInTree(t).then(function(c){(t=c)?(!a&&i.layoutConstraint.allowLayout(t)||(a=!0,(t=t.modify()).overflow=!0),i.isFloatNodeContext(t)&&!i.vertical?i.layoutFloatOrFootnote(t).then(function(d){t=d,i.pageFloatLayoutContext.isInvalidated()&&(t=null),t?u.continueLoop():u.breakLoop()}):t.inline?u.continueLoop():u.breakLoop()):u.breakLoop()})})}).then(function(){s.finish(t)}),s.result()},e.nextInTree=function(t,n){return pu(this.layoutContext.nextInTree(t,n),this)},e.buildDeepElementView=function(t){var n=this;if(!t.viewNode)return I(t);var i=[],a=t.sourceNode,s=L("buildDeepElementView");return s.loopWithFrame(function(u){t.viewNode&&t.inline&&!qn(t)?i.push(t.copy()):(i.length>0&&n.postLayoutBlock(t,i),i=[]),n.maybePeelOff(t,0).then(function(h){var c=h;if(c!==t){for(var d=c;d&&d.sourceNode!=a;)d=d.parent;if(d==null)return t=c,void u.breakLoop();qn(c)||i.push(c.copy())}n.nextInTree(c).then(function(f){(t=f)&&t.sourceNode!=a?n.layoutConstraint.allowLayout(t)?u.continueLoop():((t=t.modify()).overflow=!0,n.stopAtOverflow?u.breakLoop():u.continueLoop()):u.breakLoop()})})}).then(function(){i.length>0&&n.postLayoutBlock(t,i),s.finish(t)}),s.result()},e.createFloat=function(t,n,i,a){var s=this.viewDocument.createElement("div");return this.vertical?(a>=this.height&&(a-=.1),T(s,"height",i+"px"),T(s,"width",a+"px")):(i>=this.width&&(i-=.1),T(s,"width",i+"px"),T(s,"height",a+"px")),T(s,"float",n),T(s,"clear",n),this.element.insertBefore(s,t),s},e.killFloats=function(){for(var t=this.element.firstChild;t;){var n=t.nextSibling;if(t.nodeType==1){var i=t,a=i.style.cssFloat;if(a!="left"&&a!="right")break;this.element.removeChild(i)}t=n}},e.createFloats=function(){for(var t,n=this.element.firstChild,i=this.bands,a=this.vertical?this.getTopEdge():this.getLeftEdge(),s=this.vertical?this.getBottomEdge():this.getRightEdge(),u=B(i);!(t=u()).done;){var h=t.value,c=h.y2-h.y1;h.left=this.createFloat(n,"left",h.x1-a,c),h.right=this.createFloat(n,"right",s-h.x2,c)}},e.calculateEdge=function(t,n,i,a){var s;if(t&&Kn(t.viewNode))return NaN;if(t&&t.after&&!t.inline&&(s=Yn(t,this.clientLayout,0,this.vertical),!isNaN(s)))return s;for(var u=a-(t=n[i]).boxOffset;;){if(s=Yn(t,this.clientLayout,u,this.vertical),!isNaN(s))return s;if(u>0)u--;else{if(--i<0)return this.beforeEdge;(t=n[i]).viewNode.nodeType!=1&&(u=t.viewNode.textContent.length)}}},e.parseComputedLength=function(t){if(typeof t=="number")return t;var n=t.match(/^(-?[0-9]*(\.[0-9]*)?)px$/);return n?parseFloat(n[0]):0},e.getComputedMargin=function(t){var n=this.clientLayout.getElementComputedStyle(t),i=new Zr(0,0,0,0);return n&&(i.left=this.parseComputedLength(n.marginLeft),i.top=this.parseComputedLength(n.marginTop),i.right=this.parseComputedLength(n.marginRight),i.bottom=this.parseComputedLength(n.marginBottom)),i},e.getComputedPaddingBorder=function(t){var n=this.clientLayout.getElementComputedStyle(t),i=new Zr(0,0,0,0);return n&&(i.left=this.parseComputedLength(n.borderLeftWidth)+this.parseComputedLength(n.paddingLeft),i.top=this.parseComputedLength(n.borderTopWidth)+this.parseComputedLength(n.paddingTop),i.right=this.parseComputedLength(n.borderRightWidth)+this.parseComputedLength(n.paddingRight),i.bottom=this.parseComputedLength(n.borderBottomWidth)+this.parseComputedLength(n.paddingBottom)),i},e.getComputedInsets=function(t){var n=this.clientLayout.getElementComputedStyle(t),i=new Zr(0,0,0,0);if(n){if(n.boxSizing=="border-box")return this.getComputedMargin(t);i.left=this.parseComputedLength(n.marginLeft)+this.parseComputedLength(n.borderLeftWidth)+this.parseComputedLength(n.paddingLeft),i.top=this.parseComputedLength(n.marginTop)+this.parseComputedLength(n.borderTopWidth)+this.parseComputedLength(n.paddingTop),i.right=this.parseComputedLength(n.marginRight)+this.parseComputedLength(n.borderRightWidth)+this.parseComputedLength(n.paddingRight),i.bottom=this.parseComputedLength(n.marginBottom)+this.parseComputedLength(n.borderBottomWidth)+this.parseComputedLength(n.paddingBottom)}return i},e.setComputedInsets=function(t,n){var i=this.clientLayout.getElementComputedStyle(t);i&&(n.marginLeft=this.parseComputedLength(i.marginLeft),n.borderLeft=this.parseComputedLength(i.borderLeftWidth),n.paddingLeft=this.parseComputedLength(i.paddingLeft),n.marginTop=this.parseComputedLength(i.marginTop),n.borderTop=this.parseComputedLength(i.borderTopWidth),n.paddingTop=this.parseComputedLength(i.paddingTop),n.marginRight=this.parseComputedLength(i.marginRight),n.borderRight=this.parseComputedLength(i.borderRightWidth),n.paddingRight=this.parseComputedLength(i.paddingRight),n.marginBottom=this.parseComputedLength(i.marginBottom),n.borderBottom=this.parseComputedLength(i.borderBottomWidth),n.paddingBottom=this.parseComputedLength(i.paddingBottom))},e.setComputedWidthAndHeight=function(t,n){var i=this.clientLayout.getElementComputedStyle(t);i&&(n.width=this.parseComputedLength(i.width),n.height=this.parseComputedLength(i.height))},e.layoutUnbreakable=function(t){return this.buildDeepElementView(t)},e.layoutFloat=function(t){var n=this,i=L("layoutFloat"),a=t.viewNode,s=t.floatSide;return T(a,"float","none"),T(a,"display","inline-block"),T(a,"vertical-align","top"),this.buildDeepElementView(t).then(function(u){for(var h=n.clientLayout.getElementClientRect(a),c=n.getComputedMargin(a),d=new ke(h.left-c.left,h.top-c.top,h.right+c.right,h.bottom+c.bottom),f=n.startEdge,v=n.endEdge,g=t.parent;g&&g.inline;)g=g.parent;if(g){var p=g.viewNode.ownerDocument.createElement("div");p.style.left="0px",p.style.top="0px",n.vertical?(p.style.bottom="0px",p.style.width="1px"):(p.style.right="0px",p.style.height="1px"),g.viewNode.appendChild(p);var E=n.clientLayout.getElementClientRect(p);f=Math.max(n.getStartEdge(E),f),v=Math.min(n.getEndEdge(E),v),g.viewNode.removeChild(p);var C=n.vertical?d.y2-d.y1:d.x2-d.x1;s=="left"?v=Math.max(v,f+C):f=Math.min(f,v-C),g.viewNode.appendChild(t.viewNode)}var D=new ke(f,n.getBoxDir()*n.beforeEdge,v,n.getBoxDir()*n.afterEdge),y=d;n.vertical&&(y=zi(d));var N=n.getBoxDir();if(y.y1<n.bottommostFloatTop*N){var x=y.y2-y.y1;y.y1=n.bottommostFloatTop*N,y.y2=y.y1+x}(function(G,X,it,lt){for(var Ht=it.y1,ct=it.x2-it.x1,ft=it.y2-it.y1,tt=is(X,Ht);;){var j=Ht+ft;if(j>G.y2)return!1;for(var ot=G.x1,Y=G.x2,vt=tt;vt<X.length&&X[vt].y1<j;vt++){var et=X[vt];et.x1>ot&&(ot=et.x1),et.x2<Y&&(Y=et.x2)}if(ot+ct<=Y||tt>=X.length)return lt=="left"?(it.x1=ot,it.x2=ot+ct):(it.x1=Y-ct,it.x2=Y),it.y2+=Ht-it.y1,it.y1=Ht,!0;Ht=X[tt].y2,tt++}})(D,n.bands,y,s),n.vertical&&(d=ts(y));var F,k=n.getComputedInsets(a);T(a,"width",d.x2-d.x1-k.left-k.right+"px"),T(a,"height",d.y2-d.y1-k.top-k.bottom+"px"),T(a,"position","absolute"),T(a,"display",t.display);var H=null;if(g&&(H=g.containingBlockForAbsolute?g:g.getContainingBlockForAbsolute()),H){var K=H.viewNode.ownerDocument.createElement("div");K.style.position="absolute",H.vertical?K.style.right="0":K.style.left="0",K.style.top="0",H.viewNode.appendChild(K),F=n.clientLayout.getElementClientRect(K),H.viewNode.removeChild(K)}else F={left:n.getLeftEdge()-n.paddingLeft,right:n.getRightEdge()+n.paddingRight,top:n.getTopEdge()-n.paddingTop};(H?H.vertical:n.vertical)?T(a,"right",F.right-d.x2+"px"):T(a,"left",d.x1-F.left+"px"),T(a,"top",d.y1-F.top+"px"),t.clearSpacer&&(t.clearSpacer.parentNode.removeChild(t.clearSpacer),t.clearSpacer=null);var q=n.vertical?d.x1:d.y2,W=n.vertical?d.x2:d.y1;n.isOverflown(q)&&n.breakPositions.length!=0?((t=t.modify()).overflow=!0,i.finish(t)):(n.killFloats(),D=new ke(n.getLeftEdge(),n.getTopEdge(),n.getRightEdge(),n.getBottomEdge()),n.vertical&&(D=zi(D)),function(G,X,it,lt,Ht){for(lt||(lt=[new rn(it.y1,it.y2,it.x1,it.x2)]);lt.length>0&<[0].y2<=G.y1;)lt.shift();if(lt.length!=0){var ct;lt[0].y1<G.y1&&(lt[0].y1=G.y1);var ft=X.length==0?G.y1:X[X.length-1].y2;ft<G.y2&&X.push(new rn(ft,G.y2,G.x1,G.x2));for(var tt,j=is(X,lt[0].y1),ot=B(lt);!(tt=ot()).done;){var Y=tt.value;if(j==X.length)break;for(X[j].y1<Y.y1&&(ct=X[j],j++,X.splice(j,0,new rn(Y.y1,ct.y2,ct.x1,ct.x2)),ct.y2=Y.y1);j<X.length&&((ct=X[j++]).y2>Y.y2&&(X.splice(j,0,new rn(Y.y2,ct.y2,ct.x1,ct.x2)),ct.y2=Y.y2),Y.x1!=Y.x2&&(Ht=="left"?ct.x1=Math.min(Y.x2,G.x2):ct.x2=Math.max(Y.x1,G.x1)),ct.y2!=Y.y2););}ns(G,X)}}(D,n.bands,y,null,s),n.createFloats(),s=="left"?n.leftFloatEdge=q:n.rightFloatEdge=q,n.bottommostFloatTop=W,n.updateMaxReachedAfterEdge(q),i.finish(u))}),i.result()},e.setupFloatArea=function(t,n,i,a,s,u){var h=this.pageFloatLayoutContext,c=h.getContainer(n),d=t.element;c.element.parentNode.appendChild(d),t.isFloat=!0,t.originX=c.originX,t.originY=c.originY,t.vertical=c.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=(c.exclusions||[]).concat(),t.forceNonfitting=!h.hasFloatFragments(),t.innerShape=null;var f=c.getPaddingRect();t.setHorizontalPosition(f.x1-c.originX,f.x2-f.x1),t.setVerticalPosition(f.y1-c.originY,f.y2-f.y1),s.adjustPageFloatArea(t,c,this),t.init();var v=!!h.setFloatAreaDimensions(t,n,i,a,!0,!h.hasFloatFragments(),u);return v?(t.killFloats(),t.init()):c.element.parentNode.removeChild(d),v},e.createPageFloatArea=function(t,n,i,a,s){var u=this.element.ownerDocument.createElement("div");T(u,"position","absolute");var h=this.pageFloatLayoutContext.getPageFloatLayoutContext(t.floatReference),c=new Ci(null,ne.COLUMN,null,this.pageFloatLayoutContext.flowName,t.nodePosition,null,null),d=h.getContainer(),f=new hd(n,u,this.layoutContext.clone(),this.clientLayout,this.layoutConstraint,c,d);return c.setContainer(f),this.setupFloatArea(f,t.floatReference,n,i,a,s)?f:null},e.layoutSinglePageFloatFragment=function(t,n,i,a,s,u,h){var c=this.pageFloatLayoutContext,d=(t=(h?h.continuations:[]).concat(t))[0].float,f=c.getPageFloatPlacementCondition(d,n,i),v=this.createPageFloatArea(d,n,u,s,f),g={floatArea:v,pageFloatFragment:null,newPosition:null};if(!v)return I(g);var p=L("layoutSinglePageFloatFragment"),E=!1,C=0;return p.loopWithFrame(function(D){if(C>=t.length)D.breakLoop();else{var y=new wn(t[C].nodePosition);v.layout(y,!0).then(function(N){g.newPosition=N,!N||a?(C++,D.continueLoop()):(E=!0,D.breakLoop())})}}).then(function(){if(!E){var D=c.setFloatAreaDimensions(v,d.floatReference,n,u,!1,a,f);if(D){var y=s.createPageFloatFragment(t,D,v,!!g.newPosition);c.addPageFloatFragment(y,!0),g.pageFloatFragment=y}else E=!0}p.finish(g)}),p.result()},e.layoutPageFloatInner=function(t,n,i,a){var s=this,u=this.pageFloatLayoutContext,h=t.float;function c(f,v){v?u.removePageFloatFragment(v,!0):f&&f.element.parentNode.removeChild(f.element),u.restoreStashedFragments(h.floatReference),u.deferPageFloat(t)}u.stashEndFloatFragments(h);var d=L("layoutPageFloatInner");return this.layoutSinglePageFloatFragment([t],h.floatSide,h.clearSide,!u.hasFloatFragments(),n,i,a).then(function(f){var v=f.floatArea,g=f.pageFloatFragment,p=f.newPosition;g?s.layoutStashedPageFloats(h.floatReference,[a]).then(function(E){if(E){if(u.addPageFloatFragment(g),u.discardStashedFragments(h.floatReference),p){var C=new eu(h,p.primary);u.deferPageFloat(C)}d.finish(!0)}else c(v,g),d.finish(!1)}):(c(v,g),d.finish(!1))}),d.result()},e.layoutStashedPageFloats=function(t,n){var i=this,a=this.pageFloatLayoutContext,s=a.getStashedFloatFragments(t),u=[],h=[],c=!1,d=L("layoutStashedPageFloats"),f=0;return d.loopWithFrame(function(v){if(f>=s.length)v.breakLoop();else{var g=s[f];if(n.includes(g))return f++,void v.continueLoop();var p=new jn().findByFloat(g.continuations[0].float);i.layoutSinglePageFloatFragment(g.continuations,g.floatSide,null,!1,p,null).then(function(E){var C=E.floatArea;C&&u.push(C);var D=E.pageFloatFragment;D?(h.push(D),f++,v.continueLoop()):(c=!0,v.breakLoop())})}}).then(function(){c?(h.forEach(function(v){a.removePageFloatFragment(v,!0)}),u.forEach(function(v){var g=v.element;g&&g.parentNode&&g.parentNode.removeChild(g)})):s.forEach(function(v){var g=v.area.element;g&&g.parentNode&&g.parentNode.removeChild(g)}),d.finish(!c)}),d.result()},e.setFloatAnchorViewNode=function(t){var n=t.viewNode.parentNode,i=n.ownerDocument.createElement("span");i.setAttribute("data-adapt-spec","1"),t.floatSide==="footnote"&&this.layoutContext.applyPseudoelementStyle(t,"footnote-call",i),n.appendChild(i),n.removeChild(t.viewNode);var a=t.modify();return a.after=!0,a.viewNode=i,a},e.resolveFloatReferenceFromColumnSpan=function(t,n,i){var a=this,s=L("resolveFloatReferenceFromColumnSpan"),u=this.pageFloatLayoutContext,h=u.getPageFloatLayoutContext(ne.REGION);return u.getContainer().width<h.getContainer().width&&t===ne.COLUMN?n===b.auto?this.buildDeepElementView(i.copy()).then(function(c){var d=c.viewNode,f=Fo(a.clientLayout,d,[Pt.MIN_CONTENT_INLINE_SIZE])[Pt.MIN_CONTENT_INLINE_SIZE],v=a.getComputedMargin(d);s.finish((f+=a.vertical?v.top+v.bottom:v.left+v.right)>a.width?ne.REGION:t)}):s.finish(n===b.all?ne.REGION:t):s.finish(t),s.result()},e.layoutPageFloat=function(t){var n=this,i=this.pageFloatLayoutContext,a=new jn().findByNodeContext(t),s=i.findPageFloatByNodePosition(t.toNodePosition());return(s?I(s):a.createPageFloat(t,i,this)).thenAsync(function(u){var h=Ji(t,0),c=n.setFloatAnchorViewNode(t),d=a.findPageFloatFragment(u,i),f=new eu(u,h);if(d&&d.hasFloat(u))return i.registerPageFloatAnchor(u,c.viewNode),I(c);if(i.isForbidden(u)||i.hasPrecedingFloatsDeferredToNext(u))return i.deferPageFloat(f),i.registerPageFloatAnchor(u,c.viewNode),I(c);if(n.nodeContextOverflowingDueToRepetitiveElements)return I(null);var v=Yn(c,n.clientLayout,0,n.vertical);return n.isOverflown(v)?I(c):n.layoutPageFloatInner(f,a,v,d).thenAsync(function(g){return g?I(null):(i.registerPageFloatAnchor(u,c.viewNode),I(c))})})},e.createJustificationAdjustmentElement=function(t,n,i,a){var s=n.createElement("span");s.style.visibility="hidden",s.style.verticalAlign="top",s.setAttribute("data-adapt-spec","1");var u=n.createElement("span");u.style.fontSize="0",u.style.lineHeight="0",u.textContent=" #",s.appendChild(u),s.style.display="block",s.style.textIndent="0",s.style.textAlign="left",i.insertBefore(s,t);var h=this.clientLayout.getElementClientRect(u);s.style.textAlign="right";var c=this.clientLayout.getElementClientRect(u);s.style.textAlign="",s.style.display=function(v){if(Rr===null){var g=v.ownerDocument,p=g.createElement("div");p.style.position="absolute",p.style.top="0px",p.style.left="0px",p.style.width="30px",p.style.height="100px",p.style.lineHeight="16px",p.style.fontSize="16px",p.style.textAlign="justify",v.appendChild(p);var E=g.createTextNode("a | ");p.appendChild(E);var C=g.createElement("span");C.style.display="inline-block",C.style.width="30px",p.appendChild(C);var D=g.createRange();D.setStart(E,0),D.setEnd(E,3);var y=D.getBoundingClientRect();Rr=y.right<27,v.removeChild(p)}return Rr}(document.body)?"inline":"inline-block";var d=a?c.top-h.top:c.left-h.left,f=d>=1?d-1+"px":"100%";return a?s.style.paddingTop=f:s.style.paddingLeft=f,s},e.addAndAdjustJustificationElement=function(t,n,i,a,s,u){return function(h,c,d,f){if(function(D){if(Or===null){var y=D.ownerDocument,N=y.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",D.appendChild(N);var x=y.createTextNode("a a-");N.appendChild(x);var F=y.createElement("span");F.style.display="inline-block",F.style.width="40px",N.appendChild(F);var k=y.createRange();k.setStart(x,2),k.setEnd(x,4);var H=k.getBoundingClientRect();Or=H.right<37,D.removeChild(N)}return Or}(document.body)){var v=Go(h),g=c?d:d.previousSibling,p=g?g.textContent:"";if(p.charAt(p.length-1)===v){var E=d.ownerDocument,C=d.parentNode;(function(D){if(kr===null){var y=D.ownerDocument,N=y.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",D.appendChild(N);var x=y.createTextNode("a a-");N.appendChild(x),N.appendChild(y.createElement("wbr"));var F=y.createElement("span");F.style.display="inline-block",F.style.width="40px",N.appendChild(F);var k=y.createRange();k.setStart(x,2),k.setEnd(x,4);var H=k.getBoundingClientRect();kr=H.right<37,D.removeChild(N)}return kr})(document.body)?C.insertBefore(E.createTextNode(" "),f):C.insertBefore(E.createElement("wbr"),f)}}}(t,n,i,a),this.createJustificationAdjustmentElement(a,s,u,t.vertical)},e.compensateJustificationLineHeight=function(t,n,i){var a=this.clientLayout.getElementClientRect(t),s=this.clientLayout.getElementClientRect(n);i.vertical?(n.style.marginRight=s.right-a.right+"px",n.style.width="0px"):(n.style.marginTop=a.top-s.top+"px",n.style.height="0px"),n.setAttribute("data-adapt-spec","1")},e.fixJustificationIfNeeded=function(t,n){if(!t.after||t.inline){if(n){for(var i="",a=t.parent;a&&!i;a=a.parent)!a.inline&&a.viewNode&&(i=a.viewNode.style.textAlign);if(i!=="justify")return}var s=t.viewNode,u=s.ownerDocument,h=n&&(t.after||s.nodeType!=1),c=h?s.nextSibling:s;c&&!c.parentNode&&(c=null);var d=s.parentNode||t.parent&&t.parent.viewNode;if(d){var f=this.addAndAdjustJustificationElement(t,h,s,c,u,d);if(!n){var v=u.createElement("div");d.insertBefore(v,c),this.compensateJustificationLineHeight(f,v,t)}}}},e.processLineStyling=function(t,n,i){var a=this,s=L("processLineStyling"),u=i.concat([]);i.splice(0,i.length);var h=0,c=t.firstPseudo;return c.count==0&&(c=c.outer),s.loopWithFrame(function(d){if(c){var f=a.findLinePositions(u),v=c.count-h;if(f.length<=v)d.breakLoop();else{var g=a.findAcceptableBreakInside(u,f[v-1],!0);g!=null?a.finishBreak(g,!1,!1).then(function(){h+=v,a.layoutContext.peelOff(g,0).then(function(p){a.fixJustificationIfNeeded(t=p,!1),c=t.firstPseudo,a.buildViewToNextBlockEdge(t,u=[]).then(function(E){n=E,d.continueLoop()})})}):d.breakLoop()}}else d.breakLoop()}).then(function(){Array.prototype.push.apply(i,u),s.finish(n)}),s.result()},e.isLoneImage=function(t){return!(t.length!=2&&this.breakPositions.length>0)&&t[0].sourceNode==t[1].sourceNode&&Ho[t[0].sourceNode.localName]},e.getTrailingMarginEdgeAdjustment=function(t){for(var n=0,i=0,a=t.length-1;a>=0;a--){var s=t[a];if(!s.after||!s.viewNode||s.viewNode.nodeType!=1)break;var u=this.getComputedMargin(s.viewNode),h=this.vertical?-u.left:u.bottom;h>0?n=Math.max(n,h):i=Math.min(i,h)}return n-i},e.layoutBreakableBlock=function(t){var n=this,i=L("layoutBreakableBlock"),a=[];return this.buildViewToNextBlockEdge(t,a).then(function(s){var u=a.length-1;if(u<0)i.finish(s);else{var h=n.calculateEdge(s,a,u,a[u].boxOffset),c=!1;if(!s||!Kn(s.viewNode)){var d=Qn(s,n.collectElementsOffset());c=n.isOverflown(h+(n.vertical?-1:1)*d.minimum),n.isOverflown(h+(n.vertical?-1:1)*d.current)&&!n.nodeContextOverflowingDueToRepetitiveElements&&(n.nodeContextOverflowingDueToRepetitiveElements=s)}s==null&&(h+=n.getTrailingMarginEdgeAdjustment(a)),n.updateMaxReachedAfterEdge(h),(t.firstPseudo?n.processLineStyling(t,s,a):I(s)).then(function(f){n.postLayoutBlock(f,a),a.length>0&&(n.saveBoxBreakPosition(a),c&&!n.isLoneImage(a)&&f&&((f=f.modify()).overflow=!0)),i.finish(f)})}}),i.result()},e.postLayoutBlock=function(t,n){var i=this;se(R.HOOKS.POST_LAYOUT_BLOCK).forEach(function(a){a(t,n,i)})},e.findEndOfLine=function(t,n,i){for(var a,s=this.vertical?t-1:t+1,u=0,h=n[0].boxOffset,c=u,d=n.length-1,f=n[d].boxOffset;h<f;){a=h+Math.ceil((f-h)/2),c=u;for(var v=d;c<v;){var g=c+Math.ceil((v-c)/2);n[g].boxOffset>a?v=g-1:c=g}var p=this.calculateEdge(null,n,c,a);if(this.vertical?p<=s:p>=s){for(f=a-1;n[c].boxOffset==a;)c--;d=c}else i&&this.updateMaxReachedAfterEdge(p),h=a,u=c}return{nodeContext:n[c],index:h,checkPointIndex:c}},e.findAcceptableBreakInside=function(t,n,i){var a=this.findEndOfLine(n,t,!0),s=a.nodeContext,u=s.viewNode;if(u.nodeType!=1){var h=u;s=this.resolveTextNodeBreaker(s).breakTextNode(h,s,a.index,t,a.checkPointIndex,i)}return this.clearOverflownViewNodes(s,!1),s},e.resolveTextNodeBreaker=function(t){return se(R.HOOKS.RESOLVE_TEXT_NODE_BREAKER).reduce(function(n,i){return i(t)||n},fr.instance)},e.getRangeBoxes=function(t,n){for(var i=[],a=t.ownerDocument.createRange(),s=!1,u=t,h=null,c=!1,d=!0;d;){var f=!0;do{var v=null;u==n&&(d=n.nodeType===1&&!(!n.firstChild||s)),u.nodeType!=1?(c||(u.parentNode==null?d=!1:(a.setStartBefore(u),c=!0)),h=u):s?s=!1:au(u)?f=!c:u.localName=="ruby"||sd(this.clientLayout.getElementComputedStyle(u).display)?((f=!c)&&(a.setStartBefore(u),c=!0,h=u),u.contains(n)&&(d=!1)):v=u.firstChild,v||(v=u.nextSibling)||(s=!0,v=u.parentNode),u=v}while(f&&d);if(c){a.setEndAfter(h);for(var g=this.clientLayout.getRangeClientRects(a),p=0;p<g.length;p++)i.push(g[p]);c=!1}}return i},e.findLinePositions=function(t){var n=[],i=this.getRangeBoxes(t[0].viewNode,t[t.length-1].viewNode);i.sort(this.vertical?$h:Zh);for(var a=0,s=0,u=0,h=0,c=0,d=this.getBoxDir();;){if(c<i.length){var f=i[c],v=1;if(h>0){var g=Math.max(this.getBoxSize(f),1);v=d*this.getBeforeEdge(f)<d*a?d*(this.getAfterEdge(f)-a)/g:d*this.getAfterEdge(f)>d*s?d*(s-this.getBeforeEdge(f))/g:1}if(h==0||v>=.6||v>=.2&&this.getStartEdge(f)>=u-1){u=this.getEndEdge(f),this.vertical?(a=h==0?f.right:Math.max(a,f.right),s=h==0?f.left:Math.min(s,f.left)):(a=h==0?f.top:Math.min(a,f.top),s=h==0?f.bottom:Math.max(s,f.bottom)),h++,c++;continue}}if(h>0&&(n.push(s),h=0),c>=i.length)break}return n.sort(Ca),this.vertical&&n.reverse(),n},e.calculateClonedPaddingBorder=function(t){var n=this,i=0;return t.walkUpBlocks(function(a){if(a.inheritedProps["box-decoration-break"]==="clone"){var s=n.getComputedPaddingBorder(a.viewNode);i+=a.vertical?-s.left:s.bottom,a.display==="table"&&(i+=a.blockBorderSpacing)}}),i},e.getOffsetByRepetitiveElements=function(t){return(t?t.calculateOffset(this):Qn(null,this.collectElementsOffset())).current},e.findBoxBreakPosition=function(t,n){for(var i,a,s=this,u=t.checkPoints,h=u[0];h.parent&&h.inline;)h=h.parent;n?(i=1,a=1):(i=Math.max((h.inheritedProps.widows||2)-0,1),a=Math.max((h.inheritedProps.orphans||2)-0,1));var c=this.calculateClonedPaddingBorder(h),d=this.findLinePositions(u),f=this.footnoteEdge-c,v=this.getBoxDir(),g=this.getOffsetByRepetitiveElements(t);f-=v*g;var p=this.findFirstOverflowingEdgeAndCheckPoint(u);isNaN(p.edge)&&(p.edge=1/0*v);var E,C=cn(d.length,function(N){var x=d[N];return s.vertical?x<f||x<=p.edge:x>f||x>=p.edge}),D=C<=0;if(D&&(C=cn(d.length,function(N){return s.vertical?d[N]<f:d[N]>f})),(C=Math.min(d.length-i,C))<a)return null;if(f=d[C-1],E=D?p.checkPoint:this.findAcceptableBreakInside(t.checkPoints,f,n)){var y=this.getAfterEdgeOfBlockContainer(E);!isNaN(y)&&y<f&&(f=y),this.computedBlockSize=v*(f-this.beforeEdge)+g}return E},e.getAfterEdgeOfBlockContainer=function(t){var n=t;do n=n.parent;while(n&&n.inline);return n?((n=n.copy().modify()).after=!0,Yn(n,this.clientLayout,0,this.vertical)):NaN},e.findFirstOverflowingEdgeAndCheckPoint=function(t){var n=t.findIndex(function(a){return a.overflow});if(n<0)return{edge:NaN,checkPoint:null};var i=t[n];return{edge:this.calculateEdge(null,t,n,i.boxOffset),checkPoint:i}},e.findEdgeBreakPosition=function(t){return this.computedBlockSize=t.computedBlockSize+this.getOffsetByRepetitiveElements(t),t.position},e.finishBreak=function(t,n,i){var a=new wi().find(t.formattingContext).finishBreak(this,t,n,i);return a||(a=Bo.finishBreak(this,t,n,i)),a},e.findAcceptableBreakPosition=function(){var t=null,n=null,i=0,a=0;do{i=a,a=Number.MAX_VALUE;for(var s=this.breakPositions.length-1;s>=0&&!n;--s){n=(t=this.breakPositions[s]).findAcceptableBreak(this,i);var u=t.getMinBreakPenalty();u>i&&(a=Math.min(a,u))}}while(a>i&&!n&&this.forceNonfitting);return{breakPosition:n?t:null,nodeContext:n}},e.doFinishBreak=function(t,n,i,a){var s=this;if(this.pageFloatLayoutContext.isInvalidated()||this.pageBreakType||!n)return I(t);var u=L("doFinishBreak"),h=!1;if(!t){if(this.forceNonfitting)return M.warn("Could not find any page breaks?!!"),this.skipTailEdges(n).then(function(c){c?((c=c.modify()).overflow=!1,s.finishBreak(c,h,!0).then(function(){u.finish(c)})):u.finish(c)}),u.result();t=i,h=!0,this.computedBlockSize=a}return this.finishBreak(t,h,!0).then(function(){u.finish(t)}),u.result()},e.isBreakable=function(t){if(t.after)return!0;switch(t.sourceNode.namespaceURI){case U.SVG:return!1}return!t.flexContainer},e.zeroIndent=function(t){var n=t.toString();return n==""||n=="auto"||!!n.match(/^0+(.0*)?[^0-9]/)},e.checkOverflowAndSaveEdge=function(t,n){if(!t||Kn(t.viewNode))return!1;var i=Yn(t,this.clientLayout,0,this.vertical),a=Qn(t,this.collectElementsOffset()),s=this.isOverflown(i+(this.vertical?-1:1)*a.minimum);if(this.isOverflown(i+(this.vertical?-1:1)*a.current)&&!this.nodeContextOverflowingDueToRepetitiveElements)this.nodeContextOverflowingDueToRepetitiveElements=t;else if(n){var u=i+this.getTrailingMarginEdgeAdjustment(n),h=this.footnoteEdge-this.getBoxDir()*a.current;i=this.vertical?Math.min(i,Math.max(u,h)):Math.max(i,Math.min(u,h))}return this.updateMaxReachedAfterEdge(i),s},e.checkOverflowAndSaveEdgeAndBreakPosition=function(t,n,i,a){if(!t||Kn(t.viewNode))return!1;var s=this.checkOverflowAndSaveEdge(t,n);return!i&&s||this.saveEdgeBreakPosition(t,a,s),s},e.applyClearance=function(t){if(!t.viewNode.parentNode)return!1;var n=this.getComputedMargin(t.viewNode),i=t.viewNode.ownerDocument.createElement("div");this.vertical?(i.style.bottom="0px",i.style.width="1px",i.style.marginRight=n.right+"px"):(i.style.right="0px",i.style.height="1px",i.style.marginTop=n.top+"px"),t.viewNode.parentNode.insertBefore(i,t.viewNode);var a=this.clientLayout.getElementClientRect(i),s=this.getBeforeEdge(a),u=this.getBoxDir(),h=t.clearSide,c=1/0*-this.getBoxDir();switch(h==="all"&&(c=this.pageFloatLayoutContext.getPageFloatClearEdge(h,this)),h){case"left":c=u*Math.max(c*u,this.leftFloatEdge*u);break;case"right":c=u*Math.max(c*u,this.rightFloatEdge*u);break;default:c=u*Math.max(c*u,Math.max(this.rightFloatEdge*u,this.leftFloatEdge*u))}if(s*u>=c*u)return t.viewNode.parentNode.removeChild(i),!1;var d=Math.max(1,(c-s)*u);this.vertical?i.style.width=d+"px":i.style.height=d+"px",a=this.clientLayout.getElementClientRect(i);var f=this.getAfterEdge(a);if(this.vertical){var v=f+n.right-c;v>0==n.right>=0&&(v+=n.right),i.style.marginLeft=v+"px"}else{var g=c-(f+n.top);g>0==n.top>=0&&(g+=n.top),i.style.marginBottom=g+"px"}return t.clearSpacer=i,!0},e.isBFC=function(t){return!!$c(t)||!!Pn.isInstanceOfRepetitiveElementsOwnerFormattingContext(t)},e.skipEdges=function(t,n,i){var a=this,s=t.after?t.parent&&t.parent.formattingContext:t.formattingContext;if(s&&!this.isBFC(s))return I(t);var u=L("skipEdges"),h=!i&&n&&t&&t.after,c=i,d=null,f=[],v=[],g=!1;function p(){return!!i||!n&&_e(c)}var E=function(){(t=f[0]||t).viewNode.parentNode.removeChild(t.viewNode),a.pageBreakType=c};return u.loopWithFrame(function(C){for(;t;){var D=new wi().find(t.formattingContext);do{if(!t.viewNode)break;if(t.inline&&t.viewNode.nodeType!=1){if($i(t.viewNode,t.whitespace))break;if(!t.after)return p()?E():a.checkOverflowAndSaveEdgeAndBreakPosition(d,null,!0,c)?(t=(a.stopAtOverflow&&d||t).modify()).overflow=!0:(t=t.modify()).breakBefore=c,void C.breakLoop()}if(!t.after){if(D&&D.startNonInlineElementNode(t))break;if(t.clearSide&&a.applyClearance(t)&&n&&a.breakPositions.length===0&&a.saveEdgeBreakPosition(t.copy(),c,!1),!a.isBFC(t.formattingContext)||Pn.isInstanceOfRepetitiveElementsOwnerFormattingContext(t.formattingContext)||a.isFloatNodeContext(t)||t.flexContainer)return f.push(t.copy()),c=Ne(c,t.breakBefore),p()?E():!a.checkOverflowAndSaveEdgeAndBreakPosition(d,null,!0,c)&&a.layoutConstraint.allowLayout(t)||((t=(a.stopAtOverflow&&d||t).modify()).overflow=!0),void C.breakLoop()}if(t.viewNode.nodeType!=1)break;var y=t.viewNode.style;if(t.after){if(t.inline||D&&D.afterNonInlineElementNode(t,a.stopAtOverflow))break;if(g){if(p())return E(),void C.breakLoop();f=[],n=!1,h=!1,c=null}g=!1,d=t.copy(),v.push(d),c=Ne(c,t.breakAfter),!y||a.zeroIndent(y.paddingBottom)&&a.zeroIndent(y.borderBottomWidth)||(v=[d])}else{if(f.push(t.copy()),!_e(c=Ne(c,t.breakBefore))&&!a.layoutConstraint.allowLayout(t)&&(a.checkOverflowAndSaveEdgeAndBreakPosition(d,null,!a.stopAtOverflow,c),(t=t.modify()).overflow=!0,a.stopAtOverflow))return void C.breakLoop();if(Ho[t.viewNode.localName])return p()?E():a.checkOverflowAndSaveEdgeAndBreakPosition(d,null,!0,c)&&((t=(a.stopAtOverflow&&d||t).modify()).overflow=!0),void C.breakLoop();!y||a.zeroIndent(y.paddingTop)&&a.zeroIndent(y.borderTopWidth)||(h=!1,v=[]),g=!0}}while(0);var N=a.nextInTree(t,h);if(N.isPending())return void N.then(function(x){t=x,C.continueLoop()});t=N.get()}a.checkOverflowAndSaveEdgeAndBreakPosition(d,v,!a.stopAtOverflow,c)?d&&a.stopAtOverflow&&((t=d.modify()).overflow=!0):_e(c)&&(a.pageBreakType=c),C.breakLoop()}).then(function(){d&&(a.lastAfterPosition=d.toNodePosition()),u.finish(t)}),u.result()},e.skipTailEdges=function(t){var n=this,i=t.copy(),a=L("skipEdges"),s=null,u=!1;return a.loopWithFrame(function(h){for(;t;){do{if(!t.viewNode)break;if(t.inline&&t.viewNode.nodeType!=1){if($i(t.viewNode,t.whitespace))break;if(!t.after)return _e(s)&&(n.pageBreakType=s),void h.breakLoop()}if(!t.after&&(n.isFloatNodeContext(t)||t.flexContainer))return _e(s=Ne(s,t.breakBefore))&&(n.pageBreakType=s),void h.breakLoop();if(t.viewNode.nodeType!=1)break;var c=t.viewNode.style;if(t.after){if(u){if(_e(s))return n.pageBreakType=s,void h.breakLoop();s=null}u=!1,s=Ne(s,t.breakAfter)}else{if(s=Ne(s,t.breakBefore),Ho[t.viewNode.localName])return _e(s)&&(n.pageBreakType=s),void h.breakLoop();if(c&&(!n.zeroIndent(c.paddingTop)||!n.zeroIndent(c.borderTopWidth)))return void h.breakLoop()}u=!0}while(0);var d=n.layoutContext.nextInTree(t);if(d.isPending())return void d.then(function(f){t=f,h.continueLoop()});t=d.get()}i=null,h.breakLoop()}).then(function(){a.finish(i)}),a.result()},e.layoutFloatOrFootnote=function(t){return lr(t.floatReference)||t.floatSide==="footnote"?this.layoutPageFloat(t):this.layoutFloat(t)},e.layoutNext=function(t,n,i){var a=this,s=L("layoutNext");return this.skipEdges(t,n,i||null).then(function(u){if(!(t=u)||a.pageBreakType||a.stopByOverflow(t))s.finish(t);else{var h=t.formattingContext;new wi().find(h).layout(t,a,n).thenFinish(s)}}),s.result()},e.clearOverflownViewNodes=function(t,n){if(t)for(var i=t.parent;t;t=i,i=i?i.parent:null){var a=(i||t).formattingContext;new wi().find(a).clearOverflownViewNodes(this,i,t,n),n=!1}},e.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 n=this.clientLayout.getElementClientRect(t);this.element.removeChild(t);var i=this.originX+this.left+this.getInsetLeft(),a=this.originY+this.top+this.getInsetTop();this.box=new ke(i,a,i+this.width,a+this.height),this.startEdge=n?this.vertical?n.top:n.left:0,this.endEdge=n?this.vertical?n.bottom:n.right:0,this.beforeEdge=n?this.vertical?n.right:n.top:0,this.afterEdge=n?this.vertical?n.left:n.bottom:0,this.leftFloatEdge=this.beforeEdge,this.rightFloatEdge=this.beforeEdge,this.bottommostFloatTop=this.beforeEdge,this.footnoteEdge=this.afterEdge,this.bands=function(s,u,h,c,d,f){f&&(s=zi(s),u=u.map(function(j){return es(j)}),h=h.map(function(j){return es(j)}));var v,g,p,E=u.length,C=h?h.length:0,D=[],y=[];for(v=0;v<E;v++)u[v].addSegments(y,v);for(v=0;v<C;v++)h[v].addSegments(y,v+E);var N=y.length;y.sort(th);for(var x=0;y[x].shapeId>=E;)x++;var F=y[x].low.y;F>s.y1&&D.push(new rn(s.y1,F,s.x2,s.x2));for(var k,H,K=0,q=[];K<N&&(p=y[K]).low.y<F;)p.high.y>F&&q.push(p),K++;for(;K<N||q.length>0;){var W=s.y2,G=Math.min((k=Math.ceil(F+8),(H=d)?Math.ceil(k/H)*H:k),s.y2);for(g=0;g<q.length&&W>G;g++)(p=q[g]).low.x==p.high.x?p.high.y<W&&(W=Math.max(Ja(p.high.y,d),G)):p.low.x!=p.high.x&&(W=G);for(W>s.y2&&(W=s.y2);K<N&&(p=y[K]).low.y<W;)if(p.high.y<F)K++;else{if(!(p.low.y<G)){var X=Ja(p.low.y,d);X<W&&(W=X);break}p.low.y==p.high.y&&p.low.y==F||(q.push(p),W=G),K++}var it=[];for(g=0;g<q.length;g++)eh(it,q[g],F,W);it.sort(function(j,ot){return j.x-ot.x||j.lowOrHigh-ot.lowOrHigh});var lt=nh(it,E,C);if(lt.length==0)D.push(new rn(F,W,s.x2,s.x2));else{var Ht=0,ct=s.x1;for(g=0;g<lt.length;g+=2){var ft=Math.max(s.x1,lt[g]),tt=Math.min(s.x2,lt[g+1])-ft;tt>Ht&&(Ht=tt,ct=ft)}D.push(Ht==0?new rn(F,W,s.x2,s.x2):new rn(F,W,Math.max(ct,s.x1),Math.min(ct+Ht,s.x2)))}if(W==s.y2)break;for(F=W,g=q.length-1;g>=0;g--)q[g].high.y<=W&&q.splice(g,1)}return ns(s,D),D}(this.box,[this.getInnerShape()],this.getExclusions(),0,this.snapHeight,this.vertical),this.createFloats()},e.init=function(){this.chunkPositions=[],T(this.element,"width",this.width+"px"),T(this.element,"height",this.height+"px"),this.initGeom(),this.computedBlockSize=0,this.overflown=!1,this.pageBreakType=null,this.lastAfterPosition=null},e.saveEdgeBreakPosition=function(t,n,i){var a=t.copy(),s=new wi().find(t.formattingContext),u=this.calculateClonedPaddingBorder(a),h=s.createEdgeBreakPosition(a,n,i,this.computedBlockSize+u);this.breakPositions.push(h)},e.saveBoxBreakPosition=function(t){var n=new ad(t,t[0].breakPenalty);this.breakPositions.push(n)},e.updateMaxReachedAfterEdge=function(t){if(!isNaN(t)){var n=this.getBoxDir()*(t-this.beforeEdge);this.computedBlockSize=Math.max(n,this.computedBlockSize)}},e.layout=function(t,n,i){var a=this;if(this.chunkPositions.push(t),t.primary.after&&(this.lastAfterPosition=t.primary),this.stopAtOverflow&&this.overflown)return I(t);if(this.isFullWithPageFloats())return I(t.primary.after&&t.primary.steps.length===1?null:t);var s=L("layout");return this.openAllViews(t.primary).then(function(u){var h=null;u.viewNode?h=u.copy():a.layoutContext.addEventListener("nextInTree",function d(f){f.nodeContext.viewNode&&(h=f.nodeContext,a.layoutContext.removeEventListener("nextInTree",d))});var c=new ud(n,i);c.layout(u,a).then(function(d){a.doFinishBreak(d,c.context.overflownNodeContext,h,c.initialComputedBlockSize).then(function(f){(a.pseudoParent?I(null):a.doFinishBreakOfFragmentLayoutConstraints(f)).then(function(){if(a.pageFloatLayoutContext.isInvalidated())s.finish(null);else if(f){a.overflown=!0;var v=new wn(f.toNodePosition());s.finish(v)}else s.finish(null)})})})}),s.result()},e.isFullWithPageFloats=function(){return this.pageFloatLayoutContext.isColumnFullWithPageFloats(this)},e.getMaxBlockSizeOfPageFloats=function(){return this.pageFloatLayoutContext.getMaxBlockSizeOfPageFloats()},e.doFinishBreakOfFragmentLayoutConstraints=function(t){var n=this,i=L("doFinishBreakOfFragmentLayoutConstraints"),a=[].concat(this.fragmentLayoutConstraints);a.sort(function(u,h){return u.getPriorityOfFinishBreak()-h.getPriorityOfFinishBreak()});var s=0;return i.loop(function(){return s<a.length?a[s++].finishBreak(t,n).thenReturn(!0):I(!1)}).then(function(){i.finish(!0)}),i.result()},e.doLayout=function(t,n,i){var a=this,s=L("doLayout"),u=null;return this.breakPositions=[],this.nodeContextOverflowingDueToRepetitiveElements=null,s.loopWithFrame(function(h){for(var c=function(){var f=!0;if(a.layoutNext(t,n,i||null).then(function(v){if(n=!1,i=null,a.nodeContextOverflowingDueToRepetitiveElements&&a.stopAtOverflow?(a.pageBreakType=null,(t=a.nodeContextOverflowingDueToRepetitiveElements).overflow=!0):t=v,a.pageFloatLayoutContext.isInvalidated())h.breakLoop();else if(a.pageBreakType)h.breakLoop();else if(t&&a.stopByOverflow(t)){u=t;var g=a.findAcceptableBreakPosition();t=g.nodeContext,g.breakPosition&&g.breakPosition.breakPositionChosen(a),h.breakLoop()}else f?f=!1:h.continueLoop()}),f)return f=!1,{v:void 0}};t;){var d=c();if(typeof d=="object")return d.v}a.computedBlockSize+=a.getOffsetByRepetitiveElements(),h.breakLoop()}).then(function(){s.finish({nodeContext:t,overflownNodeContext:u})}),s.result()},e.redoLayout=function(){for(var t=this,n=this.chunkPositions,i=this.element.lastChild;i!=this.last;){var a=i.previousSibling;this.element===i.parentNode&&this.layoutContext.isPseudoelement(i)||this.element.removeChild(i),i=a}this.killFloats(),this.init();var s=L("redoLayout"),u=0,h=null,c=!0;return s.loopWithFrame(function(d){if(u<n.length){var f=n[u++];t.layout(f,c).then(function(v){c=!1,v?(h=v,d.breakLoop()):d.continueLoop()})}else d.breakLoop()}).then(function(){s.finish(h)}),s.result()},e.saveDistanceToBlockEndFloats=function(){var t=this.pageFloatLayoutContext.getBlockStartEdgeOfBlockEndFloats();t>0&&isFinite(t)&&(this.blockDistanceToBlockEndFloats=this.getBoxDir()*(t-this.beforeEdge-this.computedBlockSize))},e.collectElementsOffset=function(){for(var t=this,n=[],i=this;i;i=i.pseudoParent)i.fragmentLayoutConstraints.forEach(function(a){if(Pn.isInstanceOfRepetitiveElementsOwnerLayoutConstraint(a)){var s=a.getRepetitiveElements();n.push(s)}if(po.isInstanceOfAfterIfContinuesLayoutConstraint(a)){var u=a.getRepetitiveElements();n.push(u)}En.isInstanceOfTableRowLayoutConstraint(a)&&a.getElementsOffsetsForTableCell(t).forEach(function(h){n.push(h)})});return n},r}(As),zo=function(){function o(e,t,n){this.startNodeContexts=[],this.column=void 0,this.column=Object.create(e),this.column.element=t,this.column.layoutContext=e.layoutContext.clone(),this.column.stopAtOverflow=!1,this.column.flowRootFormattingContext=n.formattingContext,this.column.pseudoParent=e;var i=this.column.calculateClonedPaddingBorder(n);this.column.footnoteEdge=this.column.footnoteEdge-i;var a=this;this.column.openAllViews=function(s){return dr.prototype.openAllViews.call(this,s).thenAsync(function(u){return a.startNodeContexts.push(u.copy()),I(u)})}}var r=o.prototype;return r.layout=function(e,t){return this.column.layout(e,t)},r.findAcceptableBreakPosition=function(e){var t=this.column.findAcceptableBreakPosition();if(e){var n=this.startNodeContexts[0].copy(),i=new hr(n,null,n.overflow,0);if(i.findAcceptableBreak(this.column,0),!t.nodeContext)return{breakPosition:i,nodeContext:n}}return t},r.finishBreak=function(e,t,n){return this.column.finishBreak(e,t,n)},r.doFinishBreakOfFragmentLayoutConstraints=function(e){this.column.doFinishBreakOfFragmentLayoutConstraints(e)},r.isStartNodeContext=function(e){var t=this.startNodeContexts[0];return t.viewNode===e.viewNode&&t.after===e.after&&t.offsetInNode===e.offsetInNode},r.isLastAfterNodeContext=function(e){return Dn(e.toNodePosition(),this.column.lastAfterPosition)},r.getColumnElement=function(){return this.column.element},r.getColumn=function(){return this.column},o}(),fr=function(){function o(){}var r=o.prototype;return r.breakTextNode=function(e,t,n,i,a,s){if(t.after)t.offsetInNode=e.length;else{var u=n-t.boxOffset,h=e.data;(u=h.charCodeAt(u)==173?this.breakAfterSoftHyphen(e,h,u,t):this.breakAfterOtherCharacter(e,h,u,t))>0&&(t=this.updateNodeContext(t,u,e))}return t},r.breakAfterSoftHyphen=function(e,t,n,i){return e.replaceData(n,t.length-n,i.breakWord?"":Go(i)),n+1},r.breakAfterOtherCharacter=function(e,t,n,i){var a=t.charAt(n);n++;var s=t.charAt(n);return e.replaceData(n,t.length-n,!i.breakWord&&ma(a)&&ma(s)?Go(i):""),n},r.updateNodeContext=function(e,t,n){return(e=e.modify()).offsetInNode+=t,e.breakBefore=null,e},o}();function Go(o){return o.hyphenateCharacter||o.parent&&o.parent.hyphenateCharacter||"-"}fr.instance=void 0,fr.instance=new fr;var ud=function(o){function r(t,n){var i;return(i=o.call(this)||this).leadingEdge=void 0,i.breakAfter=void 0,i.initialPageBreakType=null,i.initialComputedBlockSize=0,i.initialOverflown=!1,i.context={overflownNodeContext:null},i.leadingEdge=t,i.breakAfter=n||null,i}w(r,o);var e=r.prototype;return e.resolveLayoutMode=function(t){return new ld(this.leadingEdge,this.breakAfter,this.context)},e.prepareLayout=function(t,n){n.fragmentLayoutConstraints=[],n.pseudoParent||(Uo=[])},e.clearNodes=function(t){o.prototype.clearNodes.call(this,t);for(var n=t;n;){var i=n.viewNode;i&&ou(i.parentNode,i),n=n.parent}},e.saveState=function(t,n){o.prototype.saveState.call(this,t,n),this.initialPageBreakType=n.pageBreakType,this.initialComputedBlockSize=n.computedBlockSize,this.initialOverflown=n.overflown},e.restoreState=function(t,n){o.prototype.restoreState.call(this,t,n),n.pageBreakType=this.initialPageBreakType,n.computedBlockSize=this.initialComputedBlockSize,n.overflown=this.initialOverflown},r}(_o),ld=function(){function o(e,t,n){this.leadingEdge=void 0,this.breakAfter=void 0,this.context=void 0,this.leadingEdge=e,this.breakAfter=t,this.context=n}var r=o.prototype;return r.doLayout=function(e,t){var n=this,i=L("DefaultLayoutMode.doLayout");return function(a,s){var u=L("processAfterIfContinuesOfAncestors"),h=a;return u.loop(function(){if(h!==null){var c=fu(h,s);return h=h.parent,c.thenReturn(!0)}return I(!1)}).then(function(){u.finish(!0)}),u.result()}(e,t).then(function(){t.doLayout(e,n.leadingEdge,n.breakAfter).then(function(a){n.context.overflownNodeContext=a.overflownNodeContext,i.finish(a.nodeContext)})}),i.result()},r.accept=function(e,t){var n=this;return!(!t.pageFloatLayoutContext.isInvalidated()&&!t.pageBreakType)||t.fragmentLayoutConstraints.length<=0||t.fragmentLayoutConstraints.every(function(i){return i.allowLayout(e,n.context.overflownNodeContext,t)})},r.postLayout=function(e,t,n,i){if(!i){var a=n.fragmentLayoutConstraints.some(function(s){return s.nextCandidate(e)});i=!a}return n.fragmentLayoutConstraints.forEach(function(s){s.postLayout(i,e,t,n)}),i},o}(),hd=function(o){function r(t,n,i,a,s,u,h){var c;return(c=o.call(this,n,i,a,s,u)||this).floatSide=void 0,c.parentContainer=void 0,c.rootViewNodes=[],c.floatMargins=[],c.adjustContentRelativeSize=!0,c.floatSide=t,c.parentContainer=h,c}w(r,o);var e=r.prototype;return e.openAllViews=function(t){var n=this;return o.prototype.openAllViews.call(this,t).thenAsync(function(i){return i&&n.fixFloatSizeAndPosition(i),I(i)})},e.convertPercentageSizesToPx=function(t){var n=this.parentContainer.getPaddingRect(),i=n.x2-n.x1,a=n.y2-n.y1;function s(u,h){u.forEach(function(c){var d=Bn(t,c);if(d&&d.charAt(d.length-1)==="%"){var f=parseFloat(d);T(t,c,h*f/100+"px")}})}s(["width","max-width","min-width"],i),s(["height","max-height","min-height"],a),s(["margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left"],this.vertical?a:i),["margin-top","margin-right","margin-bottom","margin-left"].forEach(function(u){Bn(t,u)==="auto"&&T(t,u,"0")})},e.fixFloatSizeAndPosition=function(t){for(;t.parent;)t=t.parent;var n=t.viewNode;if(this.rootViewNodes.push(n),this.adjustContentRelativeSize&&this.convertPercentageSizesToPx(n),this.floatMargins.push(this.getComputedMargin(n)),this.adjustContentRelativeSize){var i=this.floatSide;if(this.parentContainer.vertical){if(i==="block-end"||i==="left"){var a=Bn(n,"height");a!==""&&a!=="auto"&&T(n,"margin-top","auto")}}else if(i==="block-end"||i==="bottom"){var s=Bn(n,"width");s!==""&&s!=="auto"&&T(n,"margin-left","auto")}}},e.getContentInlineSize=function(){var t=this;return Math.max.apply(null,this.rootViewNodes.map(function(n,i){var a=t.clientLayout.getElementClientRect(n),s=t.floatMargins[i];return t.vertical?s.top+a.height+s.bottom:s.left+a.width+s.right}))},r}(dr),$n=function(){function o(e,t){this.parent=void 0,this.rootSourceNode=void 0,this.formattingContextType="RepetitiveElementsOwner",this.isRoot=!1,this.repetitiveElements=null,this.parent=e,this.rootSourceNode=t}var r=o.prototype;return r.getName=function(){return"Repetitive elements owner formatting context (RepetitiveElementsOwnerFormattingContext)"},r.isFirstTime=function(e,t){return t},r.getParent=function(){return this.parent},r.getRepetitiveElements=function(){return this.repetitiveElements},r.getRootViewNode=function(e){var t=this.getRootNodeContext(e);return t?t.viewNode:null},r.getRootNodeContext=function(e){do if(!e.belongsTo(this)&&e.sourceNode===this.rootSourceNode)return e;while(e=e.parent);return null},r.initializeRepetitiveElements=function(e){var t=this;this.repetitiveElements||Uo.some(function(n){return n.root===t.rootSourceNode&&(t.repetitiveElements=n.elements,!0)})||(this.repetitiveElements=new cd(e,this.rootSourceNode),Uo.push({root:this.rootSourceNode,elements:this.repetitiveElements}))},r.saveState=function(){},r.restoreState=function(e){},o}(),cd=function(){function o(e,t){this.vertical=void 0,this.ownerSourceNode=void 0,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,this.allowInsertRepeatitiveElements=void 0,this.vertical=e,this.ownerSourceNode=t}var r=o.prototype;return r.setHeaderNodeContext=function(e){this.headerNodePosition||(this.headerNodePosition=Ji(e,0),this.headerSourceNode=e.sourceNode,this.headerViewNode=e.viewNode)},r.setFooterNodeContext=function(e){this.footerNodePosition||(this.footerNodePosition=Ji(e,0),this.footerSourceNode=e.sourceNode,this.footerViewNode=e.viewNode)},r.updateHeight=function(e){this.headerViewNode&&(this.headerHeight=Oo(this.headerViewNode,e,this.vertical),this.headerViewNode=null),this.footerViewNode&&(this.footerHeight=Oo(this.footerViewNode,e,this.vertical),this.footerViewNode=null)},r.prepareLayoutFragment=function(){this.isSkipHeader=this.isSkipFooter=!1,this.enableSkippingFooter=!0,this.enableSkippingHeader=!0},r.appendHeaderToFragment=function(e,t,n){return!this.headerNodePosition||this.isSkipHeader?I(!0):this.appendElementToFragment(this.headerNodePosition,e,t,n)},r.appendFooterToFragment=function(e,t,n){return!this.footerNodePosition||this.isSkipFooter?I(!0):this.appendElementToFragment(this.footerNodePosition,e,t,n)},r.appendElementToFragment=function(e,t,n,i){var a=this,s=t.viewNode,u=t.viewNode.ownerDocument.createElement("div");s.appendChild(u);var h=new zo(i,u,t),c=h.getColumn().pageBreakType;return h.getColumn().pageBreakType=null,this.allowInsertRepeatitiveElements=!0,h.layout(new wn(e),!0).thenAsync(function(){return a.allowInsertRepeatitiveElements=!1,s.removeChild(u),a.moveChildren(u,s,n),h.getColumn().pageBreakType=c,I(!0)})},r.moveChildren=function(e,t,n){if(t)for(;e.firstChild;){var i=e.firstChild;e.removeChild(i),i.setAttribute("data-adapt-spec","1"),n?t.insertBefore(i,n):t.appendChild(i)}},r.calculateOffset=function(e){var t=0;return e&&!this.affectTo(e)||((!this.isSkipFooter||e&&this.isAfterLastContent(e))&&(t+=this.footerHeight),this.isSkipHeader||(t+=this.headerHeight)),t},r.calculateMinimumOffset=function(e){var t=0;return e&&!this.affectTo(e)||(e&&this.isAfterLastContent(e)&&(t+=this.footerHeight),this.enableSkippingHeader||(t+=this.headerHeight)),t},r.isAfterLastContent=function(e){var t=this;return this.findResultFromCache(e,this.afterLastContentNodeCache,function(n){return t.isAfterNodeContextOf(t.lastContentSourceNode,e,!1)})},r.affectTo=function(e){var t=this;return this.findResultFromCache(e,this.affectedNodeCache,function(n){return t.isAfterNodeContextOf(t.ownerSourceNode,e,!0)})},r.findResultFromCache=function(e,t,n){var i=t.filter(function(s){return s.nodeContext.sourceNode===e.sourceNode&&s.nodeContext.after===e.after});if(i.length>0)return i[0].result;var a=n(e);return t.push({nodeContext:e,result:a}),a},r.isAfterNodeContextOf=function(e,t,n){for(var i=[],a=e;a;a=a.parentNode){if(t.sourceNode===a)return t.after;i.push(a)}for(var s=t.sourceNode;s;s=s.parentNode){var u=i.indexOf(s);if(u>=0)return!!n&&u===0;for(var h=s;h;h=h.previousElementSibling)if(i.includes(h))return!0}return t.after},r.isFirstContentNode=function(e){return e&&this.firstContentSourceNode===e.sourceNode},r.isEnableToUpdateState=function(){return!!(!this.isSkipFooter&&this.enableSkippingFooter&&this.footerNodePosition||!this.isSkipHeader&&this.enableSkippingHeader&&this.headerNodePosition)},r.updateState=function(){!this.isSkipFooter&&this.enableSkippingFooter&&this.footerNodePosition?this.isSkipFooter=!0:!this.isSkipHeader&&this.enableSkippingHeader&&this.headerNodePosition&&(this.isSkipHeader=!0)},r.preventSkippingHeader=function(){this.isSkipHeader=!1,this.enableSkippingHeader=!1},r.preventSkippingFooter=function(){this.isSkipFooter=!1,this.enableSkippingFooter=!1},r.isHeaderRegistered=function(){return!!this.headerNodePosition},r.isFooterRegistered=function(){return!!this.footerNodePosition},r.isHeaderSourceNode=function(e){return this.headerSourceNode===e},r.isFooterSourceNode=function(e){return this.footerSourceNode===e},o}(),gu=function(){function o(e){this.formattingContext=void 0,this.formattingContext=e}var r=o.prototype;return r.accept=function(e,t){return!!e},r.postLayout=function(e,t,n,i){var a=this.formattingContext.getRepetitiveElements();return a&&(a.doneInitialLayout||(a.updateHeight(n),a.doneInitialLayout=!0)),i},o}(),vu=function(){function o(e){this.formattingContext=void 0,this.formattingContext=e}var r=o.prototype;return r.accept=function(e,t){return!0},r.postLayout=function(e,t,n,i){return i},o}(),dd=function(o){function r(t,n){var i;return(i=o.call(this,t)||this).processor=void 0,i.processor=n,i}w(r,o);var e=r.prototype;return e.doLayout=function(t,n){return this.processor.doInitialLayout(t,n)},e.accept=function(t,n){return!1},r}(gu),fd=function(o){function r(e,t){var n;return(n=o.call(this,e)||this).processor=void 0,n.processor=t,n}return w(r,o),r.prototype.doLayout=function(e,t){return e.belongsTo(this.formattingContext)||e.after||t.fragmentLayoutConstraints.unshift(new Wo(e)),this.processor.doLayout(e,t)},r}(vu),Wo=function(){function o(e){this.flagmentLayoutConstraintType="RepetitiveElementsOwner",this.nodeContext=void 0,this.nodeContext=e.formattingContext.getRootNodeContext(e)}var r=o.prototype;return r.allowLayout=function(e,t,n){var i=this.getRepetitiveElements();return!(i&&!Kn(this.nodeContext.viewNode)&&i.isEnableToUpdateState()&&(t&&!e||e&&e.overflow))},r.nextCandidate=function(e){var t=this.getRepetitiveElements();return!!t&&!!t.isEnableToUpdateState()&&(t.updateState(),!0)},r.postLayout=function(e,t,n,i){var a=this.getRepetitiveElements();a&&e&&i.stopAtOverflow&&(t==null||a.isAfterLastContent(t))&&a.preventSkippingFooter()},r.finishBreak=function(e,t){var n=this.nodeContext.formattingContext,i=this.getRepetitiveElements();if(!i)return I(!0);var a=this.nodeContext;return function(s,u,h){var c=s.getRepetitiveElements();if(c){var d=s.getRootNodeContext(u);if(d.viewNode)return c.appendHeaderToFragment(d,d.viewNode.firstChild,h)}return I(!0)}(n,a,t).thenAsync(function(){return function(s,u,h){var c=s.getRepetitiveElements();if(c&&!c.isSkipFooter){var d=s.getRootNodeContext(u);if(d.viewNode)return c.appendFooterToFragment(d,null,h)}return I(!0)}(n,a,t).thenAsync(function(){return i.prepareLayoutFragment(),I(!0)})})},r.getRepetitiveElements=function(){return this.nodeContext.formattingContext.getRepetitiveElements()},r.equalsTo=function(e){return e instanceof o&&this.nodeContext.formattingContext===e.nodeContext.formattingContext},r.getPriorityOfFinishBreak=function(){return 10},o}(),pd=function(o){function r(e,t){var n;return(n=o.call(this)||this).formattingContext=void 0,n.processor=void 0,n.formattingContext=e,n.processor=t,n}return w(r,o),r.prototype.resolveLayoutMode=function(e){var t=this.formattingContext.getRepetitiveElements();return e.belongsTo(this.formattingContext)||t.doneInitialLayout?(e.belongsTo(this.formattingContext)||e.after||t&&t.preventSkippingHeader(),new fd(this.formattingContext,this.processor)):new dd(this.formattingContext,this.processor)},r}(_o),gd=function(o){function r(t,n){var i;return(i=o.call(this)||this).formattingContext=void 0,i.column=void 0,i.formattingContext=t,i.column=n,i}w(r,o);var e=r.prototype;return e.startNonInlineElementNode=function(t){var n=this.formattingContext,i=t.nodeContext,a=n.getRepetitiveElements();if(i.parent&&n.rootSourceNode===i.parent.sourceNode){switch(i.repeatOnBreak){case"header":if(!a.isHeaderRegistered())return a.setHeaderNodeContext(i),I(!0);i.repeatOnBreak="none";break;case"footer":if(!a.isFooterRegistered())return a.setFooterNodeContext(i),I(!0);i.repeatOnBreak="none"}a.firstContentSourceNode||(a.firstContentSourceNode=i.sourceNode)}return yi.prototype.startNonInlineElementNode.call(this,t)},e.afterNonInlineElementNode=function(t){var n=this.formattingContext,i=t.nodeContext;return i.sourceNode===n.rootSourceNode&&(n.getRepetitiveElements().lastContentSourceNode=t.lastAfterNodeContext&&t.lastAfterNodeContext.sourceNode,t.break=!0),i.repeatOnBreak==="header"||i.repeatOnBreak==="footer"?I(!0):yi.prototype.afterNonInlineElementNode.call(this,t)},r}(yi);function mu(o,r){o&&function(e,t){for(var n=e;n;n=n.parent){var i=n.formattingContext;i&&i instanceof $n&&!n.belongsTo(i)&&t(i,n)}}(o.after?o.parent:o,function(e,t){En.isInstanceOfTableFormattingContext(e)||r.fragmentLayoutConstraints.push(new Wo(t))})}var vd=new(function(o){function r(){return o.apply(this,arguments)||this}w(r,o);var e=r.prototype;return e.layout=function(t,n,i){if(n.isFloatNodeContext(t))return n.layoutFloatOrFootnote(t);var a=t.formattingContext;return a.getRootViewNode(t)?(i&&mu(t.parent,n),t.belongsTo(a)?Zn.prototype.layout.call(this,t,n,i):new pd(a,this).layout(t,n)):n.buildDeepElementView(t)},e.startNonInlineElementNode=function(t){var n=function(i){var a=i.formattingContext;return a&&a instanceof $n?a:null}(t).getRepetitiveElements();return!!n&&(n.allowInsertRepeatitiveElements||!n.isHeaderSourceNode(t.sourceNode)&&!n.isFooterSourceNode(t.sourceNode)||t.viewNode.parentNode.removeChild(t.viewNode),!1)},e.doInitialLayout=function(t,n){var i=L("BlockLayoutProcessor.doInitialLayout");return this.layoutEntireBlock(t,n).thenFinish(i),i.result()},e.layoutEntireBlock=function(t,n){var i=new gd(t.formattingContext,n);return new Mo(i,n.layoutContext).iterate(t)},e.doLayout=function(t,n){var i=t.formattingContext,a=L("doLayout");return pu(n.layoutContext.nextInTree(t,!1),n).then(function(s){var u=s;a.loopWithFrame(function(h){for(var c=function(){var f=!0;if(n.layoutNext(u,!1).then(function(v){u=v,n.pageFloatLayoutContext.isInvalidated()||n.pageBreakType||u&&n.stopByOverflow(u)||u&&u.after&&u.sourceNode==i.rootSourceNode?h.breakLoop():f?f=!1:h.continueLoop()}),f)return f=!1,{v:void 0}};u;){var d=c();if(typeof d=="object")return d.v}h.breakLoop()}).then(function(){a.finish(u)})}),a.result()},e.finishBreak=function(t,n,i,a){return Zn.prototype.finishBreak.call(this,t,n,i,a)},e.clearOverflownViewNodes=function(t,n,i,a){Zn.prototype.clearOverflownViewNodes(t,n,i,a)},r}(Zn));be(R.HOOKS.RESOLVE_LAYOUT_PROCESSOR,function(o){return o instanceof $n&&!En.isInstanceOfTableFormattingContext(o)?vd:null});var Eu=function(){function o(e,t){this.rowIndex=void 0,this.sourceNode=void 0,this.cells=[],this.rowIndex=e,this.sourceNode=t}var r=o.prototype;return r.addCell=function(e){this.cells.push(e)},r.getMinimumHeight=function(){return Math.min.apply(null,this.cells.map(function(e){return e.height}))},o}(),md=function(){function o(e,t,n){this.rowIndex=void 0,this.columnIndex=void 0,this.viewElement=void 0,this.colSpan=void 0,this.rowSpan=void 0,this.height=0,this.anchorSlot=null,this.rowIndex=e,this.columnIndex=t,this.viewElement=n,this.colSpan=n.colSpan||1,this.rowSpan=n.rowSpan||1}var r=o.prototype;return r.setHeight=function(e){this.height=e},r.setAnchorSlot=function(e){this.anchorSlot=e},o}(),Ed=function(o,r,e){this.rowIndex=void 0,this.columnIndex=void 0,this.cell=void 0,this.rowIndex=o,this.columnIndex=r,this.cell=e},Cd=function(){function o(r,e,t){this.column=void 0,this.cellNodeContext=void 0,this.pseudoColumn=void 0,this.empty=!1,this.column=r,this.cellNodeContext=t,this.pseudoColumn=new zo(r,e,t)}return o.prototype.findAcceptableBreakPosition=function(){var r=this.cellNodeContext.viewNode,e=this.cellNodeContext.verticalAlign;e!=="middle"&&e!=="bottom"||T(r,"vertical-align","top");var t=this.pseudoColumn.findAcceptableBreakPosition(!0);return T(r,"vertical-align",e),t},o}(),Dd=function(o,r){this.viewNode=void 0,this.side=void 0,this.viewNode=o,this.side=r},wd=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t,n,i,a)||this).formattingContext=void 0,s.acceptableCellBreakPositions=null,s.rowIndex=null,s.formattingContext=t.formattingContext,s}w(r,o);var e=r.prototype;return e.findAcceptableBreak=function(t,n){var i=o.prototype.findAcceptableBreak.call(this,t,n);return n<this.getMinBreakPenalty()?null:this.getAcceptableCellBreakPositions().every(function(a){return!!a.nodeContext})?i:null},e.getMinBreakPenalty=function(){var t=o.prototype.getMinBreakPenalty.call(this);return this.getAcceptableCellBreakPositions().forEach(function(n){t+=n.breakPosition.getMinBreakPenalty()}),t},e.getAcceptableCellBreakPositions=function(){if(!this.acceptableCellBreakPositions){var t=this.getCellFragments();this.acceptableCellBreakPositions=t.map(function(n){return n.findAcceptableBreakPosition()})}return this.acceptableCellBreakPositions},e.getRowIndex=function(){return this.rowIndex!=null?this.rowIndex:this.rowIndex=this.formattingContext.findRowIndexBySourceNode(this.position.sourceNode)},e.getCellFragments=function(){return this.formattingContext.getRowSpanningCellsOverflowingTheRow(this.getRowIndex()).map(this.formattingContext.getCellFragmentOfCell,this.formattingContext)},r}(hr),yd=function(o){function r(t,n,i){var a;return(a=o.call(this)||this).rowIndex=void 0,a.beforeNodeContext=void 0,a.formattingContext=void 0,a.acceptableCellBreakPositions=null,a.rowIndex=t,a.beforeNodeContext=n,a.formattingContext=i,a}w(r,o);var e=r.prototype;return e.findAcceptableBreak=function(t,n){if(n<this.getMinBreakPenalty())return null;var i=this.getCellFragments(),a=this.getAcceptableCellBreakPositions(),s=a.every(function(u){return!!u.nodeContext})&&a.some(function(u,h){var c=i[h].pseudoColumn,d=u.nodeContext;return!c.isStartNodeContext(d)&&!c.isLastAfterNodeContext(d)});return this.beforeNodeContext.overflow=a.some(function(u){return u.nodeContext&&u.nodeContext.overflow}),s?this.beforeNodeContext:null},e.getMinBreakPenalty=function(){var t=this.formattingContext,n=t.getRowByIndex(this.rowIndex),i=0;return t.isFreelyFragmentableRow(n)||(i+=10),this.getAcceptableCellBreakPositions().forEach(function(a){i+=a.breakPosition.getMinBreakPenalty()}),i},e.getAcceptableCellBreakPositions=function(){if(!this.acceptableCellBreakPositions){var t=this.getCellFragments();this.acceptableCellBreakPositions=t.map(function(n){return n.findAcceptableBreakPosition()})}return this.acceptableCellBreakPositions},e.getCellFragments=function(){return this.formattingContext.getCellsFallingOnRow(this.rowIndex).map(this.formattingContext.getCellFragmentOfCell,this.formattingContext)},r}(ko),bi=function(o){function r(t,n){var i;return(i=o.call(this,t,n)||this).tableSourceNode=void 0,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.tableSourceNode=n,i}w(r,o);var e=r.prototype;return e.getName=function(){return"Table formatting context (Table.TableFormattingContext)"},e.isFirstTime=function(t,n){if(!n)return n;switch(t.display){case"table-row":return this.cellBreakPositions.length===0;case"table-cell":return!this.cellBreakPositions.some(function(i){return i.cellNodePosition.steps[0].node===t.sourceNode});default:return n}},e.getParent=function(){return this.parent},e.finishFragment=function(){this.cellFragments=[]},e.addRow=function(t,n){this.rows[t]=n},e.getRowSlots=function(t){var n=this.slots[t];return n||(n=this.slots[t]=[]),n},e.addCell=function(t,n){var i=this.rows[t];i||(this.addRow(t,new Eu(t,null)),i=this.rows[t]),i.addCell(n);for(var a=t+n.rowSpan,s=this.getRowSlots(t),u=0;s[u];)u++;for(;t<a;t++){s=this.getRowSlots(t);for(var h=u;h<u+n.colSpan;h++){var c=s[h]=new Ed(t,h,n);n.anchorSlot||n.setAnchorSlot(c)}}},e.getRowByIndex=function(t){return this.rows[t]},e.findRowIndexBySourceNode=function(t){return this.rows.findIndex(function(n){return t===n.sourceNode})},e.addCellFragment=function(t,n,i){var a=this.cellFragments[t];a||(a=this.cellFragments[t]=[]),a[n]=i},e.getCellsFallingOnRow=function(t){return this.getRowSlots(t).reduce(function(n,i){return i.cell!==n[n.length-1]?n.concat(i.cell):n},[])},e.getRowSpanningCellsOverflowingTheRow=function(t){return this.getCellsFallingOnRow(t).filter(function(n){return n.rowIndex+n.rowSpan-1>t})},e.getCellFragmentOfCell=function(t){return this.cellFragments[t.rowIndex]&&this.cellFragments[t.rowIndex][t.columnIndex]},e.isFreelyFragmentableRow=function(t){return t.getMinimumHeight()>this.tableWidth/2},e.getColumnCount=function(){return this.columnCount<0&&(this.columnCount=Math.max.apply(null,this.rows.map(function(t){return t.cells.reduce(function(n,i){return n+i.colSpan},0)}))),this.columnCount},e.updateCellSizes=function(t){var n=this;this.rows.forEach(function(i){i.cells.forEach(function(a){var s=t.getElementClientRect(a.viewElement);a.viewElement=null,a.setHeight(n.vertical?s.width:s.height)})})},e.findCellFromColumn=function(t){if(!t)return null;var n=null,i=0,a=0;t:for(i=0;i<this.cellFragments.length;i++)if(this.cellFragments[i]){for(a=0;a<this.cellFragments[i].length;a++)if(this.cellFragments[i][a]&&t===this.cellFragments[i][a].pseudoColumn.getColumn()){n=this.rows[i].cells[a];break t}}if(!n)return null;for(;i<this.slots.length;i++)for(;a<this.slots[i].length;a++){var s=this.slots[i][a];if(s.cell===n)return{rowIndex:s.rowIndex,columnIndex:s.columnIndex}}return null},e.collectElementsOffsetOfUpperCells=function(t){var n=this,i=[];return this.slots.reduce(function(a,s,u){if(u>=t.rowIndex)return a;var h=s[t.columnIndex]&&n.getCellFragmentOfCell(s[t.columnIndex].cell);return!h||i.includes(h)||(n.collectElementsOffsetFromColumn(h.pseudoColumn.getColumn(),a),i.push(h)),a},[])},e.collectElementsOffsetOfHighestColumn=function(){var t=this,n=[];return this.rows.forEach(function(i){i.cells.forEach(function(a,s){n[s]||(n[s]={collected:[],elements:[]});var u=n[s],h=t.getCellFragmentOfCell(a);h&&!u.collected.includes(h)&&(t.collectElementsOffsetFromColumn(h.pseudoColumn.getColumn(),u.elements),u.collected.push(h))})}),[new Nd(n.map(function(i){return i.elements}))]},e.collectElementsOffsetFromColumn=function(t,n){t.fragmentLayoutConstraints.forEach(function(i){if(Pn.isInstanceOfRepetitiveElementsOwnerLayoutConstraint(i)){var a=i.getRepetitiveElements();n.push(a)}En.isInstanceOfTableRowLayoutConstraint(i)&&i.getElementsOffsetsForTableCell(null).forEach(function(s){n.push(s)})})},e.saveState=function(){return[].concat(this.cellBreakPositions)},e.restoreState=function(t){this.cellBreakPositions=t},r}($n),Nd=function(){function o(e){this.repeatitiveElementsInColumns=void 0,this.repeatitiveElementsInColumns=e}var r=o.prototype;return r.calculateOffset=function(e){return this.calculateMaxOffsetOfColumn(e,function(t){return t.current})},r.calculateMinimumOffset=function(e){return this.calculateMaxOffsetOfColumn(e,function(t){return t.minimum})},r.calculateMaxOffsetOfColumn=function(e,t){var n=0;return this.repeatitiveElementsInColumns.forEach(function(i){var a=Qn(e,i);n=Math.max(n,t(a))}),n},o}();function Cu(o){return function(r){return r==="table-row-group"||r==="table-header-group"||r==="table-footer-group"}(o)||function(r){return r==="table"||r==="inline-table"}(o)}function Du(o,r,e){var t=o.nodeContext,n=t.display,i=t.parent?t.parent.display:null,a=!1;if(i==="inline-table"&&!(t.formattingContext instanceof bi)){for(var s=t.parent;s;s=s.parent)if(s.formattingContext instanceof bi){a=s.formattingContext===r;break}}return a||n==="table-row"&&!Cu(i)||n==="table-cell"&&i!=="table-row"&&!Cu(i)||t.formattingContext instanceof bi&&t.formattingContext!==r?e.buildDeepElementView(t).thenAsync(function(u){return o.nodeContext=u,I(!0)}):null}var bd=function(o){function r(t,n){var i;return(i=o.call(this)||this).formattingContext=void 0,i.column=void 0,i.rowIndex=-1,i.columnIndex=0,i.inRow=!1,i.checkPoints=[],i.inHeaderOrFooter=!1,i.formattingContext=t,i.column=n,i}w(r,o);var e=r.prototype;return e.startNonInlineElementNode=function(t){var n=this.formattingContext,i=Du(t,n,this.column);if(i)return i;this.postLayoutBlockContents(t);var a=t.nodeContext,s=a.display,u=n.getRepetitiveElements();switch(s){case"table":n.inlineBorderSpacing=a.inlineBorderSpacing;break;case"table-caption":var h=new Dd(a.viewNode,a.captionSide);n.captions.push(h);break;case"table-header-group":return u.isHeaderRegistered()||(this.inHeaderOrFooter=!0,u.setHeaderNodeContext(a)),I(!0);case"table-footer-group":return u.isFooterRegistered()||(this.inHeaderOrFooter=!0,u.setFooterNodeContext(a)),I(!0);case"table-row":this.inHeaderOrFooter||(this.inRow=!0,this.rowIndex++,this.columnIndex=0,n.addRow(this.rowIndex,new Eu(this.rowIndex,a.sourceNode)),u.firstContentSourceNode||(u.firstContentSourceNode=a.sourceNode))}return o.prototype.startNonInlineElementNode.call(this,t)},e.afterNonInlineElementNode=function(t){var n=this.formattingContext,i=t.nodeContext,a=i.display,s=this.column.clientLayout;if(this.postLayoutBlockContents(t),i.sourceNode===n.tableSourceNode){var u=s.getElementComputedStyle(n.getRootViewNode(i));n.tableWidth=parseFloat(u[n.vertical?"height":"width"]),n.getRepetitiveElements().lastContentSourceNode=t.lastAfterNodeContext&&t.lastAfterNodeContext.sourceNode,t.break=!0}else switch(a){case"table-header-group":case"table-footer-group":if(this.inHeaderOrFooter)return this.inHeaderOrFooter=!1,I(!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 md(this.rowIndex,this.columnIndex,i.viewNode)),this.columnIndex++)}return o.prototype.afterNonInlineElementNode.call(this,t)},e.startNonElementNode=function(t){this.registerCheckPoint(t)},e.afterNonElementNode=function(t){this.registerCheckPoint(t)},e.startInlineElementNode=function(t){this.registerCheckPoint(t)},e.afterInlineElementNode=function(t){this.registerCheckPoint(t)},e.registerCheckPoint=function(t){var n=t.nodeContext;n&&n.viewNode&&!qn(n)&&this.checkPoints.push(n.clone())},e.postLayoutBlockContents=function(t){this.checkPoints.length>0&&this.column.postLayoutBlock(t.nodeContext,this.checkPoints),this.checkPoints=[]},r}(yi),wu=function(o){function r(t,n){var i;return(i=o.call(this,!0)||this).formattingContext=void 0,i.column=void 0,i.inRow=!1,i.currentRowIndex=-1,i.currentColumnIndex=0,i.originalStopAtOverflow=void 0,i.inHeader=void 0,i.inFooter=void 0,i.formattingContext=t,i.column=n,i.originalStopAtOverflow=n.stopAtOverflow,n.stopAtOverflow=!1,i}w(r,o);var e=r.prototype;return e.resetColumn=function(){this.column.stopAtOverflow=this.originalStopAtOverflow},e.getColSpanningCellWidth=function(t){for(var n=this.formattingContext.colWidths,i=0,a=0;a<t.colSpan;a++)i+=n[t.anchorSlot.columnIndex+a];return i+this.formattingContext.inlineBorderSpacing*(t.colSpan-1)},e.layoutCell=function(t,n,i){var a=t.rowIndex,s=t.columnIndex,u=n.viewNode;t.colSpan>1&&(T(u,"box-sizing","border-box"),T(u,this.formattingContext.vertical?"height":"width",this.getColSpanningCellWidth(t)+"px"));var h=u.ownerDocument.createElement("div");u.appendChild(h);var c=new Cd(this.column,h,n);return this.formattingContext.addCellFragment(a,s,c),i.primary.steps.length===1&&i.primary.after&&(c.empty=!0),c.pseudoColumn.layout(i,!0).thenReturn(!0)},e.hasBrokenCellAtSlot=function(t){var n=this.formattingContext.cellBreakPositions[0];return!!n&&n.cell.anchorSlot.columnIndex===t},e.extractRowSpanningCellBreakPositions=function(){var t=this.formattingContext.cellBreakPositions;if(t.length===0)return[];var n=[],i=0;do{var a=t[i],s=a.cell.rowIndex;if(s<this.currentRowIndex){var u=n[s];u||(u=n[s]=[]),u.push(a),t.splice(i,1)}else i++}while(i<t.length);return n},e.layoutRowSpanningCellsFromPreviousFragment=function(t){var n=this,i=this.formattingContext,a=this.extractRowSpanningCellBreakPositions(),s=a.reduce(function(g){return g+1},0);if(s===0)return I(!0);var u=this.column.layoutContext,h=t.nodeContext;h.viewNode.parentNode.removeChild(h.viewNode);var c=L("layoutRowSpanningCellsFromPreviousFragment"),d=I(!0),f=0,v=[];return a.forEach(function(g){d=d.thenAsync(function(){var p=tr(g[0].cellNodePosition.steps[1],h.parent);return u.setCurrent(p,!1).thenAsync(function(){var E=I(!0),C=0;function D(y){for(;C<y;){if(!v.includes(C)){var N=p.viewNode.ownerDocument.createElement("td");T(N,"padding","0"),p.viewNode.appendChild(N)}C++}}return g.forEach(function(y){E=E.thenAsync(function(){var N=y.cell;D(N.anchorSlot.columnIndex);var x=y.cellNodePosition,F=tr(x.steps[0],p);return F.offsetInNode=x.offsetInNode,F.after=x.after,F.fragmentIndex=x.steps[0].fragmentIndex+1,u.setCurrent(F,!1).thenAsync(function(){for(var k=y.breakChunkPosition,H=0;H<N.colSpan;H++)v.push(C+H);return C+=N.colSpan,n.layoutCell(N,F,k).thenAsync(function(){return F.viewNode.rowSpan=N.rowIndex+N.rowSpan-n.currentRowIndex+s-f,I(!0)})})})}),E.thenAsync(function(){return D(i.getColumnCount()),f++,I(!0)})})})}),d.then(function(){u.setCurrent(h,!0,t.atUnforcedBreak).then(function(){c.finish(!0)})}),c.result()},e.startTableRow=function(t){var n=this;if(this.inHeader||this.inFooter)return I(!0);var i=t.nodeContext,a=this.formattingContext;return this.currentRowIndex<0?this.currentRowIndex=a.findRowIndexBySourceNode(i.sourceNode):this.currentRowIndex++,this.currentColumnIndex=0,this.inRow=!0,this.layoutRowSpanningCellsFromPreviousFragment(t).thenAsync(function(){return n.registerCellFragmentIndex(),n.column.checkOverflowAndSaveEdgeAndBreakPosition(t.lastAfterNodeContext,null,!0,t.breakAtTheEdge)&&a.getRowSpanningCellsOverflowingTheRow(n.currentRowIndex-1).length===0&&(n.resetColumn(),i.overflow=!0,t.break=!0),I(!0)})},e.registerCellFragmentIndex=function(){var t=this;this.formattingContext.getRowByIndex(this.currentRowIndex).cells.forEach(function(n){var i=t.formattingContext.cellBreakPositions[n.columnIndex];if(i&&i.cell.anchorSlot.columnIndex==n.anchorSlot.columnIndex){var a=i.cellNodePosition.steps[0],s=t.column.layoutContext.xmldoc.getElementOffset(a.node);ed(s,a.fragmentIndex+1,1)}})},e.startTableCell=function(t){var n=this;if(this.inHeader||this.inFooter)return I(!0);var i=t.nodeContext;this.inRow||(this.currentRowIndex<0?this.currentRowIndex=0:this.currentRowIndex++,this.currentColumnIndex=0,this.inRow=!0);var a=this.formattingContext.getRowByIndex(this.currentRowIndex).cells[this.currentColumnIndex];if(!a)return t.break=!0,I(!0);var s=i.copy().modify();s.after=!0,t.nodeContext=s;var u,h=L("startTableCell");if(this.hasBrokenCellAtSlot(a.anchorSlot.columnIndex)){var c=this.formattingContext.cellBreakPositions.shift();i.fragmentIndex=c.cellNodePosition.steps[0].fragmentIndex+1,u=I(c.breakChunkPosition)}else u=this.column.nextInTree(i,t.atUnforcedBreak).thenAsync(function(d){d.viewNode&&i.viewNode.removeChild(d.viewNode);var f=Ji(d,0);return I(new wn(f))});return u.then(function(d){n.layoutCell(a,i,d).then(function(){n.afterNonInlineElementNode(t),n.currentColumnIndex++,h.finish(!0)})}),h.result()},e.startNonInlineBox=function(t){var n=Du(t,this.formattingContext,this.column);if(n)return n;var i=t.nodeContext,a=this.formattingContext.getRepetitiveElements(),s=i.display;return s==="table-header-group"&&a&&a.isHeaderSourceNode(i.sourceNode)?(this.inHeader=!0,I(!0)):s==="table-footer-group"&&a&&a.isFooterSourceNode(i.sourceNode)?(this.inFooter=!0,I(!0)):s==="table-row"?this.startTableRow(t):s==="table-cell"?this.startTableCell(t):I(!0)},e.endNonInlineBox=function(t){var n=t.nodeContext;if(n.display==="table-row"&&(this.inRow=!1,!this.inHeader&&!this.inFooter)){var i=n.copy().modify();i.after=!1;var a=new yd(this.currentRowIndex,i,this.formattingContext);this.column.breakPositions.push(a)}return I(!0)},e.afterNonInlineElementNode=function(t){var n=t.nodeContext,i=this.formattingContext.getRepetitiveElements(),a=n.display;if(a==="table-header-group"?i&&!i.allowInsertRepeatitiveElements&&i.isHeaderSourceNode(n.sourceNode)?(this.inHeader=!1,n.viewNode.parentNode.removeChild(n.viewNode)):T(n.viewNode,"display","table-row-group"):a==="table-footer-group"&&(i&&!i.allowInsertRepeatitiveElements&&i.isFooterSourceNode(n.sourceNode)?(this.inFooter=!1,n.viewNode.parentNode.removeChild(n.viewNode)):T(n.viewNode,"display","table-row-group")),a&&r.ignoreList[a])n.viewNode.parentNode.removeChild(n.viewNode);else{if(n.sourceNode!==this.formattingContext.tableSourceNode)return o.prototype.afterNonInlineElementNode.call(this,t);n.overflow=this.column.checkOverflowAndSaveEdge(n,null),this.resetColumn(),t.break=!0}return I(!0)},r}(yi);wu.ignoreList={"table-caption":!0,"table-column-group":!0,"table-column":!0};var Si=[],yu=function(){function o(){}var r=o.prototype;return r.layoutEntireTable=function(e,t){var n=new bd(e.formattingContext,t);return new Mo(n,t.layoutContext).iterate(e)},r.getColumnWidths=function(e,t,n,i){for(var a=e.ownerDocument,s=a.createElement("tr"),u=[],h=0;h<t;h++){var c=a.createElement("td");s.appendChild(c),u.push(c)}e.parentNode.insertBefore(s,e.nextSibling);var d=u.map(function(f){var v=i.getElementClientRect(f);return n?v.height:v.width});return e.parentNode.removeChild(s),d},r.getColGroupElements=function(e){for(var t=[],n=e.firstElementChild;n;)n.localName==="colgroup"&&t.push(n),n=n.nextElementSibling;return t},r.normalizeAndGetColElements=function(e){var t=[];return e.forEach(function(n){var i=n.span;n.removeAttribute("span");for(var a=n.firstElementChild;a;){if(a.localName==="col"){var s=a.span;for(a.removeAttribute("span"),i-=s;s-- >1;){var u=a.cloneNode(!0);n.insertBefore(u,a),t.push(u)}t.push(a)}a=a.nextElementSibling}for(;i-- >0;)a=n.ownerDocument.createElement("col"),n.appendChild(a),t.push(a)}),t},r.addMissingColElements=function(e,t,n,i){if(e.length<n){var a=i.ownerDocument.createElement("colgroup");t.push(a);for(var s=e.length;s<n;s++){var u=i.ownerDocument.createElement("col");a.appendChild(u),e.push(u)}}},r.normalizeColGroups=function(e,t,n){var i=e.vertical,a=e.lastRowViewNode;if(a){e.lastRowViewNode=null;var s=a.ownerDocument.createDocumentFragment(),u=e.getColumnCount();if(u>0){var h=e.colWidths=this.getColumnWidths(a,u,i,n.clientLayout),c=this.getColGroupElements(t),d=this.normalizeAndGetColElements(c);this.addMissingColElements(d,c,u,t),d.forEach(function(f,v){T(f,i?"height":"width",h[v]+"px")}),c.forEach(function(f){s.appendChild(f.cloneNode(!0))}),e.colGroups=s}else e.colGroups=s}},r.doInitialLayout=function(e,t){var n=this,i=e.formattingContext;i.vertical=e.vertical,i.initializeRepetitiveElements(e.vertical);var a,s,u,h=(a=e.sourceNode,s=Si.findIndex(function(f){return f.root===a}),(u=Si[s])?u.tableLayoutOption:null);(function(f){var v=Si.findIndex(function(g){return g.root===f});v>=0&&Si.splice(v,1)})(e.sourceNode);var c=L("TableLayoutProcessor.doInitialLayout"),d=e.copy();return this.layoutEntireTable(e,t).then(function(f){var v=f.viewNode,g=t.clientLayout.getElementClientRect(v),p=t.vertical?g.left:g.bottom;if(p+=(t.vertical?-1:1)*Qn(e,t.collectElementsOffset()).current,!(t.isOverflown(p)||h&&h.calculateBreakPositionsInside))return t.breakPositions.push(new Td(d)),void c.finish(f);n.normalizeColGroups(i,v,t),i.updateCellSizes(t.clientLayout),c.finish(null)}),c.result()},r.addCaptions=function(e,t,n){var i=e.captions;i.forEach(function(a,s){a&&(t.insertBefore(a.viewNode,n),a.side==="top"&&(i[s]=null))})},r.addColGroups=function(e,t,n){e.colGroups&&this.getColGroupElements(t).length===0&&t.insertBefore(e.colGroups.cloneNode(!0),n)},r.removeColGroups=function(e,t){if(e.colGroups&&t){var n=this.getColGroupElements(t);n&&n.forEach(function(i){t.removeChild(i)})}},r.doLayout=function(e,t){var n=e.formattingContext,i=n.getRootViewNode(e),a=i.firstChild;this.addCaptions(n,i,a),this.addColGroups(n,i,a);var s=new wu(n,t),u=new Mo(s,t.layoutContext),h=L("TableFormattingContext.doLayout");return u.iterate(e).thenFinish(h),h.result()},r.layout=function(e,t,n){var i=e.formattingContext;return i.getRootViewNode(e)?(n&&mu(e.parent,t),new Sd(i,this).layout(e,t)):t.buildDeepElementView(e)},r.createEdgeBreakPosition=function(e,t,n,i){return new wd(e,t,n,i)},r.startNonInlineElementNode=function(e){return!1},r.afterNonInlineElementNode=function(e,t){return!1},r.finishBreak=function(e,t,n,i){var a=t.formattingContext;if(t.display==="table-row"){var s,u=a.findRowIndexBySourceNode(t.sourceNode);if(a.cellBreakPositions=[],(s=t.after?a.getRowSpanningCellsOverflowingTheRow(u):a.getCellsFallingOnRow(u)).length){var h=L("TableLayoutProcessor.finishBreak"),c=0;return h.loopWithFrame(function(d){if(c!==s.length){var f=s[c++],v=a.getCellFragmentOfCell(f),g=v.findAcceptableBreakPosition().nodeContext,p=v.cellNodeContext,E=p.toNodePosition(),C=new wn(g.toNodePosition());a.cellBreakPositions.push({cellNodePosition:E,breakChunkPosition:C,cell:f});var D=p.viewNode;v.column.layoutContext.processFragmentedBlockEdge(v.cellNodeContext),u<f.rowIndex+f.rowSpan-1&&(D.rowSpan=u-f.rowIndex+1),v.empty?d.continueLoop():v.pseudoColumn.finishBreak(g,!1,!0).then(function(){(function(y,N,x){var F=N.getRepetitiveElements();if(F){var k=N.vertical,H=y.column,K=y.pseudoColumn.getColumnElement(),q=y.cellNodeContext.viewNode,W=H.clientLayout.getElementClientRect(q),G=H.getComputedPaddingBorder(q);k?T(K,"max-width",W.right-H.footnoteEdge-F.calculateOffset(x)-G.right+"px"):T(K,"max-height",H.footnoteEdge-F.calculateOffset(x)-W.top-G.top+"px"),T(K,"overflow","hidden")}})(v,a,g),d.continueLoop()})}else d.breakLoop()}).then(function(){e.clearOverflownViewNodes(t,!1),e.layoutContext.processFragmentedBlockEdge(t),a.finishFragment(),h.finish(!0)}),h.result()}}return a.finishFragment(),Bo.finishBreak(e,t,n,i)},r.clearOverflownViewNodes=function(e,t,n,i){Zn.prototype.clearOverflownViewNodes(e,t,n,i)},o}(),Sd=function(o){function r(t,n){var i;return(i=o.call(this)||this).tableFormattingContext=void 0,i.processor=void 0,i.tableFormattingContext=t,i.processor=n,i}w(r,o);var e=r.prototype;return e.resolveLayoutMode=function(t){var n=this.tableFormattingContext.getRepetitiveElements();return n&&n.doneInitialLayout?(t.sourceNode!==this.tableFormattingContext.tableSourceNode||t.after||n&&n.preventSkippingHeader(),new Id(this.tableFormattingContext,this.processor)):new Ad(this.tableFormattingContext,this.processor)},e.clearNodes=function(t){o.prototype.clearNodes.call(this,t);var n=this.tableFormattingContext.getRootViewNode(t);this.processor.removeColGroups(this.tableFormattingContext,n)},e.restoreState=function(t,n){o.prototype.restoreState.call(this,t,n),this.tableFormattingContext.finishFragment()},r}(_o),Ad=function(o){function r(e,t){var n;return(n=o.call(this,e)||this).processor=void 0,n.processor=t,n}return w(r,o),r.prototype.doLayout=function(e,t){return this.processor.doInitialLayout(e,t)},r}(gu),Td=function(o){function r(t){return o.call(this,t,null,t.overflow,0)||this}w(r,o);var e=r.prototype;return e.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)},e.breakPositionChosen=function(t){t.fragmentLayoutConstraints.push(new xd(this.position.sourceNode))},r}(hr),xd=function(){function o(e){this.tableRootNode=void 0,this.flagmentLayoutConstraintType="EntireTable",this.tableRootNode=e}var r=o.prototype;return r.allowLayout=function(e,t,n){return!1},r.nextCandidate=function(e){return!0},r.postLayout=function(e,t,n,i){Si.push({root:t.sourceNode,tableLayoutOption:{calculateBreakPositionsInside:!0}})},r.finishBreak=function(e,t){return I(!0)},r.equalsTo=function(e){return e instanceof o&&e.tableRootNode===this.tableRootNode},r.getPriorityOfFinishBreak=function(){return 0},o}(),Id=function(o){function r(e,t){var n;return(n=o.call(this,e)||this).processor=void 0,n.processor=t,n}return w(r,o),r.prototype.doLayout=function(e,t){var n=this.formattingContext.getRepetitiveElements();if(n&&!n.isAfterLastContent(e)){var i=new Fd(e);t.fragmentLayoutConstraints.some(function(a){return i.equalsTo(a)})||t.fragmentLayoutConstraints.unshift(i)}return this.processor.doLayout(e,t)},r}(vu),Fd=function(o){function r(t){var n;return(n=o.call(this,t)||this).flagmentLayoutConstraintType="TableRow",n.cellFragmentLayoutConstraints=[],n}w(r,o);var e=r.prototype;return e.allowLayout=function(t,n,i){var a=this.getRepetitiveElements();return!(a&&!i.pseudoParent&&!Kn(this.nodeContext.viewNode)&&a.isEnableToUpdateState()&&(n&&!t||t&&t.overflow))},e.nextCandidate=function(t){return!!this.collectCellFragmentLayoutConstraints(t,this.nodeContext.formattingContext).some(function(n){return n.constraints.some(function(i){return i.nextCandidate(t)})})||o.prototype.nextCandidate.call(this,t)},e.postLayout=function(t,n,i,a){var s=this.nodeContext.formattingContext;if(this.cellFragmentLayoutConstraints=this.collectCellFragmentLayoutConstraints(n,s),this.cellFragmentLayoutConstraints.forEach(function(h){h.constraints.forEach(function(c){c.postLayout(t,h.breakPosition,i,a)})}),!t){var u=s.getRootViewNode(this.nodeContext);new yu().removeColGroups(s,u),this.removeDummyRowNodes(i)}o.prototype.postLayout.call(this,t,n,i,a)},e.finishBreak=function(t,n){var i=this,a=L("finishBreak"),s=this.cellFragmentLayoutConstraints.reduce(function(h,c){return h.concat(c.constraints.map(function(d){return{constraint:d,breakPosition:c.breakPosition}}))},[]),u=0;return a.loop(function(){if(u<s.length){var h=s[u++];return h.constraint.finishBreak(h.breakPosition,n).thenReturn(!0)}return I(!1)}).then(function(){a.finish(!0)}),a.result().thenAsync(function(){return o.prototype.finishBreak.call(i,t,n)})},e.removeDummyRowNodes=function(t){if(t&&t.display==="table-row"&&t.viewNode)for(;t.viewNode.previousElementSibling;){var n=t.viewNode.previousElementSibling;n.parentNode&&n.parentNode.removeChild(n)}},e.collectCellFragmentLayoutConstraints=function(t,n){return this.getCellFragemnts(t,n).map(function(i){return{constraints:i.fragment.pseudoColumn.getColumn().fragmentLayoutConstraints,breakPosition:i.breakPosition}})},e.getCellFragemnts=function(t,n){var i=Number.MAX_VALUE;t&&t.display==="table-row"&&(i=n.findRowIndexBySourceNode(t.sourceNode)+1),i=Math.min(n.cellFragments.length,i);for(var a=[],s=0;s<i;s++)n.cellFragments[s]&&n.cellFragments[s].forEach(function(u){u&&a.push({fragment:u,breakPosition:u.findAcceptableBreakPosition().nodeContext})});return a},e.getElementsOffsetsForTableCell=function(t){var n=this.nodeContext.formattingContext,i=n.findCellFromColumn(t);return i?n.collectElementsOffsetOfUpperCells(i):n.collectElementsOffsetOfHighestColumn()},e.equalsTo=function(t){return t instanceof r&&this.nodeContext.formattingContext===t.nodeContext.formattingContext},r}(Wo),Pd=new yu;function Nu(o){return o.reduce(function(r,e){return r+e},0)/o.length}be(R.HOOKS.RESOLVE_FORMATTING_CONTEXT,function(o,r,e,t,n,i){if(!r)return null;if(e===b.table){var a=o.parent;return new bi(a?a.formattingContext:null,o.sourceNode)}return null}),be(R.HOOKS.RESOLVE_LAYOUT_PROCESSOR,function(o){return o instanceof bi?Pd:null});var Rd=function(o,r){this.layoutResult=void 0,this.penalty=void 0,this.layoutResult=o,this.penalty=r};function Ai(o){return o.vertical?o.width:o.height}function Ti(o,r){o.vertical?o.width=r:o.height=r}var bu=function(){function o(e,t,n){this.layoutContainer=void 0,this.columnGenerator=void 0,this.regionPageFloatLayoutContext=void 0,this.originalContainerBlockSize=void 0,this.layoutContainer=e,this.columnGenerator=t,this.regionPageFloatLayoutContext=n,this.originalContainerBlockSize=Ai(e)}var r=o.prototype;return r.balanceColumns=function(e){var t=this,n=L("ColumnBalancer#balanceColumns");this.preBalance(e),this.savePageFloatLayoutContexts(e),this.layoutContainer.clear();var i=[this.createTrialResult(e)];return n.loopWithFrame(function(a){t.hasNextCandidate(i)?(t.updateCondition(i),t.columnGenerator().then(function(s){t.savePageFloatLayoutContexts(s),t.layoutContainer.clear(),s?(i.push(t.createTrialResult(s)),a.continueLoop()):a.breakLoop()})):a.breakLoop()}).then(function(){var a=i.reduce(function(s,u){return u.penalty<s.penalty?u:s},i[0]);t.restoreContents(a.layoutResult),t.postBalance(),n.finish(a.layoutResult)}),n.result()},r.createTrialResult=function(e){var t=this.calculatePenalty(e);return new Rd(e,t)},r.preBalance=function(e){},r.postBalance=function(){Ti(this.layoutContainer,this.originalContainerBlockSize)},r.savePageFloatLayoutContexts=function(e){var t=this.regionPageFloatLayoutContext.detachChildren();e&&(e.columnPageFloatLayoutContexts=t)},r.restoreContents=function(e){var t=this.layoutContainer.element;e.columns.forEach(function(n){t.appendChild(n.element)}),this.regionPageFloatLayoutContext.attachChildren(e.columnPageFloatLayoutContexts)},o}();function Su(o){var r=o[o.length-1];if(r.penalty===0)return!1;var e=o[o.length-2];if(e&&r.penalty>=e.penalty)return!1;var t=r.layoutResult.columns;return Math.max.apply(null,t.map(function(n){return n.computedBlockSize}))>Math.max.apply(null,t.map(function(n){return n.getMaxBlockSizeOfPageFloats()}))+1}function Au(o,r){var e=Math.max.apply(null,o[o.length-1].layoutResult.columns.map(function(t){return isNaN(t.blockDistanceToBlockEndFloats)?t.computedBlockSize:t.computedBlockSize-t.blockDistanceToBlockEndFloats+1}))-1;e<Ai(r)?Ti(r,e):Ti(r,Ai(r)-1)}var Od=function(o){function r(t,n,i,a){var s;return(s=o.call(this,i,t,n)||this).columnCount=void 0,s.originalPosition=null,s.foundUpperBound=!1,s.columnCount=a,s}w(r,o);var e=r.prototype;return e.preBalance=function(t){var n=t.columns.reduce(function(i,a){return i+a.computedBlockSize},0);Ti(this.layoutContainer,n/this.columnCount),this.originalPosition=t.position},e.checkPosition=function(t){return this.originalPosition?this.originalPosition.isSamePosition(t):t===null},e.calculatePenalty=function(t){if(!this.checkPosition(t.position))return 1/0;var n=t.columns;return Tu(n)?1/0:Math.max.apply(null,n.map(function(i){return i.computedBlockSize}))},e.hasNextCandidate=function(t){if(t.length===1)return!0;if(this.foundUpperBound)return Su(t);var n=t[t.length-1];return this.checkPosition(n.layoutResult.position)&&!Tu(n.layoutResult.columns)?(this.foundUpperBound=!0,!0):Ai(this.layoutContainer)<this.originalContainerBlockSize},e.updateCondition=function(t){if(this.foundUpperBound)Au(t,this.layoutContainer);else{var n=Math.min(this.originalContainerBlockSize,Ai(this.layoutContainer)+.1*this.originalContainerBlockSize);Ti(this.layoutContainer,n)}},r}(bu);function Tu(o){if(o.length<=1)return!1;var r=o[o.length-1].computedBlockSize;return o.slice(0,o.length-1).every(function(e){return r>e.computedBlockSize})}var ve,kd=function(o){function r(t,n,i){return o.call(this,i,t,n)||this}w(r,o);var e=r.prototype;return e.calculatePenalty=function(t){if(t.columns.every(function(s){return s.computedBlockSize===0}))return 1/0;var n,i,a=t.columns.filter(function(s){return!s.pageBreakType}).map(function(s){return s.computedBlockSize});return i=Nu(n=a),Nu(n.map(function(s){var u=s-i;return u*u}))},e.hasNextCandidate=function(t){return Su(t)},e.updateCondition=function(t){Au(t,this.layoutContainer)},r}(bu),Xo=function(o,r,e){this.endStuckFixed=void 0,this.endFixed=void 0,this.endSlipped=void 0,this.endStuckFixed=o,this.endFixed=r,this.endSlipped=e},Ld=function(){function o(){this.map=[]}var r=o.prototype;return r.getMaxFixed=function(){return this.map.length==0?0:this.map[this.map.length-1].endFixed},r.getMaxSlipped=function(){return this.map.length==0?0:this.map[this.map.length-1].endSlipped},r.addStuckRange=function(e){if(this.map.length==0)this.map.push(new Xo(e,e,e));else{var t=this.map[this.map.length-1],n=t.endSlipped+e-t.endFixed;t.endFixed==t.endStuckFixed?(t.endFixed=e,t.endStuckFixed=e,t.endSlipped=n):this.map.push(new Xo(e,e,n))}},r.addSlippedRange=function(e){this.map.length==0?this.map.push(new Xo(e,0,0)):this.map[this.map.length-1].endFixed=e},r.slippedByFixed=function(e){var t=this,n=cn(this.map.length,function(a){return e<=t.map[a].endFixed}),i=this.map[n];return i.endSlipped-Math.max(0,i.endStuckFixed-e)},r.fixedBySlipped=function(e){var t=this,n=cn(this.map.length,function(a){return e<=t.map[a].endSlipped}),i=this.map[n];return i.endStuckFixed-(i.endSlipped-e)},o}(),Bd=function(){function o(e,t,n,i,a,s,u,h){if(this.context=void 0,this.style=void 0,this.offset=void 0,this.isRoot=void 0,this.flowChunk=void 0,this.atBlockStart=void 0,this.atFlowStart=void 0,this.isParentBoxDisplayed=void 0,this.flowName=void 0,this.isBlockValue=null,this.hasBoxValue=null,this.styleValues={},this.beforeBox=null,this.afterBox=null,this.breakBefore=null,this.context=e,this.style=t,this.offset=n,this.isRoot=i,this.flowChunk=a,this.atBlockStart=s,this.atFlowStart=u,this.isParentBoxDisplayed=h,this.flowName=a.flowName,this.hasBox()){var c=t._pseudos;if(c&&c.before){var d=new o(e,c.before,n,!1,a,this.isBlock(),u,!0);Wn(d.styleValue("content"))&&(this.beforeBox=d,this.breakBefore=d.breakBefore)}}this.breakBefore=Ne(this.getBreakValue("before"),this.breakBefore),this.atFlowStart&&_e(this.breakBefore)&&(a.breakBefore=Ne(a.breakBefore,this.breakBefore))}var r=o.prototype;return r.buildAfterPseudoElementBox=function(e,t,n){if(this.hasBox()){var i=this.style._pseudos;if(i&&i.after){var a=new o(this.context,i.after,e,!1,this.flowChunk,t,n,!0);Wn(a.styleValue("content"))&&(this.afterBox=a)}}},r.styleValue=function(e,t){if(!(e in this.styleValues)){var n=this.style[e];this.styleValues[e]=n?n.evaluate(this.context,e):t||null}return this.styleValues[e]},r.displayValue=function(){return this.styleValue("display",b.inline)},r.isBlock=function(){if(this.isBlockValue===null){var e=this.displayValue(),t=this.styleValue("position"),n=this.styleValue("float");this.isBlockValue=hu(e,t,n,this.isRoot)}return this.isBlockValue},r.hasBox=function(){return this.hasBoxValue===null&&(this.hasBoxValue=this.isParentBoxDisplayed&&this.displayValue()!==b.none),this.hasBoxValue},r.getBreakValue=function(e){var t=null;if(this.isBlock()){var n=this.styleValue("break-"+e);n&&(t=n.toString())}return t},o}(),_d=function(){function o(e){this.context=void 0,this.stack=[],this.atBlockStart=!0,this.atFlowStart=!0,this.atStartStack=[],this.context=e}var r=o.prototype;return r.empty=function(){return this.stack.length===0},r.lastBox=function(){return this.stack[this.stack.length-1]},r.lastFlowName=function(){var e=this.lastBox();return e?e.flowChunk.flowName:null},r.isCurrentBoxDisplayed=function(){return this.stack.every(function(e){return e.displayValue()!==b.none})},r.push=function(e,t,n,i){var a=this.lastBox();i&&a&&i.flowName!==a.flowName&&this.atStartStack.push({atBlockStart:this.atBlockStart,atFlowStart:this.atFlowStart});var s=i||a.flowChunk,u=this.atFlowStart||!!i,h=this.isCurrentBoxDisplayed(),c=new Bd(this.context,e,t,n,s,u||this.atBlockStart,u,h);return this.stack.push(c),this.atBlockStart=c.hasBox()?!c.beforeBox&&c.isBlock():this.atBlockStart,this.atFlowStart=c.hasBox()?!c.beforeBox&&u:this.atFlowStart,c},r.encounteredTextNode=function(e){var t=this.lastBox();(this.atBlockStart||this.atFlowStart)&&t.hasBox()&&($i(e,bs(t.styleValue("white-space",b.normal).toString()))||(this.atBlockStart=!1,this.atFlowStart=!1))},r.pop=function(e){var t=this.stack.pop();if(t.buildAfterPseudoElementBox(e,this.atBlockStart,this.atFlowStart),this.atFlowStart&&t.afterBox){var n=t.afterBox.getBreakValue("before");t.flowChunk.breakBefore=Ne(t.flowChunk.breakBefore,n)}var i=this.lastBox();if(i)if(i.flowName===t.flowName)t.hasBox()&&(this.atBlockStart=this.atFlowStart=!1);else{var a=this.atStartStack.pop();this.atBlockStart=a.atBlockStart,this.atFlowStart=a.atFlowStart}return t},r.nearestBlockStartOffset=function(e){if(!e.atBlockStart)return e.offset;var t=this.stack.length-1,n=this.stack[t];for(n===e&&(t--,n=this.stack[t]);t>=0;){if(n.flowName!==e.flowName)return e.offset;if(!n.atBlockStart||n.isRoot)return n.offset;e=n,n=this.stack[--t]}throw new Error("No block start offset found!")},o}(),xu=function(){function o(e,t,n,i,a,s,u,h){this.xmldoc=void 0,this.scope=void 0,this.context=void 0,this.primaryFlows=void 0,this.validatorSet=void 0,this.counterListener=void 0,this.root=void 0,this.cascadeHolder=void 0,this.last=void 0,this.rootStyle={},this.styleMap={},this.flows={},this.flowChunks=[],this.flowListener=null,this.flowToReach=null,this.idToReach=null,this.cascade=void 0,this.offsetMap=void 0,this.primary=!0,this.primaryStack=[],this.rootBackgroundAssigned=!1,this.rootLayoutAssigned=!1,this.lastOffset=void 0,this.breakBeforeValues={},this.boxStack=void 0,this.bodyReached=!0,this.xmldoc=e,this.scope=n,this.context=i,this.primaryFlows=a,this.validatorSet=s,this.counterListener=u,this.root=e.root,this.cascadeHolder=t,this.last=this.root,this.cascade=t.createInstance(i,u,h,e.lang),this.offsetMap=new Ld;var c=e.getElementOffset(this.root);this.lastOffset=c,this.boxStack=new _d(i),this.offsetMap.addStuckRange(c);var d=this.getAttrStyle(this.root);switch(this.cascade.pushElement(this.root,d,c),this.postprocessTopStyle(d,!1),this.root.namespaceURI){case U.XHTML:this.bodyReached=!1}this.primaryStack.push(!0),this.styleMap={},this.styleMap["e"+c]=d,this.lastOffset++,this.replayFlowElementsFromOffset(-1)}var r=o.prototype;return r.hasProp=function(e,t,n){var i=e[n];return i&&i.evaluate(this.context)!==t[n]},r.transferPropsToRoot=function(e,t){for(var n in t){var i=e[n];if(i)this.rootStyle[n]=i,delete e[n];else{var a=t[n];a&&(this.rootStyle[n]=new Dt(a,33554432))}}},r.postprocessTopStyle=function(e,t){var n=this;if(["writing-mode","direction"].forEach(function(f){!e[f]||t&&n.rootStyle[f]||(n.rootStyle[f]=e[f])}),!this.rootBackgroundAssigned){var i=this.hasProp(e,this.validatorSet.backgroundProps,"background-color")?e["background-color"].evaluate(this.context):null,a=this.hasProp(e,this.validatorSet.backgroundProps,"background-image")?e["background-image"].evaluate(this.context):null;(i&&i!==b.inherit||a&&a!==b.inherit)&&(this.transferPropsToRoot(e,this.validatorSet.backgroundProps),this.rootBackgroundAssigned=!0)}if(!this.rootLayoutAssigned){for(var s=0;s<Iu.length;s++)if(this.hasProp(e,this.validatorSet.layoutProps,Iu[s])){this.transferPropsToRoot(e,this.validatorSet.layoutProps),this.rootLayoutAssigned=!0;break}}if(!t){var u=e["font-size"];if(u){var h=u.evaluate(this.context),c=h.num;switch(h.unit){case"em":case"rem":c*=this.context.initialFontSize;break;case"ex":c*=this.context.initialFontSize*me.ex/me.em;break;case"%":c*=this.context.initialFontSize/100;break;default:var d=me[h.unit];d&&(c*=d)}this.context.rootFontSize=c}}},r.getTopContainerStyle=function(){for(var e=0;!this.bodyReached&&this.styleUntil(e+=5e3,0)!=Number.POSITIVE_INFINITY;);return this.rootStyle},r.getAttrStyle=function(e){if(e.style instanceof CSSStyleDeclaration){var t=e.getAttribute("style");if(t)return function(n,i,a,s){var u=new zc(n,i),h=new mn(s,u);try{(function(c,d,f){new ji(Wi,c,d,f).runParser(Number.POSITIVE_INFINITY,!1,!0,!1,!1)})(h,u,a)}catch(c){M.warn(c,"Style attribute parse error:")}return u.elementStyle}(this.scope,this.validatorSet,this.xmldoc.url,t)}return{}},r.getReachedOffset=function(){return this.lastOffset},r.replayFlowElementsFromOffset=function(e){if(!(e>=this.lastOffset)){var t=this.context,n=this.xmldoc.getElementOffset(this.root);if(e<n){var i=this.getStyle(this.root,!1),a=Be(i,"flow-into"),s=a?a.evaluate(t,"flow-into").toString():"body",u=this.encounteredFlowElement(s,i,this.root,n);this.boxStack.empty()&&this.boxStack.push(i,n,!0,u)}var h=this.xmldoc.getNodeByOffset(e),c=this.xmldoc.getNodeOffset(h,0,!1);if(!(c>=this.lastOffset))for(;;){if(h.nodeType!=1)c+=h.textContent.length;else{var d=h,f=this.getStyle(d,!1),v=f["flow-into"];if(v){var g=v.evaluate(t,"flow-into").toString();this.encounteredFlowElement(g,f,d,c)}c++}if(c>=this.lastOffset)break;var p=h.firstChild;if(p==null){for(;!(p=h.nextSibling);)if((h=h.parentNode)===this.root)return}h=p}}},r.resetFlowChunkStream=function(e){this.flowListener=e;for(var t=0;t<this.flowChunks.length;t++)this.flowListener.encounteredFlowChunk(this.flowChunks[t],this.flows[this.flowChunks[t].flowName])},r.styleUntilFlowIsReached=function(e){this.flowToReach=e;for(var t=0;this.flowToReach!=null&&this.styleUntil(t+=5e3,0)!=Number.POSITIVE_INFINITY;);},r.styleUntilIdIsReached=function(e){if(e){this.idToReach=e;for(var t=0;this.idToReach&&this.styleUntil(t+=5e3,0)!==Number.POSITIVE_INFINITY;);this.idToReach=null}},r.encounteredFlowElement=function(e,t,n,i){var a=0,s=Number.POSITIVE_INFINITY,u=!1,h=!1,c=!1,d=t["flow-options"];if(d){var f=function(y){if(y){var N=new oh;try{return y.visit(N),N.propSet}catch(x){M.warn(x,"toSet:")}}return{}}(d.evaluate(this.context,"flow-options"));u=!!f.exclusive,h=!!f.static,c=!!f.last}var v=t["flow-linger"];v&&(s=rs(v.evaluate(this.context,"flow-linger"),Number.POSITIVE_INFINITY));var g=t["flow-priority"];g&&(a=rs(g.evaluate(this.context,"flow-priority"),0));var p=this.breakBeforeValues[i]||null,E=this.flows[e];if(!E){var C=this.boxStack.lastFlowName();E=this.flows[e]=new qh(e,C)}var D=new Qh(e,n,i,a,s,u,h,c,p);return this.flowChunks.push(D),this.flowToReach==e&&(this.flowToReach=null),this.flowListener&&this.flowListener.encounteredFlowChunk(D,E),D},r.registerForcedBreakOffset=function(e,t,n){if(_e(e)){var i=this.flows[n].forcedBreakOffsets;(i.length===0||i[i.length-1]<t)&&i.push(t)}this.breakBeforeValues[t]=Ne(this.breakBeforeValues[t],e)},r.styleUntil=function(e,t){var n=-1;if(e<=this.lastOffset&&(n=this.offsetMap.slippedByFixed(e)+t)<this.offsetMap.getMaxSlipped())return this.offsetMap.fixedBySlipped(n);if(this.last==null)return Number.POSITIVE_INFINITY;for(var i=this.context;;){var a=this.last.firstChild;if(a==null)for(;;){if(this.last.nodeType==1){this.cascade.popElement(this.last),this.primary=this.primaryStack.pop();var s=this.boxStack.pop(this.lastOffset),u=null;if(s.afterBox){var h=s.afterBox.getBreakValue("before");this.registerForcedBreakOffset(h,s.afterBox.atBlockStart?this.boxStack.nearestBlockStartOffset(s):s.afterBox.offset,s.flowName),u=s.afterBox.getBreakValue("after")}u=Ne(u,s.getBreakValue("after")),this.registerForcedBreakOffset(u,this.lastOffset,s.flowName)}if(a=this.last.nextSibling)break;if(this.last=this.last.parentNode,this.last===this.root)return this.last=null,e<this.lastOffset&&(n<0&&(n=this.offsetMap.slippedByFixed(e)+t),n<=this.offsetMap.getMaxSlipped())?this.offsetMap.fixedBySlipped(n):Number.POSITIVE_INFINITY}if(this.last=a,this.last.nodeType!=1)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 c=this.last,d=this.getAttrStyle(c);this.primaryStack.push(this.primary),this.cascade.pushElement(c,d,this.lastOffset);var f=c.getAttribute("id")||c.getAttributeNS(U.XML,"id");f&&f===this.idToReach&&(this.idToReach=null),this.bodyReached||c.localName!="body"||c.parentNode!=this.root||(this.postprocessTopStyle(d,!0),this.bodyReached=!0);var v=void 0,g=d["flow-into"];if(g){var p=g.evaluate(i,"flow-into").toString(),E=this.encounteredFlowElement(p,d,c,this.lastOffset);this.primary=!!this.primaryFlows[p],v=this.boxStack.push(d,this.lastOffset,c===this.root,E)}else v=this.boxStack.push(d,this.lastOffset,c===this.root),c===this.xmldoc.body&&(v.breakBefore=Ne(v.flowChunk.breakBefore,v.breakBefore));var C=this.boxStack.nearestBlockStartOffset(v);if(C===0){var D,y=(D=d.page)==null?void 0:D.value.toString();y&&y.toLowerCase()!=="auto"&&(this.cascade.firstPageType=y)}if(this.registerForcedBreakOffset(v.breakBefore,C,v.flowName),v.beforeBox){var N=v.beforeBox.getBreakValue("after");this.registerForcedBreakOffset(N,v.beforeBox.atBlockStart?C:v.offset,v.flowName)}if(this.primary&&v.displayValue()===b.none&&(this.primary=!1),this.styleMap["e"+this.lastOffset]=d,this.lastOffset++,this.primary?this.offsetMap.addStuckRange(this.lastOffset):this.offsetMap.addSlippedRange(this.lastOffset),e<this.lastOffset&&(n<0&&(n=this.offsetMap.slippedByFixed(e)+t),n<=this.offsetMap.getMaxSlipped()))return this.offsetMap.fixedBySlipped(n)}}},r.getStyle=function(e,t){var n=this.xmldoc.getElementOffset(e),i="e"+n;return t&&(n=this.xmldoc.getNodeOffset(e,0,!0)),this.lastOffset<=n&&this.styleUntil(n,0),this.styleMap[i]},r.processContent=function(e,t){},o}(),Iu=["column-count","column-width","column-fill"],Jn=function(){function o(e){this.validator=void 0,this.success=null,this.failure=null,this.code=0,this.validator=e}var r=o.prototype;return r.isSpecial=function(){return this.code!=0},r.markAsStartGroup=function(){this.code=-1},r.isStartGroup=function(){return this.code==-1},r.markAsEndGroup=function(){this.code=-2},r.isEndGroup=function(){return this.code==-2},r.markAsStartAlternate=function(e){this.code=2*e+1},r.isStartAlternate=function(){return this.code>0&&this.code%2!=0},r.markAsEndAlternate=function(e){this.code=2*e+2},r.isEndAlternate=function(){return this.code>0&&this.code%2==0},r.getAlternate=function(){return Math.floor((this.code-1)/2)},o}(),On=function(o,r){this.where=void 0,this.success=void 0,this.what=-1,this.where=o,this.success=r};(function(o){o[o.FOLLOW=1]="FOLLOW",o[o.OPTIONAL=2]="OPTIONAL",o[o.REPEATED=3]="REPEATED",o[o.ALTERNATE=4]="ALTERNATE"})(ve||(ve={}));var xi=function(){function o(){this.nodes=[],this.connections=[],this.match=[],this.nomatch=[],this.error=[],this.emptyHead=!0}var r=o.prototype;return r.connect=function(e,t){for(var n=0;n<e.length;n++)this.connections[e[n]].what=t;e.splice(0,e.length)},r.clone=function(){for(var e,t,n,i=new o,a=0;a<this.nodes.length;a++){var s=this.nodes[a],u=new Jn(s.validator);u.code=s.code,i.nodes.push(u)}for(var h=0;h<this.connections.length;h++){var c=this.connections[h],d=new On(c.where,c.success);d.what=c.what,i.connections.push(d)}return(e=i.match).push.apply(e,this.match),(t=i.nomatch).push.apply(t,this.nomatch),(n=i.error).push.apply(n,this.error),i},r.addSpecialToArr=function(e,t,n){var i=this.nodes.length,a=new Jn(Pu);n>=0?t?a.markAsStartAlternate(n):a.markAsEndAlternate(n):t?a.markAsStartGroup():a.markAsEndGroup(),this.nodes.push(a),this.connect(e,i);var s=new On(i,!0),u=new On(i,!1);e.push(this.connections.length),this.connections.push(u),e.push(this.connections.length),this.connections.push(s)},r.endSpecialGroup=function(){for(var e=[this.match,this.nomatch,this.error],t=0;t<e.length;t++)this.addSpecialToArr(e[t],!1,-1)},r.startSpecialGroup=function(){if(this.nodes.length)throw new Error("invalid call");this.addSpecialToArr(this.match,!0,-1)},r.endClause=function(e){this.addSpecialToArr(this.match,!1,e)},r.startClause=function(e){if(this.nodes.length)throw new Error("invalid call");var t=new Jn(Pu);t.markAsStartAlternate(e),this.nodes.push(t);var n=new On(0,!0),i=new On(0,!1);this.nomatch.push(this.connections.length),this.connections.push(i),this.match.push(this.connections.length),this.connections.push(n)},r.addPrimitive=function(e){var t=this.nodes.length;this.nodes.push(new Jn(e));var n=new On(t,!0),i=new On(t,!1);this.connect(this.match,t),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)},r.isSimple=function(){return this.nodes.length==1&&!this.nodes[0].isSpecial()},r.isPrimitive=function(){return this.isSimple()&&this.nodes[0].validator instanceof oe},r.addGroup=function(e,t){if(e.nodes.length!=0){var n=this.nodes.length;if(t==ve.ALTERNATE&&n==1&&e.isPrimitive()&&this.isPrimitive())this.nodes[0].validator=this.nodes[0].validator.combine(e.nodes[0].validator);else{for(var i=0;i<e.nodes.length;i++)this.nodes.push(e.nodes[i]);t==ve.ALTERNATE?(this.emptyHead=!0,this.connect(this.nomatch,n)):this.connect(this.match,n);for(var a=this.connections.length,s=0;s<e.connections.length;s++){var u=e.connections[s];u.where+=n,u.what>=0&&(u.what+=n),this.connections.push(u)}for(var h=0;h<e.match.length;h++)this.match.push(e.match[h]+a);if(t==ve.REPEATED&&this.connect(this.match,n),t==ve.OPTIONAL||t==ve.REPEATED)for(var c=0;c<e.nomatch.length;c++)this.match.push(e.nomatch[c]+a);else if(this.emptyHead){for(var d=0;d<e.nomatch.length;d++)this.nomatch.push(e.nomatch[d]+a);this.emptyHead=e.emptyHead}else for(var f=0;f<e.nomatch.length;f++)this.error.push(e.nomatch[f]+a);for(var v=0;v<e.error.length;v++)this.error.push(e.error[v]+a);e.nodes=null,e.connections=null}}},r.finish=function(e,t){var n=this.nodes.length;this.nodes.push(e),this.nodes.push(t),this.connect(this.match,n),this.connect(this.nomatch,n+1),this.connect(this.error,n+1);for(var i,a=B(this.connections);!(i=a()).done;){var s=i.value;s.success?this.nodes[s.where].success=this.nodes[s.what]:this.nodes[s.where].failure=this.nodes[s.what]}for(var u=0;u<n;u++)if(this.nodes[u].failure==null||this.nodes[u].success==null)throw new Error("Invalid validator state");return this.nodes[0]},o}(),Fu=function(o){function r(){return o.call(this)||this}return w(r,o),r.prototype.validateForShorthand=function(e,t){var n=e[t].visit(this);return n?[n]:null},r}(fn),oe=function(o){function r(t,n,i){var a;return(a=o.call(this)||this).allowed=void 0,a.idents=void 0,a.units=void 0,a.allowed=t,a.idents=n,a.units=i,a}w(r,o);var e=r.prototype;return e.visitEmpty=function(t){return 1&this.allowed?t:null},e.visitSlash=function(t){return 2048&this.allowed?t:null},e.visitStr=function(t){return 2&this.allowed?t:null},e.visitIdent=function(t){return this.idents[t.name.toLowerCase()]||(4&this.allowed?t:null)},e.visitNumeric=function(t){return t.num!=0||512&this.allowed?t.num<0&&!(256&this.allowed)?null:this.units[t.unit]?t:null:t.unit=="%"&&1024&this.allowed?t:null},e.visitNum=function(t){return t.num==0?512&this.allowed?t:null:t.num<=0&&!(256&this.allowed)?null:16&this.allowed?t:null},e.visitInt=function(t){return t.num==0?512&this.allowed?t:null:t.num<=0&&!(256&this.allowed)?null:48&this.allowed?t:this.idents[""+t.num]||null},e.visitColor=function(t){return 64&this.allowed?t:null},e.visitURL=function(t){return 128&this.allowed?t:null},e.visitSpaceList=function(t){return null},e.visitCommaList=function(t){return null},e.visitFunc=function(t){return null},e.visitExpr=function(t){return 2046&this.allowed?t:null},e.combine=function(t){var n={},i={};for(var a in this.idents)n[a]=this.idents[a];for(var s in t.idents)n[s]=t.idents[s];for(var u in this.units)i[u]=this.units[u];for(var h in t.units)i[h]=t.units[h];return new r(this.allowed|t.allowed,n,i)},r}(Fu),Rt={},Pu=new oe(0,Rt,Rt),jo=function(o){function r(t){var n;return(n=o.call(this)||this).successTerminal=void 0,n.failureTerminal=void 0,n.first=void 0,n.successTerminal=new Jn(null),n.failureTerminal=new Jn(null),n.first=t.finish(n.successTerminal,n.failureTerminal),n}w(r,o);var e=r.prototype;return e.validateList=function(t,n,i){for(var a=n?[]:t,s=this.first,u=i,h=null,c=null;s!==this.successTerminal&&s!==this.failureTerminal;)if(u>=t.length)s=s.failure;else{var d=t[u],f=d;if(s.isSpecial()){var v=!0;s.isStartGroup()?(h?h.push(c):h=[c],c=[]):s.isEndGroup()?c=h.length>0?h.pop():null:s.isEndAlternate()?c[s.getAlternate()]="taken":v=c[s.getAlternate()]==null,s=v?s.success:s.failure}else{if(u==0&&!n&&s.validator instanceof Ii&&this instanceof Ii){if(f=new fe(t).visit(s.validator)){u=t.length,s=s.success;continue}}else if(u==0&&!n&&s.validator instanceof Yo&&this instanceof Ii){if(f=new Te(t).visit(s.validator)){u=t.length,s=s.success;continue}}else f=d.visit(s.validator);if(!f){s=s.failure;continue}if(f!==d&&t===a){a=[];for(var g=0;g<u;g++)a[g]=t[g]}t!==a&&(a[u-i]=f),u++,s=s.success}}return s===this.successTerminal&&(n?a.length>0:u==t.length)?a:null},e.validateSingle=function(t){for(var n=null,i=this.first;i!==this.successTerminal&&i!==this.failureTerminal;)t?i.isSpecial()?i=i.success:(n=t.visit(i.validator))?(t=null,i=i.success):i=i.failure:i=i.failure;return i===this.successTerminal?n:null},e.visitEmpty=function(t){return this.validateSingle(t)},e.visitSlash=function(t){return this.validateSingle(t)},e.visitStr=function(t){return this.validateSingle(t)},e.visitIdent=function(t){return this.validateSingle(t)},e.visitNumeric=function(t){return this.validateSingle(t)},e.visitNum=function(t){return this.validateSingle(t)},e.visitInt=function(t){return this.validateSingle(t)},e.visitColor=function(t){return this.validateSingle(t)},e.visitURL=function(t){return this.validateSingle(t)},e.visitSpaceList=function(t){return null},e.visitCommaList=function(t){return null},e.visitFunc=function(t){return this.validateSingle(t)},e.visitExpr=function(t){return null},r}(Fu),Ii=function(o){function r(t){return o.call(this,t)||this}w(r,o);var e=r.prototype;return e.visitSpaceList=function(t){var n=this.validateList(t.values,!1,0);return n===t.values?t:n?new fe(n):null},e.visitCommaList=function(t){for(var n=this.first,i=!1;n;){if(n.validator instanceof Yo){i=!0;break}n=n.failure}if(i){var a=this.validateList(t.values,!1,0);return a===t.values?t:a?new Te(a):null}return null},e.validateForShorthand=function(t,n){return this.validateList(t,!0,n)},r}(jo),Yo=function(o){function r(t){return o.call(this,t)||this}w(r,o);var e=r.prototype;return e.visitSpaceList=function(t){return this.validateSingle(t)},e.visitCommaList=function(t){var n=this.validateList(t.values,!1,0);return n===t.values?t:n?new Te(n):null},e.validateForShorthand=function(t,n){for(var i,a=this.first;a!==this.failureTerminal;){if(i=a.validator.validateForShorthand(t,n))return i;a=a.failure}return null},r}(jo),Md=function(o){function r(t,n){var i;return(i=o.call(this,n)||this).name=void 0,i.name=t,i}w(r,o);var e=r.prototype;return e.validateSingle=function(t){return null},e.visitFunc=function(t){if(t.name.toLowerCase()!=this.name)return null;var n=this.validateList(t.values,!1,0);return n===t.values?t:n?new qr(t.name,n):null},r}(jo),Ru=function(){function o(){}var r=o.prototype;return r.tryParse=function(e,t,n){return t},r.success=function(e,t){},o}(),Ou=function(o){function r(t,n){var i;return(i=o.call(this)||this).name=void 0,i.validator=void 0,i.name=n,i.validator=t.validators[i.name],i}w(r,o);var e=r.prototype;return e.tryParse=function(t,n,i){if(i.values[this.name])return n;var a=this.validator.validateForShorthand(t,n);if(a){var s=a.length,u=s>1?new fe(a):a[0];return this.success(u,i),n+s}return n},e.success=function(t,n){n.values[this.name]=t},r}(Ru),Ud=function(o){function r(e,t){var n;return(n=o.call(this,e,t[0])||this).names=void 0,n.names=t,n}return w(r,o),r.prototype.success=function(e,t){for(var n=0;n<this.names.length;n++)t.values[this.names[n]]=e},r}(Ou),Vd=function(o){function r(e,t){var n;return(n=o.call(this)||this).nodes=void 0,n.slash=void 0,n.nodes=e,n.slash=t,n}return w(r,o),r.prototype.tryParse=function(e,t,n){var i=t;if(this.slash&&(e[t]!=Mi||++t==e.length))return i;var a=this.nodes[0].tryParse(e,t,n);if(a==t)return i;t=a;for(var s=1;s<this.nodes.length&&t<e.length&&(a=this.nodes[s].tryParse(e,t,n))!=t;s++)t=a;return t},r}(Ru),Ko=function(o){function r(){for(var t,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return(t=o.call.apply(o,[this].concat(i))||this).syntax=null,t.propList=null,t.error=!1,t.values={},t.validatorSet=null,t}w(r,o);var e=r.prototype;return e.setOwner=function(t){this.validatorSet=t},e.syntaxNodeForProperty=function(t){return new Ou(this.validatorSet,t)},e.clone=function(){var t=new this.constructor;return t.syntax=this.syntax,t.propList=this.propList,t.validatorSet=this.validatorSet,t},e.init=function(t,n){this.syntax=t,this.propList=n},e.finish=function(t,n){if(!this.error){for(var i,a=B(this.propList);!(i=a()).done;){var s=i.value;n.simpleProperty(s,this.values[s]||this.validatorSet.defaultValues[s],t)}return!0}return!1},e.propagateInherit=function(t,n){for(var i,a=B(this.propList);!(i=a()).done;)n.simpleProperty(i.value,b.inherit,t)},e.validateList=function(t){return this.error=!0,0},e.validateSingle=function(t){return this.validateList([t]),null},e.visitEmpty=function(t){return this.validateSingle(t)},e.visitStr=function(t){return this.validateSingle(t)},e.visitIdent=function(t){return this.validateSingle(t)},e.visitNumeric=function(t){return this.validateSingle(t)},e.visitNum=function(t){return this.validateSingle(t)},e.visitInt=function(t){return this.validateSingle(t)},e.visitColor=function(t){return this.validateSingle(t)},e.visitURL=function(t){return this.validateSingle(t)},e.visitSpaceList=function(t){return this.validateList(t.values),null},e.visitCommaList=function(t){return this.error=!0,null},e.visitFunc=function(t){return this.validateSingle(t)},e.visitExpr=function(t){return this.error=!0,null},r}(fn),pr=function(o){function r(){return o.call(this)||this}return w(r,o),r.prototype.validateList=function(e){for(var t=0,n=0;t<e.length;){var i=this.syntax[n].tryParse(e,t,this);if(i>t)t=i,n=0;else if(++n==this.syntax.length){this.error=!0;break}}return t},r}(Ko),ku=function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.validateList=function(t){if(t.length>this.syntax.length||t.length==0)return this.error=!0,0;for(var n=0;n<this.syntax.length;n++){for(var i=n;i>=t.length;)i=i==1?0:i-2;if(this.syntax[n].tryParse(t,i,this)!=i+1)return this.error=!0,0}return t.length},e.createSyntaxNode=function(){return new Ud(this.validatorSet,this.propList)},r}(Ko),Lu={SIMPLE:pr,INSETS:ku,INSETS_SLASH:function(o){function r(){return o.call(this)||this}return w(r,o),r.prototype.validateList=function(e){for(var t=e.length,n=0;n<e.length;n++)if(e[n]===Mi){t=n;break}if(t>this.syntax.length||e.length==0)return this.error=!0,0;for(var i=0;i<this.syntax.length;i++){for(var a=i;a>=t;)a=a==1?0:a-2;var s=void 0;if(t+1<e.length)for(s=t+i+1;s>=e.length;)s-=s==t+2?1:2;else s=a;if(this.syntax[i].tryParse([e[a],e[s]],0,this)!=2)return this.error=!0,0}return e.length},r}(Ko),COMMA:function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.mergeIn=function(t,n){for(var i,a=B(this.propList);!(i=a()).done;){var s=i.value,u=n[s]||this.validatorSet.defaultValues[s],h=t[s];h||(t[s]=h=[]),h.push(u)}},e.visitCommaList=function(t){for(var n={},i=0;i<t.values.length;i++)if(this.values={},t.values[i]instanceof Te?this.error=!0:(t.values[i].visit(this),this.mergeIn(n,this.values),this.values["background-color"]&&i!=t.values.length-1&&(this.error=!0)),this.error)return null;for(var a in this.values={},n)this.values[a]=a=="background-color"?n[a].pop():new Te(n[a]);return null},r}(pr),FONT:function(o){function r(){return o.call(this)||this}w(r,o);var e=r.prototype;return e.init=function(t,n){o.prototype.init.call(this,t,n),this.propList.push("font-family","line-height","font-size")},e.validateList=function(t){var n=o.prototype.validateList.call(this,t);if(n+2>t.length)return this.error=!0,n;this.error=!1;var i=this.validatorSet.validators;if(!t[n].visit(i["font-size"]))return this.error=!0,n;if(this.values["font-size"]=t[n++],t[n]===Mi){if(2+ ++n>t.length)return this.error=!0,n;if(!t[n].visit(i["line-height"]))return this.error=!0,n;this.values["line-height"]=t[n++]}var a=n==t.length-1?t[n]:new fe(t.slice(n,t.length));return a.visit(i["font-family"])?(this.values["font-family"]=a,t.length):(this.error=!0,n)},e.visitCommaList=function(t){if(t.values[0].visit(this),this.error)return null;for(var n=[this.values["font-family"]],i=1;i<t.values.length;i++)n.push(t.values[i]);var a=new Te(n);return a.visit(this.validatorSet.validators["font-family"])?this.values["font-family"]=a:this.error=!0,null},e.visitIdent=function(t){var n=this.validatorSet.systemFonts[t.name];if(n)for(var i in n)this.values[i]=n[i];else this.error=!0;return null},r}(pr)},Hd=function(){function o(){this.validators={},this.prefixes={},this.defaultValues={},this.namedValidators={},this.systemFonts={},this.shorthands={},this.layoutProps={},this.backgroundProps={}}var r=o.prototype;return r.addReplacement=function(e,t){var n;if(t.type==m.NUMERIC)n=new O(t.num,t.text);else if(t.type==m.HASH)n=ms(t.text);else{if(t.type!=m.IDENT)throw new Error("unexpected replacement");n=_(t.text)}if(e.isPrimitive()){var i=e.nodes[0].validator.idents;for(var a in i)i[a]=n;return e}throw new Error("unexpected replacement")},r.newGroup=function(e,t){var n,i=new xi;if(e=="||"){for(var a=0;a<t.length;a++){var s=new xi;s.startClause(a),s.addGroup(t[a],ve.FOLLOW),s.endClause(a),i.addGroup(s,a==0?ve.FOLLOW:ve.ALTERNATE)}var u=new xi;return u.startSpecialGroup(),u.addGroup(i,ve.REPEATED),u.endSpecialGroup(),u}switch(e){case" ":n=ve.FOLLOW;break;case"|":case"||":n=ve.ALTERNATE;break;default:throw new Error("unexpected op")}for(var h=0;h<t.length;h++)i.addGroup(t[h],h==0?ve.FOLLOW:n);return i},r.addCounts=function(e,t,n){for(var i=new xi,a=0;a<t;a++)i.addGroup(e.clone(),ve.FOLLOW);if(n==Number.POSITIVE_INFINITY)i.addGroup(e,ve.REPEATED);else for(var s=t;s<n;s++)i.addGroup(e.clone(),ve.OPTIONAL);return i},r.primitive=function(e){var t=new xi;return t.addPrimitive(e),t},r.newFunc=function(e,t){var n;switch(e){case"COMMA":n=new Yo(t);break;case"SPACE":n=new Ii(t);break;default:n=new Md(e.toLowerCase(),t)}return this.primitive(n)},r.initBuiltInValidators=function(){this.namedValidators.HASHCOLOR=this.primitive(new oe(64,Rt,Rt)),this.namedValidators.POS_INT=this.primitive(new oe(32,Rt,Rt)),this.namedValidators.POS_NUM=this.primitive(new oe(16,Rt,Rt)),this.namedValidators.POS_PERCENTAGE=this.primitive(new oe(8,Rt,{"%":ht})),this.namedValidators.NEGATIVE=this.primitive(new oe(256,Rt,Rt)),this.namedValidators.ZERO=this.primitive(new oe(512,Rt,Rt)),this.namedValidators.ZERO_PERCENTAGE=this.primitive(new oe(1024,Rt,Rt)),this.namedValidators.POS_LENGTH=this.primitive(new oe(8,Rt,{em:ht,ex:ht,ch:ht,rem:ht,vw:ht,vh:ht,vi:ht,vb:ht,vmin:ht,vmax:ht,pvw:ht,pvh:ht,pvi:ht,pvb:ht,pvmin:ht,pvmax:ht,cm:ht,mm:ht,in:ht,px:ht,pt:ht,pc:ht,q:ht})),this.namedValidators.POS_ANGLE=this.primitive(new oe(8,Rt,{deg:ht,grad:ht,rad:ht,turn:ht})),this.namedValidators.POS_TIME=this.primitive(new oe(8,Rt,{s:ht,ms:ht})),this.namedValidators.FREQUENCY=this.primitive(new oe(8,Rt,{Hz:ht,kHz:ht})),this.namedValidators.RESOLUTION=this.primitive(new oe(8,Rt,{dpi:ht,dpcm:ht,dppx:ht})),this.namedValidators.URI=this.primitive(new oe(128,Rt,Rt)),this.namedValidators.IDENT=this.primitive(new oe(4,Rt,Rt)),this.namedValidators.STRING=this.primitive(new oe(2,Rt,Rt)),this.namedValidators.SLASH=this.primitive(new oe(2048,Rt,Rt));var e={"font-family":_("sans-serif")};this.systemFonts.caption=e,this.systemFonts.icon=e,this.systemFonts.menu=e,this.systemFonts["message-box"]=e,this.systemFonts["small-caption"]=e,this.systemFonts["status-bar"]=e},r.isBuiltIn=function(e){return!!e.match(/^[A-Z_0-9]+$/)},r.readNameAndPrefixes=function(e,t){var n=e.token();if(n.type==m.EOF)return null;var i={"":!0};if(n.type==m.O_BRK){do{if(e.consume(),(n=e.token()).type!=m.IDENT)throw new Error("Prefix name expected");i[n.text]=!0,e.consume(),n=e.token()}while(n.type==m.COMMA);if(n.type!=m.C_BRK)throw new Error("']' expected");e.consume(),n=e.token()}if(n.type!=m.IDENT)throw new Error("Property name expected");if(t==2?n.text=="SHORTHANDS":n.text=="DEFAULTS")return e.consume(),null;var a=n.text;if(e.consume(),t!=2){if(e.token().type!=m.EQ)throw new Error("'=' expected");this.isBuiltIn(a)||(this.prefixes[a]=i)}else if(e.token().type!=m.COLON)throw new Error("':' expected");return a},r.parseValidators=function(e){for(var t=this,n=function(){var a=t.readNameAndPrefixes(e,1);if(!a)return{v:void 0};for(var s=[],u=[],h="",c=void 0,d=!0,f=function(){if(s.length==0)throw new Error("No values");return s.length==1?s[0]:t.newGroup(h,s)},v=function(k){if(d)throw new Error("'"+k+"': unexpected");if(h&&h!=k)throw new Error("mixed operators: '"+k+"' and '"+h+"'");h=k,d=!0},g=null;!g;){e.consume();var p=e.token();switch(p.type){case m.IDENT:if(d||v(" "),t.isBuiltIn(p.text)){var E=t.namedValidators[p.text];if(!E)throw new Error("'"+p.text+"' unexpected");s.push(E.clone())}else{var C={};C[p.text.toLowerCase()]=_(p.text),s.push(t.primitive(new oe(0,C,Rt)))}d=!1;break;case m.INT:var D={};D[""+p.num]=new xn(p.num),s.push(t.primitive(new oe(0,D,Rt))),d=!1;break;case m.BAR:v("|");break;case m.BAR_BAR:v("||");break;case m.O_BRK:d||v(" "),u.push({vals:s,op:h,b:"["}),h="",s=[],d=!0;break;case m.FUNC:d||v(" "),u.push({vals:s,op:h,b:"(",fn:p.text}),h="",s=[],d=!0;break;case m.C_BRK:c=f();var y=u.pop();if(y.b!="[")throw new Error("']' unexpected");(s=y.vals).push(c),h=y.op,d=!1;break;case m.C_PAR:c=f();var N=u.pop();if(N.b!="(")throw new Error("')' unexpected");(s=N.vals).push(t.newFunc(N.fn,c)),h=N.op,d=!1;break;case m.COLON:if(d)throw new Error("':' unexpected");e.consume(),s.push(t.addReplacement(s.pop(),e.token()));break;case m.QMARK:if(d)throw new Error("'?' unexpected");s.push(t.addCounts(s.pop(),0,1));break;case m.STAR:if(d)throw new Error("'*' unexpected");s.push(t.addCounts(s.pop(),0,Number.POSITIVE_INFINITY));break;case m.PLUS:if(d)throw new Error("'+' unexpected");s.push(t.addCounts(s.pop(),1,Number.POSITIVE_INFINITY));break;case m.O_BRC:if(e.consume(),(p=e.token()).type!=m.INT)throw new Error("<int> expected");var x=p.num,F=x;if(e.consume(),(p=e.token()).type==m.COMMA){if(e.consume(),(p=e.token()).type!=m.INT)throw new Error("<int> expected");F=p.num,e.consume(),p=e.token()}if(p.type!=m.C_BRC)throw new Error("'}' expected");s.push(t.addCounts(s.pop(),x,F));break;case m.SEMICOL:if(g=f(),u.length>0)throw new Error("unclosed '"+u.pop().b+"'");break;default:throw new Error("unexpected token")}}e.consume(),t.isBuiltIn(a)?t.namedValidators[a]=g:t.validators[a]=g.isSimple()?g.nodes[0].validator:new Ii(g)};;){var i=n();if(typeof i=="object")return i.v}},r.parseDefaults=function(e){for(;;){var t=this.readNameAndPrefixes(e,2);if(!t)return;for(var n=[];;){e.consume();var i=e.token();if(i.type==m.SEMICOL){e.consume();break}switch(i.type){case m.IDENT:n.push(_(i.text));break;case m.NUM:n.push(new ri(i.num));break;case m.INT:n.push(new xn(i.num));break;case m.NUMERIC:n.push(new O(i.num,i.text));break;default:throw new Error("unexpected token")}}this.defaultValues[t]=n.length>1?new fe(n):n[0]}},r.parseShorthands=function(e){for(;;){var t=this.readNameAndPrefixes(e,3);if(!t)return;var n=e.nthToken(1),i=void 0;n.type==m.IDENT&&Lu[n.text]?(i=new Lu[n.text],e.consume()):i=new pr,i.setOwner(this);for(var a=!1,s=[],u=!1,h=[],c=[];!a;)switch(e.consume(),(n=e.token()).type){case m.IDENT:if(this.validators[n.text])s.push(i.syntaxNodeForProperty(n.text)),c.push(n.text);else{if(!(this.shorthands[n.text]instanceof ku))throw new Error("'"+n.text+"' is neither a simple property nor an inset shorthand");var d=this.shorthands[n.text];s.push(d.createSyntaxNode()),c.push.apply(c,d.propList)}break;case m.SLASH:if(s.length>0||u)throw new Error("unexpected slash");u=!0;break;case m.O_BRK:h.push({slash:u,syntax:s}),s=[],u=!1;break;case m.C_BRK:var f=new Vd(s,u),v=h.pop();u=v.slash,(s=v.syntax).push(f);break;case m.SEMICOL:a=!0,e.consume();break;default:throw new Error("unexpected token")}i.init(s,c),this.shorthands[t]=i}},r.parse=function(e){var t=new mn(e,null);this.parseValidators(t),this.parseDefaults(t),this.parseShorthands(t),this.backgroundProps=this.makePropSet(["background"]),this.layoutProps=this.makePropSet(["margin","border","padding","columns","column-gap","column-rule","column-fill"])},r.makePropSet=function(e){for(var t,n={},i=B(e);!(t=i()).done;)for(var a,s=t.value,u=this.shorthands[s],h=B(u?u.propList:[s]);!(a=h()).done;){var c=a.value,d=this.defaultValues[c];d?n[c]=d:M.warn("Unknown property in makePropSet:",c)}return n},r.validatePropertyAndHandleShorthand=function(e,t,n,i){var a="",s=e,u=(e=e.toLowerCase()).match(/^-([a-z]+)-([-a-z0-9]+)$/);u&&(a=u[1],e=u[2]);var h=this.prefixes[e];if(h&&h[a]){var c=this.validators[e];if(c){var d=t===b.inherit||t.isExpr()?t:t.visit(c);d?i.simpleProperty(e,d,n):i.invalidPropertyValue(s,t)}else{var f=this.shorthands[e].clone();t===b.inherit?f.propagateInherit(n,i):(t.visit(f),f.finish(n,i)||i.invalidPropertyValue(s,t))}}else i.unknownProperty(s,t)},o}();function Bu(){var o=new Hd;return o.initBuiltInValidators(),o.parse(fs),o}var ti={"font-style":b.normal,"font-variant":b.normal,"font-weight":b.normal},zd="OTTO"+new Date().valueOf(),Gd=1;function Wd(o,r){var e={};for(var t in o)e[t]=Be(o,t).evaluate(r,t);return function(n){for(var i in ti)n[i]||(n[i]=ti[i])}(e),e}var _u=function(){function o(e){this.properties=void 0,this.fontTraitKey=void 0,this.src=void 0,this.blobURLs=[],this.blobs=[],this.family=void 0,this.properties=e,this.fontTraitKey=function(n){var i=new Re;for(var a in ti)i.append(" "),i.append(n[a].toString());return i.toString()}(this.properties),this.src=this.properties.src?this.properties.src.toString():null;var t=this.properties["font-family"];this.family=t?t.stringValue():null}var r=o.prototype;return r.traitsEqual=function(e){return this.fontTraitKey==e.fontTraitKey},r.makeAtRule=function(e,t){var n=new Re;for(var i in n.append(@font-face {
font-family: ),n.append(this.family),n.append(;
),ti)n.append(i),n.append(": "),this.properties[i].appendTo(n,!0),n.append(;
);if(t){n.append('src: url("');var a=(window.URL||window.webkitURL).createObjectURL(t);n.append(a),this.blobURLs.push(a),this.blobs.push(t),n.append('")')}else n.append("src: "),n.append(e);return n.append(;
}
),n.toString()},o}(),Xd=function(){function o(e){this.deobfuscator=void 0,this.familyMap={},this.deobfuscator=e}var r=o.prototype;return r.registerFamily=function(e,t){var n=e.family,i=this.familyMap[n],a=t.family;if(i){if(i!=a)throw new Error("E_FONT_FAMILY_INCONSISTENT "+e.family)}else this.familyMap[n]=a},r.filterFontFamily=function(e){if(e instanceof Te){for(var t,n=[],i=B(e.values);!(t=i()).done;){var a=t.value,s=this.familyMap[a.stringValue()];s&&n.push(_(s)),n.push(a)}return new Te(n)}var u=this.familyMap[e.stringValue()];return u?new Te([_(u),e]):e},o}(),jd=function(){function o(e,t,n){this.head=void 0,this.body=void 0,this.srcURLMap={},this.familyPrefix=void 0,this.familyCounter=0,this.head=e,this.body=t,this.familyPrefix=n||"Fnt_"}var r=o.prototype;return r.getViewFontFamily=function(e,t){var n=e.family,i=t.familyMap[n];return i||(i=this.familyPrefix+ ++this.familyCounter,t.familyMap[n]=i,i)},r.initFont=function(e,t,n){var i=this,a=L("initFont"),s=e.src,u={};for(var h in ti)u[h]=e.properties[h];var c=this.getViewFontFamily(e,n);u["font-family"]=_(c);var d=new _u(u),f=this.body.ownerDocument.createElement("span");f.textContent="M";var v=new Date().valueOf()+1e3,g=this.head.ownerDocument.createElement("style"),p=zd+Gd++;g.textContent=d.makeAtRule("",uo([p])),this.head.appendChild(g);var E=this.body.ownerDocument.createElement("span");for(var C in E.style.width="0",E.style.height="0",E.style.overflow="hidden",E.appendChild(f),this.body.appendChild(E),f.style.visibility="hidden",f.style.fontFamily=c,ti)T(f,C,u[C].toString());var D=f.getBoundingClientRect(),y=D.right-D.left,N=D.bottom-D.top;g.textContent=d.makeAtRule(s,t),M.info("Starting to load font:",s);var x=!1;return a.loop(function(){var F=f.getBoundingClientRect();return y!=F.right-F.left||N!=F.bottom-F.top?(x=!0,I(!1)):new Date().valueOf()>v?I(!1):a.sleep(10)}).then(function(){x?M.info("Loaded font:",s):M.warn("Failed to load font:",s),i.body.removeChild(E),a.finish(d)}),a.result()},r.loadFont=function(e,t){var n=this,i=e.src,a=this.srcURLMap[i];return a?a.piggyback(function(s){var u=s;u.traitsEqual(e)?(t.registerFamily(e,u),M.warn("Found already-loaded font:",i)):M.warn("E_FONT_FACE_INCOMPATIBLE",e.src)}):(a=new ui(function(){var s=L("loadFont"),u=t.deobfuscator?t.deobfuscator(i):null;return u?hi(i,$e.BLOB).then(function(h){h.responseBlob?u(h.responseBlob).then(function(c){n.initFont(e,c,t).thenFinish(s)}):s.finish(null)}):n.initFont(e,null,t).thenFinish(s),s.result()},"loadFont "+i),this.srcURLMap[i]=a,a.start()),a},r.findOrLoadFonts=function(e,t){for(var n,i=[],a=B(e);!(n=a()).done;){var s=n.value;s.src&&s.family?i.push(this.loadFont(s,t)):M.warn("E_FONT_FACE_INVALID")}return so(i)},o}(),Yd=1,gr=function(){function o(e,t,n,i,a){this.name=void 0,this.pseudoName=void 0,this.classes=void 0,this.parent=void 0,this.specified={},this.children=[],this.pageMaster=null,this.index=0,this.key=void 0,this._scope=void 0,this.name=t,this.pseudoName=n,this.classes=i,this.parent=a,this._scope=e,this.key="p"+Yd++,a&&(this.index=a.children.length,a.children.push(this))}var r=o.prototype;return r.createInstance=function(e){throw new Error("E_UNEXPECTED_CALL")},r.clone=function(e){throw new Error("E_UNEXPECTED_CALL")},r.copySpecified=function(e){var t=this.specified,n=e.specified;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])},r.cloneChildren=function(e){for(var t=0;t<this.children.length;t++)this.children[t].clone({parent:e})},V(o,[{key:"scope",get:function(){return this._scope}}]),o}(),Kd=function(o){function r(e){var t;return(t=o.call(this,e,null,null,[],null)||this).specified.width=new Dt(oi,0),t.specified.height=new Dt(ai,0),t}return w(r,o),r}(gr),Mu=function(o){function r(e,t){var n;(n=o.call(this,e,function(a,s){var u=a.match(/^([^.]+)\.([^.]+)$/);if(u){var h=i.pageMaster.keyMap[u[1]];if(h){var c=this.lookupInstance(h);if(c)return s?c.resolveFunc(u[2]):c.resolveName(u[2])}}return null})||this).pageMaster=void 0,n.pageMaster=t;var i=xt(n);return n}return w(r,o),r}(Mr),Uu=function(o){function r(t,n,i,a,s,u,h){var c;return(c=o.call(this,t,n,i,a,s)||this).condition=void 0,c.specificity=void 0,c.keyMap={},c.condition=u,c.specificity=h,t instanceof Mu||(c._scope=new Mu(t,xt(c))),c.pageMaster=xt(c),c.specified.width=new Dt(oi,0),c.specified.height=new Dt(ai,0),c.specified["wrap-flow"]=new Dt(b.auto,0),c.specified.position=new Dt(b.relative,0),c.specified.overflow=new Dt(b.visible,0),c}w(r,o);var e=r.prototype;return e.createInstance=function(t){return new qo(t,this)},e.clone=function(t){var n=new r(this.scope,this.name,t.pseudoName||this.pseudoName,this.classes,this.parent,this.condition,this.specificity);return this.copySpecified(n),this.cloneChildren(n),n},e.resetScope=function(){this.scope.pageMaster=this},r}(gr),Vu=function(o){function r(t,n,i,a,s){var u;return(u=o.call(this,t,n,i,a,s)||this).pageMaster=s.pageMaster,n&&(u.pageMaster.keyMap[n]=u.key),u.specified["wrap-flow"]=new Dt(b.auto,0),u}w(r,o);var e=r.prototype;return e.createInstance=function(t){return new Qd(t,this)},e.clone=function(t){var n=new r(t.parent.scope,this.name,this.pseudoName,this.classes,t.parent);return this.copySpecified(n),this.cloneChildren(n),n},r}(gr),vr=function(o){function r(t,n,i,a,s){var u;return(u=o.call(this,t,n,i,a,s)||this).pageMaster=s.pageMaster,n&&(u.pageMaster.keyMap[n]=u.key),u}w(r,o);var e=r.prototype;return e.createInstance=function(t){return new Er(t,this)},e.clone=function(t){var n=new r(t.parent.scope,this.name,this.pseudoName,this.classes,t.parent);return this.copySpecified(n),this.cloneChildren(n),n},r}(gr);function Ot(o,r,e){return r&&r!==b.auto?r.toExpr(o,e):null}function Ie(o,r,e){return r&&r!==b.auto?r.toExpr(o,e):o.zero}function Hu(o,r,e){return r?r===b.auto?null:r.toExpr(o,e):o.zero}function tn(o,r,e,t){return r&&e!==b.none?r.toExpr(o,t):o.zero}function zu(o,r,e){return r?r===b._true?o._true:r===b._false?o._false:r.toExpr(o,o.zero):e}var mr=function(){function o(e,t){this.parentInstance=void 0,this.pageBox=void 0,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,this.parentInstance=e,this.pageBox=t,e&&e.children.push(this)}var r=o.prototype;return r.reset=function(){this.calculatedWidth=0,this.calculatedHeight=0},r.addNamedValues=function(e,t){var n=this.resolveName(e),i=this.resolveName(t);if(!n||!i)throw new Error("E_INTERNAL");return ut(this.pageBox.scope,n,i)},r.resolveName=function(e){var t=this.namedValues[e];if(t)return t;var n=this.style[e];switch(n&&(t=n.toExpr(this.pageBox.scope,this.pageBox.scope.zero)),e){case"margin-left-edge":t=this.resolveName("left");break;case"margin-top-edge":t=this.resolveName("top");break;case"margin-right-edge":t=this.addNamedValues("border-right-edge","margin-right");break;case"margin-bottom-edge":t=this.addNamedValues("border-bottom-edge","margin-bottom");break;case"border-left-edge":t=this.addNamedValues("margin-left-edge","margin-left");break;case"border-top-edge":t=this.addNamedValues("margin-top-edge","margin-top");break;case"border-right-edge":t=this.addNamedValues("padding-right-edge","border-right-width");break;case"border-bottom-edge":t=this.addNamedValues("padding-bottom-edge","border-bottom-width");break;case"padding-left-edge":t=this.addNamedValues("border-left-edge","border-left-width");break;case"padding-top-edge":t=this.addNamedValues("border-top-edge","border-top-width");break;case"padding-right-edge":t=this.addNamedValues("right-edge","padding-right");break;case"padding-bottom-edge":t=this.addNamedValues("bottom-edge","padding-bottom");break;case"left-edge":t=this.addNamedValues("padding-left-edge","padding-left");break;case"top-edge":t=this.addNamedValues("padding-top-edge","padding-top");break;case"right-edge":t=this.addNamedValues("left-edge","width");break;case"bottom-edge":t=this.addNamedValues("top-edge","height")}if(!t){var i;if(e=="extent")i=this.vertical?"width":"height";else if(e=="measure")i=this.vertical?"height":"width";else{var a=this.vertical?Is:Fs;for(var s in i=e,a)i=i.replace(s,a[s])}i!=e&&(t=this.resolveName(i))}return t&&(this.namedValues[e]=t),t},r.resolveFunc=function(e){var t=this.namedFuncs[e];if(t)return t;switch(e){case"columns":var n=this.pageBox.scope,i=new Wa(n,0),a=this.resolveName("column-count"),s=this.resolveName("column-width"),u=this.resolveName("column-gap");t=Ft(n,Bi(n,new ii(n,"min",[i,a]),ut(n,s,u)),u)}return t&&(this.namedFuncs[e]=t),t},r.initEnabled=function(){var e=this.pageBox.scope,t=this.style,n=zu(e,t.enabled,e._true),i=Ot(e,t.page,e.zero);if(i){var a=new ie(e,"page-number");n=We(e,n,new Wr(e,i,a))}var s=Ot(e,t["min-page-width"],e.zero);s&&(n=We(e,n,new Gr(e,new ie(e,"page-width"),s)));var u=Ot(e,t["min-page-height"],e.zero);u&&(n=We(e,n,new Gr(e,new ie(e,"page-height"),u))),n=this.boxSpecificEnabled(n),t.enabled=new Z(n)},r.boxSpecificEnabled=function(e){return e},r.initHorizontal=function(){var e=this.pageBox.scope,t=this.style,n=this.parentInstance?this.parentInstance.style.width.toExpr(e,null):null,i=Ot(e,t.left,n),a=Ot(e,t["margin-left"],n),s=tn(e,t["border-left-width"],t["border-left-style"],n),u=Ie(e,t["padding-left"],n),h=Ot(e,t.width,n),c=Ot(e,t["max-width"],n),d=Ie(e,t["padding-right"],n),f=tn(e,t["border-right-width"],t["border-right-style"],n),v=Ot(e,t["margin-right"],n),g=Ot(e,t.right,n),p=ut(e,s,u),E=ut(e,s,d);if(i&&g&&h){var C=Ft(e,n,ut(e,h,ut(e,ut(e,i,p),E)));a?v?g=Ft(e,C,v):v=Ft(e,C,ut(e,g,a)):(C=Ft(e,C,g),v?a=Ft(e,C,v):v=a=Bi(e,C,new re(e,.5)))}else{a||(a=e.zero),v||(v=e.zero),i||g||h||(i=e.zero),i||h?i||g?h||g||(h=this.autoWidth,this.isAutoWidth=!0):i=e.zero:(h=this.autoWidth,this.isAutoWidth=!0);var D=Ft(e,n,ut(e,ut(e,a,p),ut(e,v,E)));this.isAutoWidth&&(c||(c=Ft(e,D,i||g)),this.vertical||!Ot(e,t["column-width"],null)&&!Ot(e,t["column-count"],null)||(h=c,this.isAutoWidth=!1)),i?h?g||(g=Ft(e,D,ut(e,i,h))):h=Ft(e,D,ut(e,i,g)):i=Ft(e,D,ut(e,g,h))}var y=Ie(e,t["snap-width"]||(this.parentInstance?this.parentInstance.style["snap-width"]:null),n);t.left=new Z(i),t["margin-left"]=new Z(a),t["border-left-width"]=new Z(s),t["padding-left"]=new Z(u),t.width=new Z(h),t["max-width"]=new Z(c||h),t["padding-right"]=new Z(d),t["border-right-width"]=new Z(f),t["margin-right"]=new Z(v),t.right=new Z(g),t["snap-width"]=new Z(y)},r.initVertical=function(){var e=this.pageBox.scope,t=this.style,n=this.parentInstance?this.parentInstance.style.width.toExpr(e,null):null,i=this.parentInstance?this.parentInstance.style.height.toExpr(e,null):null,a=Ot(e,t.top,i),s=Ot(e,t["margin-top"],n),u=tn(e,t["border-top-width"],t["border-top-style"],n),h=Ie(e,t["padding-top"],n),c=Ot(e,t.height,i),d=Ot(e,t["max-height"],i),f=Ie(e,t["padding-bottom"],n),v=tn(e,t["border-bottom-width"],t["border-bottom-style"],n),g=Ot(e,t["margin-bottom"],n),p=Ot(e,t.bottom,i),E=ut(e,u,h),C=ut(e,v,f);if(a&&p&&c){var D=Ft(e,i,ut(e,c,ut(e,ut(e,a,E),C)));s?g?p=Ft(e,D,s):g=Ft(e,D,ut(e,p,s)):(D=Ft(e,D,p),g?s=Ft(e,D,g):g=s=Bi(e,D,new re(e,.5)))}else{s||(s=e.zero),g||(g=e.zero),a||p||c||(a=e.zero),a||c?a||p?c||p||(c=this.autoHeight,this.isAutoHeight=!0):a=e.zero:(c=this.autoHeight,this.isAutoHeight=!0);var y=Ft(e,i,ut(e,ut(e,s,E),ut(e,g,C)));this.isAutoHeight&&(d||(d=Ft(e,y,a||p)),this.vertical&&(Ot(e,t["column-width"],null)||Ot(e,t["column-count"],null))&&(c=d,this.isAutoHeight=!1)),a?c?p||(p=Ft(e,y,ut(e,a,c))):c=Ft(e,y,ut(e,p,a)):a=Ft(e,y,ut(e,p,c))}var N=Ie(e,t["snap-height"]||(this.parentInstance?this.parentInstance.style["snap-height"]:null),n);t.top=new Z(a),t["margin-top"]=new Z(s),t["border-top-width"]=new Z(u),t["padding-top"]=new Z(h),t.height=new Z(c),t["max-height"]=new Z(d||c),t["padding-bottom"]=new Z(f),t["border-bottom-width"]=new Z(v),t["margin-bottom"]=new Z(g),t.bottom=new Z(p),t["snap-height"]=new Z(N)},r.initColumns=function(){var e=this.pageBox.scope,t=this.style,n=Ot(e,t[this.vertical?"height":"width"],null),i=Ot(e,t["column-width"],n),a=Ot(e,t["column-count"],null),s=function(u,h,c){return h&&h!==b.normal?h.toExpr(u,null):null}(e,t["column-gap"]);s||(s=new Mn(e,1,"em")),i&&!a&&(a=new ii(e,"floor",[jr(e,ut(e,n,s),ut(e,i,s))]),a=new ii(e,"max",[e.one,a])),a||(a=e.one),i=Ft(e,jr(e,ut(e,n,s),a),s),t["column-width"]=new Z(i),t["column-count"]=new Z(a),t["column-gap"]=new Z(s)},r.depends=function(e,t,n){return this.style[e].toExpr(this.pageBox.scope,null).depend(t,n)},r.init=function(e){var t=this;e.registerInstance(this.pageBox.key,this);var n=this.pageBox.scope,i=this.style,a=this.parentInstance?this.parentInstance.getActiveRegions(e):null,s=Ys(this.cascaded,e,a,!1);this.vertical=Xs(s,e,!!this.parentInstance&&this.parentInstance.vertical),this.rtl=js(s,e,!!this.parentInstance&&this.parentInstance.rtl),qs(s,i,this.vertical,this.rtl,function(u,h){return h.value}),this.autoWidth=new Oe(n,function(){return t.calculatedWidth},"autoWidth"),this.autoHeight=new Oe(n,function(){return t.calculatedHeight},"autoHeight"),this.initHorizontal(),this.initVertical(),this.initColumns(),this.initEnabled()},r.getProp=function(e,t){var n=this.style[t];return n&&(n=Ki(e,n,t)),n},r.getPropAsNumber=function(e,t){var n=this.style[t];return n&&(n=Ki(e,n,t)),pe(n,e)},r.getSpecial=function(e,t){var n=ks(this.cascaded,t);if(n){for(var i=[],a=0;a<n.length;a++){var s=n[a].evaluate(e,"");s&&s!==ht&&i.push(s)}if(i.length)return i}return null},r.getActiveRegions=function(e){var t=this.getSpecial(e,"region-id");if(t){for(var n=[],i=0;i<t.length;i++)n[i]=t[i].toString();return n}return null},r.propagateProperty=function(e,t,n,i){this.propagatePropertyToElement(e,t.element,n,i)},r.propagatePropertyToElement=function(e,t,n,i){var a=this.getProp(e,n);a&&(a.isNumeric()&&Oa(a.unit)&&(a=Qr(a,e)),n==="font-family"&&(a=i.filterFontFamily(a)),T(t,n,a.toString()))},r.propagateDelayedProperty=function(e,t,n,i){var a=this.getProp(e,n);a&&i.push(new go(t.element,n,a))},r.assignLeftPosition=function(e,t){var n=this.getPropAsNumber(e,"left"),i=this.getPropAsNumber(e,"margin-left"),a=this.getPropAsNumber(e,"padding-left"),s=this.getPropAsNumber(e,"border-left-width"),u=this.getPropAsNumber(e,"width");t.setHorizontalPosition(n,u),T(t.element,"margin-left",i+"px"),T(t.element,"padding-left",a+"px"),T(t.element,"border-left-width",s+"px"),t.marginLeft=i,t.borderLeft=s,t.paddingLeft=a},r.assignRightPosition=function(e,t){var n=this.getPropAsNumber(e,"right"),i=this.getPropAsNumber(e,"snap-height"),a=this.getPropAsNumber(e,"margin-right"),s=this.getPropAsNumber(e,"padding-right"),u=this.getPropAsNumber(e,"border-right-width");if(T(t.element,"margin-right",a+"px"),T(t.element,"padding-right",s+"px"),T(t.element,"border-right-width",u+"px"),t.marginRight=a,t.borderRight=u,this.vertical&&i>0){var h=n+t.getInsetRight(),c=h-Math.floor(h/i)*i;c>0&&(t.snapOffsetX=i-c,s+=t.snapOffsetX)}t.paddingRight=s,t.snapWidth=i},r.assignTopPosition=function(e,t){var n=this.getPropAsNumber(e,"snap-height"),i=this.getPropAsNumber(e,"top"),a=this.getPropAsNumber(e,"margin-top"),s=this.getPropAsNumber(e,"padding-top"),u=this.getPropAsNumber(e,"border-top-width");if(t.top=i,t.marginTop=a,t.borderTop=u,t.snapHeight=n,!this.vertical&&n>0){var h=i+t.getInsetTop(),c=h-Math.floor(h/n)*n;c>0&&(t.snapOffsetY=n-c,s+=t.snapOffsetY)}t.paddingTop=s,T(t.element,"top",i+"px"),T(t.element,"margin-top",a+"px"),T(t.element,"padding-top",s+"px"),T(t.element,"border-top-width",u+"px")},r.assignBottomPosition=function(e,t){var n=this.getPropAsNumber(e,"margin-bottom"),i=this.getPropAsNumber(e,"padding-bottom"),a=this.getPropAsNumber(e,"border-bottom-width"),s=this.getPropAsNumber(e,"height")-t.snapOffsetY;T(t.element,"height",s+"px"),T(t.element,"margin-bottom",n+"px"),T(t.element,"padding-bottom",i+"px"),T(t.element,"border-bottom-width",a+"px"),t.height=s-t.snapOffsetY,t.marginBottom=n,t.borderBottom=a,t.paddingBottom=i},r.assignBeforePosition=function(e,t){this.vertical?this.assignRightPosition(e,t):this.assignTopPosition(e,t)},r.assignAfterPosition=function(e,t){this.vertical?this.assignLeftPosition(e,t):this.assignBottomPosition(e,t)},r.assignStartEndPosition=function(e,t){this.vertical?(this.assignTopPosition(e,t),this.assignBottomPosition(e,t)):(this.assignRightPosition(e,t),this.assignLeftPosition(e,t))},r.sizeWithMaxHeight=function(e,t){T(t.element,"border-top-width","0px");var n=this.getPropAsNumber(e,"max-height");this.isTopDependentOnAutoHeight?t.setVerticalPosition(0,n):(this.assignTopPosition(e,t),t.height=n-=t.snapOffsetY,T(t.element,"height",n+"px"))},r.sizeWithMaxWidth=function(e,t){T(t.element,"border-left-width","0px");var n=this.getPropAsNumber(e,"max-width");if(this.isRightDependentOnAutoWidth)t.setHorizontalPosition(0,n);else{this.assignRightPosition(e,t),t.width=n-=t.snapOffsetX;var i=this.getPropAsNumber(e,"right");T(t.element,"right",i+"px"),T(t.element,"width",n+"px")}},r.prepareContainer=function(e,t,n,i,a){this.parentInstance&&this.vertical==this.parentInstance.vertical||T(t.element,"writing-mode",this.vertical?"vertical-rl":"horizontal-tb"),(this.vertical?this.isAutoWidth:this.isAutoHeight)?this.vertical?this.sizeWithMaxWidth(e,t):this.sizeWithMaxHeight(e,t):(this.assignBeforePosition(e,t),this.assignAfterPosition(e,t)),(this.vertical?this.isAutoHeight:this.isAutoWidth)?this.vertical?this.sizeWithMaxHeight(e,t):this.sizeWithMaxWidth(e,t):this.assignStartEndPosition(e,t);for(var s=0;s<Gu.length;s++)this.propagateProperty(e,t,Gu[s],i)},r.transferContentProps=function(e,t,n,i){for(var a=0;a<Xu.length;a++)this.propagateProperty(e,t,Xu[a],i)},r.transferSinglUriContentProps=function(e,t,n){for(var i=0;i<ju.length;i++)this.propagatePropertyToElement(e,t,ju[i],n)},r.finishContainer=function(e,t,n,i,a,s,u){this.vertical?this.calculatedWidth=t.computedBlockSize+t.snapOffsetX:this.calculatedHeight=t.computedBlockSize+t.snapOffsetY;var h=(this.vertical||!i)&&this.isAutoHeight,c=(!this.vertical||!i)&&this.isAutoWidth,d=null;if((c||h)&&(c&&T(t.element,"width","auto"),h&&T(t.element,"height","auto"),d=s.getElementClientRect(i?i.element:t.element),c&&(this.calculatedWidth=Math.ceil(d.right-d.left-t.paddingLeft-t.borderLeft-t.paddingRight-t.borderRight),this.vertical&&(this.calculatedWidth+=t.snapOffsetX)),h&&(this.calculatedHeight=d.bottom-d.top-t.paddingTop-t.borderTop-t.paddingBottom-t.borderBottom,this.vertical||(this.calculatedHeight+=t.snapOffsetY))),(this.vertical?this.isAutoHeight:this.isAutoWidth)&&this.assignStartEndPosition(e,t),(this.vertical?this.isAutoWidth:this.isAutoHeight)&&((this.vertical?this.isRightDependentOnAutoWidth:this.isTopDependentOnAutoHeight)&&this.assignBeforePosition(e,t),this.assignAfterPosition(e,t)),a>1){var f=this.getPropAsNumber(e,"column-rule-width"),v=this.getProp(e,"column-rule-style"),g=this.getProp(e,"column-rule-color");if(f>0&&v&&v!=b.none&&g!=b.transparent)for(var p=this.getPropAsNumber(e,"column-gap"),E=this.vertical?t.height:t.width,C=this.vertical?"border-top":"border-left",D=1;D<a;D++){var y=(E+p)*D/a-p/2+t.paddingLeft-f/2,N=t.height+t.paddingTop+t.paddingBottom,x=t.element.ownerDocument.createElement("div");T(x,"position","absolute"),T(x,this.vertical?"left":"top","0px"),T(x,this.vertical?"top":"left",y+"px"),T(x,this.vertical?"height":"width","0px"),T(x,this.vertical?"width":"height",N+"px"),T(x,C,f+"px "+v.toString()+(g?" "+g.toString():"")),t.element.insertBefore(x,t.element.firstChild)}}for(var F=0;F<Wu.length;F++)this.propagateProperty(e,t,Wu[F],u);for(var k=0;k<Yu.length;k++)this.propagateDelayedProperty(e,t,Yu[k],n.delayedItems)},r.applyCascadeAndInit=function(e,t){var n=this.cascaded,i=this.pageBox.specified;for(var a in i)nr(a)&&Je(n,a,Be(i,a));if(this.pageBox.pseudoName==Ku)for(var s in t)(s.match(/^background-/)||s=="writing-mode")&&(n[s]=t[s]);if(this.pageBox.pseudoName=="layout-host")for(var u in t)u.match(/^background-/)||u=="writing-mode"||(n[u]=t[u]);e.pushRule(this.pageBox.classes,null,n),n.content&&(n.content=n.content.filterValue(new Ao(e,null,e.counterResolver))),this.init(e.context);for(var h,c=B(this.pageBox.children);!(h=c()).done;)h.value.createInstance(this).applyCascadeAndInit(e,t);e.popRule()},r.resolveAutoSizing=function(e){this.isAutoWidth&&(this.isRightDependentOnAutoWidth=this.depends("right",this.autoWidth,e)||this.depends("margin-right",this.autoWidth,e)||this.depends("border-right-width",this.autoWidth,e)||this.depends("padding-right",this.autoWidth,e)),this.isAutoHeight&&(this.isTopDependentOnAutoHeight=this.depends("top",this.autoHeight,e)||this.depends("margin-top",this.autoHeight,e)||this.depends("border-top-width",this.autoHeight,e)||this.depends("padding-top",this.autoHeight,e));for(var t,n=B(this.children);!(t=n()).done;)t.value.resolveAutoSizing(e)},o}(),Gu=["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"],Wu=["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"],Xu=["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"],ju=["width","height","image-resolution","object-fit","object-position"],Yu=["transform","transform-origin"],Ku="background-host",qd=function(o){function r(e){return o.call(this,null,e)||this}return w(r,o),r.prototype.applyCascadeAndInit=function(e,t){o.prototype.applyCascadeAndInit.call(this,e,t),this.children.sort(function(n,i){return i.pageBox.specificity-n.pageBox.specificity||n.pageBox.index-i.pageBox.index})},r}(mr),qo=function(o){function r(t,n){var i;return(i=o.call(this,t,n)||this).pageMasterInstance=xt(i),i}w(r,o);var e=r.prototype;return e.boxSpecificEnabled=function(t){var n=this.pageBox.pageMaster;return n.condition&&(t=We(n.scope,t,n.condition)),t},e.adjustPageLayout=function(t,n,i){},r}(mr),Qd=function(o){function r(e,t){var n;return(n=o.call(this,e,t)||this).pageMasterInstance=e.pageMasterInstance,n}return w(r,o),r}(mr),Er=function(o){function r(t,n){var i;return(i=o.call(this,t,n)||this).pageMasterInstance=t.pageMasterInstance,i}w(r,o);var e=r.prototype;return e.processPartitionList=function(t,n,i){var a=null;if(n instanceof Ui&&(a=[n]),n instanceof Te&&(a=n.values),a){for(var s=this.pageBox.scope,u=0;u<a.length;u++)if(a[u]instanceof Ui){var h=_r(a[u].name,"enabled"),c=new ie(s,h);i&&(c=new dn(s,c)),t=We(s,t,c)}}return t},e.boxSpecificEnabled=function(t){var n=this.pageBox.scope,i=this.style,a=zu(n,i.required,n._false)!==n._false;if(a||this.isAutoHeight){var s=function(c,d,f){return d?d.toExpr(c,c.zero):new re(c,"body")}(n,i["flow-from"]);t=We(n,t,new ii(n,"has-content",[s]))}if(t=this.processPartitionList(t,i["required-partitions"],!1),t=this.processPartitionList(t,i["conflicting-partitions"],!0),a){var u=this.pageMasterInstance.style.enabled,h=u?u.toExpr(n,null):n._true;h=We(n,h,t),this.pageMasterInstance.style.enabled=new Z(h)}return t},e.prepareContainer=function(t,n,i,a,s){T(n.element,"overflow","hidden"),o.prototype.prepareContainer.call(this,t,n,i,a,s)},r}(mr),Qo=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t,n,!1)||this).target=void 0,s.validatorSet=void 0,s.target=i,s.validatorSet=a,s}w(r,o);var e=r.prototype;return e.property=function(t,n,i){this.validatorSet.validatePropertyAndHandleShorthand(t,n,i,this)},e.unknownProperty=function(t,n){this.report("E_INVALID_PROPERTY "+t+": "+n.toString())},e.invalidPropertyValue=function(t,n){this.report("E_INVALID_PROPERTY_VALUE "+t+": "+n.toString())},e.simpleProperty=function(t,n,i){this.target.specified[t]=new Dt(n,i?50331648:67108864)},r}(ci),qu=function(o){function r(e,t,n,i){return o.call(this,e,t,n,i)||this}return w(r,o),r}(Qo),Zd=function(o){function r(t,n,i,a){var s;return s=o.call(this,t,n,i,a)||this,i.specified.width=new Dt(Ka,0),i.specified.height=new Dt(Ka,0),s}w(r,o);var e=r.prototype;return e.startPartitionRule=function(t,n,i){var a=new vr(this.scope,t,n,i,this.target),s=new qu(this.scope,this.owner,a,this.validatorSet);this.owner.pushHandler(s)},e.startPartitionGroupRule=function(t,n,i){var a=new Vu(this.scope,t,n,i,this.target),s=new r(this.scope,this.owner,a,this.validatorSet);this.owner.pushHandler(s)},r}(Qo),$d=function(o){function r(t,n,i,a){return o.call(this,t,n,i,a)||this}w(r,o);var e=r.prototype;return e.startPartitionRule=function(t,n,i){var a=new vr(this.scope,t,n,i,this.target),s=new qu(this.scope,this.owner,a,this.validatorSet);this.owner.pushHandler(s)},e.startPartitionGroupRule=function(t,n,i){var a=new Vu(this.scope,t,n,i,this.target),s=new Zd(this.scope,this.owner,a,this.validatorSet);this.owner.pushHandler(s)},r}(Qo);function Qu(o){var r=o["writing-mode"],e=o.direction;return e=e&&e.value,(r=r&&r.value)===b.vertical_lr||r!==b.vertical_rl&&e!==b.rtl?R.PageProgression.LTR:R.PageProgression.RTL}var Nn,Ee,Jd={a10:{width:new O(26,"mm"),height:new O(37,"mm")},a9:{width:new O(37,"mm"),height:new O(52,"mm")},a8:{width:new O(52,"mm"),height:new O(74,"mm")},a7:{width:new O(74,"mm"),height:new O(105,"mm")},a6:{width:new O(105,"mm"),height:new O(148,"mm")},a5:{width:new O(148,"mm"),height:new O(210,"mm")},a4:{width:new O(210,"mm"),height:new O(297,"mm")},a3:{width:new O(297,"mm"),height:new O(420,"mm")},a2:{width:new O(420,"mm"),height:new O(594,"mm")},a1:{width:new O(594,"mm"),height:new O(841,"mm")},a0:{width:new O(841,"mm"),height:new O(1189,"mm")},b10:{width:new O(31,"mm"),height:new O(44,"mm")},b9:{width:new O(44,"mm"),height:new O(62,"mm")},b8:{width:new O(62,"mm"),height:new O(88,"mm")},b7:{width:new O(88,"mm"),height:new O(125,"mm")},b6:{width:new O(125,"mm"),height:new O(176,"mm")},b5:{width:new O(176,"mm"),height:new O(250,"mm")},b4:{width:new O(250,"mm"),height:new O(353,"mm")},b3:{width:new O(353,"mm"),height:new O(500,"mm")},b2:{width:new O(500,"mm"),height:new O(707,"mm")},b1:{width:new O(707,"mm"),height:new O(1e3,"mm")},b0:{width:new O(1e3,"mm"),height:new O(1414,"mm")},c10:{width:new O(28,"mm"),height:new O(40,"mm")},c9:{width:new O(40,"mm"),height:new O(57,"mm")},c8:{width:new O(57,"mm"),height:new O(81,"mm")},c7:{width:new O(81,"mm"),height:new O(114,"mm")},c6:{width:new O(114,"mm"),height:new O(162,"mm")},c5:{width:new O(162,"mm"),height:new O(229,"mm")},c4:{width:new O(229,"mm"),height:new O(324,"mm")},c3:{width:new O(324,"mm"),height:new O(458,"mm")},c2:{width:new O(458,"mm"),height:new O(648,"mm")},c1:{width:new O(648,"mm"),height:new O(917,"mm")},c0:{width:new O(917,"mm"),height:new O(1297,"mm")},"jis-b10":{width:new O(32,"mm"),height:new O(45,"mm")},"jis-b9":{width:new O(45,"mm"),height:new O(64,"mm")},"jis-b8":{width:new O(64,"mm"),height:new O(91,"mm")},"jis-b7":{width:new O(91,"mm"),height:new O(128,"mm")},"jis-b6":{width:new O(128,"mm"),height:new O(182,"mm")},"jis-b5":{width:new O(182,"mm"),height:new O(257,"mm")},"jis-b4":{width:new O(257,"mm"),height:new O(364,"mm")},"jis-b3":{width:new O(364,"mm"),height:new O(515,"mm")},"jis-b2":{width:new O(515,"mm"),height:new O(728,"mm")},"jis-b1":{width:new O(728,"mm"),height:new O(1030,"mm")},"jis-b0":{width:new O(1030,"mm"),height:new O(1456,"mm")},letter:{width:new O(8.5,"in"),height:new O(11,"in")},legal:{width:new O(8.5,"in"),height:new O(14,"in")},ledger:{width:new O(11,"in"),height:new O(17,"in")}},tf=new O(.24,"pt"),ef=new O(3,"mm"),nf=new O(10,"mm"),rf=new O(13,"mm");function Cr(o){var r={width:oi,height:ai,bleed:Gt,bleedOffset:Gt},e=o.size;if(e&&e.value!==b.auto){var t,n,i=e.value;if(i.isSpaceList()?(t=i.values[0],n=i.values[1]):(t=i,n=null),t.isNumeric())r.width=t,r.height=n||t;else{var a=t.name&&Jd[t.name.toLowerCase()];a&&(n&&n===b.landscape?(r.width=a.height,r.height=a.width):(r.width=a.width,r.height=a.height))}}var s=o.marks;s&&s.value!==b.none&&(r.bleedOffset=rf);var u=o.bleed;return u&&u.value!==b.auto?u.value&&u.value.isNumeric()&&(r.bleed=u.value):s&&(s.value.isSpaceList()?s.value.values.some(function(h){return h===b.crop}):s.value===b.crop)&&(r.bleed=new O(6,"pt")),r}function Zu(o,r){var e={},t=o.bleed.num*r.queryUnitSize(o.bleed.unit,!1),n=o.bleedOffset.num*r.queryUnitSize(o.bleedOffset.unit,!1),i=t+n,a=o.width;e.pageWidth=a===oi?r.pref.defaultPaperSize?r.pref.defaultPaperSize.width*r.queryUnitSize("px",!1):(r.pref.spreadView?Math.floor(r.viewportWidth/2)-r.pref.pageBorder:r.viewportWidth)-2*i:a.num*r.queryUnitSize(a.unit,!1);var s=o.height;return e.pageHeight=s===ai?r.pref.defaultPaperSize?r.pref.defaultPaperSize.height*r.queryUnitSize("px",!1):r.viewportHeight-2*i:s.num*r.queryUnitSize(s.unit,!1),e.bleed=t,e.bleedOffset=n,e.cropOffset=i,e}function $u(o,r,e){var t=o.createElementNS(U.SVG,"svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.position="absolute",t}function Fi(o,r,e){var t=o.createElementNS(U.SVG,e=e||"polyline");return t.setAttribute("stroke","black"),t.setAttribute("stroke-width",r),t.setAttribute("fill","none"),t}(function(o){o.TOP_LEFT="top left",o.TOP_RIGHT="top right",o.BOTTOM_LEFT="bottom left",o.BOTTOM_RIGHT="bottom right"})(Nn||(Nn={})),function(o){o.TOP="top",o.BOTTOM="bottom",o.LEFT="left",o.RIGHT="right"}(Ee||(Ee={}));var kn,Lt,Zo=(kn={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(o){kn["margin-"+o]=!0,kn["padding-"+o]=!0,kn["border-"+o+"-width"]=!0,kn["border-"+o+"-style"]=!0,kn["border-"+o+"-color"]=!0}),kn);(function(o){o.START="start",o.CENTER="center",o.END="end"})(Lt||(Lt={}));var Dr,$o={"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:Lt.START},"top-center":{order:3,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Lt.CENTER},"top-right":{order:4,isInTopRow:!0,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Lt.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:Lt.START},"right-middle":{order:7,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:Lt.CENTER},"right-bottom":{order:8,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!1,isInRightColumn:!0,positionAlongVariableDimension:Lt.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:Lt.END},"bottom-center":{order:11,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Lt.CENTER},"bottom-left":{order:12,isInTopRow:!1,isInBottomRow:!0,isInLeftColumn:!1,isInRightColumn:!1,positionAlongVariableDimension:Lt.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:Lt.END},"left-middle":{order:15,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!0,isInRightColumn:!1,positionAlongVariableDimension:Lt.CENTER},"left-top":{order:16,isInTopRow:!1,isInBottomRow:!1,isInLeftColumn:!0,isInRightColumn:!1,positionAlongVariableDimension:Lt.START}},of=(Dr=$o,Object.keys(Dr).sort(function(o,r){return Dr[o].order-Dr[r].order})),af=function(o){function r(t,n,i){var a;(a=o.call(this,t,null,"vivliostyle-page-rule-master",[],n,null,0)||this).bodyPartitionKey=void 0,a.pageMarginBoxes={};var s=Cr(i),u=new sf(a.scope,xt(a),i,s);return a.bodyPartitionKey=u.key,a.createPageMarginBoxes(i),a.applySpecified(i,s),a}w(r,o);var e=r.prototype;return e.createPageMarginBoxes=function(t){var n=this,i=t._marginBoxes;i&&of.forEach(function(a){i[a]&&(n.pageMarginBoxes[a]=new uf(n.scope,n,a,t))})},e.applySpecified=function(t,n){for(var i in this.specified.position=new Dt(b.relative,0),this.specified.width=new Dt(n.width,0),this.specified.height=new Dt(n.height,0),t)Zo[i]||i==="background-clip"||(this.specified[i]=t[i])},e.createInstance=function(t){return new Jo(t,this)},r}(Uu),sf=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t,null,null,[],n)||this).pageSize=void 0,s.pageSize=a,s.specified["z-index"]=new Dt(new xn(0),0),s.applySpecified(i),s}w(r,o);var e=r.prototype;return e.applySpecified=function(t){for(var n in this.specified["flow-from"]=new Dt(_("body"),0),this.specified.position=new Dt(b.absolute,0),this.specified.overflow=new Dt(b.visible,0),Zo)Zo.hasOwnProperty(n)&&(this.specified[n]=t[n])},e.createInstance=function(t){return new el(t,this)},r}(vr),uf=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t,null,null,[],n)||this).marginBoxName=void 0,s.marginBoxName=i,s.applySpecified(a),s}w(r,o);var e=r.prototype;return e.applySpecified=function(t){var n=t._marginBoxes[this.marginBoxName];for(var i in t){var a=n[i];(Ts[i]||a&&a.value===b.inherit)&&(this.specified[i]=t[i])}for(var s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var u=n[s];u&&u.value!==b.inherit&&(this.specified[s]=u)}},e.createInstance=function(t){return new hf(t,this)},r}(vr),Jo=function(o){function r(t,n){var i;return(i=o.call(this,t,n)||this).pageAreaDimension=null,i.pageMarginBoxInstances={},i}w(r,o);var e=r.prototype;return e.applyCascadeAndInit=function(t,n){var i=this.cascaded;for(var a in n)if(Object.prototype.hasOwnProperty.call(n,a))switch(a){case"writing-mode":case"direction":i[a]=n[a]}o.prototype.applyCascadeAndInit.call(this,t,n)},e.initHorizontal=function(){var t=this.style;t.left=Gt,t["margin-left"]=Gt,t["border-left-width"]=Gt,t["padding-left"]=Gt,t["padding-right"]=Gt,t["border-right-width"]=Gt,t["margin-right"]=Gt,t.right=Gt},e.initVertical=function(){var t=this.style;t.top=Gt,t["margin-top"]=Gt,t["border-top-width"]=Gt,t["padding-top"]=Gt,t["padding-bottom"]=Gt,t["border-bottom-width"]=Gt,t["margin-bottom"]=Gt,t.bottom=Gt},e.setPageAreaDimension=function(t){this.pageAreaDimension=t;var n=this.style;n.width=new Z(t.borderBoxWidth),n.height=new Z(t.borderBoxHeight),n["padding-left"]=new Z(t.marginLeft),n["padding-right"]=new Z(t.marginRight),n["padding-top"]=new Z(t.marginTop),n["padding-bottom"]=new Z(t.marginBottom)},e.adjustPageLayout=function(t,n,i){var a=n.marginBoxes,s={start:this.pageAreaDimension.marginLeft,end:this.pageAreaDimension.marginRight,extent:this.pageAreaDimension.borderBoxWidth},u={start:this.pageAreaDimension.marginTop,end:this.pageAreaDimension.marginBottom,extent:this.pageAreaDimension.borderBoxHeight};this.sizeMarginBoxesAlongVariableDimension(a.top,!0,s,t,i),this.sizeMarginBoxesAlongVariableDimension(a.bottom,!0,s,t,i),this.sizeMarginBoxesAlongVariableDimension(a.left,!1,u,t,i),this.sizeMarginBoxesAlongVariableDimension(a.right,!1,u,t,i)},e.sizeMarginBoxesAlongVariableDimension=function(t,n,i,a,s){var u=Lt.START,h=Lt.CENTER,c=Lt.END,d=this.pageBox.scope,f={},v={},g={};for(var p in t){var E=$o[p];if(E){var C=t[p],D=this.pageMarginBoxInstances[p],y=new Ju(C,D.style,n,d,s);f[E.positionAlongVariableDimension]=C,v[E.positionAlongVariableDimension]=D,g[E.positionAlongVariableDimension]=y}}var N={start:i.start.evaluate(a),end:i.end.evaluate(a),extent:i.extent.evaluate(a)},x=this.getSizesOfMarginBoxesAlongVariableDimension(g,N.extent),F=!1,k={};Object.keys(f).forEach(function(W){var G=W,X=Ot(d,v[G].style[n?"max-width":"max-height"],i.extent);if(X){var it=X.evaluate(a);if(x[G]>it){var lt=g[G]=new tl(f[G],v[G].style,n,d,s,it);k[G]=lt.getOuterSize(),F=!0}}}),F&&(x=this.getSizesOfMarginBoxesAlongVariableDimension(g,N.extent),F=!1,[u,h,c].forEach(function(W){x[W]=k[W]||x[W]}));var H={};Object.keys(f).forEach(function(W){var G=W,X=Ot(d,v[G].style[n?"min-width":"min-height"],i.extent);if(X){var it=X.evaluate(a);if(x[G]<it){var lt=g[G]=new tl(f[G],v[G].style,n,d,s,it);H[G]=lt.getOuterSize(),F=!0}}}),F&&(x=this.getSizesOfMarginBoxesAlongVariableDimension(g,N.extent),[u,h,c].forEach(function(W){x[W]=H[W]||x[W]}));var K=N.start+N.extent,q=N.start+(N.start+N.extent);[u,h,c].forEach(function(W){var G=x[W];if(G){var X=f[W],it=0;switch(W){case u:it=n?X.left:X.top;break;case h:it=(q-G)/2;break;case c:it=K-G}n?X.setHorizontalPosition(it,G-X.getInsetLeft()-X.getInsetRight()):X.setVerticalPosition(it,G-X.getInsetTop()-X.getInsetBottom())}})},e.getSizesOfMarginBoxesAlongVariableDimension=function(t,n){var i=t[Lt.START],a=t[Lt.CENTER],s=t[Lt.END],u={};if(a){var h=[i,s].filter(function(g){return g}),c=h.length?new lf(h):null,d=this.distributeAutoMarginBoxSizes(a,c,n);d.xSize&&(u[Lt.CENTER]=d.xSize);var f=(n-(d.xSize||a.getOuterSize()))/2;i&&i.hasAutoSize()&&(u[Lt.START]=f),s&&s.hasAutoSize()&&(u[Lt.END]=f)}else{var v=this.distributeAutoMarginBoxSizes(i,s,n);v.xSize&&(u[Lt.START]=v.xSize),v.ySize&&(u[Lt.END]=v.ySize)}return u},e.distributeAutoMarginBoxSizes=function(t,n,i){var a={xSize:null,ySize:null};if(t&&n)if(t.hasAutoSize()&&n.hasAutoSize()){var s=t.getOuterMaxContentSize(),u=n.getOuterMaxContentSize();if(s>0&&u>0){var h=s+u;if(h<i)a.xSize=i*s/h;else{var c=t.getOuterMinContentSize(),d=c+n.getOuterMinContentSize();d<i?a.xSize=c+(i-d)*(s-c)/(h-d):d>0&&(a.xSize=i*c/d)}a.xSize>0&&(a.ySize=i-a.xSize)}else s>0?a.xSize=i:u>0&&(a.ySize=i)}else t.hasAutoSize()?a.xSize=Math.max(i-n.getOuterSize(),0):n.hasAutoSize()&&(a.ySize=Math.max(i-t.getOuterSize(),0));else t?t.hasAutoSize()&&(a.xSize=i):n&&n.hasAutoSize()&&(a.ySize=i);return a},e.prepareContainer=function(t,n,i,a,s){o.prototype.prepareContainer.call(this,t,n,i,a,s),n.element.setAttribute("data-vivliostyle-page-box",!0)},r}(qo),Ju=function(){function o(e,t,n,i,a){this.container=void 0,this.isHorizontal=void 0,this.clientLayout=void 0,this.hasAutoSize_=void 0,this.size=null,this.container=e,this.isHorizontal=n,this.clientLayout=a,this.hasAutoSize_=!Ot(i,t[n?"width":"height"],new Mn(i,0,"px"))}var r=o.prototype;return r.hasAutoSize=function(){return this.hasAutoSize_},r.getSize=function(){return this.size||(this.size=Fo(this.clientLayout,this.container.element,this.isHorizontal?[Pt.MAX_CONTENT_WIDTH,Pt.MIN_CONTENT_WIDTH]:[Pt.MAX_CONTENT_HEIGHT,Pt.MIN_CONTENT_HEIGHT])),this.size},r.getOuterMaxContentSize=function(){var e=this.getSize();return this.isHorizontal?this.container.getInsetLeft()+e[Pt.MAX_CONTENT_WIDTH]+this.container.getInsetRight():this.container.getInsetTop()+e[Pt.MAX_CONTENT_HEIGHT]+this.container.getInsetBottom()},r.getOuterMinContentSize=function(){var e=this.getSize();return this.isHorizontal?this.container.getInsetLeft()+e[Pt.MIN_CONTENT_WIDTH]+this.container.getInsetRight():this.container.getInsetTop()+e[Pt.MIN_CONTENT_HEIGHT]+this.container.getInsetBottom()},r.getOuterSize=function(){return this.isHorizontal?this.container.getInsetLeft()+this.container.width+this.container.getInsetRight():this.container.getInsetTop()+this.container.height+this.container.getInsetBottom()},o}(),lf=function(){function o(e){this.params=void 0,this.params=e}var r=o.prototype;return r.hasAutoSize=function(){return this.params.some(function(e){return e.hasAutoSize()})},r.getOuterMaxContentSize=function(){var e=this.params.map(function(t){return t.getOuterMaxContentSize()});return Math.max.apply(null,e)*e.length},r.getOuterMinContentSize=function(){var e=this.params.map(function(t){return t.getOuterMinContentSize()});return Math.max.apply(null,e)*e.length},r.getOuterSize=function(){var e=this.params.map(function(t){return t.getOuterSize()});return Math.max.apply(null,e)*e.length},o}(),tl=function(o){function r(t,n,i,a,s,u){var h;return(h=o.call(this,t,n,i,a,s)||this).fixedSize=void 0,h.fixedSize=u,h}w(r,o);var e=r.prototype;return e.hasAutoSize=function(){return!1},e.getOuterMaxContentSize=function(){return this.getOuterSize()},e.getOuterMinContentSize=function(){return this.getOuterSize()},e.getOuterSize=function(){return this.isHorizontal?this.container.getInsetLeft()+this.fixedSize+this.container.getInsetRight():this.container.getInsetTop()+this.fixedSize+this.container.getInsetBottom()},r}(Ju),el=function(o){function r(t,n){var i;return(i=o.call(this,t,n)||this).borderBoxWidth=null,i.borderBoxHeight=null,i.marginTop=null,i.marginRight=null,i.marginBottom=null,i.marginLeft=null,i}w(r,o);var e=r.prototype;return e.applyCascadeAndInit=function(t,n){var i=this.cascaded;for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(a.match(/^column.*$/)||a.match(/^background-/))&&(i[a]=n[a]);o.prototype.applyCascadeAndInit.call(this,t,n),this.parentInstance.setPageAreaDimension({borderBoxWidth:this.borderBoxWidth,borderBoxHeight:this.borderBoxHeight,marginTop:this.marginTop,marginRight:this.marginRight,marginBottom:this.marginBottom,marginLeft:this.marginLeft})},e.initHorizontal=function(){var t=this.resolvePageBoxDimensions({start:"left",end:"right",extent:"width"});this.borderBoxWidth=t.borderBoxExtent,this.marginLeft=t.marginStart,this.marginRight=t.marginEnd},e.initVertical=function(){var t=this.resolvePageBoxDimensions({start:"top",end:"bottom",extent:"height"});this.borderBoxHeight=t.borderBoxExtent,this.marginTop=t.marginStart,this.marginBottom=t.marginEnd},e.resolvePageBoxDimensions=function(t){var n=this.style,i=this.pageBox.scope,a=t.start,s=t.end,u=t.extent,h=this.pageBox.pageSize[u].toExpr(i,null),c=Ot(i,n[u],h),d=Ot(i,n["margin-"+a],h),f=Ot(i,n["margin-"+s],h),v=Ie(i,n["padding-"+a],h),g=Ie(i,n["padding-"+s],h),p=tn(i,n["border-"+a+"-width"],n["border-"+a+"-style"],h),E=tn(i,n["border-"+s+"-width"],n["border-"+s+"-style"],h),C=Ft(i,h,ut(i,ut(i,p,v),ut(i,E,g)));return c?(C=Ft(i,C,c),d||f?d?f=Ft(i,C,d):d=Ft(i,C,f):f=d=Bi(i,C,new re(i,.5))):(d||(d=i.zero),f||(f=i.zero),c=Ft(i,C,ut(i,d,f))),n[a]=new Z(d),n[s]=new Z(f),n["margin-"+a]=Gt,n["margin-"+s]=Gt,n["padding-"+a]=new Z(v),n["padding-"+s]=new Z(g),n["border-"+a+"-width"]=new Z(p),n["border-"+s+"-width"]=new Z(E),n[u]=new Z(c),n["max-"+u]=new Z(c),{borderBoxExtent:Ft(i,h,ut(i,d,f)),marginStart:d,marginEnd:f}},e.prepareContainer=function(t,n,i,a,s){o.prototype.prepareContainer.call(this,t,n,i,a,s),i.pageAreaElement=n.element,t.pageAreaWidth=parseFloat(i.pageAreaElement.style.width),t.pageAreaHeight=parseFloat(i.pageAreaElement.style.height)},r}(Er),hf=function(o){function r(t,n){var i;(i=o.call(this,t,n)||this).boxInfo=void 0,i.suppressEmptyBoxGeneration=!0;var a=n.marginBoxName;return i.boxInfo=$o[a],t.pageMarginBoxInstances[a]=xt(i),i}w(r,o);var e=r.prototype;return e.prepareContainer=function(t,n,i,a,s){this.applyVerticalAlign(t,n.element),o.prototype.prepareContainer.call(this,t,n,i,a,s)},e.applyVerticalAlign=function(t,n){T(n,"display","flex");var i=this.getProp(t,"vertical-align"),a=null;i===_("middle")?a="center":i===_("top")?a="flex-start":i===_("bottom")&&(a="flex-end"),a&&(T(n,"flex-flow",this.vertical?"row":"column"),T(n,"justify-content",a))},e.positionAlongVariableDimension=function(t,n){var i=this.style,a=this.pageBox.scope,s=t.start,u=t.end,h=s==="left",c=h?n.borderBoxWidth:n.borderBoxHeight,d=Ot(a,i[t.extent],c),f=h?n.marginLeft:n.marginTop;if(this.boxInfo.positionAlongVariableDimension===Lt.START)i[s]=new Z(f);else if(d){var v=Ie(a,i["margin-"+s],c),g=Ie(a,i["margin-"+u],c),p=Ie(a,i["padding-"+s],c),E=Ie(a,i["padding-"+u],c),C=tn(a,i["border-"+s+"-width"],i["border-"+s+"-style"],c),D=tn(a,i["border-"+u+"-width"],i["border-"+u+"-style"],c),y=ut(a,d,ut(a,ut(a,p,E),ut(a,ut(a,C,D),ut(a,v,g))));switch(this.boxInfo.positionAlongVariableDimension){case Lt.CENTER:i[s]=new Z(ut(a,f,jr(a,Ft(a,c,y),new re(a,2))));break;case Lt.END:i[s]=new Z(Ft(a,ut(a,f,c),y))}}},e.positionAndSizeAlongFixedDimension=function(t,n){var i=this.style,a=this.pageBox.scope,s=t.inside,u=t.outside,h=t.extent,c=n["margin"+u.charAt(0).toUpperCase()+u.substring(1)],d=Hu(a,i["margin-"+s],c),f=Hu(a,i["margin-"+u],c),v=Ie(a,i["padding-"+s],c),g=Ie(a,i["padding-"+u],c),p=tn(a,i["border-"+s+"-width"],i["border-"+s+"-style"],c),E=tn(a,i["border-"+u+"-width"],i["border-"+u+"-style"],c),C=Ot(a,i[h],c),D=null;function y(N){if(D)return D;D={extent:C?C.evaluate(N):null,marginInside:d?d.evaluate(N):null,marginOutside:f?f.evaluate(N):null};var x=c.evaluate(N),F=0;return[p,v,g,E].forEach(function(k){k&&(F+=k.evaluate(N))}),(D.marginInside===null||D.marginOutside===null)&&F+D.extent+D.marginInside+D.marginOutside>x&&(D.marginInside===null&&(D.marginInside=0),D.marginOutside===null&&(D.marginOutside=0)),D.extent!==null&&D.marginInside!==null&&D.marginOutside!==null&&(D.marginOutside=null),D.extent===null&&D.marginInside!==null&&D.marginOutside!==null?D.extent=x-F-D.marginInside-D.marginOutside:D.extent!==null&&D.marginInside===null&&D.marginOutside!==null?D.marginInside=x-F-D.extent-D.marginOutside:D.extent!==null&&D.marginInside!==null&&D.marginOutside===null?D.marginOutside=x-F-D.extent-D.marginInside:D.extent===null?(D.marginInside=D.marginOutside=0,D.extent=x-F):D.marginInside=D.marginOutside=(x-F-D.extent)/2,D}i[h]=new Z(new Oe(a,function(){var N=y(this).extent;return N===null?0:N},h)),i["margin-"+s]=new Z(new Oe(a,function(){var N=y(this).marginInside;return N===null?0:N},"margin-"+s)),i["margin-"+u]=new Z(new Oe(a,function(){var N=y(this).marginOutside;return N===null?0:N},"margin-"+u)),s==="left"?i.left=new Z(ut(a,n.marginLeft,n.borderBoxWidth)):s==="top"&&(i.top=new Z(ut(a,n.marginTop,n.borderBoxHeight)))},e.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)},e.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)},e.finishContainer=function(t,n,i,a,s,u,h){o.prototype.finishContainer.call(this,t,n,i,a,s,u,h);var c=i.marginBoxes,d=this.pageBox.marginBoxName,f=this.boxInfo;f.isInLeftColumn||f.isInRightColumn?f.isInTopRow||f.isInBottomRow||(f.isInLeftColumn?c.left[d]=n:f.isInRightColumn&&(c.right[d]=n)):f.isInTopRow?c.top[d]=n:f.isInBottomRow&&(c.bottom[d]=n)},r}(Er),cf=function(){function o(e,t,n,i,a){this.cascadeInstance=void 0,this.pageScope=void 0,this.rootPageBoxInstance=void 0,this.context=void 0,this.docElementStyle=void 0,this.pageMasterCache={},this.cascadeInstance=e,this.pageScope=t,this.rootPageBoxInstance=n,this.context=i,this.docElementStyle=a,this.definePageProgression()}var r=o.prototype;return r.definePageProgression=function(){var e=this.pageScope,t=this.context,n=t.isVersoFirstPage,i=new ie(e,"page-number"),a=new Wr(e,new Ha(e,i,new re(e,2)),n?e.one:e.zero);e.defineName("recto-page",new dn(e,a)),e.defineName("verso-page",a),(t.pageProgression||Qu(this.docElementStyle))===R.PageProgression.LTR?(e.defineName("left-page",a),e.defineName("right-page",new dn(e,a))):(e.defineName("left-page",new dn(e,a)),e.defineName("right-page",a))},r.getCascadedPageStyle=function(e){var t={};return this.cascadeInstance.pushRule([],e,t),this.cascadeInstance.popRule(),t},r.getPageRulePageMaster=function(e,t){var n=e.pageBox;if(Object.keys(t).length===0)return n.resetScope(),e;var i=this.makeCacheKey(t,n),a=this.pageMasterCache[i];return a||(a=n.pseudoName===Ku?this.generatePageRuleMaster(t):this.generateCascadedPageMaster(t,n),this.pageMasterCache[i]=a),a.pageBox.resetScope(),a},r.makeCacheKey=function(e,t){var n=this.makeCascadeValueObjectKey(e);return t.key+"^"+n},r.makeCascadeValueObjectKey=function(e){var t=[];for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i,a=e[n];i=a instanceof Dt?""+a.value:this.makeCascadeValueObjectKey(a),t.push(n+i+(a.priority||""))}return t.sort().join("^")},r.generatePageRuleMaster=function(e){var t=new af(this.pageScope,this.rootPageBoxInstance.pageBox,e).createInstance(this.rootPageBoxInstance);return t.applyCascadeAndInit(this.cascadeInstance,this.docElementStyle),t.resolveAutoSizing(this.context),t},r.generateCascadedPageMaster=function(e,t){var n=t.clone({pseudoName:"vivliostyle-page-rule-master"}),i=n.specified,a=e.size;if(a){var s=Cr(e),u=a.priority;i.width=fi(this.context,i.width,new Dt(s.width,u)),i.height=fi(this.context,i.height,new Dt(s.height,u))}["counter-reset","counter-increment"].forEach(function(c){i[c]&&(e[c]=i[c])});var h=n.createInstance(this.rootPageBoxInstance);return h.applyCascadeAndInit(this.cascadeInstance,this.docElementStyle),h.resolveAutoSizing(this.context),h},o}(),df=function(o){function r(t){var n;return(n=o.call(this)||this).pageType=void 0,n.pageType=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){t.currentPageType===this.pageType&&this.chained.apply(t)},e.getPriority=function(){return 3},e.makePrimary=function(t){return this.chained&&t.insertInTable(t.pagetypes,this.pageType,this.chained),!0},r}(Mt),ff=function(o){function r(t){var n;return(n=o.call(this)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){new ie(this.scope,"page-number").evaluate(t.context)===1&&this.chained.apply(t)},e.getPriority=function(){return 2},r}(Mt),pf=function(o){function r(t){var n;return(n=o.call(this)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){new ie(this.scope,"blank-page").evaluate(t.context)&&this.chained.apply(t)},e.getPriority=function(){return 2},r}(Mt),gf=function(o){function r(t){var n;return(n=o.call(this)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){new ie(this.scope,"left-page").evaluate(t.context)&&this.chained.apply(t)},e.getPriority=function(){return 1},r}(Mt),vf=function(o){function r(t){var n;return(n=o.call(this)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){new ie(this.scope,"right-page").evaluate(t.context)&&this.chained.apply(t)},e.getPriority=function(){return 1},r}(Mt),mf=function(o){function r(t){var n;return(n=o.call(this)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){new ie(this.scope,"recto-page").evaluate(t.context)&&this.chained.apply(t)},e.getPriority=function(){return 1},r}(Mt),Ef=function(o){function r(t){var n;return(n=o.call(this)||this).scope=void 0,n.scope=t,n}w(r,o);var e=r.prototype;return e.apply=function(t){new ie(this.scope,"verso-page").evaluate(t.context)&&this.chained.apply(t)},e.getPriority=function(){return 1},r}(Mt),Cf=function(o){function r(t,n,i){var a;return(a=o.call(this,n,i)||this).scope=void 0,a.a=void 0,a.b=void 0,a.scope=t,a.a=n,a.b=i,a}w(r,o);var e=r.prototype;return e.apply=function(t){var n=t.context,i=n.layoutPositionAtPageStart.page;n.blankPageAtStart&&i--,i&&this.matchANPlusB(i)&&this.chained.apply(t)},e.getPriority=function(){return 2},r}(vi),Df=function(o){function r(e,t){return o.call(this,e,t,null,null,null)||this}return w(r,o),r.prototype.apply=function(e){(function(t,n,i,a,s){rr(t,n,i,a,null,null,null);var u=i._marginBoxes;if(u){var h=ir(n,"_marginBoxes");for(var c in u)if(u.hasOwnProperty(c)){var d=h[c];d||(h[c]=d={}),rr(t,d,u[c],a,null,null,null)}}})(e.context,e.currentStyle,this.style,this.specificity)},r}(_s),wf=function(o){function r(t,n,i,a,s){var u;return(u=o.call(this,t,n,i==null?void 0:i.condition,i,null,a,!1)||this).pageProps=void 0,u.currentPageSelectors=[],u.currentNamedPageSelector="",u.currentPseudoPageClassSelectors=[],u.pageProps=s,u}w(r,o);var e=r.prototype;return e.startPageRule=function(){this.startSelectorRule()},e.tagSelector=function(t,n){this.currentNamedPageSelector=n,n&&(this.chain.push(new df(n)),this.specificity+=65536)},e.pseudoclassSelector=function(t,n){if(t=t.toLowerCase(),n)switch(t){case"nth":var i=n[0],a=n[1];this.currentPseudoPageClassSelectors.push(":"+t+"("+i+"n"+(a<0?a:"+"+a)+")"),this.chain.push(new Cf(this.scope,i,a)),this.specificity+=256;break;default:this.reportAndSkip("E_INVALID_PAGE_SELECTOR :"+t+"("+n.join("")+")")}else switch(this.currentPseudoPageClassSelectors.push(":"+t),t){case"first":this.chain.push(new ff(this.scope)),this.specificity+=256;break;case"blank":this.chain.push(new pf(this.scope)),this.specificity+=256;break;case"left":this.chain.push(new gf(this.scope)),this.specificity+=1;break;case"right":this.chain.push(new vf(this.scope)),this.specificity+=1;break;case"recto":this.chain.push(new mf(this.scope)),this.specificity+=1;break;case"verso":this.chain.push(new Ef(this.scope)),this.specificity+=1;break;default:this.reportAndSkip("E_INVALID_PAGE_SELECTOR :"+t)}},e.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=[]},e.nextSelector=function(){this.finishSelector(),o.prototype.nextSelector.call(this)},e.startRuleBody=function(){this.finishSelector(),o.prototype.startRuleBody.call(this)},e.simpleProperty=function(t,n,i){if(t!=="bleed"&&t!=="marks"||this.currentPageSelectors.some(function(h){return h.selectors===null})){o.prototype.simpleProperty.call(this,t,n,i);var a=Be(this.elementStyle,t),s=this.pageProps;if(t==="bleed"||t==="marks")s[""]||(s[""]={}),Object.keys(s).forEach(function(h){Je(s[h],t,a)});else if(t==="size"){var u=s[""];this.currentPageSelectors.forEach(function(h){var c=new Dt(a.value,a.priority+h.specificity),d=h.selectors?h.selectors.join(""):"",f=s[d];if(f){var v=Be(f,t);c=v?fi(null,c,v):c,Je(f,t,c)}else Je(f=s[d]={},t,c),u&&["bleed","marks"].forEach(function(g){u[g]&&Je(f,g,u[g])})})}}},e.insertNonPrimary=function(t){this.cascade.insertInTable(this.cascade.pagetypes,"*",t)},e.makeApplyRuleAction=function(t){return new Df(this.elementStyle,t)},e.startPageMarginBoxRule=function(t){var n=ir(this.elementStyle,"_marginBoxes"),i=n[t];i||(n[t]=i={});var a=new yf(this.scope,this.owner,this.validatorSet,i);this.owner.pushHandler(a)},r}(mi),yf=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t,n,!1)||this).validatorSet=void 0,s.boxStyle=void 0,s.validatorSet=i,s.boxStyle=a,s}w(r,o);var e=r.prototype;return e.property=function(t,n,i){this.validatorSet.validatePropertyAndHandleShorthand(t,n,i,this)},e.invalidPropertyValue=function(t,n){this.report("E_INVALID_PROPERTY_VALUE "+t+": "+n.toString())},e.unknownProperty=function(t,n){this.report("E_INVALID_PROPERTY "+t+": "+n.toString())},e.simpleProperty=function(t,n,i){var a=i?this.getImportantSpecificity():this.getBaseSpecificity(),s=new Dt(n,a);Je(this.boxStyle,t,s)},r}(ci),Nf=function(o,r,e){return o.replace(/[uU][rR][lL]\(\s*"((\\([^0-9a-fA-F]+|[0-9a-fA-F]+\s*)|[^"\r\n])+)"/gm,function(t,n){return'url("'+e.transformURL(n,r)+'"'}).replace(/[uU][rR][lL]\(\s*'((\\([^0-9a-fA-F]+|[0-9a-fA-F]+\s*)|[^'\r\n])+)'/gm,function(t,n){return"url('"+e.transformURL(n,r)+"'"}).replace(/[uU][rR][lL]\(\s*((\\([^0-9a-fA-F]+|[0-9a-fA-F]+\s*)|[^"'\r\n\)\s])+)/gm,function(t,n){return"url("+e.transformURL(n,r)})},bf={},Sf={"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"},Af={"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"},nl={"margin-top":"0px"},il={"margin-right":"0px"},rl=function(o){function r(t,n,i,a,s,u,h,c,d,f,v,g,p){var E;return(E=o.call(this)||this).flowName=void 0,E.context=void 0,E.viewport=void 0,E.styler=void 0,E.regionIds=void 0,E.xmldoc=void 0,E.docFaces=void 0,E.footnoteStyle=void 0,E.stylerProducer=void 0,E.page=void 0,E.customRenderer=void 0,E.fallbackMap=void 0,E.documentURLTransformer=void 0,E.document=void 0,E.exprContentListener=void 0,E.nodeContext=null,E.viewRoot=null,E.isFootnote=!1,E.sourceNode=null,E.offsetInNode=0,E.viewNode=null,E.flowName=t,E.context=n,E.viewport=i,E.styler=a,E.regionIds=s,E.xmldoc=u,E.docFaces=h,E.footnoteStyle=c,E.stylerProducer=d,E.page=f,E.customRenderer=v,E.fallbackMap=g,E.documentURLTransformer=p,E.document=i.document,E.exprContentListener=a.counterListener.getExprContentListener(),E}w(r,o);var e=r.prototype;return e.clone=function(){return new r(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)},e.createPseudoelementShadow=function(t,n,i,a,s,u,h,c){var d=this.getPseudoMap(i,this.regionIds,this.isFootnote,this.nodeContext,u);if(!d)return c;for(var f,v=[],g=cr.createElementNS(U.SHADOW,"root"),p=g,E=B(td);!(f=E()).done;){var C=f.value,D=void 0;if(C){if(!d[C]||!(C!="footnote-marker"||n&&this.isFootnote))continue;if(C.match(/^first-/)){var y=a.display;if(!y||y===b.inline)continue}if(C==="before"||C==="after"){var N=d[C].content;if(!N||N===b.normal||N===b.none)continue}v.push(C),Vo(D=cr.createElementNS(U.XHTML,"span"),C)}else D=cr.createElementNS(U.SHADOW,"content");p.appendChild(D),C.match(/^first-/)&&(p=D)}if(!v.length)return c;var x=new du(t,i,s,u,this.exprContentListener);return new vo(t,g,null,h,c,Ye.ROOTLESS,x)},e.getPseudoMap=function(t,n,i,a,s){var u=yn(t,"_pseudos");if(!u)return null;var h={},c=function(f){var v=h[f]={};Ei(v,u[f],s),Io(v,s,u[f]),Ks(u[f],n,i,function(g,p){Ei(v,p,s),Ws(p,function(E){Ei(v,E,s)})})};for(var d in u)c(d);return h},e.createRefShadow=function(t,n,i,a,s){var u=this,h=L("createRefShadow");return this.xmldoc.store.load(t).then(function(c){var d=c;if(d){var f=d.getElement(t);if(f){var v=u.stylerProducer.getStylerForDoc(d);s=new vo(i,f,d,a,s,n,v)}}h.finish(s)}),h.result()},e.createShadows=function(t,n,i,a,s,u,h){var c=this,d=L("createShadows"),f=a.template;return(f instanceof pn?this.createRefShadow(f.url,Ye.ROOTLESS,t,h,null):I(null)).then(function(v){var g=null;if(t.namespaceURI==U.SHADOW&&t.localName=="include"){var p=t.getAttribute("href"),E=null;p?E=h?h.xmldoc:c.xmldoc:h&&(p=h.owner.namespaceURI==U.XHTML?h.owner.getAttribute("href"):h.owner.getAttributeNS(U.XLINK,"href"),E=h.parentShadow?h.parentShadow.xmldoc:c.xmldoc),p&&(p=wt(p,E.url),g=c.createRefShadow(p,Ye.ROOTED,t,h,v))}g==null&&(g=I(v));var C=null;g.then(function(D){if(a.display===b.table_cell){var y=wt("user-agent.xml#table-cell",Bt);C=c.createRefShadow(y,Ye.ROOTLESS,t,h,D)}else C=I(D)}),C.then(function(D){D=c.createPseudoelementShadow(t,n,i,a,s,u,h,D),d.finish(D)})}),d.result()},e.setViewRoot=function(t,n){this.viewRoot=t,this.isFootnote=n},e.computeStyle=function(t,n,i,a){var s=this,u=this.context,h=Ys(i,u,this.regionIds,this.isFootnote);t=Xs(h,u,t),n=js(h,u,n),qs(h,a,t,n,function(d,f){var v=f.evaluate(u,d);return d=="font-family"&&(v=s.docFaces.filterFontFamily(v)),v});var c=lu(a.display||b.inline,a.position,a.float,this.sourceNode===this.xmldoc.root);return["display","position","float"].forEach(function(d){c[d]&&(a[d]=c[d])}),t},e.inheritFromSourceParent=function(t){for(var n=this.nodeContext.sourceNode,i=[],a=null,s=this.nodeContext.shadowContext,u=-1;n&&n.nodeType==1;){var h=s&&s.root==n;if(!h||s.type==Ye.ROOTLESS){var c=(s?s.styler:this.styler).getStyle(n,!1);i.push(c),a=a||xr(n)}h?(n=s.owner,s=s.parentShadow):(n=n.parentNode,u++)}for(var d=this.context.queryUnitSize("em",u===0),f={"font-size":new Dt(new O(d,"px"),0)},v=new lc(f,this.context),g=i.length-1;g>=0;--g){var p=i[g],E=[];for(var C in p)Rs(C)&&E.push(C);E.sort(Jl);for(var D=0,y=E;D<y.length;D++){var N=y[D];v.setPropName(N);var x=Be(p,N);x.value!==b.inherit&&(f[N]=x.filterValue(v))}}for(var F in t)Rs(F)||(f[F]=t[F]);return{lang:a,elementStyle:f}},e.resolveURL=function(t){return t=wt(t,this.xmldoc.url),this.fallbackMap[t]||t},e.inheritLangAttribute=function(){this.nodeContext.lang=xr(this.nodeContext.sourceNode)||this.nodeContext.parent&&this.nodeContext.parent.lang||this.nodeContext.lang},e.transferPolyfilledInheritedProps=function(t){var n=rc().filter(function(s){return t[s]});if(n.length){var i=this.nodeContext.inheritedProps;if(this.nodeContext.parent)for(var a in i=this.nodeContext.inheritedProps={},this.nodeContext.parent.inheritedProps)i[a]=this.nodeContext.parent.inheritedProps[a];n.forEach(function(s){var u=t[s];if(u){if(u instanceof xn)i[s]=u.num;else if(u instanceof Ui)i[s]=u.name;else if(u instanceof O){var h=u;switch(h.unit){case"dpi":case"dpcm":case"dppx":i[s]=h.num*me[h.unit]}}else i[s]=u;delete t[s]}})}},e.resolveFormattingContext=function(t,n,i,a,s,u){for(var h=se(R.HOOKS.RESOLVE_FORMATTING_CONTEXT),c=0;c<h.length;c++){var d=h[c](t,n,i,a,s,u);if(d)return void(t.formattingContext=d)}},e.createElementView=function(t,n){var i=this,a=!0,s=L("createElementView"),u=this.sourceNode,h=this.nodeContext.shadowContext?this.nodeContext.shadowContext.styler:this.styler,c=h.getStyle(u,!1);if(!this.nodeContext.shadowContext){var d=this.xmldoc.getElementOffset(u);qi.registerFragmentIndex(d,this.nodeContext.fragmentIndex,0)}var f={};if(!this.nodeContext.parent){var v=this.inheritFromSourceParent(c);c=v.elementStyle,this.nodeContext.lang=v.lang}var g=c["float-reference"]&&function(y){switch(y){case"inline":return ne.INLINE;case"column":return ne.COLUMN;case"region":return ne.REGION;case"page":return ne.PAGE;default:throw new Error("Unknown float-reference: "+y)}}(c["float-reference"].value.toString());if(this.nodeContext.parent&&g&&lr(g)){var p=this.inheritFromSourceParent(c);c=p.elementStyle,this.nodeContext.lang=p.lang}this.nodeContext.vertical=this.computeStyle(this.nodeContext.vertical,this.nodeContext.direction==="rtl",c,f),h.processContent(u,f),this.transferPolyfilledInheritedProps(f),this.inheritLangAttribute(),f.direction&&(this.nodeContext.direction=f.direction.toString());var E=f["flow-into"];if(E&&E.toString()!=this.flowName)return s.finish(!1),s.result();var C=f.display;if(C===b.none)return s.finish(!1),s.result();var D=this.nodeContext.parent==null;return this.nodeContext.flexContainer=C===b.flex,this.createShadows(u,D,c,f,h,this.context,this.nodeContext.shadowContext).then(function(y){i.nodeContext.nodeShadow=y;var N=f.position,x=f.float,F=f.clear,k=i.nodeContext.vertical?b.vertical_rl:b.horizontal_tb,H=i.nodeContext.parent?i.nodeContext.parent.vertical?b.vertical_rl:b.horizontal_tb:k,K=function(at){return at.getAttribute("data-vivliostyle-flow-root")==="true"}(u);i.nodeContext.establishesBFC=function(at,pt,Ue,Qt,en,Qe,Ri){return en=en||Qe||b.horizontal_tb,!!Ri||!!Ue&&Ue!==b.none||uu(pt)||at===b.inline_block||at===b.table_cell||at===b.table_caption||at==b.flex||(at===b.block||at===b.list_item)&&!!Qt&&Qt!==b.visible||!!Qe&&en!==Qe}(C,N,x,f.overflow,k,H,K),i.nodeContext.containingBlockForAbsolute=function(at){return at===b.relative||at===b.absolute||at===b.fixed}(N),!i.nodeContext.isInsideBFC()||x===b.footnote||g&&lr(g)||(x=null,F=null);var q=x===b.left||x===b.right||x===b.top||x===b.bottom||x===b.inline_start||x===b.inline_end||x===b.block_start||x===b.block_end||x===b.snap_block||x===b.footnote;x&&(delete f.float,x===b.footnote&&(i.isFootnote?(q=!1,f.display=b.block):f.display=b.inline)),F&&(F===b.inherit&&i.nodeContext.parent&&i.nodeContext.parent.clearSide&&(F=_(i.nodeContext.parent.clearSide)),F!==b.left&&F!==b.right&&F!==b.top&&F!==b.bottom&&F!==b.both&&F!==b.all&&F!==b.same||(delete f.clear,f.display&&f.display!=b.inline&&(i.nodeContext.clearSide=F.toString())));var W=C===b.list_item&&f["ua-list-item-count"];if((q||f["break-inside"]&&f["break-inside"]!==b.auto)&&i.nodeContext.breakPenalty++,C&&C!==b.inline&&cu(C)&&i.nodeContext.breakPenalty++,i.nodeContext.inline=!q&&!C||cu(C)||function(at){switch(at.toString()){case"ruby-base":case"ruby-text":case"ruby-base-container":case"ruby-text-container":return!0;default:return!1}}(C),i.nodeContext.display=C?C.toString():"inline",i.nodeContext.floatSide=q?x.toString():null,i.nodeContext.floatReference=g||ne.INLINE,i.nodeContext.floatMinWrapBlock=f["float-min-wrap-block"]||null,i.nodeContext.columnSpan=f["column-span"],!i.nodeContext.inline){var G,X=f["break-after"];X&&(i.nodeContext.breakAfter=X.toString());var it=f["break-before"];it&&(i.nodeContext.breakBefore=it.toString());var lt=((G=f.page)==null?void 0:G.toString())||null;lt&<.toLowerCase()!=="auto"?i.nodeContext.pageType=lt:lt=i.nodeContext.pageType,i.styler.cascade.currentPageType!==lt&&(i.isAtForcedBreak()||(i.nodeContext.breakBefore="page"),i.styler.cascade.previousPageType=i.styler.cascade.currentPageType,i.styler.cascade.currentPageType=lt)}i.nodeContext.verticalAlign=f["vertical-align"]&&f["vertical-align"].toString()||"baseline",i.nodeContext.captionSide=f["caption-side"]&&f["caption-side"].toString()||"top";var Ht=f["border-collapse"];if(!Ht||Ht===_("separate")){var ct,ft,tt=f["border-spacing"];tt&&(tt.isSpaceList()?(ct=tt.values[0],ft=tt.values[1]):ct=ft=tt,ct.isNumeric()&&(i.nodeContext.inlineBorderSpacing=pe(ct,i.context)),ft.isNumeric()&&(i.nodeContext.blockBorderSpacing=pe(ft,i.context)))}i.nodeContext.footnotePolicy=f["footnote-policy"];var j=f["x-first-pseudo"];j&&(i.nodeContext.firstPseudo=new Jh(i.nodeContext.parent?i.nodeContext.parent.firstPseudo:null,j.num)),i.nodeContext.inline||i.processAfterIfcontinues(u,c,h,i.context);var ot=f["white-space"];if(ot){var Y=bs(ot.toString());Y!==null&&(i.nodeContext.whitespace=Y)}var vt=f["hyphenate-character"];vt&&vt!==b.auto&&(i.nodeContext.hyphenateCharacter=vt.str),i.nodeContext.breakWord=f["word-break"]===b.break_all||(f["overflow-wrap"]||["word-wrap"])===b.break_word,i.resolveFormattingContext(i.nodeContext,t,C,N,x,D),i.nodeContext.parent&&i.nodeContext.parent.formattingContext&&(t=i.nodeContext.parent.formattingContext.isFirstTime(i.nodeContext,t)),i.nodeContext.inline||(i.nodeContext.repeatOnBreak=i.processRepeatOnBreak(f),i.findAndProcessRepeatingElements(u,h));var et=!1,st=[],mt=u.namespaceURI,$=u.localName;if(mt==U.XHTML)$=="html"||$=="body"||$=="script"||$=="link"||$=="meta"?$="div":$=="vide_"?$="video":$=="audi_"?$="audio":$=="object"&&(et=!!i.customRenderer),u.getAttribute("data-adapt-pseudo")&&c.content&&c.content.value&&c.content.value.url&&($="img");else if(mt==U.epub)$="span",mt=U.XHTML;else if(mt==U.NCX)if(mt=U.XHTML,$=="ncx"||$=="navPoint")$="div";else if($=="navLabel"){$="span";var Me=u.parentNode;if(Me){for(var dt=null,yt=Me.firstChild;yt;yt=yt.nextSibling)if(yt.nodeType==1&&yt.namespaceURI==U.NCX&&yt.localName=="content"){dt=yt.getAttribute("src");break}dt&&($="a",(u=u.ownerDocument.createElementNS(mt,"a")).setAttribute("href",dt))}}else $="span";else mt==U.SHADOW?(mt=U.XHTML,$=i.nodeContext.inline?"span":"div"):et=!!i.customRenderer;if(W)t?$="li":($="div",f.display=C=b.block);else if($=="body"||$=="li")$="div";else if($=="q")$="span";else if($=="a"){var he=f["hyperlink-processing"];he&&he.toString()!="normal"&&($="span")}f.behavior&&f.behavior.toString()!="none"&&i.customRenderer&&(et=!0),u.dataset&&u.getAttribute("data-math-typeset")==="true"&&(et=!0),(et?i.customRenderer(u,i.nodeContext.parent?i.nodeContext.parent.viewNode:null,f):I(null)).then(function(at){var pt;at?et&&(a=at.getAttribute("data-adapt-process-children")=="true"):at=i.createElement(mt,$),$=="a"&&at.addEventListener("click",i.page.hrefHandler,!1),at.localName=="iframe"&&at.namespaceURI==U.XHTML&&(pt=at).addEventListener("load",function(){pt.contentWindow.navigator.epubReadingSystem={name:"adapt",version:"0.1",layoutStyle:"paginated",hasFeature:function(ki,Cp){switch(ki){case"mouse-events":return!0}return!1}}},!1);for(var Ue=i.nodeContext.inheritedProps["image-resolution"],Qt=[],en=f.width,Qe=f.height,Ri=u.getAttribute("width"),ta=u.getAttribute("height"),ea=en===b.auto||!en&&!Ri,na=Qe===b.auto||!Qe&&!ta,yl=u.attributes,jf=yl.length,Ar=null,ia=0;ia<jf;ia++){var ra=yl[ia],on=ra.namespaceURI,Zt=ra.localName,ce=ra.nodeValue;if(on){if(on=="http://www.w3.org/2000/xmlns/")continue;on==U.XLINK&&Zt=="href"&&(ce=i.resolveURL(ce))}else{if(Zt.match(/^on/)||Zt=="style")continue;if((Zt=="id"||Zt=="name")&&t){ce=i.documentURLTransformer.transformFragment(ce,i.xmldoc.url),at.setAttribute(Zt,ce),i.page.registerElementWithId(at,ce);continue}if(Zt=="src"||Zt=="href"||Zt=="poster"?(ce=i.resolveURL(ce),Zt==="href"&&(ce=i.documentURLTransformer.transformURL(ce,i.xmldoc.url))):Zt=="srcset"&&(ce=ce.split(",").map(function(ki){return i.resolveURL(ki.trim())}).join(",")),Zt==="poster"&&$==="video"&&mt===U.XHTML&&ea&&na){var Nl=new Image,bl=li(Nl,ce);st.push(bl),Qt.push({image:Nl,element:at,fetcher:bl})}}if(mt==U.SVG&&/^[A-Z\-]+$/.test(Zt)&&(Zt=Zt.toLowerCase()),i.isSVGUrlAttribute(Zt)&&(ce=Nf(ce,i.xmldoc.url,i.documentURLTransformer)),on){var Sl=bf[on];Sl&&(Zt=Sl+":"+Zt)}if(Zt!="src"||on||$!="img"&&$!="input"||mt!=U.XHTML)if(Zt=="href"&&$=="image"&&mt==U.SVG&&on==U.XLINK)i.page.fetchers.push(li(at,ce));else if(on)at.setAttributeNS(on,Zt,ce);else try{at.setAttribute(Zt,ce)}catch(ki){M.warn(ki)}else Ar=ce}if(Ar){var oa=$==="input"?new Image:at,aa=li(oa,Ar);oa!==at&&(at.src=Ar),ea||na?(ea&&na&&Ue&&Ue!==1&&Qt.push({image:oa,element:at,fetcher:aa}),st.push(aa)):i.page.fetchers.push(aa)}delete f.content;var sa=f["list-style-image"];if(sa&&sa instanceof pn){var Yf=sa.url;st.push(li(new Image,Yf))}if(i.preprocessElementStyle(f),i.applyComputedStyles(at,f),!i.nodeContext.inline){var Oi=null;if(t?n&&!i.isAtForcedBreak()&&(Oi=i.nodeContext.vertical?il:nl):Oi=i.nodeContext.inheritedProps["box-decoration-break"]!=="clone"?i.nodeContext.vertical?Af:Sf:i.nodeContext.vertical?il:nl,Oi)for(var ua in Oi)(ua!=="text-indent"||i.isParagraph(u))&&T(at,ua,Oi[ua])}W&&at.setAttribute("value",f["ua-list-item-count"].stringValue()),i.viewNode=at,st.length?so(st).then(function(){Ue>0&&i.modifyElemDimensionWithImageResolution(Qt,Ue,f,i.nodeContext.vertical),s.finish(a)}):s.timeSlice().then(function(){s.finish(a)})})}),s.result()},e.isParagraph=function(t){switch(t.localName){case"p":return!0;case"html":case"body":case"main":case"article":case"section":return!1}for(var n={a:!0,abbr:!0,b:!0,bdi:!0,bdo:!0,cite:!0,code:!0,data:!0,del:!0,dfn:!0,em:!0,i:!0,ins:!0,kbd:!0,mark:!0,q:!0,ruby:!0,s:!0,samp:!0,small:!0,span:!0,strong:!0,sub:!0,sup:!0,time:!0,u:!0,var:!0},i=t.firstChild;i;i=i.nextSibling)switch(i.nodeType){case Node.TEXT_NODE:if(i.nodeValue.trim().length>0)return!0;break;case Node.ELEMENT_NODE:if(n[i.localName])return!0}return!1},e.isAtForcedBreak=function(){for(var t=this.nodeContext;t&&!t.after;t=t.parent){if(_e(t.breakBefore))return!0;if(t.parent&&t.parent.sourceNode.firstElementChild!==t.sourceNode)break}return!1},e.processAfterIfcontinues=function(t,n,i,a){var s=this.getPseudoMap(n,this.regionIds,this.isFootnote,this.nodeContext,a);if(s&&s["after-if-continues"]&&s["after-if-continues"].content){var u=new du(t,n,i,a,this.exprContentListener);this.nodeContext.afterIfContinues=new nd(t,u)}},e.isSVGUrlAttribute=function(t){return r.SVG_URL_ATTRIBUTES.includes(t.toLowerCase())},e.modifyElemDimensionWithImageResolution=function(t,n,i,a){var s=this;t.forEach(function(u){if(u.fetcher.get().get()==="load"){var h=u.image,c=h.width/n,d=h.height/n,f=u.element;if(c>0&&d>0){if(i["box-sizing"]===b.border_box&&(i["border-left-style"]!==b.none&&(c+=pe(i["border-left-width"],s.context)),i["border-right-style"]!==b.none&&(c+=pe(i["border-right-width"],s.context)),i["border-top-style"]!==b.none&&(d+=pe(i["border-top-width"],s.context)),i["border-bottom-style"]!==b.none&&(d+=pe(i["border-bottom-width"],s.context))),n>1){var v=i["max-width"]||b.none,g=i["max-height"]||b.none;if(v===b.none&&g===b.none)T(f,"max-width",c+"px");else if(v!==b.none&&g===b.none)T(f,"width",c+"px");else if(v===b.none&&g!==b.none)T(f,"height",d+"px");else{v.isNumeric(),g.isNumeric();var p=g;v.unit!=="%"?T(f,"max-width",Math.min(c,pe(v,s.context))+"px"):p.unit!=="%"?T(f,"max-height",Math.min(d,pe(p,s.context))+"px"):a?T(f,"height",d+"px"):T(f,"width",c+"px")}}else if(n<1){var E=i["min-width"]||Gt,C=i["min-height"]||Gt;E.isNumeric(),E.isNumeric();var D=E,y=C;D.num===0&&y.num===0?T(f,"min-width",c+"px"):D.num!==0&&y.num===0?T(f,"width",c+"px"):D.num===0&&y.num!==0?T(f,"height",d+"px"):D.unit!=="%"?T(f,"min-width",Math.max(c,pe(D,s.context))+"px"):y.unit!=="%"?T(f,"min-height",Math.max(d,pe(y,s.context))+"px"):a?T(f,"height",d+"px"):T(f,"width",c+"px")}}}})},e.preprocessElementStyle=function(t){var n=this;se(R.HOOKS.PREPROCESS_ELEMENT_STYLE).forEach(function(i){i(n.nodeContext,t)})},e.findAndProcessRepeatingElements=function(t,n){for(var i=t.firstChild;i;i=i.nextSibling)if(i.nodeType===1){var a={},s=n.getStyle(i,!1);if(this.computeStyle(this.nodeContext.vertical,this.nodeContext.direction==="rtl",s,a),this.processRepeatOnBreak(a)){if(this.nodeContext.formattingContext instanceof $n&&!this.nodeContext.belongsTo(this.nodeContext.formattingContext))return;var u=this.nodeContext.parent;return this.nodeContext.formattingContext=new $n(u&&u.formattingContext,this.nodeContext.sourceNode),void this.nodeContext.formattingContext.initializeRepetitiveElements(this.nodeContext.vertical)}}},e.processRepeatOnBreak=function(t){var n=t["repeat-on-break"];return n!==b.none&&(n===b.auto&&(n=t.display===b.table_header_group?b.header:t.display===b.table_footer_group?b.footer:b.none),n&&n!==b.none)?n.toString():null},e.createTextNodeView=function(){var t=this,n=L("createTextNodeView");return this.preprocessTextContent().then(function(){var i=t.offsetInNode||0,a=ys(t.nodeContext.preprocessedTextContent).substr(i);t.viewNode=document.createTextNode(a),n.finish(!0)}),n.result()},e.preprocessTextContent=function(){var t,n=this;if(this.nodeContext.preprocessedTextContent!=null)return I(!0);var i=t=this.sourceNode.textContent,a=L("preprocessTextContent"),s=se(R.HOOKS.PREPROCESS_TEXT_CONTENT),u=0;return a.loop(function(){return u>=s.length?I(!1):s[u++](n.nodeContext,i).thenAsync(function(h){return i=h,I(!0)})}).then(function(){n.nodeContext.preprocessedTextContent=Ce.default(t,i,0),a.finish(!0)}),a.result()},e.createNodeView=function(t,n){var i,a=this,s=L("createNodeView"),u=!0;return this.sourceNode.nodeType==1?i=this.createElementView(t,n):this.sourceNode.nodeType==8?(this.viewNode=null,i=I(!0)):i=this.createTextNodeView(),i.then(function(h){if(u=h,a.nodeContext.viewNode=a.viewNode,a.viewNode){var c=a.nodeContext.parent?a.nodeContext.parent.viewNode:a.viewRoot;c&&c.appendChild(a.viewNode)}s.finish(u)}),s.result()},e.setCurrent=function(t,n,i){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(n,!!i):I(!0)},e.processShadowContent=function(t){if(t.shadowContext==null||t.sourceNode.localName!="content"||t.sourceNode.namespaceURI!=U.SHADOW)return t;var n,i,a=t.boxOffset,s=t.shadowContext,u=t.parent,h=s.subShadow||s.parentShadow;s.subShadow?(n=s.root,(i=s.type)==Ye.ROOTLESS&&(n=n.firstChild)):(n=s.owner.firstChild,i=Ye.ROOTLESS);var c=t.sourceNode.nextSibling;if(c?(t.sourceNode=c,t.resetView()):t.shadowSibling?t=t.shadowSibling:n?t=null:(t=t.parent.modify()).after=!0,n){var d=new di(n,u,a);return d.shadowContext=h,d.shadowType=i,d.shadowSibling=t,d}return t.boxOffset=a,t},e.nextPositionInTree=function(t){var n=t.boxOffset+1;if(t.after){if(!t.parent)return null;if(t.shadowType!=Ye.ROOTED){var i=t.sourceNode.nextSibling;if(i)return(t=t.modify()).boxOffset=n,t.sourceNode=i,t.resetView(),this.processShadowContent(t)}return t.shadowSibling?((t=t.shadowSibling.modify()).boxOffset=n,t):((t=t.parent.modify()).boxOffset=n,t.after=!0,t)}if(t.nodeShadow){var a=t.nodeShadow.root;if(t.nodeShadow.type==Ye.ROOTLESS&&(a=a.firstChild),a){var s=new di(a,t,n);return s.shadowContext=t.nodeShadow,s.shadowType=t.nodeShadow.type,this.processShadowContent(s)}}var u=t.sourceNode.firstChild;return u?this.processShadowContent(new di(u,t,n)):(t.sourceNode.nodeType!=1&&(n+=ys(t.preprocessedTextContent).length-1-t.offsetInNode),(t=t.modify()).boxOffset=n,t.after=!0,t)},e.isTransclusion=function(t,n,i){var a=Be(n,"hyperlink-processing");if(!a)return!1;var s=a.evaluate(this.context,"hyperlink-processing");return!!s&&s.toString()==i},e.nextInTree=function(t,n){var i=this,a=this.nextPositionInTree(t);if(!a||a.after)return I(a);var s=L("nextInTree");return this.setCurrent(a,!0,n).then(function(u){a.viewNode&&u||((a=a.modify()).after=!0,a.viewNode||(a.inline=!0)),i.dispatchEvent({type:"nextInTree",nodeContext:a}),s.finish(a)}),s.result()},e.addImageFetchers=function(t){if(t instanceof Te)for(var n=t.values,i=0;i<n.length;i++)this.addImageFetchers(n[i]);else if(t instanceof pn){var a=t.url;this.page.fetchers.push(li(new Image,a))}},e.applyComputedStyles=function(t,n){var i=n["background-image"];i&&this.addImageFetchers(i);var a=n.position===b.relative;for(var s in n)if(!Tf[s]){var u=n[s];u&&u!==ht&&((u=u.visit(new lh(this.xmldoc.url,this.documentURLTransformer))).isNumeric()&&Oa(u.unit)&&(u=Qr(u,this.context)),Xh[s]||a&&jh[s]?this.page.delayedItems.push(new go(t,s,u)):t.localName==="rt"&&s==="font-size"&&this.fixRubyTextFontSize(t,u)||T(t,s,u.toString()))}},e.fixRubyTextFontSize=function(t,n){if(!/Chrome/.test(navigator.userAgent)||!n.isNumeric())return!1;var i,a=n;if(a.unit==="%"||a.unit==="em"){var s,u,h=(s=this.nodeContext)==null||(u=s.parent)==null?void 0:u.viewNode;i=(h&&parseFloat(window.getComputedStyle(h).fontSize))*a.num/(a.unit==="%"?100:1)}else i=Qr(a,this.context).num;if(!i||i>=10||!(t instanceof HTMLElement&&"zoom"in t.style))return!1;var c=i/10;return T(t,"font-size","10px"),T(t,"zoom",""+c),!0},e.applyPseudoelementStyle=function(t,n,i){if(!t.after){var a=(t.shadowContext?t.shadowContext.styler:this.styler).getStyle(this.sourceNode,!1),s=yn(a,"_pseudos");if(s&&(a=s[n])){var u={};t.vertical=this.computeStyle(t.vertical,t.direction==="rtl",a,u);var h=u.content;Wn(h)&&(h.visit(new Eo(i,this.context,h,this.exprContentListener)),delete u.content),this.applyComputedStyles(i,u)}}},e.peelOff=function(t,n){var i=this,a=L("peelOff"),s=t.firstPseudo,u=t.offsetInNode,h=t.after;if(n>0)t.viewNode.textContent=t.viewNode.textContent.substr(0,n),u+=n;else if(!h&&t.viewNode&&u==0){var c=t.viewNode.parentNode;c&&c.removeChild(t.viewNode)}for(var d=t.boxOffset+n,f=[];t.firstPseudo===s;)f.push(t),t=t.parent;var v=f.pop(),g=v.shadowSibling;return a.loop(function(){for(;f.length>0;){v=f.pop(),t=new di(v.sourceNode,t,d),f.length==0&&(t.offsetInNode=u,t.after=h),t.shadowType=v.shadowType,t.shadowContext=v.shadowContext,t.nodeShadow=v.nodeShadow,t.shadowSibling=v.shadowSibling?v.shadowSibling:g,g=null;var p=i.setCurrent(t,!1);if(p.isPending())return p}return I(!1)}).then(function(){a.finish(t)}),a.result()},e.createElement=function(t,n){return t==U.XHTML?this.document.createElement(n):this.document.createElementNS(t,n)},e.applyFootnoteStyle=function(t,n,i){var a={},s=yn(this.footnoteStyle,"_pseudos");if(t=this.computeStyle(t,n,this.footnoteStyle,a),s&&s.before){var u={},h=this.createElement(U.XHTML,"span");Vo(h,"before"),i.appendChild(h),this.computeStyle(t,n,s.before,u),delete u.content,this.applyComputedStyles(h,u)}return delete a.content,this.applyComputedStyles(i,a),t},e.processFragmentedBlockEdge=function(t){t&&t.walkUpBlocks(function(n){var i=n.inheritedProps["box-decoration-break"];if(!i||i==="slice"){var a=n.viewNode;n.vertical?(T(a,"padding-left","0"),T(a,"border-left","none"),T(a,"border-top-left-radius","0"),T(a,"border-bottom-left-radius","0")):(T(a,"padding-bottom","0"),T(a,"border-bottom","none"),T(a,"border-bottom-left-radius","0"),T(a,"border-bottom-right-radius","0"))}})},e.convertLengthToPx=function(t,n,i){var a=t.num,s=t.unit;if(function(c){switch(c.toLowerCase()){case"em":case"ex":case"rem":return!0;default:return!1}}(s)){for(var u=n;u&&u.nodeType!==1;)u=u.parentNode;return wo(t,parseFloat(i.getElementComputedStyle(u)["font-size"]),this.context).num}var h=this.context.queryUnitSize(s,!1);return h?a*h:t},e.isSameNodePositionStep=function(t,n){if(t.shadowContext){if(!n.shadowContext)return!1;var i=n.node.nodeType===1?n.node:n.node.parentElement;return t.shadowContext.owner===n.shadowContext.owner&&Ni(t.node.nodeType===1?t.node:t.node.parentElement)===Ni(i)}return t.node===n.node},e.isSameNodePosition=function(t,n){var i=this;return t.offsetInNode===n.offsetInNode&&t.after==n.after&&t.steps.length===n.steps.length&&t.steps.every(function(a,s){return i.isSameNodePositionStep(a,n.steps[s])})},e.isPseudoelement=function(t){return!!Ni(t)},r}(Fr);rl.SVG_URL_ATTRIBUTES=["color-profile","clip-path","cursor","filter","marker","marker-start","marker-end","marker-mid","fill","stroke","mask"];var Fe,Tf={"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},ol=function(){function o(e){this.layoutBox=void 0,this.window=void 0,this.layoutBox=e.layoutBox,this.window=e.window}var r=o.prototype;return r.subtractOffsets=function(e,t){var n=t.left,i=t.top;return{left:e.left-n,top:e.top-i,right:e.right-n,bottom:e.bottom-i,width:e.width,height:e.height}},r.getRangeClientRects=function(e){var t=this,n=e.getClientRects(),i=this.layoutBox.getBoundingClientRect();return Array.from(n).map(function(a){return t.subtractOffsets(a,i)})},r.getElementClientRect=function(e){var t=e.getBoundingClientRect(),n=this.layoutBox.getBoundingClientRect();return this.subtractOffsets(t,n)},r.getElementComputedStyle=function(e){return this.window.getComputedStyle(e,null)},o}(),wr=function(){function o(e,t,n,i,a){this.window=void 0,this.fontSize=void 0,this.document=void 0,this.root=void 0,this.outerZoomBox=void 0,this.contentContainer=void 0,this.layoutBox=void 0,this.width=void 0,this.height=void 0,this.window=e,this.fontSize=t,this.document=e.document,this.root=n||this.document.body;var s=this.root.firstElementChild;s||((s=this.document.createElement("div")).setAttribute("data-vivliostyle-outer-zoom-box","true"),this.root.appendChild(s));var u=s.firstElementChild;u||((u=this.document.createElement("div")).setAttribute("data-vivliostyle-spread-container","true"),s.appendChild(u));var h=s.nextElementSibling;h||((h=this.document.createElement("div")).setAttribute("data-vivliostyle-layout-box","true"),this.root.appendChild(h)),this.outerZoomBox=s,this.contentContainer=u,this.layoutBox=h;var c=new ol(this).getElementComputedStyle(this.root);this.width=i||parseFloat(c.width)||e.innerWidth,this.height=a||parseFloat(c.height)||e.innerHeight}var r=o.prototype;return r.resetZoom=function(){T(this.outerZoomBox,"width",""),T(this.outerZoomBox,"height",""),T(this.contentContainer,"width",""),T(this.contentContainer,"height",""),T(this.contentContainer,"transform","")},r.zoom=function(e,t,n){T(this.outerZoomBox,"width",e*n+"px"),T(this.outerZoomBox,"height",t*n+"px"),T(this.contentContainer,"width",e+"px"),T(this.contentContainer,"height",t+"px"),T(this.contentContainer,"transform","scale("+n+")")},r.clear=function(){for(var e=this.root;e.lastChild;)e.removeChild(e.lastChild)},o}(),al=function(){function o(e,t,n){this.store=void 0,this.url=void 0,this.document=void 0,this.lang=null,this.totalOffset=-1,this.root=void 0,this.body=void 0,this.head=void 0,this.last=void 0,this.lastOffset=1,this.idMap=void 0,this.store=e,this.url=t,this.document=n,this.root=n.documentElement;var i=null,a=null;if(this.root.namespaceURI==U.XHTML){for(var s=this.root.firstChild;s;s=s.nextSibling)if(s.nodeType==1){var u=s;if(u.namespaceURI==U.XHTML)switch(u.localName){case"head":a=u;break;case"body":i=u}}this.lang=this.root.getAttribute("lang")}this.body=i,this.head=a,this.last=this.root,this.last.setAttribute("data-adapt-eloff","0")}var r=o.prototype;return r.doc=function(){return new ll([this.document])},r.getElementOffset=function(e){var t=e.getAttribute("data-adapt-eloff");if(t)return parseInt(t,10);for(var n=this.lastOffset,i=this.last;i!=e;){var a=i.firstChild;if(!a){for(;!(a=i.nextSibling);)if((i=i.parentNode)==null)throw new Error("Internal error")}i=a,a.nodeType==1?(a.setAttribute("data-adapt-eloff",n.toString()),++n):n+=a.textContent.length}return this.lastOffset=n,this.last=e,n-1},r.getNodeOffset=function(e,t,n){var i=0,a=e,s=null;if(a.nodeType==1){if(!n)return this.getElementOffset(a)}else{if(i=t,!(s=a.previousSibling))return i+=1,this.getElementOffset(a=a.parentNode)+i;a=s}for(;;){for(;a.lastChild;)a=a.lastChild;if(a.nodeType==1)break;if(i+=a.textContent.length,!(s=a.previousSibling)){a=a.parentNode;break}a=s}return i+=1,this.getElementOffset(a)+i},r.getTotalOffset=function(){return this.totalOffset<0&&(this.totalOffset=this.getNodeOffset(this.root,0,!0)),this.totalOffset},r.getNodeByOffset=function(e){for(var t,n=this,i=this.root,a=function(){if((t=n.getElementOffset(i))>=e)return{v:i};var f=i.children;if(!f)return"break";var v=cn(f.length,function(g){return n.getElementOffset(f[g])>e});if(v==0)return"break";i=f[v-1]};;){var s=a();if(s==="break")break;if(typeof s=="object")return s.v}for(var u=t+1,h=i,c=h.firstChild||h.nextSibling,d=null;;){if(c){if(c.nodeType==1||(d=h=c,(u+=c.textContent.length)>e&&!/^\s*$/.test(c.textContent)))break}else if(!(h=h.parentNode))break;c=h.nextSibling}return c&&d&&/^\s*$/.test(d.textContent)&&(d=c),d||i},r.buildIdMap=function(e){var t=e.getAttribute("id");t&&!this.idMap[t]&&(this.idMap[t]=e);var n=e.getAttributeNS(U.XML,"id");n&&!this.idMap[n]&&(this.idMap[n]=e);for(var i=e.firstElementChild;i;i=i.nextElementSibling)this.buildIdMap(i)},r.getElement=function(e){var t=e.match(/([^#]*)#(.+)$/);if(!t||t[1]&&t[1]!=this.url)return null;var n=t[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},o}();function yr(o,r,e){var t,n=e||new DOMParser;try{t=n.parseFromString(o,r)}catch(u){}if(!t)return null;var i=t.documentElement,a="parsererror";if(i.localName===a)return null;for(var s=i.firstElementChild;s;s=s.nextElementSibling)if(s.localName===a)return null;return t}function sl(o,r){var e=o.responseXML;if(!e){var t=new DOMParser,n=o.responseText;if(n){var i=function(s){var u=s.contentType;if(u){for(var h=Object.keys(Fe),c=0;c<h.length;c++)if(Fe[h[c]]===u)return u;if(u.match(/\+xml$/))return Fe.APPLICATION_XML}var d=s.url.match(/\.([^./]+)$/);if(d)switch(d[1]){case"html":case"htm":return Fe.TEXT_HTML;case"xhtml":case"xht":return Fe.APPLICATION_XHTML_XML;case"svg":case"svgz":return Fe.IMAGE_SVG_XML;case"opf":case"xml":return Fe.APPLICATION_XML}return null}(o);if((e=yr(n,i||Fe.APPLICATION_XML,t))&&!i){var a=e.documentElement;a.localName.toLowerCase()!=="html"||a.namespaceURI?a.localName.toLowerCase()==="svg"&&e.contentType!==Fe.IMAGE_SVG_XML&&(e=yr(n,Fe.IMAGE_SVG_XML,t)):e=yr(n,Fe.TEXT_HTML,t)}e||(e=yr(n,Fe.TEXT_HTML,t))}}return I(e?new al(r,o.url,e):null)}(function(o){o.TEXT_HTML="text/html",o.TEXT_XML="text/xml",o.APPLICATION_XML="application/xml",o.APPLICATION_XHTML_XML="application/xhtml+xml",o.IMAGE_SVG_XML="image/svg+xml"})(Fe||(Fe={}));var ul=new(function(){function o(e){this.fn=void 0,this.fn=e}var r=o.prototype;return r.check=function(e){return this.fn(e)},r.withAttribute=function(e,t){var n=this;return new o(function(i){return n.check(i)&&i.nodeType==1&&i.getAttribute(e)==t})},r.withChild=function(e,t){var n=this;return new o(function(i){if(!n.check(i))return!1;var a=new ll([i]);return a=a.child(e),t&&(a=a.predicate(t)),a.size()>0})},o}())(function(o){return!0}),ll=function(){function o(e){this.nodes=void 0,this.nodes=e}var r=o.prototype;return r.asArray=function(){return this.nodes},r.size=function(){return this.nodes.length},r.predicate=function(e){for(var t,n=[],i=B(this.nodes);!(t=i()).done;){var a=t.value;e.check(a)&&n.push(a)}return new o(n)},r.forEachNode=function(e){for(var t=[],n=function(a){t.push(a)},i=0;i<this.nodes.length;i++)e(this.nodes[i],n);return new o(t)},r.forEach=function(e){for(var t=[],n=0;n<this.nodes.length;n++)t.push(e(this.nodes[n]));return t},r.forEachNonNull=function(e){for(var t=[],n=0;n<this.nodes.length;n++){var i=e(this.nodes[n]);i!=null&&t.push(i)}return t},r.child=function(e){return this.forEachNode(function(t,n){for(var i=t.firstChild;i;i=i.nextSibling)i.nodeType==1&&i.localName==e&&n(i)})},r.childElements=function(){return this.forEachNode(function(e,t){for(var n=e.firstChild;n;n=n.nextSibling)n.nodeType==1&&t(n)})},r.attribute=function(e){return this.forEachNonNull(function(t){return t.nodeType==1?t.getAttribute(e):null})},r.textContent=function(){return this.forEach(function(e){return e.textContent})},o}(),xf=new ui(function(){var o=L("uaStylesheetBase"),r=Bu(),e=wt("user-agent-base.css",Bt),t=new mi(null,null,null,null,null,r,!0);return t.startStylesheet(xe.USER_AGENT),xo=t.cascade,co(vs,t,e,null,null).thenFinish(o),o.result()},"uaStylesheetBaseFetcher"),If=function(){function o(r,e,t,n,i,a,s,u,h,c){this.store=void 0,this.rootScope=void 0,this.pageScope=void 0,this.cascade=void 0,this.rootBox=void 0,this.fontFaces=void 0,this.footnoteProps=void 0,this.flowProps=void 0,this.viewportProps=void 0,this.pageProps=void 0,this.fontDeobfuscator=void 0,this.validatorSet=void 0,this.store=r,this.rootScope=e,this.pageScope=t,this.cascade=n,this.rootBox=i,this.fontFaces=a,this.footnoteProps=s,this.flowProps=u,this.viewportProps=h,this.pageProps=c,this.fontDeobfuscator=r.fontDeobfuscator,this.validatorSet=r.validatorSet,this.pageScope.defineBuiltIn("has-content",function(d){var f=this,v=f.currentLayoutPosition,g=v.firstFlowChunkOfFlow(d=d);return f.matchPageSide(v.startSideOfFlow(d))&&v.hasContent(d,f.lookupOffset)&&!!g&&!f.flowChunkIsAfterParentFlowForcedBreak(g)}),this.pageScope.defineName("page-number",new Oe(this.pageScope,function(){return this.pageNumberOffset+this.currentLayoutPosition.page},"page-number")),this.pageScope.defineName("blank-page",new Oe(this.pageScope,function(){var d=this.currentLayoutPosition;return d==null?void 0:d.isBlankPage},"blank-page"))}return o.prototype.sizeViewport=function(r,e,t,n){if(this.viewportProps.length){var i=new Ur(this.rootScope,r,e,t),a=function(g,p){for(var E={},C=0;C<p.length;C++)rr(g,E,p[C],0,null,null,null);return E}(i,this.viewportProps),s=a.width,u=a.height,h=a["text-zoom"],c=1;if(s&&u||h){var d=me.em;if((h?h.evaluate(i,"text-zoom"):null)===b.scale&&(c=d/t,t=d,r*=c,e*=c),s&&u){var f=pe(s.evaluate(i,"width"),i),v=pe(u.evaluate(i,"height"),i);if(f>0&&v>0)return{width:n&&n.spreadView?2*(f+n.pageBorder):f,height:v,fontSize:t}}}}return{width:r,height:e,fontSize:t}},o}(),hl=function(o){function r(t,n,i,a,s,u,h,c,d,f,v,g,p){var E;for(var C in(E=o.call(this,t.rootScope,a.width,a.height,a.fontSize)||this).style=void 0,E.xmldoc=void 0,E.viewport=void 0,E.clientLayout=void 0,E.fontMapper=void 0,E.customRenderer=void 0,E.fallbackMap=void 0,E.pageNumberOffset=void 0,E.documentURLTransformer=void 0,E.counterStore=void 0,E.lang=void 0,E.primaryFlows={body:!0},E.rootPageBoxInstance=null,E.styler=null,E.stylerMap=null,E.currentLayoutPosition=null,E.layoutPositionAtPageStart=null,E.lookupOffset=0,E.faces=void 0,E.pageBoxInstances={},E.pageManager=null,E.rootPageFloatLayoutContext=void 0,E.pageBreaks={},E.pageProgression=null,E.isVersoFirstPage=!1,E.blankPageAtStart=!1,E.pageSheetSize={},E.pageSheetHeight=0,E.pageSheetWidth=0,E.style=t,E.xmldoc=n,E.viewport=a,E.clientLayout=s,E.fontMapper=u,E.customRenderer=h,E.fallbackMap=c,E.pageNumberOffset=d,E.documentURLTransformer=f,E.counterStore=v,E.lang=n.lang||i,E.faces=new Xd(E.style.fontDeobfuscator),E.rootPageFloatLayoutContext=new Ci(null,null,null,null,null,null,null),E.pageProgression=g||null,E.isVersoFirstPage=!!p,t.flowProps){var D=Be(t.flowProps[C],"flow-consume");D&&(D.evaluate(xt(E),"flow-consume")==b.all?E.primaryFlows[C]=!0:delete E.primaryFlows[C])}return E}w(r,o);var e=r.prototype;return e.init=function(){var t=this,n=L("StyleInstance.init"),i=this.counterStore.createCounterListener(this.xmldoc.url),a=this.counterStore.createCounterResolver(this.xmldoc.url,this.style.rootScope,this.style.pageScope);this.styler=new xu(this.xmldoc,this.style.cascade,this.style.rootScope,this,this.primaryFlows,this.style.validatorSet,i,a),a.setStyler(this.styler),this.styler.resetFlowChunkStream(this),this.stylerMap={},this.stylerMap[this.xmldoc.url]=this.styler;var s=this.styler.getTopContainerStyle();this.pageProgression||(this.pageProgression=Qu(s)),this.matchStartPageSide(this.styler.breakBeforeValues[0])||(this.pageNumberOffset===0?this.isVersoFirstPage=!0:this.blankPageAtStart=!0),this.rootPageBoxInstance=new qd(this.style.rootBox);var u=this.style.cascade.createInstance(this,i,a,this.lang);this.styler.cascade.currentPageType=this.styler.cascade.firstPageType,this.rootPageBoxInstance.applyCascadeAndInit(u,s),this.rootPageBoxInstance.resolveAutoSizing(this),this.pageManager=new cf(u,this.style.pageScope,this.rootPageBoxInstance,this,s);for(var h,c=[],d=B(this.style.fontFaces);!(h=d()).done;){var f=h.value;if(!f.condition||f.condition.evaluate(this)){var v=Wd(f.properties,this),g=new _u(v);c.push(g)}}this.fontMapper.findOrLoadFonts(c,this.faces).thenFinish(n);var p=this.style.pageProps;return Object.keys(p).forEach(function(E){var C=Zu(Cr(p[E]),t);t.pageSheetSize[E]={width:C.pageWidth+2*C.cropOffset,height:C.pageHeight+2*C.cropOffset}}),n.result()},e.matchStartPageSide=function(t){var n=this.pageNumberOffset%2==(this.isVersoFirstPage?1:0),i=this.pageProgression==R.PageProgression.LTR;switch(t){case"left":return n!==i;case"right":return n===i;case"recto":return n;case"verso":return!n;default:return!0}},e.getStylerForDoc=function(t){var n=this.stylerMap[t.url];if(!n){var i=this.style.store.getStyleForDoc(t),a=new Ur(i.rootScope,this.pageWidth(),this.pageHeight(),this.initialFontSize),s=this.counterStore.createCounterListener(t.url),u=this.counterStore.createCounterResolver(t.url,i.rootScope,i.pageScope);n=new xu(t,i.cascade,i.rootScope,a,this.primaryFlows,i.validatorSet,s,u),this.stylerMap[t.url]=n}return n},e.registerInstance=function(t,n){this.pageBoxInstances[t]=n},e.lookupInstance=function(t){return this.pageBoxInstances[t]},e.encounteredFlowChunk=function(t,n){var i=this.currentLayoutPosition;if(i){i.flows[t.flowName]?n=i.flows[t.flowName]:i.flows[t.flowName]=n;var a=i.flowPositions[t.flowName];a||(a=new ec,i.flowPositions[t.flowName]=a);var s=new wn({steps:[{node:t.element,shadowType:Ye.NONE,shadowContext:null,nodeShadow:null,shadowSibling:null,formattingContext:null,fragmentIndex:0}],offsetInNode:0,after:!1,preprocessedTextContent:null}),u=new tc(s,t);a.positions.push(u)}},e.evalSupportsTest=function(t,n,i){if(i||!t)return!1;var a=!0,s=new(function(){function h(){}var c=h.prototype;return c.unknownProperty=function(d,f){a=!1},c.invalidPropertyValue=function(d,f){a=!1},c.simpleProperty=function(d,f,v){},h}()),u=Yi(this.style.rootScope,new mn(n,null),"");return!!u&&(this.xmldoc.store.validatorSet.validatePropertyAndHandleShorthand(t,u,!1,s),a)},e.getConsumedOffset=function(t){for(var n=Number.POSITIVE_INFINITY,i=0;i<t.positions.length;i++){for(var a=t.positions[i].chunkPosition.primary,s=a.steps[0].node,u=a.offsetInNode,h=a.after,c=0;s.ownerDocument!=this.xmldoc.document;)c++,s=a.steps[c].node,h=!1,u=0;var d=this.xmldoc.getNodeOffset(s,u,h);d<n&&(n=d)}return n},e.getPosition=function(t,n){if(!t)return 0;var i=Number.POSITIVE_INFINITY;for(var a in this.primaryFlows){var s=t.flowPositions[a];if(n||s&&s.positions.length!=0||!this.currentLayoutPosition||(this.styler.styleUntilFlowIsReached(a),s=this.currentLayoutPosition.flowPositions[a],t!=this.currentLayoutPosition&&s&&(s=s.clone(),t.flowPositions[a]=s)),s){var u=this.getConsumedOffset(s);u<i&&(i=u)}}return i},e.dumpLocation=function(t){for(var n in M.debug("Location - page",this.currentLayoutPosition.page),M.debug(" current:",t),M.debug(" lookup:",this.lookupOffset),this.currentLayoutPosition.flowPositions)for(var i,a=B(this.currentLayoutPosition.flowPositions[n].positions);!(i=a()).done;)M.debug(" Chunk",n+":",i.value.flowChunk.startOffset)},e.matchPageSide=function(t){switch(t){case"left":case"right":case"recto":case"verso":return new ie(this.style.pageScope,t+"-page").evaluate(this);default:return!0}},e.updateStartSide=function(t){for(var n in t.flowPositions){var i=t.flowPositions[n];if(i&&i.positions.length>0){var a=i.positions[0].flowChunk;if(this.getConsumedOffset(i)===a.startOffset){var s=i.positions[0].flowChunk.breakBefore,u=Zc(i.startSide);i.startSide=ru(Ne(u,s))}}}},e.selectPageMaster=function(t){var n=this.currentLayoutPosition,i=this.getPosition(n);if(i==Number.POSITIVE_INFINITY)return null;for(var a,s=this.rootPageBoxInstance.children,u=0;u<s.length;u++)if((a=s[u]).pageBox.pseudoName!=="vivliostyle-page-rule-master"){var h=1,c=a.getProp(this,"utilization");c&&c.isNum()&&(h=c.num);var d=this.queryUnitSize("em",!1),f=this.pageWidth()*this.pageHeight(),v=Math.ceil(h*f/(d*d));this.lookupOffset=this.styler.styleUntil(i,v),this.updateStartSide(n),this.layoutPositionAtPageStart=n.clone(),this.initLingering(),this.clearScope(this.style.pageScope);var g=a.getProp(this,"enabled");if(!g||g===b._true){if(n.page===1&&this.blankPageAtStart){a.style={};var p=t.size;t={},p&&(t.size=p)}return this.pageManager.getPageRulePageMaster(a,t)}}throw new Error("No enabled page masters")},e.flowChunkIsAfterParentFlowForcedBreak=function(t){var n=this.layoutPositionAtPageStart.flows,i=n[t.flowName].parentFlowName;if(i){var a=t.startOffset,s=n[i].forcedBreakOffsets;if(!s.length||a<s[0])return!1;var u=cn(s.length,function(f){return s[f]>a})-1,h=s[u],c=this.layoutPositionAtPageStart.flowPositions[i],d=this.getConsumedOffset(c);return!(h<d)&&(d<h||!this.matchPageSide(c.startSide))}return!1},e.setFormattingContextToColumn=function(t,n){var i=this.currentLayoutPosition.flows[n];i.formattingContext||(i.formattingContext=new Lo(null)),t.flowRootFormattingContext=i.formattingContext},e.layoutDeferredPageFloats=function(t){var n=t.pageFloatLayoutContext,i=n.getDeferredPageFloatContinuations();if(i.length&&i[0].float.floatReference==="page"){var a=i[0].float.nodePosition.steps[0].node,s=a&&this.xmldoc.getNodeOffset(a,0,!1),u=this.layoutPositionAtPageStart.flowPositions.body,h=u&&this.getConsumedOffset(u);if(s!=null&&h!=null&&s>h)return I(!0)}var c=L("layoutDeferredPageFloats"),d=!1,f=0;return c.loopWithFrame(function(v){if(f!==i.length){var g=i[f++],p=g.float,E=new jn().findByFloat(p),C=E.findPageFloatFragment(p,n);if(!C||!C.hasFloat(p))return n.isForbidden(p)||n.hasPrecedingFloatsDeferredToNext(p)?(n.deferPageFloat(g),void v.breakLoop()):void t.layoutPageFloatInner(g,E,null,C).then(function(D){if(D){var y=n.parent.isInvalidated();y?v.breakLoop():(n.isInvalidated()&&!y&&(d=!0,n.validate()),v.continueLoop())}else v.breakLoop()});v.continueLoop()}else v.breakLoop()}).then(function(){d&&n.invalidate(),c.finish(!0)}),c.result()},e.getLastAfterPositionIfDeferredFloatsExists=function(t,n){var i;return t.pageFloatLayoutContext.getPageFloatContinuationsDeferredToNext().length>0&&t.lastAfterPosition?(n?(i=n.clone()).primary=t.lastAfterPosition:i=new wn(t.lastAfterPosition),i):null},e.layoutColumn=function(t,n){var i=this,a=this.currentLayoutPosition.flowPositions[n];if(!a||!this.matchPageSide(a.startSide))return I(!0);a.startSide="any",this.setFormattingContextToColumn(t,n),t.init(),this.primaryFlows[n]&&t.bands.length>0&&(t.forceNonfitting=!1);var s=L("layoutColumn");return this.layoutDeferredPageFloats(t).then(function(){if(t.pageFloatLayoutContext.isInvalidated())s.finish(!0);else{var u=[],h=[],c=!0;s.loopWithFrame(function(d){if(t.pageFloatLayoutContext.hasContinuingFloatFragmentsInFlow(n))d.breakLoop();else{for(var f=function(){for(var g=0;h.includes(g);)g++;var p=a.positions[g];if(p.flowChunk.startOffset>i.lookupOffset||i.flowChunkIsAfterParentFlowForcedBreak(p.flowChunk))return"break";for(var E=g+1;E<a.positions.length;E++)if(!h.includes(E)){var C=a.positions[E];if(C.flowChunk.startOffset>i.lookupOffset||i.flowChunkIsAfterParentFlowForcedBreak(C.flowChunk))break;C.flowChunk.isBetter(p.flowChunk)&&(p=C,g=E)}var D=p.flowChunk,y=!0;return t.layout(p.chunkPosition,c,a.breakAfter).then(function(N){if(t.pageFloatLayoutContext.isInvalidated())d.breakLoop();else{if(c=!1,p.flowChunk.repeated&&(N===null||D.exclusive)&&u.push(g),D.exclusive)return h.push(g),void d.breakLoop();var x=!!N||!!t.pageBreakType,F=i.getLastAfterPositionIfDeferredFloatsExists(t,N);t.pageBreakType&&F?(p.chunkPosition=F,a.breakAfter=t.pageBreakType,t.pageBreakType=null):(h.push(g),(N||F)&&(p.chunkPosition=N||F,u.push(g)),t.pageBreakType&&(a.startSide=ru(t.pageBreakType))),x?d.breakLoop():(t.forceNonfitting=!1,y?y=!1:d.continueLoop())}}),y?(y=!1,{v:void 0}):void 0};a.positions.length-h.length>0;){var v=f();if(v==="break")break;if(typeof v=="object")return v.v}d.breakLoop()}}).then(function(){if(!t.pageFloatLayoutContext.isInvalidated()){a.positions=a.positions.filter(function(f,v){return u.includes(v)||!h.includes(v)}),a.breakAfter==="column"&&(a.breakAfter=null),t.saveDistanceToBlockEndFloats();var d=t.pageFloatLayoutContext.getMaxReachedAfterEdge();t.updateMaxReachedAfterEdge(d)}s.finish(!0)})}}),s.result()},e.createLayoutConstraint=function(t){var n=this.counterStore.createLayoutConstraint(this.currentLayoutPosition.page-1);return new od([n].concat(t.getLayoutConstraints()))},e.createAndLayoutColumn=function(t,n,i,a,s,u,h,c,d,f,v,g,p,E){var C,D=this,y=t.vertical?t.isAutoWidth&&t.isRightDependentOnAutoWidth:t.isAutoHeight&&t.isTopDependentOnAutoHeight,N=s.element,x=new Ci(c,ne.COLUMN,null,h,null,null,null),F=this.currentLayoutPosition.clone(),k=L("createAndLayoutColumn");return k.loopWithFrame(function(H){var K=D.createLayoutConstraint(x);if(d>1){var q=D.viewport.document.createElement("div");if(T(q,"position","absolute"),N.appendChild(q),(C=new dr(q,p,D.clientLayout,K,x)).forceNonfitting=E,C.vertical=s.vertical,C.snapHeight=s.snapHeight,C.snapWidth=s.snapWidth,s.vertical){var W=u*(v+f)+s.paddingTop;C.setHorizontalPosition(s.paddingLeft,s.width),C.setVerticalPosition(W,v)}else{var G=u*(v+f)+s.paddingLeft;C.setVerticalPosition(s.paddingTop,s.height),C.setHorizontalPosition(G,v)}C.originX=n,C.originY=i}else(C=new dr(N,p,D.clientLayout,K,x)).copyFrom(s);C.exclusions=y?[]:a.concat(),C.innerShape=g,x.setContainer(C),C.width>=0?D.layoutColumn(C,h).then(function(){x.isInvalidated()||x.finish(),C.pageFloatLayoutContext.isInvalidated()&&!c.isInvalidated()?(C.pageFloatLayoutContext.validate(),D.currentLayoutPosition=F.clone(),C.element!==N&&N.removeChild(C.element),H.continueLoop()):H.breakLoop()}):(x.finish(),H.breakLoop())}).then(function(){k.finish(C)}),k.result()},e.setPagePageFloatLayoutContextContainer=function(t,n,i){(n instanceof el||n instanceof qo&&!(n instanceof Jo))&&t.setContainer(i)},e.getRegionPageFloatLayoutContext=function(t,n,i,a){var s=n.getProp(this,"writing-mode")||null,u=n.getProp(this,"direction")||null;return new Ci(t,ne.REGION,i,a,null,s,u)},e.layoutFlowColumnsWithBalancing=function(t,n,i,a,s,u,h,c,d){var f=this,v=this.currentLayoutPosition.clone(),g=this.getRegionPageFloatLayoutContext(u,n,h,c),p=!0,E=function(){return f.currentLayoutPosition=v.clone(),f.layoutFlowColumns(t,n,i,a,s,u,g,h,c,d,p).thenAsync(function(C){return I(C?{columns:C,position:f.currentLayoutPosition}:null)})};return E().thenAsync(function(C){if(!C)return I(null);if(d<=1)return I(C.columns);var D=n.getProp(f,"column-fill")||b.balance,y=function(N,x,F,k,H,K,q){if(x===b.auto)return null;var W=K[K.length-1];return q.positions.length===0||W&&W.pageBreakType?new Od(F,k,H,N):x===b.balance_all?new kd(F,k,H):null}(d,D,E,g,h,C.columns,f.currentLayoutPosition.flowPositions[c]);return y?(p=!1,u.lock(),g.lock(),y.balanceColumns(C).thenAsync(function(N){return u.unlock(),u.validate(),g.unlock(),f.currentLayoutPosition=N.position,I(N.columns)})):I(C.columns)})},e.layoutFlowColumns=function(t,n,i,a,s,u,h,c,d,f,v){var g=this,p=L("layoutFlowColumns"),E=this.currentLayoutPosition.clone(),C=n.getPropAsNumber(this,"column-gap"),D=f>1?n.getPropAsNumber(this,"column-width"):c.width,y=n.getActiveRegions(this),N=os(n.getProp(this,"shape-inside"),0,0,c.width,c.height,this),x=new rl(d,this,this.viewport,this.styler,y,this.xmldoc,this.faces,this.style.footnoteProps,this,t,this.customRenderer,this.fallbackMap,this.documentURLTransformer),F=0,k=null,H=[];return p.loopWithFrame(function(K){g.createAndLayoutColumn(n,i,a,s,c,F++,d,h,f,C,D,N,x,v).then(function(q){return u.isInvalidated()?(H=null,void K.breakLoop()):(!(q.pageBreakType&&q.pageBreakType!=="column")&&F!==f||h.isInvalidated()||h.finish(),h.isInvalidated()?(F=0,g.currentLayoutPosition=E.clone(),h.validate(),void(h.isLocked()?(H=null,K.breakLoop()):K.continueLoop())):(H[F-1]=k=q,k.pageBreakType&&k.pageBreakType!="column"&&(F=f,k.pageBreakType!="region"&&(g.pageBreaks[d]=!0)),void(F<f?K.continueLoop():K.breakLoop())))})}).then(function(){p.finish(H)}),p.result()},e.layoutContainer=function(t,n,i,a,s,u,h){var c=this;n.reset();var d=n.getProp(this,"enabled");if(d&&d!==b._true)return I(!0);var f=L("layoutContainer"),v=n.getProp(this,"wrap-flow")===b.auto,g=n.getProp(this,"flow-from"),p=this.viewport.document.createElement("div"),E=n.getProp(this,"position");T(p,"position",E?E.name:"absolute");var C=n instanceof Jo;n instanceof Er?i.appendChild(p):i.insertBefore(p,i.firstChild);var D,y=new As(p);y.vertical=n.vertical,y.exclusions=u,n.prepareContainer(this,y,t,this.faces,this.clientLayout),y.originX=a,y.originY=s,a+=y.left+y.marginLeft+y.borderLeft,s+=y.top+y.marginTop+y.borderTop,this.setPagePageFloatLayoutContextContainer(h,n,y);var N=!1;if(g&&g.isIdent())if(this.pageBreaks[g.toString()])h.isInvalidated()||n.finishContainer(this,y,t,null,1,this.clientLayout,this.faces),D=I(!0);else{var x=L("layoutContainer.inner"),F=g.toString(),k=n.getPropAsNumber(this,"column-count");this.layoutFlowColumnsWithBalancing(t,n,a,s,u,h,y,F,k).then(function(W){if(!h.isInvalidated()){var G=W[0];G.element===p&&(y=G),y.computedBlockSize=Math.max.apply(null,W.map(function(it){return it.computedBlockSize})),n.finishContainer(c,y,t,G,k,c.clientLayout,c.faces);var X=c.currentLayoutPosition.flowPositions[F];X&&X.breakAfter==="region"&&(X.breakAfter=null)}x.finish(!0)}),D=x.result()}else{var H=n.getProp(this,"content");if(H&&Wn(H)){var K="span";H.url&&(K="img");var q=this.viewport.document.createElement(K);H.visit(new Eo(q,this,H,this.counterStore.getExprContentListener())),p.appendChild(q),K=="img"&&n.transferSinglUriContentProps(this,q,this.faces),n.transferContentProps(this,y,t,this.faces)}else n.suppressEmptyBoxGeneration&&(i.removeChild(p),N=!0);N||n.finishContainer(this,y,t,null,1,this.clientLayout,this.faces),D=I(!0)}return D.then(function(){if(h.isInvalidated())f.finish(!0);else{if(!n.isAutoHeight||Math.floor(y.computedBlockSize)>0){if(!N&&!v){var W=n.getProp(c,"shape-outside"),G=y.getOuterShape(W,c);u.push(G)}}else if(n.children.length==0)return i.removeChild(p),void f.finish(!0);var X=C?0:n.children.length-1;f.loop(function(){for(;X>=0&&X<n.children.length;){var it=n.children[C?X++:X--],lt=c.layoutContainer(t,it,p,a,s,u,h);if(lt.isPending())return lt.thenAsync(function(){return I(!h.isInvalidated())});if(h.isInvalidated())break}return I(!1)}).then(function(){f.finish(!0)})}}),f.result()},e.processLinger=function(){var t=this.currentLayoutPosition.page;for(var n in this.currentLayoutPosition.flowPositions)for(var i=this.currentLayoutPosition.flowPositions[n],a=i.positions.length-1;a>=0;a--){var s=i.positions[a];s.flowChunk.startPage>=0&&s.flowChunk.startPage+s.flowChunk.linger-1<=t&&i.positions.splice(a,1)}},e.initLingering=function(){var t=this.currentLayoutPosition.page;for(var n in this.currentLayoutPosition.flowPositions)for(var i=this.currentLayoutPosition.flowPositions[n],a=i.positions.length-1;a>=0;a--){var s=i.positions[a];s.flowChunk.startPage<0&&s.flowChunk.startOffset<this.lookupOffset&&(s.flowChunk.startPage=t)}},e.noMorePrimaryFlows=function(t){for(var n in this.primaryFlows){var i=t.flowPositions[n];if(i&&i.positions.length>0)return!1}return!0},e.layoutNextPage=function(t,n){var i,a,s=this,u=t.container===t.bleedBox;this.pageBreaks={},n?(this.currentLayoutPosition=n.clone(),this.styler.replayFlowElementsFromOffset(n.highestSeenOffset)):(this.currentLayoutPosition=new nc,this.styler.replayFlowElementsFromOffset(-1)),this.lang&&t.bleedBox.setAttribute("lang",this.lang),(n=this.currentLayoutPosition).page++;var h=(i=n.flowPositions.body)==null?void 0:i.startSide;n.isBlankPage=h&&h!=="any"&&this.matchPageSide(h),t.isBlankPage=n.isBlankPage,this.clearScope(this.style.pageScope),this.layoutPositionAtPageStart=n.clone();var c=u?{}:this.pageManager.getCascadedPageStyle((a=t.isBlankPage?this.styler.cascade.previousPageType:this.styler.cascade.currentPageType)!=null?a:""),d=this.selectPageMaster(c);if(!d)return I(null);var f=0;if(!u){t.setAutoPageWidth(d.pageBox.specified.width.value===oi),t.setAutoPageHeight(d.pageBox.specified.height.value===ai),this.counterStore.setCurrentPage(t),this.counterStore.updatePageCounters(c,this);var v=Zu(Cr(c),this);this.setPageSizeAndBleed(v,t),function(D,y,N,x){var F=!1,k=!1,H=D.marks;if(H){var K=H.value;K.isSpaceList()?K.values.forEach(function(ct){ct===b.crop?F=!0:ct===b.cross&&(k=!0)}):K===b.crop?F=!0:K===b.cross&&(k=!0)}if(F||k){var q=N.container,W=q.ownerDocument,G=y.bleed,X=pe(tf,x),it=pe(ef,x),lt=pe(nf,x);if(G){var Ht=D["background-color"];Ht&&Ht.value&&(N.bleedBox.style.backgroundColor=Ht.value.stringValue())}F&&Object.keys(Nn).forEach(function(ct){var ft=function(tt,j,ot,Y,vt,et){var st=Y;st<=vt+2*me.mm&&(st=vt+Y/2);var mt=Math.max(Y,st),$=vt+mt+ot/2,Me=$u(tt,$,$),dt=[[0,vt+Y],[Y,vt+Y],[Y,vt+Y-st]],yt=dt.map(function(pt){return[pt[1],pt[0]]});j!==Nn.TOP_RIGHT&&j!==Nn.BOTTOM_RIGHT||(dt=dt.map(function(pt){return[vt+mt-pt[0],pt[1]]}),yt=yt.map(function(pt){return[vt+mt-pt[0],pt[1]]})),j!==Nn.BOTTOM_LEFT&&j!==Nn.BOTTOM_RIGHT||(dt=dt.map(function(pt){return[pt[0],vt+mt-pt[1]]}),yt=yt.map(function(pt){return[pt[0],vt+mt-pt[1]]}));var he=Fi(tt,ot);he.setAttribute("points",dt.map(function(pt){return pt.join(",")}).join(" ")),Me.appendChild(he);var at=Fi(tt,ot);return at.setAttribute("points",yt.map(function(pt){return pt.join(",")}).join(" ")),Me.appendChild(at),j.split(" ").forEach(function(pt){Me.style[pt]=et+"px"}),Me}(W,Nn[ct],X,lt,G,it);q.appendChild(ft)}),k&&Object.keys(Ee).forEach(function(ct){var ft=function(tt,j,ot,Y,vt){var et,st,mt=2*Y;j===Ee.TOP||j===Ee.BOTTOM?(et=mt,st=Y):(et=Y,st=mt);var $=$u(tt,et,st),Me=Fi(tt,ot);Me.setAttribute("points","0,"+st/2+" "+et+","+st/2),$.appendChild(Me);var dt=Fi(tt,ot);dt.setAttribute("points",et/2+",0 "+et/2+","+st),$.appendChild(dt);var yt,he=Fi(tt,ot,"circle");switch(he.setAttribute("cx",et/2),he.setAttribute("cy",st/2),he.setAttribute("r",Y/4),$.appendChild(he),j){case Ee.TOP:yt=Ee.BOTTOM;break;case Ee.BOTTOM:yt=Ee.TOP;break;case Ee.LEFT:yt=Ee.RIGHT;break;case Ee.RIGHT:yt=Ee.LEFT}return Object.keys(Ee).forEach(function(at){var pt=Ee[at];pt===j?$.style[pt]=vt+"px":pt!==yt&&($.style[pt]="0",$.style["margin-"+pt]="auto")}),$}(W,Ee[ct],X,lt,it);q.appendChild(ft)})}}(c,v,t,this),f=v.bleedOffset+v.bleed}var g=!u&&d.getProp(this,"writing-mode")||b.horizontal_tb;this.pageVertical=g!=b.horizontal_tb;var p=d.getProp(this,"direction")||b.ltr,E=new Ci(this.rootPageFloatLayoutContext,ne.PAGE,null,null,null,g,p),C=L("layoutNextPage");return C.loopWithFrame(function(D){s.layoutContainer(t,d,t.bleedBox,f,f,[],E).then(function(){E.isInvalidated()||E.finish(),E.isInvalidated()?(s.currentLayoutPosition=s.layoutPositionAtPageStart.clone(),E.validate(),D.continueLoop()):D.breakLoop()})}).then(function(){if(d.adjustPageLayout(s,t,s.clientLayout),!u){var D=new ie(d.pageBox.scope,"left-page");t.side=D.evaluate(s)?R.PageSide.LEFT:R.PageSide.RIGHT,s.processLinger(),n=s.currentLayoutPosition,Object.keys(n.flowPositions).forEach(function(N){var x=n.flowPositions[N],F=x.breakAfter;!F||F!=="page"&&s.matchPageSide(F)||(x.breakAfter=null)})}s.currentLayoutPosition=s.layoutPositionAtPageStart=null,n.highestSeenOffset=s.styler.getReachedOffset();var y=s.style.store.getTriggersForDoc(s.xmldoc);t.finish(y,s.clientLayout),s.noMorePrimaryFlows(n)&&(n=null),C.finish(n)}),C.result()},e.setPageSizeAndBleed=function(t,n){this.actualPageWidth=t.pageWidth,this.actualPageHeight=t.pageHeight,this.pageSheetWidth=t.pageWidth+2*t.cropOffset,this.pageSheetHeight=t.pageHeight+2*t.cropOffset,n.container.style.width=this.pageSheetWidth+"px",n.container.style.height=this.pageSheetHeight+"px",n.bleedBox.style.left=t.bleedOffset+"px",n.bleedBox.style.right=t.bleedOffset+"px",n.bleedBox.style.top=t.bleedOffset+"px",n.bleedBox.style.bottom=t.bleedOffset+"px",n.bleedBox.style.padding=t.bleed+"px",n.bleedBox.style.paddingTop=t.bleed+.01+"px"},r}(Ur),Ff=function(o){function r(t,n,i,a){var s;return(s=o.call(this,t.rootScope,t,n,i,a,t.validatorSet,!i)||this).masterHandler=void 0,s.insideRegion=!1,s.masterHandler=t,s}w(r,o);var e=r.prototype;return e.startPageTemplateRule=function(){},e.startPageMasterRule=function(t,n,i){var a=new Uu(this.masterHandler.pageScope,t,n,i,this.masterHandler.rootBox,this.condition,this.owner.getBaseSpecificity());this.masterHandler.pushHandler(new $d(a.scope,this.masterHandler,a,this.validatorSet))},e.startWhenRule=function(t){var n=t.expr;this.condition!=null&&(n=We(this.scope,this.condition,n)),this.masterHandler.pushHandler(new r(this.masterHandler,n,this,this.regionId))},e.startDefineRule=function(){this.masterHandler.pushHandler(new Hc(this.scope,this.owner))},e.startFontFaceRule=function(){var t={};this.masterHandler.fontFaces.push({properties:t,condition:this.condition}),this.masterHandler.pushHandler(new ur(this.scope,this.owner,null,t,this.masterHandler.validatorSet))},e.startFlowRule=function(t){var n=this.masterHandler.flowProps[t];n||(this.masterHandler.flowProps[t]=n={}),this.masterHandler.pushHandler(new ur(this.scope,this.owner,null,n,this.masterHandler.validatorSet))},e.startViewportRule=function(){var t={};this.masterHandler.viewportProps.push(t),this.masterHandler.pushHandler(new ur(this.scope,this.owner,this.condition,t,this.masterHandler.validatorSet))},e.startFootnoteRule=function(t){var n=this.masterHandler.footnoteProps;if(t){var i=ir(n,"_pseudos");(n=i[t])||(i[t]=n={})}this.masterHandler.pushHandler(new ur(this.scope,this.owner,null,n,this.masterHandler.validatorSet))},e.startRegionRule=function(){this.insideRegion=!0,this.startSelectorRule()},e.startPageRule=function(){var t=new wf(this.masterHandler.pageScope,this.masterHandler,this,this.validatorSet,this.masterHandler.pageProps);this.masterHandler.pushHandler(t),t.startPageRule()},e.startRuleBody=function(){if(mi.prototype.startRuleBody.call(this),this.insideRegion){this.insideRegion=!1;var t="R"+this.masterHandler.regionCount++;this.special("region-id",_(t)),this.endRule();var n=new r(this.masterHandler,this.condition,this,t);this.masterHandler.pushHandler(n),n.startRuleBody()}},r}(mi);function Pf(o){var r=o.getAttribute("content");if(!r)return"";for(var e,t={};(e=r.match(/^,?\s*([-A-Za-z_.][-A-Za-z_0-9.]*)\s*=\s*([-+A-Za-z_0-9.]*)\s*/))!=null;)r=r.substr(e[0].length),t[e[1]]=e[2];var n=t.width-0,i=t.height-0;return n&&i?"@-epubx-viewport{width:"+n+"px;height:"+i+"px;}":""}var Rf=function(o){function r(e){var t;return(t=o.call(this)||this).validatorSet=void 0,t.rootScope=void 0,t.pageScope=void 0,t.rootBox=void 0,t.cascadeParserHandler=void 0,t.regionCount=0,t.fontFaces=[],t.footnoteProps={},t.flowProps={},t.viewportProps=[],t.pageProps={},t.validatorSet=e,t.rootScope=new Mr(null),t.pageScope=new Mr(t.rootScope),t.rootBox=new Kd(t.rootScope),t.cascadeParserHandler=new Ff(xt(t),null,null,null),t.slave=t.cascadeParserHandler,t}return w(r,o),r.prototype.error=function(e,t){M.warn("CSS parser:",e)},r}(Hh);function Of(o,r){return r.parseOPSResource(o)}var kf=function(o){function r(t){var n;return(n=o.call(this,Of,$e.DOCUMENT)||this).fontDeobfuscator=void 0,n.styleByKey={},n.styleFetcherByKey={},n.styleByDocURL={},n.triggersByDocURL={},n.validatorSet=null,n.styleSheets=[],n.triggerSingleDocumentPreprocessing=!1,n.fontDeobfuscator=t,n}w(r,o);var e=r.prototype;return e.init=function(t,n){var i=this;this.setStyleSheets(t,n);var a=wt("user-agent.xml",Bt),s=L("OPSDocStore.init");return this.validatorSet=Bu(),xf.get().then(function(){i.load(a).then(function(){i.triggerSingleDocumentPreprocessing=!0,s.finish(!0)})}),s.result()},e.getStyleForDoc=function(t){return this.styleByDocURL[t.url]},e.getTriggersForDoc=function(t){return this.triggersByDocURL[t.url]},e.setStyleSheets=function(t,n){this.clearStyleSheets(),t&&t.forEach(this.addAuthorStyleSheet,this),n&&n.forEach(this.addUserStyleSheet,this)},e.clearStyleSheets=function(){this.styleSheets.splice(0)},e.addAuthorStyleSheet=function(t){var n=t.url;n&&(n=wt(ei(n),bt)),this.styleSheets.push({url:n,text:t.text,flavor:xe.AUTHOR,classes:null,media:null})},e.addUserStyleSheet=function(t){var n=t.url;n&&(n=wt(ei(n),bt)),this.styleSheets.push({url:n,text:t.text,flavor:xe.USER,classes:null,media:null})},e.parseOPSResource=function(t){var n=this,i=L("OPSDocStore.load"),a=t.url,s=a.endsWith("?viv-toc-box");return sl(t,this).then(function(u){if(u){if(n.triggerSingleDocumentPreprocessing)for(var h=se(R.HOOKS.PREPROCESS_SINGLE_DOCUMENT),c=0;c<h.length;c++)try{h[c](u.document)}catch(Y){M.warn("Error during single document preprocessing:",Y)}for(var d=[],f=u.document.getElementsByTagNameNS(U.epub,"trigger"),v=0;v<f.length;v++){var g=f[v],p=g.getAttributeNS(U.EV,"observer"),E=g.getAttributeNS(U.EV,"event"),C=g.getAttribute("action"),D=g.getAttribute("ref");p&&E&&C&&D&&d.push({observer:p,event:E,action:C,ref:D})}n.triggersByDocURL[a]=d;var y=[],N=wt("user-agent-page.css",Bt);if(y.push({url:N,text:gs,flavor:xe.USER_AGENT,classes:null,media:null}),!s){for(var x,F=B(u.document.querySelectorAll("style, link, meta"));!(x=F()).done;){var k=x.value,H=k.localName;if(k.namespaceURI==U.XHTML)if(H=="style"){var K=k.getAttribute("class"),q=k.getAttribute("media"),W=k.getAttribute("title");y.push({url:a,text:k.textContent,flavor:xe.AUTHOR,classes:W?K:null,media:q})}else if(H=="link"){var G=k.getAttribute("rel"),X=k.getAttribute("class"),it=k.getAttribute("media");if(G=="stylesheet"||G=="alternate stylesheet"&&X){var lt=k.getAttribute("href");lt=wt(lt,a);var Ht=k.getAttribute("title");y.push({url:lt,text:null,classes:Ht?X:null,media:it,flavor:xe.AUTHOR})}}else H=="meta"&&k.getAttribute("name")=="viewport"&&y.push({url:a,text:Pf(k),flavor:xe.AUTHOR,classes:null,media:null})}for(var ct=0;ct<n.styleSheets.length;ct++)y.push(n.styleSheets[ct])}for(var ft="",tt=0;tt<y.length;tt++)ft+=y[tt].url,ft+="^",y[tt].text&&(ft+=y[tt].text),ft+="^";var j=n.styleByKey[ft];if(j)return n.styleByDocURL[a]=j,void i.finish(u);var ot=n.styleFetcherByKey[ft];ot||(ot=new ui(function(){var Y=L("fetchStylesheet"),vt=0,et=new Rf(n.validatorSet);return Y.loop(function(){if(vt<y.length){var st=y[vt++];return et.startStylesheet(st.flavor),st.text!==null?co(st.text,et,st.url,st.classes,st.media).thenReturn(!0):Ds(st.url,et,st.classes,st.media)}return I(!1)}).then(function(){var st=et.cascadeParserHandler.finish();j=new If(n,et.rootScope,et.pageScope,st,et.rootBox,et.fontFaces,et.footnoteProps,et.flowProps,et.viewportProps,et.pageProps),n.styleByKey[ft]=j,delete n.styleFetcherByKey[ft],Y.finish(j)}),Y.result()},"FetchStylesheet "+a),n.styleFetcherByKey[ft]=ot,ot.start()),ot.get().then(function(Y){n.styleByDocURL[a]=Y,i.finish(u)})}else i.finish(null)}),i.result()},r}(lo);function cl(o){return String.fromCharCode(o>>>24&255,o>>>16&255,o>>>8&255,255&o)}function Lf(o){return(255&o.charCodeAt(0))<<24|(255&o.charCodeAt(1))<<16|(255&o.charCodeAt(2))<<8|255&o.charCodeAt(3)}function dl(o){var r=new Re;r.append(o);var e=55-o.length&63;for(r.append("");e>0;)e--,r.append("\0");r.append("\0\0\0\0"),r.append(cl(8*o.length)),o=r.toString();for(var t,n=[1732584193,4023233417,2562383102,271733878,3285377520],i=[],a=0;a<o.length;a+=64){for(t=0;t<16;t++)i[t]=Lf(o.substr(a+4*t,4));for(;t<80;t++){var s=i[t-3]^i[t-8]^i[t-14]^i[t-16];i[t]=s<<1|s>>>31}var u=n[0],h=n[1],c=n[2],d=n[3],f=n[4],v=void 0;for(t=0;t<80;t++)v=t<20?1518500249+(h&c|~h&d):t<40?1859775393+(h^c^d):t<60?2400959708+(h&c|h&d|c&d):3395469782+(h^c^d),v+=(u<<5|u>>>27)+f+i[t],f=d,d=c,c=h<<30|h>>>2,h=u,u=v;n[0]=n[0]+u|0,n[1]=n[1]+h|0,n[2]=n[2]+c|0,n[3]=n[3]+d|0,n[4]=n[4]+f|0}return n}var Bf=function(){function o(e,t,n,i,a,s,u,h,c,d){this.store=void 0,this.url=void 0,this.lang=void 0,this.clientLayout=void 0,this.fontMapper=void 0,this.rendererFactory=void 0,this.fallbackMap=void 0,this.documentURLTransformer=void 0,this.counterStore=void 0,this.pref=void 0,this.page=null,this.instance=null,this.store=e,this.url=t,this.lang=n,this.clientLayout=i,this.fontMapper=a,this.rendererFactory=u,this.fallbackMap=h,this.documentURLTransformer=c,this.counterStore=d,this.pref=xa(s),this.pref.spreadView=!1}var r=o.prototype;return r.setAutoHeight=function(e,t){if(t--!=0){for(var n=e.firstChild;n;n=n.nextSibling)if(n.nodeType==1){var i=n;Bn(i,"height","auto")!="auto"&&(T(i,"height","auto"),this.setAutoHeight(i,t)),Bn(i,"position","static")=="absolute"&&(T(i,"position","relative"),this.setAutoHeight(i,t))}}},r.makeCustomRenderer=function(e){var t=this.rendererFactory.makeCustomRenderer(e);return function(n,i,a){var s=a.behavior;if(s)switch(s.toString()){case"body-child":n.querySelector("[role=doc-toc], [role=directory], nav li a, .toc, #toc")||(a.display=b.none);break;case"toc-node-anchor":a.color=b.inherit,a["text-decoration"]=b.none;break;case"toc-node":a.display=b.block,a.margin=Gt,a.padding=Gt,a["padding-inline-start"]=new O(1.25,"em");break;case"toc-node-first-child":a.display=b.inline_block,a.margin=new O(.2,"em"),a["vertical-align"]=b.top,a.color=b.inherit,a["text-decoration"]=b.none}if(!s||s.toString()!="toc-node"&&s.toString()!="toc-container")return t(n,i,a);var u=n.firstChild;u&&u.nodeType!==1&&u.textContent.trim()===""&&n.replaceChild(n.ownerDocument.createComment(u.textContent),u);var h=i.getAttribute("data-adapt-class");if(h=="toc-node"){var c=i.firstChild;c.textContent!="▸"&&(c.textContent="▸",T(c,"cursor","pointer"),c.addEventListener("click",_f,!1),c.setAttribute("role","button"),c.setAttribute("aria-expanded","false"),i.setAttribute("aria-expanded","false"),i.style.height!=="0px"&&(c.tabIndex=0))}var d=i.ownerDocument.createElement("div");if(d.setAttribute("data-adapt-process-children","true"),s.toString()=="toc-node"){var f=i.ownerDocument.createElement("div");if(f.textContent="▹",T(f,"margin","0.2em 0 0 -1em"),T(f,"margin-inline-start","-1em"),T(f,"margin-inline-end","0"),T(f,"display","inline-block"),T(f,"width","1em"),T(f,"text-align","center"),T(f,"vertical-align","top"),T(f,"cursor","default"),T(f,"font-family","Menlo,sans-serif"),d.appendChild(f),T(d,"overflow","hidden"),d.setAttribute("data-adapt-class","toc-node"),d.setAttribute("role","treeitem"),h=="toc-node"||h=="toc-container"){T(d,"height","0px");var v=n.firstElementChild;v&&v.localName==="a"&&(v.tabIndex=-1)}else i.setAttribute("role","tree")}else h=="toc-node"&&(d.setAttribute("data-adapt-class","toc-container"),d.setAttribute("role","group"),d.setAttribute("aria-hidden","true"));return I(d)}},r.showTOC=function(e,t,n,i,a){var s=this;if(this.page)return I(this.page);var u=L("showTOC"),h=new Zi(e,e);return this.page=h,this.store.load(this.url+"?viv-toc-box").then(function(c){for(var d,f=B(c.document.querySelectorAll("[role=doc-toc], [role=directory], nav, .toc, #toc"));!(d=f()).done;){var v=d.value;v.hasAttribute("hidden")&&v.removeAttribute("hidden")}var g=s.store.getStyleForDoc(c),p=g.sizeViewport(n,1e5,a);t=new wr(t.window,p.fontSize,t.root,p.width,p.height);var E=s.makeCustomRenderer(c),C=new hl(g,c,s.lang,t,s.clientLayout,s.fontMapper,E,s.fallbackMap,0,s.documentURLTransformer,s.counterStore);s.instance=C,C.pref=s.pref,C.init().then(function(){C.layoutNextPage(h,null).then(function(){Array.from(h.container.querySelectorAll("[data-vivliostyle-toc-box]>*>*>*>*>*[style*='display: none']")).forEach(function(D){D.setAttribute("aria-hidden","true"),D.setAttribute("hidden","hidden")}),s.setAutoHeight(e,2),u.finish(h)})})}),u.result()},r.hideTOC=function(){this.page&&(this.page.container.style.visibility="hidden",this.page.container.setAttribute("aria-hidden","true"))},r.isTOCVisible=function(){return!!this.page&&this.page.container.style.visibility==="visible"},r.getTOC=function(){if(!this.page)return[];function e(n){if(!n)return[];var i=n.querySelectorAll(":scope > [role=treeitem] > a[href]");return Array.from(i).map(t)}function t(n){return{id:new URL(n.href).hash.match(/^#?(.*)$/)[1],title:n.innerText,children:e(n.parentElement.querySelector("[role=group]"))}}return e(this.page.container.querySelector("[role=tree]"))},o}();function _f(o){var r=o.target,e=r.textContent=="▸";r.textContent=e?"▾":"▸";var t=r.parentNode;r.setAttribute("aria-expanded",e?"true":"false"),t.setAttribute("aria-expanded",e?"true":"false");for(var n=t.firstChild;n;){if(n.nodeType===1){var i=n,a=i.getAttribute("data-adapt-class");if(a==="toc-container"){if(i.setAttribute("aria-hidden",e?"false":"true"),i.firstChild){n=i.firstChild;continue}}else if(a==="toc-node"&&(i.style.height=e?"auto":"0px",i.children.length>=2&&(i.children[1].tabIndex=e?0:-1),i.children.length>=3&&(i.children[0].tabIndex=e?0:-1,!e))){var s=i.children[0];if(s.textContent=="▾"){s.textContent="▸",s.setAttribute("aria-expanded","false"),i.setAttribute("aria-expanded","false"),n=i.children[2];continue}}}for(;!n.nextSibling&&n.parentNode!==t;)n=n.parentNode;n=n.nextSibling}o.stopPropagation()}var fl=function(o){function r(){var t;return(t=o.call(this,null)||this).plainXMLStore=void 0,t.jsonStore=void 0,t.opfByURL={},t.primaryOPFByEPubURL={},t.deobfuscators={},t.documents={},t.fontDeobfuscator=t.makeDeobfuscatorFactory(),t.plainXMLStore=new lo(sl,$e.DOCUMENT),t.jsonStore=new lo(Vh,$e.TEXT),t}w(r,o);var e=r.prototype;return e.makeDeobfuscatorFactory=function(){var t=this;return function(n){return t.deobfuscators[n]}},e.loadAsPlainXML=function(t,n,i){return this.plainXMLStore.load(t,n,i)},e.startLoadingAsPlainXML=function(t){this.plainXMLStore.fetch(t)},e.loadAsJSON=function(t,n,i){return this.jsonStore.load(t,n,i)},e.startLoadingAsJSON=function(t){this.jsonStore.fetch(t)},e.loadPubDoc=function(t,n){var i=this,a=L("loadPubDoc");return hi(t,null,"HEAD").then(function(s){if(s.status>=400)i.loadEPUBDoc(t,n).then(function(h){h?a.finish(h):(M.error("Failed to fetch a source document from "+t+" ("+s.status+(s.statusText?" "+s.statusText:"")+")"),a.finish(null))});else if(s.status||s.responseXML||s.responseText||s.responseBlob||s.contentType||/\/[^/.]+(?:[#?]|$)/.test(t)&&(t=t.replace(/([#?]|$)/,"/$1")),s.contentType=="application/oebps-package+xml"||/\.opf(?:[#?]|$)/.test(t)){var u=t.match(/^((?:.*\/)?)([^/]*)$/);i.loadOPF(u[1],u[2],n).thenFinish(a)}else s.contentType=="application/ld+json"||s.contentType=="application/webpub+json"||s.contentType=="application/audiobook+json"||s.contentType=="application/json"||/\.json(?:ld)?(?:[#?]|$)/.test(t)?i.loadAsJSON(t,!0).then(function(h){if(!h)return i.reportLoadError(t),void a.finish(null);var c=new Nr(i,t);c.initWithWebPubManifest(h,void 0,t).then(function(){a.finish(c)})}):i.loadWebPub(t).then(function(h){h?a.finish(h):i.loadEPUBDoc(t,n).then(function(c){c?a.finish(c):(M.error("Failed to load "+t+"."),a.finish(null))})})}),a.result()},e.loadEPUBDoc=function(t,n){var i=this,a=L("loadEPUBDoc");return t.endsWith("/")||(t+="/"),n&&this.startLoadingAsJSON(t+"?r=list"),this.startLoadingAsPlainXML(t+"META-INF/encryption.xml"),this.loadAsPlainXML(t+"META-INF/container.xml").then(function(s){if(s)for(var u,h=B(s.doc().child("container").child("rootfiles").child("rootfile").attribute("full-path"));!(u=h()).done;){var c=u.value;if(c)return void i.loadOPF(t,c,n).thenFinish(a)}a.finish(null)}),a.result()},e.loadOPF=function(t,n,i){var a=this,s=t+n,u=this.opfByURL[s];if(u)return I(u);var h=L("loadOPF");return this.loadAsPlainXML(s,!0,"Failed to fetch EPUB OPF "+s).then(function(c){c?a.loadAsPlainXML(t+"META-INF/encryption.xml").then(function(d){(i?a.loadAsJSON(t+"?r=list"):I(null)).then(function(f){(u=new Nr(a,t)).initWithXMLDoc(c,d,f,t+"?r=manifest").then(function(){a.opfByURL[s]=u,a.primaryOPFByEPubURL[t]=u,h.finish(u)})})}):a.reportLoadError(s)}),h.result()},e.loadWebPub=function(t){var n=this,i=L("loadWebPub");return this.load(t).then(function(a){if(a)if(a.document.querySelector("a[href='META-INF/'],a[href$='/META-INF/']"))i.finish(null);else{var s=a.document,u=new Nr(n,t);s.body&&s.body.setAttribute("data-vivliostyle-primary-entry",!0);var h=s.querySelector("link[rel='publication'],link[rel='manifest'][type='application/webpub+json']");if(h){var c=h.getAttribute("href");if(/^#/.test(c)){var d=It(s.getElementById(c.substr(1)).textContent);u.initWithWebPubManifest(d,s).then(function(){i.finish(u)})}else{var f=wt(h.getAttribute("href"),t);n.loadAsJSON(f).then(function(v){u.initWithWebPubManifest(v,s,f).then(function(){i.finish(u)})})}}else u.initWithWebPubManifest({},s).then(function(){u.xhtmlToc&&u.xhtmlToc.src===a.url&&(s.querySelector("[role=doc-toc], [role=directory], nav, .toc, #toc")||(u.xhtmlToc=null)),i.finish(u)})}else n.reportLoadError(t)}),i.result()},e.addDocument=function(t,n){var i=L("EPUBDocStore.load"),a=Ct(t);return(this.documents[a]=this.parseOPSResource({status:200,statusText:"",url:a,contentType:n.contentType,responseText:null,responseXML:n,responseBlob:null})).thenFinish(i),i.result()},e.reportLoadError=function(t){var n,i=this,a=function(s){return s.replace(/([^:/?#]|^)[/?#].*/,"$1")};t.startsWith("data:")?M.error("Failed to load "+t+". Invalid data."):t.startsWith("http:")&&bt.startsWith("https:")?M.error("Failed to load "+t+'. Mixed Content ("http:" content on "https:" context) is not allowed.'):(n=a(t))===a(bt)||Object.keys(i.resources).find(function(s){return i.resources[s]&&a(s)===n})||/\.(xhtml|xht|xml|opf)$/i.test(t)?M.error("Failed to load "+t+". The target resource is invalid."):M.error("Failed to load "+t+". This may be caused by the server not allowing cross-origin resource sharing (CORS).")},e.load=function(t){var n=this,i=Ct(t),a=this.documents[i];if(a)return a.isPending()?a:I(a.get());var s=L("EPUBDocStore.load");return(a=o.prototype.load.call(this,i,!0,"Failed to fetch a source document from "+i)).then(function(u){u?s.finish(u):n.reportLoadError(i)}),s.result()},r}(kf),pl=function(){function o(){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=void 0,this.itemProperties=jt}var r=o.prototype;return r.initWithElement=function(e,t){this.id=e.getAttribute("id"),this.src=wt(e.getAttribute("href"),t),this.mediaType=e.getAttribute("media-type");var n=e.getAttribute("properties");n&&(this.itemProperties=function(i){for(var a={},s=0;s<i.length;s++)a[i[s]]=!0;return a}(n.split(/\s+/)))},r.initWithParam=function(e){this.spineIndex=e.index,this.id="item"+(e.index+1),this.src=e.url,this.startPage=e.startPage,this.skipPagesBefore=e.skipPagesBefore},o}();function Mf(o){return o.id}var bn={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"},Pi="http://idpf.org/epub/vocab/package/meta/#",ae={language:bn.dcterms+"language",title:bn.dcterms+"title",creator:bn.dcterms+"creator",layout:bn.rendition+"layout",titleType:Pi+"title-type",displaySeq:Pi+"display-seq",alternateScript:Pi+"alternate-script",role:Pi+"role"};function Uf(o,r){var e={};return function(t,n){var i,a,s,u,h,c=t.r||e,d=n.r||e;if(o==ae.title&&(s=((u=c[ae.titleType])==null?void 0:u[0].v)=="main")!=(((h=d[ae.titleType])==null?void 0:h[0].v)=="main"))return s?-1:1;var f=parseInt((i=c[ae.displaySeq])==null?void 0:i[0].v,10);isNaN(f)&&(f=Number.MAX_VALUE);var v,g,p=parseInt((a=d[ae.displaySeq])==null?void 0:a[0].v,10);return isNaN(p)&&(p=Number.MAX_VALUE),f!=p?f-p:o!=ae.language&&r&&(s=((v=c[ae.language]||c[ae.alternateScript])==null?void 0:v[0].v)==r)!=(((g=d[ae.language]||d[ae.alternateScript])==null?void 0:g[0].v)==r)?s?-1:1:t.o-n.o}}function gl(){var o=window.MathJax;return o?o.Hub:null}var Sn,vl={"application/xhtml+xml":!0,"image/jpeg":!0,"image/png":!0,"image/svg+xml":!0,"image/gif":!0,"audio/mp3":!0},Nr=function(){function o(e,t){this.store=void 0,this.pubURL=void 0,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=void 0,this.store=e,this.pubURL=t,this.documentURLTransformer=this.createDocumentURLTransformer(),gl()&&(xs[U.MATHML]=!0)}var r=o.prototype;return r.createDocumentURLTransformer=function(){var e=this;return new(function(){function t(){}var n=t.prototype;return n.transformFragment=function(i,a){return"viv-id-"+Ea(a+(i?"#"+i:""),":")},n.transformURL=function(i,a){var s=i.match(/^([^#]*)#?(.*)$/);if(s){var u=s[1]||a,h=decodeURIComponent(s[2]);if(u&&e.items.some(function(c){return c.src===u}))return"#"+this.transformFragment(h,u)}return i},n.restoreURL=function(i){i.charAt(0)==="#"&&(i=i.substring(1)),i.indexOf("viv-id-")===0&&(i=i.substring("viv-id-".length));var a=function(s,u){u=typeof u=="string"?u:"\\u";var h=new RegExp(hn(u)+"[0-9a-fA-F]{4}","g");return s.replace(h,function(c){return function(d,f){return d.indexOf(f=typeof f=="string"?f:"\\u")===0?String.fromCharCode(parseInt(d.substring(f.length),16)):d}(c,u)})}(i,":").match(/^([^#]*)#?(.*)$/);return a?[a[1],a[2]]:[]},t}())},r.getMetadata=function(){return this.metadata},r.getPathFromURL=function(e){if(e.startsWith("data:"))return e===this.pubURL?"":e;if(this.pubURL){var t=wt("",this.pubURL);return e===t||e+"/"===t?"":(t.charAt(t.length-1)!="/"&&(t+="/"),e.substr(0,t.length)==t?decodeURIComponent(e.substr(t.length)):null)}return e},r.initWithXMLDoc=function(e,t,n,i){var a=this;this.opfXML=e,this.encXML=t;var s=e.doc().child("package"),u=s.attribute("unique-identifier")[0];if(u){var h=e.getElement(e.url+"#"+u);h&&(this.uid=h.textContent.replace(/[ \n\r\t]/g,""))}var c={};for(var d in this.items=s.child("manifest").child("item").asArray().map(function(ft){var tt=new pl,j=ft;tt.initWithElement(j,e.url);var ot=j.getAttribute("fallback");return ot&&!vl[tt.mediaType]&&(c[tt.src]=ot),!a.xhtmlToc&&tt.itemProperties.nav&&(a.xhtmlToc=tt),!a.cover&&tt.itemProperties["cover-image"]&&(a.cover=tt),tt}),this.itemMap=Da(this.items,Mf),this.itemMapByPath=Da(this.items,function(ft){return a.getPathFromURL(ft.src)}),c)for(var f=d;;){var v=this.itemMap[c[f]];if(!v)break;if(vl[v.mediaType]){this.fallbackMap[d]=v.src;break}f=v.src}this.spine=s.child("spine").child("itemref").asArray().map(function(ft,tt){var j=ft,ot=j.getAttribute("idref"),Y=a.itemMap[ot];return Y&&(Y.itemRefElement=j,Y.spineIndex=tt),Y});var g=s.child("spine").attribute("toc")[0];g&&(this.ncxToc=this.itemMap[g]);var p=s.child("spine").attribute("page-progression-direction")[0];p&&(this.pageProgression=sn(p));for(var E=t?t.doc().child("encryption").child("EncryptedData").predicate(ul.withChild("EncryptionMethod",ul.withAttribute("Algorithm","http://www.idpf.org/2008/embedding"))).child("CipherData").child("CipherReference").attribute("URI"):[],C=s.child("bindings").child("mediaType").asArray(),D=0;D<C.length;D++){var y=C[D].getAttribute("handler"),N=C[D].getAttribute("media-type");N&&y&&this.itemMap[y]&&(this.bindings[N]=this.itemMap[y].src)}if(this.metadata=function(ft,tt){var j;if(tt){for(var ot in j={},bn)j[ot]=bn[ot];for(var Y;(Y=tt.match(/^\s*([A-Z_a-z\u007F-\uFFFF][-.A-Z_a-z0-9\u007F-\uFFFF]*):\s*(\S+)/))!=null;)tt=tt.substr(Y[0].length),j[Y[1]]=Y[2]}else j=bn;var vt=function(dt){if(dt){var yt=dt.match(/^\s*(([^:]*):)?(\S+)\s*$/);if(yt){var he=yt[2]?j[yt[2]]:Pi;if(he)return he+yt[3]}}return null},et=1,st=ft.childElements().forEachNonNull(function(dt){if(dt.localName=="meta"){var yt=vt(dt.getAttribute("property"));if(yt)return{name:yt,value:dt.textContent,id:dt.getAttribute("id"),order:et++,refines:dt.getAttribute("refines"),lang:null,scheme:vt(dt.getAttribute("scheme")),role:null}}else if(dt.namespaceURI==U.DC)return{name:bn.dcterms+dt.localName,order:et++,lang:dt.getAttribute("xml:lang"),value:dt.textContent,id:dt.getAttribute("id"),refines:null,scheme:null,role:dt.getAttribute("role")||dt.getAttribute("opf:role")};return null}),mt=Ir(st,function(dt){return dt.refines}),$=function dt(yt){return function(he,at){var pt={};for(var Ue in he)pt[Ue]=he[Ue].map(function(Qt){var en={v:Qt.value,o:Qt.order};Qt.scheme&&(en.s=Qt.scheme);var Qe=mt["#"+Qt.id]||[];if(Qe.length||Qt.lang||Qt.role){Qt.lang&&Qe.push({name:ae.language,value:Qt.lang,lang:null,id:null,refines:Qt.id,scheme:null,order:Qt.order,role:null}),Qt.role&&Qe.push({name:ae.role,value:Qt.role,lang:null,id:null,refines:Qt.id,scheme:null,order:Qt.order,role:null});var Ri=Ir(Qe,function(ta){return ta.name});en.r=dt(Ri)}return en});return pt}(yt)}(Ir(st,function(dt){return dt.refines?null:dt.name})),Me=null;return $[ae.language]&&(Me=$[ae.language][0].v),function dt(yt){for(var he in yt){var at=yt[he];at.sort(Uf(he,Me));for(var pt=0;pt<at.length;pt++){var Ue=at[pt].r;Ue&&dt(Ue)}}}($),$}(s.child("metadata"),s.attribute("prefix")[0]),this.metadata[ae.language]&&(this.lang=this.metadata[ae.language][0].v),this.metadata[ae.layout]&&(this.prePaginated=this.metadata[ae.layout][0].v==="pre-paginated"),!n){if(E.length>0&&this.uid)for(var x=function(ft){var tt=function(j){for(var ot,Y=[],vt=B(dl(j));!(ot=vt()).done;){var et=ot.value;Y.push(et>>>24&255,et>>>16&255,et>>>8&255,255&et)}return Y}(ft);return function(j){var ot,Y,vt=L("deobfuscator");return j.slice?(ot=j.slice(0,1040),Y=j.slice(1040,j.size)):(ot=j.webkitSlice(0,1040),Y=j.webkitSlice(1040,j.size-1040)),function(et){var st=L("readBlob"),mt=new FileReader,$=st.suspend(mt);return mt.addEventListener("load",function(){$.schedule(mt.result)},!1),mt.readAsArrayBuffer(et),st.result()}(ot).then(function(et){for(var st=new DataView(et),mt=0;mt<st.byteLength;mt++){var $=st.getUint8(mt);st.setUint8(mt,$^=tt[mt%20])}vt.finish(uo([st,Y]))}),vt.result()}}(this.uid),F=0;F<E.length;F++)this.store.deobfuscators[this.pubURL+E[F]]=x;return this.prePaginated&&this.assignAutoPages(),I(!0)}var k=new Re,H={};if(E.length>0&&this.uid)for(var K="1040:"+function(ft){for(var tt=function(Y){for(var vt=dl(Y),et=new Re,st=0;st<vt.length;st++)et.append(cl(vt[st]));return et.toString()}(ft),j=new Re,ot=0;ot<tt.length;ot++)j.append((256|tt.charCodeAt(ot)).toString(16).substr(1));return j.toString()}(this.uid),q=0;q<E.length;q++)H[E[q]]=K;for(var W=0;W<n.length;W++){var G=n[W],X=G.n;if(X){var it=decodeURIComponent(X),lt=this.itemMapByPath[it],Ht=null;lt&&(lt.compressed=G.m!=0,lt.compressedSize=G.c,lt.mediaType&&(Ht=lt.mediaType.replace(/\s+/g,"")));var ct=H[it];(Ht||ct)&&(k.append(X),k.append(" "),k.append(Ht||"application/octet-stream"),ct&&(k.append(" "),k.append(ct)),k.append(
))}}return this.assignAutoPages(),hi(i,$e.DEFAULT,"POST",k.toString(),"text/plain")},r.assignAutoPages=function(){for(var e,t=0,n=B(this.spine);!(e=n()).done;){var i=e.value,a=this.prePaginated?1:Math.ceil(i.compressedSize/1024);i.epage=t,i.epageCount=a,t+=a}this.epageCount=t,this.epageCountCallback&&this.epageCountCallback(this.epageCount)},r.setEPageCountMode=function(e){this.epageIsRenderedPage=e||this.prePaginated},r.countEPages=function(e){var t=this;if(this.epageCountCallback=e,this.epageIsRenderedPage)return this.prePaginated&&this.epageCount==0&&this.assignAutoPages(),I(!0);var n=0,i=0,a=L("countEPages");return a.loopWithFrame(function(s){if(i!==t.spine.length){var u=t.spine[i++];u.epage=n,t.store.load(u.src).then(function(h){var c=1800,d=h.lang||t.lang;d&&d.match(/^(ja|ko|zh)/)&&(c/=3),u.epageCount=Math.ceil(h.getTotalOffset()/c),t.epageCount=n+=u.epageCount,t.epageCountCallback&&t.epageCountCallback(t.epageCount),s.continueLoop()})}else s.breakLoop()}).thenFinish(a),a.result()},r.initWithChapters=function(e,t){var n=this;this.itemMap={},this.itemMapByPath={},this.items=[],this.spine=this.items;var i=this.opfXML=new al(null,"",new DOMParser().parseFromString("<spine></spine>","text/xml"));return e.forEach(function(a){var s=new pl;s.initWithParam(a);var u=i.document.createElement("itemref");u.setAttribute("idref",s.id),i.root.appendChild(u),s.itemRefElement=u,n.itemMap[s.id]=s;var h=n.getPathFromURL(a.url);h==null&&(h=a.url),n.itemMapByPath[h]=s,n.items.push(s)}),t?this.store.addDocument(e[0].url,t):I(null)},r.initWithWebPubManifest=function(e,t,n){var i=this;e.readingProgression&&(this.pageProgression=e.readingProgression),this.metadata===void 0&&(this.metadata={});var a=t&&t.title||e.name||e.metadata&&e.metadata.title;a&&(this.metadata[ae.title]=[{v:a}]);var s=this.getPathFromURL(this.pubURL);if(!e.readingOrder&&t&&s!==null){e.readingOrder=[encodeURI(s)];for(var u,h=B(t.querySelectorAll("[role=doc-toc] a[href],[role=directory] a[href],nav li a[href],.toc a[href],#toc a[href]"));!(u=h()).done;){var c=u.value.getAttribute("href");if(!/^(https?:)?\/\//.test(c)){var d=Ct(wt(c,this.pubURL)),f=this.getPathFromURL(d),v=f!==null?encodeURI(f):d;e.readingOrder.indexOf(v)==-1&&e.readingOrder.push(v)}}}var g=[],p=0,E=-1;[e.readingOrder,e.resources].forEach(function(D){D instanceof Array&&D.forEach(function(y){var N=e.readingOrder.includes(y),x=typeof y=="string"?y:y.url||y.href,F=typeof y=="string"?"":y.encodingFormat||y.href&&y.type||"";if(N||F==="text/html"||F==="application/xhtml+xml"||/(^|\/)([^/]+\.(x?html|htm|xht)|[^/.]*)([#?]|$)/.test(x)){var k=n?n.replace(/\/[^/]+$/,"/"):i.pubURL,H={url:wt(ei(x),k),index:p++,startPage:null,skipPagesBefore:null};y.rel==="contents"&&E===-1&&(E=H.index),g.push(H)}})});var C=L("initWithWebPubManifest");return this.initWithChapters(g).then(function(){var D;E!==-1&&(i.xhtmlToc=i.items[E]),i.xhtmlToc||(i.xhtmlToc=n?(D=i.items)==null?void 0:D[0]:i.itemMapByPath[s]),C.finish(!0)}),C.result()},r.getCFI=function(e,t){var n=this.spine[e],i=L("getCFI");return this.store.load(n.src).then(function(a){var s=a.getNodeByOffset(t),u=null;if(s){var h=a.getNodeOffset(s,0,!1),c=t-h,d=new Ta;d.prependPathFromNode(s,c,!1,null),n.itemRefElement&&d.prependPathFromNode(n.itemRefElement,0,!1,null),u=d.toString()}i.finish(u)}),i.result()},r.resolveFragment=function(e){var t=this;return Vn("resolveFragment",function(n){if(e){var i,a=new Ta;if(a.fromString(e),t.opfXML){var s=a.navigate(t.opfXML.document);if(s.node.nodeType!=1||s.after||!s.ref)return void n.finish(null);var u=s.node,h=u.getAttribute("idref");if(u.localName!="itemref"||!h||!t.itemMap[h])return void n.finish(null);i=t.itemMap[h],a=s.ref}else i=t.spine[0];t.store.load(i.src).then(function(c){var d=a.navigate(c.document),f=c.getNodeOffset(d.node,d.offset,d.after);n.finish({spineIndex:i.spineIndex,offsetInItem:f,pageIndex:-1})})}else n.finish(null)},function(n,i){M.warn(i,"Cannot resolve fragment:",e),n.finish(null)})},r.resolveEPage=function(e){var t=this;return Vn("resolveEPage",function(n){if(e<=0)n.finish({spineIndex:0,offsetInItem:0,pageIndex:-1});else if(t.epageIsRenderedPage){var i=t.spine.findIndex(function(c){return c.epage==0&&c.epageCount==0||c.epage<=e&&c.epage+c.epageCount>e});i==-1&&(i=t.spine.length-1);var a=t.spine[i];a&&a.epageCount!=0||(a=t.spine[--i]);var s=Math.floor(e-a.epage);n.finish({spineIndex:i,offsetInItem:-1,pageIndex:s})}else{var u=cn(t.spine.length,function(c){var d=t.spine[c];return d.epage+d.epageCount>e});u==t.spine.length&&u--;var h=t.spine[u];t.store.load(h.src).then(function(c){(e-=h.epage)>h.epageCount&&(e=h.epageCount);var d=0;if(e>0){var f=c.getTotalOffset();(d=Math.round(f*e/h.epageCount))==f&&d--}n.finish({spineIndex:u,offsetInItem:d,pageIndex:-1})})}},function(n,i){M.warn(i,"Cannot resolve epage:",e),n.finish(null)})},r.getEPageFromPosition=function(e){var t=this.spine[e.spineIndex];if(this.epageIsRenderedPage)return I(t.epage+e.pageIndex);if(e.offsetInItem<=0)return I(t.epage);var n=L("getEPage");return this.store.load(t.src).then(function(i){var a=i.getTotalOffset(),s=Math.min(a,e.offsetInItem);n.finish(t.epage+s*t.epageCount/a)}),n.result()},o}(),br=function(o,r){return{page:o,position:{spineIndex:o.spineIndex,pageIndex:r,offsetInItem:o.offset}}},Vf=function(){function o(e,t,n,i,a){this.opf=void 0,this.viewport=void 0,this.fontMapper=void 0,this.pageSheetSizeReporter=void 0,this.spineItems=[],this.spineItemLoadingContinuations=[],this.pref=void 0,this.clientLayout=void 0,this.counterStore=void 0,this.tocAutohide=!1,this.tocView=void 0,this.opf=e,this.viewport=t,this.fontMapper=n,this.pageSheetSizeReporter=a,this.pref=xa(i),this.clientLayout=new ol(t),this.counterStore=new fh(e.documentURLTransformer)}var r=o.prototype;return r.getPage=function(e){var t=this.spineItems[e.spineIndex];return t?t.pages[e.pageIndex]:null},r.getCurrentPageProgression=function(e){if(this.opf.pageProgression)return this.opf.pageProgression;var t=this.spineItems[e?e.spineIndex:0];return t?t.instance.pageProgression:null},r.finishPageContainer=function(e,t,n){t.container.style.display="none",t.container.style.visibility="visible",t.container.style.position="",t.container.style.top="",t.container.style.left="",t.container.setAttribute("data-vivliostyle-page-side",t.side);var i=e.pages[n];if(t.isFirstPage=e.item.spineIndex==0&&n==0,e.pages[n]=t,this.opf.epageIsRenderedPage){if(n==0&&e.item.spineIndex>0){var a=this.opf.spine[e.item.spineIndex-1];e.item.epage=a.epage+a.epageCount}e.item.epageCount=e.pages.length,this.opf.epageCount=this.opf.spine.reduce(function(c,d){return c+d.epageCount},0),this.opf.epageCountCallback&&this.opf.epageCountCallback(this.opf.epageCount)}if(i)e.instance.viewport.contentContainer.replaceChild(t.container,i.container),i.dispatchEvent({type:"replaced",target:null,currentTarget:null,preventDefault:null,newPage:t});else{var s=null;if(n>0)s=e.pages[n-1].container.nextElementSibling;else for(var u=e.item.spineIndex+1;u<this.spineItems.length;u++){var h=this.spineItems[u];if(h&&h.pages[0]){s=h.pages[0].container;break}}e.instance.viewport.contentContainer.insertBefore(t.container,s)}this.pageSheetSizeReporter({width:e.instance.pageSheetWidth,height:e.instance.pageSheetHeight},e.instance.pageSheetSize,e.item.spineIndex,e.instance.pageNumberOffset+n)},r.renderSinglePage=function(e,t){var n=this,i=L("renderSinglePage"),a=this.makePage(e,t);return e.instance.layoutNextPage(a,t).then(function(s){var u=(t=s)?t.page-1:e.layoutPositions.length-1;n.finishPageContainer(e,a,u),n.counterStore.finishPage(a.spineIndex,u);var h=null;if(t){var c=e.layoutPositions[t.page];e.layoutPositions[t.page]=t,c&&e.pages[t.page]&&(t.isSamePosition(c)||(h=n.renderSinglePage(e,t)))}h||(h=I(!0)),h.then(function(){var d=n.counterStore.getUnresolvedRefsToPage(a),f=0;i.loopWithFrame(function(v){if(++f>d.length)v.breakLoop();else{var g=d[f-1];g.refs=g.refs.filter(function(p){return!p.isResolved()}),g.refs.length!==0?n.getPageViewItem(g.spineIndex).then(function(p){p?(n.counterStore.pushPageCounters(g.pageCounters),n.counterStore.pushReferencesToSolve(g.refs),n.renderSinglePage(p,p.layoutPositions[g.pageIndex]).then(function(E){n.counterStore.popPageCounters(),n.counterStore.popReferencesToSolve();var C=E.pageAndPosition.position;C.spineIndex===a.spineIndex&&C.pageIndex===u&&(a=E.pageAndPosition.page),v.continueLoop()})):v.continueLoop()}):v.continueLoop()}}).then(function(){a.container.parentElement||(a=e.pages[u]),a.isLastPage=!t&&e.item.spineIndex===n.opf.spine.length-1,a.isLastPage&&n.counterStore.finishLastPage(n.viewport),i.finish({pageAndPosition:br(a,u),nextLayoutPosition:t})})})}),i.result()},r.normalizeSeekPosition=function(e,t){var n=e.pageIndex,i=-1;if(n<0){i=e.offsetInItem;var a=cn(t.layoutPositions.length,function(s){return t.instance.getPosition(t.layoutPositions[s],!0)>i});n=a===t.layoutPositions.length?t.complete?t.layoutPositions.length-1:Number.POSITIVE_INFINITY:a-1}else n===Number.POSITIVE_INFINITY&&e.offsetInItem!==-1&&(i=e.offsetInItem);return{spineIndex:e.spineIndex,pageIndex:n,offsetInItem:i}},r.findPage=function(e,t){var n=this,i=L("findPage");return this.getPageViewItem(e.spineIndex).then(function(a){if(a){var s,u=null;i.loopWithFrame(function(h){var c=n.normalizeSeekPosition(e,a);(u=a.pages[s=c.pageIndex])?h.breakLoop():a.complete?(u=a.pages[s=a.layoutPositions.length-1],h.breakLoop()):t?n.renderPage(c).then(function(d){d&&(u=d.page,s=d.position.pageIndex),h.breakLoop()}):i.sleep(100).then(function(){h.continueLoop()})}).then(function(){i.finish(br(u,s))})}else i.finish(null)}),i.result()},r.renderPage=function(e){var t=this,n=L("renderPage");return this.getPageViewItem(e.spineIndex).then(function(i){if(i){var a=t.normalizeSeekPosition(e,i),s=a.pageIndex,u=a.offsetInItem,h=i.pages[s];h?n.finish(br(h,s)):n.loopWithFrame(function(c){if(s<i.layoutPositions.length)c.breakLoop();else{if(i.complete)return s=i.layoutPositions.length-1,void c.breakLoop();var d=i.layoutPositions[i.layoutPositions.length-1];t.renderSinglePage(i,d).then(function(f){var v=f.pageAndPosition.page;if(d=f.nextLayoutPosition){if(u>=0&&i.instance.getPosition(d)>u)return h=v,s=i.layoutPositions.length-2,void c.breakLoop();c.continueLoop()}else h=v,s=f.pageAndPosition.position.pageIndex,i.complete=!0,c.breakLoop()})}}).then(function(){var c=i.layoutPositions[s];(h=h||i.pages[s])?n.finish(br(h,s)):t.renderSinglePage(i,c).then(function(d){d.nextLayoutPosition||(i.complete=!0),n.finish(d.pageAndPosition)})})}else n.finish(null)}),n.result()},r.renderAllPages=function(){return this.renderPagesUpto({spineIndex:this.opf.spine.length-1,pageIndex:Number.POSITIVE_INFINITY,offsetInItem:-1},!1)},r.renderPagesUpto=function(e,t){var n=this,i=L("renderPagesUpto");e||(e={spineIndex:0,pageIndex:0,offsetInItem:0});var a,s=e.spineIndex,u=e.pageIndex,h=0;return t&&(h=s),i.loopWithFrame(function(c){n.renderPage({spineIndex:h,pageIndex:h===s?u:Number.POSITIVE_INFINITY,offsetInItem:h===s?e.offsetInItem:-1}).then(function(d){a=d,++h>s?c.breakLoop():c.continueLoop()})}).then(function(){i.finish(a)}),i.result()},r.firstPage=function(e,t){return this.findPage({spineIndex:0,pageIndex:0,offsetInItem:-1},t)},r.lastPage=function(e,t){return this.findPage({spineIndex:this.opf.spine.length-1,pageIndex:Number.POSITIVE_INFINITY,offsetInItem:-1},t)},r.nextPage=function(e,t){var n=this,i=e.spineIndex,a=e.pageIndex,s=L("nextPage");return this.getPageViewItem(i).then(function(u){if(u){if(u.complete&&a==u.layoutPositions.length-1){if(i>=n.opf.spine.length-1)return void s.finish(null);i++,a=0;var h=n.spineItems[i],c=h&&h.pages[0],d=u.pages[u.pages.length-1];c&&d&&c.side==d.side&&(h.pages.forEach(function(f){f.container&&f.container.remove()}),n.spineItems[i]=null,n.spineItemLoadingContinuations[i]=null)}else a++;n.findPage({spineIndex:i,pageIndex:a,offsetInItem:-1},t).thenFinish(s)}else s.finish(null)}),s.result()},r.previousPage=function(e,t){var n=e.spineIndex,i=e.pageIndex;if(i==0){if(n==0)return I(null);n--,i=Number.POSITIVE_INFINITY}else i--;return this.findPage({spineIndex:n,pageIndex:i,offsetInItem:-1},t)},r.isRectoPage=function(e,t){var n=e.side===R.PageSide.LEFT,i=this.getCurrentPageProgression(t)===R.PageProgression.LTR;return!n&&i||n&&!i},r.getSpread=function(e,t){var n=this,i=L("getCurrentSpread"),a=this.getPage(e);if(!a)return I({left:null,right:null});var s=a.side===R.PageSide.LEFT;return(this.isRectoPage(a,e)?this.previousPage(e,t):this.nextPage(e,t)).then(function(u){var h=n.getPage(e),c=u&&u.page;c&&c.side===h.side&&(c=null),i.finish(s?{left:h,right:c}:{left:c,right:h})}),i.result()},r.nextSpread=function(e,t){var n=this,i=this.getPage(e);if(!i)return I(null);var a=this.isRectoPage(i,e),s=this.nextPage(e,t);return a?s:s.thenAsync(function(u){if(u){if(u.page.side===i.side)return s;var h=n.nextPage(u.position,t);return h.thenAsync(function(c){return c?h:s})}return I(null)})},r.previousSpread=function(e,t){var n=this,i=this.getPage(e);if(!i)return I(null);var a=this.isRectoPage(i,e),s=this.previousPage(e,t),u=i.container.previousElementSibling;return a?s.thenAsync(function(h){return h?h.page.side===i.side||h.page.container!==u?s:n.previousPage(h.position,t):I(null)}):s},r.navigateToEPage=function(e,t,n){var i=this,a=L("navigateToEPage");return this.opf.resolveEPage(e).then(function(s){s?i.findPage(s,n).thenFinish(a):a.finish(null)}),a.result()},r.navigateToFragment=function(e,t,n){var i=this,a=L("navigateToCFI");return this.opf.resolveFragment(e).then(function(s){s?i.findPage(s,n).thenFinish(a):a.finish(null)}),a.result()},r.navigateTo=function(e,t,n){var i=this;M.debug("Navigate to",e);var a=this.opf.getPathFromURL(Ct(e));if(!a){if(this.opf.opfXML&&e.match(/^#epubcfi\(/))a=this.opf.getPathFromURL(this.opf.opfXML.url);else if(e.charAt(0)==="#"){var s=this.opf.documentURLTransformer.restoreURL(e);this.opf.opfXML?(a=this.opf.getPathFromURL(s[0]))==null&&(a=s[0]):a=s[0],e=s[0]+(s[1]?"#"+s[1]:"")}if(a==null)return I(null)}var u=this.opf.itemMapByPath[a];if(!u){if(this.opf.opfXML&&a==this.opf.getPathFromURL(this.opf.opfXML.url)){var h=e.indexOf("#");if(h>=0)return this.navigateToFragment(e.substr(h+1),t,n)}return I(null)}var c=L("navigateTo");return this.getPageViewItem(u.spineIndex).then(function(d){if(d){var f=d.xmldoc.getElement(e);i.findPage({spineIndex:u.spineIndex,pageIndex:-1,offsetInItem:f?d.xmldoc.getElementOffset(f):0},n).thenFinish(c)}else c.finish(null)}),c.result()},r.makePage=function(e,t){var n=e.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",R.isDebug||(i.style.visibility="hidden",i.setAttribute("aria-hidden","true")),n.layoutBox.appendChild(i);var a=n.document.createElement("div");a.setAttribute("data-vivliostyle-bleed-box","true"),i.appendChild(a);var s=new Zi(i,a);if(s.spineIndex=e.item.spineIndex,s.position=t,s.offset=e.instance.getPosition(t),s.offset===0){var u=this.opf.documentURLTransformer.transformFragment("",e.item.src);a.setAttribute("id",u),s.registerElementWithId(a,u)}if(n!==this.viewport){var h=Fa(this.viewport.width,this.viewport.height,n.width,n.height),c=Yi(null,new mn(h,null),"");s.delayedItems.push(new go(i,"transform",c))}return s},r.makeObjectView=function(e,t,n,i){var a=t.getAttribute("data"),s=null;if(a){a=wt(a,e.url);var u=t.getAttribute("media-type");if(!u){var h=this.opf.getPathFromURL(a);if(h){var c=this.opf.itemMapByPath[h];c&&(u=c.mediaType)}}if(u){var d=this.opf.bindings[u];if(d){(s=this.viewport.document.createElement("iframe")).style.border="none";var f=va(a),v=va(u),g=new Re;g.append(d),g.append("?src="),g.append(f),g.append("&type="),g.append(v);for(var p=t.firstChild;p;p=p.nextSibling)if(p.nodeType==1){var E=p;if(E.localName=="param"&&E.namespaceURI==U.XHTML){var C=E.getAttribute("name"),D=E.getAttribute("value");C&&D&&(g.append("&"),g.append(encodeURIComponent(C)),g.append("="),g.append(encodeURIComponent(D)))}}s.setAttribute("src",g.toString());var y=t.getAttribute("width");y&&s.setAttribute("width",y);var N=t.getAttribute("height");N&&s.setAttribute("height",N)}}}return s||(s=this.viewport.document.createElement("span")).setAttribute("data-adapt-process-children","true"),I(s)},r.makeMathJaxView=function(e,t,n,i){var a=gl();if(a){var s=n.ownerDocument,u=s.createElement("span");n.appendChild(u);var h=s.importNode(t,!0);this.resolveURLsInMathML(h,e),u.appendChild(h);var c=a.queue;c.Push(["Typeset",a,u]);var d=L("makeMathJaxView"),f=d.suspend();return c.Push(function(){f.schedule(u)}),d.result()}return I(null)},r.resolveURLsInMathML=function(e,t){if(e!=null){if(e.nodeType===1&&e.tagName==="mglyph")for(var n=0,i=Array.from(e.attributes);n<i.length;n++){var a=i[n];if(a.name==="src"){var s=wt(a.nodeValue,t.url);a.namespaceURI?e.setAttributeNS(a.namespaceURI,a.name,s):e.setAttribute(a.name,s)}}e.firstChild&&this.resolveURLsInMathML(e.firstChild,t),e.nextSibling&&this.resolveURLsInMathML(e.nextSibling,t)}},r.makeCustomRenderer=function(e){var t=this;return function(n,i,a){return n.localName=="object"&&n.namespaceURI==U.XHTML?t.makeObjectView(e,n,i,a):n.namespaceURI==U.MATHML||n.dataset&&n.dataset.mathTypeset=="true"?t.makeMathJaxView(e,n,i,a):I(null)}},r.getPageViewItem=function(e){var t=this;if(e===-1||e>=this.opf.spine.length)return I(null);var n=this.spineItems[e];if(n)return I(n);var i=L("getPageViewItem"),a=this.spineItemLoadingContinuations[e];if(a){var s=i.suspend();return a.push(s),i.result()}a=this.spineItemLoadingContinuations[e]=[];var u=this.opf.spine[e],h=this.opf.store;return h.load(u.src).then(function(c){var d,f=u.itemRefElement.getAttribute("properties");f&&c.root.setAttribute("data-vivliostyle-epub-spine-properties",f),u.title=c.document.title;var v=h.getStyleForDoc(c),g=t.makeCustomRenderer(c),p=t.viewport,E=v.sizeViewport(p.width,p.height,p.fontSize,t.pref);E.width==p.width&&E.height==p.height&&E.fontSize==p.fontSize||(p=new wr(p.window,E.fontSize,p.root,E.width,E.height));var C,D,y=(d=t.spineItems[0])==null?void 0:d.instance.isVersoFirstPage,N=t.spineItems[e-1];if(u.startPage!==null)D=C=u.startPage-1;else{if(!(e>0)||N&&N.complete){C=N?N.instance.pageNumberOffset+N.pages.length:0;var x=t.counterStore.currentPageCounters.page;D=x&&x.length?x[x.length-1]:C}else C=u.epage||e,t.opf.prePaginated||C%2!=(y?1:0)||C++,D=C;u.skipPagesBefore!==null&&(C+=u.skipPagesBefore,D+=u.skipPagesBefore)}t.counterStore.forceSetPageCounter(D);var F=new hl(v,c,t.opf.lang,p,t.clientLayout,t.fontMapper,g,t.opf.fallbackMap,C,t.opf.documentURLTransformer,t.counterStore,t.opf.pageProgression,y);F.pref=t.pref;var k=t.opf.metadata&&t.opf.metadata[ae.title];F.pubTitle=k&&k[0]&&k[0].v||"",F.docTitle=u.title||"",F.init().then(function(){t.spineItems[e]=n={item:u,xmldoc:c,instance:F,layoutPositions:[null],pages:[],complete:!1},i.finish(n),a.forEach(function(H){H.schedule(n)})})}),i.result()},r.removeRenderedPages=function(){for(var e,t=B(this.spineItems);!(e=t()).done;){var n=e.value;n&&n.pages.splice(0)}this.viewport.clear()},r.hasAutoSizedPages=function(){for(var e,t=B(this.spineItems);!(e=t()).done;){var n=e.value;if(n)for(var i,a=B(n.pages);!(i=a()).done;){var s=i.value;if(s.isAutoPageWidth&&s.isAutoPageHeight)return!0}}return!1},r.hasPages=function(){return this.spineItems.some(function(e){return e&&e.pages.length>0})},r.showTOC=function(e){var t=this.opf,n=t.xhtmlToc||t.ncxToc;if(this.tocAutohide=e,!n)return I(null);if(this.tocView&&this.tocView.page)return this.tocView.page.container.style.visibility="visible",this.tocView.page.container.setAttribute("aria-hidden","false"),I(this.tocView.page);var i=L("showTOC");this.tocView||(this.tocView=new Bf(t.store,n.src,t.lang,this.clientLayout,this.fontMapper,this.pref,this,t.fallbackMap,t.documentURLTransformer,this.counterStore));var a=this.viewport,s=Math.min(350,Math.round(.67*a.width)-16),u=a.height-6,h=a.document.createElement("div");return a.root.appendChild(h),h.style.visibility="hidden",h.style.width=s+10+"px",h.style.maxHeight=u+"px",h.setAttribute("data-vivliostyle-toc-box","true"),h.setAttribute("role","navigation"),this.tocView.showTOC(h,a,s,u,this.viewport.fontSize).then(function(c){h.style.visibility="visible",h.setAttribute("aria-hidden","false"),i.finish(c)}),i.result()},r.hideTOC=function(){this.tocView&&this.tocView.hideTOC()},r.isTOCVisible=function(){return!!this.tocView&&this.tocView.isTOCVisible()},o}();(function(o){o.SINGLE_PAGE="singlePage",o.SPREAD="spread",o.AUTO_SPREAD="autoSpread"})(Sn||(Sn={}));var Sr,Hf=function(){function o(e,t,n,i){var a=this;this.window=void 0,this.viewportElement=void 0,this.instanceId=void 0,this.callbackFn=void 0,this.fontMapper=void 0,this.kick=void 0,this.sendCommand=void 0,this.resizeListener=void 0,this.hyperlinkListener=void 0,this.pageRuleStyleElement=void 0,this.pageSheetSizeAlreadySet=!1,this.renderTask=null,this.actions=void 0,this.readyState=void 0,this.packageURL=void 0,this.opf=void 0,this.haveZipMetadata=void 0,this.touchActive=void 0,this.touchX=void 0,this.touchY=void 0,this.needResize=void 0,this.needRefresh=void 0,this.viewportSize=void 0,this.currentPage=void 0,this.currentSpread=void 0,this.pagePosition=void 0,this.fontSize=void 0,this.zoom=void 0,this.fitToScreen=void 0,this.pageViewMode=void 0,this.waitForLoading=void 0,this.renderAllPages=void 0,this.pref=void 0,this.pageSizes=void 0,this.viewport=void 0,this.opfView=void 0,this.window=e,this.viewportElement=t,this.instanceId=n,this.callbackFn=i,t.setAttribute("data-vivliostyle-viewer-viewport",!0),R.isDebug&&t.setAttribute("data-vivliostyle-debug",!0),t.setAttribute("data-vivliostyle-viewer-status","loading");var s=e.document;this.fontMapper=new jd(s.head,t),this.init(),this.kick=function(){},this.sendCommand=function(){},this.resizeListener=function(){a.needResize=!0,a.kick()},this.pageReplacedListener=this.pageReplacedListener.bind(this),this.hyperlinkListener=function(u){},this.pageRuleStyleElement=s.getElementById("vivliostyle-page-rules"),this.actions={loadPublication:this.loadPublication,loadXML:this.loadXML,configure:this.configure,moveTo:this.moveTo,toc:this.showTOC},this.addLogListeners()}var r=o.prototype;return r.init=function(){this.readyState=R.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=Sn.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=[]},r.addLogListeners=function(){var e=this,t=zt;M.addListener(t.DEBUG,function(n){e.callback({t:"debug",content:n})}),M.addListener(t.INFO,function(n){e.callback({t:"info",content:n})}),M.addListener(t.WARN,function(n){e.callback({t:"warn",content:n})}),M.addListener(t.ERROR,function(n){e.callback({t:"error",content:n})})},r.callback=function(e){e.i=this.instanceId,this.callbackFn(e)},r.setReadyState=function(e){this.readyState!==e&&(this.readyState=e,this.viewportElement.setAttribute("data-vivliostyle-viewer-status",e),this.callback({t:"readystatechange"}))},r.loadPublication=function(e){var t=this;P.registerStartTiming("beforeRender"),this.setReadyState(R.ReadyState.LOADING);var n=e.url,i=e.fragment,a=!!e.zipmeta,s=e.authorStyleSheet,u=e.userStyleSheet;this.viewport=null;var h=L("loadPublication");return this.configure(e).then(function(){var c=new fl;c.init(s,u).then(function(){var d=wt(ei(n),t.window.location.href);t.packageURL=[d],c.loadPubDoc(d,a).then(function(f){f?(t.opf=f,t.render(i).then(function(){h.finish(!0)})):h.finish(!1)})})}),h.result()},r.loadXML=function(e){var t=this;P.registerStartTiming("beforeRender"),this.setReadyState(R.ReadyState.LOADING);var n=e.url,i=e.document,a=e.fragment,s=e.authorStyleSheet,u=e.userStyleSheet;this.viewport=null;var h=L("loadXML");return this.configure(e).then(function(){var c=new fl;c.init(s,u).then(function(){var d=n.map(function(f,v){return{url:wt(ei(f.url),t.window.location.href),index:v,startPage:f.startPage,skipPagesBefore:f.skipPagesBefore}});t.packageURL=d.map(function(f){return f.url}),t.opf=new Nr(c,""),t.opf.initWithChapters(d,i).then(function(){t.render(a).then(function(){h.finish(!0)})})})}),h.result()},r.render=function(e){var t=this;return this.cancelRenderingTask(),(e?this.opf.resolveFragment(e).thenAsync(function(n){return t.pagePosition=n,I(!0)}):I(!0)).thenAsync(function(){return P.registerEndTiming("beforeRender"),t.resize()})},r.resolveLength=function(e){var t,n=parseFloat(e);if(typeof e=="string"&&(t=e.match(/[a-z]+$/))){var i=t[0];if(i==="em"||i==="rem")return n*this.fontSize;if(i==="ex")return n*me.ex*this.fontSize/me.em;var a=me[i];if(a)return n*a}return n},r.configure=function(e){if(typeof e.autoresize=="boolean"&&(e.autoresize?(this.viewportSize=null,this.window.addEventListener("resize",this.resizeListener,!1),this.needResize=!0):this.window.removeEventListener("resize",this.resizeListener,!1)),typeof e.fontSize=="number"){var t=e.fontSize;t>=5&&t<=72&&this.fontSize!=t&&(this.fontSize=t,this.needResize=!0)}if(typeof e.viewport=="object"&&e.viewport){var n=e.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 typeof e.hyphenate=="boolean"&&(this.pref.hyphenate=e.hyphenate,this.needResize=!0),typeof e.horizontal=="boolean"&&(this.pref.horizontal=e.horizontal,this.needResize=!0),typeof e.nightMode=="boolean"&&(this.pref.nightMode=e.nightMode,this.needResize=!0),typeof e.lineHeight=="number"&&(this.pref.lineHeight=e.lineHeight,this.needResize=!0),typeof e.columnWidth=="number"&&(this.pref.columnWidth=e.columnWidth,this.needResize=!0),typeof e.fontFamily=="string"&&(this.pref.fontFamily=e.fontFamily,this.needResize=!0),typeof e.load=="boolean"&&(this.waitForLoading=e.load),typeof e.renderAllPages=="boolean"&&(this.renderAllPages=e.renderAllPages),typeof e.userAgentRootURL=="string"&&(Ut(e.userAgentRootURL.replace(/resources\/?$/,"")),De(e.userAgentRootURL)),typeof e.rootURL=="string"&&(Ut(e.rootURL),De(bt+"resources/")),typeof e.pageViewMode=="string"&&e.pageViewMode!==this.pageViewMode&&(this.pageViewMode=e.pageViewMode,this.needResize=!0),typeof e.pageBorder=="number"&&e.pageBorder!==this.pref.pageBorder&&(this.viewport=null,this.pref.pageBorder=e.pageBorder,this.needResize=!0),typeof e.zoom=="number"&&e.zoom!==this.zoom&&(this.zoom=e.zoom,this.needRefresh=!0),typeof e.fitToScreen=="boolean"&&e.fitToScreen!==this.fitToScreen&&(this.fitToScreen=e.fitToScreen,this.needRefresh=!0),typeof e.defaultPaperSize=="object"&&typeof e.defaultPaperSize.width=="number"&&typeof e.defaultPaperSize.height=="number"&&(this.viewport=null,this.pref.defaultPaperSize=e.defaultPaperSize,this.needResize=!0),this.configurePlugins(e),I(!0)},r.configurePlugins=function(e){var t=this;se(R.HOOKS.CONFIGURATION).forEach(function(n){var i=n(e);t.needResize=i.needResize||t.needResize,t.needRefresh=i.needRefresh||t.needRefresh})},r.pageReplacedListener=function(e){var t=this.currentPage,n=this.currentSpread,i=e.target;n?n.left!==i&&n.right!==i||this.showCurrent(e.newPage):t===e.target&&this.showCurrent(e.newPage)},r.forCurrentPages=function(e){var t=[];this.currentPage&&t.push(this.currentPage),this.currentSpread&&(t.push(this.currentSpread.left),t.push(this.currentSpread.right)),t.forEach(function(n){n&&e(n)})},r.removePageListeners=function(){var e=this;this.forCurrentPages(function(t){t.removeEventListener("hyperlink",e.hyperlinkListener,!1),t.removeEventListener("replaced",e.pageReplacedListener,!1)})},r.hidePages=function(){this.removePageListeners(),this.forCurrentPages(function(e){T(e.container,"display","none"),e.container.setAttribute("aria-hidden","true")}),this.currentPage=null,this.currentSpread=null},r.showSinglePage=function(e){e.addEventListener("hyperlink",this.hyperlinkListener,!1),e.addEventListener("replaced",this.pageReplacedListener,!1),T(e.container,"visibility","visible"),T(e.container,"display","block"),e.container.setAttribute("aria-hidden","false")},r.showPage=function(e){this.hidePages(),this.currentPage=e,e.container.style.marginLeft="",e.container.style.marginRight="",this.showSinglePage(e)},r.showSpread=function(e){if(this.hidePages(),this.currentSpread=e,e.left&&e.right){var t=parseFloat(e.left.container.style.width),n=parseFloat(e.right.container.style.width);t&&n&&t!==n&&(t<n?e.left.container.style.marginLeft=n-t+"px":e.right.container.style.marginRight=t-n+"px")}e.left&&(this.showSinglePage(e.left),e.right?e.left.container.removeAttribute("data-vivliostyle-unpaired-page"):e.left.container.setAttribute("data-vivliostyle-unpaired-page",!0)),e.right&&(this.showSinglePage(e.right),e.left?e.right.container.removeAttribute("data-vivliostyle-unpaired-page"):e.right.container.setAttribute("data-vivliostyle-unpaired-page",!0))},r.reportPosition=function(){var e=this,t=L("reportPosition");return this.opf.getCFI(this.pagePosition.spineIndex,this.pagePosition.offsetInItem).then(function(n){var i=e.currentPage;(e.waitForLoading&&i.fetchers.length>0?so(i.fetchers):I(!0)).then(function(){e.sendLocationNotification(i,n).thenFinish(t)})}),t.result()},r.createViewport=function(){var e=this.viewportElement;if(this.viewportSize){var t=this.viewportSize;return e.style.marginLeft=t.marginLeft+"px",e.style.marginRight=t.marginRight+"px",e.style.marginTop=t.marginTop+"px",e.style.marginBottom=t.marginBottom+"px",new wr(this.window,this.fontSize,e,t.width,t.height)}return new wr(this.window,this.fontSize,e)},r.resolveSpreadView=function(e){switch(this.pageViewMode){case Sn.SINGLE_PAGE:return!1;case Sn.SPREAD:return!0;case Sn.AUTO_SPREAD:default:return e.width/e.height>=1.45&&e.width>800}},r.updateSpreadView=function(e){this.pref.spreadView=e,this.viewportElement.setAttribute("data-vivliostyle-spread-view",e.toString())},r.sizeIsGood=function(){var e=this.createViewport(),t=this.resolveSpreadView(e),n=this.pref.spreadView!==t;return this.updateSpreadView(t),!(this.viewportSize||!this.viewport||this.viewport.fontSize!=this.fontSize||(n||e.width!=this.viewport.width||e.height!=this.viewport.height)&&(n||e.width!=this.viewport.width||e.height==this.viewport.height||!/Android|iPhone|iPad|iPod/.test(navigator.userAgent))&&(!this.opfView||!this.opfView.hasPages()||this.opfView.hasAutoSizedPages()||(this.viewport.width=e.width,this.viewport.height=e.height,this.needRefresh=!0,0)))},r.setPageSize=function(e,t,n,i){this.pageSizes[i]=e,this.setPageSizePageRules(t,n,i)},r.setPageSizePageRules=function(e,t,n){if(!this.pageSheetSizeAlreadySet&&this.pageRuleStyleElement){var i="";Object.keys(e).forEach(function(a){i+="@page "+a+"{margin:0;size:";var s=e[a];i+=s.width+"px "+s.height+"px;}"}),this.pageRuleStyleElement.textContent=i,this.pageSheetSizeAlreadySet=!0}},r.removePageSizePageRules=function(){this.pageRuleStyleElement&&(this.pageRuleStyleElement.textContent="",this.pageSheetSizeAlreadySet=!1)},r.reset=function(){var e=!1,t=!1;this.opfView&&(e=this.opfView.isTOCVisible(),t=this.opfView.tocAutohide,this.opfView.hideTOC(),this.opfView.removeRenderedPages()),this.removePageSizePageRules(),this.viewport=this.createViewport(),this.viewport.resetZoom(),this.opfView=new Vf(this.opf,this.viewport,this.fontMapper,this.pref,this.setPageSize.bind(this)),e&&this.sendCommand({a:"toc",v:"show",autohide:t})},r.showCurrent=function(e,t){var n=this;return this.needRefresh=!1,this.removePageListeners(),this.pref.spreadView?this.opfView.getSpread(this.pagePosition,t).thenAsync(function(i){return n.showSpread(i),n.setSpreadZoom(i),n.currentPage=e.side===R.PageSide.LEFT?i.left:i.right,I(null)}):(this.showPage(e),this.setPageZoom(e),this.currentPage=e,I(null))},r.setPageZoom=function(e){var t=this.getAdjustedZoomFactor(e.dimensions);this.viewport.zoom(e.dimensions.width,e.dimensions.height,t)},r.setSpreadZoom=function(e){var t=this.getSpreadDimensions(e);this.viewport.zoom(t.width,t.height,this.getAdjustedZoomFactor(t))},r.getAdjustedZoomFactor=function(e){return this.fitToScreen?this.calculateZoomFactorToFitInsideViewPort(e):this.zoom},r.getSpreadDimensions=function(e){var t=0,n=0;return e.left&&(t+=e.left.dimensions.width,n=e.left.dimensions.height),e.right&&(t+=e.right.dimensions.width,n=Math.max(n,e.right.dimensions.height)),e.left&&e.right&&(t+=2*this.pref.pageBorder,t+=Math.abs(e.left.dimensions.width-e.right.dimensions.width)),{width:t,height:n}},r.queryZoomFactor=function(e){if(!this.currentPage)throw new Error("no page exists.");switch(e){case Sr.FIT_INSIDE_VIEWPORT:var t;return t=this.pref.spreadView?this.getSpreadDimensions(this.currentSpread):this.currentPage.dimensions,this.calculateZoomFactorToFitInsideViewPort(t);default:throw new Error("unknown zoom type: "+e)}},r.calculateZoomFactorToFitInsideViewPort=function(e){return Math.min(this.viewport.width/e.width,this.viewport.height/e.height)},r.cancelRenderingTask=function(){this.renderTask&&this.renderTask.interrupt(new ml),this.renderTask=null},r.resize=function(){var e=this;if(this.needResize=!1,this.needRefresh=!1,this.sizeIsGood())return I(!0);this.setReadyState(R.ReadyState.LOADING),this.cancelRenderingTask();var t=oo().getScheduler().run(function(){return Vn("resize",function(n){e.opf?(e.renderTask=t,P.registerStartTiming("render (resize)"),e.reset(),e.pagePosition&&(e.pagePosition.pageIndex==0&&e.pagePosition.offsetInItem==0||(e.pagePosition.pageIndex=-1)),e.opf.setEPageCountMode(e.renderAllPages),e.opfView.renderPagesUpto(e.pagePosition,!e.renderAllPages).then(function(i){i?(e.pagePosition=i.position,e.showCurrent(i.page,!0).then(function(){e.setReadyState(R.ReadyState.INTERACTIVE),e.opf.countEPages(function(a){var s={t:"nav",epageCount:a,first:e.currentPage.isFirstPage,last:e.currentPage.isLastPage,metadata:e.opf.metadata,docTitle:e.opf.spine[e.pagePosition.spineIndex].title};(e.currentPage.isFirstPage||e.pagePosition.pageIndex==0&&e.opf.spine[e.pagePosition.spineIndex].epage)&&(s.epage=e.opf.spine[e.pagePosition.spineIndex].epage),e.callback(s)}).then(function(){e.reportPosition().then(function(a){(e.renderAllPages?e.opfView.renderAllPages():I(null)).then(function(){e.renderTask===t&&(e.renderTask=null),P.registerEndTiming("render (resize)"),e.renderAllPages&&e.setReadyState(R.ReadyState.COMPLETE),e.callback({t:"loaded"}),n.finish(a)})})})})):n.finish(!1)})):n.finish(!1)},function(n,i){if(!(i instanceof ml))throw i;P.registerEndTiming("render (resize)"),M.debug(i.message)})});return I(!0)},r.sendLocationNotification=function(e,t){var n=this,i=L("sendLocationNotification"),a={t:"nav",first:e.isFirstPage,last:e.isLastPage,metadata:this.opf.metadata,docTitle:this.opf.spine[e.spineIndex].title};return this.opf.getEPageFromPosition(this.pagePosition).then(function(s){a.epage=s,a.epageCount=n.opf.epageCount,t&&(a.cfi=t),n.callback(a),i.finish(!0)}),i.result()},r.getCurrentPageProgression=function(){return this.opfView?this.opfView.getCurrentPageProgression(this.pagePosition):null},r.moveTo=function(e){var t,n=this;if(this.readyState!==R.ReadyState.COMPLETE&&e.where!=="next"&&this.setReadyState(R.ReadyState.LOADING),typeof e.where=="string"){var i;switch(e.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 I(!0)}i&&(t=function(){return i.call(n.opfView,n.pagePosition,!n.renderAllPages)})}else if(typeof e.epage=="number"){var a=e.epage;t=function(){return n.opfView.navigateToEPage(a,n.pagePosition,!n.renderAllPages)}}else{if(typeof e.url!="string")return I(!0);var s=e.url;t=function(){return n.opfView.navigateTo(s,n.pagePosition,!n.renderAllPages)}}var u=L("moveTo");return t.call(this.opfView).then(function(h){var c;if(h){n.pagePosition=h.position;var d=L("moveTo.showCurrent");c=d.result(),n.showCurrent(h.page,!n.renderAllPages).then(function(){n.reportPosition().thenFinish(d)})}else c=I(!0);c.then(function(f){n.readyState===R.ReadyState.LOADING&&n.setReadyState(R.ReadyState.INTERACTIVE),u.finish(f)})}),u.result()},r.showTOC=function(e){var t=this,n=!!e.autohide,i=e.v,a=this.opfView.isTOCVisible(),s=n!=this.opfView.tocAutohide&&i!="hide";if(a){if(i=="show"&&!s)return I(!0)}else if(i=="hide")return I(!0);if(a&&i!="show")return this.opfView.hideTOC(),I(!0);var u=L("showTOC");return this.opfView.showTOC(n).then(function(h){h&&(s&&(h.listeners={}),n&&h.addEventListener("hyperlink",function(){t.opfView.hideTOC()},!1),h.addEventListener("hyperlink",t.hyperlinkListener,!1)),u.finish(!0)}),u.result()},r.runCommand=function(e){var t=this,n=e.a||"";return Vn("runCommand",function(i){var a=t.actions[n];a?a.call(t,e).then(function(){t.callback({t:"done",a:n}),i.finish(!0)}):(M.error("No such action:",n),i.finish(!0))},function(i,a){M.error(a,"Error during action:",n),i.finish(!0)})},r.initEmbed=function(e){var t,n=this,i=El(e),a=null,s=this;t=function(){var u=L("commandLoop"),h=oo().getScheduler();return s.hyperlinkListener=function(c){var d=c,f=d.href.charAt(0)==="#"||s.packageURL.some(function(g){return d.href.substr(0,g.length)==g});if(f){c.preventDefault();var v={t:"hyperlink",href:d.href,internal:f};h.run(function(){return s.callback(v),I(!0)})}},u.loopWithFrame(function(c){if(s.needResize)s.resize().then(function(){c.continueLoop()});else if(s.needRefresh)s.currentPage&&s.showCurrent(s.currentPage,!0).then(function(){c.continueLoop()});else if(i){var d=i;i=null,s.runCommand(d).then(function(){c.continueLoop()})}else{var f=L("waitForCommand");a=f.suspend(n),f.result().then(function(){c.continueLoop()})}}).thenFinish(u),u.result()},(Yt?Yt.getScheduler():ro||new Bh(new Lh)).run(t,void 0),s.kick=function(){var u=a;u&&(a=null,u.schedule(!0))},s.sendCommand=function(u){return!i&&(i=El(u),s.kick(),!0)},this.window.adapt_command=s.sendCommand},o}();(Sr||(Sr={})).FIT_INSIDE_VIEWPORT="fit inside viewport";var ml=function(o){function r(){var e;return(e=o.call(this)||this).name="RenderingCanceledError",e.message="Page rendering has been canceled",e.stack=void 0,Object.setPrototypeOf(xt(e),r.prototype),e.stack=new Error().stack,e}return w(r,o),r}(Et(Error));function El(o){return typeof o=="string"?It(o):o}var Cl=R.PageProgression;function Dl(o){var r={};return Object.keys(o).forEach(function(e){var t=o[e];switch(e){case"autoResize":r.autoresize=t;break;case"pageBorderWidth":r.pageBorder=t;break;default:r[e]=t}}),r}var Ln,wl=function(){function o(e,t){this.settings=void 0,this.initialized=!1,this.adaptViewer_=void 0,this.options=void 0,this.eventTarget=void 0,this.readyState=void 0,this.settings=e,an(e.debug),this.adaptViewer_=new Hf(e.window||window,e.viewportElement,"main",this.dispatcher.bind(this)),this.options={autoResize:!0,fontSize:16,pageBorderWidth:1,renderAllPages:!0,pageViewMode:Sn.AUTO_SPREAD,zoom:1,fitToScreen:!1,defaultPaperSize:void 0},t&&this.setOptions(t),this.eventTarget=new Fr,Object.defineProperty(this,"readyState",{get:function(){return this.adaptViewer_.readyState}})}var r=o.prototype;return r.setOptions=function(e){var t=Object.assign({a:"configure"},Dl(e));this.adaptViewer_.sendCommand(t),Object.assign(this.options,e)},r.dispatcher=function(e){var t={type:e.t},n=e;Object.keys(n).forEach(function(i){i!=="t"&&(t[i]=n[i])}),this.eventTarget.dispatchEvent(t)},r.addListener=function(e,t){this.eventTarget.addEventListener(e,t,!1)},r.removeListener=function(e,t){this.eventTarget.removeEventListener(e,t,!1)},r.loadDocument=function(e,t,n){e||this.eventTarget.dispatchEvent({type:"error",content:"No URL specified"}),this.loadDocumentOrPublication(e,null,t,n)},r.loadPublication=function(e,t,n){e||this.eventTarget.dispatchEvent({type:"error",content:"No URL specified"}),this.loadDocumentOrPublication(null,e,t,n)},r.loadDocumentOrPublication=function(e,t,n,i){var a=n||{};function s(d){return d?d.map(function(f){return{url:f.url||null,text:f.text||null}}):void 0}var u=s(a.authorStyleSheet),h=s(a.userStyleSheet);i&&Object.assign(this.options,i);var c=Object.assign({a:e?"loadXML":"loadPublication",userAgentRootURL:this.settings.userAgentRootURL,url:zf(e)||t,document:a.documentObject,fragment:a.fragment,authorStyleSheet:u,userStyleSheet:h},Dl(this.options));this.initialized?this.adaptViewer_.sendCommand(c):(this.initialized=!0,this.adaptViewer_.initEmbed(c))},r.getCurrentPageProgression=function(){return this.adaptViewer_.getCurrentPageProgression()},r.resolveNavigation=function(e){switch(e){case R.Navigation.LEFT:return this.getCurrentPageProgression()===Cl.LTR?R.Navigation.PREVIOUS:R.Navigation.NEXT;case R.Navigation.RIGHT:return this.getCurrentPageProgression()===Cl.LTR?R.Navigation.NEXT:R.Navigation.PREVIOUS;default:return e}},r.navigateToPage=function(e,t){e===R.Navigation.EPAGE?this.adaptViewer_.sendCommand({a:"moveTo",epage:t}):this.adaptViewer_.sendCommand({a:"moveTo",where:this.resolveNavigation(e)})},r.navigateToInternalUrl=function(e){this.adaptViewer_.sendCommand({a:"moveTo",url:e})},r.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},r.showTOC=function(e,t){this.adaptViewer_.sendCommand({a:"toc",v:e==null?"toggle":e?"show":"hide",autohide:t})},r.queryZoomFactor=function(e){return this.adaptViewer_.queryZoomFactor(e)},r.getPageSizes=function(){return this.adaptViewer_.pageSizes},r.getTOC=function(){var e,t;return(e=this.adaptViewer_.opfView)==null||(t=e.tocView)==null?void 0:t.getTOC()},r.getMetadata=function(){return this.adaptViewer_.opf.getMetadata()},r.getCover=function(){return this.adaptViewer_.opf.cover},o}();function zf(o){function r(t){return typeof t=="number"?t:null}function e(t){return typeof t=="string"?{url:t,startPage:null,skipPagesBefore:null}:{url:t.url,startPage:r(t.startPage),skipPagesBefore:r(t.skipPagesBefore)}}return Array.isArray(o)?o.map(e):o?[e(o)]:null}R.Navigation=void 0,(Ln=R.Navigation||(R.Navigation={})).PREVIOUS="previous",Ln.NEXT="next",Ln.LEFT="left",Ln.RIGHT="right",Ln.FIRST="first",Ln.LAST="last",Ln.EPAGE="epage";var Gf=Sr,Wf=Sn;P.forceRegisterEndTiming("load_vivliostyle");var Xf=function(){function o(e,t){var n=t.title,i=n===void 0?"":n,a=t.printCallback,s=a===void 0?function(f){return f.print()}:a,u=t.hideIframe,h=u===void 0||u,c=t.removeIframe,d=c===void 0||c;this.htmlDoc=void 0,this.title=void 0,this.printCallback=void 0,this.hideIframe=void 0,this.removeIframe=void 0,this.iframe=void 0,this.iframeWin=void 0,this.window=void 0,this.htmlDoc=e,this.title=i,this.printCallback=s,this.hideIframe=h,this.removeIframe=d}var r=o.prototype;return r.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=
<!DOCTYPE html>
<html data-vivliostyle-paginated="true">
<head>
<meta charset='utf-8'/>
<meta name='viewport' content='width=device-width, initial-scale=1.0'/>
<title>+this.title+</title>
<style>+ds+</style>
<style>+cs+</style>
<style>
width: 100%;
height: 100%;
}
width: 100% !important;
height: 100% !important;
}
margin: 0;
padding: 0;
}
</style>
<style id='vivliostyle-page-rules'></style>
</head>
<body onload='parent.printInstance.runInIframe(window)'>
<div id="vivliostyle-viewer-viewport"></div>
</body>
</html>,document.body.appendChild(this.iframe)},r.runInIframe=function(e){var t=this;return this.iframeWin=e,this.preparePrint().then(function(){return t.browserPrint()}).then(function(){return t.cleanUp()})},r.preparePrint=function(){this.iframeWin.document.title=this.title;var e=new Blob([this.htmlDoc],{type:"text/html"}),t=URL.createObjectURL(e),n=new wl({viewportElement:this.iframeWin.document.body.firstElementChild,window:this.iframeWin,debug:!0},{defaultPaperSize:{width:794,height:1122}});return new Promise(function(i){n.addListener("readystatechange",function(){n.readyState==="complete"&&i()}),n.loadDocument({url:t})})},r.browserPrint=function(){this.printCallback(this.iframeWin)},r.cleanUp=function(){delete this.window.printInstance,this.removeIframe&&this.iframe.parentElement.removeChild(this.iframe)},o}();R.CoreViewer=wl,R.PageViewMode=Wf,R.Profiler=Tn,R.UserAgentBaseCss=vs,R.UserAgentPageCss=gs,R.UserAgentXml=ps,R.ValidationTxt=fs,R.VivliostyleViewportCss=ds,R.VivliostyleViewportScreenCss=cs,R.ZoomType=Gf,R.getHooksForName=se,R.pageProgressionOf=sn,R.plugin=An,R.printHTML=function(o,r){new Xf(o,r).init()},R.profile=nt,R.profiler=P,R.registerHook=be,R.removeHook=un,R.setDebug=an}),cp=Il(Fl()),dp=Il(Fl()),{isDebug:Sp,PageProgression:Ap,PageSide:Tp,ReadyState:Pl,HOOKS:xp,Navigation:Rl,CoreViewer:Ol,PageViewMode:kl,Profiler:Ip,UserAgentBaseCss:Fp,UserAgentPageCss:Pp,UserAgentXml:Rp,ValidationTxt:Op,VivliostyleViewportCss:kp,VivliostyleViewportScreenCss:Lp,ZoomType:Bp,getHooksForName:_p,pageProgressionOf:Mp,plugin:Up,printHTML:Vp,profile:Hp,profiler:zp,registerHook:Gp,removeHook:Wp,setDebug:Xp}=cp,fp=dp.default;function Ll(R){return R-1}var vp=["source","page","zoom","fontSize","background","renderAllPages","autoResize","pageViewMode","defaultPaperSize","pageBorderWidth","fitToScreen","userStyleSheet","authorStyleSheet","onMessage","onError","onReadyStateChange","onLoad","onNavigation","onHyperlink"],mp=({source:R,page:St=1,zoom:Xt=1,fontSize:Nt=16,background:zt="#ececec",renderAllPages:Ce=!0,autoResize:an=!0,pageViewMode:sn=kl.SINGLE_PAGE,defaultPaperSize:Ke,pageBorderWidth:Ve=1,fitToScreen:de=!1,userStyleSheet:M,authorStyleSheet:He,onMessage:be,onError:un,onReadyStateChange:se,onLoad:An,onNavigation:Tn,onHyperlink:Pe})=>{let nn=da(null),Se=da(),A=da();function z(){let V={fontSize:Nt,pageViewMode:sn,zoom:Xt,renderAllPages:Ce,autoResize:an,defaultPaperSize:Ke,pageBorderWidth:Ve,fitToScreen:de};Se.current.setOptions(V)}function P(){let V=Se.current,w=R.endsWith(".json"),Q={...M?{userStyleSheet:[{[M.endsWith(".css")?"url":"text"]:M}]}:null,...He?{authorStyleSheet:[{[He.endsWith(".css")?"url":"text"]:He}]}:null};w?V.loadPublication(R,Q):V.loadDocument({url:R},Q,{fontSize:Nt,pageViewMode:sn,zoom:1,renderAllPages:Ce,autoResize:an,defaultPaperSize:Ke,pageBorderWidth:Ve,fitToScreen:!1})}function nt(){function V(gt,jt){be&&be(gt.content,jt)}let w=gt=>V(gt,"debug"),Q=gt=>V(gt,"info"),rt=gt=>V(gt,"warn");function At(gt){un&&un(gt.content)}function Tt(){let{readyState:gt}=Se.current;se&&se(gt)}function Et(){An&&An(A.current)}function xt(gt){let{docTitle:jt,epageCount:It,epage:Ct,metadata:bt}=gt,Ut={docTitle:jt,epageCount:It,epage:Ct,metadata:bt};A.current=Ut,Tn&&Tn(Ut)}function Vt(gt){Pe&&Pe(gt)}let B=Se.current;return B.addListener("debug",w),B.addListener("info",Q),B.addListener("warn",rt),B.addListener("error",At),B.addListener("readystatechange",Tt),B.addListener("loaded",Et),B.addListener("nav",xt),B.addListener("hyperlink",Vt),()=>{se&&se(Pl.LOADING),B.removeListener("debug",w),B.removeListener("info",Q),B.removeListener("warn",rt),B.removeListener("error",At),B.removeListener("readystatechange",Tt),B.removeListener("loaded",Et),B.removeListener("nav",xt),B.removeListener("hyperlink",Vt),nn.current.innerHTML=""}}function J(){Se.current=new Ol({viewportElement:nn.current})}return Tr(()=>(J(),z(),nt()),[]),Tr(()=>{P()},[R,He,M]),Tr(()=>{z()},[Nt,sn,Xt,Ce,an,Ke,Ve,de]),Tr(()=>{let V=Ll(St);Se.current?.navigateToPage(Rl.EPAGE,V)},[St]),ca(pp,null,ca("style",null,Ep(zt)),ca("div",{ref:nn}))};gp(mp,"vivliostyle-viewer",vp,{shadow:!0});function Ep(R){return
:host {
overflow: scroll;
background: ${R};
}
@media screen {
background: white;
z-index: 0;
}
display: flex;
overflow: auto;
position: relative;
}
margin: auto;
overflow: hidden;
flex: none;
}
display: flex;
flex: none;
justify-content: center;
transform-origin: left top;
}
flex-direction: row;
}
flex-direction: row-reverse;
}
margin: 0 auto;
flex: none;
transform-origin: center top;
}
margin-right: 1px;
transform-origin: right top;
}
margin-left: 1px;
transform-origin: left top;
}
margin-left: auto;
margin-right: auto;
transform-origin: center top;
}
}
/* vivliostyle-viewport */
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: -1;
}
right: auto;
bottom: auto;
overflow: visible;
z-index: auto;
}
position: relative;
overflow: hidden;
}
position: absolute;
overflow: hidden;
max-width: 100%;
max-height: 100%;
box-sizing: border-box;
}
display: none;
}
position: absolute;
left: 3px;
top: 3px;
overflow: scroll;
overflow-x: hidden;
background: rgba(248, 248, 248, 0.9);
border-radius: 2px;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}
@media print {
display: none;
}
width: 100% !important;
height: 100% !important;
}
-moz-transform: none !important;
-ms-transform: none !important;
-webkit-transform: none !important;
transform: none !important;
}
display: block !important;
max-width: 100%;
height: 100% !important;
max-height: 100%;
}
/* Workaround for Chrome printing problem */
padding-bottom: 0 !important;
overflow: visible !important;
} */
display: block;
content: "";
padding-top: 0.015625px;
margin-bottom: -0.015625px;
}
@-moz-document regexp('.*') {
top: -1px;
margin-top: 1px;
margin-bottom: -1px;
}
}
}
`}export{mp as Renderer};