From d86602af9358c6d7d26ba52d438c6208ef369430 Mon Sep 17 00:00:00 2001 From: joelsouza95 <53006969+joelsouza95@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:20:49 -0400 Subject: [PATCH] Add files via upload --- .../thirdparty/jeeliz/JeelizResizer.js | 328 +++++++++++++ .../thirdparty/jeeliz/JeelizThreeHelper.js | 438 ++++++++++++++++++ vdo.ninja-24.4/thirdparty/jeeliz/Tween.min.js | 2 + .../thirdparty/jeeliz/jeelizFaceFilter.js | 186 ++++++++ vdo.ninja-24.4/thirdparty/jeeliz/readme.md | 6 + 5 files changed, 960 insertions(+) create mode 100644 vdo.ninja-24.4/thirdparty/jeeliz/JeelizResizer.js create mode 100644 vdo.ninja-24.4/thirdparty/jeeliz/JeelizThreeHelper.js create mode 100644 vdo.ninja-24.4/thirdparty/jeeliz/Tween.min.js create mode 100644 vdo.ninja-24.4/thirdparty/jeeliz/jeelizFaceFilter.js create mode 100644 vdo.ninja-24.4/thirdparty/jeeliz/readme.md diff --git a/vdo.ninja-24.4/thirdparty/jeeliz/JeelizResizer.js b/vdo.ninja-24.4/thirdparty/jeeliz/JeelizResizer.js new file mode 100644 index 0000000..7c89b52 --- /dev/null +++ b/vdo.ninja-24.4/thirdparty/jeeliz/JeelizResizer.js @@ -0,0 +1,328 @@ +/* +This helper can help for: +* adjusting the canvas resolution to the good size -> this is crucial to +optimize the code because if the canvas is too large, +there are too much pixels to compute => it will be slow + +* to mirror horizontally or not the canvas -> if the front camera is used we +need it flipped (mirror effect), while if the rear camera is used we need it not flipped + +* to get the best camera resolution (either above the canvas resolution or closer) +to balance between performance and quality +*/ +"use strict"; + +const JeelizResizer = (function(){ + // private vars: + let _domCanvas = null, + _whCanvasPx = null, + _isApplyCSS = false, + _resizeAttemptsCounter = 0, + _overSamplingFactor = 1, + _isFullScreen = false, + _timerFullScreen = null, + _callbackResize = null, + _isInvFullscreenWH = false; + + const _cameraResolutions = [ // all resolutions should be in landscape mode + [640,480], + [768,480], + [800,600], + [960,640], + [960,720], + [1024,768], + [1280,720], + [1920, 1080] + ]; + + //private functions + function add_CSStransform(domElement, CSS){ + const CSStransform = domElement.style.transform; + if (CSStransform.indexOf(CSS) !== -1) return; + domElement.style.transform = CSS + ' ' + CSStransform; + } + + // Compute overlap between 2 rectangles A and B + // characterized by their width and their height in pixels + // the rectangles are centered + // return the ratio (pixels overlaped)/(total pixels) + function compute_overlap(whA, whB){ + const aspectRatioA = whA[0] / whA[1]; + const aspectRatioB = whB[0] / whB[1]; //higher aspectRatio -> more landscape + + var whLandscape, whPortrait; + if (aspectRatioA > aspectRatioB){ + whLandscape = whA, whPortrait = whB; + } else { + whLandscape = whB, whPortrait = whA; + } + + // The overlapped area will be always a rectangle + const areaOverlap = Math.min(whLandscape[0], whPortrait[0]) * Math.min(whLandscape[1], whPortrait[1]); + + var areaTotal; + if (whLandscape[0]>=whPortrait[0] && whLandscape[1]>=whPortrait[1]){ //union is a rectangle + areaTotal = whLandscape[0]*whLandscape[1]; + } else if (whPortrait[0]>whLandscape[0] && whPortrait[1]>whLandscape[1]){ //union is a rectangle + areaTotal = whPortrait[0]*whPortrait[1]; + } else { //union is a cross + areaTotal = whLandscape[0]*whLandscape[1]; + areaTotal += (whPortrait[1]-whLandscape[1])*whPortrait[0]; + } + + return areaOverlap / areaTotal; + } //end compute_overlap() + + function update_sizeCanvas(){ + const domRect = _domCanvas.getBoundingClientRect(); + apply_sizeCanvas(domRect.width, domRect.height); + } + + function apply_sizeCanvas(width, height){ + _whCanvasPx = [ + Math.round(_overSamplingFactor * width), + Math.round(_overSamplingFactor * height) + ]; + + // set canvas resolution: + _domCanvas.setAttribute('width', _whCanvasPx[0]); + _domCanvas.setAttribute('height', _whCanvasPx[1]); + + // canvas display size: + if (_isApplyCSS){ + _domCanvas.style.width = width.toString() + 'px'; + _domCanvas.style.height = height.toString() + 'px'; + } + } + + function on_windowResize(){ + // avoid to resize too often using a timer + // (it can create weird bug with some browsers) + if (_timerFullScreen){ + clearTimeout(_timerFullScreen); + } + _timerFullScreen = setTimeout(resize_fullScreen, 50); + } + + function resize_canvasToFullScreen(){ + const wh = [window['innerWidth'], window['innerHeight']]; + if (_isInvFullscreenWH){ + wh.reverse(); + } + apply_sizeCanvas(wh[0], wh[1]); + } + + function resize_fullScreen(){ + resize_canvasToFullScreen(); + JEELIZFACEFILTER.resize(); + _timerFullScreen = null; + if (_callbackResize) { + _callbackResize(); + } + } + + // public methods: + const that = { + // return true or false if the device is in portrait or landscape mode + // see https://stackoverflow.com/questions/4917664/detect-viewport-orientation-if-orientation-is-portrait-display-alert-message-ad + is_portrait: function(){ + try{ + if (window['matchMedia']("(orientation: portrait)")['matches']){ + return true; + } else { + return false; + } + } catch(e){ + return (window['innerHeight'] > window['innerWidth']); + } + }, + + // check whether the user is using IOS or not + // see https://stackoverflow.com/questions/9038625/detect-if-device-is-ios + check_isIOS: function(){ + const isIOS = /iPad|iPhone|iPod/.test(navigator['userAgent']) && !window['MSStream']; + return isIOS; + }, + + // Should be called only if IOS was detected + // see https://stackoverflow.com/questions/8348139/detect-ios-version-less-than-5-with-javascript + get_IOSVersion: function(){ + const v = (navigator['appVersion']).match(/OS (\d+)_(\d+)_?(\d+)?/); + return (v.length > 2) ? [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)] : [0, 0, 0]; + }, + + // Check whether the user is using Android or not + // see https://stackoverflow.com/questions/6031412/detect-android-phone-via-javascript-jquery + check_isAndroid: function(){ + const ua = navigator['userAgent'].toLowerCase(); + return (ua.indexOf('android') !== -1); + }, + + // Should be called only if Android was detected + // see https://stackoverflow.com/questions/7184573/pick-up-the-android-version-in-the-browser-by-javascript + get_androidVersion: function(){ + const ua = navigator['userAgent'].toLowerCase(); + const match = ua.match(/android\s([0-9\.]*)/i); + if (!match || match.length<2){ + return [0,0,0]; + } + const v = match[1].split('.'); + return [ + parseInt(v[0], 10), + parseInt(v[1], 10), + parseInt(v[2] || 0, 10) + ]; + }, + + // to get a video of 480x640 (480 width and 640 height) + // with a mobile phone in portrait mode, the default implementation + // should require a 480x640 video (Chrome, Firefox) + // but bad implementations needs to always request landscape resolutions (so 640x480) + // see https://github.com/jeeliz/jeelizFaceFilter/issues/144 + require_flipVideoWHIfPortrait: function(){ + // disabled because of https://github.com/jeeliz/jeelizFaceFilter/issues/144 + // seems quite a mess though... + + /* if (that.check_isIOS()){ + //the user is using IOS + const version = that.get_IOSVersion(); + if (version[0] >= 13){ + if (version[1] <= 1 // IOS 13.0.X + || (version[1] === 1 && version[2] < 3)){ // IOS 13.1.X with X<3 + return false; + } + } + } + + if (that.check_isAndroid()){ + const version = that.get_androidVersion(); + if (version[0] >= 9){ // Android 9+ + return false; + } + } */ + + // normal implementation + return false; + }, + + // size canvas to the right resolution + // should be called after the page loading + // when the canvas has already the right size + // options: + // - canvasId: id of the canvas + // - canvas: if canvasId is not provided + // - callback: function to launch if there was an error or not + // - overSamplingFactor: facultative. If 1, same resolution than displayed size (default). + // If 2, resolution twice higher than real size + // - CSSFlipX: if we should flip the canvas or not. Default: false + // - isFullScreen: if we should set the canvas fullscreen. Default: false + // - onResize: function called when the window is resized. Only enabled if isFullScreen = true + // - isInvWH: if we should invert width and height for fullscreen mode only. default = false + // - isApplyCSS: if we should also apply canvas dimensions as CSS. default = false + size_canvas: function(optionsArg){ + const options = Object.assign({ + canvasId: 'undefinedCanvasId', + canvas: null, + overSamplingFactor: window.devicePixelRatio || 1, + + isFullScreen: false, + isInvWH: false, + CSSFlipX: false, + isApplyCSS: false, + + onResize: null, + callback: function(){} + }, optionsArg); + + _domCanvas = (options.canvas) ? options.canvas : document.getElementById(options.canvasId); + _isFullScreen = options.isFullScreen; + _isInvFullscreenWH = options.isInvWH; + _isApplyCSS = options.isApplyCSS; + _overSamplingFactor = options.overSamplingFactor; + + if (_isFullScreen){ + // we are in fullscreen mode + _callbackResize = options.onResize; + + resize_canvasToFullScreen(); + window.addEventListener('resize', on_windowResize, false); + window.addEventListener('orientationchange', on_windowResize, false); + + } else { // not fullscreen mode + + // get display size of the canvas: + const domRect = _domCanvas.getBoundingClientRect(); + if (domRect.width===0 || domRect.height===0){ + console.log('WARNING in JeelizResize.size_canvas(): the canvas has its width or its height null, Retry a bit later...'); + if (++_resizeAttemptsCounter > 20){ + options.callback('CANNOT_RESIZECANVAS'); + return; + } + setTimeout(that.size_canvas.bind(null, options), 50); + return; + } + + // do resize canvas: + _resizeAttemptsCounter = 0; + update_sizeCanvas(); + } + + // flip horizontally if required: + if (options.CSSFlipX){ + add_CSStransform(_domCanvas, 'rotateY(180deg)'); + } + + // compute the best camera resolutions: + const allResolutions = _cameraResolutions.map(function(x){ + return x.slice(0) + }); + + // if we are in portrait mode, the camera is also in portrait mode + // so we need to set all resolutions to portrait mode + if (that.is_portrait() && that.require_flipVideoWHIfPortrait()){ + allResolutions.forEach(function(wh){ + wh.reverse(); + }); + } + + // sort camera resolutions from the best to the worst: + allResolutions.sort(function(resA, resB){ + return compute_overlap(resB, _whCanvasPx) - compute_overlap(resA, _whCanvasPx); + }); + + // pick the best camera resolution: + const bestCameraResolution = { + 'idealWidth': allResolutions[0][0], + 'idealHeight': allResolutions[0][1] + }; + + console.log('INFO in JeelizResizer: bestCameraResolution =', bestCameraResolution); + + // launch the callback function after a small interval to let it + // some time to size: + setTimeout(options.callback.bind(null, false, bestCameraResolution), 1); + }, //end size_canvas() + + // Should be called if the canvas is resized to update the canvas resolution: + resize_canvas: function(){ + if (_isFullScreen){ + resize_canvasToFullScreen() + } else { + update_sizeCanvas(); + } + }, + + get_canvasSize: function(){ + return _whCanvasPx; + } + }; //end that + return that; +})(); + +// Export ES6 module: +try { + module.exports = JeelizResizer; +} catch(e){ + console.log('JeelizResizer ES6 Module not exported'); + window.JeelizResizer = JeelizResizer; +} \ No newline at end of file diff --git a/vdo.ninja-24.4/thirdparty/jeeliz/JeelizThreeHelper.js b/vdo.ninja-24.4/thirdparty/jeeliz/JeelizThreeHelper.js new file mode 100644 index 0000000..2036719 --- /dev/null +++ b/vdo.ninja-24.4/thirdparty/jeeliz/JeelizThreeHelper.js @@ -0,0 +1,438 @@ +/* + Helper for Three.js +*/ + +const JeelizThreeHelper = (function(){ + // internal settings: + const _settings = { + rotationOffsetX: 0.0, // negative -> look upper. in radians + pivotOffsetYZ: [0.2, 0.6],// YZ of the distance between the center of the cube and the pivot + + detectionThreshold: 0.8, // sensibility, between 0 and 1. Less -> more sensitive + detectionHysteresis: 0.02, + + //tweakMoveYRotateX: 0,//0.5, // tweak value: move detection window along Y axis when rotate the face around X (look up <-> down) + + cameraMinVideoDimFov: 35 // Field of View for the smallest dimension of the video in degrees + }; + + // private vars: + let _threeRenderer = null, + _threeScene = null, + _threeVideoMesh = null, + _threeVideoTexture = null, + _threeTranslation = null; + + let _maxFaces = -1, + _isMultiFaces = false, + _detectCallback = null, + _isVideoTextureReady = false, + _isSeparateThreeCanvas = false, + _faceFilterCv = null, + _videoElement = null, + _isDetected = false, + _scaleW = 1, + _canvasAspectRatio = -1; + + const _threeCompositeObjects = []; + + let _gl = null, + _glVideoTexture = null, + _glShpCopyCut = null, + _glShpCopyCutVideoMatUniformPointer = null; + + let _videoTransformMat2 = null; + + // private funcs: + function destroy(){ + _isVideoTextureReady = false; + _threeCompositeObjects.splice(0); + if (_threeVideoTexture){ + _threeVideoTexture.dispose(); + _threeVideoTexture = null; + } + } + + function create_threeCompositeObjects(){ + for (let i=0; i<_maxFaces; ++i){ + // COMPOSITE OBJECT WHICH WILL TRACK A DETECTED FACE + const threeCompositeObject = new THREE.Object3D(); + threeCompositeObject.frustumCulled = false; + threeCompositeObject.visible = false; + + _threeCompositeObjects.push(threeCompositeObject); + _threeScene.add(threeCompositeObject); + } + } + + function create_videoScreen(){ + const videoScreenVertexShaderSource = "attribute vec2 position;\n\ + uniform mat2 videoTransformMat2;\n\ + varying vec2 vUV;\n\ + void main(void){\n\ + gl_Position = vec4(position, 0., 1.);\n\ + vUV = 0.5 + videoTransformMat2 * position;\n\ + }"; + const videoScreenFragmentShaderSource = "precision lowp float;\n\ + uniform sampler2D samplerVideo;\n\ + varying vec2 vUV;\n\ + void main(void){\n\ + gl_FragColor = texture2D(samplerVideo, vUV);\n\ + }"; + + if (_isSeparateThreeCanvas){ + const compile_shader = function(source, type, typeString) { + const glShader = _gl.createShader(type); + _gl.shaderSource(glShader, source); + _gl.compileShader(glShader); + if (!_gl.getShaderParameter(glShader, _gl.COMPILE_STATUS)) { + alert("ERROR IN " + typeString + " SHADER: " + _gl.getShaderInfoLog(glShader)); + return null; + } + return glShader; + }; + + const glShaderVertex = compile_shader(videoScreenVertexShaderSource, _gl.VERTEX_SHADER, 'VERTEX'); + const glShaderFragment = compile_shader(videoScreenFragmentShaderSource, _gl.FRAGMENT_SHADER, 'FRAGMENT'); + + _glShpCopyCut = _gl.createProgram(); + _gl.attachShader(_glShpCopyCut, glShaderVertex); + _gl.attachShader(_glShpCopyCut, glShaderFragment); + + _gl.linkProgram(_glShpCopyCut); + const samplerVideo = _gl.getUniformLocation(_glShpCopyCut, 'samplerVideo'); + _glShpCopyCutVideoMatUniformPointer = _gl.getUniformLocation(_glShpCopyCut, 'videoTransformMat2'); + + return; + } + + // init video texture with red: + _threeVideoTexture = new THREE.DataTexture( new Uint8Array([255,0,0]), 1, 1, THREE.RGBFormat); + _threeVideoTexture.needsUpdate = true; + + // CREATE THE VIDEO BACKGROUND: + const videoMaterial = new THREE.RawShaderMaterial({ + depthWrite: false, + depthTest: false, + vertexShader: videoScreenVertexShaderSource, + fragmentShader: videoScreenFragmentShaderSource, + uniforms:{ + samplerVideo: {value: _threeVideoTexture}, + videoTransformMat2: { + value: _videoTransformMat2 + } + } + }); + + const videoGeometry = new THREE.BufferGeometry() + const videoScreenCorners = new Float32Array([-1,-1, 1,-1, 1,1, -1,1]); + videoGeometry.setAttribute( 'position', new THREE.BufferAttribute( videoScreenCorners, 2 ) ); + videoGeometry.setIndex(new THREE.BufferAttribute(new Uint16Array([0,1,2, 0,2,3]), 1)); + _threeVideoMesh = new THREE.Mesh(videoGeometry, videoMaterial); + that.apply_videoTexture(_threeVideoMesh); + _threeVideoMesh.renderOrder = -1000; // render first + _threeVideoMesh.frustumCulled = false; + _threeScene.add(_threeVideoMesh); + } //end create_videoScreen() + + function detect(detectState){ + _threeCompositeObjects.forEach(function(threeCompositeObject, i){ + _isDetected = threeCompositeObject.visible; + const ds = detectState[i]; + if (_isDetected && ds.detected < _settings.detectionThreshold-_settings.detectionHysteresis){ + + // DETECTION LOST + if (_detectCallback) _detectCallback(i, false); + threeCompositeObject.visible = false; + } else if (!_isDetected && ds.detected > _settings.detectionThreshold+_settings.detectionHysteresis){ + + // FACE DETECTED + if (_detectCallback) _detectCallback(i, true); + threeCompositeObject.visible = true; + } + }); //end loop on all detection slots + } + + function update_poses(ds, threeCamera){ + // tan( / 2 ): + const halfTanFOVX = Math.tan(threeCamera.aspect * threeCamera.fov * Math.PI/360); //tan(/2), in radians (threeCamera.fov is vertical FoV) + + _threeCompositeObjects.forEach(function(threeCompositeObject, i){ + if (!threeCompositeObject.visible) return; + const detectState = ds[i]; + + // tweak Y position depending on rx: + //const tweak = _settings.tweakMoveYRotateX * Math.tan(detectState.rx); + const cz = Math.cos(detectState.rz), sz = Math.sin(detectState.rz); + + // relative width of the detection window (1-> whole width of the detection window): + const W = detectState.s * _scaleW; + + // distance between the front face of the cube and the camera: + const DFront = 1 / ( 2 * W * halfTanFOVX ); + + // D is the distance between the center of the unit cube and the camera: + const D = DFront + 0.5; + + // coords in 2D of the center of the detection window in the viewport: + const xv = detectState.x * _scaleW; + const yv = detectState.y * _scaleW; + + // coords in 3D of the center of the cube (in the view coordinates system): + const z = -D; // minus because view coordinate system Z goes backward + const x = xv * D * halfTanFOVX; + const y = yv * D * halfTanFOVX / _canvasAspectRatio; + + // set position before pivot: + threeCompositeObject.position.set(-sz*_settings.pivotOffsetYZ[0], -cz*_settings.pivotOffsetYZ[0], -_settings.pivotOffsetYZ[1]); + + // set rotation and apply it to position: + threeCompositeObject.rotation.set(detectState.rx+_settings.rotationOffsetX, detectState.ry, detectState.rz, "ZYX"); + threeCompositeObject.position.applyEuler(threeCompositeObject.rotation); + + // add translation part: + _threeTranslation.set(x, y+_settings.pivotOffsetYZ[0], z+_settings.pivotOffsetYZ[1]); + threeCompositeObject.position.add(_threeTranslation); + }); //end loop on composite objects + } + + //public methods: + const that = { + // launched with the same spec object than callbackReady. set spec.threeCanvasId to the ID of the threeCanvas to be in 2 canvas mode: + init: function(spec, detectCallback){ + destroy(); + + _maxFaces = spec.maxFacesDetected; + _glVideoTexture = spec.videoTexture; + _videoTransformMat2 = spec.videoTransformMat2; + _gl = spec.GL; + _faceFilterCv = spec.canvasElement; + _isMultiFaces = (_maxFaces>1); + _videoElement = spec.videoElement; + + // enable 2 canvas mode if necessary: + let threeCanvas = null; + if (spec.threeCanvasId){ + _isSeparateThreeCanvas = true; + // adjust the threejs canvas size to the threejs canvas: + threeCanvas = document.getElementById(spec.threeCanvasId); + threeCanvas.setAttribute('width', _faceFilterCv.width); + threeCanvas.setAttribute('height', _faceFilterCv.height); + } else { + threeCanvas = _faceFilterCv; + } + + if (typeof(detectCallback) !== 'undefined'){ + _detectCallback = detectCallback; + } + + // init THREE.JS context: + _threeRenderer = new THREE.WebGLRenderer({ + context: (_isSeparateThreeCanvas) ? null : _gl, + canvas: threeCanvas, + alpha: (_isSeparateThreeCanvas || spec.alpha) ? true : false + }); + + _threeScene = new THREE.Scene(); + _threeTranslation = new THREE.Vector3(); + + create_threeCompositeObjects(); + create_videoScreen(); + + // handle device orientation change: + window.addEventListener('orientationchange', function(){ + setTimeout(JEELIZFACEFILTER.resize, 1000); + }, false); + + const returnedDict = { + videoMesh: _threeVideoMesh, + renderer: _threeRenderer, + scene: _threeScene + }; + if (_isMultiFaces){ + returnedDict.faceObjects = _threeCompositeObjects + } else { + returnedDict.faceObject = _threeCompositeObjects[0]; + } + return returnedDict; + }, //end that.init() + + detect: function(detectState){ + const ds = (_isMultiFaces) ? detectState : [detectState]; + + // update detection states: + detect(ds); + }, + + get_isDetected: function() { + return _isDetected; + }, + + render: function(detectState, threeCamera){ + const ds = (_isMultiFaces) ? detectState : [detectState]; + + // update detection states then poses: + detect(ds); + update_poses(ds, threeCamera); + + if (_isSeparateThreeCanvas){ + // render the video texture on the faceFilter canvas: + _gl.viewport(0, 0, _faceFilterCv.width, _faceFilterCv.height); + _gl.useProgram(_glShpCopyCut); + _gl.uniformMatrix2fv(_glShpCopyCutVideoMatUniformPointer, false, _videoTransformMat2); + _gl.activeTexture(_gl.TEXTURE0); + _gl.bindTexture(_gl.TEXTURE_2D, _glVideoTexture); + _gl.drawElements(_gl.TRIANGLES, 3, _gl.UNSIGNED_SHORT, 0); + } else { + // reinitialize the state of THREE.JS because JEEFACEFILTER have changed stuffs: + // -> can be VERY costly ! + _threeRenderer.state.reset(); + } + + // trigger the render of the THREE.JS SCENE: + _threeRenderer.render(_threeScene, threeCamera); + }, + + sortFaces: function(bufferGeometry, axis, isInv){ // sort faces long an axis + // Useful when a bufferGeometry has alpha: we should render the last faces first + const axisOffset = {X:0, Y:1, Z:2}[axis.toUpperCase()]; + const sortWay = (isInv) ? -1 : 1; + + // fill the faces array: + const nFaces = bufferGeometry.index.count/3; + const faces = new Array(nFaces); + for (let i=0; i vw) ? (1.0 / videoAspectRatio) : 1.0; + const fov = _settings.cameraMinVideoDimFov * fovFactor; + console.log('INFO in JeelizThreeHelper - update_camera(): Estimated vertical video FoV is', fov); + + // compute X and Y offsets in pixels: + let scale = 1.0; + if (_canvasAspectRatio > videoAspectRatio) { + // the canvas is more in landscape format than the video, so we crop top and bottom margins: + scale = cvw / vw; + } else { + // the canvas is more in portrait format than the video, so we crop right and left margins: + scale = cvh / vh; + } + const cvws = vw * scale, cvhs = vh * scale; + const offsetX = (cvws - cvw) / 2.0; + const offsetY = (cvhs - cvh) / 2.0; + _scaleW = cvw / cvws; + + // apply parameters: + threeCamera.aspect = _canvasAspectRatio; + threeCamera.fov = fov; + console.log('INFO in JeelizThreeHelper.update_camera(): camera vertical estimated FoV is', fov, 'deg'); + threeCamera.setViewOffset(cvws, cvhs, offsetX, offsetY, cvw, cvh); + threeCamera.updateProjectionMatrix(); + + // update drawing area: + _threeRenderer.setSize(cvw, cvh, false); + _threeRenderer.setViewport(0, 0, cvw, cvh); + }, //end update_camera() + + resize: function(w, h, threeCamera){ + _threeRenderer.domElement.width = w; + _threeRenderer.domElement.height = h; + JEELIZFACEFILTER.resize(); + if (threeCamera){ + that.update_camera(threeCamera); + } + } + } + return that; +})(); + +window.JeelizThreeHelper = JeelizThreeHelper; \ No newline at end of file diff --git a/vdo.ninja-24.4/thirdparty/jeeliz/Tween.min.js b/vdo.ninja-24.4/thirdparty/jeeliz/Tween.min.js new file mode 100644 index 0000000..c712b17 --- /dev/null +++ b/vdo.ninja-24.4/thirdparty/jeeliz/Tween.min.js @@ -0,0 +1,2 @@ +var TWEEN=TWEEN||function(){var n=[];return{getAll:function(){return n},removeAll:function(){n=[]},add:function(t){n.push(t)},remove:function(t){var r=n.indexOf(t);-1!==r&&n.splice(r,1)},update:function(t,r){if(0===n.length)return!1;var i=0;for(t=void 0!==t?t:TWEEN.now();in;n++)p[n].stop()},this.delay=function(n){return s=n,this},this.repeat=function(n){return e=n,this},this.yoyo=function(n){return a=n,this},this.easing=function(n){return l=n,this},this.interpolation=function(n){return E=n,this},this.chain=function(){return p=arguments,this},this.onStart=function(n){return d=n,this},this.onUpdate=function(n){return w=n,this},this.onComplete=function(n){return I=n,this},this.onStop=function(n){return M=n,this},this.update=function(n){var f,M,T;if(h>n)return!0;v===!1&&(null!==d&&d.call(t),v=!0),M=(n-h)/u,M=M>1?1:M,T=l(M);for(f in i)if(void 0!==r[f]){var N=r[f]||0,W=i[f];W instanceof Array?t[f]=E(W,T):("string"==typeof W&&(W="+"===W.charAt(0)||"-"===W.charAt(0)?N+parseFloat(W,10):parseFloat(W,10)),"number"==typeof W&&(t[f]=N+(W-N)*T))}if(null!==w&&w.call(t,T),1===M){if(e>0){isFinite(e)&&e--;for(f in o){if("string"==typeof i[f]&&(o[f]=o[f]+parseFloat(i[f],10)),a){var O=o[f];o[f]=i[f],i[f]=O}r[f]=o[f]}return a&&(c=!c),h=n+s,!0}null!==I&&I.call(t);for(var m=0,g=p.length;g>m;m++)p[m].start(h+u);return!1}return!0}},TWEEN.Easing={Linear:{None:function(n){return n}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.cos(n*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return.5*(1-Math.cos(Math.PI*n))}},Exponential:{In:function(n){return 0===n?0:Math.pow(1024,n-1)},Out:function(n){return 1===n?1:1-Math.pow(2,-10*n)},InOut:function(n){return 0===n?0:1===n?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){return 0===n?0:1===n?1:-Math.pow(2,10*(n-1))*Math.sin(5*(n-1.1)*Math.PI)},Out:function(n){return 0===n?0:1===n?1:Math.pow(2,-10*n)*Math.sin(5*(n-.1)*Math.PI)+1},InOut:function(n){return 0===n?0:1===n?1:(n*=2,1>n?-.5*Math.pow(2,10*(n-1))*Math.sin(5*(n-1.1)*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin(5*(n-1.1)*Math.PI)+1)}},Back:{In:function(n){var t=1.70158;return n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}},Bounce:{In:function(n){return 1-TWEEN.Easing.Bounce.Out(1-n)},Out:function(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return.5>n?.5*TWEEN.Easing.Bounce.In(2*n):.5*TWEEN.Easing.Bounce.Out(2*n-1)+.5}}},TWEEN.Interpolation={Linear:function(n,t){var r=n.length-1,i=r*t,o=Math.floor(i),u=TWEEN.Interpolation.Utils.Linear;return 0>t?u(n[0],n[1],i):t>1?u(n[r],n[r-1],r-i):u(n[o],n[o+1>r?r:o+1],i-o)},Bezier:function(n,t){for(var r=0,i=n.length-1,o=Math.pow,u=TWEEN.Interpolation.Utils.Bernstein,e=0;i>=e;e++)r+=o(1-t,i-e)*o(t,e)*n[e]*u(i,e);return r},CatmullRom:function(n,t){var r=n.length-1,i=r*t,o=Math.floor(i),u=TWEEN.Interpolation.Utils.CatmullRom;return n[0]===n[r]?(0>t&&(o=Math.floor(i=r*(1+t))),u(n[(o-1+r)%r],n[o],n[(o+1)%r],n[(o+2)%r],i-o)):0>t?n[0]-(u(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[r]-(u(n[r],n[r],n[r-1],n[r-1],i-r)-n[r]):u(n[o?o-1:0],n[o],n[o+1>r?r:o+1],n[o+2>r?r:o+2],i-o)},Utils:{Linear:function(n,t,r){return(t-n)*r+n},Bernstein:function(n,t){var r=TWEEN.Interpolation.Utils.Factorial;return r(n)/r(t)/r(n-t)},Factorial:function(){var n=[1];return function(t){var r=1;if(n[t])return n[t];for(var i=t;i>1;i--)r*=i;return n[t]=r,r}}(),CatmullRom:function(n,t,r,i,o){var u=.5*(r-n),e=.5*(i-t),a=o*o,f=o*a;return(2*t-2*r+u+e)*f+(-3*t+3*r-2*u-e)*a+u*o+t}}},function(n){"function"==typeof define&&define.amd?define([],function(){return TWEEN}):"undefined"!=typeof module&&"object"==typeof exports?module.exports=TWEEN:void 0!==n&&(n.TWEEN=TWEEN)}(this); +//# sourceMappingURL=Tween.min.js.map \ No newline at end of file diff --git a/vdo.ninja-24.4/thirdparty/jeeliz/jeelizFaceFilter.js b/vdo.ninja-24.4/thirdparty/jeeliz/jeelizFaceFilter.js new file mode 100644 index 0000000..11db714 --- /dev/null +++ b/vdo.ninja-24.4/thirdparty/jeeliz/jeelizFaceFilter.js @@ -0,0 +1,186 @@ + /** + * Jeeliz Face Filter - https://github.com/jeeliz/jeelizFaceFilter + * + * Copyright 2020 WebAR.rocks ( https://webar.rocks ) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +var JEELIZFACEFILTER=(function(){window.JEELIZFACEFILTERGEN=function(){function Fb(a){var c=null,d=null,e=null,m=0;this.A=function(n){this.Cf(n.pb);e.Be({qc:n.qc,nc:n.nc})};this.We=function(n){return c[n]};this.Cf=function(n){var q=null;m=n.length;c=n.map(function(r,l){r=Object.assign({},r,{index:l,parent:this,vb:q,ff:l===m-1});return q=l=0===l?Gb.instance(r):Hb.instance(r)});d=c[0];e=c[m-1];c.forEach(function(r,l){0!==l&&r.uf()})};this.V=function(n){var q=n;c.forEach(function(r){q=r.V(q,!1)});return q};this.Ve=function(){return d.F()}; +this.Xb=function(){return e.Xe()};this.nd=function(){return e.nd()};this.m=function(){c&&(c.forEach(function(n){n.m()}),e=d=c=null,m=0)};"undefined"!==typeof a&&this.A(a)}function db(a,c){var d=c%8;return a[(c-d)/8]>>7-d&1}function Ib(a){var c=JSON.parse(a);a=c.ne;var d=c.nf,e=c.n;var m="undefined"===typeof btoa?Buffer.from(c.data,"base64").toString("latin1"):atob(c.data);var n=m.length;c=new Uint8Array(n);for(var q=0;q=C;--t)g+=E*db(c,t),E*=2;C=g;l=l+1+a;E=n.length;g=0;for(t=l;tc&&(B.wb=a);1E3*ca)O.W.splice(0,O.W.length-a);else for(;O.W.lengthd&&(d=qa[e].detected,c=0);for(d=0;dc){do++d===O.o&&(d=0);while(!gb(qa[d]))}O.W[e]=d++;d%=O.o}O.Fd=d}for(a=0;aea.multiDetectionThresholdFactors[1]*ea.threshold}function Nb(a){return!gb(a)}function wb(a,c,d,e){return d>a?Math.max(0,a+c/2-(d-e/2)):Math.max(0,d+e/2-(a-c/2))}function Sb(){return Sa.some(function(a,c){if(c===O.pa)return!1; +c=Sa[O.pa];if(c.Aa>a.Aa||3>a.Aa||wb(c.x,c.ca,a.x,a.ca)ba.Hd*c.ca*d})}function Tb(){var a=O.pa;X.Da.Bf(1);1!==O.o&&(b.viewport(0,0,3,O.o),A.set("s0"),A.Xd("u1",1),U.l(!1,!1),A.Xd("u1",0));b.viewport(0,a,1,1);A.set("s56");Q.ua&&A.G("u42",qa[a].rz);1!==O.o&&A.G("u41",O.mc);if(1Pa?B.L[1]*=Pa/a:B.L[0]*=a/Pa;A.T("s56",[{name:"u50",type:"1f",value:Pa}]);B.v[0]=0;B.v[1]=0;B.v[2]=0;B.v[3]=0;switch(oa.rotate){case 0:B.v[0]=B.L[0];B.v[3]=B.L[1];break;case 180:B.v[0]=-B.L[0];B.v[3]=-B.L[1];break;case 90:B.v[1]=B.L[0];B.v[2]=-B.L[1];break;case -90:B.v[1]=-B.L[0],B.v[2]=B.L[1]}oa.flipX&&(B.v[0]*=-1,B.v[2]*=-1);B.kb||(B.v[1]*=-1,B.v[3]*=-1)}function yb(){var a={w:B.element.videoWidth||B.element.width,wa:B.element.videoHeight||B.element.height};if(!a.w||!a.wa||4>a.w||4>a.wa)throw Error("INVALID VIDEO DIMENSIONS - width = "+ +a.w+" height = "+a.wa);return a}function lb(){var a=yb(),c=B.H[0]!==a.w||B.H[1]!==a.wa;c&&(B.H[0]=a.w,B.H[1]=a.wa);return c}function $a(a,c){if(na===ia.error)return!1;B.element=a;lb();c&&c();return!0}function zb(a,c,d){a&&a();B.La={video:{facingMode:{exact:oa.facingMode},width:{min:oa.minWidth,max:oa.maxWidth,ideal:oa.idealWidth},height:{min:oa.minHeight,max:oa.maxHeight,ideal:oa.idealHeight}},audio:!1};W.Oc(B.La,oa.deviceId);W.get(B.element?B.element:W.Ze(),function(e){c&&c(e);d(e)},function(){Ha("WEBCAM_UNAVAILABLE")}, +B.La)}function Ha(a){na!==ia.error&&(na=ia.error,Q.Ka&&Q.Ka(a))}var wa={Qg:function(a){return Math.ceil(Math.log2(a))},jh:function(a){return Math.log2(a)},fh:function(a){return 0===Math.log2(a)%1},dg:function(a){var c=[0,0,0,0];a.forEach(function(d){c[0]+=d[0];c[1]+=d[1];c[2]+=d[2];c[3]+=d[3]});return c},eg:function(a,c,d){return Math.min(Math.max(a,c),d)},hg:function(a){return a*Math.PI/180},oh:function(a,c){c=Math.pow(10,c);return Math.round(a*c)/c},ph:function(a){return Math.round(1E6*a)/1E6}, +Rg:function(a,c){return(100*a/c).toFixed(3)},$:function(a,c,d){return a*(1-d)+c*d},Ge:function(a,c){return wa.ye(a-c)},ye:function(a){for(;a>Math.PI;)a-=2*Math.PI;for(;a<=-Math.PI;)a+=2*Math.PI;return a},kg:function(a,c){return Math.abs(wa.Ge(a,c))},Uf:function(a,c){return Math.atan2(Math.sin(a)+Math.sin(c),Math.cos(a)+Math.cos(c))}},vb={get:function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0);e.withCredentials=!1;e.onreadystatechange=function(){4===e.readyState&&(200===e.status||0===e.status? +c(e.responseText):"undefined"!==typeof d&&d(e.status))};e.send()},Ng:function(a,c){vb.get(a,function(d){c(JSON.parse(d))})},lh:function(a,c,d){var e=new XMLHttpRequest;e.open("POST",a,!0);e.setRequestHeader("Content-type","application/x-www-form-urlencoded");e.onreadystatechange=function(){4!==e.readyState||200!==e.status&&0!==e.status||d(e.responseText)};e.send(c)},Bg:function(a,c){var d=new XMLHttpRequest;d.open("POST",a,!0);d.responseType="arraybuffer";d.onload=function(){c(d.response)};d.send()}}, +Ub={create:function(a,c){for(var d=Array(c),e=0;e +a?2*a*a:-1+(4-2*a)*a},ng:function(a){return a*a*a},wg:function(a){return--a*a*a+1},og:function(a){return.5>a?4*a*a*a:(a-1)*(2*a-2)*(2*a-2)+1},tg:function(a){return a*a*a*a},yg:function(a){return 1- --a*a*a*a},qg:function(a){return.5>a?8*a*a*a*a:1-8*--a*a*a*a},ug:function(a){return a*a*a*a*a},zg:function(a){return 1+--a*a*a*a*a},rg:function(a){return.5>a?16*a*a*a*a*a:1+16*--a*a*a*a*a}},Vb={Me:function(a,c,d){switch(a){case "relu":return d+"=max(vec4(0.,0.,0.,0.),"+c+");";case "elu":return d+"=mix(exp(-abs("+ +c+"))-vec4(1.,1.,1.,1.),"+c+",step(0.,"+c+"));";case "elu01":return d+"=mix(0.1*exp(-abs("+c+"))-vec4(0.1,0.1,0.1,0.1),"+c+",step(0.,"+c+"));";case "arctan":return d+"=atan(3.14159265359*texture2D(u0,vUV))/3.14159265359;";case "copy":return"";default:return!1}}},A=function(){function a(u,f,y){f=u.createShader(f);u.shaderSource(f,y);u.compileShader(f);return u.getShaderParameter(f,u.COMPILE_STATUS)?f:!1}function c(u,f,y){f=a(u,u.VERTEX_SHADER,f);y=a(u,u.FRAGMENT_SHADER,y);u===b&&q.push(f,y);var G= +u.createProgram();u.attachShader(G,f);u.attachShader(G,y);u.linkProgram(G);return G}function d(u,f){f.C=f.C?!0:!1;if(!f.C){void 0===f.ta&&(f.ta="precision lowp float;attribute vec2 a0;varying vec2 vv0;void main(){gl_Position=vec4(a0,0.,1.),vv0=a0*.5+vec2(.5,.5);}");void 0===f.Ta&&(f.Ta=["a0"]);void 0===f.Ha&&(f.Ha=[2]);if(void 0===f.precision||"highp"===f.precision)f.precision=E;f.id=v++;void 0!==f.Vd&&(f.Vd.forEach(function(G,L){f.h=f.h.replace(G,f.yb[L])}),f.Vd.splice(0));f.Hc=0;f.Ha.forEach(function(G){f.Hc+= +4*G});f.ra=c(u,f.ta,"precision "+f.precision+" float;\n"+f.h);f.B={};f.i.forEach(function(G){f.B[G]=u.getUniformLocation(f.ra,G)});f.attributes={};f.Ia=[];f.Ta.forEach(function(G){var L=u.getAttribLocation(f.ra,G);f.attributes[G]=L;f.Ia.push(L)});if(f.j){u.useProgram(f.ra);l=f;r=f.id;for(var y in f.j)u.uniform1i(f.B[y],f.j[y])}f.qa=!0}}function e(u){xa.Ff(M);r!==u.id&&(M.R(),r=u.id,l=u,b.useProgram(u.ra),u.Ia.forEach(function(f){0!==f&&b.enableVertexAttribArray(f)}))}function m(u,f,y){d(u,f,y);u.useProgram(f.ra); +u.enableVertexAttribArray(0);r=-1;return l=f}function n(){return{h:"uniform sampler2D u1;varying vec2 vv0;void main(){gl_FragColor=texture2D(u1,vv0);}",i:["u1"],j:{u1:0}}}var q=[],r=-1,l=null,v=0,C=!1,E="highp",g=["u1"],t=["u0"],x={u1:0},k={u0:0},p={u1:0,u2:1},H={u3:0},I={s0:n(),s1:{h:"uniform sampler2D u1;varying vec2 vv0;void main(){gl_FragColor=texture2D(u1,vv0);}",i:g,j:x,precision:"lowp"},s2:{h:"uniform sampler2D u1,u2;varying vec2 vv0;void main(){vec4 a=texture2D(u2,vv0),b=texture2D(u1,vv0);gl_FragColor=a*b;}", +i:["u1","u2"],j:p},s3:{h:"uniform sampler2D u1;uniform vec2 u4,u5;varying vec2 vv0;void main(){vec2 a=vv0*u4+u5;gl_FragColor=texture2D(u1,a);}",i:["u1","u4","u5"],j:x,C:!0},s4:{h:"uniform sampler2D u1;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u1,vv0);gl_FragColor=a.r*f;}",i:g,j:x},s5:{h:"uniform sampler2D u1,u2;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u2,vv0),b=texture2D(u1,vv0);gl_FragColor=a.a*b.r*f;}",i:["u1","u2"],j:p},s6:{h:"uniform sampler2D u1;varying vec2 vv0;void main(){gl_FragColor=texture2D(u1,vec2(1.-vv0.x,vv0.y));}", +i:g,j:x},s7:{h:"uniform sampler2D u1;varying vec2 vv0;void main(){gl_FragColor=texture2D(u1,vec2(vv0.x,1.-vv0.y));}",i:g,j:x},s8:{h:"uniform sampler2D u0;uniform float u4;varying vec2 vv0;void main(){vec4 a=texture2D(u0,vv0);gl_FragColor=a*u4;}",i:["u0","u4"],j:k},s9:{h:"uniform sampler2D u0;uniform float u4;varying vec2 vv0;const vec4 f=vec4(.25,.25,.25,.25),g=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u0,vv0);float b=dot(a*u4,f);gl_FragColor=b*g;}",i:["u0","u4"],j:k},s10:{h:"uniform sampler2D u1;varying vec2 vv0;const vec4 e=vec4(1.,1.,1.,1.);void main(){float a=.25*dot(e,texture2D(u1,vv0));gl_FragColor=a*e;}", +i:g,j:x},s11:{h:"uniform sampler2D u1,u6;uniform float u7;const vec4 f=vec4(1.,1.,1.,1.);varying vec2 vv0;void main(){vec4 a=texture2D(u1,vv0),b=texture2D(u6,vv0);gl_FragColor=mix(b,a,u7*f);}",i:["u1","u6","u7"],j:{u1:0,u6:1}},s12:{h:"uniform sampler2D u1;uniform vec2 u8;varying vec2 vv0;void main(){gl_FragColor=.25*(texture2D(u1,vv0+u8)+texture2D(u1,vv0+u8*vec2(1.,-1.))+texture2D(u1,vv0+u8*vec2(-1.,-1.))+texture2D(u1,vv0+u8*vec2(-1.,1.)));}",i:["u1","u8"],j:x},s13:{h:"uniform sampler2D u1;uniform vec4 u9;varying vec2 vv0;float g(float a,float b){a=floor(a)+.5;return floor(a/exp2(b));}float h(float a,float b){return floor(a*exp2(b)+.5);}float i(float a,float b){return mod(a,h(1.,b));}float e(float c,float a,float b){a=floor(a+.5),b=floor(b+.5);return i(g(c,a),b-a);}vec4 j(float a){if(a==0.)return vec4(0.,0.,0.,0.);float k=128.*step(a,0.);a=abs(a);float c=floor(log2(a)),l=c+127.,b=(a/exp2(c)-1.)*8388608.,d=l/2.,m=fract(d)*2.,n=floor(d),o=e(b,0.,8.),p=e(b,8.,16.),q=m*128.+e(b,16.,23.),r=k+n;return vec4(o,p,q,r)/255.;}void main(){float a=dot(texture2D(u1,vv0),u9);gl_FragColor=j(a);}", +i:["u1","u9"],j:x},s14:{h:"uniform sampler2D u0;varying vec2 vv0;const vec4 e=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u0,vv0),b=e/(e+exp(-a));gl_FragColor=b;}",i:t,j:k,C:!0},s15:{h:"uniform sampler2D u0;varying vec2 vv0;const vec4 f=vec4(0.,0.,0.,0.);void main(){vec4 a=texture2D(u0,vv0);gl_FragColor=max(f,a);}",i:t,j:k},s16:{h:"uniform sampler2D u0;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u0,vv0);gl_FragColor=mix(exp(-abs(a))-f,a,step(0.,a));}",i:t,j:k}, +s17:{h:"uniform sampler2D u0;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u0,vv0),b=exp(-abs(a))-f;gl_FragColor=mix(.1*b,a,step(0.,a));}",i:t,j:k},s18:{h:"uniform sampler2D u0,u7,u10;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u0,vv0),c=texture2D(u7,vv0),d=texture2D(u10,vv0),b=a/d;gl_FragColor=c*mix(exp(-abs(b))-f,b,step(0.,a));}",i:["u0","u7","u10"],j:{u0:0,u7:1,u10:2},C:!0},s19:{h:"uniform sampler2D u0;const float e=3.141593;varying vec2 vv0;void main(){gl_FragColor=atan(e*texture2D(u0,vv0))/e;}", +i:t,j:k},s20:{h:"uniform sampler2D u0;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=texture2D(u0,vv0),b=log(f+a);gl_FragColor=b;}",i:t,j:k,C:!0},s21:{h:"uniform sampler2D u0,u11;uniform float u12;const vec2 e=vec2(.5,.5);const float f=1e-5;const vec4 g=vec4(1.,1.,1.,1.),i=vec4(0.,0.,0.,0.);varying vec2 vv0;void main(){vec4 a=texture2D(u11,e);float b=u12*u12;vec4 c=max(b*a,f*g);gl_FragColor=texture2D(u0,vv0)/c;}",i:["u0","u11","u12"],j:{u0:0,u11:1},C:!0},s22:{h:"uniform sampler2D u1;uniform vec2 u13;varying vec2 vv0;void main(){float a=u13.x*u13.y;vec2 b=floor(vv0*a)/a,c=fract(vv0*a),d=floor(b*u13.y),f=floor(u13.x*fract(b*u13.y)),g=(f*u13.y+d)/a;gl_FragColor=texture2D(u1,g+c/a);}", +i:["u1","u13"],j:x},s23:{h:"uniform sampler2D u14,u15,u16;varying vec2 vv0;void main(){vec4 a=texture2D(u16,vv0);vec2 b=a.rg,c=a.ba;vec4 d=texture2D(u14,b),f=texture2D(u15,c);gl_FragColor=d*f;}",i:["u14","u15","u16"],j:{u15:0,u14:1,u16:2},C:!0},s24:{h:"uniform float u17;uniform sampler2D u14,u15;varying vec2 vv0;void main(){vec2 a=fract(vv0*u17);vec4 b=texture2D(u14,vv0),c=texture2D(u15,a);gl_FragColor=b*c;}",i:["u15","u14","u17"],j:{u15:0,u14:1}},s25:{h:"uniform float u17;uniform sampler2D u14,u15,u18,u19,u20,u21;varying vec2 vv0;const vec4 e=vec4(1.,1.,1.,1.),g=vec4(1e-3,1e-3,1e-3,1e-3);void main(){vec2 h=vv0*u17,l=floor(h),c=h-l;vec4 m=texture2D(u14,vv0),d=texture2D(u15,c),a=texture2D(u21,vv0);a=a*255.;vec4 n=texture2D(u18,c),o=texture2D(u19,c),p=texture2D(u20,c),i=step(-g,-a),b=e-i,j=b*step(-e-g,-a);b*=e-j;vec4 k=b*step(-2.*e-g,-a);b*=e-k;vec4 q=b;d=i*d+j*n+k*o+q*p,gl_FragColor=m*d;}", +i:"u14 u15 u17 u21 u18 u19 u20".split(" "),j:{u15:0,u14:1,u21:3,u18:4,u19:5,u20:6},C:!0},s26:{h:"uniform sampler2D u14,u15,u22;uniform float u17,u23,u24,u25;varying vec2 vv0;const vec2 j=vec2(1.,1.);void main(){vec2 a=floor(u23*vv0),b=u23*vv0-a;float c=u17/u23;vec2 d=floor(b*c),f=b*c-d,g=(a+f)/u23;float k=u23*u25/u17;vec2 l=k*d,h=(l+f*u24)/u25,i=step(h,j);vec4 m=texture2D(u14,g),n=texture2D(u15,h),o=m*n*i.x*i.y,p=texture2D(u22,g);gl_FragColor=o*u24*u24+p;}",i:"u14 u15 u17 u23 u24 u25 u22".split(" "), +j:{u15:0,u14:1,u22:2}},s27:{h:"uniform sampler2D u14,u15;varying vec2 vv0;void main(){vec4 a=texture2D(u14,vv0),b=texture2D(u15,vv0);gl_FragColor=a*b;}",i:["u14","u15"],j:{u15:0,u14:1},C:!0},s28:{h:"uniform sampler2D u1,u22;uniform float u26;varying vec2 vv0;void main(){gl_FragColor=texture2D(u22,vv0)+u26*texture2D(u1,vv0);}",i:["u1","u22","u26"],j:{u1:0,u22:1}},s29:{h:"varying vec2 vv0;uniform sampler2D u1;const vec4 f=vec4(1.,1.,1.,1.),g=vec4(.299,.587,.114,0.);void main(){vec4 a=texture2D(u1,vv0);gl_FragColor=dot(a,g)*f;}", +i:g,j:x,precision:"lowp"},s30:{h:"varying vec2 vv0;uniform sampler2D u1;uniform float u27;const vec3 f=vec3(.299,.587,.114);void main(){vec3 a=texture2D(u1,vv0).rgb,b=texture2D(u1,vv0+vec2(0.,u27)).rgb,c=texture2D(u1,vv0+vec2(u27,u27)).rgb,d=texture2D(u1,vv0+vec2(u27,0.)).rgb;gl_FragColor=vec4(dot(a,f),dot(b,f),dot(c,f),dot(d,f));}",i:["u1","u27"],j:x,precision:"lowp"},s31:{h:"varying vec2 vv0;uniform sampler2D u1;uniform float u27;const vec3 f=vec3(.299,.587,.114);void main(){vec3 a=texture2D(u1,vv0).rgb,b=texture2D(u1,vv0+vec2(0.,u27)).rgb,c=texture2D(u1,vv0+vec2(u27,u27)).rgb,d=texture2D(u1,vv0+vec2(u27,0.)).rgb;gl_FragColor=vec4(a.r,b.g,c.b,dot(d,f));}", +i:["u1","u27"],j:x,precision:"lowp"},s32:{h:"varying vec2 vv0;uniform sampler2D u1,u2;uniform float u28;const vec4 f=vec4(1.,1.,1.,1.);void main(){vec4 a=vec4(0.);a-=texture2D(u1,vec2(vv0.x-u28,vv0.y-u28))*1.,a-=texture2D(u1,vec2(vv0.x-u28,vv0.y))*2.,a-=texture2D(u1,vec2(vv0.x-u28,vv0.y+u28))*1.,a+=texture2D(u1,vec2(vv0.x+u28,vv0.y-u28))*1.,a+=texture2D(u1,vec2(vv0.x+u28,vv0.y))*2.,a+=texture2D(u1,vec2(vv0.x+u28,vv0.y+u28))*1.;vec4 b=vec4(0.);b-=texture2D(u1,vec2(vv0.x-u28,vv0.y-u28))*1.,b-=texture2D(u1,vec2(vv0.x,vv0.y-u28))*2.,b-=texture2D(u1,vec2(vv0.x+u28,vv0.y-u28))*1.,b+=texture2D(u1,vec2(vv0.x-u28,vv0.y+u28))*1.,b+=texture2D(u1,vec2(vv0.x,vv0.y+u28))*2.,b+=texture2D(u1,vec2(vv0.x+u28,vv0.y+u28))*1.;vec3 c=sqrt(a.rgb*a.rgb+b.rgb*b.rgb);vec4 e=vec4(c,texture2D(u1,vv0).a),g=texture2D(u2,vv0);gl_FragColor=g.a*e.r*f;}", +i:["u1","u2","u28"],j:p,C:!0},s33:{h:"varying vec2 vv0;uniform sampler2D u1,u2;uniform float u28;const vec4 j=vec4(1.,1.,1.,1.);const vec2 k=vec2(1.,1.);void main(){float h=0.;vec2 l=k*u28,a,b;float c,d,i=0.;for(float e=-4.;e<=4.;e+=1.)for(float f=-4.;f<=4.;f+=1.)a=vec2(e,f),c=length(a)/2.,d=exp(-c*c),b=vv0+l*a,h+=d*texture2D(u1,b).r,i+=d;vec4 m=texture2D(u2,vv0);gl_FragColor=m.a*(texture2D(u1,b).r-h/i)*j;}",i:["u1","u2","u28"],j:p,C:!0},s34:{h:"uniform sampler2D u3;uniform vec2 u8;varying vec2 vv0;vec4 e(vec4 a,vec4 b){vec4 c=step(a,b);return mix(a,b,c);}const vec2 g=vec2(.5,.5),h=vec2(1.,0.),i=vec2(0.,1.);void main(){vec2 a=vv0-u8*g;vec4 b=texture2D(u3,a),c=texture2D(u3,a+u8*h),d=texture2D(u3,a+u8*i),j=texture2D(u3,a+u8),k=e(b,c),l=e(d,j);gl_FragColor=e(k,l);}", +i:["u3","u8"],j:H},s35:{h:"uniform sampler2D u3;uniform vec2 u8;varying vec2 vv0;const vec2 k=vec2(1.,0.),l=vec2(0.,1.),m=vec2(2.,0.),n=vec2(0.,2.);vec4 e(vec4 a,vec4 b){vec4 c=step(a,b);return mix(a,b,c);}vec4 f(vec2 a){vec4 b=texture2D(u3,a),c=texture2D(u3,a+u8*k),d=texture2D(u3,a+u8*l),g=texture2D(u3,a+u8),h=e(b,c),i=e(d,g);return e(h,i);}void main(){vec2 a=vv0+u8*vec2(-.55,-1.05);vec4 b=f(a),c=f(a+u8*m),d=f(a+u8*2.),g=f(a+u8*n),h=e(b,c),i=e(d,g);gl_FragColor=e(h,i);}",i:["u3","u8"],j:H,C:!0}, +s36:{h:"uniform sampler2D u1;varying vec2 vv0;void main(){vec4 a=texture2D(u1,vv0);gl_FragColor=a*a;}",i:["u1"],j:x,precision:"lowp",C:!0},s37:{h:"uniform sampler2D u1;uniform vec2 u8;varying vec2 vv0;const float e=15444.;void main(){vec4 a=1001./e*texture2D(u1,vv0-3.*u8)+2002./e*texture2D(u1,vv0-2.*u8)+3003./e*texture2D(u1,vv0-u8)+3432./e*texture2D(u1,vv0)+3003./e*texture2D(u1,vv0+u8)+2002./e*texture2D(u1,vv0+2.*u8)+1001./e*texture2D(u1,vv0+3.*u8);gl_FragColor=a;}",i:["u8","u1"],j:x,precision:"lowp", +C:!0},s38:{h:"uniform sampler2D u1,u11,u29;varying vec2 vv0;const vec4 f=vec4(1.,1.,1.,1.);const float g=.1;void main(){vec4 a=texture2D(u11,vv0),b=texture2D(u29,vv0),c=texture2D(u1,vv0),d=max(f*g,b-a*a),h=sqrt(d);gl_FragColor=(c-a)/h;}",i:["u1","u11","u29"],j:{u1:0,u11:1,u29:2},C:!0}},N={s39:{h:"uniform float u17,u30;uniform sampler2D u14,u15,u22;varying vec2 vv0;const vec2 ZERO2=vec2(0.,0.),ONE2=vec2(1.,1.),HALF2=vec2(.5,.5),EPS2=vec2(1e-5,1e-5);void main(){vec4 sum=texture2D(u22,vv0);float toSparsity=1.1111;vec2 uvFrom,uvWeight,xyPatch=ZERO2,eps2=EPS2/u17,xyTo=floor(vv0*u17+eps2);float weightSize=toSparsity*u17;vec2 halfFromSparsity=ONE2*(toSparsity-1.)/2.;for(float patch_x=0.;patch_x<1.1111;patch_x+=1.){xyPatch.x=patch_x;for(float patch_y=0.;patch_y<1.1111;patch_y+=1.)xyPatch.y=patch_y,uvFrom=(xyTo+HALF2+u30*(xyPatch-halfFromSparsity))/u17,uvFrom+=step(uvFrom,-eps2),uvFrom-=step(ONE2-eps2,uvFrom),uvWeight=(xyTo*toSparsity+xyPatch+HALF2)/weightSize,sum+=texture2D(u14,uvWeight)*texture2D(u15,uvFrom);}gl_FragColor=sum,gl_FragColor*=2.2222;}", +i:["u17","u14","u15","u22","u30"],yb:["1.1111","gl_FragColor\\*=2.2222;"]},s40:{h:"uniform float u17,u30,u25;uniform sampler2D u14,u15,u22;varying vec2 vv0;const vec2 ZERO2=vec2(0.,0.),ONE2=vec2(1.,1.),HALF2=vec2(.5,.5),EPS2=vec2(1e-4,1e-4);void main(){vec4 sum=texture2D(u22,vv0);float fromSparsity=1.1111,shrinkFactor=3.3333;vec2 uvFrom,uvWeight,xyFrom,xyPatchTo,xyPatch=ZERO2,xyShrink=ZERO2,eps2=EPS2/u25,xyTo=floor(vv0*u17+eps2);float weightSize=fromSparsity*u25;vec2 halfFromSparsity=ONE2*(fromSparsity-1.)/2.;float toSparsity=weightSize/u17;vec2 xyFrom0=xyTo*shrinkFactor;for(float patch_x=0.;patch_x<1.1111;patch_x+=1.){xyPatch.x=patch_x;for(float patch_y=0.;patch_y<1.1111;patch_y+=1.){xyPatch.y=patch_y;for(float shrink_x=0.;shrink_x<3.3333;shrink_x+=1.){xyShrink.x=shrink_x;for(float shrink_y=0.;shrink_y<3.3333;shrink_y+=1.)xyShrink.y=shrink_y,xyFrom=xyFrom0+xyShrink+shrinkFactor*u30*(xyPatch-halfFromSparsity),uvFrom=(xyFrom+HALF2)/u25,uvFrom+=step(uvFrom,-eps2),uvFrom-=step(ONE2-eps2,uvFrom),xyPatchTo=xyPatch*shrinkFactor+xyShrink,uvWeight=(xyTo*toSparsity+xyPatchTo+HALF2)/weightSize,sum+=texture2D(u14,uvWeight)*texture2D(u15,uvFrom);}}}gl_FragColor=sum,gl_FragColor*=2.2222;}", +i:"u17 u25 u14 u15 u22 u30".split(" "),yb:["1.1111","gl_FragColor\\*=2.2222;","3.3333"]}},z=null,J=null,M={nb:function(){return C},A:function(){if(!C){z=mb.Kb(I,2);J=mb.Kb(N,2);E="highp";for(var u in z)d(b,z[u],u);A.set("s0");b.enableVertexAttribArray(0);C=!0}},Qc:function(u){u.forEach(function(f){M.Pc(f)})},Pc:function(u){z[u.id]=u;d(b,u,u.id)},sd:function(u,f,y){f||(f=u);z[f]=Object.create(J[u]);z[f].ef=!0;J[u].yb&&J[u].yb.forEach(function(G,L){z[f].h=z[f].h.replace(new RegExp(G,"g"),y[L])});d(b, +z[f],f)},set:function(u){var f=z[u];f.C&&(f.C=!1,d(b,f,u));e(f)},Ra:function(u){return m(u,n(),"s41")},wc:function(u){return m(u,{h:"void main(){gl_FragColor=vec4(.5,.5,.5,.5);}",i:[],precision:"highp"},"s42")},Je:function(u){return"undefined"===typeof z[u]?!1:z[u].qa},R:function(){-1!==r&&(r=-1,l.Ia.forEach(function(u){0!==u&&b.disableVertexAttribArray(u)}))},yc:function(){var u=0;l.Ia.forEach(function(f,y){y=l.Ha[y];b.vertexAttribPointer(f,y,b.FLOAT,!1,l.Hc,u);u+=4*y})},ad:function(){b.enableVertexAttribArray(0)}, +Ba:function(){M.zb(b)},zb:function(u){u.vertexAttribPointer(l.Ia[0],2,u.FLOAT,!1,8,0)},Xd:function(u,f){b.uniform1i(l.B[u],f)},G:function(u,f){b.uniform1f(l.B[u],f)},sa:function(u,f,y){b.uniform2f(l.B[u],f,y)},wh:function(u,f){b.uniform2fv(l.B[u],f)},Gf:function(u,f){b.uniform3fv(l.B[u],f)},xh:function(u,f,y,G){b.uniform3f(l.B[u],f,y,G)},yh:function(u,f,y,G,L){b.uniform4f(l.B[u],f,y,G,L)},xc:function(u,f){b.uniform4fv(l.B[u],f)},zh:function(u,f){b.uniformMatrix2fv(l.B[u],!1,f)},Ah:function(u,f){b.uniformMatrix3fv(l.B[u], +!1,f)},Bh:function(u,f){b.uniformMatrix4fv(l.B[u],!1,f)},T:function(u,f){M.set(u);f.forEach(function(y){switch(y.type){case "4f":b.uniform4fv(l.B[y.name],y.value);break;case "3f":b.uniform3fv(l.B[y.name],y.value);break;case "2f":b.uniform2fv(l.B[y.name],y.value);break;case "1f":b.uniform1f(l.B[y.name],y.value);break;case "1i":b.uniform1i(l.B[y.name],y.value);break;case "mat2":b.uniformMatrix2fv(l.B[y.name],!1,y.value);break;case "mat3":b.uniformMatrix3fv(l.B[y.name],!1,y.value);break;case "mat4":b.uniformMatrix4fv(l.B[y.name], +!1,y.value)}})},Pg:function(){return"lowp"},m:function(){b.disableVertexAttribArray(0);M.R();for(var u in z){var f=z[u];f.qa&&(f.qa=!1,b.deleteProgram(f.ra));f.ef&&delete z[u]}q.forEach(function(y){b.deleteShader(y)});q.splice(0);v=0;C=!1;l=null;r=-1}};return M}(),b=null,Qa=function(){function a(g){console.log("ERROR in ContextFF: ",g);return!1}function c(g){function t(){Ca.m();aa.reset();k.getExtension("WEBGL_lose_context").loseContext()}if(navigator.userAgent&&-1!==navigator.userAgent.indexOf("forceWebGL1"))return!1; +var x=document.createElement("canvas");x.setAttribute("width",5);x.setAttribute("height",5);var k=null;try{k=x.getContext("webgl2",g)}catch(p){return!1}if(!k)return!1;d(k);aa.bd(k);g=aa.Lb(k);if(!g.ja&&!g.ka)return t(),!1;g=Ca.Tc(k,g);t();return g?!0:!1}function d(g){g.clearColor(0,0,0,0);g.disable(g.DEPTH_TEST);g.disable(g.BLEND);g.disable(g.DITHER);g.disable(g.STENCIL_TEST);g.disable(g.CULL_FACE);g.GENERATE_MIPMAP_HINT&&g.hint(g.GENERATE_MIPMAP_HINT,g.FASTEST);g.disable(g.SAMPLE_ALPHA_TO_COVERAGE); +g.disable(g.SAMPLE_COVERAGE);g.depthFunc(g.LEQUAL);g.clearDepth(1)}var e=null,m=null,n=null,q=null,r=!0,l=null,v=null,C=[],E={F:function(){return e.width},U:function(){return e.height},Gg:function(){return e},Eg:function(){return b},la:function(){return r},flush:function(){b.flush()},Pe:function(){l||(l=new Uint8Array(e.width*e.height*4));b.readPixels(0,0,e.width,e.height,b.RGBA,b.UNSIGNED_BYTE,l);return l},Ig:function(){return e.toDataURL("image/jpeg")},Jg:function(){va.P();m||(m=document.createElement("canvas"), +n=m.getContext("2d"));m.width=e.width;m.height=e.height;for(var g=E.Pe(),t=n.createImageData(m.width,m.height),x=m.width,k=m.height,p=t.data,H=0;H>16&32768,K=h>>12&2047,P=h>>23&255;return 103>P?F:142P?(K|=2048,F|(K>>114-P)+(K>>113-P&1)):F=(F| +P-112<<10|K>>1)+(K&1)}function d(h){var F=new Uint16Array(h.length);h.forEach(function(K,P){F[P]=c(K)});return F}function e(){if(null!==G.$b)return G.$b;var h=n(d([.5,.5,.5,.5]));return null===h?!0:G.$b=h}function m(){if(null!==G.ac)return G.ac;var h=n(new Uint8Array([127,127,127,127]));return null===h?!0:G.ac=h}function n(h){if(!xa.nb()||!k)return null;var F=null,K=Math.sqrt(h.length/4);try{var P=b.getError();if("FUCKING_BIG_ERROR"===P)return!1;F=L.instance({isFloat:!1,S:!0,array:h,width:K});P=b.getError(); +if(P!==b.NO_ERROR)return!1}catch(ra){return!1}la.P();b.viewport(0,0,K,K);b.clearColor(0,0,0,0);b.clear(b.COLOR_BUFFER_BIT);xa.set("s0");F.Rc(0);ma.l(!0,!0);h=4*K*K;P=new Uint8Array(h);b.readPixels(0,0,K,K,b.RGBA,b.UNSIGNED_BYTE,P);K=!0;for(var da=0;daMath.abs(P[da]-127);F.remove();la.ha();return K}var q=0,r=null,l=0,v=null,C=null,E=null,g=null,t=null,x=null,k=!1,p=[],H={isFloat:!1,isPot:!0,isLinear:!1,isMipmap:!1,isAnisotropicFiltering:!1,isMirrorX:!1,isMirrorY:!1,isSrgb:!1,isKeepArray:!1, +isFlipY:null,width:0,height:0,url:null,array:null,data:null,I:null,Zb:null,df:!1,S:!1,oa:null,sb:4,ic:0},I=!1,N=null,z=null,J=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],M=!1,u=!1,f=new Float32Array(1),y=new Int32Array(f.buffer),G={$b:null,ac:null},L={A:function(){k||(t=[b.RGBA,null,b.RGBA,b.RGBA],x=[b.RGBA,null,b.RGBA,b.RGBA],r=[b.TEXTURE0,b.TEXTURE1,b.TEXTURE2,b.TEXTURE3,b.TEXTURE4,b.TEXTURE5,b.TEXTURE6,b.TEXTURE7],M="undefined"!==typeof JEContext,u="undefined"!==typeof aa,M&&JEContext.gh()&&r.push(b.TEXTURE8, +b.TEXTURE9),v=[-1,-1,-1,-1,-1,-1,-1,-1],g=[b.UNSIGNED_BYTE,b.FLOAT,b.FLOAT],k=!0)},af:function(){if(!C){for(var h=new Float32Array(16384),F=0;16384>F;++F)h[F]=2*Math.random()-1;C={random:L.instance({isFloat:!0,isPot:!0,array:h,width:64}),de:L.instance({isFloat:!1,isPot:!0,width:1,array:new Uint8Array([0,0,0,0])})}}L.Sf()},Xg:function(){return C.de},Sf:function(){g[1]=aa.Vb(b)},Df:function(){x=t=[b.RGBA,b.RGBA,b.RGBA,b.RGBA]},Sd:function(h){A.set("s1");la.P();var F=h.F(),K=h.U();b.viewport(0,0,F,K); +h.g(0);ma.l(!1,!1)},mh:function(h,F){L.Sd(h);b.readPixels(0,0,h.F(),h.U(),b.RGBA,b.UNSIGNED_BYTE,F)},nh:function(h,F){L.Sd(h);return aa.xb(0,0,h.F(),h.U(),F)},kd:function(h,F,K,P,da,ra,za){h.activeTexture(h.TEXTURE0);var w=h.createTexture();h.bindTexture(h.TEXTURE_2D,w);da=da instanceof Float32Array?da:new Float32Array(da);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER, +h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,ra);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,K,P,0,h.RGBA,h.FLOAT,da);h.bindTexture(h.TEXTURE_2D,null);h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,!1);za&&(la.ha(),A.Ra(h));h.viewport(0,0,K,P);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,F,0);h.bindTexture(h.TEXTURE_2D,w);za?ma.l(!0,!0):U.ab(h);h.deleteTexture(w);k&&(v[0]=-1,E=null,q=0)},Fb:function(h){h!==q&&(b.activeTexture(r[h]), +q=h)},instance:function(h){function F(){R=void 0!==w.I.videoWidth?w.I.videoWidth:w.I.width;T=void 0!==w.I.videoHeight?w.I.videoHeight:w.I.height}function K(D){var S=b.getError();if("FUCKING_BIG_ERROR"===S)return!1;b.texImage2D(b.TEXTURE_2D,0,ja,fa,ha,D);S=b.getError();S!==b.NO_ERROR&&fa!==b.RGBA&&(fa=b.RGBA,b.texImage2D(b.TEXTURE_2D,0,ja,fa,ha,D));return!0}function P(){if(!Ab){a(ta);Aa&&b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,Aa);w.isPot?(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,w.isMirrorX?b.MIRRORED_REPEAT: +b.REPEAT),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,w.isMirrorY?b.MIRRORED_REPEAT:b.REPEAT)):(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE));w.isAnisotropicFiltering&&"undefined"!==typeof JESETTINGS&&b.texParameterf(b.TEXTURE_2D,JEContext.Kg().TEXTURE_MAX_ANISOTROPY_EXT,JESETTINGS.Wf);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,w.isLinear?b.LINEAR:b.NEAREST);w.isLinear?b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER, +w.isMipmap&&!Ka?b.NEAREST_MIPMAP_LINEAR:b.LINEAR):b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,w.isMipmap&&!Ka?b.NEAREST_MIPMAP_NEAREST:b.NEAREST);fa=t[w.sb-1];ja=x[w.sb-1];ha=g[nb];if(aa.la()){var D=aa.Re();fa===b.RGBA&&ha===b.FLOAT?w.isMipmap||w.isLinear?ja=Ca.Te(b):aa.Uc()?D&&(ja=D):ja=b.RGBA16F||b.RGBA:fa===b.RGB&&ha===b.FLOAT&&D&&(ja=D,fa=b.RGBA)}if(w.S&&!w.isFloat||w.isFloat&&w.isMipmap&&Ca.hf())ja=aa.Se(),ha=aa.Vb(b);w.ic&&(ab=w.ic);w.isSrgb&&4===w.sb&&(fa=JEContext.Vg());if(w.I)K(w.I); +else if(w.url)K(Ga);else if(ua){D=ua;try{"FUCKING_BIG_ERROR"!==b.getError()&&(b.texImage2D(b.TEXTURE_2D,0,ja,R,T,0,fa,ha,D),b.getError()!==b.NO_ERROR&&(b.texImage2D(b.TEXTURE_2D,0,ja,R,T,0,fa,ha,null),b.getError()!==b.NO_ERROR&&b.texImage2D(b.TEXTURE_2D,0,b.RGBA,R,T,0,b.RGBA,b.UNSIGNED_BYTE,null)))}catch(hc){b.texImage2D(b.TEXTURE_2D,0,ja,R,T,0,fa,ha,null)}w.isKeepArray||(ua=null)}else D=b.getError(),"FUCKING_BIG_ERROR"!==D&&(b.texImage2D(b.TEXTURE_2D,0,ja,R,T,0,fa,ha,null),D=b.getError(),D!==b.NO_ERROR&& +(fa=b.RGBA,w.S&&ha!==b.FLOAT&&(ha=b.FLOAT,b.texImage2D(b.TEXTURE_2D,0,ja,R,T,0,fa,ha,null))));if(w.isMipmap)if(!Ka&&ca)ca.Ub(),bb=!0;else if(Ka){D=Math.log2(Math.min(R,T));Ra=Array(1+D);Ra[0]=ta;for(var S=1;S<=D;++S){var ka=Math.pow(2,S),V=R/ka;ka=T/ka;var La=b.createTexture();a(La);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texImage2D(b.TEXTURE_2D,0,ja,V,ka,0,fa,ha,null);a(null);Ra[S]=La}bb=!0}a(null);v[q]=-1;Aa&&b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL, +!1);Ta=!0;w.oa&&ca&&(w.oa(ca),w.oa=null)}}function da(){for(var D=R*T,S=2*D,ka=3*D,V=0;VD;++D)b.viewport(0,T*D,R,T),A.xc("u9",J[D]),ma.l(!1,0===D)},Rf:function(D){var S=ha===g[0]&&!m();a(ta);Aa&&b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!0);S?(Cb||(Xa=document.createElement("canvas"),Xa.width=R,Xa.height=T,ob=Xa.getContext("2d"), +pb=ob.createImageData(R,T),Cb=!0),pb.data.set(D),ob.putImageData(pb,0,0),b.texImage2D(b.TEXTURE_2D,0,ja,fa,ha,Xa)):b.texImage2D(b.TEXTURE_2D,0,ja,R,T,0,fa,ha,D);v[q]=Wa;Aa&&b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!1)},Gh:function(D,S){a(ta);S&&b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!0);b.texImage2D(b.TEXTURE_2D,0,ja,fa,ha,D);v[q]=Wa;S&&b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!1)},th:function(D,S){var ka=R*T,V=4*ka;D=w.S?D?"RGBE":"JSON":"RGBA";S&&(D=S);S=aa.la()&&!1;var La=null;switch(D){case "RGBE":La="s43"; +break;case "JSON":La=S?"s0":"s13";break;case "RGBA":case "RGBAARRAY":La="s7"}Va||("RGBA"===D||"RGBE"===D||"RGBAARRAY"===D?(Da=new Uint8Array(V),Va=!0):"JSON"!==D||S||ra());la.P();A.set(La);ca.g(0);V=null;if("RGBA"===D||"RGBE"===D||"RGBAARRAY"===D){b.viewport(0,0,R,T);ma.l(!0,!0);b.readPixels(0,0,R,T,b.RGBA,b.UNSIGNED_BYTE,Da);if("RGBAARRAY"===D)return{data:Da};I||(N=document.createElement("canvas"),z=N.getContext("2d"),I=!0);N.width=R;N.height=T;ka=z.createImageData(R,T);ka.data.set(Da);z.putImageData(ka, +0,0);V=N.toDataURL("image/png")}else if("JSON"===D)if(S)V=new Float32Array(ka),b.viewport(0,0,R,T),ma.l(!0,!0),b.readPixels(0,0,R,T,b.RGBA,b.FLOAT,V);else{for(V=0;4>V;++V)b.viewport(0,T*V,R,T),A.xc("u9",J[V]),ma.l(!V,!V);ca.Rd();V=Array(ka);for(S=0;S +l.K.length?(p=Uint16Array,x=b.UNSIGNED_SHORT,k=2):(p=Uint32Array,x=b.UNSIGNED_INT,k=4);p=l.K instanceof p?l.K:new p(l.K);b.bufferData(b.ELEMENT_ARRAY_BUFFER,p,E);q=v}var H={se:function(I){n!==v&&(b.bindBuffer(b.ARRAY_BUFFER,g),n=v);I&&xa.yc()},pe:function(){q!==v&&(b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,t),q=v)},bind:function(I){H.se(I);H.pe()},lg:function(){b.drawElements(b.TRIANGLES,C,x,0)},mg:function(I,N){b.drawElements(b.TRIANGLES,I,x,N*k)},remove:function(){b.deleteBuffer(g);l.K&&b.deleteBuffer(t); +H=null}};m.push(H);return H},Ja:function(){-1!==n&&(b.bindBuffer(b.ARRAY_BUFFER,c.ea),n=-1);-1!==q&&(b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c.K),q=-1)},l:function(l,v){l&&ma.Ja();v&&xa.Ba();b.drawElements(b.TRIANGLES,3,b.UNSIGNED_SHORT,0)},ab:function(l){l=l||b;var v=a(l);l.bindBuffer(l.ARRAY_BUFFER,v.ea);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,v.K);xa.zb(l);l.clear(l.COLOR_BUFFER_BIT);l.drawElements(l.TRIANGLES,3,l.UNSIGNED_SHORT,0);l.flush();l.bindBuffer(l.ARRAY_BUFFER,null);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER, +null);l.deleteBuffer(v.ea);l.deleteBuffer(v.K);r.reset();e&&(r.Ja(),xa.Ba())},md:function(){var l=b,v=c;l.deleteBuffer(v.ea);l.deleteBuffer(v.K)},m:function(){r.md();m.forEach(function(l){l.remove()});b.bindBuffer(b.ARRAY_BUFFER,null);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,null);r.reset();e=!1;m.splice(0);d=0}};return r}(),la=function(){var a=null,c=null,d=null,e=!1,m=[],n={J:-2,jd:1},q={nb:function(){return e},A:function(){if(!e){a=b.createFramebuffer();var r=aa.la();c=r&&b.DRAW_FRAMEBUFFER?b.DRAW_FRAMEBUFFER: +b.FRAMEBUFFER;d=r&&b.READ_FRAMEBUFFER?b.READ_FRAMEBUFFER:b.FRAMEBUFFER;e=!0}},Lg:function(){return c},Ue:function(){return d},eb:function(){return b.FRAMEBUFFER},Tg:function(){return n},Dg:function(){return a},instance:function(r){void 0===r.vd&&(r.vd=!1);var l=r.N?r.N:null,v=r.width,C=void 0!==r.height?r.height:r.width,E=a,g=null,t=!1,x=!1,k=0;l&&(v=v?v:l.F(),C=C?C:l.U());var p={Wd:function(){t||(E=b.createFramebuffer(),t=!0,k=n.jd++)},je:function(){p.Wd();p.u();g=b.createRenderbuffer();b.bindRenderbuffer(b.RENDERBUFFER, +g);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,v,C);b.framebufferRenderbuffer(c,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,g);b.clearDepth(1)},bind:function(H,I){k!==n.J&&(b.bindFramebuffer(c,E),n.J=k);l&&l.u();I&&b.viewport(0,0,v,C);H&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)},Xf:function(){k!==n.J&&(b.bindFramebuffer(c,E),n.J=k)},clear:function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)},fg:function(){b.clear(b.COLOR_BUFFER_BIT)},gg:function(){b.clear(b.DEPTH_BUFFER_BIT)},Hf:function(){b.viewport(0, +0,v,C)},u:function(){k!==n.J&&(b.bindFramebuffer(c,E),n.J=k)},rtt:function(H){l=H;n.J!==k&&(b.bindFramebuffer(b.FRAMEBUFFER,E),n.J=k);H.u()},P:function(){b.bindFramebuffer(c,null);n.J=-1},resize:function(H,I){v=H;C=I;g&&(b.bindRenderbuffer(b.RENDERBUFFER,g),b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,v,C))},remove:function(){E===a||x||(b.bindFramebuffer(c,E),b.framebufferTexture2D(c,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,null,0),g&&b.framebufferRenderbuffer(c,b.DEPTH_ATTACHMENT,b.RENDERBUFFER, +null),b.bindFramebuffer(c,null),b.deleteFramebuffer(E),g&&b.deleteRenderbuffer(g));x=!0}};r.vd&&p.je();m.push(p);return p},P:function(){b.bindFramebuffer(c,null);n.J=-1},Pf:function(){b.bindFramebuffer(c,null);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);b.viewport(0,0,aa.F(),aa.U());n.J=-1},reset:function(){n.J=-2},ha:function(){0!==n.J&&(b.bindFramebuffer(c,a),n.J=0)},clear:function(){b.viewport(0,0,aa.F(),aa.U());b.clear(b.COLOR_BUFFER_BIT)},m:function(){q.P();m.forEach(function(r){r.remove()}); +null!==a&&(b.deleteFramebuffer(a),a=null);q.reset();e=!1;m.splice(0);n.jd=1}};return q}(),aa=function(){function a(){e="undefined"===typeof Qa?JEContext:Qa;m=!0}function c(k,p){for(var H=0;HH;++H)if(3!==H%4&&3f;++f)u=u&&4>Math.abs(C[f]-127);u&&(l.Nd=M,l.ud=J);return u}function c(J,M){return H.ja&&a(J,p.FLOAT,new Float32Array(E),M)?(r=q.Nc,!0):!1}function d(J,M,u){if(!H.ka)return!1;var f=Ba.ze(E), +y=aa.Za(p);if(y&&y.HALF_FLOAT_OES&&a(J,y.HALF_FLOAT_OES,f,M)||p.HALF_FLOAT&&a(J,p.HALF_FLOAT,f,M))return r=q.Ga,!0;f=new Float32Array(E);if(a(J,p.FLOAT,f,M))return r=q.Ga,!0;p.bindTexture(p.TEXTURE_2D,u);p.texImage2D(p.TEXTURE_2D,0,p.RGBA,2,2,0,p.RGBA,p.UNSIGNED_BYTE,null);p.bindFramebuffer(l.Xa,z);Ba.kd(p,u,2,2,f,!1,!1);p.bindFramebuffer(l.Xa,null);p.bindTexture(p.TEXTURE_2D,u);return a(J,null,null,M)?(r=q.Ga,!0):!1}function e(J,M,u){v=!0;if(d(J,!0,u)||c(M,!0))return!0;v=!1;return d(J,!1,u)||c(M, +!1)?!0:!1}function m(J){if(r===q.R){p=J||b;r=q.RGBA8;v=!0;aa.bd(p);H||(H=aa.Lb(p));va.reset();z=p.createFramebuffer();l.Xa=p.DRAW_FRAMEBUFFER||p.FRAMEBUFFER;p.bindFramebuffer(l.Xa,null);p.clearColor(0,0,0,0);p.viewport(0,0,2,2);A.R();I=A.Ra(p);J=p.createTexture();p.activeTexture(p.TEXTURE0);p.bindTexture(p.TEXTURE_2D,J);p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.REPEAT);p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.REPEAT);p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST);N=J;var M= +J=p.RGBA,u=p.RGBA16F,f=p.RGBA32F;f&&(J=f);u&&(M=u);if((u||f)&&e(M,J,N))return n(),!0;J=M=p.RGBA;if(e(M,J,N))return n(),!0;r=q.RGBA8;n();return!1}}function n(){p.deleteProgram(I.ra);p.deleteTexture(N);N=I=null}for(var q={R:-1,Nc:3,Ga:2,RGBA8:0},r=q.R,l={Nd:null,ud:null,Xa:null},v=!0,C=new Uint8Array(16),E=Array(64),g=0;4>g;++g)for(var t=0;4>t;++t){var x=0===(t+g)%2?1:0,k=4*g+t;E[4*k]=x;E[4*k+1]=x;E[4*k+2]=x;E[4*k+3]=x}var p=null,H=null,I=null,N=null,z=null;return{te:function(J){m(J);return v},Tc:function(J, +M){r===q.R&&(typeof("undefined"!==M)&&(H=M),m(J));return r!==q.RGBA8},bh:function(J){m(J);return r===q.Nc},hf:function(J){m(J);return r===q.Ga},Mg:function(J){m(J);return l.Nd},Te:function(J){m(J);return l.ud},m:function(){p=null;v=!0;r=q.R;H=null}}}(),Xb=function(){return{instance:function(a){var c=Y.instance(a.alpha),d=Y.instance(a.beta);return{He:function(){c.g(1);d.g(2)}}}}}(),Gb=function(){return{instance:function(a){var c=null,d=!1,e=!1,m=null,n=!1,q=!1,r=null,l="undefined"===typeof a.preprocessing? +!1:a.preprocessing,v="undefined"===typeof a.preprocessingSize?a.size:a.preprocessingSize;a.mask&&(d=!0,ba&&void 0!==ba.oe&&(a.mask=ba.oe+a.mask),c=Y.instance({isFloat:!1,url:a.mask}));var C=!1;a.customInputShader&&(C="s45",A.Pc({name:"_",id:C,h:a.customInputShader,Eh:["uSource"],precision:"lowp"}),A.T(C,[{type:"1i",name:"_",value:0}]));switch(l){case "sobel":r="s32";n=!0;break;case "meanNormalization":r="s33";n=!0;break;case "grayScale":r="s29";n=!1;break;case "grayScaleTilt":r="s30";q=!0;n=!1;break; +case "rgbGrayTilt":r="s31";q=!0;n=!1;break;case "copy":r=C?C:"s0";break;case "inputLightRegulation":r=C?C:"s29";m=Yb.instance({td:v,Md:a.size,Id:a.nBlurPass,mb:!1});e=!0;break;case "inputMix0":r="none";m=Zb.instance({D:v,ee:a.varianceMin,Sc:a.blurKernelSizePx,mb:!1});e=!0;break;case "direct":case "none":r="abort";break;default:r="s4"}q&&A.T(r,[{name:"u27",type:"1f",value:a.tilt}]);d&&(r+="Mask");var E=Y.instance({isFloat:!1,isPot:!1,width:a.size}),g={F:function(){return v},Wb:function(){return g.F()}, +Xe:function(){return e?m.Xb():E},V:function(t){va.ha();"abort"!==r&&("none"!==r&&(A.set(r),n&&A.G("u28",1/a.size),E.da(),d&&c.g(1),U.l(!1,!1),E.g(0),t=E),e&&m.process(t))},m:function(){E.remove();d&&c.remove()}};return g}}}(),Hb=function(){return{instance:function(a){function c(h){m.forEach(function(F,K){n[K][0]=h[0][F];n[K][1]=h[1][F];n[K][2]=h[2][F];n[K][3]=h[3][F]});return n}"undefined"===typeof a.normalize&&(a.normalize=!1);var d={input:null,Ua:null,bc:null,ba:null,tb:null,oc:null,pc:null},e= +null,m=[],n=[],q=!1,r=null,l=!0,v=-1,C=a.isReorganize?a.isReorganize:!1,E=a.kernelsCount?!0:!1,g=a.dynPelu?Xb.instance(a.dynPelu):!1,t=g?!0:!1,x={isEnabled:!1};a.ff?(a.sparsity="undefined"!==typeof a.sparsity?a.sparsity:a.vb.Wb(),l=!1):"full"===a.connectivityUp&&(a.sparsity=a.vb.Wb());var k={elu:"s16",elu01:"s17",relu:"s15",arctan:"s19",sigmoid:"s14",copy:"s0",softplus:"s20",dynPelu:"s18"}[a.activation],p=a.sparsity*a.sparsity,H=!1,I=a.size,N="";if(a.maxPooling){switch(a.maxPooling.size){case 2:N= +"s34";break;case 4:N="s35"}H=!0;I/=a.maxPooling.size;d.oc=Y.instance({isFloat:!0,isPot:!1,width:I})}var z=void 0!==a.rf&&a.rf?!0:!1,J=null,M=null,u=null;if(z){J="s46"+a.index.toString();A.sd("s46",J,[((a.normalization.n-1)/2).toFixed(1)]);A.T(J,[{type:"1i",name:"u1",value:0},{type:"2f",name:"u8",value:[1/a.size,1/a.size]},{type:"1f",name:"u7",value:a.normalization.alpha},{type:"1f",name:"u10",value:a.normalization.beta},{type:"1f",name:"u31",value:a.normalization.k}]);var f={isFloat:!0,isPot:!0,width:a.size}; +M=Y.instance(f);u=Y.instance(f)}var y=-1,G=null;l&&(d.ba=Y.instance({isFloat:!0,isPot:!1,width:a.size}));d.Ua=Y.instance(a.bias);var L={F:function(){return a.size},Wb:function(){return I},nd:function(){return a.classesCount},qe:function(h){e.g(h)},uf:function(){a.remap&&a.remap.isEnabled&&(x={isEnabled:!0,kf:Y.instance({isFloat:!1,isFlipY:!1,array:new Uint8Array(a.remap.maskTexture.data),width:a.remap.maskTexture.width,isPot:!1}),pb:a.remap.layers.map(function(h){return a.parent.We(h)}),depth:a.remap.depth})}, +Ef:function(){switch(a.connectivityUp){case "direct":G=$b.instance(a.connectivity);break;case "square":G=ac.instance(a.connectivity);break;case "squareFast":G=bc.instance(a.connectivity,a.activation);break;case "full":G=cc.instance(a.connectivity);break;case "conv":v=a.kernelsCount,G=dc.instance(a.connectivity),C&&(d.tb=Y.instance({width:I,isFloat:!0,isFlipY:!1,isPot:!1}))}if(G.Ca){var h=a.size*a.sparsity;y=Math.log(h/a.size)/Math.log(2);d.input=Y.instance({isMipmap:!0,isFloat:!0,isPot:!0,width:h, +ic:y});d.bc=Y.instance({isFloat:!0,isPot:!0,width:a.size})}},V:function(h,F){e=h;G.Ca?(d.input.da(),E&&d.Ua.g(2),G.V(x),d.input.g(0),d.input.Le(y),d.bc.da(),E?A.set("s0"):(A.set("s28"),A.G("u26",p),d.Ua.g(1)),d.input.re(y,0),U.l(!1,!1),A.set(k),z?M.u():d.ba.u(),d.bc.g(0),t&&g.He(),U.l(!1,!1)):(d.ba.da(),d.Ua.g(1),G.V());z&&(A.set(J),u.u(),M.g(0),U.l(!1,!1),A.set("s47"),A.G("u7",1),d.ba.u(),u.g(1),U.l(!1,!1));if(l)return H?(d.oc.da(),d.ba.g(0),A.set(N),A.sa("u8",1/a.size,1/a.size),U.l(!1,!1),F=d.oc): +F=d.ba,F.g(0),C&&(d.tb.u(),A.set("s22"),A.sa("u13",v,I/v),U.l(!1,!1),F=d.tb,d.tb.g(0)),F;var K=d.ba;a.normalize&&(A.set("gpuRawAvg"===q?"s9":"s8"),A.G("u4",1/a.size),d.pc.da(),d.ba.g(0),U.l(!1,!1),K=d.pc);h=null;switch(q){case "cpuRGBA2Float":K.Zc(!1);F?h=L.vf(K).then(r):(K=L.wf(K),r(K));break;case "cpuMeanFloat":K.Zc(!0);F?h=K.yf().then(r):(K=K.zf(),r(K));break;case "gpuRawAvg":case "gpuRaw":K.g(0);case "none":null!==r&&r(K)}F&&null===h&&(h=Promise.resolve());return h},Be:function(h){h&&(q=h.qc|| +"none",r=h.nc||null);d.ba=Y.instance({isFloat:!0,isPot:!0,isMipmap:!1,width:a.size});h="undefined"!==typeof a.classesCount&&a.classesCount?a.classesCount:a.size*a.size;for(var F=0,K=0,P=0;Ff&&(f+=c);f>=c&&(f-=c);for(var y=0;yh&&(h+=c);h>=c&&(h-=c);var F=f/c,K=h/c;L=1-L-1/m;F+=k;K+=k;G+=p;L+=p;var P=H*e+u,da=N*e+y;da=d*e-da-1;P=da*d*e+P;C[4*P]=G;C[4*P+1]=L;C[4*P+2]=F;C[4*P+3]=K;K=g[h*c+f]++;P=K%n;F=f*n+P;h=h*n+(K-P)/n;h=c*n-1-h;h=h*c*n+F;E[4*h]=G;E[4*h+1]=L;E[4*h+2]=J;E[4*h+3]=M;++r>=m&&(r=0,++l);++v}}}g=null;var ra=Y.instance(a.weights);delete a.weights.data;var za=Y.instance({width:m,isFloat:!0,array:new Float32Array(E),isPot:!0});E=null;var w=Y.instance({width:m,isFloat:!0,array:new Float32Array(C),isPot:!0});C=null; +return{Ca:!0,cb:function(){return n},m:function(){za.remove();w.remove();ra.remove()},V:function(){A.set("s23");ra.g(1);w.g(2);U.l(!1,!1)}}}}}(),dc=function(){return{instance:function(a){var c=a.kernelsCount,d=a.toSparsity,e=d*a.toLayerSize/a.fromLayerSize,m=Y.instance(a.weights);return{Ca:!0,cb:function(){return e},Wg:function(){return d},$e:function(){return m},m:function(){m.remove()},V:function(){A.set("s26");A.G("u23",c);A.G("u24",d);A.G("u17",a.toLayerSize);A.G("u25",a.fromLayerSize);m.g(1); +U.l(!1,!1)}}}}}(),bc=function(){return{instance:function(a,c){var d=a.fromLayerSize,e=a.toLayerSize,m=a.toSparsity,n=a.stride?a.stride:1,q=m*e/d,r=ev;++v)A.sa("u32",1,0),m[v].u(),r[v].g(0),U.l(!1,!1),A.sa("u32",0,1),n[v].u(),m[v].g(0),U.l(!1,!1);A.set("s52");q.u();e.g(0);n[0].g(1);n[1].g(2);n[2].g(3);U.l(!1,!1);q.g(0)},Xb:function(){return q}}}}}(),W={Ze:function(){return W.Yc()?document.createElement("video"):!1},Ma:function(a,c){a[c]=!0;a.setAttribute(c,"true")},xe:function(){var a=!1,c=navigator.userAgent||navigator.vendor|| +window.opera;if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(c)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(c.substr(0, +4)))a=!0;return a},Vc:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},Ne:function(){var a=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return a&&a.length&&2window.innerWidth}},we:function(){return W.Wc()||W.Vc()},Wc:function(){var a=navigator.userAgent.toLowerCase(); +return-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")?!0:!1},Ag:function(){return W.xe()?W.Dd()?window.innerHeight/window.innerWidth*45:45:45},Yc:function(){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?!0:!1},pause:function(a){a.pause()},rh:function(a){a.play()},release:function(a){a.pause();a.videoStream&&a.videoStream.stop();a.videoStream=null},Xc:function(a){if(!a)return a;var c=null;if(a.video){var d=function(e){return e&&"object"===typeof e?Object.assign({},e):e};c={}; +"undefined"!==typeof a.video.width&&(c.width=d(a.video.width));"undefined"!==typeof a.video.height&&(c.height=d(a.video.height));"undefined"!==typeof a.video.facingMode&&(c.facingMode=d(a.video.facingMode))}c={audio:a.audio,video:c};"undefined"!==typeof a.deviceId&&W.Oc(c,a.deviceId);return c},Oc:function(a,c){c&&(a.video=a.video||{},a.video.deviceId={exact:c},a.video.facingMode&&delete a.video.facingMode)},$d:function(a){var c=a.video.width;a.video.width=a.video.height;a.video.height=c;return a}, +Ae:function(a){function c(g){return[480,576,640,648,720,768,800,960,1080,1152,1280,1366,1920].sort(function(t,x){return Math.abs(t-g)-Math.abs(x-g)})}function d(g){var t=W.Xc(a);g=g(t);m.push(g);e(g)}function e(g){if(g.video&&g.video.facingMode&&g.video.facingMode.exact){var t=g.video.facingMode.exact;g=W.Xc(g);delete g.video.facingMode.exact;g.video.facingMode.ideal=t;m.push(g)}}var m=[];if(!a||!a.video)return m;e(a);if(a.video.width&&a.video.height){if(a.video.width.ideal&&a.video.height.ideal){var n= +c(a.video.width.ideal).slice(0,3),q=c(a.video.height.ideal).slice(0,3),r={},l=0;for(r.na=void 0;l16/9+.1||d(function(g,t){return function(x){x.video.width.ideal=g.na;x.video.height.ideal=t.ma;return x}}(r,v))}}}d(function(g){return W.$d(g)})}a.video.width&&a.video.height&&(a.video.width.ideal&& +a.video.height.ideal&&d(function(g){delete g.video.width.ideal;delete g.video.height.ideal;return g}),d(function(g){delete g.video.width;delete g.video.height;return g}));a.video.facingMode&&(d(function(g){delete g.video.facingMode;return g}),a.video.width&&a.video.height&&d(function(g){W.$d(g);delete g.video.facingMode;return g}));m.push({audio:a.audio,video:!0});return m},Lf:function(a){if(W.Dd()){if(!a||!a.video)return!1;var c=a.video.width,d=a.video.height;if(!c||!d)return!1;if(c.ideal&&d.ideal&& +c.ideal>d.ideal)return a.video.height=c,a.video.width=d,!0}return!1},rb:function(a){a.volume=0;W.Ma(a,"muted");if(W.Wc()){if(1===a.volume){var c=function(){a.volume=0;window.removeEventListener("mousemove",c,!1);window.removeEventListener("touchstart",c,!1)};window.addEventListener("mousemove",c,!1);window.addEventListener("touchstart",c,!1)}setTimeout(function(){a.volume=0;W.Ma(a,"muted")},5)}},ce:function(a,c,d){return null===a?Promise.resolve():new Promise(function(e,m){if(a.srcObject&&a.srcObject.getVideoTracks){var n= +a.srcObject.getVideoTracks();1!==n.length?m("INVALID_TRACKNUMBER"):(n=n[0],c?W.get(a,e,m,d):(n.stop(),e()))}else m("BAD_IMPLEMENTATION")})},qd:function(a,c,d,e){function m(q){n||(n=!0,d(q))}var n=!1;return navigator.mediaDevices.getUserMedia(e).then(function(q){function r(){setTimeout(function(){if(a.currentTime){var v=a.videoWidth,C=a.videoHeight;if(0===v||0===C)m("VIDEO_NULLSIZE");else{v&&(a.style.width=v.toString()+"px");C&&(a.style.height=C.toString()+"px");v={ve:null,If:null,lf:null};try{var E= +q.getVideoTracks()[0];E&&(v.lf=E,v.ve=E.getCapabilities(),v.If=E.getSettings())}catch(g){}W.we()?a.parentNode&&null!==a.parentNode?(n||c(a,q,v),setTimeout(function(){a.play()},100)):(document.body.appendChild(a),W.rb(a),n||c(a,q,v),setTimeout(function(){a.style.transform="scale(0.0001,0.0001)";a.style.position="fixed";a.style.bottom="0px";a.style.right="0px";W.rb(a);setTimeout(function(){a.play()},100)},80)):n||c(a,q,v)}}else m("VIDEO_NOTSTARTED")},700)}function l(){a.removeEventListener("loadeddata", +l,!1);var v=a.play();W.rb(a);"undefined"===typeof v?r():v.then(function(){r()}).catch(function(){m("VIDEO_PLAYPROMISEREJECTED")})}"undefined"!==typeof a.srcObject?a.srcObject=q:(a.src=window.URL.createObjectURL(q),a.videoStream=q);W.rb(a);a.addEventListener("loadeddata",l,!1)}).catch(function(q){m(q)})},get:function(a,c,d,e){if(!a)return d&&d("VIDEO_NOTPROVIDED"),!1;if(!W.Yc())return d&&d("MEDIASTREAMAPI_NOTFOUND"),!1;if(e&&e.video){if(W.Vc()){var m=W.Ne();0!==m[0]&&(12>m[0]||12===m[0]&&2>m[1])&& +W.Lf(e)}e.video.width&&e.video.width.ideal&&(a.style.width=e.video.width.ideal+"px");e.video.height&&e.video.height.ideal&&(a.style.height=e.video.height.ideal+"px")}W.Ma(a,"autoplay");W.Ma(a,"playsinline");e&&e.audio?a.volume=0:W.Ma(a,"muted");W.qd(a,c,function(){function n(r){if(0===r.length)d("INVALID_FALLBACKCONSTRAINTS");else{var l=r.shift();W.qd(a,c,function(){n(r)},l)}}var q=W.Ae(e);n(q)},e)},Ye:function(a){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)return a(!1,"NOTSUPPORTED"), +!1;navigator.mediaDevices.enumerateDevices().then(function(c){(c=c.filter(function(d){return d.kind&&-1!==d.kind.toLowerCase().indexOf("video")&&d.label&&d.deviceId}))&&c.length&&0e.Qf&&5<++q&&(x=e.k,r=r*(1-x)+(me.bb[1]?l+1:l)*x,Math.abs(r-l)>1-e.tf&&(x=Math.min(Math.max(Math.round(r),0),e.n-1),x!==l&&(r=l=x,m=(e.bb[1]-e.bb[0])/2)),n=t)},rc:function(t,x,k,p,H){a(t,x,k,p,H,0)},vc:function(t){v=t;d=1},Gc:function(){d=0;g.reset()},reset:function(){E=c.Ya[1];n=m=-1;q=0},Qe:function(){return E}};return g}(),Ma=function(){function a(){d(k+t.jc);p.port.postMessage("DONE")}function c(){var f= +t.ga;z.isEnabled&&(f=Math.max(f,z.ga));N.Sa=0===f?window.requestAnimationFrame(d):window.requestAnimationFrame(e)}function d(f){I.ya&&null!==x&&(f-=k,f=Math.min(Math.max(f,t.$c[0]),t.$c[1]),k+=f,n(),z.isEnabled&&z.Y&&I.Z&&k-z.fc>t.Lc&&(v(),z.fc=k),x(k))}function e(f){I.ya&&(N.timeout=window.setTimeout(d.bind(null,f),t.ga))}function m(){x=null;I.ya=!1;n()}function n(){N.Sa&&(window.cancelAnimationFrame(N.Sa),N.Sa=null);N.timeout&&(window.clearTimeout(N.timeout),N.timeout=null)}function q(f){f&&!I.Z? +(I.Z=!0,H&&pa.Gc(),p.port.postMessage("STOP"),aa.be(!0),c()):!f&&I.Z&&(I.Z=!1,H&&pa.vc(1),aa.be(!1),p.port.postMessage("START"))}function r(f){f.target.hidden?M():J()}function l(f,y,G){y=f.createShader(y);f.shaderSource(y,G);f.compileShader(y);return y}function v(){z.Y=!1;var f=z.fb,y=z.gb,G=z.hb,L=z.X;f.uniform1f(z.rd,Math.random());z.za?y.beginQueryEXT(L,G):f.beginQuery(L,G);f.drawElements(f.POINTS,1,f.UNSIGNED_SHORT,0);z.za?y.endQueryEXT(L):f.endQuery(L);f.flush();E().then(function(h){h=t.ge*t.Jc* +1E3/h;z.Db=(z.Db+1)%t.Ea;z.hc[z.Db]=h;if(++z.Ed>t.Ea){z.ob.set(z.hc);z.ob.sort();h=z.ob[Math.floor(t.Ea/2)];z.$a=Math.max(z.$a,h);var F;for(F=0;Fz.$a*(1-(t.Kc[F]+t.he*(F>=z.Bb?1:-1))));++F)F===z.Ec-1&&++F;F!==z.Bb&&(console.log("THERMAL THROTTLING LEVEL = "+F.toString()),z.Bb=F,z.ga=0===F?0:t.fe[F-1],t.Ic&&t.Ic(F))}z.Y=!0}).catch(function(){z.Y=!0})}function C(f){var y=z.fb,G=z.gb,L=z.hb;L=z.za?G.Cg(L,G.QUERY_RESULT_AVAILABLE_EXT):y.getQueryParameter(L,y.QUERY_RESULT_AVAILABLE);y=y.getParameter(G.GPU_DISJOINT_EXT); +L?f(!y):setTimeout(C.bind(null,f),.1)}function E(){return new Promise(function(f,y){C(function(G){if(G){G=z.fb;var L=z.gb,h=z.hb;G=z.za?L.getQueryObjectEXT(h,L.QUERY_RESULT_EXT):G.getQueryParameter(h,G.QUERY_RESULT);f(G)}else y()})})}var g={zd:!0,$c:[1,200],jc:20,ga:0,ie:!1,Jc:50,ge:240,Lc:3E3,Ea:3,Kc:[.2,.35,.5],he:.05,fe:[8,20,40],Ic:null},t=null,x=null,k=0,p=null,H=!1,I={qa:!1,Z:!0,ec:!1,dc:!1,cc:!1,ya:!1},N={Sa:null,timeout:null},z={isEnabled:!1,Y:!1,fb:null,gb:null,hb:null,X:null,rd:null,za:!0, +Bb:0,Ec:0,ga:0,fc:0,Ed:0,hc:null,ob:null,Db:0,$a:0},J=q.bind(null,!0),M=q.bind(null,!1),u={A:function(f){t=Object.assign(g,f);Object.assign(I,{Z:!0,qa:!0,ya:!1});if(t.ie){f=document.createElement("canvas");f.setAttribute("width","1");f.setAttribute("height","1");var y={antialias:!1};f=f.getContext("webgl2",y)||f.getContext("webgl",y);if(y=f.getExtension("EXT_disjoint_timer_query")||f.getExtension("EXT_disjoint_timer_query_webgl2")){z.fb=f;z.gb=y;z.isEnabled=!0;z.za=y.beginQueryEXT?!0:!1;var G=l(f, +f.VERTEX_SHADER,"attribute vec4 a0;void main(){gl_Position=a0;}"),L=l(f,f.FRAGMENT_SHADER,"precision lowp float;uniform float u37;void main(){vec4 a=u37*vec4(1.,2.,3.,4.);for(int b=0;b<666;b+=1)a=cos(a);gl_FragColor=a;}".replace("666",t.Jc.toString())),h=f.createProgram();f.attachShader(h,G);f.attachShader(h,L);f.linkProgram(h);G=f.getAttribLocation(h,"a0");z.rd=f.getUniformLocation(h,"u37");f.useProgram(h);f.enableVertexAttribArray(G);h=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,h);f.bufferData(f.ARRAY_BUFFER, +new Float32Array([.5,.5,0,1]),f.STATIC_DRAW);f.vertexAttribPointer(G,4,f.FLOAT,!1,16,0);h=f.createBuffer();f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h);f.bufferData(f.ELEMENT_ARRAY_BUFFER,new Uint16Array([0]),f.STATIC_DRAW);f.disable(f.DEPTH_TEST);f.disable(f.DITHER);f.disable(f.STENCIL_TEST);f.viewport(0,0,1,1);h=z.za?y.createQueryEXT():f.createQuery();z.hb=h;z.X=y.TIME_ELAPSED_EXT||f.TIME_ELAPSED;z.Bb=0;z.Ec=t.Kc.length;z.ga=0;z.fc=-t.Lc;z.hc=new Float32Array(t.Ea);z.ob=new Float32Array(t.Ea);z.$a=0; +z.Db=0;z.Ed=0;z.Y=!0}}if(t.zd){f=!1;try{if("undefined"===typeof SharedWorker){var F=URL.createObjectURL(new Blob(["let handler = null;\n self.addEventListener('message', function(e){\n if (handler !== null){\n clearTimeout(handler);\n handler = null;\n }\n switch (e.data) {\n case 'START':\n case 'DONE':\n handler = setTimeout(function(){\n self.postMessage('TICK');\n }, "+t.jc.toString()+");\n break;\n case 'STOP':\n break;\n };\n }, false);"], +{type:"text/javascript"})),K=new Worker(F);K.addEventListener("message",a);p={Pd:K,port:K};I.ec=!0}else{var P=URL.createObjectURL(new Blob(["let handler = null;\n onconnect = function(e) {\n const port = e.ports[0];\n port.addEventListener('message', function(e) {\n \n if (handler !== null){\n clearTimeout(handler);\n handler = null;\n }\n switch (e.data) {\n case 'START':\n case 'DONE':\n handler = setTimeout(function(){\n port.postMessage('TICK');\n }, "+ +t.jc.toString()+");\n break;\n case 'STOP':\n break;\n };\n \n });\n \n port.start();\n } // end onconnect()"],{type:"text/javascript"})),da=new SharedWorker(P);da.port.start();da.port.addEventListener("message",a);p={Pd:da,port:da.port};I.dc=!0}f=!0}catch(ra){}f&&("onvisibilitychange"in document?document.addEventListener("visibilitychange",r):(window.addEventListener("blur",M),window.addEventListener("focus",J)),I.cc= +!0)}H="undefined"!==typeof pa},m:function(){m();I.cc&&("onvisibilitychange"in document?document.removeEventListener("visibilitychange",r):(window.removeEventListener("blur",M),window.removeEventListener("focus",J)),I.cc=!1);I.dc?(p.port.close(),I.dc=!1):I.ec&&(p.Pd.terminate(),I.ec=!1);Object.assign(I,{Z:!0,qa:!1,ya:!1});x=null},hh:function(){return I.Z},update:function(f){Object.assign(t,f)},rc:function(f){I.qa||u.A({});n();I.ya=!0;x=f;I.Z&&c()},stop:m};return u}(),tb=function(){var a={Kd:4,ub:[1.5, +1.5,2],O:[.1,.1,.1],Td:1,D:-1,M:-1,Kf:2,sf:1,Ud:!0,Ie:.8},c=null,d=[],e=0,m=[.5,.5,1];return{A:function(n){c=Object.assign({},a,n);d.splice(0);n=c.ub[0]*c.O[0];var q=c.ub[1]*c.O[1],r=1/(1+c.ub[2]*c.O[2]),l=c.Td*Math.min(c.D,c.M),v=l/c.D;l/=c.M;var C=.5*c.Ie;C*=C;for(var E=0;EC||d.push([u,z,t*c.sf])}}c.Ud&&d.sort(function(y, +G){var L=y[0]-.5;y=y[1]-.5;var h=G[0]-.5;G=G[1]-.5;return L*L+y*y-(h*h+G*G)})},get:function(){var n=d.length;if(0===n)return m;e>=n&&(e=0);var q=d[Math.floor(e)];e=(e+1/c.Kf)%n;return q}}}(),ba={neuralNetworkPath:"NN_DEFAULT.json",fa:0,Eb:[2,8],Af:{threshold:1,nScaleLevels:2,scale0Factor:.8,overlapFactors:[2,2,3],scanCenterFirst:!0,nDetectsPerLoop:-1,multiDetectionThresholdFactors:[.5,.6],isCleanGLStateAtEachIteration:!0,animateProcessOrder:"DSR"},Nf:50, +Hd:.3,mf:8,pf:.3,Jf:{translationFactorRange:[.0015,.005],rotationFactorRange:[.003,.02],qualityFactorRange:[.9,.98],alphaRange:[.05,1],followZRotAlphaFactor:.8},Pa:[.65,1,.262],O:[.092,.092,.3],ke:.2,me:2,le:.1,qf:8,Jd:1,Ke:Za.qb.bind(null,.3,.7),Tf:20,Yd:3},oa={facingMode:"user",idealWidth:800,idealHeight:600,minWidth:480,maxWidth:1920,minHeight:480,maxHeight:1920,rotate:0,flipX:!1},ia={lc:-3,jf:-1,error:-2,ready:1,play:2,pause:3},na=ia.lc,B=null,ec={kb:!1,zc:null,element:null,N:null,H:[0,0],L:[.5, +.5],v:[.5,0,0,.5],wb:0,La:null,jb:!1},Q=null,fc={Ka:null,Va:null,antialias:!0,Mc:"./",Fa:null,ia:null,fa:ba.fa,Od:ba.fa,lb:!1,ua:!0},Oa=null,ea=null,sa=null,Pa=1,Na={uc:-1,Mb:-1},Z=null,gc={D:0,M:0,H:[0,0],xa:null},X={Da:null,buffer:null,O:null,Pa:null,aa:ba.Jd,Na:null},Sa=null,qa=null,O={o:1,pa:0,W:null,Ad:!1,Fd:0,mc:0},hb=[],ib=[],Eb={VERSION:"2.1.7",init:function(a){function c(){na!==ia.error&&2===++e&&(Ja(),xb(),Ia(),Q.Ka&&(na=ia.ready,Q.Ka(!1,{GL:b,canvasElement:Q.ia,videoTexture:B.N.get(),videoTransformMat2:B.v, +maxFacesDetected:O.o,videoElement:B.element}),fb()),eb())}if(na!==ia.lc)return a.callbackReady&&a.callbackReady("ALREADY_INITIALIZED"),!1;na=ia.jf;B=Object.assign({},ec);Q=Object.assign({},fc);Z=Object.assign({},gc);O.W=[0];X.O=ba.O.slice(0);X.Pa=ba.Pa.slice(0);"undefined"!==typeof a.antialias&&(Q.antialias=a.antialias);a.callbackReady&&(Q.Ka=a.callbackReady);a.callbackTrack&&(Q.Va=a.callbackTrack);a.nExpressions&&(X.aa=a.nExpressions);a.expressionsEasings&&(X.Na=a.expressionsEasings);"undefined"!== +typeof a.animateDelay&&(Q.fa=a.animateDelay);"undefined"!==typeof a.NNCPath&&(Q.Mc=a.NNCPath);"undefined"!==typeof a.NNC&&(Q.Fa=a.NNC);"undefined"!==typeof a.maxFacesDetected&&(O.o=Math.max(1,a.maxFacesDetected));"undefined"!==typeof a.followZRot&&(Q.ua=a.followZRot?!0:!1);if(O.o>ba.mf)return Ha("MAXFACES_TOOHIGH"),!1;if(!a.canvasId&&!a.canvas)return Ha("NO_CANVASID"),!1;Q.ia=a.canvas?a.canvas:document.getElementById(a.canvasId);if(!Q.ia)return Ha("INVALID_CANVASID"),!1;Z.D=Q.ia.width;Z.M=Q.ia.height; +if(!Z.D||!Z.M)return Ha("INVALID_CANVASDIMENSIONS"),!1;for(var d=0;du48;h?a.r=2.:a.r>u47?a.r=0.:a.r>1.9?a.r+=1.:0.,a.r*=u49;if(a.r<.9)a=vec4(1.,u45);else{a.r*=step(1.9,a.r);float i=dot(e,texture2D(u44,vec2(.875,.875))),j=dot(e,texture2D(u44,vec2(.125,.625))),k=dot(e,texture2D(u44,vec2(.375,.625))),b=cos(u42),c=sin(u42);vec2 l=mat2(b,c*u50,-c/u50,b)*vec2(i,j);a.gba+=vec3(l,k)*u46*a.a;}gl_FragColor=a;}", +ta:"attribute vec2 a0;void main(){gl_Position=vec4(a0,0.,1.);}",i:"u44 u39 u45 u47 u46 u49 u42 u50 u48 u41".split(" ")},{id:"s57",name:"_",ta:"attribute vec2 a0;void main(){gl_Position=vec4(a0,0.,1.);}",h:"uniform sampler2D u44;uniform float u49;const vec4 e=vec4(.25,.25,.25,.25);const vec3 f=vec3(.5,.5,.5);void main(){float a=dot(e,texture2D(u44,vec2(.125,.875))),b=dot(e,texture2D(u44,vec2(.375,.875))),c=dot(e,texture2D(u44,vec2(.625,.875))),d=dot(e,texture2D(u44,vec2(.625,.625)));vec3 g=vec3(a,b,c)*.5+f;gl_FragColor=vec4(g,d*u49);}", +i:["u44","u49"]},{id:"s58",name:"_",ta:"attribute vec2 a0;void main(){gl_Position=vec4(a0,0.,1.);}",h:"uniform sampler2D u44;const vec4 e=vec4(.25,.25,.25,.25);void main(){float a=dot(e,texture2D(u44,vec2(.375,.375))),b=dot(e,texture2D(u44,vec2(.625,.375))),c=dot(e,texture2D(u44,vec2(.875,.375))),d=dot(e,texture2D(u44,vec2(.125,.125)));gl_FragColor=vec4(a,b,c,d);}",i:["u44"]},{id:"s53",name:"_",h:"uniform sampler2D u39;uniform vec2 u51;uniform float u52;varying vec2 vv0;void main(){float f=step(.5,mod(gl_FragCoord.y+1.5,2.)),c=step(.33,vv0.x);vec4 a=texture2D(u39,vv0+u51);a.a=mix(a.a*u52,a.a,c);vec4 d=floor(255.*a),g=255.*(255.*a-d),b=mix(d,g,f)/255.;b.x=mix(step(a.x,1.5),b.x,c),gl_FragColor=b;}", +i:["u39","u52","u51"]}]);sb();Pb();kb();jb();c()});return!0},destroy:function(){Ma.m();return new Promise(function(a){Eb.toggle_pause(!0,!0).finally(function(){Oa&&Oa.m();Qa.m();Oa=qa=Sa=null;hb.splice(0);ib.splice(0);Z.xa=null;X.Da=null;B.N=null;na=ia.lc;a()}).catch(function(){})})},toggle_pause:function(a,c){if(!Ya())return Promise.reject("NOT_READY");var d=null;d=B.jb?Promise.resolve():c?W.ce(B.element,!a,B.La):Promise.resolve();a?rb():d.then(function(){eb()});return d},update_videoSettings:function(a){rb(); +return new Promise(function(c,d){W.ce(B.element,!1,B.La).then(function(){Object.assign(oa,a);zb(null,null,function(e){$a(e,function(){Ja();Ia();eb();c()})})}).catch(d)})},toggle_slow:function(a){Ya()&&na===ia.play&&(a&&!Q.lb?(Q.Od=Q.fa,ea.nDetectsPerLoop=1,this.set_animateDelay(ba.Vf),Q.lb=!0):!a&&Q.lb&&(ea.nDetectsPerLoop=-1,this.set_animateDelay(Q.Od),Q.lb=!1))},set_animateDelay:function(a){Q.fa=a;Ma.update({ga:Q.fa})},resize:function(){if(!Ya())return!1;var a=Q.ia.width,c=Q.ia.height;if(!lb()&& +a===Z.D&&c===Z.M)return!1;Z.D=a;Z.M=c;A.R();kb();jb();Ja();Ia();return!0},set_inputTexture:function(a,c,d){B.H[0]=c;B.H[1]=d;B.N=Y.instance({width:c,height:d,Zb:a});B.kb=!0;Ja();fb();Ia()},reset_GLState:function(){fb();Z.xa.remove();X.Da.remove();sb()},render_video:function(){va.P();A.set("s54");b.viewport(0,0,Z.D,Z.M);B.N.g(0);U.l(!0,!0)},reset_inputTexture:function(){B.kb=!1;B.N=B.zc;lb();Ja();Ia()},get_videoDevices:function(a){return W.Ye(a)},set_scanSettings:function(a){Object.assign(ea,a);-1!== +ea.nDetectsPerLoop?pa.vc(ea.nDetectsPerLoop):pa.Gc();kb();jb()},set_stabilizationSettings:function(a){Object.assign(sa,a)},set_videoOrientation:function(a,c){Ya()&&(oa.flipX=c,oa.rotate=a,Ja(),Ia())},update_videoElement:function(a,c){$a(a?a:B.element,function(){xb();Ja();Ia();c&&c()})},create_new:function(){return window.JEELIZFACEFILTERGEN()}};return Eb};window.JEELIZFACEFILTER=window.JEELIZFACEFILTERGEN(); +;return JEELIZFACEFILTER||window.JEELIZFACEFILTER;})(); \ No newline at end of file diff --git a/vdo.ninja-24.4/thirdparty/jeeliz/readme.md b/vdo.ninja-24.4/thirdparty/jeeliz/readme.md new file mode 100644 index 0000000..7b4e9b0 --- /dev/null +++ b/vdo.ninja-24.4/thirdparty/jeeliz/readme.md @@ -0,0 +1,6 @@ + Many of the files found in this folder are obtained from Jeeliz + + jeelize/jeelizFaceFilter + Apache-2.0 License + + https://github.com/jeeliz/jeelizFaceFilter/blob/master/LICENSE \ No newline at end of file