diff --git a/application/modules/default/views/scripts/product/index.phtml b/application/modules/default/views/scripts/product/index.phtml index 445cd2992..cc4f08c20 100644 --- a/application/modules/default/views/scripts/product/index.phtml +++ b/application/modules/default/views/scripts/product/index.phtml @@ -1,1163 +1,1165 @@ . **/ $helpAddDefaultScheme = new Default_View_Helper_AddDefaultScheme(); $helpMemberUrl = new Default_View_Helper_BuildMemberUrl(); $helpEncryptUrl = new Default_View_Helper_EncryptUrl(); $helpImage = new Default_View_Helper_Image(); $helpTruncate = new Default_View_Helper_Truncate(); $helpProductUrl = new Default_View_Helper_BuildProductUrl(); $helpBBCode = new Default_View_Helper_Bbcode2html(); $identity = Zend_Auth::getInstance()->getStorage()->read(); $loginUrl = '/login?redirect=' . $helpEncryptUrl->encryptUrl(Zend_Controller_Front::getInstance()->getRequest() ->getRequestUri(), true); $viewSidebar = 'product/partials/productAboutSidebar.phtml'; $viewClaimBox = false; if ($this->product->claimable == 1) { $viewClaimBox = 'product/partials/productClaimTopHeader.phtml'; } $helpProjectFiles = new Default_View_Helper_ProjectFiles(); $productFileInfos = $helpProjectFiles->projectFiles($this->product->ppload_collection_id); $this->product->title = Default_Model_HtmlPurify::purify($this->product->title); $this->product->description = Default_Model_BBCode::renderHtml(Default_Model_HtmlPurify::purify($this->product->description)); $this->product->version = Default_Model_HtmlPurify::purify($this->product->version); //$this->product->embed_code =Default_Model_HtmlPurify::purify($this->product->embed_code,Default_Model_HtmlPurify::ALLOW_EMBED); $this->product->link_1 = Default_Model_HtmlPurify::purify($helpAddDefaultScheme->addDefaultScheme($this->product->link_1),Default_Model_HtmlPurify::ALLOW_URL); $this->product->source_url = Default_Model_HtmlPurify::purify($this->product->source_url,Default_Model_HtmlPurify::ALLOW_URL); $this->product->facebook_code = Default_Model_HtmlPurify::purify($this->product->facebook_code,Default_Model_HtmlPurify::ALLOW_URL); $this->product->twitter_code = Default_Model_HtmlPurify::purify($this->product->twitter_code,Default_Model_HtmlPurify::ALLOW_URL); $this->product->google_code = Default_Model_HtmlPurify::purify($this->product->google_code,Default_Model_HtmlPurify::ALLOW_URL); $this->doctype(Zend_View_Helper_Doctype::XHTML1_RDFA); $this->headMeta()->setName('description', $helpTruncate->truncate($this->product->description, 200, '...', false, true)); $this->headMeta()->setName('title', $helpTruncate->truncate($this->product->title, 200, '...', false, true)); $this->headMeta()->appendProperty('og:url', $helpProductUrl->buildProductUrl($this->product->project_id, '', null, true)); $this->headMeta()->appendProperty('og:type', 'website'); $this->headMeta()->appendProperty('og:title', $this->product->title); $this->headMeta()->appendProperty('og:description', $helpTruncate->truncate($this->product->description, 200, '...', false, true)); $this->headMeta()->appendProperty('og:image', $helpImage->Image($this->product->image_small, array('width' => 400, 'height' => 400))); $tableProject = new Default_Model_Project(); $tableCollection = new Default_Model_Collection(); $tableProjectUpdates = new Default_Model_ProjectUpdates(); $this->updates = $tableProjectUpdates->fetchProjectUpdates($this->product->project_id); $tableProjectRatings = new Default_Model_DbTable_ProjectRating(); $this->ratings = $tableProjectRatings->fetchRating($this->product->project_id); $cntRatingsActive = 0; foreach ($this->ratings as $p) { if($p['rating_active']==1) $cntRatingsActive =$cntRatingsActive+1; } if (Zend_Auth::getInstance()->hasIdentity()){ $this->ratingOfUser = $tableProjectRatings->getProjectRateForUser($this->product->project_id,$identity->member_id); } $tableProjectFollower = new Default_Model_DbTable_ProjectFollower(); $this->likes = $tableProjectFollower->fetchLikesForProject($this->product->project_id); $projectplings = new Default_Model_ProjectPlings(); $this->projectplings = $projectplings->fetchPlingsForProject($this->product->project_id); $tagmodel = new Default_Model_Tags(); $helperUserRole = new Backend_View_Helper_UserRole(); $userRoleName = $helperUserRole->userRole(); $this->userRoleName = $userRoleName; $productJson = Zend_Json::encode($this->product); $filesJson = $this->filesJson; $helperCatXdgType = new Default_View_Helper_CatXdgType(); $xdgTypeJson = Zend_Json::encode($helperCatXdgType->catXdgType($this->product->project_category_id)); $isowner = false; if(Zend_Auth::getInstance()->hasIdentity() && $identity->member_id==$this->product->member_id){ $isowner = true; } $this->isowner = $isowner; $filesTable = new Default_Model_DbTable_PploadFiles(); $countFiles = $filesTable->fetchFilesCntForProject($this->product->ppload_collection_id); $pics= $tableProject->getGalleryPictureSources($this->product->project_id); if(sizeof($pics)==0) { array_push($pics,$this->product->image_small); } $this->galleryPictures=array(); foreach ($pics as $p) { $this->galleryPictures[] = $this->Image($p, array('height' => '600')); } $galleryPicturesJson = Zend_Json::encode($this->galleryPictures); ?>
hasIdentity()) { ?> hasIdentity()) { ?> hasIdentity()) { ?>
product->link_1)): ?> product->title; ?> product->title; ?> translate('Edit Product') ?> product->featured=='1'){ ?> Featured isProjectOriginal($this->product->project_id)){?> Original

product->project_category_id . '/order/latest">' . $this->product->cat_title . ' '; ?> '; $tagsuser = $tagmodel->getTagsUser($this->product->project_id, Default_Model_Tags::TAG_TYPE_PROJECT); echo ''; if(false === empty($tagsuser)) { foreach (explode(',',$tagsuser) as $tag) { ?> '; if($isowner){ $this->headLink()->appendStylesheet('/theme/flatui/css/select2.min.css'); $this->headLink()->appendStylesheet('/theme/flatui/css/select2.custmized.css'); $this->inlineScript()->appendFile('/theme/flatui/js/lib/select2.min.js'); ?> Saved inlineScript()->appendScript( ' $(document).ready(function(){ TagingProductDetail.setup(); }); '); } echo ''; ?>

Source (link to git-repo or to original if based on someone elses unmodified work): product->gitlab_project_id)) { $url = $this->gitlab_project['web_url']; $url = str_replace("http://", "https://", $url); echo ' ' . $url . ' '; } else if (false === empty($this->product->source_url)) { $target='_blank'; if (strpos($this->product->source_url, 'opencode.net') !== false) { $target='_self'; } echo '' . $this->product->source_url . ' '; if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { $cntSameSource = $tableProject->getCountSourceurl($this->product->source_url); if($cntSameSource>1){ $link = '/p/'.$this->product->project_id.'/listsamesourceurl'; echo ' ['.$cntSameSource.']'; } } } else { echo ' Add the source-code for this project on opencode.net'; } ?>

partial( '/product/partials/projectlike.phtml', array( "authMember" => $identity, "project_id" => $this->product->project_id ) ); ?>
render('partials/sidebarRating.phtml'); ?>
render('partials/sidebarScore.phtml'); ?>
product->is_gitlab_project && $this->product->use_gitlab_project_readme && null != $this->gitlab_project['readme_url']) { ?>
Description:

readme ?>

Description:

product->description ?>
updates) > 0) { $this->productUpdate = $this->updates[0]; ?>
Last changelog: render('product/partials/productUpdatesV1.phtml'); ?>
paramPageId; $testComments = $modelComments->getCommentTreeForProject($this->product->project_id); $testComments->setItemCountPerPage(25); $testComments->setCurrentPageNumber($offset); $this->comments = $testComments; echo $this->render('product/partials/productCommentsUX1.phtml'); ?>
partial( $viewClaimBox, array( "member" => $this->member, "product" => $this->product ) ); } ?>
product->embed_code)): ?> product->embed_code ?>
updates) > 0) { ?>
updates as $this->productUpdate) { echo $this->render('product/partials/productUpdatesV1.phtml'); } ?>
product->show_gitlab_project_issues) { ?>
gitlab_project_issues; $i = 0; foreach ($issues as $issue){ $date = date('Y-m-d H:i:s', strtotime($issue['created_at'])); echo '
' . $issue['title'] . '
'.$this->printDate($date).'
'; $i ++; if($i>5) { break; } } ?> Show all gitlab_project['open_issues_count'] ?> Issues
render('product/partials/productRating.phtml'); ?>
render('product/partials/productRating2.phtml'); ?>
likes) > 0) { ?>
render('product/partials/productLikes.phtml'); ?>
projectplings) > 0) { ?>
render('product/partials/productPlings.phtml'); ?>
render('product/partials/ppload.phtml'); ?>
product->claimable)) { ?>
partial( '/product/partials/projectplings.phtml', array( "authMember" => $identity, "project_id" => $this->product->project_id, "ppload_collection_id" => $this->product->ppload_collection_id, "project_category_id" => $this->product->project_category_id ) ); ?>
render('partials/sidebarRating.phtml'); */ ?>
*/ ?> countAllCollectionsForProject($this->product->project_id); if($cntCollections>0) { ?>
moreProducts = $tableCollection->fetchAllCollectionsForProject($this->product->project_id, 6); $this->moreProductsTitle = 'Is part of these Collections'; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productMoreProductsWidgetV1.phtml'); } ?>
*Needs ocs-url or ocs-store to install things
fetchOrigins($this->product->project_id); $this->moreProducts = $origins; $this->moreProductsTitle = 'Based on'; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productCloneFrom.phtml'); } ?> fetchRelatedProducts($this->product->project_id); $bflag = false; foreach ($related as $r){ $rid = $r->project_id; $bflag = false; foreach ($origins as $o){ $oid = $o->project_id; if($rid == $oid){ $bflag = true; break; } } if(!$bflag) { $relatednew[] = $r; } } $this->moreProducts = $relatednew; $this->moreProductsTitle = 'Variants'; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productCloneFrom.phtml'); } ?>
moreProducts = $tableProject->fetchMoreProjects($this->product, 6); $this->moreProductsTitle = 'More ' . $this->product->cat_title . ' from ' . $this->product->username; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productMoreProductsWidgetV1.phtml'); } ?>
moreProducts = $tableProject->fetchMoreProjectsOfOtherUsr($this->product, 6); $this->moreProductsTitle = 'Other ' . $this->product->cat_title; if (count($this->moreProducts) > 0) { echo $this->render('product/partials/productMoreProductsWidgetV1.phtml'); } ?>
render('partials/sidebarCcLicense.phtml'); ?> isProjectEbook($this->product->project_id)) { echo $this->render('product/partials/ebook_details.phtml'); } ?> render('product/partials/details.phtml'); ?> render('product/partials/tags.phtml'); ?>
++ + inlineScript()->appendScript( ' $(document).ready(function(){ InitActiveHashTab.setup(); PartialJson.setup(); PartialJsonFraud.setup(); PartialJsonClone.setup(); ProductDetailCarousel.setup(); PartialCommentReviewForm.setup(); PartialCommentReviewFormNew.setup(); PartialsButtonHeartDetail.setup(); PartialsButtonPlingProject.setup(); TooltipUser.setup("tooltipuserleft","left"); AppimagequestionOnClick.setup(); Opendownloadfile.setup(); CreateScoreRatingPopup.setup(); $(\'.tooltipheart\').tooltipster({theme: [\'tooltipster-light\', \'tooltipster-light-customized\'], contentCloning: true, contentAsHTML: true, interactive: true}); }); '); diff --git a/httpdocs/theme/react/product-media-slider/app/book-reader.js b/httpdocs/theme/react/product-media-slider/app/book-reader.js index 8a885397f..41cc2e142 100644 --- a/httpdocs/theme/react/product-media-slider/app/book-reader.js +++ b/httpdocs/theme/react/product-media-slider/app/book-reader.js @@ -1,24 +1,18 @@ -import React, { useState } from 'react'; -import { - EpubView, // Underlaying epub-canvas (wrapper for epub.js iframe) - EpubViewStyle, // Styles for EpubView, you can pass it to the instance as a style prop for customize it - ReactReader, // A simple epub-reader with left/right button and chapter navigation - ReactReaderStyle // Styles for the epub-reader it you need to customize it -} from "react-reader"; +import React from 'react'; -class BookReaderWrapper extends React.Component { - render() { - return ( -
- console.log(epubcifi)} - /> -
- ); - } +function BookReaderWrapper(props){ + + var book = ePub(props.slide.url); + var rendition = book.renderTo("book-container", { flow: "scrolled-doc", width: props.width, height: props.height}); + var displayed = rendition.display(); + + return ( +
+ +
+ +
+ ) } export default BookReaderWrapper; \ No newline at end of file diff --git a/httpdocs/theme/react/product-media-slider/app/product-media-slider.js b/httpdocs/theme/react/product-media-slider/app/product-media-slider.js index 9416a5555..e6076cfeb 100644 --- a/httpdocs/theme/react/product-media-slider/app/product-media-slider.js +++ b/httpdocs/theme/react/product-media-slider/app/product-media-slider.js @@ -1,363 +1,373 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom'; import {isMobile} from 'react-device-detect'; import VideoPlayerWrapper from './video-player'; import BookReaderWrapper from './book-reader'; function ProductMediaSlider(){ /* Component */ const [ product, setProduct ] = useState(window.product); let galleryArray = [] if (window.galleryPicturesJson) window.galleryPicturesJson.forEach(function(gp,index){ galleryArray.push({url:gp,type:'image'}); }); else galleryArray = [{url:product.image_small,type:'image'} ]; if (product.embed_code !== null && product.embed_code.length > 0) galleryArray = [{url:product.embed_code,type:'embed'}, ... galleryArray ]; if (window.filesJson) { window.filesJson.forEach(function(f,index){ if (f.type.indexOf('video') > -1 || f.type.indexOf('audio') > -1 || f.type.indexOf('epub') > -1){ + + let type; + if (f.type.indexOf('video') > -1 || f.type.indexOf('audio') > -1 ) type = f.type.split('/')[0] + else if (f.type.indexOf('epub') > -1 ) type = "book"; + + let url_preview, url_thumb; + if (f.url_thumb) url_thumb = f.url_thumb.replace(/%2F/g,'/').replace(/%3A/g,':'); + if (f.url_preview) url_preview = f.url_preview.replace(/%2F/g,'/').replace(/%3A/g,':'); + const gItem = { url:f.url.replace(/%2F/g,'/').replace(/%3A/g,':'), - type:f.type.split('/')[0], collection_id:f.collection_id, + type:type, file_id:f.id, - title:f.title + title:f.title, + url_thumb:url_thumb, + url_preview:url_preview } - if (f.url_thumb) gItem.url_thumb = f.url_thumb.replace(/%2F/g,'/').replace(/%3A/g,':'); - if (f.url_preview) gItem.url_preview = f.url_preview.replace(/%2F/g,'/').replace(/%3A/g,':') galleryArray = [gItem, ... galleryArray] } }) } const [ gallery, setGallery ] = useState(galleryArray); const [ disableGallery, setDisableGallery ] = useState(gallery.length > 1 ? false : true) const parentContainerElement = document.getElementById('product-title-div'); const [ containerWidth, setContainerWidth ] = useState(parentContainerElement.offsetWidth); const [ currentSlide, setCurrentSlide ] = useState(0) const [ sliderHeight, setSliderHeight ] = useState(360); const [ cinemaMode, setCinemaMode ] = useState(false); const [ isFullScreen, setIsFullScreen] = useState(false) const [ showPlaylist, setShowPlaylist ] = useState(false); const [ showSliderArrows, setShowSliderArrows ] = useState(true); const [ sliderFadeControlsMode, setSliderFadeControlsMode ] = useState(true); let sliderFadeControlTimeOut; // use effects React.useEffect(() => { initProductMediaSlider(currentSlide) },[currentSlide]) React.useEffect((event) => { updateDimensions(event,currentSlide) },[currentSlide, cinemaMode]) React.useEffect(() => { handleMouseMovementEventListener(showPlaylist,isFullScreen) },[showPlaylist,isFullScreen]) // init product media slider function initProductMediaSlider(currentSlide){ window.addEventListener("resize", function(event){updateDimensions(event,currentSlide)}); window.addEventListener("orientationchange", function(event){updateDimensions(event,currentSlide)}); } // handle mouse movement event listener function handleMouseMovementEventListener(showPlaylist,isFullScreen){ window.removeEventListener("mousemove",function(event){ onMouseMovement(event,showPlaylist,isFullScreen)}) window.removeEventListener("mousedown",function(event){ onMouseMovement(event,showPlaylist,isFullScreen)}) window.addEventListener("mousemove",function(event){ onMouseMovement(event,showPlaylist,isFullScreen) }); window.addEventListener("mousedown",function(event){ onMouseMovement(event,showPlaylist,isFullScreen) }); } // update dimensions function updateDimensions(){ const newContainerWidth = parentContainerElement.offsetWidth; setContainerWidth(newContainerWidth) document.getElementById('product-page-content').removeEventListener("DOMNodeRemoved", updateDimensions); document.getElementById('product-page-content').removeEventListener("DOMNodeInserted", updateDimensions); if (cinemaMode === false) setSliderHeight(360) } // on mouse movement function onMouseMovement(event,showPlaylist,isFullScreen){ const mediaSliderOffest = $('#media-slider').offset() const mediaSliderLeft = mediaSliderOffest.left; const mediaSliderRight = mediaSliderLeft + $('#media-slider').width(); const mediaSliderTop = mediaSliderOffest.top - window.pageYOffset; let mediaSliderBottom = mediaSliderTop + $('#media-slider').height(); if (showPlaylist) mediaSliderBottom += 110; else mediaSliderBottom += 30; let mouseIn = false; if (event.clientX > mediaSliderLeft && event.clientX < mediaSliderRight && event.clientY > mediaSliderTop && event.clientY < mediaSliderBottom ){ mouseIn = true; } if (isFullScreen) mouseIn = true; if (mouseIn) { setSliderFadeControlsMode(false) clearTimeout(sliderFadeControlTimeOut); sliderFadeControlTimeOut = setTimeout(function(){ setSliderFadeControlsMode(true) }, 1700); } else { setSliderFadeControlsMode(true) clearTimeout(sliderFadeControlTimeOut); } } // toggle cinema mode function toggleCinemaMode(){ document.getElementById('product-page-content').addEventListener("DOMNodeRemoved", updateDimensions); document.getElementById('product-page-content').addEventListener("DOMNodeInserted", updateDimensions); const newCinemaMode = cinemaMode === true ? false : true; const targetParentElement = cinemaMode === true ? $('#product-main') : $('#product-page-content'); const targetChildPrependedElement = cinemaMode === true ? $('#product-title-div') : $('#product-media-slider-container'); $('#product-main-img-container').prependTo(targetParentElement); $(targetChildPrependedElement).prependTo('#product-main-img'); $("#product-media-slider-container").toggleClass("imgsmall"); $("#product-media-slider-container").toggleClass("imgfull"); setCinemaMode(newCinemaMode) } // toggle show playlist function toggleShowPlaylist(){ const newShowPlaylistValue = showPlaylist === true ? false : true; setShowPlaylist(newShowPlaylistValue) } //handle full screen toggle function hanleFullScreenToggle(val){ setIsFullScreen(val); } // on finish slides render function onFinishedSlidesRender(){ $(document).ready(function() { window.mySwiper = new Swiper('.swiper-container', { speed: 400, initialSlide: 0, observer: true, observeParents: true, preloadImages: true, updateOnImagesReady: true, pagination: '.swiper-pagination', paginationClickable: '.swiper-pagination', nextButton: '.swiper-button-next', prevButton: '.swiper-button-prev', threshold:50, onSlideChangeStart: function(swiper){ setCurrentSlide(swiper.activeIndex); } }); window.mySwiper.update() // if (isMobile) setShowPlaylist(true) }); } // on finished thumbs render function onfinishedThumbsRender(){ $(document).ready(function() { let slidesPerView = Math.ceil(containerWidth / 200); if (isMobile) slidesPerView = 2; window.galleryThumbs = new Swiper('.gallery-thumbs', { slidesPerView:slidesPerView, + initialSlide: currentSlide, spaceBetween:10, freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, activeIndex:currentSlide, scrollbar:'.swiper-scrollbar' }); window.galleryThumbs.update() }); } // on thumb item click function onThumbItemClick(slideIndex){ window.mySwiper.slideTo(slideIndex) } /* Render */ // media slider css class let mediaSliderCssClass = ""; if (disableGallery === true) mediaSliderCssClass += "disable-gallery "; if (cinemaMode === true) mediaSliderCssClass += "cinema-mode "; if (showSliderArrows === false) mediaSliderCssClass += "hide-arrows "; if (showPlaylist === false) mediaSliderCssClass += "hide-playlist "; if (sliderFadeControlsMode === true) mediaSliderCssClass += "fade-controls "; if (isMobile === true) mediaSliderCssClass += "is-mobile "; // slides display const slidesDisplay = gallery.map((s,index) => ( setSliderHeight(height)} onUpdateDimensions={updateDimensions} onFullScreenToggle={hanleFullScreenToggle} /> )); let thumbnailNavigationDisplay; if (showPlaylist){ // thumbnail navigation const slidesThumbnailNavigationDisplay = gallery.map((g, index) => ( onThumbItemClick(slideIndex)} /> )) thumbnailNavigationDisplay = (
{slidesThumbnailNavigationDisplay}
) } return (
{slidesDisplay}
{thumbnailNavigationDisplay}
) } function SlideItem(props){ const [ mediaStyle, setMediaStyle ] = useState(); React.useEffect(() => { if (props.gallery && props.gallery.length === props.slideIndex + 1){ props.onFinishedSlidesRender(); } }, [props.gallery]) React.useEffect(() => { getSlideContentHeight() },[props.currentSlide, props.cinemaMode]); function getSlideContentHeight(){ if (props.slide.type === "image"){ const imageEl = document.getElementById('slide-img-'+props.slideIndex); if (props.currentSlide === props.slideIndex){ if ( props.cinemaMode === true ){ let imageHeight = imageEl.naturalHeight; if (imageEl.naturalWidth > window.innerWidth){ let dimensionsPercentage = window.innerWidth / imageEl.naturalWidth; imageHeight = imageEl.naturalHeight * dimensionsPercentage; } setMediaStyle({height:imageHeight}) props.onSetSliderHeight(imageHeight); } else if (imageEl.offsetHeight > 0) setMediaStyle({marginTop:(props.sliderHeight - imageEl.offsetHeight) / 2}) } } else if (props.slide.type === "embed"){ if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(315) } else if (props.slide.type === "video" || props.slide.type === "audio"){ - if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(410); + if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(440); } } let slideContentDisplay; if (props.slide.type === "embed"){ slideContentDisplay =
; } else if (props.slide.type === "image") { slideContentDisplay = ( ) } else if (props.slide.type === "video") { slideContentDisplay = ( ) } else if (props.slide.type === "book"){ slideContentDisplay = ( ) } return(
{slideContentDisplay}
) } function ThumbNavigationItem(props){ React.useEffect(() => { if (props.gallery && props.gallery.length === props.slideIndex + 1){ props.onfinishedThumbsRender() } }, [props.gallery]) React.useEffect(() => { if (window.galleryThumbs){ window.galleryThumbs.slideTo(props.currentSlide); } },[props.currentSlide]) let bgImage; if (props.item.type === "image"){ bgImage = props.item.url.split('/img')[0] + "/cache/120x80-1/img" + props.item.url.split('/img')[1]; } else if (props.item.type === "video"){ bgImage = props.item.url_thumb; } return (
props.onThumbItemClick(props.slideIndex)} onTouchEnd={() => props.onThumbItemClick(props.slideIndex)}>
) } const rootElement = document.getElementById("product-media-slider-container"); ReactDOM.render(, rootElement); \ No newline at end of file diff --git a/httpdocs/theme/react/product-media-slider/package.json b/httpdocs/theme/react/product-media-slider/package.json index 0686424f8..98e772cd1 100644 --- a/httpdocs/theme/react/product-media-slider/package.json +++ b/httpdocs/theme/react/product-media-slider/package.json @@ -1,40 +1,41 @@ { "name": "pling-media-player", "version": "1.0.0", "description": "Pling / Opendesktop Media Player", "author": "DFN", "license": "UNLICENSED", "homepage": "https://my.opendesktop.org/", "repository": "https://github.com/opendesktop/opendesktop-my", "main": "public/main.js", "scripts": { "build": "webpack --mode production", "watch": "webpack --mode development --watch" }, "devDependencies": { "@babel/core": "*", "@babel/polyfill": "*", "@babel/preset-env": "*", "@babel/preset-react": "*", "@dicebear/avatars": "^3.0.6", "babel-loader": "*", "react": "^16.8.4", "react-dom": "^16.8.4", "react-video-thumbnail": "^0.1.3", "webpack": "*", "webpack-cli": "*" }, "dependencies": { "@dicebear/avatars-gridy-sprites": "^1.0.11", "@dicebear/avatars-jdenticon-sprites": "^1.0.3", "@dicebear/avatars-male-sprites": "^2.0.6", + "epubjs": "^0.3.84", "gyp": "^0.5.0", "jdenticon": "^2.1.1", "react-color": "^2.17.0", "react-device-detect": "^1.6.2", "react-draggable": "^3.3.0", "react-reader": "^0.17.10", "swiper": "^4.5.0", "video-react": "^0.13.7" } } diff --git a/httpdocs/theme/react/product-media-slider/product-media-slider.js b/httpdocs/theme/react/product-media-slider/product-media-slider.js index 760aacdb3..a163ce09d 100644 --- a/httpdocs/theme/react/product-media-slider/product-media-slider.js +++ b/httpdocs/theme/react/product-media-slider/product-media-slider.js @@ -1,3087 +1,1133 @@ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./app/product-media-slider.js"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./app/book-reader.js": /*!****************************!*\ !*** ./app/book-reader.js ***! \****************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_reader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-reader */ \"./node_modules/react-reader/lib/index.js\");\n/* harmony import */ var react_reader__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_reader__WEBPACK_IMPORTED_MODULE_1__);\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\nvar BookReaderWrapper =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(BookReaderWrapper, _React$Component);\n\n function BookReaderWrapper() {\n _classCallCheck(this, BookReaderWrapper);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(BookReaderWrapper).apply(this, arguments));\n }\n\n _createClass(BookReaderWrapper, [{\n key: \"render\",\n value: function render() {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n style: {\n position: \"relative\",\n height: \"100%\"\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_reader__WEBPACK_IMPORTED_MODULE_1__[\"ReactReader\"], {\n url: props.slide.url,\n title: props.slide.title,\n location: \"epubcfi(/6/2[cover]!/6)\",\n locationChanged: function locationChanged(epubcifi) {\n return console.log(epubcifi);\n }\n }));\n }\n }]);\n\n return BookReaderWrapper;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (BookReaderWrapper);\n\n//# sourceURL=webpack:///./app/book-reader.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\n\nfunction BookReaderWrapper(props) {\n var book = ePub(props.slide.url);\n var rendition = book.renderTo(\"book-container\", {\n flow: \"scrolled-doc\",\n width: props.width,\n height: props.height\n });\n var displayed = rendition.display();\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"book-reader-wrapper\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"prev\",\n onClick: goPrev\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"book-container\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"next\",\n onClick: goNext\n }));\n}\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (BookReaderWrapper);\n\n//# sourceURL=webpack:///./app/book-reader.js?"); /***/ }), /***/ "./app/product-media-slider.js": /*!*************************************!*\ !*** ./app/product-media-slider.js ***! \*************************************/ /*! no exports provided */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-device-detect */ \"./node_modules/react-device-detect/dist/index.js\");\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_device_detect__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _video_player__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./video-player */ \"./app/video-player.js\");\n/* harmony import */ var _book_reader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./book-reader */ \"./app/book-reader.js\");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\nfunction ProductMediaSlider() {\n /* Component */\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(window.product),\n _useState2 = _slicedToArray(_useState, 2),\n product = _useState2[0],\n setProduct = _useState2[1];\n\n var galleryArray = [];\n if (window.galleryPicturesJson) window.galleryPicturesJson.forEach(function (gp, index) {\n galleryArray.push({\n url: gp,\n type: 'image'\n });\n });else galleryArray = [{\n url: product.image_small,\n type: 'image'\n }];\n if (product.embed_code !== null && product.embed_code.length > 0) galleryArray = [{\n url: product.embed_code,\n type: 'embed'\n }].concat(_toConsumableArray(galleryArray));\n\n if (window.filesJson) {\n window.filesJson.forEach(function (f, index) {\n if (f.type.indexOf('video') > -1 || f.type.indexOf('audio') > -1 || f.type.indexOf('epub') > -1) {\n var gItem = {\n url: f.url.replace(/%2F/g, '/').replace(/%3A/g, ':'),\n type: f.type.split('/')[0],\n collection_id: f.collection_id,\n file_id: f.id,\n title: f.title\n };\n if (f.url_thumb) gItem.url_thumb = f.url_thumb.replace(/%2F/g, '/').replace(/%3A/g, ':');\n if (f.url_preview) gItem.url_preview = f.url_preview.replace(/%2F/g, '/').replace(/%3A/g, ':');\n galleryArray = [gItem].concat(_toConsumableArray(galleryArray));\n }\n });\n }\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(galleryArray),\n _useState4 = _slicedToArray(_useState3, 2),\n gallery = _useState4[0],\n setGallery = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(gallery.length > 1 ? false : true),\n _useState6 = _slicedToArray(_useState5, 2),\n disableGallery = _useState6[0],\n setDisableGallery = _useState6[1];\n\n var parentContainerElement = document.getElementById('product-title-div');\n\n var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(parentContainerElement.offsetWidth),\n _useState8 = _slicedToArray(_useState7, 2),\n containerWidth = _useState8[0],\n setContainerWidth = _useState8[1];\n\n var _useState9 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(0),\n _useState10 = _slicedToArray(_useState9, 2),\n currentSlide = _useState10[0],\n setCurrentSlide = _useState10[1];\n\n var _useState11 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(360),\n _useState12 = _slicedToArray(_useState11, 2),\n sliderHeight = _useState12[0],\n setSliderHeight = _useState12[1];\n\n var _useState13 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState14 = _slicedToArray(_useState13, 2),\n cinemaMode = _useState14[0],\n setCinemaMode = _useState14[1];\n\n var _useState15 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState16 = _slicedToArray(_useState15, 2),\n isFullScreen = _useState16[0],\n setIsFullScreen = _useState16[1];\n\n var _useState17 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState18 = _slicedToArray(_useState17, 2),\n showPlaylist = _useState18[0],\n setShowPlaylist = _useState18[1];\n\n var _useState19 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(true),\n _useState20 = _slicedToArray(_useState19, 2),\n showSliderArrows = _useState20[0],\n setShowSliderArrows = _useState20[1];\n\n var _useState21 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(true),\n _useState22 = _slicedToArray(_useState21, 2),\n sliderFadeControlsMode = _useState22[0],\n setSliderFadeControlsMode = _useState22[1];\n\n var sliderFadeControlTimeOut; // use effects\n\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n initProductMediaSlider(currentSlide);\n }, [currentSlide]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function (event) {\n updateDimensions(event, currentSlide);\n }, [currentSlide, cinemaMode]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n handleMouseMovementEventListener(showPlaylist, isFullScreen);\n }, [showPlaylist, isFullScreen]); // init product media slider\n\n function initProductMediaSlider(currentSlide) {\n window.addEventListener(\"resize\", function (event) {\n updateDimensions(event, currentSlide);\n });\n window.addEventListener(\"orientationchange\", function (event) {\n updateDimensions(event, currentSlide);\n });\n } // handle mouse movement event listener\n\n\n function handleMouseMovementEventListener(showPlaylist, isFullScreen) {\n window.removeEventListener(\"mousemove\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n window.removeEventListener(\"mousedown\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n window.addEventListener(\"mousemove\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n window.addEventListener(\"mousedown\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n } // update dimensions\n\n\n function updateDimensions() {\n var newContainerWidth = parentContainerElement.offsetWidth;\n setContainerWidth(newContainerWidth);\n document.getElementById('product-page-content').removeEventListener(\"DOMNodeRemoved\", updateDimensions);\n document.getElementById('product-page-content').removeEventListener(\"DOMNodeInserted\", updateDimensions);\n if (cinemaMode === false) setSliderHeight(360);\n } // on mouse movement\n\n\n function onMouseMovement(event, showPlaylist, isFullScreen) {\n var mediaSliderOffest = $('#media-slider').offset();\n var mediaSliderLeft = mediaSliderOffest.left;\n var mediaSliderRight = mediaSliderLeft + $('#media-slider').width();\n var mediaSliderTop = mediaSliderOffest.top - window.pageYOffset;\n var mediaSliderBottom = mediaSliderTop + $('#media-slider').height();\n if (showPlaylist) mediaSliderBottom += 110;else mediaSliderBottom += 30;\n var mouseIn = false;\n\n if (event.clientX > mediaSliderLeft && event.clientX < mediaSliderRight && event.clientY > mediaSliderTop && event.clientY < mediaSliderBottom) {\n mouseIn = true;\n }\n\n if (isFullScreen) mouseIn = true;\n\n if (mouseIn) {\n setSliderFadeControlsMode(false);\n clearTimeout(sliderFadeControlTimeOut);\n sliderFadeControlTimeOut = setTimeout(function () {\n setSliderFadeControlsMode(true);\n }, 1700);\n } else {\n setSliderFadeControlsMode(true);\n clearTimeout(sliderFadeControlTimeOut);\n }\n } // toggle cinema mode\n\n\n function toggleCinemaMode() {\n document.getElementById('product-page-content').addEventListener(\"DOMNodeRemoved\", updateDimensions);\n document.getElementById('product-page-content').addEventListener(\"DOMNodeInserted\", updateDimensions);\n var newCinemaMode = cinemaMode === true ? false : true;\n var targetParentElement = cinemaMode === true ? $('#product-main') : $('#product-page-content');\n var targetChildPrependedElement = cinemaMode === true ? $('#product-title-div') : $('#product-media-slider-container');\n $('#product-main-img-container').prependTo(targetParentElement);\n $(targetChildPrependedElement).prependTo('#product-main-img');\n $(\"#product-media-slider-container\").toggleClass(\"imgsmall\");\n $(\"#product-media-slider-container\").toggleClass(\"imgfull\");\n setCinemaMode(newCinemaMode);\n } // toggle show playlist\n\n\n function toggleShowPlaylist() {\n var newShowPlaylistValue = showPlaylist === true ? false : true;\n setShowPlaylist(newShowPlaylistValue);\n } //handle full screen toggle\n\n\n function hanleFullScreenToggle(val) {\n setIsFullScreen(val);\n } // on finish slides render\n\n\n function onFinishedSlidesRender() {\n $(document).ready(function () {\n window.mySwiper = new Swiper('.swiper-container', {\n speed: 400,\n initialSlide: 0,\n observer: true,\n observeParents: true,\n preloadImages: true,\n updateOnImagesReady: true,\n pagination: '.swiper-pagination',\n paginationClickable: '.swiper-pagination',\n nextButton: '.swiper-button-next',\n prevButton: '.swiper-button-prev',\n threshold: 50,\n onSlideChangeStart: function onSlideChangeStart(swiper) {\n setCurrentSlide(swiper.activeIndex);\n }\n });\n window.mySwiper.update(); // if (isMobile) setShowPlaylist(true)\n });\n } // on finished thumbs render\n\n\n function onfinishedThumbsRender() {\n $(document).ready(function () {\n var slidesPerView = Math.ceil(containerWidth / 200);\n if (react_device_detect__WEBPACK_IMPORTED_MODULE_2__[\"isMobile\"]) slidesPerView = 2;\n window.galleryThumbs = new Swiper('.gallery-thumbs', {\n slidesPerView: slidesPerView,\n spaceBetween: 10,\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n activeIndex: currentSlide,\n scrollbar: '.swiper-scrollbar'\n });\n window.galleryThumbs.update();\n });\n } // on thumb item click\n\n\n function _onThumbItemClick(slideIndex) {\n window.mySwiper.slideTo(slideIndex);\n }\n /* Render */\n // media slider css class\n\n\n var mediaSliderCssClass = \"\";\n if (disableGallery === true) mediaSliderCssClass += \"disable-gallery \";\n if (cinemaMode === true) mediaSliderCssClass += \"cinema-mode \";\n if (showSliderArrows === false) mediaSliderCssClass += \"hide-arrows \";\n if (showPlaylist === false) mediaSliderCssClass += \"hide-playlist \";\n if (sliderFadeControlsMode === true) mediaSliderCssClass += \"fade-controls \";\n if (react_device_detect__WEBPACK_IMPORTED_MODULE_2__[\"isMobile\"] === true) mediaSliderCssClass += \"is-mobile \"; // slides display\n\n var slidesDisplay = gallery.map(function (s, index) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(SlideItem, {\n key: index,\n slideIndex: index,\n slide: s,\n currentSlide: currentSlide,\n containerWidth: containerWidth,\n sliderHeight: sliderHeight,\n cinemaMode: cinemaMode,\n gallery: gallery,\n onFinishedSlidesRender: onFinishedSlidesRender,\n onCinemaModeClick: toggleCinemaMode,\n onSetSliderHeight: function onSetSliderHeight(height) {\n return setSliderHeight(height);\n },\n onUpdateDimensions: updateDimensions,\n onFullScreenToggle: hanleFullScreenToggle\n });\n });\n var thumbnailNavigationDisplay;\n\n if (showPlaylist) {\n // thumbnail navigation\n var slidesThumbnailNavigationDisplay = gallery.map(function (g, index) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ThumbNavigationItem, {\n key: index,\n slideIndex: index,\n currentSlide: currentSlide,\n gallery: gallery,\n item: g,\n onFinishedSlidesRender: onFinishedSlidesRender,\n containerWidth: containerWidth,\n onfinishedThumbsRender: onfinishedThumbsRender,\n onThumbItemClick: function onThumbItemClick(slideIndex) {\n return _onThumbItemClick(slideIndex);\n }\n });\n });\n thumbnailNavigationDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"slide-navigation\",\n className: \"swiper-container gallery-thumbs\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"thumbnail-navigation swiper-wrapper\"\n }, slidesThumbnailNavigationDisplay), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-scrollbar\"\n }));\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"main\", {\n id: \"media-slider\",\n style: {\n height: sliderHeight\n },\n className: mediaSliderCssClass\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"slider-container\",\n className: \"swiper-container\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-wrapper\"\n }, slidesDisplay), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-pagination\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-button-prev\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-button-next\"\n })), thumbnailNavigationDisplay, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"a\", {\n className: \"slider-navigation-toggle\",\n onClick: toggleShowPlaylist,\n style: {\n top: sliderHeight - 65\n }\n }));\n}\n\nfunction SlideItem(props) {\n var _useState23 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(),\n _useState24 = _slicedToArray(_useState23, 2),\n mediaStyle = _useState24[0],\n setMediaStyle = _useState24[1];\n\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n if (props.gallery && props.gallery.length === props.slideIndex + 1) {\n props.onFinishedSlidesRender();\n }\n }, [props.gallery]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n getSlideContentHeight();\n }, [props.currentSlide, props.cinemaMode]);\n\n function getSlideContentHeight() {\n if (props.slide.type === \"image\") {\n var imageEl = document.getElementById('slide-img-' + props.slideIndex);\n\n if (props.currentSlide === props.slideIndex) {\n if (props.cinemaMode === true) {\n var imageHeight = imageEl.naturalHeight;\n\n if (imageEl.naturalWidth > window.innerWidth) {\n var dimensionsPercentage = window.innerWidth / imageEl.naturalWidth;\n imageHeight = imageEl.naturalHeight * dimensionsPercentage;\n }\n\n setMediaStyle({\n height: imageHeight\n });\n props.onSetSliderHeight(imageHeight);\n } else if (imageEl.offsetHeight > 0) setMediaStyle({\n marginTop: (props.sliderHeight - imageEl.offsetHeight) / 2\n });\n }\n } else if (props.slide.type === \"embed\") {\n if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(315);\n } else if (props.slide.type === \"video\" || props.slide.type === \"audio\") {\n if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(410);\n }\n }\n\n var slideContentDisplay;\n\n if (props.slide.type === \"embed\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n dangerouslySetInnerHTML: {\n __html: props.slide.url\n }\n });\n } else if (props.slide.type === \"image\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"img\", {\n onClick: props.onCinemaModeClick,\n id: \"slide-img-\" + props.slideIndex,\n src: props.slide.url,\n style: mediaStyle\n });\n } else if (props.slide.type === \"video\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_video_player__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n height: props.sliderHeight,\n width: props.containerWidth,\n onCinemaModeClick: props.onCinemaModeClick,\n slide: props.slide,\n playVideo: props.currentSlide === props.slideIndex,\n onUpdateDimensions: props.onUpdateDimensions,\n onFullScreenToggle: props.onFullScreenToggle\n });\n } else if (props.slide.type === \"book\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_book_reader__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n height: props.sliderHeight,\n width: props.containerWidth,\n onCinemaModeClick: props.onCinemaModeClick,\n slide: props.slide,\n playVideo: props.currentSlide === props.slideIndex,\n onUpdateDimensions: props.onUpdateDimensions,\n onFullScreenToggle: props.onFullScreenToggle\n });\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"slide-\" + props.slideIndex,\n className: props.currentSlide === props.slideIndex ? \"active slide-item swiper-slide \" + props.slide.type : \"slide-item swiper-slide \" + props.slide.type,\n style: {\n width: props.containerWidth,\n height: props.sliderHeight\n }\n }, slideContentDisplay);\n}\n\nfunction ThumbNavigationItem(props) {\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n if (props.gallery && props.gallery.length === props.slideIndex + 1) {\n props.onfinishedThumbsRender();\n }\n }, [props.gallery]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n if (window.galleryThumbs) {\n window.galleryThumbs.slideTo(props.currentSlide);\n }\n }, [props.currentSlide]);\n var bgImage;\n\n if (props.item.type === \"image\") {\n bgImage = props.item.url.split('/img')[0] + \"/cache/120x80-1/img\" + props.item.url.split('/img')[1];\n } else if (props.item.type === \"video\") {\n bgImage = props.item.url_thumb;\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: props.currentSlide === props.slideIndex ? \" swiper-slide active \" : \" swiper-slide \",\n onClick: function onClick() {\n return props.onThumbItemClick(props.slideIndex);\n },\n onTouchEnd: function onTouchEnd() {\n return props.onThumbItemClick(props.slideIndex);\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"preview-image\",\n style: {\n \"backgroundImage\": \"url(\" + bgImage + \")\"\n }\n }));\n}\n\nvar rootElement = document.getElementById(\"product-media-slider-container\");\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ProductMediaSlider, null), rootElement);\n\n//# sourceURL=webpack:///./app/product-media-slider.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-device-detect */ \"./node_modules/react-device-detect/dist/index.js\");\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_device_detect__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _video_player__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./video-player */ \"./app/video-player.js\");\n/* harmony import */ var _book_reader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./book-reader */ \"./app/book-reader.js\");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\n\n\n\n\nfunction ProductMediaSlider() {\n /* Component */\n var _useState = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(window.product),\n _useState2 = _slicedToArray(_useState, 2),\n product = _useState2[0],\n setProduct = _useState2[1];\n\n var galleryArray = [];\n if (window.galleryPicturesJson) window.galleryPicturesJson.forEach(function (gp, index) {\n galleryArray.push({\n url: gp,\n type: 'image'\n });\n });else galleryArray = [{\n url: product.image_small,\n type: 'image'\n }];\n if (product.embed_code !== null && product.embed_code.length > 0) galleryArray = [{\n url: product.embed_code,\n type: 'embed'\n }].concat(_toConsumableArray(galleryArray));\n\n if (window.filesJson) {\n window.filesJson.forEach(function (f, index) {\n if (f.type.indexOf('video') > -1 || f.type.indexOf('audio') > -1 || f.type.indexOf('epub') > -1) {\n var type;\n if (f.type.indexOf('video') > -1 || f.type.indexOf('audio') > -1) type = f.type.split('/')[0];else if (f.type.indexOf('epub') > -1) type = \"book\";\n var url_preview, url_thumb;\n if (f.url_thumb) url_thumb = f.url_thumb.replace(/%2F/g, '/').replace(/%3A/g, ':');\n if (f.url_preview) url_preview = f.url_preview.replace(/%2F/g, '/').replace(/%3A/g, ':');\n var gItem = {\n url: f.url.replace(/%2F/g, '/').replace(/%3A/g, ':'),\n collection_id: f.collection_id,\n type: type,\n file_id: f.id,\n title: f.title,\n url_thumb: url_thumb,\n url_preview: url_preview\n };\n galleryArray = [gItem].concat(_toConsumableArray(galleryArray));\n }\n });\n }\n\n var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(galleryArray),\n _useState4 = _slicedToArray(_useState3, 2),\n gallery = _useState4[0],\n setGallery = _useState4[1];\n\n var _useState5 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(gallery.length > 1 ? false : true),\n _useState6 = _slicedToArray(_useState5, 2),\n disableGallery = _useState6[0],\n setDisableGallery = _useState6[1];\n\n var parentContainerElement = document.getElementById('product-title-div');\n\n var _useState7 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(parentContainerElement.offsetWidth),\n _useState8 = _slicedToArray(_useState7, 2),\n containerWidth = _useState8[0],\n setContainerWidth = _useState8[1];\n\n var _useState9 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(0),\n _useState10 = _slicedToArray(_useState9, 2),\n currentSlide = _useState10[0],\n setCurrentSlide = _useState10[1];\n\n var _useState11 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(360),\n _useState12 = _slicedToArray(_useState11, 2),\n sliderHeight = _useState12[0],\n setSliderHeight = _useState12[1];\n\n var _useState13 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState14 = _slicedToArray(_useState13, 2),\n cinemaMode = _useState14[0],\n setCinemaMode = _useState14[1];\n\n var _useState15 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState16 = _slicedToArray(_useState15, 2),\n isFullScreen = _useState16[0],\n setIsFullScreen = _useState16[1];\n\n var _useState17 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(false),\n _useState18 = _slicedToArray(_useState17, 2),\n showPlaylist = _useState18[0],\n setShowPlaylist = _useState18[1];\n\n var _useState19 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(true),\n _useState20 = _slicedToArray(_useState19, 2),\n showSliderArrows = _useState20[0],\n setShowSliderArrows = _useState20[1];\n\n var _useState21 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(true),\n _useState22 = _slicedToArray(_useState21, 2),\n sliderFadeControlsMode = _useState22[0],\n setSliderFadeControlsMode = _useState22[1];\n\n var sliderFadeControlTimeOut; // use effects\n\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n initProductMediaSlider(currentSlide);\n }, [currentSlide]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function (event) {\n updateDimensions(event, currentSlide);\n }, [currentSlide, cinemaMode]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n handleMouseMovementEventListener(showPlaylist, isFullScreen);\n }, [showPlaylist, isFullScreen]); // init product media slider\n\n function initProductMediaSlider(currentSlide) {\n window.addEventListener(\"resize\", function (event) {\n updateDimensions(event, currentSlide);\n });\n window.addEventListener(\"orientationchange\", function (event) {\n updateDimensions(event, currentSlide);\n });\n } // handle mouse movement event listener\n\n\n function handleMouseMovementEventListener(showPlaylist, isFullScreen) {\n window.removeEventListener(\"mousemove\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n window.removeEventListener(\"mousedown\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n window.addEventListener(\"mousemove\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n window.addEventListener(\"mousedown\", function (event) {\n onMouseMovement(event, showPlaylist, isFullScreen);\n });\n } // update dimensions\n\n\n function updateDimensions() {\n var newContainerWidth = parentContainerElement.offsetWidth;\n setContainerWidth(newContainerWidth);\n document.getElementById('product-page-content').removeEventListener(\"DOMNodeRemoved\", updateDimensions);\n document.getElementById('product-page-content').removeEventListener(\"DOMNodeInserted\", updateDimensions);\n if (cinemaMode === false) setSliderHeight(360);\n } // on mouse movement\n\n\n function onMouseMovement(event, showPlaylist, isFullScreen) {\n var mediaSliderOffest = $('#media-slider').offset();\n var mediaSliderLeft = mediaSliderOffest.left;\n var mediaSliderRight = mediaSliderLeft + $('#media-slider').width();\n var mediaSliderTop = mediaSliderOffest.top - window.pageYOffset;\n var mediaSliderBottom = mediaSliderTop + $('#media-slider').height();\n if (showPlaylist) mediaSliderBottom += 110;else mediaSliderBottom += 30;\n var mouseIn = false;\n\n if (event.clientX > mediaSliderLeft && event.clientX < mediaSliderRight && event.clientY > mediaSliderTop && event.clientY < mediaSliderBottom) {\n mouseIn = true;\n }\n\n if (isFullScreen) mouseIn = true;\n\n if (mouseIn) {\n setSliderFadeControlsMode(false);\n clearTimeout(sliderFadeControlTimeOut);\n sliderFadeControlTimeOut = setTimeout(function () {\n setSliderFadeControlsMode(true);\n }, 1700);\n } else {\n setSliderFadeControlsMode(true);\n clearTimeout(sliderFadeControlTimeOut);\n }\n } // toggle cinema mode\n\n\n function toggleCinemaMode() {\n document.getElementById('product-page-content').addEventListener(\"DOMNodeRemoved\", updateDimensions);\n document.getElementById('product-page-content').addEventListener(\"DOMNodeInserted\", updateDimensions);\n var newCinemaMode = cinemaMode === true ? false : true;\n var targetParentElement = cinemaMode === true ? $('#product-main') : $('#product-page-content');\n var targetChildPrependedElement = cinemaMode === true ? $('#product-title-div') : $('#product-media-slider-container');\n $('#product-main-img-container').prependTo(targetParentElement);\n $(targetChildPrependedElement).prependTo('#product-main-img');\n $(\"#product-media-slider-container\").toggleClass(\"imgsmall\");\n $(\"#product-media-slider-container\").toggleClass(\"imgfull\");\n setCinemaMode(newCinemaMode);\n } // toggle show playlist\n\n\n function toggleShowPlaylist() {\n var newShowPlaylistValue = showPlaylist === true ? false : true;\n setShowPlaylist(newShowPlaylistValue);\n } //handle full screen toggle\n\n\n function hanleFullScreenToggle(val) {\n setIsFullScreen(val);\n } // on finish slides render\n\n\n function onFinishedSlidesRender() {\n $(document).ready(function () {\n window.mySwiper = new Swiper('.swiper-container', {\n speed: 400,\n initialSlide: 0,\n observer: true,\n observeParents: true,\n preloadImages: true,\n updateOnImagesReady: true,\n pagination: '.swiper-pagination',\n paginationClickable: '.swiper-pagination',\n nextButton: '.swiper-button-next',\n prevButton: '.swiper-button-prev',\n threshold: 50,\n onSlideChangeStart: function onSlideChangeStart(swiper) {\n setCurrentSlide(swiper.activeIndex);\n }\n });\n window.mySwiper.update(); // if (isMobile) setShowPlaylist(true)\n });\n } // on finished thumbs render\n\n\n function onfinishedThumbsRender() {\n $(document).ready(function () {\n var slidesPerView = Math.ceil(containerWidth / 200);\n if (react_device_detect__WEBPACK_IMPORTED_MODULE_2__[\"isMobile\"]) slidesPerView = 2;\n window.galleryThumbs = new Swiper('.gallery-thumbs', {\n slidesPerView: slidesPerView,\n initialSlide: currentSlide,\n spaceBetween: 10,\n freeMode: true,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n activeIndex: currentSlide,\n scrollbar: '.swiper-scrollbar'\n });\n window.galleryThumbs.update();\n });\n } // on thumb item click\n\n\n function _onThumbItemClick(slideIndex) {\n window.mySwiper.slideTo(slideIndex);\n }\n /* Render */\n // media slider css class\n\n\n var mediaSliderCssClass = \"\";\n if (disableGallery === true) mediaSliderCssClass += \"disable-gallery \";\n if (cinemaMode === true) mediaSliderCssClass += \"cinema-mode \";\n if (showSliderArrows === false) mediaSliderCssClass += \"hide-arrows \";\n if (showPlaylist === false) mediaSliderCssClass += \"hide-playlist \";\n if (sliderFadeControlsMode === true) mediaSliderCssClass += \"fade-controls \";\n if (react_device_detect__WEBPACK_IMPORTED_MODULE_2__[\"isMobile\"] === true) mediaSliderCssClass += \"is-mobile \"; // slides display\n\n var slidesDisplay = gallery.map(function (s, index) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(SlideItem, {\n key: index,\n slideIndex: index,\n slide: s,\n currentSlide: currentSlide,\n containerWidth: containerWidth,\n sliderHeight: sliderHeight,\n cinemaMode: cinemaMode,\n gallery: gallery,\n onFinishedSlidesRender: onFinishedSlidesRender,\n onCinemaModeClick: toggleCinemaMode,\n onSetSliderHeight: function onSetSliderHeight(height) {\n return setSliderHeight(height);\n },\n onUpdateDimensions: updateDimensions,\n onFullScreenToggle: hanleFullScreenToggle\n });\n });\n var thumbnailNavigationDisplay;\n\n if (showPlaylist) {\n // thumbnail navigation\n var slidesThumbnailNavigationDisplay = gallery.map(function (g, index) {\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ThumbNavigationItem, {\n key: index,\n slideIndex: index,\n currentSlide: currentSlide,\n gallery: gallery,\n item: g,\n onFinishedSlidesRender: onFinishedSlidesRender,\n containerWidth: containerWidth,\n onfinishedThumbsRender: onfinishedThumbsRender,\n onThumbItemClick: function onThumbItemClick(slideIndex) {\n return _onThumbItemClick(slideIndex);\n }\n });\n });\n thumbnailNavigationDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"slide-navigation\",\n className: \"swiper-container gallery-thumbs\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"thumbnail-navigation swiper-wrapper\"\n }, slidesThumbnailNavigationDisplay), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-scrollbar\"\n }));\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"main\", {\n id: \"media-slider\",\n style: {\n height: sliderHeight\n },\n className: mediaSliderCssClass\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"slider-container\",\n className: \"swiper-container\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-wrapper\"\n }, slidesDisplay), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-pagination\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-button-prev\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"swiper-button-next\"\n })), thumbnailNavigationDisplay, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"a\", {\n className: \"slider-navigation-toggle\",\n onClick: toggleShowPlaylist,\n style: {\n top: sliderHeight - 65\n }\n }));\n}\n\nfunction SlideItem(props) {\n var _useState23 = Object(react__WEBPACK_IMPORTED_MODULE_0__[\"useState\"])(),\n _useState24 = _slicedToArray(_useState23, 2),\n mediaStyle = _useState24[0],\n setMediaStyle = _useState24[1];\n\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n if (props.gallery && props.gallery.length === props.slideIndex + 1) {\n props.onFinishedSlidesRender();\n }\n }, [props.gallery]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n getSlideContentHeight();\n }, [props.currentSlide, props.cinemaMode]);\n\n function getSlideContentHeight() {\n if (props.slide.type === \"image\") {\n var imageEl = document.getElementById('slide-img-' + props.slideIndex);\n\n if (props.currentSlide === props.slideIndex) {\n if (props.cinemaMode === true) {\n var imageHeight = imageEl.naturalHeight;\n\n if (imageEl.naturalWidth > window.innerWidth) {\n var dimensionsPercentage = window.innerWidth / imageEl.naturalWidth;\n imageHeight = imageEl.naturalHeight * dimensionsPercentage;\n }\n\n setMediaStyle({\n height: imageHeight\n });\n props.onSetSliderHeight(imageHeight);\n } else if (imageEl.offsetHeight > 0) setMediaStyle({\n marginTop: (props.sliderHeight - imageEl.offsetHeight) / 2\n });\n }\n } else if (props.slide.type === \"embed\") {\n if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(315);\n } else if (props.slide.type === \"video\" || props.slide.type === \"audio\") {\n if (props.currentSlide === props.slideIndex && props.cinemaMode === true) props.onSetSliderHeight(440);\n }\n }\n\n var slideContentDisplay;\n\n if (props.slide.type === \"embed\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n dangerouslySetInnerHTML: {\n __html: props.slide.url\n }\n });\n } else if (props.slide.type === \"image\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"img\", {\n onClick: props.onCinemaModeClick,\n id: \"slide-img-\" + props.slideIndex,\n src: props.slide.url,\n style: mediaStyle\n });\n } else if (props.slide.type === \"video\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_video_player__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n height: props.sliderHeight,\n width: props.containerWidth,\n onCinemaModeClick: props.onCinemaModeClick,\n slide: props.slide,\n playVideo: props.currentSlide === props.slideIndex,\n onUpdateDimensions: props.onUpdateDimensions,\n onFullScreenToggle: props.onFullScreenToggle\n });\n } else if (props.slide.type === \"book\") {\n slideContentDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_book_reader__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n height: props.sliderHeight,\n width: props.containerWidth,\n onCinemaModeClick: props.onCinemaModeClick,\n slide: props.slide,\n playVideo: props.currentSlide === props.slideIndex,\n onUpdateDimensions: props.onUpdateDimensions,\n onFullScreenToggle: props.onFullScreenToggle\n });\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n id: \"slide-\" + props.slideIndex,\n className: props.currentSlide === props.slideIndex ? \"active slide-item swiper-slide \" + props.slide.type : \"slide-item swiper-slide \" + props.slide.type,\n style: {\n width: props.containerWidth,\n height: props.sliderHeight\n }\n }, slideContentDisplay);\n}\n\nfunction ThumbNavigationItem(props) {\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n if (props.gallery && props.gallery.length === props.slideIndex + 1) {\n props.onfinishedThumbsRender();\n }\n }, [props.gallery]);\n react__WEBPACK_IMPORTED_MODULE_0___default.a.useEffect(function () {\n if (window.galleryThumbs) {\n window.galleryThumbs.slideTo(props.currentSlide);\n }\n }, [props.currentSlide]);\n var bgImage;\n\n if (props.item.type === \"image\") {\n bgImage = props.item.url.split('/img')[0] + \"/cache/120x80-1/img\" + props.item.url.split('/img')[1];\n } else if (props.item.type === \"video\") {\n bgImage = props.item.url_thumb;\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: props.currentSlide === props.slideIndex ? \" swiper-slide active \" : \" swiper-slide \",\n onClick: function onClick() {\n return props.onThumbItemClick(props.slideIndex);\n },\n onTouchEnd: function onTouchEnd() {\n return props.onThumbItemClick(props.slideIndex);\n }\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"preview-image\",\n style: {\n \"backgroundImage\": \"url(\" + bgImage + \")\"\n }\n }));\n}\n\nvar rootElement = document.getElementById(\"product-media-slider-container\");\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(ProductMediaSlider, null), rootElement);\n\n//# sourceURL=webpack:///./app/product-media-slider.js?"); /***/ }), /***/ "./app/video-player.js": /*!*****************************!*\ !*** ./app/video-player.js ***! \*****************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var video_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! video-react */ \"./node_modules/video-react/lib/index.js\");\n/* harmony import */ var video_react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(video_react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-device-detect */ \"./node_modules/react-device-detect/dist/index.js\");\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_device_detect__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\n\nvar VideoPlayerWrapper =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(VideoPlayerWrapper, _React$Component);\n\n function VideoPlayerWrapper(props, context) {\n var _this;\n\n _classCallCheck(this, VideoPlayerWrapper);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(VideoPlayerWrapper).call(this, props, context));\n var hostLocation = window.location.href;\n if (!hostLocation.endsWith('/')) hostLocation += \"/\";\n _this.state = {\n source: _this.props.slide.url_preview,\n videoStarted: false,\n videoStopped: false,\n videoStartUrl: hostLocation + \"startvideoajax?collection_id=\" + _this.props.slide.collection_id + \"&file_id=\" + _this.props.slide.file_id,\n videoStopUrl: hostLocation + \"stopvideoajax?media_view_id=\"\n };\n _this.onCinemaModeClick = _this.onCinemaModeClick.bind(_assertThisInitialized(_this));\n _this.play = _this.play.bind(_assertThisInitialized(_this));\n _this.pause = _this.pause.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(VideoPlayerWrapper, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.refs.player.subscribeToStateChange(this.handleStateChange.bind(this));\n }\n }, {\n key: \"handleStateChange\",\n value: function handleStateChange(state, prevState) {\n this.setState({\n player: state\n }, function () {\n if (this.state.player) {\n if (this.state.player.hasStarted && this.state.videoStarted === false) {\n this.setState({\n videoStarted: true\n }, function () {\n var self = this;\n $.ajax({\n url: this.state.videoStartUrl\n }).done(function (res) {\n self.setState({\n videoStopUrl: self.state.videoStopUrl + res.MediaViewId\n });\n });\n });\n }\n\n if (this.state.player.paused && this.state.videoStarted === true && this.state.videoStopped === false) {\n this.setState({\n videoStopped: true\n }, function () {\n $.ajax({\n url: this.state.videoStopUrl\n }).done(function (res) {// console.log(res)\n });\n });\n }\n\n if (state.isFullscreen === false && prevState.isFullscreen === true) this.props.onUpdateDimensions();\n if (state.isFullscreen !== prevState.isFullscreen) this.props.onFullScreenToggle(state.isFullscreen);\n }\n });\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n if (nextProps.playVideo === false) this.pause();\n return true;\n }\n }, {\n key: \"onCinemaModeClick\",\n value: function onCinemaModeClick() {\n this.props.onCinemaModeClick();\n }\n }, {\n key: \"play\",\n value: function play() {\n this.refs.player.play();\n }\n }, {\n key: \"pause\",\n value: function pause() {\n this.refs.player.pause();\n }\n }, {\n key: \"render\",\n value: function render() {\n var videoPlayerDisplay;\n\n if (this.state.source) {\n var controlBarDisplay;\n\n if (react_device_detect__WEBPACK_IMPORTED_MODULE_2__[\"isMobile\"]) {\n controlBarDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"ControlBar\"], {\n disabled: true\n });\n } else {\n controlBarDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"ControlBar\"], {\n className: \"custom-video-player\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"CurrentTimeDisplay\"], {\n order: 4.1\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"DurationDisplay\"], {\n order: 7.1\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"VolumeMenuButton\"], {\n vertical: true,\n order: 7.2\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"a\", {\n className: \"cinema-mode-button\",\n onClick: this.onCinemaModeClick,\n order: 7.3\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null)));\n }\n\n videoPlayerDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"Player\"], {\n poster: this.props.slide.url_thumb,\n ref: \"player\",\n fluid: false,\n height: this.props.height,\n width: this.props.width,\n preload: \"auto\",\n src: this.state.source\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"BigPlayButton\"], {\n position: \"center\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"LoadingSpinner\"], null), controlBarDisplay);\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"react-player-container\"\n }, videoPlayerDisplay);\n }\n }]);\n\n return VideoPlayerWrapper;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (VideoPlayerWrapper);\n\n//# sourceURL=webpack:///./app/video-player.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var video_react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! video-react */ \"./node_modules/video-react/lib/index.js\");\n/* harmony import */ var video_react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(video_react__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-device-detect */ \"./node_modules/react-device-detect/dist/index.js\");\n/* harmony import */ var react_device_detect__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_device_detect__WEBPACK_IMPORTED_MODULE_2__);\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\n\nvar VideoPlayerWrapper =\n/*#__PURE__*/\nfunction (_React$Component) {\n _inherits(VideoPlayerWrapper, _React$Component);\n\n function VideoPlayerWrapper(props, context) {\n var _this;\n\n _classCallCheck(this, VideoPlayerWrapper);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(VideoPlayerWrapper).call(this, props, context));\n var hostLocation = window.location.href;\n if (!hostLocation.endsWith('/')) hostLocation += \"/\";\n _this.state = {\n source: _this.props.slide.url_preview,\n videoStarted: false,\n videoStopped: false,\n videoStartUrl: hostLocation + \"startvideoajax?collection_id=\" + _this.props.slide.collection_id + \"&file_id=\" + _this.props.slide.file_id,\n videoStopUrl: hostLocation + \"stopvideoajax?media_view_id=\"\n };\n _this.onCinemaModeClick = _this.onCinemaModeClick.bind(_assertThisInitialized(_this));\n _this.play = _this.play.bind(_assertThisInitialized(_this));\n _this.pause = _this.pause.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(VideoPlayerWrapper, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.refs.player.subscribeToStateChange(this.handleStateChange.bind(this));\n }\n }, {\n key: \"handleStateChange\",\n value: function handleStateChange(state, prevState) {\n this.setState({\n player: state\n }, function () {\n if (this.state.player) {\n if (this.state.player.hasStarted && this.state.videoStarted === false) {\n this.setState({\n videoStarted: true\n }, function () {\n var self = this;\n $.ajax({\n url: this.state.videoStartUrl\n }).done(function (res) {\n self.setState({\n videoStopUrl: self.state.videoStopUrl + res.MediaViewId\n });\n });\n });\n }\n\n if (this.state.player.paused && this.state.videoStarted === true && this.state.videoStopped === false) {\n this.setState({\n videoStopped: true\n }, function () {\n $.ajax({\n url: this.state.videoStopUrl\n }).done(function (res) {// console.log(res)\n });\n });\n }\n\n if (state.isFullscreen === false && prevState.isFullscreen === true) this.props.onUpdateDimensions();\n if (state.isFullscreen !== prevState.isFullscreen) this.props.onFullScreenToggle(state.isFullscreen);\n }\n });\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n if (nextProps.playVideo === false) this.pause();\n return true;\n }\n }, {\n key: \"onCinemaModeClick\",\n value: function onCinemaModeClick() {\n this.props.onCinemaModeClick();\n }\n }, {\n key: \"play\",\n value: function play() {\n this.refs.player.play();\n }\n }, {\n key: \"pause\",\n value: function pause() {\n this.refs.player.pause();\n }\n }, {\n key: \"render\",\n value: function render() {\n var videoPlayerDisplay;\n\n if (this.state.source) {\n videoPlayerDisplay = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"Player\"], {\n ref: \"player\",\n fluid: false,\n height: this.props.height,\n width: this.props.width,\n preload: \"auto\",\n src: this.state.source\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"BigPlayButton\"], {\n position: \"center\"\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"LoadingSpinner\"], null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"ControlBar\"], {\n className: \"custom-video-player\"\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"CurrentTimeDisplay\"], {\n order: 4.1\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"DurationDisplay\"], {\n order: 7.1\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(video_react__WEBPACK_IMPORTED_MODULE_1__[\"VolumeMenuButton\"], {\n vertical: true,\n order: 7.2\n }), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"a\", {\n className: \"cinema-mode-button\",\n onClick: this.onCinemaModeClick,\n order: 7.3\n }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null))));\n }\n\n return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"react-player-container\"\n }, videoPlayerDisplay);\n }\n }]);\n\n return VideoPlayerWrapper;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (VideoPlayerWrapper);\n\n//# sourceURL=webpack:///./app/video-player.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js": /*!******************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***! \******************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}\n\nmodule.exports = _arrayWithoutHoles;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js": /*!**********************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/assertThisInitialized.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/classCallCheck.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/createClass.js": /*!************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/createClass.js ***! \************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/createClass.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/defineProperty.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/defineProperty.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/extends.js": /*!********************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/extends.js ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _extends() {\n module.exports = _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/extends.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/getPrototypeOf.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/inherits.js": /*!*********************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/inherits.js ***! \*********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ \"./node_modules/@babel/runtime/helpers/setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/inherits.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js": /*!**********************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! \**********************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/interopRequireDefault.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/interopRequireWildcard.js": /*!***********************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/interopRequireWildcard.js ***! \***********************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};\n\n if (desc.get || desc.set) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n }\n\n newObj[\"default\"] = obj;\n return newObj;\n }\n}\n\nmodule.exports = _interopRequireWildcard;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/interopRequireWildcard.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js": /*!****************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***! \****************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/iterableToArray.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js": /*!******************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***! \******************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nmodule.exports = _nonIterableSpread;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/nonIterableSpread.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/objectSpread.js": /*!*************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/objectSpread.js ***! \*************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var defineProperty = __webpack_require__(/*! ./defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\");\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nmodule.exports = _objectSpread;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectSpread.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/objectWithoutProperties.js": /*!************************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***! \************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var objectWithoutPropertiesLoose = __webpack_require__(/*! ./objectWithoutPropertiesLoose */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutProperties.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js": /*!*****************************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***! \*****************************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": /*!**************************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! \**************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var _typeof = __webpack_require__(/*! ../helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\n\nvar assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! \***************************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/setPrototypeOf.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js": /*!******************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***! \******************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles */ \"./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js\");\n\nvar iterableToArray = __webpack_require__(/*! ./iterableToArray */ \"./node_modules/@babel/runtime/helpers/iterableToArray.js\");\n\nvar nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread */ \"./node_modules/@babel/runtime/helpers/nonIterableSpread.js\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/toConsumableArray.js?"); /***/ }), /***/ "./node_modules/@babel/runtime/helpers/typeof.js": /*!*******************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports) { eval("function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;\n\n//# sourceURL=webpack:///./node_modules/@babel/runtime/helpers/typeof.js?"); /***/ }), -/***/ "./node_modules/base64-js/index.js": -/*!*****************************************!*\ - !*** ./node_modules/base64-js/index.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n\n//# sourceURL=webpack:///./node_modules/base64-js/index.js?"); - -/***/ }), - -/***/ "./node_modules/buffer/index.js": -/*!**************************************!*\ - !*** ./node_modules/buffer/index.js ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __webpack_require__(/*! base64-js */ \"./node_modules/base64-js/index.js\")\nvar ieee754 = __webpack_require__(/*! ieee754 */ \"./node_modules/ieee754/index.js\")\nvar isArray = __webpack_require__(/*! isarray */ \"./node_modules/isarray/index.js\")\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/buffer/index.js?"); - -/***/ }), - /***/ "./node_modules/classnames/index.js": /*!******************************************!*\ !*** ./node_modules/classnames/index.js ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { eval("var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n Copyright (c) 2017 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg) && arg.length) {\n\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\tif (inner) {\n\t\t\t\t\tclasses.push(inner);\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif ( true && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (true) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {\n\t\t\treturn classNames;\n\t\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n}());\n\n\n//# sourceURL=webpack:///./node_modules/classnames/index.js?"); /***/ }), -/***/ "./node_modules/core-util-is/lib/util.js": -/*!***********************************************!*\ - !*** ./node_modules/core-util-is/lib/util.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -eval("/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ \"./node_modules/buffer/index.js\").Buffer))\n\n//# sourceURL=webpack:///./node_modules/core-util-is/lib/util.js?"); - -/***/ }), - -/***/ "./node_modules/d/index.js": -/*!*********************************!*\ - !*** ./node_modules/d/index.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar assign = __webpack_require__(/*! es5-ext/object/assign */ \"./node_modules/es5-ext/object/assign/index.js\")\n , normalizeOpts = __webpack_require__(/*! es5-ext/object/normalize-options */ \"./node_modules/es5-ext/object/normalize-options.js\")\n , isCallable = __webpack_require__(/*! es5-ext/object/is-callable */ \"./node_modules/es5-ext/object/is-callable.js\")\n , contains = __webpack_require__(/*! es5-ext/string/#/contains */ \"./node_modules/es5-ext/string/#/contains/index.js\")\n\n , d;\n\nd = module.exports = function (dscr, value/*, options*/) {\n\tvar c, e, w, options, desc;\n\tif ((arguments.length < 2) || (typeof dscr !== 'string')) {\n\t\toptions = value;\n\t\tvalue = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[2];\n\t}\n\tif (dscr == null) {\n\t\tc = w = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t\tw = contains.call(dscr, 'w');\n\t}\n\n\tdesc = { value: value, configurable: c, enumerable: e, writable: w };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\nd.gs = function (dscr, get, set/*, options*/) {\n\tvar c, e, options, desc;\n\tif (typeof dscr !== 'string') {\n\t\toptions = set;\n\t\tset = get;\n\t\tget = dscr;\n\t\tdscr = null;\n\t} else {\n\t\toptions = arguments[3];\n\t}\n\tif (get == null) {\n\t\tget = undefined;\n\t} else if (!isCallable(get)) {\n\t\toptions = get;\n\t\tget = set = undefined;\n\t} else if (set == null) {\n\t\tset = undefined;\n\t} else if (!isCallable(set)) {\n\t\toptions = set;\n\t\tset = undefined;\n\t}\n\tif (dscr == null) {\n\t\tc = true;\n\t\te = false;\n\t} else {\n\t\tc = contains.call(dscr, 'c');\n\t\te = contains.call(dscr, 'e');\n\t}\n\n\tdesc = { get: get, set: set, configurable: c, enumerable: e };\n\treturn !options ? desc : assign(normalizeOpts(options), desc);\n};\n\n\n//# sourceURL=webpack:///./node_modules/d/index.js?"); - -/***/ }), - -/***/ "./node_modules/detect-passive-events/lib/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/detect-passive-events/lib/index.js ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n// adapted from https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\nvar detectPassiveEvents = {\n update: function update() {\n if (typeof window !== 'undefined' && typeof window.addEventListener === 'function') {\n var passive = false;\n var options = Object.defineProperty({}, 'passive', {\n get: function get() {\n passive = true;\n }\n });\n // note: have to set and remove a no-op listener instead of null\n // (which was used previously), becasue Edge v15 throws an error\n // when providing a null callback.\n // https://github.com/rafrex/detect-passive-events/pull/3\n var noop = function noop() {};\n window.addEventListener('testPassiveEventSupport', noop, options);\n window.removeEventListener('testPassiveEventSupport', noop, options);\n detectPassiveEvents.hasSupport = passive;\n }\n }\n};\n\ndetectPassiveEvents.update();\nexports.default = detectPassiveEvents;\n\n//# sourceURL=webpack:///./node_modules/detect-passive-events/lib/index.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/annotations.js": -/*!************************************************!*\ - !*** ./node_modules/epubjs/lib/annotations.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n\t* Handles managing adding & removing Annotations\n\t* @param {Rendition} rendition\n\t* @class\n\t*/\nvar Annotations = function () {\n\tfunction Annotations(rendition) {\n\t\t_classCallCheck(this, Annotations);\n\n\t\tthis.rendition = rendition;\n\t\tthis.highlights = [];\n\t\tthis.underlines = [];\n\t\tthis.marks = [];\n\t\tthis._annotations = {};\n\t\tthis._annotationsBySectionIndex = {};\n\n\t\tthis.rendition.hooks.render.register(this.inject.bind(this));\n\t\tthis.rendition.hooks.unloaded.register(this.clear.bind(this));\n\t}\n\n\t/**\n * Add an annotation to store\n * @param {string} type Type of annotation to add: \"highlight\", \"underline\", \"mark\"\n * @param {EpubCFI} cfiRange EpubCFI range to attach annotation to\n * @param {object} data Data to assign to annotation\n * @param {function} [cb] Callback after annotation is added\n * @param {string} className CSS class to assign to annotation\n * @param {object} styles CSS styles to assign to annotation\n * @returns {Annotation} annotation\n */\n\n\n\t_createClass(Annotations, [{\n\t\tkey: \"add\",\n\t\tvalue: function add(type, cfiRange, data, cb, className, styles) {\n\t\t\tvar hash = encodeURI(cfiRange + type);\n\t\t\tvar cfi = new _epubcfi2.default(cfiRange);\n\t\t\tvar sectionIndex = cfi.spinePos;\n\t\t\tvar annotation = new Annotation({\n\t\t\t\ttype: type,\n\t\t\t\tcfiRange: cfiRange,\n\t\t\t\tdata: data,\n\t\t\t\tsectionIndex: sectionIndex,\n\t\t\t\tcb: cb,\n\t\t\t\tclassName: className,\n\t\t\t\tstyles: styles\n\t\t\t});\n\n\t\t\tthis._annotations[hash] = annotation;\n\n\t\t\tif (sectionIndex in this._annotationsBySectionIndex) {\n\t\t\t\tthis._annotationsBySectionIndex[sectionIndex].push(hash);\n\t\t\t} else {\n\t\t\t\tthis._annotationsBySectionIndex[sectionIndex] = [hash];\n\t\t\t}\n\n\t\t\tvar views = this.rendition.views();\n\n\t\t\tviews.forEach(function (view) {\n\t\t\t\tif (annotation.sectionIndex === view.index) {\n\t\t\t\t\tannotation.attach(view);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn annotation;\n\t\t}\n\n\t\t/**\n * Remove an annotation from store\n * @param {EpubCFI} cfiRange EpubCFI range the annotation is attached to\n * @param {string} type Type of annotation to add: \"highlight\", \"underline\", \"mark\"\n */\n\n\t}, {\n\t\tkey: \"remove\",\n\t\tvalue: function remove(cfiRange, type) {\n\t\t\tvar _this = this;\n\n\t\t\tvar hash = encodeURI(cfiRange + type);\n\n\t\t\tif (hash in this._annotations) {\n\t\t\t\tvar annotation = this._annotations[hash];\n\n\t\t\t\tif (type && annotation.type !== type) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar views = this.rendition.views();\n\t\t\t\tviews.forEach(function (view) {\n\t\t\t\t\t_this._removeFromAnnotationBySectionIndex(annotation.sectionIndex, hash);\n\t\t\t\t\tif (annotation.sectionIndex === view.index) {\n\t\t\t\t\t\tannotation.detach(view);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tdelete this._annotations[hash];\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Remove an annotations by Section Index\n * @private\n */\n\n\t}, {\n\t\tkey: \"_removeFromAnnotationBySectionIndex\",\n\t\tvalue: function _removeFromAnnotationBySectionIndex(sectionIndex, hash) {\n\t\t\tthis._annotationsBySectionIndex[sectionIndex] = this._annotationsAt(sectionIndex).filter(function (h) {\n\t\t\t\treturn h !== hash;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Get annotations by Section Index\n * @private\n */\n\n\t}, {\n\t\tkey: \"_annotationsAt\",\n\t\tvalue: function _annotationsAt(index) {\n\t\t\treturn this._annotationsBySectionIndex[index];\n\t\t}\n\n\t\t/**\n * Add a highlight to the store\n * @param {EpubCFI} cfiRange EpubCFI range to attach annotation to\n * @param {object} data Data to assign to annotation\n * @param {function} cb Callback after annotation is clicked\n * @param {string} className CSS class to assign to annotation\n * @param {object} styles CSS styles to assign to annotation\n */\n\n\t}, {\n\t\tkey: \"highlight\",\n\t\tvalue: function highlight(cfiRange, data, cb, className, styles) {\n\t\t\treturn this.add(\"highlight\", cfiRange, data, cb, className, styles);\n\t\t}\n\n\t\t/**\n * Add a underline to the store\n * @param {EpubCFI} cfiRange EpubCFI range to attach annotation to\n * @param {object} data Data to assign to annotation\n * @param {function} cb Callback after annotation is clicked\n * @param {string} className CSS class to assign to annotation\n * @param {object} styles CSS styles to assign to annotation\n */\n\n\t}, {\n\t\tkey: \"underline\",\n\t\tvalue: function underline(cfiRange, data, cb, className, styles) {\n\t\t\treturn this.add(\"underline\", cfiRange, data, cb, className, styles);\n\t\t}\n\n\t\t/**\n * Add a mark to the store\n * @param {EpubCFI} cfiRange EpubCFI range to attach annotation to\n * @param {object} data Data to assign to annotation\n * @param {function} cb Callback after annotation is clicked\n */\n\n\t}, {\n\t\tkey: \"mark\",\n\t\tvalue: function mark(cfiRange, data, cb) {\n\t\t\treturn this.add(\"mark\", cfiRange, data, cb);\n\t\t}\n\n\t\t/**\n * iterate over annotations in the store\n */\n\n\t}, {\n\t\tkey: \"each\",\n\t\tvalue: function each() {\n\t\t\treturn this._annotations.forEach.apply(this._annotations, arguments);\n\t\t}\n\n\t\t/**\n * Hook for injecting annotation into a view\n * @param {View} view\n * @private\n */\n\n\t}, {\n\t\tkey: \"inject\",\n\t\tvalue: function inject(view) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar sectionIndex = view.index;\n\t\t\tif (sectionIndex in this._annotationsBySectionIndex) {\n\t\t\t\tvar annotations = this._annotationsBySectionIndex[sectionIndex];\n\t\t\t\tannotations.forEach(function (hash) {\n\t\t\t\t\tvar annotation = _this2._annotations[hash];\n\t\t\t\t\tannotation.attach(view);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Hook for removing annotation from a view\n * @param {View} view\n * @private\n */\n\n\t}, {\n\t\tkey: \"clear\",\n\t\tvalue: function clear(view) {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar sectionIndex = view.index;\n\t\t\tif (sectionIndex in this._annotationsBySectionIndex) {\n\t\t\t\tvar annotations = this._annotationsBySectionIndex[sectionIndex];\n\t\t\t\tannotations.forEach(function (hash) {\n\t\t\t\t\tvar annotation = _this3._annotations[hash];\n\t\t\t\t\tannotation.detach(view);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * [Not Implemented] Show annotations\n * @TODO: needs implementation in View\n */\n\n\t}, {\n\t\tkey: \"show\",\n\t\tvalue: function show() {}\n\n\t\t/**\n * [Not Implemented] Hide annotations\n * @TODO: needs implementation in View\n */\n\n\t}, {\n\t\tkey: \"hide\",\n\t\tvalue: function hide() {}\n\t}]);\n\n\treturn Annotations;\n}();\n\n/**\n * Annotation object\n * @class\n * @param {object} options\n * @param {string} options.type Type of annotation to add: \"highlight\", \"underline\", \"mark\"\n * @param {EpubCFI} options.cfiRange EpubCFI range to attach annotation to\n * @param {object} options.data Data to assign to annotation\n * @param {int} options.sectionIndex Index in the Spine of the Section annotation belongs to\n * @param {function} [options.cb] Callback after annotation is clicked\n * @param {string} className CSS class to assign to annotation\n * @param {object} styles CSS styles to assign to annotation\n * @returns {Annotation} annotation\n */\n\n\nvar Annotation = function () {\n\tfunction Annotation(_ref) {\n\t\tvar type = _ref.type,\n\t\t cfiRange = _ref.cfiRange,\n\t\t data = _ref.data,\n\t\t sectionIndex = _ref.sectionIndex,\n\t\t cb = _ref.cb,\n\t\t className = _ref.className,\n\t\t styles = _ref.styles;\n\n\t\t_classCallCheck(this, Annotation);\n\n\t\tthis.type = type;\n\t\tthis.cfiRange = cfiRange;\n\t\tthis.data = data;\n\t\tthis.sectionIndex = sectionIndex;\n\t\tthis.mark = undefined;\n\t\tthis.cb = cb;\n\t\tthis.className = className;\n\t\tthis.styles = styles;\n\t}\n\n\t/**\n * Update stored data\n * @param {object} data\n */\n\n\n\t_createClass(Annotation, [{\n\t\tkey: \"update\",\n\t\tvalue: function update(data) {\n\t\t\tthis.data = data;\n\t\t}\n\n\t\t/**\n * Add to a view\n * @param {View} view\n */\n\n\t}, {\n\t\tkey: \"attach\",\n\t\tvalue: function attach(view) {\n\t\t\tvar cfiRange = this.cfiRange,\n\t\t\t data = this.data,\n\t\t\t type = this.type,\n\t\t\t mark = this.mark,\n\t\t\t cb = this.cb,\n\t\t\t className = this.className,\n\t\t\t styles = this.styles;\n\n\t\t\tvar result = void 0;\n\n\t\t\tif (type === \"highlight\") {\n\t\t\t\tresult = view.highlight(cfiRange, data, cb, className, styles);\n\t\t\t} else if (type === \"underline\") {\n\t\t\t\tresult = view.underline(cfiRange, data, cb, className, styles);\n\t\t\t} else if (type === \"mark\") {\n\t\t\t\tresult = view.mark(cfiRange, data, cb);\n\t\t\t}\n\n\t\t\tthis.mark = result;\n\t\t\tthis.emit(_constants.EVENTS.ANNOTATION.ATTACH, result);\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n * Remove from a view\n * @param {View} view\n */\n\n\t}, {\n\t\tkey: \"detach\",\n\t\tvalue: function detach(view) {\n\t\t\tvar cfiRange = this.cfiRange,\n\t\t\t type = this.type;\n\n\t\t\tvar result = void 0;\n\n\t\t\tif (view) {\n\t\t\t\tif (type === \"highlight\") {\n\t\t\t\t\tresult = view.unhighlight(cfiRange);\n\t\t\t\t} else if (type === \"underline\") {\n\t\t\t\t\tresult = view.ununderline(cfiRange);\n\t\t\t\t} else if (type === \"mark\") {\n\t\t\t\t\tresult = view.unmark(cfiRange);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.mark = undefined;\n\t\t\tthis.emit(_constants.EVENTS.ANNOTATION.DETACH, result);\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n * [Not Implemented] Get text of an annotation\n * @TODO: needs implementation in contents\n */\n\n\t}, {\n\t\tkey: \"text\",\n\t\tvalue: function text() {}\n\t}]);\n\n\treturn Annotation;\n}();\n\n(0, _eventEmitter2.default)(Annotation.prototype);\n\nexports.default = Annotations;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/annotations.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/archive.js": -/*!********************************************!*\ - !*** ./node_modules/epubjs/lib/archive.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _request = __webpack_require__(/*! ./utils/request */ \"./node_modules/epubjs/lib/utils/request.js\");\n\nvar _request2 = _interopRequireDefault(_request);\n\nvar _mime = __webpack_require__(/*! ../libs/mime/mime */ \"./node_modules/epubjs/libs/mime/mime.js\");\n\nvar _mime2 = _interopRequireDefault(_mime);\n\nvar _path = __webpack_require__(/*! ./utils/path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Handles Unzipping a requesting files from an Epub Archive\n * @class\n */\nvar Archive = function () {\n\tfunction Archive() {\n\t\t_classCallCheck(this, Archive);\n\n\t\tthis.zip = undefined;\n\t\tthis.urlCache = {};\n\n\t\tthis.checkRequirements();\n\t}\n\n\t/**\n * Checks to see if JSZip exists in global namspace,\n * Requires JSZip if it isn't there\n * @private\n */\n\n\n\t_createClass(Archive, [{\n\t\tkey: \"checkRequirements\",\n\t\tvalue: function checkRequirements() {\n\t\t\ttry {\n\t\t\t\tif (typeof JSZip === \"undefined\") {\n\t\t\t\t\tvar _JSZip = __webpack_require__(/*! jszip */ \"./node_modules/jszip/lib/index.js\");\n\t\t\t\t\tthis.zip = new _JSZip();\n\t\t\t\t} else {\n\t\t\t\t\tthis.zip = new JSZip();\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tthrow new Error(\"JSZip lib not loaded\");\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Open an archive\n * @param {binary} input\n * @param {boolean} [isBase64] tells JSZip if the input data is base64 encoded\n * @return {Promise} zipfile\n */\n\n\t}, {\n\t\tkey: \"open\",\n\t\tvalue: function open(input, isBase64) {\n\t\t\treturn this.zip.loadAsync(input, { \"base64\": isBase64 });\n\t\t}\n\n\t\t/**\n * Load and Open an archive\n * @param {string} zipUrl\n * @param {boolean} [isBase64] tells JSZip if the input data is base64 encoded\n * @return {Promise} zipfile\n */\n\n\t}, {\n\t\tkey: \"openUrl\",\n\t\tvalue: function openUrl(zipUrl, isBase64) {\n\t\t\treturn (0, _request2.default)(zipUrl, \"binary\").then(function (data) {\n\t\t\t\treturn this.zip.loadAsync(data, { \"base64\": isBase64 });\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Request a url from the archive\n * @param {string} url a url to request from the archive\n * @param {string} [type] specify the type of the returned result\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"request\",\n\t\tvalue: function request(url, type) {\n\t\t\tvar deferred = new _core.defer();\n\t\t\tvar response;\n\t\t\tvar path = new _path2.default(url);\n\n\t\t\t// If type isn't set, determine it from the file extension\n\t\t\tif (!type) {\n\t\t\t\ttype = path.extension;\n\t\t\t}\n\n\t\t\tif (type == \"blob\") {\n\t\t\t\tresponse = this.getBlob(url);\n\t\t\t} else {\n\t\t\t\tresponse = this.getText(url);\n\t\t\t}\n\n\t\t\tif (response) {\n\t\t\t\tresponse.then(function (r) {\n\t\t\t\t\tvar result = this.handleResponse(r, type);\n\t\t\t\t\tdeferred.resolve(result);\n\t\t\t\t}.bind(this));\n\t\t\t} else {\n\t\t\t\tdeferred.reject({\n\t\t\t\t\tmessage: \"File not found in the epub: \" + url,\n\t\t\t\t\tstack: new Error().stack\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn deferred.promise;\n\t\t}\n\n\t\t/**\n * Handle the response from request\n * @private\n * @param {any} response\n * @param {string} [type]\n * @return {any} the parsed result\n */\n\n\t}, {\n\t\tkey: \"handleResponse\",\n\t\tvalue: function handleResponse(response, type) {\n\t\t\tvar r;\n\n\t\t\tif (type == \"json\") {\n\t\t\t\tr = JSON.parse(response);\n\t\t\t} else if ((0, _core.isXml)(type)) {\n\t\t\t\tr = (0, _core.parse)(response, \"text/xml\");\n\t\t\t} else if (type == \"xhtml\") {\n\t\t\t\tr = (0, _core.parse)(response, \"application/xhtml+xml\");\n\t\t\t} else if (type == \"html\" || type == \"htm\") {\n\t\t\t\tr = (0, _core.parse)(response, \"text/html\");\n\t\t\t} else {\n\t\t\t\tr = response;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\t/**\n * Get a Blob from Archive by Url\n * @param {string} url\n * @param {string} [mimeType]\n * @return {Blob}\n */\n\n\t}, {\n\t\tkey: \"getBlob\",\n\t\tvalue: function getBlob(url, mimeType) {\n\t\t\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\t\t\tvar entry = this.zip.file(decodededUrl);\n\n\t\t\tif (entry) {\n\t\t\t\tmimeType = mimeType || _mime2.default.lookup(entry.name);\n\t\t\t\treturn entry.async(\"uint8array\").then(function (uint8array) {\n\t\t\t\t\treturn new Blob([uint8array], { type: mimeType });\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Get Text from Archive by Url\n * @param {string} url\n * @param {string} [encoding]\n * @return {string}\n */\n\n\t}, {\n\t\tkey: \"getText\",\n\t\tvalue: function getText(url, encoding) {\n\t\t\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\t\t\tvar entry = this.zip.file(decodededUrl);\n\n\t\t\tif (entry) {\n\t\t\t\treturn entry.async(\"string\").then(function (text) {\n\t\t\t\t\treturn text;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Get a base64 encoded result from Archive by Url\n * @param {string} url\n * @param {string} [mimeType]\n * @return {string} base64 encoded\n */\n\n\t}, {\n\t\tkey: \"getBase64\",\n\t\tvalue: function getBase64(url, mimeType) {\n\t\t\tvar decodededUrl = window.decodeURIComponent(url.substr(1)); // Remove first slash\n\t\t\tvar entry = this.zip.file(decodededUrl);\n\n\t\t\tif (entry) {\n\t\t\t\tmimeType = mimeType || _mime2.default.lookup(entry.name);\n\t\t\t\treturn entry.async(\"base64\").then(function (data) {\n\t\t\t\t\treturn \"data:\" + mimeType + \";base64,\" + data;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Create a Url from an unarchived item\n * @param {string} url\n * @param {object} [options.base64] use base64 encoding or blob url\n * @return {Promise} url promise with Url string\n */\n\n\t}, {\n\t\tkey: \"createUrl\",\n\t\tvalue: function createUrl(url, options) {\n\t\t\tvar deferred = new _core.defer();\n\t\t\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\t\t\tvar tempUrl;\n\t\t\tvar response;\n\t\t\tvar useBase64 = options && options.base64;\n\n\t\t\tif (url in this.urlCache) {\n\t\t\t\tdeferred.resolve(this.urlCache[url]);\n\t\t\t\treturn deferred.promise;\n\t\t\t}\n\n\t\t\tif (useBase64) {\n\t\t\t\tresponse = this.getBase64(url);\n\n\t\t\t\tif (response) {\n\t\t\t\t\tresponse.then(function (tempUrl) {\n\n\t\t\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\t\t\tdeferred.resolve(tempUrl);\n\t\t\t\t\t}.bind(this));\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\tresponse = this.getBlob(url);\n\n\t\t\t\tif (response) {\n\t\t\t\t\tresponse.then(function (blob) {\n\n\t\t\t\t\t\ttempUrl = _URL.createObjectURL(blob);\n\t\t\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\t\t\tdeferred.resolve(tempUrl);\n\t\t\t\t\t}.bind(this));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\tdeferred.reject({\n\t\t\t\t\tmessage: \"File not found in the epub: \" + url,\n\t\t\t\t\tstack: new Error().stack\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn deferred.promise;\n\t\t}\n\n\t\t/**\n * Revoke Temp Url for a achive item\n * @param {string} url url of the item in the archive\n */\n\n\t}, {\n\t\tkey: \"revokeUrl\",\n\t\tvalue: function revokeUrl(url) {\n\t\t\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\t\t\tvar fromCache = this.urlCache[url];\n\t\t\tif (fromCache) _URL.revokeObjectURL(fromCache);\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\t\t\tfor (var fromCache in this.urlCache) {\n\t\t\t\t_URL.revokeObjectURL(fromCache);\n\t\t\t}\n\t\t\tthis.zip = undefined;\n\t\t\tthis.urlCache = {};\n\t\t}\n\t}]);\n\n\treturn Archive;\n}();\n\nexports.default = Archive;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/archive.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/book.js": -/*!*****************************************!*\ - !*** ./node_modules/epubjs/lib/book.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _url = __webpack_require__(/*! ./utils/url */ \"./node_modules/epubjs/lib/utils/url.js\");\n\nvar _url2 = _interopRequireDefault(_url);\n\nvar _path = __webpack_require__(/*! ./utils/path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _spine = __webpack_require__(/*! ./spine */ \"./node_modules/epubjs/lib/spine.js\");\n\nvar _spine2 = _interopRequireDefault(_spine);\n\nvar _locations = __webpack_require__(/*! ./locations */ \"./node_modules/epubjs/lib/locations.js\");\n\nvar _locations2 = _interopRequireDefault(_locations);\n\nvar _container = __webpack_require__(/*! ./container */ \"./node_modules/epubjs/lib/container.js\");\n\nvar _container2 = _interopRequireDefault(_container);\n\nvar _packaging = __webpack_require__(/*! ./packaging */ \"./node_modules/epubjs/lib/packaging.js\");\n\nvar _packaging2 = _interopRequireDefault(_packaging);\n\nvar _navigation = __webpack_require__(/*! ./navigation */ \"./node_modules/epubjs/lib/navigation.js\");\n\nvar _navigation2 = _interopRequireDefault(_navigation);\n\nvar _resources = __webpack_require__(/*! ./resources */ \"./node_modules/epubjs/lib/resources.js\");\n\nvar _resources2 = _interopRequireDefault(_resources);\n\nvar _pagelist = __webpack_require__(/*! ./pagelist */ \"./node_modules/epubjs/lib/pagelist.js\");\n\nvar _pagelist2 = _interopRequireDefault(_pagelist);\n\nvar _rendition = __webpack_require__(/*! ./rendition */ \"./node_modules/epubjs/lib/rendition.js\");\n\nvar _rendition2 = _interopRequireDefault(_rendition);\n\nvar _archive = __webpack_require__(/*! ./archive */ \"./node_modules/epubjs/lib/archive.js\");\n\nvar _archive2 = _interopRequireDefault(_archive);\n\nvar _request2 = __webpack_require__(/*! ./utils/request */ \"./node_modules/epubjs/lib/utils/request.js\");\n\nvar _request3 = _interopRequireDefault(_request2);\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _store = __webpack_require__(/*! ./store */ \"./node_modules/epubjs/lib/store.js\");\n\nvar _store2 = _interopRequireDefault(_store);\n\nvar _displayoptions = __webpack_require__(/*! ./displayoptions */ \"./node_modules/epubjs/lib/displayoptions.js\");\n\nvar _displayoptions2 = _interopRequireDefault(_displayoptions);\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar CONTAINER_PATH = \"META-INF/container.xml\";\nvar IBOOKS_DISPLAY_OPTIONS_PATH = \"META-INF/com.apple.ibooks.display-options.xml\";\n\nvar INPUT_TYPE = {\n\tBINARY: \"binary\",\n\tBASE64: \"base64\",\n\tEPUB: \"epub\",\n\tOPF: \"opf\",\n\tMANIFEST: \"json\",\n\tDIRECTORY: \"directory\"\n};\n\n/**\n * An Epub representation with methods for the loading, parsing and manipulation\n * of its contents.\n * @class\n * @param {string} [url]\n * @param {object} [options]\n * @param {method} [options.requestMethod] a request function to use instead of the default\n * @param {boolean} [options.requestCredentials=undefined] send the xhr request withCredentials\n * @param {object} [options.requestHeaders=undefined] send the xhr request headers\n * @param {string} [options.encoding=binary] optional to pass 'binary' or base64' for archived Epubs\n * @param {string} [options.replacements=none] use base64, blobUrl, or none for replacing assets in archived Epubs\n * @param {method} [options.canonical] optional function to determine canonical urls for a path\n * @param {string} [options.openAs] optional string to determine the input type\n * @param {string} [options.store=false] cache the contents in local storage, value should be the name of the reader\n * @returns {Book}\n * @example new Book(\"/path/to/book.epub\", {})\n * @example new Book({ replacements: \"blobUrl\" })\n */\n\nvar Book = function () {\n\tfunction Book(url, options) {\n\t\tvar _this = this;\n\n\t\t_classCallCheck(this, Book);\n\n\t\t// Allow passing just options to the Book\n\t\tif (typeof options === \"undefined\" && typeof url !== \"string\" && url instanceof Blob === false) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\tthis.settings = (0, _core.extend)(this.settings || {}, {\n\t\t\trequestMethod: undefined,\n\t\t\trequestCredentials: undefined,\n\t\t\trequestHeaders: undefined,\n\t\t\tencoding: undefined,\n\t\t\treplacements: undefined,\n\t\t\tcanonical: undefined,\n\t\t\topenAs: undefined,\n\t\t\tstore: undefined\n\t\t});\n\n\t\t(0, _core.extend)(this.settings, options);\n\n\t\t// Promises\n\t\tthis.opening = new _core.defer();\n\t\t/**\n * @member {promise} opened returns after the book is loaded\n * @memberof Book\n */\n\t\tthis.opened = this.opening.promise;\n\t\tthis.isOpen = false;\n\n\t\tthis.loading = {\n\t\t\tmanifest: new _core.defer(),\n\t\t\tspine: new _core.defer(),\n\t\t\tmetadata: new _core.defer(),\n\t\t\tcover: new _core.defer(),\n\t\t\tnavigation: new _core.defer(),\n\t\t\tpageList: new _core.defer(),\n\t\t\tresources: new _core.defer(),\n\t\t\tdisplayOptions: new _core.defer()\n\t\t};\n\n\t\tthis.loaded = {\n\t\t\tmanifest: this.loading.manifest.promise,\n\t\t\tspine: this.loading.spine.promise,\n\t\t\tmetadata: this.loading.metadata.promise,\n\t\t\tcover: this.loading.cover.promise,\n\t\t\tnavigation: this.loading.navigation.promise,\n\t\t\tpageList: this.loading.pageList.promise,\n\t\t\tresources: this.loading.resources.promise,\n\t\t\tdisplayOptions: this.loading.displayOptions.promise\n\t\t};\n\n\t\t/**\n * @member {promise} ready returns after the book is loaded and parsed\n * @memberof Book\n * @private\n */\n\t\tthis.ready = Promise.all([this.loaded.manifest, this.loaded.spine, this.loaded.metadata, this.loaded.cover, this.loaded.navigation, this.loaded.resources, this.loaded.displayOptions]);\n\n\t\t// Queue for methods used before opening\n\t\tthis.isRendered = false;\n\t\t// this._q = queue(this);\n\n\t\t/**\n * @member {method} request\n * @memberof Book\n * @private\n */\n\t\tthis.request = this.settings.requestMethod || _request3.default;\n\n\t\t/**\n * @member {Spine} spine\n * @memberof Book\n */\n\t\tthis.spine = new _spine2.default();\n\n\t\t/**\n * @member {Locations} locations\n * @memberof Book\n */\n\t\tthis.locations = new _locations2.default(this.spine, this.load.bind(this));\n\n\t\t/**\n * @member {Navigation} navigation\n * @memberof Book\n */\n\t\tthis.navigation = undefined;\n\n\t\t/**\n * @member {PageList} pagelist\n * @memberof Book\n */\n\t\tthis.pageList = undefined;\n\n\t\t/**\n * @member {Url} url\n * @memberof Book\n * @private\n */\n\t\tthis.url = undefined;\n\n\t\t/**\n * @member {Path} path\n * @memberof Book\n * @private\n */\n\t\tthis.path = undefined;\n\n\t\t/**\n * @member {boolean} archived\n * @memberof Book\n * @private\n */\n\t\tthis.archived = false;\n\n\t\t/**\n * @member {Archive} archive\n * @memberof Book\n * @private\n */\n\t\tthis.archive = undefined;\n\n\t\t/**\n * @member {Store} storage\n * @memberof Book\n * @private\n */\n\t\tthis.storage = undefined;\n\n\t\t/**\n * @member {Resources} resources\n * @memberof Book\n * @private\n */\n\t\tthis.resources = undefined;\n\n\t\t/**\n * @member {Rendition} rendition\n * @memberof Book\n * @private\n */\n\t\tthis.rendition = undefined;\n\n\t\t/**\n * @member {Container} container\n * @memberof Book\n * @private\n */\n\t\tthis.container = undefined;\n\n\t\t/**\n * @member {Packaging} packaging\n * @memberof Book\n * @private\n */\n\t\tthis.packaging = undefined;\n\n\t\t/**\n * @member {DisplayOptions} displayOptions\n * @memberof DisplayOptions\n * @private\n */\n\t\tthis.displayOptions = undefined;\n\n\t\t// this.toc = undefined;\n\t\tif (this.settings.store) {\n\t\t\tthis.store(this.settings.store);\n\t\t}\n\n\t\tif (url) {\n\t\t\tthis.open(url, this.settings.openAs).catch(function (error) {\n\t\t\t\tvar err = new Error(\"Cannot load book at \" + url);\n\t\t\t\t_this.emit(_constants.EVENTS.BOOK.OPEN_FAILED, err);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n * Open a epub or url\n * @param {string | ArrayBuffer} input Url, Path or ArrayBuffer\n * @param {string} [what=\"binary\", \"base64\", \"epub\", \"opf\", \"json\", \"directory\"] force opening as a certain type\n * @returns {Promise} of when the book has been loaded\n * @example book.open(\"/path/to/book.epub\")\n */\n\n\n\t_createClass(Book, [{\n\t\tkey: \"open\",\n\t\tvalue: function open(input, what) {\n\t\t\tvar opening;\n\t\t\tvar type = what || this.determineType(input);\n\n\t\t\tif (type === INPUT_TYPE.BINARY) {\n\t\t\t\tthis.archived = true;\n\t\t\t\tthis.url = new _url2.default(\"/\", \"\");\n\t\t\t\topening = this.openEpub(input);\n\t\t\t} else if (type === INPUT_TYPE.BASE64) {\n\t\t\t\tthis.archived = true;\n\t\t\t\tthis.url = new _url2.default(\"/\", \"\");\n\t\t\t\topening = this.openEpub(input, type);\n\t\t\t} else if (type === INPUT_TYPE.EPUB) {\n\t\t\t\tthis.archived = true;\n\t\t\t\tthis.url = new _url2.default(\"/\", \"\");\n\t\t\t\topening = this.request(input, \"binary\", this.settings.requestCredentials).then(this.openEpub.bind(this));\n\t\t\t} else if (type == INPUT_TYPE.OPF) {\n\t\t\t\tthis.url = new _url2.default(input);\n\t\t\t\topening = this.openPackaging(this.url.Path.toString());\n\t\t\t} else if (type == INPUT_TYPE.MANIFEST) {\n\t\t\t\tthis.url = new _url2.default(input);\n\t\t\t\topening = this.openManifest(this.url.Path.toString());\n\t\t\t} else {\n\t\t\t\tthis.url = new _url2.default(input);\n\t\t\t\topening = this.openContainer(CONTAINER_PATH).then(this.openPackaging.bind(this));\n\t\t\t}\n\n\t\t\treturn opening;\n\t\t}\n\n\t\t/**\n * Open an archived epub\n * @private\n * @param {binary} data\n * @param {string} [encoding]\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"openEpub\",\n\t\tvalue: function openEpub(data, encoding) {\n\t\t\tvar _this2 = this;\n\n\t\t\treturn this.unarchive(data, encoding || this.settings.encoding).then(function () {\n\t\t\t\treturn _this2.openContainer(CONTAINER_PATH);\n\t\t\t}).then(function (packagePath) {\n\t\t\t\treturn _this2.openPackaging(packagePath);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Open the epub container\n * @private\n * @param {string} url\n * @return {string} packagePath\n */\n\n\t}, {\n\t\tkey: \"openContainer\",\n\t\tvalue: function openContainer(url) {\n\t\t\tvar _this3 = this;\n\n\t\t\treturn this.load(url).then(function (xml) {\n\t\t\t\t_this3.container = new _container2.default(xml);\n\t\t\t\treturn _this3.resolve(_this3.container.packagePath);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Open the Open Packaging Format Xml\n * @private\n * @param {string} url\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"openPackaging\",\n\t\tvalue: function openPackaging(url) {\n\t\t\tvar _this4 = this;\n\n\t\t\tthis.path = new _path2.default(url);\n\t\t\treturn this.load(url).then(function (xml) {\n\t\t\t\t_this4.packaging = new _packaging2.default(xml);\n\t\t\t\treturn _this4.unpack(_this4.packaging);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Open the manifest JSON\n * @private\n * @param {string} url\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"openManifest\",\n\t\tvalue: function openManifest(url) {\n\t\t\tvar _this5 = this;\n\n\t\t\tthis.path = new _path2.default(url);\n\t\t\treturn this.load(url).then(function (json) {\n\t\t\t\t_this5.packaging = new _packaging2.default();\n\t\t\t\t_this5.packaging.load(json);\n\t\t\t\treturn _this5.unpack(_this5.packaging);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Load a resource from the Book\n * @param {string} path path to the resource to load\n * @return {Promise} returns a promise with the requested resource\n */\n\n\t}, {\n\t\tkey: \"load\",\n\t\tvalue: function load(path) {\n\t\t\tvar resolved = this.resolve(path);\n\t\t\tif (this.archived) {\n\t\t\t\treturn this.archive.request(resolved);\n\t\t\t} else {\n\t\t\t\treturn this.request(resolved, null, this.settings.requestCredentials, this.settings.requestHeaders);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Resolve a path to it's absolute position in the Book\n * @param {string} path\n * @param {boolean} [absolute] force resolving the full URL\n * @return {string} the resolved path string\n */\n\n\t}, {\n\t\tkey: \"resolve\",\n\t\tvalue: function resolve(path, absolute) {\n\t\t\tif (!path) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar resolved = path;\n\t\t\tvar isAbsolute = path.indexOf(\"://\") > -1;\n\n\t\t\tif (isAbsolute) {\n\t\t\t\treturn path;\n\t\t\t}\n\n\t\t\tif (this.path) {\n\t\t\t\tresolved = this.path.resolve(path);\n\t\t\t}\n\n\t\t\tif (absolute != false && this.url) {\n\t\t\t\tresolved = this.url.resolve(resolved);\n\t\t\t}\n\n\t\t\treturn resolved;\n\t\t}\n\n\t\t/**\n * Get a canonical link to a path\n * @param {string} path\n * @return {string} the canonical path string\n */\n\n\t}, {\n\t\tkey: \"canonical\",\n\t\tvalue: function canonical(path) {\n\t\t\tvar url = path;\n\n\t\t\tif (!path) {\n\t\t\t\treturn \"\";\n\t\t\t}\n\n\t\t\tif (this.settings.canonical) {\n\t\t\t\turl = this.settings.canonical(path);\n\t\t\t} else {\n\t\t\t\turl = this.resolve(path, true);\n\t\t\t}\n\n\t\t\treturn url;\n\t\t}\n\n\t\t/**\n * Determine the type of they input passed to open\n * @private\n * @param {string} input\n * @return {string} binary | directory | epub | opf\n */\n\n\t}, {\n\t\tkey: \"determineType\",\n\t\tvalue: function determineType(input) {\n\t\t\tvar url;\n\t\t\tvar path;\n\t\t\tvar extension;\n\n\t\t\tif (this.settings.encoding === \"base64\") {\n\t\t\t\treturn INPUT_TYPE.BASE64;\n\t\t\t}\n\n\t\t\tif (typeof input != \"string\") {\n\t\t\t\treturn INPUT_TYPE.BINARY;\n\t\t\t}\n\n\t\t\turl = new _url2.default(input);\n\t\t\tpath = url.path();\n\t\t\textension = path.extension;\n\n\t\t\tif (!extension) {\n\t\t\t\treturn INPUT_TYPE.DIRECTORY;\n\t\t\t}\n\n\t\t\tif (extension === \"epub\") {\n\t\t\t\treturn INPUT_TYPE.EPUB;\n\t\t\t}\n\n\t\t\tif (extension === \"opf\") {\n\t\t\t\treturn INPUT_TYPE.OPF;\n\t\t\t}\n\n\t\t\tif (extension === \"json\") {\n\t\t\t\treturn INPUT_TYPE.MANIFEST;\n\t\t\t}\n\t\t}\n\n\t\t/**\n * unpack the contents of the Books packaging\n * @private\n * @param {Packaging} packaging object\n */\n\n\t}, {\n\t\tkey: \"unpack\",\n\t\tvalue: function unpack(packaging) {\n\t\t\tvar _this6 = this;\n\n\t\t\tthis.package = packaging; //TODO: deprecated this\n\n\t\t\tif (this.packaging.metadata.layout === \"\") {\n\t\t\t\t// rendition:layout not set - check display options if book is pre-paginated\n\t\t\t\tthis.load(this.url.resolve(IBOOKS_DISPLAY_OPTIONS_PATH)).then(function (xml) {\n\t\t\t\t\t_this6.displayOptions = new _displayoptions2.default(xml);\n\t\t\t\t\t_this6.loading.displayOptions.resolve(_this6.displayOptions);\n\t\t\t\t}).catch(function (err) {\n\t\t\t\t\t_this6.displayOptions = new _displayoptions2.default();\n\t\t\t\t\t_this6.loading.displayOptions.resolve(_this6.displayOptions);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.displayOptions = new _displayoptions2.default();\n\t\t\t\tthis.loading.displayOptions.resolve(this.displayOptions);\n\t\t\t}\n\n\t\t\tthis.spine.unpack(this.packaging, this.resolve.bind(this), this.canonical.bind(this));\n\n\t\t\tthis.resources = new _resources2.default(this.packaging.manifest, {\n\t\t\t\tarchive: this.archive,\n\t\t\t\tresolver: this.resolve.bind(this),\n\t\t\t\trequest: this.request.bind(this),\n\t\t\t\treplacements: this.settings.replacements || (this.archived ? \"blobUrl\" : \"base64\")\n\t\t\t});\n\n\t\t\tthis.loadNavigation(this.packaging).then(function () {\n\t\t\t\t// this.toc = this.navigation.toc;\n\t\t\t\t_this6.loading.navigation.resolve(_this6.navigation);\n\t\t\t});\n\n\t\t\tif (this.packaging.coverPath) {\n\t\t\t\tthis.cover = this.resolve(this.packaging.coverPath);\n\t\t\t}\n\t\t\t// Resolve promises\n\t\t\tthis.loading.manifest.resolve(this.packaging.manifest);\n\t\t\tthis.loading.metadata.resolve(this.packaging.metadata);\n\t\t\tthis.loading.spine.resolve(this.spine);\n\t\t\tthis.loading.cover.resolve(this.cover);\n\t\t\tthis.loading.resources.resolve(this.resources);\n\t\t\tthis.loading.pageList.resolve(this.pageList);\n\n\t\t\tthis.isOpen = true;\n\n\t\t\tif (this.archived || this.settings.replacements && this.settings.replacements != \"none\") {\n\t\t\t\tthis.replacements().then(function () {\n\t\t\t\t\t_this6.loaded.displayOptions.then(function () {\n\t\t\t\t\t\t_this6.opening.resolve(_this6);\n\t\t\t\t\t});\n\t\t\t\t}).catch(function (err) {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Resolve book opened promise\n\t\t\t\tthis.loaded.displayOptions.then(function () {\n\t\t\t\t\t_this6.opening.resolve(_this6);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Load Navigation and PageList from package\n * @private\n * @param {Packaging} packaging\n */\n\n\t}, {\n\t\tkey: \"loadNavigation\",\n\t\tvalue: function loadNavigation(packaging) {\n\t\t\tvar _this7 = this;\n\n\t\t\tvar navPath = packaging.navPath || packaging.ncxPath;\n\t\t\tvar toc = packaging.toc;\n\n\t\t\t// From json manifest\n\t\t\tif (toc) {\n\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\t_this7.navigation = new _navigation2.default(toc);\n\n\t\t\t\t\tif (packaging.pageList) {\n\t\t\t\t\t\t_this7.pageList = new _pagelist2.default(packaging.pageList); // TODO: handle page lists from Manifest\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve(_this7.navigation);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (!navPath) {\n\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\t_this7.navigation = new _navigation2.default();\n\t\t\t\t\t_this7.pageList = new _pagelist2.default();\n\n\t\t\t\t\tresolve(_this7.navigation);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn this.load(navPath, \"xml\").then(function (xml) {\n\t\t\t\t_this7.navigation = new _navigation2.default(xml);\n\t\t\t\t_this7.pageList = new _pagelist2.default(xml);\n\t\t\t\treturn _this7.navigation;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Gets a Section of the Book from the Spine\n * Alias for `book.spine.get`\n * @param {string} target\n * @return {Section}\n */\n\n\t}, {\n\t\tkey: \"section\",\n\t\tvalue: function section(target) {\n\t\t\treturn this.spine.get(target);\n\t\t}\n\n\t\t/**\n * Sugar to render a book to an element\n * @param {element | string} element element or string to add a rendition to\n * @param {object} [options]\n * @return {Rendition}\n */\n\n\t}, {\n\t\tkey: \"renderTo\",\n\t\tvalue: function renderTo(element, options) {\n\t\t\tthis.rendition = new _rendition2.default(this, options);\n\t\t\tthis.rendition.attachTo(element);\n\n\t\t\treturn this.rendition;\n\t\t}\n\n\t\t/**\n * Set if request should use withCredentials\n * @param {boolean} credentials\n */\n\n\t}, {\n\t\tkey: \"setRequestCredentials\",\n\t\tvalue: function setRequestCredentials(credentials) {\n\t\t\tthis.settings.requestCredentials = credentials;\n\t\t}\n\n\t\t/**\n * Set headers request should use\n * @param {object} headers\n */\n\n\t}, {\n\t\tkey: \"setRequestHeaders\",\n\t\tvalue: function setRequestHeaders(headers) {\n\t\t\tthis.settings.requestHeaders = headers;\n\t\t}\n\n\t\t/**\n * Unarchive a zipped epub\n * @private\n * @param {binary} input epub data\n * @param {string} [encoding]\n * @return {Archive}\n */\n\n\t}, {\n\t\tkey: \"unarchive\",\n\t\tvalue: function unarchive(input, encoding) {\n\t\t\tthis.archive = new _archive2.default();\n\t\t\treturn this.archive.open(input, encoding);\n\t\t}\n\n\t\t/**\n * Store the epubs contents\n * @private\n * @param {binary} input epub data\n * @param {string} [encoding]\n * @return {Store}\n */\n\n\t}, {\n\t\tkey: \"store\",\n\t\tvalue: function store(name) {\n\t\t\tvar _this8 = this;\n\n\t\t\t// Use \"blobUrl\" or \"base64\" for replacements\n\t\t\tvar replacementsSetting = this.settings.replacements && this.settings.replacements !== \"none\";\n\t\t\t// Save original url\n\t\t\tvar originalUrl = this.url;\n\t\t\t// Save original request method\n\t\t\tvar requester = this.settings.requestMethod || _request3.default.bind(this);\n\t\t\t// Create new Store\n\t\t\tthis.storage = new _store2.default(name, requester, this.resolve.bind(this));\n\t\t\t// Replace request method to go through store\n\t\t\tthis.request = this.storage.request.bind(this.storage);\n\n\t\t\tthis.opened.then(function () {\n\t\t\t\tif (_this8.archived) {\n\t\t\t\t\t_this8.storage.requester = _this8.archive.request.bind(_this8.archive);\n\t\t\t\t}\n\t\t\t\t// Substitute hook\n\t\t\t\tvar substituteResources = function substituteResources(output, section) {\n\t\t\t\t\tsection.output = _this8.resources.substitute(output, section.url);\n\t\t\t\t};\n\n\t\t\t\t// Set to use replacements\n\t\t\t\t_this8.resources.settings.replacements = replacementsSetting || \"blobUrl\";\n\t\t\t\t// Create replacement urls\n\t\t\t\t_this8.resources.replacements().then(function () {\n\t\t\t\t\treturn _this8.resources.replaceCss();\n\t\t\t\t});\n\n\t\t\t\t_this8.storage.on(\"offline\", function () {\n\t\t\t\t\t// Remove url to use relative resolving for hrefs\n\t\t\t\t\t_this8.url = new _url2.default(\"/\", \"\");\n\t\t\t\t\t// Add hook to replace resources in contents\n\t\t\t\t\t_this8.spine.hooks.serialize.register(substituteResources);\n\t\t\t\t});\n\n\t\t\t\t_this8.storage.on(\"online\", function () {\n\t\t\t\t\t// Restore original url\n\t\t\t\t\t_this8.url = originalUrl;\n\t\t\t\t\t// Remove hook\n\t\t\t\t\t_this8.spine.hooks.serialize.deregister(substituteResources);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn this.storage;\n\t\t}\n\n\t\t/**\n * Get the cover url\n * @return {string} coverUrl\n */\n\n\t}, {\n\t\tkey: \"coverUrl\",\n\t\tvalue: function coverUrl() {\n\t\t\tvar _this9 = this;\n\n\t\t\tvar retrieved = this.loaded.cover.then(function (url) {\n\t\t\t\tif (_this9.archived) {\n\t\t\t\t\t// return this.archive.createUrl(this.cover);\n\t\t\t\t\treturn _this9.resources.get(_this9.cover);\n\t\t\t\t} else {\n\t\t\t\t\treturn _this9.cover;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn retrieved;\n\t\t}\n\n\t\t/**\n * Load replacement urls\n * @private\n * @return {Promise} completed loading urls\n */\n\n\t}, {\n\t\tkey: \"replacements\",\n\t\tvalue: function replacements() {\n\t\t\tvar _this10 = this;\n\n\t\t\tthis.spine.hooks.serialize.register(function (output, section) {\n\t\t\t\tsection.output = _this10.resources.substitute(output, section.url);\n\t\t\t});\n\n\t\t\treturn this.resources.replacements().then(function () {\n\t\t\t\treturn _this10.resources.replaceCss();\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Find a DOM Range for a given CFI Range\n * @param {EpubCFI} cfiRange a epub cfi range\n * @return {Range}\n */\n\n\t}, {\n\t\tkey: \"getRange\",\n\t\tvalue: function getRange(cfiRange) {\n\t\t\tvar cfi = new _epubcfi2.default(cfiRange);\n\t\t\tvar item = this.spine.get(cfi.spinePos);\n\t\t\tvar _request = this.load.bind(this);\n\t\t\tif (!item) {\n\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\treject(\"CFI could not be found\");\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn item.load(_request).then(function (contents) {\n\t\t\t\tvar range = cfi.toRange(item.document);\n\t\t\t\treturn range;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Generates the Book Key using the identifer in the manifest or other string provided\n * @param {string} [identifier] to use instead of metadata identifier\n * @return {string} key\n */\n\n\t}, {\n\t\tkey: \"key\",\n\t\tvalue: function key(identifier) {\n\t\t\tvar ident = identifier || this.packaging.metadata.identifier || this.url.filename;\n\t\t\treturn \"epubjs:\" + _constants.EPUBJS_VERSION + \":\" + ident;\n\t\t}\n\n\t\t/**\n * Destroy the Book and all associated objects\n */\n\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.opened = undefined;\n\t\t\tthis.loading = undefined;\n\t\t\tthis.loaded = undefined;\n\t\t\tthis.ready = undefined;\n\n\t\t\tthis.isOpen = false;\n\t\t\tthis.isRendered = false;\n\n\t\t\tthis.spine && this.spine.destroy();\n\t\t\tthis.locations && this.locations.destroy();\n\t\t\tthis.pageList && this.pageList.destroy();\n\t\t\tthis.archive && this.archive.destroy();\n\t\t\tthis.resources && this.resources.destroy();\n\t\t\tthis.container && this.container.destroy();\n\t\t\tthis.packaging && this.packaging.destroy();\n\t\t\tthis.rendition && this.rendition.destroy();\n\t\t\tthis.displayOptions && this.displayOptions.destroy();\n\n\t\t\tthis.spine = undefined;\n\t\t\tthis.locations = undefined;\n\t\t\tthis.pageList = undefined;\n\t\t\tthis.archive = undefined;\n\t\t\tthis.resources = undefined;\n\t\t\tthis.container = undefined;\n\t\t\tthis.packaging = undefined;\n\t\t\tthis.rendition = undefined;\n\n\t\t\tthis.navigation = undefined;\n\t\t\tthis.url = undefined;\n\t\t\tthis.path = undefined;\n\t\t\tthis.archived = false;\n\t\t}\n\t}]);\n\n\treturn Book;\n}();\n\n//-- Enable binding events to book\n\n\n(0, _eventEmitter2.default)(Book.prototype);\n\nexports.default = Book;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/book.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/container.js": -/*!**********************************************!*\ - !*** ./node_modules/epubjs/lib/container.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _pathWebpack = __webpack_require__(/*! path-webpack */ \"./node_modules/path-webpack/path.js\");\n\nvar _pathWebpack2 = _interopRequireDefault(_pathWebpack);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Handles Parsing and Accessing an Epub Container\n * @class\n * @param {document} [containerDocument] xml document\n */\nvar Container = function () {\n\tfunction Container(containerDocument) {\n\t\t_classCallCheck(this, Container);\n\n\t\tthis.packagePath = '';\n\t\tthis.directory = '';\n\t\tthis.encoding = '';\n\n\t\tif (containerDocument) {\n\t\t\tthis.parse(containerDocument);\n\t\t}\n\t}\n\n\t/**\n * Parse the Container XML\n * @param {document} containerDocument\n */\n\n\n\t_createClass(Container, [{\n\t\tkey: \"parse\",\n\t\tvalue: function parse(containerDocument) {\n\t\t\t//-- \n\t\t\tvar rootfile;\n\n\t\t\tif (!containerDocument) {\n\t\t\t\tthrow new Error(\"Container File Not Found\");\n\t\t\t}\n\n\t\t\trootfile = (0, _core.qs)(containerDocument, \"rootfile\");\n\n\t\t\tif (!rootfile) {\n\t\t\t\tthrow new Error(\"No RootFile Found\");\n\t\t\t}\n\n\t\t\tthis.packagePath = rootfile.getAttribute(\"full-path\");\n\t\t\tthis.directory = _pathWebpack2.default.dirname(this.packagePath);\n\t\t\tthis.encoding = containerDocument.xmlEncoding;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.packagePath = undefined;\n\t\t\tthis.directory = undefined;\n\t\t\tthis.encoding = undefined;\n\t\t}\n\t}]);\n\n\treturn Container;\n}();\n\nexports.default = Container;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/container.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/contents.js": -/*!*********************************************!*\ - !*** ./node_modules/epubjs/lib/contents.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _mapping = __webpack_require__(/*! ./mapping */ \"./node_modules/epubjs/lib/mapping.js\");\n\nvar _mapping2 = _interopRequireDefault(_mapping);\n\nvar _replacements = __webpack_require__(/*! ./utils/replacements */ \"./node_modules/epubjs/lib/utils/replacements.js\");\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar hasNavigator = typeof navigator !== \"undefined\";\n\nvar isChrome = hasNavigator && /Chrome/.test(navigator.userAgent);\nvar isWebkit = hasNavigator && !isChrome && /AppleWebKit/.test(navigator.userAgent);\n\nvar ELEMENT_NODE = 1;\nvar TEXT_NODE = 3;\n\n/**\n\t* Handles DOM manipulation, queries and events for View contents\n\t* @class\n\t* @param {document} doc Document\n\t* @param {element} content Parent Element (typically Body)\n\t* @param {string} cfiBase Section component of CFIs\n\t* @param {number} sectionIndex Index in Spine of Conntent's Section\n\t*/\n\nvar Contents = function () {\n\tfunction Contents(doc, content, cfiBase, sectionIndex) {\n\t\t_classCallCheck(this, Contents);\n\n\t\t// Blank Cfi for Parsing\n\t\tthis.epubcfi = new _epubcfi2.default();\n\n\t\tthis.document = doc;\n\t\tthis.documentElement = this.document.documentElement;\n\t\tthis.content = content || this.document.body;\n\t\tthis.window = this.document.defaultView;\n\n\t\tthis._size = {\n\t\t\twidth: 0,\n\t\t\theight: 0\n\t\t};\n\n\t\tthis.sectionIndex = sectionIndex || 0;\n\t\tthis.cfiBase = cfiBase || \"\";\n\n\t\tthis.epubReadingSystem(\"epub.js\", _constants.EPUBJS_VERSION);\n\n\t\tthis.listeners();\n\t}\n\n\t/**\n \t* Get DOM events that are listened for and passed along\n \t*/\n\n\n\t_createClass(Contents, [{\n\t\tkey: \"width\",\n\n\n\t\t/**\n \t* Get or Set width\n \t* @param {number} [w]\n \t* @returns {number} width\n \t*/\n\t\tvalue: function width(w) {\n\t\t\t// var frame = this.documentElement;\n\t\t\tvar frame = this.content;\n\n\t\t\tif (w && (0, _core.isNumber)(w)) {\n\t\t\t\tw = w + \"px\";\n\t\t\t}\n\n\t\t\tif (w) {\n\t\t\t\tframe.style.width = w;\n\t\t\t\t// this.content.style.width = w;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(frame)[\"width\"];\n\t\t}\n\n\t\t/**\n \t* Get or Set height\n \t* @param {number} [h]\n \t* @returns {number} height\n \t*/\n\n\t}, {\n\t\tkey: \"height\",\n\t\tvalue: function height(h) {\n\t\t\t// var frame = this.documentElement;\n\t\t\tvar frame = this.content;\n\n\t\t\tif (h && (0, _core.isNumber)(h)) {\n\t\t\t\th = h + \"px\";\n\t\t\t}\n\n\t\t\tif (h) {\n\t\t\t\tframe.style.height = h;\n\t\t\t\t// this.content.style.height = h;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(frame)[\"height\"];\n\t\t}\n\n\t\t/**\n \t* Get or Set width of the contents\n \t* @param {number} [w]\n \t* @returns {number} width\n \t*/\n\n\t}, {\n\t\tkey: \"contentWidth\",\n\t\tvalue: function contentWidth(w) {\n\n\t\t\tvar content = this.content || this.document.body;\n\n\t\t\tif (w && (0, _core.isNumber)(w)) {\n\t\t\t\tw = w + \"px\";\n\t\t\t}\n\n\t\t\tif (w) {\n\t\t\t\tcontent.style.width = w;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(content)[\"width\"];\n\t\t}\n\n\t\t/**\n \t* Get or Set height of the contents\n \t* @param {number} [h]\n \t* @returns {number} height\n \t*/\n\n\t}, {\n\t\tkey: \"contentHeight\",\n\t\tvalue: function contentHeight(h) {\n\n\t\t\tvar content = this.content || this.document.body;\n\n\t\t\tif (h && (0, _core.isNumber)(h)) {\n\t\t\t\th = h + \"px\";\n\t\t\t}\n\n\t\t\tif (h) {\n\t\t\t\tcontent.style.height = h;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(content)[\"height\"];\n\t\t}\n\n\t\t/**\n \t* Get the width of the text using Range\n \t* @returns {number} width\n \t*/\n\n\t}, {\n\t\tkey: \"textWidth\",\n\t\tvalue: function textWidth() {\n\t\t\tvar rect = void 0;\n\t\t\tvar width = void 0;\n\t\t\tvar range = this.document.createRange();\n\t\t\tvar content = this.content || this.document.body;\n\t\t\tvar border = (0, _core.borders)(content);\n\n\t\t\t// Select the contents of frame\n\t\t\trange.selectNodeContents(content);\n\n\t\t\t// get the width of the text content\n\t\t\trect = range.getBoundingClientRect();\n\t\t\twidth = rect.width;\n\n\t\t\tif (border && border.width) {\n\t\t\t\twidth += border.width;\n\t\t\t}\n\n\t\t\treturn Math.round(width);\n\t\t}\n\n\t\t/**\n \t* Get the height of the text using Range\n \t* @returns {number} height\n \t*/\n\n\t}, {\n\t\tkey: \"textHeight\",\n\t\tvalue: function textHeight() {\n\t\t\tvar rect = void 0;\n\t\t\tvar height = void 0;\n\t\t\tvar range = this.document.createRange();\n\t\t\tvar content = this.content || this.document.body;\n\t\t\tvar border = (0, _core.borders)(content);\n\n\t\t\trange.selectNodeContents(content);\n\n\t\t\trect = range.getBoundingClientRect();\n\t\t\theight = rect.height;\n\n\t\t\tif (height && border.height) {\n\t\t\t\theight += border.height;\n\t\t\t}\n\n\t\t\tif (height && rect.top) {\n\t\t\t\theight += rect.top;\n\t\t\t}\n\n\t\t\treturn Math.round(height);\n\t\t}\n\n\t\t/**\n \t* Get documentElement scrollWidth\n \t* @returns {number} width\n \t*/\n\n\t}, {\n\t\tkey: \"scrollWidth\",\n\t\tvalue: function scrollWidth() {\n\t\t\tvar width = this.documentElement.scrollWidth;\n\n\t\t\treturn width;\n\t\t}\n\n\t\t/**\n \t* Get documentElement scrollHeight\n \t* @returns {number} height\n \t*/\n\n\t}, {\n\t\tkey: \"scrollHeight\",\n\t\tvalue: function scrollHeight() {\n\t\t\tvar height = this.documentElement.scrollHeight;\n\n\t\t\treturn height;\n\t\t}\n\n\t\t/**\n \t* Set overflow css style of the contents\n \t* @param {string} [overflow]\n \t*/\n\n\t}, {\n\t\tkey: \"overflow\",\n\t\tvalue: function overflow(_overflow) {\n\n\t\t\tif (_overflow) {\n\t\t\t\tthis.documentElement.style.overflow = _overflow;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(this.documentElement)[\"overflow\"];\n\t\t}\n\n\t\t/**\n \t* Set overflowX css style of the documentElement\n \t* @param {string} [overflow]\n \t*/\n\n\t}, {\n\t\tkey: \"overflowX\",\n\t\tvalue: function overflowX(overflow) {\n\n\t\t\tif (overflow) {\n\t\t\t\tthis.documentElement.style.overflowX = overflow;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(this.documentElement)[\"overflowX\"];\n\t\t}\n\n\t\t/**\n \t* Set overflowY css style of the documentElement\n \t* @param {string} [overflow]\n \t*/\n\n\t}, {\n\t\tkey: \"overflowY\",\n\t\tvalue: function overflowY(overflow) {\n\n\t\t\tif (overflow) {\n\t\t\t\tthis.documentElement.style.overflowY = overflow;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(this.documentElement)[\"overflowY\"];\n\t\t}\n\n\t\t/**\n \t* Set Css styles on the contents element (typically Body)\n \t* @param {string} property\n \t* @param {string} value\n \t* @param {boolean} [priority] set as \"important\"\n \t*/\n\n\t}, {\n\t\tkey: \"css\",\n\t\tvalue: function css(property, value, priority) {\n\t\t\tvar content = this.content || this.document.body;\n\n\t\t\tif (value) {\n\t\t\t\tcontent.style.setProperty(property, value, priority ? \"important\" : \"\");\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(content)[property];\n\t\t}\n\n\t\t/**\n \t* Get or Set the viewport element\n \t* @param {object} [options]\n \t* @param {string} [options.width]\n \t* @param {string} [options.height]\n \t* @param {string} [options.scale]\n \t* @param {string} [options.minimum]\n \t* @param {string} [options.maximum]\n \t* @param {string} [options.scalable]\n \t*/\n\n\t}, {\n\t\tkey: \"viewport\",\n\t\tvalue: function viewport(options) {\n\t\t\tvar _width, _height, _scale, _minimum, _maximum, _scalable;\n\t\t\t// var width, height, scale, minimum, maximum, scalable;\n\t\t\tvar $viewport = this.document.querySelector(\"meta[name='viewport']\");\n\t\t\tvar parsed = {\n\t\t\t\t\"width\": undefined,\n\t\t\t\t\"height\": undefined,\n\t\t\t\t\"scale\": undefined,\n\t\t\t\t\"minimum\": undefined,\n\t\t\t\t\"maximum\": undefined,\n\t\t\t\t\"scalable\": undefined\n\t\t\t};\n\t\t\tvar newContent = [];\n\t\t\tvar settings = {};\n\n\t\t\t/*\n * check for the viewport size\n * \n */\n\t\t\tif ($viewport && $viewport.hasAttribute(\"content\")) {\n\t\t\t\tvar content = $viewport.getAttribute(\"content\");\n\t\t\t\tvar _width2 = content.match(/width\\s*=\\s*([^,]*)/);\n\t\t\t\tvar _height2 = content.match(/height\\s*=\\s*([^,]*)/);\n\t\t\t\tvar _scale2 = content.match(/initial-scale\\s*=\\s*([^,]*)/);\n\t\t\t\tvar _minimum2 = content.match(/minimum-scale\\s*=\\s*([^,]*)/);\n\t\t\t\tvar _maximum2 = content.match(/maximum-scale\\s*=\\s*([^,]*)/);\n\t\t\t\tvar _scalable2 = content.match(/user-scalable\\s*=\\s*([^,]*)/);\n\n\t\t\t\tif (_width2 && _width2.length && typeof _width2[1] !== \"undefined\") {\n\t\t\t\t\tparsed.width = _width2[1];\n\t\t\t\t}\n\t\t\t\tif (_height2 && _height2.length && typeof _height2[1] !== \"undefined\") {\n\t\t\t\t\tparsed.height = _height2[1];\n\t\t\t\t}\n\t\t\t\tif (_scale2 && _scale2.length && typeof _scale2[1] !== \"undefined\") {\n\t\t\t\t\tparsed.scale = _scale2[1];\n\t\t\t\t}\n\t\t\t\tif (_minimum2 && _minimum2.length && typeof _minimum2[1] !== \"undefined\") {\n\t\t\t\t\tparsed.minimum = _minimum2[1];\n\t\t\t\t}\n\t\t\t\tif (_maximum2 && _maximum2.length && typeof _maximum2[1] !== \"undefined\") {\n\t\t\t\t\tparsed.maximum = _maximum2[1];\n\t\t\t\t}\n\t\t\t\tif (_scalable2 && _scalable2.length && typeof _scalable2[1] !== \"undefined\") {\n\t\t\t\t\tparsed.scalable = _scalable2[1];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsettings = (0, _core.defaults)(options || {}, parsed);\n\n\t\t\tif (options) {\n\t\t\t\tif (settings.width) {\n\t\t\t\t\tnewContent.push(\"width=\" + settings.width);\n\t\t\t\t}\n\n\t\t\t\tif (settings.height) {\n\t\t\t\t\tnewContent.push(\"height=\" + settings.height);\n\t\t\t\t}\n\n\t\t\t\tif (settings.scale) {\n\t\t\t\t\tnewContent.push(\"initial-scale=\" + settings.scale);\n\t\t\t\t}\n\n\t\t\t\tif (settings.scalable === \"no\") {\n\t\t\t\t\tnewContent.push(\"minimum-scale=\" + settings.scale);\n\t\t\t\t\tnewContent.push(\"maximum-scale=\" + settings.scale);\n\t\t\t\t\tnewContent.push(\"user-scalable=\" + settings.scalable);\n\t\t\t\t} else {\n\n\t\t\t\t\tif (settings.scalable) {\n\t\t\t\t\t\tnewContent.push(\"user-scalable=\" + settings.scalable);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (settings.minimum) {\n\t\t\t\t\t\tnewContent.push(\"minimum-scale=\" + settings.minimum);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (settings.maximum) {\n\t\t\t\t\t\tnewContent.push(\"minimum-scale=\" + settings.maximum);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!$viewport) {\n\t\t\t\t\t$viewport = this.document.createElement(\"meta\");\n\t\t\t\t\t$viewport.setAttribute(\"name\", \"viewport\");\n\t\t\t\t\tthis.document.querySelector(\"head\").appendChild($viewport);\n\t\t\t\t}\n\n\t\t\t\t$viewport.setAttribute(\"content\", newContent.join(\", \"));\n\n\t\t\t\tthis.window.scrollTo(0, 0);\n\t\t\t}\n\n\t\t\treturn settings;\n\t\t}\n\n\t\t/**\n * Event emitter for when the contents has expanded\n * @private\n */\n\n\t}, {\n\t\tkey: \"expand\",\n\t\tvalue: function expand() {\n\t\t\tthis.emit(_constants.EVENTS.CONTENTS.EXPAND);\n\t\t}\n\n\t\t/**\n * Add DOM listeners\n * @private\n */\n\n\t}, {\n\t\tkey: \"listeners\",\n\t\tvalue: function listeners() {\n\n\t\t\tthis.imageLoadListeners();\n\n\t\t\tthis.mediaQueryListeners();\n\n\t\t\t// this.fontLoadListeners();\n\n\t\t\tthis.addEventListeners();\n\n\t\t\tthis.addSelectionListeners();\n\n\t\t\t// this.transitionListeners();\n\n\t\t\tthis.resizeListeners();\n\n\t\t\t// this.resizeObservers();\n\n\t\t\tthis.linksHandler();\n\t\t}\n\n\t\t/**\n * Remove DOM listeners\n * @private\n */\n\n\t}, {\n\t\tkey: \"removeListeners\",\n\t\tvalue: function removeListeners() {\n\n\t\t\tthis.removeEventListeners();\n\n\t\t\tthis.removeSelectionListeners();\n\n\t\t\tclearTimeout(this.expanding);\n\t\t}\n\n\t\t/**\n * Check if size of contents has changed and\n * emit 'resize' event if it has.\n * @private\n */\n\n\t}, {\n\t\tkey: \"resizeCheck\",\n\t\tvalue: function resizeCheck() {\n\t\t\tvar width = this.textWidth();\n\t\t\tvar height = this.textHeight();\n\n\t\t\tif (width != this._size.width || height != this._size.height) {\n\n\t\t\t\tthis._size = {\n\t\t\t\t\twidth: width,\n\t\t\t\t\theight: height\n\t\t\t\t};\n\n\t\t\t\tthis.onResize && this.onResize(this._size);\n\t\t\t\tthis.emit(_constants.EVENTS.CONTENTS.RESIZE, this._size);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Poll for resize detection\n * @private\n */\n\n\t}, {\n\t\tkey: \"resizeListeners\",\n\t\tvalue: function resizeListeners() {\n\t\t\tvar width, height;\n\t\t\t// Test size again\n\t\t\tclearTimeout(this.expanding);\n\n\t\t\trequestAnimationFrame(this.resizeCheck.bind(this));\n\t\t\tthis.expanding = setTimeout(this.resizeListeners.bind(this), 350);\n\t\t}\n\n\t\t/**\n * Use css transitions to detect resize\n * @private\n */\n\n\t}, {\n\t\tkey: \"transitionListeners\",\n\t\tvalue: function transitionListeners() {\n\t\t\tvar body = this.content;\n\n\t\t\tbody.style['transitionProperty'] = \"font, font-size, font-size-adjust, font-stretch, font-variation-settings, font-weight, width, height\";\n\t\t\tbody.style['transitionDuration'] = \"0.001ms\";\n\t\t\tbody.style['transitionTimingFunction'] = \"linear\";\n\t\t\tbody.style['transitionDelay'] = \"0\";\n\n\t\t\tthis._resizeCheck = this.resizeCheck.bind(this);\n\t\t\tthis.document.addEventListener('transitionend', this._resizeCheck);\n\t\t}\n\n\t\t/**\n * Listen for media query changes and emit 'expand' event\n * Adapted from: https://github.com/tylergaw/media-query-events/blob/master/js/mq-events.js\n * @private\n */\n\n\t}, {\n\t\tkey: \"mediaQueryListeners\",\n\t\tvalue: function mediaQueryListeners() {\n\t\t\tvar sheets = this.document.styleSheets;\n\t\t\tvar mediaChangeHandler = function (m) {\n\t\t\t\tif (m.matches && !this._expanding) {\n\t\t\t\t\tsetTimeout(this.expand.bind(this), 1);\n\t\t\t\t}\n\t\t\t}.bind(this);\n\n\t\t\tfor (var i = 0; i < sheets.length; i += 1) {\n\t\t\t\tvar rules;\n\t\t\t\t// Firefox errors if we access cssRules cross-domain\n\t\t\t\ttry {\n\t\t\t\t\trules = sheets[i].cssRules;\n\t\t\t\t} catch (e) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!rules) return; // Stylesheets changed\n\t\t\t\tfor (var j = 0; j < rules.length; j += 1) {\n\t\t\t\t\t//if (rules[j].constructor === CSSMediaRule) {\n\t\t\t\t\tif (rules[j].media) {\n\t\t\t\t\t\tvar mql = this.window.matchMedia(rules[j].media.mediaText);\n\t\t\t\t\t\tmql.addListener(mediaChangeHandler);\n\t\t\t\t\t\t//mql.onchange = mediaChangeHandler;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Use MutationObserver to listen for changes in the DOM and check for resize\n * @private\n */\n\n\t}, {\n\t\tkey: \"resizeObservers\",\n\t\tvalue: function resizeObservers() {\n\t\t\tvar _this = this;\n\n\t\t\t// create an observer instance\n\t\t\tthis.observer = new MutationObserver(function (mutations) {\n\t\t\t\t_this.resizeCheck();\n\t\t\t});\n\n\t\t\t// configuration of the observer:\n\t\t\tvar config = { attributes: true, childList: true, characterData: true, subtree: true };\n\n\t\t\t// pass in the target node, as well as the observer options\n\t\t\tthis.observer.observe(this.document, config);\n\t\t}\n\n\t\t/**\n * Test if images are loaded or add listener for when they load\n * @private\n */\n\n\t}, {\n\t\tkey: \"imageLoadListeners\",\n\t\tvalue: function imageLoadListeners() {\n\t\t\tvar images = this.document.querySelectorAll(\"img\");\n\t\t\tvar img;\n\t\t\tfor (var i = 0; i < images.length; i++) {\n\t\t\t\timg = images[i];\n\n\t\t\t\tif (typeof img.naturalWidth !== \"undefined\" && img.naturalWidth === 0) {\n\t\t\t\t\timg.onload = this.expand.bind(this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Listen for font load and check for resize when loaded\n * @private\n */\n\n\t}, {\n\t\tkey: \"fontLoadListeners\",\n\t\tvalue: function fontLoadListeners() {\n\t\t\tif (!this.document || !this.document.fonts) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.document.fonts.ready.then(function () {\n\t\t\t\tthis.resizeCheck();\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Get the documentElement\n * @returns {element} documentElement\n */\n\n\t}, {\n\t\tkey: \"root\",\n\t\tvalue: function root() {\n\t\t\tif (!this.document) return null;\n\t\t\treturn this.document.documentElement;\n\t\t}\n\n\t\t/**\n * Get the location offset of a EpubCFI or an #id\n * @param {string | EpubCFI} target\n * @param {string} [ignoreClass] for the cfi\n * @returns { {left: Number, top: Number }\n */\n\n\t}, {\n\t\tkey: \"locationOf\",\n\t\tvalue: function locationOf(target, ignoreClass) {\n\t\t\tvar position;\n\t\t\tvar targetPos = { \"left\": 0, \"top\": 0 };\n\n\t\t\tif (!this.document) return targetPos;\n\n\t\t\tif (this.epubcfi.isCfiString(target)) {\n\t\t\t\tvar range = new _epubcfi2.default(target).toRange(this.document, ignoreClass);\n\n\t\t\t\tif (range) {\n\t\t\t\t\tif (range.startContainer.nodeType === Node.ELEMENT_NODE) {\n\t\t\t\t\t\tposition = range.startContainer.getBoundingClientRect();\n\t\t\t\t\t\ttargetPos.left = position.left;\n\t\t\t\t\t\ttargetPos.top = position.top;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Webkit does not handle collapsed range bounds correctly\n\t\t\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=138949\n\n\t\t\t\t\t\t// Construct a new non-collapsed range\n\t\t\t\t\t\tif (isWebkit) {\n\t\t\t\t\t\t\tvar container = range.startContainer;\n\t\t\t\t\t\t\tvar newRange = new Range();\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tif (container.nodeType === ELEMENT_NODE) {\n\t\t\t\t\t\t\t\t\tposition = container.getBoundingClientRect();\n\t\t\t\t\t\t\t\t} else if (range.startOffset + 2 < container.length) {\n\t\t\t\t\t\t\t\t\tnewRange.setStart(container, range.startOffset);\n\t\t\t\t\t\t\t\t\tnewRange.setEnd(container, range.startOffset + 2);\n\t\t\t\t\t\t\t\t\tposition = newRange.getBoundingClientRect();\n\t\t\t\t\t\t\t\t} else if (range.startOffset - 2 > 0) {\n\t\t\t\t\t\t\t\t\tnewRange.setStart(container, range.startOffset - 2);\n\t\t\t\t\t\t\t\t\tnewRange.setEnd(container, range.startOffset);\n\t\t\t\t\t\t\t\t\tposition = newRange.getBoundingClientRect();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// empty, return the parent element\n\t\t\t\t\t\t\t\t\tposition = container.parentNode.getBoundingClientRect();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\tconsole.error(e, e.stack);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tposition = range.getBoundingClientRect();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (typeof target === \"string\" && target.indexOf(\"#\") > -1) {\n\n\t\t\t\tvar id = target.substring(target.indexOf(\"#\") + 1);\n\t\t\t\tvar el = this.document.getElementById(id);\n\t\t\t\tif (el) {\n\t\t\t\t\tif (isWebkit) {\n\t\t\t\t\t\t// Webkit reports incorrect bounding rects in Columns\n\t\t\t\t\t\tvar _newRange = new Range();\n\t\t\t\t\t\t_newRange.selectNode(el);\n\t\t\t\t\t\tposition = _newRange.getBoundingClientRect();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tposition = el.getBoundingClientRect();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (position) {\n\t\t\t\ttargetPos.left = position.left;\n\t\t\t\ttargetPos.top = position.top;\n\t\t\t}\n\n\t\t\treturn targetPos;\n\t\t}\n\n\t\t/**\n * Append a stylesheet link to the document head\n * @param {string} src url\n */\n\n\t}, {\n\t\tkey: \"addStylesheet\",\n\t\tvalue: function addStylesheet(src) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar $stylesheet;\n\t\t\t\tvar ready = false;\n\n\t\t\t\tif (!this.document) {\n\t\t\t\t\tresolve(false);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Check if link already exists\n\t\t\t\t$stylesheet = this.document.querySelector(\"link[href='\" + src + \"']\");\n\t\t\t\tif ($stylesheet) {\n\t\t\t\t\tresolve(true);\n\t\t\t\t\treturn; // already present\n\t\t\t\t}\n\n\t\t\t\t$stylesheet = this.document.createElement(\"link\");\n\t\t\t\t$stylesheet.type = \"text/css\";\n\t\t\t\t$stylesheet.rel = \"stylesheet\";\n\t\t\t\t$stylesheet.href = src;\n\t\t\t\t$stylesheet.onload = $stylesheet.onreadystatechange = function () {\n\t\t\t\t\tif (!ready && (!this.readyState || this.readyState == \"complete\")) {\n\t\t\t\t\t\tready = true;\n\t\t\t\t\t\t// Let apply\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t}, 1);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.document.head.appendChild($stylesheet);\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Append stylesheet rules to a generate stylesheet\n * Array: https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule\n * Object: https://github.com/desirable-objects/json-to-css\n * @param {array | object} rules\n */\n\n\t}, {\n\t\tkey: \"addStylesheetRules\",\n\t\tvalue: function addStylesheetRules(rules) {\n\t\t\tvar styleEl;\n\t\t\tvar styleSheet;\n\t\t\tvar key = \"epubjs-inserted-css\";\n\n\t\t\tif (!this.document || !rules || rules.length === 0) return;\n\n\t\t\t// Check if link already exists\n\t\t\tstyleEl = this.document.getElementById(\"#\" + key);\n\t\t\tif (!styleEl) {\n\t\t\t\tstyleEl = this.document.createElement(\"style\");\n\t\t\t\tstyleEl.id = key;\n\t\t\t}\n\n\t\t\t// Append style element to head\n\t\t\tthis.document.head.appendChild(styleEl);\n\n\t\t\t// Grab style sheet\n\t\t\tstyleSheet = styleEl.sheet;\n\n\t\t\tif (Object.prototype.toString.call(rules) === \"[object Array]\") {\n\t\t\t\tfor (var i = 0, rl = rules.length; i < rl; i++) {\n\t\t\t\t\tvar j = 1,\n\t\t\t\t\t rule = rules[i],\n\t\t\t\t\t selector = rules[i][0],\n\t\t\t\t\t propStr = \"\";\n\t\t\t\t\t// If the second argument of a rule is an array of arrays, correct our variables.\n\t\t\t\t\tif (Object.prototype.toString.call(rule[1][0]) === \"[object Array]\") {\n\t\t\t\t\t\trule = rule[1];\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (var pl = rule.length; j < pl; j++) {\n\t\t\t\t\t\tvar prop = rule[j];\n\t\t\t\t\t\tpropStr += prop[0] + \":\" + prop[1] + (prop[2] ? \" !important\" : \"\") + \";\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\t// Insert CSS Rule\n\t\t\t\t\tstyleSheet.insertRule(selector + \"{\" + propStr + \"}\", styleSheet.cssRules.length);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar selectors = Object.keys(rules);\n\t\t\t\tselectors.forEach(function (selector) {\n\t\t\t\t\tvar definition = rules[selector];\n\t\t\t\t\tif (Array.isArray(definition)) {\n\t\t\t\t\t\tdefinition.forEach(function (item) {\n\t\t\t\t\t\t\tvar _rules = Object.keys(item);\n\t\t\t\t\t\t\tvar result = _rules.map(function (rule) {\n\t\t\t\t\t\t\t\treturn rule + \":\" + item[rule];\n\t\t\t\t\t\t\t}).join(';');\n\t\t\t\t\t\t\tstyleSheet.insertRule(selector + \"{\" + result + \"}\", styleSheet.cssRules.length);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar _rules = Object.keys(definition);\n\t\t\t\t\t\tvar result = _rules.map(function (rule) {\n\t\t\t\t\t\t\treturn rule + \":\" + definition[rule];\n\t\t\t\t\t\t}).join(';');\n\t\t\t\t\t\tstyleSheet.insertRule(selector + \"{\" + result + \"}\", styleSheet.cssRules.length);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Append a script tag to the document head\n * @param {string} src url\n * @returns {Promise} loaded\n */\n\n\t}, {\n\t\tkey: \"addScript\",\n\t\tvalue: function addScript(src) {\n\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\tvar $script;\n\t\t\t\tvar ready = false;\n\n\t\t\t\tif (!this.document) {\n\t\t\t\t\tresolve(false);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$script = this.document.createElement(\"script\");\n\t\t\t\t$script.type = \"text/javascript\";\n\t\t\t\t$script.async = true;\n\t\t\t\t$script.src = src;\n\t\t\t\t$script.onload = $script.onreadystatechange = function () {\n\t\t\t\t\tif (!ready && (!this.readyState || this.readyState == \"complete\")) {\n\t\t\t\t\t\tready = true;\n\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t}, 1);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis.document.head.appendChild($script);\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Add a class to the contents container\n * @param {string} className\n */\n\n\t}, {\n\t\tkey: \"addClass\",\n\t\tvalue: function addClass(className) {\n\t\t\tvar content;\n\n\t\t\tif (!this.document) return;\n\n\t\t\tcontent = this.content || this.document.body;\n\n\t\t\tif (content) {\n\t\t\t\tcontent.classList.add(className);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Remove a class from the contents container\n * @param {string} removeClass\n */\n\n\t}, {\n\t\tkey: \"removeClass\",\n\t\tvalue: function removeClass(className) {\n\t\t\tvar content;\n\n\t\t\tif (!this.document) return;\n\n\t\t\tcontent = this.content || this.document.body;\n\n\t\t\tif (content) {\n\t\t\t\tcontent.classList.remove(className);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Add DOM event listeners\n * @private\n */\n\n\t}, {\n\t\tkey: \"addEventListeners\",\n\t\tvalue: function addEventListeners() {\n\t\t\tif (!this.document) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._triggerEvent = this.triggerEvent.bind(this);\n\n\t\t\t_constants.DOM_EVENTS.forEach(function (eventName) {\n\t\t\t\tthis.document.addEventListener(eventName, this._triggerEvent, { passive: true });\n\t\t\t}, this);\n\t\t}\n\n\t\t/**\n * Remove DOM event listeners\n * @private\n */\n\n\t}, {\n\t\tkey: \"removeEventListeners\",\n\t\tvalue: function removeEventListeners() {\n\t\t\tif (!this.document) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t_constants.DOM_EVENTS.forEach(function (eventName) {\n\t\t\t\tthis.document.removeEventListener(eventName, this._triggerEvent, { passive: true });\n\t\t\t}, this);\n\t\t\tthis._triggerEvent = undefined;\n\t\t}\n\n\t\t/**\n * Emit passed browser events\n * @private\n */\n\n\t}, {\n\t\tkey: \"triggerEvent\",\n\t\tvalue: function triggerEvent(e) {\n\t\t\tthis.emit(e.type, e);\n\t\t}\n\n\t\t/**\n * Add listener for text selection\n * @private\n */\n\n\t}, {\n\t\tkey: \"addSelectionListeners\",\n\t\tvalue: function addSelectionListeners() {\n\t\t\tif (!this.document) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis._onSelectionChange = this.onSelectionChange.bind(this);\n\t\t\tthis.document.addEventListener(\"selectionchange\", this._onSelectionChange, { passive: true });\n\t\t}\n\n\t\t/**\n * Remove listener for text selection\n * @private\n */\n\n\t}, {\n\t\tkey: \"removeSelectionListeners\",\n\t\tvalue: function removeSelectionListeners() {\n\t\t\tif (!this.document) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.document.removeEventListener(\"selectionchange\", this._onSelectionChange, { passive: true });\n\t\t\tthis._onSelectionChange = undefined;\n\t\t}\n\n\t\t/**\n * Handle getting text on selection\n * @private\n */\n\n\t}, {\n\t\tkey: \"onSelectionChange\",\n\t\tvalue: function onSelectionChange(e) {\n\t\t\tif (this.selectionEndTimeout) {\n\t\t\t\tclearTimeout(this.selectionEndTimeout);\n\t\t\t}\n\t\t\tthis.selectionEndTimeout = setTimeout(function () {\n\t\t\t\tvar selection = this.window.getSelection();\n\t\t\t\tthis.triggerSelectedEvent(selection);\n\t\t\t}.bind(this), 250);\n\t\t}\n\n\t\t/**\n * Emit event on text selection\n * @private\n */\n\n\t}, {\n\t\tkey: \"triggerSelectedEvent\",\n\t\tvalue: function triggerSelectedEvent(selection) {\n\t\t\tvar range, cfirange;\n\n\t\t\tif (selection && selection.rangeCount > 0) {\n\t\t\t\trange = selection.getRangeAt(0);\n\t\t\t\tif (!range.collapsed) {\n\t\t\t\t\t// cfirange = this.section.cfiFromRange(range);\n\t\t\t\t\tcfirange = new _epubcfi2.default(range, this.cfiBase).toString();\n\t\t\t\t\tthis.emit(_constants.EVENTS.CONTENTS.SELECTED, cfirange);\n\t\t\t\t\tthis.emit(_constants.EVENTS.CONTENTS.SELECTED_RANGE, range);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Get a Dom Range from EpubCFI\n * @param {EpubCFI} _cfi\n * @param {string} [ignoreClass]\n * @returns {Range} range\n */\n\n\t}, {\n\t\tkey: \"range\",\n\t\tvalue: function range(_cfi, ignoreClass) {\n\t\t\tvar cfi = new _epubcfi2.default(_cfi);\n\t\t\treturn cfi.toRange(this.document, ignoreClass);\n\t\t}\n\n\t\t/**\n * Get an EpubCFI from a Dom Range\n * @param {Range} range\n * @param {string} [ignoreClass]\n * @returns {EpubCFI} cfi\n */\n\n\t}, {\n\t\tkey: \"cfiFromRange\",\n\t\tvalue: function cfiFromRange(range, ignoreClass) {\n\t\t\treturn new _epubcfi2.default(range, this.cfiBase, ignoreClass).toString();\n\t\t}\n\n\t\t/**\n * Get an EpubCFI from a Dom node\n * @param {node} node\n * @param {string} [ignoreClass]\n * @returns {EpubCFI} cfi\n */\n\n\t}, {\n\t\tkey: \"cfiFromNode\",\n\t\tvalue: function cfiFromNode(node, ignoreClass) {\n\t\t\treturn new _epubcfi2.default(node, this.cfiBase, ignoreClass).toString();\n\t\t}\n\n\t\t// TODO: find where this is used - remove?\n\n\t}, {\n\t\tkey: \"map\",\n\t\tvalue: function map(layout) {\n\t\t\tvar map = new _mapping2.default(layout);\n\t\t\treturn map.section();\n\t\t}\n\n\t\t/**\n * Size the contents to a given width and height\n * @param {number} [width]\n * @param {number} [height]\n */\n\n\t}, {\n\t\tkey: \"size\",\n\t\tvalue: function size(width, height) {\n\t\t\tvar viewport = { scale: 1.0, scalable: \"no\" };\n\n\t\t\tthis.layoutStyle(\"scrolling\");\n\n\t\t\tif (width >= 0) {\n\t\t\t\tthis.width(width);\n\t\t\t\tviewport.width = width;\n\t\t\t\tthis.css(\"padding\", \"0 \" + width / 12 + \"px\");\n\t\t\t}\n\n\t\t\tif (height >= 0) {\n\t\t\t\tthis.height(height);\n\t\t\t\tviewport.height = height;\n\t\t\t}\n\n\t\t\tthis.css(\"margin\", \"0\");\n\t\t\tthis.css(\"box-sizing\", \"border-box\");\n\n\t\t\tthis.viewport(viewport);\n\t\t}\n\n\t\t/**\n * Apply columns to the contents for pagination\n * @param {number} width\n * @param {number} height\n * @param {number} columnWidth\n * @param {number} gap\n */\n\n\t}, {\n\t\tkey: \"columns\",\n\t\tvalue: function columns(width, height, columnWidth, gap) {\n\t\t\tvar COLUMN_AXIS = (0, _core.prefixed)(\"column-axis\");\n\t\t\tvar COLUMN_GAP = (0, _core.prefixed)(\"column-gap\");\n\t\t\tvar COLUMN_WIDTH = (0, _core.prefixed)(\"column-width\");\n\t\t\tvar COLUMN_FILL = (0, _core.prefixed)(\"column-fill\");\n\n\t\t\tvar writingMode = this.writingMode();\n\t\t\tvar axis = writingMode.indexOf(\"vertical\") === 0 ? \"vertical\" : \"horizontal\";\n\n\t\t\tthis.layoutStyle(\"paginated\");\n\n\t\t\t// Fix body width issues if rtl is only set on body element\n\t\t\tif (this.content.dir === \"rtl\") {\n\t\t\t\tthis.direction(\"rtl\");\n\t\t\t}\n\n\t\t\tthis.width(width);\n\t\t\tthis.height(height);\n\n\t\t\t// Deal with Mobile trying to scale to viewport\n\t\t\tthis.viewport({ width: width, height: height, scale: 1.0, scalable: \"no\" });\n\n\t\t\t// TODO: inline-block needs more testing\n\t\t\t// Fixes Safari column cut offs, but causes RTL issues\n\t\t\t// this.css(\"display\", \"inline-block\");\n\n\t\t\tthis.css(\"overflow-y\", \"hidden\");\n\t\t\tthis.css(\"margin\", \"0\", true);\n\n\t\t\tif (axis === \"vertical\") {\n\t\t\t\tthis.css(\"padding-top\", gap / 2 + \"px\", true);\n\t\t\t\tthis.css(\"padding-bottom\", gap / 2 + \"px\", true);\n\t\t\t\tthis.css(\"padding-left\", \"20px\");\n\t\t\t\tthis.css(\"padding-right\", \"20px\");\n\t\t\t} else {\n\t\t\t\tthis.css(\"padding-top\", \"20px\");\n\t\t\t\tthis.css(\"padding-bottom\", \"20px\");\n\t\t\t\tthis.css(\"padding-left\", gap / 2 + \"px\", true);\n\t\t\t\tthis.css(\"padding-right\", gap / 2 + \"px\", true);\n\t\t\t}\n\n\t\t\tthis.css(\"box-sizing\", \"border-box\");\n\t\t\tthis.css(\"max-width\", \"inherit\");\n\n\t\t\tthis.css(COLUMN_AXIS, \"horizontal\");\n\t\t\tthis.css(COLUMN_FILL, \"auto\");\n\n\t\t\tthis.css(COLUMN_GAP, gap + \"px\");\n\t\t\tthis.css(COLUMN_WIDTH, columnWidth + \"px\");\n\t\t}\n\n\t\t/**\n * Scale contents from center\n * @param {number} scale\n * @param {number} offsetX\n * @param {number} offsetY\n */\n\n\t}, {\n\t\tkey: \"scaler\",\n\t\tvalue: function scaler(scale, offsetX, offsetY) {\n\t\t\tvar scaleStr = \"scale(\" + scale + \")\";\n\t\t\tvar translateStr = \"\";\n\t\t\t// this.css(\"position\", \"absolute\"));\n\t\t\tthis.css(\"transform-origin\", \"top left\");\n\n\t\t\tif (offsetX >= 0 || offsetY >= 0) {\n\t\t\t\ttranslateStr = \" translate(\" + (offsetX || 0) + \"px, \" + (offsetY || 0) + \"px )\";\n\t\t\t}\n\n\t\t\tthis.css(\"transform\", scaleStr + translateStr);\n\t\t}\n\n\t\t/**\n * Fit contents into a fixed width and height\n * @param {number} width\n * @param {number} height\n */\n\n\t}, {\n\t\tkey: \"fit\",\n\t\tvalue: function fit(width, height) {\n\t\t\tvar viewport = this.viewport();\n\t\t\tvar viewportWidth = parseInt(viewport.width);\n\t\t\tvar viewportHeight = parseInt(viewport.height);\n\t\t\tvar widthScale = width / viewportWidth;\n\t\t\tvar heightScale = height / viewportHeight;\n\t\t\tvar scale = widthScale < heightScale ? widthScale : heightScale;\n\n\t\t\t// the translate does not work as intended, elements can end up unaligned\n\t\t\t// var offsetY = (height - (viewportHeight * scale)) / 2;\n\t\t\t// var offsetX = 0;\n\t\t\t// if (this.sectionIndex % 2 === 1) {\n\t\t\t// \toffsetX = width - (viewportWidth * scale);\n\t\t\t// }\n\n\t\t\tthis.layoutStyle(\"paginated\");\n\n\t\t\t// scale needs width and height to be set\n\t\t\tthis.width(viewportWidth);\n\t\t\tthis.height(viewportHeight);\n\t\t\tthis.overflow(\"hidden\");\n\n\t\t\t// Scale to the correct size\n\t\t\tthis.scaler(scale, 0, 0);\n\t\t\t// this.scaler(scale, offsetX > 0 ? offsetX : 0, offsetY);\n\n\t\t\t// background images are not scaled by transform\n\t\t\tthis.css(\"background-size\", viewportWidth * scale + \"px \" + viewportHeight * scale + \"px\");\n\n\t\t\tthis.css(\"background-color\", \"transparent\");\n\t\t}\n\n\t\t/**\n * Set the direction of the text\n * @param {string} [dir=\"ltr\"] \"rtl\" | \"ltr\"\n */\n\n\t}, {\n\t\tkey: \"direction\",\n\t\tvalue: function direction(dir) {\n\t\t\tif (this.documentElement) {\n\t\t\t\tthis.documentElement.style[\"direction\"] = dir;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"mapPage\",\n\t\tvalue: function mapPage(cfiBase, layout, start, end, dev) {\n\t\t\tvar mapping = new _mapping2.default(layout, dev);\n\n\t\t\treturn mapping.page(this, cfiBase, start, end);\n\t\t}\n\n\t\t/**\n * Emit event when link in content is clicked\n * @private\n */\n\n\t}, {\n\t\tkey: \"linksHandler\",\n\t\tvalue: function linksHandler() {\n\t\t\tvar _this2 = this;\n\n\t\t\t(0, _replacements.replaceLinks)(this.content, function (href) {\n\t\t\t\t_this2.emit(_constants.EVENTS.CONTENTS.LINK_CLICKED, href);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Set the writingMode of the text\n * @param {string} [mode=\"horizontal-tb\"] \"horizontal-tb\" | \"vertical-rl\" | \"vertical-lr\"\n */\n\n\t}, {\n\t\tkey: \"writingMode\",\n\t\tvalue: function writingMode(mode) {\n\t\t\tvar WRITING_MODE = (0, _core.prefixed)(\"writing-mode\");\n\n\t\t\tif (mode && this.documentElement) {\n\t\t\t\tthis.documentElement.style[WRITING_MODE] = mode;\n\t\t\t}\n\n\t\t\treturn this.window.getComputedStyle(this.documentElement)[WRITING_MODE] || '';\n\t\t}\n\n\t\t/**\n * Set the layoutStyle of the content\n * @param {string} [style=\"paginated\"] \"scrolling\" | \"paginated\"\n * @private\n */\n\n\t}, {\n\t\tkey: \"layoutStyle\",\n\t\tvalue: function layoutStyle(style) {\n\n\t\t\tif (style) {\n\t\t\t\tthis._layoutStyle = style;\n\t\t\t\tnavigator.epubReadingSystem.layoutStyle = this._layoutStyle;\n\t\t\t}\n\n\t\t\treturn this._layoutStyle || \"paginated\";\n\t\t}\n\n\t\t/**\n * Add the epubReadingSystem object to the navigator\n * @param {string} name\n * @param {string} version\n * @private\n */\n\n\t}, {\n\t\tkey: \"epubReadingSystem\",\n\t\tvalue: function epubReadingSystem(name, version) {\n\t\t\tnavigator.epubReadingSystem = {\n\t\t\t\tname: name,\n\t\t\t\tversion: version,\n\t\t\t\tlayoutStyle: this.layoutStyle(),\n\t\t\t\thasFeature: function hasFeature(feature) {\n\t\t\t\t\tswitch (feature) {\n\t\t\t\t\t\tcase \"dom-manipulation\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase \"layout-changes\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase \"touch-events\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase \"mouse-events\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase \"keyboard-events\":\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tcase \"spine-scripting\":\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\treturn navigator.epubReadingSystem;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\t// Stop observing\n\t\t\tif (this.observer) {\n\t\t\t\tthis.observer.disconnect();\n\t\t\t}\n\n\t\t\tthis.document.removeEventListener('transitionend', this._resizeCheck);\n\n\t\t\tthis.removeListeners();\n\t\t}\n\t}], [{\n\t\tkey: \"listenedEvents\",\n\t\tget: function get() {\n\t\t\treturn _constants.DOM_EVENTS;\n\t\t}\n\t}]);\n\n\treturn Contents;\n}();\n\n(0, _eventEmitter2.default)(Contents.prototype);\n\nexports.default = Contents;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/contents.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/displayoptions.js": -/*!***************************************************!*\ - !*** ./node_modules/epubjs/lib/displayoptions.js ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Open DisplayOptions Format Parser\n * @class\n * @param {document} displayOptionsDocument XML\n */\nvar DisplayOptions = function () {\n\tfunction DisplayOptions(displayOptionsDocument) {\n\t\t_classCallCheck(this, DisplayOptions);\n\n\t\tthis.interactive = \"\";\n\t\tthis.fixedLayout = \"\";\n\t\tthis.openToSpread = \"\";\n\t\tthis.orientationLock = \"\";\n\n\t\tif (displayOptionsDocument) {\n\t\t\tthis.parse(displayOptionsDocument);\n\t\t}\n\t}\n\n\t/**\n * Parse XML\n * @param {document} displayOptionsDocument XML\n * @return {DisplayOptions} self\n */\n\n\n\t_createClass(DisplayOptions, [{\n\t\tkey: \"parse\",\n\t\tvalue: function parse(displayOptionsDocument) {\n\t\t\tvar _this = this;\n\n\t\t\tif (!displayOptionsDocument) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tvar displayOptionsNode = (0, _core.qs)(displayOptionsDocument, \"display_options\");\n\t\t\tif (!displayOptionsNode) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tvar options = (0, _core.qsa)(displayOptionsNode, \"option\");\n\t\t\toptions.forEach(function (el) {\n\t\t\t\tvar value = \"\";\n\n\t\t\t\tif (el.childNodes.length) {\n\t\t\t\t\tvalue = el.childNodes[0].nodeValue;\n\t\t\t\t}\n\n\t\t\t\tswitch (el.attributes.name.value) {\n\t\t\t\t\tcase \"interactive\":\n\t\t\t\t\t\t_this.interactive = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"fixed-layout\":\n\t\t\t\t\t\t_this.fixedLayout = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"open-to-spread\":\n\t\t\t\t\t\t_this.openToSpread = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"orientation-lock\":\n\t\t\t\t\t\t_this.orientationLock = value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn this;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.interactive = undefined;\n\t\t\tthis.fixedLayout = undefined;\n\t\t\tthis.openToSpread = undefined;\n\t\t\tthis.orientationLock = undefined;\n\t\t}\n\t}]);\n\n\treturn DisplayOptions;\n}();\n\nexports.default = DisplayOptions;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/displayoptions.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/epub.js": -/*!*****************************************!*\ - !*** ./node_modules/epubjs/lib/epub.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _book = __webpack_require__(/*! ./book */ \"./node_modules/epubjs/lib/book.js\");\n\nvar _book2 = _interopRequireDefault(_book);\n\nvar _rendition = __webpack_require__(/*! ./rendition */ \"./node_modules/epubjs/lib/rendition.js\");\n\nvar _rendition2 = _interopRequireDefault(_rendition);\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _contents = __webpack_require__(/*! ./contents */ \"./node_modules/epubjs/lib/contents.js\");\n\nvar _contents2 = _interopRequireDefault(_contents);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar utils = _interopRequireWildcard(_core);\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _urlPolyfill = __webpack_require__(/*! url-polyfill */ \"./node_modules/url-polyfill/url-polyfill.js\");\n\nvar URLpolyfill = _interopRequireWildcard(_urlPolyfill);\n\nvar _iframe = __webpack_require__(/*! ./managers/views/iframe */ \"./node_modules/epubjs/lib/managers/views/iframe.js\");\n\nvar _iframe2 = _interopRequireDefault(_iframe);\n\nvar _default = __webpack_require__(/*! ./managers/default */ \"./node_modules/epubjs/lib/managers/default/index.js\");\n\nvar _default2 = _interopRequireDefault(_default);\n\nvar _continuous = __webpack_require__(/*! ./managers/continuous */ \"./node_modules/epubjs/lib/managers/continuous/index.js\");\n\nvar _continuous2 = _interopRequireDefault(_continuous);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Creates a new Book\n * @param {string|ArrayBuffer} url URL, Path or ArrayBuffer\n * @param {object} options to pass to the book\n * @returns {Book} a new Book object\n * @example ePub(\"/path/to/book.epub\", {})\n */\nfunction ePub(url, options) {\n return new _book2.default(url, options);\n}\n\nePub.VERSION = _constants.EPUBJS_VERSION;\n\nif (typeof global !== \"undefined\") {\n global.EPUBJS_VERSION = _constants.EPUBJS_VERSION;\n}\n\nePub.Book = _book2.default;\nePub.Rendition = _rendition2.default;\nePub.Contents = _contents2.default;\nePub.CFI = _epubcfi2.default;\nePub.utils = utils;\n\nexports.default = ePub;\nmodule.exports = exports[\"default\"];\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/epub.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/epubcfi.js": -/*!********************************************!*\ - !*** ./node_modules/epubjs/lib/epubcfi.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar ELEMENT_NODE = 1;\nvar TEXT_NODE = 3;\nvar COMMENT_NODE = 8;\nvar DOCUMENT_NODE = 9;\n\n/**\n\t* Parsing and creation of EpubCFIs: http://www.idpf.org/epub/linking/cfi/epub-cfi.html\n\n\t* Implements:\n\t* - Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)\n\t* - Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)\n\n\t* Does Not Implement:\n\t* - Temporal Offset (~)\n\t* - Spatial Offset (@)\n\t* - Temporal-Spatial Offset (~ + @)\n\t* - Text Location Assertion ([)\n\t* @class\n\t@param {string | Range | Node } [cfiFrom]\n\t@param {string | object} [base]\n\t@param {string} [ignoreClass] class to ignore when parsing DOM\n*/\n\nvar EpubCFI = function () {\n\tfunction EpubCFI(cfiFrom, base, ignoreClass) {\n\t\t_classCallCheck(this, EpubCFI);\n\n\t\tvar type;\n\n\t\tthis.str = \"\";\n\n\t\tthis.base = {};\n\t\tthis.spinePos = 0; // For compatibility\n\n\t\tthis.range = false; // true || false;\n\n\t\tthis.path = {};\n\t\tthis.start = null;\n\t\tthis.end = null;\n\n\t\t// Allow instantiation without the \"new\" keyword\n\t\tif (!(this instanceof EpubCFI)) {\n\t\t\treturn new EpubCFI(cfiFrom, base, ignoreClass);\n\t\t}\n\n\t\tif (typeof base === \"string\") {\n\t\t\tthis.base = this.parseComponent(base);\n\t\t} else if ((typeof base === \"undefined\" ? \"undefined\" : _typeof(base)) === \"object\" && base.steps) {\n\t\t\tthis.base = base;\n\t\t}\n\n\t\ttype = this.checkType(cfiFrom);\n\n\t\tif (type === \"string\") {\n\t\t\tthis.str = cfiFrom;\n\t\t\treturn (0, _core.extend)(this, this.parse(cfiFrom));\n\t\t} else if (type === \"range\") {\n\t\t\treturn (0, _core.extend)(this, this.fromRange(cfiFrom, this.base, ignoreClass));\n\t\t} else if (type === \"node\") {\n\t\t\treturn (0, _core.extend)(this, this.fromNode(cfiFrom, this.base, ignoreClass));\n\t\t} else if (type === \"EpubCFI\" && cfiFrom.path) {\n\t\t\treturn cfiFrom;\n\t\t} else if (!cfiFrom) {\n\t\t\treturn this;\n\t\t} else {\n\t\t\tthrow new TypeError(\"not a valid argument for EpubCFI\");\n\t\t}\n\t}\n\n\t/**\n * Check the type of constructor input\n * @private\n */\n\n\n\t_createClass(EpubCFI, [{\n\t\tkey: \"checkType\",\n\t\tvalue: function checkType(cfi) {\n\n\t\t\tif (this.isCfiString(cfi)) {\n\t\t\t\treturn \"string\";\n\t\t\t\t// Is a range object\n\t\t\t} else if (cfi && (typeof cfi === \"undefined\" ? \"undefined\" : _typeof(cfi)) === \"object\" && ((0, _core.type)(cfi) === \"Range\" || typeof cfi.startContainer != \"undefined\")) {\n\t\t\t\treturn \"range\";\n\t\t\t} else if (cfi && (typeof cfi === \"undefined\" ? \"undefined\" : _typeof(cfi)) === \"object\" && typeof cfi.nodeType != \"undefined\") {\n\t\t\t\t// || typeof cfi === \"function\"\n\t\t\t\treturn \"node\";\n\t\t\t} else if (cfi && (typeof cfi === \"undefined\" ? \"undefined\" : _typeof(cfi)) === \"object\" && cfi instanceof EpubCFI) {\n\t\t\t\treturn \"EpubCFI\";\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Parse a cfi string to a CFI object representation\n * @param {string} cfiStr\n * @returns {object} cfi\n */\n\n\t}, {\n\t\tkey: \"parse\",\n\t\tvalue: function parse(cfiStr) {\n\t\t\tvar cfi = {\n\t\t\t\tspinePos: -1,\n\t\t\t\trange: false,\n\t\t\t\tbase: {},\n\t\t\t\tpath: {},\n\t\t\t\tstart: null,\n\t\t\t\tend: null\n\t\t\t};\n\t\t\tvar baseComponent, pathComponent, range;\n\n\t\t\tif (typeof cfiStr !== \"string\") {\n\t\t\t\treturn { spinePos: -1 };\n\t\t\t}\n\n\t\t\tif (cfiStr.indexOf(\"epubcfi(\") === 0 && cfiStr[cfiStr.length - 1] === \")\") {\n\t\t\t\t// Remove intial epubcfi( and ending )\n\t\t\t\tcfiStr = cfiStr.slice(8, cfiStr.length - 1);\n\t\t\t}\n\n\t\t\tbaseComponent = this.getChapterComponent(cfiStr);\n\n\t\t\t// Make sure this is a valid cfi or return\n\t\t\tif (!baseComponent) {\n\t\t\t\treturn { spinePos: -1 };\n\t\t\t}\n\n\t\t\tcfi.base = this.parseComponent(baseComponent);\n\n\t\t\tpathComponent = this.getPathComponent(cfiStr);\n\t\t\tcfi.path = this.parseComponent(pathComponent);\n\n\t\t\trange = this.getRange(cfiStr);\n\n\t\t\tif (range) {\n\t\t\t\tcfi.range = true;\n\t\t\t\tcfi.start = this.parseComponent(range[0]);\n\t\t\t\tcfi.end = this.parseComponent(range[1]);\n\t\t\t}\n\n\t\t\t// Get spine node position\n\t\t\t// cfi.spineSegment = cfi.base.steps[1];\n\n\t\t\t// Chapter segment is always the second step\n\t\t\tcfi.spinePos = cfi.base.steps[1].index;\n\n\t\t\treturn cfi;\n\t\t}\n\t}, {\n\t\tkey: \"parseComponent\",\n\t\tvalue: function parseComponent(componentStr) {\n\t\t\tvar component = {\n\t\t\t\tsteps: [],\n\t\t\t\tterminal: {\n\t\t\t\t\toffset: null,\n\t\t\t\t\tassertion: null\n\t\t\t\t}\n\t\t\t};\n\t\t\tvar parts = componentStr.split(\":\");\n\t\t\tvar steps = parts[0].split(\"/\");\n\t\t\tvar terminal;\n\n\t\t\tif (parts.length > 1) {\n\t\t\t\tterminal = parts[1];\n\t\t\t\tcomponent.terminal = this.parseTerminal(terminal);\n\t\t\t}\n\n\t\t\tif (steps[0] === \"\") {\n\t\t\t\tsteps.shift(); // Ignore the first slash\n\t\t\t}\n\n\t\t\tcomponent.steps = steps.map(function (step) {\n\t\t\t\treturn this.parseStep(step);\n\t\t\t}.bind(this));\n\n\t\t\treturn component;\n\t\t}\n\t}, {\n\t\tkey: \"parseStep\",\n\t\tvalue: function parseStep(stepStr) {\n\t\t\tvar type, num, index, has_brackets, id;\n\n\t\t\thas_brackets = stepStr.match(/\\[(.*)\\]/);\n\t\t\tif (has_brackets && has_brackets[1]) {\n\t\t\t\tid = has_brackets[1];\n\t\t\t}\n\n\t\t\t//-- Check if step is a text node or element\n\t\t\tnum = parseInt(stepStr);\n\n\t\t\tif (isNaN(num)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (num % 2 === 0) {\n\t\t\t\t// Even = is an element\n\t\t\t\ttype = \"element\";\n\t\t\t\tindex = num / 2 - 1;\n\t\t\t} else {\n\t\t\t\ttype = \"text\";\n\t\t\t\tindex = (num - 1) / 2;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t\"type\": type,\n\t\t\t\t\"index\": index,\n\t\t\t\t\"id\": id || null\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"parseTerminal\",\n\t\tvalue: function parseTerminal(termialStr) {\n\t\t\tvar characterOffset, textLocationAssertion;\n\t\t\tvar assertion = termialStr.match(/\\[(.*)\\]/);\n\n\t\t\tif (assertion && assertion[1]) {\n\t\t\t\tcharacterOffset = parseInt(termialStr.split(\"[\")[0]);\n\t\t\t\ttextLocationAssertion = assertion[1];\n\t\t\t} else {\n\t\t\t\tcharacterOffset = parseInt(termialStr);\n\t\t\t}\n\n\t\t\tif (!(0, _core.isNumber)(characterOffset)) {\n\t\t\t\tcharacterOffset = null;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t\"offset\": characterOffset,\n\t\t\t\t\"assertion\": textLocationAssertion\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"getChapterComponent\",\n\t\tvalue: function getChapterComponent(cfiStr) {\n\n\t\t\tvar indirection = cfiStr.split(\"!\");\n\n\t\t\treturn indirection[0];\n\t\t}\n\t}, {\n\t\tkey: \"getPathComponent\",\n\t\tvalue: function getPathComponent(cfiStr) {\n\n\t\t\tvar indirection = cfiStr.split(\"!\");\n\n\t\t\tif (indirection[1]) {\n\t\t\t\tvar ranges = indirection[1].split(\",\");\n\t\t\t\treturn ranges[0];\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"getRange\",\n\t\tvalue: function getRange(cfiStr) {\n\n\t\t\tvar ranges = cfiStr.split(\",\");\n\n\t\t\tif (ranges.length === 3) {\n\t\t\t\treturn [ranges[1], ranges[2]];\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}, {\n\t\tkey: \"getCharecterOffsetComponent\",\n\t\tvalue: function getCharecterOffsetComponent(cfiStr) {\n\t\t\tvar splitStr = cfiStr.split(\":\");\n\t\t\treturn splitStr[1] || \"\";\n\t\t}\n\t}, {\n\t\tkey: \"joinSteps\",\n\t\tvalue: function joinSteps(steps) {\n\t\t\tif (!steps) {\n\t\t\t\treturn \"\";\n\t\t\t}\n\n\t\t\treturn steps.map(function (part) {\n\t\t\t\tvar segment = \"\";\n\n\t\t\t\tif (part.type === \"element\") {\n\t\t\t\t\tsegment += (part.index + 1) * 2;\n\t\t\t\t}\n\n\t\t\t\tif (part.type === \"text\") {\n\t\t\t\t\tsegment += 1 + 2 * part.index; // TODO: double check that this is odd\n\t\t\t\t}\n\n\t\t\t\tif (part.id) {\n\t\t\t\t\tsegment += \"[\" + part.id + \"]\";\n\t\t\t\t}\n\n\t\t\t\treturn segment;\n\t\t\t}).join(\"/\");\n\t\t}\n\t}, {\n\t\tkey: \"segmentString\",\n\t\tvalue: function segmentString(segment) {\n\t\t\tvar segmentString = \"/\";\n\n\t\t\tsegmentString += this.joinSteps(segment.steps);\n\n\t\t\tif (segment.terminal && segment.terminal.offset != null) {\n\t\t\t\tsegmentString += \":\" + segment.terminal.offset;\n\t\t\t}\n\n\t\t\tif (segment.terminal && segment.terminal.assertion != null) {\n\t\t\t\tsegmentString += \"[\" + segment.terminal.assertion + \"]\";\n\t\t\t}\n\n\t\t\treturn segmentString;\n\t\t}\n\n\t\t/**\n * Convert CFI to a epubcfi(...) string\n * @returns {string} epubcfi\n */\n\n\t}, {\n\t\tkey: \"toString\",\n\t\tvalue: function toString() {\n\t\t\tvar cfiString = \"epubcfi(\";\n\n\t\t\tcfiString += this.segmentString(this.base);\n\n\t\t\tcfiString += \"!\";\n\t\t\tcfiString += this.segmentString(this.path);\n\n\t\t\t// Add Range, if present\n\t\t\tif (this.range && this.start) {\n\t\t\t\tcfiString += \",\";\n\t\t\t\tcfiString += this.segmentString(this.start);\n\t\t\t}\n\n\t\t\tif (this.range && this.end) {\n\t\t\t\tcfiString += \",\";\n\t\t\t\tcfiString += this.segmentString(this.end);\n\t\t\t}\n\n\t\t\tcfiString += \")\";\n\n\t\t\treturn cfiString;\n\t\t}\n\n\t\t/**\n * Compare which of two CFIs is earlier in the text\n * @returns {number} First is earlier = -1, Second is earlier = 1, They are equal = 0\n */\n\n\t}, {\n\t\tkey: \"compare\",\n\t\tvalue: function compare(cfiOne, cfiTwo) {\n\t\t\tvar stepsA, stepsB;\n\t\t\tvar terminalA, terminalB;\n\n\t\t\tvar rangeAStartSteps, rangeAEndSteps;\n\t\t\tvar rangeBEndSteps, rangeBEndSteps;\n\t\t\tvar rangeAStartTerminal, rangeAEndTerminal;\n\t\t\tvar rangeBStartTerminal, rangeBEndTerminal;\n\n\t\t\tif (typeof cfiOne === \"string\") {\n\t\t\t\tcfiOne = new EpubCFI(cfiOne);\n\t\t\t}\n\t\t\tif (typeof cfiTwo === \"string\") {\n\t\t\t\tcfiTwo = new EpubCFI(cfiTwo);\n\t\t\t}\n\t\t\t// Compare Spine Positions\n\t\t\tif (cfiOne.spinePos > cfiTwo.spinePos) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (cfiOne.spinePos < cfiTwo.spinePos) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tif (cfiOne.range) {\n\t\t\t\tstepsA = cfiOne.path.steps.concat(cfiOne.start.steps);\n\t\t\t\tterminalA = cfiOne.start.terminal;\n\t\t\t} else {\n\t\t\t\tstepsA = cfiOne.path.steps;\n\t\t\t\tterminalA = cfiOne.path.terminal;\n\t\t\t}\n\n\t\t\tif (cfiTwo.range) {\n\t\t\t\tstepsB = cfiTwo.path.steps.concat(cfiTwo.start.steps);\n\t\t\t\tterminalB = cfiTwo.start.terminal;\n\t\t\t} else {\n\t\t\t\tstepsB = cfiTwo.path.steps;\n\t\t\t\tterminalB = cfiTwo.path.terminal;\n\t\t\t}\n\n\t\t\t// Compare Each Step in the First item\n\t\t\tfor (var i = 0; i < stepsA.length; i++) {\n\t\t\t\tif (!stepsA[i]) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tif (!stepsB[i]) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tif (stepsA[i].index > stepsB[i].index) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\tif (stepsA[i].index < stepsB[i].index) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\t// Otherwise continue checking\n\t\t\t}\n\n\t\t\t// All steps in First equal to Second and First is Less Specific\n\t\t\tif (stepsA.length < stepsB.length) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\t// Compare the charecter offset of the text node\n\t\t\tif (terminalA.offset > terminalB.offset) {\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tif (terminalA.offset < terminalB.offset) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\t// CFI's are equal\n\t\t\treturn 0;\n\t\t}\n\t}, {\n\t\tkey: \"step\",\n\t\tvalue: function step(node) {\n\t\t\tvar nodeType = node.nodeType === TEXT_NODE ? \"text\" : \"element\";\n\n\t\t\treturn {\n\t\t\t\t\"id\": node.id,\n\t\t\t\t\"tagName\": node.tagName,\n\t\t\t\t\"type\": nodeType,\n\t\t\t\t\"index\": this.position(node)\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"filteredStep\",\n\t\tvalue: function filteredStep(node, ignoreClass) {\n\t\t\tvar filteredNode = this.filter(node, ignoreClass);\n\t\t\tvar nodeType;\n\n\t\t\t// Node filtered, so ignore\n\t\t\tif (!filteredNode) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise add the filter node in\n\t\t\tnodeType = filteredNode.nodeType === TEXT_NODE ? \"text\" : \"element\";\n\n\t\t\treturn {\n\t\t\t\t\"id\": filteredNode.id,\n\t\t\t\t\"tagName\": filteredNode.tagName,\n\t\t\t\t\"type\": nodeType,\n\t\t\t\t\"index\": this.filteredPosition(filteredNode, ignoreClass)\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"pathTo\",\n\t\tvalue: function pathTo(node, offset, ignoreClass) {\n\t\t\tvar segment = {\n\t\t\t\tsteps: [],\n\t\t\t\tterminal: {\n\t\t\t\t\toffset: null,\n\t\t\t\t\tassertion: null\n\t\t\t\t}\n\t\t\t};\n\t\t\tvar currentNode = node;\n\t\t\tvar step;\n\n\t\t\twhile (currentNode && currentNode.parentNode && currentNode.parentNode.nodeType != DOCUMENT_NODE) {\n\n\t\t\t\tif (ignoreClass) {\n\t\t\t\t\tstep = this.filteredStep(currentNode, ignoreClass);\n\t\t\t\t} else {\n\t\t\t\t\tstep = this.step(currentNode);\n\t\t\t\t}\n\n\t\t\t\tif (step) {\n\t\t\t\t\tsegment.steps.unshift(step);\n\t\t\t\t}\n\n\t\t\t\tcurrentNode = currentNode.parentNode;\n\t\t\t}\n\n\t\t\tif (offset != null && offset >= 0) {\n\n\t\t\t\tsegment.terminal.offset = offset;\n\n\t\t\t\t// Make sure we are getting to a textNode if there is an offset\n\t\t\t\tif (segment.steps[segment.steps.length - 1].type != \"text\") {\n\t\t\t\t\tsegment.steps.push({\n\t\t\t\t\t\t\"type\": \"text\",\n\t\t\t\t\t\t\"index\": 0\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn segment;\n\t\t}\n\t}, {\n\t\tkey: \"equalStep\",\n\t\tvalue: function equalStep(stepA, stepB) {\n\t\t\tif (!stepA || !stepB) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (stepA.index === stepB.index && stepA.id === stepB.id && stepA.type === stepB.type) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\t/**\n * Create a CFI object from a Range\n * @param {Range} range\n * @param {string | object} base\n * @param {string} [ignoreClass]\n * @returns {object} cfi\n */\n\n\t}, {\n\t\tkey: \"fromRange\",\n\t\tvalue: function fromRange(range, base, ignoreClass) {\n\t\t\tvar cfi = {\n\t\t\t\trange: false,\n\t\t\t\tbase: {},\n\t\t\t\tpath: {},\n\t\t\t\tstart: null,\n\t\t\t\tend: null\n\t\t\t};\n\n\t\t\tvar start = range.startContainer;\n\t\t\tvar end = range.endContainer;\n\n\t\t\tvar startOffset = range.startOffset;\n\t\t\tvar endOffset = range.endOffset;\n\n\t\t\tvar needsIgnoring = false;\n\n\t\t\tif (ignoreClass) {\n\t\t\t\t// Tell pathTo if / what to ignore\n\t\t\t\tneedsIgnoring = start.ownerDocument.querySelector(\".\" + ignoreClass) != null;\n\t\t\t}\n\n\t\t\tif (typeof base === \"string\") {\n\t\t\t\tcfi.base = this.parseComponent(base);\n\t\t\t\tcfi.spinePos = cfi.base.steps[1].index;\n\t\t\t} else if ((typeof base === \"undefined\" ? \"undefined\" : _typeof(base)) === \"object\") {\n\t\t\t\tcfi.base = base;\n\t\t\t}\n\n\t\t\tif (range.collapsed) {\n\t\t\t\tif (needsIgnoring) {\n\t\t\t\t\tstartOffset = this.patchOffset(start, startOffset, ignoreClass);\n\t\t\t\t}\n\t\t\t\tcfi.path = this.pathTo(start, startOffset, ignoreClass);\n\t\t\t} else {\n\t\t\t\tcfi.range = true;\n\n\t\t\t\tif (needsIgnoring) {\n\t\t\t\t\tstartOffset = this.patchOffset(start, startOffset, ignoreClass);\n\t\t\t\t}\n\n\t\t\t\tcfi.start = this.pathTo(start, startOffset, ignoreClass);\n\t\t\t\tif (needsIgnoring) {\n\t\t\t\t\tendOffset = this.patchOffset(end, endOffset, ignoreClass);\n\t\t\t\t}\n\n\t\t\t\tcfi.end = this.pathTo(end, endOffset, ignoreClass);\n\n\t\t\t\t// Create a new empty path\n\t\t\t\tcfi.path = {\n\t\t\t\t\tsteps: [],\n\t\t\t\t\tterminal: null\n\t\t\t\t};\n\n\t\t\t\t// Push steps that are shared between start and end to the common path\n\t\t\t\tvar len = cfi.start.steps.length;\n\t\t\t\tvar i;\n\n\t\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\t\tif (this.equalStep(cfi.start.steps[i], cfi.end.steps[i])) {\n\t\t\t\t\t\tif (i === len - 1) {\n\t\t\t\t\t\t\t// Last step is equal, check terminals\n\t\t\t\t\t\t\tif (cfi.start.terminal === cfi.end.terminal) {\n\t\t\t\t\t\t\t\t// CFI's are equal\n\t\t\t\t\t\t\t\tcfi.path.steps.push(cfi.start.steps[i]);\n\t\t\t\t\t\t\t\t// Not a range\n\t\t\t\t\t\t\t\tcfi.range = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcfi.path.steps.push(cfi.start.steps[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcfi.start.steps = cfi.start.steps.slice(cfi.path.steps.length);\n\t\t\t\tcfi.end.steps = cfi.end.steps.slice(cfi.path.steps.length);\n\n\t\t\t\t// TODO: Add Sanity check to make sure that the end if greater than the start\n\t\t\t}\n\n\t\t\treturn cfi;\n\t\t}\n\n\t\t/**\n * Create a CFI object from a Node\n * @param {Node} anchor\n * @param {string | object} base\n * @param {string} [ignoreClass]\n * @returns {object} cfi\n */\n\n\t}, {\n\t\tkey: \"fromNode\",\n\t\tvalue: function fromNode(anchor, base, ignoreClass) {\n\t\t\tvar cfi = {\n\t\t\t\trange: false,\n\t\t\t\tbase: {},\n\t\t\t\tpath: {},\n\t\t\t\tstart: null,\n\t\t\t\tend: null\n\t\t\t};\n\n\t\t\tif (typeof base === \"string\") {\n\t\t\t\tcfi.base = this.parseComponent(base);\n\t\t\t\tcfi.spinePos = cfi.base.steps[1].index;\n\t\t\t} else if ((typeof base === \"undefined\" ? \"undefined\" : _typeof(base)) === \"object\") {\n\t\t\t\tcfi.base = base;\n\t\t\t}\n\n\t\t\tcfi.path = this.pathTo(anchor, null, ignoreClass);\n\n\t\t\treturn cfi;\n\t\t}\n\t}, {\n\t\tkey: \"filter\",\n\t\tvalue: function filter(anchor, ignoreClass) {\n\t\t\tvar needsIgnoring;\n\t\t\tvar sibling; // to join with\n\t\t\tvar parent, previousSibling, nextSibling;\n\t\t\tvar isText = false;\n\n\t\t\tif (anchor.nodeType === TEXT_NODE) {\n\t\t\t\tisText = true;\n\t\t\t\tparent = anchor.parentNode;\n\t\t\t\tneedsIgnoring = anchor.parentNode.classList.contains(ignoreClass);\n\t\t\t} else {\n\t\t\t\tisText = false;\n\t\t\t\tneedsIgnoring = anchor.classList.contains(ignoreClass);\n\t\t\t}\n\n\t\t\tif (needsIgnoring && isText) {\n\t\t\t\tpreviousSibling = parent.previousSibling;\n\t\t\t\tnextSibling = parent.nextSibling;\n\n\t\t\t\t// If the sibling is a text node, join the nodes\n\t\t\t\tif (previousSibling && previousSibling.nodeType === TEXT_NODE) {\n\t\t\t\t\tsibling = previousSibling;\n\t\t\t\t} else if (nextSibling && nextSibling.nodeType === TEXT_NODE) {\n\t\t\t\t\tsibling = nextSibling;\n\t\t\t\t}\n\n\t\t\t\tif (sibling) {\n\t\t\t\t\treturn sibling;\n\t\t\t\t} else {\n\t\t\t\t\t// Parent will be ignored on next step\n\t\t\t\t\treturn anchor;\n\t\t\t\t}\n\t\t\t} else if (needsIgnoring && !isText) {\n\t\t\t\t// Otherwise just skip the element node\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\t// No need to filter\n\t\t\t\treturn anchor;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"patchOffset\",\n\t\tvalue: function patchOffset(anchor, offset, ignoreClass) {\n\t\t\tif (anchor.nodeType != TEXT_NODE) {\n\t\t\t\tthrow new Error(\"Anchor must be a text node\");\n\t\t\t}\n\n\t\t\tvar curr = anchor;\n\t\t\tvar totalOffset = offset;\n\n\t\t\t// If the parent is a ignored node, get offset from it's start\n\t\t\tif (anchor.parentNode.classList.contains(ignoreClass)) {\n\t\t\t\tcurr = anchor.parentNode;\n\t\t\t}\n\n\t\t\twhile (curr.previousSibling) {\n\t\t\t\tif (curr.previousSibling.nodeType === ELEMENT_NODE) {\n\t\t\t\t\t// Originally a text node, so join\n\t\t\t\t\tif (curr.previousSibling.classList.contains(ignoreClass)) {\n\t\t\t\t\t\ttotalOffset += curr.previousSibling.textContent.length;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak; // Normal node, dont join\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If the previous sibling is a text node, join the nodes\n\t\t\t\t\ttotalOffset += curr.previousSibling.textContent.length;\n\t\t\t\t}\n\n\t\t\t\tcurr = curr.previousSibling;\n\t\t\t}\n\n\t\t\treturn totalOffset;\n\t\t}\n\t}, {\n\t\tkey: \"normalizedMap\",\n\t\tvalue: function normalizedMap(children, nodeType, ignoreClass) {\n\t\t\tvar output = {};\n\t\t\tvar prevIndex = -1;\n\t\t\tvar i,\n\t\t\t len = children.length;\n\t\t\tvar currNodeType;\n\t\t\tvar prevNodeType;\n\n\t\t\tfor (i = 0; i < len; i++) {\n\n\t\t\t\tcurrNodeType = children[i].nodeType;\n\n\t\t\t\t// Check if needs ignoring\n\t\t\t\tif (currNodeType === ELEMENT_NODE && children[i].classList.contains(ignoreClass)) {\n\t\t\t\t\tcurrNodeType = TEXT_NODE;\n\t\t\t\t}\n\n\t\t\t\tif (i > 0 && currNodeType === TEXT_NODE && prevNodeType === TEXT_NODE) {\n\t\t\t\t\t// join text nodes\n\t\t\t\t\toutput[i] = prevIndex;\n\t\t\t\t} else if (nodeType === currNodeType) {\n\t\t\t\t\tprevIndex = prevIndex + 1;\n\t\t\t\t\toutput[i] = prevIndex;\n\t\t\t\t}\n\n\t\t\t\tprevNodeType = currNodeType;\n\t\t\t}\n\n\t\t\treturn output;\n\t\t}\n\t}, {\n\t\tkey: \"position\",\n\t\tvalue: function position(anchor) {\n\t\t\tvar children, index;\n\t\t\tif (anchor.nodeType === ELEMENT_NODE) {\n\t\t\t\tchildren = anchor.parentNode.children;\n\t\t\t\tif (!children) {\n\t\t\t\t\tchildren = (0, _core.findChildren)(anchor.parentNode);\n\t\t\t\t}\n\t\t\t\tindex = Array.prototype.indexOf.call(children, anchor);\n\t\t\t} else {\n\t\t\t\tchildren = this.textNodes(anchor.parentNode);\n\t\t\t\tindex = children.indexOf(anchor);\n\t\t\t}\n\n\t\t\treturn index;\n\t\t}\n\t}, {\n\t\tkey: \"filteredPosition\",\n\t\tvalue: function filteredPosition(anchor, ignoreClass) {\n\t\t\tvar children, index, map;\n\n\t\t\tif (anchor.nodeType === ELEMENT_NODE) {\n\t\t\t\tchildren = anchor.parentNode.children;\n\t\t\t\tmap = this.normalizedMap(children, ELEMENT_NODE, ignoreClass);\n\t\t\t} else {\n\t\t\t\tchildren = anchor.parentNode.childNodes;\n\t\t\t\t// Inside an ignored node\n\t\t\t\tif (anchor.parentNode.classList.contains(ignoreClass)) {\n\t\t\t\t\tanchor = anchor.parentNode;\n\t\t\t\t\tchildren = anchor.parentNode.childNodes;\n\t\t\t\t}\n\t\t\t\tmap = this.normalizedMap(children, TEXT_NODE, ignoreClass);\n\t\t\t}\n\n\t\t\tindex = Array.prototype.indexOf.call(children, anchor);\n\n\t\t\treturn map[index];\n\t\t}\n\t}, {\n\t\tkey: \"stepsToXpath\",\n\t\tvalue: function stepsToXpath(steps) {\n\t\t\tvar xpath = [\".\", \"*\"];\n\n\t\t\tsteps.forEach(function (step) {\n\t\t\t\tvar position = step.index + 1;\n\n\t\t\t\tif (step.id) {\n\t\t\t\t\txpath.push(\"*[position()=\" + position + \" and @id='\" + step.id + \"']\");\n\t\t\t\t} else if (step.type === \"text\") {\n\t\t\t\t\txpath.push(\"text()[\" + position + \"]\");\n\t\t\t\t} else {\n\t\t\t\t\txpath.push(\"*[\" + position + \"]\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn xpath.join(\"/\");\n\t\t}\n\n\t\t/*\n \tTo get the last step if needed:\n \t// Get the terminal step\n lastStep = steps[steps.length-1];\n // Get the query string\n query = this.stepsToQuery(steps);\n // Find the containing element\n startContainerParent = doc.querySelector(query);\n // Find the text node within that element\n if(startContainerParent && lastStep.type == \"text\") {\n \tcontainer = startContainerParent.childNodes[lastStep.index];\n }\n */\n\n\t}, {\n\t\tkey: \"stepsToQuerySelector\",\n\t\tvalue: function stepsToQuerySelector(steps) {\n\t\t\tvar query = [\"html\"];\n\n\t\t\tsteps.forEach(function (step) {\n\t\t\t\tvar position = step.index + 1;\n\n\t\t\t\tif (step.id) {\n\t\t\t\t\tquery.push(\"#\" + step.id);\n\t\t\t\t} else if (step.type === \"text\") {\n\t\t\t\t\t// unsupported in querySelector\n\t\t\t\t\t// query.push(\"text()[\" + position + \"]\");\n\t\t\t\t} else {\n\t\t\t\t\tquery.push(\"*:nth-child(\" + position + \")\");\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn query.join(\">\");\n\t\t}\n\t}, {\n\t\tkey: \"textNodes\",\n\t\tvalue: function textNodes(container, ignoreClass) {\n\t\t\treturn Array.prototype.slice.call(container.childNodes).filter(function (node) {\n\t\t\t\tif (node.nodeType === TEXT_NODE) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else if (ignoreClass && node.classList.contains(ignoreClass)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"walkToNode\",\n\t\tvalue: function walkToNode(steps, _doc, ignoreClass) {\n\t\t\tvar doc = _doc || document;\n\t\t\tvar container = doc.documentElement;\n\t\t\tvar children;\n\t\t\tvar step;\n\t\t\tvar len = steps.length;\n\t\t\tvar i;\n\n\t\t\tfor (i = 0; i < len; i++) {\n\t\t\t\tstep = steps[i];\n\n\t\t\t\tif (step.type === \"element\") {\n\t\t\t\t\t//better to get a container using id as some times step.index may not be correct\n\t\t\t\t\t//For ex.https://github.com/futurepress/epub.js/issues/561\n\t\t\t\t\tif (step.id) {\n\t\t\t\t\t\tcontainer = doc.getElementById(step.id);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tchildren = container.children || (0, _core.findChildren)(container);\n\t\t\t\t\t\tcontainer = children[step.index];\n\t\t\t\t\t}\n\t\t\t\t} else if (step.type === \"text\") {\n\t\t\t\t\tcontainer = this.textNodes(container, ignoreClass)[step.index];\n\t\t\t\t}\n\t\t\t\tif (!container) {\n\t\t\t\t\t//Break the for loop as due to incorrect index we can get error if\n\t\t\t\t\t//container is undefined so that other functionailties works fine\n\t\t\t\t\t//like navigation\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn container;\n\t\t}\n\t}, {\n\t\tkey: \"findNode\",\n\t\tvalue: function findNode(steps, _doc, ignoreClass) {\n\t\t\tvar doc = _doc || document;\n\t\t\tvar container;\n\t\t\tvar xpath;\n\n\t\t\tif (!ignoreClass && typeof doc.evaluate != \"undefined\") {\n\t\t\t\txpath = this.stepsToXpath(steps);\n\t\t\t\tcontainer = doc.evaluate(xpath, doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;\n\t\t\t} else if (ignoreClass) {\n\t\t\t\tcontainer = this.walkToNode(steps, doc, ignoreClass);\n\t\t\t} else {\n\t\t\t\tcontainer = this.walkToNode(steps, doc);\n\t\t\t}\n\n\t\t\treturn container;\n\t\t}\n\t}, {\n\t\tkey: \"fixMiss\",\n\t\tvalue: function fixMiss(steps, offset, _doc, ignoreClass) {\n\t\t\tvar container = this.findNode(steps.slice(0, -1), _doc, ignoreClass);\n\t\t\tvar children = container.childNodes;\n\t\t\tvar map = this.normalizedMap(children, TEXT_NODE, ignoreClass);\n\t\t\tvar child;\n\t\t\tvar len;\n\t\t\tvar lastStepIndex = steps[steps.length - 1].index;\n\n\t\t\tfor (var childIndex in map) {\n\t\t\t\tif (!map.hasOwnProperty(childIndex)) return;\n\n\t\t\t\tif (map[childIndex] === lastStepIndex) {\n\t\t\t\t\tchild = children[childIndex];\n\t\t\t\t\tlen = child.textContent.length;\n\t\t\t\t\tif (offset > len) {\n\t\t\t\t\t\toffset = offset - len;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (child.nodeType === ELEMENT_NODE) {\n\t\t\t\t\t\t\tcontainer = child.childNodes[0];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontainer = child;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontainer: container,\n\t\t\t\toffset: offset\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Creates a DOM range representing a CFI\n * @param {document} _doc document referenced in the base\n * @param {string} [ignoreClass]\n * @return {Range}\n */\n\n\t}, {\n\t\tkey: \"toRange\",\n\t\tvalue: function toRange(_doc, ignoreClass) {\n\t\t\tvar doc = _doc || document;\n\t\t\tvar range;\n\t\t\tvar start, end, startContainer, endContainer;\n\t\t\tvar cfi = this;\n\t\t\tvar startSteps, endSteps;\n\t\t\tvar needsIgnoring = ignoreClass ? doc.querySelector(\".\" + ignoreClass) != null : false;\n\t\t\tvar missed;\n\n\t\t\tif (typeof doc.createRange !== \"undefined\") {\n\t\t\t\trange = doc.createRange();\n\t\t\t} else {\n\t\t\t\trange = new _core.RangeObject();\n\t\t\t}\n\n\t\t\tif (cfi.range) {\n\t\t\t\tstart = cfi.start;\n\t\t\t\tstartSteps = cfi.path.steps.concat(start.steps);\n\t\t\t\tstartContainer = this.findNode(startSteps, doc, needsIgnoring ? ignoreClass : null);\n\t\t\t\tend = cfi.end;\n\t\t\t\tendSteps = cfi.path.steps.concat(end.steps);\n\t\t\t\tendContainer = this.findNode(endSteps, doc, needsIgnoring ? ignoreClass : null);\n\t\t\t} else {\n\t\t\t\tstart = cfi.path;\n\t\t\t\tstartSteps = cfi.path.steps;\n\t\t\t\tstartContainer = this.findNode(cfi.path.steps, doc, needsIgnoring ? ignoreClass : null);\n\t\t\t}\n\n\t\t\tif (startContainer) {\n\t\t\t\ttry {\n\n\t\t\t\t\tif (start.terminal.offset != null) {\n\t\t\t\t\t\trange.setStart(startContainer, start.terminal.offset);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trange.setStart(startContainer, 0);\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tmissed = this.fixMiss(startSteps, start.terminal.offset, doc, needsIgnoring ? ignoreClass : null);\n\t\t\t\t\trange.setStart(missed.container, missed.offset);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconsole.log(\"No startContainer found for\", this.toString());\n\t\t\t\t// No start found\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (endContainer) {\n\t\t\t\ttry {\n\n\t\t\t\t\tif (end.terminal.offset != null) {\n\t\t\t\t\t\trange.setEnd(endContainer, end.terminal.offset);\n\t\t\t\t\t} else {\n\t\t\t\t\t\trange.setEnd(endContainer, 0);\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tmissed = this.fixMiss(endSteps, cfi.end.terminal.offset, doc, needsIgnoring ? ignoreClass : null);\n\t\t\t\t\trange.setEnd(missed.container, missed.offset);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// doc.defaultView.getSelection().addRange(range);\n\t\t\treturn range;\n\t\t}\n\n\t\t/**\n * Check if a string is wrapped with \"epubcfi()\"\n * @param {string} str\n * @returns {boolean}\n */\n\n\t}, {\n\t\tkey: \"isCfiString\",\n\t\tvalue: function isCfiString(str) {\n\t\t\tif (typeof str === \"string\" && str.indexOf(\"epubcfi(\") === 0 && str[str.length - 1] === \")\") {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}, {\n\t\tkey: \"generateChapterComponent\",\n\t\tvalue: function generateChapterComponent(_spineNodeIndex, _pos, id) {\n\t\t\tvar pos = parseInt(_pos),\n\t\t\t spineNodeIndex = (_spineNodeIndex + 1) * 2,\n\t\t\t cfi = \"/\" + spineNodeIndex + \"/\";\n\n\t\t\tcfi += (pos + 1) * 2;\n\n\t\t\tif (id) {\n\t\t\t\tcfi += \"[\" + id + \"]\";\n\t\t\t}\n\n\t\t\treturn cfi;\n\t\t}\n\n\t\t/**\n * Collapse a CFI Range to a single CFI Position\n * @param {boolean} [toStart=false]\n */\n\n\t}, {\n\t\tkey: \"collapse\",\n\t\tvalue: function collapse(toStart) {\n\t\t\tif (!this.range) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.range = false;\n\n\t\t\tif (toStart) {\n\t\t\t\tthis.path.steps = this.path.steps.concat(this.start.steps);\n\t\t\t\tthis.path.terminal = this.start.terminal;\n\t\t\t} else {\n\t\t\t\tthis.path.steps = this.path.steps.concat(this.end.steps);\n\t\t\t\tthis.path.terminal = this.end.terminal;\n\t\t\t}\n\t\t}\n\t}]);\n\n\treturn EpubCFI;\n}();\n\nexports.default = EpubCFI;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/epubcfi.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/index.js": -/*!******************************************!*\ - !*** ./node_modules/epubjs/lib/index.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.Layout = exports.Contents = exports.Rendition = exports.EpubCFI = exports.Book = undefined;\n\nvar _book = __webpack_require__(/*! ./book */ \"./node_modules/epubjs/lib/book.js\");\n\nvar _book2 = _interopRequireDefault(_book);\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _rendition = __webpack_require__(/*! ./rendition */ \"./node_modules/epubjs/lib/rendition.js\");\n\nvar _rendition2 = _interopRequireDefault(_rendition);\n\nvar _contents = __webpack_require__(/*! ./contents */ \"./node_modules/epubjs/lib/contents.js\");\n\nvar _contents2 = _interopRequireDefault(_contents);\n\nvar _layout = __webpack_require__(/*! ./layout */ \"./node_modules/epubjs/lib/layout.js\");\n\nvar _layout2 = _interopRequireDefault(_layout);\n\nvar _epub = __webpack_require__(/*! ./epub */ \"./node_modules/epubjs/lib/epub.js\");\n\nvar _epub2 = _interopRequireDefault(_epub);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = _epub2.default;\nexports.Book = _book2.default;\nexports.EpubCFI = _epubcfi2.default;\nexports.Rendition = _rendition2.default;\nexports.Contents = _contents2.default;\nexports.Layout = _layout2.default;\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/index.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/layout.js": -/*!*******************************************!*\ - !*** ./node_modules/epubjs/lib/layout.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Figures out the CSS values to apply for a layout\n * @class\n * @param {object} settings\n * @param {string} [settings.layout='reflowable']\n * @param {string} [settings.spread]\n * @param {number} [settings.minSpreadWidth=800]\n * @param {boolean} [settings.evenSpreads=false]\n */\nvar Layout = function () {\n\tfunction Layout(settings) {\n\t\t_classCallCheck(this, Layout);\n\n\t\tthis.settings = settings;\n\t\tthis.name = settings.layout || \"reflowable\";\n\t\tthis._spread = settings.spread === \"none\" ? false : true;\n\t\tthis._minSpreadWidth = settings.minSpreadWidth || 800;\n\t\tthis._evenSpreads = settings.evenSpreads || false;\n\n\t\tif (settings.flow === \"scrolled\" || settings.flow === \"scrolled-continuous\" || settings.flow === \"scrolled-doc\") {\n\t\t\tthis._flow = \"scrolled\";\n\t\t} else {\n\t\t\tthis._flow = \"paginated\";\n\t\t}\n\n\t\tthis.width = 0;\n\t\tthis.height = 0;\n\t\tthis.spreadWidth = 0;\n\t\tthis.delta = 0;\n\n\t\tthis.columnWidth = 0;\n\t\tthis.gap = 0;\n\t\tthis.divisor = 1;\n\n\t\tthis.props = {\n\t\t\tname: this.name,\n\t\t\tspread: this._spread,\n\t\t\tflow: this._flow,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tspreadWidth: 0,\n\t\t\tdelta: 0,\n\t\t\tcolumnWidth: 0,\n\t\t\tgap: 0,\n\t\t\tdivisor: 1\n\t\t};\n\t}\n\n\t/**\n * Switch the flow between paginated and scrolled\n * @param {string} flow paginated | scrolled\n * @return {string} simplified flow\n */\n\n\n\t_createClass(Layout, [{\n\t\tkey: \"flow\",\n\t\tvalue: function flow(_flow) {\n\t\t\tif (typeof _flow != \"undefined\") {\n\t\t\t\tif (_flow === \"scrolled\" || _flow === \"scrolled-continuous\" || _flow === \"scrolled-doc\") {\n\t\t\t\t\tthis._flow = \"scrolled\";\n\t\t\t\t} else {\n\t\t\t\t\tthis._flow = \"paginated\";\n\t\t\t\t}\n\t\t\t\t// this.props.flow = this._flow;\n\t\t\t\tthis.update({ flow: this._flow });\n\t\t\t}\n\t\t\treturn this._flow;\n\t\t}\n\n\t\t/**\n * Switch between using spreads or not, and set the\n * width at which they switch to single.\n * @param {string} spread \"none\" | \"always\" | \"auto\"\n * @param {number} min integer in pixels\n * @return {boolean} spread true | false\n */\n\n\t}, {\n\t\tkey: \"spread\",\n\t\tvalue: function spread(_spread, min) {\n\n\t\t\tif (_spread) {\n\t\t\t\tthis._spread = _spread === \"none\" ? false : true;\n\t\t\t\t// this.props.spread = this._spread;\n\t\t\t\tthis.update({ spread: this._spread });\n\t\t\t}\n\n\t\t\tif (min >= 0) {\n\t\t\t\tthis._minSpreadWidth = min;\n\t\t\t}\n\n\t\t\treturn this._spread;\n\t\t}\n\n\t\t/**\n * Calculate the dimensions of the pagination\n * @param {number} _width width of the rendering\n * @param {number} _height height of the rendering\n * @param {number} _gap width of the gap between columns\n */\n\n\t}, {\n\t\tkey: \"calculate\",\n\t\tvalue: function calculate(_width, _height, _gap) {\n\n\t\t\tvar divisor = 1;\n\t\t\tvar gap = _gap || 0;\n\n\t\t\t//-- Check the width and create even width columns\n\t\t\t// var fullWidth = Math.floor(_width);\n\t\t\tvar width = _width;\n\t\t\tvar height = _height;\n\n\t\t\tvar section = Math.floor(width / 12);\n\n\t\t\tvar columnWidth;\n\t\t\tvar spreadWidth;\n\t\t\tvar pageWidth;\n\t\t\tvar delta;\n\n\t\t\tif (this._spread && width >= this._minSpreadWidth) {\n\t\t\t\tdivisor = 2;\n\t\t\t} else {\n\t\t\t\tdivisor = 1;\n\t\t\t}\n\n\t\t\tif (this.name === \"reflowable\" && this._flow === \"paginated\" && !(_gap >= 0)) {\n\t\t\t\tgap = section % 2 === 0 ? section : section - 1;\n\t\t\t}\n\n\t\t\tif (this.name === \"pre-paginated\") {\n\t\t\t\tgap = 0;\n\t\t\t}\n\n\t\t\t//-- Double Page\n\t\t\tif (divisor > 1) {\n\t\t\t\t// width = width - gap;\n\t\t\t\t// columnWidth = (width - gap) / divisor;\n\t\t\t\t// gap = gap / divisor;\n\t\t\t\tcolumnWidth = width / divisor - gap;\n\t\t\t\tpageWidth = columnWidth + gap;\n\t\t\t} else {\n\t\t\t\tcolumnWidth = width;\n\t\t\t\tpageWidth = width;\n\t\t\t}\n\n\t\t\tif (this.name === \"pre-paginated\" && divisor > 1) {\n\t\t\t\twidth = columnWidth;\n\t\t\t}\n\n\t\t\tspreadWidth = columnWidth * divisor + gap;\n\n\t\t\tdelta = width;\n\n\t\t\tthis.width = width;\n\t\t\tthis.height = height;\n\t\t\tthis.spreadWidth = spreadWidth;\n\t\t\tthis.pageWidth = pageWidth;\n\t\t\tthis.delta = delta;\n\n\t\t\tthis.columnWidth = columnWidth;\n\t\t\tthis.gap = gap;\n\t\t\tthis.divisor = divisor;\n\n\t\t\t// this.props.width = width;\n\t\t\t// this.props.height = _height;\n\t\t\t// this.props.spreadWidth = spreadWidth;\n\t\t\t// this.props.pageWidth = pageWidth;\n\t\t\t// this.props.delta = delta;\n\t\t\t//\n\t\t\t// this.props.columnWidth = colWidth;\n\t\t\t// this.props.gap = gap;\n\t\t\t// this.props.divisor = divisor;\n\n\t\t\tthis.update({\n\t\t\t\twidth: width,\n\t\t\t\theight: height,\n\t\t\t\tspreadWidth: spreadWidth,\n\t\t\t\tpageWidth: pageWidth,\n\t\t\t\tdelta: delta,\n\t\t\t\tcolumnWidth: columnWidth,\n\t\t\t\tgap: gap,\n\t\t\t\tdivisor: divisor\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Apply Css to a Document\n * @param {Contents} contents\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"format\",\n\t\tvalue: function format(contents) {\n\t\t\tvar formating;\n\n\t\t\tif (this.name === \"pre-paginated\") {\n\t\t\t\tformating = contents.fit(this.columnWidth, this.height);\n\t\t\t} else if (this._flow === \"paginated\") {\n\t\t\t\tformating = contents.columns(this.width, this.height, this.columnWidth, this.gap);\n\t\t\t} else {\n\t\t\t\t// scrolled\n\t\t\t\tformating = contents.size(this.width, null);\n\t\t\t}\n\n\t\t\treturn formating; // might be a promise in some View Managers\n\t\t}\n\n\t\t/**\n * Count number of pages\n * @param {number} totalLength\n * @param {number} pageLength\n * @return {{spreads: Number, pages: Number}}\n */\n\n\t}, {\n\t\tkey: \"count\",\n\t\tvalue: function count(totalLength, pageLength) {\n\n\t\t\tvar spreads = void 0,\n\t\t\t pages = void 0;\n\n\t\t\tif (this.name === \"pre-paginated\") {\n\t\t\t\tspreads = 1;\n\t\t\t\tpages = 1;\n\t\t\t} else if (this._flow === \"paginated\") {\n\t\t\t\tpageLength = pageLength || this.delta;\n\t\t\t\tspreads = Math.ceil(totalLength / pageLength);\n\t\t\t\tpages = spreads * this.divisor;\n\t\t\t} else {\n\t\t\t\t// scrolled\n\t\t\t\tpageLength = pageLength || this.height;\n\t\t\t\tspreads = Math.ceil(totalLength / pageLength);\n\t\t\t\tpages = spreads;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tspreads: spreads,\n\t\t\t\tpages: pages\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Update props that have changed\n * @private\n * @param {object} props\n */\n\n\t}, {\n\t\tkey: \"update\",\n\t\tvalue: function update(props) {\n\t\t\tvar _this = this;\n\n\t\t\t// Remove props that haven't changed\n\t\t\tObject.keys(props).forEach(function (propName) {\n\t\t\t\tif (_this.props[propName] === props[propName]) {\n\t\t\t\t\tdelete props[propName];\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (Object.keys(props).length > 0) {\n\t\t\t\tvar newProps = (0, _core.extend)(this.props, props);\n\t\t\t\tthis.emit(_constants.EVENTS.LAYOUT.UPDATED, newProps, props);\n\t\t\t}\n\t\t}\n\t}]);\n\n\treturn Layout;\n}();\n\n(0, _eventEmitter2.default)(Layout.prototype);\n\nexports.default = Layout;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/layout.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/locations.js": -/*!**********************************************!*\ - !*** ./node_modules/epubjs/lib/locations.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _queue = __webpack_require__(/*! ./utils/queue */ \"./node_modules/epubjs/lib/utils/queue.js\");\n\nvar _queue2 = _interopRequireDefault(_queue);\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Find Locations for a Book\n * @param {Spine} spine\n * @param {request} request\n * @param {number} [pause=100]\n */\nvar Locations = function () {\n\tfunction Locations(spine, request, pause) {\n\t\t_classCallCheck(this, Locations);\n\n\t\tthis.spine = spine;\n\t\tthis.request = request;\n\t\tthis.pause = pause || 100;\n\n\t\tthis.q = new _queue2.default(this);\n\t\tthis.epubcfi = new _epubcfi2.default();\n\n\t\tthis._locations = [];\n\t\tthis.total = 0;\n\n\t\tthis.break = 150;\n\n\t\tthis._current = 0;\n\n\t\tthis.currentLocation = '';\n\t\tthis._currentCfi = '';\n\t\tthis.processingTimeout = undefined;\n\t}\n\n\t/**\n * Load all of sections in the book to generate locations\n * @param {int} chars how many chars to split on\n * @return {object} locations\n */\n\n\n\t_createClass(Locations, [{\n\t\tkey: \"generate\",\n\t\tvalue: function generate(chars) {\n\n\t\t\tif (chars) {\n\t\t\t\tthis.break = chars;\n\t\t\t}\n\n\t\t\tthis.q.pause();\n\n\t\t\tthis.spine.each(function (section) {\n\t\t\t\tif (section.linear) {\n\t\t\t\t\tthis.q.enqueue(this.process.bind(this), section);\n\t\t\t\t}\n\t\t\t}.bind(this));\n\n\t\t\treturn this.q.run().then(function () {\n\t\t\t\tthis.total = this._locations.length - 1;\n\n\t\t\t\tif (this._currentCfi) {\n\t\t\t\t\tthis.currentLocation = this._currentCfi;\n\t\t\t\t}\n\n\t\t\t\treturn this._locations;\n\t\t\t\t// console.log(this.percentage(this.book.rendition.location.start), this.percentage(this.book.rendition.location.end));\n\t\t\t}.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"createRange\",\n\t\tvalue: function createRange() {\n\t\t\treturn {\n\t\t\t\tstartContainer: undefined,\n\t\t\t\tstartOffset: undefined,\n\t\t\t\tendContainer: undefined,\n\t\t\t\tendOffset: undefined\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"process\",\n\t\tvalue: function process(section) {\n\n\t\t\treturn section.load(this.request).then(function (contents) {\n\t\t\t\tvar completed = new _core.defer();\n\t\t\t\tvar locations = this.parse(contents, section.cfiBase);\n\t\t\t\tthis._locations = this._locations.concat(locations);\n\n\t\t\t\tsection.unload();\n\n\t\t\t\tthis.processingTimeout = setTimeout(function () {\n\t\t\t\t\treturn completed.resolve(locations);\n\t\t\t\t}, this.pause);\n\t\t\t\treturn completed.promise;\n\t\t\t}.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"parse\",\n\t\tvalue: function parse(contents, cfiBase, chars) {\n\t\t\tvar locations = [];\n\t\t\tvar range;\n\t\t\tvar doc = contents.ownerDocument;\n\t\t\tvar body = (0, _core.qs)(doc, \"body\");\n\t\t\tvar counter = 0;\n\t\t\tvar prev;\n\t\t\tvar _break = chars || this.break;\n\t\t\tvar parser = function parser(node) {\n\t\t\t\tvar len = node.length;\n\t\t\t\tvar dist;\n\t\t\t\tvar pos = 0;\n\n\t\t\t\tif (node.textContent.trim().length === 0) {\n\t\t\t\t\treturn false; // continue\n\t\t\t\t}\n\n\t\t\t\t// Start range\n\t\t\t\tif (counter == 0) {\n\t\t\t\t\trange = this.createRange();\n\t\t\t\t\trange.startContainer = node;\n\t\t\t\t\trange.startOffset = 0;\n\t\t\t\t}\n\n\t\t\t\tdist = _break - counter;\n\n\t\t\t\t// Node is smaller than a break,\n\t\t\t\t// skip over it\n\t\t\t\tif (dist > len) {\n\t\t\t\t\tcounter += len;\n\t\t\t\t\tpos = len;\n\t\t\t\t}\n\n\t\t\t\twhile (pos < len) {\n\t\t\t\t\tdist = _break - counter;\n\n\t\t\t\t\tif (counter === 0) {\n\t\t\t\t\t\t// Start new range\n\t\t\t\t\t\tpos += 1;\n\t\t\t\t\t\trange = this.createRange();\n\t\t\t\t\t\trange.startContainer = node;\n\t\t\t\t\t\trange.startOffset = pos;\n\t\t\t\t\t}\n\n\t\t\t\t\t// pos += dist;\n\n\t\t\t\t\t// Gone over\n\t\t\t\t\tif (pos + dist >= len) {\n\t\t\t\t\t\t// Continue counter for next node\n\t\t\t\t\t\tcounter += len - pos;\n\t\t\t\t\t\t// break\n\t\t\t\t\t\tpos = len;\n\t\t\t\t\t\t// At End\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Advance pos\n\t\t\t\t\t\tpos += dist;\n\n\t\t\t\t\t\t// End the previous range\n\t\t\t\t\t\trange.endContainer = node;\n\t\t\t\t\t\trange.endOffset = pos;\n\t\t\t\t\t\t// cfi = section.cfiFromRange(range);\n\t\t\t\t\t\tvar cfi = new _epubcfi2.default(range, cfiBase).toString();\n\t\t\t\t\t\tlocations.push(cfi);\n\t\t\t\t\t\tcounter = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprev = node;\n\t\t\t};\n\n\t\t\t(0, _core.sprint)(body, parser.bind(this));\n\n\t\t\t// Close remaining\n\t\t\tif (range && range.startContainer && prev) {\n\t\t\t\trange.endContainer = prev;\n\t\t\t\trange.endOffset = prev.length;\n\t\t\t\tvar cfi = new _epubcfi2.default(range, cfiBase).toString();\n\t\t\t\tlocations.push(cfi);\n\t\t\t\tcounter = 0;\n\t\t\t}\n\n\t\t\treturn locations;\n\t\t}\n\n\t\t/**\n * Get a location from an EpubCFI\n * @param {EpubCFI} cfi\n * @return {number}\n */\n\n\t}, {\n\t\tkey: \"locationFromCfi\",\n\t\tvalue: function locationFromCfi(cfi) {\n\t\t\tvar loc = void 0;\n\t\t\tif (_epubcfi2.default.prototype.isCfiString(cfi)) {\n\t\t\t\tcfi = new _epubcfi2.default(cfi);\n\t\t\t}\n\t\t\t// Check if the location has not been set yet\n\t\t\tif (this._locations.length === 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tloc = (0, _core.locationOf)(cfi, this._locations, this.epubcfi.compare);\n\n\t\t\tif (loc > this.total) {\n\t\t\t\treturn this.total;\n\t\t\t}\n\n\t\t\treturn loc;\n\t\t}\n\n\t\t/**\n * Get a percentage position in locations from an EpubCFI\n * @param {EpubCFI} cfi\n * @return {number}\n */\n\n\t}, {\n\t\tkey: \"percentageFromCfi\",\n\t\tvalue: function percentageFromCfi(cfi) {\n\t\t\tif (this._locations.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\t// Find closest cfi\n\t\t\tvar loc = this.locationFromCfi(cfi);\n\t\t\t// Get percentage in total\n\t\t\treturn this.percentageFromLocation(loc);\n\t\t}\n\n\t\t/**\n * Get a percentage position from a location index\n * @param {number} location\n * @return {number}\n */\n\n\t}, {\n\t\tkey: \"percentageFromLocation\",\n\t\tvalue: function percentageFromLocation(loc) {\n\t\t\tif (!loc || !this.total) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\treturn loc / this.total;\n\t\t}\n\n\t\t/**\n * Get an EpubCFI from location index\n * @param {number} loc\n * @return {EpubCFI} cfi\n */\n\n\t}, {\n\t\tkey: \"cfiFromLocation\",\n\t\tvalue: function cfiFromLocation(loc) {\n\t\t\tvar cfi = -1;\n\t\t\t// check that pg is an int\n\t\t\tif (typeof loc != \"number\") {\n\t\t\t\tloc = parseInt(loc);\n\t\t\t}\n\n\t\t\tif (loc >= 0 && loc < this._locations.length) {\n\t\t\t\tcfi = this._locations[loc];\n\t\t\t}\n\n\t\t\treturn cfi;\n\t\t}\n\n\t\t/**\n * Get an EpubCFI from location percentage\n * @param {number} percentage\n * @return {EpubCFI} cfi\n */\n\n\t}, {\n\t\tkey: \"cfiFromPercentage\",\n\t\tvalue: function cfiFromPercentage(percentage) {\n\t\t\tvar loc = void 0;\n\t\t\tif (percentage > 1) {\n\t\t\t\tconsole.warn(\"Normalize cfiFromPercentage value to between 0 - 1\");\n\t\t\t}\n\n\t\t\t// Make sure 1 goes to very end\n\t\t\tif (percentage >= 1) {\n\t\t\t\tvar cfi = new _epubcfi2.default(this._locations[this.total]);\n\t\t\t\tcfi.collapse();\n\t\t\t\treturn cfi.toString();\n\t\t\t}\n\n\t\t\tloc = Math.ceil(this.total * percentage);\n\t\t\treturn this.cfiFromLocation(loc);\n\t\t}\n\n\t\t/**\n * Load locations from JSON\n * @param {json} locations\n */\n\n\t}, {\n\t\tkey: \"load\",\n\t\tvalue: function load(locations) {\n\t\t\tif (typeof locations === \"string\") {\n\t\t\t\tthis._locations = JSON.parse(locations);\n\t\t\t} else {\n\t\t\t\tthis._locations = locations;\n\t\t\t}\n\t\t\tthis.total = this._locations.length - 1;\n\t\t\treturn this._locations;\n\t\t}\n\n\t\t/**\n * Save locations to JSON\n * @return {json}\n */\n\n\t}, {\n\t\tkey: \"save\",\n\t\tvalue: function save() {\n\t\t\treturn JSON.stringify(this._locations);\n\t\t}\n\t}, {\n\t\tkey: \"getCurrent\",\n\t\tvalue: function getCurrent() {\n\t\t\treturn this._current;\n\t\t}\n\t}, {\n\t\tkey: \"setCurrent\",\n\t\tvalue: function setCurrent(curr) {\n\t\t\tvar loc;\n\n\t\t\tif (typeof curr == \"string\") {\n\t\t\t\tthis._currentCfi = curr;\n\t\t\t} else if (typeof curr == \"number\") {\n\t\t\t\tthis._current = curr;\n\t\t\t} else {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._locations.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof curr == \"string\") {\n\t\t\t\tloc = this.locationFromCfi(curr);\n\t\t\t\tthis._current = loc;\n\t\t\t} else {\n\t\t\t\tloc = curr;\n\t\t\t}\n\n\t\t\tthis.emit(_constants.EVENTS.LOCATIONS.CHANGED, {\n\t\t\t\tpercentage: this.percentageFromLocation(loc)\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Get the current location\n */\n\n\t}, {\n\t\tkey: \"length\",\n\n\n\t\t/**\n * Locations length\n */\n\t\tvalue: function length() {\n\t\t\treturn this._locations.length;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.spine = undefined;\n\t\t\tthis.request = undefined;\n\t\t\tthis.pause = undefined;\n\n\t\t\tthis.q.stop();\n\t\t\tthis.q = undefined;\n\t\t\tthis.epubcfi = undefined;\n\n\t\t\tthis._locations = undefined;\n\t\t\tthis.total = undefined;\n\n\t\t\tthis.break = undefined;\n\t\t\tthis._current = undefined;\n\n\t\t\tthis.currentLocation = undefined;\n\t\t\tthis._currentCfi = undefined;\n\t\t\tclearTimeout(this.processingTimeout);\n\t\t}\n\t}, {\n\t\tkey: \"currentLocation\",\n\t\tget: function get() {\n\t\t\treturn this._current;\n\t\t}\n\n\t\t/**\n * Set the current location\n */\n\t\t,\n\t\tset: function set(curr) {\n\t\t\tthis.setCurrent(curr);\n\t\t}\n\t}]);\n\n\treturn Locations;\n}();\n\n(0, _eventEmitter2.default)(Locations.prototype);\n\nexports.default = Locations;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/locations.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/managers/continuous/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/epubjs/lib/managers/continuous/index.js ***! - \**************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if (\"value\" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };\n\nvar _core = __webpack_require__(/*! ../../utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _default = __webpack_require__(/*! ../default */ \"./node_modules/epubjs/lib/managers/default/index.js\");\n\nvar _default2 = _interopRequireDefault(_default);\n\nvar _snap = __webpack_require__(/*! ../helpers/snap */ \"./node_modules/epubjs/lib/managers/helpers/snap.js\");\n\nvar _snap2 = _interopRequireDefault(_snap);\n\nvar _constants = __webpack_require__(/*! ../../utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _debounce = __webpack_require__(/*! lodash/debounce */ \"./node_modules/lodash/debounce.js\");\n\nvar _debounce2 = _interopRequireDefault(_debounce);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar ContinuousViewManager = function (_DefaultViewManager) {\n\t_inherits(ContinuousViewManager, _DefaultViewManager);\n\n\tfunction ContinuousViewManager(options) {\n\t\t_classCallCheck(this, ContinuousViewManager);\n\n\t\tvar _this = _possibleConstructorReturn(this, (ContinuousViewManager.__proto__ || Object.getPrototypeOf(ContinuousViewManager)).call(this, options));\n\n\t\t_this.name = \"continuous\";\n\n\t\t_this.settings = (0, _core.extend)(_this.settings || {}, {\n\t\t\tinfinite: true,\n\t\t\toverflow: undefined,\n\t\t\taxis: undefined,\n\t\t\tflow: \"scrolled\",\n\t\t\toffset: 500,\n\t\t\toffsetDelta: 250,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tsnap: false,\n\t\t\tafterScrolledTimeout: 10\n\t\t});\n\n\t\t(0, _core.extend)(_this.settings, options.settings || {});\n\n\t\t// Gap can be 0, but defaults doesn't handle that\n\t\tif (options.settings.gap != \"undefined\" && options.settings.gap === 0) {\n\t\t\t_this.settings.gap = options.settings.gap;\n\t\t}\n\n\t\t_this.viewSettings = {\n\t\t\tignoreClass: _this.settings.ignoreClass,\n\t\t\taxis: _this.settings.axis,\n\t\t\tflow: _this.settings.flow,\n\t\t\tlayout: _this.layout,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tforceEvenPages: false\n\t\t};\n\n\t\t_this.scrollTop = 0;\n\t\t_this.scrollLeft = 0;\n\t\treturn _this;\n\t}\n\n\t_createClass(ContinuousViewManager, [{\n\t\tkey: \"display\",\n\t\tvalue: function display(section, target) {\n\t\t\treturn _default2.default.prototype.display.call(this, section, target).then(function () {\n\t\t\t\treturn this.fill();\n\t\t\t}.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"fill\",\n\t\tvalue: function fill(_full) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar full = _full || new _core.defer();\n\n\t\t\tthis.q.enqueue(function () {\n\t\t\t\treturn _this2.check();\n\t\t\t}).then(function (result) {\n\t\t\t\tif (result) {\n\t\t\t\t\t_this2.fill(full);\n\t\t\t\t} else {\n\t\t\t\t\tfull.resolve();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn full.promise;\n\t\t}\n\t}, {\n\t\tkey: \"moveTo\",\n\t\tvalue: function moveTo(offset) {\n\t\t\t// var bounds = this.stage.bounds();\n\t\t\t// var dist = Math.floor(offset.top / bounds.height) * bounds.height;\n\t\t\tvar distX = 0,\n\t\t\t distY = 0;\n\n\t\t\tvar offsetX = 0,\n\t\t\t offsetY = 0;\n\n\t\t\tif (!this.isPaginated) {\n\t\t\t\tdistY = offset.top;\n\t\t\t\toffsetY = offset.top + this.settings.offsetDelta;\n\t\t\t} else {\n\t\t\t\tdistX = Math.floor(offset.left / this.layout.delta) * this.layout.delta;\n\t\t\t\toffsetX = distX + this.settings.offsetDelta;\n\t\t\t}\n\n\t\t\tif (distX > 0 || distY > 0) {\n\t\t\t\tthis.scrollBy(distX, distY, true);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"afterResized\",\n\t\tvalue: function afterResized(view) {\n\t\t\tthis.emit(_constants.EVENTS.MANAGERS.RESIZE, view.section);\n\t\t}\n\n\t\t// Remove Previous Listeners if present\n\n\t}, {\n\t\tkey: \"removeShownListeners\",\n\t\tvalue: function removeShownListeners(view) {\n\n\t\t\t// view.off(\"shown\", this.afterDisplayed);\n\t\t\t// view.off(\"shown\", this.afterDisplayedAbove);\n\t\t\tview.onDisplayed = function () {};\n\t\t}\n\t}, {\n\t\tkey: \"add\",\n\t\tvalue: function add(section) {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar view = this.createView(section);\n\n\t\t\tthis.views.append(view);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.RESIZED, function (bounds) {\n\t\t\t\tview.expanded = true;\n\t\t\t});\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.AXIS, function (axis) {\n\t\t\t\t_this3.updateAxis(axis);\n\t\t\t});\n\n\t\t\t// view.on(EVENTS.VIEWS.SHOWN, this.afterDisplayed.bind(this));\n\t\t\tview.onDisplayed = this.afterDisplayed.bind(this);\n\t\t\tview.onResize = this.afterResized.bind(this);\n\n\t\t\treturn view.display(this.request);\n\t\t}\n\t}, {\n\t\tkey: \"append\",\n\t\tvalue: function append(section) {\n\t\t\tvar _this4 = this;\n\n\t\t\tvar view = this.createView(section);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.RESIZED, function (bounds) {\n\t\t\t\tview.expanded = true;\n\t\t\t});\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.AXIS, function (axis) {\n\t\t\t\t_this4.updateAxis(axis);\n\t\t\t});\n\n\t\t\tthis.views.append(view);\n\n\t\t\tview.onDisplayed = this.afterDisplayed.bind(this);\n\n\t\t\treturn view;\n\t\t}\n\t}, {\n\t\tkey: \"prepend\",\n\t\tvalue: function prepend(section) {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar view = this.createView(section);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.RESIZED, function (bounds) {\n\t\t\t\t_this5.counter(bounds);\n\t\t\t\tview.expanded = true;\n\t\t\t});\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.AXIS, function (axis) {\n\t\t\t\t_this5.updateAxis(axis);\n\t\t\t});\n\n\t\t\tthis.views.prepend(view);\n\n\t\t\tview.onDisplayed = this.afterDisplayed.bind(this);\n\n\t\t\treturn view;\n\t\t}\n\t}, {\n\t\tkey: \"counter\",\n\t\tvalue: function counter(bounds) {\n\t\t\tif (this.settings.axis === \"vertical\") {\n\t\t\t\tthis.scrollBy(0, bounds.heightDelta, true);\n\t\t\t} else {\n\t\t\t\tthis.scrollBy(bounds.widthDelta, 0, true);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"update\",\n\t\tvalue: function update(_offset) {\n\t\t\tvar container = this.bounds();\n\t\t\tvar views = this.views.all();\n\t\t\tvar viewsLength = views.length;\n\t\t\tvar visible = [];\n\t\t\tvar offset = typeof _offset != \"undefined\" ? _offset : this.settings.offset || 0;\n\t\t\tvar isVisible;\n\t\t\tvar view;\n\n\t\t\tvar updating = new _core.defer();\n\t\t\tvar promises = [];\n\t\t\tfor (var i = 0; i < viewsLength; i++) {\n\t\t\t\tview = views[i];\n\n\t\t\t\tisVisible = this.isVisible(view, offset, offset, container);\n\n\t\t\t\tif (isVisible === true) {\n\t\t\t\t\t// console.log(\"visible \" + view.index);\n\n\t\t\t\t\tif (!view.displayed) {\n\t\t\t\t\t\tvar displayed = view.display(this.request).then(function (view) {\n\t\t\t\t\t\t\tview.show();\n\t\t\t\t\t\t}, function (err) {\n\t\t\t\t\t\t\tview.hide();\n\t\t\t\t\t\t});\n\t\t\t\t\t\tpromises.push(displayed);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tview.show();\n\t\t\t\t\t}\n\t\t\t\t\tvisible.push(view);\n\t\t\t\t} else {\n\t\t\t\t\tthis.q.enqueue(view.destroy.bind(view));\n\t\t\t\t\t// console.log(\"hidden \" + view.index);\n\n\t\t\t\t\tclearTimeout(this.trimTimeout);\n\t\t\t\t\tthis.trimTimeout = setTimeout(function () {\n\t\t\t\t\t\tthis.q.enqueue(this.trim.bind(this));\n\t\t\t\t\t}.bind(this), 250);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (promises.length) {\n\t\t\t\treturn Promise.all(promises).catch(function (err) {\n\t\t\t\t\tupdating.reject(err);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tupdating.resolve();\n\t\t\t\treturn updating.promise;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"check\",\n\t\tvalue: function check(_offsetLeft, _offsetTop) {\n\t\t\tvar _this6 = this;\n\n\t\t\tvar checking = new _core.defer();\n\t\t\tvar newViews = [];\n\n\t\t\tvar horizontal = this.settings.axis === \"horizontal\";\n\t\t\tvar delta = this.settings.offset || 0;\n\n\t\t\tif (_offsetLeft && horizontal) {\n\t\t\t\tdelta = _offsetLeft;\n\t\t\t}\n\n\t\t\tif (_offsetTop && !horizontal) {\n\t\t\t\tdelta = _offsetTop;\n\t\t\t}\n\n\t\t\tvar bounds = this._bounds; // bounds saved this until resize\n\n\t\t\tvar rtl = this.settings.direction === \"rtl\";\n\t\t\tvar dir = horizontal && rtl ? -1 : 1; //RTL reverses scrollTop\n\n\t\t\tvar offset = horizontal ? this.scrollLeft : this.scrollTop * dir;\n\t\t\tvar visibleLength = horizontal ? Math.floor(bounds.width) : bounds.height;\n\t\t\tvar contentLength = horizontal ? this.container.scrollWidth : this.container.scrollHeight;\n\n\t\t\tvar prepend = function prepend() {\n\t\t\t\tvar first = _this6.views.first();\n\t\t\t\tvar prev = first && first.section.prev();\n\n\t\t\t\tif (prev) {\n\t\t\t\t\tnewViews.push(_this6.prepend(prev));\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar append = function append() {\n\t\t\t\tvar last = _this6.views.last();\n\t\t\t\tvar next = last && last.section.next();\n\n\t\t\t\tif (next) {\n\t\t\t\t\tnewViews.push(_this6.append(next));\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (offset + visibleLength + delta >= contentLength) {\n\t\t\t\tif (horizontal && rtl) {\n\t\t\t\t\tprepend();\n\t\t\t\t} else {\n\t\t\t\t\tappend();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (offset - delta < 0) {\n\t\t\t\tif (horizontal && rtl) {\n\t\t\t\t\tappend();\n\t\t\t\t} else {\n\t\t\t\t\tprepend();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar promises = newViews.map(function (view) {\n\t\t\t\treturn view.displayed;\n\t\t\t});\n\n\t\t\tif (newViews.length) {\n\t\t\t\treturn Promise.all(promises).then(function () {\n\t\t\t\t\tif (_this6.layout.name === \"pre-paginated\" && _this6.layout.props.spread) {\n\t\t\t\t\t\treturn _this6.check();\n\t\t\t\t\t}\n\t\t\t\t}).then(function () {\n\t\t\t\t\t// Check to see if anything new is on screen after rendering\n\t\t\t\t\treturn _this6.update(delta);\n\t\t\t\t}, function (err) {\n\t\t\t\t\treturn err;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.q.enqueue(function () {\n\t\t\t\t\tthis.update();\n\t\t\t\t}.bind(this));\n\t\t\t\tchecking.resolve(false);\n\t\t\t\treturn checking.promise;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"trim\",\n\t\tvalue: function trim() {\n\t\t\tvar task = new _core.defer();\n\t\t\tvar displayed = this.views.displayed();\n\t\t\tvar first = displayed[0];\n\t\t\tvar last = displayed[displayed.length - 1];\n\t\t\tvar firstIndex = this.views.indexOf(first);\n\t\t\tvar lastIndex = this.views.indexOf(last);\n\t\t\tvar above = this.views.slice(0, firstIndex);\n\t\t\tvar below = this.views.slice(lastIndex + 1);\n\n\t\t\t// Erase all but last above\n\t\t\tfor (var i = 0; i < above.length - 1; i++) {\n\t\t\t\tthis.erase(above[i], above);\n\t\t\t}\n\n\t\t\t// Erase all except first below\n\t\t\tfor (var j = 1; j < below.length; j++) {\n\t\t\t\tthis.erase(below[j]);\n\t\t\t}\n\n\t\t\ttask.resolve();\n\t\t\treturn task.promise;\n\t\t}\n\t}, {\n\t\tkey: \"erase\",\n\t\tvalue: function erase(view, above) {\n\t\t\t//Trim\n\n\t\t\tvar prevTop;\n\t\t\tvar prevLeft;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tprevTop = this.container.scrollTop;\n\t\t\t\tprevLeft = this.container.scrollLeft;\n\t\t\t} else {\n\t\t\t\tprevTop = window.scrollY;\n\t\t\t\tprevLeft = window.scrollX;\n\t\t\t}\n\n\t\t\tvar bounds = view.bounds();\n\n\t\t\tthis.views.remove(view);\n\n\t\t\tif (above) {\n\t\t\t\tif (this.settings.axis === \"vertical\") {\n\t\t\t\t\tthis.scrollTo(0, prevTop - bounds.height, true);\n\t\t\t\t} else {\n\t\t\t\t\tthis.scrollTo(prevLeft - Math.floor(bounds.width), 0, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"addEventListeners\",\n\t\tvalue: function addEventListeners(stage) {\n\n\t\t\twindow.addEventListener(\"unload\", function (e) {\n\t\t\t\tthis.ignore = true;\n\t\t\t\t// this.scrollTo(0,0);\n\t\t\t\tthis.destroy();\n\t\t\t}.bind(this));\n\n\t\t\tthis.addScrollListeners();\n\n\t\t\tif (this.isPaginated && this.settings.snap) {\n\t\t\t\tthis.snapper = new _snap2.default(this, this.settings.snap && _typeof(this.settings.snap) === \"object\" && this.settings.snap);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"addScrollListeners\",\n\t\tvalue: function addScrollListeners() {\n\t\t\tvar scroller;\n\n\t\t\tthis.tick = _core.requestAnimationFrame;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tthis.prevScrollTop = this.container.scrollTop;\n\t\t\t\tthis.prevScrollLeft = this.container.scrollLeft;\n\t\t\t} else {\n\t\t\t\tthis.prevScrollTop = window.scrollY;\n\t\t\t\tthis.prevScrollLeft = window.scrollX;\n\t\t\t}\n\n\t\t\tthis.scrollDeltaVert = 0;\n\t\t\tthis.scrollDeltaHorz = 0;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tscroller = this.container;\n\t\t\t\tthis.scrollTop = this.container.scrollTop;\n\t\t\t\tthis.scrollLeft = this.container.scrollLeft;\n\t\t\t} else {\n\t\t\t\tscroller = window;\n\t\t\t\tthis.scrollTop = window.scrollY;\n\t\t\t\tthis.scrollLeft = window.scrollX;\n\t\t\t}\n\n\t\t\tthis._onScroll = this.onScroll.bind(this);\n\t\t\tscroller.addEventListener(\"scroll\", this._onScroll);\n\t\t\tthis._scrolled = (0, _debounce2.default)(this.scrolled.bind(this), 30);\n\t\t\t// this.tick.call(window, this.onScroll.bind(this));\n\n\t\t\tthis.didScroll = false;\n\t\t}\n\t}, {\n\t\tkey: \"removeEventListeners\",\n\t\tvalue: function removeEventListeners() {\n\t\t\tvar scroller;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tscroller = this.container;\n\t\t\t} else {\n\t\t\t\tscroller = window;\n\t\t\t}\n\n\t\t\tscroller.removeEventListener(\"scroll\", this._onScroll);\n\t\t\tthis._onScroll = undefined;\n\t\t}\n\t}, {\n\t\tkey: \"onScroll\",\n\t\tvalue: function onScroll() {\n\t\t\tvar scrollTop = void 0;\n\t\t\tvar scrollLeft = void 0;\n\t\t\tvar dir = this.settings.direction === \"rtl\" ? -1 : 1;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tscrollTop = this.container.scrollTop;\n\t\t\t\tscrollLeft = this.container.scrollLeft;\n\t\t\t} else {\n\t\t\t\tscrollTop = window.scrollY * dir;\n\t\t\t\tscrollLeft = window.scrollX * dir;\n\t\t\t}\n\n\t\t\tthis.scrollTop = scrollTop;\n\t\t\tthis.scrollLeft = scrollLeft;\n\n\t\t\tif (!this.ignore) {\n\n\t\t\t\tthis._scrolled();\n\t\t\t} else {\n\t\t\t\tthis.ignore = false;\n\t\t\t}\n\n\t\t\tthis.scrollDeltaVert += Math.abs(scrollTop - this.prevScrollTop);\n\t\t\tthis.scrollDeltaHorz += Math.abs(scrollLeft - this.prevScrollLeft);\n\n\t\t\tthis.prevScrollTop = scrollTop;\n\t\t\tthis.prevScrollLeft = scrollLeft;\n\n\t\t\tclearTimeout(this.scrollTimeout);\n\t\t\tthis.scrollTimeout = setTimeout(function () {\n\t\t\t\tthis.scrollDeltaVert = 0;\n\t\t\t\tthis.scrollDeltaHorz = 0;\n\t\t\t}.bind(this), 150);\n\n\t\t\tclearTimeout(this.afterScrolled);\n\n\t\t\tthis.didScroll = false;\n\t\t}\n\t}, {\n\t\tkey: \"scrolled\",\n\t\tvalue: function scrolled() {\n\n\t\t\tthis.q.enqueue(function () {\n\t\t\t\tthis.check();\n\t\t\t}.bind(this));\n\n\t\t\tthis.emit(_constants.EVENTS.MANAGERS.SCROLL, {\n\t\t\t\ttop: this.scrollTop,\n\t\t\t\tleft: this.scrollLeft\n\t\t\t});\n\n\t\t\tclearTimeout(this.afterScrolled);\n\t\t\tthis.afterScrolled = setTimeout(function () {\n\n\t\t\t\t// Don't report scroll if we are about the snap\n\t\t\t\tif (this.snapper && this.snapper.supportsTouch && this.snapper.needsSnap()) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tthis.emit(_constants.EVENTS.MANAGERS.SCROLLED, {\n\t\t\t\t\ttop: this.scrollTop,\n\t\t\t\t\tleft: this.scrollLeft\n\t\t\t\t});\n\t\t\t}.bind(this), this.settings.afterScrolledTimeout);\n\t\t}\n\t}, {\n\t\tkey: \"next\",\n\t\tvalue: function next() {\n\n\t\t\tvar dir = this.settings.direction;\n\t\t\tvar delta = this.layout.props.name === \"pre-paginated\" && this.layout.props.spread ? this.layout.props.delta * 2 : this.layout.props.delta;\n\n\t\t\tif (!this.views.length) return;\n\n\t\t\tif (this.isPaginated && this.settings.axis === \"horizontal\") {\n\n\t\t\t\tthis.scrollBy(delta, 0, true);\n\t\t\t} else {\n\n\t\t\t\tthis.scrollBy(0, this.layout.height, true);\n\t\t\t}\n\n\t\t\tthis.q.enqueue(function () {\n\t\t\t\tthis.check();\n\t\t\t}.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"prev\",\n\t\tvalue: function prev() {\n\n\t\t\tvar dir = this.settings.direction;\n\t\t\tvar delta = this.layout.props.name === \"pre-paginated\" && this.layout.props.spread ? this.layout.props.delta * 2 : this.layout.props.delta;\n\n\t\t\tif (!this.views.length) return;\n\n\t\t\tif (this.isPaginated && this.settings.axis === \"horizontal\") {\n\n\t\t\t\tthis.scrollBy(-delta, 0, true);\n\t\t\t} else {\n\n\t\t\t\tthis.scrollBy(0, -this.layout.height, true);\n\t\t\t}\n\n\t\t\tthis.q.enqueue(function () {\n\t\t\t\tthis.check();\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t// updateAxis(axis, forceUpdate){\n\t\t//\n\t\t// \tsuper.updateAxis(axis, forceUpdate);\n\t\t//\n\t\t// \tif (axis === \"vertical\") {\n\t\t// \t\tthis.settings.infinite = true;\n\t\t// \t} else {\n\t\t// \t\tthis.settings.infinite = false;\n\t\t// \t}\n\t\t// }\n\n\t}, {\n\t\tkey: \"updateFlow\",\n\t\tvalue: function updateFlow(flow) {\n\t\t\tif (this.rendered && this.snapper) {\n\t\t\t\tthis.snapper.destroy();\n\t\t\t\tthis.snapper = undefined;\n\t\t\t}\n\n\t\t\t_get(ContinuousViewManager.prototype.__proto__ || Object.getPrototypeOf(ContinuousViewManager.prototype), \"updateFlow\", this).call(this, flow, \"scroll\");\n\n\t\t\tif (this.rendered && this.isPaginated && this.settings.snap) {\n\t\t\t\tthis.snapper = new _snap2.default(this, this.settings.snap && _typeof(this.settings.snap) === \"object\" && this.settings.snap);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\t_get(ContinuousViewManager.prototype.__proto__ || Object.getPrototypeOf(ContinuousViewManager.prototype), \"destroy\", this).call(this);\n\n\t\t\tif (this.snapper) {\n\t\t\t\tthis.snapper.destroy();\n\t\t\t}\n\t\t}\n\t}]);\n\n\treturn ContinuousViewManager;\n}(_default2.default);\n\nexports.default = ContinuousViewManager;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/managers/continuous/index.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/managers/default/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/epubjs/lib/managers/default/index.js ***! - \***********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nvar _core = __webpack_require__(/*! ../../utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _mapping = __webpack_require__(/*! ../../mapping */ \"./node_modules/epubjs/lib/mapping.js\");\n\nvar _mapping2 = _interopRequireDefault(_mapping);\n\nvar _queue = __webpack_require__(/*! ../../utils/queue */ \"./node_modules/epubjs/lib/utils/queue.js\");\n\nvar _queue2 = _interopRequireDefault(_queue);\n\nvar _stage = __webpack_require__(/*! ../helpers/stage */ \"./node_modules/epubjs/lib/managers/helpers/stage.js\");\n\nvar _stage2 = _interopRequireDefault(_stage);\n\nvar _views = __webpack_require__(/*! ../helpers/views */ \"./node_modules/epubjs/lib/managers/helpers/views.js\");\n\nvar _views2 = _interopRequireDefault(_views);\n\nvar _constants = __webpack_require__(/*! ../../utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar DefaultViewManager = function () {\n\tfunction DefaultViewManager(options) {\n\t\t_classCallCheck(this, DefaultViewManager);\n\n\t\tthis.name = \"default\";\n\t\tthis.optsSettings = options.settings;\n\t\tthis.View = options.view;\n\t\tthis.request = options.request;\n\t\tthis.renditionQueue = options.queue;\n\t\tthis.q = new _queue2.default(this);\n\n\t\tthis.settings = (0, _core.extend)(this.settings || {}, {\n\t\t\tinfinite: true,\n\t\t\thidden: false,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\taxis: undefined,\n\t\t\tflow: \"scrolled\",\n\t\t\tignoreClass: \"\",\n\t\t\tfullsize: undefined\n\t\t});\n\n\t\t(0, _core.extend)(this.settings, options.settings || {});\n\n\t\tthis.viewSettings = {\n\t\t\tignoreClass: this.settings.ignoreClass,\n\t\t\taxis: this.settings.axis,\n\t\t\tflow: this.settings.flow,\n\t\t\tlayout: this.layout,\n\t\t\tmethod: this.settings.method, // srcdoc, blobUrl, write\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tforceEvenPages: true\n\t\t};\n\n\t\tthis.rendered = false;\n\t}\n\n\t_createClass(DefaultViewManager, [{\n\t\tkey: \"render\",\n\t\tvalue: function render(element, size) {\n\t\t\tvar tag = element.tagName;\n\n\t\t\tif (typeof this.settings.fullsize === \"undefined\" && tag && (tag.toLowerCase() == \"body\" || tag.toLowerCase() == \"html\")) {\n\t\t\t\tthis.settings.fullsize = true;\n\t\t\t}\n\n\t\t\tif (this.settings.fullsize) {\n\t\t\t\tthis.settings.overflow = \"visible\";\n\t\t\t\tthis.overflow = this.settings.overflow;\n\t\t\t}\n\n\t\t\tthis.settings.size = size;\n\n\t\t\t// Save the stage\n\t\t\tthis.stage = new _stage2.default({\n\t\t\t\twidth: size.width,\n\t\t\t\theight: size.height,\n\t\t\t\toverflow: this.overflow,\n\t\t\t\thidden: this.settings.hidden,\n\t\t\t\taxis: this.settings.axis,\n\t\t\t\tfullsize: this.settings.fullsize,\n\t\t\t\tdirection: this.settings.direction\n\t\t\t});\n\n\t\t\tthis.stage.attachTo(element);\n\n\t\t\t// Get this stage container div\n\t\t\tthis.container = this.stage.getContainer();\n\n\t\t\t// Views array methods\n\t\t\tthis.views = new _views2.default(this.container);\n\n\t\t\t// Calculate Stage Size\n\t\t\tthis._bounds = this.bounds();\n\t\t\tthis._stageSize = this.stage.size();\n\n\t\t\t// Set the dimensions for views\n\t\t\tthis.viewSettings.width = this._stageSize.width;\n\t\t\tthis.viewSettings.height = this._stageSize.height;\n\n\t\t\t// Function to handle a resize event.\n\t\t\t// Will only attach if width and height are both fixed.\n\t\t\tthis.stage.onResize(this.onResized.bind(this));\n\n\t\t\tthis.stage.onOrientationChange(this.onOrientationChange.bind(this));\n\n\t\t\t// Add Event Listeners\n\t\t\tthis.addEventListeners();\n\n\t\t\t// Add Layout method\n\t\t\t// this.applyLayoutMethod();\n\t\t\tif (this.layout) {\n\t\t\t\tthis.updateLayout();\n\t\t\t}\n\n\t\t\tthis.rendered = true;\n\t\t}\n\t}, {\n\t\tkey: \"addEventListeners\",\n\t\tvalue: function addEventListeners() {\n\t\t\tvar scroller;\n\n\t\t\twindow.addEventListener(\"unload\", function (e) {\n\t\t\t\tthis.destroy();\n\t\t\t}.bind(this));\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tscroller = this.container;\n\t\t\t} else {\n\t\t\t\tscroller = window;\n\t\t\t}\n\n\t\t\tthis._onScroll = this.onScroll.bind(this);\n\t\t\tscroller.addEventListener(\"scroll\", this._onScroll);\n\t\t}\n\t}, {\n\t\tkey: \"removeEventListeners\",\n\t\tvalue: function removeEventListeners() {\n\t\t\tvar scroller;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tscroller = this.container;\n\t\t\t} else {\n\t\t\t\tscroller = window;\n\t\t\t}\n\n\t\t\tscroller.removeEventListener(\"scroll\", this._onScroll);\n\t\t\tthis._onScroll = undefined;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tclearTimeout(this.orientationTimeout);\n\t\t\tclearTimeout(this.resizeTimeout);\n\t\t\tclearTimeout(this.afterScrolled);\n\n\t\t\tthis.clear();\n\n\t\t\tthis.removeEventListeners();\n\n\t\t\tthis.stage.destroy();\n\n\t\t\tthis.rendered = false;\n\n\t\t\t/*\n \t\tclearTimeout(this.trimTimeout);\n \tif(this.settings.hidden) {\n \t\tthis.element.removeChild(this.wrapper);\n \t} else {\n \t\tthis.element.removeChild(this.container);\n \t}\n */\n\t\t}\n\t}, {\n\t\tkey: \"onOrientationChange\",\n\t\tvalue: function onOrientationChange(e) {\n\t\t\tvar _window = window,\n\t\t\t orientation = _window.orientation;\n\n\n\t\t\tif (this.optsSettings.resizeOnOrientationChange) {\n\t\t\t\tthis.resize();\n\t\t\t}\n\n\t\t\t// Per ampproject:\n\t\t\t// In IOS 10.3, the measured size of an element is incorrect if the\n\t\t\t// element size depends on window size directly and the measurement\n\t\t\t// happens in window.resize event. Adding a timeout for correct\n\t\t\t// measurement. See https://github.com/ampproject/amphtml/issues/8479\n\t\t\tclearTimeout(this.orientationTimeout);\n\t\t\tthis.orientationTimeout = setTimeout(function () {\n\t\t\t\tthis.orientationTimeout = undefined;\n\n\t\t\t\tif (this.optsSettings.resizeOnOrientationChange) {\n\t\t\t\t\tthis.resize();\n\t\t\t\t}\n\n\t\t\t\tthis.emit(_constants.EVENTS.MANAGERS.ORIENTATION_CHANGE, orientation);\n\t\t\t}.bind(this), 500);\n\t\t}\n\t}, {\n\t\tkey: \"onResized\",\n\t\tvalue: function onResized(e) {\n\t\t\tthis.resize();\n\t\t}\n\t}, {\n\t\tkey: \"resize\",\n\t\tvalue: function resize(width, height) {\n\t\t\tvar stageSize = this.stage.size(width, height);\n\n\t\t\t// For Safari, wait for orientation to catch up\n\t\t\t// if the window is a square\n\t\t\tthis.winBounds = (0, _core.windowBounds)();\n\t\t\tif (this.orientationTimeout && this.winBounds.width === this.winBounds.height) {\n\t\t\t\t// reset the stage size for next resize\n\t\t\t\tthis._stageSize = undefined;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this._stageSize && this._stageSize.width === stageSize.width && this._stageSize.height === stageSize.height) {\n\t\t\t\t// Size is the same, no need to resize\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._stageSize = stageSize;\n\n\t\t\tthis._bounds = this.bounds();\n\n\t\t\t// Clear current views\n\t\t\tthis.clear();\n\n\t\t\t// Update for new views\n\t\t\tthis.viewSettings.width = this._stageSize.width;\n\t\t\tthis.viewSettings.height = this._stageSize.height;\n\n\t\t\tthis.updateLayout();\n\n\t\t\tthis.emit(_constants.EVENTS.MANAGERS.RESIZED, {\n\t\t\t\twidth: this._stageSize.width,\n\t\t\t\theight: this._stageSize.height\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"createView\",\n\t\tvalue: function createView(section) {\n\t\t\treturn new this.View(section, this.viewSettings);\n\t\t}\n\t}, {\n\t\tkey: \"display\",\n\t\tvalue: function display(section, target) {\n\n\t\t\tvar displaying = new _core.defer();\n\t\t\tvar displayed = displaying.promise;\n\n\t\t\t// Check if moving to target is needed\n\t\t\tif (target === section.href || (0, _core.isNumber)(target)) {\n\t\t\t\ttarget = undefined;\n\t\t\t}\n\n\t\t\t// Check to make sure the section we want isn't already shown\n\t\t\tvar visible = this.views.find(section);\n\n\t\t\t// View is already shown, just move to correct location in view\n\t\t\tif (visible && section) {\n\t\t\t\tvar offset = visible.offset();\n\n\t\t\t\tif (this.settings.direction === \"ltr\") {\n\t\t\t\t\tthis.scrollTo(offset.left, offset.top, true);\n\t\t\t\t} else {\n\t\t\t\t\tvar width = visible.width();\n\t\t\t\t\tthis.scrollTo(offset.left + width, offset.top, true);\n\t\t\t\t}\n\n\t\t\t\tif (target) {\n\t\t\t\t\tvar _offset = visible.locationOf(target);\n\t\t\t\t\tthis.moveTo(_offset);\n\t\t\t\t}\n\n\t\t\t\tdisplaying.resolve();\n\t\t\t\treturn displayed;\n\t\t\t}\n\n\t\t\t// Hide all current views\n\t\t\tthis.clear();\n\n\t\t\tthis.add(section).then(function (view) {\n\n\t\t\t\t// Move to correct place within the section, if needed\n\t\t\t\tif (target) {\n\t\t\t\t\tvar _offset2 = view.locationOf(target);\n\t\t\t\t\tthis.moveTo(_offset2);\n\t\t\t\t}\n\t\t\t}.bind(this), function (err) {\n\t\t\t\tdisplaying.reject(err);\n\t\t\t}).then(function () {\n\t\t\t\tvar next;\n\t\t\t\tif (this.layout.name === \"pre-paginated\" && this.layout.divisor > 1 && section.index > 0) {\n\t\t\t\t\t// First page (cover) should stand alone for pre-paginated books\n\t\t\t\t\tnext = section.next();\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn this.add(next);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}.bind(this)).then(function () {\n\n\t\t\t\tthis.views.show();\n\n\t\t\t\tdisplaying.resolve();\n\t\t\t}.bind(this));\n\t\t\t// .then(function(){\n\t\t\t// \treturn this.hooks.display.trigger(view);\n\t\t\t// }.bind(this))\n\t\t\t// .then(function(){\n\t\t\t// \tthis.views.show();\n\t\t\t// }.bind(this));\n\t\t\treturn displayed;\n\t\t}\n\t}, {\n\t\tkey: \"afterDisplayed\",\n\t\tvalue: function afterDisplayed(view) {\n\t\t\tthis.emit(_constants.EVENTS.MANAGERS.ADDED, view);\n\t\t}\n\t}, {\n\t\tkey: \"afterResized\",\n\t\tvalue: function afterResized(view) {\n\t\t\tthis.emit(_constants.EVENTS.MANAGERS.RESIZE, view.section);\n\t\t}\n\t}, {\n\t\tkey: \"moveTo\",\n\t\tvalue: function moveTo(offset) {\n\t\t\tvar distX = 0,\n\t\t\t distY = 0;\n\n\t\t\tif (!this.isPaginated) {\n\t\t\t\tdistY = offset.top;\n\t\t\t} else {\n\t\t\t\tdistX = Math.floor(offset.left / this.layout.delta) * this.layout.delta;\n\n\t\t\t\tif (distX + this.layout.delta > this.container.scrollWidth) {\n\t\t\t\t\tdistX = this.container.scrollWidth - this.layout.delta;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.scrollTo(distX, distY, true);\n\t\t}\n\t}, {\n\t\tkey: \"add\",\n\t\tvalue: function add(section) {\n\t\t\tvar _this = this;\n\n\t\t\tvar view = this.createView(section);\n\n\t\t\tthis.views.append(view);\n\n\t\t\t// view.on(EVENTS.VIEWS.SHOWN, this.afterDisplayed.bind(this));\n\t\t\tview.onDisplayed = this.afterDisplayed.bind(this);\n\t\t\tview.onResize = this.afterResized.bind(this);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.AXIS, function (axis) {\n\t\t\t\t_this.updateAxis(axis);\n\t\t\t});\n\n\t\t\treturn view.display(this.request);\n\t\t}\n\t}, {\n\t\tkey: \"append\",\n\t\tvalue: function append(section) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar view = this.createView(section);\n\t\t\tthis.views.append(view);\n\n\t\t\tview.onDisplayed = this.afterDisplayed.bind(this);\n\t\t\tview.onResize = this.afterResized.bind(this);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.AXIS, function (axis) {\n\t\t\t\t_this2.updateAxis(axis);\n\t\t\t});\n\n\t\t\treturn view.display(this.request);\n\t\t}\n\t}, {\n\t\tkey: \"prepend\",\n\t\tvalue: function prepend(section) {\n\t\t\tvar _this3 = this;\n\n\t\t\tvar view = this.createView(section);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.RESIZED, function (bounds) {\n\t\t\t\t_this3.counter(bounds);\n\t\t\t});\n\n\t\t\tthis.views.prepend(view);\n\n\t\t\tview.onDisplayed = this.afterDisplayed.bind(this);\n\t\t\tview.onResize = this.afterResized.bind(this);\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.AXIS, function (axis) {\n\t\t\t\t_this3.updateAxis(axis);\n\t\t\t});\n\n\t\t\treturn view.display(this.request);\n\t\t}\n\t}, {\n\t\tkey: \"counter\",\n\t\tvalue: function counter(bounds) {\n\t\t\tif (this.settings.axis === \"vertical\") {\n\t\t\t\tthis.scrollBy(0, bounds.heightDelta, true);\n\t\t\t} else {\n\t\t\t\tthis.scrollBy(bounds.widthDelta, 0, true);\n\t\t\t}\n\t\t}\n\n\t\t// resizeView(view) {\n\t\t//\n\t\t// \tif(this.settings.globalLayoutProperties.layout === \"pre-paginated\") {\n\t\t// \t\tview.lock(\"both\", this.bounds.width, this.bounds.height);\n\t\t// \t} else {\n\t\t// \t\tview.lock(\"width\", this.bounds.width, this.bounds.height);\n\t\t// \t}\n\t\t//\n\t\t// };\n\n\t}, {\n\t\tkey: \"next\",\n\t\tvalue: function next() {\n\t\t\tvar next;\n\t\t\tvar left;\n\n\t\t\tvar dir = this.settings.direction;\n\n\t\t\tif (!this.views.length) return;\n\n\t\t\tif (this.isPaginated && this.settings.axis === \"horizontal\" && (!dir || dir === \"ltr\")) {\n\n\t\t\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\t\t\tleft = this.container.scrollLeft + this.container.offsetWidth + this.layout.delta;\n\n\t\t\t\tif (left <= this.container.scrollWidth) {\n\t\t\t\t\tthis.scrollBy(this.layout.delta, 0, true);\n\t\t\t\t} else {\n\t\t\t\t\tnext = this.views.last().section.next();\n\t\t\t\t}\n\t\t\t} else if (this.isPaginated && this.settings.axis === \"horizontal\" && dir === \"rtl\") {\n\n\t\t\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\t\t\tleft = this.container.scrollLeft;\n\n\t\t\t\tif (left > 0) {\n\t\t\t\t\tthis.scrollBy(this.layout.delta, 0, true);\n\t\t\t\t} else {\n\t\t\t\t\tnext = this.views.last().section.next();\n\t\t\t\t}\n\t\t\t} else if (this.isPaginated && this.settings.axis === \"vertical\") {\n\n\t\t\t\tthis.scrollTop = this.container.scrollTop;\n\n\t\t\t\tvar top = this.container.scrollTop + this.container.offsetHeight;\n\n\t\t\t\tif (top < this.container.scrollHeight) {\n\t\t\t\t\tthis.scrollBy(0, this.layout.height, true);\n\t\t\t\t} else {\n\t\t\t\t\tnext = this.views.last().section.next();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnext = this.views.last().section.next();\n\t\t\t}\n\n\t\t\tif (next) {\n\t\t\t\tthis.clear();\n\n\t\t\t\treturn this.append(next).then(function () {\n\t\t\t\t\tvar right;\n\t\t\t\t\tif (this.layout.name === \"pre-paginated\" && this.layout.divisor > 1) {\n\t\t\t\t\t\tright = next.next();\n\t\t\t\t\t\tif (right) {\n\t\t\t\t\t\t\treturn this.append(right);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}.bind(this), function (err) {\n\t\t\t\t\treturn err;\n\t\t\t\t}).then(function () {\n\t\t\t\t\tthis.views.show();\n\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"prev\",\n\t\tvalue: function prev() {\n\t\t\tvar prev;\n\t\t\tvar left;\n\t\t\tvar dir = this.settings.direction;\n\n\t\t\tif (!this.views.length) return;\n\n\t\t\tif (this.isPaginated && this.settings.axis === \"horizontal\" && (!dir || dir === \"ltr\")) {\n\n\t\t\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\t\t\tleft = this.container.scrollLeft;\n\n\t\t\t\tif (left > 0) {\n\t\t\t\t\tthis.scrollBy(-this.layout.delta, 0, true);\n\t\t\t\t} else {\n\t\t\t\t\tprev = this.views.first().section.prev();\n\t\t\t\t}\n\t\t\t} else if (this.isPaginated && this.settings.axis === \"horizontal\" && dir === \"rtl\") {\n\n\t\t\t\tthis.scrollLeft = this.container.scrollLeft;\n\n\t\t\t\tleft = this.container.scrollLeft + this.container.offsetWidth + this.layout.delta;\n\n\t\t\t\tif (left <= this.container.scrollWidth) {\n\t\t\t\t\tthis.scrollBy(-this.layout.delta, 0, true);\n\t\t\t\t} else {\n\t\t\t\t\tprev = this.views.first().section.prev();\n\t\t\t\t}\n\t\t\t} else if (this.isPaginated && this.settings.axis === \"vertical\") {\n\n\t\t\t\tthis.scrollTop = this.container.scrollTop;\n\n\t\t\t\tvar top = this.container.scrollTop;\n\n\t\t\t\tif (top > 0) {\n\t\t\t\t\tthis.scrollBy(0, -this.layout.height, true);\n\t\t\t\t} else {\n\t\t\t\t\tprev = this.views.first().section.prev();\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\tprev = this.views.first().section.prev();\n\t\t\t}\n\n\t\t\tif (prev) {\n\t\t\t\tthis.clear();\n\n\t\t\t\treturn this.prepend(prev).then(function () {\n\t\t\t\t\tvar left;\n\t\t\t\t\tif (this.layout.name === \"pre-paginated\" && this.layout.divisor > 1) {\n\t\t\t\t\t\tleft = prev.prev();\n\t\t\t\t\t\tif (left) {\n\t\t\t\t\t\t\treturn this.prepend(left);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}.bind(this), function (err) {\n\t\t\t\t\treturn err;\n\t\t\t\t}).then(function () {\n\t\t\t\t\tif (this.isPaginated && this.settings.axis === \"horizontal\") {\n\t\t\t\t\t\tif (this.settings.direction === \"rtl\") {\n\t\t\t\t\t\t\tthis.scrollTo(0, 0, true);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.scrollTo(this.container.scrollWidth - this.layout.delta, 0, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.views.show();\n\t\t\t\t}.bind(this));\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"current\",\n\t\tvalue: function current() {\n\t\t\tvar visible = this.visible();\n\t\t\tif (visible.length) {\n\t\t\t\t// Current is the last visible view\n\t\t\t\treturn visible[visible.length - 1];\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}, {\n\t\tkey: \"clear\",\n\t\tvalue: function clear() {\n\n\t\t\t// this.q.clear();\n\n\t\t\tif (this.views) {\n\t\t\t\tthis.views.hide();\n\t\t\t\tthis.scrollTo(0, 0, true);\n\t\t\t\tthis.views.clear();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"currentLocation\",\n\t\tvalue: function currentLocation() {\n\n\t\t\tif (this.settings.axis === \"vertical\") {\n\t\t\t\tthis.location = this.scrolledLocation();\n\t\t\t} else {\n\t\t\t\tthis.location = this.paginatedLocation();\n\t\t\t}\n\t\t\treturn this.location;\n\t\t}\n\t}, {\n\t\tkey: \"scrolledLocation\",\n\t\tvalue: function scrolledLocation() {\n\t\t\tvar _this4 = this;\n\n\t\t\tvar visible = this.visible();\n\t\t\tvar container = this.container.getBoundingClientRect();\n\t\t\tvar pageHeight = container.height < window.innerHeight ? container.height : window.innerHeight;\n\n\t\t\tvar offset = 0;\n\t\t\tvar used = 0;\n\n\t\t\tif (this.settings.fullsize) {\n\t\t\t\toffset = window.scrollY;\n\t\t\t}\n\n\t\t\tvar sections = visible.map(function (view) {\n\t\t\t\tvar _view$section = view.section,\n\t\t\t\t index = _view$section.index,\n\t\t\t\t href = _view$section.href;\n\n\t\t\t\tvar position = view.position();\n\t\t\t\tvar height = view.height();\n\n\t\t\t\tvar startPos = offset + container.top - position.top + used;\n\t\t\t\tvar endPos = startPos + pageHeight - used;\n\t\t\t\tif (endPos > height) {\n\t\t\t\t\tendPos = height;\n\t\t\t\t\tused = endPos - startPos;\n\t\t\t\t}\n\n\t\t\t\tvar totalPages = _this4.layout.count(height, pageHeight).pages;\n\n\t\t\t\tvar currPage = Math.ceil(startPos / pageHeight);\n\t\t\t\tvar pages = [];\n\t\t\t\tvar endPage = Math.ceil(endPos / pageHeight);\n\n\t\t\t\tpages = [];\n\t\t\t\tfor (var i = currPage; i <= endPage; i++) {\n\t\t\t\t\tvar pg = i + 1;\n\t\t\t\t\tpages.push(pg);\n\t\t\t\t}\n\n\t\t\t\tvar mapping = _this4.mapping.page(view.contents, view.section.cfiBase, startPos, endPos);\n\n\t\t\t\treturn {\n\t\t\t\t\tindex: index,\n\t\t\t\t\thref: href,\n\t\t\t\t\tpages: pages,\n\t\t\t\t\ttotalPages: totalPages,\n\t\t\t\t\tmapping: mapping\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn sections;\n\t\t}\n\t}, {\n\t\tkey: \"paginatedLocation\",\n\t\tvalue: function paginatedLocation() {\n\t\t\tvar _this5 = this;\n\n\t\t\tvar visible = this.visible();\n\t\t\tvar container = this.container.getBoundingClientRect();\n\n\t\t\tvar left = 0;\n\t\t\tvar used = 0;\n\n\t\t\tif (this.settings.fullsize) {\n\t\t\t\tleft = window.scrollX;\n\t\t\t}\n\n\t\t\tvar sections = visible.map(function (view) {\n\t\t\t\tvar _view$section2 = view.section,\n\t\t\t\t index = _view$section2.index,\n\t\t\t\t href = _view$section2.href;\n\n\t\t\t\tvar offset = view.offset().left;\n\t\t\t\tvar position = view.position().left;\n\t\t\t\tvar width = view.width();\n\n\t\t\t\t// Find mapping\n\t\t\t\tvar start = left + container.left - position + used;\n\t\t\t\tvar end = start + _this5.layout.width - used;\n\n\t\t\t\tvar mapping = _this5.mapping.page(view.contents, view.section.cfiBase, start, end);\n\n\t\t\t\t// Find displayed pages\n\t\t\t\t//console.log(\"pre\", end, offset + width);\n\t\t\t\t// if (end > offset + width) {\n\t\t\t\t// \tend = offset + width;\n\t\t\t\t// \tused = this.layout.pageWidth;\n\t\t\t\t// }\n\t\t\t\t// console.log(\"post\", end);\n\n\t\t\t\tvar totalPages = _this5.layout.count(width).pages;\n\t\t\t\tvar startPage = Math.floor(start / _this5.layout.pageWidth);\n\t\t\t\tvar pages = [];\n\t\t\t\tvar endPage = Math.floor(end / _this5.layout.pageWidth);\n\n\t\t\t\t// start page should not be negative\n\t\t\t\tif (startPage < 0) {\n\t\t\t\t\tstartPage = 0;\n\t\t\t\t\tendPage = endPage + 1;\n\t\t\t\t}\n\n\t\t\t\t// Reverse page counts for rtl\n\t\t\t\tif (_this5.settings.direction === \"rtl\") {\n\t\t\t\t\tvar tempStartPage = startPage;\n\t\t\t\t\tstartPage = totalPages - endPage;\n\t\t\t\t\tendPage = totalPages - tempStartPage;\n\t\t\t\t}\n\n\t\t\t\tfor (var i = startPage + 1; i <= endPage; i++) {\n\t\t\t\t\tvar pg = i;\n\t\t\t\t\tpages.push(pg);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tindex: index,\n\t\t\t\t\thref: href,\n\t\t\t\t\tpages: pages,\n\t\t\t\t\ttotalPages: totalPages,\n\t\t\t\t\tmapping: mapping\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn sections;\n\t\t}\n\t}, {\n\t\tkey: \"isVisible\",\n\t\tvalue: function isVisible(view, offsetPrev, offsetNext, _container) {\n\t\t\tvar position = view.position();\n\t\t\tvar container = _container || this.bounds();\n\n\t\t\tif (this.settings.axis === \"horizontal\" && position.right > container.left - offsetPrev && position.left < container.right + offsetNext) {\n\n\t\t\t\treturn true;\n\t\t\t} else if (this.settings.axis === \"vertical\" && position.bottom > container.top - offsetPrev && position.top < container.bottom + offsetNext) {\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}, {\n\t\tkey: \"visible\",\n\t\tvalue: function visible() {\n\t\t\tvar container = this.bounds();\n\t\t\tvar views = this.views.displayed();\n\t\t\tvar viewsLength = views.length;\n\t\t\tvar visible = [];\n\t\t\tvar isVisible;\n\t\t\tvar view;\n\n\t\t\tfor (var i = 0; i < viewsLength; i++) {\n\t\t\t\tview = views[i];\n\t\t\t\tisVisible = this.isVisible(view, 0, 0, container);\n\n\t\t\t\tif (isVisible === true) {\n\t\t\t\t\tvisible.push(view);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn visible;\n\t\t}\n\t}, {\n\t\tkey: \"scrollBy\",\n\t\tvalue: function scrollBy(x, y, silent) {\n\t\t\tvar dir = this.settings.direction === \"rtl\" ? -1 : 1;\n\n\t\t\tif (silent) {\n\t\t\t\tthis.ignore = true;\n\t\t\t}\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tif (x) this.container.scrollLeft += x * dir;\n\t\t\t\tif (y) this.container.scrollTop += y;\n\t\t\t} else {\n\t\t\t\twindow.scrollBy(x * dir, y * dir);\n\t\t\t}\n\t\t\tthis.scrolled = true;\n\t\t}\n\t}, {\n\t\tkey: \"scrollTo\",\n\t\tvalue: function scrollTo(x, y, silent) {\n\t\t\tif (silent) {\n\t\t\t\tthis.ignore = true;\n\t\t\t}\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tthis.container.scrollLeft = x;\n\t\t\t\tthis.container.scrollTop = y;\n\t\t\t} else {\n\t\t\t\twindow.scrollTo(x, y);\n\t\t\t}\n\t\t\tthis.scrolled = true;\n\t\t}\n\t}, {\n\t\tkey: \"onScroll\",\n\t\tvalue: function onScroll() {\n\t\t\tvar scrollTop = void 0;\n\t\t\tvar scrollLeft = void 0;\n\n\t\t\tif (!this.settings.fullsize) {\n\t\t\t\tscrollTop = this.container.scrollTop;\n\t\t\t\tscrollLeft = this.container.scrollLeft;\n\t\t\t} else {\n\t\t\t\tscrollTop = window.scrollY;\n\t\t\t\tscrollLeft = window.scrollX;\n\t\t\t}\n\n\t\t\tthis.scrollTop = scrollTop;\n\t\t\tthis.scrollLeft = scrollLeft;\n\n\t\t\tif (!this.ignore) {\n\t\t\t\tthis.emit(_constants.EVENTS.MANAGERS.SCROLL, {\n\t\t\t\t\ttop: scrollTop,\n\t\t\t\t\tleft: scrollLeft\n\t\t\t\t});\n\n\t\t\t\tclearTimeout(this.afterScrolled);\n\t\t\t\tthis.afterScrolled = setTimeout(function () {\n\t\t\t\t\tthis.emit(_constants.EVENTS.MANAGERS.SCROLLED, {\n\t\t\t\t\t\ttop: this.scrollTop,\n\t\t\t\t\t\tleft: this.scrollLeft\n\t\t\t\t\t});\n\t\t\t\t}.bind(this), 20);\n\t\t\t} else {\n\t\t\t\tthis.ignore = false;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"bounds\",\n\t\tvalue: function bounds() {\n\t\t\tvar bounds;\n\n\t\t\tbounds = this.stage.bounds();\n\n\t\t\treturn bounds;\n\t\t}\n\t}, {\n\t\tkey: \"applyLayout\",\n\t\tvalue: function applyLayout(layout) {\n\n\t\t\tthis.layout = layout;\n\t\t\tthis.updateLayout();\n\t\t\t// this.manager.layout(this.layout.format);\n\t\t}\n\t}, {\n\t\tkey: \"updateLayout\",\n\t\tvalue: function updateLayout() {\n\n\t\t\tif (!this.stage) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._stageSize = this.stage.size();\n\n\t\t\tif (!this.isPaginated) {\n\t\t\t\tthis.layout.calculate(this._stageSize.width, this._stageSize.height);\n\t\t\t} else {\n\t\t\t\tthis.layout.calculate(this._stageSize.width, this._stageSize.height, this.settings.gap);\n\n\t\t\t\t// Set the look ahead offset for what is visible\n\t\t\t\tthis.settings.offset = this.layout.delta;\n\n\t\t\t\t// this.stage.addStyleRules(\"iframe\", [{\"margin-right\" : this.layout.gap + \"px\"}]);\n\t\t\t}\n\n\t\t\t// Set the dimensions for views\n\t\t\tthis.viewSettings.width = this.layout.width;\n\t\t\tthis.viewSettings.height = this.layout.height;\n\n\t\t\tthis.setLayout(this.layout);\n\t\t}\n\t}, {\n\t\tkey: \"setLayout\",\n\t\tvalue: function setLayout(layout) {\n\n\t\t\tthis.viewSettings.layout = layout;\n\n\t\t\tthis.mapping = new _mapping2.default(layout.props, this.settings.direction, this.settings.axis);\n\n\t\t\tif (this.views) {\n\n\t\t\t\tthis.views.forEach(function (view) {\n\t\t\t\t\tif (view) {\n\t\t\t\t\t\tview.setLayout(layout);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"updateAxis\",\n\t\tvalue: function updateAxis(axis, forceUpdate) {\n\n\t\t\tif (!this.isPaginated) {\n\t\t\t\taxis = \"vertical\";\n\t\t\t}\n\n\t\t\tif (!forceUpdate && axis === this.settings.axis) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.settings.axis = axis;\n\n\t\t\tthis.stage && this.stage.axis(axis);\n\n\t\t\tthis.viewSettings.axis = axis;\n\n\t\t\tif (this.mapping) {\n\t\t\t\tthis.mapping = new _mapping2.default(this.layout.props, this.settings.direction, this.settings.axis);\n\t\t\t}\n\n\t\t\tif (this.layout) {\n\t\t\t\tif (axis === \"vertical\") {\n\t\t\t\t\tthis.layout.spread(\"none\");\n\t\t\t\t} else {\n\t\t\t\t\tthis.layout.spread(this.layout.settings.spread);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"updateFlow\",\n\t\tvalue: function updateFlow(flow) {\n\t\t\tvar defaultScrolledOverflow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"auto\";\n\n\t\t\tvar isPaginated = flow === \"paginated\" || flow === \"auto\";\n\n\t\t\tthis.isPaginated = isPaginated;\n\n\t\t\tif (flow === \"scrolled-doc\" || flow === \"scrolled-continuous\" || flow === \"scrolled\") {\n\t\t\t\tthis.updateAxis(\"vertical\");\n\t\t\t} else {\n\t\t\t\tthis.updateAxis(\"horizontal\");\n\t\t\t}\n\n\t\t\tthis.viewSettings.flow = flow;\n\n\t\t\tif (!this.settings.overflow) {\n\t\t\t\tthis.overflow = isPaginated ? \"hidden\" : defaultScrolledOverflow;\n\t\t\t} else {\n\t\t\t\tthis.overflow = this.settings.overflow;\n\t\t\t}\n\n\t\t\tthis.stage && this.stage.overflow(this.overflow);\n\n\t\t\tthis.updateLayout();\n\t\t}\n\t}, {\n\t\tkey: \"getContents\",\n\t\tvalue: function getContents() {\n\t\t\tvar contents = [];\n\t\t\tif (!this.views) {\n\t\t\t\treturn contents;\n\t\t\t}\n\t\t\tthis.views.forEach(function (view) {\n\t\t\t\tvar viewContents = view && view.contents;\n\t\t\t\tif (viewContents) {\n\t\t\t\t\tcontents.push(viewContents);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn contents;\n\t\t}\n\t}, {\n\t\tkey: \"direction\",\n\t\tvalue: function direction() {\n\t\t\tvar dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"ltr\";\n\n\t\t\tthis.settings.direction = dir;\n\n\t\t\tthis.stage && this.stage.direction(dir);\n\n\t\t\tthis.viewSettings.direction = dir;\n\n\t\t\tthis.updateLayout();\n\t\t}\n\t}, {\n\t\tkey: \"isRendered\",\n\t\tvalue: function isRendered() {\n\t\t\treturn this.rendered;\n\t\t}\n\t}]);\n\n\treturn DefaultViewManager;\n}();\n\n//-- Enable binding events to Manager\n\n\n(0, _eventEmitter2.default)(DefaultViewManager.prototype);\n\nexports.default = DefaultViewManager;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/managers/default/index.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/managers/helpers/snap.js": -/*!**********************************************************!*\ - !*** ./node_modules/epubjs/lib/managers/helpers/snap.js ***! - \**********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ../../utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _constants = __webpack_require__(/*! ../../utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// easing equations from https://github.com/danro/easing-js/blob/master/easing.js\nvar PI_D2 = Math.PI / 2;\nvar EASING_EQUATIONS = {\n\teaseOutSine: function easeOutSine(pos) {\n\t\treturn Math.sin(pos * PI_D2);\n\t},\n\teaseInOutSine: function easeInOutSine(pos) {\n\t\treturn -0.5 * (Math.cos(Math.PI * pos) - 1);\n\t},\n\teaseInOutQuint: function easeInOutQuint(pos) {\n\t\tif ((pos /= 0.5) < 1) {\n\t\t\treturn 0.5 * Math.pow(pos, 5);\n\t\t}\n\t\treturn 0.5 * (Math.pow(pos - 2, 5) + 2);\n\t},\n\teaseInCubic: function easeInCubic(pos) {\n\t\treturn Math.pow(pos, 3);\n\t}\n};\n\nvar Snap = function () {\n\tfunction Snap(manager, options) {\n\t\t_classCallCheck(this, Snap);\n\n\t\tthis.settings = (0, _core.extend)({\n\t\t\tduration: 80,\n\t\t\tminVelocity: 0.2,\n\t\t\tminDistance: 10,\n\t\t\teasing: EASING_EQUATIONS['easeInCubic']\n\t\t}, options || {});\n\n\t\tthis.supportsTouch = this.supportsTouch();\n\n\t\tif (this.supportsTouch) {\n\t\t\tthis.setup(manager);\n\t\t}\n\t}\n\n\t_createClass(Snap, [{\n\t\tkey: \"setup\",\n\t\tvalue: function setup(manager) {\n\t\t\tthis.manager = manager;\n\n\t\t\tthis.layout = this.manager.layout;\n\n\t\t\tthis.fullsize = this.manager.settings.fullsize;\n\t\t\tif (this.fullsize) {\n\t\t\t\tthis.element = this.manager.stage.element;\n\t\t\t\tthis.scroller = window;\n\t\t\t\tthis.disableScroll();\n\t\t\t} else {\n\t\t\t\tthis.element = this.manager.stage.container;\n\t\t\t\tthis.scroller = this.element;\n\t\t\t\tthis.element.style[\"WebkitOverflowScrolling\"] = \"touch\";\n\t\t\t}\n\n\t\t\t// this.overflow = this.manager.overflow;\n\n\t\t\t// set lookahead offset to page width\n\t\t\tthis.manager.settings.offset = this.layout.width;\n\t\t\tthis.manager.settings.afterScrolledTimeout = this.settings.duration * 2;\n\n\t\t\tthis.isVertical = this.manager.settings.axis === \"vertical\";\n\n\t\t\t// disable snapping if not paginated or axis in not horizontal\n\t\t\tif (!this.manager.isPaginated || this.isVertical) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.touchCanceler = false;\n\t\t\tthis.resizeCanceler = false;\n\t\t\tthis.snapping = false;\n\n\t\t\tthis.scrollLeft;\n\t\t\tthis.scrollTop;\n\n\t\t\tthis.startTouchX = undefined;\n\t\t\tthis.startTouchY = undefined;\n\t\t\tthis.startTime = undefined;\n\t\t\tthis.endTouchX = undefined;\n\t\t\tthis.endTouchY = undefined;\n\t\t\tthis.endTime = undefined;\n\n\t\t\tthis.addListeners();\n\t\t}\n\t}, {\n\t\tkey: \"supportsTouch\",\n\t\tvalue: function supportsTouch() {\n\t\t\tif ('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\t}, {\n\t\tkey: \"disableScroll\",\n\t\tvalue: function disableScroll() {\n\t\t\tthis.element.style.overflow = \"hidden\";\n\t\t}\n\t}, {\n\t\tkey: \"enableScroll\",\n\t\tvalue: function enableScroll() {\n\t\t\tthis.element.style.overflow = \"\";\n\t\t}\n\t}, {\n\t\tkey: \"addListeners\",\n\t\tvalue: function addListeners() {\n\t\t\tthis._onResize = this.onResize.bind(this);\n\t\t\twindow.addEventListener('resize', this._onResize);\n\n\t\t\tthis._onScroll = this.onScroll.bind(this);\n\t\t\tthis.scroller.addEventListener('scroll', this._onScroll);\n\n\t\t\tthis._onTouchStart = this.onTouchStart.bind(this);\n\t\t\tthis.scroller.addEventListener('touchstart', this._onTouchStart, { passive: true });\n\t\t\tthis.on('touchstart', this._onTouchStart);\n\n\t\t\tthis._onTouchMove = this.onTouchMove.bind(this);\n\t\t\tthis.scroller.addEventListener('touchmove', this._onTouchMove, { passive: true });\n\t\t\tthis.on('touchmove', this._onTouchMove);\n\n\t\t\tthis._onTouchEnd = this.onTouchEnd.bind(this);\n\t\t\tthis.scroller.addEventListener('touchend', this._onTouchEnd, { passive: true });\n\t\t\tthis.on('touchend', this._onTouchEnd);\n\n\t\t\tthis._afterDisplayed = this.afterDisplayed.bind(this);\n\t\t\tthis.manager.on(_constants.EVENTS.MANAGERS.ADDED, this._afterDisplayed);\n\t\t}\n\t}, {\n\t\tkey: \"removeListeners\",\n\t\tvalue: function removeListeners() {\n\t\t\twindow.removeEventListener('resize', this._onResize);\n\t\t\tthis._onResize = undefined;\n\n\t\t\tthis.scroller.removeEventListener('scroll', this._onScroll);\n\t\t\tthis._onScroll = undefined;\n\n\t\t\tthis.scroller.removeEventListener('touchstart', this._onTouchStart, { passive: true });\n\t\t\tthis.off('touchstart', this._onTouchStart);\n\t\t\tthis._onTouchStart = undefined;\n\n\t\t\tthis.scroller.removeEventListener('touchmove', this._onTouchMove, { passive: true });\n\t\t\tthis.off('touchmove', this._onTouchMove);\n\t\t\tthis._onTouchMove = undefined;\n\n\t\t\tthis.scroller.removeEventListener('touchend', this._onTouchEnd, { passive: true });\n\t\t\tthis.off('touchend', this._onTouchEnd);\n\t\t\tthis._onTouchEnd = undefined;\n\n\t\t\tthis.manager.off(_constants.EVENTS.MANAGERS.ADDED, this._afterDisplayed);\n\t\t\tthis._afterDisplayed = undefined;\n\t\t}\n\t}, {\n\t\tkey: \"afterDisplayed\",\n\t\tvalue: function afterDisplayed(view) {\n\t\t\tvar _this = this;\n\n\t\t\tvar contents = view.contents;\n\t\t\t[\"touchstart\", \"touchmove\", \"touchend\"].forEach(function (e) {\n\t\t\t\tcontents.on(e, function (ev) {\n\t\t\t\t\treturn _this.triggerViewEvent(ev, contents);\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: \"triggerViewEvent\",\n\t\tvalue: function triggerViewEvent(e, contents) {\n\t\t\tthis.emit(e.type, e, contents);\n\t\t}\n\t}, {\n\t\tkey: \"onScroll\",\n\t\tvalue: function onScroll(e) {\n\t\t\tthis.scrollLeft = this.fullsize ? window.scrollX : this.scroller.scrollLeft;\n\t\t\tthis.scrollTop = this.fullsize ? window.scrollY : this.scroller.scrollTop;\n\t\t}\n\t}, {\n\t\tkey: \"onResize\",\n\t\tvalue: function onResize(e) {\n\t\t\tthis.resizeCanceler = true;\n\t\t}\n\t}, {\n\t\tkey: \"onTouchStart\",\n\t\tvalue: function onTouchStart(e) {\n\t\t\tvar _e$touches$ = e.touches[0],\n\t\t\t screenX = _e$touches$.screenX,\n\t\t\t screenY = _e$touches$.screenY;\n\n\n\t\t\tif (this.fullsize) {\n\t\t\t\tthis.enableScroll();\n\t\t\t}\n\n\t\t\tthis.touchCanceler = true;\n\n\t\t\tif (!this.startTouchX) {\n\t\t\t\tthis.startTouchX = screenX;\n\t\t\t\tthis.startTouchY = screenY;\n\t\t\t\tthis.startTime = this.now();\n\t\t\t}\n\n\t\t\tthis.endTouchX = screenX;\n\t\t\tthis.endTouchY = screenY;\n\t\t\tthis.endTime = this.now();\n\t\t}\n\t}, {\n\t\tkey: \"onTouchMove\",\n\t\tvalue: function onTouchMove(e) {\n\t\t\tvar _e$touches$2 = e.touches[0],\n\t\t\t screenX = _e$touches$2.screenX,\n\t\t\t screenY = _e$touches$2.screenY;\n\n\t\t\tvar deltaY = Math.abs(screenY - this.endTouchY);\n\n\t\t\tthis.touchCanceler = true;\n\n\t\t\tif (!this.fullsize && deltaY < 10) {\n\t\t\t\tthis.element.scrollLeft -= screenX - this.endTouchX;\n\t\t\t}\n\n\t\t\tthis.endTouchX = screenX;\n\t\t\tthis.endTouchY = screenY;\n\t\t\tthis.endTime = this.now();\n\t\t}\n\t}, {\n\t\tkey: \"onTouchEnd\",\n\t\tvalue: function onTouchEnd(e) {\n\t\t\tif (this.fullsize) {\n\t\t\t\tthis.disableScroll();\n\t\t\t}\n\n\t\t\tthis.touchCanceler = false;\n\n\t\t\tvar swipped = this.wasSwiped();\n\n\t\t\tif (swipped !== 0) {\n\t\t\t\tthis.snap(swipped);\n\t\t\t} else {\n\t\t\t\tthis.snap();\n\t\t\t}\n\n\t\t\tthis.startTouchX = undefined;\n\t\t\tthis.startTouchY = undefined;\n\t\t\tthis.startTime = undefined;\n\t\t\tthis.endTouchX = undefined;\n\t\t\tthis.endTouchY = undefined;\n\t\t\tthis.endTime = undefined;\n\t\t}\n\t}, {\n\t\tkey: \"wasSwiped\",\n\t\tvalue: function wasSwiped() {\n\t\t\tvar snapWidth = this.layout.pageWidth * this.layout.divisor;\n\t\t\tvar distance = this.endTouchX - this.startTouchX;\n\t\t\tvar absolute = Math.abs(distance);\n\t\t\tvar time = this.endTime - this.startTime;\n\t\t\tvar velocity = distance / time;\n\t\t\tvar minVelocity = this.settings.minVelocity;\n\n\t\t\tif (absolute <= this.settings.minDistance || absolute >= snapWidth) {\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tif (velocity > minVelocity) {\n\t\t\t\t// previous\n\t\t\t\treturn -1;\n\t\t\t} else if (velocity < -minVelocity) {\n\t\t\t\t// next\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"needsSnap\",\n\t\tvalue: function needsSnap() {\n\t\t\tvar left = this.scrollLeft;\n\t\t\tvar snapWidth = this.layout.pageWidth * this.layout.divisor;\n\t\t\treturn left % snapWidth !== 0;\n\t\t}\n\t}, {\n\t\tkey: \"snap\",\n\t\tvalue: function snap() {\n\t\t\tvar howMany = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n\t\t\tvar left = this.scrollLeft;\n\t\t\tvar snapWidth = this.layout.pageWidth * this.layout.divisor;\n\t\t\tvar snapTo = Math.round(left / snapWidth) * snapWidth;\n\n\t\t\tif (howMany) {\n\t\t\t\tsnapTo += howMany * snapWidth;\n\t\t\t}\n\n\t\t\treturn this.smoothScrollTo(snapTo);\n\t\t}\n\t}, {\n\t\tkey: \"smoothScrollTo\",\n\t\tvalue: function smoothScrollTo(destination) {\n\t\t\tvar deferred = new _core.defer();\n\t\t\tvar start = this.scrollLeft;\n\t\t\tvar startTime = this.now();\n\n\t\t\tvar duration = this.settings.duration;\n\t\t\tvar easing = this.settings.easing;\n\n\t\t\tthis.snapping = true;\n\n\t\t\t// add animation loop\n\t\t\tfunction tick() {\n\t\t\t\tvar now = this.now();\n\t\t\t\tvar time = Math.min(1, (now - startTime) / duration);\n\t\t\t\tvar timeFunction = easing(time);\n\n\t\t\t\tif (this.touchCanceler || this.resizeCanceler) {\n\t\t\t\t\tthis.resizeCanceler = false;\n\t\t\t\t\tthis.snapping = false;\n\t\t\t\t\tdeferred.resolve();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (time < 1) {\n\t\t\t\t\twindow.requestAnimationFrame(tick.bind(this));\n\t\t\t\t\tthis.scrollTo(start + (destination - start) * time, 0);\n\t\t\t\t} else {\n\t\t\t\t\tthis.scrollTo(destination, 0);\n\t\t\t\t\tthis.snapping = false;\n\t\t\t\t\tdeferred.resolve();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ttick.call(this);\n\n\t\t\treturn deferred.promise;\n\t\t}\n\t}, {\n\t\tkey: \"scrollTo\",\n\t\tvalue: function scrollTo() {\n\t\t\tvar left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\t\t\tvar top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n\t\t\tif (this.fullsize) {\n\t\t\t\twindow.scroll(left, top);\n\t\t\t} else {\n\t\t\t\tthis.scroller.scrollLeft = left;\n\t\t\t\tthis.scroller.scrollTop = top;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"now\",\n\t\tvalue: function now() {\n\t\t\treturn 'now' in window.performance ? performance.now() : new Date().getTime();\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tif (!this.scroller) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.fullsize) {\n\t\t\t\tthis.enableScroll();\n\t\t\t}\n\n\t\t\tthis.removeListeners();\n\n\t\t\tthis.scroller = undefined;\n\t\t}\n\t}]);\n\n\treturn Snap;\n}();\n\n(0, _eventEmitter2.default)(Snap.prototype);\n\nexports.default = Snap;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/managers/helpers/snap.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/managers/helpers/stage.js": -/*!***********************************************************!*\ - !*** ./node_modules/epubjs/lib/managers/helpers/stage.js ***! - \***********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ../../utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _throttle = __webpack_require__(/*! lodash/throttle */ \"./node_modules/lodash/throttle.js\");\n\nvar _throttle2 = _interopRequireDefault(_throttle);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Stage = function () {\n\tfunction Stage(_options) {\n\t\t_classCallCheck(this, Stage);\n\n\t\tthis.settings = _options || {};\n\t\tthis.id = \"epubjs-container-\" + (0, _core.uuid)();\n\n\t\tthis.container = this.create(this.settings);\n\n\t\tif (this.settings.hidden) {\n\t\t\tthis.wrapper = this.wrap(this.container);\n\t\t}\n\t}\n\n\t/*\n * Creates an element to render to.\n * Resizes to passed width and height or to the elements size\n */\n\n\n\t_createClass(Stage, [{\n\t\tkey: \"create\",\n\t\tvalue: function create(options) {\n\t\t\tvar height = options.height; // !== false ? options.height : \"100%\";\n\t\t\tvar width = options.width; // !== false ? options.width : \"100%\";\n\t\t\tvar overflow = options.overflow || false;\n\t\t\tvar axis = options.axis || \"vertical\";\n\t\t\tvar direction = options.direction;\n\n\t\t\t(0, _core.extend)(this.settings, options);\n\n\t\t\tif (options.height && (0, _core.isNumber)(options.height)) {\n\t\t\t\theight = options.height + \"px\";\n\t\t\t}\n\n\t\t\tif (options.width && (0, _core.isNumber)(options.width)) {\n\t\t\t\twidth = options.width + \"px\";\n\t\t\t}\n\n\t\t\t// Create new container element\n\t\t\tvar container = document.createElement(\"div\");\n\n\t\t\tcontainer.id = this.id;\n\t\t\tcontainer.classList.add(\"epub-container\");\n\n\t\t\t// Style Element\n\t\t\t// container.style.fontSize = \"0\";\n\t\t\tcontainer.style.wordSpacing = \"0\";\n\t\t\tcontainer.style.lineHeight = \"0\";\n\t\t\tcontainer.style.verticalAlign = \"top\";\n\t\t\tcontainer.style.position = \"relative\";\n\n\t\t\tif (axis === \"horizontal\") {\n\t\t\t\t// container.style.whiteSpace = \"nowrap\";\n\t\t\t\tcontainer.style.display = \"flex\";\n\t\t\t\tcontainer.style.flexDirection = \"row\";\n\t\t\t\tcontainer.style.flexWrap = \"nowrap\";\n\t\t\t}\n\n\t\t\tif (width) {\n\t\t\t\tcontainer.style.width = width;\n\t\t\t}\n\n\t\t\tif (height) {\n\t\t\t\tcontainer.style.height = height;\n\t\t\t}\n\n\t\t\tif (overflow) {\n\t\t\t\tif (overflow === \"scroll\" && axis === \"vertical\") {\n\t\t\t\t\tcontainer.style[\"overflow-y\"] = overflow;\n\t\t\t\t\tcontainer.style[\"overflow-x\"] = \"hidden\";\n\t\t\t\t} else if (overflow === \"scroll\" && axis === \"horizontal\") {\n\t\t\t\t\tcontainer.style[\"overflow-y\"] = \"hidden\";\n\t\t\t\t\tcontainer.style[\"overflow-x\"] = overflow;\n\t\t\t\t} else {\n\t\t\t\t\tcontainer.style[\"overflow\"] = overflow;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (direction) {\n\t\t\t\tcontainer.dir = direction;\n\t\t\t\tcontainer.style[\"direction\"] = direction;\n\t\t\t}\n\n\t\t\tif (direction && this.settings.fullsize) {\n\t\t\t\tdocument.body.style[\"direction\"] = direction;\n\t\t\t}\n\n\t\t\treturn container;\n\t\t}\n\t}, {\n\t\tkey: \"wrap\",\n\t\tvalue: function wrap(container) {\n\t\t\tvar wrapper = document.createElement(\"div\");\n\n\t\t\twrapper.style.visibility = \"hidden\";\n\t\t\twrapper.style.overflow = \"hidden\";\n\t\t\twrapper.style.width = \"0\";\n\t\t\twrapper.style.height = \"0\";\n\n\t\t\twrapper.appendChild(container);\n\t\t\treturn wrapper;\n\t\t}\n\t}, {\n\t\tkey: \"getElement\",\n\t\tvalue: function getElement(_element) {\n\t\t\tvar element;\n\n\t\t\tif ((0, _core.isElement)(_element)) {\n\t\t\t\telement = _element;\n\t\t\t} else if (typeof _element === \"string\") {\n\t\t\t\telement = document.getElementById(_element);\n\t\t\t}\n\n\t\t\tif (!element) {\n\t\t\t\tthrow new Error(\"Not an Element\");\n\t\t\t}\n\n\t\t\treturn element;\n\t\t}\n\t}, {\n\t\tkey: \"attachTo\",\n\t\tvalue: function attachTo(what) {\n\n\t\t\tvar element = this.getElement(what);\n\t\t\tvar base;\n\n\t\t\tif (!element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.settings.hidden) {\n\t\t\t\tbase = this.wrapper;\n\t\t\t} else {\n\t\t\t\tbase = this.container;\n\t\t\t}\n\n\t\t\telement.appendChild(base);\n\n\t\t\tthis.element = element;\n\n\t\t\treturn element;\n\t\t}\n\t}, {\n\t\tkey: \"getContainer\",\n\t\tvalue: function getContainer() {\n\t\t\treturn this.container;\n\t\t}\n\t}, {\n\t\tkey: \"onResize\",\n\t\tvalue: function onResize(func) {\n\t\t\t// Only listen to window for resize event if width and height are not fixed.\n\t\t\t// This applies if it is set to a percent or auto.\n\t\t\tif (!(0, _core.isNumber)(this.settings.width) || !(0, _core.isNumber)(this.settings.height)) {\n\t\t\t\tthis.resizeFunc = (0, _throttle2.default)(func, 50);\n\t\t\t\twindow.addEventListener(\"resize\", this.resizeFunc, false);\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"onOrientationChange\",\n\t\tvalue: function onOrientationChange(func) {\n\t\t\tthis.orientationChangeFunc = func;\n\t\t\twindow.addEventListener(\"orientationchange\", this.orientationChangeFunc, false);\n\t\t}\n\t}, {\n\t\tkey: \"size\",\n\t\tvalue: function size(width, height) {\n\t\t\tvar bounds;\n\t\t\tvar _width = width || this.settings.width;\n\t\t\tvar _height = height || this.settings.height;\n\n\t\t\t// If width or height are set to false, inherit them from containing element\n\t\t\tif (width === null) {\n\t\t\t\tbounds = this.element.getBoundingClientRect();\n\n\t\t\t\tif (bounds.width) {\n\t\t\t\t\twidth = Math.floor(bounds.width);\n\t\t\t\t\tthis.container.style.width = width + \"px\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ((0, _core.isNumber)(width)) {\n\t\t\t\t\tthis.container.style.width = width + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tthis.container.style.width = width;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (height === null) {\n\t\t\t\tbounds = bounds || this.element.getBoundingClientRect();\n\n\t\t\t\tif (bounds.height) {\n\t\t\t\t\theight = bounds.height;\n\t\t\t\t\tthis.container.style.height = height + \"px\";\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ((0, _core.isNumber)(height)) {\n\t\t\t\t\tthis.container.style.height = height + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tthis.container.style.height = height;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!(0, _core.isNumber)(width)) {\n\t\t\t\twidth = this.container.clientWidth;\n\t\t\t}\n\n\t\t\tif (!(0, _core.isNumber)(height)) {\n\t\t\t\theight = this.container.clientHeight;\n\t\t\t}\n\n\t\t\tthis.containerStyles = window.getComputedStyle(this.container);\n\n\t\t\tthis.containerPadding = {\n\t\t\t\tleft: parseFloat(this.containerStyles[\"padding-left\"]) || 0,\n\t\t\t\tright: parseFloat(this.containerStyles[\"padding-right\"]) || 0,\n\t\t\t\ttop: parseFloat(this.containerStyles[\"padding-top\"]) || 0,\n\t\t\t\tbottom: parseFloat(this.containerStyles[\"padding-bottom\"]) || 0\n\t\t\t};\n\n\t\t\t// Bounds not set, get them from window\n\t\t\tvar _windowBounds = (0, _core.windowBounds)();\n\t\t\tvar bodyStyles = window.getComputedStyle(document.body);\n\t\t\tvar bodyPadding = {\n\t\t\t\tleft: parseFloat(bodyStyles[\"padding-left\"]) || 0,\n\t\t\t\tright: parseFloat(bodyStyles[\"padding-right\"]) || 0,\n\t\t\t\ttop: parseFloat(bodyStyles[\"padding-top\"]) || 0,\n\t\t\t\tbottom: parseFloat(bodyStyles[\"padding-bottom\"]) || 0\n\t\t\t};\n\n\t\t\tif (!_width) {\n\t\t\t\twidth = _windowBounds.width - bodyPadding.left - bodyPadding.right;\n\t\t\t}\n\n\t\t\tif (this.settings.fullsize && !_height || !_height) {\n\t\t\t\theight = _windowBounds.height - bodyPadding.top - bodyPadding.bottom;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\twidth: width - this.containerPadding.left - this.containerPadding.right,\n\t\t\t\theight: height - this.containerPadding.top - this.containerPadding.bottom\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"bounds\",\n\t\tvalue: function bounds() {\n\t\t\tvar box = void 0;\n\t\t\tif (this.container.style.overflow !== \"visible\") {\n\t\t\t\tbox = this.container && this.container.getBoundingClientRect();\n\t\t\t}\n\n\t\t\tif (!box || !box.width || !box.height) {\n\t\t\t\treturn (0, _core.windowBounds)();\n\t\t\t} else {\n\t\t\t\treturn box;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"getSheet\",\n\t\tvalue: function getSheet() {\n\t\t\tvar style = document.createElement(\"style\");\n\n\t\t\t// WebKit hack --> https://davidwalsh.name/add-rules-stylesheets\n\t\t\tstyle.appendChild(document.createTextNode(\"\"));\n\n\t\t\tdocument.head.appendChild(style);\n\n\t\t\treturn style.sheet;\n\t\t}\n\t}, {\n\t\tkey: \"addStyleRules\",\n\t\tvalue: function addStyleRules(selector, rulesArray) {\n\t\t\tvar scope = \"#\" + this.id + \" \";\n\t\t\tvar rules = \"\";\n\n\t\t\tif (!this.sheet) {\n\t\t\t\tthis.sheet = this.getSheet();\n\t\t\t}\n\n\t\t\trulesArray.forEach(function (set) {\n\t\t\t\tfor (var prop in set) {\n\t\t\t\t\tif (set.hasOwnProperty(prop)) {\n\t\t\t\t\t\trules += prop + \":\" + set[prop] + \";\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.sheet.insertRule(scope + selector + \" {\" + rules + \"}\", 0);\n\t\t}\n\t}, {\n\t\tkey: \"axis\",\n\t\tvalue: function axis(_axis) {\n\t\t\tif (_axis === \"horizontal\") {\n\t\t\t\tthis.container.style.display = \"flex\";\n\t\t\t\tthis.container.style.flexDirection = \"row\";\n\t\t\t\tthis.container.style.flexWrap = \"nowrap\";\n\t\t\t} else {\n\t\t\t\tthis.container.style.display = \"block\";\n\t\t\t}\n\t\t\tthis.settings.axis = _axis;\n\t\t}\n\n\t\t// orientation(orientation) {\n\t\t// \tif (orientation === \"landscape\") {\n\t\t//\n\t\t// \t} else {\n\t\t//\n\t\t// \t}\n\t\t//\n\t\t// \tthis.orientation = orientation;\n\t\t// }\n\n\t}, {\n\t\tkey: \"direction\",\n\t\tvalue: function direction(dir) {\n\t\t\tif (this.container) {\n\t\t\t\tthis.container.dir = dir;\n\t\t\t\tthis.container.style[\"direction\"] = dir;\n\t\t\t}\n\n\t\t\tif (this.settings.fullsize) {\n\t\t\t\tdocument.body.style[\"direction\"] = dir;\n\t\t\t}\n\t\t\tthis.settings.dir = dir;\n\t\t}\n\t}, {\n\t\tkey: \"overflow\",\n\t\tvalue: function overflow(_overflow) {\n\t\t\tif (this.container) {\n\t\t\t\tif (_overflow === \"scroll\" && this.settings.axis === \"vertical\") {\n\t\t\t\t\tthis.container.style[\"overflow-y\"] = _overflow;\n\t\t\t\t\tthis.container.style[\"overflow-x\"] = \"hidden\";\n\t\t\t\t} else if (_overflow === \"scroll\" && this.settings.axis === \"horizontal\") {\n\t\t\t\t\tthis.container.style[\"overflow-y\"] = \"hidden\";\n\t\t\t\t\tthis.container.style[\"overflow-x\"] = _overflow;\n\t\t\t\t} else {\n\t\t\t\t\tthis.container.style[\"overflow\"] = _overflow;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.settings.overflow = _overflow;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tvar base;\n\n\t\t\tif (this.element) {\n\n\t\t\t\tif (this.settings.hidden) {\n\t\t\t\t\tbase = this.wrapper;\n\t\t\t\t} else {\n\t\t\t\t\tbase = this.container;\n\t\t\t\t}\n\n\t\t\t\tif (this.element.contains(this.container)) {\n\t\t\t\t\tthis.element.removeChild(this.container);\n\t\t\t\t}\n\n\t\t\t\twindow.removeEventListener(\"resize\", this.resizeFunc);\n\t\t\t\twindow.removeEventListener(\"orientationChange\", this.orientationChangeFunc);\n\t\t\t}\n\t\t}\n\t}]);\n\n\treturn Stage;\n}();\n\nexports.default = Stage;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/managers/helpers/stage.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/managers/helpers/views.js": -/*!***********************************************************!*\ - !*** ./node_modules/epubjs/lib/managers/helpers/views.js ***! - \***********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Views = function () {\n\tfunction Views(container) {\n\t\t_classCallCheck(this, Views);\n\n\t\tthis.container = container;\n\t\tthis._views = [];\n\t\tthis.length = 0;\n\t\tthis.hidden = false;\n\t}\n\n\t_createClass(Views, [{\n\t\tkey: \"all\",\n\t\tvalue: function all() {\n\t\t\treturn this._views;\n\t\t}\n\t}, {\n\t\tkey: \"first\",\n\t\tvalue: function first() {\n\t\t\treturn this._views[0];\n\t\t}\n\t}, {\n\t\tkey: \"last\",\n\t\tvalue: function last() {\n\t\t\treturn this._views[this._views.length - 1];\n\t\t}\n\t}, {\n\t\tkey: \"indexOf\",\n\t\tvalue: function indexOf(view) {\n\t\t\treturn this._views.indexOf(view);\n\t\t}\n\t}, {\n\t\tkey: \"slice\",\n\t\tvalue: function slice() {\n\t\t\treturn this._views.slice.apply(this._views, arguments);\n\t\t}\n\t}, {\n\t\tkey: \"get\",\n\t\tvalue: function get(i) {\n\t\t\treturn this._views[i];\n\t\t}\n\t}, {\n\t\tkey: \"append\",\n\t\tvalue: function append(view) {\n\t\t\tthis._views.push(view);\n\t\t\tif (this.container) {\n\t\t\t\tthis.container.appendChild(view.element);\n\t\t\t}\n\t\t\tthis.length++;\n\t\t\treturn view;\n\t\t}\n\t}, {\n\t\tkey: \"prepend\",\n\t\tvalue: function prepend(view) {\n\t\t\tthis._views.unshift(view);\n\t\t\tif (this.container) {\n\t\t\t\tthis.container.insertBefore(view.element, this.container.firstChild);\n\t\t\t}\n\t\t\tthis.length++;\n\t\t\treturn view;\n\t\t}\n\t}, {\n\t\tkey: \"insert\",\n\t\tvalue: function insert(view, index) {\n\t\t\tthis._views.splice(index, 0, view);\n\n\t\t\tif (this.container) {\n\t\t\t\tif (index < this.container.children.length) {\n\t\t\t\t\tthis.container.insertBefore(view.element, this.container.children[index]);\n\t\t\t\t} else {\n\t\t\t\t\tthis.container.appendChild(view.element);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.length++;\n\t\t\treturn view;\n\t\t}\n\t}, {\n\t\tkey: \"remove\",\n\t\tvalue: function remove(view) {\n\t\t\tvar index = this._views.indexOf(view);\n\n\t\t\tif (index > -1) {\n\t\t\t\tthis._views.splice(index, 1);\n\t\t\t}\n\n\t\t\tthis.destroy(view);\n\n\t\t\tthis.length--;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy(view) {\n\t\t\tif (view.displayed) {\n\t\t\t\tview.destroy();\n\t\t\t}\n\n\t\t\tif (this.container) {\n\t\t\t\tthis.container.removeChild(view.element);\n\t\t\t}\n\t\t\tview = null;\n\t\t}\n\n\t\t// Iterators\n\n\t}, {\n\t\tkey: \"forEach\",\n\t\tvalue: function forEach() {\n\t\t\treturn this._views.forEach.apply(this._views, arguments);\n\t\t}\n\t}, {\n\t\tkey: \"clear\",\n\t\tvalue: function clear() {\n\t\t\t// Remove all views\n\t\t\tvar view;\n\t\t\tvar len = this.length;\n\n\t\t\tif (!this.length) return;\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tview = this._views[i];\n\t\t\t\tthis.destroy(view);\n\t\t\t}\n\n\t\t\tthis._views = [];\n\t\t\tthis.length = 0;\n\t\t}\n\t}, {\n\t\tkey: \"find\",\n\t\tvalue: function find(section) {\n\n\t\t\tvar view;\n\t\t\tvar len = this.length;\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tview = this._views[i];\n\t\t\t\tif (view.displayed && view.section.index == section.index) {\n\t\t\t\t\treturn view;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"displayed\",\n\t\tvalue: function displayed() {\n\t\t\tvar displayed = [];\n\t\t\tvar view;\n\t\t\tvar len = this.length;\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tview = this._views[i];\n\t\t\t\tif (view.displayed) {\n\t\t\t\t\tdisplayed.push(view);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn displayed;\n\t\t}\n\t}, {\n\t\tkey: \"show\",\n\t\tvalue: function show() {\n\t\t\tvar view;\n\t\t\tvar len = this.length;\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tview = this._views[i];\n\t\t\t\tif (view.displayed) {\n\t\t\t\t\tview.show();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.hidden = false;\n\t\t}\n\t}, {\n\t\tkey: \"hide\",\n\t\tvalue: function hide() {\n\t\t\tvar view;\n\t\t\tvar len = this.length;\n\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tview = this._views[i];\n\t\t\t\tif (view.displayed) {\n\t\t\t\t\tview.hide();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.hidden = true;\n\t\t}\n\t}]);\n\n\treturn Views;\n}();\n\nexports.default = Views;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/managers/helpers/views.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/managers/views/iframe.js": -/*!**********************************************************!*\ - !*** ./node_modules/epubjs/lib/managers/views/iframe.js ***! - \**********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nvar _core = __webpack_require__(/*! ../../utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _epubcfi = __webpack_require__(/*! ../../epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _contents = __webpack_require__(/*! ../../contents */ \"./node_modules/epubjs/lib/contents.js\");\n\nvar _contents2 = _interopRequireDefault(_contents);\n\nvar _constants = __webpack_require__(/*! ../../utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _marksPane = __webpack_require__(/*! marks-pane */ \"./node_modules/marks-pane/lib/marks.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar IframeView = function () {\n\tfunction IframeView(section, options) {\n\t\t_classCallCheck(this, IframeView);\n\n\t\tthis.settings = (0, _core.extend)({\n\t\t\tignoreClass: \"\",\n\t\t\taxis: options.layout && options.layout.props.flow === \"scrolled\" ? \"vertical\" : \"horizontal\",\n\t\t\tdirection: undefined,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tlayout: undefined,\n\t\t\tglobalLayoutProperties: {},\n\t\t\tmethod: undefined\n\t\t}, options || {});\n\n\t\tthis.id = \"epubjs-view-\" + (0, _core.uuid)();\n\t\tthis.section = section;\n\t\tthis.index = section.index;\n\n\t\tthis.element = this.container(this.settings.axis);\n\n\t\tthis.added = false;\n\t\tthis.displayed = false;\n\t\tthis.rendered = false;\n\n\t\t// this.width = this.settings.width;\n\t\t// this.height = this.settings.height;\n\n\t\tthis.fixedWidth = 0;\n\t\tthis.fixedHeight = 0;\n\n\t\t// Blank Cfi for Parsing\n\t\tthis.epubcfi = new _epubcfi2.default();\n\n\t\tthis.layout = this.settings.layout;\n\t\t// Dom events to listen for\n\t\t// this.listenedEvents = [\"keydown\", \"keyup\", \"keypressed\", \"mouseup\", \"mousedown\", \"click\", \"touchend\", \"touchstart\"];\n\n\t\tthis.pane = undefined;\n\t\tthis.highlights = {};\n\t\tthis.underlines = {};\n\t\tthis.marks = {};\n\t}\n\n\t_createClass(IframeView, [{\n\t\tkey: \"container\",\n\t\tvalue: function container(axis) {\n\t\t\tvar element = document.createElement(\"div\");\n\n\t\t\telement.classList.add(\"epub-view\");\n\n\t\t\t// this.element.style.minHeight = \"100px\";\n\t\t\telement.style.height = \"0px\";\n\t\t\telement.style.width = \"0px\";\n\t\t\telement.style.overflow = \"hidden\";\n\t\t\telement.style.position = \"relative\";\n\t\t\telement.style.display = \"block\";\n\n\t\t\tif (axis && axis == \"horizontal\") {\n\t\t\t\telement.style.flex = \"none\";\n\t\t\t} else {\n\t\t\t\telement.style.flex = \"initial\";\n\t\t\t}\n\n\t\t\treturn element;\n\t\t}\n\t}, {\n\t\tkey: \"create\",\n\t\tvalue: function create() {\n\n\t\t\tif (this.iframe) {\n\t\t\t\treturn this.iframe;\n\t\t\t}\n\n\t\t\tif (!this.element) {\n\t\t\t\tthis.element = this.createContainer();\n\t\t\t}\n\n\t\t\tthis.iframe = document.createElement(\"iframe\");\n\t\t\tthis.iframe.id = this.id;\n\t\t\tthis.iframe.scrolling = \"no\"; // Might need to be removed: breaks ios width calculations\n\t\t\tthis.iframe.style.overflow = \"hidden\";\n\t\t\tthis.iframe.seamless = \"seamless\";\n\t\t\t// Back up if seamless isn't supported\n\t\t\tthis.iframe.style.border = \"none\";\n\n\t\t\tthis.iframe.setAttribute(\"enable-annotation\", \"true\");\n\n\t\t\tthis.resizing = true;\n\n\t\t\t// this.iframe.style.display = \"none\";\n\t\t\tthis.element.style.visibility = \"hidden\";\n\t\t\tthis.iframe.style.visibility = \"hidden\";\n\n\t\t\tthis.iframe.style.width = \"0\";\n\t\t\tthis.iframe.style.height = \"0\";\n\t\t\tthis._width = 0;\n\t\t\tthis._height = 0;\n\n\t\t\tthis.element.setAttribute(\"ref\", this.index);\n\n\t\t\tthis.added = true;\n\n\t\t\tthis.elementBounds = (0, _core.bounds)(this.element);\n\n\t\t\t// if(width || height){\n\t\t\t// this.resize(width, height);\n\t\t\t// } else if(this.width && this.height){\n\t\t\t// this.resize(this.width, this.height);\n\t\t\t// } else {\n\t\t\t// this.iframeBounds = bounds(this.iframe);\n\t\t\t// }\n\n\n\t\t\tif (\"srcdoc\" in this.iframe) {\n\t\t\t\tthis.supportsSrcdoc = true;\n\t\t\t} else {\n\t\t\t\tthis.supportsSrcdoc = false;\n\t\t\t}\n\n\t\t\tif (!this.settings.method) {\n\t\t\t\tthis.settings.method = this.supportsSrcdoc ? \"srcdoc\" : \"write\";\n\t\t\t}\n\n\t\t\treturn this.iframe;\n\t\t}\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render(request, show) {\n\n\t\t\t// view.onLayout = this.layout.format.bind(this.layout);\n\t\t\tthis.create();\n\n\t\t\t// Fit to size of the container, apply padding\n\t\t\tthis.size();\n\n\t\t\tif (!this.sectionRender) {\n\t\t\t\tthis.sectionRender = this.section.render(request);\n\t\t\t}\n\n\t\t\t// Render Chain\n\t\t\treturn this.sectionRender.then(function (contents) {\n\t\t\t\treturn this.load(contents);\n\t\t\t}.bind(this)).then(function () {\n\t\t\t\tvar _this = this;\n\n\t\t\t\t// apply the layout function to the contents\n\t\t\t\tthis.layout.format(this.contents);\n\n\t\t\t\t// find and report the writingMode axis\n\t\t\t\tvar writingMode = this.contents.writingMode();\n\t\t\t\tvar axis = writingMode.indexOf(\"vertical\") === 0 ? \"vertical\" : \"horizontal\";\n\n\t\t\t\tthis.setAxis(axis);\n\t\t\t\tthis.emit(_constants.EVENTS.VIEWS.AXIS, axis);\n\n\t\t\t\t// Listen for events that require an expansion of the iframe\n\t\t\t\tthis.addListeners();\n\n\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\t// Expand the iframe to the full size of the content\n\t\t\t\t\t_this.expand();\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}.bind(this), function (e) {\n\t\t\t\tthis.emit(_constants.EVENTS.VIEWS.LOAD_ERROR, e);\n\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t}.bind(this)).then(function () {\n\t\t\t\tthis.emit(_constants.EVENTS.VIEWS.RENDERED, this.section);\n\t\t\t}.bind(this));\n\t\t}\n\t}, {\n\t\tkey: \"reset\",\n\t\tvalue: function reset() {\n\t\t\tif (this.iframe) {\n\t\t\t\tthis.iframe.style.width = \"0\";\n\t\t\t\tthis.iframe.style.height = \"0\";\n\t\t\t\tthis._width = 0;\n\t\t\t\tthis._height = 0;\n\t\t\t\tthis._textWidth = undefined;\n\t\t\t\tthis._contentWidth = undefined;\n\t\t\t\tthis._textHeight = undefined;\n\t\t\t\tthis._contentHeight = undefined;\n\t\t\t}\n\t\t\tthis._needsReframe = true;\n\t\t}\n\n\t\t// Determine locks base on settings\n\n\t}, {\n\t\tkey: \"size\",\n\t\tvalue: function size(_width, _height) {\n\t\t\tvar width = _width || this.settings.width;\n\t\t\tvar height = _height || this.settings.height;\n\n\t\t\tif (this.layout.name === \"pre-paginated\") {\n\t\t\t\tthis.lock(\"both\", width, height);\n\t\t\t} else if (this.settings.axis === \"horizontal\") {\n\t\t\t\tthis.lock(\"height\", width, height);\n\t\t\t} else {\n\t\t\t\tthis.lock(\"width\", width, height);\n\t\t\t}\n\n\t\t\tthis.settings.width = width;\n\t\t\tthis.settings.height = height;\n\t\t}\n\n\t\t// Lock an axis to element dimensions, taking borders into account\n\n\t}, {\n\t\tkey: \"lock\",\n\t\tvalue: function lock(what, width, height) {\n\t\t\tvar elBorders = (0, _core.borders)(this.element);\n\t\t\tvar iframeBorders;\n\n\t\t\tif (this.iframe) {\n\t\t\t\tiframeBorders = (0, _core.borders)(this.iframe);\n\t\t\t} else {\n\t\t\t\tiframeBorders = { width: 0, height: 0 };\n\t\t\t}\n\n\t\t\tif (what == \"width\" && (0, _core.isNumber)(width)) {\n\t\t\t\tthis.lockedWidth = width - elBorders.width - iframeBorders.width;\n\t\t\t\t// this.resize(this.lockedWidth, width); // width keeps ratio correct\n\t\t\t}\n\n\t\t\tif (what == \"height\" && (0, _core.isNumber)(height)) {\n\t\t\t\tthis.lockedHeight = height - elBorders.height - iframeBorders.height;\n\t\t\t\t// this.resize(width, this.lockedHeight);\n\t\t\t}\n\n\t\t\tif (what === \"both\" && (0, _core.isNumber)(width) && (0, _core.isNumber)(height)) {\n\n\t\t\t\tthis.lockedWidth = width - elBorders.width - iframeBorders.width;\n\t\t\t\tthis.lockedHeight = height - elBorders.height - iframeBorders.height;\n\t\t\t\t// this.resize(this.lockedWidth, this.lockedHeight);\n\t\t\t}\n\n\t\t\tif (this.displayed && this.iframe) {\n\n\t\t\t\t// this.contents.layout();\n\t\t\t\tthis.expand();\n\t\t\t}\n\t\t}\n\n\t\t// Resize a single axis based on content dimensions\n\n\t}, {\n\t\tkey: \"expand\",\n\t\tvalue: function expand(force) {\n\t\t\tvar width = this.lockedWidth;\n\t\t\tvar height = this.lockedHeight;\n\t\t\tvar columns;\n\n\t\t\tvar textWidth, textHeight;\n\n\t\t\tif (!this.iframe || this._expanding) return;\n\n\t\t\tthis._expanding = true;\n\n\t\t\tif (this.layout.name === \"pre-paginated\") {\n\t\t\t\twidth = this.layout.columnWidth;\n\t\t\t\theight = this.layout.height;\n\t\t\t}\n\t\t\t// Expand Horizontally\n\t\t\telse if (this.settings.axis === \"horizontal\") {\n\t\t\t\t\t// Get the width of the text\n\t\t\t\t\twidth = this.contents.textWidth();\n\n\t\t\t\t\tif (width % this.layout.pageWidth > 0) {\n\t\t\t\t\t\twidth = Math.ceil(width / this.layout.pageWidth) * this.layout.pageWidth;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (this.settings.forceEvenPages) {\n\t\t\t\t\t\tcolumns = width / this.layout.pageWidth;\n\t\t\t\t\t\tif (this.layout.divisor > 1 && this.layout.name === \"reflowable\" && columns % 2 > 0) {\n\t\t\t\t\t\t\t// add a blank page\n\t\t\t\t\t\t\twidth += this.layout.pageWidth;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} // Expand Vertically\n\t\t\t\telse if (this.settings.axis === \"vertical\") {\n\t\t\t\t\t\theight = this.contents.textHeight();\n\t\t\t\t\t}\n\n\t\t\t// Only Resize if dimensions have changed or\n\t\t\t// if Frame is still hidden, so needs reframing\n\t\t\tif (this._needsReframe || width != this._width || height != this._height) {\n\t\t\t\tthis.reframe(width, height);\n\t\t\t}\n\n\t\t\tthis._expanding = false;\n\t\t}\n\t}, {\n\t\tkey: \"reframe\",\n\t\tvalue: function reframe(width, height) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar size;\n\n\t\t\tif ((0, _core.isNumber)(width)) {\n\t\t\t\tthis.element.style.width = width + \"px\";\n\t\t\t\tthis.iframe.style.width = width + \"px\";\n\t\t\t\tthis._width = width;\n\t\t\t}\n\n\t\t\tif ((0, _core.isNumber)(height)) {\n\t\t\t\tthis.element.style.height = height + \"px\";\n\t\t\t\tthis.iframe.style.height = height + \"px\";\n\t\t\t\tthis._height = height;\n\t\t\t}\n\n\t\t\tvar widthDelta = this.prevBounds ? width - this.prevBounds.width : width;\n\t\t\tvar heightDelta = this.prevBounds ? height - this.prevBounds.height : height;\n\n\t\t\tsize = {\n\t\t\t\twidth: width,\n\t\t\t\theight: height,\n\t\t\t\twidthDelta: widthDelta,\n\t\t\t\theightDelta: heightDelta\n\t\t\t};\n\n\t\t\tthis.pane && this.pane.render();\n\n\t\t\trequestAnimationFrame(function () {\n\t\t\t\tvar mark = void 0;\n\t\t\t\tfor (var m in _this2.marks) {\n\t\t\t\t\tif (_this2.marks.hasOwnProperty(m)) {\n\t\t\t\t\t\tmark = _this2.marks[m];\n\t\t\t\t\t\t_this2.placeMark(mark.element, mark.range);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.onResize(this, size);\n\n\t\t\tthis.emit(_constants.EVENTS.VIEWS.RESIZED, size);\n\n\t\t\tthis.prevBounds = size;\n\n\t\t\tthis.elementBounds = (0, _core.bounds)(this.element);\n\t\t}\n\t}, {\n\t\tkey: \"load\",\n\t\tvalue: function load(contents) {\n\t\t\tvar loading = new _core.defer();\n\t\t\tvar loaded = loading.promise;\n\n\t\t\tif (!this.iframe) {\n\t\t\t\tloading.reject(new Error(\"No Iframe Available\"));\n\t\t\t\treturn loaded;\n\t\t\t}\n\n\t\t\tthis.iframe.onload = function (event) {\n\n\t\t\t\tthis.onLoad(event, loading);\n\t\t\t}.bind(this);\n\n\t\t\tif (this.settings.method === \"blobUrl\") {\n\t\t\t\tthis.blobUrl = (0, _core.createBlobUrl)(contents, \"application/xhtml+xml\");\n\t\t\t\tthis.iframe.src = this.blobUrl;\n\t\t\t\tthis.element.appendChild(this.iframe);\n\t\t\t} else if (this.settings.method === \"srcdoc\") {\n\t\t\t\tthis.iframe.srcdoc = contents;\n\t\t\t\tthis.element.appendChild(this.iframe);\n\t\t\t} else {\n\n\t\t\t\tthis.element.appendChild(this.iframe);\n\n\t\t\t\tthis.document = this.iframe.contentDocument;\n\n\t\t\t\tif (!this.document) {\n\t\t\t\t\tloading.reject(new Error(\"No Document Available\"));\n\t\t\t\t\treturn loaded;\n\t\t\t\t}\n\n\t\t\t\tthis.iframe.contentDocument.open();\n\t\t\t\tthis.iframe.contentDocument.write(contents);\n\t\t\t\tthis.iframe.contentDocument.close();\n\t\t\t}\n\n\t\t\treturn loaded;\n\t\t}\n\t}, {\n\t\tkey: \"onLoad\",\n\t\tvalue: function onLoad(event, promise) {\n\t\t\tvar _this3 = this;\n\n\t\t\tthis.window = this.iframe.contentWindow;\n\t\t\tthis.document = this.iframe.contentDocument;\n\n\t\t\tthis.contents = new _contents2.default(this.document, this.document.body, this.section.cfiBase, this.section.index);\n\n\t\t\tthis.rendering = false;\n\n\t\t\tvar link = this.document.querySelector(\"link[rel='canonical']\");\n\t\t\tif (link) {\n\t\t\t\tlink.setAttribute(\"href\", this.section.canonical);\n\t\t\t} else {\n\t\t\t\tlink = this.document.createElement(\"link\");\n\t\t\t\tlink.setAttribute(\"rel\", \"canonical\");\n\t\t\t\tlink.setAttribute(\"href\", this.section.canonical);\n\t\t\t\tthis.document.querySelector(\"head\").appendChild(link);\n\t\t\t}\n\n\t\t\tthis.contents.on(_constants.EVENTS.CONTENTS.EXPAND, function () {\n\t\t\t\tif (_this3.displayed && _this3.iframe) {\n\t\t\t\t\t_this3.expand();\n\t\t\t\t\tif (_this3.contents) {\n\t\t\t\t\t\t_this3.layout.format(_this3.contents);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.contents.on(_constants.EVENTS.CONTENTS.RESIZE, function (e) {\n\t\t\t\tif (_this3.displayed && _this3.iframe) {\n\t\t\t\t\t_this3.expand();\n\t\t\t\t\tif (_this3.contents) {\n\t\t\t\t\t\t_this3.layout.format(_this3.contents);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tpromise.resolve(this.contents);\n\t\t}\n\t}, {\n\t\tkey: \"setLayout\",\n\t\tvalue: function setLayout(layout) {\n\t\t\tthis.layout = layout;\n\n\t\t\tif (this.contents) {\n\t\t\t\tthis.layout.format(this.contents);\n\t\t\t\tthis.expand();\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"setAxis\",\n\t\tvalue: function setAxis(axis) {\n\n\t\t\t// Force vertical for scrolled\n\t\t\tif (this.layout.props.flow === \"scrolled\") {\n\t\t\t\taxis = \"vertical\";\n\t\t\t}\n\n\t\t\tthis.settings.axis = axis;\n\n\t\t\tif (axis == \"horizontal\") {\n\t\t\t\tthis.element.style.flex = \"none\";\n\t\t\t} else {\n\t\t\t\tthis.element.style.flex = \"initial\";\n\t\t\t}\n\n\t\t\tthis.size();\n\t\t}\n\t}, {\n\t\tkey: \"addListeners\",\n\t\tvalue: function addListeners() {\n\t\t\t//TODO: Add content listeners for expanding\n\t\t}\n\t}, {\n\t\tkey: \"removeListeners\",\n\t\tvalue: function removeListeners(layoutFunc) {\n\t\t\t//TODO: remove content listeners for expanding\n\t\t}\n\t}, {\n\t\tkey: \"display\",\n\t\tvalue: function display(request) {\n\t\t\tvar displayed = new _core.defer();\n\n\t\t\tif (!this.displayed) {\n\n\t\t\t\tthis.render(request).then(function () {\n\n\t\t\t\t\tthis.emit(_constants.EVENTS.VIEWS.DISPLAYED, this);\n\t\t\t\t\tthis.onDisplayed(this);\n\n\t\t\t\t\tthis.displayed = true;\n\t\t\t\t\tdisplayed.resolve(this);\n\t\t\t\t}.bind(this), function (err) {\n\t\t\t\t\tdisplayed.reject(err, this);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdisplayed.resolve(this);\n\t\t\t}\n\n\t\t\treturn displayed.promise;\n\t\t}\n\t}, {\n\t\tkey: \"show\",\n\t\tvalue: function show() {\n\n\t\t\tthis.element.style.visibility = \"visible\";\n\n\t\t\tif (this.iframe) {\n\t\t\t\tthis.iframe.style.visibility = \"visible\";\n\n\t\t\t\t// Remind Safari to redraw the iframe\n\t\t\t\tthis.iframe.style.transform = \"translateZ(0)\";\n\t\t\t\tthis.iframe.offsetWidth;\n\t\t\t\tthis.iframe.style.transform = null;\n\t\t\t}\n\n\t\t\tthis.emit(_constants.EVENTS.VIEWS.SHOWN, this);\n\t\t}\n\t}, {\n\t\tkey: \"hide\",\n\t\tvalue: function hide() {\n\t\t\t// this.iframe.style.display = \"none\";\n\t\t\tthis.element.style.visibility = \"hidden\";\n\t\t\tthis.iframe.style.visibility = \"hidden\";\n\n\t\t\tthis.stopExpanding = true;\n\t\t\tthis.emit(_constants.EVENTS.VIEWS.HIDDEN, this);\n\t\t}\n\t}, {\n\t\tkey: \"offset\",\n\t\tvalue: function offset() {\n\t\t\treturn {\n\t\t\t\ttop: this.element.offsetTop,\n\t\t\t\tleft: this.element.offsetLeft\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"width\",\n\t\tvalue: function width() {\n\t\t\treturn this._width;\n\t\t}\n\t}, {\n\t\tkey: \"height\",\n\t\tvalue: function height() {\n\t\t\treturn this._height;\n\t\t}\n\t}, {\n\t\tkey: \"position\",\n\t\tvalue: function position() {\n\t\t\treturn this.element.getBoundingClientRect();\n\t\t}\n\t}, {\n\t\tkey: \"locationOf\",\n\t\tvalue: function locationOf(target) {\n\t\t\tvar parentPos = this.iframe.getBoundingClientRect();\n\t\t\tvar targetPos = this.contents.locationOf(target, this.settings.ignoreClass);\n\n\t\t\treturn {\n\t\t\t\t\"left\": targetPos.left,\n\t\t\t\t\"top\": targetPos.top\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"onDisplayed\",\n\t\tvalue: function onDisplayed(view) {\n\t\t\t// Stub, override with a custom functions\n\t\t}\n\t}, {\n\t\tkey: \"onResize\",\n\t\tvalue: function onResize(view, e) {\n\t\t\t// Stub, override with a custom functions\n\t\t}\n\t}, {\n\t\tkey: \"bounds\",\n\t\tvalue: function bounds(force) {\n\t\t\tif (force || !this.elementBounds) {\n\t\t\t\tthis.elementBounds = (0, _core.bounds)(this.element);\n\t\t\t}\n\n\t\t\treturn this.elementBounds;\n\t\t}\n\t}, {\n\t\tkey: \"highlight\",\n\t\tvalue: function highlight(cfiRange) {\n\t\t\tvar data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\t\tvar cb = arguments[2];\n\n\t\t\tvar _this4 = this;\n\n\t\t\tvar className = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : \"epubjs-hl\";\n\t\t\tvar styles = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n\n\t\t\tif (!this.contents) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar attributes = Object.assign({ \"fill\": \"yellow\", \"fill-opacity\": \"0.3\", \"mix-blend-mode\": \"multiply\" }, styles);\n\t\t\tvar range = this.contents.range(cfiRange);\n\n\t\t\tvar emitter = function emitter() {\n\t\t\t\t_this4.emit(_constants.EVENTS.VIEWS.MARK_CLICKED, cfiRange, data);\n\t\t\t};\n\n\t\t\tdata[\"epubcfi\"] = cfiRange;\n\n\t\t\tif (!this.pane) {\n\t\t\t\tthis.pane = new _marksPane.Pane(this.iframe, this.element);\n\t\t\t}\n\n\t\t\tvar m = new _marksPane.Highlight(range, className, data, attributes);\n\t\t\tvar h = this.pane.addMark(m);\n\n\t\t\tthis.highlights[cfiRange] = { \"mark\": h, \"element\": h.element, \"listeners\": [emitter, cb] };\n\n\t\t\th.element.setAttribute(\"ref\", className);\n\t\t\th.element.addEventListener(\"click\", emitter);\n\t\t\th.element.addEventListener(\"touchstart\", emitter);\n\n\t\t\tif (cb) {\n\t\t\t\th.element.addEventListener(\"click\", cb);\n\t\t\t\th.element.addEventListener(\"touchstart\", cb);\n\t\t\t}\n\t\t\treturn h;\n\t\t}\n\t}, {\n\t\tkey: \"underline\",\n\t\tvalue: function underline(cfiRange) {\n\t\t\tvar data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\t\tvar cb = arguments[2];\n\n\t\t\tvar _this5 = this;\n\n\t\t\tvar className = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : \"epubjs-ul\";\n\t\t\tvar styles = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};\n\n\t\t\tif (!this.contents) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar attributes = Object.assign({ \"stroke\": \"black\", \"stroke-opacity\": \"0.3\", \"mix-blend-mode\": \"multiply\" }, styles);\n\t\t\tvar range = this.contents.range(cfiRange);\n\t\t\tvar emitter = function emitter() {\n\t\t\t\t_this5.emit(_constants.EVENTS.VIEWS.MARK_CLICKED, cfiRange, data);\n\t\t\t};\n\n\t\t\tdata[\"epubcfi\"] = cfiRange;\n\n\t\t\tif (!this.pane) {\n\t\t\t\tthis.pane = new _marksPane.Pane(this.iframe, this.element);\n\t\t\t}\n\n\t\t\tvar m = new _marksPane.Underline(range, className, data, attributes);\n\t\t\tvar h = this.pane.addMark(m);\n\n\t\t\tthis.underlines[cfiRange] = { \"mark\": h, \"element\": h.element, \"listeners\": [emitter, cb] };\n\n\t\t\th.element.setAttribute(\"ref\", className);\n\t\t\th.element.addEventListener(\"click\", emitter);\n\t\t\th.element.addEventListener(\"touchstart\", emitter);\n\n\t\t\tif (cb) {\n\t\t\t\th.element.addEventListener(\"click\", cb);\n\t\t\t\th.element.addEventListener(\"touchstart\", cb);\n\t\t\t}\n\t\t\treturn h;\n\t\t}\n\t}, {\n\t\tkey: \"mark\",\n\t\tvalue: function mark(cfiRange) {\n\t\t\tvar _this6 = this;\n\n\t\t\tvar data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\t\tvar cb = arguments[2];\n\n\t\t\tif (!this.contents) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (cfiRange in this.marks) {\n\t\t\t\tvar item = this.marks[cfiRange];\n\t\t\t\treturn item;\n\t\t\t}\n\n\t\t\tvar range = this.contents.range(cfiRange);\n\t\t\tif (!range) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar container = range.commonAncestorContainer;\n\t\t\tvar parent = container.nodeType === 1 ? container : container.parentNode;\n\n\t\t\tvar emitter = function emitter(e) {\n\t\t\t\t_this6.emit(_constants.EVENTS.VIEWS.MARK_CLICKED, cfiRange, data);\n\t\t\t};\n\n\t\t\tif (range.collapsed && container.nodeType === 1) {\n\t\t\t\trange = new Range();\n\t\t\t\trange.selectNodeContents(container);\n\t\t\t} else if (range.collapsed) {\n\t\t\t\t// Webkit doesn't like collapsed ranges\n\t\t\t\trange = new Range();\n\t\t\t\trange.selectNodeContents(parent);\n\t\t\t}\n\n\t\t\tvar mark = this.document.createElement(\"a\");\n\t\t\tmark.setAttribute(\"ref\", \"epubjs-mk\");\n\t\t\tmark.style.position = \"absolute\";\n\n\t\t\tmark.dataset[\"epubcfi\"] = cfiRange;\n\n\t\t\tif (data) {\n\t\t\t\tObject.keys(data).forEach(function (key) {\n\t\t\t\t\tmark.dataset[key] = data[key];\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (cb) {\n\t\t\t\tmark.addEventListener(\"click\", cb);\n\t\t\t\tmark.addEventListener(\"touchstart\", cb);\n\t\t\t}\n\n\t\t\tmark.addEventListener(\"click\", emitter);\n\t\t\tmark.addEventListener(\"touchstart\", emitter);\n\n\t\t\tthis.placeMark(mark, range);\n\n\t\t\tthis.element.appendChild(mark);\n\n\t\t\tthis.marks[cfiRange] = { \"element\": mark, \"range\": range, \"listeners\": [emitter, cb] };\n\n\t\t\treturn parent;\n\t\t}\n\t}, {\n\t\tkey: \"placeMark\",\n\t\tvalue: function placeMark(element, range) {\n\t\t\tvar top = void 0,\n\t\t\t right = void 0,\n\t\t\t left = void 0;\n\n\t\t\tif (this.layout.name === \"pre-paginated\" || this.settings.axis !== \"horizontal\") {\n\t\t\t\tvar pos = range.getBoundingClientRect();\n\t\t\t\ttop = pos.top;\n\t\t\t\tright = pos.right;\n\t\t\t} else {\n\t\t\t\t// Element might break columns, so find the left most element\n\t\t\t\tvar rects = range.getClientRects();\n\n\t\t\t\tvar rect = void 0;\n\t\t\t\tfor (var i = 0; i != rects.length; i++) {\n\t\t\t\t\trect = rects[i];\n\t\t\t\t\tif (!left || rect.left < left) {\n\t\t\t\t\t\tleft = rect.left;\n\t\t\t\t\t\t// right = rect.right;\n\t\t\t\t\t\tright = Math.ceil(left / this.layout.props.pageWidth) * this.layout.props.pageWidth - this.layout.gap / 2;\n\t\t\t\t\t\ttop = rect.top;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\telement.style.top = top + \"px\";\n\t\t\telement.style.left = right + \"px\";\n\t\t}\n\t}, {\n\t\tkey: \"unhighlight\",\n\t\tvalue: function unhighlight(cfiRange) {\n\t\t\tvar item = void 0;\n\t\t\tif (cfiRange in this.highlights) {\n\t\t\t\titem = this.highlights[cfiRange];\n\n\t\t\t\tthis.pane.removeMark(item.mark);\n\t\t\t\titem.listeners.forEach(function (l) {\n\t\t\t\t\tif (l) {\n\t\t\t\t\t\titem.element.removeEventListener(\"click\", l);\n\t\t\t\t\t\titem.element.removeEventListener(\"touchstart\", l);\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tdelete this.highlights[cfiRange];\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"ununderline\",\n\t\tvalue: function ununderline(cfiRange) {\n\t\t\tvar item = void 0;\n\t\t\tif (cfiRange in this.underlines) {\n\t\t\t\titem = this.underlines[cfiRange];\n\t\t\t\tthis.pane.removeMark(item.mark);\n\t\t\t\titem.listeners.forEach(function (l) {\n\t\t\t\t\tif (l) {\n\t\t\t\t\t\titem.element.removeEventListener(\"click\", l);\n\t\t\t\t\t\titem.element.removeEventListener(\"touchstart\", l);\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tdelete this.underlines[cfiRange];\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"unmark\",\n\t\tvalue: function unmark(cfiRange) {\n\t\t\tvar item = void 0;\n\t\t\tif (cfiRange in this.marks) {\n\t\t\t\titem = this.marks[cfiRange];\n\t\t\t\tthis.element.removeChild(item.element);\n\t\t\t\titem.listeners.forEach(function (l) {\n\t\t\t\t\tif (l) {\n\t\t\t\t\t\titem.element.removeEventListener(\"click\", l);\n\t\t\t\t\t\titem.element.removeEventListener(\"touchstart\", l);\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t\tdelete this.marks[cfiRange];\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\n\t\t\tfor (var cfiRange in this.highlights) {\n\t\t\t\tthis.unhighlight(cfiRange);\n\t\t\t}\n\n\t\t\tfor (var _cfiRange in this.underlines) {\n\t\t\t\tthis.ununderline(_cfiRange);\n\t\t\t}\n\n\t\t\tfor (var _cfiRange2 in this.marks) {\n\t\t\t\tthis.unmark(_cfiRange2);\n\t\t\t}\n\n\t\t\tif (this.blobUrl) {\n\t\t\t\t(0, _core.revokeBlobUrl)(this.blobUrl);\n\t\t\t}\n\n\t\t\tif (this.displayed) {\n\t\t\t\tthis.displayed = false;\n\n\t\t\t\tthis.removeListeners();\n\t\t\t\tthis.contents.destroy();\n\n\t\t\t\tthis.stopExpanding = true;\n\t\t\t\tthis.element.removeChild(this.iframe);\n\n\t\t\t\tthis.iframe = undefined;\n\t\t\t\tthis.contents = undefined;\n\n\t\t\t\tthis._textWidth = null;\n\t\t\t\tthis._textHeight = null;\n\t\t\t\tthis._width = null;\n\t\t\t\tthis._height = null;\n\t\t\t}\n\n\t\t\t// this.element.style.height = \"0px\";\n\t\t\t// this.element.style.width = \"0px\";\n\t\t}\n\t}]);\n\n\treturn IframeView;\n}();\n\n(0, _eventEmitter2.default)(IframeView.prototype);\n\nexports.default = IframeView;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/managers/views/iframe.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/mapping.js": -/*!********************************************!*\ - !*** ./node_modules/epubjs/lib/mapping.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Map text locations to CFI ranges\n * @class\n * @param {Layout} layout Layout to apply\n * @param {string} [direction=\"ltr\"] Text direction\n * @param {string} [axis=\"horizontal\"] vertical or horizontal axis\n * @param {boolean} [dev] toggle developer highlighting\n */\nvar Mapping = function () {\n\tfunction Mapping(layout, direction, axis, dev) {\n\t\t_classCallCheck(this, Mapping);\n\n\t\tthis.layout = layout;\n\t\tthis.horizontal = axis === \"horizontal\" ? true : false;\n\t\tthis.direction = direction || \"ltr\";\n\t\tthis._dev = dev;\n\t}\n\n\t/**\n * Find CFI pairs for entire section at once\n */\n\n\n\t_createClass(Mapping, [{\n\t\tkey: \"section\",\n\t\tvalue: function section(view) {\n\t\t\tvar ranges = this.findRanges(view);\n\t\t\tvar map = this.rangeListToCfiList(view.section.cfiBase, ranges);\n\n\t\t\treturn map;\n\t\t}\n\n\t\t/**\n * Find CFI pairs for a page\n * @param {Contents} contents Contents from view\n * @param {string} cfiBase string of the base for a cfi\n * @param {number} start position to start at\n * @param {number} end position to end at\n */\n\n\t}, {\n\t\tkey: \"page\",\n\t\tvalue: function page(contents, cfiBase, start, end) {\n\t\t\tvar root = contents && contents.document ? contents.document.body : false;\n\t\t\tvar result;\n\n\t\t\tif (!root) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresult = this.rangePairToCfiPair(cfiBase, {\n\t\t\t\tstart: this.findStart(root, start, end),\n\t\t\t\tend: this.findEnd(root, start, end)\n\t\t\t});\n\n\t\t\tif (this._dev === true) {\n\t\t\t\tvar doc = contents.document;\n\t\t\t\tvar startRange = new _epubcfi2.default(result.start).toRange(doc);\n\t\t\t\tvar endRange = new _epubcfi2.default(result.end).toRange(doc);\n\n\t\t\t\tvar selection = doc.defaultView.getSelection();\n\t\t\t\tvar r = doc.createRange();\n\t\t\t\tselection.removeAllRanges();\n\t\t\t\tr.setStart(startRange.startContainer, startRange.startOffset);\n\t\t\t\tr.setEnd(endRange.endContainer, endRange.endOffset);\n\t\t\t\tselection.addRange(r);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n * Walk a node, preforming a function on each node it finds\n * @private\n * @param {Node} root Node to walkToNode\n * @param {function} func walk function\n * @return {*} returns the result of the walk function\n */\n\n\t}, {\n\t\tkey: \"walk\",\n\t\tvalue: function walk(root, func) {\n\t\t\t// IE11 has strange issue, if root is text node IE throws exception on\n\t\t\t// calling treeWalker.nextNode(), saying\n\t\t\t// Unexpected call to method or property access instead of returing null value\n\t\t\tif (root && root.nodeType === Node.TEXT_NODE) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// safeFilter is required so that it can work in IE as filter is a function for IE\n\t\t\t// and for other browser filter is an object.\n\t\t\tvar filter = {\n\t\t\t\tacceptNode: function acceptNode(node) {\n\t\t\t\t\tif (node.data.trim().length > 0) {\n\t\t\t\t\t\treturn NodeFilter.FILTER_ACCEPT;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn NodeFilter.FILTER_REJECT;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tvar safeFilter = filter.acceptNode;\n\t\t\tsafeFilter.acceptNode = filter.acceptNode;\n\n\t\t\tvar treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, safeFilter, false);\n\t\t\tvar node;\n\t\t\tvar result;\n\t\t\twhile (node = treeWalker.nextNode()) {\n\t\t\t\tresult = func(node);\n\t\t\t\tif (result) break;\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}\n\t}, {\n\t\tkey: \"findRanges\",\n\t\tvalue: function findRanges(view) {\n\t\t\tvar columns = [];\n\t\t\tvar scrollWidth = view.contents.scrollWidth();\n\t\t\tvar spreads = Math.ceil(scrollWidth / this.layout.spreadWidth);\n\t\t\tvar count = spreads * this.layout.divisor;\n\t\t\tvar columnWidth = this.layout.columnWidth;\n\t\t\tvar gap = this.layout.gap;\n\t\t\tvar start, end;\n\n\t\t\tfor (var i = 0; i < count.pages; i++) {\n\t\t\t\tstart = (columnWidth + gap) * i;\n\t\t\t\tend = columnWidth * (i + 1) + gap * i;\n\t\t\t\tcolumns.push({\n\t\t\t\t\tstart: this.findStart(view.document.body, start, end),\n\t\t\t\t\tend: this.findEnd(view.document.body, start, end)\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn columns;\n\t\t}\n\n\t\t/**\n * Find Start Range\n * @private\n * @param {Node} root root node\n * @param {number} start position to start at\n * @param {number} end position to end at\n * @return {Range}\n */\n\n\t}, {\n\t\tkey: \"findStart\",\n\t\tvalue: function findStart(root, start, end) {\n\t\t\tvar _this = this;\n\n\t\t\tvar stack = [root];\n\t\t\tvar $el;\n\t\t\tvar found;\n\t\t\tvar $prev = root;\n\n\t\t\twhile (stack.length) {\n\n\t\t\t\t$el = stack.shift();\n\n\t\t\t\tfound = this.walk($el, function (node) {\n\t\t\t\t\tvar left, right, top, bottom;\n\t\t\t\t\tvar elPos;\n\t\t\t\t\tvar elRange;\n\n\t\t\t\t\telPos = (0, _core.nodeBounds)(node);\n\n\t\t\t\t\tif (_this.horizontal && _this.direction === \"ltr\") {\n\n\t\t\t\t\t\tleft = _this.horizontal ? elPos.left : elPos.top;\n\t\t\t\t\t\tright = _this.horizontal ? elPos.right : elPos.bottom;\n\n\t\t\t\t\t\tif (left >= start && left <= end) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else if (right > start) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$prev = node;\n\t\t\t\t\t\t\tstack.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (_this.horizontal && _this.direction === \"rtl\") {\n\n\t\t\t\t\t\tleft = elPos.left;\n\t\t\t\t\t\tright = elPos.right;\n\n\t\t\t\t\t\tif (right <= end && right >= start) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else if (left < end) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$prev = node;\n\t\t\t\t\t\t\tstack.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttop = elPos.top;\n\t\t\t\t\t\tbottom = elPos.bottom;\n\n\t\t\t\t\t\tif (top >= start && top <= end) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else if (bottom > start) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$prev = node;\n\t\t\t\t\t\t\tstack.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (found) {\n\t\t\t\t\treturn this.findTextStartRange(found, start, end);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Return last element\n\t\t\treturn this.findTextStartRange($prev, start, end);\n\t\t}\n\n\t\t/**\n * Find End Range\n * @private\n * @param {Node} root root node\n * @param {number} start position to start at\n * @param {number} end position to end at\n * @return {Range}\n */\n\n\t}, {\n\t\tkey: \"findEnd\",\n\t\tvalue: function findEnd(root, start, end) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar stack = [root];\n\t\t\tvar $el;\n\t\t\tvar $prev = root;\n\t\t\tvar found;\n\n\t\t\twhile (stack.length) {\n\n\t\t\t\t$el = stack.shift();\n\n\t\t\t\tfound = this.walk($el, function (node) {\n\n\t\t\t\t\tvar left, right, top, bottom;\n\t\t\t\t\tvar elPos;\n\t\t\t\t\tvar elRange;\n\n\t\t\t\t\telPos = (0, _core.nodeBounds)(node);\n\n\t\t\t\t\tif (_this2.horizontal && _this2.direction === \"ltr\") {\n\n\t\t\t\t\t\tleft = Math.round(elPos.left);\n\t\t\t\t\t\tright = Math.round(elPos.right);\n\n\t\t\t\t\t\tif (left > end && $prev) {\n\t\t\t\t\t\t\treturn $prev;\n\t\t\t\t\t\t} else if (right > end) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$prev = node;\n\t\t\t\t\t\t\tstack.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (_this2.horizontal && _this2.direction === \"rtl\") {\n\n\t\t\t\t\t\tleft = Math.round(_this2.horizontal ? elPos.left : elPos.top);\n\t\t\t\t\t\tright = Math.round(_this2.horizontal ? elPos.right : elPos.bottom);\n\n\t\t\t\t\t\tif (right < start && $prev) {\n\t\t\t\t\t\t\treturn $prev;\n\t\t\t\t\t\t} else if (left < start) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$prev = node;\n\t\t\t\t\t\t\tstack.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\ttop = Math.round(elPos.top);\n\t\t\t\t\t\tbottom = Math.round(elPos.bottom);\n\n\t\t\t\t\t\tif (top > end && $prev) {\n\t\t\t\t\t\t\treturn $prev;\n\t\t\t\t\t\t} else if (bottom > end) {\n\t\t\t\t\t\t\treturn node;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$prev = node;\n\t\t\t\t\t\t\tstack.push(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (found) {\n\t\t\t\t\treturn this.findTextEndRange(found, start, end);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// end of chapter\n\t\t\treturn this.findTextEndRange($prev, start, end);\n\t\t}\n\n\t\t/**\n * Find Text Start Range\n * @private\n * @param {Node} root root node\n * @param {number} start position to start at\n * @param {number} end position to end at\n * @return {Range}\n */\n\n\t}, {\n\t\tkey: \"findTextStartRange\",\n\t\tvalue: function findTextStartRange(node, start, end) {\n\t\t\tvar ranges = this.splitTextNodeIntoRanges(node);\n\t\t\tvar range;\n\t\t\tvar pos;\n\t\t\tvar left, top, right;\n\n\t\t\tfor (var i = 0; i < ranges.length; i++) {\n\t\t\t\trange = ranges[i];\n\n\t\t\t\tpos = range.getBoundingClientRect();\n\n\t\t\t\tif (this.horizontal && this.direction === \"ltr\") {\n\n\t\t\t\t\tleft = pos.left;\n\t\t\t\t\tif (left >= start) {\n\t\t\t\t\t\treturn range;\n\t\t\t\t\t}\n\t\t\t\t} else if (this.horizontal && this.direction === \"rtl\") {\n\n\t\t\t\t\tright = pos.right;\n\t\t\t\t\tif (right <= end) {\n\t\t\t\t\t\treturn range;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\n\t\t\t\t\ttop = pos.top;\n\t\t\t\t\tif (top >= start) {\n\t\t\t\t\t\treturn range;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// prev = range;\n\t\t\t}\n\n\t\t\treturn ranges[0];\n\t\t}\n\n\t\t/**\n * Find Text End Range\n * @private\n * @param {Node} root root node\n * @param {number} start position to start at\n * @param {number} end position to end at\n * @return {Range}\n */\n\n\t}, {\n\t\tkey: \"findTextEndRange\",\n\t\tvalue: function findTextEndRange(node, start, end) {\n\t\t\tvar ranges = this.splitTextNodeIntoRanges(node);\n\t\t\tvar prev;\n\t\t\tvar range;\n\t\t\tvar pos;\n\t\t\tvar left, right, top, bottom;\n\n\t\t\tfor (var i = 0; i < ranges.length; i++) {\n\t\t\t\trange = ranges[i];\n\n\t\t\t\tpos = range.getBoundingClientRect();\n\n\t\t\t\tif (this.horizontal && this.direction === \"ltr\") {\n\n\t\t\t\t\tleft = pos.left;\n\t\t\t\t\tright = pos.right;\n\n\t\t\t\t\tif (left > end && prev) {\n\t\t\t\t\t\treturn prev;\n\t\t\t\t\t} else if (right > end) {\n\t\t\t\t\t\treturn range;\n\t\t\t\t\t}\n\t\t\t\t} else if (this.horizontal && this.direction === \"rtl\") {\n\n\t\t\t\t\tleft = pos.left;\n\t\t\t\t\tright = pos.right;\n\n\t\t\t\t\tif (right < start && prev) {\n\t\t\t\t\t\treturn prev;\n\t\t\t\t\t} else if (left < start) {\n\t\t\t\t\t\treturn range;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\n\t\t\t\t\ttop = pos.top;\n\t\t\t\t\tbottom = pos.bottom;\n\n\t\t\t\t\tif (top > end && prev) {\n\t\t\t\t\t\treturn prev;\n\t\t\t\t\t} else if (bottom > end) {\n\t\t\t\t\t\treturn range;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tprev = range;\n\t\t\t}\n\n\t\t\t// Ends before limit\n\t\t\treturn ranges[ranges.length - 1];\n\t\t}\n\n\t\t/**\n * Split up a text node into ranges for each word\n * @private\n * @param {Node} root root node\n * @param {string} [_splitter] what to split on\n * @return {Range[]}\n */\n\n\t}, {\n\t\tkey: \"splitTextNodeIntoRanges\",\n\t\tvalue: function splitTextNodeIntoRanges(node, _splitter) {\n\t\t\tvar ranges = [];\n\t\t\tvar textContent = node.textContent || \"\";\n\t\t\tvar text = textContent.trim();\n\t\t\tvar range;\n\t\t\tvar doc = node.ownerDocument;\n\t\t\tvar splitter = _splitter || \" \";\n\n\t\t\tvar pos = text.indexOf(splitter);\n\n\t\t\tif (pos === -1 || node.nodeType != Node.TEXT_NODE) {\n\t\t\t\trange = doc.createRange();\n\t\t\t\trange.selectNodeContents(node);\n\t\t\t\treturn [range];\n\t\t\t}\n\n\t\t\trange = doc.createRange();\n\t\t\trange.setStart(node, 0);\n\t\t\trange.setEnd(node, pos);\n\t\t\tranges.push(range);\n\t\t\trange = false;\n\n\t\t\twhile (pos != -1) {\n\n\t\t\t\tpos = text.indexOf(splitter, pos + 1);\n\t\t\t\tif (pos > 0) {\n\n\t\t\t\t\tif (range) {\n\t\t\t\t\t\trange.setEnd(node, pos);\n\t\t\t\t\t\tranges.push(range);\n\t\t\t\t\t}\n\n\t\t\t\t\trange = doc.createRange();\n\t\t\t\t\trange.setStart(node, pos + 1);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (range) {\n\t\t\t\trange.setEnd(node, text.length);\n\t\t\t\tranges.push(range);\n\t\t\t}\n\n\t\t\treturn ranges;\n\t\t}\n\n\t\t/**\n * Turn a pair of ranges into a pair of CFIs\n * @private\n * @param {string} cfiBase base string for an EpubCFI\n * @param {object} rangePair { start: Range, end: Range }\n * @return {object} { start: \"epubcfi(...)\", end: \"epubcfi(...)\" }\n */\n\n\t}, {\n\t\tkey: \"rangePairToCfiPair\",\n\t\tvalue: function rangePairToCfiPair(cfiBase, rangePair) {\n\n\t\t\tvar startRange = rangePair.start;\n\t\t\tvar endRange = rangePair.end;\n\n\t\t\tstartRange.collapse(true);\n\t\t\tendRange.collapse(false);\n\n\t\t\tvar startCfi = new _epubcfi2.default(startRange, cfiBase).toString();\n\t\t\tvar endCfi = new _epubcfi2.default(endRange, cfiBase).toString();\n\n\t\t\treturn {\n\t\t\t\tstart: startCfi,\n\t\t\t\tend: endCfi\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: \"rangeListToCfiList\",\n\t\tvalue: function rangeListToCfiList(cfiBase, columns) {\n\t\t\tvar map = [];\n\t\t\tvar cifPair;\n\n\t\t\tfor (var i = 0; i < columns.length; i++) {\n\t\t\t\tcifPair = this.rangePairToCfiPair(cfiBase, columns[i]);\n\n\t\t\t\tmap.push(cifPair);\n\t\t\t}\n\n\t\t\treturn map;\n\t\t}\n\n\t\t/**\n * Set the axis for mapping\n * @param {string} axis horizontal | vertical\n * @return {boolean} is it horizontal?\n */\n\n\t}, {\n\t\tkey: \"axis\",\n\t\tvalue: function axis(_axis) {\n\t\t\tif (_axis) {\n\t\t\t\tthis.horizontal = _axis === \"horizontal\" ? true : false;\n\t\t\t}\n\t\t\treturn this.horizontal;\n\t\t}\n\t}]);\n\n\treturn Mapping;\n}();\n\nexports.default = Mapping;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/mapping.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/navigation.js": -/*!***********************************************!*\ - !*** ./node_modules/epubjs/lib/navigation.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Navigation Parser\n * @param {document} xml navigation html / xhtml / ncx\n */\nvar Navigation = function () {\n\tfunction Navigation(xml) {\n\t\t_classCallCheck(this, Navigation);\n\n\t\tthis.toc = [];\n\t\tthis.tocByHref = {};\n\t\tthis.tocById = {};\n\n\t\tthis.landmarks = [];\n\t\tthis.landmarksByType = {};\n\n\t\tthis.length = 0;\n\t\tif (xml) {\n\t\t\tthis.parse(xml);\n\t\t}\n\t}\n\n\t/**\n * Parse out the navigation items\n * @param {document} xml navigation html / xhtml / ncx\n */\n\n\n\t_createClass(Navigation, [{\n\t\tkey: \"parse\",\n\t\tvalue: function parse(xml) {\n\t\t\tvar isXml = xml.nodeType;\n\t\t\tvar html = void 0;\n\t\t\tvar ncx = void 0;\n\n\t\t\tif (isXml) {\n\t\t\t\thtml = (0, _core.qs)(xml, \"html\");\n\t\t\t\tncx = (0, _core.qs)(xml, \"ncx\");\n\t\t\t}\n\n\t\t\tif (!isXml) {\n\t\t\t\tthis.toc = this.load(xml);\n\t\t\t} else if (html) {\n\t\t\t\tthis.toc = this.parseNav(xml);\n\t\t\t\tthis.landmarks = this.parseLandmarks(xml);\n\t\t\t} else if (ncx) {\n\t\t\t\tthis.toc = this.parseNcx(xml);\n\t\t\t}\n\n\t\t\tthis.length = 0;\n\n\t\t\tthis.unpack(this.toc);\n\t\t}\n\n\t\t/**\n * Unpack navigation items\n * @private\n * @param {array} toc\n */\n\n\t}, {\n\t\tkey: \"unpack\",\n\t\tvalue: function unpack(toc) {\n\t\t\tvar item;\n\n\t\t\tfor (var i = 0; i < toc.length; i++) {\n\t\t\t\titem = toc[i];\n\n\t\t\t\tif (item.href) {\n\t\t\t\t\tthis.tocByHref[item.href] = i;\n\t\t\t\t}\n\n\t\t\t\tif (item.id) {\n\t\t\t\t\tthis.tocById[item.id] = i;\n\t\t\t\t}\n\n\t\t\t\tthis.length++;\n\n\t\t\t\tif (item.subitems.length) {\n\t\t\t\t\tthis.unpack(item.subitems);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Get an item from the navigation\n * @param {string} target\n * @return {object} navItem\n */\n\n\t}, {\n\t\tkey: \"get\",\n\t\tvalue: function get(target) {\n\t\t\tvar index;\n\n\t\t\tif (!target) {\n\t\t\t\treturn this.toc;\n\t\t\t}\n\n\t\t\tif (target.indexOf(\"#\") === 0) {\n\t\t\t\tindex = this.tocById[target.substring(1)];\n\t\t\t} else if (target in this.tocByHref) {\n\t\t\t\tindex = this.tocByHref[target];\n\t\t\t}\n\n\t\t\treturn this.toc[index];\n\t\t}\n\n\t\t/**\n * Get a landmark by type\n * List of types: https://idpf.github.io/epub-vocabs/structure/\n * @param {string} type\n * @return {object} landmarkItem\n */\n\n\t}, {\n\t\tkey: \"landmark\",\n\t\tvalue: function landmark(type) {\n\t\t\tvar index;\n\n\t\t\tif (!type) {\n\t\t\t\treturn this.landmarks;\n\t\t\t}\n\n\t\t\tindex = this.landmarksByType[type];\n\n\t\t\treturn this.landmarks[index];\n\t\t}\n\n\t\t/**\n * Parse toc from a Epub > 3.0 Nav\n * @private\n * @param {document} navHtml\n * @return {array} navigation list\n */\n\n\t}, {\n\t\tkey: \"parseNav\",\n\t\tvalue: function parseNav(navHtml) {\n\t\t\tvar navElement = (0, _core.querySelectorByType)(navHtml, \"nav\", \"toc\");\n\t\t\tvar navItems = navElement ? (0, _core.qsa)(navElement, \"li\") : [];\n\t\t\tvar length = navItems.length;\n\t\t\tvar i;\n\t\t\tvar toc = {};\n\t\t\tvar list = [];\n\t\t\tvar item, parent;\n\n\t\t\tif (!navItems || length === 0) return list;\n\n\t\t\tfor (i = 0; i < length; ++i) {\n\t\t\t\titem = this.navItem(navItems[i]);\n\t\t\t\tif (item) {\n\t\t\t\t\ttoc[item.id] = item;\n\t\t\t\t\tif (!item.parent) {\n\t\t\t\t\t\tlist.push(item);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparent = toc[item.parent];\n\t\t\t\t\t\tparent.subitems.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\n\t\t/**\n * Create a navItem\n * @private\n * @param {element} item\n * @return {object} navItem\n */\n\n\t}, {\n\t\tkey: \"navItem\",\n\t\tvalue: function navItem(item) {\n\t\t\tvar id = item.getAttribute(\"id\") || undefined;\n\t\t\tvar content = (0, _core.filterChildren)(item, \"a\", true);\n\n\t\t\tif (!content) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar src = content.getAttribute(\"href\") || \"\";\n\n\t\t\tif (!id) {\n\t\t\t\tid = src;\n\t\t\t}\n\t\t\tvar text = content.textContent || \"\";\n\t\t\tvar subitems = [];\n\t\t\tvar parentItem = (0, _core.getParentByTagName)(item, \"li\");\n\t\t\tvar parent = void 0;\n\n\t\t\tif (parentItem) {\n\t\t\t\tparent = parentItem.getAttribute(\"id\");\n\t\t\t\tif (!parent) {\n\t\t\t\t\tvar parentContent = (0, _core.filterChildren)(parentItem, \"a\", true);\n\t\t\t\t\tparent = parentContent && parentContent.getAttribute(\"href\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (!parent && parentItem) {\n\t\t\t\tparentItem = (0, _core.getParentByTagName)(parentItem, \"li\");\n\t\t\t\tif (parentItem) {\n\t\t\t\t\tparent = parentItem.getAttribute(\"id\");\n\t\t\t\t\tif (!parent) {\n\t\t\t\t\t\tvar _parentContent = (0, _core.filterChildren)(parentItem, \"a\", true);\n\t\t\t\t\t\tparent = _parentContent && _parentContent.getAttribute(\"href\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t\"id\": id,\n\t\t\t\t\"href\": src,\n\t\t\t\t\"label\": text,\n\t\t\t\t\"subitems\": subitems,\n\t\t\t\t\"parent\": parent\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Parse landmarks from a Epub > 3.0 Nav\n * @private\n * @param {document} navHtml\n * @return {array} landmarks list\n */\n\n\t}, {\n\t\tkey: \"parseLandmarks\",\n\t\tvalue: function parseLandmarks(navHtml) {\n\t\t\tvar navElement = (0, _core.querySelectorByType)(navHtml, \"nav\", \"landmarks\");\n\t\t\tvar navItems = navElement ? (0, _core.qsa)(navElement, \"li\") : [];\n\t\t\tvar length = navItems.length;\n\t\t\tvar i;\n\t\t\tvar list = [];\n\t\t\tvar item;\n\n\t\t\tif (!navItems || length === 0) return list;\n\n\t\t\tfor (i = 0; i < length; ++i) {\n\t\t\t\titem = this.landmarkItem(navItems[i]);\n\t\t\t\tif (item) {\n\t\t\t\t\tlist.push(item);\n\t\t\t\t\tthis.landmarksByType[item.type] = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\n\t\t/**\n * Create a landmarkItem\n * @private\n * @param {element} item\n * @return {object} landmarkItem\n */\n\n\t}, {\n\t\tkey: \"landmarkItem\",\n\t\tvalue: function landmarkItem(item) {\n\t\t\tvar content = (0, _core.filterChildren)(item, \"a\", true);\n\n\t\t\tif (!content) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar type = content.getAttributeNS(\"http://www.idpf.org/2007/ops\", \"type\") || undefined;\n\t\t\tvar href = content.getAttribute(\"href\") || \"\";\n\t\t\tvar text = content.textContent || \"\";\n\n\t\t\treturn {\n\t\t\t\t\"href\": href,\n\t\t\t\t\"label\": text,\n\t\t\t\t\"type\": type\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Parse from a Epub > 3.0 NC\n * @private\n * @param {document} navHtml\n * @return {array} navigation list\n */\n\n\t}, {\n\t\tkey: \"parseNcx\",\n\t\tvalue: function parseNcx(tocXml) {\n\t\t\tvar navPoints = (0, _core.qsa)(tocXml, \"navPoint\");\n\t\t\tvar length = navPoints.length;\n\t\t\tvar i;\n\t\t\tvar toc = {};\n\t\t\tvar list = [];\n\t\t\tvar item, parent;\n\n\t\t\tif (!navPoints || length === 0) return list;\n\n\t\t\tfor (i = 0; i < length; ++i) {\n\t\t\t\titem = this.ncxItem(navPoints[i]);\n\t\t\t\ttoc[item.id] = item;\n\t\t\t\tif (!item.parent) {\n\t\t\t\t\tlist.push(item);\n\t\t\t\t} else {\n\t\t\t\t\tparent = toc[item.parent];\n\t\t\t\t\tparent.subitems.push(item);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\n\t\t/**\n * Create a ncxItem\n * @private\n * @param {element} item\n * @return {object} ncxItem\n */\n\n\t}, {\n\t\tkey: \"ncxItem\",\n\t\tvalue: function ncxItem(item) {\n\t\t\tvar id = item.getAttribute(\"id\") || false,\n\t\t\t content = (0, _core.qs)(item, \"content\"),\n\t\t\t src = content.getAttribute(\"src\"),\n\t\t\t navLabel = (0, _core.qs)(item, \"navLabel\"),\n\t\t\t text = navLabel.textContent ? navLabel.textContent : \"\",\n\t\t\t subitems = [],\n\t\t\t parentNode = item.parentNode,\n\t\t\t parent;\n\n\t\t\tif (parentNode && (parentNode.nodeName === \"navPoint\" || parentNode.nodeName.split(':').slice(-1)[0] === \"navPoint\")) {\n\t\t\t\tparent = parentNode.getAttribute(\"id\");\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t\"id\": id,\n\t\t\t\t\"href\": src,\n\t\t\t\t\"label\": text,\n\t\t\t\t\"subitems\": subitems,\n\t\t\t\t\"parent\": parent\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Load Spine Items\n * @param {object} json the items to be loaded\n * @return {Array} navItems\n */\n\n\t}, {\n\t\tkey: \"load\",\n\t\tvalue: function load(json) {\n\t\t\tvar _this = this;\n\n\t\t\treturn json.map(function (item) {\n\t\t\t\titem.label = item.title;\n\t\t\t\titem.subitems = item.children ? _this.load(item.children) : [];\n\t\t\t\treturn item;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * forEach pass through\n * @param {Function} fn function to run on each item\n * @return {method} forEach loop\n */\n\n\t}, {\n\t\tkey: \"forEach\",\n\t\tvalue: function forEach(fn) {\n\t\t\treturn this.toc.forEach(fn);\n\t\t}\n\t}]);\n\n\treturn Navigation;\n}();\n\nexports.default = Navigation;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/navigation.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/packaging.js": -/*!**********************************************!*\ - !*** ./node_modules/epubjs/lib/packaging.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Open Packaging Format Parser\n * @class\n * @param {document} packageDocument OPF XML\n */\nvar Packaging = function () {\n\tfunction Packaging(packageDocument) {\n\t\t_classCallCheck(this, Packaging);\n\n\t\tthis.manifest = {};\n\t\tthis.navPath = '';\n\t\tthis.ncxPath = '';\n\t\tthis.coverPath = '';\n\t\tthis.spineNodeIndex = 0;\n\t\tthis.spine = [];\n\t\tthis.metadata = {};\n\n\t\tif (packageDocument) {\n\t\t\tthis.parse(packageDocument);\n\t\t}\n\t}\n\n\t/**\n * Parse OPF XML\n * @param {document} packageDocument OPF XML\n * @return {object} parsed package parts\n */\n\n\n\t_createClass(Packaging, [{\n\t\tkey: 'parse',\n\t\tvalue: function parse(packageDocument) {\n\t\t\tvar metadataNode, manifestNode, spineNode;\n\n\t\t\tif (!packageDocument) {\n\t\t\t\tthrow new Error(\"Package File Not Found\");\n\t\t\t}\n\n\t\t\tmetadataNode = (0, _core.qs)(packageDocument, \"metadata\");\n\t\t\tif (!metadataNode) {\n\t\t\t\tthrow new Error(\"No Metadata Found\");\n\t\t\t}\n\n\t\t\tmanifestNode = (0, _core.qs)(packageDocument, \"manifest\");\n\t\t\tif (!manifestNode) {\n\t\t\t\tthrow new Error(\"No Manifest Found\");\n\t\t\t}\n\n\t\t\tspineNode = (0, _core.qs)(packageDocument, \"spine\");\n\t\t\tif (!spineNode) {\n\t\t\t\tthrow new Error(\"No Spine Found\");\n\t\t\t}\n\n\t\t\tthis.manifest = this.parseManifest(manifestNode);\n\t\t\tthis.navPath = this.findNavPath(manifestNode);\n\t\t\tthis.ncxPath = this.findNcxPath(manifestNode, spineNode);\n\t\t\tthis.coverPath = this.findCoverPath(packageDocument);\n\n\t\t\tthis.spineNodeIndex = (0, _core.indexOfElementNode)(spineNode);\n\n\t\t\tthis.spine = this.parseSpine(spineNode, this.manifest);\n\n\t\t\tthis.uniqueIdentifier = this.findUniqueIdentifier(packageDocument);\n\t\t\tthis.metadata = this.parseMetadata(metadataNode);\n\n\t\t\tthis.metadata.direction = spineNode.getAttribute(\"page-progression-direction\");\n\n\t\t\treturn {\n\t\t\t\t\"metadata\": this.metadata,\n\t\t\t\t\"spine\": this.spine,\n\t\t\t\t\"manifest\": this.manifest,\n\t\t\t\t\"navPath\": this.navPath,\n\t\t\t\t\"ncxPath\": this.ncxPath,\n\t\t\t\t\"coverPath\": this.coverPath,\n\t\t\t\t\"spineNodeIndex\": this.spineNodeIndex\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Parse Metadata\n * @private\n * @param {node} xml\n * @return {object} metadata\n */\n\n\t}, {\n\t\tkey: 'parseMetadata',\n\t\tvalue: function parseMetadata(xml) {\n\t\t\tvar metadata = {};\n\n\t\t\tmetadata.title = this.getElementText(xml, \"title\");\n\t\t\tmetadata.creator = this.getElementText(xml, \"creator\");\n\t\t\tmetadata.description = this.getElementText(xml, \"description\");\n\n\t\t\tmetadata.pubdate = this.getElementText(xml, \"date\");\n\n\t\t\tmetadata.publisher = this.getElementText(xml, \"publisher\");\n\n\t\t\tmetadata.identifier = this.getElementText(xml, \"identifier\");\n\t\t\tmetadata.language = this.getElementText(xml, \"language\");\n\t\t\tmetadata.rights = this.getElementText(xml, \"rights\");\n\n\t\t\tmetadata.modified_date = this.getPropertyText(xml, \"dcterms:modified\");\n\n\t\t\tmetadata.layout = this.getPropertyText(xml, \"rendition:layout\");\n\t\t\tmetadata.orientation = this.getPropertyText(xml, \"rendition:orientation\");\n\t\t\tmetadata.flow = this.getPropertyText(xml, \"rendition:flow\");\n\t\t\tmetadata.viewport = this.getPropertyText(xml, \"rendition:viewport\");\n\t\t\tmetadata.media_active_class = this.getPropertyText(xml, \"media:active-class\");\n\t\t\t// metadata.page_prog_dir = packageXml.querySelector(\"spine\").getAttribute(\"page-progression-direction\");\n\n\t\t\treturn metadata;\n\t\t}\n\n\t\t/**\n * Parse Manifest\n * @private\n * @param {node} manifestXml\n * @return {object} manifest\n */\n\n\t}, {\n\t\tkey: 'parseManifest',\n\t\tvalue: function parseManifest(manifestXml) {\n\t\t\tvar manifest = {};\n\n\t\t\t//-- Turn items into an array\n\t\t\t// var selected = manifestXml.querySelectorAll(\"item\");\n\t\t\tvar selected = (0, _core.qsa)(manifestXml, \"item\");\n\t\t\tvar items = Array.prototype.slice.call(selected);\n\n\t\t\t//-- Create an object with the id as key\n\t\t\titems.forEach(function (item) {\n\t\t\t\tvar id = item.getAttribute(\"id\"),\n\t\t\t\t href = item.getAttribute(\"href\") || \"\",\n\t\t\t\t type = item.getAttribute(\"media-type\") || \"\",\n\t\t\t\t overlay = item.getAttribute(\"media-overlay\") || \"\",\n\t\t\t\t properties = item.getAttribute(\"properties\") || \"\";\n\n\t\t\t\tmanifest[id] = {\n\t\t\t\t\t\"href\": href,\n\t\t\t\t\t// \"url\" : href,\n\t\t\t\t\t\"type\": type,\n\t\t\t\t\t\"overlay\": overlay,\n\t\t\t\t\t\"properties\": properties.length ? properties.split(\" \") : []\n\t\t\t\t};\n\t\t\t});\n\n\t\t\treturn manifest;\n\t\t}\n\n\t\t/**\n * Parse Spine\n * @private\n * @param {node} spineXml\n * @param {Packaging.manifest} manifest\n * @return {object} spine\n */\n\n\t}, {\n\t\tkey: 'parseSpine',\n\t\tvalue: function parseSpine(spineXml, manifest) {\n\t\t\tvar spine = [];\n\n\t\t\tvar selected = (0, _core.qsa)(spineXml, \"itemref\");\n\t\t\tvar items = Array.prototype.slice.call(selected);\n\n\t\t\t// var epubcfi = new EpubCFI();\n\n\t\t\t//-- Add to array to mantain ordering and cross reference with manifest\n\t\t\titems.forEach(function (item, index) {\n\t\t\t\tvar idref = item.getAttribute(\"idref\");\n\t\t\t\t// var cfiBase = epubcfi.generateChapterComponent(spineNodeIndex, index, Id);\n\t\t\t\tvar props = item.getAttribute(\"properties\") || \"\";\n\t\t\t\tvar propArray = props.length ? props.split(\" \") : [];\n\t\t\t\t// var manifestProps = manifest[Id].properties;\n\t\t\t\t// var manifestPropArray = manifestProps.length ? manifestProps.split(\" \") : [];\n\n\t\t\t\tvar itemref = {\n\t\t\t\t\t\"idref\": idref,\n\t\t\t\t\t\"linear\": item.getAttribute(\"linear\") || \"yes\",\n\t\t\t\t\t\"properties\": propArray,\n\t\t\t\t\t// \"href\" : manifest[Id].href,\n\t\t\t\t\t// \"url\" : manifest[Id].url,\n\t\t\t\t\t\"index\": index\n\t\t\t\t\t// \"cfiBase\" : cfiBase\n\t\t\t\t};\n\t\t\t\tspine.push(itemref);\n\t\t\t});\n\n\t\t\treturn spine;\n\t\t}\n\n\t\t/**\n * Find Unique Identifier\n * @private\n * @param {node} packageXml\n * @return {string} Unique Identifier text\n */\n\n\t}, {\n\t\tkey: 'findUniqueIdentifier',\n\t\tvalue: function findUniqueIdentifier(packageXml) {\n\t\t\tvar uniqueIdentifierId = packageXml.documentElement.getAttribute(\"unique-identifier\");\n\t\t\tif (!uniqueIdentifierId) {\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\tvar identifier = packageXml.getElementById(uniqueIdentifierId);\n\t\t\tif (!identifier) {\n\t\t\t\treturn \"\";\n\t\t\t}\n\n\t\t\tif (identifier.localName === \"identifier\" && identifier.namespaceURI === \"http://purl.org/dc/elements/1.1/\") {\n\t\t\t\treturn identifier.childNodes[0].nodeValue.trim();\n\t\t\t}\n\n\t\t\treturn \"\";\n\t\t}\n\n\t\t/**\n * Find TOC NAV\n * @private\n * @param {element} manifestNode\n * @return {string}\n */\n\n\t}, {\n\t\tkey: 'findNavPath',\n\t\tvalue: function findNavPath(manifestNode) {\n\t\t\t// Find item with property \"nav\"\n\t\t\t// Should catch nav irregardless of order\n\t\t\t// var node = manifestNode.querySelector(\"item[properties$='nav'], item[properties^='nav '], item[properties*=' nav ']\");\n\t\t\tvar node = (0, _core.qsp)(manifestNode, \"item\", { \"properties\": \"nav\" });\n\t\t\treturn node ? node.getAttribute(\"href\") : false;\n\t\t}\n\n\t\t/**\n * Find TOC NCX\n * media-type=\"application/x-dtbncx+xml\" href=\"toc.ncx\"\n * @private\n * @param {element} manifestNode\n * @param {element} spineNode\n * @return {string}\n */\n\n\t}, {\n\t\tkey: 'findNcxPath',\n\t\tvalue: function findNcxPath(manifestNode, spineNode) {\n\t\t\t// var node = manifestNode.querySelector(\"item[media-type='application/x-dtbncx+xml']\");\n\t\t\tvar node = (0, _core.qsp)(manifestNode, \"item\", { \"media-type\": \"application/x-dtbncx+xml\" });\n\t\t\tvar tocId;\n\n\t\t\t// If we can't find the toc by media-type then try to look for id of the item in the spine attributes as\n\t\t\t// according to http://www.idpf.org/epub/20/spec/OPF_2.0.1_draft.htm#Section2.4.1.2,\n\t\t\t// \"The item that describes the NCX must be referenced by the spine toc attribute.\"\n\t\t\tif (!node) {\n\t\t\t\ttocId = spineNode.getAttribute(\"toc\");\n\t\t\t\tif (tocId) {\n\t\t\t\t\t// node = manifestNode.querySelector(\"item[id='\" + tocId + \"']\");\n\t\t\t\t\tnode = manifestNode.querySelector('#' + tocId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn node ? node.getAttribute(\"href\") : false;\n\t\t}\n\n\t\t/**\n * Find the Cover Path\n * \n * Fallback for Epub 2.0\n * @private\n * @param {node} packageXml\n * @return {string} href\n */\n\n\t}, {\n\t\tkey: 'findCoverPath',\n\t\tvalue: function findCoverPath(packageXml) {\n\t\t\tvar pkg = (0, _core.qs)(packageXml, \"package\");\n\t\t\tvar epubVersion = pkg.getAttribute(\"version\");\n\n\t\t\tif (epubVersion === \"2.0\") {\n\t\t\t\tvar metaCover = (0, _core.qsp)(packageXml, \"meta\", { \"name\": \"cover\" });\n\t\t\t\tif (metaCover) {\n\t\t\t\t\tvar coverId = metaCover.getAttribute(\"content\");\n\t\t\t\t\t// var cover = packageXml.querySelector(\"item[id='\" + coverId + \"']\");\n\t\t\t\t\tvar cover = packageXml.getElementById(coverId);\n\t\t\t\t\treturn cover ? cover.getAttribute(\"href\") : \"\";\n\t\t\t\t} else {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// var node = packageXml.querySelector(\"item[properties='cover-image']\");\n\t\t\t\tvar node = (0, _core.qsp)(packageXml, \"item\", { \"properties\": \"cover-image\" });\n\t\t\t\treturn node ? node.getAttribute(\"href\") : \"\";\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Get text of a namespaced element\n * @private\n * @param {node} xml\n * @param {string} tag\n * @return {string} text\n */\n\n\t}, {\n\t\tkey: 'getElementText',\n\t\tvalue: function getElementText(xml, tag) {\n\t\t\tvar found = xml.getElementsByTagNameNS(\"http://purl.org/dc/elements/1.1/\", tag);\n\t\t\tvar el;\n\n\t\t\tif (!found || found.length === 0) return \"\";\n\n\t\t\tel = found[0];\n\n\t\t\tif (el.childNodes.length) {\n\t\t\t\treturn el.childNodes[0].nodeValue;\n\t\t\t}\n\n\t\t\treturn \"\";\n\t\t}\n\n\t\t/**\n * Get text by property\n * @private\n * @param {node} xml\n * @param {string} property\n * @return {string} text\n */\n\n\t}, {\n\t\tkey: 'getPropertyText',\n\t\tvalue: function getPropertyText(xml, property) {\n\t\t\tvar el = (0, _core.qsp)(xml, \"meta\", { \"property\": property });\n\n\t\t\tif (el && el.childNodes.length) {\n\t\t\t\treturn el.childNodes[0].nodeValue;\n\t\t\t}\n\n\t\t\treturn \"\";\n\t\t}\n\n\t\t/**\n * Load JSON Manifest\n * @param {document} packageDocument OPF XML\n * @return {object} parsed package parts\n */\n\n\t}, {\n\t\tkey: 'load',\n\t\tvalue: function load(json) {\n\t\t\tvar _this = this;\n\n\t\t\tthis.metadata = json.metadata;\n\n\t\t\tvar spine = json.readingOrder || json.spine;\n\t\t\tthis.spine = spine.map(function (item, index) {\n\t\t\t\titem.index = index;\n\t\t\t\titem.linear = item.linear || \"yes\";\n\t\t\t\treturn item;\n\t\t\t});\n\n\t\t\tjson.resources.forEach(function (item, index) {\n\t\t\t\t_this.manifest[index] = item;\n\n\t\t\t\tif (item.rel && item.rel[0] === \"cover\") {\n\t\t\t\t\t_this.coverPath = item.href;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.spineNodeIndex = 0;\n\n\t\t\tthis.toc = json.toc.map(function (item, index) {\n\t\t\t\titem.label = item.title;\n\t\t\t\treturn item;\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t\"metadata\": this.metadata,\n\t\t\t\t\"spine\": this.spine,\n\t\t\t\t\"manifest\": this.manifest,\n\t\t\t\t\"navPath\": this.navPath,\n\t\t\t\t\"ncxPath\": this.ncxPath,\n\t\t\t\t\"coverPath\": this.coverPath,\n\t\t\t\t\"spineNodeIndex\": this.spineNodeIndex,\n\t\t\t\t\"toc\": this.toc\n\t\t\t};\n\t\t}\n\t}, {\n\t\tkey: 'destroy',\n\t\tvalue: function destroy() {\n\t\t\tthis.manifest = undefined;\n\t\t\tthis.navPath = undefined;\n\t\t\tthis.ncxPath = undefined;\n\t\t\tthis.coverPath = undefined;\n\t\t\tthis.spineNodeIndex = undefined;\n\t\t\tthis.spine = undefined;\n\t\t\tthis.metadata = undefined;\n\t\t}\n\t}]);\n\n\treturn Packaging;\n}();\n\nexports.default = Packaging;\nmodule.exports = exports['default'];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/packaging.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/pagelist.js": -/*!*********************************************!*\ - !*** ./node_modules/epubjs/lib/pagelist.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Page List Parser\n * @param {document} [xml]\n */\nvar PageList = function () {\n\tfunction PageList(xml) {\n\t\t_classCallCheck(this, PageList);\n\n\t\tthis.pages = [];\n\t\tthis.locations = [];\n\t\tthis.epubcfi = new _epubcfi2.default();\n\n\t\tthis.firstPage = 0;\n\t\tthis.lastPage = 0;\n\t\tthis.totalPages = 0;\n\n\t\tthis.toc = undefined;\n\t\tthis.ncx = undefined;\n\n\t\tif (xml) {\n\t\t\tthis.pageList = this.parse(xml);\n\t\t}\n\n\t\tif (this.pageList && this.pageList.length) {\n\t\t\tthis.process(this.pageList);\n\t\t}\n\t}\n\n\t/**\n * Parse PageList Xml\n * @param {document} xml\n */\n\n\n\t_createClass(PageList, [{\n\t\tkey: \"parse\",\n\t\tvalue: function parse(xml) {\n\t\t\tvar html = (0, _core.qs)(xml, \"html\");\n\t\t\tvar ncx = (0, _core.qs)(xml, \"ncx\");\n\n\t\t\tif (html) {\n\t\t\t\treturn this.parseNav(xml);\n\t\t\t} else if (ncx) {\n\t\t\t\treturn this.parseNcx(xml);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Parse a Nav PageList\n * @private\n * @param {node} navHtml\n * @return {PageList.item[]} list\n */\n\n\t}, {\n\t\tkey: \"parseNav\",\n\t\tvalue: function parseNav(navHtml) {\n\t\t\tvar navElement = (0, _core.querySelectorByType)(navHtml, \"nav\", \"page-list\");\n\t\t\tvar navItems = navElement ? (0, _core.qsa)(navElement, \"li\") : [];\n\t\t\tvar length = navItems.length;\n\t\t\tvar i;\n\t\t\tvar list = [];\n\t\t\tvar item;\n\n\t\t\tif (!navItems || length === 0) return list;\n\n\t\t\tfor (i = 0; i < length; ++i) {\n\t\t\t\titem = this.item(navItems[i]);\n\t\t\t\tlist.push(item);\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\t}, {\n\t\tkey: \"parseNcx\",\n\t\tvalue: function parseNcx(navXml) {\n\t\t\tvar list = [];\n\t\t\tvar i = 0;\n\t\t\tvar item;\n\t\t\tvar pageList;\n\t\t\tvar pageTargets;\n\t\t\tvar length = 0;\n\n\t\t\tpageList = (0, _core.qs)(navXml, \"pageList\");\n\t\t\tif (!pageList) return list;\n\n\t\t\tpageTargets = (0, _core.qsa)(pageList, \"pageTarget\");\n\t\t\tlength = pageTargets.length;\n\n\t\t\tif (!pageTargets || pageTargets.length === 0) {\n\t\t\t\treturn list;\n\t\t\t}\n\n\t\t\tfor (i = 0; i < length; ++i) {\n\t\t\t\titem = this.ncxItem(pageTargets[i]);\n\t\t\t\tlist.push(item);\n\t\t\t}\n\n\t\t\treturn list;\n\t\t}\n\t}, {\n\t\tkey: \"ncxItem\",\n\t\tvalue: function ncxItem(item) {\n\t\t\tvar navLabel = (0, _core.qs)(item, \"navLabel\");\n\t\t\tvar navLabelText = (0, _core.qs)(navLabel, \"text\");\n\t\t\tvar pageText = navLabelText.textContent;\n\t\t\tvar content = (0, _core.qs)(item, \"content\");\n\n\t\t\tvar href = content.getAttribute(\"src\");\n\t\t\tvar page = parseInt(pageText, 10);\n\n\t\t\treturn {\n\t\t\t\t\"href\": href,\n\t\t\t\t\"page\": page\n\t\t\t};\n\t\t}\n\n\t\t/**\n * Page List Item\n * @private\n * @param {node} item\n * @return {object} pageListItem\n */\n\n\t}, {\n\t\tkey: \"item\",\n\t\tvalue: function item(_item) {\n\t\t\tvar content = (0, _core.qs)(_item, \"a\"),\n\t\t\t href = content.getAttribute(\"href\") || \"\",\n\t\t\t text = content.textContent || \"\",\n\t\t\t page = parseInt(text),\n\t\t\t isCfi = href.indexOf(\"epubcfi\"),\n\t\t\t split,\n\t\t\t packageUrl,\n\t\t\t cfi;\n\n\t\t\tif (isCfi != -1) {\n\t\t\t\tsplit = href.split(\"#\");\n\t\t\t\tpackageUrl = split[0];\n\t\t\t\tcfi = split.length > 1 ? split[1] : false;\n\t\t\t\treturn {\n\t\t\t\t\t\"cfi\": cfi,\n\t\t\t\t\t\"href\": href,\n\t\t\t\t\t\"packageUrl\": packageUrl,\n\t\t\t\t\t\"page\": page\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t\"href\": href,\n\t\t\t\t\t\"page\": page\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Process pageList items\n * @private\n * @param {array} pageList\n */\n\n\t}, {\n\t\tkey: \"process\",\n\t\tvalue: function process(pageList) {\n\t\t\tpageList.forEach(function (item) {\n\t\t\t\tthis.pages.push(item.page);\n\t\t\t\tif (item.cfi) {\n\t\t\t\t\tthis.locations.push(item.cfi);\n\t\t\t\t}\n\t\t\t}, this);\n\t\t\tthis.firstPage = parseInt(this.pages[0]);\n\t\t\tthis.lastPage = parseInt(this.pages[this.pages.length - 1]);\n\t\t\tthis.totalPages = this.lastPage - this.firstPage;\n\t\t}\n\n\t\t/**\n * Get a PageList result from a EpubCFI\n * @param {string} cfi EpubCFI String\n * @return {number} page\n */\n\n\t}, {\n\t\tkey: \"pageFromCfi\",\n\t\tvalue: function pageFromCfi(cfi) {\n\t\t\tvar pg = -1;\n\n\t\t\t// Check if the pageList has not been set yet\n\t\t\tif (this.locations.length === 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\t// TODO: check if CFI is valid?\n\n\t\t\t// check if the cfi is in the location list\n\t\t\t// var index = this.locations.indexOf(cfi);\n\t\t\tvar index = (0, _core.indexOfSorted)(cfi, this.locations, this.epubcfi.compare);\n\t\t\tif (index != -1) {\n\t\t\t\tpg = this.pages[index];\n\t\t\t} else {\n\t\t\t\t// Otherwise add it to the list of locations\n\t\t\t\t// Insert it in the correct position in the locations page\n\t\t\t\t//index = EPUBJS.core.insert(cfi, this.locations, this.epubcfi.compare);\n\t\t\t\tindex = (0, _core.locationOf)(cfi, this.locations, this.epubcfi.compare);\n\t\t\t\t// Get the page at the location just before the new one, or return the first\n\t\t\t\tpg = index - 1 >= 0 ? this.pages[index - 1] : this.pages[0];\n\t\t\t\tif (pg !== undefined) {\n\t\t\t\t\t// Add the new page in so that the locations and page array match up\n\t\t\t\t\t//this.pages.splice(index, 0, pg);\n\t\t\t\t} else {\n\t\t\t\t\tpg = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn pg;\n\t\t}\n\n\t\t/**\n * Get an EpubCFI from a Page List Item\n * @param {string | number} pg\n * @return {string} cfi\n */\n\n\t}, {\n\t\tkey: \"cfiFromPage\",\n\t\tvalue: function cfiFromPage(pg) {\n\t\t\tvar cfi = -1;\n\t\t\t// check that pg is an int\n\t\t\tif (typeof pg != \"number\") {\n\t\t\t\tpg = parseInt(pg);\n\t\t\t}\n\n\t\t\t// check if the cfi is in the page list\n\t\t\t// Pages could be unsorted.\n\t\t\tvar index = this.pages.indexOf(pg);\n\t\t\tif (index != -1) {\n\t\t\t\tcfi = this.locations[index];\n\t\t\t}\n\t\t\t// TODO: handle pages not in the list\n\t\t\treturn cfi;\n\t\t}\n\n\t\t/**\n * Get a Page from Book percentage\n * @param {number} percent\n * @return {number} page\n */\n\n\t}, {\n\t\tkey: \"pageFromPercentage\",\n\t\tvalue: function pageFromPercentage(percent) {\n\t\t\tvar pg = Math.round(this.totalPages * percent);\n\t\t\treturn pg;\n\t\t}\n\n\t\t/**\n * Returns a value between 0 - 1 corresponding to the location of a page\n * @param {number} pg the page\n * @return {number} percentage\n */\n\n\t}, {\n\t\tkey: \"percentageFromPage\",\n\t\tvalue: function percentageFromPage(pg) {\n\t\t\tvar percentage = (pg - this.firstPage) / this.totalPages;\n\t\t\treturn Math.round(percentage * 1000) / 1000;\n\t\t}\n\n\t\t/**\n * Returns a value between 0 - 1 corresponding to the location of a cfi\n * @param {string} cfi EpubCFI String\n * @return {number} percentage\n */\n\n\t}, {\n\t\tkey: \"percentageFromCfi\",\n\t\tvalue: function percentageFromCfi(cfi) {\n\t\t\tvar pg = this.pageFromCfi(cfi);\n\t\t\tvar percentage = this.percentageFromPage(pg);\n\t\t\treturn percentage;\n\t\t}\n\n\t\t/**\n * Destroy\n */\n\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.pages = undefined;\n\t\t\tthis.locations = undefined;\n\t\t\tthis.epubcfi = undefined;\n\n\t\t\tthis.pageList = undefined;\n\n\t\t\tthis.toc = undefined;\n\t\t\tthis.ncx = undefined;\n\t\t}\n\t}]);\n\n\treturn PageList;\n}();\n\nexports.default = PageList;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/pagelist.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/rendition.js": -/*!**********************************************!*\ - !*** ./node_modules/epubjs/lib/rendition.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n// import Mapping from \"./mapping\";\n\n\n// Default Views\n\n\n// Default View Managers\n\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _hook = __webpack_require__(/*! ./utils/hook */ \"./node_modules/epubjs/lib/utils/hook.js\");\n\nvar _hook2 = _interopRequireDefault(_hook);\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _queue = __webpack_require__(/*! ./utils/queue */ \"./node_modules/epubjs/lib/utils/queue.js\");\n\nvar _queue2 = _interopRequireDefault(_queue);\n\nvar _layout = __webpack_require__(/*! ./layout */ \"./node_modules/epubjs/lib/layout.js\");\n\nvar _layout2 = _interopRequireDefault(_layout);\n\nvar _themes = __webpack_require__(/*! ./themes */ \"./node_modules/epubjs/lib/themes.js\");\n\nvar _themes2 = _interopRequireDefault(_themes);\n\nvar _contents = __webpack_require__(/*! ./contents */ \"./node_modules/epubjs/lib/contents.js\");\n\nvar _contents2 = _interopRequireDefault(_contents);\n\nvar _annotations = __webpack_require__(/*! ./annotations */ \"./node_modules/epubjs/lib/annotations.js\");\n\nvar _annotations2 = _interopRequireDefault(_annotations);\n\nvar _constants = __webpack_require__(/*! ./utils/constants */ \"./node_modules/epubjs/lib/utils/constants.js\");\n\nvar _iframe = __webpack_require__(/*! ./managers/views/iframe */ \"./node_modules/epubjs/lib/managers/views/iframe.js\");\n\nvar _iframe2 = _interopRequireDefault(_iframe);\n\nvar _index = __webpack_require__(/*! ./managers/default/index */ \"./node_modules/epubjs/lib/managers/default/index.js\");\n\nvar _index2 = _interopRequireDefault(_index);\n\nvar _index3 = __webpack_require__(/*! ./managers/continuous/index */ \"./node_modules/epubjs/lib/managers/continuous/index.js\");\n\nvar _index4 = _interopRequireDefault(_index3);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Displays an Epub as a series of Views for each Section.\n * Requires Manager and View class to handle specifics of rendering\n * the section content.\n * @class\n * @param {Book} book\n * @param {object} [options]\n * @param {number} [options.width]\n * @param {number} [options.height]\n * @param {string} [options.ignoreClass] class for the cfi parser to ignore\n * @param {string | function | object} [options.manager='default']\n * @param {string | function} [options.view='iframe']\n * @param {string} [options.layout] layout to force\n * @param {string} [options.spread] force spread value\n * @param {number} [options.minSpreadWidth] overridden by spread: none (never) / both (always)\n * @param {string} [options.stylesheet] url of stylesheet to be injected\n * @param {boolean} [options.resizeOnOrientationChange] false to disable orientation events\n * @param {string} [options.script] url of script to be injected\n * @param {boolean | object} [options.snap=false] use snap scrolling\n */\nvar Rendition = function () {\n\tfunction Rendition(book, options) {\n\t\t_classCallCheck(this, Rendition);\n\n\t\tthis.settings = (0, _core.extend)(this.settings || {}, {\n\t\t\twidth: null,\n\t\t\theight: null,\n\t\t\tignoreClass: \"\",\n\t\t\tmanager: \"default\",\n\t\t\tview: \"iframe\",\n\t\t\tflow: null,\n\t\t\tlayout: null,\n\t\t\tspread: null,\n\t\t\tminSpreadWidth: 800,\n\t\t\tstylesheet: null,\n\t\t\tresizeOnOrientationChange: true,\n\t\t\tscript: null,\n\t\t\tsnap: false\n\t\t});\n\n\t\t(0, _core.extend)(this.settings, options);\n\n\t\tif (_typeof(this.settings.manager) === \"object\") {\n\t\t\tthis.manager = this.settings.manager;\n\t\t}\n\n\t\tthis.book = book;\n\n\t\t/**\n * Adds Hook methods to the Rendition prototype\n * @member {object} hooks\n * @property {Hook} hooks.content\n * @memberof Rendition\n */\n\t\tthis.hooks = {};\n\t\tthis.hooks.display = new _hook2.default(this);\n\t\tthis.hooks.serialize = new _hook2.default(this);\n\t\tthis.hooks.content = new _hook2.default(this);\n\t\tthis.hooks.unloaded = new _hook2.default(this);\n\t\tthis.hooks.layout = new _hook2.default(this);\n\t\tthis.hooks.render = new _hook2.default(this);\n\t\tthis.hooks.show = new _hook2.default(this);\n\n\t\tthis.hooks.content.register(this.handleLinks.bind(this));\n\t\tthis.hooks.content.register(this.passEvents.bind(this));\n\t\tthis.hooks.content.register(this.adjustImages.bind(this));\n\n\t\tthis.book.spine.hooks.content.register(this.injectIdentifier.bind(this));\n\n\t\tif (this.settings.stylesheet) {\n\t\t\tthis.book.spine.hooks.content.register(this.injectStylesheet.bind(this));\n\t\t}\n\n\t\tif (this.settings.script) {\n\t\t\tthis.book.spine.hooks.content.register(this.injectScript.bind(this));\n\t\t}\n\n\t\t/**\n * @member {Themes} themes\n * @memberof Rendition\n */\n\t\tthis.themes = new _themes2.default(this);\n\n\t\t/**\n * @member {Annotations} annotations\n * @memberof Rendition\n */\n\t\tthis.annotations = new _annotations2.default(this);\n\n\t\tthis.epubcfi = new _epubcfi2.default();\n\n\t\tthis.q = new _queue2.default(this);\n\n\t\t/**\n * A Rendered Location Range\n * @typedef location\n * @type {Object}\n * @property {object} start\n * @property {string} start.index\n * @property {string} start.href\n * @property {object} start.displayed\n * @property {EpubCFI} start.cfi\n * @property {number} start.location\n * @property {number} start.percentage\n * @property {number} start.displayed.page\n * @property {number} start.displayed.total\n * @property {object} end\n * @property {string} end.index\n * @property {string} end.href\n * @property {object} end.displayed\n * @property {EpubCFI} end.cfi\n * @property {number} end.location\n * @property {number} end.percentage\n * @property {number} end.displayed.page\n * @property {number} end.displayed.total\n * @property {boolean} atStart\n * @property {boolean} atEnd\n * @memberof Rendition\n */\n\t\tthis.location = undefined;\n\n\t\t// Hold queue until book is opened\n\t\tthis.q.enqueue(this.book.opened);\n\n\t\tthis.starting = new _core.defer();\n\t\t/**\n * @member {promise} started returns after the rendition has started\n * @memberof Rendition\n */\n\t\tthis.started = this.starting.promise;\n\t\t// Block the queue until rendering is started\n\t\tthis.q.enqueue(this.start);\n\t}\n\n\t/**\n * Set the manager function\n * @param {function} manager\n */\n\n\n\t_createClass(Rendition, [{\n\t\tkey: \"setManager\",\n\t\tvalue: function setManager(manager) {\n\t\t\tthis.manager = manager;\n\t\t}\n\n\t\t/**\n * Require the manager from passed string, or as a class function\n * @param {string|object} manager [description]\n * @return {method}\n */\n\n\t}, {\n\t\tkey: \"requireManager\",\n\t\tvalue: function requireManager(manager) {\n\t\t\tvar viewManager;\n\n\t\t\t// If manager is a string, try to load from imported managers\n\t\t\tif (typeof manager === \"string\" && manager === \"default\") {\n\t\t\t\tviewManager = _index2.default;\n\t\t\t} else if (typeof manager === \"string\" && manager === \"continuous\") {\n\t\t\t\tviewManager = _index4.default;\n\t\t\t} else {\n\t\t\t\t// otherwise, assume we were passed a class function\n\t\t\t\tviewManager = manager;\n\t\t\t}\n\n\t\t\treturn viewManager;\n\t\t}\n\n\t\t/**\n * Require the view from passed string, or as a class function\n * @param {string|object} view\n * @return {view}\n */\n\n\t}, {\n\t\tkey: \"requireView\",\n\t\tvalue: function requireView(view) {\n\t\t\tvar View;\n\n\t\t\t// If view is a string, try to load from imported views,\n\t\t\tif (typeof view == \"string\" && view === \"iframe\") {\n\t\t\t\tView = _iframe2.default;\n\t\t\t} else {\n\t\t\t\t// otherwise, assume we were passed a class function\n\t\t\t\tView = view;\n\t\t\t}\n\n\t\t\treturn View;\n\t\t}\n\n\t\t/**\n * Start the rendering\n * @return {Promise} rendering has started\n */\n\n\t}, {\n\t\tkey: \"start\",\n\t\tvalue: function start() {\n\t\t\tif (!this.settings.layout && (this.book.package.metadata.layout === \"pre-paginated\" || this.book.displayOptions.fixedLayout === \"true\")) {\n\t\t\t\tthis.settings.layout = \"pre-paginated\";\n\t\t\t}\n\n\t\t\tif (!this.manager) {\n\t\t\t\tthis.ViewManager = this.requireManager(this.settings.manager);\n\t\t\t\tthis.View = this.requireView(this.settings.view);\n\n\t\t\t\tthis.manager = new this.ViewManager({\n\t\t\t\t\tview: this.View,\n\t\t\t\t\tqueue: this.q,\n\t\t\t\t\trequest: this.book.load.bind(this.book),\n\t\t\t\t\tsettings: this.settings\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.direction(this.book.package.metadata.direction);\n\n\t\t\t// Parse metadata to get layout props\n\t\t\tthis.settings.globalLayoutProperties = this.determineLayoutProperties(this.book.package.metadata);\n\n\t\t\tthis.flow(this.settings.globalLayoutProperties.flow);\n\n\t\t\tthis.layout(this.settings.globalLayoutProperties);\n\n\t\t\t// Listen for displayed views\n\t\t\tthis.manager.on(_constants.EVENTS.MANAGERS.ADDED, this.afterDisplayed.bind(this));\n\t\t\tthis.manager.on(_constants.EVENTS.MANAGERS.REMOVED, this.afterRemoved.bind(this));\n\n\t\t\t// Listen for resizing\n\t\t\tthis.manager.on(_constants.EVENTS.MANAGERS.RESIZED, this.onResized.bind(this));\n\n\t\t\t// Listen for rotation\n\t\t\tthis.manager.on(_constants.EVENTS.MANAGERS.ORIENTATION_CHANGE, this.onOrientationChange.bind(this));\n\n\t\t\t// Listen for scroll changes\n\t\t\tthis.manager.on(_constants.EVENTS.MANAGERS.SCROLLED, this.reportLocation.bind(this));\n\n\t\t\t/**\n * Emit that rendering has started\n * @event started\n * @memberof Rendition\n */\n\t\t\tthis.emit(_constants.EVENTS.RENDITION.STARTED);\n\n\t\t\t// Start processing queue\n\t\t\tthis.starting.resolve();\n\t\t}\n\n\t\t/**\n * Call to attach the container to an element in the dom\n * Container must be attached before rendering can begin\n * @param {element} element to attach to\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"attachTo\",\n\t\tvalue: function attachTo(element) {\n\n\t\t\treturn this.q.enqueue(function () {\n\n\t\t\t\t// Start rendering\n\t\t\t\tthis.manager.render(element, {\n\t\t\t\t\t\"width\": this.settings.width,\n\t\t\t\t\t\"height\": this.settings.height\n\t\t\t\t});\n\n\t\t\t\t/**\n * Emit that rendering has attached to an element\n * @event attached\n * @memberof Rendition\n */\n\t\t\t\tthis.emit(_constants.EVENTS.RENDITION.ATTACHED);\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Display a point in the book\n * The request will be added to the rendering Queue,\n * so it will wait until book is opened, rendering started\n * and all other rendering tasks have finished to be called.\n * @param {string} target Url or EpubCFI\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"display\",\n\t\tvalue: function display(target) {\n\t\t\tif (this.displaying) {\n\t\t\t\tthis.displaying.resolve();\n\t\t\t}\n\t\t\treturn this.q.enqueue(this._display, target);\n\t\t}\n\n\t\t/**\n * Tells the manager what to display immediately\n * @private\n * @param {string} target Url or EpubCFI\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"_display\",\n\t\tvalue: function _display(target) {\n\t\t\tvar _this = this;\n\n\t\t\tif (!this.book) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar isCfiString = this.epubcfi.isCfiString(target);\n\t\t\tvar displaying = new _core.defer();\n\t\t\tvar displayed = displaying.promise;\n\t\t\tvar section;\n\t\t\tvar moveTo;\n\n\t\t\tthis.displaying = displaying;\n\n\t\t\t// Check if this is a book percentage\n\t\t\tif (this.book.locations.length() && (0, _core.isFloat)(target)) {\n\t\t\t\ttarget = this.book.locations.cfiFromPercentage(parseFloat(target));\n\t\t\t}\n\n\t\t\tsection = this.book.spine.get(target);\n\n\t\t\tif (!section) {\n\t\t\t\tdisplaying.reject(new Error(\"No Section Found\"));\n\t\t\t\treturn displayed;\n\t\t\t}\n\n\t\t\tthis.manager.display(section, target).then(function () {\n\t\t\t\tdisplaying.resolve(section);\n\t\t\t\t_this.displaying = undefined;\n\n\t\t\t\t/**\n * Emit that a section has been displayed\n * @event displayed\n * @param {Section} section\n * @memberof Rendition\n */\n\t\t\t\t_this.emit(_constants.EVENTS.RENDITION.DISPLAYED, section);\n\t\t\t\t_this.reportLocation();\n\t\t\t}, function (err) {\n\t\t\t\t/**\n * Emit that has been an error displaying\n * @event displayError\n * @param {Section} section\n * @memberof Rendition\n */\n\t\t\t\t_this.emit(_constants.EVENTS.RENDITION.DISPLAY_ERROR, err);\n\t\t\t});\n\n\t\t\treturn displayed;\n\t\t}\n\n\t\t/*\n render(view, show) {\n \t\t// view.onLayout = this.layout.format.bind(this.layout);\n \tview.create();\n \t\t// Fit to size of the container, apply padding\n \tthis.manager.resizeView(view);\n \t\t// Render Chain\n \treturn view.section.render(this.book.request)\n \t\t.then(function(contents){\n \t\t\treturn view.load(contents);\n \t\t}.bind(this))\n \t\t.then(function(doc){\n \t\t\treturn this.hooks.content.trigger(view, this);\n \t\t}.bind(this))\n \t\t.then(function(){\n \t\t\tthis.layout.format(view.contents);\n \t\t\treturn this.hooks.layout.trigger(view, this);\n \t\t}.bind(this))\n \t\t.then(function(){\n \t\t\treturn view.display();\n \t\t}.bind(this))\n \t\t.then(function(){\n \t\t\treturn this.hooks.render.trigger(view, this);\n \t\t}.bind(this))\n \t\t.then(function(){\n \t\t\tif(show !== false) {\n \t\t\t\tthis.q.enqueue(function(view){\n \t\t\t\t\tview.show();\n \t\t\t\t}, view);\n \t\t\t}\n \t\t\t// this.map = new Map(view, this.layout);\n \t\t\tthis.hooks.show.trigger(view, this);\n \t\t\tthis.trigger(\"rendered\", view.section);\n \t\t\t}.bind(this))\n \t\t.catch(function(e){\n \t\t\tthis.trigger(\"loaderror\", e);\n \t\t}.bind(this));\n \t}\n */\n\n\t\t/**\n * Report what section has been displayed\n * @private\n * @param {*} view\n */\n\n\t}, {\n\t\tkey: \"afterDisplayed\",\n\t\tvalue: function afterDisplayed(view) {\n\t\t\tvar _this2 = this;\n\n\t\t\tview.on(_constants.EVENTS.VIEWS.MARK_CLICKED, function (cfiRange, data) {\n\t\t\t\treturn _this2.triggerMarkEvent(cfiRange, data, view.contents);\n\t\t\t});\n\n\t\t\tthis.hooks.render.trigger(view, this).then(function () {\n\t\t\t\tif (view.contents) {\n\t\t\t\t\t_this2.hooks.content.trigger(view.contents, _this2).then(function () {\n\t\t\t\t\t\t/**\n * Emit that a section has been rendered\n * @event rendered\n * @param {Section} section\n * @param {View} view\n * @memberof Rendition\n */\n\t\t\t\t\t\t_this2.emit(_constants.EVENTS.RENDITION.RENDERED, view.section, view);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t_this2.emit(_constants.EVENTS.RENDITION.RENDERED, view.section, view);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Report what has been removed\n * @private\n * @param {*} view\n */\n\n\t}, {\n\t\tkey: \"afterRemoved\",\n\t\tvalue: function afterRemoved(view) {\n\t\t\tvar _this3 = this;\n\n\t\t\tthis.hooks.unloaded.trigger(view, this).then(function () {\n\t\t\t\t/**\n * Emit that a section has been removed\n * @event removed\n * @param {Section} section\n * @param {View} view\n * @memberof Rendition\n */\n\t\t\t\t_this3.emit(_constants.EVENTS.RENDITION.REMOVED, view.section, view);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Report resize events and display the last seen location\n * @private\n */\n\n\t}, {\n\t\tkey: \"onResized\",\n\t\tvalue: function onResized(size) {\n\n\t\t\t/**\n * Emit that the rendition has been resized\n * @event resized\n * @param {number} width\n * @param {height} height\n * @memberof Rendition\n */\n\t\t\tthis.emit(_constants.EVENTS.RENDITION.RESIZED, {\n\t\t\t\twidth: size.width,\n\t\t\t\theight: size.height\n\t\t\t});\n\n\t\t\tif (this.location && this.location.start) {\n\t\t\t\tthis.display(this.location.start.cfi);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Report orientation events and display the last seen location\n * @private\n */\n\n\t}, {\n\t\tkey: \"onOrientationChange\",\n\t\tvalue: function onOrientationChange(orientation) {\n\t\t\t/**\n * Emit that the rendition has been rotated\n * @event orientationchange\n * @param {string} orientation\n * @memberof Rendition\n */\n\t\t\tthis.emit(_constants.EVENTS.RENDITION.ORIENTATION_CHANGE, orientation);\n\t\t}\n\n\t\t/**\n * Move the Rendition to a specific offset\n * Usually you would be better off calling display()\n * @param {object} offset\n */\n\n\t}, {\n\t\tkey: \"moveTo\",\n\t\tvalue: function moveTo(offset) {\n\t\t\tthis.manager.moveTo(offset);\n\t\t}\n\n\t\t/**\n * Trigger a resize of the views\n * @param {number} [width]\n * @param {number} [height]\n */\n\n\t}, {\n\t\tkey: \"resize\",\n\t\tvalue: function resize(width, height) {\n\t\t\tif (width) {\n\t\t\t\tthis.settings.width = width;\n\t\t\t}\n\t\t\tif (height) {\n\t\t\t\tthis.settings.height = height;\n\t\t\t}\n\t\t\tthis.manager.resize(width, height);\n\t\t}\n\n\t\t/**\n * Clear all rendered views\n */\n\n\t}, {\n\t\tkey: \"clear\",\n\t\tvalue: function clear() {\n\t\t\tthis.manager.clear();\n\t\t}\n\n\t\t/**\n * Go to the next \"page\" in the rendition\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"next\",\n\t\tvalue: function next() {\n\t\t\treturn this.q.enqueue(this.manager.next.bind(this.manager)).then(this.reportLocation.bind(this));\n\t\t}\n\n\t\t/**\n * Go to the previous \"page\" in the rendition\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"prev\",\n\t\tvalue: function prev() {\n\t\t\treturn this.q.enqueue(this.manager.prev.bind(this.manager)).then(this.reportLocation.bind(this));\n\t\t}\n\n\t\t//-- http://www.idpf.org/epub/301/spec/epub-publications.html#meta-properties-rendering\n\t\t/**\n * Determine the Layout properties from metadata and settings\n * @private\n * @param {object} metadata\n * @return {object} properties\n */\n\n\t}, {\n\t\tkey: \"determineLayoutProperties\",\n\t\tvalue: function determineLayoutProperties(metadata) {\n\t\t\tvar properties;\n\t\t\tvar layout = this.settings.layout || metadata.layout || \"reflowable\";\n\t\t\tvar spread = this.settings.spread || metadata.spread || \"auto\";\n\t\t\tvar orientation = this.settings.orientation || metadata.orientation || \"auto\";\n\t\t\tvar flow = this.settings.flow || metadata.flow || \"auto\";\n\t\t\tvar viewport = metadata.viewport || \"\";\n\t\t\tvar minSpreadWidth = this.settings.minSpreadWidth || metadata.minSpreadWidth || 800;\n\t\t\tvar direction = this.settings.direction || metadata.direction || \"ltr\";\n\n\t\t\tif ((this.settings.width === 0 || this.settings.width > 0) && (this.settings.height === 0 || this.settings.height > 0)) {\n\t\t\t\t// viewport = \"width=\"+this.settings.width+\", height=\"+this.settings.height+\"\";\n\t\t\t}\n\n\t\t\tproperties = {\n\t\t\t\tlayout: layout,\n\t\t\t\tspread: spread,\n\t\t\t\torientation: orientation,\n\t\t\t\tflow: flow,\n\t\t\t\tviewport: viewport,\n\t\t\t\tminSpreadWidth: minSpreadWidth,\n\t\t\t\tdirection: direction\n\t\t\t};\n\n\t\t\treturn properties;\n\t\t}\n\n\t\t/**\n * Adjust the flow of the rendition to paginated or scrolled\n * (scrolled-continuous vs scrolled-doc are handled by different view managers)\n * @param {string} flow\n */\n\n\t}, {\n\t\tkey: \"flow\",\n\t\tvalue: function flow(_flow2) {\n\t\t\tvar _flow = _flow2;\n\t\t\tif (_flow2 === \"scrolled\" || _flow2 === \"scrolled-doc\" || _flow2 === \"scrolled-continuous\") {\n\t\t\t\t_flow = \"scrolled\";\n\t\t\t}\n\n\t\t\tif (_flow2 === \"auto\" || _flow2 === \"paginated\") {\n\t\t\t\t_flow = \"paginated\";\n\t\t\t}\n\n\t\t\tthis.settings.flow = _flow2;\n\n\t\t\tif (this._layout) {\n\t\t\t\tthis._layout.flow(_flow);\n\t\t\t}\n\n\t\t\tif (this.manager && this._layout) {\n\t\t\t\tthis.manager.applyLayout(this._layout);\n\t\t\t}\n\n\t\t\tif (this.manager) {\n\t\t\t\tthis.manager.updateFlow(_flow);\n\t\t\t}\n\n\t\t\tif (this.manager && this.manager.isRendered() && this.location) {\n\t\t\t\tthis.manager.clear();\n\t\t\t\tthis.display(this.location.start.cfi);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Adjust the layout of the rendition to reflowable or pre-paginated\n * @param {object} settings\n */\n\n\t}, {\n\t\tkey: \"layout\",\n\t\tvalue: function layout(settings) {\n\t\t\tvar _this4 = this;\n\n\t\t\tif (settings) {\n\t\t\t\tthis._layout = new _layout2.default(settings);\n\t\t\t\tthis._layout.spread(settings.spread, this.settings.minSpreadWidth);\n\n\t\t\t\t// this.mapping = new Mapping(this._layout.props);\n\n\t\t\t\tthis._layout.on(_constants.EVENTS.LAYOUT.UPDATED, function (props, changed) {\n\t\t\t\t\t_this4.emit(_constants.EVENTS.RENDITION.LAYOUT, props, changed);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.manager && this._layout) {\n\t\t\t\tthis.manager.applyLayout(this._layout);\n\t\t\t}\n\n\t\t\treturn this._layout;\n\t\t}\n\n\t\t/**\n * Adjust if the rendition uses spreads\n * @param {string} spread none | auto (TODO: implement landscape, portrait, both)\n * @param {int} [min] min width to use spreads at\n */\n\n\t}, {\n\t\tkey: \"spread\",\n\t\tvalue: function spread(_spread, min) {\n\n\t\t\tthis.settings.spread = _spread;\n\n\t\t\tif (min) {\n\t\t\t\tthis.settings.minSpreadWidth = min;\n\t\t\t}\n\n\t\t\tif (this._layout) {\n\t\t\t\tthis._layout.spread(_spread, min);\n\t\t\t}\n\n\t\t\tif (this.manager && this.manager.isRendered()) {\n\t\t\t\tthis.manager.updateLayout();\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Adjust the direction of the rendition\n * @param {string} dir\n */\n\n\t}, {\n\t\tkey: \"direction\",\n\t\tvalue: function direction(dir) {\n\n\t\t\tthis.settings.direction = dir || \"ltr\";\n\n\t\t\tif (this.manager) {\n\t\t\t\tthis.manager.direction(this.settings.direction);\n\t\t\t}\n\n\t\t\tif (this.manager && this.manager.isRendered() && this.location) {\n\t\t\t\tthis.manager.clear();\n\t\t\t\tthis.display(this.location.start.cfi);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Report the current location\n * @fires relocated\n * @fires locationChanged\n */\n\n\t}, {\n\t\tkey: \"reportLocation\",\n\t\tvalue: function reportLocation() {\n\t\t\treturn this.q.enqueue(function reportedLocation() {\n\t\t\t\trequestAnimationFrame(function reportedLocationAfterRAF() {\n\t\t\t\t\tvar location = this.manager.currentLocation();\n\t\t\t\t\tif (location && location.then && typeof location.then === \"function\") {\n\t\t\t\t\t\tlocation.then(function (result) {\n\t\t\t\t\t\t\tvar located = this.located(result);\n\n\t\t\t\t\t\t\tif (!located || !located.start || !located.end) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tthis.location = located;\n\n\t\t\t\t\t\t\tthis.emit(_constants.EVENTS.RENDITION.LOCATION_CHANGED, {\n\t\t\t\t\t\t\t\tindex: this.location.start.index,\n\t\t\t\t\t\t\t\thref: this.location.start.href,\n\t\t\t\t\t\t\t\tstart: this.location.start.cfi,\n\t\t\t\t\t\t\t\tend: this.location.end.cfi,\n\t\t\t\t\t\t\t\tpercentage: this.location.start.percentage\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tthis.emit(_constants.EVENTS.RENDITION.RELOCATED, this.location);\n\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t} else if (location) {\n\t\t\t\t\t\tvar located = this.located(location);\n\n\t\t\t\t\t\tif (!located || !located.start || !located.end) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthis.location = located;\n\n\t\t\t\t\t\t/**\n * @event locationChanged\n * @deprecated\n * @type {object}\n * @property {number} index\n * @property {string} href\n * @property {EpubCFI} start\n * @property {EpubCFI} end\n * @property {number} percentage\n * @memberof Rendition\n */\n\t\t\t\t\t\tthis.emit(_constants.EVENTS.RENDITION.LOCATION_CHANGED, {\n\t\t\t\t\t\t\tindex: this.location.start.index,\n\t\t\t\t\t\t\thref: this.location.start.href,\n\t\t\t\t\t\t\tstart: this.location.start.cfi,\n\t\t\t\t\t\t\tend: this.location.end.cfi,\n\t\t\t\t\t\t\tpercentage: this.location.start.percentage\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t/**\n * @event relocated\n * @type {displayedLocation}\n * @memberof Rendition\n */\n\t\t\t\t\t\tthis.emit(_constants.EVENTS.RENDITION.RELOCATED, this.location);\n\t\t\t\t\t}\n\t\t\t\t}.bind(this));\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Get the Current Location object\n * @return {displayedLocation | promise} location (may be a promise)\n */\n\n\t}, {\n\t\tkey: \"currentLocation\",\n\t\tvalue: function currentLocation() {\n\t\t\tvar location = this.manager.currentLocation();\n\t\t\tif (location && location.then && typeof location.then === \"function\") {\n\t\t\t\tlocation.then(function (result) {\n\t\t\t\t\tvar located = this.located(result);\n\t\t\t\t\treturn located;\n\t\t\t\t}.bind(this));\n\t\t\t} else if (location) {\n\t\t\t\tvar located = this.located(location);\n\t\t\t\treturn located;\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Creates a Rendition#locationRange from location\n * passed by the Manager\n * @returns {displayedLocation}\n * @private\n */\n\n\t}, {\n\t\tkey: \"located\",\n\t\tvalue: function located(location) {\n\t\t\tif (!location.length) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tvar start = location[0];\n\t\t\tvar end = location[location.length - 1];\n\n\t\t\tvar located = {\n\t\t\t\tstart: {\n\t\t\t\t\tindex: start.index,\n\t\t\t\t\thref: start.href,\n\t\t\t\t\tcfi: start.mapping.start,\n\t\t\t\t\tdisplayed: {\n\t\t\t\t\t\tpage: start.pages[0] || 1,\n\t\t\t\t\t\ttotal: start.totalPages\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tend: {\n\t\t\t\t\tindex: end.index,\n\t\t\t\t\thref: end.href,\n\t\t\t\t\tcfi: end.mapping.end,\n\t\t\t\t\tdisplayed: {\n\t\t\t\t\t\tpage: end.pages[end.pages.length - 1] || 1,\n\t\t\t\t\t\ttotal: end.totalPages\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar locationStart = this.book.locations.locationFromCfi(start.mapping.start);\n\t\t\tvar locationEnd = this.book.locations.locationFromCfi(end.mapping.end);\n\n\t\t\tif (locationStart != null) {\n\t\t\t\tlocated.start.location = locationStart;\n\t\t\t\tlocated.start.percentage = this.book.locations.percentageFromLocation(locationStart);\n\t\t\t}\n\t\t\tif (locationEnd != null) {\n\t\t\t\tlocated.end.location = locationEnd;\n\t\t\t\tlocated.end.percentage = this.book.locations.percentageFromLocation(locationEnd);\n\t\t\t}\n\n\t\t\tvar pageStart = this.book.pageList.pageFromCfi(start.mapping.start);\n\t\t\tvar pageEnd = this.book.pageList.pageFromCfi(end.mapping.end);\n\n\t\t\tif (pageStart != -1) {\n\t\t\t\tlocated.start.page = pageStart;\n\t\t\t}\n\t\t\tif (pageEnd != -1) {\n\t\t\t\tlocated.end.page = pageEnd;\n\t\t\t}\n\n\t\t\tif (end.index === this.book.spine.last().index && located.end.displayed.page >= located.end.displayed.total) {\n\t\t\t\tlocated.atEnd = true;\n\t\t\t}\n\n\t\t\tif (start.index === this.book.spine.first().index && located.start.displayed.page === 1) {\n\t\t\t\tlocated.atStart = true;\n\t\t\t}\n\n\t\t\treturn located;\n\t\t}\n\n\t\t/**\n * Remove and Clean Up the Rendition\n */\n\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\t// Clear the queue\n\t\t\t// this.q.clear();\n\t\t\t// this.q = undefined;\n\n\t\t\tthis.manager && this.manager.destroy();\n\n\t\t\tthis.book = undefined;\n\n\t\t\t// this.views = null;\n\n\t\t\t// this.hooks.display.clear();\n\t\t\t// this.hooks.serialize.clear();\n\t\t\t// this.hooks.content.clear();\n\t\t\t// this.hooks.layout.clear();\n\t\t\t// this.hooks.render.clear();\n\t\t\t// this.hooks.show.clear();\n\t\t\t// this.hooks = {};\n\n\t\t\t// this.themes.destroy();\n\t\t\t// this.themes = undefined;\n\n\t\t\t// this.epubcfi = undefined;\n\n\t\t\t// this.starting = undefined;\n\t\t\t// this.started = undefined;\n\n\t\t}\n\n\t\t/**\n * Pass the events from a view's Contents\n * @private\n * @param {Contents} view contents\n */\n\n\t}, {\n\t\tkey: \"passEvents\",\n\t\tvalue: function passEvents(contents) {\n\t\t\tvar _this5 = this;\n\n\t\t\t_constants.DOM_EVENTS.forEach(function (e) {\n\t\t\t\tcontents.on(e, function (ev) {\n\t\t\t\t\treturn _this5.triggerViewEvent(ev, contents);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tcontents.on(_constants.EVENTS.CONTENTS.SELECTED, function (e) {\n\t\t\t\treturn _this5.triggerSelectedEvent(e, contents);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Emit events passed by a view\n * @private\n * @param {event} e\n */\n\n\t}, {\n\t\tkey: \"triggerViewEvent\",\n\t\tvalue: function triggerViewEvent(e, contents) {\n\t\t\tthis.emit(e.type, e, contents);\n\t\t}\n\n\t\t/**\n * Emit a selection event's CFI Range passed from a a view\n * @private\n * @param {EpubCFI} cfirange\n */\n\n\t}, {\n\t\tkey: \"triggerSelectedEvent\",\n\t\tvalue: function triggerSelectedEvent(cfirange, contents) {\n\t\t\t/**\n * Emit that a text selection has occured\n * @event selected\n * @param {EpubCFI} cfirange\n * @param {Contents} contents\n * @memberof Rendition\n */\n\t\t\tthis.emit(_constants.EVENTS.RENDITION.SELECTED, cfirange, contents);\n\t\t}\n\n\t\t/**\n * Emit a markClicked event with the cfiRange and data from a mark\n * @private\n * @param {EpubCFI} cfirange\n */\n\n\t}, {\n\t\tkey: \"triggerMarkEvent\",\n\t\tvalue: function triggerMarkEvent(cfiRange, data, contents) {\n\t\t\t/**\n * Emit that a mark was clicked\n * @event markClicked\n * @param {EpubCFI} cfirange\n * @param {object} data\n * @param {Contents} contents\n * @memberof Rendition\n */\n\t\t\tthis.emit(_constants.EVENTS.RENDITION.MARK_CLICKED, cfiRange, data, contents);\n\t\t}\n\n\t\t/**\n * Get a Range from a Visible CFI\n * @param {string} cfi EpubCfi String\n * @param {string} ignoreClass\n * @return {range}\n */\n\n\t}, {\n\t\tkey: \"getRange\",\n\t\tvalue: function getRange(cfi, ignoreClass) {\n\t\t\tvar _cfi = new _epubcfi2.default(cfi);\n\t\t\tvar found = this.manager.visible().filter(function (view) {\n\t\t\t\tif (_cfi.spinePos === view.index) return true;\n\t\t\t});\n\n\t\t\t// Should only every return 1 item\n\t\t\tif (found.length) {\n\t\t\t\treturn found[0].contents.range(_cfi, ignoreClass);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Hook to adjust images to fit in columns\n * @param {Contents} contents\n * @private\n */\n\n\t}, {\n\t\tkey: \"adjustImages\",\n\t\tvalue: function adjustImages(contents) {\n\n\t\t\tif (this._layout.name === \"pre-paginated\") {\n\t\t\t\treturn new Promise(function (resolve) {\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tvar computed = contents.window.getComputedStyle(contents.content, null);\n\t\t\tvar height = (contents.content.offsetHeight - (parseFloat(computed.paddingTop) + parseFloat(computed.paddingBottom))) * .95;\n\t\t\tvar verticalPadding = parseFloat(computed.verticalPadding);\n\n\t\t\tcontents.addStylesheetRules({\n\t\t\t\t\"img\": {\n\t\t\t\t\t\"max-width\": (this._layout.columnWidth ? this._layout.columnWidth - verticalPadding + \"px\" : \"100%\") + \"!important\",\n\t\t\t\t\t\"max-height\": height + \"px\" + \"!important\",\n\t\t\t\t\t\"object-fit\": \"contain\",\n\t\t\t\t\t\"page-break-inside\": \"avoid\",\n\t\t\t\t\t\"break-inside\": \"avoid\",\n\t\t\t\t\t\"box-sizing\": \"border-box\"\n\t\t\t\t},\n\t\t\t\t\"svg\": {\n\t\t\t\t\t\"max-width\": (this._layout.columnWidth ? this._layout.columnWidth - verticalPadding + \"px\" : \"100%\") + \"!important\",\n\t\t\t\t\t\"max-height\": height + \"px\" + \"!important\",\n\t\t\t\t\t\"page-break-inside\": \"avoid\",\n\t\t\t\t\t\"break-inside\": \"avoid\"\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t// Wait to apply\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\tresolve();\n\t\t\t\t}, 1);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Get the Contents object of each rendered view\n * @returns {Contents[]}\n */\n\n\t}, {\n\t\tkey: \"getContents\",\n\t\tvalue: function getContents() {\n\t\t\treturn this.manager ? this.manager.getContents() : [];\n\t\t}\n\n\t\t/**\n * Get the views member from the manager\n * @returns {Views}\n */\n\n\t}, {\n\t\tkey: \"views\",\n\t\tvalue: function views() {\n\t\t\tvar views = this.manager ? this.manager.views : undefined;\n\t\t\treturn views || [];\n\t\t}\n\n\t\t/**\n * Hook to handle link clicks in rendered content\n * @param {Contents} contents\n * @private\n */\n\n\t}, {\n\t\tkey: \"handleLinks\",\n\t\tvalue: function handleLinks(contents) {\n\t\t\tvar _this6 = this;\n\n\t\t\tif (contents) {\n\t\t\t\tcontents.on(_constants.EVENTS.CONTENTS.LINK_CLICKED, function (href) {\n\t\t\t\t\tvar relative = _this6.book.path.relative(href);\n\t\t\t\t\t_this6.display(relative);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Hook to handle injecting stylesheet before\n * a Section is serialized\n * @param {document} doc\n * @param {Section} section\n * @private\n */\n\n\t}, {\n\t\tkey: \"injectStylesheet\",\n\t\tvalue: function injectStylesheet(doc, section) {\n\t\t\tvar style = doc.createElement(\"link\");\n\t\t\tstyle.setAttribute(\"type\", \"text/css\");\n\t\t\tstyle.setAttribute(\"rel\", \"stylesheet\");\n\t\t\tstyle.setAttribute(\"href\", this.settings.stylesheet);\n\t\t\tdoc.getElementsByTagName(\"head\")[0].appendChild(style);\n\t\t}\n\n\t\t/**\n * Hook to handle injecting scripts before\n * a Section is serialized\n * @param {document} doc\n * @param {Section} section\n * @private\n */\n\n\t}, {\n\t\tkey: \"injectScript\",\n\t\tvalue: function injectScript(doc, section) {\n\t\t\tvar script = doc.createElement(\"script\");\n\t\t\tscript.setAttribute(\"type\", \"text/javascript\");\n\t\t\tscript.setAttribute(\"src\", this.settings.script);\n\t\t\tscript.textContent = \" \"; // Needed to prevent self closing tag\n\t\t\tdoc.getElementsByTagName(\"head\")[0].appendChild(script);\n\t\t}\n\n\t\t/**\n * Hook to handle the document identifier before\n * a Section is serialized\n * @param {document} doc\n * @param {Section} section\n * @private\n */\n\n\t}, {\n\t\tkey: \"injectIdentifier\",\n\t\tvalue: function injectIdentifier(doc, section) {\n\t\t\tvar ident = this.book.packaging.metadata.identifier;\n\t\t\tvar meta = doc.createElement(\"meta\");\n\t\t\tmeta.setAttribute(\"name\", \"dc.relation.ispartof\");\n\t\t\tif (ident) {\n\t\t\t\tmeta.setAttribute(\"content\", ident);\n\t\t\t}\n\t\t\tdoc.getElementsByTagName(\"head\")[0].appendChild(meta);\n\t\t}\n\t}]);\n\n\treturn Rendition;\n}();\n\n//-- Enable binding events to Renderer\n\n\n(0, _eventEmitter2.default)(Rendition.prototype);\n\nexports.default = Rendition;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/rendition.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/resources.js": -/*!**********************************************!*\ - !*** ./node_modules/epubjs/lib/resources.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _replacements = __webpack_require__(/*! ./utils/replacements */ \"./node_modules/epubjs/lib/utils/replacements.js\");\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _url = __webpack_require__(/*! ./utils/url */ \"./node_modules/epubjs/lib/utils/url.js\");\n\nvar _url2 = _interopRequireDefault(_url);\n\nvar _mime = __webpack_require__(/*! ../libs/mime/mime */ \"./node_modules/epubjs/libs/mime/mime.js\");\n\nvar _mime2 = _interopRequireDefault(_mime);\n\nvar _path = __webpack_require__(/*! ./utils/path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _pathWebpack = __webpack_require__(/*! path-webpack */ \"./node_modules/path-webpack/path.js\");\n\nvar _pathWebpack2 = _interopRequireDefault(_pathWebpack);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Handle Package Resources\n * @class\n * @param {Manifest} manifest\n * @param {object} [options]\n * @param {string} [options.replacements=\"base64\"]\n * @param {Archive} [options.archive]\n * @param {method} [options.resolver]\n */\nvar Resources = function () {\n\tfunction Resources(manifest, options) {\n\t\t_classCallCheck(this, Resources);\n\n\t\tthis.settings = {\n\t\t\treplacements: options && options.replacements || \"base64\",\n\t\t\tarchive: options && options.archive,\n\t\t\tresolver: options && options.resolver,\n\t\t\trequest: options && options.request\n\t\t};\n\n\t\tthis.process(manifest);\n\t}\n\n\t/**\n * Process resources\n * @param {Manifest} manifest\n */\n\n\n\t_createClass(Resources, [{\n\t\tkey: \"process\",\n\t\tvalue: function process(manifest) {\n\t\t\tthis.manifest = manifest;\n\t\t\tthis.resources = Object.keys(manifest).map(function (key) {\n\t\t\t\treturn manifest[key];\n\t\t\t});\n\n\t\t\tthis.replacementUrls = [];\n\n\t\t\tthis.html = [];\n\t\t\tthis.assets = [];\n\t\t\tthis.css = [];\n\n\t\t\tthis.urls = [];\n\t\t\tthis.cssUrls = [];\n\n\t\t\tthis.split();\n\t\t\tthis.splitUrls();\n\t\t}\n\n\t\t/**\n * Split resources by type\n * @private\n */\n\n\t}, {\n\t\tkey: \"split\",\n\t\tvalue: function split() {\n\n\t\t\t// HTML\n\t\t\tthis.html = this.resources.filter(function (item) {\n\t\t\t\tif (item.type === \"application/xhtml+xml\" || item.type === \"text/html\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Exclude HTML\n\t\t\tthis.assets = this.resources.filter(function (item) {\n\t\t\t\tif (item.type !== \"application/xhtml+xml\" && item.type !== \"text/html\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Only CSS\n\t\t\tthis.css = this.resources.filter(function (item) {\n\t\t\t\tif (item.type === \"text/css\") {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Convert split resources into Urls\n * @private\n */\n\n\t}, {\n\t\tkey: \"splitUrls\",\n\t\tvalue: function splitUrls() {\n\n\t\t\t// All Assets Urls\n\t\t\tthis.urls = this.assets.map(function (item) {\n\t\t\t\treturn item.href;\n\t\t\t}.bind(this));\n\n\t\t\t// Css Urls\n\t\t\tthis.cssUrls = this.css.map(function (item) {\n\t\t\t\treturn item.href;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Create a url to a resource\n * @param {string} url\n * @return {Promise} Promise resolves with url string\n */\n\n\t}, {\n\t\tkey: \"createUrl\",\n\t\tvalue: function createUrl(url) {\n\t\t\tvar parsedUrl = new _url2.default(url);\n\t\t\tvar mimeType = _mime2.default.lookup(parsedUrl.filename);\n\n\t\t\tif (this.settings.archive) {\n\t\t\t\treturn this.settings.archive.createUrl(url, { \"base64\": this.settings.replacements === \"base64\" });\n\t\t\t} else {\n\t\t\t\tif (this.settings.replacements === \"base64\") {\n\t\t\t\t\treturn this.settings.request(url, 'blob').then(function (blob) {\n\t\t\t\t\t\treturn (0, _core.blob2base64)(blob);\n\t\t\t\t\t}).then(function (blob) {\n\t\t\t\t\t\treturn (0, _core.createBase64Url)(blob, mimeType);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn this.settings.request(url, 'blob').then(function (blob) {\n\t\t\t\t\t\treturn (0, _core.createBlobUrl)(blob, mimeType);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Create blob urls for all the assets\n * @return {Promise} returns replacement urls\n */\n\n\t}, {\n\t\tkey: \"replacements\",\n\t\tvalue: function replacements() {\n\t\t\tvar _this = this;\n\n\t\t\tif (this.settings.replacements === \"none\") {\n\t\t\t\treturn new Promise(function (resolve) {\n\t\t\t\t\tresolve(this.urls);\n\t\t\t\t}.bind(this));\n\t\t\t}\n\n\t\t\tvar replacements = this.urls.map(function (url) {\n\t\t\t\tvar absolute = _this.settings.resolver(url);\n\n\t\t\t\treturn _this.createUrl(absolute).catch(function (err) {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t\treturn null;\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn Promise.all(replacements).then(function (replacementUrls) {\n\t\t\t\t_this.replacementUrls = replacementUrls.filter(function (url) {\n\t\t\t\t\treturn typeof url === \"string\";\n\t\t\t\t});\n\t\t\t\treturn replacementUrls;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Replace URLs in CSS resources\n * @private\n * @param {Archive} [archive]\n * @param {method} [resolver]\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"replaceCss\",\n\t\tvalue: function replaceCss(archive, resolver) {\n\t\t\tvar replaced = [];\n\t\t\tarchive = archive || this.settings.archive;\n\t\t\tresolver = resolver || this.settings.resolver;\n\t\t\tthis.cssUrls.forEach(function (href) {\n\t\t\t\tvar replacement = this.createCssFile(href, archive, resolver).then(function (replacementUrl) {\n\t\t\t\t\t// switch the url in the replacementUrls\n\t\t\t\t\tvar indexInUrls = this.urls.indexOf(href);\n\t\t\t\t\tif (indexInUrls > -1) {\n\t\t\t\t\t\tthis.replacementUrls[indexInUrls] = replacementUrl;\n\t\t\t\t\t}\n\t\t\t\t}.bind(this));\n\n\t\t\t\treplaced.push(replacement);\n\t\t\t}.bind(this));\n\t\t\treturn Promise.all(replaced);\n\t\t}\n\n\t\t/**\n * Create a new CSS file with the replaced URLs\n * @private\n * @param {string} href the original css file\n * @return {Promise} returns a BlobUrl to the new CSS file or a data url\n */\n\n\t}, {\n\t\tkey: \"createCssFile\",\n\t\tvalue: function createCssFile(href) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar newUrl;\n\n\t\t\tif (_pathWebpack2.default.isAbsolute(href)) {\n\t\t\t\treturn new Promise(function (resolve) {\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tvar absolute = this.settings.resolver(href);\n\n\t\t\t// Get the text of the css file from the archive\n\t\t\tvar textResponse;\n\n\t\t\tif (this.settings.archive) {\n\t\t\t\ttextResponse = this.settings.archive.getText(absolute);\n\t\t\t} else {\n\t\t\t\ttextResponse = this.settings.request(absolute, \"text\");\n\t\t\t}\n\n\t\t\t// Get asset links relative to css file\n\t\t\tvar relUrls = this.urls.map(function (assetHref) {\n\t\t\t\tvar resolved = _this2.settings.resolver(assetHref);\n\t\t\t\tvar relative = new _path2.default(absolute).relative(resolved);\n\n\t\t\t\treturn relative;\n\t\t\t});\n\n\t\t\tif (!textResponse) {\n\t\t\t\t// file not found, don't replace\n\t\t\t\treturn new Promise(function (resolve) {\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn textResponse.then(function (text) {\n\t\t\t\t// Replacements in the css text\n\t\t\t\ttext = (0, _replacements.substitute)(text, relUrls, _this2.replacementUrls);\n\n\t\t\t\t// Get the new url\n\t\t\t\tif (_this2.settings.replacements === \"base64\") {\n\t\t\t\t\tnewUrl = (0, _core.createBase64Url)(text, \"text/css\");\n\t\t\t\t} else {\n\t\t\t\t\tnewUrl = (0, _core.createBlobUrl)(text, \"text/css\");\n\t\t\t\t}\n\n\t\t\t\treturn newUrl;\n\t\t\t}, function (err) {\n\t\t\t\t// handle response errors\n\t\t\t\treturn new Promise(function (resolve) {\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Resolve all resources URLs relative to an absolute URL\n * @param {string} absolute to be resolved to\n * @param {resolver} [resolver]\n * @return {string[]} array with relative Urls\n */\n\n\t}, {\n\t\tkey: \"relativeTo\",\n\t\tvalue: function relativeTo(absolute, resolver) {\n\t\t\tresolver = resolver || this.settings.resolver;\n\n\t\t\t// Get Urls relative to current sections\n\t\t\treturn this.urls.map(function (href) {\n\t\t\t\tvar resolved = resolver(href);\n\t\t\t\tvar relative = new _path2.default(absolute).relative(resolved);\n\t\t\t\treturn relative;\n\t\t\t}.bind(this));\n\t\t}\n\n\t\t/**\n * Get a URL for a resource\n * @param {string} path\n * @return {string} url\n */\n\n\t}, {\n\t\tkey: \"get\",\n\t\tvalue: function get(path) {\n\t\t\tvar indexInUrls = this.urls.indexOf(path);\n\t\t\tif (indexInUrls === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (this.replacementUrls.length) {\n\t\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\t\tresolve(this.replacementUrls[indexInUrls]);\n\t\t\t\t}.bind(this));\n\t\t\t} else {\n\t\t\t\treturn this.createUrl(path);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Substitute urls in content, with replacements,\n * relative to a url if provided\n * @param {string} content\n * @param {string} [url] url to resolve to\n * @return {string} content with urls substituted\n */\n\n\t}, {\n\t\tkey: \"substitute\",\n\t\tvalue: function substitute(content, url) {\n\t\t\tvar relUrls;\n\t\t\tif (url) {\n\t\t\t\trelUrls = this.relativeTo(url);\n\t\t\t} else {\n\t\t\t\trelUrls = this.urls;\n\t\t\t}\n\t\t\treturn (0, _replacements.substitute)(content, relUrls, this.replacementUrls);\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.settings = undefined;\n\t\t\tthis.manifest = undefined;\n\t\t\tthis.resources = undefined;\n\t\t\tthis.replacementUrls = undefined;\n\t\t\tthis.html = undefined;\n\t\t\tthis.assets = undefined;\n\t\t\tthis.css = undefined;\n\n\t\t\tthis.urls = undefined;\n\t\t\tthis.cssUrls = undefined;\n\t\t}\n\t}]);\n\n\treturn Resources;\n}();\n\nexports.default = Resources;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/resources.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/section.js": -/*!********************************************!*\ - !*** ./node_modules/epubjs/lib/section.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _hook = __webpack_require__(/*! ./utils/hook */ \"./node_modules/epubjs/lib/utils/hook.js\");\n\nvar _hook2 = _interopRequireDefault(_hook);\n\nvar _replacements = __webpack_require__(/*! ./utils/replacements */ \"./node_modules/epubjs/lib/utils/replacements.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Represents a Section of the Book\n *\n * In most books this is equivelent to a Chapter\n * @param {object} item The spine item representing the section\n * @param {object} hooks hooks for serialize and content\n */\nvar Section = function () {\n\tfunction Section(item, hooks) {\n\t\t_classCallCheck(this, Section);\n\n\t\tthis.idref = item.idref;\n\t\tthis.linear = item.linear === \"yes\";\n\t\tthis.properties = item.properties;\n\t\tthis.index = item.index;\n\t\tthis.href = item.href;\n\t\tthis.url = item.url;\n\t\tthis.canonical = item.canonical;\n\t\tthis.next = item.next;\n\t\tthis.prev = item.prev;\n\n\t\tthis.cfiBase = item.cfiBase;\n\n\t\tif (hooks) {\n\t\t\tthis.hooks = hooks;\n\t\t} else {\n\t\t\tthis.hooks = {};\n\t\t\tthis.hooks.serialize = new _hook2.default(this);\n\t\t\tthis.hooks.content = new _hook2.default(this);\n\t\t}\n\n\t\tthis.document = undefined;\n\t\tthis.contents = undefined;\n\t\tthis.output = undefined;\n\t}\n\n\t/**\n * Load the section from its url\n * @param {method} [_request] a request method to use for loading\n * @return {document} a promise with the xml document\n */\n\n\n\t_createClass(Section, [{\n\t\tkey: \"load\",\n\t\tvalue: function load(_request) {\n\t\t\tvar request = _request || this.request || __webpack_require__(/*! ./utils/request */ \"./node_modules/epubjs/lib/utils/request.js\");\n\t\t\tvar loading = new _core.defer();\n\t\t\tvar loaded = loading.promise;\n\n\t\t\tif (this.contents) {\n\t\t\t\tloading.resolve(this.contents);\n\t\t\t} else {\n\t\t\t\trequest(this.url).then(function (xml) {\n\t\t\t\t\t// var directory = new Url(this.url).directory;\n\n\t\t\t\t\tthis.document = xml;\n\t\t\t\t\tthis.contents = xml.documentElement;\n\n\t\t\t\t\treturn this.hooks.content.trigger(this.document, this);\n\t\t\t\t}.bind(this)).then(function () {\n\t\t\t\t\tloading.resolve(this.contents);\n\t\t\t\t}.bind(this)).catch(function (error) {\n\t\t\t\t\tloading.reject(error);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn loaded;\n\t\t}\n\n\t\t/**\n * Adds a base tag for resolving urls in the section\n * @private\n */\n\n\t}, {\n\t\tkey: \"base\",\n\t\tvalue: function base() {\n\t\t\treturn (0, _replacements.replaceBase)(this.document, this);\n\t\t}\n\n\t\t/**\n * Render the contents of a section\n * @param {method} [_request] a request method to use for loading\n * @return {string} output a serialized XML Document\n */\n\n\t}, {\n\t\tkey: \"render\",\n\t\tvalue: function render(_request) {\n\t\t\tvar rendering = new _core.defer();\n\t\t\tvar rendered = rendering.promise;\n\t\t\tthis.output; // TODO: better way to return this from hooks?\n\n\t\t\tthis.load(_request).then(function (contents) {\n\t\t\t\tvar userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';\n\t\t\t\tvar isIE = userAgent.indexOf('Trident') >= 0;\n\t\t\t\tvar Serializer;\n\t\t\t\tif (typeof XMLSerializer === \"undefined\" || isIE) {\n\t\t\t\t\tSerializer = __webpack_require__(/*! xmldom/dom-parser */ \"./node_modules/xmldom/dom-parser.js\").XMLSerializer;\n\t\t\t\t} else {\n\t\t\t\t\tSerializer = XMLSerializer;\n\t\t\t\t}\n\t\t\t\tvar serializer = new Serializer();\n\t\t\t\tthis.output = serializer.serializeToString(contents);\n\t\t\t\treturn this.output;\n\t\t\t}.bind(this)).then(function () {\n\t\t\t\treturn this.hooks.serialize.trigger(this.output, this);\n\t\t\t}.bind(this)).then(function () {\n\t\t\t\trendering.resolve(this.output);\n\t\t\t}.bind(this)).catch(function (error) {\n\t\t\t\trendering.reject(error);\n\t\t\t});\n\n\t\t\treturn rendered;\n\t\t}\n\n\t\t/**\n * Find a string in a section\n * @param {string} _query The query string to find\n * @return {object[]} A list of matches, with form {cfi, excerpt}\n */\n\n\t}, {\n\t\tkey: \"find\",\n\t\tvalue: function find(_query) {\n\t\t\tvar section = this;\n\t\t\tvar matches = [];\n\t\t\tvar query = _query.toLowerCase();\n\t\t\tvar find = function find(node) {\n\t\t\t\tvar text = node.textContent.toLowerCase();\n\t\t\t\tvar range = section.document.createRange();\n\t\t\t\tvar cfi;\n\t\t\t\tvar pos;\n\t\t\t\tvar last = -1;\n\t\t\t\tvar excerpt;\n\t\t\t\tvar limit = 150;\n\n\t\t\t\twhile (pos != -1) {\n\t\t\t\t\t// Search for the query\n\t\t\t\t\tpos = text.indexOf(query, last + 1);\n\n\t\t\t\t\tif (pos != -1) {\n\t\t\t\t\t\t// We found it! Generate a CFI\n\t\t\t\t\t\trange = section.document.createRange();\n\t\t\t\t\t\trange.setStart(node, pos);\n\t\t\t\t\t\trange.setEnd(node, pos + query.length);\n\n\t\t\t\t\t\tcfi = section.cfiFromRange(range);\n\n\t\t\t\t\t\t// Generate the excerpt\n\t\t\t\t\t\tif (node.textContent.length < limit) {\n\t\t\t\t\t\t\texcerpt = node.textContent;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\texcerpt = node.textContent.substring(pos - limit / 2, pos + limit / 2);\n\t\t\t\t\t\t\texcerpt = \"...\" + excerpt + \"...\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Add the CFI to the matches list\n\t\t\t\t\t\tmatches.push({\n\t\t\t\t\t\t\tcfi: cfi,\n\t\t\t\t\t\t\texcerpt: excerpt\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tlast = pos;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t(0, _core.sprint)(section.document, function (node) {\n\t\t\t\tfind(node);\n\t\t\t});\n\n\t\t\treturn matches;\n\t\t}\n\t}, {\n\t\tkey: \"reconcileLayoutSettings\",\n\n\n\t\t/**\n * Reconciles the current chapters layout properies with\n * the global layout properities.\n * @param {object} globalLayout The global layout settings object, chapter properties string\n * @return {object} layoutProperties Object with layout properties\n */\n\t\tvalue: function reconcileLayoutSettings(globalLayout) {\n\t\t\t//-- Get the global defaults\n\t\t\tvar settings = {\n\t\t\t\tlayout: globalLayout.layout,\n\t\t\t\tspread: globalLayout.spread,\n\t\t\t\torientation: globalLayout.orientation\n\t\t\t};\n\n\t\t\t//-- Get the chapter's display type\n\t\t\tthis.properties.forEach(function (prop) {\n\t\t\t\tvar rendition = prop.replace(\"rendition:\", \"\");\n\t\t\t\tvar split = rendition.indexOf(\"-\");\n\t\t\t\tvar property, value;\n\n\t\t\t\tif (split != -1) {\n\t\t\t\t\tproperty = rendition.slice(0, split);\n\t\t\t\t\tvalue = rendition.slice(split + 1);\n\n\t\t\t\t\tsettings[property] = value;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn settings;\n\t\t}\n\n\t\t/**\n * Get a CFI from a Range in the Section\n * @param {range} _range\n * @return {string} cfi an EpubCFI string\n */\n\n\t}, {\n\t\tkey: \"cfiFromRange\",\n\t\tvalue: function cfiFromRange(_range) {\n\t\t\treturn new _epubcfi2.default(_range, this.cfiBase).toString();\n\t\t}\n\n\t\t/**\n * Get a CFI from an Element in the Section\n * @param {element} el\n * @return {string} cfi an EpubCFI string\n */\n\n\t}, {\n\t\tkey: \"cfiFromElement\",\n\t\tvalue: function cfiFromElement(el) {\n\t\t\treturn new _epubcfi2.default(el, this.cfiBase).toString();\n\t\t}\n\n\t\t/**\n * Unload the section document\n */\n\n\t}, {\n\t\tkey: \"unload\",\n\t\tvalue: function unload() {\n\t\t\tthis.document = undefined;\n\t\t\tthis.contents = undefined;\n\t\t\tthis.output = undefined;\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.unload();\n\t\t\tthis.hooks.serialize.clear();\n\t\t\tthis.hooks.content.clear();\n\n\t\t\tthis.hooks = undefined;\n\t\t\tthis.idref = undefined;\n\t\t\tthis.linear = undefined;\n\t\t\tthis.properties = undefined;\n\t\t\tthis.index = undefined;\n\t\t\tthis.href = undefined;\n\t\t\tthis.url = undefined;\n\t\t\tthis.next = undefined;\n\t\t\tthis.prev = undefined;\n\n\t\t\tthis.cfiBase = undefined;\n\t\t}\n\t}]);\n\n\treturn Section;\n}();\n\nexports.default = Section;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/section.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/spine.js": -/*!******************************************!*\ - !*** ./node_modules/epubjs/lib/spine.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _epubcfi = __webpack_require__(/*! ./epubcfi */ \"./node_modules/epubjs/lib/epubcfi.js\");\n\nvar _epubcfi2 = _interopRequireDefault(_epubcfi);\n\nvar _hook = __webpack_require__(/*! ./utils/hook */ \"./node_modules/epubjs/lib/utils/hook.js\");\n\nvar _hook2 = _interopRequireDefault(_hook);\n\nvar _section = __webpack_require__(/*! ./section */ \"./node_modules/epubjs/lib/section.js\");\n\nvar _section2 = _interopRequireDefault(_section);\n\nvar _replacements = __webpack_require__(/*! ./utils/replacements */ \"./node_modules/epubjs/lib/utils/replacements.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * A collection of Spine Items\n */\nvar Spine = function () {\n\tfunction Spine() {\n\t\t_classCallCheck(this, Spine);\n\n\t\tthis.spineItems = [];\n\t\tthis.spineByHref = {};\n\t\tthis.spineById = {};\n\n\t\tthis.hooks = {};\n\t\tthis.hooks.serialize = new _hook2.default();\n\t\tthis.hooks.content = new _hook2.default();\n\n\t\t// Register replacements\n\t\tthis.hooks.content.register(_replacements.replaceBase);\n\t\tthis.hooks.content.register(_replacements.replaceCanonical);\n\t\tthis.hooks.content.register(_replacements.replaceMeta);\n\n\t\tthis.epubcfi = new _epubcfi2.default();\n\n\t\tthis.loaded = false;\n\n\t\tthis.items = undefined;\n\t\tthis.manifest = undefined;\n\t\tthis.spineNodeIndex = undefined;\n\t\tthis.baseUrl = undefined;\n\t\tthis.length = undefined;\n\t}\n\n\t/**\n * Unpack items from a opf into spine items\n * @param {Packaging} _package\n * @param {method} resolver URL resolver\n * @param {method} canonical Resolve canonical url\n */\n\n\n\t_createClass(Spine, [{\n\t\tkey: \"unpack\",\n\t\tvalue: function unpack(_package, resolver, canonical) {\n\t\t\tvar _this = this;\n\n\t\t\tthis.items = _package.spine;\n\t\t\tthis.manifest = _package.manifest;\n\t\t\tthis.spineNodeIndex = _package.spineNodeIndex;\n\t\t\tthis.baseUrl = _package.baseUrl || _package.basePath || \"\";\n\t\t\tthis.length = this.items.length;\n\n\t\t\tthis.items.forEach(function (item, index) {\n\t\t\t\tvar manifestItem = _this.manifest[item.idref];\n\t\t\t\tvar spineItem;\n\n\t\t\t\titem.index = index;\n\t\t\t\titem.cfiBase = _this.epubcfi.generateChapterComponent(_this.spineNodeIndex, item.index, item.idref);\n\n\t\t\t\tif (item.href) {\n\t\t\t\t\titem.url = resolver(item.href, true);\n\t\t\t\t\titem.canonical = canonical(item.href);\n\t\t\t\t}\n\n\t\t\t\tif (manifestItem) {\n\t\t\t\t\titem.href = manifestItem.href;\n\t\t\t\t\titem.url = resolver(item.href, true);\n\t\t\t\t\titem.canonical = canonical(item.href);\n\n\t\t\t\t\tif (manifestItem.properties.length) {\n\t\t\t\t\t\titem.properties.push.apply(item.properties, manifestItem.properties);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (item.linear === \"yes\") {\n\t\t\t\t\titem.prev = function () {\n\t\t\t\t\t\tvar prevIndex = item.index;\n\t\t\t\t\t\twhile (prevIndex > 0) {\n\t\t\t\t\t\t\tvar prev = this.get(prevIndex - 1);\n\t\t\t\t\t\t\tif (prev && prev.linear) {\n\t\t\t\t\t\t\t\treturn prev;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tprevIndex -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}.bind(_this);\n\t\t\t\t\titem.next = function () {\n\t\t\t\t\t\tvar nextIndex = item.index;\n\t\t\t\t\t\twhile (nextIndex < this.spineItems.length - 1) {\n\t\t\t\t\t\t\tvar next = this.get(nextIndex + 1);\n\t\t\t\t\t\t\tif (next && next.linear) {\n\t\t\t\t\t\t\t\treturn next;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnextIndex += 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}.bind(_this);\n\t\t\t\t} else {\n\t\t\t\t\titem.prev = function () {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t};\n\t\t\t\t\titem.next = function () {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tspineItem = new _section2.default(item, _this.hooks);\n\n\t\t\t\t_this.append(spineItem);\n\t\t\t});\n\n\t\t\tthis.loaded = true;\n\t\t}\n\n\t\t/**\n * Get an item from the spine\n * @param {string|number} [target]\n * @return {Section} section\n * @example spine.get();\n * @example spine.get(1);\n * @example spine.get(\"chap1.html\");\n * @example spine.get(\"#id1234\");\n */\n\n\t}, {\n\t\tkey: \"get\",\n\t\tvalue: function get(target) {\n\t\t\tvar index = 0;\n\n\t\t\tif (typeof target === \"undefined\") {\n\t\t\t\twhile (index < this.spineItems.length) {\n\t\t\t\t\tvar next = this.spineItems[index];\n\t\t\t\t\tif (next && next.linear) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tindex += 1;\n\t\t\t\t}\n\t\t\t} else if (this.epubcfi.isCfiString(target)) {\n\t\t\t\tvar cfi = new _epubcfi2.default(target);\n\t\t\t\tindex = cfi.spinePos;\n\t\t\t} else if (typeof target === \"number\" || isNaN(target) === false) {\n\t\t\t\tindex = target;\n\t\t\t} else if (typeof target === \"string\" && target.indexOf(\"#\") === 0) {\n\t\t\t\tindex = this.spineById[target.substring(1)];\n\t\t\t} else if (typeof target === \"string\") {\n\t\t\t\t// Remove fragments\n\t\t\t\ttarget = target.split(\"#\")[0];\n\t\t\t\tindex = this.spineByHref[target] || this.spineByHref[encodeURI(target)];\n\t\t\t}\n\n\t\t\treturn this.spineItems[index] || null;\n\t\t}\n\n\t\t/**\n * Append a Section to the Spine\n * @private\n * @param {Section} section\n */\n\n\t}, {\n\t\tkey: \"append\",\n\t\tvalue: function append(section) {\n\t\t\tvar index = this.spineItems.length;\n\t\t\tsection.index = index;\n\n\t\t\tthis.spineItems.push(section);\n\n\t\t\t// Encode and Decode href lookups\n\t\t\t// see pr for details: https://github.com/futurepress/epub.js/pull/358\n\t\t\tthis.spineByHref[decodeURI(section.href)] = index;\n\t\t\tthis.spineByHref[encodeURI(section.href)] = index;\n\t\t\tthis.spineByHref[section.href] = index;\n\n\t\t\tthis.spineById[section.idref] = index;\n\n\t\t\treturn index;\n\t\t}\n\n\t\t/**\n * Prepend a Section to the Spine\n * @private\n * @param {Section} section\n */\n\n\t}, {\n\t\tkey: \"prepend\",\n\t\tvalue: function prepend(section) {\n\t\t\t// var index = this.spineItems.unshift(section);\n\t\t\tthis.spineByHref[section.href] = 0;\n\t\t\tthis.spineById[section.idref] = 0;\n\n\t\t\t// Re-index\n\t\t\tthis.spineItems.forEach(function (item, index) {\n\t\t\t\titem.index = index;\n\t\t\t});\n\n\t\t\treturn 0;\n\t\t}\n\n\t\t// insert(section, index) {\n\t\t//\n\t\t// };\n\n\t\t/**\n * Remove a Section from the Spine\n * @private\n * @param {Section} section\n */\n\n\t}, {\n\t\tkey: \"remove\",\n\t\tvalue: function remove(section) {\n\t\t\tvar index = this.spineItems.indexOf(section);\n\n\t\t\tif (index > -1) {\n\t\t\t\tdelete this.spineByHref[section.href];\n\t\t\t\tdelete this.spineById[section.idref];\n\n\t\t\t\treturn this.spineItems.splice(index, 1);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Loop over the Sections in the Spine\n * @return {method} forEach\n */\n\n\t}, {\n\t\tkey: \"each\",\n\t\tvalue: function each() {\n\t\t\treturn this.spineItems.forEach.apply(this.spineItems, arguments);\n\t\t}\n\n\t\t/**\n * Find the first Section in the Spine\n * @return {Section} first section\n */\n\n\t}, {\n\t\tkey: \"first\",\n\t\tvalue: function first() {\n\t\t\tvar index = 0;\n\n\t\t\tdo {\n\t\t\t\tvar next = this.get(index);\n\n\t\t\t\tif (next && next.linear) {\n\t\t\t\t\treturn next;\n\t\t\t\t}\n\t\t\t\tindex += 1;\n\t\t\t} while (index < this.spineItems.length);\n\t\t}\n\n\t\t/**\n * Find the last Section in the Spine\n * @return {Section} last section\n */\n\n\t}, {\n\t\tkey: \"last\",\n\t\tvalue: function last() {\n\t\t\tvar index = this.spineItems.length - 1;\n\n\t\t\tdo {\n\t\t\t\tvar prev = this.get(index);\n\t\t\t\tif (prev && prev.linear) {\n\t\t\t\t\treturn prev;\n\t\t\t\t}\n\t\t\t\tindex -= 1;\n\t\t\t} while (index >= 0);\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.each(function (section) {\n\t\t\t\treturn section.destroy();\n\t\t\t});\n\n\t\t\tthis.spineItems = undefined;\n\t\t\tthis.spineByHref = undefined;\n\t\t\tthis.spineById = undefined;\n\n\t\t\tthis.hooks.serialize.clear();\n\t\t\tthis.hooks.content.clear();\n\t\t\tthis.hooks = undefined;\n\n\t\t\tthis.epubcfi = undefined;\n\n\t\t\tthis.loaded = false;\n\n\t\t\tthis.items = undefined;\n\t\t\tthis.manifest = undefined;\n\t\t\tthis.spineNodeIndex = undefined;\n\t\t\tthis.baseUrl = undefined;\n\t\t\tthis.length = undefined;\n\t\t}\n\t}]);\n\n\treturn Spine;\n}();\n\nexports.default = Spine;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/spine.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/store.js": -/*!******************************************!*\ - !*** ./node_modules/epubjs/lib/store.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./utils/core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _request = __webpack_require__(/*! ./utils/request */ \"./node_modules/epubjs/lib/utils/request.js\");\n\nvar _request2 = _interopRequireDefault(_request);\n\nvar _mime = __webpack_require__(/*! ../libs/mime/mime */ \"./node_modules/epubjs/libs/mime/mime.js\");\n\nvar _mime2 = _interopRequireDefault(_mime);\n\nvar _path = __webpack_require__(/*! ./utils/path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _eventEmitter = __webpack_require__(/*! event-emitter */ \"./node_modules/event-emitter/index.js\");\n\nvar _eventEmitter2 = _interopRequireDefault(_eventEmitter);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Handles saving and requesting files from local storage\n * @class\n * @param {string} name This should be the name of the application for modals\n * @param {function} [requester]\n * @param {function} [resolver]\n */\nvar Store = function () {\n\tfunction Store(name, requester, resolver) {\n\t\t_classCallCheck(this, Store);\n\n\t\tthis.urlCache = {};\n\n\t\tthis.storage = undefined;\n\n\t\tthis.name = name;\n\t\tthis.requester = requester || _request2.default;\n\t\tthis.resolver = resolver;\n\n\t\tthis.online = true;\n\n\t\tthis.checkRequirements();\n\n\t\tthis.addListeners();\n\t}\n\n\t/**\n * Checks to see if localForage exists in global namspace,\n * Requires localForage if it isn't there\n * @private\n */\n\n\n\t_createClass(Store, [{\n\t\tkey: \"checkRequirements\",\n\t\tvalue: function checkRequirements() {\n\t\t\ttry {\n\t\t\t\tvar store = void 0;\n\t\t\t\tif (typeof localforage === \"undefined\") {\n\t\t\t\t\tstore = __webpack_require__(/*! localforage */ \"./node_modules/localforage/dist/localforage.js\");\n\t\t\t\t} else {\n\t\t\t\t\tstore = localforage;\n\t\t\t\t}\n\t\t\t\tthis.storage = store.createInstance({\n\t\t\t\t\tname: this.name\n\t\t\t\t});\n\t\t\t} catch (e) {\n\t\t\t\tthrow new Error(\"localForage lib not loaded\");\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Add online and offline event listeners\n * @private\n */\n\n\t}, {\n\t\tkey: \"addListeners\",\n\t\tvalue: function addListeners() {\n\t\t\tthis._status = this.status.bind(this);\n\t\t\twindow.addEventListener('online', this._status);\n\t\t\twindow.addEventListener('offline', this._status);\n\t\t}\n\n\t\t/**\n * Remove online and offline event listeners\n * @private\n */\n\n\t}, {\n\t\tkey: \"removeListeners\",\n\t\tvalue: function removeListeners() {\n\t\t\twindow.removeEventListener('online', this._status);\n\t\t\twindow.removeEventListener('offline', this._status);\n\t\t\tthis._status = undefined;\n\t\t}\n\n\t\t/**\n * Update the online / offline status\n * @private\n */\n\n\t}, {\n\t\tkey: \"status\",\n\t\tvalue: function status(event) {\n\t\t\tvar online = navigator.onLine;\n\t\t\tthis.online = online;\n\t\t\tif (online) {\n\t\t\t\tthis.emit(\"online\", this);\n\t\t\t} else {\n\t\t\t\tthis.emit(\"offline\", this);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Add all of a book resources to the store\n * @param {Resources} resources book resources\n * @param {boolean} [force] force resaving resources\n * @return {Promise} store objects\n */\n\n\t}, {\n\t\tkey: \"add\",\n\t\tvalue: function add(resources, force) {\n\t\t\tvar _this = this;\n\n\t\t\tvar mapped = resources.resources.map(function (item) {\n\t\t\t\tvar href = item.href;\n\n\t\t\t\tvar url = _this.resolver(href);\n\t\t\t\tvar encodedUrl = window.encodeURIComponent(url);\n\n\t\t\t\treturn _this.storage.getItem(encodedUrl).then(function (item) {\n\t\t\t\t\tif (!item || force) {\n\t\t\t\t\t\treturn _this.requester(url, \"binary\").then(function (data) {\n\t\t\t\t\t\t\treturn _this.storage.setItem(encodedUrl, data);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn item;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn Promise.all(mapped);\n\t\t}\n\n\t\t/**\n * Put binary data from a url to storage\n * @param {string} url a url to request from storage\n * @param {boolean} [withCredentials]\n * @param {object} [headers]\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"put\",\n\t\tvalue: function put(url, withCredentials, headers) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar encodedUrl = window.encodeURIComponent(url);\n\n\t\t\treturn this.storage.getItem(encodedUrl).then(function (result) {\n\t\t\t\tif (!result) {\n\t\t\t\t\treturn _this2.requester(url, \"binary\", withCredentials, headers).then(function (data) {\n\t\t\t\t\t\treturn _this2.storage.setItem(encodedUrl, data);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Request a url\n * @param {string} url a url to request from storage\n * @param {string} [type] specify the type of the returned result\n * @param {boolean} [withCredentials]\n * @param {object} [headers]\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"request\",\n\t\tvalue: function request(url, type, withCredentials, headers) {\n\t\t\tvar _this3 = this;\n\n\t\t\tif (this.online) {\n\t\t\t\t// From network\n\t\t\t\treturn this.requester(url, type, withCredentials, headers).then(function (data) {\n\t\t\t\t\t// save to store if not present\n\t\t\t\t\t_this3.put(url);\n\t\t\t\t\treturn data;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// From store\n\t\t\t\treturn this.retrieve(url, type);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Request a url from storage\n * @param {string} url a url to request from storage\n * @param {string} [type] specify the type of the returned result\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"retrieve\",\n\t\tvalue: function retrieve(url, type) {\n\t\t\tvar _this4 = this;\n\n\t\t\tvar deferred = new _core.defer();\n\t\t\tvar response;\n\t\t\tvar path = new _path2.default(url);\n\n\t\t\t// If type isn't set, determine it from the file extension\n\t\t\tif (!type) {\n\t\t\t\ttype = path.extension;\n\t\t\t}\n\n\t\t\tif (type == \"blob\") {\n\t\t\t\tresponse = this.getBlob(url);\n\t\t\t} else {\n\t\t\t\tresponse = this.getText(url);\n\t\t\t}\n\n\t\t\treturn response.then(function (r) {\n\t\t\t\tvar deferred = new _core.defer();\n\t\t\t\tvar result;\n\t\t\t\tif (r) {\n\t\t\t\t\tresult = _this4.handleResponse(r, type);\n\t\t\t\t\tdeferred.resolve(result);\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tmessage: \"File not found in storage: \" + url,\n\t\t\t\t\t\tstack: new Error().stack\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn deferred.promise;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Handle the response from request\n * @private\n * @param {any} response\n * @param {string} [type]\n * @return {any} the parsed result\n */\n\n\t}, {\n\t\tkey: \"handleResponse\",\n\t\tvalue: function handleResponse(response, type) {\n\t\t\tvar r;\n\n\t\t\tif (type == \"json\") {\n\t\t\t\tr = JSON.parse(response);\n\t\t\t} else if ((0, _core.isXml)(type)) {\n\t\t\t\tr = (0, _core.parse)(response, \"text/xml\");\n\t\t\t} else if (type == \"xhtml\") {\n\t\t\t\tr = (0, _core.parse)(response, \"application/xhtml+xml\");\n\t\t\t} else if (type == \"html\" || type == \"htm\") {\n\t\t\t\tr = (0, _core.parse)(response, \"text/html\");\n\t\t\t} else {\n\t\t\t\tr = response;\n\t\t\t}\n\n\t\t\treturn r;\n\t\t}\n\n\t\t/**\n * Get a Blob from Storage by Url\n * @param {string} url\n * @param {string} [mimeType]\n * @return {Blob}\n */\n\n\t}, {\n\t\tkey: \"getBlob\",\n\t\tvalue: function getBlob(url, mimeType) {\n\t\t\tvar encodedUrl = window.encodeURIComponent(url);\n\n\t\t\treturn this.storage.getItem(encodedUrl).then(function (uint8array) {\n\t\t\t\tif (!uint8array) return;\n\n\t\t\t\tmimeType = mimeType || _mime2.default.lookup(url);\n\n\t\t\t\treturn new Blob([uint8array], { type: mimeType });\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Get Text from Storage by Url\n * @param {string} url\n * @param {string} [mimeType]\n * @return {string}\n */\n\n\t}, {\n\t\tkey: \"getText\",\n\t\tvalue: function getText(url, mimeType) {\n\t\t\tvar encodedUrl = window.encodeURIComponent(url);\n\n\t\t\tmimeType = mimeType || _mime2.default.lookup(url);\n\n\t\t\treturn this.storage.getItem(encodedUrl).then(function (uint8array) {\n\t\t\t\tvar deferred = new _core.defer();\n\t\t\t\tvar reader = new FileReader();\n\t\t\t\tvar blob;\n\n\t\t\t\tif (!uint8array) return;\n\n\t\t\t\tblob = new Blob([uint8array], { type: mimeType });\n\n\t\t\t\treader.addEventListener(\"loadend\", function () {\n\t\t\t\t\tdeferred.resolve(reader.result);\n\t\t\t\t});\n\n\t\t\t\treader.readAsText(blob, mimeType);\n\n\t\t\t\treturn deferred.promise;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Get a base64 encoded result from Storage by Url\n * @param {string} url\n * @param {string} [mimeType]\n * @return {string} base64 encoded\n */\n\n\t}, {\n\t\tkey: \"getBase64\",\n\t\tvalue: function getBase64(url, mimeType) {\n\t\t\tvar encodedUrl = window.encodeURIComponent(url);\n\n\t\t\tmimeType = mimeType || _mime2.default.lookup(url);\n\n\t\t\treturn this.storage.getItem(encodedUrl).then(function (uint8array) {\n\t\t\t\tvar deferred = new _core.defer();\n\t\t\t\tvar reader = new FileReader();\n\t\t\t\tvar blob;\n\n\t\t\t\tif (!uint8array) return;\n\n\t\t\t\tblob = new Blob([uint8array], { type: mimeType });\n\n\t\t\t\treader.addEventListener(\"loadend\", function () {\n\t\t\t\t\tdeferred.resolve(reader.result);\n\t\t\t\t});\n\t\t\t\treader.readAsDataURL(blob, mimeType);\n\n\t\t\t\treturn deferred.promise;\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Create a Url from a stored item\n * @param {string} url\n * @param {object} [options.base64] use base64 encoding or blob url\n * @return {Promise} url promise with Url string\n */\n\n\t}, {\n\t\tkey: \"createUrl\",\n\t\tvalue: function createUrl(url, options) {\n\t\t\tvar deferred = new _core.defer();\n\t\t\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\t\t\tvar tempUrl;\n\t\t\tvar response;\n\t\t\tvar useBase64 = options && options.base64;\n\n\t\t\tif (url in this.urlCache) {\n\t\t\t\tdeferred.resolve(this.urlCache[url]);\n\t\t\t\treturn deferred.promise;\n\t\t\t}\n\n\t\t\tif (useBase64) {\n\t\t\t\tresponse = this.getBase64(url);\n\n\t\t\t\tif (response) {\n\t\t\t\t\tresponse.then(function (tempUrl) {\n\n\t\t\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\t\t\tdeferred.resolve(tempUrl);\n\t\t\t\t\t}.bind(this));\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\tresponse = this.getBlob(url);\n\n\t\t\t\tif (response) {\n\t\t\t\t\tresponse.then(function (blob) {\n\n\t\t\t\t\t\ttempUrl = _URL.createObjectURL(blob);\n\t\t\t\t\t\tthis.urlCache[url] = tempUrl;\n\t\t\t\t\t\tdeferred.resolve(tempUrl);\n\t\t\t\t\t}.bind(this));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!response) {\n\t\t\t\tdeferred.reject({\n\t\t\t\t\tmessage: \"File not found in storage: \" + url,\n\t\t\t\t\tstack: new Error().stack\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn deferred.promise;\n\t\t}\n\n\t\t/**\n * Revoke Temp Url for a achive item\n * @param {string} url url of the item in the store\n */\n\n\t}, {\n\t\tkey: \"revokeUrl\",\n\t\tvalue: function revokeUrl(url) {\n\t\t\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\t\t\tvar fromCache = this.urlCache[url];\n\t\t\tif (fromCache) _URL.revokeObjectURL(fromCache);\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tvar _URL = window.URL || window.webkitURL || window.mozURL;\n\t\t\tfor (var fromCache in this.urlCache) {\n\t\t\t\t_URL.revokeObjectURL(fromCache);\n\t\t\t}\n\t\t\tthis.urlCache = {};\n\t\t\tthis.removeListeners();\n\t\t}\n\t}]);\n\n\treturn Store;\n}();\n\n(0, _eventEmitter2.default)(Store.prototype);\n\nexports.default = Store;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/store.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/themes.js": -/*!*******************************************!*\ - !*** ./node_modules/epubjs/lib/themes.js ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _url = __webpack_require__(/*! ./utils/url */ \"./node_modules/epubjs/lib/utils/url.js\");\n\nvar _url2 = _interopRequireDefault(_url);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Themes to apply to displayed content\n * @class\n * @param {Rendition} rendition\n */\nvar Themes = function () {\n\tfunction Themes(rendition) {\n\t\t_classCallCheck(this, Themes);\n\n\t\tthis.rendition = rendition;\n\t\tthis._themes = {\n\t\t\t\"default\": {\n\t\t\t\t\"rules\": {},\n\t\t\t\t\"url\": \"\",\n\t\t\t\t\"serialized\": \"\"\n\t\t\t}\n\t\t};\n\t\tthis._overrides = {};\n\t\tthis._current = \"default\";\n\t\tthis._injected = [];\n\t\tthis.rendition.hooks.content.register(this.inject.bind(this));\n\t\tthis.rendition.hooks.content.register(this.overrides.bind(this));\n\t}\n\n\t/**\n * Add themes to be used by a rendition\n * @param {object | Array | string}\n * @example themes.register(\"light\", \"http://example.com/light.css\")\n * @example themes.register(\"light\", { \"body\": { \"color\": \"purple\"}})\n * @example themes.register({ \"light\" : {...}, \"dark\" : {...}})\n */\n\n\n\t_createClass(Themes, [{\n\t\tkey: \"register\",\n\t\tvalue: function register() {\n\t\t\tif (arguments.length === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (arguments.length === 1 && _typeof(arguments[0]) === \"object\") {\n\t\t\t\treturn this.registerThemes(arguments[0]);\n\t\t\t}\n\t\t\tif (arguments.length === 1 && typeof arguments[0] === \"string\") {\n\t\t\t\treturn this.default(arguments[0]);\n\t\t\t}\n\t\t\tif (arguments.length === 2 && typeof arguments[1] === \"string\") {\n\t\t\t\treturn this.registerUrl(arguments[0], arguments[1]);\n\t\t\t}\n\t\t\tif (arguments.length === 2 && _typeof(arguments[1]) === \"object\") {\n\t\t\t\treturn this.registerRules(arguments[0], arguments[1]);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Add a default theme to be used by a rendition\n * @param {object | string} theme\n * @example themes.register(\"http://example.com/default.css\")\n * @example themes.register({ \"body\": { \"color\": \"purple\"}})\n */\n\n\t}, {\n\t\tkey: \"default\",\n\t\tvalue: function _default(theme) {\n\t\t\tif (!theme) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (typeof theme === \"string\") {\n\t\t\t\treturn this.registerUrl(\"default\", theme);\n\t\t\t}\n\t\t\tif ((typeof theme === \"undefined\" ? \"undefined\" : _typeof(theme)) === \"object\") {\n\t\t\t\treturn this.registerRules(\"default\", theme);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Register themes object\n * @param {object} themes\n */\n\n\t}, {\n\t\tkey: \"registerThemes\",\n\t\tvalue: function registerThemes(themes) {\n\t\t\tfor (var theme in themes) {\n\t\t\t\tif (themes.hasOwnProperty(theme)) {\n\t\t\t\t\tif (typeof themes[theme] === \"string\") {\n\t\t\t\t\t\tthis.registerUrl(theme, themes[theme]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.registerRules(theme, themes[theme]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Register a url\n * @param {string} name\n * @param {string} input\n */\n\n\t}, {\n\t\tkey: \"registerUrl\",\n\t\tvalue: function registerUrl(name, input) {\n\t\t\tvar url = new _url2.default(input);\n\t\t\tthis._themes[name] = { \"url\": url.toString() };\n\t\t\tif (this._injected[name]) {\n\t\t\t\tthis.update(name);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Register rule\n * @param {string} name\n * @param {object} rules\n */\n\n\t}, {\n\t\tkey: \"registerRules\",\n\t\tvalue: function registerRules(name, rules) {\n\t\t\tthis._themes[name] = { \"rules\": rules };\n\t\t\t// TODO: serialize css rules\n\t\t\tif (this._injected[name]) {\n\t\t\t\tthis.update(name);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Select a theme\n * @param {string} name\n */\n\n\t}, {\n\t\tkey: \"select\",\n\t\tvalue: function select(name) {\n\t\t\tvar prev = this._current;\n\t\t\tvar contents;\n\n\t\t\tthis._current = name;\n\t\t\tthis.update(name);\n\n\t\t\tcontents = this.rendition.getContents();\n\t\t\tcontents.forEach(function (content) {\n\t\t\t\tcontent.removeClass(prev);\n\t\t\t\tcontent.addClass(name);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Update a theme\n * @param {string} name\n */\n\n\t}, {\n\t\tkey: \"update\",\n\t\tvalue: function update(name) {\n\t\t\tvar _this = this;\n\n\t\t\tvar contents = this.rendition.getContents();\n\t\t\tcontents.forEach(function (content) {\n\t\t\t\t_this.add(name, content);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Inject all themes into contents\n * @param {Contents} contents\n */\n\n\t}, {\n\t\tkey: \"inject\",\n\t\tvalue: function inject(contents) {\n\t\t\tvar links = [];\n\t\t\tvar themes = this._themes;\n\t\t\tvar theme;\n\n\t\t\tfor (var name in themes) {\n\t\t\t\tif (themes.hasOwnProperty(name) && (name === this._current || name === \"default\")) {\n\t\t\t\t\ttheme = themes[name];\n\t\t\t\t\tif (theme.rules && Object.keys(theme.rules).length > 0 || theme.url && links.indexOf(theme.url) === -1) {\n\t\t\t\t\t\tthis.add(name, contents);\n\t\t\t\t\t}\n\t\t\t\t\tthis._injected.push(name);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this._current != \"default\") {\n\t\t\t\tcontents.addClass(this._current);\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Add Theme to contents\n * @param {string} name\n * @param {Contents} contents\n */\n\n\t}, {\n\t\tkey: \"add\",\n\t\tvalue: function add(name, contents) {\n\t\t\tvar theme = this._themes[name];\n\n\t\t\tif (!theme || !contents) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (theme.url) {\n\t\t\t\tcontents.addStylesheet(theme.url);\n\t\t\t} else if (theme.serialized) {\n\t\t\t\t// TODO: handle serialized\n\t\t\t} else if (theme.rules) {\n\t\t\t\tcontents.addStylesheetRules(theme.rules);\n\t\t\t\ttheme.injected = true;\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Add override\n * @param {string} name\n * @param {string} value\n * @param {boolean} priority\n */\n\n\t}, {\n\t\tkey: \"override\",\n\t\tvalue: function override(name, value, priority) {\n\t\t\tvar _this2 = this;\n\n\t\t\tvar contents = this.rendition.getContents();\n\n\t\t\tthis._overrides[name] = {\n\t\t\t\tvalue: value,\n\t\t\t\tpriority: priority === true\n\t\t\t};\n\n\t\t\tcontents.forEach(function (content) {\n\t\t\t\tcontent.css(name, _this2._overrides[name].value, _this2._overrides[name].priority);\n\t\t\t});\n\t\t}\n\n\t\t/**\n * Add all overrides\n * @param {Content} content\n */\n\n\t}, {\n\t\tkey: \"overrides\",\n\t\tvalue: function overrides(contents) {\n\t\t\tvar overrides = this._overrides;\n\n\t\t\tfor (var rule in overrides) {\n\t\t\t\tif (overrides.hasOwnProperty(rule)) {\n\t\t\t\t\tcontents.css(rule, overrides[rule].value, overrides[rule].priority);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Adjust the font size of a rendition\n * @param {number} size\n */\n\n\t}, {\n\t\tkey: \"fontSize\",\n\t\tvalue: function fontSize(size) {\n\t\t\tthis.override(\"font-size\", size);\n\t\t}\n\n\t\t/**\n * Adjust the font-family of a rendition\n * @param {string} f\n */\n\n\t}, {\n\t\tkey: \"font\",\n\t\tvalue: function font(f) {\n\t\t\tthis.override(\"font-family\", f, true);\n\t\t}\n\t}, {\n\t\tkey: \"destroy\",\n\t\tvalue: function destroy() {\n\t\t\tthis.rendition = undefined;\n\t\t\tthis._themes = undefined;\n\t\t\tthis._overrides = undefined;\n\t\t\tthis._current = undefined;\n\t\t\tthis._injected = undefined;\n\t\t}\n\t}]);\n\n\treturn Themes;\n}();\n\nexports.default = Themes;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/themes.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/constants.js": -/*!****************************************************!*\ - !*** ./node_modules/epubjs/lib/utils/constants.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar EPUBJS_VERSION = exports.EPUBJS_VERSION = \"0.3\";\n\n// Dom events to listen for\nvar DOM_EVENTS = exports.DOM_EVENTS = [\"keydown\", \"keyup\", \"keypressed\", \"mouseup\", \"mousedown\", \"click\", \"touchend\", \"touchstart\", \"touchmove\"];\n\nvar EVENTS = exports.EVENTS = {\n BOOK: {\n OPEN_FAILED: \"openFailed\"\n },\n CONTENTS: {\n EXPAND: \"expand\",\n RESIZE: \"resize\",\n SELECTED: \"selected\",\n SELECTED_RANGE: \"selectedRange\",\n LINK_CLICKED: \"linkClicked\"\n },\n LOCATIONS: {\n CHANGED: \"changed\"\n },\n MANAGERS: {\n RESIZE: \"resize\",\n RESIZED: \"resized\",\n ORIENTATION_CHANGE: \"orientationchange\",\n ADDED: \"added\",\n SCROLL: \"scroll\",\n SCROLLED: \"scrolled\",\n REMOVED: \"removed\"\n },\n VIEWS: {\n AXIS: \"axis\",\n LOAD_ERROR: \"loaderror\",\n RENDERED: \"rendered\",\n RESIZED: \"resized\",\n DISPLAYED: \"displayed\",\n SHOWN: \"shown\",\n HIDDEN: \"hidden\",\n MARK_CLICKED: \"markClicked\"\n },\n RENDITION: {\n STARTED: \"started\",\n ATTACHED: \"attached\",\n DISPLAYED: \"displayed\",\n DISPLAY_ERROR: \"displayerror\",\n RENDERED: \"rendered\",\n REMOVED: \"removed\",\n RESIZED: \"resized\",\n ORIENTATION_CHANGE: \"orientationchange\",\n LOCATION_CHANGED: \"locationChanged\",\n RELOCATED: \"relocated\",\n MARK_CLICKED: \"markClicked\",\n SELECTED: \"selected\",\n LAYOUT: \"layout\"\n },\n LAYOUT: {\n UPDATED: \"updated\"\n },\n ANNOTATION: {\n ATTACH: \"attach\",\n DETACH: \"detach\"\n }\n};\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/constants.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/core.js": -/*!***********************************************!*\ - !*** ./node_modules/epubjs/lib/utils/core.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nexports.uuid = uuid;\nexports.documentHeight = documentHeight;\nexports.isElement = isElement;\nexports.isNumber = isNumber;\nexports.isFloat = isFloat;\nexports.prefixed = prefixed;\nexports.defaults = defaults;\nexports.extend = extend;\nexports.insert = insert;\nexports.locationOf = locationOf;\nexports.indexOfSorted = indexOfSorted;\nexports.bounds = bounds;\nexports.borders = borders;\nexports.nodeBounds = nodeBounds;\nexports.windowBounds = windowBounds;\nexports.indexOfNode = indexOfNode;\nexports.indexOfTextNode = indexOfTextNode;\nexports.indexOfElementNode = indexOfElementNode;\nexports.isXml = isXml;\nexports.createBlob = createBlob;\nexports.createBlobUrl = createBlobUrl;\nexports.revokeBlobUrl = revokeBlobUrl;\nexports.createBase64Url = createBase64Url;\nexports.type = type;\nexports.parse = parse;\nexports.qs = qs;\nexports.qsa = qsa;\nexports.qsp = qsp;\nexports.sprint = sprint;\nexports.treeWalker = treeWalker;\nexports.walk = walk;\nexports.blob2base64 = blob2base64;\nexports.defer = defer;\nexports.querySelectorByType = querySelectorByType;\nexports.findChildren = findChildren;\nexports.parents = parents;\nexports.filterChildren = filterChildren;\nexports.getParentByTagName = getParentByTagName;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Core Utilities and Helpers\n * @module Core\n*/\n\n/**\n * Vendor prefixed requestAnimationFrame\n * @returns {function} requestAnimationFrame\n * @memberof Core\n */\nvar requestAnimationFrame = exports.requestAnimationFrame = typeof window != \"undefined\" ? window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame : false;\nvar ELEMENT_NODE = 1;\nvar TEXT_NODE = 3;\nvar COMMENT_NODE = 8;\nvar DOCUMENT_NODE = 9;\nvar _URL = typeof URL != \"undefined\" ? URL : typeof window != \"undefined\" ? window.URL || window.webkitURL || window.mozURL : undefined;\n\n/**\n * Generates a UUID\n * based on: http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript\n * @returns {string} uuid\n * @memberof Core\n */\nfunction uuid() {\n\tvar d = new Date().getTime();\n\tvar uuid = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n\t\tvar r = (d + Math.random() * 16) % 16 | 0;\n\t\td = Math.floor(d / 16);\n\t\treturn (c == \"x\" ? r : r & 0x7 | 0x8).toString(16);\n\t});\n\treturn uuid;\n}\n\n/**\n * Gets the height of a document\n * @returns {number} height\n * @memberof Core\n */\nfunction documentHeight() {\n\treturn Math.max(document.documentElement.clientHeight, document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight);\n}\n\n/**\n * Checks if a node is an element\n * @param {object} obj\n * @returns {boolean}\n * @memberof Core\n */\nfunction isElement(obj) {\n\treturn !!(obj && obj.nodeType == 1);\n}\n\n/**\n * @param {any} n\n * @returns {boolean}\n * @memberof Core\n */\nfunction isNumber(n) {\n\treturn !isNaN(parseFloat(n)) && isFinite(n);\n}\n\n/**\n * @param {any} n\n * @returns {boolean}\n * @memberof Core\n */\nfunction isFloat(n) {\n\tvar f = parseFloat(n);\n\n\tif (isNumber(n) === false) {\n\t\treturn false;\n\t}\n\n\tif (typeof n === \"string\" && n.indexOf(\".\") > -1) {\n\t\treturn true;\n\t}\n\n\treturn Math.floor(f) !== f;\n}\n\n/**\n * Get a prefixed css property\n * @param {string} unprefixed\n * @returns {string}\n * @memberof Core\n */\nfunction prefixed(unprefixed) {\n\tvar vendors = [\"Webkit\", \"webkit\", \"Moz\", \"O\", \"ms\"];\n\tvar prefixes = [\"-webkit-\", \"-webkit-\", \"-moz-\", \"-o-\", \"-ms-\"];\n\tvar lower = unprefixed.toLowerCase();\n\tvar length = vendors.length;\n\n\tif (typeof document === \"undefined\" || typeof document.body.style[lower] != \"undefined\") {\n\t\treturn unprefixed;\n\t}\n\n\tfor (var i = 0; i < length; i++) {\n\t\tif (typeof document.body.style[prefixes[i] + lower] != \"undefined\") {\n\t\t\treturn prefixes[i] + lower;\n\t\t}\n\t}\n\n\treturn unprefixed;\n}\n\n/**\n * Apply defaults to an object\n * @param {object} obj\n * @returns {object}\n * @memberof Core\n */\nfunction defaults(obj) {\n\tfor (var i = 1, length = arguments.length; i < length; i++) {\n\t\tvar source = arguments[i];\n\t\tfor (var prop in source) {\n\t\t\tif (obj[prop] === void 0) obj[prop] = source[prop];\n\t\t}\n\t}\n\treturn obj;\n}\n\n/**\n * Extend properties of an object\n * @param {object} target\n * @returns {object}\n * @memberof Core\n */\nfunction extend(target) {\n\tvar sources = [].slice.call(arguments, 1);\n\tsources.forEach(function (source) {\n\t\tif (!source) return;\n\t\tObject.getOwnPropertyNames(source).forEach(function (propName) {\n\t\t\tObject.defineProperty(target, propName, Object.getOwnPropertyDescriptor(source, propName));\n\t\t});\n\t});\n\treturn target;\n}\n\n/**\n * Fast quicksort insert for sorted array -- based on:\n * http://stackoverflow.com/questions/1344500/efficient-way-to-insert-a-number-into-a-sorted-array-of-numbers\n * @param {any} item\n * @param {array} array\n * @param {function} [compareFunction]\n * @returns {number} location (in array)\n * @memberof Core\n */\nfunction insert(item, array, compareFunction) {\n\tvar location = locationOf(item, array, compareFunction);\n\tarray.splice(location, 0, item);\n\n\treturn location;\n}\n\n/**\n * Finds where something would fit into a sorted array\n * @param {any} item\n * @param {array} array\n * @param {function} [compareFunction]\n * @param {function} [_start]\n * @param {function} [_end]\n * @returns {number} location (in array)\n * @memberof Core\n */\nfunction locationOf(item, array, compareFunction, _start, _end) {\n\tvar start = _start || 0;\n\tvar end = _end || array.length;\n\tvar pivot = parseInt(start + (end - start) / 2);\n\tvar compared;\n\tif (!compareFunction) {\n\t\tcompareFunction = function compareFunction(a, b) {\n\t\t\tif (a > b) return 1;\n\t\t\tif (a < b) return -1;\n\t\t\tif (a == b) return 0;\n\t\t};\n\t}\n\tif (end - start <= 0) {\n\t\treturn pivot;\n\t}\n\n\tcompared = compareFunction(array[pivot], item);\n\tif (end - start === 1) {\n\t\treturn compared >= 0 ? pivot : pivot + 1;\n\t}\n\tif (compared === 0) {\n\t\treturn pivot;\n\t}\n\tif (compared === -1) {\n\t\treturn locationOf(item, array, compareFunction, pivot, end);\n\t} else {\n\t\treturn locationOf(item, array, compareFunction, start, pivot);\n\t}\n}\n\n/**\n * Finds index of something in a sorted array\n * Returns -1 if not found\n * @param {any} item\n * @param {array} array\n * @param {function} [compareFunction]\n * @param {function} [_start]\n * @param {function} [_end]\n * @returns {number} index (in array) or -1\n * @memberof Core\n */\nfunction indexOfSorted(item, array, compareFunction, _start, _end) {\n\tvar start = _start || 0;\n\tvar end = _end || array.length;\n\tvar pivot = parseInt(start + (end - start) / 2);\n\tvar compared;\n\tif (!compareFunction) {\n\t\tcompareFunction = function compareFunction(a, b) {\n\t\t\tif (a > b) return 1;\n\t\t\tif (a < b) return -1;\n\t\t\tif (a == b) return 0;\n\t\t};\n\t}\n\tif (end - start <= 0) {\n\t\treturn -1; // Not found\n\t}\n\n\tcompared = compareFunction(array[pivot], item);\n\tif (end - start === 1) {\n\t\treturn compared === 0 ? pivot : -1;\n\t}\n\tif (compared === 0) {\n\t\treturn pivot; // Found\n\t}\n\tif (compared === -1) {\n\t\treturn indexOfSorted(item, array, compareFunction, pivot, end);\n\t} else {\n\t\treturn indexOfSorted(item, array, compareFunction, start, pivot);\n\t}\n}\n/**\n * Find the bounds of an element\n * taking padding and margin into account\n * @param {element} el\n * @returns {{ width: Number, height: Number}}\n * @memberof Core\n */\nfunction bounds(el) {\n\n\tvar style = window.getComputedStyle(el);\n\tvar widthProps = [\"width\", \"paddingRight\", \"paddingLeft\", \"marginRight\", \"marginLeft\", \"borderRightWidth\", \"borderLeftWidth\"];\n\tvar heightProps = [\"height\", \"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\", \"borderTopWidth\", \"borderBottomWidth\"];\n\n\tvar width = 0;\n\tvar height = 0;\n\n\twidthProps.forEach(function (prop) {\n\t\twidth += parseFloat(style[prop]) || 0;\n\t});\n\n\theightProps.forEach(function (prop) {\n\t\theight += parseFloat(style[prop]) || 0;\n\t});\n\n\treturn {\n\t\theight: height,\n\t\twidth: width\n\t};\n}\n\n/**\n * Find the bounds of an element\n * taking padding, margin and borders into account\n * @param {element} el\n * @returns {{ width: Number, height: Number}}\n * @memberof Core\n */\nfunction borders(el) {\n\n\tvar style = window.getComputedStyle(el);\n\tvar widthProps = [\"paddingRight\", \"paddingLeft\", \"marginRight\", \"marginLeft\", \"borderRightWidth\", \"borderLeftWidth\"];\n\tvar heightProps = [\"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\", \"borderTopWidth\", \"borderBottomWidth\"];\n\n\tvar width = 0;\n\tvar height = 0;\n\n\twidthProps.forEach(function (prop) {\n\t\twidth += parseFloat(style[prop]) || 0;\n\t});\n\n\theightProps.forEach(function (prop) {\n\t\theight += parseFloat(style[prop]) || 0;\n\t});\n\n\treturn {\n\t\theight: height,\n\t\twidth: width\n\t};\n}\n\n/**\n * Find the bounds of any node\n * allows for getting bounds of text nodes by wrapping them in a range\n * @param {node} node\n * @returns {BoundingClientRect}\n * @memberof Core\n */\nfunction nodeBounds(node) {\n\tvar elPos = void 0;\n\tvar doc = node.ownerDocument;\n\tif (node.nodeType == Node.TEXT_NODE) {\n\t\tvar elRange = doc.createRange();\n\t\telRange.selectNodeContents(node);\n\t\telPos = elRange.getBoundingClientRect();\n\t} else {\n\t\telPos = node.getBoundingClientRect();\n\t}\n\treturn elPos;\n}\n\n/**\n * Find the equivelent of getBoundingClientRect of a browser window\n * @returns {{ width: Number, height: Number, top: Number, left: Number, right: Number, bottom: Number }}\n * @memberof Core\n */\nfunction windowBounds() {\n\n\tvar width = window.innerWidth;\n\tvar height = window.innerHeight;\n\n\treturn {\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tright: width,\n\t\tbottom: height,\n\t\twidth: width,\n\t\theight: height\n\t};\n}\n\n/**\n * Gets the index of a node in its parent\n * @param {Node} node\n * @param {string} typeId\n * @return {number} index\n * @memberof Core\n */\nfunction indexOfNode(node, typeId) {\n\tvar parent = node.parentNode;\n\tvar children = parent.childNodes;\n\tvar sib;\n\tvar index = -1;\n\tfor (var i = 0; i < children.length; i++) {\n\t\tsib = children[i];\n\t\tif (sib.nodeType === typeId) {\n\t\t\tindex++;\n\t\t}\n\t\tif (sib == node) break;\n\t}\n\n\treturn index;\n}\n\n/**\n * Gets the index of a text node in its parent\n * @param {node} textNode\n * @returns {number} index\n * @memberof Core\n */\nfunction indexOfTextNode(textNode) {\n\treturn indexOfNode(textNode, TEXT_NODE);\n}\n\n/**\n * Gets the index of an element node in its parent\n * @param {element} elementNode\n * @returns {number} index\n * @memberof Core\n */\nfunction indexOfElementNode(elementNode) {\n\treturn indexOfNode(elementNode, ELEMENT_NODE);\n}\n\n/**\n * Check if extension is xml\n * @param {string} ext\n * @returns {boolean}\n * @memberof Core\n */\nfunction isXml(ext) {\n\treturn [\"xml\", \"opf\", \"ncx\"].indexOf(ext) > -1;\n}\n\n/**\n * Create a new blob\n * @param {any} content\n * @param {string} mime\n * @returns {Blob}\n * @memberof Core\n */\nfunction createBlob(content, mime) {\n\treturn new Blob([content], { type: mime });\n}\n\n/**\n * Create a new blob url\n * @param {any} content\n * @param {string} mime\n * @returns {string} url\n * @memberof Core\n */\nfunction createBlobUrl(content, mime) {\n\tvar tempUrl;\n\tvar blob = createBlob(content, mime);\n\n\ttempUrl = _URL.createObjectURL(blob);\n\n\treturn tempUrl;\n}\n\n/**\n * Remove a blob url\n * @param {string} url\n * @memberof Core\n */\nfunction revokeBlobUrl(url) {\n\treturn _URL.revokeObjectURL(url);\n}\n\n/**\n * Create a new base64 encoded url\n * @param {any} content\n * @param {string} mime\n * @returns {string} url\n * @memberof Core\n */\nfunction createBase64Url(content, mime) {\n\tvar data;\n\tvar datauri;\n\n\tif (typeof content !== \"string\") {\n\t\t// Only handles strings\n\t\treturn;\n\t}\n\n\tdata = btoa(encodeURIComponent(content));\n\n\tdatauri = \"data:\" + mime + \";base64,\" + data;\n\n\treturn datauri;\n}\n\n/**\n * Get type of an object\n * @param {object} obj\n * @returns {string} type\n * @memberof Core\n */\nfunction type(obj) {\n\treturn Object.prototype.toString.call(obj).slice(8, -1);\n}\n\n/**\n * Parse xml (or html) markup\n * @param {string} markup\n * @param {string} mime\n * @param {boolean} forceXMLDom force using xmlDom to parse instead of native parser\n * @returns {document} document\n * @memberof Core\n */\nfunction parse(markup, mime, forceXMLDom) {\n\tvar doc;\n\tvar Parser;\n\n\tif (typeof DOMParser === \"undefined\" || forceXMLDom) {\n\t\tParser = __webpack_require__(/*! xmldom */ \"./node_modules/xmldom/dom-parser.js\").DOMParser;\n\t} else {\n\t\tParser = DOMParser;\n\t}\n\n\t// Remove byte order mark before parsing\n\t// https://www.w3.org/International/questions/qa-byte-order-mark\n\tif (markup.charCodeAt(0) === 0xFEFF) {\n\t\tmarkup = markup.slice(1);\n\t}\n\n\tdoc = new Parser().parseFromString(markup, mime);\n\n\treturn doc;\n}\n\n/**\n * querySelector polyfill\n * @param {element} el\n * @param {string} sel selector string\n * @returns {element} element\n * @memberof Core\n */\nfunction qs(el, sel) {\n\tvar elements;\n\tif (!el) {\n\t\tthrow new Error(\"No Element Provided\");\n\t}\n\n\tif (typeof el.querySelector != \"undefined\") {\n\t\treturn el.querySelector(sel);\n\t} else {\n\t\telements = el.getElementsByTagName(sel);\n\t\tif (elements.length) {\n\t\t\treturn elements[0];\n\t\t}\n\t}\n}\n\n/**\n * querySelectorAll polyfill\n * @param {element} el\n * @param {string} sel selector string\n * @returns {element[]} elements\n * @memberof Core\n */\nfunction qsa(el, sel) {\n\n\tif (typeof el.querySelector != \"undefined\") {\n\t\treturn el.querySelectorAll(sel);\n\t} else {\n\t\treturn el.getElementsByTagName(sel);\n\t}\n}\n\n/**\n * querySelector by property\n * @param {element} el\n * @param {string} sel selector string\n * @param {object[]} props\n * @returns {element[]} elements\n * @memberof Core\n */\nfunction qsp(el, sel, props) {\n\tvar q, filtered;\n\tif (typeof el.querySelector != \"undefined\") {\n\t\tsel += \"[\";\n\t\tfor (var prop in props) {\n\t\t\tsel += prop + \"~='\" + props[prop] + \"'\";\n\t\t}\n\t\tsel += \"]\";\n\t\treturn el.querySelector(sel);\n\t} else {\n\t\tq = el.getElementsByTagName(sel);\n\t\tfiltered = Array.prototype.slice.call(q, 0).filter(function (el) {\n\t\t\tfor (var prop in props) {\n\t\t\t\tif (el.getAttribute(prop) === props[prop]) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\n\t\tif (filtered) {\n\t\t\treturn filtered[0];\n\t\t}\n\t}\n}\n\n/**\n * Sprint through all text nodes in a document\n * @memberof Core\n * @param {element} root element to start with\n * @param {function} func function to run on each element\n */\nfunction sprint(root, func) {\n\tvar doc = root.ownerDocument || root;\n\tif (typeof doc.createTreeWalker !== \"undefined\") {\n\t\ttreeWalker(root, func, NodeFilter.SHOW_TEXT);\n\t} else {\n\t\twalk(root, function (node) {\n\t\t\tif (node && node.nodeType === 3) {\n\t\t\t\t// Node.TEXT_NODE\n\t\t\t\tfunc(node);\n\t\t\t}\n\t\t}, true);\n\t}\n}\n\n/**\n * Create a treeWalker\n * @memberof Core\n * @param {element} root element to start with\n * @param {function} func function to run on each element\n * @param {function | object} filter funtion or object to filter with\n */\nfunction treeWalker(root, func, filter) {\n\tvar treeWalker = document.createTreeWalker(root, filter, null, false);\n\tvar node = void 0;\n\twhile (node = treeWalker.nextNode()) {\n\t\tfunc(node);\n\t}\n}\n\n/**\n * @memberof Core\n * @param {node} node\n * @param {callback} return false for continue,true for break inside callback\n */\nfunction walk(node, callback) {\n\tif (callback(node)) {\n\t\treturn true;\n\t}\n\tnode = node.firstChild;\n\tif (node) {\n\t\tdo {\n\t\t\tvar walked = walk(node, callback);\n\t\t\tif (walked) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tnode = node.nextSibling;\n\t\t} while (node);\n\t}\n}\n\n/**\n * Convert a blob to a base64 encoded string\n * @param {Blog} blob\n * @returns {string}\n * @memberof Core\n */\nfunction blob2base64(blob) {\n\treturn new Promise(function (resolve, reject) {\n\t\tvar reader = new FileReader();\n\t\treader.readAsDataURL(blob);\n\t\treader.onloadend = function () {\n\t\t\tresolve(reader.result);\n\t\t};\n\t});\n}\n\n/**\n * Creates a new pending promise and provides methods to resolve or reject it.\n * From: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred#backwards_forwards_compatible\n * @memberof Core\n */\nfunction defer() {\n\tvar _this = this;\n\n\t/* A method to resolve the associated Promise with the value passed.\n * If the promise is already settled it does nothing.\n *\n * @param {anything} value : This value is used to resolve the promise\n * If the value is a Promise then the associated promise assumes the state\n * of Promise passed as value.\n */\n\tthis.resolve = null;\n\n\t/* A method to reject the assocaited Promise with the value passed.\n * If the promise is already settled it does nothing.\n *\n * @param {anything} reason: The reason for the rejection of the Promise.\n * Generally its an Error object. If however a Promise is passed, then the Promise\n * itself will be the reason for rejection no matter the state of the Promise.\n */\n\tthis.reject = null;\n\n\tthis.id = uuid();\n\n\t/* A newly created Pomise object.\n * Initially in pending state.\n */\n\tthis.promise = new Promise(function (resolve, reject) {\n\t\t_this.resolve = resolve;\n\t\t_this.reject = reject;\n\t});\n\tObject.freeze(this);\n}\n\n/**\n * querySelector with filter by epub type\n * @param {element} html\n * @param {string} element element type to find\n * @param {string} type epub type to find\n * @returns {element[]} elements\n * @memberof Core\n */\nfunction querySelectorByType(html, element, type) {\n\tvar query;\n\tif (typeof html.querySelector != \"undefined\") {\n\t\tquery = html.querySelector(element + \"[*|type=\\\"\" + type + \"\\\"]\");\n\t}\n\t// Handle IE not supporting namespaced epub:type in querySelector\n\tif (!query || query.length === 0) {\n\t\tquery = qsa(html, element);\n\t\tfor (var i = 0; i < query.length; i++) {\n\t\t\tif (query[i].getAttributeNS(\"http://www.idpf.org/2007/ops\", \"type\") === type || query[i].getAttribute(\"epub:type\") === type) {\n\t\t\t\treturn query[i];\n\t\t\t}\n\t\t}\n\t} else {\n\t\treturn query;\n\t}\n}\n\n/**\n * Find direct decendents of an element\n * @param {element} el\n * @returns {element[]} children\n * @memberof Core\n */\nfunction findChildren(el) {\n\tvar result = [];\n\tvar childNodes = el.childNodes;\n\tfor (var i = 0; i < childNodes.length; i++) {\n\t\tvar node = childNodes[i];\n\t\tif (node.nodeType === 1) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\treturn result;\n}\n\n/**\n * Find all parents (ancestors) of an element\n * @param {element} node\n * @returns {element[]} parents\n * @memberof Core\n */\nfunction parents(node) {\n\tvar nodes = [node];\n\tfor (; node; node = node.parentNode) {\n\t\tnodes.unshift(node);\n\t}\n\treturn nodes;\n}\n\n/**\n * Find all direct decendents of a specific type\n * @param {element} el\n * @param {string} nodeName\n * @param {boolean} [single]\n * @returns {element[]} children\n * @memberof Core\n */\nfunction filterChildren(el, nodeName, single) {\n\tvar result = [];\n\tvar childNodes = el.childNodes;\n\tfor (var i = 0; i < childNodes.length; i++) {\n\t\tvar node = childNodes[i];\n\t\tif (node.nodeType === 1 && node.nodeName.toLowerCase() === nodeName) {\n\t\t\tif (single) {\n\t\t\t\treturn node;\n\t\t\t} else {\n\t\t\t\tresult.push(node);\n\t\t\t}\n\t\t}\n\t}\n\tif (!single) {\n\t\treturn result;\n\t}\n}\n\n/**\n * Filter all parents (ancestors) with tag name\n * @param {element} node\n * @param {string} tagname\n * @returns {element[]} parents\n * @memberof Core\n */\nfunction getParentByTagName(node, tagname) {\n\tvar parent = void 0;\n\tif (node === null || tagname === '') return;\n\tparent = node.parentNode;\n\twhile (parent.nodeType === 1) {\n\t\tif (parent.tagName.toLowerCase() === tagname) {\n\t\t\treturn parent;\n\t\t}\n\t\tparent = parent.parentNode;\n\t}\n}\n\n/**\n * Lightweight Polyfill for DOM Range\n * @class\n * @memberof Core\n */\n\nvar RangeObject = exports.RangeObject = function () {\n\tfunction RangeObject() {\n\t\t_classCallCheck(this, RangeObject);\n\n\t\tthis.collapsed = false;\n\t\tthis.commonAncestorContainer = undefined;\n\t\tthis.endContainer = undefined;\n\t\tthis.endOffset = undefined;\n\t\tthis.startContainer = undefined;\n\t\tthis.startOffset = undefined;\n\t}\n\n\t_createClass(RangeObject, [{\n\t\tkey: \"setStart\",\n\t\tvalue: function setStart(startNode, startOffset) {\n\t\t\tthis.startContainer = startNode;\n\t\t\tthis.startOffset = startOffset;\n\n\t\t\tif (!this.endContainer) {\n\t\t\t\tthis.collapse(true);\n\t\t\t} else {\n\t\t\t\tthis.commonAncestorContainer = this._commonAncestorContainer();\n\t\t\t}\n\n\t\t\tthis._checkCollapsed();\n\t\t}\n\t}, {\n\t\tkey: \"setEnd\",\n\t\tvalue: function setEnd(endNode, endOffset) {\n\t\t\tthis.endContainer = endNode;\n\t\t\tthis.endOffset = endOffset;\n\n\t\t\tif (!this.startContainer) {\n\t\t\t\tthis.collapse(false);\n\t\t\t} else {\n\t\t\t\tthis.collapsed = false;\n\t\t\t\tthis.commonAncestorContainer = this._commonAncestorContainer();\n\t\t\t}\n\n\t\t\tthis._checkCollapsed();\n\t\t}\n\t}, {\n\t\tkey: \"collapse\",\n\t\tvalue: function collapse(toStart) {\n\t\t\tthis.collapsed = true;\n\t\t\tif (toStart) {\n\t\t\t\tthis.endContainer = this.startContainer;\n\t\t\t\tthis.endOffset = this.startOffset;\n\t\t\t\tthis.commonAncestorContainer = this.startContainer.parentNode;\n\t\t\t} else {\n\t\t\t\tthis.startContainer = this.endContainer;\n\t\t\t\tthis.startOffset = this.endOffset;\n\t\t\t\tthis.commonAncestorContainer = this.endOffset.parentNode;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"selectNode\",\n\t\tvalue: function selectNode(referenceNode) {\n\t\t\tvar parent = referenceNode.parentNode;\n\t\t\tvar index = Array.prototype.indexOf.call(parent.childNodes, referenceNode);\n\t\t\tthis.setStart(parent, index);\n\t\t\tthis.setEnd(parent, index + 1);\n\t\t}\n\t}, {\n\t\tkey: \"selectNodeContents\",\n\t\tvalue: function selectNodeContents(referenceNode) {\n\t\t\tvar end = referenceNode.childNodes[referenceNode.childNodes - 1];\n\t\t\tvar endIndex = referenceNode.nodeType === 3 ? referenceNode.textContent.length : parent.childNodes.length;\n\t\t\tthis.setStart(referenceNode, 0);\n\t\t\tthis.setEnd(referenceNode, endIndex);\n\t\t}\n\t}, {\n\t\tkey: \"_commonAncestorContainer\",\n\t\tvalue: function _commonAncestorContainer(startContainer, endContainer) {\n\t\t\tvar startParents = parents(startContainer || this.startContainer);\n\t\t\tvar endParents = parents(endContainer || this.endContainer);\n\n\t\t\tif (startParents[0] != endParents[0]) return undefined;\n\n\t\t\tfor (var i = 0; i < startParents.length; i++) {\n\t\t\t\tif (startParents[i] != endParents[i]) {\n\t\t\t\t\treturn startParents[i - 1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"_checkCollapsed\",\n\t\tvalue: function _checkCollapsed() {\n\t\t\tif (this.startContainer === this.endContainer && this.startOffset === this.endOffset) {\n\t\t\t\tthis.collapsed = true;\n\t\t\t} else {\n\t\t\t\tthis.collapsed = false;\n\t\t\t}\n\t\t}\n\t}, {\n\t\tkey: \"toString\",\n\t\tvalue: function toString() {\n\t\t\t// TODO: implement walking between start and end to find text\n\t\t}\n\t}]);\n\n\treturn RangeObject;\n}();\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/core.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/hook.js": -/*!***********************************************!*\ - !*** ./node_modules/epubjs/lib/utils/hook.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Hooks allow for injecting functions that must all complete in order before finishing\n * They will execute in parallel but all must finish before continuing\n * Functions may return a promise if they are asycn.\n * @param {any} context scope of this\n * @example this.content = new EPUBJS.Hook(this);\n */\nvar Hook = function () {\n\tfunction Hook(context) {\n\t\t_classCallCheck(this, Hook);\n\n\t\tthis.context = context || this;\n\t\tthis.hooks = [];\n\t}\n\n\t/**\n * Adds a function to be run before a hook completes\n * @example this.content.register(function(){...});\n */\n\n\n\t_createClass(Hook, [{\n\t\tkey: \"register\",\n\t\tvalue: function register() {\n\t\t\tfor (var i = 0; i < arguments.length; ++i) {\n\t\t\t\tif (typeof arguments[i] === \"function\") {\n\t\t\t\t\tthis.hooks.push(arguments[i]);\n\t\t\t\t} else {\n\t\t\t\t\t// unpack array\n\t\t\t\t\tfor (var j = 0; j < arguments[i].length; ++j) {\n\t\t\t\t\t\tthis.hooks.push(arguments[i][j]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Removes a function\n * @example this.content.deregister(function(){...});\n */\n\n\t}, {\n\t\tkey: \"deregister\",\n\t\tvalue: function deregister(func) {\n\t\t\tvar hook = void 0;\n\t\t\tfor (var i = 0; i < this.hooks.length; i++) {\n\t\t\t\thook = this.hooks[i];\n\t\t\t\tif (hook === func) {\n\t\t\t\t\tthis.hooks.splice(i, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Triggers a hook to run all functions\n * @example this.content.trigger(args).then(function(){...});\n */\n\n\t}, {\n\t\tkey: \"trigger\",\n\t\tvalue: function trigger() {\n\t\t\tvar args = arguments;\n\t\t\tvar context = this.context;\n\t\t\tvar promises = [];\n\n\t\t\tthis.hooks.forEach(function (task) {\n\t\t\t\tvar executing = task.apply(context, args);\n\n\t\t\t\tif (executing && typeof executing[\"then\"] === \"function\") {\n\t\t\t\t\t// Task is a function that returns a promise\n\t\t\t\t\tpromises.push(executing);\n\t\t\t\t}\n\t\t\t\t// Otherwise Task resolves immediately, continue\n\t\t\t});\n\n\t\t\treturn Promise.all(promises);\n\t\t}\n\n\t\t// Adds a function to be run before a hook completes\n\n\t}, {\n\t\tkey: \"list\",\n\t\tvalue: function list() {\n\t\t\treturn this.hooks;\n\t\t}\n\t}, {\n\t\tkey: \"clear\",\n\t\tvalue: function clear() {\n\t\t\treturn this.hooks = [];\n\t\t}\n\t}]);\n\n\treturn Hook;\n}();\n\nexports.default = Hook;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/hook.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/path.js": -/*!***********************************************!*\ - !*** ./node_modules/epubjs/lib/utils/path.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _pathWebpack = __webpack_require__(/*! path-webpack */ \"./node_modules/path-webpack/path.js\");\n\nvar _pathWebpack2 = _interopRequireDefault(_pathWebpack);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Creates a Path object for parsing and manipulation of a path strings\n *\n * Uses a polyfill for Nodejs path: https://nodejs.org/api/path.html\n * @param\t{string} pathString\ta url string (relative or absolute)\n * @class\n */\nvar Path = function () {\n\tfunction Path(pathString) {\n\t\t_classCallCheck(this, Path);\n\n\t\tvar protocol;\n\t\tvar parsed;\n\n\t\tprotocol = pathString.indexOf(\"://\");\n\t\tif (protocol > -1) {\n\t\t\tpathString = new URL(pathString).pathname;\n\t\t}\n\n\t\tparsed = this.parse(pathString);\n\n\t\tthis.path = pathString;\n\n\t\tif (this.isDirectory(pathString)) {\n\t\t\tthis.directory = pathString;\n\t\t} else {\n\t\t\tthis.directory = parsed.dir + \"/\";\n\t\t}\n\n\t\tthis.filename = parsed.base;\n\t\tthis.extension = parsed.ext.slice(1);\n\t}\n\n\t/**\n * Parse the path: https://nodejs.org/api/path.html#path_path_parse_path\n * @param\t{string} what\n * @returns {object}\n */\n\n\n\t_createClass(Path, [{\n\t\tkey: \"parse\",\n\t\tvalue: function parse(what) {\n\t\t\treturn _pathWebpack2.default.parse(what);\n\t\t}\n\n\t\t/**\n * @param\t{string} what\n * @returns {boolean}\n */\n\n\t}, {\n\t\tkey: \"isAbsolute\",\n\t\tvalue: function isAbsolute(what) {\n\t\t\treturn _pathWebpack2.default.isAbsolute(what || this.path);\n\t\t}\n\n\t\t/**\n * Check if path ends with a directory\n * @param\t{string} what\n * @returns {boolean}\n */\n\n\t}, {\n\t\tkey: \"isDirectory\",\n\t\tvalue: function isDirectory(what) {\n\t\t\treturn what.charAt(what.length - 1) === \"/\";\n\t\t}\n\n\t\t/**\n * Resolve a path against the directory of the Path\n *\n * https://nodejs.org/api/path.html#path_path_resolve_paths\n * @param\t{string} what\n * @returns {string} resolved\n */\n\n\t}, {\n\t\tkey: \"resolve\",\n\t\tvalue: function resolve(what) {\n\t\t\treturn _pathWebpack2.default.resolve(this.directory, what);\n\t\t}\n\n\t\t/**\n * Resolve a path relative to the directory of the Path\n *\n * https://nodejs.org/api/path.html#path_path_relative_from_to\n * @param\t{string} what\n * @returns {string} relative\n */\n\n\t}, {\n\t\tkey: \"relative\",\n\t\tvalue: function relative(what) {\n\t\t\tvar isAbsolute = what && what.indexOf(\"://\") > -1;\n\n\t\t\tif (isAbsolute) {\n\t\t\t\treturn what;\n\t\t\t}\n\n\t\t\treturn _pathWebpack2.default.relative(this.directory, what);\n\t\t}\n\t}, {\n\t\tkey: \"splitPath\",\n\t\tvalue: function splitPath(filename) {\n\t\t\treturn this.splitPathRe.exec(filename).slice(1);\n\t\t}\n\n\t\t/**\n * Return the path string\n * @returns {string} path\n */\n\n\t}, {\n\t\tkey: \"toString\",\n\t\tvalue: function toString() {\n\t\t\treturn this.path;\n\t\t}\n\t}]);\n\n\treturn Path;\n}();\n\nexports.default = Path;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/path.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/queue.js": -/*!************************************************!*\ - !*** ./node_modules/epubjs/lib/utils/queue.js ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.Task = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _core = __webpack_require__(/*! ./core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Queue for handling tasks one at a time\n * @class\n * @param {scope} context what this will resolve to in the tasks\n */\nvar Queue = function () {\n\tfunction Queue(context) {\n\t\t_classCallCheck(this, Queue);\n\n\t\tthis._q = [];\n\t\tthis.context = context;\n\t\tthis.tick = _core.requestAnimationFrame;\n\t\tthis.running = false;\n\t\tthis.paused = false;\n\t}\n\n\t/**\n * Add an item to the queue\n * @return {Promise}\n */\n\n\n\t_createClass(Queue, [{\n\t\tkey: \"enqueue\",\n\t\tvalue: function enqueue() {\n\t\t\tvar deferred, promise;\n\t\t\tvar queued;\n\t\t\tvar task = [].shift.call(arguments);\n\t\t\tvar args = arguments;\n\n\t\t\t// Handle single args without context\n\t\t\t// if(args && !Array.isArray(args)) {\n\t\t\t// args = [args];\n\t\t\t// }\n\t\t\tif (!task) {\n\t\t\t\tthrow new Error(\"No Task Provided\");\n\t\t\t}\n\n\t\t\tif (typeof task === \"function\") {\n\n\t\t\t\tdeferred = new _core.defer();\n\t\t\t\tpromise = deferred.promise;\n\n\t\t\t\tqueued = {\n\t\t\t\t\t\"task\": task,\n\t\t\t\t\t\"args\": args,\n\t\t\t\t\t//\"context\" : context,\n\t\t\t\t\t\"deferred\": deferred,\n\t\t\t\t\t\"promise\": promise\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Task is a promise\n\t\t\t\tqueued = {\n\t\t\t\t\t\"promise\": task\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis._q.push(queued);\n\n\t\t\t// Wait to start queue flush\n\t\t\tif (this.paused == false && !this.running) {\n\t\t\t\t// setTimeout(this.flush.bind(this), 0);\n\t\t\t\t// this.tick.call(window, this.run.bind(this));\n\t\t\t\tthis.run();\n\t\t\t}\n\n\t\t\treturn queued.promise;\n\t\t}\n\n\t\t/**\n * Run one item\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"dequeue\",\n\t\tvalue: function dequeue() {\n\t\t\tvar inwait, task, result;\n\n\t\t\tif (this._q.length && !this.paused) {\n\t\t\t\tinwait = this._q.shift();\n\t\t\t\ttask = inwait.task;\n\t\t\t\tif (task) {\n\t\t\t\t\t// console.log(task)\n\n\t\t\t\t\tresult = task.apply(this.context, inwait.args);\n\n\t\t\t\t\tif (result && typeof result[\"then\"] === \"function\") {\n\t\t\t\t\t\t// Task is a function that returns a promise\n\t\t\t\t\t\treturn result.then(function () {\n\t\t\t\t\t\t\tinwait.deferred.resolve.apply(this.context, arguments);\n\t\t\t\t\t\t}.bind(this), function () {\n\t\t\t\t\t\t\tinwait.deferred.reject.apply(this.context, arguments);\n\t\t\t\t\t\t}.bind(this));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Task resolves immediately\n\t\t\t\t\t\tinwait.deferred.resolve.apply(this.context, result);\n\t\t\t\t\t\treturn inwait.promise;\n\t\t\t\t\t}\n\t\t\t\t} else if (inwait.promise) {\n\t\t\t\t\t// Task is a promise\n\t\t\t\t\treturn inwait.promise;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tinwait = new _core.defer();\n\t\t\t\tinwait.deferred.resolve();\n\t\t\t\treturn inwait.promise;\n\t\t\t}\n\t\t}\n\n\t\t// Run All Immediately\n\n\t}, {\n\t\tkey: \"dump\",\n\t\tvalue: function dump() {\n\t\t\twhile (this._q.length) {\n\t\t\t\tthis.dequeue();\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Run all tasks sequentially, at convince\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"run\",\n\t\tvalue: function run() {\n\t\t\tvar _this = this;\n\n\t\t\tif (!this.running) {\n\t\t\t\tthis.running = true;\n\t\t\t\tthis.defered = new _core.defer();\n\t\t\t}\n\n\t\t\tthis.tick.call(window, function () {\n\n\t\t\t\tif (_this._q.length) {\n\n\t\t\t\t\t_this.dequeue().then(function () {\n\t\t\t\t\t\tthis.run();\n\t\t\t\t\t}.bind(_this));\n\t\t\t\t} else {\n\t\t\t\t\t_this.defered.resolve();\n\t\t\t\t\t_this.running = undefined;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Unpause\n\t\t\tif (this.paused == true) {\n\t\t\t\tthis.paused = false;\n\t\t\t}\n\n\t\t\treturn this.defered.promise;\n\t\t}\n\n\t\t/**\n * Flush all, as quickly as possible\n * @return {Promise}\n */\n\n\t}, {\n\t\tkey: \"flush\",\n\t\tvalue: function flush() {\n\n\t\t\tif (this.running) {\n\t\t\t\treturn this.running;\n\t\t\t}\n\n\t\t\tif (this._q.length) {\n\t\t\t\tthis.running = this.dequeue().then(function () {\n\t\t\t\t\tthis.running = undefined;\n\t\t\t\t\treturn this.flush();\n\t\t\t\t}.bind(this));\n\n\t\t\t\treturn this.running;\n\t\t\t}\n\t\t}\n\n\t\t/**\n * Clear all items in wait\n */\n\n\t}, {\n\t\tkey: \"clear\",\n\t\tvalue: function clear() {\n\t\t\tthis._q = [];\n\t\t}\n\n\t\t/**\n * Get the number of tasks in the queue\n * @return {number} tasks\n */\n\n\t}, {\n\t\tkey: \"length\",\n\t\tvalue: function length() {\n\t\t\treturn this._q.length;\n\t\t}\n\n\t\t/**\n * Pause a running queue\n */\n\n\t}, {\n\t\tkey: \"pause\",\n\t\tvalue: function pause() {\n\t\t\tthis.paused = true;\n\t\t}\n\n\t\t/**\n * End the queue\n */\n\n\t}, {\n\t\tkey: \"stop\",\n\t\tvalue: function stop() {\n\t\t\tthis._q = [];\n\t\t\tthis.running = false;\n\t\t\tthis.paused = true;\n\t\t}\n\t}]);\n\n\treturn Queue;\n}();\n\n/**\n * Create a new task from a callback\n * @class\n * @private\n * @param {function} task\n * @param {array} args\n * @param {scope} context\n * @return {function} task\n */\n\n\nvar Task = function Task(task, args, context) {\n\t_classCallCheck(this, Task);\n\n\treturn function () {\n\t\tvar _this2 = this;\n\n\t\tvar toApply = arguments || [];\n\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar callback = function callback(value, err) {\n\t\t\t\tif (!value && err) {\n\t\t\t\t\treject(err);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(value);\n\t\t\t\t}\n\t\t\t};\n\t\t\t// Add the callback to the arguments list\n\t\t\ttoApply.push(callback);\n\n\t\t\t// Apply all arguments to the functions\n\t\t\ttask.apply(context || _this2, toApply);\n\t\t});\n\t};\n};\n\nexports.default = Queue;\nexports.Task = Task;\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/queue.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/replacements.js": -/*!*******************************************************!*\ - !*** ./node_modules/epubjs/lib/utils/replacements.js ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.replaceBase = replaceBase;\nexports.replaceCanonical = replaceCanonical;\nexports.replaceMeta = replaceMeta;\nexports.replaceLinks = replaceLinks;\nexports.substitute = substitute;\n\nvar _core = __webpack_require__(/*! ./core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _url = __webpack_require__(/*! ./url */ \"./node_modules/epubjs/lib/utils/url.js\");\n\nvar _url2 = _interopRequireDefault(_url);\n\nvar _path = __webpack_require__(/*! ./path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction replaceBase(doc, section) {\n\tvar base;\n\tvar head;\n\tvar url = section.url;\n\tvar absolute = url.indexOf(\"://\") > -1;\n\n\tif (!doc) {\n\t\treturn;\n\t}\n\n\thead = (0, _core.qs)(doc, \"head\");\n\tbase = (0, _core.qs)(head, \"base\");\n\n\tif (!base) {\n\t\tbase = doc.createElement(\"base\");\n\t\thead.insertBefore(base, head.firstChild);\n\t}\n\n\t// Fix for Safari crashing if the url doesn't have an origin\n\tif (!absolute && window && window.location) {\n\t\turl = window.location.origin + url;\n\t}\n\n\tbase.setAttribute(\"href\", url);\n}\n\nfunction replaceCanonical(doc, section) {\n\tvar head;\n\tvar link;\n\tvar url = section.canonical;\n\n\tif (!doc) {\n\t\treturn;\n\t}\n\n\thead = (0, _core.qs)(doc, \"head\");\n\tlink = (0, _core.qs)(head, \"link[rel='canonical']\");\n\n\tif (link) {\n\t\tlink.setAttribute(\"href\", url);\n\t} else {\n\t\tlink = doc.createElement(\"link\");\n\t\tlink.setAttribute(\"rel\", \"canonical\");\n\t\tlink.setAttribute(\"href\", url);\n\t\thead.appendChild(link);\n\t}\n}\n\nfunction replaceMeta(doc, section) {\n\tvar head;\n\tvar meta;\n\tvar id = section.idref;\n\tif (!doc) {\n\t\treturn;\n\t}\n\n\thead = (0, _core.qs)(doc, \"head\");\n\tmeta = (0, _core.qs)(head, \"link[property='dc.identifier']\");\n\n\tif (meta) {\n\t\tmeta.setAttribute(\"content\", id);\n\t} else {\n\t\tmeta = doc.createElement(\"meta\");\n\t\tmeta.setAttribute(\"name\", \"dc.identifier\");\n\t\tmeta.setAttribute(\"content\", id);\n\t\thead.appendChild(meta);\n\t}\n}\n\n// TODO: move me to Contents\nfunction replaceLinks(contents, fn) {\n\n\tvar links = contents.querySelectorAll(\"a[href]\");\n\n\tif (!links.length) {\n\t\treturn;\n\t}\n\n\tvar base = (0, _core.qs)(contents.ownerDocument, \"base\");\n\tvar location = base ? base.getAttribute(\"href\") : undefined;\n\tvar replaceLink = function (link) {\n\t\tvar href = link.getAttribute(\"href\");\n\n\t\tif (href.indexOf(\"mailto:\") === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar absolute = href.indexOf(\"://\") > -1;\n\n\t\tif (absolute) {\n\n\t\t\tlink.setAttribute(\"target\", \"_blank\");\n\t\t} else {\n\t\t\tvar linkUrl;\n\t\t\ttry {\n\t\t\t\tlinkUrl = new _url2.default(href, location);\n\t\t\t} catch (error) {\n\t\t\t\t// NOOP\n\t\t\t}\n\n\t\t\tlink.onclick = function () {\n\n\t\t\t\tif (linkUrl && linkUrl.hash) {\n\t\t\t\t\tfn(linkUrl.Path.path + linkUrl.hash);\n\t\t\t\t} else if (linkUrl) {\n\t\t\t\t\tfn(linkUrl.Path.path);\n\t\t\t\t} else {\n\t\t\t\t\tfn(href);\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}\n\t}.bind(this);\n\n\tfor (var i = 0; i < links.length; i++) {\n\t\treplaceLink(links[i]);\n\t}\n}\n\nfunction substitute(content, urls, replacements) {\n\turls.forEach(function (url, i) {\n\t\tif (url && replacements[i]) {\n\t\t\tcontent = content.replace(new RegExp(url, \"g\"), replacements[i]);\n\t\t}\n\t});\n\treturn content;\n}\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/replacements.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/request.js": -/*!**************************************************!*\ - !*** ./node_modules/epubjs/lib/utils/request.js ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _core = __webpack_require__(/*! ./core */ \"./node_modules/epubjs/lib/utils/core.js\");\n\nvar _path = __webpack_require__(/*! ./path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction request(url, type, withCredentials, headers) {\n\tvar supportsURL = typeof window != \"undefined\" ? window.URL : false; // TODO: fallback for url if window isn't defined\n\tvar BLOB_RESPONSE = supportsURL ? \"blob\" : \"arraybuffer\";\n\n\tvar deferred = new _core.defer();\n\n\tvar xhr = new XMLHttpRequest();\n\n\t//-- Check from PDF.js:\n\t// https://github.com/mozilla/pdf.js/blob/master/web/compatibility.js\n\tvar xhrPrototype = XMLHttpRequest.prototype;\n\n\tvar header;\n\n\tif (!(\"overrideMimeType\" in xhrPrototype)) {\n\t\t// IE10 might have response, but not overrideMimeType\n\t\tObject.defineProperty(xhrPrototype, \"overrideMimeType\", {\n\t\t\tvalue: function xmlHttpRequestOverrideMimeType() {}\n\t\t});\n\t}\n\n\tif (withCredentials) {\n\t\txhr.withCredentials = true;\n\t}\n\n\txhr.onreadystatechange = handler;\n\txhr.onerror = err;\n\n\txhr.open(\"GET\", url, true);\n\n\tfor (header in headers) {\n\t\txhr.setRequestHeader(header, headers[header]);\n\t}\n\n\tif (type == \"json\") {\n\t\txhr.setRequestHeader(\"Accept\", \"application/json\");\n\t}\n\n\t// If type isn\"t set, determine it from the file extension\n\tif (!type) {\n\t\ttype = new _path2.default(url).extension;\n\t}\n\n\tif (type == \"blob\") {\n\t\txhr.responseType = BLOB_RESPONSE;\n\t}\n\n\tif ((0, _core.isXml)(type)) {\n\t\t// xhr.responseType = \"document\";\n\t\txhr.overrideMimeType(\"text/xml\"); // for OPF parsing\n\t}\n\n\tif (type == \"xhtml\") {\n\t\t// xhr.responseType = \"document\";\n\t}\n\n\tif (type == \"html\" || type == \"htm\") {\n\t\t// xhr.responseType = \"document\";\n\t}\n\n\tif (type == \"binary\") {\n\t\txhr.responseType = \"arraybuffer\";\n\t}\n\n\txhr.send();\n\n\tfunction err(e) {\n\t\tdeferred.reject(e);\n\t}\n\n\tfunction handler() {\n\t\tif (this.readyState === XMLHttpRequest.DONE) {\n\t\t\tvar responseXML = false;\n\n\t\t\tif (this.responseType === \"\" || this.responseType === \"document\") {\n\t\t\t\tresponseXML = this.responseXML;\n\t\t\t}\n\n\t\t\tif (this.status === 200 || this.status === 0 || responseXML) {\n\t\t\t\t//-- Firefox is reporting 0 for blob urls\n\t\t\t\tvar r;\n\n\t\t\t\tif (!this.response && !responseXML) {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tstatus: this.status,\n\t\t\t\t\t\tmessage: \"Empty Response\",\n\t\t\t\t\t\tstack: new Error().stack\n\t\t\t\t\t});\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}\n\n\t\t\t\tif (this.status === 403) {\n\t\t\t\t\tdeferred.reject({\n\t\t\t\t\t\tstatus: this.status,\n\t\t\t\t\t\tresponse: this.response,\n\t\t\t\t\t\tmessage: \"Forbidden\",\n\t\t\t\t\t\tstack: new Error().stack\n\t\t\t\t\t});\n\t\t\t\t\treturn deferred.promise;\n\t\t\t\t}\n\t\t\t\tif (responseXML) {\n\t\t\t\t\tr = this.responseXML;\n\t\t\t\t} else if ((0, _core.isXml)(type)) {\n\t\t\t\t\t// xhr.overrideMimeType(\"text/xml\"); // for OPF parsing\n\t\t\t\t\t// If this.responseXML wasn't set, try to parse using a DOMParser from text\n\t\t\t\t\tr = (0, _core.parse)(this.response, \"text/xml\");\n\t\t\t\t} else if (type == \"xhtml\") {\n\t\t\t\t\tr = (0, _core.parse)(this.response, \"application/xhtml+xml\");\n\t\t\t\t} else if (type == \"html\" || type == \"htm\") {\n\t\t\t\t\tr = (0, _core.parse)(this.response, \"text/html\");\n\t\t\t\t} else if (type == \"json\") {\n\t\t\t\t\tr = JSON.parse(this.response);\n\t\t\t\t} else if (type == \"blob\") {\n\n\t\t\t\t\tif (supportsURL) {\n\t\t\t\t\t\tr = this.response;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//-- Safari doesn't support responseType blob, so create a blob from arraybuffer\n\t\t\t\t\t\tr = new Blob([this.response]);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tr = this.response;\n\t\t\t\t}\n\n\t\t\t\tdeferred.resolve(r);\n\t\t\t} else {\n\n\t\t\t\tdeferred.reject({\n\t\t\t\t\tstatus: this.status,\n\t\t\t\t\tmessage: this.response,\n\t\t\t\t\tstack: new Error().stack\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn deferred.promise;\n}\n\nexports.default = request;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/request.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/lib/utils/url.js": -/*!**********************************************!*\ - !*** ./node_modules/epubjs/lib/utils/url.js ***! - \**********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _path = __webpack_require__(/*! ./path */ \"./node_modules/epubjs/lib/utils/path.js\");\n\nvar _path2 = _interopRequireDefault(_path);\n\nvar _pathWebpack = __webpack_require__(/*! path-webpack */ \"./node_modules/path-webpack/path.js\");\n\nvar _pathWebpack2 = _interopRequireDefault(_pathWebpack);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * creates a Url object for parsing and manipulation of a url string\n * @param\t{string} urlString\ta url string (relative or absolute)\n * @param\t{string} [baseString] optional base for the url,\n * default to window.location.href\n */\nvar Url = function () {\n\tfunction Url(urlString, baseString) {\n\t\t_classCallCheck(this, Url);\n\n\t\tvar absolute = urlString.indexOf(\"://\") > -1;\n\t\tvar pathname = urlString;\n\t\tvar basePath;\n\n\t\tthis.Url = undefined;\n\t\tthis.href = urlString;\n\t\tthis.protocol = \"\";\n\t\tthis.origin = \"\";\n\t\tthis.hash = \"\";\n\t\tthis.hash = \"\";\n\t\tthis.search = \"\";\n\t\tthis.base = baseString;\n\n\t\tif (!absolute && baseString !== false && typeof baseString !== \"string\" && window && window.location) {\n\t\t\tthis.base = window.location.href;\n\t\t}\n\n\t\t// URL Polyfill doesn't throw an error if base is empty\n\t\tif (absolute || this.base) {\n\t\t\ttry {\n\t\t\t\tif (this.base) {\n\t\t\t\t\t// Safari doesn't like an undefined base\n\t\t\t\t\tthis.Url = new URL(urlString, this.base);\n\t\t\t\t} else {\n\t\t\t\t\tthis.Url = new URL(urlString);\n\t\t\t\t}\n\t\t\t\tthis.href = this.Url.href;\n\n\t\t\t\tthis.protocol = this.Url.protocol;\n\t\t\t\tthis.origin = this.Url.origin;\n\t\t\t\tthis.hash = this.Url.hash;\n\t\t\t\tthis.search = this.Url.search;\n\n\t\t\t\tpathname = this.Url.pathname;\n\t\t\t} catch (e) {\n\t\t\t\t// Skip URL parsing\n\t\t\t\tthis.Url = undefined;\n\t\t\t\t// resolve the pathname from the base\n\t\t\t\tif (this.base) {\n\t\t\t\t\tbasePath = new _path2.default(this.base);\n\t\t\t\t\tpathname = basePath.resolve(pathname);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.Path = new _path2.default(pathname);\n\n\t\tthis.directory = this.Path.directory;\n\t\tthis.filename = this.Path.filename;\n\t\tthis.extension = this.Path.extension;\n\t}\n\n\t/**\n * @returns {Path}\n */\n\n\n\t_createClass(Url, [{\n\t\tkey: \"path\",\n\t\tvalue: function path() {\n\t\t\treturn this.Path;\n\t\t}\n\n\t\t/**\n * Resolves a relative path to a absolute url\n * @param {string} what\n * @returns {string} url\n */\n\n\t}, {\n\t\tkey: \"resolve\",\n\t\tvalue: function resolve(what) {\n\t\t\tvar isAbsolute = what.indexOf(\"://\") > -1;\n\t\t\tvar fullpath;\n\n\t\t\tif (isAbsolute) {\n\t\t\t\treturn what;\n\t\t\t}\n\n\t\t\tfullpath = _pathWebpack2.default.resolve(this.directory, what);\n\t\t\treturn this.origin + fullpath;\n\t\t}\n\n\t\t/**\n * Resolve a path relative to the url\n * @param {string} what\n * @returns {string} path\n */\n\n\t}, {\n\t\tkey: \"relative\",\n\t\tvalue: function relative(what) {\n\t\t\treturn _pathWebpack2.default.relative(what, this.directory);\n\t\t}\n\n\t\t/**\n * @returns {string}\n */\n\n\t}, {\n\t\tkey: \"toString\",\n\t\tvalue: function toString() {\n\t\t\treturn this.href;\n\t\t}\n\t}]);\n\n\treturn Url;\n}();\n\nexports.default = Url;\nmodule.exports = exports[\"default\"];\n\n//# sourceURL=webpack:///./node_modules/epubjs/lib/utils/url.js?"); - -/***/ }), - -/***/ "./node_modules/epubjs/libs/mime/mime.js": -/*!***********************************************!*\ - !*** ./node_modules/epubjs/libs/mime/mime.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("/*\n From Zip.js, by Gildas Lormeau\nedited down\n */\n\nvar table = {\n\t\"application\" : {\n\t\t\"ecmascript\" : [ \"es\", \"ecma\" ],\n\t\t\"javascript\" : \"js\",\n\t\t\"ogg\" : \"ogx\",\n\t\t\"pdf\" : \"pdf\",\n\t\t\"postscript\" : [ \"ps\", \"ai\", \"eps\", \"epsi\", \"epsf\", \"eps2\", \"eps3\" ],\n\t\t\"rdf+xml\" : \"rdf\",\n\t\t\"smil\" : [ \"smi\", \"smil\" ],\n\t\t\"xhtml+xml\" : [ \"xhtml\", \"xht\" ],\n\t\t\"xml\" : [ \"xml\", \"xsl\", \"xsd\", \"opf\", \"ncx\" ],\n\t\t\"zip\" : \"zip\",\n\t\t\"x-httpd-eruby\" : \"rhtml\",\n\t\t\"x-latex\" : \"latex\",\n\t\t\"x-maker\" : [ \"frm\", \"maker\", \"frame\", \"fm\", \"fb\", \"book\", \"fbdoc\" ],\n\t\t\"x-object\" : \"o\",\n\t\t\"x-shockwave-flash\" : [ \"swf\", \"swfl\" ],\n\t\t\"x-silverlight\" : \"scr\",\n\t\t\"epub+zip\" : \"epub\",\n\t\t\"font-tdpfr\" : \"pfr\",\n\t\t\"inkml+xml\" : [ \"ink\", \"inkml\" ],\n\t\t\"json\" : \"json\",\n\t\t\"jsonml+json\" : \"jsonml\",\n\t\t\"mathml+xml\" : \"mathml\",\n\t\t\"metalink+xml\" : \"metalink\",\n\t\t\"mp4\" : \"mp4s\",\n\t\t// \"oebps-package+xml\" : \"opf\",\n\t\t\"omdoc+xml\" : \"omdoc\",\n\t\t\"oxps\" : \"oxps\",\n\t\t\"vnd.amazon.ebook\" : \"azw\",\n\t\t\"widget\" : \"wgt\",\n\t\t// \"x-dtbncx+xml\" : \"ncx\",\n\t\t\"x-dtbook+xml\" : \"dtb\",\n\t\t\"x-dtbresource+xml\" : \"res\",\n\t\t\"x-font-bdf\" : \"bdf\",\n\t\t\"x-font-ghostscript\" : \"gsf\",\n\t\t\"x-font-linux-psf\" : \"psf\",\n\t\t\"x-font-otf\" : \"otf\",\n\t\t\"x-font-pcf\" : \"pcf\",\n\t\t\"x-font-snf\" : \"snf\",\n\t\t\"x-font-ttf\" : [ \"ttf\", \"ttc\" ],\n\t\t\"x-font-type1\" : [ \"pfa\", \"pfb\", \"pfm\", \"afm\" ],\n\t\t\"x-font-woff\" : \"woff\",\n\t\t\"x-mobipocket-ebook\" : [ \"prc\", \"mobi\" ],\n\t\t\"x-mspublisher\" : \"pub\",\n\t\t\"x-nzb\" : \"nzb\",\n\t\t\"x-tgif\" : \"obj\",\n\t\t\"xaml+xml\" : \"xaml\",\n\t\t\"xml-dtd\" : \"dtd\",\n\t\t\"xproc+xml\" : \"xpl\",\n\t\t\"xslt+xml\" : \"xslt\",\n\t\t\"internet-property-stream\" : \"acx\",\n\t\t\"x-compress\" : \"z\",\n\t\t\"x-compressed\" : \"tgz\",\n\t\t\"x-gzip\" : \"gz\",\n\t},\n\t\"audio\" : {\n\t\t\"flac\" : \"flac\",\n\t\t\"midi\" : [ \"mid\", \"midi\", \"kar\", \"rmi\" ],\n\t\t\"mpeg\" : [ \"mpga\", \"mpega\", \"mp2\", \"mp3\", \"m4a\", \"mp2a\", \"m2a\", \"m3a\" ],\n\t\t\"mpegurl\" : \"m3u\",\n\t\t\"ogg\" : [ \"oga\", \"ogg\", \"spx\" ],\n\t\t\"x-aiff\" : [ \"aif\", \"aiff\", \"aifc\" ],\n\t\t\"x-ms-wma\" : \"wma\",\n\t\t\"x-wav\" : \"wav\",\n\t\t\"adpcm\" : \"adp\",\n\t\t\"mp4\" : \"mp4a\",\n\t\t\"webm\" : \"weba\",\n\t\t\"x-aac\" : \"aac\",\n\t\t\"x-caf\" : \"caf\",\n\t\t\"x-matroska\" : \"mka\",\n\t\t\"x-pn-realaudio-plugin\" : \"rmp\",\n\t\t\"xm\" : \"xm\",\n\t\t\"mid\" : [ \"mid\", \"rmi\" ]\n\t},\n\t\"image\" : {\n\t\t\"gif\" : \"gif\",\n\t\t\"ief\" : \"ief\",\n\t\t\"jpeg\" : [ \"jpeg\", \"jpg\", \"jpe\" ],\n\t\t\"pcx\" : \"pcx\",\n\t\t\"png\" : \"png\",\n\t\t\"svg+xml\" : [ \"svg\", \"svgz\" ],\n\t\t\"tiff\" : [ \"tiff\", \"tif\" ],\n\t\t\"x-icon\" : \"ico\",\n\t\t\"bmp\" : \"bmp\",\n\t\t\"webp\" : \"webp\",\n\t\t\"x-pict\" : [ \"pic\", \"pct\" ],\n\t\t\"x-tga\" : \"tga\",\n\t\t\"cis-cod\" : \"cod\"\n\t},\n\t\"text\" : {\n\t\t\"cache-manifest\" : [ \"manifest\", \"appcache\" ],\n\t\t\"css\" : \"css\",\n\t\t\"csv\" : \"csv\",\n\t\t\"html\" : [ \"html\", \"htm\", \"shtml\", \"stm\" ],\n\t\t\"mathml\" : \"mml\",\n\t\t\"plain\" : [ \"txt\", \"text\", \"brf\", \"conf\", \"def\", \"list\", \"log\", \"in\", \"bas\" ],\n\t\t\"richtext\" : \"rtx\",\n\t\t\"tab-separated-values\" : \"tsv\",\n\t\t\"x-bibtex\" : \"bib\"\n\t},\n\t\"video\" : {\n\t\t\"mpeg\" : [ \"mpeg\", \"mpg\", \"mpe\", \"m1v\", \"m2v\", \"mp2\", \"mpa\", \"mpv2\" ],\n\t\t\"mp4\" : [ \"mp4\", \"mp4v\", \"mpg4\" ],\n\t\t\"quicktime\" : [ \"qt\", \"mov\" ],\n\t\t\"ogg\" : \"ogv\",\n\t\t\"vnd.mpegurl\" : [ \"mxu\", \"m4u\" ],\n\t\t\"x-flv\" : \"flv\",\n\t\t\"x-la-asf\" : [ \"lsf\", \"lsx\" ],\n\t\t\"x-mng\" : \"mng\",\n\t\t\"x-ms-asf\" : [ \"asf\", \"asx\", \"asr\" ],\n\t\t\"x-ms-wm\" : \"wm\",\n\t\t\"x-ms-wmv\" : \"wmv\",\n\t\t\"x-ms-wmx\" : \"wmx\",\n\t\t\"x-ms-wvx\" : \"wvx\",\n\t\t\"x-msvideo\" : \"avi\",\n\t\t\"x-sgi-movie\" : \"movie\",\n\t\t\"x-matroska\" : [ \"mpv\", \"mkv\", \"mk3d\", \"mks\" ],\n\t\t\"3gpp2\" : \"3g2\",\n\t\t\"h261\" : \"h261\",\n\t\t\"h263\" : \"h263\",\n\t\t\"h264\" : \"h264\",\n\t\t\"jpeg\" : \"jpgv\",\n\t\t\"jpm\" : [ \"jpm\", \"jpgm\" ],\n\t\t\"mj2\" : [ \"mj2\", \"mjp2\" ],\n\t\t\"vnd.ms-playready.media.pyv\" : \"pyv\",\n\t\t\"vnd.uvvu.mp4\" : [ \"uvu\", \"uvvu\" ],\n\t\t\"vnd.vivo\" : \"viv\",\n\t\t\"webm\" : \"webm\",\n\t\t\"x-f4v\" : \"f4v\",\n\t\t\"x-m4v\" : \"m4v\",\n\t\t\"x-ms-vob\" : \"vob\",\n\t\t\"x-smv\" : \"smv\"\n\t}\n};\n\nvar mimeTypes = (function() {\n\tvar type, subtype, val, index, mimeTypes = {};\n\tfor (type in table) {\n\t\tif (table.hasOwnProperty(type)) {\n\t\t\tfor (subtype in table[type]) {\n\t\t\t\tif (table[type].hasOwnProperty(subtype)) {\n\t\t\t\t\tval = table[type][subtype];\n\t\t\t\t\tif (typeof val == \"string\") {\n\t\t\t\t\t\tmimeTypes[val] = type + \"/\" + subtype;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (index = 0; index < val.length; index++) {\n\t\t\t\t\t\t\tmimeTypes[val[index]] = type + \"/\" + subtype;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn mimeTypes;\n})();\n\nvar defaultValue = \"text/plain\";//\"application/octet-stream\";\n\nfunction lookup(filename) {\n\treturn filename && mimeTypes[filename.split(\".\").pop().toLowerCase()] || defaultValue;\n};\n\nmodule.exports = {\n\t'lookup': lookup\n}\n\n\n//# sourceURL=webpack:///./node_modules/epubjs/libs/mime/mime.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/function/noop.js": -/*!***********************************************!*\ - !*** ./node_modules/es5-ext/function/noop.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\n// eslint-disable-next-line no-empty-function\nmodule.exports = function () {};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/function/noop.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/assign/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/es5-ext/object/assign/index.js ***! - \*****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nmodule.exports = __webpack_require__(/*! ./is-implemented */ \"./node_modules/es5-ext/object/assign/is-implemented.js\")()\n\t? Object.assign\n\t: __webpack_require__(/*! ./shim */ \"./node_modules/es5-ext/object/assign/shim.js\");\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/assign/index.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/assign/is-implemented.js": -/*!**************************************************************!*\ - !*** ./node_modules/es5-ext/object/assign/is-implemented.js ***! - \**************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nmodule.exports = function () {\n\tvar assign = Object.assign, obj;\n\tif (typeof assign !== \"function\") return false;\n\tobj = { foo: \"raz\" };\n\tassign(obj, { bar: \"dwa\" }, { trzy: \"trzy\" });\n\treturn (obj.foo + obj.bar + obj.trzy) === \"razdwatrzy\";\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/assign/is-implemented.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/assign/shim.js": -/*!****************************************************!*\ - !*** ./node_modules/es5-ext/object/assign/shim.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar keys = __webpack_require__(/*! ../keys */ \"./node_modules/es5-ext/object/keys/index.js\")\n , value = __webpack_require__(/*! ../valid-value */ \"./node_modules/es5-ext/object/valid-value.js\")\n , max = Math.max;\n\nmodule.exports = function (dest, src /*, …srcn*/) {\n\tvar error, i, length = max(arguments.length, 2), assign;\n\tdest = Object(value(dest));\n\tassign = function (key) {\n\t\ttry {\n\t\t\tdest[key] = src[key];\n\t\t} catch (e) {\n\t\t\tif (!error) error = e;\n\t\t}\n\t};\n\tfor (i = 1; i < length; ++i) {\n\t\tsrc = arguments[i];\n\t\tkeys(src).forEach(assign);\n\t}\n\tif (error !== undefined) throw error;\n\treturn dest;\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/assign/shim.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/is-callable.js": -/*!****************************************************!*\ - !*** ./node_modules/es5-ext/object/is-callable.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("// Deprecated\n\n\n\nmodule.exports = function (obj) {\n return typeof obj === \"function\";\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/is-callable.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/is-value.js": -/*!*************************************************!*\ - !*** ./node_modules/es5-ext/object/is-value.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar _undefined = __webpack_require__(/*! ../function/noop */ \"./node_modules/es5-ext/function/noop.js\")(); // Support ES3 engines\n\nmodule.exports = function (val) {\n return (val !== _undefined) && (val !== null);\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/is-value.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/keys/index.js": -/*!***************************************************!*\ - !*** ./node_modules/es5-ext/object/keys/index.js ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nmodule.exports = __webpack_require__(/*! ./is-implemented */ \"./node_modules/es5-ext/object/keys/is-implemented.js\")() ? Object.keys : __webpack_require__(/*! ./shim */ \"./node_modules/es5-ext/object/keys/shim.js\");\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/keys/index.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/keys/is-implemented.js": -/*!************************************************************!*\ - !*** ./node_modules/es5-ext/object/keys/is-implemented.js ***! - \************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nmodule.exports = function () {\n\ttry {\n\t\tObject.keys(\"primitive\");\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/keys/is-implemented.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/keys/shim.js": -/*!**************************************************!*\ - !*** ./node_modules/es5-ext/object/keys/shim.js ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar isValue = __webpack_require__(/*! ../is-value */ \"./node_modules/es5-ext/object/is-value.js\");\n\nvar keys = Object.keys;\n\nmodule.exports = function (object) { return keys(isValue(object) ? Object(object) : object); };\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/keys/shim.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/normalize-options.js": -/*!**********************************************************!*\ - !*** ./node_modules/es5-ext/object/normalize-options.js ***! - \**********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar isValue = __webpack_require__(/*! ./is-value */ \"./node_modules/es5-ext/object/is-value.js\");\n\nvar forEach = Array.prototype.forEach, create = Object.create;\n\nvar process = function (src, obj) {\n\tvar key;\n\tfor (key in src) obj[key] = src[key];\n};\n\n// eslint-disable-next-line no-unused-vars\nmodule.exports = function (opts1 /*, …options*/) {\n\tvar result = create(null);\n\tforEach.call(arguments, function (options) {\n\t\tif (!isValue(options)) return;\n\t\tprocess(Object(options), result);\n\t});\n\treturn result;\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/normalize-options.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/valid-callable.js": -/*!*******************************************************!*\ - !*** ./node_modules/es5-ext/object/valid-callable.js ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nmodule.exports = function (fn) {\n\tif (typeof fn !== \"function\") throw new TypeError(fn + \" is not a function\");\n\treturn fn;\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/valid-callable.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/object/valid-value.js": -/*!****************************************************!*\ - !*** ./node_modules/es5-ext/object/valid-value.js ***! - \****************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar isValue = __webpack_require__(/*! ./is-value */ \"./node_modules/es5-ext/object/is-value.js\");\n\nmodule.exports = function (value) {\n\tif (!isValue(value)) throw new TypeError(\"Cannot use null or undefined\");\n\treturn value;\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/object/valid-value.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/string/#/contains/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/es5-ext/string/#/contains/index.js ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nmodule.exports = __webpack_require__(/*! ./is-implemented */ \"./node_modules/es5-ext/string/#/contains/is-implemented.js\")()\n\t? String.prototype.contains\n\t: __webpack_require__(/*! ./shim */ \"./node_modules/es5-ext/string/#/contains/shim.js\");\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/string/#/contains/index.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/string/#/contains/is-implemented.js": -/*!******************************************************************!*\ - !*** ./node_modules/es5-ext/string/#/contains/is-implemented.js ***! - \******************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar str = \"razdwatrzy\";\n\nmodule.exports = function () {\n\tif (typeof str.contains !== \"function\") return false;\n\treturn (str.contains(\"dwa\") === true) && (str.contains(\"foo\") === false);\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/string/#/contains/is-implemented.js?"); - -/***/ }), - -/***/ "./node_modules/es5-ext/string/#/contains/shim.js": -/*!********************************************************!*\ - !*** ./node_modules/es5-ext/string/#/contains/shim.js ***! - \********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar indexOf = String.prototype.indexOf;\n\nmodule.exports = function (searchString/*, position*/) {\n\treturn indexOf.call(this, searchString, arguments[1]) > -1;\n};\n\n\n//# sourceURL=webpack:///./node_modules/es5-ext/string/#/contains/shim.js?"); - -/***/ }), - -/***/ "./node_modules/event-emitter/index.js": -/*!*********************************************!*\ - !*** ./node_modules/event-emitter/index.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("\n\nvar d = __webpack_require__(/*! d */ \"./node_modules/d/index.js\")\n , callable = __webpack_require__(/*! es5-ext/object/valid-callable */ \"./node_modules/es5-ext/object/valid-callable.js\")\n\n , apply = Function.prototype.apply, call = Function.prototype.call\n , create = Object.create, defineProperty = Object.defineProperty\n , defineProperties = Object.defineProperties\n , hasOwnProperty = Object.prototype.hasOwnProperty\n , descriptor = { configurable: true, enumerable: false, writable: true }\n\n , on, once, off, emit, methods, descriptors, base;\n\non = function (type, listener) {\n\tvar data;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) {\n\t\tdata = descriptor.value = create(null);\n\t\tdefineProperty(this, '__ee__', descriptor);\n\t\tdescriptor.value = null;\n\t} else {\n\t\tdata = this.__ee__;\n\t}\n\tif (!data[type]) data[type] = listener;\n\telse if (typeof data[type] === 'object') data[type].push(listener);\n\telse data[type] = [data[type], listener];\n\n\treturn this;\n};\n\nonce = function (type, listener) {\n\tvar once, self;\n\n\tcallable(listener);\n\tself = this;\n\ton.call(this, type, once = function () {\n\t\toff.call(self, type, once);\n\t\tapply.call(listener, this, arguments);\n\t});\n\n\tonce.__eeOnceListener__ = listener;\n\treturn this;\n};\n\noff = function (type, listener) {\n\tvar data, listeners, candidate, i;\n\n\tcallable(listener);\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return this;\n\tdata = this.__ee__;\n\tif (!data[type]) return this;\n\tlisteners = data[type];\n\n\tif (typeof listeners === 'object') {\n\t\tfor (i = 0; (candidate = listeners[i]); ++i) {\n\t\t\tif ((candidate === listener) ||\n\t\t\t\t\t(candidate.__eeOnceListener__ === listener)) {\n\t\t\t\tif (listeners.length === 2) data[type] = listeners[i ? 0 : 1];\n\t\t\t\telse listeners.splice(i, 1);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif ((listeners === listener) ||\n\t\t\t\t(listeners.__eeOnceListener__ === listener)) {\n\t\t\tdelete data[type];\n\t\t}\n\t}\n\n\treturn this;\n};\n\nemit = function (type) {\n\tvar i, l, listener, listeners, args;\n\n\tif (!hasOwnProperty.call(this, '__ee__')) return;\n\tlisteners = this.__ee__[type];\n\tif (!listeners) return;\n\n\tif (typeof listeners === 'object') {\n\t\tl = arguments.length;\n\t\targs = new Array(l - 1);\n\t\tfor (i = 1; i < l; ++i) args[i - 1] = arguments[i];\n\n\t\tlisteners = listeners.slice();\n\t\tfor (i = 0; (listener = listeners[i]); ++i) {\n\t\t\tapply.call(listener, this, args);\n\t\t}\n\t} else {\n\t\tswitch (arguments.length) {\n\t\tcase 1:\n\t\t\tcall.call(listeners, this);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tcall.call(listeners, this, arguments[1]);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tcall.call(listeners, this, arguments[1], arguments[2]);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tl = arguments.length;\n\t\t\targs = new Array(l - 1);\n\t\t\tfor (i = 1; i < l; ++i) {\n\t\t\t\targs[i - 1] = arguments[i];\n\t\t\t}\n\t\t\tapply.call(listeners, this, args);\n\t\t}\n\t}\n};\n\nmethods = {\n\ton: on,\n\tonce: once,\n\toff: off,\n\temit: emit\n};\n\ndescriptors = {\n\ton: d(on),\n\tonce: d(once),\n\toff: d(off),\n\temit: d(emit)\n};\n\nbase = defineProperties({}, descriptors);\n\nmodule.exports = exports = function (o) {\n\treturn (o == null) ? create(base) : defineProperties(Object(o), descriptors);\n};\nexports.methods = methods;\n\n\n//# sourceURL=webpack:///./node_modules/event-emitter/index.js?"); - -/***/ }), - -/***/ "./node_modules/events/events.js": -/*!***************************************!*\ - !*** ./node_modules/events/events.js ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction $getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return $getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = $getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n ReflectApply(this.listener, this.target, args);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\n\n//# sourceURL=webpack:///./node_modules/events/events.js?"); - -/***/ }), - -/***/ "./node_modules/ieee754/index.js": -/*!***************************************!*\ - !*** ./node_modules/ieee754/index.js ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -eval("exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n\n//# sourceURL=webpack:///./node_modules/ieee754/index.js?"); - -/***/ }), - -/***/ "./node_modules/immediate/lib/browser.js": -/*!***********************************************!*\ - !*** ./node_modules/immediate/lib/browser.js ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -eval("/* WEBPACK VAR INJECTION */(function(global) {\nvar Mutation = global.MutationObserver || global.WebKitMutationObserver;\n\nvar scheduleDrain;\n\n{\n if (Mutation) {\n var called = 0;\n var observer = new Mutation(nextTick);\n var element = global.document.createTextNode('');\n observer.observe(element, {\n characterData: true\n });\n scheduleDrain = function () {\n element.data = (called = ++called % 2);\n };\n } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {\n var channel = new global.MessageChannel();\n channel.port1.onmessage = nextTick;\n scheduleDrain = function () {\n channel.port2.postMessage(0);\n };\n } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {\n scheduleDrain = function () {\n\n // Create a