@monitordog/detector 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -97
- package/dist/assets/inference-worker-EjUccpPR.js +8 -0
- package/dist/assets/ort/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/assets/ort/ort-wasm-simd-threaded.wasm +0 -0
- package/dist/assets/sdk/detector-320.onnx.enc +0 -0
- package/dist/assets/sdk/detector-416.onnx.enc +0 -0
- package/dist/assets/sdk/detector-640.onnx.enc +0 -0
- package/dist/constants.d.ts +1 -12
- package/dist/detect/model-loader.d.ts +2 -12
- package/dist/environment.d.ts +0 -8
- package/dist/events.d.ts +2 -5
- package/dist/index.d.ts +1 -3
- package/dist/monitordog-detector.js +641 -11642
- package/dist/monitordog-detector.umd.cjs +1 -54
- package/dist/service/container.d.ts +0 -10
- package/dist/service/detect-service.d.ts +0 -30
- package/dist/service/detection-event-service.d.ts +2 -10
- package/dist/service/webcam-service.d.ts +0 -2
- package/dist/types.d.ts +22 -96
- package/package.json +15 -18
- package/dist/assets/inference-worker-BqvxPw8S.js +0 -2
- package/dist/detect/wasm/webcam-frame-analysis-wasm-bytes.d.ts +0 -1
- package/dist/detect/webcam-blockage-detector.d.ts +0 -32
- package/dist/detect/webcam-frame-analysis-wasm.d.ts +0 -47
- package/dist/detect/webcam-frame-analysis.d.ts +0 -34
- package/dist/detect/webcam-lighting-detector.d.ts +0 -21
- package/dist/language.d.ts +0 -6
- package/dist/monitordog-detector.d.ts +0 -41
- package/dist/pose/mediapipe-asset-loader.d.ts +0 -16
- package/dist/pose/mediapipe-main-user-tracker.d.ts +0 -90
- package/dist/pose.d.ts +0 -15
- package/dist/service/overlay-renderer.d.ts +0 -71
- package/dist/service/overlay-service.d.ts +0 -75
- package/dist/service/overlay-watchdog-service.d.ts +0 -13
|
@@ -1,54 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("html2canvas")):typeof define==`function`&&define.amd?define([`exports`,`html2canvas`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MonitorDogDetector={},e.html2canvas))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=u;(function(e,t){let n=u,r=e();for(;;)try{if(-parseInt(n(446))/1*(parseInt(n(444))/2)+parseInt(n(450))/3+-parseInt(n(451))/4*(parseInt(n(442))/5)+-parseInt(n(440))/6+-parseInt(n(441))/7*(-parseInt(n(449))/8)+-parseInt(n(453))/9*(-parseInt(n(452))/10)+parseInt(n(443))/11*(-parseInt(n(447))/12)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(ie,592251);function u(e,t){return e-=440,ie()[e]}var d=.8,ee=.7,te=3e4,ne=`0.0.2`,re=`monitordog.mainUserTracking.enabled`;function ie(){let e=[`1680ZtDwFy`,`pose_landmarker_lite.task`,`4615160OxGtpK`,`2824182UUgIkf`,`81460bugSkW`,`10KsjMCo`,`3431187rhdaUa`,`vision_wasm_module_internal.js`,`3516828FdEeZZ`,`7EFwGEY`,`45ddYRwE`,`8382uzBvbt`,`132iCvQYB`,`ort-js`,`6533AMJJJZ`];return ie=function(){return e},ie()}l(445);var ae=`0.0.1`,oe=l(448),se=`vision_wasm_internal.js`,ce=`vision_wasm_internal.wasm`;l(454);function le(){let e=[`expiresIn`,`access_token`,`replace`,`2335270CONqJT`,`39eQYcPS`,`parse`,`3861636cWQFMO`,`expires_in`,`22477928AqityS`,`4991385XeClRr`,`now`,`552322wHlALT`,`expiresAt`,`string`,`89294cqZYDZ`,`2345872Fwnfxc`];return le=function(){return e},le()}(function(e,t){let n=fe,r=e();for(;;)try{if(parseInt(n(114))/1+-parseInt(n(117))/2*(parseInt(n(123))/3)+-parseInt(n(118))/4+-parseInt(n(122))/5+-parseInt(n(109))/6+-parseInt(n(112))/7+parseInt(n(111))/8===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(le,371469);function ue(e){return typeof e==`string`?e:e[fe(120)]}function de(e){let t=fe;if(typeof e!=`string`)return e[t(110)]}function fe(e,t){return e-=108,le()[e]}function pe(e){if(typeof e!==fe(116))return e.expires_at}function me(e){let t=fe;if(e[t(115)]){let n=Date[t(108)](e.expiresAt);if(!Number.isNaN(n))return n}if(e.expiresIn)return e.expiresIn>1e9?e[t(119)]*1e3:Date[t(113)]()+e.expiresIn*1e3}function he(e){return e[fe(121)](/\/+$/,``)}function ge(){let e=[`platform`,`none`,`10fcppVr`,`413536ZaXXKE`,`toLowerCase`,`test`,`linux`,`2CnIFpx`,`214570OammCA`,`904008MVqrhq`,`990948YZIjjO`,`mac`,`includes`,`142123cEThSV`,`1594116drnaZV`,`3axGFnV`,`low cpu cores (`,`396016iPQPuI`];return ge=function(){return e},ge()}function _e(e,t){return e-=443,ge()[e]}(function(e,t){let n=_e,r=e();for(;;)try{if(parseInt(n(448))/1*(parseInt(n(460))/2)+parseInt(n(450))/3*(-parseInt(n(456))/4)+parseInt(n(443))/5+parseInt(n(445))/6+-parseInt(n(444))/7+-parseInt(n(452))/8+parseInt(n(449))/9*(parseInt(n(455))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(ge,245289);function ve(){let e=_e;if(typeof navigator>`u`)return e(454);let t=navigator.userAgent[e(457)]();return/ipad|tablet/.test(t)?`tablet`:/mobile|iphone|ipod|android/.test(t)?`mobile`:`desktop`}function ye(){let e=_e;if(typeof navigator>`u`)return`none`;let t=navigator.userAgent.toLowerCase(),n=navigator[e(453)].toLowerCase();return/iphone|ipad|ipod/.test(t)?`ios`:/android/[e(458)](t)?`android`:n[e(447)](`win`)?`windows`:n.includes(e(446))?`macos`:n[e(447)](`linux`)?e(459):`other`}function be(){let e=_e,t=ve(),n=typeof navigator>`u`?0:navigator.hardwareConcurrency||0,r=xe();return t===`mobile`||t===`tablet`?{enabled:!1,reason:t+` device`,deviceType:t,cpuCores:n,deviceMemoryGb:r}:n>0&&n<8?{enabled:!1,reason:e(451)+n+`)`,deviceType:t,cpuCores:n,deviceMemoryGb:r}:r!==void 0&&r<8?{enabled:!1,reason:`low memory (`+r+`GB)`,deviceType:t,cpuCores:n,deviceMemoryGb:r}:{enabled:!0,deviceType:t,cpuCores:n,deviceMemoryGb:r}}function xe(){if(!(typeof navigator>`u`))return navigator.deviceMemory}(function(e,t){for(var n=Ce,r=e();;)try{if(parseInt(n(464))/1+parseInt(n(457))/2*(-parseInt(n(460))/3)+-parseInt(n(456))/4+parseInt(n(463))/5+parseInt(n(455))/6+-parseInt(n(459))/7+-parseInt(n(458))/8===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Se,227534);function Se(){var e=[`72UAuWJh`,`name`,`MonitorDogSdkError`,`1747775bOaMTZ`,`178175trOKwD`,`2111004cXUaHb`,`258292qCxgBT`,`27908WTwtRg`,`1873328GarpWy`,`128765ThgKDC`];return Se=function(){return e},Se()}function Ce(e,t){return e-=455,Se()[e]}var we=class extends Error{code;cause;constructor(e,t,n){var r=Ce;super(t),this[r(461)]=r(462),this.code=e,this.cause=n}};function Te(e){return e instanceof we}(function(e,t){let n=Ee,r=e();for(;;)try{if(-parseInt(n(309))/1*(-parseInt(n(296))/2)+parseInt(n(300))/3*(parseInt(n(297))/4)+parseInt(n(301))/5+parseInt(n(302))/6+parseInt(n(305))/7*(parseInt(n(307))/8)+-parseInt(n(306))/9+-parseInt(n(299))/10*(parseInt(n(298))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Pe,527394);function Ee(e,t){return e-=295,Pe()[e]}function De(e,t){let n=Ee;if(e.faceCount===0&&(t.state===`AWAY`||t.state===`INIT`&&t.hasTrackedUser))return je(`noFaceDetected`,e);if(e.faceCount>=2)return je(`twoFacesDetected`,e);if(e.phoneCount>=1)return je(n(304),e)}function Oe(e){return{type:`webcamBlocked`,payload:{...Me(`webcamBlocked`,new Date().toISOString()),properties:{confidence:1,spots:[],changed_coverage:e.changedCoverage}}}}function ke(e){return{...Me(e,new Date().toISOString()),properties:{},webcam_imgs:[],monitor_imgs:[]}}function Ae(e,t){return e.phoneCount===0&&(e.faceCount===1||e.faceCount===0&&t.state===`TRACKING`)}function je(e,t){let n=Me(e,new Date().toISOString());switch(e){case`noFaceDetected`:return{type:e,payload:{...n,properties:{confidence:0,spots:[]}}};case`twoFacesDetected`:return{type:e,payload:{...n,properties:{confidence:Ne(t.faceDetections),spots:t.faceDetections}}};case`mobileDevice`:return{type:e,payload:{...n,properties:{confidence:Ne(t.phoneDetections),spots:t.phoneDetections}}};case`webcamBlocked`:return{type:e,payload:{...n,properties:{confidence:0,spots:[]}}}}}function Me(e,t){return{basic_event_uuid:Fe(e),occured_at:t,sended_at:new Date().toISOString(),device_type:ve(),device_os:ye(),device_id:`browser`}}function Ne(e){return e.reduce((e,t)=>Math.max(e,t.score),0)}function Pe(){let e=[`11671WYMVcN`,`9710htDRJW`,`15mYjzGX`,`2319860jkUfnd`,`1268304WSNQET`,`d555efac-7465-4067-8056-611e95385807`,`mobileDevice`,`752864ABsiBs`,`3915243veRsDZ`,`48UBJXbP`,`027af5c9-297d-4a64-983f-4199ca4b9dad`,`26947NMSUZJ`,`twoFacesDetected`,`44VNdMiD`,`63320SDBoaK`];return Pe=function(){return e},Pe()}function Fe(e){let t=Ee;switch(e){case`logout`:return`12ca646a-d832-4581-b03c-48f95627507f`;case`login`:return`4c6f98ea-88d8-4215-9b6a-9b3ccb753465`;case`mobileDevice`:return t(308);case t(295):return t(303);case`noFaceDetected`:return`e2c48c23-36e2-4253-82b1-7f6565fdcfc3`;case`webcamBlocked`:return`169058dd-60c3-44dd-a97b-ce92a7083197`;default:return``}}function Ie(){let e=`services,tokenExpiresAt,shouldRefreshAfterAuthError,setSessionTokenPayload,55KJbwLN,refreshIntervalId,40792806IxbjFL,329608VkpPfc,setTokens,periodicRefreshIntervalMs,options,432208kzCSZP,935624mKGcdA,onAuthError,sessionTokenProvider,MonitorDog login email is required to refresh SDK token.,getApiErrorCode,MonitorDog ,authorization,64XKJNbL,createSdkError,authSessionId,fetchSessionToken,MonitorDog SDK session token refresh failed.,refreshAccessToken,application/json,sendUserActivityEvent,3411714tccfoK,stopPeriodicRefresh,clearTokens,status,2718627ulzsGD,MonitorDog sessionTokenProvider is required for SDK login.,245588UboYUF,token,string,login,Device-Access-Token,getValidAccessToken,code,onLoginRequired`.split(`,`);return Ie=function(){return e},Ie()}var f=Le;(function(e,t){let n=Le,r=e();for(;;)try{if(-parseInt(n(266))/1+-parseInt(n(246))/2+-parseInt(n(244))/3+parseInt(n(261))/4*(-parseInt(n(258))/5)+-parseInt(n(281))/6+parseInt(n(265))/7*(-parseInt(n(273))/8)+parseInt(n(260))/9===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ie,598914);function Le(e,t){return e-=244,Ie()[e]}var Re=`MonitorDog token refresh was superseded.`,ze=300*1e3,Be=class{[f(254)];refreshBeforeMs=ze;periodicRefreshIntervalMs=te;[f(247)];[f(255)];refreshPromise;[f(259)];authSessionId=0;sessionEmail;constructor(e){this.services=e}async[f(249)](e){let t=f,n=await this.fetchSessionToken(e.email);return this.sessionEmail=e.email,this.setSessionTokenPayload(n),await this[t(280)](`login`),n}async logout(){let e=f;if(this.token)try{await this.sendUserActivityEvent(`logout`)}finally{this[e(283)]()}}getToken(){return this.token}getTokenExpiresAt(){let e=f;return this[e(255)]}getSessionEmail(){return this.sessionEmail}isAuthenticated(){return!!this.token}dispose(){this.clearTokens()}assertAuthenticated(){if(!this.token)throw Error(`MonitorDog login is required before detection.`)}async[f(251)](){if(this.shouldRefreshCurrentToken())try{await this.handleAuthRefresh()}catch(e){if(this.token&&this.tokenExpiresAt&&Date.now()<this.tokenExpiresAt)return this.token;throw e}return this.token}async authorizedFetch(e,t={},n=!0){let r=f,i=await this.getValidAccessToken(),a=new Headers(t.headers);i&&(a.set(r(272),`Bearer `+i),a.set(r(250),i));let o=await fetch(``+this[r(254)][r(264)].apiBaseUrl+e,{...t,headers:a}),s=await this.getApiErrorCode(o);return o.status===400&&s===4221&&this.handleLoginRequired(),n&&this[r(256)](o,s)?(await this.handleAuthRefresh(),this.authorizedFetch(e,t,!1)):o}[f(257)](e){let t=f,n=ue(e);if(!n||typeof n!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);this[t(262)]({accessToken:n,expiresIn:de(e),expiresAt:pe(e)})}setTokens(e){let t=f;this.token=e.accessToken,this.tokenExpiresAt=me(e),this.tokenExpiresAt?this.startPeriodicRefresh():this[t(282)]()}[f(283)](){let e=f;this[e(275)]+=1,this.token=void 0,this.tokenExpiresAt=void 0,this.refreshPromise=void 0,this.sessionEmail=void 0,this.stopPeriodicRefresh()}async refreshToken(){return this.refreshPromise||=this.refreshAccessToken().finally(()=>{this.refreshPromise=void 0}),this.refreshPromise}async handleAuthRefresh(){let e=f;try{return await this.refreshToken()}catch(t){if(!this.isRefreshSupersededError(t)){let n=this[e(274)](`SESSION_TOKEN_FAILED`,e(277),t);this[e(254)].options.onAuthError?.(n),this.isCurrentTokenExpired()&&(this.clearTokens(),this.services.onLoginRequired?.())}throw t}}async[f(278)](){let e=f,t=this.authSessionId,n=this.sessionEmail;if(!n)throw Error(e(269));let r=await this.fetchSessionToken(n),i=ue(r);if(!i||typeof i!==e(248))throw Error(`MonitorDog SDK token response did not include a token.`);if(t!==this.authSessionId)throw Error(Re);return this.setSessionTokenPayload(r),i}startPeriodicRefresh(){let e=f;this.refreshIntervalId||=setInterval(()=>{this.refreshPeriodically()},this[e(263)])}[f(282)](){this.refreshIntervalId&&=(clearInterval(this.refreshIntervalId),void 0)}async refreshPeriodically(){if(!(!this.token||!this.shouldRefreshCurrentToken()))try{await this.handleAuthRefresh()}catch{}}shouldRefreshCurrentToken(){let e=f;return!!(this.token&&this.tokenExpiresAt&&Date.now()>=this[e(255)]-this.refreshBeforeMs)}isCurrentTokenExpired(){let e=f;return!!(this[e(255)]&&Date.now()>=this.tokenExpiresAt)}isRefreshSupersededError(e){return e instanceof Error&&e.message===Re}async[f(276)](e){let t=f,n=this[t(254)][t(264)][t(268)];if(!n)throw Error(t(245));return n({email:e})}async[f(270)](e){let t=f;if(e[t(284)]===400)try{let n=await e.clone().json();if(typeof n==`object`&&n&&`code`in n&&typeof n[t(252)]==`number`)return n.code}catch{return}}shouldRefreshAfterAuthError(e,t){let n=f;return e.status===401?!0:e[n(284)]===400&&t===422}handleLoginRequired(){let e=f;this.clearTokens(),this[e(254)][e(253)]?.();let t=this.createSdkError(`NOT_LOGGED_IN`,`MonitorDog login is required.`);throw this.services.options[e(267)]?.(t),t}async sendUserActivityEvent(e){let t=f;try{let n=await this.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":t(279)},body:JSON.stringify(ke(e))});if(!n.ok)throw Error(`MonitorDog `+e+` event failed: `+n[t(284)])}catch(n){let r=this.createSdkError(Ve(e),t(271)+e+` event failed.`,n);if(this.services.options.onAuthError?.(r),e===`logout`)throw r}}createSdkError(e,t,n){return n instanceof we?n:new we(e,t,n)}};function Ve(e){return e===`logout`?`LOGOUT_FAILED`:`SESSION_TOKEN_FAILED`}function He(e,t){return e-=278,Ue()[e]}function Ue(){let e=`name.audio.createFallbackWebcamStream.getVideoTracks.isPermissionError.stopStream.7rlskPL.readyState.max.4748guPVLf.message.getBaseWebcamConstraints.getVideoInputDevices.videoinput.width.forEach.video.949122WTMrzm.213668LOvdTz.475SvdiUZ.createFirstCameraConstraints.778386iIOKHb.generateResolutionList.deviceId.finally.object.getUserMedia.2775256viYMoW.1345484LNTpvb.mediaDevices.height.getWebcamNaturalAspectRatio.3776046ppzCFr.getRealVideoInputDevices.filter.getTracks`.split(`.`);return Ue=function(){return e},Ue()}var We=He;(function(e,t){let n=He,r=e();for(;;)try{if(parseInt(n(303))/1+parseInt(n(313))/2+-parseInt(n(306))/3+parseInt(n(294))/4*(-parseInt(n(304))/5)+-parseInt(n(281))/6+parseInt(n(291))/7*(parseInt(n(312))/8)+parseInt(n(302))/9===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ue,337207);var Ge=/(obs|virtual|xsplit|manycam|splitcam|webcammax|fake|loopback|camtwist|e2esoft|vcam|droidcam|iriun|epoccam|camo|mmhmm|nvidia broadcast|streamlabs|bandicam|wirecast|chromacam|youcam|cyberlink|altserver|logi capture|elgato|streamfx|screen capture|desktop capture)/i,Ke=class{async createWebcamStream(e){let t=He;if(!navigator[t(278)]?.getUserMedia)throw Error(`getUserMedia is not available in this browser.`);let n=this[t(296)](e),r=await this[t(305)](n);try{return await this.getUserMedia(r)}catch(e){if(this[t(289)](e)||this.isCameraRequestTimeoutError(e))throw e;return this.createFallbackWebcamStream(r,e)}}stopStream(e){let t=He;e.getTracks()[t(300)](e=>e.stop())}watchStreamDeviceDisconnect(e,t,n=1e3){let r=e[He(288)]()[0],i=r?.getSettings().deviceId;if(!r&&!i)return()=>{};let a=!1,o,s=()=>{a||(a=!0,t())},c=()=>{i&&(o&&clearTimeout(o),o=setTimeout(()=>{o=void 0,this.handleDeviceChange(i,s)},n))};return r?.addEventListener(`ended`,s),navigator.mediaDevices?.addEventListener?.(`devicechange`,c),()=>{o&&clearTimeout(o),r?.removeEventListener(`ended`,s),navigator.mediaDevices?.removeEventListener?.(`devicechange`,c)}}isCameraInUse(e){let t=He,n=e?.srcObject;return n instanceof MediaStream?n.getTracks().some(e=>e[t(292)]===`live`):!1}async getVideoInputDevices(){let e=He;return navigator.mediaDevices?.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(t=>t.kind===e(298)):[]}async getRealVideoInputDevices(){let e=He,t=await this.getVideoInputDevices(),n=t[e(283)](e=>!this.isVirtualCamera(e));return n.length>0?n:t}async[We(287)](e,t){let n=We,r=await this[n(282)]();if(r.length===0)throw t;let i=r[0],a=t;if(!i?.deviceId)throw a;let o=await this.getWebcamNaturalAspectRatio(i[n(308)]),s=this[n(307)](o,720);for(let t of s)try{return await this[n(311)](this.createDeviceConstraints(e,i.deviceId,t))}catch(e){a=e}throw a}async handleDeviceChange(e,t){let n=We;try{!(await this[n(297)]()).some(t=>t[n(308)]===e)&&t()}catch{}}[We(296)](e){return e??{audio:!1,video:{facingMode:`user`}}}async[We(305)](e){let t=We,n=typeof e[t(301)]==`object`?e[t(301)]:{};if(`deviceId`in n||`facingMode`in n)return e;let r=(await this.getRealVideoInputDevices())[0];return r?.deviceId?this.createDeviceConstraints(e,r[t(308)]):e}async[We(280)](e){let t=We,n;try{n=await this[t(311)]({audio:!1,video:{deviceId:{exact:e}}});let r=n.getVideoTracks()[0]?.getSettings();if(r?.[t(299)]&&r.height)return r.width/r[t(279)]}catch{}finally{n?.[t(284)]().forEach(e=>e.stop())}return 16/9}[We(307)](e,t){let n=We;return[t,640,600,480,320,240].map(t=>({width:t,height:Math[n(293)](1,Math.round(t/e))})).filter(e=>e.width<=t&&e.height>=120&&e.height<=1080)}createDeviceConstraints(e,t,n){let r=We,i=typeof e[r(301)]===r(310)?e.video:{};return{...e,audio:e[r(286)]??!1,video:{...i,deviceId:{exact:t},...n?{width:{min:n.width,ideal:n.width},height:{min:n.height,ideal:n.height}}:{}}}}isVirtualCamera(e){let t=e.label.toLowerCase();return t?Ge.test(t):!1}[We(289)](e){let t=We;return e instanceof DOMException&&(e[t(285)]===`NotAllowedError`||e.name===`SecurityError`)}getUserMedia(e,t=15e3){let n=We,r=!1,i,a=navigator.mediaDevices.getUserMedia(e).then(e=>{let t=He;if(r)throw this[t(290)](e),Error(`Camera permission request timed out.`);return e}),o=new Promise((e,n)=>{i=setTimeout(()=>{r=!0,n(Error(`Camera permission request timed out.`))},t)});return Promise.race([a,o])[n(309)](()=>{i&&clearTimeout(i)})}isCameraRequestTimeoutError(e){let t=We;return e instanceof Error&&e[t(295)]===`Camera permission request timed out.`}};function qe(e,t){return e-=367,Xe()[e]}(function(e,t){let n=qe,r=e();for(;;)try{if(parseInt(n(370))/1+-parseInt(n(377))/2*(-parseInt(n(380))/3)+-parseInt(n(372))/4*(parseInt(n(369))/5)+parseInt(n(383))/6*(-parseInt(n(382))/7)+parseInt(n(384))/8*(parseInt(n(373))/9)+-parseInt(n(378))/10*(parseInt(n(376))/11)+parseInt(n(374))/12===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Xe,861110);function Je(e){let t=qe;if(e[t(367)]===0||e.videoHeight===0)throw Error(t(375));let n=document[t(379)](`canvas`),r=n.getContext(`2d`);if(!r)throw Error(`2D canvas context is not available.`);return n.width=e[t(367)],n.height=e.videoHeight,r.drawImage(e,0,0,n.width,n.height),new Promise((e,t)=>{n.toBlob(n=>{if(!n){t(Error(`Failed to capture video frame.`));return}e(n)},`image/jpeg`,.9)})}async function Ye(){let e=qe;if(typeof document===e(381)||!document.body)return null;let n=await(0,t.default)(document.body,{backgroundColor:e(371),useCORS:!0});return new Promise(t=>{let r=e;n.toBlob(t,r(368),.9)})}function Xe(){let e=[`createElement`,`3VtMBgz`,`undefined`,`203DAMemr`,`125886VUzFtG`,`982520vqheWq`,`videoWidth`,`image/jpeg`,`7621885khswgv`,`994626zfJZWl`,`#ffffff`,`4HzWXrN`,`27CBZFdK`,`27233748OkgsjO`,`Video frame is not ready for capture.`,`3058gVUFmC`,`408008vYkltN`,`30310cNAxiE`];return Xe=function(){return e},Xe()}function Ze(){let e=`noPersonLockDuration.12664afBWMG.mobileDetectionMode.6SwzWkJ.POST.98QqecXZ.1515330POQhqr.name.5741592aLKkgQ.uploadWebcamImage.19794nINohU.19mKEtOX.detectionEventLockTimeoutId.options.overlay.clearLock.log.noFaceStartedAt.noFaceDetected.detectionEventLocked.shouldShowOverlay.NO_FACE_STARTUP_GRACE_MS.type.19892IzRPxZ.webcamBlocked.multiPersonDetectionEnabled.hasActiveState.reduce.isShowingDetectionBlocker.status.confidence.noPersonDetectionMode.resetForWebcamStartup.userPreferences.services.uploadMonitorImage.142168GOUTpm.getMode.stringify.faceDetectionThreshold.623079WSeKrs.MonitorDog event request failed: .requiredPassword.faceDetections.suppressNoFaceUntil.isLocked.blocked.handleWebcamBlockageResult.11VPcjtf.detection.400vIcgpN.append.monitor_imgs.lock.payload`.split(`.`);return Ze=function(){return e},Ze()}var p=Qe;function Qe(e,t){return e-=118,Ze()[e]}(function(e,t){let n=Qe,r=e();for(;;)try{if(parseInt(n(124))/1*(parseInt(n(136))/2)+-parseInt(n(171))/3*(parseInt(n(149))/4)+parseInt(n(163))/5*(-parseInt(n(123))/6)+-parseInt(n(118))/7*(-parseInt(n(169))/8)+-parseInt(n(153))/9+-parseInt(n(119))/10+parseInt(n(161))/11*(parseInt(n(121))/12)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ze,133834);var $e=class e{static NO_FACE_STARTUP_GRACE_MS=1500;services;[p(132)]=!1;detectionEventInFlight=!1;[p(125)];noFaceStartedAt;suppressNoFaceUntil=0;constructor(e){this.services=e}async handleDetectionResult(e,t,n){let r=p;if(Ae(e,t)){if(this.noFaceStartedAt=void 0,this.services.overlay[r(158)]()||this.services.shouldPauseForResumePassword)return;this.clearLock(),this.services[r(127)].clearSource(r(162));return}if(this.detectionEventLocked||this.detectionEventInFlight||this.services[r(127)][r(141)]())return;let i=De(e,t);if(!i){this[r(130)]=void 0;return}if(!(i[r(135)]===r(131)&&!this.hasNoFaceDelayElapsed())&&(i.type!==`noFaceDetected`&&(this.noFaceStartedAt=void 0),this.shouldSendEvent(i.type,e))){this.lock(i.type),this[r(133)](i.type)&&this.services.overlay.showJob({id:`detection:`+i.type,state:i.type,source:`detection`,durationMs:this.getOverlayDuration(i.type)}),this.detectionEventInFlight=!0;try{let e=await this.uploadWebcamImage(n);this.shouldPauseDetectionAfterCapture(i.type)&&this.services.webcam.syncPauseState(),e&&(i[r(167)].webcam_imgs=e);let t=await this[r(148)]();if(t&&(i.payload[r(165)]=t),this.services[r(126)].debug){console[r(129)](i.payload);return}let a=await this.services.auth.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON[r(151)](i.payload)});if(!a.ok)throw Error(r(154)+a[r(142)])}finally{this.detectionEventInFlight=!1}}}async[p(160)](e,t){let n=p,r=`webcamBlocked`;if((e.likelyCovered||e.suspected||e[n(159)])&&(this.noFaceStartedAt=void 0),!(!e.blocked||!this.shouldSendWebcamBlockedEvent()||this.detectionEventLocked||this.detectionEventInFlight||this[n(147)].overlay[n(139)](n(131))||this[n(147)][n(127)].hasActiveState(r))){this[n(166)](r),this[n(133)](r)&&this.services.overlay.showJob({id:`detection:webcamBlocked`,state:r,source:`detection`,durationMs:this.getOverlayDuration(r),priority:150}),this.detectionEventInFlight=!0;try{let r=Oe(e),i=await this.uploadWebcamImage(t);i&&(r.payload.webcam_imgs=i);let a=await this[n(148)]();if(a&&(r.payload.monitor_imgs=a),this.services.options.debug){console.log(r.payload);return}let o=await this[n(147)].auth.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r.payload)});if(!o.ok)throw Error(`MonitorDog event request failed: `+o.status)}finally{this.detectionEventInFlight=!1}}}reset(){let e=p;this.clearLock(),this[e(130)]=void 0,this[e(157)]=0}[p(145)](){let t=p;this.clearLock(),this[t(130)]=void 0,this.suppressNoFaceUntil=Date.now()+e[t(134)]}resetAfterResumePasswordUnlock(){this.resetForWebcamStartup()}async[p(122)](e){if(!(e instanceof HTMLVideoElement)||e.videoWidth===0||e.videoHeight===0)return;let t=await Je(e);return this.uploadImage(t,`webcam.jpg`)}async uploadMonitorImage(){let e=p,t=this.services.options.captureMonitorImage?await this[e(147)].options.captureMonitorImage():await Ye();if(!t)return;let n=typeof File<`u`&&t instanceof File?t[e(120)]:`monitor.jpg`;return this.uploadImage(t,n)}async uploadImage(e,t){let n=p,r=new FormData;r[n(164)](`files`,e,t);let i=await this.services.auth.authorizedFetch(`/file/image`,{method:n(172),body:r});if(!i.ok)throw Error(`MonitorDog image upload failed: `+i[n(142)]);return i.json()}shouldSendEvent(e,t){let n=p;switch(e){case`mobileDevice`:return this.services.userPreferences.mobileDetectionEnabled&&et(t.phoneDetections)>=this.services.userPreferences.mobileDetectionThreshold;case`twoFacesDetected`:return this.services.userPreferences[n(138)]&&et(t[n(156)])>=this.services.userPreferences[n(152)];case`noFaceDetected`:return this.services.userPreferences.noPersonDetectionEnabled;case n(137):return this.shouldSendWebcamBlockedEvent()}}shouldSendWebcamBlockedEvent(){let e=p;return this[e(147)].userPreferences.webcamBlockageDetectionEnabled}shouldShowOverlay(e){let t=p;return this[t(150)](e)===`auto_lock`}lock(e){let t=p;this[t(128)](),this.detectionEventLocked=!0;let n=this.getLockDuration(e);if(n<=0){this.detectionEventLocked=!1;return}this.detectionEventLockTimeoutId=setTimeout(()=>{let e=t;this[e(132)]=!1,this.detectionEventLockTimeoutId=void 0},n)}clearLock(){this.detectionEventLockTimeoutId&&=(clearTimeout(this.detectionEventLockTimeoutId),void 0),this.detectionEventLocked=!1}hasNoFaceDelayElapsed(){let e=p;if(Date.now()<this.suppressNoFaceUntil)return this[e(130)]=void 0,!1;if(this.services.noFaceEventDelayMs<=0)return!0;let t=Date.now();return this.noFaceStartedAt===void 0?(this.noFaceStartedAt=t,!1):t-this[e(130)]>=this[e(147)].noFaceEventDelayMs}getLockDuration(e){let t=p;switch(e){case`mobileDevice`:return this[t(147)].userPreferences.mobileDetectionLockDuration;case`twoFacesDetected`:return this[t(147)].userPreferences.multiPersonLockDuration;case t(131):return this[t(147)].userPreferences[t(168)];case`webcamBlocked`:return this.services.userPreferences.webcamBlockageLockDuration}}getOverlayDuration(e){if(!(e===p(131)&&this.services.options.requiredPassword))return this.getLockDuration(e)}shouldPauseDetectionAfterCapture(e){let t=p;return e===`noFaceDetected`&&this.services.options[t(155)]&&this.shouldShowOverlay(e)}getMode(e){let t=p;switch(e){case`mobileDevice`:return this.services.userPreferences[t(170)];case`twoFacesDetected`:return this.services.userPreferences.multiPersonDetectionMode;case t(131):return this.services[t(146)][t(144)];case`webcamBlocked`:return this.services.userPreferences.webcamBlockageDetectionMode}}};function et(e){let t=p;return e[t(140)]((e,n)=>Math.max(e,n[t(143)]),0)}``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/inference-worker-BqvxPw8S.js`).href:new URL(`assets/inference-worker-BqvxPw8S.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href);var tt=rt;function nt(){let e=`2328712NfpVYH,debug,23781593OurRkn,bitmap,getWorker,iouThreshold,delete,confidenceThreshold,request,run,rejectPendingRequests,nextRequestId,161274QrQkAJ,8FbvOkb,9ZnvUBo,21DgxRgR,Inference worker was terminated.,worker,reject,inputSize,message,6AdUQdD,3556368GVGGzM,handleMessage,source,138723WRvPZX,load,8309050OZUBYP,error,6471775eBvfLf,MonitorDogInference`.split(`,`);return nt=function(){return e},nt()}(function(e,t){let n=rt,r=e();for(;;)try{if(parseInt(n(311))/1*(parseInt(n(312))/2)+parseInt(n(324))/3+parseInt(n(321))/4+parseInt(n(328))/5*(parseInt(n(320))/6)+-parseInt(n(314))/7*(-parseInt(n(330))/8)+-parseInt(n(313))/9*(parseInt(n(326))/10)+-parseInt(n(301))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(nt,755183);function rt(e,t){return e-=300,nt()[e]}var it=class{[tt(316)];[tt(310)]=1;pendingRequests=new Map;async load(e){let t=tt,n={id:this.nextRequestId,type:t(325),model:e};await this[t(307)](n)}run(e){let t=tt,n=e[t(323)].kind===t(302)?[e.source.bitmap]:[e.source.data.buffer];return this.request({id:this[t(310)],type:t(308),source:e.source,inputSize:e[t(318)],inputType:e.inputType,confidenceThreshold:e[t(306)],faceConfidenceThreshold:e.faceConfidenceThreshold,iouThreshold:e[t(304)],maxDetections:e.maxDetections,debug:e[t(300)]},n)}terminate(){let e=tt;this.rejectPendingRequests(Error(e(315))),this.worker?.terminate(),this[e(316)]=void 0}request(e,t=[]){let n=this.getWorker();return this.nextRequestId+=1,new Promise((r,i)=>{this.pendingRequests.set(e.id,{resolve:r,reject:i}),n.postMessage(e,t)})}[tt(303)](){let e=tt;return!this.worker&&(this.worker=new Worker(``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/inference-worker-BqvxPw8S.js`).href:new URL(`assets/inference-worker-BqvxPw8S.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),{name:e(329),type:`module`}),this.worker.addEventListener(e(319),this[e(322)]),this.worker.addEventListener(`error`,this.handleError),this.worker.addEventListener(`messageerror`,this.handleError)),this[e(316)]}[tt(322)]=e=>{let t=tt,n=e.data,r=this.pendingRequests.get(n.id);if(r){if(this.pendingRequests[t(305)](n.id),!n.ok){r.reject(Error(n[t(327)]));return}r.resolve(n.result)}};handleError=e=>{let t=tt,n=e instanceof ErrorEvent?e.message:`Inference worker message failed.`;this[t(309)](Error(n)),this.worker?.terminate(),this.worker=void 0};rejectPendingRequests(e){let t=tt;for(let n of this.pendingRequests.values())n[t(317)](e);this.pendingRequests.clear()}};(function(e,t){let n=st,r=e();for(;;)try{if(-parseInt(n(186))/1*(parseInt(n(169))/2)+-parseInt(n(170))/3*(parseInt(n(189))/4)+-parseInt(n(174))/5+-parseInt(n(184))/6*(parseInt(n(176))/7)+-parseInt(n(175))/8*(parseInt(n(188))/9)+parseInt(n(183))/10+parseInt(n(173))/11*(parseInt(n(187))/12)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(at,285972);function at(){let e=[`data`,`getImageData`,`3491280VuwNWN`,`26118XDXkpN`,`fillStyle`,`20283ICnyfw`,`996eeaoBx`,`46422viLDoe`,`4FhbqGm`,`drawImage`,`38WxXpTs`,`643575vVAzGA`,`min`,`createElement`,`199265htgPfM`,`2028400qPFAsH`,`688DsdJam`,`189SDwTpN`,`floor`,`height`,`width`,`canvas`];return at=function(){return e},at()}async function ot(e){let t=st,{sourceWidth:n,sourceHeight:r}=ct(e);if(e instanceof ImageData)return{kind:`rgba`,data:new Uint8ClampedArray(e[t(181)]),sourceWidth:n,sourceHeight:r};if(lt()&&ut())try{return{kind:`bitmap`,bitmap:await createImageBitmap(e),sourceWidth:n,sourceHeight:r}}catch{}return dt(e,n,r)}function st(e,t){return e-=169,at()[e]}function ct(e){let t=st;return e instanceof ImageData?{sourceWidth:e.width,sourceHeight:e.height}:e instanceof HTMLVideoElement?{sourceWidth:e.videoWidth,sourceHeight:e.videoHeight}:e instanceof HTMLImageElement?{sourceWidth:e.naturalWidth,sourceHeight:e.naturalHeight}:{sourceWidth:e[t(179)],sourceHeight:e.height}}function lt(){return typeof createImageBitmap==`function`}function ut(){return typeof OffscreenCanvas==`function`}function dt(e,t,n){let r=st,i=document[r(172)](r(180)),a=i.getContext(`2d`);if(!a)throw Error(`2D canvas context is not available.`);return i[r(179)]=t,i[r(178)]=n,a.drawImage(e,0,0,t,n),{kind:`rgba`,data:a.getImageData(0,0,t,n).data,sourceWidth:t,sourceHeight:n}}var ft=new Uint8Array([0,97,115,109,1,0,0,0,1,43,5,96,0,0,96,4,127,127,127,127,0,96,21,127,127,127,127,127,127,124,124,124,127,124,124,127,124,124,127,127,127,127,127,127,0,96,1,127,0,96,0,1,127,3,6,5,0,1,2,3,4,4,5,1,112,1,2,2,5,6,1,1,130,2,130,2,6,8,1,127,1,65,128,136,4,11,7,160,1,7,6,109,101,109,111,114,121,2,0,17,109,100,95,119,101,98,99,97,109,95,97,110,97,108,121,122,101,0,1,26,109,100,95,119,101,98,99,97,109,95,98,108,111,99,107,97,103,101,95,97,110,97,108,121,122,101,0,2,11,95,105,110,105,116,105,97,108,105,122,101,0,0,25,95,95,105,110,100,105,114,101,99,116,95,102,117,110,99,116,105,111,110,95,116,97,98,108,101,1,0,25,95,101,109,115,99,114,105,112,116,101,110,95,115,116,97,99,107,95,114,101,115,116,111,114,101,0,3,28,101,109,115,99,114,105,112,116,101,110,95,115,116,97,99,107,95,103,101,116,95,99,117,114,114,101,110,116,0,4,9,7,1,0,65,1,11,1,0,10,246,26,5,3,0,1,11,193,16,2,14,127,10,124,35,0,65,128,204,0,107,34,4,36,0,2,64,32,1,32,2,108,34,8,65,176,9,74,13,0,32,2,65,0,76,13,0,32,1,65,0,76,13,0,32,0,69,13,0,32,3,69,13,0,32,4,65,60,106,65,0,65,196,0,252,11,0,32,4,65,128,1,106,65,0,65,128,203,0,252,11,0,65,1,32,8,32,8,65,1,77,27,33,9,32,4,65,64,107,33,6,3,64,32,4,65,128,1,106,32,5,65,3,116,106,32,0,32,5,65,2,116,106,34,7,45,0,2,184,34,22,68,93,109,197,254,178,123,178,63,162,32,7,45,0,0,184,34,25,68,188,150,144,15,122,54,203,63,162,32,7,45,0,1,184,34,23,68,165,44,67,28,235,226,230,63,162,160,160,34,19,57,3,0,32,6,65,15,32,19,68,0,0,0,0,0,0,112,63,162,68,0,0,0,0,0,0,48,64,162,156,252,2,34,7,32,7,65,15,78,27,65,2,116,106,34,7,32,7,40,2,0,65,1,106,54,2,0,32,24,32,19,160,33,24,32,13,32,19,68,0,0,0,0,0,64,106,64,102,106,33,13,32,12,32,19,68,0,0,0,0,0,128,70,64,101,106,33,12,32,11,32,19,68,0,0,0,0,0,128,91,64,101,106,33,11,32,20,32,22,160,33,20,32,18,32,23,160,33,18,32,21,32,25,160,33,21,32,5,65,1,106,34,5,32,9,71,13,0,11,32,20,32,8,184,34,23,163,33,19,32,18,32,23,163,33,18,32,21,32,23,163,33,21,65,0,33,5,3,64,32,26,32,0,32,5,65,2,116,106,34,8,45,0,2,184,32,19,161,34,20,32,20,162,32,8,45,0,0,184,32,21,161,34,20,32,20,162,32,8,45,0,1,184,32,18,161,34,20,32,20,162,160,160,160,33,26,32,5,65,1,106,34,5,32,9,71,13,0,11,68,0,0,0,0,0,0,0,0,33,21,2,64,32,1,65,3,73,13,0,32,2,65,3,73,13,0,32,1,65,2,107,33,7,32,2,65,2,107,33,14,65,0,33,9,65,1,33,0,3,64,32,4,65,128,1,106,34,5,32,0,32,1,108,65,3,116,106,33,15,32,0,65,1,106,34,2,32,1,108,65,3,116,32,5,106,34,16,43,3,0,33,19,32,0,65,1,107,32,1,108,65,3,116,32,5,106,34,17,43,3,0,33,21,32,16,43,3,8,33,18,32,17,43,3,8,33,20,65,1,33,5,3,64,32,21,33,22,32,20,33,21,32,19,33,25,32,18,33,19,32,9,32,15,32,5,65,1,106,34,8,65,3,116,34,10,106,43,3,0,34,18,32,18,160,32,10,32,17,106,43,3,0,34,20,160,32,10,32,16,106,43,3,0,34,18,160,32,25,32,22,32,15,32,5,65,3,116,106,65,8,107,43,3,0,34,27,32,27,160,160,160,161,34,27,32,27,162,32,25,32,19,32,19,160,160,32,18,160,32,22,32,21,32,21,160,160,32,20,160,161,34,22,32,22,162,160,159,68,0,0,0,0,0,0,68,64,100,106,33,9,32,5,32,7,71,33,10,32,8,33,5,32,10,13,0,11,32,0,32,14,71,33,5,32,2,33,0,32,5,13,0,11,32,9,183,32,7,32,14,108,184,163,33,21,11,68,0,0,0,0,0,224,31,64,33,18,2,124,68,0,0,0,0,0,224,31,64,32,4,40,2,64,34,1,32,23,68,205,204,204,204,204,204,236,63,162,155,34,19,68,0,0,0,0,0,0,240,63,32,19,68,0,0,0,0,0,0,240,63,100,27,252,3,34,0,79,13,0,26,68,0,0,0,0,0,232,55,64,32,0,32,4,40,2,68,32,1,106,34,2,77,13,0,26,68,0,0,0,0,0,236,67,64,32,0,32,4,40,2,72,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,228,75,64,32,0,32,4,40,2,76,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,238,81,64,32,0,32,4,40,2,80,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,234,85,64,32,0,32,4,40,2,84,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,230,89,64,32,0,32,4,40,2,88,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,226,93,64,32,0,32,4,40,2,92,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,239,96,64,32,0,32,4,40,2,96,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,237,98,64,32,0,32,4,40,2,100,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,235,100,64,32,0,32,4,40,2,104,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,233,102,64,32,0,32,4,40,2,108,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,231,104,64,32,0,32,4,40,2,112,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,229,106,64,32,0,32,4,40,2,116,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,227,108,64,32,0,32,4,40,2,120,32,2,106,34,2,77,13,0,26,68,0,0,0,0,0,224,111,64,68,0,0,0,0,0,225,110,64,32,4,40,2,124,32,2,106,32,0,73,27,11,33,20,32,11,184,33,22,32,24,32,23,163,33,19,32,26,32,23,163,33,25,2,64,32,1,32,23,68,154,153,153,153,153,153,185,63,162,155,34,24,68,0,0,0,0,0,0,240,63,32,24,68,0,0,0,0,0,0,240,63,100,27,252,3,34,0,79,13,0,32,0,32,4,40,2,68,32,1,106,34,1,77,4,64,68,0,0,0,0,0,232,55,64,33,18,12,1,11,32,0,32,4,40,2,72,32,1,106,34,1,77,4,64,68,0,0,0,0,0,236,67,64,33,18,12,1,11,32,0,32,4,40,2,76,32,1,106,34,1,77,4,64,68,0,0,0,0,0,228,75,64,33,18,12,1,11,32,0,32,4,40,2,80,32,1,106,34,1,77,4,64,68,0,0,0,0,0,238,81,64,33,18,12,1,11,32,0,32,4,40,2,84,32,1,106,34,1,77,4,64,68,0,0,0,0,0,234,85,64,33,18,12,1,11,32,0,32,4,40,2,88,32,1,106,34,1,77,4,64,68,0,0,0,0,0,230,89,64,33,18,12,1,11,32,0,32,4,40,2,92,32,1,106,34,1,77,4,64,68,0,0,0,0,0,226,93,64,33,18,12,1,11,32,0,32,4,40,2,96,32,1,106,34,1,77,4,64,68,0,0,0,0,0,239,96,64,33,18,12,1,11,32,0,32,4,40,2,100,32,1,106,34,1,77,4,64,68,0,0,0,0,0,237,98,64,33,18,12,1,11,32,0,32,4,40,2,104,32,1,106,34,1,77,4,64,68,0,0,0,0,0,235,100,64,33,18,12,1,11,32,0,32,4,40,2,108,32,1,106,34,1,77,4,64,68,0,0,0,0,0,233,102,64,33,18,12,1,11,32,0,32,4,40,2,112,32,1,106,34,1,77,4,64,68,0,0,0,0,0,231,104,64,33,18,12,1,11,32,0,32,4,40,2,116,32,1,106,34,1,77,4,64,68,0,0,0,0,0,229,106,64,33,18,12,1,11,32,0,32,4,40,2,120,32,1,106,34,1,77,4,64,68,0,0,0,0,0,227,108,64,33,18,12,1,11,68,0,0,0,0,0,224,111,64,68,0,0,0,0,0,225,110,64,32,4,40,2,124,32,1,106,32,0,73,27,33,18,11,32,22,32,23,163,33,24,32,12,184,32,23,163,34,22,68,92,143,194,245,40,92,239,63,102,34,0,32,20,32,18,161,34,20,68,0,0,0,0,0,0,48,64,101,34,1,32,19,68,0,0,0,0,0,0,32,64,101,113,113,32,25,68,0,0,0,0,0,0,78,64,101,113,32,21,68,123,20,174,71,225,122,132,63,101,113,32,19,68,0,0,0,0,0,0,73,64,101,32,1,113,32,0,113,114,33,0,32,13,184,32,23,163,33,18,65,1,33,5,2,64,2,64,32,19,68,0,0,0,0,0,64,90,64,101,69,13,0,32,22,68,225,122,20,174,71,225,218,63,102,69,13,0,32,18,68,184,30,133,235,81,184,174,63,102,69,13,0,32,20,68,0,0,0,0,0,0,94,64,102,13,1,11,32,19,68,0,0,0,0,0,128,70,64,101,13,0,32,22,68,61,10,215,163,112,61,234,63,102,13,0,65,2,65,2,65,0,32,18,68,10,215,163,112,61,10,231,63,102,27,32,19,68,0,0,0,0,0,32,108,64,102,27,33,5,11,32,3,32,5,54,0,60,32,3,32,0,54,0,56,32,3,32,18,57,0,48,32,3,32,22,57,0,40,32,3,32,20,57,0,32,32,3,32,19,57,0,24,32,3,32,25,57,0,16,32,3,32,24,57,0,8,32,3,32,21,57,0,0,32,3,65,64,107,32,6,41,0,0,55,0,0,32,3,32,6,41,0,8,55,0,72,32,3,32,6,41,0,16,55,0,80,32,3,32,6,41,0,24,55,0,88,32,3,32,6,41,0,32,55,0,96,32,3,32,6,41,0,40,55,0,104,32,3,32,6,41,0,48,55,0,112,32,3,32,6,41,0,56,55,0,120,11,32,4,65,128,204,0,106,36,0,11,160,10,2,4,124,8,127,2,64,32,5,65,0,76,13,0,32,0,69,13,0,32,20,69,13,0,32,3,65,0,71,32,4,65,0,71,113,33,4,2,64,2,64,2,64,32,1,69,13,0,32,2,69,13,0,32,4,4,64,65,0,33,2,3,64,32,21,32,0,32,2,65,2,116,34,4,65,1,114,34,27,106,45,0,0,34,30,32,1,32,27,106,45,0,0,107,34,25,32,25,65,31,117,34,25,115,32,25,107,32,0,32,4,106,45,0,0,34,31,32,1,32,4,106,45,0,0,107,34,25,32,25,65,31,117,34,25,115,32,25,107,106,32,0,32,4,65,2,114,34,25,106,45,0,0,34,32,32,1,32,25,106,45,0,0,107,34,29,32,29,65,31,117,34,29,115,32,29,107,106,184,34,22,160,33,21,32,28,32,6,32,30,32,3,32,27,106,45,0,0,107,34,27,32,27,65,31,117,34,27,115,32,27,107,32,31,32,3,32,4,106,45,0,0,107,34,4,32,4,65,31,117,34,4,115,32,4,107,106,32,32,32,3,32,25,106,45,0,0,107,34,4,32,4,65,31,117,34,4,115,32,4,107,106,184,101,106,33,28,32,26,32,6,32,22,101,106,33,26,32,2,65,1,106,34,2,32,5,71,13,0,11,32,28,184,32,5,184,163,33,6,12,2,11,65,0,33,4,3,64,32,21,32,0,32,4,65,2,116,34,2,65,1,114,34,3,106,45,0,0,32,1,32,3,106,45,0,0,107,34,3,32,3,65,31,117,34,3,115,32,3,107,32,0,32,2,106,45,0,0,32,1,32,2,106,45,0,0,107,34,3,32,3,65,31,117,34,3,115,32,3,107,106,32,0,32,2,65,2,114,34,2,106,45,0,0,32,1,32,2,106,45,0,0,107,34,2,32,2,65,31,117,34,2,115,32,2,107,106,184,34,22,160,33,21,32,26,32,6,32,22,101,106,33,26,32,4,65,1,106,34,4,32,5,71,13,0,11,68,0,0,0,0,0,0,0,0,33,6,12,1,11,32,4,4,124,65,0,33,4,3,64,32,26,32,6,32,0,32,4,65,2,116,34,1,65,1,114,34,2,106,45,0,0,32,2,32,3,106,45,0,0,107,34,2,32,2,65,31,117,34,2,115,32,2,107,32,0,32,1,106,45,0,0,32,1,32,3,106,45,0,0,107,34,2,32,2,65,31,117,34,2,115,32,2,107,106,32,0,32,1,65,2,114,34,1,106,45,0,0,32,1,32,3,106,45,0,0,107,34,1,32,1,65,31,117,34,1,115,32,1,107,106,184,101,106,33,26,32,4,65,1,106,34,4,32,5,71,13,0,11,32,26,184,32,5,184,163,5,68,0,0,0,0,0,0,0,0,11,33,6,12,1,11,32,21,32,5,184,34,21,163,33,24,32,26,183,32,21,163,33,23,11,65,0,33,3,2,64,32,17,69,13,0,32,15,69,13,0,32,16,69,13,0,32,15,42,2,0,187,32,16,42,2,0,187,161,153,32,15,42,2,4,187,32,16,42,2,4,187,161,153,160,32,15,42,2,8,187,32,16,42,2,8,187,161,153,160,32,15,42,2,12,187,32,16,42,2,12,187,161,153,160,32,15,42,2,16,187,32,16,42,2,16,187,161,153,160,32,15,42,2,20,187,32,16,42,2,20,187,161,153,160,32,15,42,2,24,187,32,16,42,2,24,187,161,153,160,32,15,42,2,28,187,32,16,42,2,28,187,161,153,160,32,15,42,2,32,187,32,16,42,2,32,187,161,153,160,32,15,42,2,36,187,32,16,42,2,36,187,161,153,160,32,15,42,2,40,187,32,16,42,2,40,187,161,153,160,32,15,42,2,44,187,32,16,42,2,44,187,161,153,160,32,15,42,2,48,187,32,16,42,2,48,187,161,153,160,32,15,42,2,52,187,32,16,42,2,52,187,161,153,160,32,15,42,2,56,187,32,16,42,2,56,187,161,153,160,32,15,42,2,60,187,32,16,42,2,60,187,161,153,160,68,0,0,0,0,0,0,224,63,162,68,205,204,204,204,204,204,220,63,102,33,3,11,68,0,0,0,0,0,0,0,0,33,22,2,124,68,0,0,0,0,0,0,0,0,32,8,68,0,0,0,0,0,0,0,0,100,69,13,0,26,68,0,0,0,0,0,0,0,0,32,9,69,13,0,26,32,8,32,7,161,32,8,163,11,33,21,2,64,32,11,68,0,0,0,0,0,0,0,0,100,69,13,0,32,12,69,13,0,32,11,32,10,161,32,11,163,33,22,11,32,6,68,51,51,51,51,51,51,227,63,102,34,2,32,21,68,154,153,153,153,153,153,201,63,102,113,33,1,65,0,33,0,2,64,32,2,69,4,64,65,0,33,4,12,1,11,32,10,68,0,0,0,0,0,64,143,64,101,34,2,32,22,68,0,0,0,0,0,0,224,63,102,114,33,4,32,13,68,154,153,153,153,153,153,225,63,101,32,14,68,0,0,0,0,0,128,65,64,101,114,32,3,113,69,13,0,32,2,32,21,68,184,30,133,235,81,184,190,63,102,32,22,68,51,51,51,51,51,51,211,63,102,114,114,33,0,11,32,1,32,4,114,32,0,114,33,2,32,20,32,0,54,0,44,32,20,32,4,54,0,40,32,20,32,1,54,0,36,32,20,32,24,57,0,16,32,20,32,23,57,0,8,32,20,32,6,57,0,0,32,20,32,6,68,51,51,51,51,51,51,227,63,102,54,0,24,32,20,65,1,32,18,65,0,71,34,0,32,2,27,54,0,32,32,20,65,1,32,0,2,127,65,1,32,18,13,0,26,65,1,32,2,13,0,26,32,19,65,0,71,32,21,68,154,153,153,153,153,153,201,63,102,113,11,27,32,0,32,8,68,154,153,153,153,153,153,169,63,102,27,32,0,32,9,27,54,0,28,11,11,6,0,32,0,36,0,11,4,0,35,0,11]);function pt(){let e=[`memory`,`8HOUpzG`,`md_webcam_blockage_analyze`,`4654550YjbSCb`,`width`,`buffer`,`2ZgYCJK`,`980821lLjNBT`,`Instance`,`baselineLuminanceHistogram`,`4UXvCes`,`getFloat64`,`2760063cCvfIL`,`set`,`435720vnEXND`,`63wARHmW`,`image`,`1205725gibzRb`,`colorVariance`,`data`,`baselineFrameData`,`getUint32`,`luminanceEntropy`,`551947KVADyL`,`2677905CmuYQf`];return pt=function(){return e},pt()}(function(e,t){let n=mt,r=e();for(;;)try{if(-parseInt(n(319))/1+parseInt(n(318))/2*(parseInt(n(324))/3)+parseInt(n(322))/4*(-parseInt(n(329))/5)+parseInt(n(326))/6*(parseInt(n(327))/7)+-parseInt(n(313))/8*(parseInt(n(311))/9)+parseInt(n(315))/10+parseInt(n(310))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(pt,569722);function mt(e,t){return e-=310,pt()[e]}var ht=1048576,gt=1056768,_t=1064960,vt=1073152,yt=1081344,bt=1081472,xt=1081600,St=new class{exports;constructor(){let e=mt,t=new WebAssembly.Module(ft),n=new WebAssembly[e(320)](t,{});this.exports=n.exports}analyze(e){let t=mt,n=e[t(316)]*e.height;new Uint8Array(this.exports.memory[t(317)]).set(e.data,ht),this.exports.md_webcam_analyze(ht,e.width,e.height,gt);let r=new DataView(this.exports.memory.buffer),i=new Uint16Array(16),a=new Float32Array(16);for(let e=0;e<i.length;e+=1){let o=r[t(333)](1056832+e*4,!0);i[e]=o,a[e]=o/n}return{edgeDensity:r.getFloat64(1056768,!0),coverage:r.getFloat64(1056776,!0),colorVariance:r.getFloat64(1056784,!0),averageLuminance:r[t(323)](1056792,!0),luminanceSpread:r.getFloat64(1056800,!0),luminanceHistogram:i,normalizedLuminanceHistogram:a,darkRatio:r.getFloat64(1056808,!0),brightRatio:r.getFloat64(1056816,!0),blackout:r[t(333)](1056824,!0)!==0,lightingIssueCode:r.getUint32(1056828,!0)}}analyzeBlockage(e){let t=mt,n=new Uint8Array(this.exports[t(312)].buffer),r=new DataView(this.exports[t(312)].buffer),i=e.image.width*e.image.height;return n.set(e[t(328)][t(331)],ht),e.previousFrameData&&n.set(e.previousFrameData,_t),e.baselineFrameData&&n[t(325)](e[t(332)],vt),Ct(r,yt,e.normalizedLuminanceHistogram),e[t(321)]&&Ct(r,bt,e.baselineLuminanceHistogram),this.exports[t(314)](ht,_t,+!!e.previousFrameData,vt,+!!e.baselineFrameData,i,e.pixelChangeThreshold,e.edgeDensity,e.baselineEdgeDensity??0,e.baselineEdgeDensity===void 0?0:1,e[t(330)],e.baselineColorVariance??0,e.baselineColorVariance===void 0?0:1,e[t(334)],e.luminanceSpread,yt,bt,+!!e.baselineLuminanceHistogram,+!!e.blackout,+!!e.currentlyBlocked,xt),{changedCoverage:r.getFloat64(1081600,!0),previousChangedCoverage:r[t(323)](1081608,!0),frameNoiseAverage:r[t(323)](1081616,!0),hasCoveredArea:r.getUint32(1081624,!0)!==0,detected:r[t(333)](1081628,!0)!==0,likelyCovered:r[t(333)](1081632,!0)!==0}}};function Ct(e,t,n){for(let r=0;r<n.length;r+=1)e.setFloat32(t+r*Float32Array.BYTES_PER_ELEMENT,n[r],!0)}(function(e,t){let n=At,r=e();for(;;)try{if(parseInt(n(198))/1*(-parseInt(n(201))/2)+-parseInt(n(197))/3+-parseInt(n(200))/4+parseInt(n(209))/5*(parseInt(n(199))/6)+parseInt(n(203))/7*(-parseInt(n(202))/8)+-parseInt(n(196))/9+parseInt(n(207))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Ot,415243);var wt=class{context;constructor(){let{context:e}=Dt(`Failed to create webcam frame analysis canvas.`);this.context=e}analyze(e){return Tt(Et(this.context,e))}};function Tt(e){let t=At,n=e.width*e.height,r=St[t(204)](e);return{image:e,pixelCount:n,edgeDensity:r.edgeDensity,coverage:r[t(205)],colorVariance:r.colorVariance,averageLuminance:r.averageLuminance,luminanceSpread:r.luminanceSpread,luminanceEntropy:jt(r.normalizedLuminanceHistogram),luminanceHistogram:r.luminanceHistogram,normalizedLuminanceHistogram:r.normalizedLuminanceHistogram,darkRatio:r.darkRatio,brightRatio:r.brightRatio,blackout:r.blackout,lightingIssueCode:r.lightingIssueCode}}function Et(e,t){return e[At(206)](t,0,0,40,30),e.getImageData(0,0,40,30)}function Dt(e){let t=document.createElement(`canvas`);t.width=40,t.height=30;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(e);return{canvas:t,context:n}}function Ot(){let e=[`905672fDsWsI`,`218MOunEs`,`59632eyFVpb`,`70JIVber`,`analyze`,`coverage`,`drawImage`,`16496990PJsCKg`,`log2`,`5yWXvha`,`3895866yRIhgv`,`1226175uNJGBn`,`4973DdIuPO`,`2700948WXklWy`];return Ot=function(){return e},Ot()}function kt(e){return e.blackout}function At(e,t){return e-=196,Ot()[e]}function jt(e){let t=At,n=0;for(let t of e)t>0&&(n-=t*Math.log2(t));return n/Math[t(208)](e.length)}var m=Ht;(function(e,t){let n=Ht,r=e();for(;;)try{if(-parseInt(n(220))/1*(-parseInt(n(218))/2)+parseInt(n(203))/3*(-parseInt(n(207))/4)+parseInt(n(231))/5+-parseInt(n(233))/6+-parseInt(n(224))/7*(parseInt(n(232))/8)+-parseInt(n(206))/9*(-parseInt(n(219))/10)+parseInt(n(208))/11===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Mt,847412);function Mt(){let e=`blockedStartedAt.refreshBaseline.baselineEdgeDensityUpdatedAt.6382920byQOhP.4753432UUpIfS.2684466WPgxNA.length.normalizedLuminanceHistogram.baselineColorVariance.blocked.adaptivePixelChangeThreshold.31215mumEzD.clearSampleCount.hasCoveredArea.2160gGGEkl.588ufDNpl.7839645MBJHxf.data.baselineEdgeDensity.baselineRefreshPending.finalizeCalibration.updateBaselineEdgeDensity.smoothedEdgeDensity.push.calibrationNoiseSamples.baselineLuminanceHistogram.4KNwFnC.42610KmqxOo.203309YeJCAG.previousFrameData.smoothedEdgeDensityUpdatedAt.baselineFrameData.7YSLmJI.calibrated.now.likelyCovered`.split(`.`);return Mt=function(){return e},Mt()}var Nt=60,Pt=30,Ft=90,It=4,Lt=100,Rt=650,zt=2e3,Bt=2,Vt=2e3;function Ht(e,t){return e-=198,Mt()[e]}var Ut=class{[m(221)];[m(223)];baselineEdgeDensity;[m(230)];[m(200)];[m(217)];[m(214)];smoothedEdgeDensityUpdatedAt;[m(201)]=!1;[m(228)];[m(211)]=!1;clearSampleCount=0;startedAt=Date[m(226)]();calibrated=!1;[m(216)]=[];adaptivePixelChangeThreshold=Nt;analyze(e){let t=m,n=e.image,r=Date.now(),i=r-this.startedAt<Vt,a=this.smoothEdgeDensity(e.edgeDensity,r),o=St.analyzeBlockage({image:n,previousFrameData:this[t(221)],baselineFrameData:this.baselineFrameData,pixelChangeThreshold:this.adaptivePixelChangeThreshold,edgeDensity:a,baselineEdgeDensity:this.baselineEdgeDensity,colorVariance:e.colorVariance,baselineColorVariance:this.baselineColorVariance,luminanceEntropy:e.luminanceEntropy,luminanceSpread:e.luminanceSpread,normalizedLuminanceHistogram:e[t(199)],baselineLuminanceHistogram:this.baselineLuminanceHistogram,blackout:kt(e),currentlyBlocked:this.blocked});return i&&this.previousFrameData?this.calibrationNoiseSamples[t(215)](o.frameNoiseAverage):!i&&!this[t(225)]&&this[t(212)](),this[t(221)]=new Uint8ClampedArray(n[t(209)]),!this[t(223)]&&(this.baselineFrameData=new Uint8ClampedArray(n.data),this.baselineEdgeDensity=a,this.baselineEdgeDensityUpdatedAt=r,this.baselineColorVariance=e.colorVariance,this.baselineLuminanceHistogram=e[t(199)]),i?(this.blockedStartedAt=void 0,this.clearSampleCount=0):o.detected?(this[t(228)]??=r,this.clearSampleCount=0):(this[t(204)]+=1,this.blockedStartedAt=void 0),!this.blocked&&this.blockedStartedAt!==void 0&&r-this.blockedStartedAt>=zt&&(this.blocked=!0),this.blocked&&this[t(204)]>=Bt&&(this[t(201)]=!1,this.baselineRefreshPending=!0),(i||!this.blocked&&!this.baselineRefreshPending&&!o.detected&&!o[t(205)])&&(this.baselineFrameData=new Uint8ClampedArray(n.data),this[t(213)](a,r),this[t(200)]=e.colorVariance,this.baselineLuminanceHistogram=e.normalizedLuminanceHistogram),{blocked:i?!1:this.blocked,suspected:!i&&(this.blocked||this.blockedStartedAt!==void 0),likelyCovered:!i&&(this.blocked||o[t(227)]),changedCoverage:o.changedCoverage}}reset(){let e=m;this.previousFrameData=void 0,this.baselineFrameData=void 0,this.baselineEdgeDensity=void 0,this.baselineEdgeDensityUpdatedAt=void 0,this[e(200)]=void 0,this.baselineLuminanceHistogram=void 0,this.smoothedEdgeDensity=void 0,this.smoothedEdgeDensityUpdatedAt=void 0,this.blocked=!1,this.blockedStartedAt=void 0,this.baselineRefreshPending=!1,this.clearSampleCount=0,this.startedAt=Date.now(),this[e(225)]=!1,this[e(216)]=[],this.adaptivePixelChangeThreshold=Nt}needsBaselineRefresh(){return this.baselineRefreshPending}[m(229)](e){let t=m,n=e.image,r=Date.now(),i=this.smoothEdgeDensity(e.edgeDensity,r);this[t(221)]=new Uint8ClampedArray(n.data),this.baselineFrameData=new Uint8ClampedArray(n.data),this.baselineEdgeDensity=i,this.baselineEdgeDensityUpdatedAt=r,this.baselineColorVariance=e.colorVariance,this[t(217)]=e.normalizedLuminanceHistogram,this.blocked=!1,this[t(228)]=void 0,this.baselineRefreshPending=!1,this.clearSampleCount=0}[m(212)](){let e=m;if(this.calibrated=!0,this.calibrationNoiseSamples[e(198)]===0)return;let t=this.calibrationNoiseSamples.reduce((e,t)=>e+t,0)/this.calibrationNoiseSamples[e(198)];this[e(202)]=Math.min(Ft,Math.max(Pt,t*It))}smoothEdgeDensity(e,t){let n=m;if(this.smoothedEdgeDensity===void 0)return this.smoothedEdgeDensity=e,this[n(222)]=t,e;let r=t-(this[n(222)]??t),i=1-Math.exp(-r/Lt);return this.smoothedEdgeDensity=this.smoothedEdgeDensity*(1-i)+e*i,this[n(222)]=t,this.smoothedEdgeDensity}[m(213)](e,t){let n=m;if(this.baselineEdgeDensity===void 0){this.baselineEdgeDensity=e,this.baselineEdgeDensityUpdatedAt=t;return}let r=t-(this.baselineEdgeDensityUpdatedAt??t),i=1-Math.exp(-r/Rt);this.baselineEdgeDensity=this[n(210)]*(1-i)+e*i,this[n(230)]=t}},Wt=Yt;function Gt(){let e=[`1991936wohJwA`,`brightRatio`,`startedAt`,`14426330URSemN`,`activeIssue`,`8zGOCut`,`issueStartedAt`,`now`,`483324vbTwTe`,`20SYXQaO`,`99435JHmRCJ`,`clearStartedAt`,`352458pFwMqt`,`reset`,`11PQmJZI`,`lightingIssueCode`,`luminanceSpread`,`1694406zLyQoE`,`640725kdmzvC`,`42coNZUs`];return Gt=function(){return e},Gt()}(function(e,t){let n=Yt,r=e();for(;;)try{if(parseInt(n(206))/1+parseInt(n(207))/2*(parseInt(n(198))/3)+parseInt(n(208))/4+-parseInt(n(197))/5*(parseInt(n(196))/6)+parseInt(n(205))/7+-parseInt(n(193))/8*(-parseInt(n(200))/9)+parseInt(n(191))/10*(-parseInt(n(202))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Gt,351125);var Kt=2e3,qt=1500,Jt=2e3;function Yt(e,t){return e-=189,Gt()[e]}var Xt=class{[Wt(190)]=Date.now();issueStartedAt;clearStartedAt;pendingIssue;activeIssue;analyze(e){let t=Wt,n=Date[t(195)](),r=n-this[t(190)]<Kt,i=kt(e),a=i?void 0:this.detectIssue(e);return r||i?(this[t(194)]=void 0,this[t(199)]=void 0,this.pendingIssue=void 0,this.activeIssue=void 0):a?(this.pendingIssue!==a&&(this.pendingIssue=a,this.issueStartedAt=n),this.clearStartedAt=void 0,this.issueStartedAt!==void 0&&n-this.issueStartedAt>=qt&&(this.activeIssue=a)):(this.pendingIssue=void 0,this.issueStartedAt=void 0,this.clearStartedAt??=n,n-this.clearStartedAt>=Jt&&(this.activeIssue=void 0)),{issue:r?void 0:this[t(192)]??a,active:!r&&this.activeIssue!==void 0,averageLuminance:e.averageLuminance,luminanceSpread:e[t(204)],luminanceEntropy:e.luminanceEntropy,darkRatio:e.darkRatio,brightRatio:e[t(189)]}}[Wt(201)](){let e=Wt;this[e(190)]=Date.now(),this.issueStartedAt=void 0,this.clearStartedAt=void 0,this.pendingIssue=void 0,this.activeIssue=void 0}detectIssue(e){if(e[Wt(203)]===1)return`tooDark`;if(e.lightingIssueCode===2)return`tooBright`}},Zt=typeof self<`u`?self:{};function Qt(e,t){t:{for(var n=[`CLOSURE_FLAGS`],r=Zt,i=0;i<n.length;i++)if((r=r[n[i]])==null){n=null;break t}n=r}return(e=n&&n[e])??t}function $t(){throw Error(`Invalid UTF8`)}function en(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var tn,nn,rn=typeof TextDecoder<`u`,an,on=typeof TextEncoder<`u`;function sn(e){if(on)e=(an||=new TextEncoder).encode(e);else{let n=0,r=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)r[n++]=t;else{if(t<2048)r[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let a=e.charCodeAt(++i);if(a>=56320&&a<=57343){t=1024*(t-55296)+a-56320+65536,r[n++]=t>>18|240,r[n++]=t>>12&63|128,r[n++]=t>>6&63|128,r[n++]=63&t|128;continue}i--}t=65533}r[n++]=t>>12|224,r[n++]=t>>6&63|128}r[n++]=63&t|128}}e=n===r.length?r:r.subarray(0,n)}return e}function cn(e){Zt.setTimeout((()=>{throw e}),0)}var ln,un=Qt(610401301,!1),dn=Qt(748402147,!0);function fn(){var e=Zt.navigator;return(e&&=e.userAgent)?e:``}var pn=Zt.navigator;function mn(e){return mn[` `](e),e}ln=pn&&pn.userAgentData||null,mn[` `]=function(){};var hn={},gn=null;function _n(e){let t=e.length,n=3*t/4;n%3?n=Math.floor(n):`=.`.indexOf(e[t-1])!=-1&&(n=`=.`.indexOf(e[t-2])==-1?n-1:n-2);let r=new Uint8Array(n),i=0;return function(e,t){function n(t){for(;r<e.length;){let t=e.charAt(r++),n=gn[t];if(n!=null)return n;if(!/^[\s\xa0]*$/.test(t))throw Error(`Unknown base64 encoding at char: `+t)}return t}vn();let r=0;for(;;){let e=n(-1),r=n(0),i=n(64),a=n(64);if(a===64&&e===-1)break;t(e<<2|r>>4),i!=64&&(t(r<<4&240|i>>2),a!=64&&t(i<<6&192|a))}}(e,(function(e){r[i++]=e})),i===n?r:r.subarray(0,i)}function vn(){if(!gn){gn={};var e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.split(``),t=[`+/=`,`+/`,`-_=`,`-_.`,`-_`];for(let n=0;n<5;n++){let r=e.concat(t[n].split(``));hn[n]=r;for(let e=0;e<r.length;e++){let t=r[e];gn[t]===void 0&&(gn[t]=e)}}}}var yn=typeof Uint8Array<`u`,bn=!(!(un&&ln&&ln.brands.length>0)&&(fn().indexOf(`Trident`)!=-1||fn().indexOf(`MSIE`)!=-1))&&typeof btoa==`function`,xn=/[-_.]/g,Sn={"-":`+`,_:`/`,".":`=`};function Cn(e){return Sn[e]||``}function wn(e){if(!bn)return _n(e);e=xn.test(e)?e.replace(xn,Cn):e,e=atob(e);let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Tn(e){return yn&&e!=null&&e instanceof Uint8Array}var En={};function Dn(){return An||=new kn(null,En)}function On(e){Mn(En);var t=e.g;return(t=t==null||Tn(t)?t:typeof t==`string`?wn(t):null)==null?t:e.g=t}var kn=class{h(){return new Uint8Array(On(this)||0)}constructor(e,t){if(Mn(t),this.g=e,e!=null&&e.length===0)throw Error(`ByteString should be constructed with non-empty values`)}},An,jn;function Mn(e){if(e!==En)throw Error(`illegal external caller`)}function Nn(e,t){e.__closure__error__context__984382||={},e.__closure__error__context__984382.severity=t}function Pn(e){return Nn(e=Error(e),`warning`),e}function Fn(e,t){if(e!=null){var n=jn??={},r=n[e]||0;r>=t||(n[e]=r+1,Nn(e=Error(),`incident`),cn(e))}}function In(){return typeof BigInt==`function`}var Ln=typeof Symbol==`function`&&typeof Symbol()==`symbol`;function Rn(e,t,n=!1){return typeof Symbol==`function`&&typeof Symbol()==`symbol`?n&&Symbol.for&&e?Symbol.for(e):e==null?Symbol():Symbol(e):t}var zn=Rn(`jas`,void 0,!0),Bn=Rn(void 0,`0di`),Vn=Rn(void 0,`1oa`),Hn=Rn(void 0,Symbol()),Un=Rn(void 0,`0ub`),Wn=Rn(void 0,`0ubs`),Gn=Rn(void 0,`0ubsb`),Kn=Rn(void 0,`0actk`),qn=Rn(`m_m`,`Pa`,!0),Jn=Rn(),Yn={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Xn=Object.defineProperties,h=Ln?zn:`Ga`,Zn,Qn=[];function $n(e,t){Ln||h in e||Xn(e,Yn),e[h]|=t}function g(e,t){Ln||h in e||Xn(e,Yn),e[h]=t}function er(e){return $n(e,34),e}function tr(e){return $n(e,8192),e}g(Qn,7),Zn=Object.freeze(Qn);var nr={};function rr(e,t){return t===void 0?e.h!==ir&&!!(2&(0|e.v[h])):!!(2&t)&&e.h!==ir}var ir={};function ar(e,t){if(e!=null){if(typeof e==`string`)e=e?new kn(e,En):Dn();else if(e.constructor!==kn)if(Tn(e))e=e.length?new kn(new Uint8Array(e),En):Dn();else{if(!t)throw Error();e=void 0}}return e}var or=class{constructor(e,t,n){this.g=e,this.h=t,this.l=n}next(){let e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}},sr=Object.freeze({});function cr(e,t,n){let r=128&t?0:-1,i=e.length;var a;(a=!!i)&&(a=(a=e[i-1])!=null&&typeof a==`object`&&a.constructor===Object);let o=i+(a?-1:0);for(t=128&t?1:0;t<o;t++)n(t-r,e[t]);if(a){e=e[i-1];for(let t in e)!isNaN(t)&&n(+t,e[t])}}var lr={};function ur(e){return 128&e?lr:void 0}function dr(e){return e.Na=!0,e}var fr=dr((e=>typeof e==`number`)),pr=dr((e=>typeof e==`string`)),mr=dr((e=>typeof e==`boolean`)),hr=typeof Zt.BigInt==`function`&&typeof Zt.BigInt(0)==`bigint`;function gr(e){var t=e;if(pr(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(fr(t)&&!Number.isSafeInteger(t))throw Error(String(t));return hr?BigInt(e):e=mr(e)?e?`1`:`0`:pr(e)?e.trim()||`0`:String(e)}var _r=dr((e=>hr?e>=yr&&e<=xr:e[0]===`-`?Sr(e,vr):Sr(e,br))),vr=(-(2**53-1)).toString(),yr=hr?BigInt(-(2**53-1)):void 0,br=(2**53-1).toString(),xr=hr?BigInt(2**53-1):void 0;function Sr(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r>i)return!1;if(r<i)return!0}}var Cr=typeof Uint8Array.prototype.slice==`function`,wr,_=0,v=0;function Tr(e){let t=e>>>0;_=t,v=(e-t)/4294967296>>>0}function Er(e){if(e<0){Tr(-e);let[t,n]=Fr(_,v);_=t>>>0,v=n>>>0}else Tr(e)}function Dr(e){let t=wr||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),v=0,_=t.getUint32(0,!0)}function Or(e,t){let n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:jr(e,t)}function kr(e,t){return gr(In()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):jr(e,t))}function Ar(e,t){return In()?gr(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):gr(Nr(e,t))}function jr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=``+(4294967296*t+e);else In()?n=``+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(n=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),n+=8147497*t,t*=2,e>=1e7&&(n+=e/1e7>>>0,e%=1e7),n>=1e7&&(t+=n/1e7>>>0,n%=1e7),n=t+Mr(n)+Mr(e));return n}function Mr(e){return e=String(e),`0000000`.slice(e.length)+e}function Nr(e,t){if(2147483648&t)if(In())e=``+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[n,r]=Fr(e,t);e=`-`+jr(n,r)}else e=jr(e,t);return e}function Pr(e){if(e.length<16)Er(Number(e));else if(In())e=BigInt(e),_=Number(e&BigInt(4294967295))>>>0,v=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]===`-`);v=_=0;let n=e.length;for(let r=t,i=(n-t)%6+t;i<=n;r=i,i+=6){let t=Number(e.slice(r,i));v*=1e6,_=1e6*_+t,_>=4294967296&&(v+=Math.trunc(_/4294967296),v>>>=0,_>>>=0)}if(t){let[e,t]=Fr(_,v);_=e,v=t}}}function Fr(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Ir(e){return Array.prototype.slice.call(e)}var Lr=typeof BigInt==`function`?BigInt.asIntN:void 0,Rr=typeof BigInt==`function`?BigInt.asUintN:void 0,zr=Number.isSafeInteger,Br=Number.isFinite,Vr=Math.trunc,Hr=gr(0);function Ur(e){if(e!=null&&typeof e!=`number`)throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function Wr(e){return e==null||typeof e==`number`?e:e===`NaN`||e===`Infinity`||e===`-Infinity`?Number(e):void 0}function Gr(e){if(e!=null&&typeof e!=`boolean`){var t=typeof e;throw Error(`Expected boolean but got ${t==`object`?e?Array.isArray(e)?`array`:t:`null`:t}: ${e}`)}return e}function Kr(e){return e==null||typeof e==`boolean`?e:typeof e==`number`?!!e:void 0}var qr=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Jr(e){switch(typeof e){case`bigint`:return!0;case`number`:return Br(e);case`string`:return qr.test(e);default:return!1}}function Yr(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return Br(e)?0|e:void 0}function Xr(e){if(e==null)return e;if(typeof e==`string`&&e)e=+e;else if(typeof e!=`number`)return;return Br(e)?e>>>0:void 0}function Zr(e){let t=e.length;return(e[0]===`-`?t<20||t===20&&e<=`-9223372036854775808`:t<19||t===19&&e<=`9223372036854775807`)?e:(Pr(e),Nr(_,v))}function Qr(e){if(e=Vr(e),!zr(e)){Er(e);var t=_,n=v;(e=2147483648&n)&&(n=~n>>>0,(t=1+~t>>>0)==0&&(n=n+1>>>0)),e=typeof(t=Or(t,n))==`number`?e?-t:t:e?`-`+t:t}return e}function $r(e){var t=Vr(Number(e));return zr(t)?String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),Zr(e))}function ei(e){var t=Vr(Number(e));return zr(t)?gr(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),In()?gr(Lr(64,BigInt(e))):gr(Zr(e)))}function ti(e){return zr(e)?e=gr(Qr(e)):(e=Vr(e),zr(e)?e=String(e):(Er(e),e=Nr(_,v)),e=gr(e)),e}function ni(e){let t=typeof e;return e==null?e:t===`bigint`?gr(Lr(64,e)):Jr(e)?t===`string`?ei(e):ti(e):void 0}function ri(e){if(typeof e!=`string`)throw Error();return e}function ii(e){if(e!=null&&typeof e!=`string`)throw Error();return e}function y(e){return e==null||typeof e==`string`?e:void 0}function ai(e,t,n,r){return e!=null&&e[qn]===nr?e:Array.isArray(e)?((r=(n=0|e[h])|32&r|2&r)!==n&&g(e,r),new t(e)):(n?2&r?((e=t[Bn])||(er((e=new t).v),e=t[Bn]=e),t=e):t=new t:t=void 0,t)}function oi(e,t,n){if(t)t:{if(!Jr(t=e))throw Pn(`int64`);switch(typeof t){case`string`:t=ei(t);break t;case`bigint`:t=gr(Lr(64,t));break t;default:t=ti(t)}}else t=ni(e);return(e=t)??(n?Hr:void 0)}var si={},ci=function(){try{return mn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),li=class{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,t){return this.g.set(e,t),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,t){return this.g.forEach(e,t)}[Symbol.iterator](){return this.entries()}},ui=ci?(Object.setPrototypeOf(li.prototype,Map.prototype),Object.defineProperties(li.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),li):class extends Map{constructor(){super()}};function di(e){return e}function fi(e){if(2&e.J)throw Error(`Cannot mutate an immutable Map`)}var pi=class extends ui{constructor(e,t,n=di,r=di){super(),this.J=0|e[h],this.K=t,this.S=n,this.fa=this.K?mi:r;for(let i=0;i<e.length;i++){let a=e[i],o=n(a[0],!1,!0),s=a[1];t?s===void 0&&(s=null):s=r(a[1],!1,!0,void 0,void 0,this.J),super.set(o,s)}}V(e){return tr(Array.from(super.entries(),e))}clear(){fi(this),super.clear()}delete(e){return fi(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new or(e,hi,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new or(e,pi.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((n,r,i)=>{e.call(t,i.get(r),r,i)})):super.forEach(e,t)}set(e,t){return fi(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var n=this.K;return n?((n=this.fa(t,!1,!0,n,this.ra,this.J))!==t&&super.set(e,n),n):t}}[Symbol.iterator](){return this.entries()}};function mi(e,t,n,r,i,a){return e=ai(e,r,n,a),i&&(e=Ii(e)),e}function hi(e){return[e,this.get(e)]}var gi;function _i(){return gi||=new pi(er([]),void 0,void 0,void 0,si)}function vi(e){return Hn?e[Hn]:void 0}function yi(e,t){for(let n in e)!isNaN(n)&&t(e,+n,e[n])}pi.prototype.toJSON=void 0;var bi=class{},xi={Ka:!0};function Si(e,t){t<100||Fn(Wn,1)}function Ci(e,t,n,r){let i=r!==void 0;r=!!r;var a,o=Hn;!i&&Ln&&o&&(a=e[o])&&yi(a,Si),o=[];var s=e.length;let c;a=4294967295;let l=!1,u=!!(64&t),d=u?128&t?0:-1:void 0;1&t||(c=s&&e[s-1],typeof c==`object`&&c&&c.constructor===Object?a=--s:c=void 0,!u||128&t||i||(l=!0,a=a-d+d)),t=void 0;for(var ee=0;ee<s;ee++){let i=e[ee];if(i!=null&&(i=n(i,r))!=null)if(u&&ee>=a){let e=ee-d;(t??={})[e]=i}else o[ee]=i}if(c)for(let e in c){if((s=c[e])==null||(s=n(s,r))==null)continue;let i;ee=+e,u&&!Number.isNaN(ee)&&(i=ee+d)<a?o[i]=s:(t??={})[e]=s}return t&&(l?o.push(t):o[a]=t),i&&Hn&&(e=vi(e))&&e instanceof bi&&(o[Hn]=function(e){let t=new bi;return yi(e,((e,n,r)=>{t[n]=Ir(r)})),t.da=e.da,t}(e)),o}function wi(e){return e[0]=Ti(e[0]),e[1]=Ti(e[1]),e}function Ti(e){switch(typeof e){case`number`:return Number.isFinite(e)?e:``+e;case`bigint`:return _r(e)?Number(e):``+e;case`boolean`:return+!!e;case`object`:if(Array.isArray(e)){var t=0|e[h];return e.length===0&&1&t?void 0:Ci(e,t,Ti)}if(e!=null&&e[qn]===nr)return Oi(e);if(e instanceof kn){if((t=e.g)==null)e=``;else if(typeof t==`string`)e=t;else{if(bn){for(var n=``,r=0,i=t.length-10240;r<i;)n+=String.fromCharCode.apply(null,t.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?t.subarray(r):t),t=btoa(n)}else{n===void 0&&(n=0),vn(),n=hn[n],r=Array(Math.floor(t.length/3)),i=n[64]||``;let e=0,l=0;for(;e<t.length-2;e+=3){var a=t[e],o=t[e+1],s=t[e+2],c=n[a>>2];a=n[(3&a)<<4|o>>4],o=n[(15&o)<<2|s>>6],s=n[63&s],r[l++]=c+a+o+s}switch(c=0,s=i,t.length-e){case 2:s=n[(15&(c=t[e+1]))<<2]||i;case 1:t=t[e],r[l]=n[t>>2]+n[(3&t)<<4|c>>4]+s+i}t=r.join(``)}e=e.g=t}return e}return e instanceof pi?e=e.size===0?void 0:e.V(wi):void 0}return e}var Ei,Di;function Oi(e){return Ci(e=e.v,0|e[h],Ti)}function ki(e,t){return Ai(e,t[0],t[1])}function Ai(e,t,n,r=0){if(e==null){var i=32;n?(e=[n],i|=128):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error(`narr`);if(i=0|e[h],dn&&1&i)throw Error(`rfarr`);if(2048&i&&!(2&i)&&function(){if(dn)throw Error(`carr`);Fn(Kn,5)}(),256&i)throw Error(`farr`);if(64&i)return(i|r)!==i&&g(e,i|r),e;if(n&&(i|=128,n!==e[0]))throw Error(`mid`);t:{i|=64;var a=(n=e).length;if(a){var o=a-1;let e=n[o];if(typeof e==`object`&&e&&e.constructor===Object){if((o-=t=128&i?0:-1)>=1024)throw Error(`pvtlmt`);for(var s in e)(a=+s)<o&&(n[a+t]=e[s],delete e[s]);i=-16760833&i|(1023&o)<<14;break t}}if(t){if((s=Math.max(t,a-(128&i?0:-1)))>1024)throw Error(`spvt`);i=-16760833&i|(1023&s)<<14}}}return g(e,64|i|r),e}function ji(e,t){if(typeof e!=`object`)return e;if(Array.isArray(e)){var n=0|e[h];return e.length===0&&1&n?void 0:Mi(e,n,t)}if(e!=null&&e[qn]===nr)return Pi(e);if(e instanceof pi){if(2&(t=e.J))return e;if(!e.size)return;if(n=er(e.V()),e.K)for(e=0;e<n.length;e++){let r=n[e],i=r[1];i=typeof i!=`object`||!i?void 0:i!=null&&i[qn]===nr?Pi(i):Array.isArray(i)?Mi(i,0|i[h],!!(32&t)):void 0,r[1]=i}return n}return e instanceof kn?e:void 0}function Mi(e,t,n){return 2&t||(!n||4096&t||16&t?e=Fi(e,t,!1,n&&!(16&t)):($n(e,34),4&t&&Object.freeze(e))),e}function Ni(e,t,n){return e=new e.constructor(t),n&&(e.h=ir),e.m=ir,e}function Pi(e){let t=e.v,n=0|t[h];return rr(e,n)?e:Bi(e,t,n)?Ni(e,t):Fi(t,n)}function Fi(e,t,n,r){return r??=!!(34&t),e=Ci(e,t,ji,r),r=32,n&&(r|=2),g(e,t=16769217&t|r),e}function Ii(e){let t=e.v,n=0|t[h];return rr(e,n)?Bi(e,t,n)?Ni(e,t,!0):new e.constructor(Fi(t,n,!1)):e}function Li(e){if(e.h!==ir)return!1;var t=e.v;return $n(t=Fi(t,0|t[h]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Ri(e){if(!Li(e)&&rr(e,0|e.v[h]))throw Error()}function zi(e,t){t===void 0&&(t=0|e[h]),32&t&&!(4096&t)&&g(e,4096|t)}function Bi(e,t,n){return!!(2&n)||!(!(32&n)||4096&n)&&(g(t,2|n),e.h=ir,!0)}var Vi=gr(0),Hi={};function b(e,t,n,r,i){if((t=Ui(e.v,t,n,i))!==null||r&&e.m!==ir)return t}function Ui(e,t,n,r){if(t===-1)return null;let i=t+(n?0:-1),a=e.length-1,o,s;if(!(a<1+(n?0:-1))){if(i>=a)if(o=e[a],typeof o==`object`&&o&&o.constructor===Object)n=o[t],s=!0;else{if(i!==a)return;n=o}else n=e[i];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return s?o[t]=r:e[i]=r,r}return n}}function x(e,t,n,r){Ri(e),S(e=e.v,0|e[h],t,n,r)}function S(e,t,n,r,i){let a=n+(i?0:-1);var o=e.length-1;if(o>=1+(i?0:-1)&&a>=o){let i=e[o];if(typeof i==`object`&&i&&i.constructor===Object)return i[n]=r,t}return a<=o?(e[a]=r,t):(r!==void 0&&(n>=(o=(t??=0|e[h])>>14&1023||536870912)?r!=null&&(e[o+(i?0:-1)]={[n]:r}):e[a]=r),t)}function Wi(){return sr===void 0?2:4}function Gi(e,t,n,r,i){let a=e.v,o=0|a[h];r=rr(e,o)?1:r,i=!!i||r===3,r===2&&Li(e)&&(a=e.v,o=0|a[h]);let s=(e=qi(a,t))===Zn?7:0|e[h],c=Ji(s,o);var l=!(4&c);if(l){4&c&&(e=Ir(e),s=0,c=ua(c,o),o=S(a,o,t,e));let r=0,i=0;for(;r<e.length;r++){let t=n(e[r]);t!=null&&(e[i++]=t)}i<r&&(e.length=i),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==s&&(g(e,c),2&c&&Object.freeze(e)),Ki(e,c,a,o,t,r,l,i)}function Ki(e,t,n,r,i,a,o,s){let c=t;return a===1||a===4&&(2&t||!(16&t)&&32&r)?Yi(t)||((t|=!e.length||o&&!(4096&t)||32&r&&!(4096&t||16&t)?2:256)!==c&&g(e,t),Object.freeze(e)):(a===2&&Yi(t)&&(e=Ir(e),c=0,t=ua(t,r),r=S(n,r,i,e)),Yi(t)||(s||(t|=16),t!==c&&g(e,t))),2&t||!(4096&t||16&t)||zi(n,r),e}function qi(e,t,n){return e=Ui(e,t,n),Array.isArray(e)?e:Zn}function Ji(e,t){return 2&t&&(e|=2),1|e}function Yi(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Xi(e){return ar(e,!0)}function Zi(e){e=Ir(e);for(let t=0;t<e.length;t++){let n=e[t]=Ir(e[t]);Array.isArray(n[1])&&(n[1]=er(n[1]))}return tr(e)}function Qi(e,t,n,r){Ri(e),S(e=e.v,0|e[h],t,(r===`0`?Number(n)===0:n===r)?void 0:n)}function $i(e,t,n){if(2&t)throw Error();let r=ur(t),i=qi(e,n,r),a=i===Zn?7:0|i[h],o=Ji(a,t);return(2&o||Yi(o)||16&o)&&(o===a||Yi(o)||g(i,o),i=Ir(i),a=0,o=ua(o,t),S(e,t,n,i,r)),o&=-13,o!==a&&g(i,o),i}function ea(e,t){var n=cc;return ra(ta(e=e.v),e,void 0,n)===t?t:-1}function ta(e){if(Ln)return e[Vn]??(e[Vn]=new Map);if(Vn in e)return e[Vn];let t=new Map;return Object.defineProperty(e,Vn,{value:t}),t}function na(e,t,n,r,i){let a=ta(e),o=ra(a,e,t,n,i);return o!==r&&(o&&(t=S(e,t,o,void 0,i)),a.set(n,r)),t}function ra(e,t,n,r,i){let a=e.get(r);if(a!=null)return a;a=0;for(let e=0;e<r.length;e++){let o=r[e];Ui(t,o,i)!=null&&(a!==0&&(n=S(t,n,a,void 0,i)),a=o)}return e.set(r,a),a}function ia(e,t,n){let r=0|e[h],i=ur(r),a=Ui(e,n,i),o;if(a!=null&&a[qn]===nr){if(!rr(a))return Li(a),a.v;o=a.v}else Array.isArray(a)&&(o=a);if(o){let e=0|o[h];2&e&&(o=Fi(o,e))}return o=ki(o,t),o!==a&&S(e,r,n,o,i),o}function aa(e,t,n,r,i){let a=!1;if((r=Ui(e,r,i,(e=>{let r=ai(e,n,!1,t);return a=r!==e&&r!=null,r})))!=null)return a&&!rr(r)&&zi(e,t),r}function C(e,t,n,r){let i=e.v,a=0|i[h];if((t=aa(i,a,t,n,r))==null)return t;if(a=0|i[h],!rr(e,a)){let o=Ii(t);o!==t&&(Li(e)&&(i=e.v,a=0|i[h]),a=S(i,a,n,t=o,r),zi(i,a))}return t}function oa(e,t,n,r,i,a,o,s){var c=rr(e,n);a=c?1:a,o=!!o||a===3,c=s&&!c,(a===2||c)&&Li(e)&&(n=0|(t=e.v)[h]);var l=(e=qi(t,i))===Zn?7:0|e[h],u=Ji(l,n);if(s=!(4&u)){var d=e,ee=n;let t=!!(2&u);t&&(ee|=2);let i=!t,a=!0,o=0,s=0;for(;o<d.length;o++){let e=ai(d[o],r,!1,ee);if(e instanceof r){if(!t){let t=rr(e);i&&=!t,a&&=t}d[s++]=e}}s<o&&(d.length=s),u|=4,u=a?-4097&u:4096|u,u=i?8|u:-9&u}if(u!==l&&(g(e,u),2&u&&Object.freeze(e)),c&&!(8&u||!e.length&&(a===1||a===4&&(2&u||!(16&u)&&32&n)))){for(Yi(u)&&(e=Ir(e),u=ua(u,n),n=S(t,n,i,e)),r=e,c=u,l=0;l<r.length;l++)(d=r[l])!==(u=Ii(d))&&(r[l]=u);c|=8,g(e,u=c=r.length?4096|c:-4097&c)}return Ki(e,u,t,n,i,a,s,o)}function sa(e,t,n){let r=e.v;return oa(e,r,0|r[h],t,n,Wi(),!1,!0)}function ca(e){return e??=void 0,e}function w(e,t,n,r,i){return x(e,n,r=ca(r),i),r&&!rr(r)&&zi(e.v),e}function la(e,t,n,r){t:{var i=r=ca(r);Ri(e);let a=e.v,o=0|a[h];if(i==null){let e=ta(a);if(ra(e,a,o,n)!==t)break t;e.set(n,0)}else o=na(a,o,n,t);S(a,o,t,i)}r&&!rr(r)&&zi(e.v)}function ua(e,t){return-273&(2&t?2|e:-3&e)}function da(e,t,n,r){var i=r;Ri(e),e=oa(e,r=e.v,0|r[h],n,t,2,!0),i??=new n,e.push(i),t=n=e===Zn?7:0|e[h],(i=rr(i))?(n&=-9,e.length===1&&(n&=-4097)):n|=4096,n!==t&&g(e,n),i||zi(r)}function fa(e,t,n){return Yr(b(e,t,void 0,n))}function T(e,t){return b(e,t,void 0,void 0,Wr)??0}function pa(e,t,n){if(n!=null){if(typeof n!=`number`||!Br(n))throw Pn(`int32`);n|=0}x(e,t,n)}function E(e,t,n){x(e,t,Ur(n))}function ma(e,t,n){Qi(e,t,ii(n),``)}function ha(e,t,n){{Ri(e);let o=e.v,s=0|o[h];if(n==null)S(o,s,t);else{var r=e=n===Zn?7:0|n[h],i=Yi(e),a=i||Object.isFrozen(n);for(i||(e=0),a||=(n=Ir(n),r=0,e=ua(e,s),!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??1024,i=0;i<n.length;i++){let t=n[i],o=ri(t);Object.is(t,o)||(a&&=(n=Ir(n),r=0,e=ua(e,s),!1),n[i]=o)}e!==r&&(a&&(n=Ir(n),e=ua(e,s)),g(n,e)),S(o,s,t,n)}}}function ga(e,t,n){Ri(e),Gi(e,t,y,2,!0).push(ri(n))}var _a=class{constructor(e,t,n){if(this.buffer=e,n&&!t)throw Error();this.g=t}};function va(e,t){if(typeof e==`string`)return new _a(wn(e),t);if(Array.isArray(e))return new _a(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new _a(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new _a(e,!1);if(e.constructor===kn)return t=On(e)||new Uint8Array,new _a(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new _a(e,!1);throw Error()}function ya(e,t){let n,r=0,i=0,a=0,o=e.h,s=e.g;do n=o[s++],r|=(127&n)<<a,a+=7;while(a<32&&128&n);if(a>32)for(i|=(127&n)>>4,a=3;a<32&&128&n;a+=7)n=o[s++],i|=(127&n)<<a;if(Ta(e,s),!(128&n))return t(r>>>0,i>>>0);throw Error()}function ba(e){let t=0,n=e.g,r=n+10,i=e.h;for(;n<r;){let r=i[n++];if(t|=r,!(128&r))return Ta(e,n),!!(127&t)}throw Error()}function xa(e){let t=e.h,n=e.g,r=t[n++],i=127&r;if(128&r&&(r=t[n++],i|=(127&r)<<7,128&r&&(r=t[n++],i|=(127&r)<<14,128&r&&(r=t[n++],i|=(127&r)<<21,128&r&&(r=t[n++],i|=r<<28,128&r&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw Error();return Ta(e,n),i}function Sa(e){return xa(e)>>>0}function Ca(e){var t=e.h;let n=e.g;var r=t[n],i=t[n+1];let a=t[n+2];return t=t[n+3],Ta(e,e.g+4),e=2*((i=(r<<0|i<<8|a<<16|t<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,r==255?i?NaN:e*(1/0):r==0?1401298464324817e-60*e*i:e*2**(r-150)*(i+8388608)}function wa(e){return xa(e)}function Ta(e,t){if(e.g=t,t>e.l)throw Error()}function Ea(e,t){if(t<0)throw Error();let n=e.g;if((t=n+t)>e.l)throw Error();return e.g=t,n}function Da(e,t){if(t==0)return Dn();var n=Ea(e,t);return e.Y&&e.j?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array:Cr?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?Dn():new kn(n,En)}var Oa=[];function ka(e,t,n,r){if(Ra.length){let i=Ra.pop();return i.o(r),i.g.init(e,t,n,r),i}return new La(e,t,n,r)}function Aa(e){e.g.clear(),e.l=-1,e.h=-1,Ra.length<100&&Ra.push(e)}function ja(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=Sa(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function Ma(e){switch(e.h){case 0:e.h==0?ba(e.g):Ma(e);break;case 1:Ta(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ma(e);else{var t=Sa(e.g);Ta(e=e.g,e.g+t)}break;case 5:Ta(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!ja(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Ma(e)}break;default:throw Error()}}function Na(e,t,n){let r=e.g.l;var i=Sa(e.g);let a=(i=e.g.g+i)-r;if(a<=0&&(e.g.l=i,n(t,e,void 0,void 0,void 0),a=i-e.g.g),a)throw Error();return e.g.g=i,e.g.l=r,t}function Pa(e){var t=Sa(e.g),n=Ea(e=e.g,t);if(e=e.h,rn){var r,i=e;(r=nn)||(r=nn=new TextDecoder(`utf-8`,{fatal:!0})),t=n+t,i=n===0&&t===i.length?i:i.subarray(n,t);try{var a=r.decode(i)}catch(e){if(tn===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),tn=!0}catch{tn=!1}}throw!tn&&(nn=void 0),e}}else{t=(a=n)+t,n=[];let s,c=null;for(;a<t;){var o=e[a++];o<128?n.push(o):o<224?a>=t?$t():(s=e[a++],o<194||(192&s)!=128?(a--,$t()):n.push((31&o)<<6|63&s)):o<240?a>=t-1?$t():(s=e[a++],(192&s)!=128||o===224&&s<160||o===237&&s>=160||(192&(r=e[a++]))!=128?(a--,$t()):n.push((15&o)<<12|(63&s)<<6|63&r)):o<=244?a>=t-2?$t():(s=e[a++],(192&s)!=128||s-144+(o<<28)>>30||(192&(r=e[a++]))!=128||(192&(i=e[a++]))!=128?(a--,$t()):(o=(7&o)<<18|(63&s)<<12|(63&r)<<6|63&i,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):$t(),n.length>=8192&&(c=en(c,n),n.length=0)}a=en(c,n)}return a}function Fa(e){let t=Sa(e.g);return Da(e.g,t)}function Ia(e,t,n){var r=Sa(e.g);for(r=e.g.g+r;e.g.g<r;)n.push(t(e.g))}var La=class{constructor(e,t,n,r){if(Oa.length){let i=Oa.pop();i.init(e,t,n,r),e=i}else e=new class{constructor(e,t,n,r){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(e,t,n,r)}init(e,t,n,{Y:r=!1,ea:i=!1}={}){this.Y=r,this.ea=i,e&&(e=va(e,this.ea),this.h=e.buffer,this.j=e.g,this.m=t||0,this.l=n===void 0?this.h.length:this.m+n,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,n,r);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:e=!1}={}){this.ha=e}},Ra=[];function za(e){return e?/^\d+$/.test(e)?(Pr(e),new Ba(_,v)):null:Va||=new Ba(0,0)}var Ba=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Va;function Ha(e){return e?/^-?\d+$/.test(e)?(Pr(e),new Ua(_,v)):null:Wa||=new Ua(0,0)}var Ua=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Wa;function Ga(e,t,n){for(;n>0||t>127;)e.g.push(127&t|128),t=(t>>>7|n<<25)>>>0,n>>>=7;e.g.push(t)}function Ka(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function qa(e,t){if(t>=0)Ka(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Ja(e){var t=_;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Ya(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Xa(e,t,n){Ka(e.g,8*t+n)}function Za(e,t){return Xa(e,t,2),t=e.g.end(),Ya(e,t),t.push(e.h),t}function Qa(e,t){var n=t.pop();for(n=e.h+e.g.length()-n;n>127;)t.push(127&n|128),n>>>=7,e.h++;t.push(n),e.h++}function $a(e,t,n){Xa(e,t,2),Ka(e.g,n.length),Ya(e,e.g.end()),Ya(e,n)}function eo(e,t,n,r){n!=null&&(t=Za(e,t),r(n,e),Qa(e,t))}function to(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var no=to(),ro=to(),io=to(),ao=to(),oo=to(),so=to(),co=to(),lo=to(),uo=to(),fo=to();function po(e,t,n){var r=e.v;Hn&&Hn in r&&(r=r[Hn])&&delete r[t.g],t.h?t.j(e,t.h,t.g,n,t.l):t.j(e,t.g,n,t.l)}var D=class{constructor(e,t){this.v=Ai(e,t,void 0,2048)}toJSON(){return Oi(this)}j(){var e=Qc,t=this.v,n=e.g,r=Hn;if(Ln&&r&&t[r]?.[n]!=null&&Fn(Un,3),t=e.g,Jn&&Hn&&Jn===void 0&&(r=(n=this.v)[Hn])&&(r=r.da))try{r(n,t,xi)}catch(e){cn(e)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){let e=this.v,t=0|e[h];return Bi(this,e,t)?Ni(this,e,!0):new this.constructor(Fi(e,t,!1))}};D.prototype[qn]=nr,D.prototype.toString=function(){return this.v.toString()};var mo=class{constructor(e,t,n){this.g=e,this.h=t,e=no,this.l=!!e&&n===e||!1}};function ho(e,t){return new mo(e,t,no)}function go(e,t,n,r,i){eo(e,n,Oo(t,r),i)}var _o=ho((function(e,t,n,r,i){return e.h===2&&(Na(e,ia(t,r,n),i),!0)}),go),vo=ho((function(e,t,n,r,i){return e.h===2&&(Na(e,ia(t,r,n),i),!0)}),go),yo=Symbol(),bo=Symbol(),xo=Symbol(),So=Symbol(),Co=Symbol(),wo,To;function Eo(e,t,n,r){var i=r[e];if(i)return i;(i={}).qa=r,i.T=function(e){switch(typeof e){case`boolean`:return Ei||=[0,void 0,!0];case`number`:return e>0?void 0:e===0?Di||=[0,void 0]:[-e,void 0];case`string`:return[0,e];case`object`:return e}}(r[0]);var a=r[1];let o=1;a&&a.constructor===Object&&(i.ba=a,typeof(a=r[++o])==`function`&&(i.ma=!0,wo??=a,To??=r[o+1],a=r[o+=2]));let s={};for(;a&&Array.isArray(a)&&a.length&&typeof a[0]==`number`&&a[0]>0;){for(var c=0;c<a.length;c++)s[a[c]]=a;a=r[++o]}for(c=1;a!==void 0;){let e;typeof a==`number`&&(c+=a,a=r[++o]);var l=void 0;if(a instanceof mo?e=a:(e=_o,o--),e?.l){a=r[++o],l=r;var u=o;typeof a==`function`&&(a=a(),l[u]=a),l=a}for(u=c+1,typeof(a=r[++o])==`number`&&a<0&&(u-=a,a=r[++o]);c<u;c++){let r=s[c];l?n(i,c,e,l,r):t(i,c,e,r)}}return r[e]=i}function Do(e){return Array.isArray(e)?e[0]instanceof mo?e:[vo,e]:[e,void 0]}function Oo(e,t){return e instanceof D?e.v:Array.isArray(e)?ki(e,t):void 0}function ko(e,t,n,r){let i=n.g;e[t]=r?(e,t,n)=>i(e,t,n,r):i}function Ao(e,t,n,r,i){let a=n.g,o,s;e[t]=(e,t,n)=>a(e,t,n,s||=Eo(bo,ko,Ao,r).T,o||=jo(r),i)}function jo(e){let t=e[xo];if(t!=null)return t;let n=Eo(bo,ko,Ao,e);return t=n.ma?(e,t)=>wo(e,t,n):(e,t)=>{for(;ja(t)&&t.h!=4;){var r=t.l,i=n[r];if(i==null){var a=n.ba;(a&&=a[r])&&(a=No(a))!=null&&(i=n[r]=a)}if(i==null||!i(t,e,r)){if(i=(a=t).m,Ma(a),a.ha)var o=void 0;else o=a.g.g-i,a.g.g=i,o=Da(a.g,o);i=void 0,a=e,o&&((i=a[Hn]??(a[Hn]=new bi))[r]??(i[r]=[])).push(o)}}return(e=vi(e))&&(e.da=n.qa[Co]),!0},e[xo]=t,e[Co]=Mo.bind(e),t}function Mo(e,t,n,r){var i=this[bo];let a=this[xo],o=ki(void 0,i.T),s=vi(e);if(s){var c=!1,l=i.ba;if(l){if(i=(t,n,i)=>{if(i.length!==0)if(l[n])for(let e of i){t=ka(e);try{c=!0,a(o,t)}finally{Aa(t)}}else r?.(e,n,i)},t==null)yi(s,i);else if(s!=null){let e=s[t];e&&i(s,t,e)}if(c){let r=0|e[h];if(2&r&&2048&r&&!n?.Ka)throw Error();let i=ur(r),a=(t,a)=>{if(Ui(e,t,i)!=null){if(n?.Qa===1)return;throw Error()}a!=null&&(r=S(e,r,t,a,i)),delete s[t]};t==null?cr(o,0|o[h],((e,t)=>{a(e,t)})):a(t,Ui(o,t,i))}}}}function No(e){let t=(e=Do(e))[0].g;if(e=e[1]){let n=jo(e),r=Eo(bo,ko,Ao,e).T;return(e,i,a)=>t(e,i,a,r,n)}return t}function Po(e,t,n){e[t]=n.h}function Fo(e,t,n,r){let i,a,o=n.h;e[t]=(e,t,n)=>o(e,t,n,a||=Eo(yo,Po,Fo,r).T,i||=Io(r))}function Io(e){let t=e[So];if(!t){let n=Eo(yo,Po,Fo,e);t=(e,t)=>Lo(e,t,n),e[So]=t}return t}function Lo(e,t,n){cr(e,0|e[h],((e,r)=>{if(r!=null){var i=function(e,t){var n=e[t];if(n)return n;if((n=e.ba)&&(n=n[t])){var r=(n=Do(n))[0].h;if(n=n[1]){let t=Io(n),i=Eo(yo,Po,Fo,n).T;n=e.ma?To(i,t):(e,n,a)=>r(e,n,a,i,t)}else n=r;return e[t]=n}}(n,e);i?i(t,r,e):e<500||Fn(Gn,3)}})),(e=vi(e))&&yi(e,((e,n,r)=>{for(Ya(t,t.g.end()),e=0;e<r.length;e++)Ya(t,On(r[e])||new Uint8Array)}))}var Ro=gr(0);function zo(e,t){if(Array.isArray(t)){var n=0|t[h];if(4&n)return t;for(var r=0,i=0;r<t.length;r++){let n=e(t[r]);n!=null&&(t[i++]=n)}return i<r&&(t.length=i),(e=-1537&(5|n))!==n&&g(t,e),2&e&&Object.freeze(t),t}}function Bo(e,t,n){return new mo(e,t,n)}function Vo(e,t,n){return new mo(e,t,n)}function Ho(e,t,n){S(e,0|e[h],t,n,ur(0|e[h]))}var Uo=ho((function(e,t,n,r,i){if(e.h!==2)return!1;if(e=Ir(e=Na(e,ki([void 0,void 0],r),i)),i=ur(r=0|t[h]),2&r)throw Error();let a=Ui(t,n,i);if(a instanceof pi)2&a.J?(a=a.V(),a.push(e),S(t,r,n,a,i)):a.Ma(e);else if(Array.isArray(a)){var o=0|a[h];8192&o||g(a,o|=8192),2&o&&(a=Zi(a),S(t,r,n,a,i)),a.push(e)}else S(t,r,n,tr([e]),i);return!0}),(function(e,t,n,r,i){if(t instanceof pi)t.forEach(((t,a)=>{eo(e,n,ki([a,t],r),i)}));else if(Array.isArray(t)){for(let a=0;a<t.length;a++){let o=t[a];Array.isArray(o)&&eo(e,n,ki(o,r),i)}tr(t)}}));function Wo(e,t,n){(t=Wr(t))!=null&&(Xa(e,n,5),e=e.g,Dr(t),Ja(e))}function Go(e,t,n){if(t=function(e){if(e==null)return e;let t=typeof e;if(t===`bigint`)return String(Lr(64,e));if(Jr(e)){if(t===`string`)return $r(e);if(t===`number`)return Qr(e)}}(t),t!=null&&(typeof t==`string`&&Ha(t),t!=null))switch(Xa(e,n,0),typeof t){case`number`:e=e.g,Er(t),Ga(e,_,v);break;case`bigint`:n=BigInt.asUintN(64,t),n=new Ua(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ga(e.g,n.h,n.g);break;default:n=Ha(t),Ga(e.g,n.h,n.g)}}function Ko(e,t,n){(t=Yr(t))!=null&&t!=null&&(Xa(e,n,0),qa(e.g,t))}function qo(e,t,n){(t=Kr(t))!=null&&(Xa(e,n,0),e.g.g.push(+!!t))}function Jo(e,t,n){(t=y(t))!=null&&$a(e,n,sn(t))}function Yo(e,t,n,r,i){eo(e,n,Oo(t,r),i)}function Xo(e,t,n){(t=t==null||typeof t==`string`||t instanceof kn?t:void 0)!=null&&$a(e,n,va(t,!0).buffer)}function Zo(e,t,n){(t=Xr(t))!=null&&t!=null&&(Xa(e,n,0),Ka(e.g,t))}function Qo(e,t,n){return(e.h===5||e.h===2)&&(t=$i(t,0|t[h],n),e.h==2?Ia(e,Ca,t):t.push(Ca(e.g)),!0)}var O=Bo((function(e,t,n){return e.h===5&&(Ho(t,n,Ca(e.g)),!0)}),Wo,lo),$o=Vo(Qo,(function(e,t,n){if((t=zo(Wr,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(Xa(r,i,5),r=r.g,Dr(a),Ja(r))}}),lo),es=Vo(Qo,(function(e,t,n){if((t=zo(Wr,t))!=null&&t.length){Xa(e,n,2),Ka(e.g,4*t.length);for(let r=0;r<t.length;r++)n=e.g,Dr(t[r]),Ja(n)}}),lo),ts=Bo((function(e,t,n){return e.h===5&&(Ho(t,n,(e=Ca(e.g))===0?void 0:e),!0)}),Wo,lo),ns=Bo((function(e,t,n){return e.h===0?(Ho(t,n,ya(e.g,Ar)),e=!0):e=!1,e}),Go,so),rs=Bo((function(e,t,n){return e.h===0?(Ho(t,n,(e=ya(e.g,Ar))===Ro?void 0:e),t=!0):t=!1,t}),Go,so),is=Bo((function(e,t,n){return e.h===0?(Ho(t,n,ya(e.g,kr)),e=!0):e=!1,e}),(function(e,t,n){if(t=function(e){if(e==null)return e;var t=typeof e;if(t===`bigint`)return String(Rr(64,e));if(Jr(e)){if(t===`string`)return t=Vr(Number(e)),zr(t)&&t>=0?e=String(t):((t=e.indexOf(`.`))!==-1&&(e=e.substring(0,t)),(t=e[0]!==`-`&&((t=e.length)<20||t===20&&e<=`18446744073709551615`))||(Pr(e),e=jr(_,v))),e;if(t===`number`)return(e=Vr(e))>=0&&zr(e)||(Er(e),e=Or(_,v)),e}}(t),t!=null&&(typeof t==`string`&&za(t),t!=null))switch(Xa(e,n,0),typeof t){case`number`:e=e.g,Er(t),Ga(e,_,v);break;case`bigint`:n=BigInt.asUintN(64,t),n=new Ba(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Ga(e.g,n.h,n.g);break;default:n=za(t),Ga(e.g,n.h,n.g)}}),co),k=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,xa(e.g)),!0)}),Ko,ao),as=Vo((function(e,t,n){return(e.h===0||e.h===2)&&(t=$i(t,0|t[h],n),e.h==2?Ia(e,xa,t):t.push(xa(e.g)),!0)}),(function(e,t,n){if((t=zo(Yr,t))!=null&&t.length){n=Za(e,n);for(let n=0;n<t.length;n++)qa(e.g,t[n]);Qa(e,n)}}),ao),os=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,(e=xa(e.g))===0?void 0:e),!0)}),Ko,ao),A=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,ba(e.g)),!0)}),qo,ro),ss=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,!1===(e=ba(e.g))?void 0:e),!0)}),qo,ro),cs=Vo((function(e,t,n){return e.h===2&&(e=Pa(e),$i(t,0|t[h],n).push(e),!0)}),(function(e,t,n){if((t=zo(y,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&$a(r,i,sn(a))}}),io),ls=Bo((function(e,t,n){return e.h===2&&(Ho(t,n,(e=Pa(e))===``?void 0:e),!0)}),Jo,io),j=Bo((function(e,t,n){return e.h===2&&(Ho(t,n,Pa(e)),!0)}),Jo,io),M=function(e,t,n=no){return new mo(e,t,n)}((function(e,t,n,r,i){return e.h===2&&(r=ki(void 0,r),$i(t,0|t[h],n).push(r),Na(e,r,i),!0)}),(function(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)Yo(e,t[a],n,r,i);1&(e=0|t[h])||g(t,1|e)}})),N=ho((function(e,t,n,r,i,a){if(e.h!==2)return!1;let o=0|t[h];return na(t,o,a,n,ur(o)),Na(e,t=ia(t,r,n),i),!0}),Yo),us=Bo((function(e,t,n){return e.h===2&&(Ho(t,n,Fa(e)),!0)}),Xo,uo),ds=Vo((function(e,t,n){return(e.h===0||e.h===2)&&(t=$i(t,0|t[h],n),e.h==2?Ia(e,Sa,t):t.push(Sa(e.g)),!0)}),(function(e,t,n){if((t=zo(Xr,t))!=null)for(let o=0;o<t.length;o++){var r=e,i=n,a=t[o];a!=null&&(Xa(r,i,0),Ka(r.g,a))}}),oo),fs=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,(e=Sa(e.g))===0?void 0:e),!0)}),Zo,oo),ps=Bo((function(e,t,n){return e.h===0&&(Ho(t,n,xa(e.g)),!0)}),(function(e,t,n){(t=Yr(t))!=null&&(t=parseInt(t,10),Xa(e,n,0),qa(e.g,t))}),fo),ms=class{constructor(e,t){var n=Ms;this.g=e,this.h=t,this.m=C,this.j=w,this.defaultValue=void 0,this.l=n.Oa==null?void 0:lr}register(){mn(this)}};function hs(e,t){return new ms(e,t)}function gs(e,t){return(n,r)=>{{let a={ea:!0};r&&Object.assign(a,r),n=ka(n,void 0,void 0,a);try{let r=new e,a=r.v;jo(t)(a,n);var i=r}finally{Aa(n)}}return i}}function _s(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let e=this.g;return this.g=[],e}}}};Lo(this.v,t,Eo(yo,Po,Fo,e)),Ya(t,t.g.end());let n=new Uint8Array(t.h),r=t.l,i=r.length,a=0;for(let e=0;e<i;e++){let t=r[e];n.set(t,a),a+=t.length}return t.l=[n],n}}var vs=class extends D{constructor(e){super(e)}},ys=[0,ls,Bo((function(e,t,n){return e.h===2&&(Ho(t,n,(e=Fa(e))===Dn()?void 0:e),!0)}),(function(e,t,n){if(t!=null){if(t instanceof D){let r=t.Ra;r?(t=r(t),t!=null&&$a(e,n,va(t,!0).buffer)):Fn(Gn,3);return}if(Array.isArray(t))return void Fn(Gn,3)}Xo(e,t,n)}),uo)],bs,xs=globalThis.trustedTypes;function Ss(e){var t;return bs===void 0&&(bs=function(){let e=null;if(!xs)return e;try{let t=e=>e;e=xs.createPolicy(`goog#html`,{createHTML:t,createScript:t,createScriptURL:t})}catch{}return e}()),e=(t=bs)?t.createScriptURL(e):e,new class{constructor(e){this.g=e}toString(){return this.g+``}}(e)}function Cs(e,...t){if(t.length===0)return Ss(e[0]);let n=e[0];for(let r=0;r<t.length;r++)n+=encodeURIComponent(t[r])+e[r+1];return Ss(n)}var ws=[0,k,ps,A,-1,as,ps,-1,A],Ts=class extends D{constructor(e){super(e)}},Es=[0,A,j,A,ps,-1,Vo((function(e,t,n){return(e.h===0||e.h===2)&&(t=$i(t,0|t[h],n),e.h==2?Ia(e,wa,t):t.push(xa(e.g)),!0)}),(function(e,t,n){if((t=zo(Yr,t))!=null&&t.length){n=Za(e,n);for(let n=0;n<t.length;n++)qa(e.g,t[n]);Qa(e,n)}}),fo),j,-1,[0,A,-1],ps,A,-1],Ds=[0,3,A,-1,2,[0,[2],k,N,[0,Bo((function(e,t,n){return e.h===0&&(Ho(t,n,Sa(e.g)),!0)}),Zo,oo)]],[0,ps,A,ps,A,ps,A,j,-1],[0,[3,4],j,-1,N,[0,k],N,[0,ps]],[0]],Os=[0,j,-2],ks=class extends D{constructor(e){super(e)}},As=[0],js=[0,k,A,1,A,-4],Ms=class extends D{constructor(e){super(e,2)}},P={};P[336783863]=[0,j,A,-1,k,[0,[1,2,3,4,5,6,7,8,9],N,As,N,Es,N,Os,N,js,N,ws,N,[0,j,-2],N,[0,j,ps],N,Ds,N,[0,ps,-1,A]],[0,j],A,[0,[1,3],[2,4],N,[0,as],-1,N,[0,cs],-1,M,[0,j,-1]],j];var Ns=[0,rs,-1,ss,-3,rs,as,ls,os,rs,-1,ss,os,ss,-2,ls];function F(e,t){ga(e,3,t)}function I(e,t){ga(e,4,t)}var Ps=class extends D{constructor(e){super(e,500)}o(e){return w(this,0,7,e)}},Fs=[-1,{}],Is=[0,j,1,Fs],Ls=[0,j,cs,Fs];function Rs(e,t){da(e,1,Ps,t)}function L(e,t){ga(e,10,t)}function R(e,t){ga(e,15,t)}var zs=class extends D{constructor(e){super(e,500)}o(e){return w(this,0,1001,e)}},Bs=[-500,M,[-500,ls,-1,cs,-3,[-2,P,A],M,ys,os,-1,Is,Ls,M,[0,ls,ss],ls,Ns,os,cs,987,cs],4,M,[-500,j,-1,[-1,{}],998,j],M,[-500,j,cs,-1,[-2,{},A],997,cs,-1],os,M,[-500,j,cs,Fs,998,cs],cs,os,Is,Ls,M,[0,ls,-1,Fs],cs,-2,Ns,ls,-1,ss,[0,ss,fs],978,Fs,M,ys];zs.prototype.g=_s(Bs);var Vs=gs(zs,Bs),Hs=class extends D{constructor(e){super(e)}},Us=class extends D{constructor(e){super(e)}g(){return sa(this,Hs,1)}},Ws=[0,M,[0,k,O,j,-1]],Gs=gs(Us,Ws),Ks=class extends D{constructor(e){super(e)}},qs=class extends D{constructor(e){super(e)}},Js=class extends D{constructor(e){super(e)}l(){return C(this,Ks,2)}g(){return sa(this,qs,5)}},Ys=gs(class extends D{constructor(e){super(e)}},[0,cs,as,es,[0,ps,[0,k,-3],[0,O,-3],[0,k,-1,[0,M,[0,k,-2]]],M,[0,O,-1,j,O]],j,-1,ns,M,[0,k,O],cs,ns]),Xs=class extends D{constructor(e){super(e)}},Zs=gs(class extends D{constructor(e){super(e)}},[0,M,[0,O,-4]]),Qs=class extends D{constructor(e){super(e)}},$s=gs(class extends D{constructor(e){super(e)}},[0,M,[0,O,-4]]),ec=class extends D{constructor(e){super(e)}},tc=[0,k,-1,es,ps],nc=class extends D{constructor(e){super(e)}};nc.prototype.g=_s([0,O,-4,ns]);var rc=class extends D{constructor(e){super(e)}},ic=gs(class extends D{constructor(e){super(e)}},[0,M,[0,1,k,j,Ws],ns]),ac=class extends D{constructor(e){super(e)}},oc=class extends D{constructor(e){super(e)}na(){return b(this,1,void 0,void 0,Xi)??Dn()}},sc=class extends D{constructor(e){super(e)}},cc=[1,2],lc=gs(class extends D{constructor(e){super(e)}},[0,M,[0,cc,N,[0,es],N,[0,us],k,j],ns]),uc=class extends D{constructor(e){super(e)}},dc=[0,j,k,O,cs,-1],fc=class extends D{constructor(e){super(e)}},pc=[0,A,-1],mc=class extends D{constructor(e){super(e)}},hc=[1,2,3,4,5,6],gc=class extends D{constructor(e){super(e)}g(){return b(this,1,void 0,void 0,Xi)!=null}l(){return y(b(this,2))!=null}},z=class extends D{constructor(e){super(e)}g(){return Kr(b(this,2))??!1}},_c=[0,us,j,[0,k,ns,-1],[0,is,ns]],B=[0,_c,A,[0,hc,N,js,N,Es,N,ws,N,As,N,Os,N,Ds],ps],vc=class extends D{constructor(e){super(e)}},yc=[0,B,O,-1,k],bc=hs(502141897,vc);P[502141897]=yc;var xc=gs(class extends D{constructor(e){super(e)}},[0,[0,ps,-1,$o,ds],tc]),Sc=class extends D{constructor(e){super(e)}},Cc=class extends D{constructor(e){super(e)}},wc=[0,B,O,[0,B],A],Tc=hs(508968150,Cc);P[508968150]=[0,B,yc,wc,O,[0,[0,_c]]],P[508968149]=wc;var Ec=class extends D{constructor(e){super(e)}l(){return C(this,uc,2)}g(){x(this,2)}},Dc=[0,B,dc];P[478825465]=Dc;var Oc=class extends D{constructor(e){super(e)}},kc=class extends D{constructor(e){super(e)}},Ac=class extends D{constructor(e){super(e)}},jc=class extends D{constructor(e){super(e)}},Mc=class extends D{constructor(e){super(e)}},Nc=[0,B,[0,B],Dc,-1],Pc=[0,B,O,k],Fc=[0,B,O],Ic=[0,B,Pc,Fc,O],Lc=hs(479097054,Mc);P[479097054]=[0,B,Ic,Nc],P[463370452]=Nc,P[464864288]=Pc;var Rc=hs(462713202,jc);P[462713202]=Ic,P[474472470]=Fc;var zc=class extends D{constructor(e){super(e)}},Bc=class extends D{constructor(e){super(e)}},Vc=class extends D{constructor(e){super(e)}},Hc=class extends D{constructor(e){super(e)}},Uc=[0,B,O,-1,k],Wc=[0,B,O,A];Hc.prototype.g=_s([0,B,Fc,[0,B],yc,wc,Uc,Wc]);var Gc=class extends D{constructor(e){super(e)}},Kc=hs(456383383,Gc);P[456383383]=[0,B,dc];var qc=class extends D{constructor(e){super(e)}},Jc=hs(476348187,qc);P[476348187]=[0,B,pc];var Yc=class extends D{constructor(e){super(e)}},Xc=class extends D{constructor(e){super(e)}},Zc=[0,ps,-1],Qc=hs(458105876,class extends D{constructor(e){super(e)}g(){let e;var t=this.v;let n=0|t[h];return e=rr(this,n),t=function(e,t,n,r){var i=Xc;!r&&Li(e)&&(n=0|(t=e.v)[h]);var a=Ui(t,2);if(e=!1,a==null){if(r)return _i();a=[]}else if(a.constructor===pi){if(!(2&a.J)||r)return a;a=a.V()}else Array.isArray(a)?e=!!(2&(0|a[h])):a=[];if(r){if(!a.length)return _i();e||(e=!0,er(a))}else e&&(e=!1,tr(a),a=Zi(a));return!e&&32&n&&$n(a,32),n=S(t,n,2,r=new pi(a,i,oi,void 0)),e||zi(t,n),r}(this,t,n,e),!e&&Xc&&(t.ra=!0),t}});P[458105876]=[0,Zc,Uo,[!0,ns,[0,j,-1,cs]],[0,as,A,ps]];var $c=class extends D{constructor(e){super(e)}},el=hs(458105758,$c);P[458105758]=[0,B,j,Zc];var tl=class extends D{constructor(e){super(e)}},nl=[0,ts,-1,ss],rl=class extends D{constructor(e){super(e)}},il=class extends D{constructor(e){super(e)}},al=[1,2];il.prototype.g=_s([0,al,N,nl,N,[0,M,nl]]);var ol=class extends D{constructor(e){super(e)}},sl=hs(443442058,ol);P[443442058]=[0,B,j,k,O,cs,-1,A,O],P[514774813]=Uc;var cl=class extends D{constructor(e){super(e)}},ll=hs(516587230,cl);function ul(e,t){return t=t?t.clone():new uc,e.displayNamesLocale===void 0?e.displayNamesLocale===void 0&&x(t,1):x(t,1,ii(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&x(t,2):pa(t,2,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&x(t,3):E(t,3,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&x(t,4):ha(t,4,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&x(t,5):ha(t,5,e.categoryDenylist),t}function dl(e){let t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function fl(e,t=-1,n=``){return{categories:e.map((e=>({index:fa(e,1)??0??-1,score:T(e,2)??0,categoryName:y(b(e,3))??``??``,displayName:y(b(e,4))??``??``}))),headIndex:t,headName:n}}function pl(e){let t={classifications:sa(e,rc,1).map((e=>fl(C(e,Us,4)?.g()??[],fa(e,2)??0,y(b(e,3))??``)))};return function(e){return e==null?e:typeof e==`bigint`?(_r(e)?e=Number(e):(e=Lr(64,e),e=_r(e)?Number(e):String(e)),e):Jr(e)?typeof e==`number`?Qr(e):$r(e):void 0}(b(e,2,void 0,void 0,ni))!=null&&(t.timestampMs=dl(b(e,2,void 0,void 0,ni)??Vi)),t}function ml(e){var t=Gi(e,3,Wr,Wi()),n=Gi(e,2,Yr,Wi()),r=Gi(e,1,y,Wi()),i=Gi(e,9,y,Wi());let a={categories:[],keypoints:[]};for(let e=0;e<t.length;e++)a.categories.push({score:t[e],index:n[e]??-1,categoryName:r[e]??``,displayName:i[e]??``});if((t=C(e,Js,4)?.l())&&(a.boundingBox={originX:fa(t,1,Hi)??0,originY:fa(t,2,Hi)??0,width:fa(t,3,Hi)??0,height:fa(t,4,Hi)??0,angle:0}),C(e,Js,4)?.g().length)for(let t of C(e,Js,4).g())a.keypoints.push({x:b(t,1,void 0,Hi,Wr)??0,y:b(t,2,void 0,Hi,Wr)??0,score:b(t,4,void 0,Hi,Wr)??0,label:y(b(t,3,void 0,Hi))??``});return a}function hl(e){let t=[];for(let n of sa(e,Qs,1))t.push({x:T(n,1)??0,y:T(n,2)??0,z:T(n,3)??0,visibility:T(n,4)??0});return t}function gl(e){let t=[];for(let n of sa(e,Xs,1))t.push({x:T(n,1)??0,y:T(n,2)??0,z:T(n,3)??0,visibility:T(n,4)??0});return t}function _l(e){return Array.from(e,(e=>e>127?e-256:e))}function vl(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,r=0,i=0;for(let a=0;a<e.length;a++)n+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];if(r<=0||i<=0)throw Error(`Cannot compute cosine similarity on embedding with 0 norm.`);return n/Math.sqrt(r*i)}var yl;P[516587230]=[0,B,Uc,Wc,O],P[518928384]=Wc;var bl=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function xl(e){if(e)return!0;if(yl===void 0)try{await WebAssembly.instantiate(bl),yl=!0}catch{yl=!1}return yl}async function Sl(e,t,n){return{wasmLoaderPath:`${t}/${e}_${n=`wasm${n?`_module`:``}${await xl(n)?``:`_nosimd`}_internal`}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var Cl=class{};function wl(){var e=navigator;return typeof OffscreenCanvas<`u`&&(!function(e=navigator){return(e=e.userAgent).includes(`Safari`)&&!e.includes(`Chrome`)}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Tl(e){if(typeof importScripts!=`function`){let t=document.createElement(`script`);return t.src=e.toString(),t.crossOrigin=`anonymous`,new Promise(((e,n)=>{t.addEventListener(`load`,(()=>{e()}),!1),t.addEventListener(`error`,(e=>{n(e)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;{let t=self.import;t?await t(e.toString()):await import(e.toString())}}}function El(e){return e.videoWidth===void 0?e.naturalWidth===void 0?e.displayWidth===void 0?[e.width,e.height]:[e.displayWidth,e.displayHeight]:[e.naturalWidth,e.naturalHeight]:[e.videoWidth,e.videoHeight]}function V(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Dl(e,t,n){if(!e.i.canvas)throw Error(`No OpenGL canvas configured.`);if(n?e.i._bindTextureToStream(n):e.i._bindTextureToCanvas(),!(n=e.i.canvas.getContext(`webgl2`)||e.i.canvas.getContext(`webgl`)))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);let[r,i]=El(t);return!e.l||r===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=i),[r,i]}function Ol(e,t,n){e.m||console.error(`No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target`);let r=new Uint32Array(t.length);for(let n=0;n<t.length;n++)r[n]=e.i.stringToNewUTF8(t[n]);t=e.i._malloc(4*r.length),e.i.HEAPU32.set(r,t>>2),n(t);for(let t of r)e.i._free(t);e.i._free(t)}function kl(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function Al(e,t,n){let r=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(e,t,i)=>{t?(n(r,i),r=[]):r.push(e)}}Cl.forVisionTasks=function(e,t=!1){return Sl(`vision`,e??Cs``,t)},Cl.forTextTasks=function(e,t=!1){return Sl(`text`,e??Cs``,t)},Cl.forGenAiTasks=function(e,t=!1){return Sl(`genai`,e??Cs``,t)},Cl.forAudioTasks=function(e,t=!1){return Sl(`audio`,e??Cs``,t)},Cl.isSimdSupported=function(e=!1){return xl(e)};async function jl(e,t,n,r){return e=await(async(e,t,n,r,i)=>{if(t&&await Tl(t),!self.ModuleFactory||n&&(await Tl(n),!self.ModuleFactory))throw Error(`ModuleFactory not set.`);return self.Module&&i&&((t=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(t.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new e(i,r)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:e=>e.endsWith(`.wasm`)?n.wasmBinaryPath.toString():n.assetBinaryPath&&e.endsWith(`.data`)?n.assetBinaryPath.toString():e}),await e.o(r),e}function Ml(e,t){let n=C(e.baseOptions,gc,1)||new gc;typeof t==`string`?(x(n,2,ii(t)),x(n,1)):t instanceof Uint8Array&&(x(n,1,ar(t,!1)),x(n,2)),w(e.baseOptions,0,1,n)}function Nl(e){try{let t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error(`Encountered multiple errors: `+e.H.map((e=>e.message)).join(`, `))}finally{e.H=[]}}function H(e,t){e.C=Math.max(e.C,t)}function Pl(e,t){e.B=new Ps,ma(e.B,2,`PassThroughCalculator`),F(e.B,`free_memory`),I(e.B,`free_memory_unused_out`),L(t,`free_memory`),Rs(t,e.B)}function Fl(e,t){F(e.B,t),I(e.B,t+`_unused_out`)}function Il(e){e.g.addBoolToStream(!0,`free_memory`,e.C)}var Ll=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let t=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error(`Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer`);if(!(C(this.baseOptions,gc,1)?.g()||C(this.baseOptions,gc,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error(`Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set`);if(function(e,t){let n=C(e.baseOptions,mc,3);if(!n){var r=n=new mc,i=new ks;la(r,4,hc,i)}`delegate`in t&&(t.delegate===`GPU`?(t=n,r=new Ts,la(t,2,hc,r)):(t=n,r=new ks,la(t,4,hc,r))),w(e.baseOptions,0,3,n)}(this,t),t.modelAssetPath)return fetch(t.modelAssetPath.toString()).then((e=>{if(e.ok)return e.arrayBuffer();throw Error(`Failed to fetch model: ${t.modelAssetPath} (${e.status})`)})).then((e=>{try{this.g.i.FS_unlink(`/model.dat`)}catch{}this.g.i.FS_createDataFile(`/`,`model.dat`,new Uint8Array(e),!0,!1,!1),Ml(this,`/model.dat`),this.m(),this.L()}));if(t.modelAssetBuffer instanceof Uint8Array)Ml(this,t.modelAssetBuffer);else if(t.modelAssetBuffer)return async function(e){let t=[];for(var n=0;;){let{done:r,value:i}=await e.read();if(r)break;t.push(i),n+=i.length}if(t.length===0)return new Uint8Array;if(t.length===1)return t[0];e=new Uint8Array(n),n=0;for(let r of t)e.set(r,n),n+=r.length;return e}(t.modelAssetBuffer).then((e=>{Ml(this,e),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=Vs(t)})),!e)throw Error(`Failed to retrieve CalculatorGraphConfig`);return e}setGraph(e,t){this.g.attachErrorListener(((e,t)=>{this.H.push(Error(t))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Nl(this)}finishProcessing(){this.g.finishProcessing(),Nl(this)}close(){this.B=void 0,this.g.closeGraph()}};function Rl(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Ll.prototype.close=Ll.prototype.close;var zl=class{constructor(e,t,n,r){this.g=e,this.h=t,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function Bl(e,t,n){let r=e.g;if(n=Rl(r.createShader(n),`Failed to create WebGL shader`),r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(e.h,n),n}function Vl(e,t){let n=e.g,r=Rl(n.createVertexArray(),`Failed to create vertex array`);n.bindVertexArray(r);let i=Rl(n.createBuffer(),`Failed to create buffer`);n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.O),n.vertexAttribPointer(e.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);let a=Rl(n.createBuffer(),`Failed to create buffer`);return n.bindBuffer(n.ARRAY_BUFFER,a),n.enableVertexAttribArray(e.L),n.vertexAttribPointer(e.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new zl(n,r,i,a)}function Hl(e,t){if(e.g){if(t!==e.g)throw Error(`Cannot change GL context once initialized`)}else e.g=t}function Ul(e,t,n,r){return Hl(e,t),e.h||(e.m(),e.D()),n?(e.u||=Vl(e,!0),n=e.u):(e.A||=Vl(e,!1),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=r(),n.g.bindVertexArray(null),e}function Wl(e,t,n){return Hl(e,t),e=Rl(t.createTexture(),`Failed to create texture`),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Gl(e,t,n){Hl(e,t),e.B||=Rl(t.createFramebuffer(),`Failed to create framebuffe.`),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function Kl(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var ql=class{H(){return`
|
|
2
|
-
precision mediump float;
|
|
3
|
-
varying vec2 vTex;
|
|
4
|
-
uniform sampler2D inputTexture;
|
|
5
|
-
void main() {
|
|
6
|
-
gl_FragColor = texture2D(inputTexture, vTex);
|
|
7
|
-
}
|
|
8
|
-
`}m(){let e=this.g;if(this.h=Rl(e.createProgram(),`Failed to create WebGL program`),this.X=Bl(this,`
|
|
9
|
-
attribute vec2 aVertex;
|
|
10
|
-
attribute vec2 aTex;
|
|
11
|
-
varying vec2 vTex;
|
|
12
|
-
void main(void) {
|
|
13
|
-
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
14
|
-
vTex = aTex;
|
|
15
|
-
}`,e.VERTEX_SHADER),this.W=Bl(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,`aVertex`),this.L=e.getAttribLocation(this.h,`aTex`)}D(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}},Jl=class extends ql{H(){return`
|
|
16
|
-
precision mediump float;
|
|
17
|
-
uniform sampler2D backgroundTexture;
|
|
18
|
-
uniform sampler2D maskTexture;
|
|
19
|
-
uniform sampler2D colorMappingTexture;
|
|
20
|
-
varying vec2 vTex;
|
|
21
|
-
void main() {
|
|
22
|
-
vec4 backgroundColor = texture2D(backgroundTexture, vTex);
|
|
23
|
-
float category = texture2D(maskTexture, vTex).r;
|
|
24
|
-
vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
|
|
25
|
-
gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
|
|
26
|
-
}
|
|
27
|
-
`}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.C=Wl(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=Wl(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.P=Rl(e.getUniformLocation(this.h,`backgroundTexture`),`Uniform location`),this.U=Rl(e.getUniformLocation(this.h,`colorMappingTexture`),`Uniform location`),this.M=Rl(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.M,0),e.uniform1i(this.P,1),e.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},Yl=class extends ql{H(){return`
|
|
28
|
-
precision mediump float;
|
|
29
|
-
uniform sampler2D maskTexture;
|
|
30
|
-
uniform sampler2D defaultTexture;
|
|
31
|
-
uniform sampler2D overlayTexture;
|
|
32
|
-
varying vec2 vTex;
|
|
33
|
-
void main() {
|
|
34
|
-
float confidence = texture2D(maskTexture, vTex).r;
|
|
35
|
-
vec4 defaultColor = texture2D(defaultTexture, vTex);
|
|
36
|
-
vec4 overlayColor = texture2D(overlayTexture, vTex);
|
|
37
|
-
// Apply the alpha from the overlay and merge in the default color
|
|
38
|
-
overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
|
|
39
|
-
gl_FragColor = mix(defaultColor, overlayColor, confidence);
|
|
40
|
-
}
|
|
41
|
-
`}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=Wl(this,e),e.activeTexture(e.TEXTURE2),this.C=Wl(this,e)}m(){super.m();let e=this.g;this.M=Rl(e.getUniformLocation(this.h,`defaultTexture`),`Uniform location`),this.P=Rl(e.getUniformLocation(this.h,`overlayTexture`),`Uniform location`),this.I=Rl(e.getUniformLocation(this.h,`maskTexture`),`Uniform location`)}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.M,1),e.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function Xl(e,t){switch(t){case 0:return e.g.find((e=>e instanceof Uint8Array));case 1:return e.g.find((e=>e instanceof Float32Array));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Zl(e){var t=Xl(e,1);if(!t){if(t=Xl(e,0))t=new Float32Array(t).map((e=>e/255));else{t=new Float32Array(e.width*e.height);let r=$l(e);var n=tu(e);if(Gl(n,r,Ql(e)),`iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod`.split(`;`).includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`document`in self&&`ontouchend`in self.document){n=new Float32Array(e.width*e.height*4),r.readPixels(0,0,e.width,e.height,r.RGBA,r.FLOAT,n);for(let e=0,r=0;e<t.length;++e,r+=4)t[e]=n[r]}else r.readPixels(0,0,e.width,e.height,r.RED,r.FLOAT,t)}e.g.push(t)}return t}function Ql(e){let t=Xl(e,2);if(!t){let n=$l(e);t=nu(e);let r=Zl(e),i=eu(e);n.texImage2D(n.TEXTURE_2D,0,i,e.width,e.height,0,n.RED,n.FLOAT,r),ru(e)}return t}function $l(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=Rl(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function eu(e){if(e=$l(e),!iu)if(e.getExtension(`EXT_color_buffer_float`)&&e.getExtension(`OES_texture_float_linear`)&&e.getExtension(`EXT_float_blend`))iu=e.R32F;else{if(!e.getExtension(`EXT_color_buffer_half_float`))throw Error(`GPU does not fully support 4-channel float32 or float16 formats`);iu=e.R16F}return iu}function tu(e){return e.l||=new ql,e.l}function nu(e){let t=$l(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=Xl(e,2);return n||(n=Wl(tu(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function ru(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var iu,U=class{constructor(e,t,n,r,i,a,o){this.g=e,this.m=t,this.j=n,this.canvas=r,this.l=i,this.width=a,this.height=o,this.j&&--au===0&&console.error(`You seem to be creating MPMask instances without invoking .close(). This leaks resources.`)}Fa(){return!!Xl(this,0)}ka(){return!!Xl(this,1)}R(){return!!Xl(this,2)}ja(){return(t=Xl(e=this,0))||(t=Zl(e),t=new Uint8Array(t.map((e=>Math.round(255*e)))),e.g.push(t)),t;var e,t}ia(){return Zl(this)}N(){return Ql(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof Uint8Array)n=new Uint8Array(t);else if(t instanceof Float32Array)n=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let e=$l(this),t=tu(this);e.activeTexture(e.TEXTURE1),n=Wl(t,e,this.m?e.LINEAR:e.NEAREST),e.bindTexture(e.TEXTURE_2D,n);let r=eu(this);e.texImage2D(e.TEXTURE_2D,0,r,this.width,this.height,0,e.RED,e.FLOAT,null),e.bindTexture(e.TEXTURE_2D,null),Gl(t,e,n),Ul(t,e,!1,(()=>{nu(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),ru(this)})),Kl(t),ru(this)}}e.push(n)}return new U(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&$l(this).deleteTexture(Xl(this,2)),au=-1}};U.prototype.close=U.prototype.close,U.prototype.clone=U.prototype.clone,U.prototype.getAsWebGLTexture=U.prototype.N,U.prototype.getAsFloat32Array=U.prototype.ia,U.prototype.getAsUint8Array=U.prototype.ja,U.prototype.hasWebGLTexture=U.prototype.R,U.prototype.hasFloat32Array=U.prototype.ka,U.prototype.hasUint8Array=U.prototype.Fa;var au=250,ou={color:`white`,lineWidth:4,radius:6};function su(e){return{...ou,fillColor:(e||={}).color,...e}}function cu(e,t){return e instanceof Function?e(t):e}function lu(e,t,n){return Math.max(Math.min(t,n),Math.min(Math.max(t,n),e))}function uu(e){if(!e.l)throw Error(`CPU rendering requested but CanvasRenderingContext2D not provided.`);return e.l}function du(e){if(!e.j)throw Error(`GPU rendering requested but WebGL2RenderingContext not provided.`);return e.j}function fu(e,t,n){if(t.R())n(t.N());else{let r=t.ka()?t.ia():t.ja();e.m=e.m??new ql;let i=du(e);n((e=new U([r],t.m,!1,i.canvas,e.m,t.width,t.height)).N()),e.close()}}function pu(e,t,n,r){let i=function(e){return e.g||=new Jl,e.g}(e),a=du(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Ul(i,a,!0,(()=>{(function(e,t,n,r){let i=e.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,t),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,e.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),e.I&&function(e,t){if(e!==t)return!1;e=e.entries(),t=t.entries();for(let[n,r]of e){e=n;let i=r,a=t.next();if(a.done)return!1;let[o,s]=a.value;if(e!==o||i[0]!==s[0]||i[1]!==s[1]||i[2]!==s[2]||i[3]!==s[3])return!1}return!!t.next().done}(e.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j);else{e.I=r;let t=Array(1024).fill(0);r.forEach(((e,n)=>{if(e.length!==4)throw Error(`Color at index ${n} is not a four-channel value.`);t[4*n]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,e.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(t))}})(i,t,o,r),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT),a.drawArrays(a.TRIANGLE_FAN,0,4);let e=i.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}function mu(e,t,n,r){let i=du(e),a=function(e){return e.h||=new Yl,e.h}(e),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Ul(a,i,!0,(()=>{var e=a.g;e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,a.j),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a.C),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,s),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(e=a.g).activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,null)}))}var hu=class{constructor(e,t){typeof CanvasRenderingContext2D<`u`&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var n=uu(this);t=su(t),n.save();var r=n.canvas,i=0;for(let a of e)n.fillStyle=cu(t.fillColor,{index:i,from:a}),n.strokeStyle=cu(t.color,{index:i,from:a}),n.lineWidth=cu(t.lineWidth,{index:i,from:a}),(e=new Path2D).arc(a.x*r.width,a.y*r.height,cu(t.radius,{index:i,from:a}),0,2*Math.PI),n.fill(e),n.stroke(e),++i;n.restore()}}xa(e,t,n){if(e&&t){var r=uu(this);n=su(n),r.save();var i=r.canvas,a=0;for(let o of t){r.beginPath(),t=e[o.start];let s=e[o.end];t&&s&&(r.strokeStyle=cu(n.color,{index:a,from:t,to:s}),r.lineWidth=cu(n.lineWidth,{index:a,from:t,to:s}),r.moveTo(t.x*i.width,t.y*i.height),r.lineTo(s.x*i.width,s.y*i.height)),++a,r.stroke()}r.restore()}}ua(e,t){let n=uu(this);t=su(t),n.save(),n.beginPath(),n.lineWidth=cu(t.lineWidth,{}),n.strokeStyle=cu(t.color,{}),n.fillStyle=cu(t.fillColor,{}),n.moveTo(e.originX,e.originY),n.lineTo(e.originX+e.width,e.originY),n.lineTo(e.originX+e.width,e.originY+e.height),n.lineTo(e.originX,e.originY+e.height),n.lineTo(e.originX,e.originY),n.stroke(),n.fill(),n.restore()}va(e,t,n=[0,0,0,255]){this.l?function(e,t,n,r){let i=du(e);fu(e,t,(t=>{pu(e,t,n,r),(t=uu(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,n,t):pu(this,e.N(),n,t)}wa(e,t,n){this.l?function(e,t,n,r){let i=du(e);fu(e,t,(t=>{mu(e,t,n,r),(t=uu(e)).drawImage(i.canvas,0,0,t.canvas.width,t.canvas.height)}))}(this,e,t,n):mu(this,e.N(),t,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function gu(e,t){switch(t){case 0:return e.g.find((e=>e instanceof ImageData));case 1:return e.g.find((e=>typeof ImageBitmap<`u`&&e instanceof ImageBitmap));case 2:return e.g.find((e=>typeof WebGLTexture<`u`&&e instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function _u(e){var t=gu(e,0);if(!t){t=yu(e);let n=bu(e),r=new Uint8Array(e.width*e.height*4);Gl(n,t,vu(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,r),Kl(n),t=new ImageData(new Uint8ClampedArray(r.buffer),e.width,e.height),e.g.push(t)}return t}function vu(e){let t=gu(e,2);if(!t){let n=yu(e);t=xu(e);let r=gu(e,1)||_u(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),Su(e)}return t}function yu(e){if(!e.canvas)throw Error(`Conversion to different image formats require that a canvas is passed when initializing the image.`);return e.h||=Rl(e.canvas.getContext(`webgl2`),`You cannot use a canvas that is already bound to a different type of rendering context.`),e.h}function bu(e){return e.l||=new ql,e.l}function xu(e){let t=yu(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=gu(e,2);return n||(n=Wl(bu(e),t),e.g.push(n),e.m=!0),t.bindTexture(t.TEXTURE_2D,n),n}function Su(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Cu(e){let t=yu(e);return Ul(bu(e),t,!0,(()=>function(e,t){let n=e.canvas;if(n.width===e.width&&n.height===e.height)return t();let r=n.width,i=n.height;return n.width=e.width,n.height=e.height,e=t(),n.width=r,n.height=i,e}(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error(`Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas`);return e.canvas.transferToImageBitmap()}))))}hu.prototype.close=hu.prototype.close,hu.prototype.drawConfidenceMask=hu.prototype.wa,hu.prototype.drawCategoryMask=hu.prototype.va,hu.prototype.drawBoundingBox=hu.prototype.ua,hu.prototype.drawConnectors=hu.prototype.xa,hu.prototype.drawLandmarks=hu.prototype.ya,hu.lerp=function(e,t,n,r,i){return lu(r*(1-(e-t)/(n-t))+i*(1-(n-e)/(n-t)),r,i)},hu.clamp=lu;var W=class{constructor(e,t,n,r,i,a,o){this.g=e,this.j=t,this.m=n,this.canvas=r,this.l=i,this.width=a,this.height=o,(this.j||this.m)&&--wu===0&&console.error(`You seem to be creating MPImage instances without invoking .close(). This leaks resources.`)}Ea(){return!!gu(this,0)}la(){return!!gu(this,1)}R(){return!!gu(this,2)}Ca(){return _u(this)}Ba(){var e=gu(this,1);return e||(vu(this),xu(this),e=Cu(this),Su(this),this.g.push(e),this.j=!0),e}N(){return vu(this)}clone(){let e=[];for(let t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let e=yu(this),t=bu(this);e.activeTexture(e.TEXTURE1),n=Wl(t,e),e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,null),Gl(t,e,n),Ul(t,e,!1,(()=>{xu(this),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),Su(this)})),Kl(t),Su(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);vu(this),xu(this),n=Cu(this),Su(this)}e.push(n)}return new W(e,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&gu(this,1).close(),this.m&&yu(this).deleteTexture(gu(this,2)),wu=-1}};W.prototype.close=W.prototype.close,W.prototype.clone=W.prototype.clone,W.prototype.getAsWebGLTexture=W.prototype.N,W.prototype.getAsImageBitmap=W.prototype.Ba,W.prototype.getAsImageData=W.prototype.Ca,W.prototype.hasWebGLTexture=W.prototype.R,W.prototype.hasImageBitmap=W.prototype.la,W.prototype.hasImageData=W.prototype.Ea;var wu=250;function Tu(...e){return e.map((([e,t])=>({start:e,end:t})))}var Eu=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((Du=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream==`function`,t===void 0?wl()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(`OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.`),this.i.canvas=document.createElement(`canvas`)):this.i.canvas=t}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(`.pbtxt`)||e.endsWith(`.textproto`)),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let n=e.length,r=this.i._malloc(n);this.i.HEAPU8.set(e,r),t?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(e,t,n,r,i){this.i._configureAudio||console.warn(`Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?`),V(this,r||`input_audio`,(r=>{V(this,i||=`audio_header`,(i=>{this.i._configureAudio(r,i,e,t??0,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){kl(this,`__graph_config__`,(t=>{e(t)})),V(this,`__graph_config__`,(e=>{this.i._getGraphConfig(e,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,r,i){let a=4*e.length;this.h!==a&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(a),this.h=a),this.i.HEAPF32.set(e,this.g/4),V(this,r,(e=>{this.i._addAudioToInputStream(this.g,t,n,e,i)}))}addGpuBufferToStream(e,t,n){V(this,t,(t=>{let[r,i]=Dl(this,e,t);this.i._addBoundTextureToStream(t,r,i,n)}))}addBoolToStream(e,t,n){V(this,t,(t=>{this.i._addBoolToInputStream(e,t,n)}))}addDoubleToStream(e,t,n){V(this,t,(t=>{this.i._addDoubleToInputStream(e,t,n)}))}addFloatToStream(e,t,n){V(this,t,(t=>{this.i._addFloatToInputStream(e,t,n)}))}addIntToStream(e,t,n){V(this,t,(t=>{this.i._addIntToInputStream(e,t,n)}))}addUintToStream(e,t,n){V(this,t,(t=>{this.i._addUintToInputStream(e,t,n)}))}addStringToStream(e,t,n){V(this,t,(t=>{V(this,e,(e=>{this.i._addStringToInputStream(e,t,n)}))}))}addStringRecordToStream(e,t,n){V(this,t,(t=>{Ol(this,Object.keys(e),(r=>{Ol(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(e).length,t,n)}))}))}))}addProtoToStream(e,t,n,r){V(this,n,(n=>{V(this,t,(t=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,t,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(e,t){V(this,e,(e=>{this.i._addEmptyPacketToInputStream(e,t)}))}addBoolVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateBoolVector(e.length);if(!r)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(r,t);this.i._addBoolVectorToInputStream(r,t,n)}))}addDoubleVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateDoubleVector(e.length);if(!r)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(r,t);this.i._addDoubleVectorToInputStream(r,t,n)}))}addFloatVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateFloatVector(e.length);if(!r)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(r,t);this.i._addFloatVectorToInputStream(r,t,n)}))}addIntVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateIntVector(e.length);if(!r)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(r,t);this.i._addIntVectorToInputStream(r,t,n)}))}addUintVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateUintVector(e.length);if(!r)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(r,t);this.i._addUintVectorToInputStream(r,t,n)}))}addStringVectorToStream(e,t,n){V(this,t,(t=>{let r=this.i._allocateStringVector(e.length);if(!r)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)V(this,t,(e=>{this.i._addStringVectorEntry(r,e)}));this.i._addStringVectorToInputStream(r,t,n)}))}addBoolToInputSidePacket(e,t){V(this,t,(t=>{this.i._addBoolToInputSidePacket(e,t)}))}addDoubleToInputSidePacket(e,t){V(this,t,(t=>{this.i._addDoubleToInputSidePacket(e,t)}))}addFloatToInputSidePacket(e,t){V(this,t,(t=>{this.i._addFloatToInputSidePacket(e,t)}))}addIntToInputSidePacket(e,t){V(this,t,(t=>{this.i._addIntToInputSidePacket(e,t)}))}addUintToInputSidePacket(e,t){V(this,t,(t=>{this.i._addUintToInputSidePacket(e,t)}))}addStringToInputSidePacket(e,t){V(this,t,(t=>{V(this,e,(e=>{this.i._addStringToInputSidePacket(e,t)}))}))}addProtoToInputSidePacket(e,t,n){V(this,n,(n=>{V(this,t,(t=>{let r=this.i._malloc(e.length);this.i.HEAPU8.set(e,r),this.i._addProtoToInputSidePacket(r,e.length,t,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error(`Unable to allocate new bool vector on heap.`);for(let t of e)this.i._addBoolVectorEntry(n,t);this.i._addBoolVectorToInputSidePacket(n,t)}))}addDoubleVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error(`Unable to allocate new double vector on heap.`);for(let t of e)this.i._addDoubleVectorEntry(n,t);this.i._addDoubleVectorToInputSidePacket(n,t)}))}addFloatVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error(`Unable to allocate new float vector on heap.`);for(let t of e)this.i._addFloatVectorEntry(n,t);this.i._addFloatVectorToInputSidePacket(n,t)}))}addIntVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error(`Unable to allocate new int vector on heap.`);for(let t of e)this.i._addIntVectorEntry(n,t);this.i._addIntVectorToInputSidePacket(n,t)}))}addUintVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error(`Unable to allocate new unsigned int vector on heap.`);for(let t of e)this.i._addUintVectorEntry(n,t);this.i._addUintVectorToInputSidePacket(n,t)}))}addStringVectorToInputSidePacket(e,t){V(this,t,(t=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error(`Unable to allocate new string vector on heap.`);for(let t of e)V(this,t,(e=>{this.i._addStringVectorEntry(n,e)}));this.i._addStringVectorToInputSidePacket(n,t)}))}attachBoolListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachBoolListener(e)}))}attachBoolVectorListener(e,t){Al(this,e,t),V(this,e,(e=>{this.i._attachBoolVectorListener(e)}))}attachIntListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachIntListener(e)}))}attachIntVectorListener(e,t){Al(this,e,t),V(this,e,(e=>{this.i._attachIntVectorListener(e)}))}attachUintListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachUintListener(e)}))}attachUintVectorListener(e,t){Al(this,e,t),V(this,e,(e=>{this.i._attachUintVectorListener(e)}))}attachDoubleListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachDoubleListener(e)}))}attachDoubleVectorListener(e,t){Al(this,e,t),V(this,e,(e=>{this.i._attachDoubleVectorListener(e)}))}attachFloatListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachFloatListener(e)}))}attachFloatVectorListener(e,t){Al(this,e,t),V(this,e,(e=>{this.i._attachFloatVectorListener(e)}))}attachStringListener(e,t){kl(this,e,t),V(this,e,(e=>{this.i._attachStringListener(e)}))}attachStringVectorListener(e,t){Al(this,e,t),V(this,e,(e=>{this.i._attachStringVectorListener(e)}))}attachProtoListener(e,t,n){kl(this,e,t),V(this,e,(e=>{this.i._attachProtoListener(e,n||!1)}))}attachProtoVectorListener(e,t,n){Al(this,e,t),V(this,e,(e=>{this.i._attachProtoVectorListener(e,n||!1)}))}attachAudioListener(e,t,n){this.i._attachAudioListener||console.warn(`Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?`),kl(this,e,((e,n)=>{e=new Float32Array(e.buffer,e.byteOffset,e.length/4),t(e,n)})),V(this,e,(e=>{this.i._attachAudioListener(e,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Du{get ga(){return this.i}pa(e,t,n){V(this,t,(t=>{let[r,i]=Dl(this,e,t);this.ga._addBoundTextureAsImageToStream(t,r,i,n)}))}Z(e,t){kl(this,e,t),V(this,e,(e=>{this.ga._attachImageListener(e)}))}aa(e,t){Al(this,e,t),V(this,e,(e=>{this.ga._attachImageVectorListener(e)}))}})),Du,Ou=class extends Eu{};async function G(e,t,n){return async function(e,t,n,r){return jl(e,t,n,r)}(e,n.canvas??(wl()?void 0:document.createElement(`canvas`)),t,n)}function ku(e,t,n,r){if(e.U){let a=new nc;if(n?.regionOfInterest){if(!e.oa)throw Error(`This task doesn't support region-of-interest.`);var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(`Expected RectF with left < right and top < bottom.`);if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(`Expected RectF values to be in [0,1].`);E(a,1,(i.left+i.right)/2),E(a,2,(i.top+i.bottom)/2),E(a,4,i.right-i.left),E(a,3,i.bottom-i.top)}else E(a,1,.5),E(a,2,.5),E(a,4,1),E(a,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(`Expected rotation to be a multiple of 90°.`);if(E(a,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){let[e,r]=El(t);n=T(a,3)*r/e,i=T(a,4)*e/r,E(a,4,n),E(a,3,i)}}e.g.addProtoToStream(a.g(),`mediapipe.NormalizedRect`,e.U,r)}e.g.pa(t,e.X,r??performance.now()),e.finishProcessing()}function Au(e,t,n){if(e.baseOptions?.g())throw Error(`Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.`);ku(e,t,n,e.C+1)}function ju(e,t,n,r){if(!e.baseOptions?.g())throw Error(`Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.`);ku(e,t,n,r)}function Mu(e,t,n,r){var i=t.data;let a=t.width,o=a*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(`Unsupported channel count: `+i.length/o);return e=new U([i],n,!1,e.g.i.canvas,e.P,a,t),r?e.clone():e}var Nu=class extends Ll{constructor(e,t,n,r){super(e),this.g=e,this.X=t,this.U=n,this.oa=r,this.P=new ql}l(e,t=!0){if(`runningMode`in e&&x(this.baseOptions,2,Gr(!!e.runningMode&&e.runningMode!==`IMAGE`)),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error(`You must create a new task to reset the canvas.`);return super.l(e,t)}close(){this.P.close(),super.close()}};Nu.prototype.close=Nu.prototype.close;var Pu=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect_in`,!1),this.j={detections:[]},w(e=this.h=new vc,0,1,t=new z),E(this.h,2,.5),E(this.h,3,.3)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return`minDetectionConfidence`in e&&E(this.h,2,e.minDetectionConfidence??.5),`minSuppressionThreshold`in e&&E(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Au(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},ju(this,e,n,t),this.j}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect_in`),R(e,`detections`);let t=new Ms;po(t,bc,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.face_detector.FaceDetectorGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect_in`),I(n,`DETECTIONS:detections`),n.o(t),Rs(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=Ys(t),this.j.detections.push(ml(e));H(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Pu.prototype.detectForVideo=Pu.prototype.G,Pu.prototype.detect=Pu.prototype.F,Pu.prototype.setOptions=Pu.prototype.o,Pu.createFromModelPath=async function(e,t){return G(Pu,e,{baseOptions:{modelAssetPath:t}})},Pu.createFromModelBuffer=function(e,t){return G(Pu,e,{baseOptions:{modelAssetBuffer:t}})},Pu.createFromOptions=function(e,t){return G(Pu,e,t)};var Fu=Tu([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Iu=Tu([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Lu=Tu([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Ru=Tu([474,475],[475,476],[476,477],[477,474]),zu=Tu([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Bu=Tu([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Vu=Tu([469,470],[470,471],[471,472],[472,469]),Hu=Tu([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),Uu=[...Fu,...Iu,...Lu,...zu,...Bu,...Hu],Wu=Tu([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Gu(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect`,!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,w(e=this.h=new Cc,0,1,t=new z),this.A=new Sc,w(this.h,0,3,this.A),this.u=new vc,w(this.h,0,2,this.u),pa(this.u,4,1),E(this.u,2,.5),E(this.A,2,.5),E(this.h,4,.5)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return`numFaces`in e&&pa(this.u,4,e.numFaces??1),`minFaceDetectionConfidence`in e&&E(this.u,2,e.minFaceDetectionConfidence??.5),`minTrackingConfidence`in e&&E(this.h,4,e.minTrackingConfidence??.5),`minFacePresenceConfidence`in e&&E(this.A,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`outputFacialTransformationMatrixes`in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return Gu(this),Au(this,e,t),this.j}G(e,t,n){return Gu(this),ju(this,e,n,t),this.j}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect`),R(e,`face_landmarks`);let t=new Ms;po(t,Tc,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`NORM_LANDMARKS:face_landmarks`),n.o(t),Rs(e,n),this.g.attachProtoVectorListener(`face_landmarks`,((e,t)=>{for(let t of e)e=$s(t),this.j.faceLandmarks.push(hl(e));H(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{H(this,e)})),this.outputFaceBlendshapes&&(R(e,`blendshapes`),I(n,`BLENDSHAPES:blendshapes`),this.g.attachProtoVectorListener(`blendshapes`,((e,t)=>{if(this.outputFaceBlendshapes)for(let t of e)e=Gs(t),this.j.faceBlendshapes.push(fl(e.g()??[]));H(this,t)})),this.g.attachEmptyPacketListener(`blendshapes`,(e=>{H(this,e)}))),this.outputFacialTransformationMatrixes&&(R(e,`face_geometry`),I(n,`FACE_GEOMETRY:face_geometry`),this.g.attachProtoVectorListener(`face_geometry`,((e,t)=>{if(this.outputFacialTransformationMatrixes)for(let t of e)(e=C(e=xc(t),ec,2))&&this.j.facialTransformationMatrixes.push({rows:fa(e,1)??0??0,columns:fa(e,2)??0??0,data:Gi(e,3,Wr,Wi()).slice()??[]});H(this,t)})),this.g.attachEmptyPacketListener(`face_geometry`,(e=>{H(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.G,K.prototype.detect=K.prototype.F,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return G(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return G(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return G(K,e,t)},K.FACE_LANDMARKS_LIPS=Fu,K.FACE_LANDMARKS_LEFT_EYE=Iu,K.FACE_LANDMARKS_LEFT_EYEBROW=Lu,K.FACE_LANDMARKS_LEFT_IRIS=Ru,K.FACE_LANDMARKS_RIGHT_EYE=zu,K.FACE_LANDMARKS_RIGHT_EYEBROW=Bu,K.FACE_LANDMARKS_RIGHT_IRIS=Vu,K.FACE_LANDMARKS_FACE_OVAL=Hu,K.FACE_LANDMARKS_CONTOURS=Uu,K.FACE_LANDMARKS_TESSELATION=Wu;var Ku=Tu([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function qu(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Ju(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function Yu(e,t=!0){let n=[];for(let i of e){var r=Gs(i);e=[];for(let n of r.g())r=t&&fa(n,1)!=null?fa(n,1)??0:-1,e.push({score:T(n,2)??0,index:r,categoryName:y(b(n,3))??``??``,displayName:y(b(n,4))??``??``});n.push(e)}return n}var Xu=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect`,!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],w(e=this.j=new Mc,0,1,t=new z),this.u=new jc,w(this.j,0,2,this.u),this.D=new Ac,w(this.u,0,3,this.D),this.A=new kc,w(this.u,0,2,this.A),this.h=new Oc,w(this.j,0,3,this.h),E(this.A,2,.5),E(this.u,4,.5),E(this.D,2,.5)}get baseOptions(){return C(this.j,z,1)}set baseOptions(e){w(this.j,0,1,e)}o(e){if(pa(this.A,3,e.numHands??1),`minHandDetectionConfidence`in e&&E(this.A,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&E(this.u,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&E(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Ec,n=t,r=ul(e.cannedGesturesClassifierOptions,C(this.h,Ec,3)?.l());w(n,0,2,r),w(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&C(this.h,Ec,3)?.g();return e.customGesturesClassifierOptions?(w(n=t=new Ec,0,2,r=ul(e.customGesturesClassifierOptions,C(this.h,Ec,4)?.l())),w(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&C(this.h,Ec,4)?.g(),this.l(e)}Ha(e,t){return qu(this),Au(this,e,t),Ju(this)}Ia(e,t,n){return qu(this),ju(this,e,n,t),Ju(this)}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect`),R(e,`hand_gestures`),R(e,`hand_landmarks`),R(e,`world_hand_landmarks`),R(e,`handedness`);let t=new Ms;po(t,Lc,this.j);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`HAND_GESTURES:hand_gestures`),I(n,`LANDMARKS:hand_landmarks`),I(n,`WORLD_LANDMARKS:world_hand_landmarks`),I(n,`HANDEDNESS:handedness`),n.o(t),Rs(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e){e=$s(t);let n=[];for(let t of sa(e,Qs,1))n.push({x:T(t,1)??0,y:T(t,2)??0,z:T(t,3)??0,visibility:T(t,4)??0});this.landmarks.push(n)}H(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e){e=Zs(t);let n=[];for(let t of sa(e,Xs,1))n.push({x:T(t,1)??0,y:T(t,2)??0,z:T(t,3)??0,visibility:T(t,4)??0});this.worldLandmarks.push(n)}H(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`hand_gestures`,((e,t)=>{this.gestures.push(...Yu(e,!1)),H(this,t)})),this.g.attachEmptyPacketListener(`hand_gestures`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{this.handedness.push(...Yu(e)),H(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Zu(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Xu.prototype.recognizeForVideo=Xu.prototype.Ia,Xu.prototype.recognize=Xu.prototype.Ha,Xu.prototype.setOptions=Xu.prototype.o,Xu.createFromModelPath=function(e,t){return G(Xu,e,{baseOptions:{modelAssetPath:t}})},Xu.createFromModelBuffer=function(e,t){return G(Xu,e,{baseOptions:{modelAssetBuffer:t}})},Xu.createFromOptions=function(e,t){return G(Xu,e,t)},Xu.HAND_CONNECTIONS=Ku;var Qu=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],w(e=this.h=new jc,0,1,t=new z),this.u=new Ac,w(this.h,0,3,this.u),this.j=new kc,w(this.h,0,2,this.j),pa(this.j,3,1),E(this.j,2,.5),E(this.u,2,.5),E(this.h,4,.5)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return`numHands`in e&&pa(this.j,3,e.numHands??1),`minHandDetectionConfidence`in e&&E(this.j,2,e.minHandDetectionConfidence??.5),`minTrackingConfidence`in e&&E(this.h,4,e.minTrackingConfidence??.5),`minHandPresenceConfidence`in e&&E(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Au(this,e,t),Zu(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ju(this,e,n,t),Zu(this)}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect`),R(e,`hand_landmarks`),R(e,`world_hand_landmarks`),R(e,`handedness`);let t=new Ms;po(t,Rc,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`LANDMARKS:hand_landmarks`),I(n,`WORLD_LANDMARKS:world_hand_landmarks`),I(n,`HANDEDNESS:handedness`),n.o(t),Rs(e,n),this.g.attachProtoVectorListener(`hand_landmarks`,((e,t)=>{for(let t of e)e=$s(t),this.landmarks.push(hl(e));H(this,t)})),this.g.attachEmptyPacketListener(`hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`world_hand_landmarks`,((e,t)=>{for(let t of e)e=Zs(t),this.worldLandmarks.push(gl(e));H(this,t)})),this.g.attachEmptyPacketListener(`world_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoVectorListener(`handedness`,((e,t)=>{var n=this.handedness,r=n.push;let i=[];for(let t of e){e=Gs(t);let n=[];for(let t of e.g())n.push({score:T(t,2)??0,index:fa(t,1)??0??-1,categoryName:y(b(t,3))??``??``,displayName:y(b(t,4))??``??``});i.push(n)}r.call(n,...i),H(this,t)})),this.g.attachEmptyPacketListener(`handedness`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Qu.prototype.detectForVideo=Qu.prototype.G,Qu.prototype.detect=Qu.prototype.F,Qu.prototype.setOptions=Qu.prototype.o,Qu.createFromModelPath=function(e,t){return G(Qu,e,{baseOptions:{modelAssetPath:t}})},Qu.createFromModelBuffer=function(e,t){return G(Qu,e,{baseOptions:{modelAssetBuffer:t}})},Qu.createFromOptions=function(e,t){return G(Qu,e,t)},Qu.HAND_CONNECTIONS=Ku;var $u=Tu([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function ed(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function td(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Il(e)}}function nd(e,t){e=$s(e),t.push(hl(e))}var q=class extends Nu{constructor(e,t){super(new Ou(e,t),`input_frames_image`,null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,w(e=this.j=new Hc,0,1,t=new z),this.I=new Ac,w(this.j,0,2,this.I),this.W=new zc,w(this.j,0,3,this.W),this.u=new vc,w(this.j,0,4,this.u),this.O=new Sc,w(this.j,0,5,this.O),this.A=new Bc,w(this.j,0,6,this.A),this.M=new Vc,w(this.j,0,7,this.M),E(this.u,2,.5),E(this.u,3,.3),E(this.O,2,.5),E(this.A,2,.5),E(this.A,3,.3),E(this.M,2,.5),E(this.I,2,.5)}get baseOptions(){return C(this.j,z,1)}set baseOptions(e){w(this.j,0,1,e)}o(e){return`minFaceDetectionConfidence`in e&&E(this.u,2,e.minFaceDetectionConfidence??.5),`minFaceSuppressionThreshold`in e&&E(this.u,3,e.minFaceSuppressionThreshold??.3),`minFacePresenceConfidence`in e&&E(this.O,2,e.minFacePresenceConfidence??.5),`outputFaceBlendshapes`in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),`minPoseDetectionConfidence`in e&&E(this.A,2,e.minPoseDetectionConfidence??.5),`minPoseSuppressionThreshold`in e&&E(this.A,3,e.minPoseSuppressionThreshold??.3),`minPosePresenceConfidence`in e&&E(this.M,2,e.minPosePresenceConfidence??.5),`outputPoseSegmentationMasks`in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),`minHandLandmarksConfidence`in e&&E(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.D=typeof t==`function`?t:n,ed(this),Au(this,e,r),td(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.D=typeof n==`function`?n:r,ed(this),ju(this,e,i,t),td(this)}m(){var e=new zs;L(e,`input_frames_image`),R(e,`pose_landmarks`),R(e,`pose_world_landmarks`),R(e,`face_landmarks`),R(e,`left_hand_landmarks`),R(e,`left_hand_world_landmarks`),R(e,`right_hand_landmarks`),R(e,`right_hand_world_landmarks`);let t=new Ms,n=new vs;ma(n,1,`type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions`),function(e,t){if(t!=null)if(Array.isArray(t))x(e,2,Ci(t,0,Ti));else{if(!(typeof t==`string`||t instanceof kn||Tn(t)))throw Error(`invalid value in Any.value field: `+t+` expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array`);Qi(e,2,ar(t,!1),Dn())}}(n,this.j.g());let r=new Ps;ma(r,2,`mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph`),da(r,8,vs,n),F(r,`IMAGE:input_frames_image`),I(r,`POSE_LANDMARKS:pose_landmarks`),I(r,`POSE_WORLD_LANDMARKS:pose_world_landmarks`),I(r,`FACE_LANDMARKS:face_landmarks`),I(r,`LEFT_HAND_LANDMARKS:left_hand_landmarks`),I(r,`LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks`),I(r,`RIGHT_HAND_LANDMARKS:right_hand_landmarks`),I(r,`RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks`),r.o(t),Rs(e,r),Pl(this,e),this.g.attachProtoListener(`pose_landmarks`,((e,t)=>{nd(e,this.h.poseLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`pose_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`pose_world_landmarks`,((e,t)=>{var n=this.h.poseWorldLandmarks;e=Zs(e),n.push(gl(e)),H(this,t)})),this.g.attachEmptyPacketListener(`pose_world_landmarks`,(e=>{H(this,e)})),this.outputPoseSegmentationMasks&&(I(r,`POSE_SEGMENTATION_MASK:pose_segmentation_mask`),Fl(this,`pose_segmentation_mask`),this.g.Z(`pose_segmentation_mask`,((e,t)=>{this.h.poseSegmentationMasks=[Mu(this,e,!0,!this.D)],H(this,t)})),this.g.attachEmptyPacketListener(`pose_segmentation_mask`,(e=>{this.h.poseSegmentationMasks=[],H(this,e)}))),this.g.attachProtoListener(`face_landmarks`,((e,t)=>{nd(e,this.h.faceLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`face_landmarks`,(e=>{H(this,e)})),this.outputFaceBlendshapes&&(R(e,`extra_blendshapes`),I(r,`FACE_BLENDSHAPES:extra_blendshapes`),this.g.attachProtoListener(`extra_blendshapes`,((e,t)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(e=Gs(e),n.push(fl(e.g()??[]))),H(this,t)})),this.g.attachEmptyPacketListener(`extra_blendshapes`,(e=>{H(this,e)}))),this.g.attachProtoListener(`left_hand_landmarks`,((e,t)=>{nd(e,this.h.leftHandLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`left_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`left_hand_world_landmarks`,((e,t)=>{var n=this.h.leftHandWorldLandmarks;e=Zs(e),n.push(gl(e)),H(this,t)})),this.g.attachEmptyPacketListener(`left_hand_world_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`right_hand_landmarks`,((e,t)=>{nd(e,this.h.rightHandLandmarks),H(this,t)})),this.g.attachEmptyPacketListener(`right_hand_landmarks`,(e=>{H(this,e)})),this.g.attachProtoListener(`right_hand_world_landmarks`,((e,t)=>{var n=this.h.rightHandWorldLandmarks;e=Zs(e),n.push(gl(e)),H(this,t)})),this.g.attachEmptyPacketListener(`right_hand_world_landmarks`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};q.prototype.detectForVideo=q.prototype.G,q.prototype.detect=q.prototype.F,q.prototype.setOptions=q.prototype.o,q.createFromModelPath=function(e,t){return G(q,e,{baseOptions:{modelAssetPath:t}})},q.createFromModelBuffer=function(e,t){return G(q,e,{baseOptions:{modelAssetBuffer:t}})},q.createFromOptions=function(e,t){return G(q,e,t)},q.HAND_CONNECTIONS=Ku,q.POSE_CONNECTIONS=$u,q.FACE_LANDMARKS_LIPS=Fu,q.FACE_LANDMARKS_LEFT_EYE=Iu,q.FACE_LANDMARKS_LEFT_EYEBROW=Lu,q.FACE_LANDMARKS_LEFT_IRIS=Ru,q.FACE_LANDMARKS_RIGHT_EYE=zu,q.FACE_LANDMARKS_RIGHT_EYEBROW=Bu,q.FACE_LANDMARKS_RIGHT_IRIS=Vu,q.FACE_LANDMARKS_FACE_OVAL=Hu,q.FACE_LANDMARKS_CONTOURS=Uu,q.FACE_LANDMARKS_TESSELATION=Wu;var rd=class extends Nu{constructor(e,t){super(new Ou(e,t),`input_image`,`norm_rect`,!0),this.j={classifications:[]},w(e=this.h=new Gc,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return w(this.h,0,2,ul(e,C(this.h,uc,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Au(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},ju(this,e,n,t),this.j}m(){var e=new zs;L(e,`input_image`),L(e,`norm_rect`),R(e,`classifications`);let t=new Ms;po(t,Kc,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.image_classifier.ImageClassifierGraph`),F(n,`IMAGE:input_image`),F(n,`NORM_RECT:norm_rect`),I(n,`CLASSIFICATIONS:classifications`),n.o(t),Rs(e,n),this.g.attachProtoListener(`classifications`,((e,t)=>{this.j=pl(ic(e)),H(this,t)})),this.g.attachEmptyPacketListener(`classifications`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};rd.prototype.classifyForVideo=rd.prototype.ta,rd.prototype.classify=rd.prototype.sa,rd.prototype.setOptions=rd.prototype.o,rd.createFromModelPath=function(e,t){return G(rd,e,{baseOptions:{modelAssetPath:t}})},rd.createFromModelBuffer=function(e,t){return G(rd,e,{baseOptions:{modelAssetBuffer:t}})},rd.createFromOptions=function(e,t){return G(rd,e,t)};var id=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect`,!0),this.h=new qc,this.embeddings={embeddings:[]},w(e=this.h,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){var t=this.h,n=C(this.h,fc,2);return n=n?n.clone():new fc,e.l2Normalize===void 0?`l2Normalize`in e&&x(n,1):x(n,1,Gr(e.l2Normalize)),e.quantize===void 0?`quantize`in e&&x(n,2):x(n,2,Gr(e.quantize)),w(t,0,2,n),this.l(e)}za(e,t){return Au(this,e,t),this.embeddings}Aa(e,t,n){return ju(this,e,n,t),this.embeddings}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect`),R(e,`embeddings_out`);let t=new Ms;po(t,Jc,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`EMBEDDINGS:embeddings_out`),n.o(t),Rs(e,n),this.g.attachProtoListener(`embeddings_out`,((e,t)=>{e=lc(e),this.embeddings=function(e){return{embeddings:sa(e,sc,1).map((e=>{let t={headIndex:fa(e,3)??0??-1,headName:y(b(e,4))??``??``};var n=e.v;return aa(n,0|n[h],ac,ea(e,1))===void 0?(n=new Uint8Array,t.quantizedEmbedding=C(e,oc,ea(e,2),void 0)?.na()?.h()??n):(e=Gi(e=C(e,ac,ea(e,1),void 0),1,Wr,Wi()),t.floatEmbedding=e.slice()),t})),timestampMs:dl(b(e,2,void 0,void 0,ni)??Vi)}}(e),H(this,t)})),this.g.attachEmptyPacketListener(`embeddings_out`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};id.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=vl(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error(`Cannot compute cosine similarity between quantized and float embeddings.`);e=vl(_l(e.quantizedEmbedding),_l(t.quantizedEmbedding))}return e},id.prototype.embedForVideo=id.prototype.Aa,id.prototype.embed=id.prototype.za,id.prototype.setOptions=id.prototype.o,id.createFromModelPath=function(e,t){return G(id,e,{baseOptions:{modelAssetPath:t}})},id.createFromModelBuffer=function(e,t){return G(id,e,{baseOptions:{modelAssetBuffer:t}})},id.createFromOptions=function(e,t){return G(id,e,t)};var ad=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function od(e){let t=function(e){return sa(e,Ps,1)}(e.ca()).filter((e=>(y(b(e,1))??``).includes(`mediapipe.tasks.TensorsToSegmentationCalculator`)));if(e.u=[],t.length>1)throw Error(`The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.`);t.length===1&&(C(t[0],Ms,7)?.j()?.g()??new Map).forEach(((t,n)=>{e.u[Number(n)]=y(b(t,1))??``}))}function sd(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function cd(e){try{let t=new ad(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Il(e)}}ad.prototype.close=ad.prototype.close;var ld=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect`,!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new $c,this.A=new Yc,w(this.h,0,3,this.A),w(e=this.h,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&x(this.h,2):x(this.h,2,ii(e.displayNamesLocale)),`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){od(this)}segment(e,t,n){let r=typeof t==`function`?{}:t;return this.j=typeof t==`function`?t:n,sd(this),Au(this,e,r),cd(this)}La(e,t,n,r){let i=typeof n==`function`?{}:n;return this.j=typeof n==`function`?n:r,sd(this),ju(this,e,i,t),cd(this)}Da(){return this.u}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect`);let t=new Ms;po(t,el,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),n.o(t),Rs(e,n),Pl(this,e),this.outputConfidenceMasks&&(R(e,`confidence_masks`),I(n,`CONFIDENCE_MASKS:confidence_masks`),Fl(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>Mu(this,e,!0,!this.j))),H(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],H(this,e)}))),this.outputCategoryMask&&(R(e,`category_mask`),I(n,`CATEGORY_MASK:category_mask`),Fl(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=Mu(this,e,!1,!this.j),H(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,H(this,e)}))),R(e,`quality_scores`),I(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,H(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ld.prototype.getLabels=ld.prototype.Da,ld.prototype.segmentForVideo=ld.prototype.La,ld.prototype.segment=ld.prototype.segment,ld.prototype.setOptions=ld.prototype.o,ld.createFromModelPath=function(e,t){return G(ld,e,{baseOptions:{modelAssetPath:t}})},ld.createFromModelBuffer=function(e,t){return G(ld,e,{baseOptions:{modelAssetBuffer:t}})},ld.createFromOptions=function(e,t){return G(ld,e,t)};var ud=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};ud.prototype.close=ud.prototype.close;var dd=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect_in`,!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new $c,this.u=new Yc,w(this.h,0,3,this.u),w(e=this.h,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return`outputCategoryMask`in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),`outputConfidenceMasks`in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,n,r){let i=typeof n==`function`?{}:n;if(this.j=typeof n==`function`?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new il,t.keypoint&&t.scribble)throw Error(`Cannot provide both keypoint and scribble.`);if(t.keypoint){var a=new tl;Qi(a,3,Gr(!0),!1),Qi(a,1,Ur(t.keypoint.x),0),Qi(a,2,Ur(t.keypoint.y),0),la(r,1,al,a)}else{if(!t.scribble)throw Error(`Must provide either a keypoint or a scribble.`);{let e=new rl;for(a of t.scribble)Qi(t=new tl,3,Gr(!0),!1),Qi(t,1,Ur(a.x),0),Qi(t,2,Ur(a.y),0),da(e,1,tl,t);la(r,2,al,e)}}this.g.addProtoToStream(r.g(),`mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest`,`roi_in`,n),Au(this,e,i);t:{try{let e=new ud(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=e;break t}this.j(e)}finally{Il(this)}o=void 0}return o}m(){var e=new zs;L(e,`image_in`),L(e,`roi_in`),L(e,`norm_rect_in`);let t=new Ms;po(t,el,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2`),F(n,`IMAGE:image_in`),F(n,`ROI:roi_in`),F(n,`NORM_RECT:norm_rect_in`),n.o(t),Rs(e,n),Pl(this,e),this.outputConfidenceMasks&&(R(e,`confidence_masks`),I(n,`CONFIDENCE_MASKS:confidence_masks`),Fl(this,`confidence_masks`),this.g.aa(`confidence_masks`,((e,t)=>{this.confidenceMasks=e.map((e=>Mu(this,e,!0,!this.j))),H(this,t)})),this.g.attachEmptyPacketListener(`confidence_masks`,(e=>{this.confidenceMasks=[],H(this,e)}))),this.outputCategoryMask&&(R(e,`category_mask`),I(n,`CATEGORY_MASK:category_mask`),Fl(this,`category_mask`),this.g.Z(`category_mask`,((e,t)=>{this.categoryMask=Mu(this,e,!1,!this.j),H(this,t)})),this.g.attachEmptyPacketListener(`category_mask`,(e=>{this.categoryMask=void 0,H(this,e)}))),R(e,`quality_scores`),I(n,`QUALITY_SCORES:quality_scores`),this.g.attachFloatVectorListener(`quality_scores`,((e,t)=>{this.qualityScores=e,H(this,t)})),this.g.attachEmptyPacketListener(`quality_scores`,(e=>{this.categoryMask=void 0,H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};dd.prototype.segment=dd.prototype.segment,dd.prototype.setOptions=dd.prototype.o,dd.createFromModelPath=function(e,t){return G(dd,e,{baseOptions:{modelAssetPath:t}})},dd.createFromModelBuffer=function(e,t){return G(dd,e,{baseOptions:{modelAssetBuffer:t}})},dd.createFromOptions=function(e,t){return G(dd,e,t)};var fd=class extends Nu{constructor(e,t){super(new Ou(e,t),`input_frame_gpu`,`norm_rect`,!1),this.j={detections:[]},w(e=this.h=new ol,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return e.displayNamesLocale===void 0?`displayNamesLocale`in e&&x(this.h,2):x(this.h,2,ii(e.displayNamesLocale)),e.maxResults===void 0?`maxResults`in e&&x(this.h,3):pa(this.h,3,e.maxResults),e.scoreThreshold===void 0?`scoreThreshold`in e&&x(this.h,4):E(this.h,4,e.scoreThreshold),e.categoryAllowlist===void 0?`categoryAllowlist`in e&&x(this.h,5):ha(this.h,5,e.categoryAllowlist),e.categoryDenylist===void 0?`categoryDenylist`in e&&x(this.h,6):ha(this.h,6,e.categoryDenylist),this.l(e)}F(e,t){return this.j={detections:[]},Au(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},ju(this,e,n,t),this.j}m(){var e=new zs;L(e,`input_frame_gpu`),L(e,`norm_rect`),R(e,`detections`);let t=new Ms;po(t,sl,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.ObjectDetectorGraph`),F(n,`IMAGE:input_frame_gpu`),F(n,`NORM_RECT:norm_rect`),I(n,`DETECTIONS:detections`),n.o(t),Rs(e,n),this.g.attachProtoVectorListener(`detections`,((e,t)=>{for(let t of e)e=Ys(t),this.j.detections.push(ml(e));H(this,t)})),this.g.attachEmptyPacketListener(`detections`,(e=>{H(this,e)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};fd.prototype.detectForVideo=fd.prototype.G,fd.prototype.detect=fd.prototype.F,fd.prototype.setOptions=fd.prototype.o,fd.createFromModelPath=async function(e,t){return G(fd,e,{baseOptions:{modelAssetPath:t}})},fd.createFromModelBuffer=function(e,t){return G(fd,e,{baseOptions:{modelAssetBuffer:t}})},fd.createFromOptions=function(e,t){return G(fd,e,t)};var pd=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function md(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function hd(e){try{let t=new pd(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Il(e)}}pd.prototype.close=pd.prototype.close;var gd=class extends Nu{constructor(e,t){super(new Ou(e,t),`image_in`,`norm_rect`,!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,w(e=this.h=new cl,0,1,t=new z),this.A=new Vc,w(this.h,0,3,this.A),this.j=new Bc,w(this.h,0,2,this.j),pa(this.j,4,1),E(this.j,2,.5),E(this.A,2,.5),E(this.h,4,.5)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return`numPoses`in e&&pa(this.j,4,e.numPoses??1),`minPoseDetectionConfidence`in e&&E(this.j,2,e.minPoseDetectionConfidence??.5),`minTrackingConfidence`in e&&E(this.h,4,e.minTrackingConfidence??.5),`minPosePresenceConfidence`in e&&E(this.A,2,e.minPosePresenceConfidence??.5),`outputSegmentationMasks`in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){let r=typeof t==`function`?{}:t;return this.u=typeof t==`function`?t:n,md(this),Au(this,e,r),hd(this)}G(e,t,n,r){let i=typeof n==`function`?{}:n;return this.u=typeof n==`function`?n:r,md(this),ju(this,e,i,t),hd(this)}m(){var e=new zs;L(e,`image_in`),L(e,`norm_rect`),R(e,`normalized_landmarks`),R(e,`world_landmarks`),R(e,`segmentation_masks`);let t=new Ms;po(t,ll,this.h);let n=new Ps;ma(n,2,`mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph`),F(n,`IMAGE:image_in`),F(n,`NORM_RECT:norm_rect`),I(n,`NORM_LANDMARKS:normalized_landmarks`),I(n,`WORLD_LANDMARKS:world_landmarks`),n.o(t),Rs(e,n),Pl(this,e),this.g.attachProtoVectorListener(`normalized_landmarks`,((e,t)=>{this.landmarks=[];for(let t of e)e=$s(t),this.landmarks.push(hl(e));H(this,t)})),this.g.attachEmptyPacketListener(`normalized_landmarks`,(e=>{this.landmarks=[],H(this,e)})),this.g.attachProtoVectorListener(`world_landmarks`,((e,t)=>{this.worldLandmarks=[];for(let t of e)e=Zs(t),this.worldLandmarks.push(gl(e));H(this,t)})),this.g.attachEmptyPacketListener(`world_landmarks`,(e=>{this.worldLandmarks=[],H(this,e)})),this.outputSegmentationMasks&&(I(n,`SEGMENTATION_MASK:segmentation_masks`),Fl(this,`segmentation_masks`),this.g.aa(`segmentation_masks`,((e,t)=>{this.segmentationMasks=e.map((e=>Mu(this,e,!0,!this.u))),H(this,t)})),this.g.attachEmptyPacketListener(`segmentation_masks`,(e=>{this.segmentationMasks=[],H(this,e)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};gd.prototype.detectForVideo=gd.prototype.G,gd.prototype.detect=gd.prototype.F,gd.prototype.setOptions=gd.prototype.o,gd.createFromModelPath=function(e,t){return G(gd,e,{baseOptions:{modelAssetPath:t}})},gd.createFromModelBuffer=function(e,t){return G(gd,e,{baseOptions:{modelAssetBuffer:t}})},gd.createFromOptions=function(e,t){return G(gd,e,t)},gd.POSE_CONNECTIONS=$u,(function(e,t){let n=wd,r=e();for(;;)try{if(-parseInt(n(209))/1+-parseInt(n(218))/2*(-parseInt(n(206))/3)+parseInt(n(213))/4+parseInt(n(227))/5*(parseInt(n(217))/6)+-parseInt(n(220))/7+-parseInt(n(214))/8*(-parseInt(n(215))/9)+-parseInt(n(204))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(yd,362740);var _d=12,vd=`SHA-256`;function yd(){let e=`crypto, response is incomplete.,model_download_url,application/json,subtle,modelBuildVersion,220670QkaEPB,length,615PdQPxK,importKey,Bearer ,571331NGtXNm,MonitorDog SDK ,generateKey,replace,1522720oJqvzU,1332968vEhgHy,27IgqxJU,decrypt,205212rjfmUg,3310seeTRy,slice,2324588ynaPYB, request failed: ,status,set,buildVersion,errorContext,publicKey,10JGajwF,RSA-OAEP,fill,-----BEGIN PUBLIC KEY-----,encode,byteLength`.split(`,`);return yd=function(){return e},yd()}async function bd(e){let t=wd;Pd();let n=await crypto.subtle[t(211)]({name:t(228),modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:vd},!0,[`decrypt`]),r=Dd(await Td(n[t(226)])),i=await xd({apiBaseUrl:e.apiBaseUrl,accessToken:e.accessToken,buildVersion:e[t(224)],buildNumber:e.buildNumber,errorContext:e[t(225)]},r),a=await Sd(i.model_download_url),o=new Uint8Array(await crypto[t(237)].decrypt({name:`RSA-OAEP`},n.privateKey,Nd(Od(i.encrypted_dek)))),s=kd(o);try{return await Cd(a,s)}finally{a.fill(0),o.fill(0),s[t(229)](0)}}async function xd(e,t){let n=wd,r=new URLSearchParams({build_version:e[n(224)],build_number:String(e.buildNumber),public_key:t}),i=await fetch(e.apiBaseUrl+`/auth/sdk-model?`+r,{method:`GET`,headers:{accept:n(236),authorization:n(208)+e.accessToken,"Device-Access-Token":e.accessToken}});if(!i.ok)throw Error(`MonitorDog SDK `+e[n(225)]+n(221)+i.status);let a=await i.json();if(!a.encrypted_dek||!a[n(235)])throw Error(n(210)+e.errorContext+n(234));return{encrypted_dek:a.encrypted_dek,model_download_url:a[n(235)]}}async function Sd(e){let t=wd,n=await fetch(e);if(!n.ok)throw Error(`Failed to download MonitorDog model: `+n[t(222)]+` `+n.statusText);return new Uint8Array(await n.arrayBuffer())}async function Cd(e,t){let n=wd;if(e[n(232)]<=_d)throw Error(`MonitorDog encrypted model data is too short.`);let r=await crypto.subtle[n(207)](`raw`,Nd(t),{name:`AES-GCM`},!1,[`decrypt`]),i=e[n(219)](0,_d),a=e.slice(_d);return new Uint8Array(await crypto.subtle[n(216)]({name:`AES-GCM`,iv:Nd(i)},r,Nd(a)))}function wd(e,t){return e-=203,yd()[e]}async function Td(e){let t=wd,n=await crypto.subtle.exportKey(`spki`,e),r=Ed(new Uint8Array(n)).match(/.{1,64}/g)??[];return[t(230),...r,`-----END PUBLIC KEY-----`].join(`
|
|
42
|
-
`)}function Ed(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function Dd(e){let t=wd;return Ed(new TextEncoder()[t(231)](e))}function Od(e){let t=wd,n=e.replace(/-----BEGIN [^-]+-----/g,``).replace(/-----END [^-]+-----/g,``).replace(/\s/g,``).replace(/-/g,`+`)[t(212)](/_/g,`/`),r=(4-n.length%4)%4,i=n+`=`.repeat(r),a=atob(i),o=new Uint8Array(a.length);for(let e=0;e<a[t(205)];e+=1)o[e]=a.charCodeAt(e);return o}function kd(e){if(Md(e.byteLength))return new Uint8Array(e);let t=new TextDecoder().decode(e).trim(),n=Ad(t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t);if(n&&Md(n.byteLength))return n;throw Error(`MonitorDog SDK model DEK must decode to a 128-bit or 256-bit AES key. Received `+e.byteLength+` bytes.`)}function Ad(e){if(/^[0-9a-f]+$/i.test(e)&&e.length%2==0)return jd(e);try{return Od(e)}catch{return}}function jd(e){let t=wd,n=new Uint8Array(e.length/2);for(let r=0;r<n[t(205)];r+=1)n[r]=Number.parseInt(e[t(219)](r*2,r*2+2),16);return n}function Md(e){return e===16||e===32}function Nd(e){let t=wd,n=new ArrayBuffer(e.byteLength);return new Uint8Array(n)[t(223)](e),n}function Pd(){if(!globalThis[wd(233)]?.subtle)throw Error(`MonitorDog SDK model decryption requires Web Crypto API.`)}(function(e,t){let n=Fd,r=e();for(;;)try{if(-parseInt(n(438))/1*(parseInt(n(430))/2)+-parseInt(n(433))/3*(-parseInt(n(431))/4)+parseInt(n(425))/5*(parseInt(n(423))/6)+parseInt(n(428))/7+parseInt(n(435))/8+-parseInt(n(436))/9+parseInt(n(426))/10*(-parseInt(n(434))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(zd,939525);function Fd(e,t){return e-=422,zd()[e]}async function Id(e){let t=Fd,[n,r,i]=await Promise.all([Ld(e,se,t(432)),Ld(e,ce,`MediaPipe vision WASM binary`),Ld(e,oe,`MediaPipe pose model`)]),a=Rd(n,`text/javascript`),o=Rd(r,t(437));return n.fill(0),r[t(424)](0),{wasmFileset:{wasmLoaderPath:a,wasmBinaryPath:o},poseModelAssetBuffer:i,dispose(){let e=t;URL.revokeObjectURL(a),URL[e(429)](o),i.fill(0)}}}function Ld(e,t,n){return bd({apiBaseUrl:e.apiBaseUrl,accessToken:e.accessToken,buildVersion:ae,buildNumber:t,errorContext:n})}function Rd(e,t){return URL[Fd(427)](new Blob([Bd(e)],{type:t}))}function zd(){let e=[`6zegCLF`,`fill`,`8577355PyiKFH`,`20oxmGIy`,`createObjectURL`,`3212244jpgLCB`,`revokeObjectURL`,`878798nekvIL`,`949540PXSGsb`,`MediaPipe vision WASM loader`,`15GwfKnf`,`9462563kwRoNO`,`11417528BcreqD`,`15201801vJubDm`,`application/wasm`,`1mZXWJo`,`set`];return zd=function(){return e},zd()}function Bd(e){let t=Fd,n=new ArrayBuffer(e.byteLength);return new Uint8Array(n)[t(422)](e),n}(function(e,t){let n=Vd,r=e();for(;;)try{if(parseInt(n(115))/1*(parseInt(n(116))/2)+-parseInt(n(124))/3+parseInt(n(125))/4+parseInt(n(126))/5+parseInt(n(117))/6*(parseInt(n(114))/7)+parseInt(n(111))/8+-parseInt(n(112))/9*(parseInt(n(121))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})($d,836586);function Vd(e,t){return e-=111,$d()[e]}var Hd=.04;function Ud(e,t){return e!==void 0&&e.visibility>=t}function Wd(e,t){let n=Vd;return[e[uf.leftShoulder],e[uf[n(122)]],e[uf.leftHip],e[uf.rightHip]].filter(e=>Ud(e,t))}function Gd(e){return e===`track`?{minShoulderWidth:nf,minVisibility:of}:{minShoulderWidth:tf,minVisibility:af}}function Kd(e){let t=Vd,n=e.reduce((e,t)=>({x:e.x+t.x,y:e.y+t.y}),{x:0,y:0});return{x:Qd(n.x/e[t(123)]),y:Qd(n.y/e[t(123)])}}function qd(e){let t=Vd,n=e.map(e=>e.x),r=e.map(e=>e.y),i=Math.min(...n),a=Math[t(120)](...r),o=Math.max(...n),s=Math[t(118)](...r),c=Math[t(118)](o-i,Hd),l=Math.max(s-a,Hd),u=(i+o)/2,d=(a+s)/2;return{x:Qd(u-c/2),y:Qd(d-l/2),width:Math[t(120)](c,1),height:Math.min(l,1)}}function Jd(e,t){let n=Vd,r=Math[n(118)](e.x,t.x),i=Math[n(118)](e.y,t.y),a=Math[n(120)](e.x+e.width,t.x+t.width),o=Math.min(e.y+e.height,t.y+t.height),s=Math[n(118)](0,a-r)*Math.max(0,o-i),c=Math.min(Yd(e),Yd(t));return c<=0?0:s/c}function Yd(e){return e[Vd(113)]*e.height}function Xd(e,t){if(!e||!t)return!1;let n=t/e;return n>=.45&&n<=2.2}function Zd(e,t){return Math[Vd(119)](e.x-t.x,e.y-t.y)}function Qd(e){return Math[Vd(120)](Math.max(e,0),1)}function $d(){let e=[`12YAagJb`,`max`,`hypot`,`min`,`10GHlQLn`,`rightShoulder`,`length`,`1628787BRQezt`,`2876644yyniby`,`3330620TBFQht`,`11346504GvTyPr`,`29709324dyKSVj`,`width`,`1006271rhcPpF`,`41XUgwfH`,`77534nyBAil`];return $d=function(){return e},$d()}function ef(e,t,n){return Math[Vd(120)](Math.max(e,t),n)}var J=rf;(function(e,t){let n=rf,r=e();for(;;)try{if(parseInt(n(283))/1+parseInt(n(269))/2*(-parseInt(n(238))/3)+parseInt(n(270))/4*(-parseInt(n(234))/5)+-parseInt(n(263))/6+-parseInt(n(262))/7+parseInt(n(280))/8*(parseInt(n(251))/9)+-parseInt(n(289))/10*(-parseInt(n(245))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(sf,868039);var tf=.2,nf=.08;function rf(e,t){return e-=232,sf()[e]}var af=.5,of=.75;function sf(){let e=`wasmFileset.abs.distance.landmarks.markMissing.setTracking.toPoseCandidate.createElement.dispose.1995042iDOyhl.6379890twUoLW.accessToken.centroid.setAway.sort.TRACKING.2629182ArfVet.12kAEBbA.rightHip.AWAY.leftHip.load.lastTrack.apiBaseUrl.CPU.GPU.createPoseLandmarkerWithFallback.6952tneatC.detectForVideo.torsoBox.761941rnmtAx.lastCentroid.minVisibility.shoulderWidth.getSelfHostedModelAssetPath.poseLandmarker.10kuGjIO.length.assetBundle.MISSING.1735505mPLYjF.missingSampleCount.poseModelAssetPath.INIT.3hnJtMI.findMainUser.map.createPoseLandmarker.missingStartedAt.leftShoulder.loadAssetBundle.41072251HRFMLs.wasmBasePath.getSelfHostedWasmBasePath.numPoses.createResult.toPoseCandidates.792QlhKso.minShoulderWidth`.split(`.`);return sf=function(){return e},sf()}var cf=1,lf=2,uf={leftShoulder:11,rightShoulder:12,leftHip:23,rightHip:24},df=class{wasmBasePath;[J(236)];[J(248)];apiBaseUrl;[J(264)];assetBundle;[J(288)];state=J(237);lastCentroid;lastTrack;hasTrackedUser=!1;[J(242)];[J(235)]=0;constructor(e={}){let t=J;this.apiBaseUrl=e.apiBaseUrl,this.accessToken=e.accessToken,this.wasmBasePath=e.wasmBasePath??``,this[t(236)]=e.modelAssetPath??``,this.numPoses=ef(e[t(248)]??cf,1,4)}async[J(274)](){let e=J;this.poseLandmarker||(this.poseLandmarker??=await this[e(279)]())}detectForVideo(e,t){let n=J;if(!this.poseLandmarker)throw Error(`MediaPipe main user tracker is not loaded.`);let r=this[n(288)][n(281)](e,t);if(this.state===n(268)||this.state===`MISSING`){let e=this.toPoseCandidates(r[n(256)],`track`),i=this.matchCandidate(e);return i?(this[n(258)](i,t),this.createResult(r[n(256)],e)):(this[n(257)](t),this[n(249)](r.landmarks,e))}let i=this[n(250)](r[n(256)],`acquire`),a=this.findMainUser(i);return a?(this.setTracking(a,t),this.createResult(r.landmarks,i)):this[n(249)](r.landmarks,i)}getSnapshot(e){let t=J,n=this.state===t(233)&&this[t(242)]!==void 0?Math.max(0,e-this.missingStartedAt):0;return{enabled:!0,state:this.state,hasTrackedUser:this.hasTrackedUser,lastCentroid:this[t(275)]?.centroid??this.lastCentroid,missingElapsedMs:n,poseCount:0,candidateCount:0}}reset(){this.resetTrackingState({preserveHistory:!1})}resetTrackingState(e){let t=J;this.state=`INIT`,this.lastCentroid=void 0,this[t(275)]=void 0,!e.preserveHistory&&(this.hasTrackedUser=!1),this.missingStartedAt=void 0,this.missingSampleCount=0}dispose(){let e=J;this[e(288)]?.close(),this.poseLandmarker=void 0,this.assetBundle?.[e(261)](),this.assetBundle=void 0,this.reset()}async[J(279)](){let e=J;try{return await this.createPoseLandmarker(e(278))}catch{return this[e(241)](e(277))}}async createPoseLandmarker(e){let t=J,n=await this[t(244)](),r=n?n[t(253)]:await Cl.forVisionTasks(this.getSelfHostedWasmBasePath());return gd.createFromOptions(r,{baseOptions:{...n?{modelAssetBuffer:new Uint8Array(n.poseModelAssetBuffer)}:{modelAssetPath:this.getSelfHostedModelAssetPath()},delegate:e},runningMode:`VIDEO`,numPoses:this.numPoses,...e===`GPU`?{canvas:document[t(260)](`canvas`)}:{}})}async loadAssetBundle(){let e=J;if(!this.hasSelfHostedAssetPath()&&!(!this[e(276)]||!this.accessToken))return this[e(232)]??=await Id({apiBaseUrl:this[e(276)],accessToken:this[e(264)]}),this.assetBundle}hasSelfHostedAssetPath(){return!!(this.wasmBasePath||this.poseModelAssetPath)}[J(247)](){let e=J;if(!this[e(246)]||!this.poseModelAssetPath)throw Error(`Both mainUserTrackingWasmBasePath and mainUserTrackingModelAssetPath are required for self-hosted MediaPipe assets.`);return this.wasmBasePath}[J(287)](){let e=J;if(!this.wasmBasePath||!this[e(236)])throw Error(`Both mainUserTrackingWasmBasePath and mainUserTrackingModelAssetPath are required for self-hosted MediaPipe assets.`);return this.poseModelAssetPath}[J(250)](e,t){return e[J(240)](e=>this.toPoseCandidate(e,t)).filter(e=>!!e)}[J(259)](e,t){let n=J,r=Gd(t),i=Wd(e,r[n(285)]),a=e[uf.leftShoulder],o=e[uf.rightShoulder],s=Ud(a,r.minVisibility),c=Ud(o,r.minVisibility);if(t===`track`){if(i[n(290)]<lf)return;let e=s&&c?Math.abs(a.x-o.x):void 0;return{centroid:Kd(i),torsoBox:qd(i),shoulderWidth:e!==void 0&&e>=.08?e:void 0}}if(!s||!c)return;let l=Math[n(254)](a.x-o.x);if(!(l<r[n(252)]))return{centroid:this.getPoseCentroid(e,r.minVisibility),torsoBox:qd(i),shoulderWidth:l}}getPoseCentroid(e,t){let n=J,r=[e[uf[n(243)]],e[uf.rightShoulder]],i=[e[uf[n(273)]],e[uf[n(271)]]],a=i.filter(e=>Ud(e,t));return Kd(a.length===i.length?[...r,...a]:r)}[J(239)](e){return e.reduce((e,t)=>e?Zd(t.centroid,{x:.5,y:.5})<Zd(e.centroid,{x:.5,y:.5})?t:e:t,void 0)}matchCandidate(e){let t=J;if(this.lastTrack)return e.map(e=>({candidate:e,distance:Zd(e[t(265)],this.lastTrack.centroid),overlapRatio:Jd(e[t(282)],this[t(275)][t(282)]),scaleMatches:Xd(this.lastTrack.shoulderWidth,e.shoulderWidth)})).filter(e=>e.distance<=.25||e.distance<=.45&&e.overlapRatio>=.15||e.distance<=.45&&e.scaleMatches)[t(267)]((e,n)=>e.distance-n[t(255)])[0]?.candidate}setTracking(e,t){let n=J;this.state=`TRACKING`,this.hasTrackedUser=!0,this[n(284)]=e[n(265)],this[n(275)]={centroid:e.centroid,torsoBox:e[n(282)],shoulderWidth:e[n(286)],updatedAt:t},this.missingStartedAt=void 0,this.missingSampleCount=0}[J(257)](e){let t=J;this[t(242)]===void 0&&(this.missingStartedAt=e),this.missingSampleCount+=1;let n=e-this.missingStartedAt;if(this.missingSampleCount>=2||n>=650){this.setAway();return}this.state=t(233)}[J(266)](){let e=J;this.state=e(272),this.lastCentroid=void 0,this.lastTrack=void 0,this.missingStartedAt=void 0,this.missingSampleCount=0}[J(249)](e,t){let n=J;return{...this.getSnapshot(performance.now()),poseCount:e.length,candidateCount:t[n(290)],debugPose:{landmarks:e.map(e=>e.map(({x:e,y:t})=>({x:Qd(e),y:Qd(t)}))),candidateBoxes:t.map(e=>e[n(282)]),lastTrackBox:this.lastTrack?.torsoBox}}}};function ff(e,t){return e-=120,pf()[e]}(function(e,t){let n=ff,r=e();for(;;)try{if(parseInt(n(124))/1+-parseInt(n(137))/2+parseInt(n(125))/3*(-parseInt(n(130))/4)+parseInt(n(132))/5*(parseInt(n(121))/6)+parseInt(n(122))/7+-parseInt(n(138))/8+parseInt(n(136))/9*(-parseInt(n(129))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(pf,555837);function pf(){let e=[`clearInterval`,`error`,`removeEventListener`,`485270rvnmGi`,`76004aqibiL`,`HAVE_METADATA`,`1010FPpKLV`,`videoHeight`,`resize`,`loadeddata`,`171QihkRh`,`305450NHeKVP`,`4405720SPNXLi`,`readyState`,`canplay`,`30054OVGTAF`,`7684327IqpMZr`,`addEventListener`,`90712texman`,`3FrqLhN`];return pf=function(){return e},pf()}function mf(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0&&!e.paused&&!e.ended}function hf(e,t=1e4){return gf(e)?Promise.resolve():new Promise((n,r)=>{let i=ff,a=window.setTimeout(()=>{s(),r(Error(`Timed out waiting for webcam video metadata.`))},t),o=window.setInterval(c,100),s=()=>{let t=ff;window.clearTimeout(a),window[t(126)](o),e.removeEventListener(`loadedmetadata`,l),e[t(128)](t(135),l),e.removeEventListener(t(120),l),e.removeEventListener(`playing`,l),e.removeEventListener(`resize`,l),e[t(128)](t(127),u)};function c(){gf(e)&&(s(),n())}let l=()=>{c()},u=()=>{s(),r(Error(`Failed to load webcam video stream.`))};e[i(123)](`loadedmetadata`,l,{once:!0}),e.addEventListener(`loadeddata`,l,{once:!0}),e.addEventListener(i(120),l,{once:!0}),e.addEventListener(`playing`,l,{once:!0}),e[i(123)](i(134),l,{once:!0}),e.addEventListener(`error`,u,{once:!0})})}function gf(e){let t=ff;return e[t(139)]>=HTMLMediaElement[t(131)]&&e.videoWidth>0&&e[t(133)]>0}var Y=Sf;(function(e,t){let n=Sf,r=e();for(;;)try{if(parseInt(n(249))/1*(-parseInt(n(223))/2)+-parseInt(n(266))/3*(parseInt(n(259))/4)+parseInt(n(209))/5+parseInt(n(278))/6+parseInt(n(272))/7*(-parseInt(n(218))/8)+-parseInt(n(239))/9+parseInt(n(241))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Cf,536331);var _f=class{[Y(207)];[Y(257)];[Y(203)];lastInferenceMemoryErrorAt=0;mainUserTracker;[Y(247)];mainUserTrackerLoadTimeoutId;[Y(225)]=0;[Y(202)]=Y(295);mainUserTrackingEnabled=!0;webcamFrameAnalyzer;webcamBlockageDetector;webcamLightingDetector;[Y(255)];[Y(198)];baselineRefreshPendingAfterNoFace=!1;constructor(e){let t=Y;this[t(207)]=e,this[t(210)]=Tf(e.options.mainUserTrackingEnabled)}async[Y(261)](){let e=Y;!this.loadPromise&&(this.loadPromise=this.loadInferenceWorker()),await this[e(203)],this.scheduleMainUserTrackerLoading()}async detect(e){let t=Y;await this[t(261)]();let n=this.services.options,r=n[t(236)]?performance.now():0,i=n.debug?performance.now():0,a=await ot(e),o=n[t(236)]?performance[t(219)]():0,s=await this[t(267)]().run({source:a,inputSize:n.inputSize,inputType:n.inputType,confidenceThreshold:n.confidenceThreshold,faceConfidenceThreshold:n.faceConfidenceThreshold,iouThreshold:n.iouThreshold,maxDetections:n.maxDetections,debug:!!n.debug});if(n[t(236)]){let e=performance[t(219)]();console.info(`[MonitorDog] detect frame`,{sourceMs:vf(o-i),workerRoundtripMs:vf(e-o),totalMs:vf(e-r)})}return s}toPublicResult(e){let t=Y;return{faceDetected:e.faceDetected,phoneDetected:e[t(246)],faceCount:e.faceCount,phoneCount:e[t(224)],faceDetections:e[t(275)],phoneDetections:e.phoneDetections}}detectVideo(e){let t=Y,n=!1,r,i=this.services[t(211)][t(252)],a=async()=>{let o=t;if(!n){try{if(!this.services[o(284)]&&mf(e)){let t=this.getWebcamFrameAnalyzer().analyze(e),s=this.getWebcamBlockageDetector(),c=s.analyze(t);if(await this[o(207)].detectionEvents.handleWebcamBlockageResult(c,e)[o(270)](e=>{let t=o;this.services[t(211)].onError?.(e)}),n||c.likelyCovered&&!this.baselineRefreshPendingAfterNoFace){!n&&(r=setTimeout(a,i));return}let l=await this[o(263)](e);if(n)return;let u=this[o(226)](e);this.renderPoseDebugOverlay(e,u);let d=Ae(l,u);this.isNoUserTrackingState(u)&&(this.baselineRefreshPendingAfterNoFace=!0),(s[o(230)]()||this.baselineRefreshPendingAfterNoFace||this[o(283)](c,d))&&d&&(s.refreshBaseline(t),this.baselineRefreshPendingAfterNoFace=!1);try{await this.services.options.onDetect({...this.toPublicResult(l),video:e,timestamp:e.currentTime,mainUserTracking:u})}catch(e){this.services[o(211)].onError?.(e)}if(n)return;await this[o(207)].detectionEvents[o(277)](l,u,e)[o(270)](e=>{let t=o;this[t(207)].options.onError?.(e)})}}catch(e){this[o(194)](e)}!n&&(r=setTimeout(a,i))}};return a(),{stop(){n=!0,r&&clearTimeout(r)}}}async startWebcamDetection(){let e=Y,t=this.services.options,n=await this[e(207)][e(229)].createWebcamStream(t.constraints),r=this.services[e(229)],i=!t.video,a=t.video??document.createElement(`video`),o=a[e(265)],s=a[e(216)],c=a.srcObject;a[e(265)]=!0,a[e(216)]=!0,a.srcObject=n;try{await Promise.all([a.play(),hf(a)])}catch(e){throw r.stopStream(n),a.pause(),i?a.srcObject=null:(a.muted=o,a.playsInline=s,a.srcObject=c),e}this[e(271)]?.reset(),this.scheduleMainUserTrackerLoading(),this.webcamBlockageDetector?.[e(244)](),this[e(212)]?.reset(),this[e(217)](),this.baselineRefreshPendingAfterNoFace=!1,this[e(207)][e(282)].resetForWebcamStartup();let l=this.detectVideo(a),u=!1,d=r.watchStreamDeviceDisconnect(n,()=>{let t=e;ee(),this[t(207)].onCameraDisconnect?.()}),ee=()=>{let t=e;u||(u=!0,d(),l[t(260)](),this[t(237)]?.reset(),this[t(212)]?.[t(244)](),this.clearWebcamLightingOverlay(),this.clearPoseDebugOverlay(),this.baselineRefreshPendingAfterNoFace=!1,r[t(222)](n),a.pause(),i?a.srcObject=null:(a.muted=o,a.playsInline=s,a[t(294)]=c))};return{stream:n,video:a,stop:ee}}[Y(254)](){return this.mainUserTrackingEnabled}[Y(245)](e){let t=Y;if(this[t(210)]!==e){if(this.mainUserTrackingEnabled=e,Ef(e),this.clearMainUserTrackerLoadTimeout(),this[t(225)]+=1,this[t(247)]=void 0,e){this.mainUserTrackerDisabledReason=`not loaded`,this.scheduleMainUserTrackerLoading();return}this.mainUserTracker?.dispose(),this.mainUserTracker=void 0,this.mainUserTrackerDisabledReason=`disabled`,this[t(296)](),this.baselineRefreshPendingAfterNoFace=!1}}dispose(){let e=Y;this.inferenceWorker?.terminate(),this.inferenceWorker=void 0,this.loadPromise=void 0,this.clearMainUserTrackerLoadTimeout(),this.webcamBlockageDetector?.reset(),this.webcamLightingDetector?.reset(),this.clearWebcamLightingOverlay(),this[e(296)](),this.baselineRefreshPendingAfterNoFace=!1,this.mainUserTrackerLoadToken+=1,this.mainUserTrackerLoadPromise=void 0,this[e(271)]?.dispose(),this.mainUserTracker=void 0,this[e(202)]=`disposed`}[Y(288)](){let e=Y;if(!this.mainUserTrackingEnabled)return this.mainUserTrackerDisabledReason=e(232),Promise.resolve();if(this.mainUserTracker||this.mainUserTrackerLoadPromise)return this.mainUserTrackerLoadPromise??Promise.resolve();let t=be();if(!t.enabled)return this.mainUserTrackerDisabledReason=t[e(289)]??`unsupported`,Promise.resolve();let n=this.mainUserTrackerLoadToken+1;return this.mainUserTrackerLoadToken=n,this[e(202)]=`loading`,this.mainUserTrackerLoadPromise=this[e(279)](n).finally(()=>{let t=e;this[t(225)]===n&&(this[t(247)]=void 0)}),this.mainUserTrackerLoadPromise}scheduleMainUserTrackerLoading(){!this.mainUserTrackingEnabled||this.mainUserTracker||this.mainUserTrackerLoadPromise||this.mainUserTrackerLoadTimeoutId||(this.mainUserTrackerLoadTimeoutId=setTimeout(()=>{let e=Sf;this.mainUserTrackerLoadTimeoutId=void 0,this.ensureMainUserTrackerLoading()[e(270)](t=>{let n=e;this.services[n(211)].onError?.(t)})},2e3))}[Y(286)](){this.mainUserTrackerLoadTimeoutId&&=(clearTimeout(this.mainUserTrackerLoadTimeoutId),void 0)}async loadMainUserTracker(e){let t=Y,n;try{let r=await this.services.auth[t(208)]();if(!r)throw Error(t(280));n=new df({apiBaseUrl:this.services.options.apiBaseUrl,accessToken:r,wasmBasePath:this.services.options[t(269)],modelAssetPath:this[t(207)].options.mainUserTrackingModelAssetPath}),await n.load(),this.mainUserTrackerLoadToken===e?(this[t(271)]?.dispose(),this.mainUserTracker=n,this[t(202)]=``):n[t(285)]()}catch(e){n?.dispose(),this[t(202)]=e instanceof Error?e[t(204)]:`failed to load`}}detectMainUser(e){let t=Y;if(!this.mainUserTracker)return bf(this[t(202)]);let n=performance.now(),r=this.mainUserTracker.getSnapshot(n);try{return this.mainUserTracker[t(248)](e,n)}catch{return r}}[Y(264)](e){let t=Y;return e[t(290)]===`AWAY`||e.state===`INIT`&&e[t(227)]}shouldRefreshBaselineForNormalState(e,t){let n=Y;return t&&!e[n(214)]&&!e.suspected&&!e[n(205)]&&e[n(220)]>=.6}handleWebcamLightingResult(e){let t=Y;if(!e.issue)return this.clearWebcamLightingOverlay(),!1;let n=wf(e.issue);return n?e[t(268)]?this.activeLightingOverlayState===n?!0:(this.clearWebcamLightingOverlay(),this.activeLightingOverlayState=n,this[t(207)].overlay.showJob({id:`webcam-lighting:`+n,state:n,source:t(228),priority:180}),!0):(this.clearWebcamLightingOverlay(),!0):(this.clearWebcamLightingOverlay(),!1)}[Y(217)](){let e=Y;if(this[e(255)]){for(let t of xf)this[e(207)][e(240)].clearJob(`webcam-lighting:`+t);this.activeLightingOverlayState=void 0}}renderPoseDebugOverlay(e,t){let n=Y;if(!this.services.options.debug||!t.debugPose){this.clearPoseDebugOverlay();return}let r=this[n(287)](),i=r[n(276)](`2d`);if(!i)return;let a=e[n(200)]();r.width=Math.max(1,Math.round(a.width)),r[n(193)]=Math.max(1,Math[n(253)](a.height)),Object[n(281)](r.style,{left:a[n(250)]+window[n(234)]+`px`,top:a.top+window.scrollY+`px`,width:a[n(195)]+`px`,height:a.height+`px`,display:`block`}),i.clearRect(0,0,r[n(195)],r[n(193)]),this.drawPoseDebug(i,r,t.debugPose)}getPoseDebugCanvas(){let e=Y;if(this.poseDebugCanvas?.isConnected)return this.poseDebugCanvas;let t=document[e(199)](`canvas`);return t.id=`monitordog-pose-debug-overlay`,Object[e(281)](t.style,{position:`absolute`,zIndex:`2147483646`,pointerEvents:`none`,display:`none`}),document.body.append(t),this[e(198)]=t,t}clearPoseDebugOverlay(){let e=Y;this[e(198)]?.remove(),this[e(198)]=void 0}drawPoseDebug(e,t,n){let r=Y;for(let i of n.landmarks){e.fillStyle=`#facc15`;for(let n of i)e.beginPath(),e.arc(n.x*t[r(195)],n.y*t.height,3,0,Math.PI*2),e[r(291)]()}for(let i of n.candidateBoxes)yf(e,t,i,r(233),2);n[r(196)]&&yf(e,t,n.lastTrackBox,r(242),3)}handleDetectionLoopError(e){let t=Y;if(this.isInferenceMemoryError(e)){this.recoverFromInferenceMemoryError(),this[t(207)].options.onError?.(e);return}this.services.options.onError?.(e)}recoverFromInferenceMemoryError(){let e=Y;this.degradeModelForMemoryPressure(),this[e(238)]();let t=Date[e(219)]();t-this[e(258)]<1e4||(this.lastInferenceMemoryErrorAt=t,this[e(207)][e(240)].showJob({id:e(292),state:`inferenceMemoryError`,source:`system`,text:e(206),durationMs:4e3,priority:220}))}[Y(238)](){let e=Y;this.inferenceWorker?.terminate(),this[e(257)]=void 0,this[e(203)]=void 0}degradeModelForMemoryPressure(){this.services.degradeInferenceModelForMemoryPressure()}[Y(197)](e){let t=e instanceof Error?e.message:String(e);return/out of memory|oom|memory access out of bounds|cannot enlarge memory|array buffer allocation|bad allocation|allocation failed/i.test(t)}getInferenceWorker(){return!this.inferenceWorker&&(this.inferenceWorker=new it),this.inferenceWorker}getWebcamFrameAnalyzer(){let e=Y;return!this[e(293)]&&(this.webcamFrameAnalyzer=new wt),this.webcamFrameAnalyzer}[Y(273)](){let e=Y;return!this[e(237)]&&(this.webcamBlockageDetector=new Ut),this[e(237)]}[Y(231)](){return!this.webcamLightingDetector&&(this.webcamLightingDetector=new Xt),this.webcamLightingDetector}async[Y(243)](){let e=Y;try{await this[e(235)]()}catch(t){if(!this.isInferenceMemoryError(t))throw t;this.recoverFromInferenceMemoryError();try{await this.loadInferenceWorkerWithOptions()}catch(t){throw this[e(213)](),t}}}async loadInferenceWorkerWithOptions(){let e=Y,t=await this.services.auth[e(208)]();if(!t)throw Error(`MonitorDog login is required before loading detection.`);let n=this[e(207)].options;await this.getInferenceWorker().load({apiBaseUrl:n.apiBaseUrl,accessToken:t,modelBuildVersion:n[e(274)],modelBuildNumber:n[e(262)]})}};function vf(e){return Math.round(e*10)/10}function yf(e,t,n,r,i){let a=Y;e.strokeStyle=r,e.lineWidth=i,e[a(215)](n.x*t.width,n.y*t[a(193)],n.width*t[a(195)],n[a(193)]*t[a(193)])}function bf(e){return{enabled:!1,disabledReason:e,state:`INIT`,hasTrackedUser:!1,missingElapsedMs:0,poseCount:0,candidateCount:0}}var xf=[`webcamTooDark`,`webcamTooBright`];function Sf(e,t){return e-=193,Cf()[e]}function Cf(){let e=`lastTrackBox,isInferenceMemoryError,poseDebugCanvas,createElement,getBoundingClientRect,tooBright,mainUserTrackerDisabledReason,loadPromise,message,likelyCovered,MonitorDog detection ran out of memory.
|
|
43
|
-
Please close unused tabs or apps to free memory. Detection is restarting automatically.,services,getValidAccessToken,4638995kLdcSq,mainUserTrackingEnabled,options,webcamLightingDetector,recoverFromInferenceMemoryError,blocked,strokeRect,playsInline,clearWebcamLightingOverlay,598568AYHyDW,now,changedCoverage,false,stopStream,6joQQwj,phoneCount,mainUserTrackerLoadToken,detectMainUser,hasTrackedUser,system,camera,needsBaselineRefresh,getWebcamLightingDetector,disabled,#38bdf8,scrollX,loadInferenceWorkerWithOptions,debug,webcamBlockageDetector,resetInferenceWorker,5835294CWTxtp,overlay,9130340gSOeOD,#22c55e,loadInferenceWorker,reset,setMainUserTrackingEnabled,phoneDetected,mainUserTrackerLoadPromise,detectForVideo,189181GBWNSq,left,handleWebcamLightingResult,detectionIntervalMs,round,isMainUserTrackingEnabled,activeLightingOverlayState,analyze,inferenceWorker,lastInferenceMemoryErrorAt,6892mgrsok,stop,load,modelBuildNumber,detect,isNoUserTrackingState,muted,921SFZzrQ,getInferenceWorker,active,mainUserTrackingWasmBasePath,catch,mainUserTracker,21SBRRSu,getWebcamBlockageDetector,modelBuildVersion,faceDetections,getContext,handleDetectionResult,3988986SRppKP,loadMainUserTracker,MonitorDog login is required before loading MediaPipe.,assign,detectionEvents,shouldRefreshBaselineForNormalState,shouldPauseDetection,dispose,clearMainUserTrackerLoadTimeout,getPoseDebugCanvas,ensureMainUserTrackerLoading,reason,state,fill,inference:memory,webcamFrameAnalyzer,srcObject,not loaded,clearPoseDebugOverlay,height,handleDetectionLoopError,width`.split(`,`);return Cf=function(){return e},Cf()}function wf(e){let t=Y;switch(e){case`tooDark`:return`webcamTooDark`;case t(201):return`webcamTooBright`;case void 0:return}}function Tf(e){let t=Y;if(e!==void 0)return e;if(typeof localStorage>`u`)return!0;try{let e=localStorage.getItem(re);return e===null?!0:e!==t(221)}catch{return!0}}function Ef(e){if(!(typeof localStorage>`u`))try{localStorage.setItem(re,String(e))}catch{return}}function Df(){let e=[`관리자에 의해 잠겼습니다.`,`Cannot read camera`,`비밀번호`,`8nATYmn`,`현재 작업자가 자리를 비워 화면을 보호합니다.`,`77156EiXdvW`,`14gzpifW`,`재시도 중...`,`周囲の環境が明るすぎます。
|
|
44
|
-
直射光を避けるか、位置を調整してください。`,`6726267Qnbgkg`,`解除をリクエスト`,`114JNeuah`,`2782040JAhnSW`,`Request unlock`,`1979262LVpnDu`,`language`,`2493204zfZvkT`,`98313EupkMh`,`두 사람 이상의 화면 시청이 탐지되어 화면을 보호합니다.`,`20291050fKkpaF`,`주변 환경이 너무 밝습니다.
|
|
45
|
-
직사광선을 줄이거나 위치를 조정해 주세요.`,`We can't find you in your seat.
|
|
46
|
-
MonitorDog is protecting your screen.`,`toLowerCase`];return Df=function(){return e},Df()}var Of=Af;(function(e,t){let n=Af,r=e();for(;;)try{if(-parseInt(n(245))/1*(parseInt(n(234))/2)+parseInt(n(239))/3*(-parseInt(n(233))/4)+parseInt(n(240))/5+-parseInt(n(242))/6+parseInt(n(244))/7*(parseInt(n(231))/8)+-parseInt(n(237))/9+parseInt(n(247))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Df,443272);var kf={en:{noFaceDetected:Of(249),twoFacesDetected:`Two people have been detected.
|
|
47
|
-
MonitorDog is protecting your screen.`,mobileDevice:`A filming attempt has been detected.
|
|
48
|
-
MonitorDog is protecting your screen.`,webcamBlocked:`The webcam appears to be covered.
|
|
49
|
-
MonitorDog is protecting your screen.`,webcamTooDark:`Your surroundings are too dark.
|
|
50
|
-
Please turn on a light or move to a brighter area.`,webcamTooBright:`Your surroundings are too bright.
|
|
51
|
-
Please reduce direct light or adjust your position.`,cameraPermissionDenied:`Camera permission is required`,cameraReadableError:Of(252),remoteAdminLocked:`Locked by administrator`,remoteLocked:`Locked remotely`,cameraRetryButton:`Retry`,cameraRetryingButton:`Retrying...`,remoteUnlockButton:`Unlock`,remoteUnlockingButton:`Unlocking...`,remoteUnlockRequestButton:Of(241),remoteUnlockRequestingButton:`Requesting...`,noFacePasswordInputPlaceholder:`Password`,noFacePasswordSubmitButton:`Submit`,noFacePasswordSubmittingButton:`Submitting...`},ko:{webcamTooDark:`주변 환경이 너무 어둡습니다.
|
|
52
|
-
조명을 켜거나 더 밝은 환경으로 이동해 주세요.`,webcamTooBright:Of(248),webcamBlocked:`웹캠이 가려진 것으로 감지되어 화면을 보호합니다.`,noFaceDetected:Of(232),twoFacesDetected:Of(246),mobileDevice:`카메라 촬영 시도가 탐지되어 화면을 보호합니다.`,cameraPermissionDenied:`카메라 권한이 필요합니다.`,cameraReadableError:`카메라를 사용할 수 없습니다.`,remoteAdminLocked:Of(251),remoteLocked:`원격으로 잠겼습니다.`,cameraRetryButton:`재시도`,cameraRetryingButton:Of(235),remoteUnlockButton:`잠금 해제`,remoteUnlockingButton:`해제 중...`,remoteUnlockRequestButton:`잠금 해제 요청`,remoteUnlockRequestingButton:`요청 중...`,noFacePasswordInputPlaceholder:Of(230),noFacePasswordSubmitButton:`확인`,noFacePasswordSubmittingButton:`확인 중...`},ja:{webcamTooDark:`周囲の環境が暗すぎます。
|
|
53
|
-
照明をつけるか、明るい場所へ移動してください。`,webcamTooBright:Of(236),webcamBlocked:`Webカメラが覆われたと検出されたため、画面を保護します。`,noFaceDetected:`現在のユーザーが席を離れたため、画面を保護しています。`,twoFacesDetected:`2人以上の画面閲覧が検知されたため、画面を保護します。`,mobileDevice:`カメラ撮影試行が検出されたため、画面を保護します。`,cameraPermissionDenied:`カメラの権限が必要です`,cameraReadableError:`カメラを使用できません`,remoteAdminLocked:`管理者によりロックされました`,remoteLocked:`リモートでロックされました`,cameraRetryButton:`再試行`,cameraRetryingButton:`再試行中...`,remoteUnlockButton:`ロック解除`,remoteUnlockingButton:`解除中...`,remoteUnlockRequestButton:Of(238),remoteUnlockRequestingButton:`リクエスト中...`,noFacePasswordInputPlaceholder:`パスワード`,noFacePasswordSubmitButton:`確認`,noFacePasswordSubmittingButton:`確認中...`}};function Af(e,t){return e-=230,Df()[e]}function jf(e){let t=Ff(e);return Pf(t)?t:`en`}function Mf(e){return kf[e?jf(e):Nf()]}function Nf(){let e=Of;if(typeof navigator>`u`)return`en`;let t=[...navigator.languages,navigator[e(243)]].filter(Boolean);for(let e of t){let t=Ff(e);if(Pf(t))return t}return`en`}function Pf(e){return e===`en`||e===`ko`||e===`ja`}function Ff(e){return e?.[Of(250)]().split(/[-_]/)[0]}var X=If;function If(e,t){return e-=248,Lf()[e]}function Lf(){let e=[`syncRemoteLockButton`,`overlayOptions`,`applyNoFacePasswordToggleButtonStyle`,`applyCameraRetryButtonStyle`,`hidden`,`startRemoteUnlockRequestCooldownTimer`,`1114085QAXuiq`,`remoteAdminLocked`,`getNoFacePasswordCloseIconSrc`,`className`,`resetCameraRetryButton`,`getOnCameraRetry`,`body`,`getCameraRetryingButtonText`,`src`,`ceil`,`noFacePasswordSubmittingButtonText`,`textContent`,`visibility`,`handleCameraRetry`,`img`,`getNoFacePasswordOpenIconSrc`,`min(100%, 320px)`,`[data-monitordog-no-face-password-submit]`,`14713803NOpcDV`,`getRemoteUnlockRequestCooldownMs`,`applyPointerEvents`,`createElement`,`password`,`remoteUnlockButton`,`[data-monitordog-no-face-password]`,`#0f172a`,`remoteUnlockingButton`,`getRemoteLockButtonText`,`cameraRetryButton`,`applyNoFacePasswordInputWrapperStyle`,`88134fyKSYG`,`monitordog-overlay`,`unlockPageScroll`,`cameraRetryButtonStyle`,`floor`,`type`,`auto`,`toString`,`updateNoFacePasswordToggleButton`,`updateRemoteUnlockRequestCooldownButton`,`21740ijBJfc`,`applyNoFacePasswordSubmitButtonStyle`,`state`,`shouldShowNoFacePasswordInput`,`dataset`,`getCameraRetryButtonText`,`pointer`,`monitordogCameraRetry`,`true`,`setAttribute`,`hide`,`append`,`applyRemoteLockButtonEnabledState`,`2147483647`,`querySelector`,`lockPageScroll`,`getOverlayElement`,`getNoFacePasswordSubmitButtonText`,`noFacePasswordToggleButtonStyle`,`1976646APerFl`,`applyNoFacePasswordFormStyle`,`clearRemoteUnlockRequestCooldownTimer`,`flex`,`messages`,`#ffffff`,`monitordogNoFacePasswordSubmit`,`addEventListener`,`display`,`getElementById`,`previousBodyOverflow`,`3431368BjWrho`,`1.2`,`noFacePasswordSubmitButtonText`,`44px`,`getNoFacePasswordSubmittingButtonText`,`noFacePasswordFormClassName`,`[data-monitordog-camera-retry]`,`00:`,`applyNoFacePasswordInputStyle`,`3237017dAkYRt`,`input`,`39bmkhyb`,`pre-line`,`syncCameraRetryButton`,`column`,`messageStyle`,`applyOverlayStyle`,`assign`,`options`,`replaceChildren`,`stop`,`disabled`,`[data-monitordog-no-face-password-toggle]`,`not-allowed`,`rootId`,`remoteUnlockButtonText`,`getCurrentJob`,`style`,`getOverlayMessageElement`,`12ZxYlbD`,`languageMessages`,`applyRemoteLockButtonStyle`,`getOnRemoteUnlockRequest`,`noFacePasswordSubmittingButton`,`applyOverlayMessageStyle`,`handleNoFacePasswordSubmit`,`getRemoteLockBusyButtonText`,`hasInteractiveAction`,`[data-monitordog-no-face-password-input-wrapper]`,`aria-hidden`,`position`,`16px`,`remoteUnlockRequestButton`];return Lf=function(){return e},Lf()}(function(e,t){let n=If,r=e();for(;;)try{if(parseInt(n(266))/1+-parseInt(n(295))/2+-parseInt(n(317))/3*(-parseInt(n(276))/4)+parseInt(n(355))/5+parseInt(n(335))/6*(-parseInt(n(315))/7)+parseInt(n(306))/8+parseInt(n(254))/9===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Lf,532209);var Rf=`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M2%2012s3.5-7%2010-7%2010%207%2010%207-3.5%207-10%207-10-7-10-7Z%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%2F%3E%3C%2Fsvg%3E`,zf=`data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%203l18%2018%22%2F%3E%3Cpath%20d%3D%22M10.6%2010.6a2%202%200%200%200%202.8%202.8%22%2F%3E%3Cpath%20d%3D%22M9.9%204.2A10.6%2010.6%200%200%201%2012%204c6.5%200%2010%208%2010%208a18.5%2018.5%200%200%201-4.1%205.1%22%2F%3E%3Cpath%20d%3D%22M6.1%206.1A18.5%2018.5%200%200%200%202%2012s3.5%208%2010%208c1.3%200%202.5-.3%203.5-.8%22%2F%3E%3C%2Fsvg%3E`,Bf=class{[X(324)];[X(305)];remoteUnlockRequestCooldownIntervalId;constructor(e){this.options=e}ensureIntegrity(e){let t=X;if(!this[t(350)]?.enabled)return;let n=this.getOverlayElement(),r=this.getOverlayMessageElement(n),i=getComputedStyle(n);(i.display===`none`||i[t(248)]===t(353)||i.opacity===`0`)&&(n[t(333)][t(303)]=`flex`,n.style.visibility=`visible`,n.style.opacity=`1`),i.position!==`fixed`&&(n.style[t(346)]=`fixed`),i.zIndex!==`2147483647`&&(n.style.zIndex=t(289));let a=this.options.getOverlayMessage(e);r.textContent!==a&&(r.textContent=a),this.syncActions(n,e),this[t(291)]()}render(e){let t=this.getOverlayElement(),n=this.getOverlayMessageElement(t);n.textContent=this.options.getOverlayMessage(e),this.syncActions(t,e),t.style.display=`flex`,this.lockPageScroll()}[X(286)](){let e=X;this[e(297)]();let t=document.getElementById(this.rootId);t instanceof HTMLDivElement&&(t.style.display=`none`,this.resetCameraRetryButton(t),this.resetRemoteLockButton(t),this.resetNoFacePasswordInput(t)),this[e(268)]()}[X(326)](){this.clearRemoteUnlockRequestCooldownTimer()}get overlayOptions(){return this.options.getOverlayOptions()}get[X(336)](){let e=X;return this[e(324)].getLanguageMessages()}get rootId(){let e=X;return this.overlayOptions?.rootId??e(267)}syncActions(e,t){let n=X;this[n(319)](e,t),this[n(349)](e,t),this.syncNoFacePasswordInput(e,t)}lockPageScroll(){let e=X;this.previousBodyOverflow===void 0&&(this.previousBodyOverflow=document[e(361)].style.overflow,document.body.style.overflow=`hidden`)}unlockPageScroll(){this.previousBodyOverflow!==void 0&&(document.body.style.overflow=this.previousBodyOverflow,this.previousBodyOverflow=void 0)}[X(292)](){let e=X,t=document[e(304)](this.rootId);if(t instanceof HTMLDivElement)return this[e(322)](t),t;let n=document.createElement(`div`),r=document[e(257)](`div`);return n.id=this[e(330)],n[e(358)]=this.overlayOptions?.className??``,r.className=this.overlayOptions?.messageClassName??``,n.append(r),this.applyOverlayStyle(n),this[e(340)](r),document.body.append(n),n}[X(322)](e){let t=X;e.className=this.overlayOptions?.[t(358)]??``,Object.assign(e.style,{position:`fixed`,inset:`0`,display:e.style[t(303)]===t(298)?t(298):`none`,flexDirection:t(320),alignItems:`center`,justifyContent:`center`,background:`rgb(15 23 42 / 0.34)`,backdropFilter:`blur(16px) saturate(150%)`,color:`#ffffff`,zIndex:t(289),pointerEvents:this.options[t(343)](this.options.getCurrentJob()?.[t(278)])?t(272):`none`,padding:`24px`,textAlign:`center`,...this.overlayOptions?.[t(333)]})}[X(340)](e){let t=X;e.className=this.overlayOptions?.messageClassName??``,Object.assign(e[t(333)],{maxWidth:`720px`,borderRadius:`8px`,fontSize:`24px`,fontWeight:`800`,lineHeight:`1.4`,padding:`24px 32px`,whiteSpace:t(318),...this[t(350)]?.[t(321)]})}[X(334)](e){let t=X,n=e.firstElementChild;if(n instanceof HTMLDivElement)return this.applyOverlayMessageStyle(n),n;let r=document.createElement(`div`);return this.applyOverlayMessageStyle(r),e[t(325)](r),r}syncCameraRetryButton(e,t){let n=X,r=e.querySelector(n(312));if(!this[n(324)].isCameraOverlay(t[n(278)])){r?.remove(),this.applyPointerEvents(e,t.state);return}e.style.pointerEvents=n(272);let i=r??document[n(257)](`button`);!r&&(i.type=`button`,i.dataset[n(283)]=`true`,i.addEventListener(`click`,()=>{this.handleCameraRetry(i)}),e[n(287)](i)),this[n(352)](i),!i[n(327)]&&(i.textContent=this[n(281)]())}async[X(249)](e){let t=X,n=this.options[t(360)]();if(!(!n||e.disabled)){e.disabled=!0,e.textContent=this.getCameraRetryingButtonText();try{await n()}catch{}finally{e[t(327)]=!1,e.textContent=this.getCameraRetryButtonText()}}}[X(349)](e,t){let n=X,r=e[n(290)](`[data-monitordog-remote-lock-action]`);if(!this.options.isRemoteLockOverlay(t[n(278)])){r?.remove(),this.applyPointerEvents(e,t[n(278)]);return}e.style.pointerEvents=n(272);let i=r??document[n(257)](`button`);if(!r&&(i.type=`button`,i.dataset.monitordogRemoteLockAction=n(284),i.addEventListener(`click`,()=>{this.handleRemoteLockAction(i)}),e[n(287)](i)),this.applyRemoteLockButtonStyle(i),t[n(278)]===`remoteAdminLocked`){this[n(275)](i),this.startRemoteUnlockRequestCooldownTimer(i);return}this.clearRemoteUnlockRequestCooldownTimer(),!i[n(327)]&&(i[n(366)]=this.getRemoteLockButtonText(t.state))}async handleRemoteLockAction(e){let t=X,n=this.options.getCurrentJob();if(!n||e[t(327)])return;let r=n.state;if(!this.options.isRemoteLockOverlay(r))return;if(r===`remoteAdminLocked`&&this.options.getRemoteUnlockRequestCooldownMs()>0){this.updateRemoteUnlockRequestCooldownButton(e),this[t(354)](e);return}let i=r===`remoteLocked`?this.options.getOnRemoteUnlock():this[t(324)][t(338)]();if(i){e.disabled=!0,e.textContent=this[t(342)](r);try{await i()}catch(e){this.options.getOnError()?.(e)}finally{e.disabled=!1,this[t(324)].getCurrentJob()?.[t(278)]===r&&(r===`remoteAdminLocked`?(this.updateRemoteUnlockRequestCooldownButton(e),this.startRemoteUnlockRequestCooldownTimer(e)):e.textContent=this.getRemoteLockButtonText(r))}}}[X(359)](e){let t=e.querySelector(`[data-monitordog-camera-retry]`);t&&(t.disabled=!1,t.textContent=this.getCameraRetryButtonText())}resetRemoteLockButton(e){let t=X,n=e.querySelector(`[data-monitordog-remote-lock-action]`);if(!n)return;this[t(297)](),n.disabled=!1;let r=this.options.getCurrentJob();r&&(n.textContent=this[t(263)](r.state))}syncNoFacePasswordInput(e,t){let n=X,r=e.querySelector(`[data-monitordog-no-face-password-form]`);if(!this.options[n(279)](t)){r?.remove(),this[n(256)](e,t[n(278)]);return}e.style.pointerEvents=`auto`;let i=r??document.createElement(`form`),a=i.querySelector(n(344)),o=i.querySelector(`[data-monitordog-no-face-password]`),s=i[n(290)](n(328)),c=i[n(290)](n(253));!r&&(i.dataset.monitordogNoFacePasswordForm=`true`,i[n(302)](`submit`,e=>{let t=n;e.preventDefault(),this[t(341)](i)}),e.append(i)),!a&&(a=document.createElement(`div`),a.dataset.monitordogNoFacePasswordInputWrapper=`true`,i.prepend(a)),!o&&(o=document[n(257)](n(316)),o.type=`password`,o.autocomplete=`current-password`,o[n(280)].monitordogNoFacePassword=`true`,o[n(285)](`aria-label`,`Password`)),o.parentElement!==a&&a[n(287)](o),!s&&(s=document.createElement(`button`),s.type=`button`,s.dataset.monitordogNoFacePasswordToggle=`true`,s.addEventListener(`click`,()=>{this.toggleNoFacePasswordVisibility(i)})),s.parentElement!==a&&a.append(s),!c&&(c=document[n(257)](`button`),c[n(271)]=`submit`,c.dataset[n(301)]=n(284),i.append(c)),o.placeholder=this[n(350)]?.noFacePasswordInputPlaceholder??this.overlayOptions?.messages?.noFacePasswordInputPlaceholder??this.languageMessages.noFacePasswordInputPlaceholder,this[n(274)](s,o),c.textContent=this[n(293)](),this.applyNoFacePasswordFormStyle(i),this[n(265)](a),this[n(314)](o),this.applyNoFacePasswordToggleButtonStyle(s),this[n(277)](c)}resetNoFacePasswordInput(e){let t=X,n=e.querySelector(`[data-monitordog-no-face-password]`),r=e.querySelector(t(328));n&&(n.value=``,n.type=t(258),r&&this.updateNoFacePasswordToggleButton(r,n))}toggleNoFacePasswordVisibility(e){let t=X,n=e[t(290)](t(260)),r=e[t(290)](t(328));!n||!r||(n.type=n.type===`password`?`text`:`password`,this.updateNoFacePasswordToggleButton(r,n),n.focus())}updateNoFacePasswordToggleButton(e,t){let n=X,r=t.type===`text`,i=r?this.getNoFacePasswordCloseIconSrc():this[n(251)](),a=document.createElement(n(250)),o=e[n(290)](`img`),s=r?`Hide password`:`Show password`,c=String(r),l=r?`none`:`invert(1)`;if(o&&o.getAttribute(`src`)===i&&e.getAttribute(`aria-label`)===s&&e.getAttribute(`aria-pressed`)===c){o.style.filter!==l&&(o.style.filter=l);return}a[n(363)]=i,a.alt=``,a.setAttribute(n(345),`true`),Object[n(323)](a.style,{display:`block`,filter:l,width:`20px`,height:`20px`,pointerEvents:`none`}),e[n(325)](a),e[n(285)](`aria-label`,s),e.setAttribute(`aria-pressed`,c)}async handleNoFacePasswordSubmit(e){let t=X,n=e.querySelector(`[data-monitordog-no-face-password]`),r=e.querySelector(`[data-monitordog-no-face-password-submit]`);if(!n)return;let i=n.value;if(!i||r?.[t(327)]){n.focus();return}r&&(r[t(327)]=!0,r[t(366)]=this[t(310)](),this.applyNoFacePasswordSubmitButtonStyle(r));try{if(await this.options.onNoFacePasswordSubmit(i)){n.value=``;return}n.value=``,n.focus()}catch(e){this.options.getOnError()?.(e),n.value=``,n.focus()}finally{r&&(r.disabled=!1,r.textContent=this[t(293)](),this.applyNoFacePasswordSubmitButtonStyle(r))}}applyCameraRetryButtonStyle(e){let t=X;e.className=this.overlayOptions?.cameraRetryButtonClassName??``,Object[t(323)](e.style,{border:`0`,borderRadius:`8px`,background:t(300),color:`#0f172a`,cursor:`pointer`,fontSize:t(347),fontWeight:`700`,lineHeight:t(307),marginTop:`12px`,padding:`12px 18px`,pointerEvents:t(272),...this.overlayOptions?.[t(269)]})}[X(337)](e){let t=X;e[t(358)]=this.overlayOptions?.remoteUnlockButtonClassName??``,Object.assign(e.style,{border:`0`,borderRadius:`8px`,background:`#ffffff`,color:`#0f172a`,cursor:`pointer`,fontSize:`16px`,fontWeight:`700`,lineHeight:`1.2`,marginTop:`12px`,padding:`12px 18px`,pointerEvents:`auto`,...this.overlayOptions?.remoteUnlockButtonStyle})}applyNoFacePasswordInputStyle(e){let t=X;e[t(358)]=this.overlayOptions?.noFacePasswordInputClassName??``,Object[t(323)](e[t(333)],{width:t(252),border:`1px solid rgb(255 255 255 / 0.7)`,borderRadius:`8px`,background:`#ffffff`,color:`#0f172a`,fontSize:t(347),lineHeight:`1.2`,margin:`0`,padding:`12px 46px 12px 14px`,pointerEvents:t(272),...this.overlayOptions?.noFacePasswordInputStyle})}applyNoFacePasswordInputWrapperStyle(e){let t=X;Object.assign(e.style,{position:`relative`,width:t(252)})}[X(296)](e){let t=X;e.className=this.overlayOptions?.[t(311)]??``,Object[t(323)](e[t(333)],{display:`flex`,flexWrap:`wrap`,justifyContent:`center`,gap:`8px`,marginTop:`12px`,pointerEvents:`auto`,...this.overlayOptions?.noFacePasswordFormStyle})}[X(277)](e){let t=X;e.className=this.overlayOptions?.noFacePasswordSubmitButtonClassName??``,Object.assign(e[t(333)],{border:`0`,borderRadius:`8px`,background:t(300),color:t(261),cursor:e.disabled?t(329):`pointer`,fontSize:`16px`,fontWeight:`700`,lineHeight:`1.2`,padding:`12px 18px`,pointerEvents:`auto`,...this[t(350)]?.noFacePasswordSubmitButtonStyle})}[X(351)](e){let t=X;e.className=this.overlayOptions?.noFacePasswordToggleButtonClassName??``,Object.assign(e.style,{border:`0`,borderRadius:`0`,background:`transparent`,color:`#0f172a`,cursor:t(282),display:`grid`,height:`100%`,placeItems:`center`,padding:`0`,pointerEvents:`auto`,position:`absolute`,right:`0`,top:`0`,width:t(309),...this[t(350)]?.[t(294)]})}updateRemoteUnlockRequestCooldownButton(e){let t=X,n=this[t(324)].getRemoteUnlockRequestCooldownMs();if(n<=0){e[t(327)]=!1,e.textContent=this.getRemoteLockButtonText(t(356)),this.applyRemoteLockButtonEnabledState(e),this[t(297)]();return}e.disabled=!0,e.textContent=this.getRemoteLockButtonText(`remoteAdminLocked`)+` (`+Vf(n)+`)`,this.applyRemoteLockButtonDisabledState(e)}[X(354)](e){let t=X;this.remoteUnlockRequestCooldownIntervalId||this[t(324)][t(255)]()<=0||(this.remoteUnlockRequestCooldownIntervalId=setInterval(()=>{let n=t;this[n(324)][n(332)]?.()?.[n(278)]===n(356)?this.updateRemoteUnlockRequestCooldownButton(e):this[n(297)]()},1e3))}clearRemoteUnlockRequestCooldownTimer(){this.remoteUnlockRequestCooldownIntervalId&&=(clearInterval(this.remoteUnlockRequestCooldownIntervalId),void 0)}[X(288)](e){Object[X(323)](e.style,{cursor:`pointer`,opacity:`1`,pointerEvents:`auto`})}applyRemoteLockButtonDisabledState(e){Object.assign(e.style,{cursor:`not-allowed`,opacity:`0.58`,pointerEvents:`auto`})}applyPointerEvents(e,t){e.style.pointerEvents=this.options.hasInteractiveAction(t)?`auto`:`none`}getCameraRetryButtonText(){let e=X;return this.overlayOptions?.cameraRetryButtonText??this[e(350)]?.messages?.cameraRetryButton??this[e(336)][e(264)]}[X(362)](){let e=X;return this.overlayOptions?.cameraRetryingButtonText??this.overlayOptions?.[e(299)]?.cameraRetryingButton??this.languageMessages.cameraRetryingButton}getRemoteLockButtonText(e){let t=X;return e===`remoteAdminLocked`?this[t(350)]?.remoteUnlockRequestButtonText??this.overlayOptions?.[t(299)]?.[t(348)]??this[t(336)][t(348)]:this.overlayOptions?.[t(331)]??this.overlayOptions?.[t(299)]?.[t(259)]??this.languageMessages.remoteUnlockButton}[X(342)](e){let t=X;return e===`remoteAdminLocked`?this.overlayOptions?.remoteUnlockRequestingButtonText??this[t(350)]?.messages?.remoteUnlockRequestingButton??this.languageMessages.remoteUnlockRequestingButton:this.overlayOptions?.remoteUnlockingButtonText??this[t(350)]?.messages?.[t(262)]??this[t(336)].remoteUnlockingButton}getNoFacePasswordSubmitButtonText(){let e=X;return this.overlayOptions?.[e(308)]??this.overlayOptions?.messages?.noFacePasswordSubmitButton??this[e(336)].noFacePasswordSubmitButton}getNoFacePasswordSubmittingButtonText(){let e=X;return this[e(350)]?.[e(365)]??this.overlayOptions?.messages?.noFacePasswordSubmittingButton??this[e(336)][e(339)]}[X(251)](){let e=X;return this[e(350)]?.noFacePasswordOpenIconSrc??Rf}[X(357)](){return this.overlayOptions?.noFacePasswordCloseIconSrc??zf}};function Vf(e){let t=X,n=Math[t(364)](e/1e3),r=Math[t(270)](n/60),i=n%60;return r<=0?t(313)+i[t(273)]().padStart(2,`0`):i===0?r[t(273)]().padStart(2,`0`)+`:00`:r.toString().padStart(2,`0`)+`:`+i.toString().padStart(2,`0`)}function Hf(e,t){return e-=465,Uf()[e]}function Uf(){let e=[`options`,`706076OgWdIY`,`2427489mpIzkE`,`671416IuJjlv`,`1565wvgqHF`,`ensureIntegrity`,`10lFBGWD`,`2296iTFxHf`,`watchdog`,`8kAcWAM`,`1526106SGxMlg`,`420135DDSbYN`,`18838692yLYuri`,`intervalId`,`11EEXKGj`,`7eXdtVs`];return Uf=function(){return e},Uf()}var Wf=Hf;(function(e,t){let n=Hf,r=e();for(;;)try{if(-parseInt(n(475))/1+-parseInt(n(467))/2*(parseInt(n(469))/3)+-parseInt(n(465))/4*(-parseInt(n(478))/5)+-parseInt(n(468))/6*(-parseInt(n(473))/7)+-parseInt(n(477))/8+-parseInt(n(476))/9*(parseInt(n(480))/10)+parseInt(n(472))/11*(parseInt(n(470))/12)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Uf,384e3);var Gf=class{[Wf(474)];intervalId;constructor(e){let t=Wf;this[t(474)]=e}start(){let e=Wf,t=this.options.getOverlayOptions();t?.enabled===!1||t?.[e(466)]===!1||this[e(471)]||(this.intervalId=setInterval(()=>this.options[e(479)](),t?.watchdogIntervalMs??500))}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0)}},Z=Kf;(function(e,t){let n=Kf,r=e();for(;;)try{if(-parseInt(n(361))/1+-parseInt(n(386))/2*(parseInt(n(392))/3)+-parseInt(n(396))/4+parseInt(n(382))/5*(parseInt(n(368))/6)+parseInt(n(339))/7*(parseInt(n(398))/8)+-parseInt(n(372))/9+-parseInt(n(389))/10*(-parseInt(n(371))/11)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Jf,180913);function Kf(e,t){return e-=339,Jf()[e]}var qf=class{[Z(399)];queue=[];activeJobs=new Map;jobTimeoutIds=new Map;renderer;[Z(387)];[Z(375)];constructor(e){let t=Z;this.services=e,this[t(395)]=new Bf({getOverlayOptions:()=>this[t(390)],getCurrentJob:()=>this.currentJob,getOverlayMessage:e=>this.getOverlayMessage(e),getLanguageMessages:()=>this[t(394)](),hasInteractiveAction:e=>this[t(365)](e),isCameraOverlay:e=>this[t(359)](e),isRemoteLockOverlay:e=>this.isRemoteLockOverlay(e),shouldShowNoFacePasswordInput:e=>this.shouldShowNoFacePasswordInput(e),getOnCameraRetry:()=>this[t(399)].onCameraRetry,getOnRemoteUnlock:()=>this.services.onRemoteUnlock,getOnRemoteUnlockRequest:()=>this.services.onRemoteUnlockRequest,getRemoteUnlockRequestCooldownMs:()=>this.services.getRemoteUnlockRequestCooldownMs?.()??0,onNoFacePasswordSubmit:e=>this.handleNoFacePasswordSubmit(e),getOnError:()=>this.services[t(393)][t(364)]}),this.watchdog=new Gf({getOverlayOptions:()=>this.overlayOptions,ensureIntegrity:()=>this[t(383)]()})}get isDebug(){let e=Z;return!!this[e(399)][e(393)][e(385)]}get overlayOptions(){let e=Z;return this[e(399)].options.overlay}[Z(352)](e){this.enqueue({action:`show`,id:e,state:e,source:this.getDefaultSource(e)})}hide(){let e=Z;this[e(362)]({action:e(370)})}lock(e){this.currentJob&&this.setJobDuration(this.currentJob.id,e)}[Z(384)](){let e=Z;this.currentJob&&this.clearJobDuration(this[e(375)].id)}[Z(343)](){let e=Z;return!!(this.currentJob&&this.jobTimeoutIds[e(400)](this.currentJob.id))}isShowing(){let e=Z;return this[e(375)]!==void 0}isShowingDetectionBlocker(){return this.currentJob!==void 0}[Z(358)](e){for(let t of this.activeJobs.values())if(t.source===e)return!0;return!1}hasActiveState(e){for(let t of this.activeJobs.values())if(t.state===e)return!0;return!1}hasActiveResumePasswordLock(){for(let e of this.activeJobs.values())if(e.requiresPasswordInput)return!0;return!1}enqueue(e){let t=Z;this.queue[t(376)](e),this[t(346)]()}showJob(e){let t=Z;this[t(362)]({...e,action:`show`})}clearJob(e){this.enqueue({action:`clear`,id:e})}clearSource(e){this.enqueue({action:`clear`,source:e})}[Z(360)](){let e=Z;this.watchdog[e(342)](),this.renderer[e(342)]()}[Z(397)](){let e=Z;this.watchdog[e(378)]()}ensureIntegrity(){let e=Z;!this.currentJob||!this[e(390)]?.enabled||this[e(395)].ensureIntegrity(this.currentJob)}processQueue(){let e=Z;for(;this.queue[e(402)]>0;){let t=this.queue[e(348)]();t&&(t.action===e(352)?(this.activeJobs.set(t.id,{id:t.id,state:t.state,source:t[e(381)],text:t.text,priority:t.priority??this[e(347)](t.state),requiresPasswordInput:this.shouldRequirePasswordInput(t[e(373)])}),this[e(341)](t.id,t.durationMs)):this[e(354)](t))}this.syncActiveOverlay()}clearJobs(e){let t=Z;if(!e.id&&!e.source){for(let e of this[t(353)].keys())this[t(374)](e);this.activeJobs.clear();return}if(e.id&&(this.clearJobDuration(e.id),this.activeJobs[t(356)](e.id)),e.source)for(let n of this.activeJobs.values())n[t(381)]===e.source&&(this.clearJobDuration(n.id),this.activeJobs.delete(n.id))}syncActiveOverlay(){let e=Z;if(this[e(375)]=this.getNextActiveJob(),!this.currentJob||this[e(379)]||!this.overlayOptions?.enabled){this.renderHidden();return}this.renderer.render(this.currentJob),this[e(397)]()}renderHidden(){this.stopWatchdog(),this.renderer.hide()}getNextActiveJob(){return[...this.activeJobs.values()].sort((e,t)=>{let n=Kf;return t.priority===e[n(367)]?e.id.localeCompare(t.id):t[n(367)]-e.priority})[0]}[Z(341)](e,t){let n=Z;this.clearJobDuration(e),!(t===void 0||t<=0)&&this[n(345)].set(e,setTimeout(()=>{this.jobTimeoutIds.delete(e),this.activeJobs.delete(e),this.syncActiveOverlay()},t))}clearJobDuration(e){let t=this.jobTimeoutIds.get(e);t&&(clearTimeout(t),this.jobTimeoutIds.delete(e))}getOverlayMessage(e){let t=Z;if(e.text)return e[t(363)];if(this.isMonitorDogOverlayType(e.state))return this[t(390)]?.[t(401)]?.[e.state]??this.getLanguageMessages()[e[t(373)]];switch(e.state){case t(349):return`MonitorDog detection ran out of memory.
|
|
54
|
-
Please close unused tabs or apps to free memory. Detection is restarting automatically.`;case`remoteAdminLocked`:return this.overlayOptions?.messages?.remoteAdminLocked??this.getLanguageMessages().remoteAdminLocked;case`remoteLocked`:return this[t(390)]?.messages?.remoteLocked??this.getLanguageMessages().remoteLocked}}getLanguageMessages(){return Mf(this.overlayOptions?.locale)}[Z(351)](e){let t=Z;return this.isCameraOverlay(e)?`camera`:e===`remoteAdminLocked`||e===`remoteLocked`?t(369):`detection`}getDefaultPriority(e){let t=Z;switch(e){case`remoteAdminLocked`:return 300;case`remoteLocked`:return 250;case t(355):case`cameraReadableError`:return 200;case`webcamTooDark`:case`webcamTooBright`:return 180;default:return 100}}async[Z(366)](e){let t=Z,n=await this.services.auth.authorizedFetch(`/account/me/password/verify_resume`,{method:`POST`,headers:{"content-type":t(388)},body:JSON.stringify({password:e})});if(!n.ok)throw Error(t(403)+n.status);let r=await n[t(377)]();return r&&(this.services[t(380)].resetAfterResumePasswordUnlock(),this.clearSource(`detection`),this.services.webcam.syncPauseState()),r}isCameraOverlay(e){return e===`cameraPermissionDenied`||e===`cameraReadableError`}isRemoteLockOverlay(e){return e===`remoteAdminLocked`||e===`remoteLocked`}[Z(357)](e){let t=Z;return e===`noFaceDetected`&&this[t(399)][t(393)][t(350)]}[Z(340)](e){return e[Z(391)]}hasInteractiveAction(e){let t=Z;return this.isCameraOverlay(e)||this.isRemoteLockOverlay(e)||this.currentJob!==void 0&&this[t(375)].state===e&&this.currentJob.requiresPasswordInput}isMonitorDogOverlayType(e){return e===`noFaceDetected`||e===`twoFacesDetected`||e===`mobileDevice`||e===`webcamBlocked`||e===Z(344)||e===`webcamTooBright`||e===`cameraPermissionDenied`||e===`cameraReadableError`}};function Jf(){let e=`show.activeJobs.clearJobs.cameraPermissionDenied.delete.shouldRequirePasswordInput.hasActiveSource.isCameraOverlay.stopWatchdog.298909edkQVD.enqueue.text.onError.hasInteractiveAction.handleNoFacePasswordSubmit.priority.6GBydkm.remote.clear.11QlrMxJ.2307537fBRPmS.state.clearJobDuration.currentJob.push.json.start.isDebug.detectionEvents.source.1680905RVtnhb.ensureIntegrity.clearLock.debug.362InRvZL.watchdog.application/json.6295120CUZXyY.overlayOptions.requiresPasswordInput.2409QHrcfK.options.getLanguageMessages.renderer.1163204WXfJnh.startWatchdog.1653328ySMSvR.services.has.messages.length.MonitorDog resume password verification failed: .7oUvthq.shouldShowNoFacePasswordInput.setJobDuration.stop.isLocked.webcamTooDark.jobTimeoutIds.processQueue.getDefaultPriority.shift.inferenceMemoryError.requiredPassword.getDefaultSource`.split(`.`);return Jf=function(){return e},Jf()}var Q=Xf;function Yf(){let e=`5067UDPGDe.isWebcamRunning.syncPauseState.startWebcamDetection.stopCurrentWebcam.stop.removeVisibilityListener.161437geYDEY.name.27080pqugZu.startPromise.addVisibilityListener.camera.5OvPgEm.shouldRun.options.NotReadableError.630172PWQfBW.30574eSGuqT.2853264zKOUhs.3031764AfoiLi.14znIMnA.detect.startWebcam.camera:readable.removeEventListener.handleVisibilityChange.isRunning.resumeWhenUnpaused.7992618AUzHow.shouldPauseDetection.isCameraPermissionError.services.overlay`.split(`.`);return Yf=function(){return e},Yf()}(function(e,t){let n=Xf,r=e();for(;;)try{if(-parseInt(n(335))/1+-parseInt(n(346))/2+-parseInt(n(348))/3+-parseInt(n(345))/4+parseInt(n(341))/5*(parseInt(n(323))/6)+parseInt(n(349))/7*(-parseInt(n(347))/8)+parseInt(n(328))/9*(parseInt(n(337))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(Yf,798536);function Xf(e,t){return e-=321,Yf()[e]}var Zf=class{services;isWebcamRunning=!1;stopCurrentWebcam;startPromise;[Q(342)]=!1;resumeWhenUnpaused=!1;handleVisibilityChange=()=>{let e=Q;this[e(330)]()};constructor(e){let t=Q;this[t(326)]=e,this[t(326)].onCameraDisconnect=()=>this.handleCameraDisconnect()}get[Q(321)](){return this.isWebcamRunning}get isStarting(){let e=Q;return!!this[e(338)]}async start(){if(this.services.auth.assertAuthenticated(),this.shouldRun=!0,this.addVisibilityListener(),!this.isWebcamRunning){if(this.services.shouldPauseDetection){this.resumeWhenUnpaused=!0;return}await this.ensureStarted()}}[Q(333)](){let e=Q;this.shouldRun=!1,this.resumeWhenUnpaused=!1,this[e(334)](),this[e(326)].detectionEvents.reset(),this.services.overlay.hide(),this.stopWebcam()}async retryConnection(){let e=Q;if(this[e(329)]){this[e(326)].overlay.clearSource(`camera`);return}await this.start()}async syncPauseState(){let e=Q;if(this.shouldRun){if(this[e(326)][e(324)]){this[e(329)]&&(this[e(322)]=!0,this.stopWebcam());return}if(this.resumeWhenUnpaused&&!this[e(329)]){this[e(322)]=!1;try{await this.ensureStarted()}catch{this.shouldRun=!1}}}}syncBackgroundPreference(){let e=Q;this[e(326)][e(343)].runInBackground?this[e(334)]():this.shouldRun&&this.addVisibilityListener(),this.syncPauseState()}async ensureStarted(){let e=Q;this[e(329)]||(!this.startPromise&&(this.startPromise=this[e(351)]().finally(()=>{let t=e;this[t(338)]=void 0})),await this.startPromise)}async startWebcam(){let e=Q;try{let t=await this.services[e(350)][e(331)]();if(!this[e(342)]){t.stop();return}this.isWebcamRunning=!0,this[e(332)]=t.stop,this[e(326)][e(327)].clearSource(`camera`)}catch(t){throw this[e(325)](t)&&this.services.overlay.showJob({id:`camera:permission`,state:`cameraPermissionDenied`,source:`camera`}),this.isCameraReadError(t)&&this.services[e(327)].showJob({id:e(352),state:`cameraReadableError`,source:e(340)}),this.services.options.onError?.(t),t}}stopWebcam(){this.stopCurrentWebcam?.(),this.stopCurrentWebcam=void 0,this.isWebcamRunning=!1}async handleCameraDisconnect(){let e=Q;if(this.isWebcamRunning&&(this.stopWebcam(),this.shouldRun)){if(this.services[e(324)]){this[e(322)]=!0;return}try{await this.ensureStarted()}catch(t){this[e(326)][e(327)].showJob({id:`camera:readable`,state:`cameraReadableError`,source:e(340)}),this.services.options.onError?.(t)}}}[Q(339)](){let e=Q;this.services[e(343)].runInBackground||typeof document>`u`||document.addEventListener(`visibilitychange`,this.handleVisibilityChange)}[Q(334)](){let e=Q;typeof document>`u`||document[e(353)](`visibilitychange`,this[e(354)])}[Q(325)](e){let t=Q;return e instanceof DOMException&&(e[t(336)]===`NotAllowedError`||e.name===`SecurityError`)}isCameraReadError(e){let t=Q;return e instanceof DOMException&&e.name===t(344)}},Qf=np;(function(e,t){let n=np,r=e();for(;;)try{if(-parseInt(n(245))/1+parseInt(n(243))/2+-parseInt(n(256))/3*(-parseInt(n(251))/4)+-parseInt(n(268))/5+-parseInt(n(247))/6+-parseInt(n(262))/7+-parseInt(n(259))/8*(-parseInt(n(267))/9)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})($f,204581);function $f(){let e=`none.auth.438594esZAEL.updateRequiredPasswordFromServer.172979ZDCeQp.detectionEvents.299046MzFwYR.getRemoteUnlockRequestCooldownMs.confidenceThreshold.policy.1545028ABNxVt.undefined.webcamBlockageDetectionEnabled.hidden.noFaceEventDelayMs.3WarvCb.inputSize.freeze.153040iqNKIw.onCameraRetry.basic_event_uuid.697368qLqgjs.detect.onRemoteUnlockRequest.shouldPauseForResumePassword.mobileDetectionThreshold.63IaCwXk.1062195CPdLZF.onCameraDisconnect.updateNoFaceEventDelayFromServer`.split(`.`);return $f=function(){return e},$f()}var ep=class{auth;overlay;camera;[Qf(246)];[Qf(263)];webcam;[Qf(260)];[Qf(239)];onRemoteUnlock;[Qf(264)];[Qf(248)];onShutdownRequest;onLoginRequired;#e=0;#t=tp();#n;constructor(e){let t=Qf;this.#n=e,this.camera=new Ke,this[t(242)]=new Be(this),this.overlay=new qf(this),this.detectionEvents=new $e(this),this[t(263)]=new _f(this),this.webcam=new Zf(this)}get options(){return Object[Qf(258)]({...this.#n()})}get[Qf(255)](){return this.#e}get userPreferences(){return Object.freeze({...this.#t})}[Qf(240)](e){this.#e=e}[Qf(244)](e){this.#n().requiredPassword=e}degradeInferenceModelForMemoryPressure(){let e=Qf,t=this.#n();if(t[e(257)]>416){t.inputSize=416,t.modelBuildNumber=`416`;return}t.inputSize>320&&(t.inputSize=320,t.modelBuildNumber=`320`)}get shouldPauseForHiddenPage(){let e=Qf;return!this.options.runInBackground&&typeof document!==e(252)&&document[e(254)]}get shouldPauseDetection(){return this.shouldPauseForHiddenPage||this.shouldPauseForResumePassword}get[Qf(265)](){return this.overlay.hasActiveResumePasswordLock()}applyPolicyItems(e,t){let n=Qf,r={...this.#t};for(let t of e)ip(r,t);this.#t=r,this.#n()[n(249)]=r[n(266)],this.#n().faceConfidenceThreshold=r.faceDetectionThreshold,this[n(244)](!1)}resetAuthenticatedState(){this.#e=0,this.#t=tp(),this.#n().requiredPassword=!1,this.#n().confidenceThreshold=this.#t.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=this.#t.faceDetectionThreshold}};function tp(){return{mobileDetectionThreshold:.8,faceDetectionThreshold:.8,headTurningThreshold:.8,language:`en`,mobileDetectionEnabled:!0,noPersonDetectionEnabled:!0,multiPersonDetectionEnabled:!0,noPersonLockDuration:0,multiPersonLockDuration:0,mobileDetectionLockDuration:0,mobileDetectionMode:`auto_lock`,noPersonDetectionMode:`auto_lock`,multiPersonDetectionMode:`auto_lock`,webcamBlockageDetectionEnabled:!0,webcamBlockageLockDuration:0,webcamBlockageDetectionMode:`auto_lock`}}function np(e,t){return e-=239,$f()[e]}function rp(e){return e===Qf(241)}function ip(e,t){let n=Qf,r=t[n(250)],i=!rp(t.policy),a=t.seconds*1e3,o=`sensitivity`in t?1-t.sensitivity/100:void 0;switch(t[n(261)]){case Fe(`mobileDevice`):e.mobileDetectionEnabled=i,e.mobileDetectionLockDuration=a,e.mobileDetectionMode=r,o!==void 0&&(e[n(266)]=o);break;case Fe(`twoFacesDetected`):e.multiPersonDetectionEnabled=i,e.multiPersonLockDuration=a,e.multiPersonDetectionMode=r,o!==void 0&&(e.faceDetectionThreshold=o);break;case Fe(`noFaceDetected`):e.noPersonDetectionEnabled=i,e.noPersonLockDuration=a,e.noPersonDetectionMode=r;break;case Fe(`webcamBlocked`):e[n(253)]=i,e.webcamBlockageLockDuration=a,e.webcamBlockageDetectionMode=r;break;default:break}}var $=cp;(function(e,t){let n=cp,r=e();for(;;)try{if(parseInt(n(561))/1*(parseInt(n(521))/2)+-parseInt(n(547))/3+parseInt(n(555))/4+-parseInt(n(534))/5+-parseInt(n(517))/6+-parseInt(n(508))/7+-parseInt(n(519))/8*(-parseInt(n(515))/9)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(op,430085);var ap=class e{#e;#t;#n=`anonymous`;#r=`idle`;#i=`idle`;#a;#o;static async init(t){return lp=new e(t),lp}constructor(e){let t=cp;mp(e);let n=pp();this.#t={...e,apiBaseUrl:he(e[t(530)]),confidenceThreshold:d,faceConfidenceThreshold:d,iouThreshold:ee,maxDetections:100,inputSize:n?416:640,inputType:`float32`,detectionIntervalMs:e[t(546)]??300,requiredPassword:!1,modelBuildVersion:ne,modelBuildNumber:String(n?416:640)},this.#e=new ep(()=>this.#t),this.#e[t(548)]=()=>this.#e.webcam.retryConnection(),this.#e[t(516)]=()=>this.stop(),this.#e[t(531)]=()=>this.resetLoggedOutState(),Object.freeze(this)}async load(){let e=cp;this.assertUsable(),this.assertAuthenticated(`loading detection`);try{this[e(549)]({runtime:`loading`,lastError:void 0}),await this.#e[e(550)][e(542)](),this.updateState({runtime:`idle`,lastError:void 0})}catch(t){let n=this[e(504)](e(558),`MonitorDog detection model failed to load.`,t);throw this.transitionToError(n),this.#t[e(497)]?.(n),n}}async[$(557)](e){let t=$;this.assertUsable();let n;try{n=await this.#e.auth.login(e)}catch(e){let t=this.createSdkError(`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token could not be created.`,e);throw this.transitionToError(t),this.#t.onAuthError?.(t),t}try{await this[t(529)]()}catch(e){let n=this.createSdkError(`ACCOUNT_POLICY_FAILED`,t(513),e);throw this.rollbackAuthenticatedLogin(),this.transitionToError(n),this.#t.onAuthError?.(n),n}return this.updateState({session:`authenticated`,runtime:this.#r===t(560)?`stopped`:t(526),camera:this.#e[t(544)][t(522)]?t(564):`idle`,lastError:void 0}),n}async completeAuthenticatedLogin(){let e=$,t=await this.#e[e(507)][e(509)](`/account/me`,{method:e(553),headers:{"content-type":e(528)}});if(!t.ok)throw Error(`MonitorDog account request failed: `+t.status);let n=await t.json(),r=await this.#e.auth.authorizedFetch(e(538)+n.uuid+e(559),{method:`GET`,headers:{"content-type":`application/json`}});if(!r.ok)throw Error(`MonitorDog lock policy request failed: `+r.status);let i=await r.json();this.#e[e(496)](i,n)}async logout(){let e=$;if(this[e(552)](),this.isDetectorRunning())throw this.lifecycleError(`DETECTOR_RUNNING`,`MonitorDog detector is running. Call stop() before logout().`);if(!this.#e.auth.getToken()){this.clearSessionState();return}try{await this.#e.auth[e(524)](),this[e(502)]()}catch(t){let n=this.createSdkError(`LOGOUT_FAILED`,e(494),t);throw this.transitionToError(n),this.#t.onAuthError?.(n),n}finally{!this.#e.auth[e(527)]()&&(this.#n=`anonymous`)}}async start(){let e=$;this.assertUsable(),this.assertAuthenticated(e(540)),!this[e(545)]()&&(!this.#o&&(this.#o=this.startRuntime()[e(495)](()=>{this.#o=void 0})),await this.#o)}[$(563)](){let e=$;this.assertUsable(),this.hasRuntimeToStop()&&(this.stopLocalRuntime(),this.updateState({runtime:this.#n===`authenticated`?e(560):e(526),camera:`idle`,lastError:void 0}))}setRunInBackground(e){this.assertUsable(),this.#t.runInBackground=e,this.#e.webcam.syncBackgroundPreference()}[$(518)](){let e=$;return this[e(552)](),this.#e.userPreferences}[$(562)](){let e=$;return this[e(552)](),this.#e[e(550)].isMainUserTrackingEnabled()}setMainUserTrackingEnabled(e){this.assertUsable(),this.#e.detect.setMainUserTrackingEnabled(e)}getState(){let e=$;return Object.freeze({session:this.#n,runtime:this.#r,camera:this.#i,tokenExpiresAt:this.#e.auth.getTokenExpiresAt(),email:this.#e.auth[e(503)](),lastError:this.#a})}dispose(){let e=$;this.#r!==`disposed`&&(this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.auth[e(498)](),this.#e[e(541)](),this.updateState({session:`anonymous`,runtime:`disposed`,camera:`idle`,lastError:void 0}))}resetLoggedOutState(){this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}[$(520)](){let e=$;this.#e[e(507)].dispose(),this.#e[e(541)]()}async startRuntime(){let e=$;try{this.updateState({runtime:`loading`,camera:`idle`,lastError:void 0}),await this.#e.detect[e(542)](),this.updateState({runtime:e(551),camera:`requesting`}),await this.#e[e(544)].start(),this.updateState({runtime:`running`,camera:this.#e[e(532)]?e(526):`active`,lastError:void 0})}catch(t){let n=this.createSdkError(this.getStartErrorCode(t),this[e(556)](t),t);throw this[e(525)](n,sp(n[e(512)])?`blocked`:e(526)),this.#t[e(497)]?.(n),n}}clearSessionState(){let e=$;this.#e[e(541)](),this[e(549)]({session:`anonymous`,runtime:e(526),camera:e(526),lastError:void 0})}stopLocalRuntime(){let e=$;this.#e[e(544)].stop()}assertUsable(){let e=$;if(this.#r===e(506))throw this.lifecycleError(`ALREADY_DISPOSED`,e(510),void 0,`disposed`)}assertAuthenticated(e){if(!this.#e.auth.isAuthenticated())throw this.lifecycleError(`NOT_LOGGED_IN`,`MonitorDog login is required before `+e+`.`)}lifecycleError(e,t,n,r=`error`){let i=$,a=this[i(504)](e,t,n);return r===`error`?this.transitionToError(a):this[i(549)]({runtime:r,lastError:a},!0),a}[$(525)](e,t=this.#i){let n=$;this[n(549)]({runtime:`error`,camera:t,lastError:e},!0)}updateState(e,t=!1){let n=$,r=!1;e[n(539)]!==void 0&&e.session!==this.#n&&(this.#n=e.session,r=!0),e.runtime!==void 0&&e.runtime!==this.#r&&(this.#r=e.runtime,r=!0),e.camera!==void 0&&e[n(514)]!==this.#i&&(this.#i=e.camera,r=!0),`lastError`in e&&e.lastError!==this.#a&&(this.#a=e.lastError,r=!0),(r||t)&&this.notifyStatusChange()}notifyStatusChange(){let e=$;try{this.#t.onStatusChange?.(this[e(533)]())}catch(e){this.#t.onError?.(e)}}createSdkError(e,t,n){return Te(n)?n:new we(e,t,n)}isDetectorRunning(){let e=$;return this.#r===`running`||this.#r===`starting`||!!this.#o||this.#e.webcam.isRunning||this.#e[e(544)].isStarting}[$(499)](){let e=$;return this.#r===`running`||this.#r===e(551)||this.#i!==e(526)||!!this.#o||this.#e.webcam.isRunning||this.#e[e(544)][e(537)]}getStartErrorCode(e){let t=$;return this.isCameraPermissionError(e)?`CAMERA_PERMISSION_DENIED`:this[t(535)](e)?t(554):this.#r===`loading`?`MODEL_LOAD_FAILED`:`RUNTIME_START_FAILED`}getStartErrorMessage(e){let t=$;switch(this.getStartErrorCode(e)){case`CAMERA_PERMISSION_DENIED`:return t(543);case`CAMERA_READ_FAILED`:return t(536);case`MODEL_LOAD_FAILED`:return t(523);default:return`MonitorDog detector runtime failed to start.`}}isCameraPermissionError(e){return typeof DOMException<`u`&&e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`)}[$(535)](e){return typeof DOMException<`u`&&e instanceof DOMException&&e.name===`NotReadableError`}};function op(){let e=`GET,CAMERA_READ_FAILED,218516atoGjy,getStartErrorMessage,login,MODEL_LOAD_FAILED,/lock_policy,stopped,677499KXZWWc,isMainUserTrackingEnabled,stop,active,MonitorDog logout failed.,finally,applyPolicyItems,onError,dispose,hasRuntimeToStop,onDetect,init,clearSessionState,getSessionEmail,createSdkError,mobile,disposed,auth,4940621iYffnF,authorizedFetch,MonitorDog detector instance has already been disposed.,tablet,code,MonitorDog account or policy could not be loaded.,camera,981HYGTCF,onShutdownRequest,4083720HquKJD,getUserPreferences,152480nmUGri,rollbackAuthenticatedLogin,2WbyqML,isRunning,MonitorDog detection model failed to load.,logout,transitionToError,idle,getToken,application/json,completeAuthenticatedLogin,apiBaseUrl,onLoginRequired,shouldPauseDetection,getState,1738380kNBBiv,isCameraReadError,MonitorDog camera could not be read.,isStarting,/account/,session,starting detection,resetAuthenticatedState,load,MonitorDog camera permission was denied.,webcam,isDetectorRunning,detectionIntervalMs,1936452nXSuYC,onCameraRetry,updateState,detect,starting,assertUsable`.split(`,`);return op=function(){return e},op()}function sp(e){return e===`CAMERA_PERMISSION_DENIED`||e===$(554)}function cp(e,t){return e-=494,op()[e]}var lp;function up(e){return lp=new ap(e),lp}async function dp(e){return ap[$(501)](e)}function fp(){if(!lp)throw Error(`MonitorDog is not configured. Call MonitorDogDetector.init(), createMonitorDogDetector(), or configureMonitorDogDetector() before using getDetector().`);return lp}function pp(){let e=$;if(typeof navigator>`u`)return!1;let t=ve();return t===e(505)||t===e(511)}function mp(e){let t=$;if(!e||typeof e.apiBaseUrl!=`string`||e.apiBaseUrl.length===0)throw Error(`MonitorDog apiBaseUrl is required.`);if(typeof e.sessionTokenProvider!=`function`)throw Error(`MonitorDog sessionTokenProvider is required.`);if(typeof e[t(500)]!=`function`)throw Error(`MonitorDog onDetect callback is required.`)}e.MonitorDogDetector=ap,e.MonitorDogSdkError=we,e.configureMonitorDogDetector=up,e.createMonitorDogDetector=dp,e.getDetector=fp,e.isMonitorDogSdkError=Te});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("html2canvas")):typeof define==`function`&&define.amd?define([`exports`,`html2canvas`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.MonitorDogDetector={},e.html2canvas))})(this,function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t,1);var l=.8,u=.7,d=3e4;function f(e){return typeof e==`string`?e:e.access_token}function p(e){if(typeof e!=`string`)return e.expires_in}function ee(e){if(typeof e!=`string`)return e.expires_at}function m(e){if(e.expiresAt){let t=Date.parse(e.expiresAt);if(!Number.isNaN(t))return t}if(e.expiresIn)return e.expiresIn>1e9?e.expiresIn*1e3:Date.now()+e.expiresIn*1e3}function h(e){return e.replace(/\/+$/,``)}function g(){if(typeof navigator>`u`)return`none`;let e=navigator.userAgent.toLowerCase();return/ipad|tablet/.test(e)?`tablet`:/mobile|iphone|ipod|android/.test(e)?`mobile`:/macintosh|windows|linux/.test(e)?`desktop`:`other`}function _(){if(typeof navigator>`u`)return`none`;let e=navigator.userAgent.toLowerCase(),t=navigator.platform.toLowerCase();return/win/.test(t)||/windows/.test(e)?`windows`:/mac/.test(t)||/mac os/.test(e)?`macos`:/android/.test(e)?`android`:/iphone|ipad|ipod/.test(e)?`ios`:/linux/.test(t)||/linux/.test(e)?`linux`:`other`}var v=class extends Error{code;cause;constructor(e,t,n){super(t),this.name=`MonitorDogSdkError`,this.code=e,this.cause=n}};function y(e){return e instanceof v}function b(e){if(e.faceCount===0)return C(`noFaceDetected`,e);if(e.faceCount>=2)return C(`twoFacesDetected`,e);if(e.phoneCount>=1)return C(`mobileDevice`,e)}function x(e){return{...w(e,new Date().toISOString()),properties:{},webcam_imgs:[],monitor_imgs:[]}}function S(e){return e.phoneCount===0&&e.faceCount===1}function C(e,t){let n=w(e,new Date().toISOString());switch(e){case`noFaceDetected`:return{type:e,payload:{...n,properties:{confidence:0,spots:[]}}};case`twoFacesDetected`:return{type:e,payload:{...n,properties:{confidence:T(t.faceDetections),spots:t.faceDetections}}};case`mobileDevice`:return{type:e,payload:{...n,properties:{confidence:T(t.phoneDetections),spots:t.phoneDetections}}}}}function w(e,t){return{basic_event_uuid:E(e),occured_at:t,sended_at:new Date().toISOString(),device_type:g(),device_os:_(),device_id:`browser`}}function T(e){return e.reduce((e,t)=>Math.max(e,t.score),0)}function E(e){switch(e){case`logout`:return`12ca646a-d832-4581-b03c-48f95627507f`;case`login`:return`4c6f98ea-88d8-4215-9b6a-9b3ccb753465`;case`mobileDevice`:return`027af5c9-297d-4a64-983f-4199ca4b9dad`;case`twoFacesDetected`:return`d555efac-7465-4067-8056-611e95385807`;case`noFaceDetected`:return`e2c48c23-36e2-4253-82b1-7f6565fdcfc3`;default:return``}}var D=`MonitorDog token refresh was superseded.`,te=300*1e3,O=class{services;refreshBeforeMs=te;periodicRefreshIntervalMs=d;token;tokenExpiresAt;refreshPromise;refreshIntervalId;authSessionId=0;sessionEmail;constructor(e){this.services=e}async login(e){let t=await this.fetchSessionToken(e.email);return this.sessionEmail=e.email,this.setSessionTokenPayload(t),await this.sendUserActivityEvent(`login`),t}async logout(){if(this.token)try{await this.sendUserActivityEvent(`logout`)}finally{this.clearTokens()}}getToken(){return this.token}getTokenExpiresAt(){return this.tokenExpiresAt}getSessionEmail(){return this.sessionEmail}isAuthenticated(){return!!this.token}dispose(){this.clearTokens()}assertAuthenticated(){if(!this.token)throw Error(`MonitorDog login is required before detection.`)}async getValidAccessToken(){if(this.shouldRefreshCurrentToken())try{await this.handleAuthRefresh()}catch(e){if(this.token&&this.tokenExpiresAt&&Date.now()<this.tokenExpiresAt)return this.token;throw e}return this.token}async authorizedFetch(e,t={},n=!0){let r=await this.getValidAccessToken(),i=new Headers(t.headers);r&&(i.set(`authorization`,`Bearer ${r}`),i.set(`Device-Access-Token`,r));let a=await fetch(`${this.services.options.apiBaseUrl}${e}`,{...t,headers:i}),o=await this.getApiErrorCode(a);return a.status===400&&o===4221&&this.handleLoginRequired(),n&&this.shouldRefreshAfterAuthError(a,o)?(await this.handleAuthRefresh(),this.authorizedFetch(e,t,!1)):a}setSessionTokenPayload(e){let t=f(e);if(!t||typeof t!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);this.setTokens({accessToken:t,expiresIn:p(e),expiresAt:ee(e)})}setTokens(e){this.token=e.accessToken,this.tokenExpiresAt=m(e),this.tokenExpiresAt?this.startPeriodicRefresh():this.stopPeriodicRefresh()}clearTokens(){this.authSessionId+=1,this.token=void 0,this.tokenExpiresAt=void 0,this.refreshPromise=void 0,this.sessionEmail=void 0,this.stopPeriodicRefresh()}async refreshToken(){return this.refreshPromise||=this.refreshAccessToken().finally(()=>{this.refreshPromise=void 0}),this.refreshPromise}async handleAuthRefresh(){try{return await this.refreshToken()}catch(e){if(!this.isRefreshSupersededError(e)){let t=this.createSdkError(`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token refresh failed.`,e);this.services.options.onAuthError?.(t),this.isCurrentTokenExpired()&&(this.clearTokens(),this.services.onLoginRequired?.())}throw e}}async refreshAccessToken(){let e=this.authSessionId,t=this.sessionEmail;if(!t)throw Error(`MonitorDog login email is required to refresh SDK token.`);let n=await this.fetchSessionToken(t),r=f(n);if(!r||typeof r!=`string`)throw Error(`MonitorDog SDK token response did not include a token.`);if(e!==this.authSessionId)throw Error(D);return this.setSessionTokenPayload(n),r}startPeriodicRefresh(){this.refreshIntervalId||=setInterval(()=>{this.refreshPeriodically()},this.periodicRefreshIntervalMs)}stopPeriodicRefresh(){this.refreshIntervalId&&=(clearInterval(this.refreshIntervalId),void 0)}async refreshPeriodically(){if(!(!this.token||!this.shouldRefreshCurrentToken()))try{await this.handleAuthRefresh()}catch{}}shouldRefreshCurrentToken(){return!!(this.token&&this.tokenExpiresAt&&Date.now()>=this.tokenExpiresAt-this.refreshBeforeMs)}isCurrentTokenExpired(){return!!(this.tokenExpiresAt&&Date.now()>=this.tokenExpiresAt)}isRefreshSupersededError(e){return e instanceof Error&&e.message===D}async fetchSessionToken(e){let t=this.services.options.sessionTokenProvider;if(!t)throw Error(`MonitorDog sessionTokenProvider is required for SDK login.`);return t({email:e})}async getApiErrorCode(e){if(e.status===400)try{let t=await e.clone().json();if(typeof t==`object`&&t&&`code`in t&&typeof t.code==`number`)return t.code}catch{return}}shouldRefreshAfterAuthError(e,t){return e.status===401?!0:e.status===400&&t===422}handleLoginRequired(){this.clearTokens(),this.services.onLoginRequired?.();let e=this.createSdkError(`NOT_LOGGED_IN`,`MonitorDog login is required.`);throw this.services.options.onAuthError?.(e),e}async sendUserActivityEvent(e){try{let t=await this.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(x(e))});if(!t.ok)throw Error(`MonitorDog ${e} event failed: ${t.status}`)}catch(t){let n=this.createSdkError(k(e),`MonitorDog ${e} event failed.`,t);if(this.services.options.onAuthError?.(n),e===`logout`)throw n}}createSdkError(e,t,n){return n instanceof v?n:new v(e,t,n)}};function k(e){return e===`logout`?`LOGOUT_FAILED`:`SESSION_TOKEN_FAILED`}var A=/(obs|virtual|xsplit|manycam|splitcam|webcammax|fake|loopback|camtwist|e2esoft|vcam|droidcam|iriun|epoccam|camo|mmhmm|nvidia broadcast|streamlabs|bandicam|wirecast|chromacam|youcam|cyberlink|altserver|logi capture|elgato|streamfx|screen capture|desktop capture)/i,j=class{async createWebcamStream(e){if(!navigator.mediaDevices?.getUserMedia)throw Error(`getUserMedia is not available in this browser.`);let t=this.getBaseWebcamConstraints(e),n=await this.createFirstCameraConstraints(t);try{return await this.getUserMedia(n)}catch(e){if(this.isPermissionError(e)||this.isCameraRequestTimeoutError(e))throw e;return this.createFallbackWebcamStream(n,e)}}stopStream(e){e.getTracks().forEach(e=>e.stop())}watchStreamDeviceDisconnect(e,t,n=1e3){let r=e.getVideoTracks()[0],i=r?.getSettings().deviceId;if(!r&&!i)return()=>{};let a=!1,o,s=()=>{a||(a=!0,t())},c=()=>{i&&(o&&clearTimeout(o),o=setTimeout(()=>{o=void 0,this.handleDeviceChange(i,s)},n))};return r?.addEventListener(`ended`,s),navigator.mediaDevices?.addEventListener?.(`devicechange`,c),()=>{o&&clearTimeout(o),r?.removeEventListener(`ended`,s),navigator.mediaDevices?.removeEventListener?.(`devicechange`,c)}}isCameraInUse(e){let t=e?.srcObject;return t instanceof MediaStream?t.getTracks().some(e=>e.readyState===`live`):!1}async getVideoInputDevices(){return navigator.mediaDevices?.enumerateDevices?(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`):[]}async getRealVideoInputDevices(){let e=await this.getVideoInputDevices(),t=e.filter(e=>!this.isVirtualCamera(e));return t.length>0?t:e}async createFallbackWebcamStream(e,t){let n=await this.getRealVideoInputDevices();if(n.length===0)throw t;let r=n[0],i=t;if(!r?.deviceId)throw i;let a=await this.getWebcamNaturalAspectRatio(r.deviceId),o=this.generateResolutionList(a,720);for(let t of o)try{return await this.getUserMedia(this.createDeviceConstraints(e,r.deviceId,t))}catch(e){i=e}throw i}async handleDeviceChange(e,t){try{(await this.getVideoInputDevices()).some(t=>t.deviceId===e)||t()}catch{}}getBaseWebcamConstraints(e){return e??{audio:!1,video:{facingMode:`user`}}}async createFirstCameraConstraints(e){let t=typeof e.video==`object`?e.video:{};if(`deviceId`in t||`facingMode`in t)return e;let n=(await this.getRealVideoInputDevices())[0];return n?.deviceId?this.createDeviceConstraints(e,n.deviceId):e}async getWebcamNaturalAspectRatio(e){let t;try{t=await this.getUserMedia({audio:!1,video:{deviceId:{exact:e}}});let n=t.getVideoTracks()[0]?.getSettings();if(n?.width&&n.height)return n.width/n.height}catch{}finally{t?.getTracks().forEach(e=>e.stop())}return 16/9}generateResolutionList(e,t){return[t,640,600,480,320,240].map(t=>({width:t,height:Math.max(1,Math.round(t/e))})).filter(e=>e.width<=t&&e.height>=120&&e.height<=1080)}createDeviceConstraints(e,t,n){let r=typeof e.video==`object`?e.video:{};return{...e,audio:e.audio??!1,video:{...r,deviceId:{exact:t},...n?{width:{min:n.width,ideal:n.width},height:{min:n.height,ideal:n.height}}:{}}}}isVirtualCamera(e){let t=e.label.toLowerCase();return t?A.test(t):!1}isPermissionError(e){return e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`)}getUserMedia(e,t=15e3){let n=!1,r,i=navigator.mediaDevices.getUserMedia(e).then(e=>{if(n)throw this.stopStream(e),Error(`Camera permission request timed out.`);return e}),a=new Promise((e,i)=>{r=setTimeout(()=>{n=!0,i(Error(`Camera permission request timed out.`))},t)});return Promise.race([i,a]).finally(()=>{r&&clearTimeout(r)})}isCameraRequestTimeoutError(e){return e instanceof Error&&e.message===`Camera permission request timed out.`}};function M(e){if(e.videoWidth===0||e.videoHeight===0)throw Error(`Video frame is not ready for capture.`);let t=document.createElement(`canvas`),n=t.getContext(`2d`);if(!n)throw Error(`2D canvas context is not available.`);return t.width=e.videoWidth,t.height=e.videoHeight,n.drawImage(e,0,0,t.width,t.height),new Promise((e,n)=>{t.toBlob(t=>{if(!t){n(Error(`Failed to capture video frame.`));return}e(t)},`image/jpeg`,.9)})}async function N(){if(typeof document>`u`||!document.body)return null;let e=await(0,t.default)(document.body,{backgroundColor:`#ffffff`,useCORS:!0});return new Promise(t=>{e.toBlob(t,`image/jpeg`,.9)})}var P=class e{static NO_FACE_STARTUP_GRACE_MS=1500;services;detectionEventLocked=!1;detectionEventInFlight=!1;detectionEventLockTimeoutId;noFaceStartedAt;suppressNoFaceUntil=0;constructor(e){this.services=e}async handleDetectionResult(e,t){if(S(e)){this.noFaceStartedAt=void 0,this.clearLock();return}if(this.detectionEventLocked||this.detectionEventInFlight)return;let n=b(e);if(!n){this.noFaceStartedAt=void 0;return}if(!(n.type===`noFaceDetected`&&!this.hasNoFaceDelayElapsed())&&(n.type!==`noFaceDetected`&&(this.noFaceStartedAt=void 0),this.shouldSendEvent(n.type,e))){this.lock(n.type),this.detectionEventInFlight=!0;try{let e=await this.uploadWebcamImage(t);e&&(n.payload.webcam_imgs=e);let r=await this.uploadMonitorImage();if(r&&(n.payload.monitor_imgs=r),this.services.options.debug){console.log(n.payload);return}let i=await this.services.auth.authorizedFetch(`/event`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n.payload)});if(!i.ok)throw Error(`MonitorDog event request failed: ${i.status}`)}finally{this.detectionEventInFlight=!1}}}reset(){this.clearLock(),this.noFaceStartedAt=void 0,this.suppressNoFaceUntil=0}resetForWebcamStartup(){this.clearLock(),this.noFaceStartedAt=void 0,this.suppressNoFaceUntil=Date.now()+e.NO_FACE_STARTUP_GRACE_MS}clearTransientState(){this.noFaceStartedAt=void 0}async uploadWebcamImage(e){if(!(e instanceof HTMLVideoElement)||e.videoWidth===0||e.videoHeight===0)return;let t=await M(e);return this.uploadImage(t,`webcam.jpg`)}async uploadMonitorImage(){let e=this.services.options.captureMonitorImage?await this.services.options.captureMonitorImage():await N();if(!e)return;let t=typeof File<`u`&&e instanceof File?e.name:`monitor.jpg`;return this.uploadImage(e,t)}async uploadImage(e,t){let n=new FormData;n.append(`files`,e,t);let r=await this.services.auth.authorizedFetch(`/file/image`,{method:`POST`,body:n});if(!r.ok)throw Error(`MonitorDog image upload failed: ${r.status}`);return r.json()}shouldSendEvent(e,t){switch(e){case`mobileDevice`:return this.services.userPreferences.mobileDetectionEnabled&&F(t.phoneDetections)>=this.services.userPreferences.mobileDetectionThreshold;case`twoFacesDetected`:return this.services.userPreferences.multiPersonDetectionEnabled&&F(t.faceDetections)>=this.services.userPreferences.faceDetectionThreshold;case`noFaceDetected`:return this.services.userPreferences.noPersonDetectionEnabled}}lock(e){this.clearLock(),this.detectionEventLocked=!0;let t=this.getLockDuration(e);if(t<=0){this.detectionEventLocked=!1;return}this.detectionEventLockTimeoutId=setTimeout(()=>{this.detectionEventLocked=!1,this.detectionEventLockTimeoutId=void 0},t)}clearLock(){this.detectionEventLockTimeoutId&&=(clearTimeout(this.detectionEventLockTimeoutId),void 0),this.detectionEventLocked=!1}hasNoFaceDelayElapsed(){if(Date.now()<this.suppressNoFaceUntil)return this.noFaceStartedAt=void 0,!1;if(this.services.noFaceEventDelayMs<=0)return!0;let e=Date.now();return this.noFaceStartedAt===void 0?(this.noFaceStartedAt=e,!1):e-this.noFaceStartedAt>=this.services.noFaceEventDelayMs}getLockDuration(e){switch(e){case`mobileDevice`:return this.services.userPreferences.mobileDetectionLockDuration;case`twoFacesDetected`:return this.services.userPreferences.multiPersonLockDuration;case`noFaceDetected`:return this.services.userPreferences.noPersonLockDuration}}};function F(e){return e.reduce((e,t)=>Math.max(e,t.confidence),0)}var I=``+(typeof document>`u`&&typeof location>`u`?require("url").pathToFileURL(__dirname+`/assets/inference-worker-EjUccpPR.js`).href:new URL(`assets/inference-worker-EjUccpPR.js`,typeof document>`u`?location.href:document.currentScript&&document.currentScript.tagName.toUpperCase()===`SCRIPT`&&document.currentScript.src||document.baseURI).href),L=class{worker;nextRequestId=1;pendingRequests=new Map;async load(e){let t={id:this.nextRequestId,type:`load`,model:e};await this.request(t)}run(e){let t=e.source.kind===`bitmap`?[e.source.bitmap]:[e.source.data.buffer];return this.request({id:this.nextRequestId,type:`run`,source:e.source,inputSize:e.inputSize,inputType:e.inputType,confidenceThreshold:e.confidenceThreshold,faceConfidenceThreshold:e.faceConfidenceThreshold,iouThreshold:e.iouThreshold,maxDetections:e.maxDetections,debug:e.debug},t)}terminate(){this.rejectPendingRequests(Error(`Inference worker was terminated.`)),this.worker?.terminate(),this.worker=void 0}request(e,t=[]){let n=this.getWorker();return this.nextRequestId+=1,new Promise((r,i)=>{this.pendingRequests.set(e.id,{resolve:r,reject:i}),n.postMessage(e,t)})}getWorker(){return this.worker||(this.worker=new Worker(I,{name:`MonitorDogInference`,type:`module`}),this.worker.addEventListener(`message`,this.handleMessage),this.worker.addEventListener(`error`,this.handleError),this.worker.addEventListener(`messageerror`,this.handleError)),this.worker}handleMessage=e=>{let t=e.data,n=this.pendingRequests.get(t.id);if(n){if(this.pendingRequests.delete(t.id),!t.ok){n.reject(Error(t.error));return}n.resolve(t.result)}};handleError=e=>{let t=e instanceof ErrorEvent?e.message:`Inference worker message failed.`;this.rejectPendingRequests(Error(t)),this.worker?.terminate(),this.worker=void 0};rejectPendingRequests(e){for(let t of this.pendingRequests.values())t.reject(e);this.pendingRequests.clear()}};async function R(e){let{sourceWidth:t,sourceHeight:n}=z(e);if(e instanceof ImageData)return{kind:`rgba`,data:new Uint8ClampedArray(e.data),sourceWidth:t,sourceHeight:n};if(B()&&V())try{return{kind:`bitmap`,bitmap:await createImageBitmap(e),sourceWidth:t,sourceHeight:n}}catch{}return H(e,t,n)}function z(e){return e instanceof ImageData?{sourceWidth:e.width,sourceHeight:e.height}:e instanceof HTMLVideoElement?{sourceWidth:e.videoWidth,sourceHeight:e.videoHeight}:e instanceof HTMLImageElement?{sourceWidth:e.naturalWidth,sourceHeight:e.naturalHeight}:{sourceWidth:e.width,sourceHeight:e.height}}function B(){return typeof createImageBitmap==`function`}function V(){return typeof OffscreenCanvas==`function`}function H(e,t,n){let r=document.createElement(`canvas`),i=r.getContext(`2d`);if(!i)throw Error(`2D canvas context is not available.`);return r.width=t,r.height=n,i.drawImage(e,0,0,t,n),{kind:`rgba`,data:i.getImageData(0,0,t,n).data,sourceWidth:t,sourceHeight:n}}function ne(e){return e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&e.videoWidth>0&&e.videoHeight>0&&!e.paused&&!e.ended}function U(e,t=1e4){return W(e)?Promise.resolve():new Promise((n,r)=>{let i=window.setTimeout(()=>{o(),r(Error(`Timed out waiting for webcam video metadata.`))},t),a=window.setInterval(s,100),o=()=>{window.clearTimeout(i),window.clearInterval(a),e.removeEventListener(`loadedmetadata`,c),e.removeEventListener(`loadeddata`,c),e.removeEventListener(`canplay`,c),e.removeEventListener(`playing`,c),e.removeEventListener(`resize`,c),e.removeEventListener(`error`,l)};function s(){W(e)&&(o(),n())}let c=()=>{s()},l=()=>{o(),r(Error(`Failed to load webcam video stream.`))};e.addEventListener(`loadedmetadata`,c,{once:!0}),e.addEventListener(`loadeddata`,c,{once:!0}),e.addEventListener(`canplay`,c,{once:!0}),e.addEventListener(`playing`,c,{once:!0}),e.addEventListener(`resize`,c,{once:!0}),e.addEventListener(`error`,l,{once:!0})})}function W(e){return e.readyState>=HTMLMediaElement.HAVE_METADATA&&e.videoWidth>0&&e.videoHeight>0}var G=class{services;inferenceWorker;loadPromise;lastInferenceMemoryErrorAt=0;constructor(e){this.services=e}async load(){this.loadPromise||=this.loadInferenceWorker(),await this.loadPromise}async detect(e){await this.load();let t=this.services.options,n=t.debug?performance.now():0,r=t.debug?performance.now():0,i=await R(e),a=t.debug?performance.now():0,o=await this.getInferenceWorker().run({source:i,inputSize:t.inputSize,inputType:t.inputType,confidenceThreshold:t.confidenceThreshold,faceConfidenceThreshold:t.faceConfidenceThreshold,iouThreshold:t.iouThreshold,maxDetections:t.maxDetections,debug:!!t.debug});if(t.debug){let e=performance.now();console.info(`[MonitorDog] detect frame`,{sourceMs:K(a-r),workerRoundtripMs:K(e-a),totalMs:K(e-n)})}return o}toPublicResult(e){return{faceDetected:e.faceDetected,phoneDetected:e.phoneDetected,faceCount:e.faceCount,phoneCount:e.phoneCount,faceDetections:e.faceDetections,phoneDetections:e.phoneDetections}}detectVideo(e){let t=!1,n,r=this.services.options.detectionIntervalMs,i=async()=>{if(!t){try{if(!this.services.shouldPauseDetection&&ne(e)){let n=await this.detect(e);if(t)return;try{await this.services.options.onDetect({...this.toPublicResult(n),video:e,timestamp:e.currentTime})}catch(e){this.services.options.onError?.(e)}if(t)return;await this.services.detectionEvents.handleDetectionResult(n,e).catch(e=>{this.services.options.onError?.(e)}),S(n)&&this.services.detectionEvents.clearTransientState()}}catch(e){this.handleDetectionLoopError(e)}t||(n=setTimeout(i,r))}};return i(),{stop(){t=!0,n&&clearTimeout(n)}}}async startWebcamDetection(){let e=this.services.options,t=await this.services.camera.createWebcamStream(e.constraints),n=this.services.camera,r=!e.video,i=e.video??document.createElement(`video`),a=i.muted,o=i.playsInline,s=i.srcObject;i.muted=!0,i.playsInline=!0,i.srcObject=t;try{await Promise.all([i.play(),U(i)])}catch(e){throw n.stopStream(t),i.pause(),r?i.srcObject=null:(i.muted=a,i.playsInline=o,i.srcObject=s),e}this.services.detectionEvents.resetForWebcamStartup();let c=this.detectVideo(i),l=!1,u=n.watchStreamDeviceDisconnect(t,()=>{d(),this.services.onCameraDisconnect?.()}),d=()=>{l||(l=!0,u(),c.stop(),this.services.detectionEvents.reset(),n.stopStream(t),i.pause(),r?i.srcObject=null:(i.muted=a,i.playsInline=o,i.srcObject=s))};return{stream:t,video:i,stop:d}}dispose(){this.inferenceWorker?.terminate(),this.inferenceWorker=void 0,this.loadPromise=void 0,this.services.detectionEvents.reset()}handleDetectionLoopError(e){this.isInferenceMemoryError(e)&&this.recoverFromInferenceMemoryError(),this.services.options.onError?.(e)}recoverFromInferenceMemoryError(){this.degradeModelForMemoryPressure(),this.resetInferenceWorker();let e=Date.now();e-this.lastInferenceMemoryErrorAt<1e4||(this.lastInferenceMemoryErrorAt=e)}resetInferenceWorker(){this.inferenceWorker?.terminate(),this.inferenceWorker=void 0,this.loadPromise=void 0}degradeModelForMemoryPressure(){this.services.degradeInferenceModelForMemoryPressure()}isInferenceMemoryError(e){let t=e instanceof Error?e.message:String(e);return/out of memory|oom|memory access out of bounds|cannot enlarge memory|array buffer allocation|bad allocation|allocation failed/i.test(t)}getInferenceWorker(){return this.inferenceWorker||=new L,this.inferenceWorker}async loadInferenceWorker(){try{await this.loadInferenceWorkerWithOptions()}catch(e){if(!this.isInferenceMemoryError(e))throw e;this.recoverFromInferenceMemoryError();try{await this.loadInferenceWorkerWithOptions()}catch(e){throw this.recoverFromInferenceMemoryError(),e}}}async loadInferenceWorkerWithOptions(){let e=await this.services.auth.getValidAccessToken();if(!e)throw Error(`MonitorDog login is required before loading detection.`);let t=this.services.options;await this.getInferenceWorker().load({apiBaseUrl:t.apiBaseUrl,accessToken:e,inputSize:t.inputSize})}};function K(e){return Math.round(e*10)/10}var q=class{services;isWebcamRunning=!1;stopCurrentWebcam;startPromise;shouldRun=!1;resumeWhenUnpaused=!1;handleVisibilityChange=()=>{this.syncPauseState()};constructor(e){this.services=e,this.services.onCameraDisconnect=()=>this.handleCameraDisconnect()}get isRunning(){return this.isWebcamRunning}get isStarting(){return!!this.startPromise}async start(){if(this.services.auth.assertAuthenticated(),this.shouldRun=!0,this.addVisibilityListener(),!this.isWebcamRunning){if(this.services.shouldPauseDetection){this.resumeWhenUnpaused=!0;return}await this.ensureStarted()}}stop(){this.shouldRun=!1,this.resumeWhenUnpaused=!1,this.removeVisibilityListener(),this.services.detectionEvents.reset(),this.stopWebcam()}async retryConnection(){await this.start()}async syncPauseState(){if(this.shouldRun){if(this.services.shouldPauseDetection){this.isWebcamRunning&&(this.resumeWhenUnpaused=!0,this.stopWebcam());return}if(this.resumeWhenUnpaused&&!this.isWebcamRunning){this.resumeWhenUnpaused=!1;try{await this.ensureStarted()}catch{this.shouldRun=!1}}}}syncBackgroundPreference(){this.services.options.runInBackground?this.removeVisibilityListener():this.shouldRun&&this.addVisibilityListener(),this.syncPauseState()}async ensureStarted(){this.isWebcamRunning||(this.startPromise||=this.startWebcam().finally(()=>{this.startPromise=void 0}),await this.startPromise)}async startWebcam(){try{let e=await this.services.detect.startWebcamDetection();if(!this.shouldRun){e.stop();return}this.isWebcamRunning=!0,this.stopCurrentWebcam=e.stop}catch(e){throw this.services.options.onError?.(e),e}}stopWebcam(){this.stopCurrentWebcam?.(),this.stopCurrentWebcam=void 0,this.isWebcamRunning=!1}async handleCameraDisconnect(){if(this.isWebcamRunning&&(this.stopWebcam(),this.shouldRun)){if(this.services.shouldPauseDetection){this.resumeWhenUnpaused=!0;return}try{await this.ensureStarted()}catch(e){this.services.options.onError?.(e)}}}addVisibilityListener(){this.services.options.runInBackground||typeof document>`u`||document.addEventListener(`visibilitychange`,this.handleVisibilityChange)}removeVisibilityListener(){typeof document>`u`||document.removeEventListener(`visibilitychange`,this.handleVisibilityChange)}},J=class{auth;camera;detectionEvents;detect;webcam;onCameraDisconnect;onLoginRequired;#e=0;#t=Y();#n;constructor(e){this.#n=e,this.camera=new j,this.auth=new O(this),this.detectionEvents=new P(this),this.detect=new G(this),this.webcam=new q(this)}get options(){return Object.freeze({...this.#n()})}get noFaceEventDelayMs(){return this.#e}get userPreferences(){return Object.freeze({...this.#t})}updateNoFaceEventDelayFromServer(e){this.#e=e}updateRequiredPasswordFromServer(e){this.#n().requiredPassword=e}degradeInferenceModelForMemoryPressure(){let e=this.#n();if(e.inputSize>416){e.inputSize=416;return}e.inputSize>320&&(e.inputSize=320)}get shouldPauseForHiddenPage(){return!this.options.runInBackground&&typeof document<`u`&&document.hidden}get shouldPauseDetection(){return this.shouldPauseForHiddenPage}applyPolicyItems(e,t){let n={...this.#t};for(let t of e)Z(n,t);this.#t=n,this.#n().confidenceThreshold=n.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=n.faceDetectionThreshold,this.updateRequiredPasswordFromServer(!1)}resetAuthenticatedState(){this.#e=0,this.#t=Y(),this.#n().requiredPassword=!1,this.#n().confidenceThreshold=this.#t.mobileDetectionThreshold,this.#n().faceConfidenceThreshold=this.#t.faceDetectionThreshold}};function Y(){return{mobileDetectionThreshold:.8,faceDetectionThreshold:.8,language:`en`,mobileDetectionEnabled:!0,noPersonDetectionEnabled:!0,multiPersonDetectionEnabled:!0,noPersonLockDuration:0,multiPersonLockDuration:0,mobileDetectionLockDuration:0,mobileDetectionMode:`auto_lock`,noPersonDetectionMode:`auto_lock`,multiPersonDetectionMode:`auto_lock`}}function X(e){return e===`none`}function Z(e,t){let n=t.policy,r=!X(t.policy),i=t.seconds*1e3,a=`sensitivity`in t?1-t.sensitivity/100:void 0;switch(t.basic_event_uuid){case E(`mobileDevice`):e.mobileDetectionEnabled=r,e.mobileDetectionLockDuration=i,e.mobileDetectionMode=n,a!==void 0&&(e.mobileDetectionThreshold=a);break;case E(`twoFacesDetected`):e.multiPersonDetectionEnabled=r,e.multiPersonLockDuration=i,e.multiPersonDetectionMode=n,a!==void 0&&(e.faceDetectionThreshold=a);break;case E(`noFaceDetected`):e.noPersonDetectionEnabled=r,e.noPersonLockDuration=i,e.noPersonDetectionMode=n;break;default:break}}var Q=class e{#e;#t;#n=`anonymous`;#r=`idle`;#i=`idle`;#a;#o;static async init(t){return $=new e(t),$}constructor(e){ce(e);let t=se();this.#t={...e,apiBaseUrl:h(e.apiBaseUrl),confidenceThreshold:l,faceConfidenceThreshold:l,iouThreshold:u,maxDetections:100,inputSize:t?416:640,inputType:`float32`,detectionIntervalMs:e.detectionIntervalMs??300,requiredPassword:!1},this.#e=new J(()=>this.#t),this.#e.onLoginRequired=()=>this.resetLoggedOutState(),Object.freeze(this)}async load(){this.assertUsable(),this.assertAuthenticated(`loading detection`);try{this.updateState({runtime:`loading`,lastError:void 0}),await this.#e.detect.load(),this.updateState({runtime:`idle`,lastError:void 0})}catch(e){let t=this.createSdkError(`MODEL_LOAD_FAILED`,`MonitorDog detection model failed to load.`,e);throw this.transitionToError(t),this.#t.onError?.(t),t}}async login(e){this.assertUsable();let t;try{t=await this.#e.auth.login(e)}catch(e){let t=this.createSdkError(`SESSION_TOKEN_FAILED`,`MonitorDog SDK session token could not be created.`,e);throw this.transitionToError(t),this.#t.onAuthError?.(t),t}try{await this.completeAuthenticatedLogin()}catch(e){let t=this.createSdkError(`ACCOUNT_POLICY_FAILED`,`MonitorDog account or policy could not be loaded.`,e);throw this.rollbackAuthenticatedLogin(),this.transitionToError(t),this.#t.onAuthError?.(t),t}return this.updateState({session:`authenticated`,runtime:this.#r===`stopped`?`stopped`:`idle`,camera:this.#e.webcam.isRunning?`active`:`idle`,lastError:void 0}),t}async logout(){if(this.assertUsable(),this.isDetectorRunning())throw this.lifecycleError(`DETECTOR_RUNNING`,`MonitorDog detector is running. Call stop() before logout().`);if(!this.#e.auth.getToken()){this.clearSessionState();return}try{await this.#e.auth.logout(),this.clearSessionState()}catch(e){let t=this.createSdkError(`LOGOUT_FAILED`,`MonitorDog logout failed.`,e);throw this.transitionToError(t),this.#t.onAuthError?.(t),t}finally{this.#e.auth.getToken()||(this.#n=`anonymous`)}}async start(){this.assertUsable(),this.assertAuthenticated(`starting detection`),!this.isDetectorRunning()&&(this.#o||=this.startRuntime().finally(()=>{this.#o=void 0}),await this.#o)}stop(){this.assertUsable(),this.hasRuntimeToStop()&&(this.stopLocalRuntime(),this.updateState({runtime:this.#n===`authenticated`?`stopped`:`idle`,camera:`idle`,lastError:void 0}))}setRunInBackground(e){this.assertUsable(),this.#t.runInBackground=e,this.#e.webcam.syncBackgroundPreference()}getUserPreferences(){return this.assertUsable(),this.#e.userPreferences}getState(){return Object.freeze({session:this.#n,runtime:this.#r,camera:this.#i,tokenExpiresAt:this.#e.auth.getTokenExpiresAt(),email:this.#e.auth.getSessionEmail(),lastError:this.#a})}dispose(){this.#r!==`disposed`&&(this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.auth.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`disposed`,camera:`idle`,lastError:void 0}))}async completeAuthenticatedLogin(){let e=await this.#e.auth.authorizedFetch(`/account/me`,{method:`GET`,headers:{"content-type":`application/json`}});if(!e.ok)throw Error(`MonitorDog account request failed: ${e.status}`);let t=await e.json(),n=await this.#e.auth.authorizedFetch(`/account/${t.uuid}/lock_policy`,{method:`GET`,headers:{"content-type":`application/json`}});if(!n.ok)throw Error(`MonitorDog lock policy request failed: ${n.status}`);let r=await n.json();this.#e.applyPolicyItems(r,t)}resetLoggedOutState(){this.stopLocalRuntime(),this.#e.detect.dispose(),this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}rollbackAuthenticatedLogin(){this.#e.auth.dispose(),this.#e.resetAuthenticatedState()}async startRuntime(){try{this.updateState({runtime:`loading`,camera:`idle`,lastError:void 0}),await this.#e.detect.load(),this.updateState({runtime:`starting`,camera:`requesting`}),await this.#e.webcam.start(),this.updateState({runtime:`running`,camera:this.#e.shouldPauseDetection?`idle`:`active`,lastError:void 0})}catch(e){let t=this.createSdkError(this.getStartErrorCode(e),this.getStartErrorMessage(e),e);throw this.transitionToError(t,re(t.code)?`blocked`:`idle`),this.#t.onError?.(t),t}}clearSessionState(){this.#e.resetAuthenticatedState(),this.updateState({session:`anonymous`,runtime:`idle`,camera:`idle`,lastError:void 0})}stopLocalRuntime(){this.#e.webcam.stop()}assertUsable(){if(this.#r===`disposed`)throw this.lifecycleError(`ALREADY_DISPOSED`,`MonitorDog detector instance has already been disposed.`,void 0,`disposed`)}assertAuthenticated(e){if(!this.#e.auth.isAuthenticated())throw this.lifecycleError(`NOT_LOGGED_IN`,`MonitorDog login is required before ${e}.`)}lifecycleError(e,t,n,r=`error`){let i=this.createSdkError(e,t,n);return r===`error`?this.transitionToError(i):this.updateState({runtime:r,lastError:i},!0),i}transitionToError(e,t=this.#i){this.updateState({runtime:`error`,camera:t,lastError:e},!0)}updateState(e,t=!1){let n=!1;e.session!==void 0&&e.session!==this.#n&&(this.#n=e.session,n=!0),e.runtime!==void 0&&e.runtime!==this.#r&&(this.#r=e.runtime,n=!0),e.camera!==void 0&&e.camera!==this.#i&&(this.#i=e.camera,n=!0),`lastError`in e&&e.lastError!==this.#a&&(this.#a=e.lastError,n=!0),(n||t)&&this.notifyStatusChange()}notifyStatusChange(){try{this.#t.onStatusChange?.(this.getState())}catch(e){this.#t.onError?.(e)}}createSdkError(e,t,n){return y(n)?n:new v(e,t,n)}isDetectorRunning(){return this.#r===`running`||this.#r===`starting`||!!this.#o||this.#e.webcam.isRunning||this.#e.webcam.isStarting}hasRuntimeToStop(){return this.#r===`running`||this.#r===`starting`||this.#i!==`idle`||!!this.#o||this.#e.webcam.isRunning||this.#e.webcam.isStarting}getStartErrorCode(e){return this.isCameraPermissionError(e)?`CAMERA_PERMISSION_DENIED`:this.isCameraReadError(e)?`CAMERA_READ_FAILED`:this.#r===`loading`?`MODEL_LOAD_FAILED`:`RUNTIME_START_FAILED`}getStartErrorMessage(e){switch(this.getStartErrorCode(e)){case`CAMERA_PERMISSION_DENIED`:return`MonitorDog camera permission was denied.`;case`CAMERA_READ_FAILED`:return`MonitorDog camera could not be read.`;case`MODEL_LOAD_FAILED`:return`MonitorDog detection model failed to load.`;default:return`MonitorDog detector runtime failed to start.`}}isCameraPermissionError(e){return typeof DOMException<`u`&&e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`)}isCameraReadError(e){return typeof DOMException<`u`&&e instanceof DOMException&&e.name===`NotReadableError`}};function re(e){return e===`CAMERA_PERMISSION_DENIED`||e===`CAMERA_READ_FAILED`}var $;function ie(e){return $=new Q(e),$}async function ae(e){return Q.init(e)}function oe(){if(!$)throw Error(`MonitorDog is not configured. Call MonitorDogDetector.init(), createMonitorDogDetector(), or configureMonitorDogDetector() before using getDetector().`);return $}function se(){if(typeof navigator>`u`)return!1;let e=g();return e===`mobile`||e===`tablet`}function ce(e){if(!e||typeof e.apiBaseUrl!=`string`||e.apiBaseUrl.length===0)throw Error(`MonitorDog apiBaseUrl is required.`);if(typeof e.sessionTokenProvider!=`function`)throw Error(`MonitorDog sessionTokenProvider is required.`);if(typeof e.onDetect!=`function`)throw Error(`MonitorDog onDetect callback is required.`)}e.MonitorDogDetector=Q,e.MonitorDogSdkError=v,e.configureMonitorDogDetector=ie,e.createMonitorDogDetector=ae,e.getDetector=oe,e.isMonitorDogSdkError=y});
|