text: (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{35:function(e,t,i){e.exports=i(65)},41:function(e,t,i){},42:function(e,t,i){},61:function(e,t,i){},62:function(e,t,i){},63:function(e,t){},64:function(e,t,i){},65:function(e,t,i){"use strict";i.r(t);var r=i(0),a=i.n(r),s=i(31),n=i.n(s),o=(i(41),i(7)),h=i(5),c=i(11),d=i(10),l=i(12),f=(i(42),i(21)),v=i.n(f),u=i(32),m=i(3),p=1/1048576;function g(e,t,i,r){var a,s,n,o,h,c,d,l,f,v,u=e[t][0],m=e[t][1],g=e[i][0],w=e[i][1],M=e[r][0],y=e[r][1],b=Math.abs(m-w),S=Math.abs(w-y);return b<p?s=(o=-(M-g)/(y-w))*((a=(g+u)/2)-(c=(g+M)/2))+(l=(w+y)/2):S<p?s=(n=-(g-u)/(w-m))*((a=(M+g)/2)-(h=(u+g)/2))+(d=(m+w)/2):(a=((n=-(g-u)/(w-m))*(h=(u+g)/2)-(o=-(M-g)/(y-w))*(c=(g+M)/2)+(l=(w+y)/2)-(d=(m+w)/2))/(n-o),s=b>S?n*(a-h)+d:o*(a-c)+l),{i:t,j:i,k:r,x:a,y:s,r:(f=g-a)*f+(v=w-s)*v}}function w(e){var t,i,r,a,s,n;for(i=e.length;i;)for(a=e[--i],r=e[--i],t=i;t;)if(n=e[--t],r===(s=e[--t])&&a===n||r===n&&a===s){e.splice(i,2),e.splice(t,2);break}}var M=i(33);var y=i(45),b=function(e){var t=function(e,t){this.scene=e,this.camera=t,this.enabled=!0,this.clear=!0,this.needsSwap=!1,this.inverse=!1};t.prototype={render:function(e,t,i,r){var a,s,n=e.context;n.colorMask(!1,!1,!1,!1),n.depthMask(!1),this.inverse?(a=0,s=1):(a=1,s=0),n.enable(n.STENCIL_TEST),n.stencilOp(n.REPLACE,n.REPLACE,n.REPLACE),n.stencilFunc(n.ALWAYS,a,4294967295),n.clearStencil(s),e.render(this.scene,this.camera,i,this.clear),e.render(this.scene,this.camera,t,this.clear),n.colorMask(!0,!0,!0,!0),n.depthMask(!0),n.stencilFunc(n.EQUAL,1,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP)}};var i=function(){this.enabled=!0};return i.prototype={render:function(e,t,i,r){var a=e.context;a.disable(a.STENCIL_TEST)}},{ClearMaskPass:i,MaskPass:t}}(),S=b.ClearMaskPass,C=b.MaskPass;y.ClearMaskPass=S,y.MaskPass=C,y.EdgeShader=function(e){return{uniforms:{tDiffuse:{type:"t",value:null},aspect:{type:"v2",value:new e.Vector2(512,512)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","varying vec2 vUv;","uniform vec2 aspect;","vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);","mat3 G[2];","const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );","const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );","void main(void)","{","mat3 I;","float cnv[2];","vec3 sample;","G[0] = g0;","G[1] = g1;","for (float i=0.0; i<3.0; i++)","for (float j=0.0; j<3.0; j++) {","sample = texture2D( tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;","I[int(i)][int(j)] = length(sample);","}","for (int i=0; i<2; i++) {","float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);","cnv[i] = dp3 * dp3; ","}","gl_FragColor = vec4(sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));","} "].join("\n")}}(y),y.RenderPass=function(e){function t(t,i,r,a,s){this.scene=t,this.camera=i,this.overrideMaterial=r,this.clearColor=a,this.clearAlpha=void 0!==s?s:1,this.oldClearColor=new e.Color,this.oldClearAlpha=1,this.enabled=!0,this.clear=!0,this.needsSwap=!1}return t.prototype={render:function(e,t,i,r){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),e.render(this.scene,this.camera,i,this.clear),this.clearColor&&e.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}},t}(y),y.ShaderPass=function(e){function t(t,i){this.textureID=void 0!==i?i:"tDiffuse",this.uniforms=e.UniformsUtils.clone(t.uniforms),this.material=new e.ShaderMaterial({defines:t.defines||{},uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader}),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.camera=new e.OrthographicCamera(-1,1,1,-1,0,1),this.scene=new e.Scene,this.quad=new e.Mesh(new e.PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)}return t.prototype={render:function(e,t,i,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i),this.quad.material=this.material,this.renderToScreen?e.render(this.scene,this.camera):e.render(this.scene,this.camera,t,this.clear)}},t}(y),y.CopyShader={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")},y.EffectComposer=function(e){var t=function(t,i){if(this.renderer=t,void 0===i){var r=t.getPixelRatio(),a=Math.floor(t.context.canvas.width/r)||1,s=Math.floor(t.context.canvas.height/r)||1,n={minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBFormat,stencilBuffer:!1};i=new e.WebGLRenderTarget(a,s,n)}this.renderTarget1=i,this.renderTarget2=i.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],void 0===e.CopyShader&&console.error("THREE.EffectComposer relies on THREE.CopyShader"),this.copyPass=new e.ShaderPass(e.CopyShader)};return t.prototype={swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e)},insertPass:function(e,t){this.passes.splice(t,0,e)},render:function(t){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var i,r,a=!1,s=this.passes.length;for(r=0;r<s;r++)if((i=this.passes[r]).enabled){if(i.render(this.renderer,this.writeBuffer,this.readBuffer,t,a),i.needsSwap){if(a){var n=this.renderer.context;n.stencilFunc(n.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,t),n.stencilFunc(n.EQUAL,1,4294967295)}this.swapBuffers()}i instanceof e.MaskPass?a=!0:i instanceof e.ClearMaskPass&&(a=!1)}},reset:function(e){if(void 0===e){e=this.renderTarget1.clone();var t=this.renderer.getPixelRatio();e.width=Math.floor(this.renderer.context.canvas.width/t),e.height=Math.floor(this.renderer.context.canvas.height/t)}this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(e,t){var i=this.renderTarget1.clone();i.width=e,i.height=t,this.reset(i)}},t}(y);var x=y;new(i(34).GPU);function E(e,t,i,r,a){if(this.canvas=e,this.maxVertexCnt=t,this.isImg=i,i)var s=a;else this.video=r,this.videoWidth=a.videoWidth,this.videoHeight=a.videoHeight,this.videoElement=a;this.init(),this.updateImage(r,s),this.hasWireframe=!1}E.prototype.init=function(){this.renderer=new x.WebGLRenderer({canvas:this.canvas,antialias:!0,preserveDrawingBuffer:!0}),this.renderer.setClearColor(0),this.scene=new x.Scene,this.finalScene=new x.Scene,this.camera=new x.OrthographicCamera(-this.canvas.width/2,this.canvas.width/2,this.canvas.height/2,-this.canvas.height/2,0,10),this.camera.position.set(0,0,8),this.scene.add(this.camera),this.finalScene.add(this.camera);var e=new x.RenderPass(this.scene,this.camera),t=new x.ShaderPass(x.EdgeShader),i=new x.ShaderPass(x.CopyShader);if(i.renderToScreen=!0,this.composer=new x.EffectComposer(this.renderer),this.composer.addPass(e),this.composer.addPass(t),this.composer.addPass(i),this.wireframeMaterial=new x.MeshBasicMaterial({wireframe:!0,color:0}),this.wireframeMesh=null,this.faceMaterial=new x.MeshBasicMaterial({vertexColors:x.FaceColors,color:16777215}),this.faceMesh=null,!this.isImg){this.videoImage=document.createElement("canvas"),this.videoImage.width=this.canvas.width,this.videoImage.height=this.canvas.height;var r=document.createElement("canvas");r.width=this.videoWidth,r.height=this.videoHeight,this.videoSrcCtx=r.getContext("2d"),this.videoImageContext=this.videoImage.getContext("2d"),this.videoImageContext.fillStyle="#000000",this.videoImageContext.fillRect(0,0,this.videoImage.width,this.videoImage.height),this.videoTexture=new x.Texture(this.videoImage),this.videoTexture.minFilter=x.LinearFilter,this.videoTexture.magFilter=x.LinearFilter;var a=new x.MeshBasicMaterial({map:this.videoTexture,overdraw:!0}),s=new x.PlaneBufferGeometry(this.videoImage.width,this.videoImage.height);this.videoMesh=new x.Mesh(s,a),this.videoMesh.position.set(0,0,-1),this.scene.add(this.videoMesh),this.lastSelected={},this.thisSelected={}}},E.prototype.setVertexCnt=function(e){this.maxVertexCnt=e},E.prototype.setTriangleRendering=function(e){this.renderTrianglesEnabled=e},E.prototype._isLastSelected=function(e,t){var i=this.lastSelected[e];if(i)for(var r=i.length-1;r>=0;--r)if(i[r]===t)return!0;return!1},E.prototype._setThisSelected=function(e,t){var i=this.thisSelected[e];i?i.push(t):this.thisSelected[e]=[t]},E.prototype.setWireframe=function(e){this.wireframeMesh&&(this.wireframeMesh.visible=e,this.hasWireframe!==e&&(this.renderer.render(this.finalScene,this.camera),this.hasWireframe=e))},E.prototype.updateImage=function(e,t){this.imgPath=e,this._renderSize=null,this.clear(),this.imgMesh&&(this.scene.remove(this.imgMesh),this.imgMesh=null),this.preRender(t)},E.prototype.clear=function(){this.faceMesh&&(this.finalScene.remove(this.faceMesh),this.faceMesh=null),this.wireframeMesh&&(this.finalScene.remove(this.wireframeMesh),this.wireframeMesh=null)},E.prototype.render=function(e){this.clear(),this.isImg||this.preRender();var t=this.getRenderSize(),i=this;if(this.isImg){var r=x.ImageUtils.loadTexture(this.imgPath,{},a);r.magFilter=x.LinearFilter,r.minFilter=x.LinearFilter,this.imgMesh=new x.Mesh(new x.PlaneBufferGeometry(t.w,t.h),new x.MeshBasicMaterial({map:r})),this.imgMesh.position.z=-1,this.scene.add(this.imgMesh)}else this.videoImageContext.drawImage(this.video,0,0),this.videoTexture&&(this.videoTexture.needsUpdate=!0),a(),this.lastSelected=this.thisSelected,this.thisSelected={};function a(){i.composer.render();var e,r,a=i.renderer.getContext();i.isImg?(e=t.w,r=t.h,i.pixels=new Uint8Array(e*r*4),i.renderTrianglesEnabled&&a.readPixels(t.ow,t.oh,t.w,t.h,a.RGBA,a.UNSIGNED_BYTE,i.pixels)):(e=i.videoWidth,r=i.videoHeight,i.pixels=new Uint8Array(e*r*4),i.renderTrianglesEnabled&&a.readPixels(0,i.canvas.height-r,e,r,a.RGBA,a.UNSIGNED_BYTE,i.pixels)),i.vertices=[[0,0],[0,1],[1,0],[1,1]];var s=e*r,n=0,o=4;for(var h in i.lastSelected){var c=parseInt(h,10);if(void 0!==i.lastSelected[h])for(var d=i.lastSelected[h].length;d>=0;--d){var l=i.lastSelected[h][d],f=l*e+c;i.pixels[4*f]>40&&Math.random()>.2&&(i._setThisSelected(h,l),i.vertices.push([c/e,l/r]),++o)}}for(var v=Math.floor(.95*i.maxVertexCnt),u=100*i.maxVertexCnt;o<v&&n<u;++o,++n){var m=Math.floor(Math.random()*s),p=m%e,g=Math.floor(m/e),w=i.pixels[4*m];w>100||w>100*Math.random()?(i.isImg||i._setThisSelected(p,g),i.vertices.push([p/e,g/r])):--o}for(;o<i.maxVertexCnt;++o){var y=Math.random(),b=Math.random();i.vertices.push([y,b]),i.isImg||i._setThisSelected(Math.floor(y*e),Math.floor(b*r))}i.renderTrianglesEnabled&&(i.triangles=M.a.from(i.vertices).triangles,i.renderTriangles(e,r))}e&&e()},E.prototype.renderTriangles=function(e,t){var i,r;this.faceMesh=[];var a=this.vertices,s=this.triangles,n=this.getRenderSize();this.isImg?(i=this.srcImg.width,r=this.srcImg.height):(i=e,r=t);for(var o=new x.Geometry,h=s.length,c=0,d=s.length-1;d>2;d-=3){var l=[a[s[d]][0]*n.w+n.dw,a[s[d]][1]*n.h+n.dh],f=[a[s[d-1]][0]*n.w+n.dw,a[s[d-1]][1]*n.h+n.dh],v=[a[s[d-2]][0]*n.w+n.dw,a[s[d-2]][1]*n.h+n.dh],u=Math.floor((a[s[d]][0]+a[s[d-1]][0]+a[s[d-2]][0])/3*i),m=r-Math.floor((a[s[d]][1]+a[s[d-1]][1]+a[s[d-2]][1])/3*r);u=Math.min(i,Math.max(0,u-1));var p=4*((m=Math.min(r,Math.max(0,m-1)))*i+u),g="rgb("+this.srcPixel[p]+", "+this.srcPixel[p+1]+", "+this.srcPixel[p+2]+")";o.vertices.push(new x.Vector3(l[0],l[1],1)),o.vertices.push(new x.Vector3(f[0],f[1],1)),o.vertices.push(new x.Vector3(v[0],v[1],1)),o.faces.push(new x.Face3(h-d-1,h-d,h-d+1)),o.faces[c++].color=new x.Color(g)}this.faceMesh=new x.Mesh(o,this.faceMaterial),this.finalScene.add(this.faceMesh),this.wireframeMesh=new x.Mesh(o,this.wireframeMaterial),this.wireframeMesh.position.z=2,this.hasWireframe||(this.wireframeMesh.visible=!1),this.finalScene.add(this.wireframeMesh),this.renderer.render(this.finalScene,this.camera)},E.prototype.resize=function(){var e=this.canvas.height,t=this.canvas.width;this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e),this.composer.setSize(t,e),this._renderSize=null},E.prototype.preRender=function(e){if(this.isImg){this.srcImg=new Image,this.srcImg.src=this.imgPath;var t=this,i=this.srcImg;this.srcImg.onload=function(){var r=document.createElement("canvas");r.width=i.width,r.height=i.height;var a=r.getContext("2d");a.drawImage(i,0,0,i.width,i.height),t.srcPixel=a.getImageData(0,0,i.width,i.height).data,t.render(),e&&e()}}else this.videoSrcCtx.drawImage(this.videoElement,0,0,this.videoWidth,this.videoHeight),this.srcPixel=this.videoSrcCtx.getImageData(0,0,this.videoWidth,this.videoHeight).data},E.prototype.getRenderSize=function(){if(this._renderSize)return this._renderSize;var e,t,i,r,a=this.isImg?this.srcImg.width:this.videoWidth,s=this.isImg?this.srcImg.height:this.videoHeight,n=this.canvas.width,o=this.canvas.height,h=a,c=s;return n/o>h/c?(e=Math.floor(o/c*h),t=o,i=Math.floor((n-e)/2),r=0):(e=n,t=Math.floor(n/h*c),i=0,r=Math.floor((o-t)/2)),this._renderSize={w:e,h:t,dw:Math.floor(i-n/2),dh:Math.floor(r-o/2),ow:i,oh:r},this._renderSize};i(61);var P=function(e){var t=e.onClick,i=e.showHH;return a.a.createElement("div",{className:"btnrecord"},a.a.createElement("input",{onChange:t,type:"checkbox",id:"btn"}),a.a.createElement("label",{htmlFor:"btn"}),a.a.createElement("div",{className:"time"},a.a.createElement("div",{className:"".concat(i?"hh":""," h_m")}),a.a.createElement("div",{className:"s_ms"})))},I=(i(62),function(e){var t=e.onChange;return a.a.createElement("div",{className:"toggleswitch"},a.a.createElement("input",{className:"switch",id:"switch",type:"checkbox",onChange:t}),a.a.createElement("label",{className:"switch-label",htmlFor:"switch"},"Select"))}),k=(i(63),function(e){function t(){return Object(o.a)(this,t),Object(c.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(l.a)(t,e),Object(h.a)(t,[{key:"render",value:function(){return a.a.createElement("div",null)}}]),t}(a.a.Component));var R=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object(o.a)(this,e),this.isCCapturer=t.ccapturer,this.frames=[],this.isCCapturer||(this.worker=new Worker("".concat("","./ffmpeg-worker-mp4.js")),this.worker.onmessage=function(e){var t=e.data;switch(t.type){case"ready":console.log("mp4 worker ready");break;case"stdout":case"stderr":console.log(t.data);break;case"done":console.log("done");var i=new Blob([t.data.MEMFS[0].data],{type:"video/mp4"});navigator.share&&navigator.share({title:"Polinized",text:"Video Mp4",url:i}),function(e,t,i){var r,a,s,n=window,o="application/octet-stream",h=i||o,c=e,d=document,l=d.createElement("a"),f=function(e){return String(e)},v=n.Blob||n.MozBlob||n.WebKitBlob||f,u=n.MSBlobBuilder||n.WebKitBlobBuilder||n.BlobBuilder,m=t||"download";if("true"===String(this)&&(h=(c=[c,h])[0],c=c[1]),String(c).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return navigator.msSaveBlob?navigator.msSaveBlob(function(e){for(var t=e.split(/[:;,]/),i=t[1],r=("base64"==t[2]?atob:decodeURIComponent)(t.pop()),a=r.length,s=0,n=new Uint8Array(a);s<a;++s)n[s]=r.charCodeAt(s);return new v([n],{type:i})}(c),m):p(c);try{r=c instanceof v?c:new v([c],{type:h})}catch(g){u&&((a=new u).append([c]),r=a.getBlob(h))}function p(e,t){if("download"in l)return l.href=e,l.setAttribute("download",m),l.innerHTML="downloading...",d.body.appendChild(l),setTimeout(function(){l.click(),d.body.removeChild(l),!0===t&&setTimeout(function(){n.URL.revokeObjectURL(l.href)},250)},66),!0;var i=d.createElement("iframe");d.body.appendChild(i),t||(e="data:"+e.replace(/^data:([\w\/\-\+]+)/,o)),i.src=e,setTimeout(function(){d.body.removeChild(i)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(r,m);if(n.URL)p(n.URL.createObjectURL(r),!0);else{if("string"===typeof r||r.constructor===f)try{return p("data:"+h+";base64,"+n.btoa(r))}catch(g){return p("data:"+h+","+encodeURIComponent(r))}(s=new FileReader).onload=function(e){p(this.result)},s.readAsDataURL(r)}}(i,"polinized.mp4","video/mp4");break;case"exit":console.log("Process exited with code "+t.data);break;default:console.log("unkown msg type"+t.data)}})}return Object(h.a)(e,[{key:"addFrame",value:function(e){if(this.isCCapturer)this.worker.capture(e);else{var t=function(e){for(var t=e.substring(23),i=window.atob(t),r=i.length,a=new Uint8Array(new ArrayBuffer(r)),s=0;s<r;s++)a[s]=i.charCodeAt(s);return a}(e.toDataURL("image/jpeg"));this.frames.push({name:"".concat(this.frames.length,".jpeg"),data:t})}}},{key:"start",value:function(e){var t=e.fps;this.fps=t,this.isCCapturer&&(this.worker=new CCapture({framerate:2*t||15,format:"webm"}),this.worker.start())}},{key:"save",value:function(){if(this.isCCapturer)return this.worker.stop(),void this.worker.save();this.worker.postMessage({type:"run",TOTAL_MEMORY:268435456,MEMFS:this.frames,arguments:["-y","-r","".concat(this.fps),"-pattern_type","glob","-i","*.jpeg","-vsync","1","-c:v","libx264","-x264opts","no-scenecut","-sc_threshold","10","-maxrate","2M","-vf","scale=480:640","-pix_fmt","yuv420p","-vb","1M","-crf","5","-preset","ultrafast","-tune","film","-an","out.mp4"]})}}]),e}(),T=(i(64),function(e){function t(){var e;return Object(o.a)(this,t),(e=Object(c.a)(this,Object(d.a)(t).call(this))).state={isReady:!1,isRecording:!1,isCapturerReady:!1},e.devices=[],e.fpsmeter=a.a.createRef(),e.handlePlayState=e.handlePlayState.bind(Object(m.a)(Object(m.a)(e))),e.renderFrame=e.renderFrame.bind(Object(m.a)(Object(m.a)(e))),e.handleRecord=e.handleRecord.bind(Object(m.a)(Object(m.a)(e))),e.prepare=e.prepare.bind(Object(m.a)(Object(m.a)(e))),e.logFPS=e.logFPS.bind(Object(m.a)(Object(m.a)(e))),e.framesRendered=0,e.framesLow=0,e.canvas=a.a.createRef(),e.renderer=null,e}return Object(l.a)(t,e),Object(h.a)(t,[{key:"componentWillMount",value:function(){this.video=document.createElement("video"),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia?this.prepare():alert("navigator.getUserMedia not supported")}},{key:"componentDidMount",value:function(){this.canvas.current.width=window.innerWidth,this.canvas.current.height=window.innerHeight}},{key:"componentDidUpdate",value:function(e,t){t.isPlaying!==this.state.isPlaying&&this.handlePlayState()}},{key:"logFPS",value:function(){this.fpsmeter.current.innerHTML=this.framesRendered,this.framesLow=0===this.framesLow||this.framesLow>this.framesRendered?this.framesRendered:this.framesLow,this.framesRendered=0}},{key:"handlePlayState",value:function(){this.state.isPlaying?(this.video.play(),setInterval(this.logFPS,1e3),this.renderer=new E(this.canvas.current,4e3,!1,this.video,this.video),this.renderFrame()):(clearInterval(this.logFPS),this.video.src="")}},{key:"handleRecord",value:function(){this.state.isRecording?(this.setState({isRecording:!1}),this.capturer.save({fps:this.framesLow})):(this.setState({isRecording:!0}),this.capturer.start({fps:this.framesLow}))}},{key:"prepare",value:function(){var e=Object(u.a)(v.a.mark(function e(){var t=this;return v.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:navigator.mediaDevices.enumerateDevices().then(function(e){e.forEach(function(e){"videoinput"===e.kind&&t.devices.push(e)}),navigator.getUserMedia({video:{deviceId:{exact:(t.devices[1]||t.devices[0]).deviceId}}},function(e){t.stream=e,t.video.srcObject=e,t.video.onloadedmetadata=function(){t.setState({isReady:!0,isPlaying:!0})},t.video.load()},function(e){alert("Camera is not accesible.")})}).then(function(){t.capturer=new R({ccapturer:!0}),t.setState({isCapturerReady:!0})}).catch(function(e){alert(e)});case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this,t=this.state,i=t.isReady,r=t.isCapturerReady;t.isRecording,t.isPlaying;return a.a.createElement("div",{className:"video-content"},a.a.createElement("canvas",{id:"canvas",ref:this.canvas}),a.a.createElement("div",{className:"video-overlay"},a.a.createElement("div",{className:"fps-counter",ref:this.fpsmeter}),a.a.createElement(k,null),a.a.createElement(P,{onClick:this.handleRecord,disabled:!i||!r}),a.a.createElement(I,{onChange:function(t){var i=t.target;e.renderer.setTriangleRendering(i.checked)}})))}},{key:"renderFrame",value:function(){this.framesRendered++,this.renderer.render(),this.state.isRecording&&this.capturer.addFrame(this.canvas.current),this.state.isPlaying&&requestAnimationFrame(this.renderFrame)}}]),t}(a.a.Component)),j=function(e){function t(){return Object(o.a)(this,t),Object(c.a)(this,Object(d.a)(t).apply(this,arguments))}return Object(l.a)(t,e),Object(h.a)(t,[{key:"render",value:function(){return a.a.createElement("div",{className:"App"},a.a.createElement(T,{publicUrl:this.props.publicUrl}))}}]),t}(r.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));n.a.render(a.a.createElement(j,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(e){e.unregister()})}},[[35,1,2]]]);
  //# sourceMappingURL=main.5901c274.chunk.js.map