!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={};__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 _extends=Object.assign||function(target){for(var i=1;i4&&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){return x[0]>x[1]&&(x=x.reverse(),y=y.reverse()),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}s+=_ref}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;if(BaseMathUtils.disp(data)1){for(var am=[],bm=[],i=0;iBaseMathUtils.eps){res={x:BaseMathUtils.det2(b1,a1[1],b2,a2[1])/d,y:BaseMathUtils.det2(a1[0],b1,a2[0],b2)/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 _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=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_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.setResolution=function(res){this.resW=res.width,this.resH=res.height},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__(43),_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 _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.CatmullRomCurve3([]);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"===(void 0===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){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,function(d){return p.cornerDeviation*_this2.corner.height/(1+Math.exp(-p.bending*(d-.5*_this2.corner.maxDistance)))}(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;i');var widthPxs=props.width,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,this.props)||{})},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,__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 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 _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=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_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 _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,Promise.resolve().then(function(){_this.loadingProgress(cur)}))}_this.progresData=data},this.task.then(function(handler){handler.numPages>1?Promise.all([handler.getPage(1),handler.getPage(2)]).then(function(pages){_this.init(handler,pages)}):_this.init(handler)}).catch(function(e){return console.error(e)})}return Pdf.prototype.init=function(handler,pages){this.handler=handler,this.doubledPages=!!pages&&Math.abs(2*Pdf.getPageSize(pages[0]).width-Pdf.getPageSize(pages[1]).width)/Pdf.getPageSize(pages[0]).width<.01;for(var done=Promise.resolve(handler),_iterator=this.handlerQueue.reverse(),_isArray=Array.isArray(_iterator),_i=0,_iterator=_isArray?_iterator:_iterator[Symbol.iterator]();;){var _ref;if("break"===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})}())break}},Pdf.prototype.getPageType=function(n){return this.doubledPages&&0!==n&&n!==this.getPagesNum()-1?1&n?"left":"right":"full"},Pdf.prototype.getPage=function(n){return this.handler.getPage(this.doubledPages?Math.ceil(n/2)+1:n+1)},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.doubledPages?2*(this.handler.numPages-1):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){return this.setCoordsFromEvent(e),this.raycaster.setFromCamera(this.coords,this.camera),this.raycaster.intersectObjects(this.threes)[0]},ThreeEventConverterFs}();exports.default=ThreeEventConverterFs},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 _BaseMathUtils=__webpack_require__(2),_BaseMathUtils2=function(obj){return obj&&obj.__esModule?obj:{default:obj}}(_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?(0,_libs.tr)("Please wait... the Application is Loading"):(0,_libs.tr)("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){props.cssLayerProps=_extends({},props.cssLayerProps,{scene:scene}),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,pageN:props.pageN||0}),this.props=props,this.context=context,this.bookCtrl=bookCtrl,this.urlParam=props.urlParam,this.pageN=props.pageN,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=parseInt(this.pageN);return(isNaN(number)||0===number)&&(number=this.getParameterByName(this.urlParam),number=parseInt(number),isNaN(number)&&(number=1)),number-1},AutoNavigator}();exports.default=AutoNavigator},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 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.element).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),_this.visual.addEventListener("resize",_this.pageManager.refreshZoom.bind(_this.pageManager)),setTimeout(function(){_this.notifyBeforeAnimation(),_this.notifyAfterAnimation()},100),_this.updateThree(),_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.element).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.updateThree=function(){this.three.userData.needsUpdate=!0},Book.prototype.setAutoResolution=function(enable){var k=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1.5;this.p.autoResolution=_extends({},this.p.autoResolution,{enable:enable,k:k})},Book.prototype.setZoom=function(zoom,singlePage){(Math.abs(this.p.zoom-zoom)>.001||singlePage!==this.p.singlePage)&&(this.p.zoom=zoom,this.p.singlePage=singlePage,this.pageManager.refreshZoom())},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.getTopPages=function(){var p=this.getPage();return 0===p||p===this.getPages()-1?[p]:[p,p+1]},Book.prototype.getPageState=function(n){return this.pageManager.getPageState(n)},Book.prototype.enableLoadingAnimation=function(enable){this.pageManager.enableLoadingAnimation(enable)},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;if(this.sheetPhysics.getSize()<25){var left=this.sheetBlocks[0],PI=Math.PI;this.angle===PI?res=this.connectPhysics(block=this.rightCover,this.p.cover.mass,PI,-this.p.cover.startVelocity,this.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))}return 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;if(this.sheetPhysics.getSize()<25){var right=this.sheetBlocks[this.sheetBlocks.length-1],PI=Math.PI;0===this.angle?res=this.connectPhysics(block=this.leftCover,this.p.cover.mass,0,this.p.cover.startVelocity,this.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.enableMouse=function(enable){this.mouseController=enable},Book.prototype.cornerCallback=function(e,data){var _this4=this;if(this.mouseController){var _data$data=data.data,i=_data$data.i,n=_data$data.n;if("mouseover"===e.type){if(this.hoverInfo&&void 0!==this.hoverInfo.pendings)++this.hoverInfo.pendings;else if(this.hoverInfo&&(console.warn("Wrong state: element is already hover"),this.hoverInfo.n!==n&&this.clearHoverInfo()),!this.hoverInfo&&!this.dragInfo){var res=Promise.resolve(void 0),hover=this.getBlockByPage(n),possible=this.getFlipping(i);if(n>1&&n<2*(this.p.sheets+1)&&hover.physicId&&(hover.angle<.02||hover.angle>Math.PI-.02))res=Promise.resolve(hover);else if(hover===possible){var sheetBlocks=[this.leftCover].concat(this.sheetBlocks,[this.rightCover]),j=sheetBlocks.indexOf(hover),nextBlock=~j?sheetBlocks[j+2*i-1]:void 0;(!nextBlock||!nextBlock.physicId||nextBlock.angle>.02&&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){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,this.dispatchEvent({type:"beforeAnimation"}),res=this.layerManager.hide()),res},Book.prototype.notifyAfterAnimation=function(){this.animationNotification&&(delete this.animationNotification,this.layerManager.show(),this.dispatchEvent({type:"afterAnimation"}))},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"};return(this.sheetPhysics.getSize()?Promise.resolve():this.notifyBeforeAnimation()).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()),_this6.updateThree()},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()}),_this6.updateThree()},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),cssLayerProps:_extends({},first.cssLayerProps,second.cssLayerProps)})},Book.calcProps=function(props){var p=_extends({},props,{sheet:_extends({},props.sheet),cover:_extends({},props.sheet,props.cover),page:_extends({},props.sheet,props.page),cssLayerProps:_extends({},props.cssLayerProps,{$:_libs.$})}),height=50*p.height,width=50*p.width,flipProgressClb=function(){},sheet={sideTexture:p.sheet.sideTexture||Book.createSideTexture(p.sheet.color)},cover=_extends({},sheet,p.cover,{depth:50*p.cover.depth,width:width,height:height,padding:50*p.cover.padding}),page=_extends({},sheet,p.page,{depth:50*p.page.depth,width:cover.width-cover.padding,height:cover.height-2*cover.padding}),marker={use:!1,color:16711680,size:.05};return cover.color===sheet.color||p.cover.sideTexture||(cover.sideTexture=Book.createSideTexture(cover.color)),page.color===sheet.color||p.page.sideTexture||(page.sideTexture=Book.createSideTexture(page.color)),_extends({},p,{scale:50,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 _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_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.book.setZoom(_this.bookWatcher.scale,_this.state.singlePage),_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.book.enableLoadingAnimation(_this.p.loadingAnimation.book),_this.p.loadingAnimation.skin&&_this.initLoadingAnimation(),_this.book.enableLoadingAnimation(_this.p.loadingAnimation.book),_this.book.setAutoResolution(_this.p.autoResolution.enabled,_this.p.autoResolution.coefficient),_this.visual.addEventListener("resize",_this.updateView.bind(_this)),_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.initLoadingAnimation=function(){var _this2=this,handler=function(){for(var pages=_this2.book.getTopPages(),visible=!1,_iterator=pages,_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 n=_ref,state=_this2.book.getPageState(n);if(visible=void 0===state||"loading"===state)break}_this2.view.setState("widLoading",{visible:visible})};this.book.addEventListener("beforeAnimation",handler),this.book.addEventListener("afterAnimation",handler),this.book.addEventListener("loadPage",handler),this.book.addEventListener("loadedPage",handler)},BookController.prototype.enableNavigation=function(enable){this.navigationControls=enable},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.setBookZoom=function(scale){var _this3=this;setTimeout(function(){_this3.bookWatcher.scale===scale&&_this3.book.setZoom(scale,_this3.state.singlePage)},1e3)},BookController.prototype.cmdZoomIn=function(){this.state.smartPan?(this.bookWatcher.scale=Math.min(this.p.scale.max,this.bookWatcher.scale+this.p.scale.delta),this.setBookZoom(this.bookWatcher.scale)):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.setBookZoom(this.bookWatcher.scale)):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.setBookZoom(this.bookWatcher.scale),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 _this4=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&&(_this4.state.activeSide=1)})):this.startFlip(this.book.flipLeft(1))},BookController.prototype.cmdBigBackward=function(){this.cmdBackward()},BookController.prototype.cmdForward=function(){var _this5=this;this.state.singlePage?(this.state.activeSide=(this.getPage()+1)%2,this.state.activeSide?this.startFlip(this.book.flipRight(1)).then(function(block){block&&(_this5.state.activeSide=0)}):(this.state.activeSide=1,this.updateView())):this.startFlip(this.book.flipRight(1))},BookController.prototype.cmdBigForward=function(){this.cmdForward()},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.setBookZoom(this.bookWatcher.scale),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 _this6=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?_this6.startFlip(_this6.book.flipLeft(-fl,clb)):_this6.startFlip(_this6.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,_iterator2=flips,_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 fl=_ref2;setClb(fl,time),time+=400}},BookController.prototype.startFlip=function(flipRes){var _this7=this;return flipRes?flipRes.then(function(block){return block&&_this7.dispatchAsync({type:"startFlip"}),block}):Promise.resolve(void 0)},BookController.prototype.endFlip=function(block){return this.dispatchAsync({type:"endFlip"}),block},BookController.prototype.getPage=function(){return this.book.getPage()?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.isCmdVisible=function(name){return(0,_libs.$)(this.visual.element).width()this.p.eps,visible:this.isCmdVisible("cmdLightingUp"),active:!1},cmdLightingDown:{enable:Math.abs(this.state.lighting-this.p.lighting.min)>this.p.eps,visible:this.isCmdVisible("cmdLightingDown"),active:!1}};for(var left=this.book.getLeftFlipping(),right=this.book.getRightFlipping(),flippersEnable={cmdFastBackward:!!left&&this.navigationControls,cmdBackward:!!left&&this.navigationControls,cmdBigBackward:!!left&&this.navigationControls,cmdForward:!!right&&this.navigationControls,cmdBigForward:!!right&&this.navigationControls,cmdFastForward:!!right&&this.navigationControls},_iterator3=Object.keys(flippersEnable),_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;this.viewState[name]={enable:flippersEnable[name],visible:this.isCmdVisible(name),active:!1}}},BookController.prototype.updateView=function(){if(this.view){this.updateViewState();for(var _iterator4=Object.keys(this.viewState),_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;this.view.setState(name,this.viewState[name])}}},BookController.prototype.getActions=function(){var _this8=this,isSwipping=function(name){return _this8.actions.touchCmdSwipe.enabled&&_this8.actions.touchCmdSwipe.code===_this8.actions[name].code&&_this8.state.smartPan&&_this8.bookWatcher.scale<=1},cmds={};for(var name in this)!function(name){0===name.indexOf("cmd")&&(cmds[name]={activate:function(){_this8.viewState&&_this8.viewState[name].enable&&_this8[name].apply(_this8,arguments)}})}(name);return _extends({},cmds,{cmdPanLeft:{activate:function(e){return _this8.orbit.actions.pan(e,{state:"move",dx:-_this8.p.pan.speed,dy:0})}},cmdPanRight:{activate:function(e){return _this8.orbit.actions.pan(e,{state:"move",dx:_this8.p.pan.speed,dy:0})}},cmdPanUp:{activate:function(e){return _this8.orbit.actions.pan(e,{state:"move",dx:0,dy:-_this8.p.pan.speed})}},cmdPanDown:{activate:function(e){return _this8.orbit.actions.pan(e,{state:"move",dx:0,dy:_this8.p.pan.speed})}},mouseCmdRotate:{activate:this.orbit.actions.rotate},mouseCmdDragZoom:{activate:function(e,data){data.dy>0?_this8.cmdZoomOut():data.dy<0&&_this8.cmdZoomIn()}},mouseCmdPan:{activate:this.orbit.actions.pan},mouseCmdWheelZoom:{activate:function(e){e.preventDefault(),e.deltaY<0?_this8.cmdZoomOut():e.deltaY>0&&_this8.cmdZoomIn()}},touchCmdRotate:{activate:function(e,data){isSwipping("touchCmdRotate")||(e.preventDefault(),_this8.orbit.actions.rotate(e,data))}},touchCmdZoom:{activate:function(e,data){isSwipping("touchCmdZoom")||(e.preventDefault(),data.dy>0?_this8.cmdZoomOut():data.dy<0&&_this8.cmdZoomIn())}},touchCmdPan:{activate:function(e,data){isSwipping("touchCmdPan")||(e.preventDefault(),_this8.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)[_this8.actions.touchCmdSwipe.code-1];_this8.swipeData={handled:!1,x0:touch.pageX,y0:touch.pageY,x:touch.pageX,y:touch.pageY}}else"move"===data.state?_this8.swipeData.handled||(_this8.swipeData=_extends({},_this8.swipeData,{x:_this8.swipeData.x+data.dx,y:_this8.swipeData.y+data.dy}),Math.abs(_this8.swipeData.x0-_this8.swipeData.x)>100&&(_this8.swipeData.x0>_this8.swipeData.x?_this8.cmdForward():_this8.cmdBackward(),_this8.swipeData.handled=!0)):delete _this8.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 _iterator5=Object.keys(this.actions),_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 name=_ref5,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 _iterator6=Object.keys(actions||{}),_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 name=_ref6;props.actions[name]=_extends({},props.actions[name],actions[name])}},BookController.mergeProps=function(first,second){function merge(first,second){second=second||{};for(var props=_extends({},first,second),_iterator7=Object.keys(first),_isArray7=Array.isArray(_iterator7),_i7=0,_iterator7=_isArray7?_iterator7:_iterator7[Symbol.iterator]();;){var _ref7;if(_isArray7){if(_i7>=_iterator7.length)break;_ref7=_iterator7[_i7++]}else{if(_i7=_iterator7.next(),_i7.done)break;_ref7=_i7.value}var name=_ref7;"object"===_typeof(first[name])&&(props[name]=merge(first[name],second[name]))}return props}second=second||{};var props=merge(first,second);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;if(delete this.canceled,"pdf"===this.type){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)}})}else 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