This is a custom module which works with the Above All template for the twelvetribes.org website.
+ The module displays two different modals (popups): Info and Flipbook. Info displays the body text of the
+ Publication, along with its image and title. The Flipbook displays a browsable 3D view of the PDF.
+
+ The module works best by creating a view of Publications. Add fields to the views, and exclude them (make them hidden).
+ Then, create a visible "Global: Custom Text" and put this in the text:
+
+ The classes and structure are important. They work together with the other files to load new text into the receiver element.
+
Fields
+
+
field_image is a thumbnail of the Publication.
+
title is the title of the publication.
+
created is the date of publication.
+
body is the body of the publication containing text about the publication.
+
field_pdf is a FileField that contains the URL to File of the publication.
+
+
Data Attributes
+ Within the Button tags are several data attributes, which are used to pass data to the javascript functions.
+
+
data-action
+
+
freepaper-info : Tells this button to open the Info modal.
+
freepaper-flipbook : Tells this button to open the Flipbook modal.
+
+
+
data-body : For Info modals, this contains the body of the Publication node to display.
+
data-pdf : For Flipbook modals, this contains the filename of the PDF.
+
+
Receiver
+ Within each div.pub__container, outside of all other elements but within the DIV, you must have a div.receiver. The module trader_will
+ fill that DIV tag with new content to create the modal.
+
+
+
Files
+
+
info-modal.html : template for the info modal that gets loaded into the receiver.
+
flipbook-modal.html : template for the flipbook modal that gets loaded into the receiver.
+
modules/custom/freepaper/js/freepaper-actions.js : scripts to load the receiver
+
modules/custom/freepaper : the location of the modules, its dependencies, and the module.
+
+
- Mevaser
+ ');
+ }
+}
+
+function freepaper_preprocess_page(&$variables){
+ // Drupal 8-9
+ // global $base_url;
+ // $host = $base_url;
+ // $variables['#attached']['drupalSettings']['modulepath'] = drupal_get_path('module', 'freepaper');
+ // $variables['#attached']['drupalSettings']['host'] = $host;
+ // // $variables['#attached']['library'][] = 'freepaper/flipbook'; We will attach it in the twig template
+
+ // DRUPAL 10
+ $host = Url::fromRoute('', [], ['absolute' => TRUE])->toString();
+ $extension_path_resolver = Drupal::service('extension.path.resolver');
+ $module_path = $extension_path_resolver->getPath('module', 'freepaper');
+ $variables['#attached']['drupalSettings']['modulepath'] = $module_path;
+ $variables['#attached']['drupalSettings']['host'] = $host;
+}
diff --git a/images/dark-loader.gif b/images/dark-loader.gif
new file mode 100644
index 0000000..5b22245
Binary files /dev/null and b/images/dark-loader.gif differ
diff --git a/images/inverse-texture.jpg b/images/inverse-texture.jpg
new file mode 100644
index 0000000..5299449
Binary files /dev/null and b/images/inverse-texture.jpg differ
diff --git a/images/light-loader.gif b/images/light-loader.gif
new file mode 100644
index 0000000..6fae678
Binary files /dev/null and b/images/light-loader.gif differ
diff --git a/images/loading.gif b/images/loading.gif
new file mode 100644
index 0000000..98912a6
Binary files /dev/null and b/images/loading.gif differ
diff --git a/images/loading_1.gif b/images/loading_1.gif
new file mode 100644
index 0000000..216f4ab
Binary files /dev/null and b/images/loading_1.gif differ
diff --git a/images/paper.jpg b/images/paper.jpg
new file mode 100644
index 0000000..0566312
Binary files /dev/null and b/images/paper.jpg differ
diff --git a/images/paper.png b/images/paper.png
new file mode 100644
index 0000000..03f39ea
Binary files /dev/null and b/images/paper.png differ
diff --git a/images/texture.jpg b/images/texture.jpg
new file mode 100644
index 0000000..cb4c591
Binary files /dev/null and b/images/texture.jpg differ
diff --git a/js/3dflipbook.min.js b/js/3dflipbook.min.js
new file mode 100644
index 0000000..5a2b9d0
--- /dev/null
+++ b/js/3dflipbook.min.js
@@ -0,0 +1,17 @@
+var pathr = drupalSettings.host + "/" + drupalSettings.modulepath;
+!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=72)}([function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0;var _$=window.jQuery,_html2canvas=window.html2canvas,_THREE=window.THREE,_React=window.React,_ReactDOM=window.ReactDOM,_PDFJS=window.PDFJS,_tr=function(s){return(window.iberezansky||{}).tr&&window.iberezansky.tr(s)||s};exports.$=_$,exports.html2canvas=_html2canvas,exports.THREE=_THREE,exports.React=_React,exports.ReactDOM=_ReactDOM,exports.PDFJS=_PDFJS,exports.tr=_tr},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0;var _$=window.jQuery,_html2canvas=window.html2canvas,_THREE=window.THREE,_PDFJS=window.PDFJS;exports.$=_$,exports.html2canvas=_html2canvas,exports.THREE=_THREE,exports.PDFJS=_PDFJS},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var BaseMathUtils=function(){function BaseMathUtils(){_classCallCheck(this,BaseMathUtils)}return BaseMathUtils.sum1=function(ka,a,kb,b){return[ka*a[0]+kb*b[0]]},BaseMathUtils.sum2=function(ka,a,kb,b){return[ka*a[0]+kb*b[0],ka*a[1]+kb*b[1]]},BaseMathUtils.sum3=function(ka,a,kb,b){return[ka*a[0]+kb*b[0],ka*a[1]+kb*b[1],ka*a[2]+kb*b[2]]},BaseMathUtils.sum4=function(ka,a,kb,b){return[ka*a[0]+kb*b[0],ka*a[1]+kb*b[1],ka*a[2]+kb*b[2],ka*a[3]+kb*b[3]]},BaseMathUtils.rk4=function(dy,t,dt,y){var sum=arguments.length>4&&void 0!==arguments[4]?arguments[4]:BaseMathUtils.sum[y.length-1],k1=dy(t,y),k2=dy(t+dt/2,sum(1,y,dt/2,k1)),k3=dy(t+dt/2,sum(1,y,dt/2,k2)),k4=dy(t+dt,sum(1,y,dt,k3));return sum(1,y,dt/6,sum(1,sum(1,k1,2,k2),1,sum(2,k3,1,k4)))},BaseMathUtils.extrapolateLinear=function(x,y,xi){return y[0]+(y[1]-y[0])/(x[1]-x[0])*(xi-x[0])},BaseMathUtils.interpolateLinear=function(x,y,xi){var yi=void 0;return x[0]>x[1]&&(x=x.reverse(),y=y.reverse()),yi=xix[1]?y[1]:BaseMathUtils.extrapolateLinear(x,y,xi)},BaseMathUtils.calcScale=function(srcW,srcH,dstW,dstH){return Math.min(dstW/srcW,dstH/srcH)},BaseMathUtils.mulM=function(a,b){for(var r=[],i=0;i=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var x=_ref;s+=x}return s/data.length},BaseMathUtils.disp=function(data){for(var M=BaseMathUtils.mat(data),s=0,_iterator2=data,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var x=_ref2;s+=(x-M)*(x-M)}return s/data.length},BaseMathUtils.predict=function(data,num){var r=[],l=data.length,D=BaseMathUtils.disp(data);if(D1){for(var am=[],bm=[],i=0;iBaseMathUtils.eps){var dx=BaseMathUtils.det2(b1,a1[1],b2,a2[1]),dy=BaseMathUtils.det2(a1[0],b1,a2[0],b2);res={x:dx/d,y:dy/d}}return res},BaseMathUtils.isInsidePoly=function(ps,p){for(var done=!1,ct=void 0,i=0;iMath.min(p0.x,p1.x)-BaseMathUtils.eps&&ip.xMath.min(p0.y,p1.y)-BaseMathUtils.eps&&ip.y0}}}}return ct%2},BaseMathUtils.isInsideConvPoly=function(ps,p){for(var sg=[0,0],i=0;i1;){var mid=Math.floor((l+h)/2);cmp(x,a[mid])<0?h=mid:l=mid}return cmp(x,a[h])>=0?h:l},Utils}();exports.default=Utils},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),_GraphUtils=__webpack_require__(7),_GraphUtils2=_interopRequireDefault(_GraphUtils),ImageBase=function(){function ImageBase(context,width,height,color){_classCallCheck(this,ImageBase),this.context=context,this.wnd=context.wnd,this.doc=context.doc,this.element=context.element||context.doc.body,this.c=context.renderCanvas||ImageBase.renderCanvas,this.ctx=context.renderCanvasCtx||ImageBase.renderCanvasCtx,this.resW=this.width=width,this.resH=this.height=height,this.color=color}return ImageBase.prototype.dispose=function(){},ImageBase.prototype.renderBlankPage=function(){this.ctx.beginPath(),this.ctx.fillStyle=_GraphUtils2.default.color2Rgba(this.color,1),this.ctx.rect(0,0,this.c.width,this.c.height),this.ctx.fill()},ImageBase.prototype.renderImage=function(image){this.pushCtx(),this.ctx.drawImage(image,0,0),this.popCtx()},ImageBase.prototype.normToConv=function(p){return{x:p.x*this.c.width,y:(1-p.y)*this.c.height}},ImageBase.prototype.renderHit=function(poly){var ctx=this.ctx;ctx.fillStyle="rgba(255,255,0,0.4)",ctx.beginPath();var p=this.normToConv(poly[0]);ctx.moveTo(p.x,p.y);for(var i=1;i")[0],ImageBase.renderCanvasCtx=ImageBase.renderCanvas.getContext("2d"),exports.default=ImageBase},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i>16&255,color>>8&255,255&color]},GraphUtils.inverseColor=function(color){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,bs=GraphUtils.getColorBytes(color),ibs=[255-bs[0],255-bs[1],255-bs[2]],nbs=[Math.round(GraphUtils.interpolate01(bs[0],ibs[0],t)),Math.round(GraphUtils.interpolate01(bs[1],ibs[1],t)),Math.round(GraphUtils.interpolate01(bs[2],ibs[2],t))];return GraphUtils.bytes2Color(nbs)},GraphUtils.color2Rgba=function(color,a){return GraphUtils.bytes2Rgba(GraphUtils.getColorBytes(color),a)},GraphUtils.bytes2Rgba=function(bs,a){return"rgba("+bs.join(",")+","+a+")"},GraphUtils.bytes2Color=function(bs){return bs[2]|bs[1]<<8|bs[0]<<16},GraphUtils}();exports.default=GraphUtils},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _Cache=__webpack_require__(14),_Cache2=_interopRequireDefault(_Cache),_BlankImage=__webpack_require__(44),_BlankImage2=_interopRequireDefault(_BlankImage),_StaticImage=__webpack_require__(59),_StaticImage2=_interopRequireDefault(_StaticImage),_PdfImage=__webpack_require__(57),_PdfImage2=_interopRequireDefault(_PdfImage),_InteractiveImage=__webpack_require__(51),_InteractiveImage2=_interopRequireDefault(_InteractiveImage),ImageFactory=function(){function ImageFactory(context,cache){_classCallCheck(this,ImageFactory),this.context=context,this.cache=cache||new _Cache2.default}return ImageFactory.prototype.build=function(info){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,widthTexels=arguments.length>2&&void 0!==arguments[2]?arguments[2]:210,heightTexels=arguments.length>3&&void 0!==arguments[3]?arguments[3]:297,color=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16777215,injector=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0,image=void 0;switch(info.type){case"html":image=new _InteractiveImage2.default(this.context,widthTexels,heightTexels,color,info.src,this.cache,injector);break;case"image":image=new _StaticImage2.default(this.context,widthTexels,heightTexels,color,info.src);break;case"pdf":image=new _PdfImage2.default(this.context,widthTexels,heightTexels,color,info.src,n);break;case"blank":default:image=new _BlankImage2.default(this.context,widthTexels,heightTexels,color)}return image},ImageFactory}();exports.default=ImageFactory},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i4&&void 0!==arguments[4]?arguments[4]:0,_this=this,state=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"closed",height=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;_classCallCheck(this,SheetBlock),this.visual=visual,this.p=_extends({},p,{first:first,last:last});var props=this.getProps(),loadedPoints=this.loadPoints();Object.keys(loadedPoints).map(function(k){_this[k]=loadedPoints[k][props.shape]||loadedPoints[k][0]}),this.pSpline=new _libs.THREE.Spline([]);for(var i=0;i=_iterator.length)break;_ref=_iterator[_i2++]}else{if(_i2=_iterator.next(),_i2.done)break;_ref=_i2.value}var _i3=_ref,marker=_ThreeUtils2.default.createMarker(this.geometry.vertices[_i3],_i3=_iterator2.length)break;_ref2=_iterator2[_i4++]}else{if(_i4=_iterator2.next(),_i4.done)break;_ref2=_i4.value}var m=_ref2;m.map&&(m.map=null,m.needsUpdate=!0),m.dispose()}delete this.materials,this.geometry.dispose()},SheetBlock.prototype.getSize=function(){return this.p.last-this.p.first},SheetBlock.prototype.getProps=function(){return _extends({},this.p.page,{sheets:this.p.sheets})},SheetBlock.prototype.getTopCerners=function(){var off=this.angle>Math.PI/2?this.geometry.vertices.length/2:0;return[this.geometry.vertices[off],this.geometry.vertices[_sheetBlock2.default.resX-1+off],this.geometry.vertices[(_sheetBlock2.default.resZ-1)*_sheetBlock2.default.resX+off],this.geometry.vertices[_sheetBlock2.default.resZ*_sheetBlock2.default.resX-1+off]]},SheetBlock.prototype.getTopSize=function(){var vs=this.getTopCerners();return{width:vs[0].distanceTo(vs[1]),height:vs[0].distanceTo(vs[2])}},SheetBlock.prototype.getTopWorldRotation=function(q){return q.x=-Math.PI/2,q},SheetBlock.prototype.getTopWorldPosition=function(v){var l=this.geometry.vertices.length,off=this.angle>Math.PI/2?l/2:0,vs=[this.geometry.vertices[off],this.geometry.vertices[_sheetBlock2.default.resX-1+off],this.geometry.vertices[(_sheetBlock2.default.resZ-1)*_sheetBlock2.default.resX+off],this.geometry.vertices[_sheetBlock2.default.resZ*_sheetBlock2.default.resX-1+off]];v.set(0,0,0);for(var _iterator3=vs,_isArray3=Array.isArray(_iterator3),_i5=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i5>=_iterator3.length)break;_ref3=_iterator3[_i5++]}else{if(_i5=_iterator3.next(),_i5.done)break;_ref3=_i5.value}var vi=_ref3;v.x+=.25*vi.x,v.y+=.25*vi.y,v.z+=.25*vi.z}return this.three.localToWorld(v),v},SheetBlock.prototype.getInterpolationPoints=function(inds,mod){for(var ps={x:[],y:[]},K=this.getProps().wave,_iterator4=inds,_isArray4=Array.isArray(_iterator4),_i6=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){var _ref4;if(_isArray4){if(_i6>=_iterator4.length)break;_ref4=_iterator4[_i6++]}else{if(_i6=_iterator4.next(),_i6.done)break;_ref4=_i6.value}var i=_ref4;ps.x.push([].concat(this.interpolationPoints.x[i])),ps.y.push(~mod.indexOf(i)?this.interpolationPoints.y[i].map(function(n){return K*n}):[].concat(this.interpolationPoints.y[i]))}return ps},SheetBlock.prototype.set=function(angle){var state=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,height=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.corner.height,first=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.p.first,last=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.p.last,PI=Math.PI;this.state=state;var closedAngle=void 0,binderTurn=void 0;"object"===("undefined"==typeof angle?"undefined":_typeof(angle))?(this.angle=angle.openedAngle,closedAngle=angle.closedAngle,binderTurn=angle.binderTurn>PI/2?PI-angle.binderTurn:angle.binderTurn):this.angle=angle,this.corner.height=height,this.p.first===first&&this.p.last===last||(this.sideTexture.repeat.set(0,last-first),this.sideTexture.needsUpdate=!0,this.p.first!==first&&this.p.setTexture(this.materials[0],2*first),this.p.last!==last&&this.p.setTexture(this.materials[1],2*last-1)),this.p.first=first,this.p.last=last;var points=void 0,props=this.getProps();if("closed"===this.state)points=this.getInterpolationPoints(this.closedInterpolationIndeces,this.closedInterpolationIndeces);else if("opened"===this.state)if(void 0!==closedAngle&&Math.abs(closedAngle-PI/2)>.01){points=this.getInterpolationPoints(this.flatInterpolationIndeces,[]);var ps=this.getPointsAtAngle(this.getInterpolationPoints(this.closedInterpolationIndeces,this.closedInterpolationIndeces),closedAngle>PI/2?PI-closedAngle:closedAngle);points.x=[ps.x].concat(points.x),points.y=[ps.y].concat(points.y)}else points=this.getInterpolationPoints(this.openedInterpolationIndeces,this.closedInterpolationIndeces);var hl=void 0,hr=void 0,offset=.5*props.sheets*props.depth;"closed"===this.state&&(offset-=7e-6*this.p.scale),this.angle<=PI/2?(hl=(props.sheets-first)*props.depth,hr=(props.sheets-last)*props.depth):(hl=first*props.depth,hr=last*props.depth);var inAngle=this.angle>PI/2?PI-this.angle:this.angle,hAngle="closed"===this.state?inAngle:void 0===binderTurn?PI/2:binderTurn,_getPointsAtAngleAndH=this.getPointsAtAngleAndHs(points,inAngle,hAngle,[hl/props.width,hr/props.width]),left=_getPointsAtAngleAndH[0],right=_getPointsAtAngleAndH[1];this.angle>PI/2&&(this.inverse(left),this.inverse(right),offset=-offset),this.setPoints(left,right,offset)},SheetBlock.prototype.setPoints=function(left,right,offset){for(var _this2=this,p=this.getProps(),i=0,ys=[right,left],y=0;y<_sheetBlock2.default.resY;++y)for(var z=0;z<_sheetBlock2.default.resZ;++z)for(var x=0;x<_sheetBlock2.default.resX;++x)this.geometry.vertices[i++].set(ys[y].x[x]*p.width+offset,ys[y].y[x]*p.width,z*p.height/(_sheetBlock2.default.resZ-1)-.5*p.height);if(i!==this.geometry.vertices.length&&console.warn("setPoints: bad mapping!"),this.corner.use&&!this.corner.points.length){var plane=new _libs.THREE.Plane,normal=plane.normal,planeOffset=(1-this.getProps().flexibleCorner)*Math.min(p.width,p.height),proj=new _libs.THREE.Vector3;plane.setFromNormalAndCoplanarPoint(new _libs.THREE.Vector3(-1,0,-1).normalize(),new _libs.THREE.Vector3(planeOffset+offset,0,.5*p.height));for(var _i7=0,l=this.geometry.vertices.length;_i70){var d=proj.length()/planeOffset;this.corner.maxDistance=Math.max(this.corner.maxDistance,d),this.corner.points.push({vertex:_i7,distance:d})}}if(this.corner.use&&Math.abs(this.corner.height)>.001){var d2Angle=function(d){return p.cornerDeviation*_this2.corner.height/(1+Math.exp(-p.bending*(d-.5*_this2.corner.maxDistance)))};this.corner.axis.set(-1,0,1).normalize(),this.corner.axis.applyAxisAngle(this.corner.OZ,this.angle);for(var _iterator5=this.corner.points,_isArray5=Array.isArray(_iterator5),_i8=0,_iterator5=_isArray5?_iterator5:_iterator5[Symbol.iterator]();;){var _ref5;if(_isArray5){if(_i8>=_iterator5.length)break;_ref5=_iterator5[_i8++]}else{if(_i8=_iterator5.next(),_i8.done)break;_ref5=_i8.value}var point=_ref5;this.geometry.vertices[point.vertex].applyAxisAngle(this.corner.axis,d2Angle(point.distance))}}for(var _iterator6=this.markers,_isArray6=Array.isArray(_iterator6),_i9=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){var _ref6;if(_isArray6){if(_i9>=_iterator6.length)break;_ref6=_iterator6[_i9++]}else{if(_i9=_iterator6.next(),_i9.done)break;_ref6=_i9.value}var m=_ref6;m.marker.position.copy(this.geometry.vertices[m.vertex])}this.geometry.computeVertexNormals(),this.geometry.computeBoundingSphere(),this.geometry.verticesNeedUpdate=!0,this.markup&&this.markup.computeVertices()},SheetBlock.prototype.inverse=function(ps){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:void 0;_classCallCheck(this,CSS3DObject);var _this=_possibleConstructorReturn(this,_THREE$Object3D.call(this));return element&&_this.set(element),_this}return _inherits(CSS3DObject,_THREE$Object3D),CSS3DObject.prototype.set=function(element){this.element=element,this.element.style.position="absolute",this.addEventListener("removed",function(){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)})},CSS3DObject}(_libs.THREE.Object3D),_libs.THREE.CSS3DSprite=function(_THREE$CSS3DObject){function CSS3DSprite(element){return _classCallCheck(this,CSS3DSprite),_possibleConstructorReturn(this,_THREE$CSS3DObject.call(this,element))}return _inherits(CSS3DSprite,_THREE$CSS3DObject),CSS3DSprite}(_libs.THREE.CSS3DObject),_libs.THREE.CSS3DRenderer=function CSS3DRenderer(){function epsilon(value){return Math.abs(value)<1e-10?0:value}function getCameraCSSMatrix(matrix){var elements=matrix.elements;return"matrix3d("+epsilon(elements[0])+","+epsilon(-elements[1])+","+epsilon(elements[2])+","+epsilon(elements[3])+","+epsilon(elements[4])+","+epsilon(-elements[5])+","+epsilon(elements[6])+","+epsilon(elements[7])+","+epsilon(elements[8])+","+epsilon(-elements[9])+","+epsilon(elements[10])+","+epsilon(elements[11])+","+epsilon(elements[12])+","+epsilon(-elements[13])+","+epsilon(elements[14])+","+epsilon(elements[15])+")"}function getObjectCSSMatrix(matrix,cameraCSSMatrix){var elements=matrix.elements,matrix3d="matrix3d("+epsilon(elements[0])+","+epsilon(elements[1])+","+epsilon(elements[2])+","+epsilon(elements[3])+","+epsilon(-elements[4])+","+epsilon(-elements[5])+","+epsilon(-elements[6])+","+epsilon(-elements[7])+","+epsilon(elements[8])+","+epsilon(elements[9])+","+epsilon(elements[10])+","+epsilon(elements[11])+","+epsilon(elements[12])+","+epsilon(elements[13])+","+epsilon(elements[14])+","+epsilon(elements[15])+")";return isIE?"translate(-50%,-50%)translate("+_widthHalf+"px,"+_heightHalf+"px)"+cameraCSSMatrix+matrix3d:"translate(-50%,-50%)"+matrix3d}function renderObject(object,camera,cameraCSSMatrix){if(object instanceof _libs.THREE.CSS3DObject){var style;object instanceof _libs.THREE.CSS3DSprite?(matrix.copy(camera.matrixWorldInverse),matrix.transpose(),matrix.copyPosition(object.matrixWorld),matrix.scale(object.scale),matrix.elements[3]=0,matrix.elements[7]=0,matrix.elements[11]=0,matrix.elements[15]=1,style=getObjectCSSMatrix(matrix,cameraCSSMatrix)):style=getObjectCSSMatrix(object.matrixWorld,cameraCSSMatrix);var element=object.element,cachedStyle=cache.objects[object.id]&&cache.objects[object.id].style;void 0!==cachedStyle&&cachedStyle===style||(element.style.WebkitTransform=style,element.style.MozTransform=style,element.style.transform=style,cache.objects[object.id]={style:style},isIE&&(cache.objects[object.id].distanceToCameraSquared=getDistanceToSquared(camera,object))),element.parentNode!==cameraElement&&cameraElement.appendChild(element)}for(var i=0,l=object.children.length;i2&&void 0!==arguments[2]?arguments[2]:1024;_classCallCheck(this,CSSLayer);var _this=_possibleConstructorReturn(this,_CSS3DObject.call(this));_this.jContainer=(0,_libs.$)('');var heightPxs=height/width*widthPxs;return _this.jContainer.width(widthPxs).height(heightPxs),_this.scale.x/=widthPxs/width,_this.scale.y/=widthPxs/width,_this.setData(),_this.set(_this.jContainer[0]),_this}return _inherits(CSSLayer,_CSS3DObject),CSSLayer.init=function(doc){var delay=arguments.length>1&&void 0!==arguments[1]?arguments[1]:150;CSSLayer.delay=delay,CSSLayer.style=(0,_libs.$)("").appendTo(doc.head)},CSSLayer.dispose=function(){CSSLayer.style.remove()},CSSLayer.prototype.callInternal=function(name){if(this.object&&this.object[name])try{this.object[name]()}catch(e){console.error(e)}},CSSLayer.prototype.dispose=function(){this.clearInternals()},CSSLayer.prototype.clearInternals=function(){this.callInternal("dispose"),!this.css||this.css.remove(),!this.html||this.html.remove()},CSSLayer.prototype.setData=function setData(){var css=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",html=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",js=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.clearInternals(),this.css=(0,_libs.$)('").appendTo(this.jContainer),this.html=(0,_libs.$)(html).appendTo(this.jContainer);var init=eval(js);init&&(this.object=init(this.jContainer)||{})},CSSLayer.prototype.pendedCall=function(clb){var _this2=this,timestamp=this.timestamp=Date.now();setTimeout(function(){timestamp===_this2.timestamp&&clb()},CSSLayer.delay)},CSSLayer.prototype.isHidden=function(){return this.jContainer.hasClass("hidden")},CSSLayer.prototype.hide=function(){var _this3=this,res=void 0;return this.isHidden()?res=Promise.resolve():(this.jContainer.addClass("hidden"),this.callInternal("hide"),res=new Promise(function(resolve){_this3.pendedCall(function(){_this3.callInternal("hidden"),resolve()})})),res},CSSLayer.prototype.show=function(){var _this4=this,res=void 0;return this.isHidden()?(this.jContainer.removeClass("hidden"),this.callInternal("show"),res=new Promise(function(resolve){_this4.pendedCall(function(){_this4.callInternal("shown"),resolve()})})):res=Promise.resolve(),res},CSSLayer}(_CSS3DRenderer.CSS3DObject);exports.default=CSSLayer},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var Cache=function(){function Cache(){var maxSize=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1/0,sizeof=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cache.countSizeof;_classCallCheck(this,Cache),this.os=new Map,this.sizeof=sizeof,this.maxSize=maxSize,this.size=0}return Cache.prototype.forEach=function(clb){this.os.forEach(function(v,k){return clb([k,v])})},Cache.countSizeof=function(value){return 1},Cache.prototype.remove=function(k){var res=!1,v=this.os.get(k);return v.locked&&v.locked(k)||(this.size-=this.sizeof(v),v.dispose&&v.dispose(),this.os.delete(k),res=!0),res},Cache.prototype.freeSpace=function(){for(var arr=[],_iterator=this.os,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var p=_ref;arr.push({timestamp:p[1].timestamp,key:p[0]})}arr.sort(function(a,b){return a.timestamp-b.timestamp});for(var i=0;i3*this.maxSize/4;++i)this.remove(arr[i].key)},Cache.prototype.dispose=function(){for(var arr=[],_iterator2=this.os,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var p=_ref2;arr.push({v:p[1],k:p[0]})}for(var _iterator3=arr,_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var o=_ref3;o.v.dispose&&o.v.dispose(),this.os.delete(o.k)}},Cache.recursionSizeof=function(value){var size=0;if(value){++size;var len=value.length;if(void 0===len)for(var p in value)value.hasOwnProperty(p)&&(size+=Cache.recursionSizeof(value[p]));else size+=len}return size},Cache.prototype.getTimestamp=function(){return Date.now()},Cache.prototype.get=function(key){var value=this.os.get(key);return value&&(value.timestamp=this.getTimestamp()),value},Cache.prototype.put=function(key,value){return value.timestamp=this.getTimestamp(),this.os.set(key,value),this.size+=this.sizeof(value),this.size>this.maxSize&&this.freeSpace(),value},Cache}();exports.default=Cache},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),Controller=function(_THREE$EventDispatche){function Controller(){return _classCallCheck(this,Controller),_possibleConstructorReturn(this,_THREE$EventDispatche.apply(this,arguments))}return _inherits(Controller,_THREE$EventDispatche),Controller.prototype.handleDefault=function(id,e,data){},Controller.prototype.dispatchAsync=function(e){var _this2=this;Promise.resolve().then(function(){return _this2.dispatchEvent(e)})},Controller.prototype.dispose=function(){},Controller}(_libs.THREE.EventDispatcher);exports.default=Controller},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _EventConverter2=__webpack_require__(6),_EventConverter3=_interopRequireDefault(_EventConverter2),CustomEventConverter=function(_EventConverter){function CustomEventConverter(wnd,doc){var customTest=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!1},eDoc=arguments[3];_classCallCheck(this,CustomEventConverter);var _this=_possibleConstructorReturn(this,_EventConverter.call(this,wnd,doc));return _this.eDoc=eDoc,_this.customTest=customTest,_this.customs=[],_this}return _inherits(CustomEventConverter,_EventConverter),CustomEventConverter.prototype.test=function(object1,object2){return!(!object1||!object2)&&this.customTest(object1,object2)},CustomEventConverter.prototype.getCallback=function(object){return object.target.callback},CustomEventConverter.prototype.addCustom=function(custom){this.customs.push(custom)},CustomEventConverter.prototype.getObject=function(e,data){var object=void 0;if(data.doc===this.eDoc)for(var _iterator=this.customs,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var custom=_ref;if(object=custom.testIntersection(e,data))break}return object},CustomEventConverter}(_EventConverter3.default);exports.default=CustomEventConverter},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i=0;--i)if(Finder.isDelimetr(this.str[i])||0===i){f=0===i?0:i+1,--dels;break}}else for(var _i=l+2;_i100?100:cur,_this.loadingProgress(cur))}_this.progresData=data}).then(function(handler){_this.handler=handler;for(var done=Promise.resolve(handler),_loop=function(){if(_isArray){if(_i>=_iterator.length)return"break";_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)return"break";_ref=_i.value}var clb=_ref;done=done.then(function(handler){return clb(handler),handler})},_iterator=_this.handlerQueue.reverse(),_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref,_ret=_loop();if("break"===_ret)break}})}return Pdf.prototype.dispose=function(){this.handlerQueue.splice(0,this.handlerQueue.length),delete this.handler},Pdf.prototype.setLoadingProgressClb=function(clb){this.loadingProgress=clb},Pdf.prototype.getPagesNum=function(){return this.handler?this.handler.numPages:void 0},Pdf.getPageSize=function(page){return{width:page.view[2]-page.view[0],height:page.view[3]-page.view[1]}},Pdf.prototype.getHandler=function(clb){this.handler?clb(this.handler):this.handlerQueue.push(clb)},Pdf}();exports.default=Pdf},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),ThreeEventConverterFs=function(){function ThreeEventConverterFs(visualWorld){var test=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ThreeEventConverterFs.objectsAndFacesTest;_classCallCheck(this,ThreeEventConverterFs),this.visual=visualWorld,this.coords=new _libs.THREE.Vector2,this.raycaster=this.visual.raycaster,this.camera=this.visual.camera,this.threes=[],this.test=test}return ThreeEventConverterFs.objectsTest=function(object1,object2){return!(!object1||!object2)&&object1.object===object2.object},ThreeEventConverterFs.objectsAndFacesTest=function(object1,object2){return!(!object1||!object2)&&(object1.object===object2.object&&object1.face.materialIndex===object2.face.materialIndex)},ThreeEventConverterFs.prototype.addThree=function(three){this.threes.push(three)},ThreeEventConverterFs.prototype.removeThree=function(three){var i=this.threes.indexOf(three);~i&&this.threes.splice(i,1)},ThreeEventConverterFs.prototype.getObject=function(e){this.setCoordsFromEvent(e),this.raycaster.setFromCamera(this.coords,this.camera);var intersects=this.raycaster.intersectObjects(this.threes);return intersects[0]},ThreeEventConverterFs}();exports.default=ThreeEventConverterFs},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _BaseMathUtils=__webpack_require__(2),_BaseMathUtils2=_interopRequireDefault(_BaseMathUtils),ThreeUtils=function(){function ThreeUtils(){_classCallCheck(this,ThreeUtils)}return ThreeUtils.vertices2UVs=function(vertices,indeces,first,last,converClb){for(var r=[],i=first;i=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}for(var p=_ref,found=!1,i=first;i").appendTo("body"),function(){_Detector2.default.webgl?(scene.loadingCtrl=new _LoadingController2.default(scene.view,!0,function(progress){return 0===progress?"Please wait... the Application is Loading":"PDF is Loading: "+progress+"%"}),scene.visual=new _VisualWorld2.default(scene.view.getContainer().ownerDocument.defaultView,scene.view.getContainer().ownerDocument,scene.view.getView()),scene.bookBuilder=function(props,sheets,pageCallback){options.propertiesCallback&&(props=options.propertiesCallback(props)),scene.book=new _Book2.default(scene.visual,sheets,pageCallback,props),scene.bookPrinter=new _BookPrinter2.default(scene.visual,scene.book,(options.template||{}).printStyle),scene.loadingCtrl.dispose(),delete scene.loadingCtrl,scene.ctrl=new _BookController2.default(scene.book,scene.view,options.controlsProps),scene.book.setInjector(function(w){w.jQuery=w.$=_libs.$,w.book=scene.book,w.bookCtrl=scene.ctrl,props.injector&&props.injector(w)}),scene.view.addHandler(scene.ctrl),scene.ctrl.setPrinter(scene.bookPrinter);var test=pageCallback(0);scene.search=new _Search2.default(scene.view.getSearchView(),scene.book.getPages()),scene.search.onQuery=scene.book.setQuery.bind(scene.book),scene.book.addEventListener("searchResults",function(e){scene.search.setResults(e.results,e.lastPage)}),scene.thumbnails=new _Thumbnails2.default(scene.visual,scene.view.getThumbnailsView(),pageCallback,2*(sheets+2),{kWtoH:props.width/props.height}),scene.tocCtrl=new _TocController2.default(scene.view,scene.ctrl),scene.tocCtrl.setThumbnails(scene.thumbnails),scene.tocCtrl.setSearch(scene.search),scene.ctrl.setTocCtrl(scene.tocCtrl),scene.view.addHandler(scene.tocCtrl),"pdf"===test.type&&(scene.pdfLinksHandler=new _PdfLinksHandler2.default(test.src,scene.ctrl,scene.visual.element),scene.book.addEventListener("pdfAnnotation",scene.pdfLinksHandler.handleEvent.bind(scene.pdfLinksHandler)),test.src.getHandler(function(handler){handler.getOutline().then(function(outline){scene.bookmarks=new _Bookmarks2.default(scene.view.getBookmarksView(),outline),scene.tocCtrl.setBookmarks(scene.bookmarks,test.src)})}),options.pdfLinks&&options.pdfLinks.handler&&scene.pdfLinksHandler.setHandler(options.pdfLinks.handler)),scene.sounds=new _SoundsEnviroment2.default(options.template),scene.ctrl.setSounds(scene.sounds),scene.sounds.subscribeFlips(scene.ctrl),scene.ready=!0,new _AutoNavigator2.default(scene.visual,scene.ctrl,options.autoNavigation).dispose(),options.ready&&options.ready(scene),scene.pendingDispose&&scene.dispose()},options.pdf?(scene.propsBuilder=new _PdfBookPropsBuilder2.default(options.pdf,scene.bookBuilder),scene.propsBuilder.pdf.setLoadingProgressClb(scene.loadingCtrl.setProgress.bind(scene.loadingCtrl))):options.pageCallback?scene.propsBuilder=new _ClbBookPropsBuilder2.default(scene.visual,options.pageCallback,options.pages,scene.bookBuilder):scene.propsBuilder=new _ClbBookPropsBuilder2.default(scene.visual,_Book2.default.pageCallback,6,scene.bookBuilder)):_Detector2.default.addGetWebGLMessage({parent:scene.view.getView()})},options.template),scene},(0,_libs.$)(function(){for(var containers=(0,_libs.$)(".flip-book-container"),i=0;i>>0,start=arguments[1],relativeStart=start>>0,k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len),end=arguments[2],relativeEnd=void 0===end?len:end>>0,final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);k>>0,thisArg=arguments[1],i=0;i>>0,thisArg=arguments[1],i=0;i2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,AutoNavigator),props=_extends({},props,{urlParam:props.urlParam||"fb3d-page",navigates:void 0===props.navigates?1:props.navigates}),this.props=props,this.context=context,this.bookCtrl=bookCtrl,this.urlParam=props.urlParam,this.wnd=context.wnd,this.wnd.fb3d=_extends({},this.wnd.fb3d),this.wnd.fb3d.navigator=_extends({},this.wnd.fb3d.navigator),this.navigator=this.wnd.fb3d.navigator[this.urlParam]=_extends({},this.wnd.fb3d.navigator[this.urlParam]),this.navigator.instances=(this.navigator.instances||0)+1,this.navigator.instances<=this.props.navigates&&this.bookCtrl.goToPage(this.getPageNumber())}return AutoNavigator.prototype.dispose=function(){},AutoNavigator.prototype.getParameterByName=function(name,url){url||(url=window.location.href),name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^]*)|&|#|$)"),results=regex.exec(url);return results?results[2]?decodeURIComponent(results[2].replace(/\+/g," ")):"":null},AutoNavigator.prototype.getPageNumber=function(){var number=this.getParameterByName(this.urlParam);return number=parseInt(number),isNaN(number)&&(number=1),number-1},AutoNavigator}();exports.default=AutoNavigator},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var m=_ref;m.map&&(m.map=null,m.needsUpdate=!0),m.dispose()}delete this.materials,this.backG.dispose()},Binder.prototype.set=function(angle){var right=void 0,left=void 0;angle>Math.PI/2?(right=Math.PI/2,left=angle-Math.PI/2):(right=angle,left=0);var p=this.p,tr1={x:-.5*p.cover.depth,y:.5*p.backSize-p.cover.depth};this.backRT.position.set(tr1.x,tr1.y,0),this.backRR.position.set(-tr1.x,-tr1.y,0),this.backRR.quaternion.setFromAxisAngle(this.OZ,right);var tr2={x:p.backSize-2*p.cover.depth-.5*p.cover.depth,y:.5*p.backSize-p.cover.depth};this.backLT.position.set(tr2.x,tr2.y,0),this.backLR.position.set(-tr2.x,-tr2.y,0),this.backLR.quaternion.setFromAxisAngle(this.OZ,left)},Binder.prototype.setLeft=function(angle){var PI=Math.PI;this.leftPivot.position.set(_MathUtils2.default.interpolateLinear([-PI,-PI/2],[0,this.p.cover.depth],angle),.5*this.p.backSize-.5*this.p.cover.depth,0),this.leftPivot.quaternion.setFromAxisAngle(this.OZ,angle)},Binder.prototype.setRight=function(angle){var PI=Math.PI;this.rightPivot.position.set(_MathUtils2.default.interpolateLinear([-PI/2,0],[this.p.cover.depth,0],angle),-.5*this.p.backSize+.5*this.p.cover.depth,0),this.rightPivot.quaternion.setFromAxisAngle(this.OZ,angle)},Binder.prototype.joinLeftCover=function(cover){cover.three.position.set(0,-.5*this.p.cover.depth,0),this.leftPivot.add(cover.three)},Binder.prototype.disconnectLeftCover=function(cover){this.leftPivot.remove(cover.three)},Binder.prototype.joinRightCover=function(cover){cover.three.position.set(0,-.5*this.p.cover.depth,0),this.rightPivot.add(cover.three)},Binder.prototype.disconnectRightCover=function(cover){this.rightPivot.remove(cover.three)},Binder}();exports.default=Binder},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i0&&_this.addSheetBlock(0,new _SheetBlock2.default(visual,_extends({},_this.p,{setTexture:_this.setPageTexture.bind(_this)}),0,sheets,0,"closed")),_this.angle=_this.p.rtl?Math.PI:0,_this.closedAngle=0,_this.set(_this.angle,0),_this.lastMousePos={t:0},_this.three.position.set(-.5*_this.p.cover.depth+.5*sheets*_this.p.page.depth,0,0),_this.sheetPhysics=new _SheetPhysics2.default(_this.p.page.width/_this.p.scale,_this.p.gravity,_this.p.page.cornerDeviation),_this.binds={update:_this.update.bind(_this),lastMousePos:function(e){_this.lastMousePos=_extends({},_this.lastMousePos,{pageX:e.pageX,pageY:e.pageY})}},_this.visual.addRenderCallback(_this.binds.update),(0,_libs.$)(_this.visual.doc).on("mousemove",_this.binds.lastMousePos),_this.binds.onPickCallback=_this.onPickCallback.bind(_this),_this.visual.drag.onPickCallback=_this.binds.onPickCallback,_this.binds.onDragCallback=_this.onDragCallback.bind(_this),_this.visual.drag.onDragCallback=_this.binds.onDragCallback,_this.binds.onReleaseCallback=_this.onReleaseCallback.bind(_this),_this.visual.drag.onReleaseCallback=_this.binds.onReleaseCallback,_this.dragAngle=.05,_this.tmp={boxs:[new _libs.THREE.Box3,new _libs.THREE.Box3]},_this.visual.addObject(_this.three),setTimeout(function(){_this.notifyBeforeAnimation(),_this.notifyAfterAnimation()},100),_this}return _inherits(Book,_THREE$EventDispatche),Book.prototype.dispose=function(){this.visual.removeObject(this.three),this.sheetPhysics.dispose(),delete this.visual.drag.onPickCallback,delete this.visual.drag.onDragCallback,delete this.visual.drag.onReleaseCallback,(0,_libs.$)(this.visual.doc).off("mousemove",this.binds.lastMousePos),this.visual.removeRenderCallback(this.binds.update),this.removeSheetBlocks(0,this.sheetBlocks.length),this.binder.disconnectLeftCover(this.leftCover),this.removeSheetBlock(this.leftCover),this.binder.disconnectRightCover(this.rightCover),this.removeSheetBlock(this.rightCover),this.binder.dispose(),this.layerManager.dispose(),_CSSLayer2.default.dispose(),this.pageManager.dispose()},Book.prototype.getPageCallback=function(){return this.p.pageCallback},Book.prototype.setQuery=function(query){this.searchEngine.setQuery(query)},Book.prototype.isProcessing=function(){return 0!==this.sheetPhysics.getSize()},Book.prototype.getPages=function(){return 4+2*this.p.sheets},Book.prototype.setFlipProgressClb=function(clb){this.p.flipProgressClb=clb},Book.prototype.setInjector=function(injector){this.p.injector=injector},Book.prototype.isActivePage=function(n){var res=!0;if(n>1&&n=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var b=_ref;if(n-2>2*b.p.first&&n-2<2*b.p.last-1){res=!1;break}}return res},Book.prototype.getBlockByPage=function(n){var block=void 0;if(n<2)block=this.leftCover;else if(n<2*(this.p.sheets+1))for(var _iterator2=this.sheetBlocks,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var b=_ref2;if(n-2>=2*b.p.first&&n-2<2*b.p.last){block=b;break}}else block=this.rightCover;return block},Book.prototype.getBlockPages=function(block){var range=void 0;switch(block){case this.leftCover:range=[0,1];break;case this.rightCover:range=[2*(this.p.sheets+1),2*(this.p.sheets+1)+1];break;default:range=block?[2*(block.p.first+1),2*(block.p.last+1)-1]:void 0}return range},Book.prototype.getPage=function(){var PI=Math.PI,p=void 0;if(this.angle===PI/2||this.angle===3*PI/2){for(var _iterator3=this.sheetBlocks,_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var block=_ref3;if(block.angle<=PI/2){p=this.getBlockPages(block)[0]-1;break}}p||(p=this.getPages()-3)}else this.angle3*PI/2?p=1:this.angle=PI&&(p=this.getPages()-1);return p},Book.prototype.getLeftFlipping=function(){var block=void 0,left=this.sheetBlocks[0],PI=Math.PI;return this.angle===PI?block=this.rightCover:left&&"closed"===left.state&&left.angle>PI/2?block=left:this.angle!==PI/2&&this.angle!==3*PI/2||(block=this.leftCover),block},Book.prototype.getRightFlipping=function(){var block=void 0,right=this.sheetBlocks[this.sheetBlocks.length-1],PI=Math.PI;return 0===this.angle?block=this.leftCover:right&&"closed"===right.state&&right.angle<=PI/2?block=right:this.angle!==PI/2&&this.angle!==3*PI/2||(block=this.rightCover),block},Book.prototype.getClosedBlockAngle=function(angle){var closedAngle=void 0,PI=Math.PI;if(this.leftCover.physicId){var test=void 0;try{test=Math.abs(this.sheetPhysics.getParametr(this.leftCover.physicId,"angle")-angle)}catch(e){test=0}closedAngle=angle>PI/2||test>PI/6?PI/2:this.closedAngle}else if(this.rightCover.physicId){var _test=void 0;try{_test=Math.abs(this.sheetPhysics.getParametr(this.rightCover.physicId,"angle")-angle)}catch(e){_test=0}closedAngle=anglePI/6?PI/2+1e-7:this.closedAngle}else closedAngle=PI/2+1e-7*(0!==angle);return{openedAngle:angle,closedAngle:closedAngle,binderTurn:this.closedAngle}},Book.prototype.flipLeft=function(){var _this2=this,size=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,progressClb=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.p.flipProgressClb,block=void 0,res=void 0;return this.sheetPhysics.getSize()<25&&!function(){var left=_this2.sheetBlocks[0],PI=Math.PI;_this2.angle===PI?res=_this2.connectPhysics(block=_this2.rightCover,_this2.p.cover.mass,PI,-_this2.p.cover.startVelocity,_this2.p.cover.flexibility,0,function(angle,height){return _this2.set(3*PI/2-angle/2,height)},function(angle,height){_this2.set(3*PI/2-angle/2,0),_this2.setSheetBlocks(angle?PI:PI/2+1e-7,"closed")},progressClb):left&&"closed"===left.state&&left.angle>PI/2?(block=sizePI/2&&_this2.setSheetBlocks(angle?PI/2:0,"closed")},function(angle,height){return _this2.set(0===angle?0:2*PI-angle/2,0)},progressClb))}(),res},Book.prototype.flipRight=function(){var _this3=this,size=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,progressClb=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.p.flipProgressClb,block=void 0,res=void 0;return this.sheetPhysics.getSize()<25&&!function(){var right=_this3.sheetBlocks[_this3.sheetBlocks.length-1],PI=Math.PI;0===_this3.angle?res=_this3.connectPhysics(block=_this3.leftCover,_this3.p.cover.mass,0,_this3.p.cover.startVelocity,_this3.p.cover.flexibility,0,function(angle,height){return _this3.set(angle/2,height)},function(angle,height){_this3.set(angle/2,0),_this3.setSheetBlocks(angle?PI/2:0,"closed")},progressClb):right&&"closed"===right.state&&right.angle<=PI/2?(block=size1&&void 0!==arguments[1]?arguments[1]:1;return i?this.flipLeft(size):this.flipRight(size)},Book.prototype.isTouchDevice=function(){return(this.visual.wnd.devicePixelRatio||1)>1},Book.prototype.cornerCallback=function(e,data){var _this4=this,_data$data=data.data,i=_data$data.i,n=_data$data.n;if("mouseover"!==e.type||this.isTouchDevice()){if(this.hoverInfo&&"mouseout"===e.type)void 0!==this.hoverInfo.pendings?--this.hoverInfo.pendings:n===this.hoverInfo.n&&this.clearHoverInfo();else if("mousedown"===e.type)this.cornerClickData={x:e.pageX,y:e.pageY};else if("click"===e.type){if(Math.sqrt(Math.pow(this.cornerClickData.x-e.pageX,2)+Math.pow(this.cornerClickData.y-e.pageY,2))<5){var hover=this.getBlockByPage(n);if(hover.physicId){var id=hover.physicId,props=hover.getProps();this.sheetPhysics.setParametr(id,"velocity",(i?-1:1)*props.startVelocity)}}delete this.cornerClickData}}else this.hoverInfo&&void 0!==this.hoverInfo.pendings?++this.hoverInfo.pendings:(this.hoverInfo&&(console.warn("Wrong state: element is already hover"),this.hoverInfo.n!==n&&this.clearHoverInfo()),this.hoverInfo||this.dragInfo||!function(){var res=Promise.resolve(void 0),hoverAngle=.02,hover=_this4.getBlockByPage(n),possible=_this4.getFlipping(i);if(n>1&&n<2*(_this4.p.sheets+1)&&hover.physicId&&(hover.angleMath.PI-hoverAngle))res=Promise.resolve(hover);else if(hover===possible){var sheetBlocks=[_this4.leftCover].concat(_this4.sheetBlocks,[_this4.rightCover]),j=sheetBlocks.indexOf(hover),nextBlock=~j?sheetBlocks[j+2*i-1]:void 0;(!nextBlock||!nextBlock.physicId||nextBlock.angle>hoverAngle&&nextBlock.angle=_iterator4.length)break;_ref4=_iterator4[_i4++]}else{if(_i4=_iterator4.next(),_i4.done)break;_ref4=_i4.value}var block=_ref4;this.removeSheetBlock(block)}},Book.prototype.setTexture=function(material,n){if(this.p.rtl){var pages=2*(this.p.sheets+2);n=pages-1-n}this.pageManager.setTexture(material,n)},Book.prototype.setPageTexture=function(material,n){this.setTexture(material,n+2)},Book.prototype.setLeftCoverTexture=function(material,n){this.setTexture(material,n)},Book.prototype.setRightCoverTexture=function(material,n){this.setTexture(material,n+2*(this.p.sheets+1))},Book.finishAnimationClb=function(angle){this.block.set(this.book.getClosedBlockAngle(angle).closedAngle,"closed",0);var i=this.book.sheetBlocks.indexOf(this.block);~i&&(0===angle?this.book.mergeSheetBlocks(i,this.book.sheetBlocks.length-i):this.book.mergeSheetBlocks(0,i+1))},Book.prototype.calcBlockForce=function(block,object,angle,velocity,cornerHeight){return block.force?block.force(object,angle,velocity,cornerHeight):0},Book.prototype.calcBlockCornerForce=function(block,object,angle,velocity,cornerHeight){return block.cornerForce?block.cornerForce(object,angle,velocity,cornerHeight):0},Book.prototype.notifyBeforeAnimation=function(){var res=void 0;return this.animationNotification?res=Promise.reject():(this.animationNotification=!0,res=this.layerManager.hide()),res},Book.prototype.notifyAfterAnimation=function(){this.animationNotification&&(delete this.animationNotification,this.layerManager.show())},Book.prototype.connectPhysics=function(block,mass,angle,velocity,flexibility,coverHeight,simulateClb,removeClb,progressClb){var _this6=this,type=function(){return _this6.hoverInfo?"hover":_this6.dragInfo?"drag":"free";
+},res=this.sheetPhysics.getSize()?Promise.resolve():this.notifyBeforeAnimation();return res.then(function(){return block.physicId=_this6.sheetPhysics.addObject(mass,angle,velocity,flexibility,coverHeight,function(angl,ch){simulateClb(angl,ch),progressClb(block,Math.abs(angle-angl)/Math.PI,"process",type())},function(angl,ch){removeClb(angl,ch),delete block.physicId,progressClb(block,Math.abs(angle-angl)/Math.PI,"finish",type()),Promise.resolve().then(function(){_this6.sheetPhysics.getSize()||_this6.notifyAfterAnimation()})},function(object,angle,velocity,cornerHeight){return _this6.calcBlockForce(block,object,angle,velocity,cornerHeight)},function(object,angle,velocity,cornerHeight){return _this6.calcBlockCornerForce(block,object,angle,velocity,cornerHeight)}),progressClb(block,0,"init",type()),block}).catch(function(){})},Book.prototype.update=function(dt){var _this7=this;this.lastMousePos.t+=dt,this.isProcessing&&void 0!==this.lastMousePos.pageX&&this.lastMousePos.t-(this.lastMousePos.lastT||0)>.25&&!this.hoverInfo&&!this.dragInfo&&(this.lastMousePos.lastT=this.lastMousePos.t,Promise.resolve().then(function(){(0,_libs.$)(_this7.visual.element).trigger(_libs.$.Event("mousemove",_this7.lastMousePos))})),this.sheetPhysics.simulate(dt)},Book.prototype.splitSheetBlock=function(i,leftSize){var block=this.sheetBlocks[i];if(block&&leftSize1&&void 0!==arguments[1]?arguments[1]:0;this.angle=angle;var PI=Math.PI;if(angle'),ctx=jC[0].getContext("2d");return ctx.beginPath(),ctx.fillStyle=_GraphUtils2.default.color2Rgba(color,1),ctx.rect(0,0,8,7),ctx.fill(),ctx.beginPath(),ctx.fillStyle=_GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(color,.5),1),ctx.rect(0,7,8,1),ctx.fill(),jC[0]},Book.prepareProps=function(props){return Book.calcProps(Book.mergeProps((0,_book.props)(),props))},Book.mergeProps=function(first,second){return second=second||{},_extends({},first,second,{sheet:_extends({},first.sheet,second.sheet),cover:_extends({},first.cover,second.cover),page:_extends({},first.page,second.page)})},Book.calcProps=function(props){var p=_extends({},props,{sheet:_extends({},props.sheet),cover:_extends({},props.sheet,props.cover),page:_extends({},props.sheet,props.page)}),scale=10,height=scale*p.height,width=scale*p.width,flipProgressClb=function(){},sheet={sideTexture:p.sheet.sideTexture||Book.createSideTexture(p.sheet.color)},cover=_extends({},sheet,p.cover,{depth:scale*p.cover.depth,width:width,height:height,padding:scale*p.cover.padding}),page=_extends({},sheet,p.page,{depth:scale*p.page.depth,width:cover.width-cover.padding,height:cover.height-2*cover.padding}),marker={use:!1,color:16711680,size:.001*scale};return _extends({},p,{scale:scale,height:height,width:width,flipProgressClb:flipProgressClb,cover:cover,page:page,marker:marker})},Book}(_libs.THREE.EventDispatcher);exports.default=Book},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i1,stats:_this.actions.cmdStats.active,lighting:_this.p.lighting.default,activeSide:1},_this.boxs=[new _libs.THREE.Box3,new _libs.THREE.Box3],_this.bookWatcher=new _Object3DWatcher2.default(_this.visual,function(){return _this.state.singlePage?_this.state.activeSide?_this.boxs[0].setFromObject(book.rightCover.three):_this.boxs[0].setFromObject(book.leftCover.three):(_this.boxs[0].setFromObject(book.leftCover.three),_this.boxs[1].setFromObject(book.rightCover.three),_this.boxs[0].union(_this.boxs[1])),_this.boxs[0]}),_this.bookWatcher.scale=_this.p.scale.default,_this.Stats=new _stats2.default,_this.Stats.domElement.style.position="absolute",_this.Stats.domElement.style.top="0px",_this.visual.setExtraLighting(_this.state.lighting),_this.binds={onScreenModeChanged:_this.onScreenModeChanged.bind(_this),stats:_this.Stats.update.bind(_this.Stats),onUpdateView:_this.updateView.bind(_this)},_FullScreen2.default.addEventListener(_this.view.getParentContainer().ownerDocument,_this.binds.onScreenModeChanged),_this.cmdSmartPan(),_this.view.templateObject.appLoaded&&Promise.resolve().then(_this.view.templateObject.appLoaded),_this}return _inherits(BookController,_Controller),BookController.prototype.dispose=function(){_FullScreen2.default.removeEventListener(this.view.getParentContainer().ownerDocument,this.binds.onScreenModeChanged),delete this.book,delete this.view,delete this.visual},BookController.prototype.setTocCtrl=function(tocCtrl){this.tocCtrl=tocCtrl,this.tocCtrl.onChange=this.updateView.bind(this),this.updateView()},BookController.prototype.setPrinter=function(printer){this.printer=printer,this.updateView()},BookController.prototype.setSounds=function(sounds){this.sounds=sounds,sounds.setEnabled(this.actions.cmdSounds.active),this.updateView()},BookController.prototype.onScreenModeChanged=function(e){this.updateView()},BookController.prototype.canZoomIn=function(){return!this.state.smartPan||Math.abs(this.bookWatcher.scale-this.p.scale.max)>this.p.eps},BookController.prototype.canZoomOut=function(){return!this.state.smartPan||Math.abs(this.bookWatcher.scale-this.p.scale.min)>this.p.eps},BookController.prototype.canDefaultZoom=function(){return this.state.smartPan},BookController.prototype.cmdZoomIn=function(){this.state.smartPan?this.bookWatcher.scale=Math.min(this.p.scale.max,this.bookWatcher.scale+this.p.scale.delta):this.orbit.zoomIn(6.6*this.p.scale.delta/.32),this.updateView()},BookController.prototype.cmdZoomOut=function(){this.state.smartPan?this.bookWatcher.scale=Math.max(this.p.scale.min,this.bookWatcher.scale-this.p.scale.delta):this.orbit.zoomOut(6.6*this.p.scale.delta/.32),this.updateView()},BookController.prototype.cmdDefaultZoom=function(){this.state.smartPan&&(this.bookWatcher.scale=this.p.scale.default,this.updateView())},BookController.prototype.cmdToc=function(){this.tocCtrl&&this.tocCtrl.togle()},BookController.prototype.cmdFastBackward=function(){this.startFlip(this.book.flipLeft(5))},BookController.prototype.cmdBackward=function(){var _this2=this;this.state.singlePage?(this.state.activeSide=(this.getPage()+1)%2,this.state.activeSide?(this.state.activeSide=0,this.updateView()):this.startFlip(this.book.flipLeft(1)).then(function(block){block&&(_this2.state.activeSide=1)})):this.startFlip(this.book.flipLeft(1))},BookController.prototype.cmdForward=function(){var _this3=this;this.state.singlePage?(this.state.activeSide=(this.getPage()+1)%2,this.state.activeSide?this.startFlip(this.book.flipRight(1)).then(function(block){block&&(_this3.state.activeSide=0)}):(this.state.activeSide=1,this.updateView())):this.startFlip(this.book.flipRight(1))},BookController.prototype.cmdFastForward=function(){this.startFlip(this.book.flipRight(5))},BookController.prototype.cmdSave=function(){window.open(this.p.downloadURL,"_blank")},BookController.prototype.cmdPrint=function(){this.printer.print()},BookController.prototype.cmdFullScreen=function(){_FullScreen2.default.activated()?_FullScreen2.default.cancel():_FullScreen2.default.request(this.view.getParentContainer())},BookController.prototype.cmdSmartPan=function(){this.state.smartPan=!this.state.smartPan,this.state.smartPan?(this.orbit.minAzimuthAngle=0,this.orbit.maxAzimuthAngle=0,this.orbit.minPolarAngle=0,this.orbit.maxPolarAngle=Math.PI/4,this.bookWatcher.enabled=!0):(this.orbit.minAzimuthAngle=-(1/0),this.orbit.maxAzimuthAngle=1/0,this.orbit.minPolarAngle=0,this.orbit.maxPolarAngle=Math.PI,this.bookWatcher.enabled=!1),this.updateView()},BookController.prototype.cmdSinglePage=function(){this.state.singlePage=!this.state.singlePage,this.updateView()},BookController.prototype.cmdSounds=function(){this.sounds&&this.sounds.togle(),this.updateView()},BookController.prototype.cmdStats=function(){this.state.stats=!this.state.stats,this.state.stats?((0,_libs.$)(this.view.getContainer()).append(this.Stats.domElement),this.visual.addRenderCallback(this.binds.stats)):((0,_libs.$)(this.view.getContainer()).find(this.Stats.domElement).remove(),this.visual.removeRenderCallback(this.binds.stats)),this.updateView()},BookController.prototype.cmdLightingUp=function(){this.state.lighting=Math.min(this.state.lighting+this.p.lighting.delta,this.p.lighting.max),this.visual.setExtraLighting(this.state.lighting),this.updateView()},BookController.prototype.cmdLightingDown=function(){this.state.lighting=Math.max(this.state.lighting-this.p.lighting.delta,this.p.lighting.min),this.visual.setExtraLighting(this.state.lighting),this.updateView()},BookController.prototype.goToPage=function(page){var _this4=this;this.p.rtl&&(page=this.book.getPages()-1-page);var pageNum=Math.max(Math.min(page,this.book.getPages()-1),0);this.state.activeSide=(pageNum+1)%2;var target=Math.max(Math.min(page-1+page%2,this.book.getPages()-1),0),current=this.book.getPage(),flips=[],covs=0;if(target!=current){0===current?(flips.push(1),current+=1,++covs):current===this.book.getPages()-1&&(flips.push(-1),current-=2,++covs);var cv=0;0===target?(cv=-1,target+=1,++covs):target===this.book.getPages()-1&&(cv=1,target-=2,++covs),target-current&&flips.push(Math.ceil((target-current)/2)),cv&&flips.push(cv)}var setClb=function(fl,time,clb){setTimeout(function(){fl<0?_this4.startFlip(_this4.book.flipLeft(-fl,clb)):_this4.startFlip(_this4.book.flipRight(fl,clb))},time)};if(2===covs)setClb(flips[0],0,function(block,progress,state){"finish"==state&&1==progress&&setClb(flips[flips.length-1],0)}),setClb(flips[1],500);else for(var time=0,_iterator=flips,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var fl=_ref;setClb(fl,time),time+=250}},BookController.prototype.startFlip=function(flipRes){var _this5=this;return flipRes?flipRes.then(function(block){return block&&_this5.dispatchAsync({type:"startFlip"}),block}):Promise.resolve(void 0)},BookController.prototype.endFlip=function(block){return this.dispatchAsync({type:"endFlip"}),block},BookController.prototype.getPage=function(){var page=this.book.getPage();return page?Math.min(this.book.getPage()+this.state.activeSide,this.book.getPages()-1):0},BookController.prototype.getPageForGUI=function(){var n=(this.state.singlePage?this.getPage():this.book.getPage())+1;return this.p.rtl&&(n=this.book.getPages()-n+1),n},BookController.prototype.inpPage=function(e,data){this.goToPage(data-1)},BookController.prototype.updateViewIfState=function(block,progress,state,type){"init"!==state&&"finish"!==state||setTimeout(this.updateView.bind(this),100),"finish"===state&&this.endFlip(block)},BookController.prototype.updateView=function(){if(this.view){this.view.setState("cmdZoomIn",{enable:this.canZoomIn(),visible:this.actions.cmdZoomIn.enabled,active:!1}),this.view.setState("cmdZoomOut",{enable:this.canZoomOut(),visible:this.actions.cmdZoomOut.enabled,active:!1}),this.view.setState("cmdDefaultZoom",{enable:this.canDefaultZoom(),visible:this.actions.cmdDefaultZoom.enabled,active:this.canDefaultZoom()&&Math.abs(this.bookWatcher.scale-this.p.scale.default)=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var name=_ref2;this.view.setState(name,{enable:flippersEnable[name],visible:this.actions[name].enabled,active:!1})}this.view.setState("inpPages",{visible:!0,value:this.book.getPages()}),this.view.setState("inpPage",{visible:!0,enable:!this.book.isProcessing(),value:this.getPageForGUI()}),this.view.setState("cmdSave",{enable:!0,visible:this.actions.cmdSave.enabled&&!!this.p.downloadURL,active:!1}),this.view.setState("cmdPrint",{enable:!0,visible:this.actions.cmdPrint.enabled&&!!this.printer,active:!1}),this.view.setState("cmdFullScreen",{enable:_FullScreen2.default.available(),visible:this.actions.cmdFullScreen.enabled,active:_FullScreen2.default.available()&&_FullScreen2.default.activated()}),this.view.setState("widSettings",{enable:!0,visible:this.actions.widSettings.enabled,active:!1}),this.view.setState("cmdSmartPan",{enable:!0,visible:this.actions.cmdSmartPan.enabled,active:this.state.smartPan}),this.view.setState("cmdSinglePage",{enable:!0,visible:this.actions.cmdSinglePage.enabled,active:this.state.singlePage}),this.view.setState("cmdSounds",{enable:!0,visible:this.actions.cmdSounds.enabled&&!!this.sounds,active:!!this.sounds&&this.sounds.enabled}),this.view.setState("cmdStats",{enable:!0,visible:this.actions.cmdStats.enabled,active:this.state.stats}),this.view.setState("cmdLightingUp",{enable:Math.abs(this.state.lighting-this.p.lighting.max)>this.p.eps,visible:this.actions.cmdLightingUp.enabled,active:!1}),this.view.setState("cmdLightingDown",{enable:Math.abs(this.state.lighting-this.p.lighting.min)>this.p.eps,visible:this.actions.cmdLightingDown.enabled,active:!1})}},BookController.prototype.getActions=function(){var _this6=this,isSwipping=function(name){return _this6.actions.touchCmdSwipe.enabled&&_this6.actions.touchCmdSwipe.code===_this6.actions[name].code&&_this6.state.smartPan&&_this6.bookWatcher.scale<=1};return{cmdZoomIn:{activate:this.cmdZoomIn.bind(this)},cmdZoomOut:{activate:this.cmdZoomOut.bind(this)},cmdDefaultZoom:{activate:this.cmdDefaultZoom.bind(this)},cmdToc:{activate:this.cmdToc.bind(this)},cmdFastBackward:{activate:this.cmdFastBackward.bind(this)},cmdBackward:{activate:this.cmdBackward.bind(this)},cmdForward:{activate:this.cmdForward.bind(this)},cmdFastForward:{activate:this.cmdFastForward.bind(this)},cmdSave:{activate:this.cmdSave.bind(this)},cmdPrint:{activate:this.cmdPrint.bind(this)},cmdFullScreen:{activate:this.cmdFullScreen.bind(this)},cmdSmartPan:{activate:this.cmdSmartPan.bind(this)},cmdSinglePage:{activate:this.cmdSinglePage.bind(this)},cmdSounds:{activate:this.cmdSounds.bind(this)},cmdStats:{activate:this.cmdStats.bind(this)},cmdLightingUp:{activate:this.cmdLightingUp.bind(this)},cmdLightingDown:{activate:this.cmdLightingDown.bind(this)},cmdPanLeft:{activate:function(e){return _this6.orbit.actions.pan(e,{state:"move",dx:-_this6.p.pan.speed,dy:0})}},cmdPanRight:{activate:function(e){return _this6.orbit.actions.pan(e,{state:"move",dx:_this6.p.pan.speed,dy:0})}},cmdPanUp:{activate:function(e){return _this6.orbit.actions.pan(e,{state:"move",dx:0,dy:-_this6.p.pan.speed})}},cmdPanDown:{activate:function(e){return _this6.orbit.actions.pan(e,{state:"move",dx:0,dy:_this6.p.pan.speed})}},mouseCmdRotate:{activate:this.orbit.actions.rotate},mouseCmdDragZoom:{activate:function(e,data){data.dy>0?_this6.cmdZoomOut():data.dy<0&&_this6.cmdZoomIn()}},mouseCmdPan:{activate:this.orbit.actions.pan},mouseCmdWheelZoom:{activate:function(e){e.preventDefault(),e.deltaY<0?_this6.cmdZoomOut():e.deltaY>0&&_this6.cmdZoomIn()}},touchCmdRotate:{activate:function(e,data){isSwipping("touchCmdRotate")||(e.preventDefault(),_this6.orbit.actions.rotate(e,data))}},touchCmdZoom:{activate:function(e,data){isSwipping("touchCmdZoom")||(e.preventDefault(),data.dy>0?_this6.cmdZoomOut():data.dy<0&&_this6.cmdZoomIn())}},touchCmdPan:{activate:function(e,data){isSwipping("touchCmdPan")||(e.preventDefault(),_this6.orbit.actions.pan(e,data))}},touchCmdSwipe:{activate:function(e,data){if(isSwipping("touchCmdSwipe"))if(e.preventDefault(),"start"===data.state){var touch=(e.touches||e.originalEvent.touches)[_this6.actions.touchCmdSwipe.code-1];_this6.swipeData={handled:!1,x0:touch.pageX,y0:touch.pageY,x:touch.pageX,y:touch.pageY}}else"move"===data.state?_this6.swipeData.handled||(_this6.swipeData=_extends({},_this6.swipeData,{x:_this6.swipeData.x+data.dx,y:_this6.swipeData.y+data.dy}),Math.abs(_this6.swipeData.x0-_this6.swipeData.x)>100&&(_this6.swipeData.x0>_this6.swipeData.x?_this6.cmdForward():_this6.cmdBackward(),_this6.swipeData.handled=!0)):delete _this6.swipeData}},widSettings:{activate:function(){}}}},BookController.prototype.bindActions=function(){this.eToA=new _EventsToActions2.default((0,_libs.$)(this.visual.element)),this.eToA.addAction(function(e){return e.preventDefault()},"contextmenu",_EventsToActions2.default.mouseButtons.Right,0),this.actions=this.getActions();for(var _iterator3=Object.keys(this.actions),_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var name=_ref3,action=_extends({},this.actions[name],this.p.actions[name]);if(this.actions[name]=action,action.enabled){var flags=action.flags||0;action.type?this.eToA.addAction(action.activate,action.type,action.code,flags):void 0!==action.code&&this.eToA.addAction(action.activate,"keydown",action.code,flags)}}},BookController.prepareProps=function(props){return BookController.calcProps(BookController.mergeProps((0,_bookController.props)(),props))},BookController.setActions=function(props,actions){for(var _iterator4=Object.keys(actions||{}),_isArray4=Array.isArray(_iterator4),_i4=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){var _ref4;if(_isArray4){if(_i4>=_iterator4.length)break;_ref4=_iterator4[_i4++]}else{if(_i4=_iterator4.next(),_i4.done)break;_ref4=_i4.value}var name=_ref4;props.actions[name]=_extends({},props.actions[name],actions[name])}},BookController.mergeProps=function(first,second){second=second||{};var props=_extends({},first,second,{scale:_extends({},first.scale,second.scale),lighting:_extends({},first.lighting,second.lighting),pan:_extends({},first.pan,second.pan),actions:_extends({},first.actions)});return BookController.setActions(props,first.actions),BookController.setActions(props,second.actions),props},BookController.calcProps=function(props){return props.scale.delta=(props.scale.max-props.scale.min)/props.scale.levels,props.lighting.delta=(props.lighting.max-props.lighting.min)/props.lighting.levels,props},BookController}(_Controller3.default);exports.default=BookController},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(1),BookPrinter=function(){function BookPrinter(context,book,styleSheet){_classCallCheck(this,BookPrinter),this.book=book,this.styleSheet=styleSheet,this.wnd=context.wnd,this.doc=context.doc,this.pageCallback=book.getPageCallback();var test=this.pageCallback(0);this.type=test.type,"pdf"===this.type&&(this.pdfSrc=test.src.src)}return BookPrinter.prototype.cancel=function(){this.canceled=!0},BookPrinter.prototype.dispose=function(){this.frame&&(this.frame.remove(),delete this.frame)},BookPrinter.prototype.print=function(){var _this=this;delete this.canceled,"pdf"===this.type?!function(){var printWnd=void 0,callManually=!1;_this.useIFrame()?(callManually=!!_this.frame,_this.frame||(_this.frame=(0,_libs.$)('').appendTo(_this.doc.body)),printWnd=_this.frame[0].contentWindow):printWnd=_this.wnd.open(_this.pdfSrc),callManually?printWnd.print():(0,_libs.$)(printWnd).on("load",function(){try{printWnd.print()}catch(e){console.error(e)}})}():this.renderContent().then(function(content){var printWnd=_this.wnd.open(),printDoc=printWnd.document,html='\n \n \n \n \n 3D FlipBook - Printing\n '+content.head+'\n \n \n \n '+content.body+"\n \n \n ";printDoc.open(),printDoc.write(html),printDoc.close()}).catch(function(e){return console.warn("3D FlipBook - Printing was canceled")})},BookPrinter.prototype.progress=function(v){if(this.canceled)throw"Cancel Printing";this.onProgress&&this.onProgress(Math.floor(100*v))},BookPrinter.prototype.renderContent=function(){for(var _this2=this,pages=this.book.getPages(),head=new Set,body=[],done=Promise.resolve(),_loop=function(page){var info=_this2.pageCallback(page);"image"===info.type?done=done.then(function(){return _this2.progress(page/pages),_this2.renderImage(head,body,info.src)}):"html"===info.type&&(done=done.then(function(){return _this2.progress(page/pages),_this2.renderHtml(head,body,info.src)}))},page=0;page'+content+""},BookPrinter.prototype.renderImage=function(head,body,src){body.push(BookPrinter.wrap(''))},BookPrinter.prototype.renderHtml=function(head,body,src){return new Promise(function(resolve,reject){_libs.$.get(src,function(html){for(var links=html.match(//gi)||[],_iterator=links,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var link=_ref;if(link.match(/stylesheet/i)){var href=link.match(/href\s*=\s*['"](.*)['"]/i);href&&head.add(href[1])}}var content=html.match(/([\S\s]*)<\/body>/i);content&&body.push(BookPrinter.wrap(content[1])),resolve()}).fail(function(e){console.error(e.responseText),reject()})})},BookPrinter.prototype.renderHead=function(head){var content=[];return head.forEach(function(k){return content.push('')}),content.push(this.styleSheet?'':BookPrinter.defaultStyleSheet()),content.join("\n")},BookPrinter.prototype.useIFrame=function(){var isChromium=this.wnd.chrome,winNav=this.wnd.navigator,vendorName=winNav.vendor,isIEedge=winNav.userAgent.indexOf("Edge")>-1,isIOSChrome=winNav.userAgent.match("CriOS"),use=void 0;return use=!!isIOSChrome||!(!isChromium||"Google Inc."!==vendorName||isIEedge)},BookPrinter.defaultStyleSheet=function(){return'\n \n '},BookPrinter}();exports.default=BookPrinter},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _View2=(__webpack_require__(1),__webpack_require__(65)),_View3=_interopRequireDefault(_View2),BookView=function(_View){function BookView(container,onLoad,template,handler){return _classCallCheck(this,BookView),_possibleConstructorReturn(this,_View.call(this,container,onLoad,template,handler))}return _inherits(BookView,_View),BookView.prototype.initView=function(){this.view=this.container.find(".view"),this.bookmarksView=this.container.find(".widBookmarks"),this.thumbnailsView=this.container.find(".widThumbnails"),this.searchView=this.container.find(".widSearch")},BookView.prototype.getHandlers=function(id){var _this2=this,handlers=void 0;return handlers="inpPage"===id?[{inpPage:function(e,data){return _this2.callLater(_View.prototype.getHandlers.call(_this2,id),id,e,data,BookView.PAGE_HANDLER_DELAY)}}]:_View.prototype.getHandlers.call(this,id)},BookView.prototype.onItemStateChanged=function(id,state){"cmdFullScreen"===id&&(state.active?this.parentContainer.addClass("fullscreen"):this.parentContainer.removeClass("fullscreen"))},BookView.prototype.getView=function(){return this.view},BookView.prototype.getBookmarksView=function(){return this.bookmarksView},BookView.prototype.getThumbnailsView=function(){return this.thumbnailsView},BookView.prototype.getSearchView=function(){return this.searchView},BookView.prototype.getForms=function(){return[]},BookView.prototype.getLinks=function(){return["cmdZoomIn","cmdZoomOut","cmdDefaultZoom","cmdToc","cmdFastBackward","cmdBackward","cmdForward","cmdFastForward","cmdSave","cmdPrint","cmdFullScreen","cmdSmartPan","cmdSinglePage","cmdSounds","cmdStats","cmdLightingUp","cmdLightingDown","cmdCloseToc","cmdBookmarks","cmdSearch","cmdThumbnails"]},BookView.prototype.getWidgets=function(){return["widLoadingProgress","widFloatWnd","widTocMenu","widBookmarks","widThumbnails","widSearch","widSettings"]},BookView.prototype.getInputs=function(){return["inpPage","inpPages"]},BookView.prototype.getTexts=function(){return["txtLoadingProgress"]},BookView.prototype.getTemplate=function(){return{html:"templates/default-book-view.html",styles:["css/black-book-view.css"],links:[{rel:"stylesheet",href:"css/font-awesome.min.css"}],script:"js/default-book-view.js"}},BookView}(_View3.default);BookView.PAGE_HANDLER_DELAY=1e3,exports.default=BookView},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);
+subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _BookPropsBuilder2=__webpack_require__(9),_BookPropsBuilder3=_interopRequireDefault(_BookPropsBuilder2),_ImageFactory=__webpack_require__(8),_ImageFactory2=_interopRequireDefault(_ImageFactory),ClbBookPropsBuilder=function(_BookPropsBuilder){function ClbBookPropsBuilder(context,pageCallback,pages,onReady){_classCallCheck(this,ClbBookPropsBuilder);var _this=_possibleConstructorReturn(this,_BookPropsBuilder.call(this,onReady));return _this.calcSheets(pages),_this.pageCallback=pageCallback,_this.binds={pageCallback:pageCallback.bind(_this)},_this.imageFactory=new _ImageFactory2.default(context),pages>0?!function(){var test=_this.imageFactory.build(pageCallback(0),0,_this.defaults.sheet.widthTexels,_this.defaults.sheet.heightTexels,_this.defaults.sheet.color);test.onLoad=function(){_this.calcProps(test.width,test.height),test.dispose(),_this.ready()}}():(_this.props=_this.defaults,_this.ready()),_this}return _inherits(ClbBookPropsBuilder,_BookPropsBuilder),ClbBookPropsBuilder}(_BookPropsBuilder3.default);exports.default=ClbBookPropsBuilder},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var w=_ref;w.layers.forEach(function(l){return l.dispose()})}delete this.wrappers},CssLayersManager.prototype.show=function(){var _this=this;this.hidden=!1;for(var _loop=function(){if(_isArray2){if(_i2>=_iterator2.length)return"break";_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)return"break";_ref2=_i2.value}var n=_ref2,w=_this.wrappers[n];w?"ready"===w.state&&w.layers.length&&!function(){var block=_this.book.getBlockByPage(n);w.layers.forEach(function(l){l.isHidden()&&(l.update(block),l.show())})}():!function(){var w=_this.wrappers[n]={state:"loading",layers:[]};Promise.resolve().then(function(){_this.pageManager.getLayers(n,function(layers){if(layers.length&&_this.wrappers){for(var block=_this.book.getBlockByPage(n),_iterator3=layers,_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var l=_ref3,sl=new _SheetCssLayer2.default(_this.visual,block);w.layers.push(sl),sl.set(l.css,l.html,l.js)}setTimeout(function(){!_this.hidden&&~_this.getActives().indexOf(n)&&w.layers.forEach(function(l){return l.show()})},10)}w.state="ready"})})}()},_iterator2=this.getActives(),_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2,_ret=_loop();if("break"===_ret)break}},CssLayersManager.prototype.hide=function(){this.hidden=!0;for(var wait=[],_iterator4=Object.values(this.wrappers),_isArray4=Array.isArray(_iterator4),_i4=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){var _ref4;if(_isArray4){if(_i4>=_iterator4.length)break;_ref4=_iterator4[_i4++]}else{if(_i4=_iterator4.next(),_i4.done)break;_ref4=_i4.value}var _w=_ref4;_w.layers.forEach(function(l){return wait.push(l.hide())})}return Promise.all(wait)},CssLayersManager}();exports.default=CssLayersManager},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i")[0],this.imageFactory=new _ImageFactory2.default(_extends({},visual,{dispatchEvent:book.dispatchEvent.bind(book),renderCanvas:this.canvas,renderCanvasCtx:this.canvas.getContext("2d")}),this.resourcesCache),this.loadings=[],this.renderQueue=[],this.pageRequests=[],this.predictedRequests=[],this.tmpMaterial=new _libs.THREE.MeshBasicMaterial,visual.addObject(new _libs.THREE.Mesh(new _libs.THREE.PlaneGeometry(0,0),this.tmpMaterial)),this.loading={},this.loading[p.cover.color]=this.createLoadingTexture(p.cover),p.page.color!==p.cover.color&&(this.loading[p.page.color]=this.createLoadingTexture(p.page)),this.turnOnEvents(),visual.addRenderCallback(this.update.bind(this)),setInterval(this.updateRenderQueue.bind(this),250)}return PageManager.prototype.createLoadingTexture=function(p){var spriteTiles=6,scale=Math.sqrt(1262992.5/(p.widthTexels*p.heightTexels)),animation=new _LoadingAnimation2.default(scale*p.widthTexels,scale*p.heightTexels,p.color),animator=new _TextureAnimator2.default(animation.createSprite(spriteTiles),spriteTiles,1,spriteTiles,.2);return animation.dispose(),animator},PageManager.prototype.dispose=function(){this.turnOffEvents();for(var _iterator=Object.keys(this.loading),_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var color=_ref;this.loading[color].dispose()}delete this.loading,this.resourcesCache.dispose(),this.pageCache.dispose(),this.canvas.height=this.canvas.width=0,delete this.canvas},PageManager.prototype.isCover=function(n){return n<2||n>=2*(this.p.sheets+1)},PageManager.prototype.isMobile=function(){return(this.visual.wnd.devicePixelRatio||1)>1},PageManager.prototype.update=function(dt){for(var loading={},_iterator2=this.loadings,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var o=_ref2;o.isActive()&&(loading[o.color]=!0)}for(var _iterator3=Object.keys(loading),_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var color=_ref3;this.loading[color].update(dt)}},PageManager.prototype.removeFromLoadings=function(o){var i=this.loadings.indexOf(o);~i&&this.loadings.splice(i,1)},PageManager.prototype.removeFromRenderQueue=function(o){var i=this.renderQueue.indexOf(o);~i&&this.renderQueue.splice(i,1)},PageManager.prototype.refreshPageQuery=function(n){var query=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.pageQuery=query;var object=this.pageCache.get(n);object&&object.wrapper&&object.wrapper.setQuery&&(this.pageCache.remove(n)||object.wrapper.setQuery(query))},PageManager.prototype.getLayers=function(n,clb){var _this=this;this.p.cssLayersLoader?this.p.cssLayersLoader(n,function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];var object=_this.pageCache.get(n);object&&("active"!==object.state?object.pendings.push({clb:clb,args:args}):clb.apply(void 0,args))}):clb([])},PageManager.prototype.resolvePendings=function(pendings){for(var _iterator4=pendings,_isArray4=Array.isArray(_iterator4),_i4=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){var _ref4;if(_isArray4){if(_i4>=_iterator4.length)break;_ref4=_iterator4[_i4++]}else{if(_i4=_iterator4.next(),_i4.done)break;_ref4=_i4.value}var p=_ref4;try{p.clb.apply(p,p.args)}catch(e){console.error(e)}}pendings.splice(0,pendings.length)},PageManager.prototype.load=function(material,n){var _this2=this,pi=this.p.pageCallback(n),p=this.isCover(n)?this.p.cover:this.p.page,o={texture:new _libs.THREE.Texture,wrapper:null,state:"loading",locked:function(n){return"loading"===o.state||"rendering"===o.state||_this2.book.isActivePage(n)},color:p.color,isActive:function(){return _this2.book.isActivePage(n)},dispose:function(){_this2.removeFromLoadings(o),_this2.removeFromRenderQueue(o),o.wrapper&&o.wrapper.dispose&&o.wrapper.dispose(),o.texture.dispose(),delete o.texture,delete o.wrapper},pendings:[]};return o.texture.minFilter=_libs.THREE.LinearFilter,this.loadings.push(o),this.setMaterial(o,material),Promise.resolve().then(function(){if(o.texture){var widthTexels=pi.widthTexels||p.widthTexels,heightTexels=pi.heightTexels||p.heightTexels;o.wrapper=_this2.imageFactory.build(pi,void 0===pi.number?n:pi.number,widthTexels,heightTexels,p.color,_this2.p.injector),o.wrapper.setQuery&&o.wrapper.setQuery(_this2.pageQuery),o.simulate=pi.interactive?(o.wrapper.simulate||function(){}).bind(o.wrapper):void 0,o.wrapper.onLoad=function(){"queuedForRender"!==o.state&&(o.state="queuedForRender",_this2.renderQueue.push(o),_this2.updateRenderQueue())},o.wrapper.onChange=function(image){o.texture&&(_this2.removeFromLoadings(o),o.material&&(o.material.map=o.texture,o.material.needsUpdate=!0),o.texture.image=image,o.texture.needsUpdate=!0,o.texture.onUpdate=function(){"queuedForRender"!==o.state&&(o.state="active",_this2.resolvePendings(o.pendings)),delete _this2.rendering,_this2.updateRenderQueue()},_this2.tmpMaterial.map=o.texture,_this2.tmpMaterial.needsUpdate=!0)}}}),this.pageCache.put(n,o)},PageManager.prototype.updateRenderQueue=function(){var p=this.book.p;if(!this.rendering&&(p.renderWhileFlipping||!this.book.isProcessing())){for(var _iterator5=this.renderQueue,_isArray5=Array.isArray(_iterator5),_i5=0,_iterator5=_isArray5?_iterator5:_iterator5[Symbol.iterator]();;){var _ref5;if(_isArray5){if(_i5>=_iterator5.length)break;_ref5=_iterator5[_i5++]}else{if(_i5=_iterator5.next(),_i5.done)break;_ref5=_i5.value}var o=_ref5;if(o.isActive()){this.rendering=o;break}}(this.isMobile()&&p.renderInactivePagesOnMobile||!this.isMobile()&&p.renderInactivePages)&&(this.rendering=this.rendering||this.renderQueue[0]),this.rendering&&(this.removeFromRenderQueue(this.rendering),this.rendering.state="rendering",this.rendering.wrapper.startRender())}},PageManager.prototype.turnOnEvents=function(){this.transferEvents=!0},PageManager.prototype.turnOffEvents=function(){var mouseup=_libs.$.Event("mouseup"),mouseout=_libs.$.Event("mouseout");this.pageCache.forEach(function(ent){var object=ent[1];object.simulate&&(object.simulate(mouseup,void 0,0,0),object.simulate(mouseout,void 0,0,0))}),this.transferEvents=!1},PageManager.prototype.transferEventToTexture=function(n,e,data){var _this3=this;if(this.transferEvents){var toObject=this.getOrLoadTextureObject(void 0,n);toObject.wrapper&&!function(){var uv=data.uv,toDoc=toObject.wrapper.getSimulatedDoc();_this3.pageCache.forEach(function(ent){var object=ent[1];object.simulate&&object.simulate(e,toDoc,uv.x,uv.y)})}()}},PageManager.prototype.loadPredictedPages=function(){this.predictedRequests=_BaseMathUtils2.default.predict(this.pageRequests,this.p.preloadPages);for(var _iterator6=this.predictedRequests,_isArray6=Array.isArray(_iterator6),_i6=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){var _ref6;if(_isArray6){if(_i6>=_iterator6.length)break;_ref6=_iterator6[_i6++]}else{if(_i6=_iterator6.next(),_i6.done)break;_ref6=_i6.value}var p=_ref6;pthis.p.pagesForPredicting&&this.pageRequests.shift(),Promise.resolve().then(this.loadPredictedPages.bind(this))},PageManager.prototype.setMaterial=function(o,material){this.pageCache.forEach(function(e){var ob=e[1];o!==ob&&ob.material===material&&delete ob.material}),material&&material!==o.material&&(o.material=material,material.map=o.texture.image?o.texture:this.loading[o.color].texture,material.needsUpdate=!0)},PageManager.prototype.getOrLoadTextureObject=function(material,n){var object=this.pageCache.get(n);return object?this.setMaterial(object,material):(object=this.load(material,n),this.addPageRequest(n)),object},PageManager.prototype.setTexture=function(material,n){~this.predictedRequests.indexOf(n)&&this.addPageRequest(n),this.getOrLoadTextureObject(material,n)},PageManager}();exports.default=PageManager},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _BookPropsBuilder2=__webpack_require__(9),_BookPropsBuilder3=_interopRequireDefault(_BookPropsBuilder2),_Pdf=__webpack_require__(18),_Pdf2=_interopRequireDefault(_Pdf),PdfBookPropsBuilder=function(_BookPropsBuilder){function PdfBookPropsBuilder(src,onReady){_classCallCheck(this,PdfBookPropsBuilder);var _this=_possibleConstructorReturn(this,_BookPropsBuilder.call(this,onReady));return _this.pdf=new _Pdf2.default(src),_this.pageDescription={type:"pdf",src:_this.pdf,interactive:!0},_this.binds={pageCallback:_this.pageCallback.bind(_this)},_this.pdf.getHandler(_this.init.bind(_this)),_this}return _inherits(PdfBookPropsBuilder,_BookPropsBuilder),PdfBookPropsBuilder.prototype.dispose=function(){this.pdf.dispose(),_BookPropsBuilder.prototype.dispose.call(this)},PdfBookPropsBuilder.prototype.init=function(handler){var _this2=this;this.calcSheets(this.pdf.getPagesNum()),this.pdf.getPagesNum()>0?handler.getPage(1).then(function(page){var size=_Pdf2.default.getPageSize(page);_this2.calcProps(size.width,size.height),_this2.ready()}).catch(function(e){console.error(e)}):(this.props=this.defaults,this.ready())},PdfBookPropsBuilder.prototype.pageCallback=function(n){return this.pageDescription},PdfBookPropsBuilder}(_BookPropsBuilder3.default);exports.default=PdfBookPropsBuilder},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(1),PdfLinksHandler=function(){function PdfLinksHandler(pdf,ctrl,element){_classCallCheck(this,PdfLinksHandler),this.pdf=pdf,this.ctrl=ctrl,this.element=(0,_libs.$)(element),this.cursors=[]}return PdfLinksHandler.prototype.dispose=function(){},PdfLinksHandler.prototype.setHandler=function(handler){this.handler=handler},PdfLinksHandler.prototype.defaultHandler=function(type,destination){"internal"===type?this.ctrl.goToPage(destination):"external"===type&&window.open(destination,"_blank")},PdfLinksHandler.prototype.callHandlers=function(type,destination){this.handler&&this.handler(type,destination)||this.defaultHandler(type,destination)},PdfLinksHandler.prototype.handleEvent=function(data){var _this=this,e=data.event,anno=data.annotation;switch(e.type){case"mouseover":this.cursors.push(this.element.css("cursor")),this.element.css("cursor","pointer");break;case"mouseout":this.element.css("cursor",this.cursors.pop()||"");break;case"touchtap":case"click":if(anno.url)this.callHandlers("external",anno.url);else if(anno.dest){var destPromise=void 0;destPromise="string"==typeof anno.dest?this.pdf.handler.getDestination(anno.dest):Promise.resolve(anno.dest),destPromise.then(function(dest){return"number"==typeof dest[0]?dest[0]:_this.pdf.handler.getPageIndex(dest[0])}).then(function(number){return _this.callHandlers("internal",number)}).catch(function(){return console.error("Bad link")})}}},PdfLinksHandler}();exports.default=PdfLinksHandler},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _Finder=__webpack_require__(17),_Finder2=_interopRequireDefault(_Finder),SearchEngine=function(){function SearchEngine(pageCallback,pages){_classCallCheck(this,SearchEngine),this.pageCallback=pageCallback,this.pages=pages,this.results=[]}return SearchEngine.prototype.setQuery=function(query){this.query=query,this.update=!0,this.process()},SearchEngine.prototype.process=function(){var _this=this;if(this.update){var results=this.results;if(this.results=[],this.onPageHitsChanged)for(var _iterator=results,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}this.onPageHitsChanged(void 0,"")}this.update=!1,this.page=0,this.stamp=Date.now(),this.query.length>1&&this.process()}else this.page0&&void 0!==arguments[0]?arguments[0]:1,gravity=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,cornerDeviation=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.15,fps=arguments.length>3&&void 0!==arguments[3]?arguments[3]:240;_classCallCheck(this,SheetPhysics),this.p={r:r,cornerDeviation:cornerDeviation,l:Math.PI*r,startDt:1/fps,gravity:gravity,margin:.002*r,infM:1e4,attempts:16,maxIterations:100},this.os=[]}return SheetPhysics.targetForceClb=function(o,a,v,ch){var l=a*this.r;return 100*this.m*this.g*(2/(1+Math.exp(10*(l-this.tl)))-1)-40*this.m*v},SheetPhysics.hoverCornerForceClb=function(o,v,l,ch){return 5},SheetPhysics.prototype.getTargetForceClb=function(mass,targetAngle){return SheetPhysics.targetForceClb.bind({g:this.p.gravity,m:mass,tl:targetAngle*this.p.r,r:this.p.r})},SheetPhysics.dragForceClb=function(o,a,v,ch){return o.flbt*o.m*(10*o.g*ch-50*v/(1+Math.exp(3.5*Math.abs(ch))))},SheetPhysics.dragCornerForceClb=function(o,a,v,ch){return 15*(2/(1+Math.exp(10*(a-this.ta)*o.r))-1)},SheetPhysics.getDragCornerForceClb=function(targetAngle){return SheetPhysics.dragCornerForceClb.bind({ta:targetAngle})},SheetPhysics.prototype.dispose=function(){this.os=[]},SheetPhysics.prototype.getSize=function(){return this.os.length},SheetPhysics.prototype.addObject=function(mass,angle,velocity,flexibility,cornerHeight,simulateClb,removeClb){var forceClb=arguments.length>7&&void 0!==arguments[7]?arguments[7]:function(){return 0},cornerForceClb=arguments.length>8&&void 0!==arguments[8]?arguments[8]:function(){return 0},no={id:_MathUtils2.default.getUnique(),m:mass,v:velocity,l:angle*this.p.r,f:forceClb,cf:cornerForceClb,ch:cornerHeight,flbt:flexibility,simulateClb:simulateClb,removeClb:removeClb},i=this.os.findIndex(function(o){return no.l<=o.l});return i=~i?i:this.os.length,this.os.splice(i,0,no),no.id},SheetPhysics.prototype.getParametrMap=function(name){var map={mass:"m",velocity:"v",flexibility:"flbt",cornerHeight:"ch",simulateClb:"simulateClb",removeClb:"removeClb",forceClb:"f",cornerForceClb:"cf"};return map[name]},SheetPhysics.prototype.setParametr=function(id,name,value){var o=this.os.find(function(o){return o.id===id});"angle"===name?o.l=value*this.p.r:o[this.getParametrMap(name)]=value},SheetPhysics.prototype.getParametr=function(id,name){var o=this.os.find(function(o){return o.id===id}),value=void 0;return value="angle"===name?o.l/this.p.r:o[this.getParametrMap(name)]},SheetPhysics.prototype.simulate=function(T){for(var t=0,dt=this.p.startDt,attempt=0,it=0;tT-t&&(dt=T-t);var nos=this.integrate(this.os,dt),ci=this.findCollisions(nos);if(ci.num>1&&attempt1){for(var gs=[],last=-2,_iterator=ci.all,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var i=_ref;i-last>1&&gs.push([]),gs[gs.length-1].push(i),last=i}for(var _iterator2=gs,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var g=_ref2,sg=void 0,i0=void 0;nos[g[0]].l>Math.PI/2*this.p.r?(sg=-1,i0=g[g.length-1]):(sg=1,i0=g[0]);for(var _i3=i0;_i3-1;_i3+=sg){var o=nos[_i3+sg];if(!(o&&sg*(o.l-nos[_i3].l)<=this.p.margin))break;o.l=nos[_i3].l+2*sg*this.p.margin,(o.l>this.p.l||o.l<0)&&(o.l=o.l>this.p.l?this.p.l:0,o.ch=0,o.v=0,console.error("Bad collision"))}}}this.os=nos,this.findAndSolveCornerCollisions(),t+=dt,dt=this.p.startDt,attempt=0}++it}this.removeStatics()},SheetPhysics.prototype.removeStatics=function(){for(var nos=[],notify=[[],[]],_iterator3=this.os,_isArray3=Array.isArray(_iterator3),_i4=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i4>=_iterator3.length)break;_ref3=_iterator3[_i4++]}else{if(_i4=_iterator3.next(),_i4.done)break;_ref3=_i4.value}var o=_ref3;o.simulateClb&&o.simulateClb(o.l/this.p.r,o.ch),o.l!==this.p.l&&0!==o.l||0!==o.v?nos.push(o):void 0!==o.removeClb&¬ify[(o.l!==this.p.l)+0].push(o)}this.os=nos;for(var _iterator4=notify[0].reverse(),_isArray4=Array.isArray(_iterator4),_i5=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){var _ref4;if(_isArray4){if(_i5>=_iterator4.length)break;_ref4=_iterator4[_i5++]}else{if(_i5=_iterator4.next(),_i5.done)break;_ref4=_i5.value}var _o=_ref4;_o.removeClb(Math.PI,_o.ch)}for(var _iterator5=notify[1],_isArray5=Array.isArray(_iterator5),_i6=0,_iterator5=_isArray5?_iterator5:_iterator5[Symbol.iterator]();;){var _ref5;if(_isArray5){if(_i6>=_iterator5.length)break;_ref5=_iterator5[_i6++]}else{if(_i6=_iterator5.next(),_i6.done)break;_ref5=_i6.value}var _o2=_ref5;_o2.removeClb(0,_o2.ch)}},SheetPhysics.prototype.findAndSolveCornerCollisions=function(){if(this.os.length)for(var os=[_extends({},this.os[0],{l:0,m:this.p.infM,ch:0})].concat(this.os,[_extends({},this.os[0],{l:1.05*this.p.l,m:this.p.infM,ch:0})]),i=1;ibl&&a.ch>b.ch){var dCh=a.ch-b.ch,dv=a.m/a.flbt+b.m/b.flbt,ka=a.m/a.flbt/dv,kb=b.m/b.flbt/dv;a.ch=a.ch-kb*dCh,b.ch=b.ch+ka*dCh}}},SheetPhysics.prototype.solveCollision=function(a,b){var mm=b.m+a.m,av=(-a.v*b.m+a.m*a.v+2*b.m*b.v)/mm,bv=(b.m*b.v-b.v*a.m+2*a.m*a.v)/mm;return[_extends({},a,{v:av}),_extends({},b,{v:bv})]},SheetPhysics.prototype.findCollisions=function(os){for(var ci={num:0,last:0,all:[]},i=1;ios[i].l||this.isCollision(os[i-1],os[i]))&&(os[i-1].l>os[i].l&&++ci.num,++ci.num,ci.last=i,ci.all.indexOf(i-1)===-1&&ci.all.push(i-1),ci.all.indexOf(i)===-1&&ci.all.push(i));return ci},SheetPhysics.prototype.isCollision=function(a,b){return Math.abs(a.l-b.l)b.v},SheetPhysics.prototype.integrate=function(os,dt){for(var nos=[],_iterator6=os,_isArray6=Array.isArray(_iterator6),_i7=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){var _ref6;if(_isArray6){if(_i7>=_iterator6.length)break;_ref6=_iterator6[_i7++]}else{if(_i7=_iterator6.next(),_i7.done)break;_ref6=_i7.value}var o=_ref6,vl=_MathUtils2.default.rk4(this.dy.bind({g:this.p.gravity,r:this.p.r,m:o.m,f:o.f,cf:o.cf,ch:o.ch,flbt:o.flbt}),0,dt,[o.v,o.l,o.ch]),no=_extends({},o,{v:vl[0],l:vl[1],ch:vl[2]});(no.l<=0||no.l>=this.p.l)&&(no.l=no.l<=0?0:this.p.l,no.v=0,no.ch=0),nos.push(no)}return nos},SheetPhysics.prototype.dy=function(t,y){var v=y[0],l=y[1],ch=y[2],f=this.f(this,l/this.r,v,ch),cf=this.cf(this,l/this.r,v,ch);return[(-this.g*Math.cos(l/this.r)*this.m+f)/this.m,v+.01*(Math.random()-.5),this.flbt*((2/(1+Math.exp(-.2*cf))-1)*(1-2/(1+Math.exp(-5*(Math.abs(ch)-2))))-ch)]},SheetPhysics}();exports.default=SheetPhysics},function(module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var SoundsEnviroment=function(){function SoundsEnviroment(){var template=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_classCallCheck(this,SoundsEnviroment),this.sounds=template.sounds||{},this.audio={},this.sounds.startFlip&&(this.audio.startFlip=new Audio(this.sounds.startFlip)),
+this.sounds.endFlip&&(this.audio.endFlip=new Audio(this.sounds.endFlip))}return SoundsEnviroment.prototype.setEnabled=function(enabled){this.enabled=enabled},SoundsEnviroment.prototype.togle=function(){this.enabled=!this.enabled},SoundsEnviroment.prototype.dispose=function(){delete this.audio.startFlip,delete this.audio.endFlip},SoundsEnviroment.prototype.startFlip=function(){this.enabled&&this.audio.startFlip&&this.audio.startFlip.play()},SoundsEnviroment.prototype.endFlip=function(){this.enabled&&this.audio.startFlip&&(this.audio.startFlip.pause(),this.audio.startFlip.currentTime=0),this.enabled&&this.audio.endFlip&&this.audio.endFlip.play()},SoundsEnviroment.prototype.subscribeFlips=function(emitter){emitter.addEventListener("startFlip",this.startFlip.bind(this)),emitter.addEventListener("endFlip",this.endFlip.bind(this))},SoundsEnviroment}();exports.default=SoundsEnviroment},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _WidgetController2=__webpack_require__(67),_WidgetController3=_interopRequireDefault(_WidgetController2),TocController=function(_WidgetController){function TocController(view,bookCtrl){_classCallCheck(this,TocController);var _this=_possibleConstructorReturn(this,_WidgetController.call(this,view));return _this.bookCtrl=bookCtrl,_this.tab="none",_this}return _inherits(TocController,_WidgetController),TocController.prototype.setThumbnails=function(thumbnails){this.thumbnails=thumbnails,thumbnails.onNavigate=this.navigateThumbnails.bind(this),"none"===this.tab&&(this.tab="thumbnails"),this.fireChange()},TocController.prototype.setSearch=function(search){this.search=search,search.onNavigate=this.navigateSearch.bind(this),this.fireChange()},TocController.prototype.setBookmarks=function(bookmarks,pdf){this.bookmarks=bookmarks,this.pdf=pdf,bookmarks.onNavigate=this.navigateBookmarks.bind(this),bookmarks.getSize()&&(this.tab="bookmarks",this.isBookmarks=!0),this.fireChange()},TocController.prototype.cmdBookmarks=function(){this.tab="bookmarks",this.fireChange()},TocController.prototype.cmdThumbnails=function(){this.tab="thumbnails",this.fireChange()},TocController.prototype.cmdSearch=function(){this.tab="search",this.fireChange()},TocController.prototype.cmdCloseToc=function(){this.hide()},TocController.prototype.navigateThumbnails=function(number){this.bookCtrl.goToPage(number)},TocController.prototype.navigateSearch=function(number){this.bookCtrl.goToPage(number)},TocController.prototype.navigateBookmarks=function(item){var _this2=this;if(item.url)window.open(item.url,"_blank");else if(item.dest){var destPromise=void 0;destPromise="string"==typeof item.dest?this.pdf.handler.getDestination(item.dest):Promise.resolve(item.dest),destPromise.then(function(dest){return _this2.pdf.handler.getPageIndex(dest[0])}).then(function(number){return _this2.bookCtrl.goToPage(number)}).catch(function(){return console.error("Bad bookmark")})}},TocController.prototype.updateView=function(){var _this3=this;this.view&&(this.view.setState("widTocMenu",{enable:!0,visible:!0,active:!1}),this.view.setState("widThumbnails",{enable:!0,visible:"thumbnails"===this.tab,active:!1}),this.view.setState("widSearch",{enable:!0,visible:"search"===this.tab,active:!1}),this.view.setState("widBookmarks",{enable:!0,visible:"bookmarks"===this.tab,active:!1}),this.view.setState("cmdBookmarks",{enable:!0,visible:!0,active:"bookmarks"===this.tab}),this.view.setState("cmdThumbnails",{enable:!0,visible:!0,active:"thumbnails"===this.tab}),this.view.setState("cmdSearch",{enable:!0,visible:!0,active:"search"===this.tab}),Promise.resolve().then(function(){return _this3.thumbnails.setEnable(_this3.visible&&"thumbnails"===_this3.tab)}),_WidgetController.prototype.updateView.call(this))},TocController}(_WidgetController3.default);exports.default=TocController},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.__esModule=!0;var _libs=__webpack_require__(1),_ThreeUtils=__webpack_require__(20),_ThreeUtils2=_interopRequireDefault(_ThreeUtils),resX=11,resY=2,resZ=15,scale=1,faces=[],frontGeometry=new _libs.THREE.PlaneGeometry(scale,scale,resX-1,resY-1);frontGeometry.translate(.5*scale,.5*scale,scale);var backGeometry=new _libs.THREE.PlaneGeometry(scale,scale,resX-1,resY-1);backGeometry.rotateY(Math.PI),backGeometry.translate(.5*scale,.5*scale,0);var leftGeometry=new _libs.THREE.PlaneGeometry(scale,scale,resZ-1,resY-1);leftGeometry.rotateY(-Math.PI/2),leftGeometry.translate(0,.5*scale,.5*scale);var rightGeometry=new _libs.THREE.PlaneGeometry(scale,scale,resZ-1,resY-1);rightGeometry.rotateY(Math.PI/2),rightGeometry.translate(scale,.5*scale,.5*scale);var topGeometry=new _libs.THREE.PlaneGeometry(scale,scale,resX-1,resZ-1);topGeometry.rotateX(-Math.PI/2),topGeometry.translate(.5*scale,scale,.5*scale);var bottomGeometry=topGeometry.clone();bottomGeometry.translate(0,-scale,0);for(var _iterator=bottomGeometry.faces,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var f=_ref,_ref3=[f.b,f.a];f.a=_ref3[0],f.b=_ref3[1]}var geometry=new _libs.THREE.Geometry;geometry.vertices=[].concat(bottomGeometry.vertices,topGeometry.vertices);var addFaces=function(fs,map){for(var _iterator2=fs,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var f=_ref2;geometry.faces.push(new _libs.THREE.Face3(map(f.a),map(f.b),map(f.c)))}faces.push(geometry.faces.length)},mapVertices=function(src,dst){for(var map=[],eq=function(a,b){return Math.abs(a.x-b.x)+Math.abs(a.y-b.y)+Math.abs(a.z-b.z)<1e-4},i=0;i2&&void 0!==arguments[2]?arguments[2]:function(i){return i.title},getItems=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(i){return i.items};_classCallCheck(this,Bookmarks),this.container=container,this.map=[],this.getTitle=getTitle,this.getItems=getItems,this.nodes=this.mapNodes(items,this.map),this.binds={togle:function(e){e.preventDefault();for(var li=(0,_libs.$)(e.target);li[0]&&li[0]!==container[0]&&!li.hasClass("item");)li=(0,_libs.$)(li[0].parentNode);if(li.hasClass("item")){for(var cmd=(0,_libs.$)(e.target);cmd[0]&&cmd[0]!==li[0]&&!cmd.hasClass("cmd");)cmd=(0,_libs.$)(cmd[0].parentNode);if(cmd.hasClass("cmd")){var node=_this.map[li.attr("data-id")];cmd.hasClass("togle")?(node.minimized=!node.minimized,node.minimized?(li.find("ul").remove(),li.find(".togle").addClass("minimized")):(li.find(".togle").removeClass("minimized"),li.append((_this.renderNode(node).match(//)||[""])[0]))):_this.onNavigate&&_this.onNavigate(node.item)}}}},container.on("click",this.binds.togle),this.update()}return Bookmarks.prototype.getSize=function(){return this.map.length},Bookmarks.prototype.dispose=function(){this.container.off("click",this.binds.togle),this.container.html("")},Bookmarks.prototype.update=function(){this.container.html(this.renderNodes(this.nodes))},Bookmarks.prototype.forEach=function(f){for(var nodes=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.nodes,_iterator=nodes||[],_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var node=_ref;f(node),this.forEach(f,node.children)}},Bookmarks.prototype.expand=function(){this.forEach(function(n){return n.minimized=!1}),this.update()},Bookmarks.prototype.minimize=function(){this.forEach(function(n){return n.minimized=!0}),this.update()},Bookmarks.prototype.renderNode=function(node){return['
"),res.join("")},Bookmarks.prototype.mapNodes=function(items){var map=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],level=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,nodes=null;if(items&&items.length){nodes=[];for(var _iterator3=items,_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var item=_ref3,id=map.length;map.push(void 0);var node={id:id,title:this.getTitle(item),level:level,item:item,minimized:!0,children:this.mapNodes(this.getItems(item),map,level+1)};nodes.push(node),map[id]=node}}return nodes},Bookmarks}();exports.default=Bookmarks},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),Detector=function(){function Detector(){_classCallCheck(this,Detector)}return Detector.getWebGLErrorMessage=function(){var element=document.createElement("div");return element.id="webgl-error-message",element.style.fontFamily="monospace",element.style.fontSize="13px",element.style.fontWeight="normal",element.style.textAlign="center",element.style.background="#fff",element.style.color="#000",element.style.padding="1.5em",element.style.width="400px",element.style.margin="5em auto 0",Detector.webgl||(element.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support WebGL. ','Find out how to get it here.'].join("\n"):['Your browser does not seem to support WebGL. ','Find out how to get it here.'].join("\n")),element},Detector.addGetWebGLMessage=function(parameters){var parent=void 0,id=void 0,element=void 0;parameters=parameters||{},parent=parameters.parent||(0,_libs.$)(document.body),id=parameters.id||"oldie",element=Detector.getWebGLErrorMessage(),parent.append(element)},Detector}();Detector.canvas=!!window.CanvasRenderingContext2D,Detector.webgl=function(){try{var canvas=document.createElement("canvas");return!(!window.WebGLRenderingContext||!canvas.getContext("webgl")&&!canvas.getContext("experimental-webgl"))}catch(e){return!1}}(),Detector.workers=!!window.Worker,Detector.fileapi=window.File&&window.FileReader&&window.FileList&&window.Blob,exports.default=Detector},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),DocMouseSimulator=function(){function DocMouseSimulator(jFrame,element){var bElement=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document.body;_classCallCheck(this,DocMouseSimulator),this.jFrame=jFrame,this.wnd=jFrame[0].contentWindow,this.doc=jFrame[0].contentDocument,this.element=element||doc.body,this.bElement=bElement,this.resendProperties=this.getDefaultResendProperties(),this.undefinedProperties=this.getDefaultUndefinedProperties(),this.cursors=[],this.onDocChangeClbs=[];for(var terms=[{find:":hover",replace:"."+DocMouseSimulator.HOVER},{find:":active",replace:"."+DocMouseSimulator.ACTIVE}],style=['"),(0,_libs.$)(this.doc.head).append((0,_libs.$)(style.join("")))}return DocMouseSimulator.prototype.convertCoords=function(x,y){var jElement=(0,_libs.$)(this.element),offset=jElement.offset();return{x:offset.left+jElement.width()*x,y:offset.top+jElement.height()*(1-y)}},DocMouseSimulator.prototype.triggerEvent=function(element,e,p,type,advancedProps){for(var props={},_iterator2=this.resendProperties,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var _n=_ref2;props[_n]=e[_n]}for(var _iterator3=this.undefinedProperties,_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var _n2=_ref3;props[_n2]=void 0}for(var n in advancedProps)advancedProps.hasOwnProperty(n)&&(props[n]=advancedProps[n]);props.view=this.wnd,props.pageX=p.x,props.pageY=p.y;var jE=_libs.$.Event(type,props);jE.timeStamp=e.timeStamp,(0,_libs.$)(element).trigger(jE)},DocMouseSimulator.prototype.addClass=function(element,name){(0,_libs.$)(element).addClass(name);var style=this.wnd.getComputedStyle(element);this.cursors.push((0,_libs.$)(this.bElement).css("cursor")),(0,_libs.$)(this.bElement).css("cursor",style.getPropertyValue("cursor"))},DocMouseSimulator.prototype.removeClass=function(element,name){(0,_libs.$)(element).removeClass(name),(0,_libs.$)(this.bElement).css("cursor",this.cursors.pop())},DocMouseSimulator.prototype.enterElement=function(element){this.addClass(element,DocMouseSimulator.HOVER)},DocMouseSimulator.prototype.leaveElement=function(element){this.removeClass(element,DocMouseSimulator.HOVER)},DocMouseSimulator.prototype.activateElement=function(element){this.addClass(element,DocMouseSimulator.ACTIVE)},DocMouseSimulator.prototype.deactivateElement=function(element){this.removeClass(element,DocMouseSimulator.ACTIVE)},DocMouseSimulator.prototype.addDocChangeClb=function(clb){this.onDocChangeClbs.push(clb)},DocMouseSimulator.prototype.notify=function(){for(var _iterator4=this.onDocChangeClbs,_isArray4=Array.isArray(_iterator4),_i4=0,_iterator4=_isArray4?_iterator4:_iterator4[Symbol.iterator]();;){var _ref4;if(_isArray4){if(_i4>=_iterator4.length)break;_ref4=_iterator4[_i4++]}else{if(_i4=_iterator4.next(),_i4.done)break;_ref4=_i4.value}var clb=_ref4;clb(this.wnd,this.doc)}},DocMouseSimulator.prototype.elementFromPoint=function(p){for(var node=this.doc.body,next=!0;next;){next=!1;for(var i=0;ioffset.left&&p.xoffset.top&&p.y','',xhtml,"",""].join("")})}function newUtil(){function mimes(){var WOFF="application/font-woff",JPEG="image/jpeg";return{woff:WOFF,woff2:WOFF,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:JPEG,jpeg:JPEG,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"}}function parseExtension(url){var match=/\.([^\.\/]*?)$/g.exec(url);return match?match[1]:""}function mimeType(url){var extension=parseExtension(url).toLowerCase();return mimes()[extension]||""}function isDataUrl(url){return url.search(/^(data:)/)!==-1}function toBlob(canvas){return new Promise(function(resolve){for(var binaryString=self.window.atob(canvas.toDataURL().split(",")[1]),length=binaryString.length,binaryArray=new self.window.Uint8Array(length),i=0;i=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var _resolve=_ref;_resolve(data.content)}data.pendings=[],resolve(data.content)},encoder.readAsDataURL(request.response)}}function timeout(){fail("timeout of "+TIMEOUT+"ms occured while fetching resource: "+url)}function fail(message){console.error(message),resolve("")}var request=new self.window.XMLHttpRequest;request.onreadystatechange=done,request.ontimeout=timeout,request.responseType="blob",request.timeout=TIMEOUT,request.open("GET",url,!0),request.send()})}function dataAsUrl(content,type){
+return["data:",type,";base64,",content].join("")}function escape(string){return string.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")}function delay(ms){return function(arg){return new Promise(function(resolve){setTimeout(function(){resolve(arg)},ms)})}}function asArray(arrayLike){for(var array=[],length=arrayLike.length,i=0;i0){var selected=intersects[0].object;if(!this.onPickCallback(intersects[0]))return;var v=intersects[0].point.clone();this.distance=v.sub(this.raycaster.ray.origin).length(),this.controlsState=this.visual.getControlsState(),this.visual.setControlsState(!1),this.plane.setFromNormalAndCoplanarPoint(this.visual.camera.getWorldDirection(this.plane.normal),intersects[0].point),this.selected=selected}}},Drag.prototype.onMouseMove=function(e){this.enabled&&(e.preventDefault(),this.selected&&(this.setCoordsFromEvent(e),this.raycaster.setFromCamera(this.coords,this.camera),this.raycaster.ray.intersectPlane(this.plane,this.intersection)&&(this.onDragCallback(this.intersection)||this.onMouseUp(e))))},Drag.prototype.onMouseUp=function(e){this.selected&&(this.onReleaseCallback(),this.selected=null,this.visual.setControlsState(this.controlsState)),this.enabled&&e.preventDefault()},Drag}();exports.default=Drag},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var action=_ref;action(e,data)}},EventsToActions.prototype.contextMenu=function(e){if(this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions("contextmenu",e.button,flags),e)}},EventsToActions.prototype.mouseDown=function(e){if(this.picked&&this.mouseUpDoc(),this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions("mousedown",e.button,flags),e),this.picked={x:e.pageX,y:e.pageY,actions:this.getActions("mousedrag",e.button,flags)},this.fireActions(this.picked.actions,e,{state:"start"})}},EventsToActions.prototype.mouseMove=function(e){if(this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions("mousemove",e.button,flags),e)}},EventsToActions.prototype.mouseMoveDoc=function(e){this.enabled&&this.picked&&(this.fireActions(this.picked.actions,e,{state:"move",dx:e.pageX-this.picked.x,dy:e.pageY-this.picked.y}),this.picked={x:e.pageX,y:e.pageY,actions:this.picked.actions})},EventsToActions.prototype.mouseUp=function(e){if(this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions("mouseup",e.button,flags),e)}},EventsToActions.prototype.mouseUpDoc=function(e){this.picked&&(this.fireActions(this.picked.actions,e,{state:"end"}),delete this.picked)},EventsToActions.prototype.mouseWheel=function(e){if(this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions("mousewheel",0,flags),e)}},EventsToActions.prototype.clicks=function(e,type){if(this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions(type,e.button,flags),e)}},EventsToActions.prototype.click=function(e){this.clicks(e,"click")},EventsToActions.prototype.dblclick=function(e){this.clicks(e,"dblclick")},EventsToActions.prototype.touchPick=function(e,flags,touches){this.touchPicked=_extends({},EventsToActions.getPosition(touches),{actions:this.getActions("touchdrag",touches.length,flags),code:touches.length,flags:flags}),this.fireActions(this.touchPicked.actions,e,{state:"start"})},EventsToActions.prototype.touchStart=function(e){if(this.touchPicked&&this.touchEnd(e),this.enabled){var flags=EventsToActions.getEventFlags(e),touches=e.touches||e.originalEvent.touches;this.fireActions(this.getActions("touchstart",touches.length,flags),e),this.touchPick(e,flags,touches)}},EventsToActions.prototype.touchMove=function(e){if(this.enabled){var flags=EventsToActions.getEventFlags(e),touches=e.touches||e.originalEvent.touches;if(this.fireActions(this.getActions("touchmove",touches.length,flags),e),this.touchPicked)if(this.touchPicked.code===touches.length&&this.touchPicked.flags===flags){var pos=EventsToActions.getPosition(touches);this.fireActions(this.touchPicked.actions,e,{state:"move",dx:pos.x-this.touchPicked.x,dy:pos.y-this.touchPicked.y}),this.touchPicked=_extends({},this.touchPicked,pos)}else this.touchEnd(e),this.touchPick(e,flags,touches)}},EventsToActions.prototype.touchEnd=function(e){this.touchPicked&&(this.fireActions(this.touchPicked.actions,e,{state:"end"}),delete this.touchPicked)},EventsToActions.prototype.key=function(e,type){if(this.enabled){var flags=EventsToActions.getEventFlags(e);this.fireActions(this.getActions(type,e.keyCode,flags),e)}},EventsToActions.prototype.keyDown=function(e){this.key(e,"keydown")},EventsToActions.prototype.keyPress=function(e){this.key(e,"keypress")},EventsToActions.prototype.keyUp=function(e){this.key(e,"keyup")},EventsToActions.prototype.dispose=function(){this.element.off("contextmenu",this.binds.contextMenu),this.element.off("mousedown",this.binds.mouseDown),this.element.off("mousemove",this.binds.mouseMove),this.element.off("mouseup",this.binds.mouseUp),this.element.off("mousewheel",this.binds.mouseWheel),(0,_libs.$)(this.doc).off("mousemove",this.binds.mouseMoveDoc),(0,_libs.$)(this.doc).off("mouseup",this.binds.mouseUpDoc),this.element.off("click",this.binds.click),this.element.off("dblclick",this.binds.dblclick),this.element.off("touchstart",this.binds.touchStart),this.element.off("touchmove",this.binds.touchMove),this.element.off("touchend",this.binds.touchEnd),(0,_libs.$)(this.wnd).off("keydown",this.binds.keyDown),(0,_libs.$)(this.wnd).off("keypress",this.binds.keyPress),(0,_libs.$)(this.wnd).off("keyup",this.binds.keyUp)},EventsToActions}();EventsToActions.modKeys={Ctrl:1,Shift:2,Alt:4},EventsToActions.mouseButtons={Left:0,Middle:1,Right:2},exports.default=EventsToActions},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),_ImageBase2=__webpack_require__(5),_ImageBase3=_interopRequireDefault(_ImageBase2),_BaseMathUtils=__webpack_require__(2),_BaseMathUtils2=_interopRequireDefault(_BaseMathUtils),_Dom2Image=__webpack_require__(48),_Dom2Image2=_interopRequireDefault(_Dom2Image),_DocMouseSimulator=__webpack_require__(47),_DocMouseSimulator2=_interopRequireDefault(_DocMouseSimulator),InteractiveImage=function(_ImageBase){function InteractiveImage(context,width,height,color,src,cache,injector){_classCallCheck(this,InteractiveImage);var _this=_possibleConstructorReturn(this,_ImageBase.call(this,context,width,height,color));_this.iId="i"+_BaseMathUtils2.default.getUnique();var jFrame=(0,_libs.$)('');return(0,_libs.$)(_this.doc.body).append(jFrame),_this.frame=jFrame[0],_this.binds={},injector&&injector(_this.frame.contentWindow),_this.doc.implementation.hasFeature("www.http://w3.org/TR/SVG11/feature#Extensibility","1.1")&&(_this.image=new Image,_this.binds.imageLoad=function(){_this.renderImage(_this.image),_this.finishRender()},(0,_libs.$)(_this.image).on("load",_this.binds.imageLoad),_this.svgRender=new _Dom2Image2.default(_this.frame.contentWindow,_this.frame.contentDocument,cache)),_this.binds.frameLoad=function(){~_this.frame.contentDocument.title.indexOf("404")?(_this.startRender=function(){_this.renderNotFoundPage(),_this.finishRender()},_this.finishLoad()):setTimeout(function(){_this.frame&&(_this.width=(0,_libs.$)(_this.frame.contentDocument.body).width(),_this.height=(0,_libs.$)(_this.frame.contentDocument.body).height(),jFrame.css("width",_this.width+"px").css("height",_this.height+"px"),jFrame.offset({left:-_this.width-100,top:0}),_this.svgRender&&(_this.simulator=new _DocMouseSimulator2.default(jFrame,_this.frame.contentDocument.body,_this.element),_this.simulator.addDocChangeClb(_this.finishLoad.bind(_this))),_this.startRender=function(){_this.render()},_this.finishLoad())},500)},(0,_libs.$)(_this.frame.contentWindow).on("load",_this.binds.frameLoad),_this}return _inherits(InteractiveImage,_ImageBase),InteractiveImage.prototype.getSimulatedDoc=function(){return this.frame.contentDocument},InteractiveImage.prototype.render=function(){var _this2=this;this.svgRender?this.svgRender.toSvg(this.simulator.element,{height:this.height+"px",width:this.width+"px"}).then(function(dataUrl){_this2.image.src=dataUrl}).catch(function(error){console.error("Dom2Image: ",error),_this2.renderBlankPage(),_this2.finishRender()}):(0,_libs.html2canvas)(this.frame.contentDocument.body,{timeout:3e4}).then(function(canvas){_this2.renderImage(canvas),_this2.finishRender()})},InteractiveImage.prototype.dispose=function(){(0,_libs.$)(this.image).off("load",this.binds.imageLoad),(0,_libs.$)(this.frame.contentWindow).off("load",this.binds.frameLoad),(0,_libs.$)(this.doc.body).find("#"+this.iId).remove(),this.image&&(this.image.src="",delete this.image),this.frame.src="",delete this.frame,_ImageBase.prototype.dispose.call(this)},InteractiveImage.prototype.simulate=function(e,doc,x,y){this.simulator&&this.simulator.simulate(e,doc,x,y)},InteractiveImage}(_ImageBase3.default);exports.default=InteractiveImage},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),_GraphUtils=__webpack_require__(7),_GraphUtils2=_interopRequireDefault(_GraphUtils),_MathUtils=__webpack_require__(3),_MathUtils2=_interopRequireDefault(_MathUtils),LoadingAnimation=function(){function LoadingAnimation(width,height,color){_classCallCheck(this,LoadingAnimation);var jC=(0,_libs.$)('');this.c=jC[0],this.p={g:9.8,dt:1/60,color:color,updateInterval:.25},this.ctx=this.c.getContext("2d"),this.os=[-2,Math.PI/2],this.t=this.p.updateInterval}return LoadingAnimation.prototype.dy=function(t,y){var w=y[0],a=y[1];return[-this.g*Math.cos(a),w]},LoadingAnimation.prototype.integrate=function(T){for(var t=0,dt=this.p.dt,os=this.os;tT&&(dt=T-t),os=_MathUtils2.default.rk4(this.dy.bind({g:this.p.g}),0,dt,os),t+=dt;return os},LoadingAnimation.prototype.calcTimeTo=function(target){for(var t=0,dt=this.p.dt,os=this.os;Math.abs(os[1]-target)>1e-4;){var nos=_MathUtils2.default.rk4(this.dy.bind({g:this.p.g}),0,dt,os);nos[0]<0&&nos[1]0&&nos[1]>target?dt/=2:(os=nos,t+=dt)}return t},LoadingAnimation.prototype.update=function(T){if(this.os=this.integrate(T),this.t+=T,this.t>=this.p.updateInterval){this.t=0;var r=.1*Math.min(this.c.width,this.c.height),a=this.os[1],x0=.5*this.c.width,y0=.5*this.c.height,ctx=this.ctx;ctx.clearRect(0,0,this.c.width,this.c.height),ctx.beginPath(),ctx.fillStyle=_GraphUtils2.default.color2Rgba(this.p.color,1),ctx.rect(0,0,this.c.width,this.c.height),ctx.fill(),ctx.beginPath(),ctx.shadowBlur=50,ctx.fillStyle=_GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color,.9),Math.abs(this.os[0]/6.36)),ctx.shadowColor=_GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color,1),.9),ctx.shadowOffsetX=0,ctx.shadowOffsetY=0,ctx.font="bold "+Math.round(.25*r)+"px Arial",ctx.textAlign="center",ctx.textBaseline="middle",ctx.fillText("Loading...",x0,y0);var ps=10,da=2*Math.PI/ps;ctx.shadowColor=_GraphUtils2.default.color2Rgba(_GraphUtils2.default.inverseColor(this.p.color,1),.7);for(var i=0,_a=a,_r=.2*r;i')[0],ctx=c.getContext("2d"),t=this.calcTimeTo(this.os[1]+2*Math.sign(this.os[0])*Math.PI),dt=t/(n+1),updateInterval=this.p.updateInterval;this.p.updateInterval=0;for(var i=0;i1&&void 0!==arguments[1])||arguments[1],loadingMsg=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;_classCallCheck(this,LoadingController),this.view=view,this.progress=0,this.showProgress=showProgress,this.getLoadingMsg=loadingMsg||LoadingController.defaultLoadingMsg,this.updateView()}return LoadingController.defaultLoadingMsg=function(progress){return["Please wait... the Application is Loading: ",progress,"%"].join("")},LoadingController.prototype.dispose=function(){this.showProgress=!1,this.updateView(),delete this.view},LoadingController.prototype.setProgress=function(v){this.progress=v,this.updateView()},LoadingController.prototype.updateView=function(){if(this.view){this.view.setState("widLoadingProgress",{enable:!0,visible:this.showProgress,active:!1}),this.view.setState("txtLoadingProgress",{value:this.getLoadingMsg(this.progress),visible:!0});for(var _iterator=this.view.getLinks(),_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var name=_ref;this.view.setState(name,{enable:!1,visible:!0,active:!1})}this.view.setState("inpPages",{visible:!0,value:""}),this.view.setState("inpPage",{visible:!0,enable:!1,value:""})}},LoadingController}());exports.default=LoadingController},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),_EventConverter2=__webpack_require__(6),_EventConverter3=_interopRequireDefault(_EventConverter2),MouseEventConverter=function(_EventConverter){function MouseEventConverter(wnd,doc,element){_classCallCheck(this,MouseEventConverter);var _this=_possibleConstructorReturn(this,_EventConverter.call(this,wnd,doc));return _this.element=element,_this.binds={convert:_this.convert.bind(_this)},(0,_libs.$)(_this.element).on("mousemove mousedown mouseover mouseout click",_this.binds.convert),(0,_libs.$)(_this.doc).on("mouseup",_this.binds.convert),_this}return _inherits(MouseEventConverter,_EventConverter),MouseEventConverter.prototype.dispose=function(){(0,_libs.$)(this.element).off("mousemove mousedown mouseover mouseout click",this.binds.convert),(0,_libs.$)(this.doc).off("mouseup",this.binds.convert)},MouseEventConverter}(_EventConverter3.default);exports.default=MouseEventConverter},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i2&&void 0!==arguments[2]?arguments[2]:this.testScale;_classCallCheck(this,Object3DWatcher),this.visual=visual,this.boundBoxClb=boundBoxClb,this.testScale=testScale,this.camera=visual.camera,this.element=this.visual.element,this.elementSize={w:1,h:1},this.devicePixelRatio=this.visual.wnd.devicePixelRatio||1,this.orbit=visual.getOrbit(),this.scale=1,this.eps=1e-4,this.v=new _libs.THREE.Vector3,this.dv=new _libs.THREE.Vector2,this.enabled=!1,visual.addRenderCallback(this.update.bind(this)),this.os={vx:0,vy:0,x:0,y:0},this.orbit.update(),this.camera.updateMatrixWorld();var box=this.computeClientBoundBox(),k=1.11;this.movePan({x:-k*box.mid.x,y:-k*box.mid.y})}return Object3DWatcher.prototype.movePan=function(dv){this.orbit.pan(dv.x*this.visual.width(),-dv.y*this.visual.height())},Object3DWatcher.prototype.vToCamera=function(v){return v.project(this.camera),{x:.5*v.x,y:.5*v.y}},Object3DWatcher.prototype.computeClientBoundBox=function(){for(var box=this.boundBoxClb(),xs=[box.min.x,box.max.x],ys=[0,0],zs=[box.min.z,box.max.z],ps=[],res={max:{},min:{}},_iterator=xs,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}for(var x=_ref,_iterator2=ys,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}for(var y=_ref2,_iterator3=zs,_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var z=_ref3;ps.push(this.vToCamera(this.v.set(x,y,z)))}}}return ps.sort(function(p1,p2){return p1.x-p2.x}),res.min.x=ps[0].x,res.max.x=ps[ps.length-1].x,ps.sort(function(p1,p2){return p1.y-p2.y}),res.min.y=ps[0].y,res.max.y=ps[ps.length-1].y,res.width=res.max.x-res.min.x,res.height=res.max.y-res.min.y,res.mid={x:.5*(res.max.x+res.min.x),y:.5*(res.max.y+res.min.y)},res},Object3DWatcher.prototype.setObject=function(boundBoxClb){this.boundBoxClb=boundBoxClb},Object3DWatcher.prototype.testScale=function(){return!0},Object3DWatcher.prototype.computeCorr=function(K,min,max){var corr=0;return K<1?min>-.5?corr=-.5-min:max<.5&&(corr=.5-max):min<-.5?corr=-.5-min:max>.5&&(corr=.5-max),corr},Object3DWatcher.prototype.getScale=function(){var box=this.computeClientBoundBox(),Kx=this.elementSize.w/box.width,Ky=this.elementSize.h/box.height;return 1/Math.min(Kx,Ky)},Object3DWatcher.prototype.centerView=function(T){var _this=this,box=this.computeClientBoundBox(),Kx=this.elementSize.w/box.width,Ky=this.elementSize.h/box.height,K=Math.min(Kx,Ky);if(this.testScale()&&Math.abs(1/K-this.scale)>this.eps){var scale=1/K+.2*(this.scale-1/K);this.orbit.setScale(this.orbit.getScale()/(K*scale)),this.orbit.update(),this.camera.updateMatrixWorld(),box=this.computeClientBoundBox(),Kx=this.elementSize.w/box.width,Ky=this.elementSize.h/box.height,K=Math.min(Kx,Ky)}var dv=this.dv;if(K>1-this.eps?dv.set(-box.mid.x,-box.mid.y):dv.set(this.computeCorr(Kx,box.min.x,box.max.x),this.computeCorr(Ky,box.min.y,box.max.y)),Math.sqrt(this.os.vx*this.os.vx+this.os.vy*this.os.vy)>.003||dv.length()>.003){var dt=1/60,t=0,os=_extends({},this.os,{x:0,y:0});for(os.tf=function(vx,vy,x,y){return{x:75*(dv.x-x)/Math.pow(_this.devicePixelRatio,1),y:75*(dv.y-y)/Math.pow(_this.devicePixelRatio,1)}};tT&&(dt=T-t),os=this.integrate(os,dt),t+=dt;this.movePan(os),this.os=os}},Object3DWatcher.prototype.integrate=function(os,dt){var _MathUtils$rk=_MathUtils2.default.rk4(this.dy.bind(os),0,dt,[os.vx,os.vy,os.x,os.y]),vx=_MathUtils$rk[0],vy=_MathUtils$rk[1],x=_MathUtils$rk[2],y=_MathUtils$rk[3];
+return _extends({},os,{vx:vx,vy:vy,x:x,y:y})},Object3DWatcher.prototype.dy=function(t,Y){var vx=Y[0],vy=Y[1],x=Y[2],y=Y[3],vd=15,tf=this.tf(vx,vy,x,y);return[tf.x-vd*vx,tf.y-vd*vy,vx,vy]},Object3DWatcher.prototype.update=function(dt){this.enabled&&this.boundBoxClb&&this.centerView(dt)},Object3DWatcher}();exports.default=Object3DWatcher},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),Orbit=function(_THREE$EventDispatche){function Orbit(object,domElement){function getAutoRotationAngle(){return 2*Math.PI/60/60*scope.autoRotateSpeed}function getZoomScale(){return Math.pow(.95,scope.zoomSpeed)}function rotateLeft(angle){sphericalDelta.theta-=angle}function rotateUp(angle){sphericalDelta.phi-=angle}function dollyIn(dollyScale){scope.object instanceof _libs.THREE.PerspectiveCamera?scale/=dollyScale:scope.object instanceof _libs.THREE.OrthographicCamera?(scope.object.zoom=Math.max(scope.minZoom,Math.min(scope.maxZoom,scope.object.zoom*dollyScale)),scope.object.updateProjectionMatrix(),zoomChanged=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type-dolly/zoom disabled."),scope.enableZoom=!1)}function dollyOut(dollyScale){scope.object instanceof _libs.THREE.PerspectiveCamera?scale*=dollyScale:scope.object instanceof _libs.THREE.OrthographicCamera?(scope.object.zoom=Math.max(scope.minZoom,Math.min(scope.maxZoom,scope.object.zoom/dollyScale)),scope.object.updateProjectionMatrix(),zoomChanged=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type-dolly/zoom disabled."),scope.enableZoom=!1)}function rotate(event,data){if(scope.enabled&&scope.enableRotate&&"move"===data.state){var element=scope.domElement;rotateLeft(2*Math.PI*data.dx/element.clientWidth*scope.rotateSpeed),rotateUp(2*Math.PI*data.dy/element.clientHeight*scope.rotateSpeed),scope.update()}}function pan(event,data){scope.enabled&&scope.enablePan&&"move"===data.state&&(scope.pan(data.dx,data.dy),scope.update())}function offsetDolly(event,data){scope.enabled&&scope.enableZoom&&"move"===data.state&&(data.dy>0?dollyIn(getZoomScale()):data.dy<0&&dollyOut(getZoomScale()),scope.update())}function wheelDolly(event){scope.enabled&&scope.enableZoom&&(event.deltaY>0?dollyOut(getZoomScale()):event.deltaY<0&&dollyIn(getZoomScale()),scope.update())}_classCallCheck(this,Orbit);var _this=_possibleConstructorReturn(this,_THREE$EventDispatche.call(this));_this.object=object,_this.domElement=domElement||document.body,_this.enabled=!0,_this.target=new _libs.THREE.Vector3,_this.minDistance=0,_this.maxDistance=1/0,_this.minZoom=0,_this.maxZoom=1/0,_this.minPolarAngle=0,_this.maxPolarAngle=Math.PI,_this.minAzimuthAngle=-(1/0),_this.maxAzimuthAngle=1/0,_this.enableDamping=!1,_this.dampingFactor=.25,_this.enableZoom=!0,_this.zoomSpeed=1,_this.enableRotate=!0,_this.rotateSpeed=1,_this.enablePan=!0,_this.autoRotate=!1,_this.autoRotateSpeed=2,_this.target0=_this.target.clone(),_this.position0=_this.object.position.clone(),_this.zoom0=_this.object.zoom,_this.getPolarAngle=function(){return spherical.phi},_this.getAzimuthalAngle=function(){return spherical.theta},_this.reset=function(){scope.target.copy(scope.target0),scope.object.position.copy(scope.position0),scope.object.zoom=scope.zoom0,scope.object.updateProjectionMatrix(),scope.dispatchEvent(changeEvent),scope.update()},_this.zoomOut=function(){var speed=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.zoomSpeed,_speed=this.zoomSpeed;this.zoomSpeed=speed,dollyIn(getZoomScale()),this.zoomSpeed=_speed},_this.zoomIn=function(){var speed=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.zoomSpeed,_speed=this.zoomSpeed;this.zoomSpeed=speed,dollyOut(getZoomScale()),this.zoomSpeed=_speed},_this.getScale=function(){return scale},_this.setScale=function(newScale){scale=newScale},_this.update=function(){var offset=new _libs.THREE.Vector3,quat=(new _libs.THREE.Quaternion).setFromUnitVectors(object.up,new _libs.THREE.Vector3(0,1,0)),quatInverse=quat.clone().inverse(),lastPosition=new _libs.THREE.Vector3,lastQuaternion=new _libs.THREE.Quaternion;return function(){var position=scope.object.position;return offset.copy(position).sub(scope.target),offset.applyQuaternion(quat),spherical.setFromVector3(offset),scope.autoRotate&&rotateLeft(getAutoRotationAngle()),spherical.theta+=sphericalDelta.theta,spherical.phi+=sphericalDelta.phi,spherical.theta=Math.max(scope.minAzimuthAngle,Math.min(scope.maxAzimuthAngle,spherical.theta)),spherical.phi=Math.max(scope.minPolarAngle,Math.min(scope.maxPolarAngle,spherical.phi)),spherical.makeSafe(),spherical.radius*=scale,spherical.radius=Math.max(scope.minDistance,Math.min(scope.maxDistance,spherical.radius)),scope.target.add(panOffset),offset.setFromSpherical(spherical),offset.applyQuaternion(quatInverse),position.copy(scope.target).add(offset),scope.object.lookAt(scope.target),scope.enableDamping===!0?(sphericalDelta.theta*=1-scope.dampingFactor,sphericalDelta.phi*=1-scope.dampingFactor):sphericalDelta.set(0,0,0),scale=1,panOffset.set(0,0,0),!!(zoomChanged||lastPosition.distanceToSquared(scope.object.position)>EPS||8*(1-lastQuaternion.dot(scope.object.quaternion))>EPS)&&(scope.dispatchEvent(changeEvent),lastPosition.copy(scope.object.position),lastQuaternion.copy(scope.object.quaternion),zoomChanged=!1,!0)}}(),_this.dispose=function(){};var scope=_this,changeEvent={type:"change"},EPS=1e-6,spherical=new _libs.THREE.Spherical,sphericalDelta=new _libs.THREE.Spherical,scale=1,panOffset=new _libs.THREE.Vector3,zoomChanged=!1,panLeft=function(){var v=new _libs.THREE.Vector3;return function(distance,objectMatrix){v.setFromMatrixColumn(objectMatrix,0),v.multiplyScalar(-distance),panOffset.add(v)}}(),panUp=function(){var v=new _libs.THREE.Vector3;return function(distance,objectMatrix){v.setFromMatrixColumn(objectMatrix,1),v.multiplyScalar(distance),panOffset.add(v)}}();return scope.pan=function(){var offset=new _libs.THREE.Vector3;return function(deltaX,deltaY){var element=scope.domElement;if(scope.object instanceof _libs.THREE.PerspectiveCamera){var position=scope.object.position;offset.copy(position).sub(scope.target);var targetDistance=offset.length();targetDistance*=Math.tan(scope.object.fov/2*Math.PI/180),panLeft(2*deltaX*targetDistance/element.clientHeight,scope.object.matrix),panUp(2*deltaY*targetDistance/element.clientHeight,scope.object.matrix)}else scope.object instanceof _libs.THREE.OrthographicCamera?(panLeft(deltaX*(scope.object.right-scope.object.left)/scope.object.zoom/element.clientWidth,scope.object.matrix),panUp(deltaY*(scope.object.top-scope.object.bottom)/scope.object.zoom/element.clientHeight,scope.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type-pan disabled."),scope.enablePan=!1)}}(),_this.actions={rotate:rotate,pan:pan,offsetDolly:offsetDolly,wheelDolly:wheelDolly},_this.update(),_this}return _inherits(Orbit,_THREE$EventDispatche),Orbit}(_libs.THREE.EventDispatcher);exports.default=Orbit},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),_ImageBase2=__webpack_require__(5),_ImageBase3=_interopRequireDefault(_ImageBase2),_Pdf=__webpack_require__(18),_Pdf2=_interopRequireDefault(_Pdf),_BaseMathUtils=__webpack_require__(2),_BaseMathUtils2=_interopRequireDefault(_BaseMathUtils),_CustomEventConverter=__webpack_require__(16),_CustomEventConverter2=_interopRequireDefault(_CustomEventConverter),_PolyTarget=__webpack_require__(69),_PolyTarget2=_interopRequireDefault(_PolyTarget),_Finder=__webpack_require__(17),_Finder2=_interopRequireDefault(_Finder),PdfImage=function(_ImageBase){function PdfImage(context,width,height,color,pdf,n){_classCallCheck(this,PdfImage);var _this=_possibleConstructorReturn(this,_ImageBase.call(this,context,width,height,color));return _this.query="",_this.n=n,_this.pdf=pdf,_this.v={x:0,y:0,z:0,set:function(x,y,z){return this.x=x,this.y=y,this.z=z,this},transform:function(m){var x=m.m[0][0]*this.x+m.m[1][0]*this.y+m.m[2][0]*this.z,y=m.m[0][1]*this.x+m.m[1][1]*this.y+m.m[2][1]*this.z,z=m.m[0][2]*this.x+m.m[0][2]*this.y+m.m[2][0]*this.z;return this.x=x,this.y=y,this.z=z,this}},_this.m={m:[[1,0,0],[0,1,0],[0,0,1]],set:function(m00,m01,m02,m10,m11,m12,m20,m21,m22){return this.m=[[m00,m01,m02],[m10,m11,m12],[m20,m21,m22]],this}},_this.startRender=function(){_this.pdf.getHandler(_this.render.bind(_this))},Promise.resolve().then(function(){return _this.pdf.getHandler(_this.init.bind(_this))}),_this}return _inherits(PdfImage,_ImageBase),PdfImage.prototype.setQuery=function(query){this.query=query.trim(),this.textContent&&(this.setHits(this.textContent),this.finishLoad())},PdfImage.prototype.rectSize=function(r){return{width:r[2]-r[0],height:r[3]-r[1]}},PdfImage.prototype.createPoly=function(m,p,s){var poly=[],v=this.v;return v.set(p.x,p.y,1).transform(m),poly.push({x:v.x,y:v.y}),v.set(p.x,p.y+s.height,1).transform(m),poly.push({x:v.x,y:v.y}),v.set(p.x+s.width,p.y+s.height,1).transform(m),poly.push({x:v.x,y:v.y}),v.set(p.x+s.width,p.y,1).transform(m),poly.push({x:v.x,y:v.y}),poly},PdfImage.prototype.getSimulatedDoc=function(){return this.page},PdfImage.prototype.simulate=function(e,doc,x,y){this.eventConverter&&this.eventConverter.convert(e,{doc:doc,x:x,y:y})},PdfImage.prototype.setAnnotations=function(annos){var _this2=this,t=this.viewport.transform,targets=[];this.m.set(t[0],t[1],0,t[2],t[3],0,t[4],t[5],1);for(var _iterator=annos,_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if(_isArray){if(_i>=_iterator.length)break;_ref=_iterator[_i++]}else{if(_i=_iterator.next(),_i.done)break;_ref=_i.value}var anno=_ref;if("Link"===anno.subtype){var rect=anno.rect,aPos={x:rect[0],y:rect[1]},aSz=this.rectSize(rect),_target=new _PolyTarget2.default(this.createPoly(this.m,aPos,aSz).map(function(p){return{x:p.x/_this2.viewport.width,y:1-p.y/_this2.viewport.height}}));_target.anno=anno,_target.callback=this.annoClb.bind(this),targets.push(_target)}}if(targets.length){this.eventConverter=new _CustomEventConverter2.default(this.wnd,this.doc,_PolyTarget2.default.test,this.page);for(var _iterator2=targets,_isArray2=Array.isArray(_iterator2),_i2=0,_iterator2=_isArray2?_iterator2:_iterator2[Symbol.iterator]();;){var _ref2;if(_isArray2){if(_i2>=_iterator2.length)break;_ref2=_iterator2[_i2++]}else{if(_i2=_iterator2.next(),_i2.done)break;_ref2=_i2.value}var target=_ref2;this.eventConverter.addCustom(target)}}},PdfImage.prototype.setHits=function(textContent){this.textContent=textContent,""!==this.query&&(this.finder=new _Finder2.default(textContent.items.map(function(item){return item.str}),this.query,{contexts:!1}))},PdfImage.prototype.renderHits=function(){var _this3=this;if(this.finder){for(var testSz=(this.page.view,(0,_libs.$)('').appendTo("body")),textDiv=testSz[0],baseOffset=testSz.offset().left,_iterator3=this.finder.getHits(),_isArray3=Array.isArray(_iterator3),_i3=0,_iterator3=_isArray3?_iterator3:_iterator3[Symbol.iterator]();;){var _ref3;if(_isArray3){if(_i3>=_iterator3.length)break;_ref3=_iterator3[_i3++]}else{if(_i3=_iterator3.next(),_i3.done)break;_ref3=_i3.value}var hit=_ref3,item=this.textContent.items[hit.index],t=PDFJS.Util.transform(this.viewport.transform,item.transform),style=this.textContent.styles[item.fontName],angle=Math.atan2(t[1],t[0])+(style.vertical?Math.PI/2:0),fontHeight=Math.sqrt(t[2]*t[2]+t[3]*t[3]),fontAscent=style.ascent?style.ascent*fontHeight:style.descent?(1+style.descent)*fontHeight:fontHeight;testSz.html(item.str.substr(0,hit.offset)+""+item.str.substr(hit.offset,hit.length)+""+item.str.substr(hit.offset+hit.length)),textDiv.style.fontSize=fontHeight+"px",textDiv.style.fontFamily=style.fontFamily;var testSpan=testSz.find("span"),iwidth=style.vertical?item.height*this.viewport.scale:item.width*this.viewport.scale,width=testSz.width(),relativeOffset=(testSpan.offset().left-baseOffset)/width;this.m.set(1,0,0,0,1,0,t[4]+fontAscent*Math.sin(angle),t[5]-fontAscent*Math.cos(angle),1);var poly=this.createPoly(this.m,{x:relativeOffset*iwidth,y:0},{width:iwidth*testSpan.width()/width,height:testSpan.height()});poly=poly.map(function(p){return{x:p.x/_this3.viewport.width,y:1-p.y/_this3.viewport.height}}),this.renderHit(poly)}testSz.remove()}},PdfImage.prototype.annoClb=function(e,data){this.context.dispatchEvent&&this.context.dispatchEvent({type:"pdfAnnotation",event:e,annotation:data.target.anno})},PdfImage.prototype.init=function(handler){var _this4=this;handler.getPage(this.n+1).then(function(page){_this4.page=page,_this4.size=_Pdf2.default.getPageSize(page),page.getAnnotations().then(_this4.setAnnotations.bind(_this4)),page.getTextContent().then(_this4.setHits.bind(_this4));var scale=_BaseMathUtils2.default.calcScale(_this4.size.width,_this4.size.height,_this4.resW,_this4.resH);_this4.viewport=page.getViewport(scale),_this4.resW=_this4.width=_this4.viewport.width,_this4.resH=_this4.height=_this4.viewport.height,_this4.finishLoad()}).catch(function(e){console.error("Cannot load PDF page: "+(_this4.n+1)),_this4.finishLoad()})},PdfImage.prototype.render=function(handler){var _this5=this;this.page?this.page.render({canvasContext:this.pushCtx(),viewport:this.viewport}).then(function(){_this5.renderHits(),_this5.popCtx(),_this5.finishRender()}):(this.renderBlankPage(),this.finishRender())},PdfImage}(_ImageBase3.default);exports.default=PdfImage},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),Search=function(){function Search(container,pages){_classCallCheck(this,Search),this.container=container,this.pages=pages,this.prevResults=[],container.html('\n
"),htmls.push(""),htmls.push("")}(0,_libs.$)(htmls.join("")).appendTo(this.results),this.prevResults=[].concat(results),void 0===lastPage?this.status.html(""):this.status.html(lastPage+" of "+this.pages)},Search}();exports.default=Search},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),_ImageBase2=__webpack_require__(5),_ImageBase3=_interopRequireDefault(_ImageBase2),_Utils=__webpack_require__(4),_Utils2=_interopRequireDefault(_Utils),StaticImage=function(_ImageBase){function StaticImage(context,width,height,color,src){_classCallCheck(this,StaticImage);var _this=_possibleConstructorReturn(this,_ImageBase.call(this,context,width,height,color));return _this.binds={},_this.image=new Image,_this.image.crossOrigin="Anonymous",_this.binds.imageLoad=function(){_this.width=_this.image.width,_this.height=_this.image.height,_this.startRender=function(){_this.renderImage(_this.image),_this.finishRender()},_this.finishLoad()},_this.binds.imageError=function(){_this.startRender=function(){_this.renderNotFoundPage(),_this.finishRender()},_this.finishLoad()},(0,_libs.$)(_this.image).on("load",_this.binds.imageLoad).on("error",_this.binds.imageError),_this.image.src=_Utils2.default.normalizeUrl(src),_this}return _inherits(StaticImage,_ImageBase),StaticImage.prototype.dispose=function(){(0,_libs.$)(this.image).off("load",this.binds.imageLoad).off("error",this.binds.imageError),this.image.src="",delete this.image,_ImageBase.prototype.dispose.call(this)},StaticImage}(_ImageBase3.default);exports.default=StaticImage},function(module,exports,__webpack_require__){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _libs=__webpack_require__(0),TextureAnimator=function(){function TextureAnimator(img,tilesHoriz,tilesVert,numTiles,tileDispDuration){_classCallCheck(this,TextureAnimator);var texture=new _libs.THREE.Texture;texture.minFilter=_libs.THREE.LinearFilter,texture.image=img,texture.needsUpdate=!0,this.texture=texture,this.tilesHorizontal=tilesHoriz,this.tilesVertical=tilesVert,this.numberOfTiles=numTiles,texture.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=tileDispDuration,this.currentDisplayTime=0,this.currentTile=0}return TextureAnimator.prototype.update=function(milliSec){for(this.currentDisplayTime+=milliSec;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,++this.currentTile,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var currentColumn=this.currentTile%this.tilesHorizontal;this.texture.offset.x=currentColumn/this.tilesHorizontal;var currentRow=Math.floor(this.currentTile/this.tilesHorizontal);this.texture.offset.y=currentRow/this.tilesVertical}},TextureAnimator.prototype.dispose=function(){var img=this.texture.image;img.height=img.width=0,this.texture.dispose()},TextureAnimator}();exports.default=TextureAnimator},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),_Utils=__webpack_require__(4),_Utils2=_interopRequireDefault(_Utils),_MouseEventConverter2=__webpack_require__(54),_MouseEventConverter3=_interopRequireDefault(_MouseEventConverter2),_ThreeEventConverter=__webpack_require__(19),_ThreeEventConverter2=_interopRequireDefault(_ThreeEventConverter),ThreeMouseEventConverter=function(_MouseEventConverter){function ThreeMouseEventConverter(wnd,doc,visualWorld,test){_classCallCheck(this,ThreeMouseEventConverter);var _this=_possibleConstructorReturn(this,_MouseEventConverter.call(this,wnd,doc,visualWorld.element));return _Utils2.default.extends(_this,new _ThreeEventConverter2.default(visualWorld,test)),_this}return _inherits(ThreeMouseEventConverter,_MouseEventConverter),ThreeMouseEventConverter.prototype.getCallback=function(object){return object.object.userData.mouseCallback},ThreeMouseEventConverter.prototype.setCoordsFromEvent=function(e){var jElement=(0,_libs.$)(this.element),offset=jElement.offset();return this.coords.x=(e.pageX-offset.left)/jElement.width()*2-1,this.coords.y=2*-((e.pageY-offset.top)/jElement.height())+1,this.coords},ThreeMouseEventConverter}(_MouseEventConverter3.default);exports.default=ThreeMouseEventConverter},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}exports.__esModule=!0;var _libs=__webpack_require__(0),_Utils=__webpack_require__(4),_Utils2=_interopRequireDefault(_Utils),_TouchEventConverter2=__webpack_require__(64),_TouchEventConverter3=_interopRequireDefault(_TouchEventConverter2),_ThreeEventConverter=__webpack_require__(19),_ThreeEventConverter2=_interopRequireDefault(_ThreeEventConverter),ThreeTouchEventConverter=function(_TouchEventConverter){function ThreeTouchEventConverter(wnd,doc,visualWorld,test){_classCallCheck(this,ThreeTouchEventConverter);var _this=_possibleConstructorReturn(this,_TouchEventConverter.call(this,wnd,doc,visualWorld.element));return _Utils2.default.extends(_this,new _ThreeEventConverter2.default(visualWorld,test)),_this}return _inherits(ThreeTouchEventConverter,_TouchEventConverter),ThreeTouchEventConverter.prototype.getCallback=function(object){return object.object.userData.touchCallback},ThreeTouchEventConverter.prototype.setCoordsFromEvent=function(e){var jElement=(0,_libs.$)(this.element),offset=jElement.offset(),touches=e.touches||e.originalEvent.touches,touch=touches.length?touches[0]:(this.lastTouches||[{pageX:0,pageY:0}])[0],pageX=touch.pageX,pageY=touch.pageY;return this.lastTouches=touches.length?touches:this.lastTouches,this.coords.x=(pageX-offset.left)/jElement.width()*2-1,this.coords.y=2*-((pageY-offset.top)/jElement.height())+1,this.coords},ThreeTouchEventConverter}(_TouchEventConverter3.default);exports.default=ThreeTouchEventConverter},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}exports.__esModule=!0;var _extends=Object.assign||function(target){for(var i=1;i4&&void 0!==arguments[4]?arguments[4]:{kWtoH:210/297};_classCallCheck(this,Thumbnails),this.container=container,this.p=props,this.thumbnailsClb=thumbnailsClb,this.size=size,this.canvas=(0,_libs.$)("