/*! * * # Jo | Helper for Embedding Bibi-Frames in Webpage. (℠) * * * © Satoru Matsushima - https://bibi.epub.link or https://github.com/satorumurmur/bibi * * Open source under the MIT License - https://github.com/satorumurmur/bibi/blob/master/LICENSE * */!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=13)}([,,,function(e,t,n){"use strict";var i,r=function(){return void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i},o=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),a=[];function u(e){for(var t=-1,n=0;n1&&void 0!==arguments[1]?arguments[1]:p;return!!t.test(e)&&s.dispatchEvent(new CustomEvent(e,{detail:n}))},p.receive=function(e){return!!t.test(e)&&c.contentWindow.E.add(e,(function(t){return p.dispatch(e,t)}))},p.post=function(e,n){return!!t.test(e)&&c.contentWindow.postMessage('{ "'.concat(e,'" : "').concat(n,'" }'),u.origin)},p.listen("bibi:initialized",(function(e){return p.Status=p.Initialized=e})),d.length&&p.listen("bibi:initialized",(function(){return d.forEach((function(e){return p.receive(""+e.trim())}))})),p.listen("bibi:readied",(function(e){return p.Status=p.Readied=e})),p.listen("bibi:prepared",(function(e){return p.Status=p.Prepared=e})),p.listen("bibi:opened",(function(e){return p.Status=p.Opened=e})),p.listen("bibi:opened",(function(){p.move=function(e){return p.post("bibi:commands:move",e)},p.focus=function(e){return p.post("bibi:commands:focus",e)},p.changeView=function(e){return p.post("bibi:commands:change-view",e)},p.togglePanel=function(){return p.post("bibi:commands:toggle-panel","")}})),u.style.display="none",e.TrustworthyOrigins.includes(u.origin)||e.TrustworthyOrigins.push(u.origin),u.href+=(/#/.test(u.href)?"&":"#")+((b=new e.Fragments).add("parent-bibi-index",p.Index),["autostart-embedded","autostart","p","fix-reader-view-mode","fix-view","view-unchangeable","full-breadth-layout-in-scroll","iipp","nav","reader-view-mode","rvm","view","start-embedded-in-new-window","start-in-new-window"].forEach((function(e){var t=""+(n.ownerDocument?n.getAttribute("data-bibi-"+e)||"":n["bibi-"+e]);t&&function(){switch(e){case"p":case"iipp":return/^(\d*\.)?\d+$/;case"nav":return/^[1-9][0-9]*$/;case"rvm":case"view":e="reader-view-mode";case"reader-view-mode":return/^(paged|horizontal|vertical)$/;case"autostart":case"start-in-new-window":e=e.replace("start","start-embedded");break;case"view-unchangeable":e="fix-reader-view-mode"}return/^(true|false|1|0|yes|no|mobile|desktop)$/}().test(t)&&b.add(e,t)})),b.make()),c.classList.add("bibi-frame"),c.setAttribute("frameborder","0"),c.setAttribute("scrolling","auto"),c.setAttribute("allowfullscreen","true"),c.src=u.href,e.Bibis.push(p),p},e.embed=function(){var t=[],n=[];Array.prototype.forEach.call(document.body.querySelectorAll("*[data-bibi]"),(function(n){if(!n.getAttribute("data-bibi-processed")){n.setAttribute("data-bibi-processed","true");var i=new e.Bibi(n);i&&t.push(i)}})),t.length&&t.forEach((function(i){var r=i.Anchor,o=i.Frame;i.listen("bibi:initialized",(function(){return!(n.push(i)1&&void 0!==arguments[1]?arguments[1]:e;return!!t.test(n)&&document.dispatchEvent(new CustomEvent(n,{detail:i}))},Array.prototype.includes||(Array.prototype.includes=function(e){for(var t=this.length,n=0;n