@airhang/vue-book-reader 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-book-reader.common.js +7 -7
- package/dist/vue-book-reader.common.js.map +1 -1
- package/dist/vue-book-reader.css +1 -1
- package/dist/vue-book-reader.umd.js +7 -7
- package/dist/vue-book-reader.umd.js.map +1 -1
- package/dist/vue-book-reader.umd.min.js +2 -2
- package/dist/vue-book-reader.umd.min.js.map +1 -1
- package/package.json +2 -1
- package/src/components/BookReader.vue +6 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["vue-book-reader"]=e():t["vue-book-reader"]=e()})("undefined"!==typeof self?self:this,function(){return function(){"use strict";var t={};!function(){t.d=function(e,i){for(var o in i)t.o(i,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:i[o]})}}(),function(){t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){t.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){t.p=""}();var e={};if(t.r(e),t.d(e,{BookCatalogueDrawer:function(){return U},BookReader:function(){return j},default:function(){return q}}),"undefined"!==typeof window){var i=window.document.currentScript,o=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(t.p=o[1])}var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"photo-album-container",
|
|
1
|
+
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["vue-book-reader"]=e():t["vue-book-reader"]=e()})("undefined"!==typeof self?self:this,function(){return function(){"use strict";var t={};!function(){t.d=function(e,i){for(var o in i)t.o(i,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:i[o]})}}(),function(){t.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){t.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}}(),function(){t.p=""}();var e={};if(t.r(e),t.d(e,{BookCatalogueDrawer:function(){return U},BookReader:function(){return j},default:function(){return q}}),"undefined"!==typeof window){var i=window.document.currentScript,o=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(t.p=o[1])}var s=function(){var t=this,e=t._self._c;return e("div",{staticClass:"photo-album-container",on:{touchstart:t.onContainerTouchStart,touchmove:t.onContainerTouchMove,touchend:t.onContainerTouchEnd,dblclick:t.onContainerDoubleClick,click:t.onContentClick}},[t._e(),t.contentReady?e("div",{staticClass:"flipbook-wrapper",style:{transform:`scale(${t.zoomScale}) translate(${t.translateX}px, ${t.translateY}px)`},on:{dblclick:t.onFlipbookDoubleClick,"!touchstart":function(e){return t.onFlipbookTouchStart.apply(null,arguments)},"!touchend":function(e){return t.onFlipbookTouchEnd.apply(null,arguments)}}},["flip"===t.flipMode&&t.flag?e("flipbook",{ref:"flipbook",class:["flipbook",t.isMobile?"mobile-mode mobile-optimized":"desktop-mode desktop-optimized"],attrs:{pages:t.pages,pagesHiRes:t.pagesHiRes,startPage:t.startPage,zooms:null,"ambient-light":.6,gloss:.4,"single-page":t.isMobile,"click-to-flip":!1,"wheel-to-flip":!t.isMobile,"swipe-to-flip":!0,"center-pages":!0},on:{"flip-left-end":t.onFlipLeftEnd,"flip-right-end":t.onFlipRightEnd},scopedSlots:t._u([{key:"default",fn:function({page:t,canFlipLeft:e,canFlipRight:i}){}}],null,!1,2449366912)}):"slide"===t.flipMode?e("div",{ref:"slideViewer",class:["slide-viewer",t.isMobile?"mobile-mode mobile-optimized":"desktop-mode desktop-optimized"],on:{touchstart:t.onSlideViewerTouchStart,touchmove:t.onSlideViewerTouchMove,touchend:t.onSlideViewerTouchEnd}},[e("div",{staticClass:"slide-container",style:t.slideContainerStyle},t._l(t.pages,function(i,o){return e("div",{key:o,staticClass:"slide-page",class:{"slide-page-active":o+1===t.currentPage}},[i?e("img",{staticClass:"slide-page-image",attrs:{src:i,alt:""}}):e("div",{staticClass:"slide-page-placeholder"},[t._v("封面/封底")])])}),0)]):"fade"===t.flipMode?e("div",{ref:"fadeViewer",class:["fade-viewer",t.isMobile?"mobile-mode mobile-optimized":"desktop-mode desktop-optimized"]},[e("transition",{attrs:{name:"fade-page",mode:"out-in"}},[e("div",{key:t.currentPage,staticClass:"fade-page-container"},[t.pages[t.currentPage-1]?e("img",{staticClass:"fade-page-image",attrs:{src:t.pages[t.currentPage-1],alt:""}}):e("div",{staticClass:"fade-page-placeholder"},[t._v("封面/封底")])])])],1):"scroll"===t.flipMode?e("div",{ref:"scrollViewer",class:["scroll-viewer",t.isMobile?"mobile-mode mobile-optimized":"desktop-mode desktop-optimized"],on:{scroll:t.onScrollViewerScroll}},[e("div",{staticClass:"scroll-container"},t._l(t.pages,function(i,o){return e("div",{key:o,ref:"scrollPage"+o,refInFor:!0,staticClass:"scroll-page"},[i?e("img",{staticClass:"scroll-page-image",attrs:{src:i,alt:""}}):e("div",{staticClass:"scroll-page-placeholder"},[t._v("封面/封底")])])}),0)]):"clip"===t.flipMode?e("div",{ref:"clipViewer",class:["clip-viewer",t.isMobile?"mobile-mode mobile-optimized":"desktop-mode desktop-optimized"]},[e("div",{staticClass:"clip-pages-wrapper"},[e("transition",{attrs:{name:"clip-current"}},[e("div",{key:"current-"+t.currentPage,staticClass:"clip-page clip-page-current"},[t.pages[t.currentPage-1]?e("img",{staticClass:"clip-page-image",attrs:{src:t.pages[t.currentPage-1],alt:""}}):e("div",{staticClass:"clip-page-placeholder"},[t._v("封面/封底")])])]),t.currentPage<t.totalPages?e("div",{staticClass:"clip-page clip-page-next"},[t.pages[t.currentPage]?e("img",{staticClass:"clip-page-image",attrs:{src:t.pages[t.currentPage],alt:""}}):e("div",{staticClass:"clip-page-placeholder"},[t._v("封面/封底")])]):t._e()],1)]):"card"===t.flipMode?e("div",{ref:"cardViewer",class:["card-viewer",t.isMobile?"mobile-mode mobile-optimized":"desktop-mode desktop-optimized"]},[e("div",{staticClass:"card-stack"},[e("transition-group",{staticClass:"card-transition-group",attrs:{name:"card-flip",tag:"div"}},t._l(t.visibleCards,function(i,o){return e("div",{key:"card-"+i.originalIndex,staticClass:"card-item",class:{"card-item-prev":"prev"===i.position,"card-item-current":"current"===i.position,"card-item-next":"next"===i.position},style:t.getCardStyle(i.position)},[e("div",{staticClass:"card-content"},[i.src?e("img",{staticClass:"card-image",attrs:{src:i.src,alt:""}}):e("div",{staticClass:"card-placeholder"},[t._v("封面/封底")])]),e("div",{staticClass:"card-page-number"},[t._v(t._s(i.originalIndex+1)+" / "+t._s(t.totalPages))])])}),0)],1)]):t._e()],1):t._e(),e("div",{staticClass:"controls",class:{"mobile-controls":t.isMobile,"desktop-controls":!t.isMobile,"controls-visible":t.showControls},on:{click:function(t){t.stopPropagation()}}},[e("button",{staticClass:"btn btn-prev",on:{click:t.flipLeft}},[t._v(" ← 上一页 ")]),e("span",{staticClass:"page-indicator"},[0===t.totalPages?e("span",[t._v("加载中...")]):1===t.currentPage&&t.totalPages>1?e("span",[t._v("封面")]):t.currentPage===t.totalPages&&t.totalPages>1?e("span",[t._v("封底")]):!t.isMobile&&t.totalPages>2?e("span",[t._v("第 "+t._s(Math.ceil((t.currentPage-1)/2))+" 组 / 共 "+t._s(Math.ceil((t.totalPages-2)/2))+" 组")]):t.isMobile&&t.totalPages>2?e("span",[t._v("第 "+t._s(Math.max(1,t.currentPage))+" 页 / 共 "+t._s(Math.max(0,t.totalPages-2))+" 页")]):1===t.totalPages?e("span",[t._v("第 1 页 / 共 1 页")]):e("span",[t._v("第 "+t._s(t.currentPage)+" 页 / 共 "+t._s(t.totalPages)+" 页")])]),e("button",{staticClass:"btn btn-next",on:{click:t.flipRight}},[t._v(" 下一页 → ")])]),t.showFlipModeSelector?e("div",{staticClass:"flip-mode-selector",class:{"mobile-flip-mode-selector":t.isMobile}},[e("button",{staticClass:"btn btn-flip-mode",on:{click:t.toggleFlipModeMenu}},[e("span",{staticClass:"flip-mode-icon"},[t._v(t._s(t.flipModeIcon))]),e("span",{staticClass:"flip-mode-text"},[t._v(t._s(t.flipModeLabel))])]),t.showFlipModeMenu?e("div",{staticClass:"flip-mode-menu"},t._l(t.flipModes,function(i){return e("div",{key:i.value,staticClass:"flip-mode-item",class:{"flip-mode-item-active":t.flipMode===i.value},on:{click:function(e){return t.selectFlipMode(i.value)}}},[e("span",{staticClass:"flip-mode-item-icon"},[t._v(t._s(i.icon))]),e("span",{staticClass:"flip-mode-item-label"},[t._v(t._s(i.label))])])}),0):t._e()]):t._e(),e("div",{staticClass:"catalogue-button",class:{"mobile-catalogue-button":t.isMobile,dragging:t.catalogueButtonDragging,"catalogue-visible":t.showControls},style:{left:t.catalogueButtonPosition.x+"px",top:t.catalogueButtonPosition.y+"px"},on:{mousedown:t.onCatalogueMouseDown,touchstart:t.onCatalogueTouchStart,touchmove:t.onCatalogueTouchMove,touchend:t.onCatalogueTouchEnd,click:function(t){t.stopPropagation()}}},[e("button",{staticClass:"btn btn-catalogue",on:{click:t.openCatalogue}},[e("span",{staticClass:"catalogue-text"},[t._v("目录")])])]),e("div",{staticClass:"zoom-hint",class:{show:1!==t.zoomScale}},[e("div",{staticClass:"zoom-info"},[e("span",[t._v("缩放: "+t._s(Math.round(100*t.zoomScale))+"%")]),e("button",{staticClass:"btn-reset-zoom",on:{click:t.resetZoom}},[t._v("重置")])])]),e("div",{staticClass:"zoom-toolbar"},[e("button",{staticClass:"btn-zoom",attrs:{disabled:t.zoomScale<=.5},on:{click:t.zoomOut}},[t._v("-")]),e("button",{staticClass:"btn-zoom",attrs:{disabled:t.zoomScale>=3},on:{click:t.zoomIn}},[t._v("+")])]),t.loading?e("div",{staticClass:"loading-overlay"},[t._m(0)]):t._e(),t.error&&!t.loading?e("div",{staticClass:"error-container"},[e("div",{staticClass:"error-content"},[e("div",{staticClass:"error-icon"},[t._v("⚠️")]),e("h3",[t._v("加载失败")]),e("p",[t._v(t._s(t.error.message||"网络连接异常,请检查网络后重试"))]),e("button",{staticClass:"retry-btn",on:{click:t.fetchBooksData}},[e("span",{staticClass:"retry-icon"},[t._v("🔄")]),t._v(" 重新加载 ")])])]):t._e(),!t.booksData||t.loading||t.error?t._e():e("div",{staticClass:"success-toast",class:{show:t.showSuccessToast}},[t._v(" 书籍加载完成 ")]),e("book-catalogue-drawer",{attrs:{"book-id":t.bookId,catalogue:t.catalogue,loading:t.catalogueLoading},on:{"catalogue-click":t.onCatalogueClick,"page-jump":t.onPageJump,Focus:t.onFocus,"fetch-catalogue":t.onFetchCatalogue},model:{value:t.showCatalogueDrawer,callback:function(e){t.showCatalogueDrawer=e},expression:"showCatalogueDrawer"}})],1)},a=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"loading-container"},[e("div",{staticClass:"loading-spinner"},[e("div",{staticClass:"spinner-ring"}),e("div",{staticClass:"spinner-ring"}),e("div",{staticClass:"spinner-ring"})]),e("div",{staticClass:"loading-text"},[e("h3",[t._v("正在加载书籍")]),e("p",[t._v("请稍候,正在获取精彩内容...")]),e("div",{staticClass:"loading-progress"},[e("div",{staticClass:"progress-bar"})])])])}];
|
|
2
2
|
/*! @license Rematrix v0.7.2
|
|
3
3
|
|
|
4
4
|
Copyright 2021 Julian Lloyd.
|
|
@@ -28,5 +28,5 @@ function n(t){if(t&&t.constructor===Array){var e=t.filter(function(t){return"num
|
|
|
28
28
|
* Copyright © 2023 Takeshi Sone.
|
|
29
29
|
* Released under the MIT License.
|
|
30
30
|
*/
|
|
31
|
-
var p,f,m,v=function(){function t(t){t?t.m?this.m=[].concat(t.m):this.m=[].concat(t):this.m=r()}return t.prototype.clone=function(){return new t(this)},t.prototype.multiply=function(t){return this.m=l(this.m,t)},t.prototype.perspective=function(t){return this.multiply(h(t))},t.prototype.transformX=function(t){return(t*this.m[0]+this.m[12])/(t*this.m[3]+this.m[15])},t.prototype.translate=function(t,e){return this.multiply(g(t,e))},t.prototype.translate3d=function(t,e,i){return this.multiply(d(t,e,i))},t.prototype.rotateY=function(t){return this.multiply(c(t))},t.prototype.toString=function(){return u(this.m)},t}(),P="data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22500%22%20height%3D%22500%22%20viewBox%3D%220%200%20500%20500%22%20fill%3D%22transparent%22%20style%3D%22background-color%3A%20%23fff%22%3E%20%20%3Ccircle%20%20%20%20cx%3D%22250%22%20%20%20%20cy%3D%22250%22%20%20%20%20r%3D%2248%22%20%20%20%20stroke%3D%22%23333%22%20%20%20%20stroke-width%3D%222%22%20%20%20%20stroke-dasharray%3D%22271%2030%22%20%20%3E%20%20%20%20%3CanimateTransform%20%20%20%20%20%20attributeName%3D%22transform%22%20%20%20%20%20%20attributeType%3D%22XML%22%20%20%20%20%20%20type%3D%22rotate%22%20%20%20%20%20%20from%3D%220%20250%20250%22%20%20%20%20%20%20to%3D%22360%20250%20250%22%20%20%20%20%20%20dur%3D%221s%22%20%20%20%20%20%20repeatCount%3D%22indefinite%22%20%20%20%20%2F%3E%20%20%3C%2Fcircle%3E%3C%2Fsvg%3E";p=function(t){return Math.pow(t,2)},m=function(t){return 1-p(1-t)},f=function(t){return t<.5?p(2*t)/2:.5+m(2*(t-.5))/2};var b={props:{pages:{type:Array,required:!0},pagesHiRes:{type:Array,default:function(){return[]}},flipDuration:{type:Number,default:1e3},zoomDuration:{type:Number,default:500},zooms:{type:Array,default:function(){return[1,2,4]}},perspective:{type:Number,default:2400},nPolygons:{type:Number,default:10},ambient:{type:Number,default:.4},gloss:{type:Number,default:.6},swipeMin:{type:Number,default:3},singlePage:{type:Boolean,default:!1},forwardDirection:{validator:function(t){return"right"===t||"left"===t},default:"right"},centering:{type:Boolean,default:!0},startPage:{type:Number,default:null},loadingImage:{type:String,default:P},clickToZoom:{type:Boolean,default:!0},dragToFlip:{type:Boolean,default:!0},wheel:{type:String,default:"scroll"}},data:function(){return{viewWidth:0,viewHeight:0,imageWidth:null,imageHeight:null,displayedPages:1,nImageLoad:0,nImageLoadTrigger:0,imageLoadCallback:null,currentPage:0,firstPage:0,secondPage:1,zoomIndex:0,zoom:1,zooming:!1,touchStartX:null,touchStartY:null,maxMove:0,activeCursor:null,hasTouchEvents:!1,hasPointerEvents:!1,minX:Infinity,maxX:-Infinity,preloadedImages:{},flip:{progress:0,direction:null,frontImage:null,backImage:null,auto:!1,opacity:1},currentCenterOffset:null,animatingCenter:!1,startScrollLeft:0,startScrollTop:0,scrollLeft:0,scrollTop:0,loadedImages:{}}},computed:{IE:function(){return"undefined"!==typeof navigator&&/Trident/.test(navigator.userAgent)},canFlipLeft:function(){return"left"===this.forwardDirection?this.canGoForward:this.canGoBack},canFlipRight:function(){return"right"===this.forwardDirection?this.canGoForward:this.canGoBack},canZoomIn:function(){return!this.zooming&&this.zoomIndex<this.zooms_.length-1},canZoomOut:function(){return!this.zooming&&this.zoomIndex>0},numPages:function(){return null===this.pages[0]?this.pages.length-1:this.pages.length},page:function(){return null!==this.pages[0]?this.currentPage+1:Math.max(1,this.currentPage)},zooms_:function(){return this.zooms||[1]},canGoForward:function(){return!this.flip.direction&&this.currentPage<this.pages.length-this.displayedPages},canGoBack:function(){return!this.flip.direction&&this.currentPage>=this.displayedPages&&!(1===this.displayedPages&&!this.pageUrl(this.firstPage-1))},leftPage:function(){return"right"===this.forwardDirection||1===this.displayedPages?this.firstPage:this.secondPage},rightPage:function(){return"left"===this.forwardDirection?this.firstPage:this.secondPage},showLeftPage:function(){return this.pageUrl(this.leftPage)},showRightPage:function(){return this.pageUrl(this.rightPage)&&2===this.displayedPages},cursor:function(){return this.activeCursor?this.activeCursor:this.IE?"auto":this.clickToZoom&&this.canZoomIn?"zoom-in":this.clickToZoom&&this.canZoomOut?"zoom-out":this.dragToFlip?"grab":"auto"},pageScale:function(){var t,e,i,o;return e=this.viewWidth/this.displayedPages,i=e/this.imageWidth,o=this.viewHeight/this.imageHeight,t=i<o?i:o,t<1?t:1},pageWidth:function(){return Math.round(this.imageWidth*this.pageScale)},pageHeight:function(){return Math.round(this.imageHeight*this.pageScale)},xMargin:function(){return(this.viewWidth-this.pageWidth*this.displayedPages)/2},yMargin:function(){return(this.viewHeight-this.pageHeight)/2},polygonWidth:function(){var t;return t=this.pageWidth/this.nPolygons,t=Math.ceil(t+1/this.zoom),t+"px"},polygonHeight:function(){return this.pageHeight+"px"},polygonBgSize:function(){return this.pageWidth+"px "+this.pageHeight+"px"},polygonArray:function(){return this.makePolygonArray("front").concat(this.makePolygonArray("back"))},boundingLeft:function(){var t;return 1===this.displayedPages?this.xMargin:(t=this.pageUrl(this.leftPage)?this.xMargin:this.viewWidth/2,t<this.minX?t:this.minX)},boundingRight:function(){var t;return 1===this.displayedPages?this.viewWidth-this.xMargin:(t=this.pageUrl(this.rightPage)?this.viewWidth-this.xMargin:this.viewWidth/2,t>this.maxX?t:this.maxX)},centerOffset:function(){var t;return t=this.centering?Math.round(this.viewWidth/2-(this.boundingLeft+this.boundingRight)/2):0,null===this.currentCenterOffset&&null!==this.imageWidth&&(this.currentCenterOffset=t),t},centerOffsetSmoothed:function(){return Math.round(this.currentCenterOffset)},dragToScroll:function(){return!this.hasTouchEvents},scrollLeftMin:function(){var t;return t=(this.boundingRight-this.boundingLeft)*this.zoom,t<this.viewWidth?(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom-(this.viewWidth-t)/2:(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom},scrollLeftMax:function(){var t;return t=(this.boundingRight-this.boundingLeft)*this.zoom,t<this.viewWidth?(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom-(this.viewWidth-t)/2:(this.boundingRight+this.centerOffsetSmoothed)*this.zoom-this.viewWidth},scrollTopMin:function(){var t;return t=this.pageHeight*this.zoom,t<this.viewHeight?this.yMargin*this.zoom-(this.viewHeight-t)/2:this.yMargin*this.zoom},scrollTopMax:function(){var t;return t=this.pageHeight*this.zoom,t<this.viewHeight?this.yMargin*this.zoom-(this.viewHeight-t)/2:(this.yMargin+this.pageHeight)*this.zoom-this.viewHeight},scrollLeftLimited:function(){return Math.min(this.scrollLeftMax,Math.max(this.scrollLeftMin,this.scrollLeft))},scrollTopLimited:function(){return Math.min(this.scrollTopMax,Math.max(this.scrollTopMin,this.scrollTop))}},mounted:function(){return window.addEventListener("resize",this.onResize,{passive:!0}),this.onResize(),this.zoom=this.zooms_[0],this.goToPage(this.startPage)},beforeDestroy:function(){return window.removeEventListener("resize",this.onResize,{passive:!0})},methods:{onResize:function(){var t;if(t=this.$refs.viewport,t)return this.viewWidth=t.clientWidth,this.viewHeight=t.clientHeight,this.displayedPages=this.viewWidth>this.viewHeight&&!this.singlePage?2:1,2===this.displayedPages&&(this.currentPage&=-2),this.fixFirstPage(),this.minX=Infinity,this.maxX=-Infinity},fixFirstPage:function(){if(1===this.displayedPages&&0===this.currentPage&&this.pages.length&&!this.pageUrl(0))return this.currentPage++},pageUrl:function(t,e){var i;return void 0===e&&(e=!1),e&&this.zoom>1&&!this.zooming&&(i=this.pagesHiRes[t],i)?i:this.pages[t]||null},pageUrlLoading:function(t,e){var i;return void 0===e&&(e=!1),i=this.pageUrl(t,e),e&&this.zoom>1&&!this.zooming?i:i&&this.loadImage(i)},flipLeft:function(){if(this.canFlipLeft)return this.flipStart("left",!0)},flipRight:function(){if(this.canFlipRight)return this.flipStart("right",!0)},makePolygonArray:function(t){var e,i,o,s,a,n,r,l,h,c,u,g,d,p,f,m,P,b,w,y,C,M,k,T,x,I;if(!this.flip.direction)return[];for(f=this.flip.progress,s=this.flip.direction,1===this.displayedPages&&s!==this.forwardDirection&&(f=1-f,s=this.forwardDirection),this.flip.opacity=1===this.displayedPages&&f>.7?1-(f-.7)/.3:1,n="front"===t?this.flip.frontImage:this.flip.backImage,p=this.pageWidth/this.nPolygons,d=this.xMargin,c=!1,1===this.displayedPages?"right"===this.forwardDirection?"back"===t&&(c=!0,d=this.xMargin-this.pageWidth):"left"===s?"back"===t?d=this.pageWidth-this.xMargin:c=!0:"front"===t?d=this.pageWidth-this.xMargin:c=!0:"left"===s?"back"===t?d=this.viewWidth/2:c=!0:"front"===t?d=this.viewWidth/2:c=!0,u=new v,u.translate(this.viewWidth/2),u.perspective(this.perspective),u.translate(-this.viewWidth/2),u.translate(d,this.yMargin),g=0,f>.5&&(g=2*-(f-.5)*180),"left"===s&&(g=-g),"back"===t&&(g+=180),g&&(c&&u.translate(this.pageWidth),u.rotateY(g),c&&u.translate(-this.pageWidth)),M=f<.5?2*f*Math.PI:(1-2*(f-.5))*Math.PI,0===M&&(M=1e-9),b=this.pageWidth/M,P=0,i=M/this.nPolygons,C=i/2/Math.PI*180,o=i/Math.PI*180,c&&(C=-M/Math.PI*180+o/2),"back"===t&&(C=-C,o=-o),this.minX=Infinity,this.maxX=-Infinity,y=[],a=r=0,w=this.nPolygons;0<=w?r<w:r>w;a=0<=w?++r:--r)e=a/(this.nPolygons-1)*100+"% 0px",h=u.clone(),m=c?M-P:P,k=Math.sin(m)*b,c&&(k=this.pageWidth-k),I=(1-Math.cos(m))*b,"back"===t&&(I=-I),h.translate3d(k,0,I),h.rotateY(-C),T=h.transformX(0),x=h.transformX(p),this.maxX=Math.max(Math.max(T,x),this.maxX),this.minX=Math.min(Math.min(T,x),this.minX),l=this.computeLighting(g-C,o),P+=i,C+=o,y.push([t+a,n,l,e,h.toString(),Math.abs(Math.round(I))]);return y},computeLighting:function(t,e){var i,o,s,a,n,r,l;return n=[],r=[-.5,-.25,0,.25,.5],this.ambient<1&&(s=1-this.ambient,a=r.map(function(i){return(1-Math.cos((t-e*i)/180*Math.PI))*s}),n.push("linear-gradient(to right,\n rgba(0, 0, 0, "+a[0]+"),\n rgba(0, 0, 0, "+a[1]+") 25%,\n rgba(0, 0, 0, "+a[2]+") 50%,\n rgba(0, 0, 0, "+a[3]+") 75%,\n rgba(0, 0, 0, "+a[4]+"))")),this.gloss>0&&!this.IE&&(i=30,o=200,l=r.map(function(s){return Math.max(Math.pow(Math.cos((t+i-e*s)/180*Math.PI),o),Math.pow(Math.cos((t-i-e*s)/180*Math.PI),o))}),n.push("linear-gradient(to right,\n rgba(255, 255, 255, "+l[0]*this.gloss+"),\n rgba(255, 255, 255, "+l[1]*this.gloss+") 25%,\n rgba(255, 255, 255, "+l[2]*this.gloss+") 50%,\n rgba(255, 255, 255, "+l[3]*this.gloss+") 75%,\n rgba(255, 255, 255, "+l[4]*this.gloss+"))")),n.join(",")},flipStart:function(t,e){var i=this;return t!==this.forwardDirection?1===this.displayedPages?(this.flip.frontImage=this.pageUrl(this.currentPage-1),this.flip.backImage=null):(this.flip.frontImage=this.pageUrl(this.firstPage),this.flip.backImage=this.pageUrl(this.currentPage-this.displayedPages+1)):1===this.displayedPages?(this.flip.frontImage=this.pageUrl(this.currentPage),this.flip.backImage=null):(this.flip.frontImage=this.pageUrl(this.secondPage),this.flip.backImage=this.pageUrl(this.currentPage+this.displayedPages)),this.flip.direction=t,this.flip.progress=0,requestAnimationFrame(function(){return requestAnimationFrame(function(){if(i.flip.direction!==i.forwardDirection?2===i.displayedPages&&(i.firstPage=i.currentPage-i.displayedPages):1===i.displayedPages?i.firstPage=i.currentPage+i.displayedPages:i.secondPage=i.currentPage+1+i.displayedPages,e)return i.flipAuto(!0)})})},flipAuto:function(t){var e,i,o,s,a=this;return s=Date.now(),i=this.flipDuration*(1-this.flip.progress),o=this.flip.progress,this.flip.auto=!0,this.$emit("flip-"+this.flip.direction+"-start",this.page),e=function(){return requestAnimationFrame(function(){var n,r;return r=Date.now()-s,n=o+r/i,n>1&&(n=1),a.flip.progress=t?f(n):n,n<1?e():(a.flip.direction!==a.forwardDirection?a.currentPage-=a.displayedPages:a.currentPage+=a.displayedPages,a.$emit("flip-"+a.flip.direction+"-end",a.page),1===a.displayedPages&&a.flip.direction===a.forwardDirection?a.flip.direction=null:a.onImageLoad(1,function(){return a.flip.direction=null}),a.flip.auto=!1)})},e()},flipRevert:function(){var t,e,i,o,s=this;return o=Date.now(),e=this.flipDuration*this.flip.progress,i=this.flip.progress,this.flip.auto=!0,t=function(){return requestAnimationFrame(function(){var a,n;return n=Date.now()-o,a=i-i*n/e,a<0&&(a=0),s.flip.progress=a,a>0?t():(s.firstPage=s.currentPage,s.secondPage=s.currentPage+1,1===s.displayedPages&&s.flip.direction!==s.forwardDirection?s.flip.direction=null:s.onImageLoad(1,function(){return s.flip.direction=null}),s.flip.auto=!1)})},t()},onImageLoad:function(t,e){return this.nImageLoad=0,this.nImageLoadTrigger=t,this.imageLoadCallback=e},didLoadImage:function(t){if(null===this.imageWidth&&(this.imageWidth=(t.target||t.path[0]).naturalWidth,this.imageHeight=(t.target||t.path[0]).naturalHeight,this.preloadImages()),this.imageLoadCallback)return++this.nImageLoad>=this.nImageLoadTrigger?(this.imageLoadCallback(),this.imageLoadCallback=null):void 0},zoomIn:function(t){if(void 0===t&&(t=null),this.canZoomIn)return this.zoomIndex+=1,this.zoomTo(this.zooms_[this.zoomIndex],t)},zoomOut:function(t){if(void 0===t&&(t=null),this.canZoomOut)return this.zoomIndex-=1,this.zoomTo(this.zooms_[this.zoomIndex],t)},zoomTo:function(t,e){var i,o,s,a,n,r,l,h,c,u,g,d,p,m,v=this;if(void 0===e&&(e=null),m=this.$refs.viewport,e?(c=m.getBoundingClientRect(),l=e.pageX-c.left,h=e.pageY-c.top):(l=m.clientWidth/2,h=m.clientHeight/2),u=this.zoom,a=t,g=m.scrollLeft,d=m.scrollTop,o=l+g,s=h+d,n=o/u*a-l,r=s/u*a-h,p=Date.now(),this.zooming=!0,this.$emit("zoom-start",t),i=function(){return requestAnimationFrame(function(){var e,o;return o=Date.now()-p,e=o/v.zoomDuration,(e>1||v.IE)&&(e=1),e=f(e),v.zoom=u+(a-u)*e,v.scrollLeft=g+(n-g)*e,v.scrollTop=d+(r-d)*e,o<v.zoomDuration?i():(v.$emit("zoom-end",t),v.zooming=!1,v.zoom=t,v.scrollLeft=n,v.scrollTop=r)})},i(),a>1)return this.preloadImages(!0)},zoomAt:function(t){return this.zoomIndex=(this.zoomIndex+1)%this.zooms_.length,this.zoomTo(this.zooms_[this.zoomIndex],t)},swipeStart:function(t){return this.touchStartX=t.pageX,this.touchStartY=t.pageY,this.maxMove=0,this.zoom<=1?this.dragToFlip?this.activeCursor="grab":void 0:(this.startScrollLeft=this.$refs.viewport.scrollLeft,this.startScrollTop=this.$refs.viewport.scrollTop,this.activeCursor="all-scroll")},swipeMove:function(t){var e,i;if(null!=this.touchStartX)if(e=t.pageX-this.touchStartX,i=t.pageY-this.touchStartY,this.maxMove=Math.max(this.maxMove,Math.abs(e)),this.maxMove=Math.max(this.maxMove,Math.abs(i)),this.zoom>1)this.dragToScroll&&this.dragScroll(e,i);else if(this.dragToFlip&&!(Math.abs(i)>Math.abs(e)))return this.activeCursor="grabbing",e>0?(null===this.flip.direction&&this.canFlipLeft&&e>=this.swipeMin&&this.flipStart("left",!1),"left"===this.flip.direction&&(this.flip.progress=e/this.pageWidth,this.flip.progress>1&&(this.flip.progress=1))):(null===this.flip.direction&&this.canFlipRight&&e<=-this.swipeMin&&this.flipStart("right",!1),"right"===this.flip.direction&&(this.flip.progress=-e/this.pageWidth,this.flip.progress>1&&(this.flip.progress=1))),!0},swipeEnd:function(t){if(null!=this.touchStartX)return this.clickToZoom&&this.maxMove<this.swipeMin&&this.zoomAt(t),null===this.flip.direction||this.flip.auto||(this.flip.progress>1/4?this.flipAuto(!1):this.flipRevert()),this.touchStartX=null,this.activeCursor=null},onTouchStart:function(t){return this.hasTouchEvents=!0,this.swipeStart(t.changedTouches[0])},onTouchMove:function(t){if(this.swipeMove(t.changedTouches[0])&&t.cancelable)return t.preventDefault()},onTouchEnd:function(t){return this.swipeEnd(t.changedTouches[0])},onPointerDown:function(t){if(this.hasPointerEvents=!0,!this.hasTouchEvents&&(!t.which||1===t.which)){this.swipeStart(t);try{return t.target.setPointerCapture(t.pointerId)}catch(e){}}},onPointerMove:function(t){if(!this.hasTouchEvents)return this.swipeMove(t)},onPointerUp:function(t){if(!this.hasTouchEvents){this.swipeEnd(t);try{return t.target.releasePointerCapture(t.pointerId)}catch(e){}}},onMouseDown:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents&&(!t.which||1===t.which))return this.swipeStart(t)},onMouseMove:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents)return this.swipeMove(t)},onMouseUp:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents)return this.swipeEnd(t)},dragScroll:function(t,e){return this.scrollLeft=this.startScrollLeft-t,this.scrollTop=this.startScrollTop-e},onWheel:function(t){if("scroll"===this.wheel&&this.zoom>1&&this.dragToScroll&&(this.scrollLeft=this.$refs.viewport.scrollLeft+t.deltaX,this.scrollTop=this.$refs.viewport.scrollTop+t.deltaY,t.cancelable&&t.preventDefault()),"zoom"===this.wheel){if(t.deltaY>=100)return this.zoomOut(t),t.preventDefault();if(t.deltaY<=-100)return this.zoomIn(t),t.preventDefault()}},preloadImages:function(t){var e,i,o,s,a,n,r,l;for(void 0===t&&(t=!1),e=i=s=this.currentPage-3,a=this.currentPage+3;s<=a?i<=a:i>=a;e=s<=a?++i:--i)this.pageUrlLoading(e);if(t)for(e=o=n=this.currentPage,r=this.currentPage+this.displayedPages;n<=r?o<r:o>r;e=n<=r?++o:--o)l=this.pagesHiRes[e],l&&((new Image).src=l)},goToPage:function(t){if(null!==t&&t!==this.page)return null===this.pages[0]?2===this.displayedPages&&1===t?this.currentPage=0:this.currentPage=t:this.currentPage=t-1,this.minX=Infinity,this.maxX=-Infinity,this.currentCenterOffset=this.centerOffset},loadImage:function(t){var e,i=this;return null===this.imageWidth||this.loadedImages[t]?t:(e=new Image,e.onload=function(){return i.$set?i.$set(i.loadedImages,t,!0):i.loadedImages[t]=!0},e.src=t,this.loadingImage)}},watch:{currentPage:function(){return this.firstPage=this.currentPage,this.secondPage=this.currentPage+1,this.preloadImages()},centerOffset:function(){var t,e=this;if(!this.animatingCenter)return t=function(){return requestAnimationFrame(function(){var i,o;return o=.1,i=e.centerOffset-e.currentCenterOffset,Math.abs(i)<.5?(e.currentCenterOffset=e.centerOffset,e.animatingCenter=!1):(e.currentCenterOffset+=i*o,t())})},this.animatingCenter=!0,t()},scrollLeftLimited:function(t){var e=this;return this.IE?requestAnimationFrame(function(){return e.$refs.viewport.scrollLeft=t}):this.$refs.viewport.scrollLeft=t},scrollTopLimited:function(t){var e=this;return this.IE?requestAnimationFrame(function(){return e.$refs.viewport.scrollTop=t}):this.$refs.viewport.scrollTop=t},pages:function(t,e){if(this.fixFirstPage(),!(null!=e?e.length:void 0)&&(null!=t?t.length:void 0)&&this.startPage>1&&null===t[0])return this.currentPage++},startPage:function(t){return this.goToPage(t)}}};function w(t,e,i,o,s,a,n,r,l,h){"boolean"!==typeof n&&(l=r,r=n,n=!1);var c,u="function"===typeof i?i.options:i;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,s&&(u.functional=!0)),o&&(u._scopeId=o),a?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):e&&(c=n?function(t){e.call(this,h(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,r(t))}),c)if(u.functional){var g=u.render;u.render=function(t,e){return c.call(e),g(t,e)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,c):[c]}return i}var y,C="undefined"!==typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function M(t){return function(t,e){return T(t,e)}}var k={};function T(t,e){var i=C?e.media||"default":t,o=k[i]||(k[i]={ids:new Set,styles:[]});if(!o.ids.has(t)){o.ids.add(t);var s=e.source;if(e.map&&(s+="\n/*# sourceURL="+e.map.sources[0]+" */",s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",e.media&&o.element.setAttribute("media",e.media),void 0===y&&(y=document.head||document.getElementsByTagName("head")[0]),y.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(s),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{var a=o.ids.size-1,n=document.createTextNode(s),r=o.element.childNodes;r[a]&&o.element.removeChild(r[a]),r.length?o.element.insertBefore(n,r[a]):o.element.appendChild(n)}}}var x=b,I=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t._t("default",null,null,{canFlipLeft:t.canFlipLeft,canFlipRight:t.canFlipRight,canZoomIn:t.canZoomIn,canZoomOut:t.canZoomOut,page:t.page,numPages:t.numPages,flipLeft:t.flipLeft,flipRight:t.flipRight,zoomIn:t.zoomIn,zoomOut:t.zoomOut}),t._v(" "),i("div",{ref:"viewport",staticClass:"viewport",class:{zoom:t.zooming||t.zoom>1,"drag-to-scroll":t.dragToScroll},style:{cursor:"grabbing"==t.cursor?"grabbing":"auto"},on:{touchmove:t.onTouchMove,pointermove:t.onPointerMove,mousemove:t.onMouseMove,touchend:t.onTouchEnd,touchcancel:t.onTouchEnd,pointerup:t.onPointerUp,pointercancel:t.onPointerUp,mouseup:t.onMouseUp,wheel:t.onWheel}},[i("div",{staticClass:"flipbook-container",style:{transform:"scale("+t.zoom+")"}},[i("div",{staticClass:"click-to-flip left",style:{cursor:t.canFlipLeft?"pointer":"auto"},on:{click:t.flipLeft}}),t._v(" "),i("div",{staticClass:"click-to-flip right",style:{cursor:t.canFlipRight?"pointer":"auto"},on:{click:t.flipRight}}),t._v(" "),i("div",{style:{transform:"translateX("+t.centerOffsetSmoothed+"px)"}},[t.showLeftPage?i("img",{staticClass:"page fixed",style:{width:t.pageWidth+"px",height:t.pageHeight+"px",left:t.xMargin+"px",top:t.yMargin+"px"},attrs:{src:t.pageUrlLoading(t.leftPage,!0)},on:{load:function(e){return t.didLoadImage(e)}}}):t._e(),t._v(" "),t.showRightPage?i("img",{staticClass:"page fixed",style:{width:t.pageWidth+"px",height:t.pageHeight+"px",left:t.viewWidth/2+"px",top:t.yMargin+"px"},attrs:{src:t.pageUrlLoading(t.rightPage,!0)},on:{load:function(e){return t.didLoadImage(e)}}}):t._e(),t._v(" "),i("div",{style:{opacity:t.flip.opacity}},t._l(t.polygonArray,function(e){var o=e[0],s=e[1],a=e[2],n=e[3],r=e[4],l=e[5];return i("div",{key:o,staticClass:"polygon",class:{blank:!s},style:{backgroundImage:s&&"url("+t.loadImage(s)+")",backgroundSize:t.polygonBgSize,backgroundPosition:n,width:t.polygonWidth,height:t.polygonHeight,transform:r,zIndex:l}},[i("div",{directives:[{name:"show",rawName:"v-show",value:a.length,expression:"lighting.length"}],staticClass:"lighting",style:{backgroundImage:a}})])}),0),t._v(" "),i("div",{staticClass:"bounding-box",style:{left:t.boundingLeft+"px",top:t.yMargin+"px",width:t.boundingRight-t.boundingLeft+"px",height:t.pageHeight+"px",cursor:t.cursor},on:{touchstart:t.onTouchStart,pointerdown:t.onPointerDown,mousedown:t.onMouseDown}})])])])],2)},z=[],D=function(t){t&&t("data-v-e3f0fbe2_0",{source:".viewport[data-v-e3f0fbe2]{-webkit-overflow-scrolling:touch;width:100%;height:100%}.viewport.zoom[data-v-e3f0fbe2]{overflow:scroll}.viewport.zoom.drag-to-scroll[data-v-e3f0fbe2]{overflow:hidden}.flipbook-container[data-v-e3f0fbe2]{position:relative;width:100%;height:100%;transform-origin:top left;user-select:none}.click-to-flip[data-v-e3f0fbe2]{position:absolute;width:50%;height:100%;top:0;user-select:none}.click-to-flip.left[data-v-e3f0fbe2]{left:0}.click-to-flip.right[data-v-e3f0fbe2]{right:0}.bounding-box[data-v-e3f0fbe2]{position:absolute;user-select:none}.page[data-v-e3f0fbe2]{position:absolute;backface-visibility:hidden}.polygon[data-v-e3f0fbe2]{position:absolute;top:0;left:0;background-repeat:no-repeat;backface-visibility:hidden;transform-origin:center left}.polygon.blank[data-v-e3f0fbe2]{background-color:#ddd}.polygon .lighting[data-v-e3f0fbe2]{width:100%;height:100%}",map:void 0,media:void 0})},S="data-v-e3f0fbe2",_=void 0,L=!1,F=w({render:I,staticRenderFns:z},D,x,S,L,_,!1,M,void 0,void 0),R=function(){var t=this,e=t._self._c;return e("div",{staticClass:"catalogue-drawer-container"},[t.visible?e("div",{staticClass:"drawer-overlay",on:{click:t.closeDrawer}}):t._e(),e("div",{staticClass:"catalogue-drawer",class:{"drawer-open":t.visible},style:{width:t.drawerWidth}},[e("div",{staticClass:"drawer-header"},[e("h3",{staticClass:"drawer-title"},[t._v("目录")]),e("button",{staticClass:"close-button",on:{click:t.closeDrawer}},[e("span",{staticClass:"close-icon"},[t._v("×")])])]),e("div",{staticClass:"page-jump-section"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.jumpPageInput,expression:"jumpPageInput"}],staticClass:"page-jump-input",attrs:{type:"text",placeholder:"请输入页码"},domProps:{value:t.jumpPageInput},on:{input:[function(e){e.target.composing||(t.jumpPageInput=e.target.value)},t.handlePageInput],focus:t.onInputFocus,blur:t.onInputBlur}}),e("button",{staticClass:"btn-jump",on:{click:t.handleJumpToPage}},[t._v(" 跳转 ")])]),e("div",{staticClass:"drawer-content"},[t.loading?e("div",{staticClass:"loading-container"},[e("div",{staticClass:"loading-spinner"}),e("p",[t._v("加载目录中...")])]):t.error?e("div",{staticClass:"error-container"},[e("div",{staticClass:"error-icon"},[t._v("⚠️")]),e("p",[t._v("目录加载失败")]),e("button",{staticClass:"retry-button",on:{click:t.fetchCatalogue}},[t._v(" 重新加载 ")])]):t.catalogueData&&t.catalogueData.length>0?e("div",{staticClass:"catalogue-list"},t._l(t.catalogueData,function(i,o){return e("catalogue-item",{key:`catalogue-${o}`,attrs:{item:i||{},level:0},on:{"item-click":t.onItemClick}})}),1):e("div",{staticClass:"empty-container"},[e("p",[t._v("暂无目录")])])])])])},$=[];const E={name:"CatalogueItem",props:{item:{type:Object,required:!0},level:{type:Number,default:0}},data(){return{expanded:!1}},computed:{hasChildren(){const t=this.item.childrenList||this.item.children||this.item.subItems||this.item.items;return t&&t.length>0},childrenData(){return this.item.childrenList||this.item.children||this.item.subItems||this.item.items||[]},itemStyle(){return{paddingLeft:"12px",paddingRight:"12px"}},levelClass(){return`level-${this.level}`}},methods:{toggleExpand(){this.hasChildren?this.expanded=!this.expanded:this.handleClick()},handleClick(){this.$emit("item-click",this.item)}},render(t){const e=this.item,i=e.titleName||e.title||e.name||e.text||e.label||"未命名章节",o=(e.startPageNum||e.pageNumber||e.page||e.pageNum,t("span",{class:"drag-handle"},"")),s=this.hasChildren?t("span",{class:"expand-icon"},this.expanded?"▼":"▶"):null,a=this.level>0?t("span",{class:`level-indicator level-${this.level}`},"•".repeat(this.level)):null,n=t("span",{class:"item-title"},i),r=null,l=this.hasChildren&&this.expanded?t("div",{class:"children-container"},this.childrenData.map((e,i)=>t("catalogue-item",{key:i,props:{item:e,level:this.level+1},on:{"item-click":t=>this.$emit("item-click",t)}}))):null;return t("div",{class:"catalogue-item-wrapper"},[t("div",{class:["catalogue-item",this.levelClass,{"has-children":this.hasChildren,expanded:this.expanded}],style:this.itemStyle,on:{click:this.toggleExpand}},[t("div",{class:"item-content"},[o,s,a,n,r].filter(Boolean))]),l].filter(Boolean))}};var X={name:"BookCatalogueDrawer",components:{CatalogueItem:E},props:{value:{type:Boolean,default:!1},bookId:{type:String,default:""},catalogue:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},data(){return{catalogueData:[],error:null,jumpPageInput:""}},computed:{visible:{get(){return this.value},set(t){this.$emit("input",t)}},drawerWidth(){return window.innerWidth<=768?"80%":"400px"}},watch:{visible(t){t&&this.bookId&&!this.catalogueData.length&&this.$emit("fetch-catalogue",this.bookId)},bookId(t){t&&this.visible&&this.$emit("fetch-catalogue",t)},catalogue:{handler(t){t&&t.length>0&&(this.catalogueData=this.processCatalogueData(t))},immediate:!0}},methods:{fetchCatalogue(){this.bookId?this.$emit("fetch-catalogue",this.bookId):console.warn("缺少 bookId,无法获取目录")},processCatalogueData(t){return Array.isArray(t)?t.map(t=>{if(!t||"object"!==typeof t)return{titleName:"未知章节",startPageNum:null,childrenList:[]};const e={...t,titleName:t.titleName||t.title||t.name||"未命名章节",startPageNum:t.startPageNum||t.pageNumber||t.page||t.pageNum||null,childrenList:t.childrenList||t.children||t.subItems||t.items||[]};return e.childrenList&&e.childrenList.length>0&&(e.childrenList=this.processCatalogueData(e.childrenList)),e}):[]},onItemClick(t){console.log("目录项被点击:",t),this.$emit("catalogue-click",t);const e=t.startPageNum||t.pageNumber||t.page||t.pageNum;e&&this.$emit("page-jump",e)},closeDrawer(){this.$emit("input",!1)},handlePageInput(t){const e=t.target.value,i=e.replace(/[^\d]/g,"");this.jumpPageInput=i},handleJumpToPage(){const t=parseInt(this.jumpPageInput);t&&t>=1&&(this.$emit("page-jump",t),this.jumpPageInput="",this.closeDrawer())},onInputFocus(){},onInputBlur(){this.$emit("Focus")},resetData(){this.catalogueData=[],this.error=null,this.loading=!1},handleResize(){}},mounted(){window.addEventListener("resize",this.handleResize)},beforeDestroy(){window.removeEventListener("resize",this.handleResize)}},W=X;function B(t,e,i,o,s,a,n,r){var l,h="function"===typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=i,h._compiled=!0),o&&(h.functional=!0),a&&(h._scopeId="data-v-"+a),n?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(n)},h._ssrRegister=l):s&&(l=r?function(){s.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(h.functional){h._injectStyles=l;var c=h.render;h.render=function(t,e){return l.call(e),c(t,e)}}else{var u=h.beforeCreate;h.beforeCreate=u?[].concat(u,l):[l]}return{exports:t,options:h}}var O=B(W,R,$,!1,null,"3930be62",null),U=O.exports,N={name:"PhotoAlbumView",components:{Flipbook:F,BookCatalogueDrawer:U},props:{pages:{type:Array,default:()=>[]},bookId:{type:String,default:""},startPage:{type:Number,default:1},catalogue:{type:Array,default:()=>[]},catalogueLoading:{type:Boolean,default:!1}},data(){return{currentPage:1,flag:!0,isMobile:!1,booksData:null,loading:!1,error:null,showSuccessToast:!1,contentReady:!1,zoomScale:1,translateX:0,translateY:0,lastTouchDistance:0,lastTouchCenter:{x:0,y:0},isZooming:!1,isPanning:!1,touchStartTime:0,initialTouches:[],flipbookTouchStartTime:0,flipbookLastTapTime:0,showCatalogueDrawer:!1,catalogueButtonDragging:!1,catalogueButtonPosition:{x:20,y:20},dragStartPosition:{x:0,y:0},dragOffset:{x:0,y:0},flipMode:"flip",showFlipModeMenu:!1,flipModes:[{value:"flip",label:"仿真翻页",icon:"📖"},{value:"slide",label:"滑动翻页",icon:"↔️"},{value:"fade",label:"淡入淡出",icon:"✨"},{value:"scroll",label:"垂直滚动",icon:"📜"},{value:"clip",label:"截断特效",icon:"✂️"},{value:"card",label:"卡片风格",icon:"🃏"}],slideStartX:0,slideCurrentX:0,slideIsDragging:!1,flipModeFromUrl:!1,showControls:!1,hideControlsTimer:null,jumpPageInput:""}},computed:{totalPages(){return this.pages.length},pagesHiRes(){return this.pages},flipModeIcon(){const t=this.flipModes.find(t=>t.value===this.flipMode);return t?t.icon:"📖"},flipModeLabel(){const t=this.flipModes.find(t=>t.value===this.flipMode);return t?t.label:"仿真翻页"},slideContainerStyle(){const t=100*-(this.currentPage-1),e=this.slideIsDragging?(this.slideCurrentX-this.slideStartX)/5:0;return{transform:`translateX(calc(${t}% + ${e}px))`,transition:this.slideIsDragging?"none":"transform 0.3s ease-out"}},showFlipModeSelector(){return!this.flipModeFromUrl},visibleCards(){const t=[];return this.currentPage>1&&t.push({src:this.pages[this.currentPage-2],originalIndex:this.currentPage-2,position:"prev"}),t.push({src:this.pages[this.currentPage-1],originalIndex:this.currentPage-1,position:"current"}),this.currentPage<this.totalPages&&t.push({src:this.pages[this.currentPage],originalIndex:this.currentPage,position:"next"}),t},pageDisplayText(){return 0===this.totalPages?"加载中...":1===this.currentPage&&this.totalPages>1?"封面":this.currentPage===this.totalPages&&this.totalPages>1?"封底":this.isMobile?this.totalPages<=2?`第 ${this.currentPage} 页 / 共 ${this.totalPages} 页`:`第 ${Math.max(1,this.currentPage-1)} 页 / 共 ${Math.max(0,this.totalPages-2)} 页`:this.totalPages<=2?`第 ${this.currentPage} 页 / 共 ${this.totalPages} 页`:`第 ${Math.ceil((this.currentPage-1)/2)} 组 / 共 ${Math.ceil((this.totalPages-2)/2)} 组`}},methods:{async fetchBooksData(){try{this.loading=!0,this.error=null,this.$emit("fetch-books-data",this.bookId),this.pages&&this.pages.length>0&&(this.booksData={data:{records:this.pages.map(t=>({imageUrl:t}))}},this.showSuccessToast=!0,setTimeout(()=>{this.showSuccessToast=!1},3e3),this.checkUrlPageParameter())}catch(t){console.error("获取书籍数据失败:",t),this.error=t,t.response?console.error("API错误响应:",t.response.data):t.request?console.error("网络请求失败:",t.request):console.error("请求配置错误:",t.message)}finally{this.loading=!1}},updatePagesFromApiData(t){if(!Array.isArray(t))return void console.warn("API数据格式不正确,期望数组格式");console.log("开始更新页面数据,数据长度:",t.length);const e=[null];t.forEach((t,i)=>{t.imageUrl&&(e.push(t.imageUrl),console.log(`添加页面 ${i+1}:`,t.imageUrl))}),e.length>1&&(this.pages=e,console.log("页面数据更新完成,总页数:",this.pages.length))},detectMobile(){const t=navigator.userAgent.toLowerCase(),e=["mobile","android","iphone","ipad","ipod","blackberry","windows phone"],i=e.some(e=>t.includes(e)),o=window.innerWidth<=768,s="ontouchstart"in window||navigator.maxTouchPoints>0;this.isMobile=i||o&&s,console.log("设备检测结果:",{userAgent:i,screenSize:o,touchSupport:s,finalResult:this.isMobile})},async preloadFirstPage(){if(!this.pages||0===this.pages.length)return void(this.contentReady=!0);const t=this.startPage-1,e=this.pages[t];if(e)try{await new Promise((t,i)=>{const o=new Image;o.onload=()=>t(),o.onerror=()=>t(),o.src=e,setTimeout(()=>t(),3e3)})}catch(i){console.warn("首页图片预加载失败:",i)}finally{this.contentReady=!0}else this.contentReady=!0},handleResize(){const t=this.isMobile;this.detectMobile(),t!==this.isMobile&&(console.log("设备类型变化,重新初始化"),this.$nextTick(()=>{this.$refs.flipbook&&(this.currentPage=1,this.startPage=1)}))},flipLeft(){if(console.log("尝试向左翻页,当前页:",this.currentPage),"flip"===this.flipMode)if(this.$refs.flipbook&&this.currentPage>1)try{this.$refs.flipbook.flipLeft(),console.log("向左翻页命令已发送")}catch(t){console.error("向左翻页失败:",t)}else console.log("无法向左翻页 - 已在第一页或组件未就绪");else this.currentPage>1&&(this.currentPage--,this.onFlipLeftEnd(this.currentPage))},flipRight(){if(console.log("尝试向右翻页,当前页:",this.currentPage),"flip"===this.flipMode)if(this.$refs.flipbook&&this.currentPage<this.totalPages)try{this.$refs.flipbook.flipRight(),console.log("向右翻页命令已发送")}catch(t){console.error("向右翻页失败:",t)}else console.log("无法向右翻页 - 已在最后一页或组件未就绪");else this.currentPage<this.totalPages&&(this.currentPage++,this.onFlipRightEnd(this.currentPage))},onFlipLeftEnd(t){console.log("向左翻页完成,新页面:",t),this.currentPage=t,this.$emit("page-change",t),this.recordReadingProgress(t)},onFlipRightEnd(t){console.log("向右翻页完成,新页面:",t),this.currentPage=t,this.$emit("page-change",t),this.recordReadingProgress(t)},onContainerTouchStart(t){this.touchStartTime=Date.now(),this.initialTouches=Array.from(t.touches),2===t.touches.length?(this.isZooming=!0,this.lastTouchDistance=this.getTouchDistance(t.touches[0],t.touches[1]),this.lastTouchCenter=this.getTouchCenter(t.touches[0],t.touches[1]),t.preventDefault()):1===t.touches.length&&this.zoomScale>1&&(this.isPanning=!0,this.lastTouchCenter={x:t.touches[0].clientX,y:t.touches[0].clientY})},onContainerTouchMove(t){if(this.isZooming&&2===t.touches.length){const e=this.getTouchDistance(t.touches[0],t.touches[1]),i=this.getTouchCenter(t.touches[0],t.touches[1]),o=e/this.lastTouchDistance;let s=this.zoomScale*o;s=Math.max(.5,Math.min(3,s));const a=i.x-this.lastTouchCenter.x,n=i.y-this.lastTouchCenter.y;this.zoomScale=s,this.translateX+=a,this.translateY+=n,this.lastTouchDistance=e,this.lastTouchCenter=i,t.preventDefault()}else if(this.isPanning&&1===t.touches.length&&this.zoomScale>1){const e=t.touches[0].clientX-this.lastTouchCenter.x,i=t.touches[0].clientY-this.lastTouchCenter.y;this.translateX+=e,this.translateY+=i,this.lastTouchCenter={x:t.touches[0].clientX,y:t.touches[0].clientY},t.preventDefault()}},onContainerTouchEnd(t){const e=Date.now()-this.touchStartTime,i=this.isZooming,o=this.isPanning;if(this.isZooming=!1,this.isPanning=!1,1===t.changedTouches.length&&e<300&&!i&&!o){const t=Date.now();this.lastTapTime&&t-this.lastTapTime<400?(this.resetZoom(),console.log("移动端双击重置显示比例"),this.lastTapTime=0):this.lastTapTime=t}this.constrainPosition()},getTouchDistance(t,e){const i=t.clientX-e.clientX,o=t.clientY-e.clientY;return Math.sqrt(i*i+o*o)},getTouchCenter(t,e){return{x:(t.clientX+e.clientX)/2,y:(t.clientY+e.clientY)/2}},resetZoom(){this.zoomScale=1,this.translateX=0,this.translateY=0},zoomIn(){this.zoomScale=Math.min(3,this.zoomScale+.2)},zoomOut(){this.zoomScale=Math.max(.5,this.zoomScale-.2)},onContainerDoubleClick(t){t.preventDefault(),t.stopPropagation(),this.resetZoom(),console.log("容器双击重置显示比例,当前缩放:",this.zoomScale)},onFlipbookDoubleClick(t){t.preventDefault(),t.stopPropagation(),this.resetZoom(),console.log("Flipbook双击重置显示比例,当前缩放:",this.zoomScale)},onFlipbookTouchStart(t){this.flipbookTouchStartTime=Date.now()},onFlipbookTouchEnd(t){const e=Date.now()-this.flipbookTouchStartTime;if(1===t.changedTouches.length&&e<300){const e=Date.now();this.flipbookLastTapTime&&e-this.flipbookLastTapTime<400?(t.preventDefault(),t.stopPropagation(),this.resetZoom(),console.log("Flipbook区域移动端双击重置显示比例"),this.flipbookLastTapTime=0):this.flipbookLastTapTime=e}},constrainPosition(){if(this.zoomScale<=1)return this.translateX=0,void(this.translateY=0);const t=200*(this.zoomScale-1);this.translateX=Math.max(-t,Math.min(t,this.translateX)),this.translateY=Math.max(-t,Math.min(t,this.translateY))},openCatalogue(){console.log("点击目录按钮",{dragging:this.catalogueButtonDragging,showDrawer:this.showCatalogueDrawer}),this.catalogueButtonDragging?console.log("拖拽状态中,不打开目录"):(this.showCatalogueDrawer=!0,console.log("目录抽屉已打开"))},onCatalogueMouseDown(t){this.catalogueButtonDragging=!1;const e=t.target.closest(".catalogue-button").getBoundingClientRect();this.dragStartPosition={x:t.clientX,y:t.clientY},this.dragOffset={x:t.clientX-e.left,y:t.clientY-e.top},document.addEventListener("mousemove",this.onCatalogueMouseMove),document.addEventListener("mouseup",this.onCatalogueMouseUp)},onCatalogueMouseMove(t){const e=Math.sqrt(Math.pow(t.clientX-this.dragStartPosition.x,2)+Math.pow(t.clientY-this.dragStartPosition.y,2));if(e>5&&(this.catalogueButtonDragging=!0),!this.catalogueButtonDragging)return;t.preventDefault();const i=t.clientX-this.dragOffset.x,o=t.clientY-this.dragOffset.y,s=window.innerWidth-120,a=window.innerHeight-50;this.catalogueButtonPosition={x:Math.max(0,Math.min(s,i)),y:Math.max(0,Math.min(a,o))}},onCatalogueMouseUp(t){this.catalogueButtonDragging=!1,document.removeEventListener("mousemove",this.onCatalogueMouseMove),document.removeEventListener("mouseup",this.onCatalogueMouseUp)},onCatalogueTouchStart(t){this.catalogueButtonDragging=!1;const e=t.touches[0],i=t.target.closest(".catalogue-button").getBoundingClientRect();this.dragStartPosition={x:e.clientX,y:e.clientY},this.dragOffset={x:e.clientX-i.left,y:e.clientY-i.top}},onCatalogueTouchMove(t){const e=t.touches[0],i=Math.sqrt(Math.pow(e.clientX-this.dragStartPosition.x,2)+Math.pow(e.clientY-this.dragStartPosition.y,2));if(i>5&&(this.catalogueButtonDragging=!0),!this.catalogueButtonDragging)return;t.preventDefault();const o=e.clientX-this.dragOffset.x,s=e.clientY-this.dragOffset.y,a=window.innerWidth-120,n=window.innerHeight-80;this.catalogueButtonPosition={x:Math.max(15,Math.min(a,o)),y:Math.max(15,Math.min(n,s))}},onCatalogueTouchEnd(t){this.catalogueButtonDragging=!1},toggleFlipModeMenu(){this.showFlipModeMenu=!this.showFlipModeMenu},selectFlipMode(t){const e=this.flipMode;this.flipMode=t,this.showFlipModeMenu=!1,localStorage.setItem("book-viewer-flip-mode",t),console.log("切换翻页模式:",{from:e,to:t}),"scroll"===t&&this.$nextTick(()=>{this.scrollToCurrentPage()})},onSlideViewerTouchStart(t){1===t.touches.length&&(this.slideStartX=t.touches[0].clientX,this.slideCurrentX=t.touches[0].clientX,this.slideIsDragging=!0)},onSlideViewerTouchMove(t){this.slideIsDragging&&1===t.touches.length&&(this.slideCurrentX=t.touches[0].clientX,t.preventDefault())},onSlideViewerTouchEnd(t){if(this.slideIsDragging){const t=this.slideCurrentX-this.slideStartX,e=50;t>e&&this.currentPage>1?(this.currentPage--,this.recordReadingProgress(this.currentPage)):t<-e&&this.currentPage<this.totalPages&&(this.currentPage++,this.recordReadingProgress(this.currentPage)),this.slideIsDragging=!1}},onScrollViewerScroll(t){const e=this.$refs.scrollViewer;if(!e)return;const i=e.scrollTop,o=e.clientHeight;for(let s=0;s<this.pages.length;s++){const t=this.$refs["scrollPage"+s];if(t&&t[0]){const e=t[0].offsetTop,a=e+t[0].offsetHeight;if(i>=e-o/2&&i<a-o/2){this.currentPage!==s+1&&(this.currentPage=s+1,this.recordReadingProgress(this.currentPage));break}}}},scrollToCurrentPage(){if("scroll"!==this.flipMode)return;const t=this.$refs["scrollPage"+(this.currentPage-1)];t&&t[0]&&t[0].scrollIntoView({behavior:"smooth",block:"start"})},closeFlipModeMenu(t){t.target.closest(".flip-mode-selector")||(this.showFlipModeMenu=!1)},getCardStyle(t){switch(t){case"prev":return{transform:"translateX(-70%) scale(0.85) rotateY(15deg)",zIndex:1,opacity:.6,filter:"brightness(0.8)"};case"current":return{transform:"translateX(0) scale(1) rotateY(0deg)",zIndex:3,opacity:1,filter:"brightness(1)"};case"next":return{transform:"translateX(70%) scale(0.85) rotateY(-15deg)",zIndex:1,opacity:.6,filter:"brightness(0.8)"};default:return{}}},onCatalogueClick(t){console.log("目录项被点击:",t),this.$emit("catalogue-click",t)},onFetchCatalogue(t){this.$emit("fetch-catalogue",t)},onFocus(){"flip"===this.flipMode?(this.flag=!1,setTimeout(()=>{this.flag=!0},500)):"scroll"===this.flipMode&&this.scrollToCurrentPage()},onPageJump(t){console.log("跳转到页面:",t),this.showCatalogueDrawer=!1,t&&t>=1&&t<=this.totalPages?(this.currentPage=t,this.startPage=t,this.recordReadingProgress(t),"flip"===this.flipMode?(this.flag=!1,setTimeout(()=>{this.flag=!0,this.$nextTick(()=>{this.$refs.flipbook.goToPage(t)})},500)):"scroll"===this.flipMode&&this.scrollToCurrentPage()):console.warn("无效的页码:",t)},checkUrlPageParameter(){const t=this.$route.query.page;if(t){const e=parseInt(t,10);console.log("检测到URL页码参数:",{pageParam:t,targetPage:e,totalPages:this.totalPages}),!isNaN(e)&&e>=1&&e<=this.totalPages?(console.log("准备跳转到页码:",e),this.$nextTick(()=>{this.jumpToPage(e)})):console.warn("无效的页码参数:",{pageParam:t,targetPage:e,totalPages:this.totalPages,isValid:!isNaN(e)&&e>=1&&e<=this.totalPages})}else console.log("URL中未检测到页码参数")},jumpToPage(t){if(!t||t<1||t>this.totalPages)console.warn("无效的页码:",t);else if(console.log("跳转到页面:",t),this.currentPage=t,this.startPage=t,this.recordReadingProgress(t),"flip"===this.flipMode)if(this.$refs.flipbook&&this.$refs.flipbook.goToPage)try{this.$refs.flipbook.goToPage(t),console.log("页面跳转成功:",t)}catch(e){console.error("页面跳转失败:",e)}else console.warn("Flipbook组件未就绪,无法跳转页面");else"scroll"===this.flipMode&&this.scrollToCurrentPage()},async recordReadingProgress(t){if(this.bookId&&t)try{console.log("记录阅读进度:",{bookId:this.bookId,pageNumber:t}),this.$emit("record-progress",{bookId:this.bookId,pageNumber:t}),console.log("阅读进度记录成功")}catch(e){console.error("记录阅读进度失败:",e)}else console.warn("缺少书籍ID或页码,无法记录阅读进度")},showControlsTemporarily(){this.showControls=!0,this.hideControlsTimer&&clearTimeout(this.hideControlsTimer),this.hideControlsTimer=setTimeout(()=>{this.showControls=!1},3e3)},onContentClick(){this.showControlsTemporarily()},handlePageInput(t){const e=t.target.value,i=e.replace(/[^\d]/g,"");i&&parseInt(i)>this.totalPages?this.jumpPageInput=this.totalPages.toString():this.jumpPageInput=i},handleJumpToPage(){const t=parseInt(this.jumpPageInput);t&&t>=1&&t<=this.totalPages&&(this.resetZoom(),this.jumpToPage(t),this.jumpPageInput="")}},watch:{async pages(t){t&&t.length>0&&this.isMobile?(this.contentReady=!1,await this.$nextTick(),await this.preloadFirstPage()):t&&t.length>0&&(this.contentReady=!0)}},async mounted(){console.log("组件已挂载,总页数:",this.totalPages),this.detectMobile();const t=this.$route.query.mode||this.$route.query.flipMode;if(t&&this.flipModes.some(e=>e.value===t))this.flipMode=t,this.flipModeFromUrl=!0,console.log("从URL参数读取翻页模式:",t);else{const t=localStorage.getItem("book-viewer-flip-mode");t&&this.flipModes.some(e=>e.value===t)&&(this.flipMode=t)}this.isMobile&&this.pages&&this.pages.length>0?(await this.$nextTick(),await this.preloadFirstPage()):this.pages&&this.pages.length>0&&(this.contentReady=!0),window.addEventListener("resize",this.handleResize),document.addEventListener("click",this.closeFlipModeMenu)},beforeDestroy(){window.removeEventListener("resize",this.handleResize),document.removeEventListener("mousemove",this.onCatalogueMouseMove),document.removeEventListener("mouseup",this.onCatalogueMouseUp),document.removeEventListener("click",this.closeFlipModeMenu),this.hideControlsTimer&&clearTimeout(this.hideControlsTimer)}},A=N,H=B(A,s,a,!1,null,"23d695ae",null),j=H.exports;const Y={BookReader:j,BookCatalogueDrawer:U},Z=function(t){Z.installed||(Z.installed=!0,Object.keys(Y).forEach(e=>{t.component(e,Y[e])}))};"undefined"!==typeof window&&window.Vue&&Z(window.Vue);var V={install:Z,BookReader:j,BookCatalogueDrawer:U},q=V;return e}()});
|
|
31
|
+
var p,f,m,v=function(){function t(t){t?t.m?this.m=[].concat(t.m):this.m=[].concat(t):this.m=r()}return t.prototype.clone=function(){return new t(this)},t.prototype.multiply=function(t){return this.m=l(this.m,t)},t.prototype.perspective=function(t){return this.multiply(h(t))},t.prototype.transformX=function(t){return(t*this.m[0]+this.m[12])/(t*this.m[3]+this.m[15])},t.prototype.translate=function(t,e){return this.multiply(g(t,e))},t.prototype.translate3d=function(t,e,i){return this.multiply(d(t,e,i))},t.prototype.rotateY=function(t){return this.multiply(c(t))},t.prototype.toString=function(){return u(this.m)},t}(),P="data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%3F%3E%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22500%22%20height%3D%22500%22%20viewBox%3D%220%200%20500%20500%22%20fill%3D%22transparent%22%20style%3D%22background-color%3A%20%23fff%22%3E%20%20%3Ccircle%20%20%20%20cx%3D%22250%22%20%20%20%20cy%3D%22250%22%20%20%20%20r%3D%2248%22%20%20%20%20stroke%3D%22%23333%22%20%20%20%20stroke-width%3D%222%22%20%20%20%20stroke-dasharray%3D%22271%2030%22%20%20%3E%20%20%20%20%3CanimateTransform%20%20%20%20%20%20attributeName%3D%22transform%22%20%20%20%20%20%20attributeType%3D%22XML%22%20%20%20%20%20%20type%3D%22rotate%22%20%20%20%20%20%20from%3D%220%20250%20250%22%20%20%20%20%20%20to%3D%22360%20250%20250%22%20%20%20%20%20%20dur%3D%221s%22%20%20%20%20%20%20repeatCount%3D%22indefinite%22%20%20%20%20%2F%3E%20%20%3C%2Fcircle%3E%3C%2Fsvg%3E";p=function(t){return Math.pow(t,2)},m=function(t){return 1-p(1-t)},f=function(t){return t<.5?p(2*t)/2:.5+m(2*(t-.5))/2};var b={props:{pages:{type:Array,required:!0},pagesHiRes:{type:Array,default:function(){return[]}},flipDuration:{type:Number,default:1e3},zoomDuration:{type:Number,default:500},zooms:{type:Array,default:function(){return[1,2,4]}},perspective:{type:Number,default:2400},nPolygons:{type:Number,default:10},ambient:{type:Number,default:.4},gloss:{type:Number,default:.6},swipeMin:{type:Number,default:3},singlePage:{type:Boolean,default:!1},forwardDirection:{validator:function(t){return"right"===t||"left"===t},default:"right"},centering:{type:Boolean,default:!0},startPage:{type:Number,default:null},loadingImage:{type:String,default:P},clickToZoom:{type:Boolean,default:!0},dragToFlip:{type:Boolean,default:!0},wheel:{type:String,default:"scroll"}},data:function(){return{viewWidth:0,viewHeight:0,imageWidth:null,imageHeight:null,displayedPages:1,nImageLoad:0,nImageLoadTrigger:0,imageLoadCallback:null,currentPage:0,firstPage:0,secondPage:1,zoomIndex:0,zoom:1,zooming:!1,touchStartX:null,touchStartY:null,maxMove:0,activeCursor:null,hasTouchEvents:!1,hasPointerEvents:!1,minX:Infinity,maxX:-Infinity,preloadedImages:{},flip:{progress:0,direction:null,frontImage:null,backImage:null,auto:!1,opacity:1},currentCenterOffset:null,animatingCenter:!1,startScrollLeft:0,startScrollTop:0,scrollLeft:0,scrollTop:0,loadedImages:{}}},computed:{IE:function(){return"undefined"!==typeof navigator&&/Trident/.test(navigator.userAgent)},canFlipLeft:function(){return"left"===this.forwardDirection?this.canGoForward:this.canGoBack},canFlipRight:function(){return"right"===this.forwardDirection?this.canGoForward:this.canGoBack},canZoomIn:function(){return!this.zooming&&this.zoomIndex<this.zooms_.length-1},canZoomOut:function(){return!this.zooming&&this.zoomIndex>0},numPages:function(){return null===this.pages[0]?this.pages.length-1:this.pages.length},page:function(){return null!==this.pages[0]?this.currentPage+1:Math.max(1,this.currentPage)},zooms_:function(){return this.zooms||[1]},canGoForward:function(){return!this.flip.direction&&this.currentPage<this.pages.length-this.displayedPages},canGoBack:function(){return!this.flip.direction&&this.currentPage>=this.displayedPages&&!(1===this.displayedPages&&!this.pageUrl(this.firstPage-1))},leftPage:function(){return"right"===this.forwardDirection||1===this.displayedPages?this.firstPage:this.secondPage},rightPage:function(){return"left"===this.forwardDirection?this.firstPage:this.secondPage},showLeftPage:function(){return this.pageUrl(this.leftPage)},showRightPage:function(){return this.pageUrl(this.rightPage)&&2===this.displayedPages},cursor:function(){return this.activeCursor?this.activeCursor:this.IE?"auto":this.clickToZoom&&this.canZoomIn?"zoom-in":this.clickToZoom&&this.canZoomOut?"zoom-out":this.dragToFlip?"grab":"auto"},pageScale:function(){var t,e,i,o;return e=this.viewWidth/this.displayedPages,i=e/this.imageWidth,o=this.viewHeight/this.imageHeight,t=i<o?i:o,t<1?t:1},pageWidth:function(){return Math.round(this.imageWidth*this.pageScale)},pageHeight:function(){return Math.round(this.imageHeight*this.pageScale)},xMargin:function(){return(this.viewWidth-this.pageWidth*this.displayedPages)/2},yMargin:function(){return(this.viewHeight-this.pageHeight)/2},polygonWidth:function(){var t;return t=this.pageWidth/this.nPolygons,t=Math.ceil(t+1/this.zoom),t+"px"},polygonHeight:function(){return this.pageHeight+"px"},polygonBgSize:function(){return this.pageWidth+"px "+this.pageHeight+"px"},polygonArray:function(){return this.makePolygonArray("front").concat(this.makePolygonArray("back"))},boundingLeft:function(){var t;return 1===this.displayedPages?this.xMargin:(t=this.pageUrl(this.leftPage)?this.xMargin:this.viewWidth/2,t<this.minX?t:this.minX)},boundingRight:function(){var t;return 1===this.displayedPages?this.viewWidth-this.xMargin:(t=this.pageUrl(this.rightPage)?this.viewWidth-this.xMargin:this.viewWidth/2,t>this.maxX?t:this.maxX)},centerOffset:function(){var t;return t=this.centering?Math.round(this.viewWidth/2-(this.boundingLeft+this.boundingRight)/2):0,null===this.currentCenterOffset&&null!==this.imageWidth&&(this.currentCenterOffset=t),t},centerOffsetSmoothed:function(){return Math.round(this.currentCenterOffset)},dragToScroll:function(){return!this.hasTouchEvents},scrollLeftMin:function(){var t;return t=(this.boundingRight-this.boundingLeft)*this.zoom,t<this.viewWidth?(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom-(this.viewWidth-t)/2:(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom},scrollLeftMax:function(){var t;return t=(this.boundingRight-this.boundingLeft)*this.zoom,t<this.viewWidth?(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom-(this.viewWidth-t)/2:(this.boundingRight+this.centerOffsetSmoothed)*this.zoom-this.viewWidth},scrollTopMin:function(){var t;return t=this.pageHeight*this.zoom,t<this.viewHeight?this.yMargin*this.zoom-(this.viewHeight-t)/2:this.yMargin*this.zoom},scrollTopMax:function(){var t;return t=this.pageHeight*this.zoom,t<this.viewHeight?this.yMargin*this.zoom-(this.viewHeight-t)/2:(this.yMargin+this.pageHeight)*this.zoom-this.viewHeight},scrollLeftLimited:function(){return Math.min(this.scrollLeftMax,Math.max(this.scrollLeftMin,this.scrollLeft))},scrollTopLimited:function(){return Math.min(this.scrollTopMax,Math.max(this.scrollTopMin,this.scrollTop))}},mounted:function(){return window.addEventListener("resize",this.onResize,{passive:!0}),this.onResize(),this.zoom=this.zooms_[0],this.goToPage(this.startPage)},beforeDestroy:function(){return window.removeEventListener("resize",this.onResize,{passive:!0})},methods:{onResize:function(){var t;if(t=this.$refs.viewport,t)return this.viewWidth=t.clientWidth,this.viewHeight=t.clientHeight,this.displayedPages=this.viewWidth>this.viewHeight&&!this.singlePage?2:1,2===this.displayedPages&&(this.currentPage&=-2),this.fixFirstPage(),this.minX=Infinity,this.maxX=-Infinity},fixFirstPage:function(){if(1===this.displayedPages&&0===this.currentPage&&this.pages.length&&!this.pageUrl(0))return this.currentPage++},pageUrl:function(t,e){var i;return void 0===e&&(e=!1),e&&this.zoom>1&&!this.zooming&&(i=this.pagesHiRes[t],i)?i:this.pages[t]||null},pageUrlLoading:function(t,e){var i;return void 0===e&&(e=!1),i=this.pageUrl(t,e),e&&this.zoom>1&&!this.zooming?i:i&&this.loadImage(i)},flipLeft:function(){if(this.canFlipLeft)return this.flipStart("left",!0)},flipRight:function(){if(this.canFlipRight)return this.flipStart("right",!0)},makePolygonArray:function(t){var e,i,o,s,a,n,r,l,h,c,u,g,d,p,f,m,P,b,w,y,C,M,k,T,x,I;if(!this.flip.direction)return[];for(f=this.flip.progress,s=this.flip.direction,1===this.displayedPages&&s!==this.forwardDirection&&(f=1-f,s=this.forwardDirection),this.flip.opacity=1===this.displayedPages&&f>.7?1-(f-.7)/.3:1,n="front"===t?this.flip.frontImage:this.flip.backImage,p=this.pageWidth/this.nPolygons,d=this.xMargin,c=!1,1===this.displayedPages?"right"===this.forwardDirection?"back"===t&&(c=!0,d=this.xMargin-this.pageWidth):"left"===s?"back"===t?d=this.pageWidth-this.xMargin:c=!0:"front"===t?d=this.pageWidth-this.xMargin:c=!0:"left"===s?"back"===t?d=this.viewWidth/2:c=!0:"front"===t?d=this.viewWidth/2:c=!0,u=new v,u.translate(this.viewWidth/2),u.perspective(this.perspective),u.translate(-this.viewWidth/2),u.translate(d,this.yMargin),g=0,f>.5&&(g=2*-(f-.5)*180),"left"===s&&(g=-g),"back"===t&&(g+=180),g&&(c&&u.translate(this.pageWidth),u.rotateY(g),c&&u.translate(-this.pageWidth)),M=f<.5?2*f*Math.PI:(1-2*(f-.5))*Math.PI,0===M&&(M=1e-9),b=this.pageWidth/M,P=0,i=M/this.nPolygons,C=i/2/Math.PI*180,o=i/Math.PI*180,c&&(C=-M/Math.PI*180+o/2),"back"===t&&(C=-C,o=-o),this.minX=Infinity,this.maxX=-Infinity,y=[],a=r=0,w=this.nPolygons;0<=w?r<w:r>w;a=0<=w?++r:--r)e=a/(this.nPolygons-1)*100+"% 0px",h=u.clone(),m=c?M-P:P,k=Math.sin(m)*b,c&&(k=this.pageWidth-k),I=(1-Math.cos(m))*b,"back"===t&&(I=-I),h.translate3d(k,0,I),h.rotateY(-C),T=h.transformX(0),x=h.transformX(p),this.maxX=Math.max(Math.max(T,x),this.maxX),this.minX=Math.min(Math.min(T,x),this.minX),l=this.computeLighting(g-C,o),P+=i,C+=o,y.push([t+a,n,l,e,h.toString(),Math.abs(Math.round(I))]);return y},computeLighting:function(t,e){var i,o,s,a,n,r,l;return n=[],r=[-.5,-.25,0,.25,.5],this.ambient<1&&(s=1-this.ambient,a=r.map(function(i){return(1-Math.cos((t-e*i)/180*Math.PI))*s}),n.push("linear-gradient(to right,\n rgba(0, 0, 0, "+a[0]+"),\n rgba(0, 0, 0, "+a[1]+") 25%,\n rgba(0, 0, 0, "+a[2]+") 50%,\n rgba(0, 0, 0, "+a[3]+") 75%,\n rgba(0, 0, 0, "+a[4]+"))")),this.gloss>0&&!this.IE&&(i=30,o=200,l=r.map(function(s){return Math.max(Math.pow(Math.cos((t+i-e*s)/180*Math.PI),o),Math.pow(Math.cos((t-i-e*s)/180*Math.PI),o))}),n.push("linear-gradient(to right,\n rgba(255, 255, 255, "+l[0]*this.gloss+"),\n rgba(255, 255, 255, "+l[1]*this.gloss+") 25%,\n rgba(255, 255, 255, "+l[2]*this.gloss+") 50%,\n rgba(255, 255, 255, "+l[3]*this.gloss+") 75%,\n rgba(255, 255, 255, "+l[4]*this.gloss+"))")),n.join(",")},flipStart:function(t,e){var i=this;return t!==this.forwardDirection?1===this.displayedPages?(this.flip.frontImage=this.pageUrl(this.currentPage-1),this.flip.backImage=null):(this.flip.frontImage=this.pageUrl(this.firstPage),this.flip.backImage=this.pageUrl(this.currentPage-this.displayedPages+1)):1===this.displayedPages?(this.flip.frontImage=this.pageUrl(this.currentPage),this.flip.backImage=null):(this.flip.frontImage=this.pageUrl(this.secondPage),this.flip.backImage=this.pageUrl(this.currentPage+this.displayedPages)),this.flip.direction=t,this.flip.progress=0,requestAnimationFrame(function(){return requestAnimationFrame(function(){if(i.flip.direction!==i.forwardDirection?2===i.displayedPages&&(i.firstPage=i.currentPage-i.displayedPages):1===i.displayedPages?i.firstPage=i.currentPage+i.displayedPages:i.secondPage=i.currentPage+1+i.displayedPages,e)return i.flipAuto(!0)})})},flipAuto:function(t){var e,i,o,s,a=this;return s=Date.now(),i=this.flipDuration*(1-this.flip.progress),o=this.flip.progress,this.flip.auto=!0,this.$emit("flip-"+this.flip.direction+"-start",this.page),e=function(){return requestAnimationFrame(function(){var n,r;return r=Date.now()-s,n=o+r/i,n>1&&(n=1),a.flip.progress=t?f(n):n,n<1?e():(a.flip.direction!==a.forwardDirection?a.currentPage-=a.displayedPages:a.currentPage+=a.displayedPages,a.$emit("flip-"+a.flip.direction+"-end",a.page),1===a.displayedPages&&a.flip.direction===a.forwardDirection?a.flip.direction=null:a.onImageLoad(1,function(){return a.flip.direction=null}),a.flip.auto=!1)})},e()},flipRevert:function(){var t,e,i,o,s=this;return o=Date.now(),e=this.flipDuration*this.flip.progress,i=this.flip.progress,this.flip.auto=!0,t=function(){return requestAnimationFrame(function(){var a,n;return n=Date.now()-o,a=i-i*n/e,a<0&&(a=0),s.flip.progress=a,a>0?t():(s.firstPage=s.currentPage,s.secondPage=s.currentPage+1,1===s.displayedPages&&s.flip.direction!==s.forwardDirection?s.flip.direction=null:s.onImageLoad(1,function(){return s.flip.direction=null}),s.flip.auto=!1)})},t()},onImageLoad:function(t,e){return this.nImageLoad=0,this.nImageLoadTrigger=t,this.imageLoadCallback=e},didLoadImage:function(t){if(null===this.imageWidth&&(this.imageWidth=(t.target||t.path[0]).naturalWidth,this.imageHeight=(t.target||t.path[0]).naturalHeight,this.preloadImages()),this.imageLoadCallback)return++this.nImageLoad>=this.nImageLoadTrigger?(this.imageLoadCallback(),this.imageLoadCallback=null):void 0},zoomIn:function(t){if(void 0===t&&(t=null),this.canZoomIn)return this.zoomIndex+=1,this.zoomTo(this.zooms_[this.zoomIndex],t)},zoomOut:function(t){if(void 0===t&&(t=null),this.canZoomOut)return this.zoomIndex-=1,this.zoomTo(this.zooms_[this.zoomIndex],t)},zoomTo:function(t,e){var i,o,s,a,n,r,l,h,c,u,g,d,p,m,v=this;if(void 0===e&&(e=null),m=this.$refs.viewport,e?(c=m.getBoundingClientRect(),l=e.pageX-c.left,h=e.pageY-c.top):(l=m.clientWidth/2,h=m.clientHeight/2),u=this.zoom,a=t,g=m.scrollLeft,d=m.scrollTop,o=l+g,s=h+d,n=o/u*a-l,r=s/u*a-h,p=Date.now(),this.zooming=!0,this.$emit("zoom-start",t),i=function(){return requestAnimationFrame(function(){var e,o;return o=Date.now()-p,e=o/v.zoomDuration,(e>1||v.IE)&&(e=1),e=f(e),v.zoom=u+(a-u)*e,v.scrollLeft=g+(n-g)*e,v.scrollTop=d+(r-d)*e,o<v.zoomDuration?i():(v.$emit("zoom-end",t),v.zooming=!1,v.zoom=t,v.scrollLeft=n,v.scrollTop=r)})},i(),a>1)return this.preloadImages(!0)},zoomAt:function(t){return this.zoomIndex=(this.zoomIndex+1)%this.zooms_.length,this.zoomTo(this.zooms_[this.zoomIndex],t)},swipeStart:function(t){return this.touchStartX=t.pageX,this.touchStartY=t.pageY,this.maxMove=0,this.zoom<=1?this.dragToFlip?this.activeCursor="grab":void 0:(this.startScrollLeft=this.$refs.viewport.scrollLeft,this.startScrollTop=this.$refs.viewport.scrollTop,this.activeCursor="all-scroll")},swipeMove:function(t){var e,i;if(null!=this.touchStartX)if(e=t.pageX-this.touchStartX,i=t.pageY-this.touchStartY,this.maxMove=Math.max(this.maxMove,Math.abs(e)),this.maxMove=Math.max(this.maxMove,Math.abs(i)),this.zoom>1)this.dragToScroll&&this.dragScroll(e,i);else if(this.dragToFlip&&!(Math.abs(i)>Math.abs(e)))return this.activeCursor="grabbing",e>0?(null===this.flip.direction&&this.canFlipLeft&&e>=this.swipeMin&&this.flipStart("left",!1),"left"===this.flip.direction&&(this.flip.progress=e/this.pageWidth,this.flip.progress>1&&(this.flip.progress=1))):(null===this.flip.direction&&this.canFlipRight&&e<=-this.swipeMin&&this.flipStart("right",!1),"right"===this.flip.direction&&(this.flip.progress=-e/this.pageWidth,this.flip.progress>1&&(this.flip.progress=1))),!0},swipeEnd:function(t){if(null!=this.touchStartX)return this.clickToZoom&&this.maxMove<this.swipeMin&&this.zoomAt(t),null===this.flip.direction||this.flip.auto||(this.flip.progress>1/4?this.flipAuto(!1):this.flipRevert()),this.touchStartX=null,this.activeCursor=null},onTouchStart:function(t){return this.hasTouchEvents=!0,this.swipeStart(t.changedTouches[0])},onTouchMove:function(t){if(this.swipeMove(t.changedTouches[0])&&t.cancelable)return t.preventDefault()},onTouchEnd:function(t){return this.swipeEnd(t.changedTouches[0])},onPointerDown:function(t){if(this.hasPointerEvents=!0,!this.hasTouchEvents&&(!t.which||1===t.which)){this.swipeStart(t);try{return t.target.setPointerCapture(t.pointerId)}catch(e){}}},onPointerMove:function(t){if(!this.hasTouchEvents)return this.swipeMove(t)},onPointerUp:function(t){if(!this.hasTouchEvents){this.swipeEnd(t);try{return t.target.releasePointerCapture(t.pointerId)}catch(e){}}},onMouseDown:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents&&(!t.which||1===t.which))return this.swipeStart(t)},onMouseMove:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents)return this.swipeMove(t)},onMouseUp:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents)return this.swipeEnd(t)},dragScroll:function(t,e){return this.scrollLeft=this.startScrollLeft-t,this.scrollTop=this.startScrollTop-e},onWheel:function(t){if("scroll"===this.wheel&&this.zoom>1&&this.dragToScroll&&(this.scrollLeft=this.$refs.viewport.scrollLeft+t.deltaX,this.scrollTop=this.$refs.viewport.scrollTop+t.deltaY,t.cancelable&&t.preventDefault()),"zoom"===this.wheel){if(t.deltaY>=100)return this.zoomOut(t),t.preventDefault();if(t.deltaY<=-100)return this.zoomIn(t),t.preventDefault()}},preloadImages:function(t){var e,i,o,s,a,n,r,l;for(void 0===t&&(t=!1),e=i=s=this.currentPage-3,a=this.currentPage+3;s<=a?i<=a:i>=a;e=s<=a?++i:--i)this.pageUrlLoading(e);if(t)for(e=o=n=this.currentPage,r=this.currentPage+this.displayedPages;n<=r?o<r:o>r;e=n<=r?++o:--o)l=this.pagesHiRes[e],l&&((new Image).src=l)},goToPage:function(t){if(null!==t&&t!==this.page)return null===this.pages[0]?2===this.displayedPages&&1===t?this.currentPage=0:this.currentPage=t:this.currentPage=t-1,this.minX=Infinity,this.maxX=-Infinity,this.currentCenterOffset=this.centerOffset},loadImage:function(t){var e,i=this;return null===this.imageWidth||this.loadedImages[t]?t:(e=new Image,e.onload=function(){return i.$set?i.$set(i.loadedImages,t,!0):i.loadedImages[t]=!0},e.src=t,this.loadingImage)}},watch:{currentPage:function(){return this.firstPage=this.currentPage,this.secondPage=this.currentPage+1,this.preloadImages()},centerOffset:function(){var t,e=this;if(!this.animatingCenter)return t=function(){return requestAnimationFrame(function(){var i,o;return o=.1,i=e.centerOffset-e.currentCenterOffset,Math.abs(i)<.5?(e.currentCenterOffset=e.centerOffset,e.animatingCenter=!1):(e.currentCenterOffset+=i*o,t())})},this.animatingCenter=!0,t()},scrollLeftLimited:function(t){var e=this;return this.IE?requestAnimationFrame(function(){return e.$refs.viewport.scrollLeft=t}):this.$refs.viewport.scrollLeft=t},scrollTopLimited:function(t){var e=this;return this.IE?requestAnimationFrame(function(){return e.$refs.viewport.scrollTop=t}):this.$refs.viewport.scrollTop=t},pages:function(t,e){if(this.fixFirstPage(),!(null!=e?e.length:void 0)&&(null!=t?t.length:void 0)&&this.startPage>1&&null===t[0])return this.currentPage++},startPage:function(t){return this.goToPage(t)}}};function w(t,e,i,o,s,a,n,r,l,h){"boolean"!==typeof n&&(l=r,r=n,n=!1);var c,u="function"===typeof i?i.options:i;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,s&&(u.functional=!0)),o&&(u._scopeId=o),a?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,l(t)),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=c):e&&(c=n?function(t){e.call(this,h(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,r(t))}),c)if(u.functional){var g=u.render;u.render=function(t,e){return c.call(e),g(t,e)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,c):[c]}return i}var y,C="undefined"!==typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function M(t){return function(t,e){return T(t,e)}}var k={};function T(t,e){var i=C?e.media||"default":t,o=k[i]||(k[i]={ids:new Set,styles:[]});if(!o.ids.has(t)){o.ids.add(t);var s=e.source;if(e.map&&(s+="\n/*# sourceURL="+e.map.sources[0]+" */",s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",e.media&&o.element.setAttribute("media",e.media),void 0===y&&(y=document.head||document.getElementsByTagName("head")[0]),y.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(s),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{var a=o.ids.size-1,n=document.createTextNode(s),r=o.element.childNodes;r[a]&&o.element.removeChild(r[a]),r.length?o.element.insertBefore(n,r[a]):o.element.appendChild(n)}}}var x=b,I=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[t._t("default",null,null,{canFlipLeft:t.canFlipLeft,canFlipRight:t.canFlipRight,canZoomIn:t.canZoomIn,canZoomOut:t.canZoomOut,page:t.page,numPages:t.numPages,flipLeft:t.flipLeft,flipRight:t.flipRight,zoomIn:t.zoomIn,zoomOut:t.zoomOut}),t._v(" "),i("div",{ref:"viewport",staticClass:"viewport",class:{zoom:t.zooming||t.zoom>1,"drag-to-scroll":t.dragToScroll},style:{cursor:"grabbing"==t.cursor?"grabbing":"auto"},on:{touchmove:t.onTouchMove,pointermove:t.onPointerMove,mousemove:t.onMouseMove,touchend:t.onTouchEnd,touchcancel:t.onTouchEnd,pointerup:t.onPointerUp,pointercancel:t.onPointerUp,mouseup:t.onMouseUp,wheel:t.onWheel}},[i("div",{staticClass:"flipbook-container",style:{transform:"scale("+t.zoom+")"}},[i("div",{staticClass:"click-to-flip left",style:{cursor:t.canFlipLeft?"pointer":"auto"},on:{click:t.flipLeft}}),t._v(" "),i("div",{staticClass:"click-to-flip right",style:{cursor:t.canFlipRight?"pointer":"auto"},on:{click:t.flipRight}}),t._v(" "),i("div",{style:{transform:"translateX("+t.centerOffsetSmoothed+"px)"}},[t.showLeftPage?i("img",{staticClass:"page fixed",style:{width:t.pageWidth+"px",height:t.pageHeight+"px",left:t.xMargin+"px",top:t.yMargin+"px"},attrs:{src:t.pageUrlLoading(t.leftPage,!0)},on:{load:function(e){return t.didLoadImage(e)}}}):t._e(),t._v(" "),t.showRightPage?i("img",{staticClass:"page fixed",style:{width:t.pageWidth+"px",height:t.pageHeight+"px",left:t.viewWidth/2+"px",top:t.yMargin+"px"},attrs:{src:t.pageUrlLoading(t.rightPage,!0)},on:{load:function(e){return t.didLoadImage(e)}}}):t._e(),t._v(" "),i("div",{style:{opacity:t.flip.opacity}},t._l(t.polygonArray,function(e){var o=e[0],s=e[1],a=e[2],n=e[3],r=e[4],l=e[5];return i("div",{key:o,staticClass:"polygon",class:{blank:!s},style:{backgroundImage:s&&"url("+t.loadImage(s)+")",backgroundSize:t.polygonBgSize,backgroundPosition:n,width:t.polygonWidth,height:t.polygonHeight,transform:r,zIndex:l}},[i("div",{directives:[{name:"show",rawName:"v-show",value:a.length,expression:"lighting.length"}],staticClass:"lighting",style:{backgroundImage:a}})])}),0),t._v(" "),i("div",{staticClass:"bounding-box",style:{left:t.boundingLeft+"px",top:t.yMargin+"px",width:t.boundingRight-t.boundingLeft+"px",height:t.pageHeight+"px",cursor:t.cursor},on:{touchstart:t.onTouchStart,pointerdown:t.onPointerDown,mousedown:t.onMouseDown}})])])])],2)},z=[],D=function(t){t&&t("data-v-e3f0fbe2_0",{source:".viewport[data-v-e3f0fbe2]{-webkit-overflow-scrolling:touch;width:100%;height:100%}.viewport.zoom[data-v-e3f0fbe2]{overflow:scroll}.viewport.zoom.drag-to-scroll[data-v-e3f0fbe2]{overflow:hidden}.flipbook-container[data-v-e3f0fbe2]{position:relative;width:100%;height:100%;transform-origin:top left;user-select:none}.click-to-flip[data-v-e3f0fbe2]{position:absolute;width:50%;height:100%;top:0;user-select:none}.click-to-flip.left[data-v-e3f0fbe2]{left:0}.click-to-flip.right[data-v-e3f0fbe2]{right:0}.bounding-box[data-v-e3f0fbe2]{position:absolute;user-select:none}.page[data-v-e3f0fbe2]{position:absolute;backface-visibility:hidden}.polygon[data-v-e3f0fbe2]{position:absolute;top:0;left:0;background-repeat:no-repeat;backface-visibility:hidden;transform-origin:center left}.polygon.blank[data-v-e3f0fbe2]{background-color:#ddd}.polygon .lighting[data-v-e3f0fbe2]{width:100%;height:100%}",map:void 0,media:void 0})},S="data-v-e3f0fbe2",_=void 0,L=!1,F=w({render:I,staticRenderFns:z},D,x,S,L,_,!1,M,void 0,void 0),R=function(){var t=this,e=t._self._c;return e("div",{staticClass:"catalogue-drawer-container"},[t.visible?e("div",{staticClass:"drawer-overlay",on:{click:t.closeDrawer}}):t._e(),e("div",{staticClass:"catalogue-drawer",class:{"drawer-open":t.visible},style:{width:t.drawerWidth}},[e("div",{staticClass:"drawer-header"},[e("h3",{staticClass:"drawer-title"},[t._v("目录")]),e("button",{staticClass:"close-button",on:{click:t.closeDrawer}},[e("span",{staticClass:"close-icon"},[t._v("×")])])]),e("div",{staticClass:"page-jump-section"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.jumpPageInput,expression:"jumpPageInput"}],staticClass:"page-jump-input",attrs:{type:"text",placeholder:"请输入页码"},domProps:{value:t.jumpPageInput},on:{input:[function(e){e.target.composing||(t.jumpPageInput=e.target.value)},t.handlePageInput],focus:t.onInputFocus,blur:t.onInputBlur}}),e("button",{staticClass:"btn-jump",on:{click:t.handleJumpToPage}},[t._v(" 跳转 ")])]),e("div",{staticClass:"drawer-content"},[t.loading?e("div",{staticClass:"loading-container"},[e("div",{staticClass:"loading-spinner"}),e("p",[t._v("加载目录中...")])]):t.error?e("div",{staticClass:"error-container"},[e("div",{staticClass:"error-icon"},[t._v("⚠️")]),e("p",[t._v("目录加载失败")]),e("button",{staticClass:"retry-button",on:{click:t.fetchCatalogue}},[t._v(" 重新加载 ")])]):t.catalogueData&&t.catalogueData.length>0?e("div",{staticClass:"catalogue-list"},t._l(t.catalogueData,function(i,o){return e("catalogue-item",{key:`catalogue-${o}`,attrs:{item:i||{},level:0},on:{"item-click":t.onItemClick}})}),1):e("div",{staticClass:"empty-container"},[e("p",[t._v("暂无目录")])])])])])},$=[];const E={name:"CatalogueItem",props:{item:{type:Object,required:!0},level:{type:Number,default:0}},data(){return{expanded:!1}},computed:{hasChildren(){const t=this.item.childrenList||this.item.children||this.item.subItems||this.item.items;return t&&t.length>0},childrenData(){return this.item.childrenList||this.item.children||this.item.subItems||this.item.items||[]},itemStyle(){return{paddingLeft:"12px",paddingRight:"12px"}},levelClass(){return`level-${this.level}`}},methods:{toggleExpand(){this.hasChildren?this.expanded=!this.expanded:this.handleClick()},handleClick(){this.$emit("item-click",this.item)}},render(t){const e=this.item,i=e.titleName||e.title||e.name||e.text||e.label||"未命名章节",o=(e.startPageNum||e.pageNumber||e.page||e.pageNum,t("span",{class:"drag-handle"},"")),s=this.hasChildren?t("span",{class:"expand-icon"},this.expanded?"▼":"▶"):null,a=this.level>0?t("span",{class:`level-indicator level-${this.level}`},"•".repeat(this.level)):null,n=t("span",{class:"item-title"},i),r=null,l=this.hasChildren&&this.expanded?t("div",{class:"children-container"},this.childrenData.map((e,i)=>t("catalogue-item",{key:i,props:{item:e,level:this.level+1},on:{"item-click":t=>this.$emit("item-click",t)}}))):null;return t("div",{class:"catalogue-item-wrapper"},[t("div",{class:["catalogue-item",this.levelClass,{"has-children":this.hasChildren,expanded:this.expanded}],style:this.itemStyle,on:{click:this.toggleExpand}},[t("div",{class:"item-content"},[o,s,a,n,r].filter(Boolean))]),l].filter(Boolean))}};var X={name:"BookCatalogueDrawer",components:{CatalogueItem:E},props:{value:{type:Boolean,default:!1},bookId:{type:String,default:""},catalogue:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},data(){return{catalogueData:[],error:null,jumpPageInput:""}},computed:{visible:{get(){return this.value},set(t){this.$emit("input",t)}},drawerWidth(){return window.innerWidth<=768?"80%":"400px"}},watch:{visible(t){t&&this.bookId&&!this.catalogueData.length&&this.$emit("fetch-catalogue",this.bookId)},bookId(t){t&&this.visible&&this.$emit("fetch-catalogue",t)},catalogue:{handler(t){t&&t.length>0&&(this.catalogueData=this.processCatalogueData(t))},immediate:!0}},methods:{fetchCatalogue(){this.bookId?this.$emit("fetch-catalogue",this.bookId):console.warn("缺少 bookId,无法获取目录")},processCatalogueData(t){return Array.isArray(t)?t.map(t=>{if(!t||"object"!==typeof t)return{titleName:"未知章节",startPageNum:null,childrenList:[]};const e={...t,titleName:t.titleName||t.title||t.name||"未命名章节",startPageNum:t.startPageNum||t.pageNumber||t.page||t.pageNum||null,childrenList:t.childrenList||t.children||t.subItems||t.items||[]};return e.childrenList&&e.childrenList.length>0&&(e.childrenList=this.processCatalogueData(e.childrenList)),e}):[]},onItemClick(t){console.log("目录项被点击:",t),this.$emit("catalogue-click",t);const e=t.startPageNum||t.pageNumber||t.page||t.pageNum;e&&this.$emit("page-jump",e)},closeDrawer(){this.$emit("input",!1)},handlePageInput(t){const e=t.target.value,i=e.replace(/[^\d]/g,"");this.jumpPageInput=i},handleJumpToPage(){const t=parseInt(this.jumpPageInput);t&&t>=1&&(this.$emit("page-jump",t),this.jumpPageInput="",this.closeDrawer())},onInputFocus(){},onInputBlur(){this.$emit("Focus")},resetData(){this.catalogueData=[],this.error=null,this.loading=!1},handleResize(){}},mounted(){window.addEventListener("resize",this.handleResize)},beforeDestroy(){window.removeEventListener("resize",this.handleResize)}},W=X;function B(t,e,i,o,s,a,n,r){var l,h="function"===typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=i,h._compiled=!0),o&&(h.functional=!0),a&&(h._scopeId="data-v-"+a),n?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(n)},h._ssrRegister=l):s&&(l=r?function(){s.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(h.functional){h._injectStyles=l;var c=h.render;h.render=function(t,e){return l.call(e),c(t,e)}}else{var u=h.beforeCreate;h.beforeCreate=u?[].concat(u,l):[l]}return{exports:t,options:h}}var O=B(W,R,$,!1,null,"3930be62",null),U=O.exports,N={name:"PhotoAlbumView",components:{Flipbook:F,BookCatalogueDrawer:U},props:{pages:{type:Array,default:()=>[]},bookId:{type:String,default:""},startPage:{type:Number,default:1},catalogue:{type:Array,default:()=>[]},catalogueLoading:{type:Boolean,default:!1}},data(){return{currentPage:1,flag:!0,isMobile:!1,booksData:null,loading:!1,error:null,showSuccessToast:!1,contentReady:!1,zoomScale:1,translateX:0,translateY:0,lastTouchDistance:0,lastTouchCenter:{x:0,y:0},isZooming:!1,isPanning:!1,touchStartTime:0,initialTouches:[],flipbookTouchStartTime:0,flipbookLastTapTime:0,showCatalogueDrawer:!1,catalogueButtonDragging:!1,catalogueButtonPosition:{x:20,y:20},dragStartPosition:{x:0,y:0},dragOffset:{x:0,y:0},flipMode:"flip",showFlipModeMenu:!1,flipModes:[{value:"flip",label:"仿真翻页",icon:"📖"},{value:"slide",label:"滑动翻页",icon:"↔️"},{value:"fade",label:"淡入淡出",icon:"✨"},{value:"scroll",label:"垂直滚动",icon:"📜"},{value:"clip",label:"截断特效",icon:"✂️"},{value:"card",label:"卡片风格",icon:"🃏"}],slideStartX:0,slideCurrentX:0,slideIsDragging:!1,flipModeFromUrl:!1,showControls:!1,hideControlsTimer:null,jumpPageInput:""}},computed:{totalPages(){return this.pages.length},pagesHiRes(){return this.pages},flipModeIcon(){const t=this.flipModes.find(t=>t.value===this.flipMode);return t?t.icon:"📖"},flipModeLabel(){const t=this.flipModes.find(t=>t.value===this.flipMode);return t?t.label:"仿真翻页"},slideContainerStyle(){const t=100*-(this.currentPage-1),e=this.slideIsDragging?(this.slideCurrentX-this.slideStartX)/5:0;return{transform:`translateX(calc(${t}% + ${e}px))`,transition:this.slideIsDragging?"none":"transform 0.3s ease-out"}},showFlipModeSelector(){return!this.flipModeFromUrl},visibleCards(){const t=[];return this.currentPage>1&&t.push({src:this.pages[this.currentPage-2],originalIndex:this.currentPage-2,position:"prev"}),t.push({src:this.pages[this.currentPage-1],originalIndex:this.currentPage-1,position:"current"}),this.currentPage<this.totalPages&&t.push({src:this.pages[this.currentPage],originalIndex:this.currentPage,position:"next"}),t},pageDisplayText(){return 0===this.totalPages?"加载中...":1===this.currentPage&&this.totalPages>1?"封面":this.currentPage===this.totalPages&&this.totalPages>1?"封底":this.isMobile?this.totalPages<=2?`第 ${this.currentPage} 页 / 共 ${this.totalPages} 页`:`第 ${Math.max(1,this.currentPage-1)} 页 / 共 ${Math.max(0,this.totalPages-2)} 页`:this.totalPages<=2?`第 ${this.currentPage} 页 / 共 ${this.totalPages} 页`:`第 ${Math.ceil((this.currentPage-1)/2)} 组 / 共 ${Math.ceil((this.totalPages-2)/2)} 组`}},methods:{async fetchBooksData(){try{this.loading=!0,this.error=null,this.$emit("fetch-books-data",this.bookId),this.pages&&this.pages.length>0&&(this.booksData={data:{records:this.pages.map(t=>({imageUrl:t}))}},this.showSuccessToast=!0,setTimeout(()=>{this.showSuccessToast=!1},3e3),this.checkUrlPageParameter())}catch(t){console.error("获取书籍数据失败:",t),this.error=t,t.response?console.error("API错误响应:",t.response.data):t.request?console.error("网络请求失败:",t.request):console.error("请求配置错误:",t.message)}finally{this.loading=!1}},updatePagesFromApiData(t){if(!Array.isArray(t))return void console.warn("API数据格式不正确,期望数组格式");console.log("开始更新页面数据,数据长度:",t.length);const e=[null];t.forEach((t,i)=>{t.imageUrl&&(e.push(t.imageUrl),console.log(`添加页面 ${i+1}:`,t.imageUrl))}),e.length>1&&(this.pages=e,console.log("页面数据更新完成,总页数:",this.pages.length))},detectMobile(){const t=navigator.userAgent.toLowerCase(),e=["mobile","android","iphone","ipad","ipod","blackberry","windows phone"],i=e.some(e=>t.includes(e)),o=window.innerWidth<=768,s="ontouchstart"in window||navigator.maxTouchPoints>0;this.isMobile=i||o&&s,console.log("设备检测结果:",{userAgent:i,screenSize:o,touchSupport:s,finalResult:this.isMobile})},async preloadFirstPage(){if(!this.pages||0===this.pages.length)return void(this.contentReady=!0);const t=this.startPage-1,e=this.pages[t];if(e)try{await new Promise((t,i)=>{const o=new Image;o.onload=()=>t(),o.onerror=()=>t(),o.src=e,setTimeout(()=>t(),3e3)})}catch(i){console.warn("首页图片预加载失败:",i)}finally{this.contentReady=!0}else this.contentReady=!0},handleResize(){const t=this.isMobile;this.detectMobile(),t!==this.isMobile&&(console.log("设备类型变化,重新初始化"),this.$nextTick(()=>{this.$refs.flipbook&&(this.currentPage=1,this.startPage=1)}))},flipLeft(){if(console.log("尝试向左翻页,当前页:",this.currentPage),"flip"===this.flipMode)if(this.$refs.flipbook&&this.currentPage>1)try{this.$refs.flipbook.flipLeft(),console.log("向左翻页命令已发送")}catch(t){console.error("向左翻页失败:",t)}else console.log("无法向左翻页 - 已在第一页或组件未就绪");else this.currentPage>1&&(this.currentPage--,this.onFlipLeftEnd(this.currentPage))},flipRight(){if(console.log("尝试向右翻页,当前页:",this.currentPage),"flip"===this.flipMode)if(this.$refs.flipbook&&this.currentPage<this.totalPages)try{this.$refs.flipbook.flipRight(),console.log("向右翻页命令已发送")}catch(t){console.error("向右翻页失败:",t)}else console.log("无法向右翻页 - 已在最后一页或组件未就绪");else this.currentPage<this.totalPages&&(this.currentPage++,this.onFlipRightEnd(this.currentPage))},onFlipLeftEnd(t){console.log("向左翻页完成,新页面:",t),this.currentPage=t,this.$emit("page-change",t),this.recordReadingProgress(t)},onFlipRightEnd(t){console.log("向右翻页完成,新页面:",t),this.currentPage=t,this.$emit("page-change",t),this.recordReadingProgress(t)},onContainerTouchStart(t){this.touchStartTime=Date.now(),this.initialTouches=Array.from(t.touches),2===t.touches.length?(this.isZooming=!0,this.lastTouchDistance=this.getTouchDistance(t.touches[0],t.touches[1]),this.lastTouchCenter=this.getTouchCenter(t.touches[0],t.touches[1]),t.preventDefault()):1===t.touches.length&&this.zoomScale>1&&(this.isPanning=!0,this.lastTouchCenter={x:t.touches[0].clientX,y:t.touches[0].clientY})},onContainerTouchMove(t){if(this.isZooming&&2===t.touches.length){const e=this.getTouchDistance(t.touches[0],t.touches[1]),i=this.getTouchCenter(t.touches[0],t.touches[1]),o=e/this.lastTouchDistance;let s=this.zoomScale*o;s=Math.max(.5,Math.min(3,s));const a=i.x-this.lastTouchCenter.x,n=i.y-this.lastTouchCenter.y;this.zoomScale=s,this.translateX+=a,this.translateY+=n,this.lastTouchDistance=e,this.lastTouchCenter=i,t.preventDefault()}else if(this.isPanning&&1===t.touches.length&&this.zoomScale>1){const e=t.touches[0].clientX-this.lastTouchCenter.x,i=t.touches[0].clientY-this.lastTouchCenter.y;this.translateX+=e,this.translateY+=i,this.lastTouchCenter={x:t.touches[0].clientX,y:t.touches[0].clientY},t.preventDefault()}},onContainerTouchEnd(t){const e=Date.now()-this.touchStartTime,i=this.isZooming,o=this.isPanning;if(this.isZooming=!1,this.isPanning=!1,1===t.changedTouches.length&&e<300&&!i&&!o){const t=Date.now();this.lastTapTime&&t-this.lastTapTime<400?(this.resetZoom(),console.log("移动端双击重置显示比例"),this.lastTapTime=0):this.lastTapTime=t}this.constrainPosition()},getTouchDistance(t,e){const i=t.clientX-e.clientX,o=t.clientY-e.clientY;return Math.sqrt(i*i+o*o)},getTouchCenter(t,e){return{x:(t.clientX+e.clientX)/2,y:(t.clientY+e.clientY)/2}},resetZoom(){this.zoomScale=1,this.translateX=0,this.translateY=0},zoomIn(){this.zoomScale=Math.min(3,this.zoomScale+.2)},zoomOut(){this.zoomScale=Math.max(.5,this.zoomScale-.2)},onContainerDoubleClick(t){t.preventDefault(),t.stopPropagation(),this.resetZoom(),console.log("容器双击重置显示比例,当前缩放:",this.zoomScale)},onFlipbookDoubleClick(t){t.preventDefault(),t.stopPropagation(),this.resetZoom(),console.log("Flipbook双击重置显示比例,当前缩放:",this.zoomScale)},onFlipbookTouchStart(t){this.flipbookTouchStartTime=Date.now()},onFlipbookTouchEnd(t){const e=Date.now()-this.flipbookTouchStartTime;if(1===t.changedTouches.length&&e<300){const e=Date.now();this.flipbookLastTapTime&&e-this.flipbookLastTapTime<400?(t.preventDefault(),t.stopPropagation(),this.resetZoom(),console.log("Flipbook区域移动端双击重置显示比例"),this.flipbookLastTapTime=0):this.flipbookLastTapTime=e}},constrainPosition(){if(this.zoomScale<=1)return this.translateX=0,void(this.translateY=0);const t=200*(this.zoomScale-1);this.translateX=Math.max(-t,Math.min(t,this.translateX)),this.translateY=Math.max(-t,Math.min(t,this.translateY))},openCatalogue(){console.log("点击目录按钮",{dragging:this.catalogueButtonDragging,showDrawer:this.showCatalogueDrawer}),this.catalogueButtonDragging?console.log("拖拽状态中,不打开目录"):(this.showCatalogueDrawer=!0,console.log("目录抽屉已打开"))},onCatalogueMouseDown(t){this.catalogueButtonDragging=!1;const e=t.target.closest(".catalogue-button").getBoundingClientRect();this.dragStartPosition={x:t.clientX,y:t.clientY},this.dragOffset={x:t.clientX-e.left,y:t.clientY-e.top},document.addEventListener("mousemove",this.onCatalogueMouseMove),document.addEventListener("mouseup",this.onCatalogueMouseUp)},onCatalogueMouseMove(t){const e=Math.sqrt(Math.pow(t.clientX-this.dragStartPosition.x,2)+Math.pow(t.clientY-this.dragStartPosition.y,2));if(e>5&&(this.catalogueButtonDragging=!0),!this.catalogueButtonDragging)return;t.preventDefault();const i=t.clientX-this.dragOffset.x,o=t.clientY-this.dragOffset.y,s=window.innerWidth-120,a=window.innerHeight-50;this.catalogueButtonPosition={x:Math.max(0,Math.min(s,i)),y:Math.max(0,Math.min(a,o))}},onCatalogueMouseUp(t){this.catalogueButtonDragging=!1,document.removeEventListener("mousemove",this.onCatalogueMouseMove),document.removeEventListener("mouseup",this.onCatalogueMouseUp)},onCatalogueTouchStart(t){this.catalogueButtonDragging=!1;const e=t.touches[0],i=t.target.closest(".catalogue-button").getBoundingClientRect();this.dragStartPosition={x:e.clientX,y:e.clientY},this.dragOffset={x:e.clientX-i.left,y:e.clientY-i.top}},onCatalogueTouchMove(t){const e=t.touches[0],i=Math.sqrt(Math.pow(e.clientX-this.dragStartPosition.x,2)+Math.pow(e.clientY-this.dragStartPosition.y,2));if(i>5&&(this.catalogueButtonDragging=!0),!this.catalogueButtonDragging)return;t.preventDefault();const o=e.clientX-this.dragOffset.x,s=e.clientY-this.dragOffset.y,a=window.innerWidth-120,n=window.innerHeight-80;this.catalogueButtonPosition={x:Math.max(15,Math.min(a,o)),y:Math.max(15,Math.min(n,s))}},onCatalogueTouchEnd(t){this.catalogueButtonDragging=!1},toggleFlipModeMenu(){this.showFlipModeMenu=!this.showFlipModeMenu},selectFlipMode(t){const e=this.flipMode;this.flipMode=t,this.showFlipModeMenu=!1,localStorage.setItem("book-viewer-flip-mode",t),console.log("切换翻页模式:",{from:e,to:t}),"scroll"===t&&this.$nextTick(()=>{this.scrollToCurrentPage()})},onSlideViewerTouchStart(t){1===t.touches.length&&(this.slideStartX=t.touches[0].clientX,this.slideCurrentX=t.touches[0].clientX,this.slideIsDragging=!0)},onSlideViewerTouchMove(t){this.slideIsDragging&&1===t.touches.length&&(this.slideCurrentX=t.touches[0].clientX,t.preventDefault())},onSlideViewerTouchEnd(t){if(this.slideIsDragging){const t=this.slideCurrentX-this.slideStartX,e=50;t>e&&this.currentPage>1?(this.currentPage--,this.recordReadingProgress(this.currentPage)):t<-e&&this.currentPage<this.totalPages&&(this.currentPage++,this.recordReadingProgress(this.currentPage)),this.slideIsDragging=!1}},onScrollViewerScroll(t){const e=this.$refs.scrollViewer;if(!e)return;const i=e.scrollTop,o=e.clientHeight;for(let s=0;s<this.pages.length;s++){const t=this.$refs["scrollPage"+s];if(t&&t[0]){const e=t[0].offsetTop,a=e+t[0].offsetHeight;if(i>=e-o/2&&i<a-o/2){this.currentPage!==s+1&&(this.currentPage=s+1,this.recordReadingProgress(this.currentPage));break}}}},scrollToCurrentPage(){if("scroll"!==this.flipMode)return;const t=this.$refs["scrollPage"+(this.currentPage-1)];t&&t[0]&&t[0].scrollIntoView({behavior:"smooth",block:"start"})},closeFlipModeMenu(t){t.target.closest(".flip-mode-selector")||(this.showFlipModeMenu=!1)},getCardStyle(t){switch(t){case"prev":return{transform:"translateX(-70%) scale(0.85) rotateY(15deg)",zIndex:1,opacity:.6,filter:"brightness(0.8)"};case"current":return{transform:"translateX(0) scale(1) rotateY(0deg)",zIndex:3,opacity:1,filter:"brightness(1)"};case"next":return{transform:"translateX(70%) scale(0.85) rotateY(-15deg)",zIndex:1,opacity:.6,filter:"brightness(0.8)"};default:return{}}},onCatalogueClick(t){console.log("目录项被点击:",t),this.$emit("catalogue-click",t)},onFetchCatalogue(t){this.$emit("fetch-catalogue",t)},onFocus(){"flip"===this.flipMode?(this.flag=!1,setTimeout(()=>{this.flag=!0},500)):"scroll"===this.flipMode&&this.scrollToCurrentPage()},onPageJump(t){console.log("跳转到页面:",t),this.showCatalogueDrawer=!1,t&&t>=1&&t<=this.totalPages?(this.currentPage=t,this.startPage=t,this.recordReadingProgress(t),"flip"===this.flipMode?(this.flag=!1,setTimeout(()=>{this.flag=!0,this.$nextTick(()=>{this.$refs.flipbook.goToPage(t)})},500)):"scroll"===this.flipMode&&this.scrollToCurrentPage()):console.warn("无效的页码:",t)},checkUrlPageParameter(){const t=this.$route.query.page;if(t){const e=parseInt(t,10);console.log("检测到URL页码参数:",{pageParam:t,targetPage:e,totalPages:this.totalPages}),!isNaN(e)&&e>=1&&e<=this.totalPages?(console.log("准备跳转到页码:",e),this.$nextTick(()=>{this.jumpToPage(e)})):console.warn("无效的页码参数:",{pageParam:t,targetPage:e,totalPages:this.totalPages,isValid:!isNaN(e)&&e>=1&&e<=this.totalPages})}else console.log("URL中未检测到页码参数")},jumpToPage(t){if(!t||t<1||t>this.totalPages)console.warn("无效的页码:",t);else if(console.log("跳转到页面:",t),this.currentPage=t,this.startPage=t,this.recordReadingProgress(t),"flip"===this.flipMode)if(this.$refs.flipbook&&this.$refs.flipbook.goToPage)try{this.$refs.flipbook.goToPage(t),console.log("页面跳转成功:",t)}catch(e){console.error("页面跳转失败:",e)}else console.warn("Flipbook组件未就绪,无法跳转页面");else"scroll"===this.flipMode&&this.scrollToCurrentPage()},async recordReadingProgress(t){if(this.bookId&&t)try{console.log("记录阅读进度:",{bookId:this.bookId,pageNumber:t}),this.$emit("record-progress",{bookId:this.bookId,pageNumber:t}),console.log("阅读进度记录成功")}catch(e){console.error("记录阅读进度失败:",e)}else console.warn("缺少书籍ID或页码,无法记录阅读进度")},showControlsTemporarily(){this.showControls=!0,this.hideControlsTimer&&clearTimeout(this.hideControlsTimer),this.hideControlsTimer=setTimeout(()=>{this.showControls=!1},3e3)},onContentClick(){this.showControlsTemporarily()},handlePageInput(t){const e=t.target.value,i=e.replace(/[^\d]/g,"");i&&parseInt(i)>this.totalPages?this.jumpPageInput=this.totalPages.toString():this.jumpPageInput=i},handleJumpToPage(){const t=parseInt(this.jumpPageInput);t&&t>=1&&t<=this.totalPages&&(this.resetZoom(),this.jumpToPage(t),this.jumpPageInput="")}},watch:{async pages(t){t&&t.length>0&&this.isMobile?(this.contentReady=!1,await this.$nextTick(),await this.preloadFirstPage()):t&&t.length>0&&(this.contentReady=!0)}},async mounted(){console.log("组件已挂载,总页数:",this.totalPages),this.detectMobile();const t=this.$route.query.mode||this.$route.query.flipMode;if(t&&this.flipModes.some(e=>e.value===t))this.flipMode=t,this.flipModeFromUrl=!0,console.log("从URL参数读取翻页模式:",t);else{const t=localStorage.getItem("book-viewer-flip-mode");t&&this.flipModes.some(e=>e.value===t)&&(this.flipMode=t)}this.isMobile&&this.pages&&this.pages.length>0?(await this.$nextTick(),await this.preloadFirstPage()):this.pages&&this.pages.length>0&&(this.contentReady=!0),window.addEventListener("resize",this.handleResize),document.addEventListener("click",this.closeFlipModeMenu)},beforeDestroy(){window.removeEventListener("resize",this.handleResize),document.removeEventListener("mousemove",this.onCatalogueMouseMove),document.removeEventListener("mouseup",this.onCatalogueMouseUp),document.removeEventListener("click",this.closeFlipModeMenu),this.hideControlsTimer&&clearTimeout(this.hideControlsTimer)}},A=N,H=B(A,s,a,!1,null,"4702ca70",null),j=H.exports;const Y={BookReader:j,BookCatalogueDrawer:U},Z=function(t){Z.installed||(Z.installed=!0,Object.keys(Y).forEach(e=>{t.component(e,Y[e])}))};"undefined"!==typeof window&&window.Vue&&Z(window.Vue);var V={install:Z,BookReader:j,BookCatalogueDrawer:U},q=V;return e}()});
|
|
32
32
|
//# sourceMappingURL=vue-book-reader.umd.min.js.map
|