@powercred/liveness-web 0.0.0-stage → 0.1.1
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 +282 -2
- package/THIRD_PARTY_NOTICES.txt +216 -0
- package/dist/assets/liveness-face.bin +0 -0
- package/dist/assets/liveness-runtime-compat.js +20 -0
- package/dist/assets/liveness-runtime-compat.wasm +0 -0
- package/dist/assets/liveness-runtime.js +20 -0
- package/dist/assets/liveness-runtime.wasm +0 -0
- package/dist/index.d.ts +11 -0
- package/dist/liveness-device-C5ygqTPx.js +3741 -0
- package/dist/liveness.iife.js +70 -0
- package/dist/liveness.js +645 -0
- package/dist/sdk.d.ts +31 -0
- package/dist/types.d.ts +138 -0
- package/dist/ui/strings.d.ts +42 -0
- package/package.json +16 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var PowerCredLiveness=function(Gt){"use strict";var ss=typeof document<"u"?document.currentScript:null;const Zr={gettingReady:"Getting ready…",center:"Center your face in the oval",moveCloser:"Move a little closer",moveBack:"Move a little back",lookStraight:"Look straight at the camera",noFace:"We can't see your face",multipleFaces:"Only one person, please",turnLeft:"Turn your head to your LEFT",turnRight:"Turn your head to your RIGHT",lookUp:"Look UP",lookDown:"Look DOWN",smile:"Smile",blink:"Blink once",openMouth:"Open your mouth",holdStill:"Hold still",great:"Great!",wrongDirection:"That was the other way — let's try again",faceLost:"We lost your face — let's try again",interrupted:"The check was interrupted — let's try again",timeUp:"Time's up — let's try again",tooSlow:"That took a while — let's try again",flashIntro:"Hold still — the screen will flash colours",checking:"Checking…",passedTitle:"Done",passedDetail:"Thank you, your liveness check is complete.",submittedTitle:"Thank you",failedTitle:"We couldn't confirm that",failedDetail:"Please try again in good light, facing the camera.",noAttemptsDetail:"Please contact the company that asked you to do this check.",tryAgain:"Try again",cameraDenied:"Camera access is needed. Allow it in your browser settings and try again.",cameraUnavailable:"We couldn't start your camera.",unsupportedBrowser:"This browser can't run the check. Please use an up-to-date Chrome, Safari, Edge or Firefox.",insecureContext:"This page must be opened over https.",network:"Connection problem. Please check your internet and try again.",sessionExpired:"This check has expired. Please start again.",serviceUnavailable:"The check is temporarily unavailable. Please try again shortly.",genericError:"Something went wrong. Please try again."},_c=`
|
|
2
|
+
:host { all: initial; display: block; }
|
|
3
|
+
.pcl { --primary: var(--pcl-primary, #4b45a1); --ok: #1f9d55; --warn: #e3a008; --bad: #d64545;
|
|
4
|
+
font-family: var(--pcl-font, system-ui, -apple-system, "Segoe UI", sans-serif); color: #fff;
|
|
5
|
+
position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
|
|
6
|
+
.stage { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #000; border-radius: 16px; overflow: hidden; }
|
|
7
|
+
@media (min-aspect-ratio: 4/3) and (min-width: 700px) { .stage { aspect-ratio: 4 / 3; } }
|
|
8
|
+
video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
|
|
9
|
+
.oval { position: absolute; left: 50%; top: 45%; width: 62%; aspect-ratio: 3 / 4; max-height: 76%; transform: translate(-50%, -50%);
|
|
10
|
+
border-radius: 50%; border: 3px solid rgba(255,255,255,.85); box-shadow: 0 0 0 9999px rgba(0,0,0,.5);
|
|
11
|
+
transition: border-color .2s; }
|
|
12
|
+
.oval[data-state="ok"] { border-color: var(--ok); }
|
|
13
|
+
.oval[data-state="warn"] { border-color: var(--warn); }
|
|
14
|
+
.prompt { position: absolute; left: 0; right: 0; bottom: 6%; padding: 0 16px; text-align: center;
|
|
15
|
+
font-size: clamp(18px, 5vw, 26px); font-weight: 650; line-height: 1.25; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
|
|
16
|
+
.progress { position: absolute; top: 14px; left: 0; right: 0; display: flex; gap: 8px; justify-content: center; }
|
|
17
|
+
.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.35); }
|
|
18
|
+
.dot[data-state="current"] { background: #fff; }
|
|
19
|
+
.dot[data-state="done"] { background: var(--ok); }
|
|
20
|
+
.countdown { position: absolute; top: 10px; right: 12px; font: 600 14px/1 inherit; background: rgba(0,0,0,.5);
|
|
21
|
+
padding: 6px 10px; border-radius: 99px; font-family: inherit; }
|
|
22
|
+
.debug { position: absolute; left: 8px; top: 34px; font: 12px/1.35 ui-monospace, monospace; background: rgba(0,0,0,.6);
|
|
23
|
+
padding: 6px 8px; border-radius: 6px; white-space: pre; }
|
|
24
|
+
.pcl.flashing .stage { position: fixed; inset: 0; z-index: 2147483647; border-radius: 0; aspect-ratio: auto;
|
|
25
|
+
background: var(--flash, #000); max-width: none; }
|
|
26
|
+
.pcl.flashing video { left: 50%; top: 50%; width: auto; height: 45vh; aspect-ratio: 3 / 4; transform: translate(-50%, -50%) scaleX(-1);
|
|
27
|
+
border-radius: 50%; inset: auto; }
|
|
28
|
+
.pcl.flashing .oval, .pcl.flashing .progress, .pcl.flashing .countdown { display: none; }
|
|
29
|
+
.pcl.flashing .prompt { bottom: 10%; }
|
|
30
|
+
.panel { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
31
|
+
gap: 12px; padding: 24px; text-align: center; background: rgba(15,17,21,.92); border-radius: 16px; }
|
|
32
|
+
.panel[hidden] { display: none; }
|
|
33
|
+
.icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 700; }
|
|
34
|
+
.icon.ok { background: var(--ok); } .icon.bad { background: var(--bad); }
|
|
35
|
+
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff;
|
|
36
|
+
animation: spin 0.9s linear infinite; }
|
|
37
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
38
|
+
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
|
|
39
|
+
.title { font-size: 20px; font-weight: 650; margin: 0; }
|
|
40
|
+
.detail { font-size: 15px; margin: 0; color: #d0d4dc; max-width: 34ch; }
|
|
41
|
+
button { font: inherit; font-size: 16px; font-weight: 600; color: #fff; background: var(--primary); border: 0; border-radius: 10px;
|
|
42
|
+
padding: 12px 22px; cursor: pointer; }
|
|
43
|
+
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
|
|
44
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
|
|
45
|
+
`;class vc{constructor(t={}){this.host=document.createElement("div");const n=this.host.attachShadow({mode:"open"});n.innerHTML=`<style>${_c}</style>
|
|
46
|
+
<div class="pcl">
|
|
47
|
+
<div class="stage">
|
|
48
|
+
<video playsinline muted autoplay></video>
|
|
49
|
+
<div class="oval" data-state="idle"></div>
|
|
50
|
+
<div class="progress"></div>
|
|
51
|
+
<div class="countdown" hidden></div>
|
|
52
|
+
<div class="debug" hidden></div>
|
|
53
|
+
<div class="prompt" role="status" aria-live="polite"></div>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="panel" hidden role="dialog" aria-live="assertive"></div>
|
|
56
|
+
</div>`;const s=r=>n.querySelector(r);this.root=s(".pcl"),this.video=s("video"),this.prompt=s(".prompt"),this.countdownEl=s(".countdown"),this.progressEl=s(".progress"),this.oval=s(".oval"),this.debugEl=s(".debug"),this.panel=s(".panel"),t.primaryColor&&this.root.style.setProperty("--pcl-primary",t.primaryColor),t.fontFamily&&this.root.style.setProperty("--pcl-font",t.fontFamily)}mount(t){t.appendChild(this.host)}unmount(){this.host.remove()}async attach(t){this.video.srcObject=t,await this.video.play().catch(()=>{}),this.video.videoWidth||await new Promise(n=>this.video.addEventListener("loadedmetadata",()=>n(),{once:!0}))}setPrompt(t){this.prompt.textContent!==t&&(this.prompt.textContent=t)}setCountdown(t){this.countdownEl.hidden=t===null,t!==null&&(this.countdownEl.textContent=`${t}s`)}setProgress(t,n,s){this.progressEl.childElementCount!==t&&(this.progressEl.innerHTML=Array.from({length:t},()=>'<span class="dot"></span>').join("")),Array.from(this.progressEl.children).forEach((r,i)=>{r.setAttribute("data-state",i<n?"done":i===s?"current":"todo")})}setOval(t){this.oval.setAttribute("data-state",t)}setFlash(t){this.root.classList.toggle("flashing",t!==null),t?this.root.style.setProperty("--flash",t):this.root.style.removeProperty("--flash")}setDebug(t){this.debugEl.hidden=t===null,t!==null&&(this.debugEl.textContent=t)}showPanel(t,n,s="",r){const i=t==="working"?'<div class="spinner" aria-hidden="true"></div>':`<div class="icon ${t}" aria-hidden="true">${t==="ok"?"✓":"!"}</div>`;if(this.panel.innerHTML=`${i}<p class="title"></p>${s?'<p class="detail"></p>':""}${r?'<button type="button"></button>':""}`,this.panel.querySelector(".title").textContent=n,s&&(this.panel.querySelector(".detail").textContent=s),this.panel.hidden=!1,!r)return Promise.resolve();const o=this.panel.querySelector("button");return o.textContent=r,o.focus(),new Promise(a=>o.addEventListener("click",()=>a(),{once:!0}))}hidePanel(){this.panel.hidden=!0,this.panel.innerHTML=""}}const bc={runtime:"liveness-runtime",runtimeCompat:"liveness-runtime-compat",model:"liveness-face.bin"},kc=ss&&ss.tagName.toUpperCase()==="SCRIPT"&&ss.src||new URL("liveness.iife.js",document.baseURI).href,Ac="assets/";function Ec(e){const t=new URL(e||Ac,e?document.baseURI:kc).href;return t.endsWith("/")?t:t+"/"}class rs extends Error{}class is{constructor(t){this.engine=t,this.lastTs=0,this.inferenceMs=[]}static async create(t,n=2e4){const s=Ec(t),r=Promise.resolve().then(()=>C1).then(o=>o.createEngine(s,bc));let i;try{const o=await Promise.race([r,new Promise((a,c)=>{i=setTimeout(()=>c(new rs("face tracker load timed out")),n)})]);return new is(o)}catch(o){throw r.then(a=>a.close(),()=>{}),o instanceof rs?o:new rs(String(o))}finally{clearTimeout(i)}}detect(t,n){const s=performance.now(),r=Math.max(s,this.lastTs+1);this.lastTs=r;const i=this.engine.detect(t,r,n);return this.inferenceMs.push(performance.now()-s),this.inferenceMs.length>60&&this.inferenceMs.shift(),i}medianInferenceMs(){if(this.inferenceMs.length<10)return null;const t=[...this.inferenceMs].sort((n,s)=>n-s);return t[Math.floor(t.length/2)]}close(){this.engine.close()}}function nt(e){return e.faceCount>=1&&e.yaw!==void 0}class Sc{constructor(t=.5){this.alpha=t}apply(t){return nt(t)?(this.yaw=this.yaw===void 0?t.yaw:this.alpha*t.yaw+(1-this.alpha)*this.yaw,this.pitch=this.pitch===void 0?t.pitch:this.alpha*t.pitch+(1-this.alpha)*this.pitch,{...t,yaw:this.yaw,pitch:this.pitch}):t}}function Tc(e){if(e.length===0)return;const t=[...e].sort((s,r)=>s-r),n=Math.floor(t.length/2);return t.length%2?t[n]:(t[n-1]+t[n])/2}const Ae={turnHeadDeg:20,nodDeg:15,jawOpen:.4,smile:.5,blinkClosed:.6,blinkOpen:.25,blinkMaxMs:600,poseHoldMs:150,expressionHoldMs:300,baselineMs:300};class on{constructor(t){this.ms=t,this.since=null,this.misses=0}update(t,n){return n?(this.since===null&&(this.since=t),this.misses=0,t-this.since>=this.ms):this.since!==null&&this.misses===0?(this.misses=1,!1):(this.since=null,this.misses=0,!1)}}class Qr{constructor(t,n,s){this.axis=t,this.negative=n,this.threshold=s,this.passedAt=null,this.start=null,this.samples=[],this.extreme=0,this.hold=new on(Ae.poseHoldMs),this.opposite=new on(Ae.poseHoldMs)}feed(t){if(this.passedAt!==null)return"passed";if(this.start===null&&(this.start=t.t),!nt(t))return this.hold.update(t.t,!1),this.opposite.update(t.t,!1),"pending";const n=t[this.axis];if(this.baseline===void 0){if(this.samples.push(n),t.t-this.start<Ae.baselineMs)return"pending";this.baseline=Tc(this.samples)}const s=n-this.baseline;(this.negative?s<this.extreme:s>this.extreme)&&(this.extreme=s);const r=this.negative?s<=-this.threshold:s>=this.threshold,i=this.negative?s>=this.threshold:s<=-this.threshold;return this.opposite.update(t.t,i)?"wrong_direction":this.hold.update(t.t,r)?(this.passedAt=t.t,"passed"):"pending"}get peak(){return this.axis==="yaw"?{yaw:an(this.extreme)}:{pitch:an(this.extreme)}}get confidence(){return os(Math.abs(this.extreme)/(this.threshold*1.5))}}class ei{constructor(t,n){this.attr=t,this.threshold=n,this.passedAt=null,this.highest=0,this.hold=new on(Ae.expressionHoldMs)}feed(t){if(this.passedAt!==null)return"passed";const n=nt(t)?t[this.attr]??0:0;return this.highest=Math.max(this.highest,n),this.hold.update(t.t,nt(t)&&n>=this.threshold)?(this.passedAt=t.t,"passed"):"pending"}get peak(){return{score:an(this.highest,3)}}get confidence(){return os(this.highest)}}class xc{constructor(){this.passedAt=null,this.closedAt=null,this.highest=0}feed(t){if(this.passedAt!==null)return"passed";if(!nt(t))return"pending";if(this.highest=Math.max(this.highest,t.blink),t.blink>=Ae.blinkClosed)this.closedAt===null&&(this.closedAt=t.t);else if(this.closedAt!==null){if(t.t-this.closedAt>Ae.blinkMaxMs)this.closedAt=null;else if(t.blink<=Ae.blinkOpen)return this.passedAt=this.closedAt,"passed"}return"pending"}get peak(){return{score:an(this.highest,3)}}get confidence(){return os(this.highest)}}function ti(e,t){switch(e){case"turn_head":return new Qr("yaw",t==="left",Ae.turnHeadDeg);case"nod":return new Qr("pitch",t==="up",Ae.nodDeg);case"smile":return new ei("smile",Ae.smile);case"open_mouth":return new ei("jawOpen",Ae.jawOpen);case"blink":return new xc}}const st={holdMs:800,center:.1,minHeight:.35,maxHeight:.7,maxAngle:12};function Lc(e){return e.faceCount>1?"multiple_faces":nt(e)?e.boxHeight<st.minHeight?"move_closer":e.boxHeight>st.maxHeight?"move_back":Math.abs(e.centerX-.5)>st.center||Math.abs(e.centerY-.5)>st.center?"center":Math.abs(e.yaw)>st.maxAngle||Math.abs(e.pitch)>st.maxAngle?"look_straight":"ok":"no_face"}class Mc{constructor(){this.hold=new on(st.holdMs)}feed(t){const n=Lc(t);return{hint:n,ready:this.hold.update(t.t,n==="ok")}}}function ni(e){return nt(e)&&e.faceCount===1&&Math.abs(e.yaw)<10&&Math.abs(e.pitch)<10&&e.blink<.3}class Pc{constructor(){this.multi=0,this.lostSince=null}feed(t){if(this.multi=t.faceCount>1?this.multi+1:0,this.multi>=5)return"multiple_faces";if(t.faceCount===0){if(this.lostSince===null&&(this.lostSince=t.t),t.t-this.lostSince>=1500)return"face_lost"}else this.lostSince=null;return null}}function os(e){return Math.max(0,Math.min(1,e))}function an(e,t=1){const n=10**t;return Math.round(e*n)/n}const Fc="liveness-web",Oc="0.1.1";function Cc(e){const t=navigator.userAgent,n=navigator.userAgentData;return{schema_version:1,liveness_session_id:e.session.liveness_session_id,sdk:{name:Fc,version:Oc},platform:{os:(n?.platform||navigator.platform||"").slice(0,64)||null,device:null,browser:t.slice(0,64)},camera:{width:e.camera.width??null,height:e.camera.height??null,fps_measured:e.camera.frameRate??null,facing:"user"},video:{mime:e.video.mime,duration_ms:e.video.durationMs,started_at_epoch_ms:e.video.startedAtEpochMs},mode:e.session.mode,challenges:e.challenges,flash:e.flash,stills:e.stills,device_result:{passed:!0,aborted_reason:null,mode:e.mode,fallback_reason:e.fallbackReason,frames_total:e.tally.framesTotal,frames_with_face:e.tally.framesWithFace,frames_with_two_faces:e.tally.framesWithTwoFaces}}}class ue extends Error{constructor(t,n){super(n||t),this.code=t}}async function si(){if(!window.isSecureContext)throw new ue("insecure_context","The camera needs an https page");if(!navigator.mediaDevices?.getUserMedia)throw new ue("unsupported_browser");if(typeof MediaRecorder>"u")throw new ue("unsupported_browser");try{return await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:640},height:{ideal:480},frameRate:{ideal:30}},audio:!1})}catch(e){const t=e?.name;throw t==="NotAllowedError"||t==="SecurityError"?new ue("camera_denied"):new ue("camera_unavailable",t)}}function ri(e){e?.getTracks().forEach(t=>t.stop())}function Ic(e=t=>MediaRecorder.isTypeSupported(t)){return["video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"].find(n=>e(n))||""}class Rc{constructor(t,n=12e5){this.chunks=[],this.t0=0,this.epoch=0;const s=Ic();this.recorder=new MediaRecorder(t,s?{mimeType:s,videoBitsPerSecond:n}:{videoBitsPerSecond:n}),this.recorder.ondataavailable=r=>{r.data&&r.data.size&&this.chunks.push(r.data)}}async start(){const t=new Promise(n=>this.recorder.addEventListener("start",()=>n(),{once:!0}));this.stopped=new Promise(n=>this.recorder.addEventListener("stop",()=>n(),{once:!0})),this.recorder.start(1e3),await t,this.t0=performance.now(),this.epoch=Date.now()}now(){return Math.round(performance.now()-this.t0)}async stop(){this.recorder.state!=="inactive"&&this.recorder.stop(),await this.stopped;const t=(this.recorder.mimeType||"video/webm").split(";")[0];return new Blob(this.chunks,{type:t})}abort(){try{this.recorder.state!=="inactive"&&this.recorder.stop()}catch{}}}async function Nc(e,t){const n=e.videoWidth,s=e.videoHeight,r=Math.min(1,1280/Math.max(n,s)),i=document.createElement("canvas");i.width=Math.round(n*r),i.height=Math.round(s*r),i.getContext("2d").drawImage(e,0,0,i.width,i.height);let o=.9;for(;;){const a=await new Promise(c=>i.toBlob(c,"image/jpeg",o));if(!a)throw new ue("capture_failed");if(a.size<=t||o<=.45)return a;o-=.1}}const rt=e=>new Promise(t=>setTimeout(t,e)),Dc=()=>new Promise(e=>requestAnimationFrame(e)),Uc=120,Bc=700,Gc=400,jc=1e3,Vc=5e3,Hc=2200;class cn extends Error{}class ii extends Error{}function as(e,t){switch(e.type){case"turn_head":return e.direction==="left"?t.turnLeft:t.turnRight;case"nod":return e.direction==="up"?t.lookUp:t.lookDown;case"smile":return t.smile;case"blink":return t.blink;case"open_mouth":return t.openMouth}}function Wc(e,t){switch(e){case"ok":return t.lookStraight;case"no_face":return t.noFace;case"multiple_faces":return t.multipleFaces;case"move_closer":return t.moveCloser;case"move_back":return t.moveBack;case"center":return t.center;case"look_straight":return t.lookStraight}}async function zc(e){const{session:t,view:n,strings:s}=e,r=e.mode==="device"&&e.tracker!==null,i=new Sc,o={framesTotal:0,framesWithFace:0,framesWithTwoFaces:0};let a=null,c=!1,h=()=>{};const u=new Promise(_=>{h=_}),w=()=>{document.visibilityState==="hidden"&&(c=!0,h())};w(),document.addEventListener("visibilitychange",w);const y=()=>{if(e.isCancelled())throw new cn;if(c)throw new ii},le=async()=>{const _=await Promise.race([Dc(),u.then(()=>NaN)]);return y(),_},ke=()=>new Promise(_=>{const J=n.video;J.requestVideoFrameCallback?J.requestVideoFrameCallback(()=>_()):requestAnimationFrame(()=>_()),setTimeout(_,250)}),P=async(_,J)=>{await ke(),y();const Ie=i.apply(e.tracker.detect(n.video,_));return J&&(o.framesTotal++,Ie.faceCount>=1&&o.framesWithFace++,Ie.faceCount>=2&&o.framesWithTwoFaces++),Ie};try{let _=null;if(r){const We=new Mc,tt=performance.now();let G=0;for(;;){_=await P(performance.now()-tt,!1),G++;const sn=e.tracker.medianInferenceMs();if(G>=15&&sn!==null&&sn>Uc)return{kind:"fallback",reason:"slow_device"};const{hint:ft,ready:rn}=We.feed(_);if(n.setPrompt(Wc(ft,s)),n.setOval(ft==="ok"?"ok":"warn"),rn)break}}a=new Rc(e.stream),await a.start(),e.emit({type:"recording_started"});const J=t.limits.max_video_seconds*1e3,Ie=[],fc=[],Xr=async We=>{fc.push({index:Ie.length,captured_at_ms:a.now(),reason:We}),Ie.push(await Nc(n.video,t.limits.max_still_bytes))};if(r){const We=performance.now()+1e3;for(;_&&!ni(_)&&performance.now()<We;)_=await P(a.now(),!0);await Xr("positioning")}else n.setOval("idle"),n.setPrompt(s.lookStraight),await rt(1500),y(),await Xr("positioning");const qr=[],pc=[],Yr=t.challenges.length;if(t.mode==="active"){const We=new Pc;for(const[tt,G]of t.challenges.entries()){n.setProgress(Yr,tt,tt),n.setPrompt(as(G,s)),n.setOval("idle"),e.emit({type:"challenge_started",challenge:G});const sn=a.now();if(r){let ft=ti(G.type,G.direction),rn=1,mc=performance.now();for(;;){const gc=await P(a.now(),!0),yc=We.feed(gc);if(yc)return{kind:"aborted",reason:yc};if(a.now()>J-Vc)return{kind:"aborted",reason:"too_slow"};const wc=ft.feed(gc);if(wc==="wrong_direction")return{kind:"aborted",reason:"wrong_direction"};if(wc==="passed"){qr.push({order:G.order,type:G.type,direction:G.direction,start_ms:sn,end_ms:a.now(),passed:!0,confidence:$c(ft.confidence),timed_out:rn>1,peak:ft.peak}),pc.push(G.type),n.setOval("ok"),n.setPrompt(s.great),n.setProgress(Yr,tt+1,null),e.emit({type:"challenge_passed",challenge:G}),await rt(Gc);break}if(performance.now()-mc>G.timeout_ms){if(rn>1)return{kind:"aborted",reason:`challenge_timeout:${G.type}`};rn=2,ft=ti(G.type,G.direction),mc=performance.now(),n.setPrompt(as(G,s))}}}else await oi(n,y,e.timedWindowMs,as(G,s)),qr.push({order:G.order,type:G.type,direction:G.direction,start_ms:sn,end_ms:a.now(),passed:null,confidence:null,timed_out:!1,peak:null}),n.setProgress(Yr,tt+1,null),n.setPrompt(s.lookStraight),await rt(Bc),y()}}else await oi(n,y,Hc,s.holdStill);const I1=await Kc(e,a,y,le);if(y(),n.setFlash(null),n.setPrompt(s.lookStraight),r){const We=performance.now()+2e3;for(;;){const tt=await P(a.now(),!0);if(ni(tt)||performance.now()>We)break}}else await rt(1500),y();await Xr("return_to_centre"),y();const R1=a.now(),N1=a.epoch,Jr=await a.stop();if(a=null,Jr.size>t.limits.max_video_bytes)throw new ue("recording_too_large");const D1=Cc({session:t,mode:e.mode,fallbackReason:e.fallbackReason,camera:e.stream.getVideoTracks()[0]?.getSettings()??{},video:{mime:Jr.type,durationMs:R1,startedAtEpochMs:N1},challenges:qr,flash:I1,stills:fc,tally:o});return{kind:"recorded",video:Jr,stills:Ie,metadata:D1,passedChallenges:pc}}catch(_){if(_ instanceof ii)return{kind:"aborted",reason:"interrupted"};throw _}finally{document.removeEventListener("visibilitychange",w),a?.abort(),n.setFlash(null),n.setCountdown(null),n.setDebug(null)}}async function oi(e,t,n,s){e.setPrompt(s);const r=performance.now()+n;for(;performance.now()<r;)t(),e.setCountdown(Math.ceil((r-performance.now())/1e3)),await rt(100);e.setCountdown(null)}async function Kc(e,t,n,s){const r=e.session.flash,i={enabled:!1,started_at_ms:null,segments:[],screen_brightness:null,exposure_locked:!1,skipped_reason:null};if(!r.enabled)return i;if(!e.allowFlash)return{...i,skipped_reason:"disabled_by_host"};if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return{...i,skipped_reason:"reduced_motion"};e.emit({type:"flash_started"}),e.view.setFlash("#000000"),e.view.setPrompt(e.strings.flashIntro),await rt(jc),n(),e.view.setPrompt(""),i.enabled=!0;for(const o of r.segments){await s(),e.view.setFlash(o.color);const a=await s(),c=Math.round(a-t.t0);i.started_at_ms===null&&(i.started_at_ms=c),await rt(Math.max(0,o.duration_ms-(performance.now()-a))),i.segments.push({color:o.color,start_ms:c,end_ms:t.now()})}return e.view.setFlash(null),e.emit({type:"flash_ended"}),i}function $c(e){return Math.round(e*100)/100}const Xc=6e4;async function qc(e,t,n){const s=new FormData;s.append("video",n.video,n.video.type==="video/mp4"?"attempt.mp4":"attempt.webm"),n.stills.forEach((i,o)=>s.append("stills",i,`${o}.jpg`)),s.append("metadata",JSON.stringify(n.metadata)),s.append("token",t.token);const r=e.replace(/\/+$/,"")+t.upload_url;for(let i=1;;i++){const o=new AbortController,a=setTimeout(()=>o.abort(),Xc);let c;try{c=await fetch(r,{method:"POST",body:s,signal:o.signal})}catch(u){if(clearTimeout(a),i<2)continue;throw new ue("network",String(u))}clearTimeout(a);const h=await c.json().catch(()=>({}));if(c.ok)return h;throw new ue(Yc(c.status),Jc(h)||`HTTP ${c.status}`)}}function Yc(e){switch(e){case 401:return"session_invalid";case 409:return"already_passed";case 410:return"session_expired";case 413:return"recording_too_large";case 422:return"recording_rejected";case 429:return"attempts_exhausted";case 503:return"service_unavailable";default:return"server_error"}}function Jc(e){const t=e?.detail;return t&&typeof t=="object"&&"error"in t?String(t.error):typeof t=="string"?t:null}const Zc={interrupted:"interrupted",wrong_direction:"wrongDirection",face_lost:"faceLost",multiple_faces:"multipleFaces",too_slow:"tooSlow"},Qc={camera_denied:"cameraDenied",camera_unavailable:"cameraUnavailable",unsupported_browser:"unsupportedBrowser",insecure_context:"insecureContext",network:"network",session_expired:"sessionExpired",session_invalid:"sessionExpired",service_unavailable:"serviceUnavailable",attempts_exhausted:"noAttemptsDetail"};class e2{constructor(t){if(this.config=t,this.view=null,this.stream=null,this.tracker=null,this.cancelled=!1,this.running=!1,this.wakeOnCancel=null,!t.baseUrl)throw new Error("PowerCredLiveness: baseUrl is required");if(!t.session&&!t.sessionProvider)throw new Error("PowerCredLiveness: pass session or sessionProvider");this.strings={...Zr,...t.strings||{}}}async start(t){if(this.running)throw new Error("PowerCredLiveness: already running");this.running=!0,this.cancelled=!1;const n=this.strings,s=this.view=new vc(this.config.theme);s.mount(t),s.setPrompt(n.gettingReady);let r=null,i=null;try{if(r=this.config.session??await this.config.sessionProvider(),Date.parse(r.expires_at)<Date.now())throw new ue("session_expired");const o=r.client_checks==="none"?"none":"device",a=o==="device"?is.create(this.config.assetsUrl).catch(()=>null):Promise.resolve(null);this.stream=await si(),await s.attach(this.stream),this.emit({type:"camera_ready"}),this.tracker=await a;let c=o==="device"&&this.tracker?"device":"none",h=o==="device"&&!this.tracker?"model_unavailable":null;this.emit({type:"mode",mode:c,fallbackReason:h});const u=this.config.maxLocalRetries??2;let w=0;for(;;){const y=await zc({session:r,view:s,strings:n,stream:this.stream,tracker:c==="device"?this.tracker:null,mode:c,fallbackReason:h,allowFlash:this.config.flash!==!1,timedWindowMs:Math.round((this.config.timedWindowSeconds??3.5)*1e3),debug:!1,emit:_=>this.emit(_),isCancelled:()=>this.cancelled});if(y.kind==="fallback"){this.tracker?.close(),this.tracker=null,c="none",h=y.reason,this.emit({type:"mode",mode:c,fallbackReason:h});continue}if(i={mode:c,fallbackReason:h,passedChallenges:y.kind==="recorded"?y.passedChallenges:[]},y.kind==="aborted"){this.emit({type:"attempt_aborted",reason:y.reason}),y.reason!=="interrupted"&&w++;const _=n[Zc[y.reason]??"timeUp"];if(w>u)return this.config.showResult!==!1&&await s.showPanel("bad",n.failedTitle,n.failedDetail),this.finish({status:"failed",livenessSessionId:r.liveness_session_id,device:i,reason:y.reason});await this.untilCancelled(s.showPanel("bad",_,"",n.tryAgain)),s.hidePanel(),await this.ensureCamera(s);continue}const le=y.stills[y.stills.length-1],ke=()=>qc(this.config.baseUrl,r,y);if(this.emit({type:"uploading",bytes:y.video.size}),this.config.waitForServer===!1){const _=r.liveness_session_id;return ke().then(J=>this.serverResult(J),J=>this.emit({type:"error",code:ai(J),message:ci(J)})),this.config.showResult!==!1&&await s.showPanel("ok",n.submittedTitle),this.finish({status:"submitted",livenessSessionId:_,device:i,selfie:le})}await s.showPanel("working",n.checking);const P=await ke();if(this.serverResult(P),P.status==="passed")return this.config.showResult!==!1&&await s.showPanel("ok",n.passedTitle,n.passedDetail),this.finish({status:"passed",livenessSessionId:P.liveness_session_id,attempt:P.attempt,device:i,server:P,retryAllowed:!1,selfie:le});if(P.retry_allowed){await this.untilCancelled(s.showPanel("bad",n.failedTitle,n.failedDetail,n.tryAgain)),s.hidePanel(),await this.ensureCamera(s);continue}return this.config.showResult!==!1&&await s.showPanel("bad",n.failedTitle,n.noAttemptsDetail),this.finish({status:P.status==="inconclusive"?"inconclusive":"failed",livenessSessionId:P.liveness_session_id,attempt:P.attempt,device:i,server:P,retryAllowed:!1,selfie:le})}}catch(o){if(o instanceof cn)return this.finish({status:"cancelled",livenessSessionId:r?.liveness_session_id??null,device:i,reason:"cancelled"});const a=ai(o);this.emit({type:"error",code:a,message:ci(o)});const c=n[Qc[a]??"genericError"];return this.config.showResult!==!1&&await s.showPanel("bad",c),this.finish({status:"error",livenessSessionId:r?.liveness_session_id??null,device:i,reason:a})}}async ensureCamera(t){this.stream?.getVideoTracks().some(n=>n.readyState==="live")||(ri(this.stream),this.stream=await si(),await t.attach(this.stream))}cancel(){this.cancelled=!0,this.wakeOnCancel?.()}untilCancelled(t){return new Promise((n,s)=>{if(this.cancelled)return s(new cn);this.wakeOnCancel=()=>s(new cn),t.then(()=>{this.wakeOnCancel=null,n()})})}destroy(){this.cancel(),this.release(),this.view?.unmount(),this.view=null}finish(t){return this.release(),this.running=!1,t}release(){ri(this.stream),this.stream=null,this.tracker?.close(),this.tracker=null}serverResult(t){this.emit({type:"server_result",result:t});try{this.config.onServerResult?.(t)}catch{}}emit(t){try{this.config.onEvent?.(t)}catch{}}}function ai(e){return e instanceof ue?e.code:"unexpected"}function ci(e){return e instanceof ue?e.message:"Unexpected error"}const t2="0.1.1";var it=typeof self<"u"?self:{};function ot(){throw Error("Invalid UTF8")}function hi(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let hn,cs;const n2=typeof TextDecoder<"u";let s2;const r2=typeof TextEncoder<"u";function li(e){if(r2)e=(s2||(s2=new TextEncoder)).encode(e);else{let n=0;const s=new Uint8Array(3*e.length);for(let r=0;r<e.length;r++){var t=e.charCodeAt(r);if(t<128)s[n++]=t;else{if(t<2048)s[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&r<e.length){const i=e.charCodeAt(++r);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,s[n++]=t>>18|240,s[n++]=t>>12&63|128,s[n++]=t>>6&63|128,s[n++]=63&t|128;continue}r--}t=65533}s[n++]=t>>12|224,s[n++]=t>>6&63|128}s[n++]=63&t|128}}e=n===s.length?s:s.subarray(0,n)}return e}var hs,ln;e:{for(var ui=["CLOSURE_FLAGS"],ls=it,us=0;us<ui.length;us++)if((ls=ls[ui[us]])==null){ln=null;break e}ln=ls}var jt,di=ln&&ln[610401301];hs=di!=null&&di;const fi=it.navigator;function ds(e){return!!hs&&!!jt&&jt.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function de(e){var t;return(t=it.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function ze(){return!!hs&&!!jt&&jt.brands.length>0}function fs(){return ze()?ds("Chromium"):(de("Chrome")||de("CriOS"))&&!(!ze()&&de("Edge"))||de("Silk")}function ps(e){return ps[" "](e),e}jt=fi&&fi.userAgentData||null,ps[" "]=function(){};var i2=!ze()&&(de("Trident")||de("MSIE"));!de("Android")||fs(),fs(),de("Safari")&&(fs()||!ze()&&de("Coast")||!ze()&&de("Opera")||!ze()&&de("Edge")||(ze()?ds("Microsoft Edge"):de("Edg/"))||ze()&&ds("Opera"));var pi={},Vt=null;function o2(e){const t=e.length;let n=3*t/4;n%3?n=Math.floor(n):"=.".indexOf(e[t-1])!=-1&&(n="=.".indexOf(e[t-2])!=-1?n-2:n-1);const s=new Uint8Array(n);let r=0;return function(i,o){function a(h){for(;c<i.length;){const u=i.charAt(c++),w=Vt[u];if(w!=null)return w;if(!/^[\s\xa0]*$/.test(u))throw Error("Unknown base64 encoding at char: "+u)}return h}mi();let c=0;for(;;){const h=a(-1),u=a(0),w=a(64),y=a(64);if(y===64&&h===-1)break;o(h<<2|u>>4),w!=64&&(o(u<<4&240|w>>2),y!=64&&o(w<<6&192|y))}}(e,function(i){s[r++]=i}),r!==n?s.subarray(0,r):s}function mi(){if(!Vt){Vt={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const s=e.concat(t[n].split(""));pi[n]=s;for(let r=0;r<s.length;r++){const i=s[r];Vt[i]===void 0&&(Vt[i]=r)}}}}var gi=typeof Uint8Array<"u",yi=!i2&&typeof btoa=="function";function wi(e){if(!yi){var t;t===void 0&&(t=0),mi(),t=pi[t];var n=Array(Math.floor(e.length/3)),s=t[64]||"";let c=0,h=0;for(;c<e.length-2;c+=3){var r=e[c],i=e[c+1],o=e[c+2],a=t[r>>2];r=t[(3&r)<<4|i>>4],i=t[(15&i)<<2|o>>6],o=t[63&o],n[h++]=a+r+i+o}switch(a=0,o=s,e.length-c){case 2:o=t[(15&(a=e[c+1]))<<2]||s;case 1:e=e[c],n[h]=t[e>>2]+t[(3&e)<<4|a>>4]+o+s}return n.join("")}for(t="",n=0,s=e.length-10240;n<s;)t+=String.fromCharCode.apply(null,e.subarray(n,n+=10240));return t+=String.fromCharCode.apply(null,n?e.subarray(n):e),btoa(t)}const _i=/[-_.]/g,a2={"-":"+",_:"/",".":"="};function c2(e){return a2[e]||""}function vi(e){if(!yi)return o2(e);_i.test(e)&&(e=e.replace(_i,c2)),e=atob(e);const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Ht(e){return gi&&e!=null&&e instanceof Uint8Array}var pt={};function at(){return h2||(h2=new Re(null,pt))}function ms(e){bi(pt);var t=e.g;return(t=t==null||Ht(t)?t:typeof t=="string"?vi(t):null)==null?t:e.g=t}var Re=class{h(){return new Uint8Array(ms(this)||0)}constructor(e,t){if(bi(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let h2,l2;function bi(e){if(e!==pt)throw Error("illegal external caller")}function ki(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function gs(e){return ki(e=Error(e),"warning"),e}var un=typeof Symbol=="function"&&typeof Symbol()=="symbol",u2=new Set;function Wt(e,t,n=!1,s=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?s&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,n&&u2.add(e),e}var d2=Wt("jas",void 0,!0,!0),Ai=Wt(void 0,"0di"),ys=Wt(void 0,"2ex"),zt=Wt(void 0,"1oa",!0),mt=Wt(void 0,Symbol(),!0);const p=un?d2:"Ga",Ei={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Si=Object.defineProperties;function dn(e,t){un||p in e||Si(e,Ei),e[p]|=t}function j(e,t){un||p in e||Si(e,Ei),e[p]=t}function gt(e){return dn(e,34),e}function f2(e,t){j(t,-30975&(0|e))}function ws(e,t){j(t,-30941&(34|e))}function _s(){return typeof BigInt=="function"}function Z(e){return Array.prototype.slice.call(e)}var vs,Kt={},Ti={};function xi(e){return!(!e||typeof e!="object"||e.Ia!==Ti)}function bs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function ks(e,t){if(e!=null){if(typeof e=="string")e=e?new Re(e,pt):at();else if(e.constructor!==Re)if(Ht(e))e=e.length?new Re(new Uint8Array(e),pt):at();else{if(!t)throw Error();e=void 0}}return e}function fn(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[p]))}const Li=[];function Ke(e){if(2&e)throw Error()}j(Li,55),vs=Object.freeze(Li);class pn{constructor(t,n,s){this.l=0,this.g=t,this.h=n,this.m=s}next(){if(this.l<this.g.length){const t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new pn(this.g,this.h,this.m)}}function As(e){return mt?e[mt]:void 0}var p2=Object.freeze({});function mn(e){return e.Qa=!0,e}var m2=mn(e=>typeof e=="number"),Mi=mn(e=>typeof e=="string"),g2=mn(e=>typeof e=="boolean"),gn=typeof it.BigInt=="function"&&typeof it.BigInt(0)=="bigint",Es=mn(e=>gn?e>=w2&&e<=v2:e[0]==="-"?Pi(e,y2):Pi(e,_2));const y2=Number.MIN_SAFE_INTEGER.toString(),w2=gn?BigInt(Number.MIN_SAFE_INTEGER):void 0,_2=Number.MAX_SAFE_INTEGER.toString(),v2=gn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Pi(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++){const s=e[n],r=t[n];if(s>r)return!1;if(s<r)return!0}}const b2=typeof Uint8Array.prototype.slice=="function";let Fi,T=0,N=0;function Oi(e){const t=e>>>0;T=t,N=(e-t)/4294967296>>>0}function yt(e){if(e<0){Oi(-e);const[t,n]=Ls(T,N);T=t>>>0,N=n>>>0}else Oi(e)}function Ss(e){const t=Fi||(Fi=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),N=0,T=t.getUint32(0,!0)}function Ts(e,t){const n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:$t(e,t)}function xs(e,t){const n=2147483648&t;return n&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Ts(e,t))=="number"?n?-e:e:n?"-"+e:e}function $t(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=""+(4294967296*t+e);else _s()?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+Ci(n)+Ci(e));return n}function Ci(e){return e=String(e),"0000000".slice(e.length)+e}function yn(e){if(e.length<16)yt(Number(e));else if(_s())e=BigInt(e),T=Number(e&BigInt(4294967295))>>>0,N=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");N=T=0;const n=e.length;for(let s=t,r=(n-t)%6+t;r<=n;s=r,r+=6){const i=Number(e.slice(s,r));N*=1e6,T=1e6*T+i,T>=4294967296&&(N+=Math.trunc(T/4294967296),N>>>=0,T>>>=0)}if(t){const[s,r]=Ls(T,N);T=s,N=r}}}function Ls(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}const Ms=typeof BigInt=="function"?BigInt.asIntN:void 0,k2=typeof BigInt=="function"?BigInt.asUintN:void 0,wt=Number.isSafeInteger,wn=Number.isFinite,_n=Math.trunc;function $e(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Ii(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const A2=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function vn(e){switch(typeof e){case"bigint":return!0;case"number":return wn(e);case"string":return A2.test(e);default:return!1}}function _t(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return wn(e)?0|e:void 0}function Ri(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return wn(e)?e>>>0:void 0}function Ni(e){if(e[0]==="-")return!1;const t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Ps(e){return e=_n(e),wt(e)||(yt(e),e=xs(T,N)),e}function Fs(e){var t=_n(Number(e));if(wt(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(yn(e),e=T,2147483648&(t=N))if(_s())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[n,s]=Ls(e,t);e="-"+$t(n,s)}else e=$t(e,t);return e}function bn(e){return e==null?e:typeof e=="bigint"?(Es(e)?e=Number(e):(e=Ms(64,e),e=Es(e)?Number(e):String(e)),e):vn(e)?typeof e=="number"?Ps(e):Fs(e):void 0}function E2(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(k2(64,e));if(vn(e)){if(t==="string")return t=_n(Number(e)),wt(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Ni(e)||(yn(e),e=$t(T,N))),e;if(t==="number")return(e=_n(e))>=0&&wt(e)?e:function(n){if(n<0){yt(n);var s=$t(T,N);return n=Number(s),wt(n)?n:s}return Ni(s=String(n))?s:(yt(n),Ts(T,N))}(e)}}function Di(e){if(typeof e!="string")throw Error();return e}function vt(e){if(e!=null&&typeof e!="string")throw Error();return e}function bt(e){return e==null||typeof e=="string"?e:void 0}function Os(e,t,n,s){if(e!=null&&typeof e=="object"&&e.W===Kt)return e;if(!Array.isArray(e))return n?2&s?((e=t[Ai])||(gt((e=new t).u),e=t[Ai]=e),t=e):t=new t:t=void 0,t;let r=n=0|e[p];return r===0&&(r|=32&s),r|=2&s,r!==n&&j(e,r),new t(e)}function S2(e,t,n){if(t)e:{if(!vn(t=e))throw gs("int64");switch(typeof t){case"string":t=Fs(t);break e;case"bigint":if(e=t=Ms(64,t),Mi(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(m2(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=gn?BigInt(t):g2(t)?t?"1":"0":Mi(t)?t.trim()||"0":String(t);break e;default:t=Ps(t)}}else t=bn(e);return typeof(n=(e=t)==null?n?0:void 0:e)=="string"&&wt(t=+n)?t:n}const T2={};let x2=function(){try{return ps(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Cs{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,n){return this.g.set(t,n),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,n){return this.g.forEach(t,n)}[Symbol.iterator](){return this.entries()}}const L2=x2?(Object.setPrototypeOf(Cs.prototype,Map.prototype),Object.defineProperties(Cs.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Cs):class extends Map{constructor(){super()}};function Ui(e){return e}function Is(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var fe=class extends L2{constructor(e,t,n=Ui,s=Ui){super();let r=0|e[p];r|=64,j(e,r),this.L=r,this.S=t,this.R=n,this.Y=this.S?M2:s;for(let i=0;i<e.length;i++){const o=e[i],a=n(o[0],!1,!0);let c=o[1];t?c===void 0&&(c=null):c=s(o[1],!1,!0,void 0,void 0,r),super.set(a,c)}}na(e=Bi){if(this.size!==0)return this.X(e)}X(e=Bi){const t=[],n=super.entries();for(var s;!(s=n.next()).done;)(s=s.value)[0]=e(s[0]),s[1]=e(s[1]),t.push(s);return t}clear(){Is(this),super.clear()}delete(e){return Is(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new pn(e,P2,this)}keys(){return this.Ha()}values(){var e=this.ma();return new pn(e,fe.prototype.get,this)}forEach(e,t){super.forEach((n,s)=>{e.call(t,this.get(s),s,this)})}set(e,t){return Is(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.S,!1,this.L))}Na(e){const t=this.R(e[0],!1,!0);e=e[1],e=this.S?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.L),super.set(t,e)}has(e){return super.has(this.R(e,!1,!1))}get(e){e=this.R(e,!1,!1);const t=super.get(e);if(t!==void 0){var n=this.S;return n?((n=this.Y(t,!1,!0,n,this.ra,this.L))!==t&&super.set(e,n),n):t}}ma(){return Array.from(super.keys())}Ha(){return super.keys()}[Symbol.iterator](){return this.entries()}};function M2(e,t,n,s,r,i){return e=Os(e,s,n,i),r&&(e=An(e)),e}function Bi(e){return e}function P2(e){return[e,this.get(e)]}let F2,Gi,O2;function ji(){return F2||(F2=new fe(gt([]),void 0,void 0,void 0,T2))}function Rs(e,t,n,s,r){if(e!=null){if(Array.isArray(e))e=fn(e)?void 0:r&&2&(0|e[p])?e:Ns(e,t,n,s!==void 0,r);else if(bs(e)){const i={};for(let o in e)i[o]=Rs(e[o],t,n,s,r);e=i}else e=t(e,s);return e}}function Ns(e,t,n,s,r){const i=s||n?0|e[p]:0,o=s?!!(32&i):void 0;s=Z(e);for(let a=0;a<s.length;a++)s[a]=Rs(s[a],t,n,o,r);return n&&((e=As(e))&&(s[mt]=Z(e)),n(i,s)),s}function C2(e){return Rs(e,Vi,void 0,void 0,!1)}function Vi(e){return e.W===Kt?e.toJSON():e instanceof fe?e.na(C2):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Es(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(fn(t))return}else{if(Ht(t))return wi(t);if(t instanceof Re){const n=t.g;return n==null?"":typeof n=="string"?n:t.g=wi(n)}if(t instanceof fe)return t.na()}}return t}(e)}function Hi(e){return Ns(e,Vi,void 0,void 0,!1)}function Xe(e,t,n){return e=Wi(e,t[0],t[1],n?1:2),t!==Gi&&n&&dn(e,16384),e}function Wi(e,t,n,s){if(e==null){var r=96;n?(e=[n],r|=512):e=[],t&&(r=-33521665&r|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(r=0|e[p]))throw Error("farr");if(64&r)return e;if(s===1||s===2||(r|=64),n&&(r|=512,n!==e[0]))throw Error("mid");e:{if(s=(n=e).length){const i=s-1;if(bs(n[i])){if((t=i-(512&(r|=256)?0:-1))>=1024)throw Error("pvtlmt");r=-33521665&r|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,s-(512&r?0:-1)))>1024)throw Error("spvt");r=-33521665&r|(1023&t)<<15}}}return j(e,r),e}function Ds(e,t,n=ws){if(e!=null){if(gi&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var s=0|e[p];return 2&s?e:(t&&(t=s===0||!!(32&s)&&!(64&s||!(16&s))),t?(j(e,-12293&(34|s)),e):Ns(e,Ds,4&s?ws:n,!0,!0))}return e.W===Kt?e=2&(s=0|(n=e.u)[p])?e:new e.constructor(kn(n,s,!0)):e instanceof fe&&!(2&e.L)&&(n=gt(e.X(Ds)),e=new fe(n,e.S,e.R,e.Y)),e}}function kn(e,t,n){const s=n||2&t?ws:f2,r=!!(32&t);return e=function(i,o,a){const c=Z(i);var h=c.length;const u=256&o?c[h-1]:void 0;for(h+=u?-1:0,o=512&o?1:0;o<h;o++)c[o]=a(c[o]);if(u){o=c[o]={};for(const w in u)o[w]=a(u[w])}return(i=As(i))&&(c[mt]=Z(i)),c}(e,t,i=>Ds(i,r,s)),dn(e,32|(n?2:0)),e}function An(e){const t=e.u,n=0|t[p];return 2&n?new e.constructor(kn(t,n,!1)):e}function kt(e,t){return Ne(e=e.u,0|e[p],t)}function Ne(e,t,n,s){if(n===-1)return null;var r=n+(512&t?0:-1);const i=e.length-1;return r>=i&&256&t?e[i][n]:s&&256&t&&(t=e[i][n])!=null?(e[r]!=null&&ys!=null&&((r=(e=l2??(l2={}))[ys]||0)>=4||(e[ys]=r+1,ki(e=Error(),"incident"),function(o){it.setTimeout(()=>{throw o},0)}(e))),t):r<=i?e[r]:void 0}function x(e,t,n){const s=e.u;let r=0|s[p];return Ke(r),R(s,r,t,n),e}function R(e,t,n,s){const r=512&t?0:-1,i=n+r;var o=e.length-1;return i>=o&&256&t?(e[o][n]=s,t):i<=o?(e[i]=s,256&t&&n in(e=e[o])&&delete e[n],t):(s!==void 0&&(n>=(o=t>>15&1023||536870912)?s!=null&&(e[o+r]={[n]:s},j(e,t|=256)):e[i]=s),t)}function En(e,t){let n=0|(e=e.u)[p];const s=Ne(e,n,t),r=$e(s);return r!=null&&r!==s&&R(e,n,t,r),r}function zi(e){let t=0|(e=e.u)[p];const n=Ne(e,t,1),s=ks(n,!0);return s!=null&&s!==n&&R(e,t,1,s),s}function ct(){return p2===void 0?2:4}function ht(e,t,n,s,r){const i=e.u,o=2&(e=0|i[p])?1:s;r=!!r;let a=0|(s=Us(i,e,t))[p];if(!(4&a)){4&a&&(s=Z(s),a=Be(a,e),e=R(i,e,t,s));let c=0,h=0;for(;c<s.length;c++){const u=n(s[c]);u!=null&&(s[h++]=u)}h<c&&(s.length=h),a=Bs(a,e),n=-4097&(20|a),a=n&=-8193,j(s,a),2&a&&Object.freeze(s)}return o===1||o===4&&32&a?De(a)||(r=a,a|=2,a!==r&&j(s,a),Object.freeze(s)):(o===2&&De(a)&&(s=Z(s),a=Be(a,e),a=qe(a,e,r),j(s,a),e=R(i,e,t,s)),De(a)||(t=a,a=qe(a,e,r),a!==t&&j(s,a))),s}function Us(e,t,n,s){return e=Ne(e,t,n,s),Array.isArray(e)?e:vs}function Bs(e,t){return e===0&&(e=Be(e,t)),1|e}function De(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Ki(e){e=Z(e);for(let t=0;t<e.length;t++){const n=e[t]=Z(e[t]);Array.isArray(n[1])&&(n[1]=gt(n[1]))}return e}function Gs(e,t,n,s){let r=0|(e=e.u)[p];Ke(r),R(e,r,t,(s==="0"?Number(n)===0:n===s)?void 0:n)}function At(e,t,n,s,r){Ke(t);var i=!(!(64&t)&&16384&t);const o=(r=Us(e,t,n,r))!==vs;if(i||!o){let a=i=o?0|r[p]:0;(!o||2&a||De(a)||4&a&&!(32&a))&&(r=Z(r),a=Be(a,t),t=R(e,t,n,r)),a=-13&Bs(a,t),a=qe(s?-17&a:16|a,t,!0),a!==i&&j(r,a)}return r}function js(e,t){var n=Jo;return Hs(Vs(e=e.u),e,0|e[p],n)===t?t:-1}function Vs(e){if(un)return e[zt]??(e[zt]=new Map);if(zt in e)return e[zt];const t=new Map;return Object.defineProperty(e,zt,{value:t}),t}function $i(e,t,n,s){const r=Vs(e),i=Hs(r,e,t,n);return i!==s&&(i&&(t=R(e,t,i)),r.set(n,s)),t}function Hs(e,t,n,s){let r=e.get(s);if(r!=null)return r;r=0;for(let i=0;i<s.length;i++){const o=s[i];Ne(t,n,o)!=null&&(r!==0&&(n=R(t,n,r)),r=o)}return e.set(s,r),r}function Ws(e,t,n,s){let r,i=0|e[p];if((s=Ne(e,i,n,s))!=null&&s.W===Kt)return(t=An(s))!==s&&R(e,i,n,t),t.u;if(Array.isArray(s)){const o=0|s[p];r=2&o?Xe(kn(s,o,!1),t,!0):64&o?s:Xe(r,t,!0)}else r=Xe(void 0,t,!0);return r!==s&&R(e,i,n,r),r}function Xi(e,t,n,s){let r=0|(e=e.u)[p];return(t=Os(s=Ne(e,r,n,s),t,!1,r))!==s&&t!=null&&R(e,r,n,t),t}function k(e,t,n,s=!1){if((t=Xi(e,t,n,s))==null)return t;if(!(2&(s=0|(e=e.u)[p]))){const r=An(t);r!==t&&R(e,s,n,t=r)}return t}function qi(e,t,n,s,r,i,o){e=e.u;var a=!!(2&t);const c=a?1:r;i=!!i,o&&(o=!a);var h=0|(r=Us(e,t,s))[p];if(!(a=!!(4&h))){var u=r,w=t;const y=!!(2&(h=Bs(h,t)));y&&(w|=2);let le=!y,ke=!0,P=0,_=0;for(;P<u.length;P++){const J=Os(u[P],n,!1,w);if(J instanceof n){if(!y){const Ie=!!(2&(0|J.u[p]));le&&(le=!Ie),ke&&(ke=Ie)}u[_++]=J}}_<P&&(u.length=_),h|=4,h=ke?16|h:-17&h,j(u,h=le?8|h:-9&h),y&&Object.freeze(u)}if(o&&!(8&h||!r.length&&(c===1||c===4&&32&h))){for(De(h)&&(r=Z(r),h=Be(h,t),t=R(e,t,s,r)),n=r,o=h,u=0;u<n.length;u++)(h=n[u])!==(w=An(h))&&(n[u]=w);o|=8,j(n,o=n.length?-17&o:16|o),h=o}return c===1||c===4&&32&h?De(h)||(t=h,(h|=!r.length||16&h&&(!a||32&h)?2:2048)!==t&&j(r,h),Object.freeze(r)):(c===2&&De(h)&&(j(r=Z(r),h=qe(h=Be(h,t),t,i)),t=R(e,t,s,r)),De(h)||(s=h,(h=qe(h,t,i))!==s&&j(r,h))),r}function Ue(e,t,n){const s=0|e.u[p];return qi(e,s,t,n,ct(),!1,!(2&s))}function g(e,t,n,s){return s==null&&(s=void 0),x(e,n,s)}function Xt(e,t,n,s){s==null&&(s=void 0);e:{let r=0|(e=e.u)[p];if(Ke(r),s==null){const i=Vs(e);if(Hs(i,e,r,n)!==t)break e;i.set(n,0)}else r=$i(e,r,n,t);R(e,r,t,s)}}function Be(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function qe(e,t,n){return 32&t&&n||(e&=-33),e}function Sn(e,t,n,s){const r=0|e.u[p];Ke(r),e=qi(e,r,n,t,2,!0),s=s??new n,e.push(s),e[p]=2&(0|s.u[p])?-9&e[p]:-17&e[p]}function pe(e,t){return _t(kt(e,t))}function me(e,t){return bt(kt(e,t))}function U(e,t){return En(e,t)??0}function qt(e,t,n){if(n!=null&&typeof n!="boolean")throw e=typeof n,Error(`Expected boolean but got ${e!="object"?e:n?Array.isArray(n)?"array":e:"null"}: ${n}`);x(e,t,n)}function Le(e,t,n){if(n!=null){if(typeof n!="number"||!wn(n))throw gs("int32");n|=0}x(e,t,n)}function f(e,t,n){if(n!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);x(e,t,n)}function Tn(e,t,n){{const o=e.u;let a=0|o[p];if(Ke(a),n==null)R(o,a,t);else{var s=e=0|n[p],r=De(e),i=r||Object.isFrozen(n);for(r||(e=0),i||(n=Z(n),s=0,e=qe(e=Be(e,a),a,!0),i=!1),e|=21,r=0;r<n.length;r++){const c=n[r],h=Di(c);Object.is(c,h)||(i&&(n=Z(n),s=0,e=qe(e=Be(e,a),a,!0),i=!1),n[r]=h)}e!==s&&(i&&(n=Z(n),e=qe(e=Be(e,a),a,!0)),j(n,e)),R(o,a,t,n)}}}function xn(e,t,n){Ke(0|e.u[p]),ht(e,t,bt,2,!0).push(Di(n))}function Yi(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function zs(){return Error("Failed to read varint, encoding is invalid.")}function Ji(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Ks(e){if(typeof e=="string")return{buffer:vi(e),N:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Uint8Array)return{buffer:e,N:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Re)return{buffer:ms(e)||new Uint8Array(0),N:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),N:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function $s(e,t){let n,s=0,r=0,i=0;const o=e.h;let a=e.g;do n=o[a++],s|=(127&n)<<i,i+=7;while(i<32&&128&n);for(i>32&&(r|=(127&n)>>4),i=3;i<32&&128&n;i+=7)n=o[a++],r|=(127&n)<<i;if(lt(e,a),n<128)return t(s>>>0,r>>>0);throw zs()}function Xs(e){let t=0,n=e.g;const s=n+10,r=e.h;for(;n<s;){const i=r[n++];if(t|=i,(128&i)==0)return lt(e,n),!!(127&t)}throw zs()}function Ye(e){const t=e.h;let n=e.g,s=t[n++],r=127&s;if(128&s&&(s=t[n++],r|=(127&s)<<7,128&s&&(s=t[n++],r|=(127&s)<<14,128&s&&(s=t[n++],r|=(127&s)<<21,128&s&&(s=t[n++],r|=s<<28,128&s&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw zs();return lt(e,n),r}function Ge(e){return Ye(e)>>>0}function qs(e){var t=e.h;const n=e.g,s=t[n],r=t[n+1],i=t[n+2];return t=t[n+3],lt(e,e.g+4),(s<<0|r<<8|i<<16|t<<24)>>>0}function Ys(e){var t=qs(e);e=2*(t>>31)+1;const n=t>>>23&255;return t&=8388607,n==255?t?NaN:e*(1/0):n==0?1401298464324817e-60*e*t:e*Math.pow(2,n-150)*(t+8388608)}function I2(e){return Ye(e)}function Js(e,t,{ba:n=!1}={}){e.ba=n,t&&(t=Ks(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function lt(e,t){if(e.g=t,t>e.l)throw Ji(e.l,t)}function Zi(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);const n=e.g,s=n+t;if(s>e.l)throw Ji(t,e.l-n);return e.g=s,n}function Qi(e,t){if(t==0)return at();var n=Zi(e,t);return e.ba&&e.m?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array(0):b2?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?at():new Re(n,pt)}fe.prototype.toJSON=void 0,fe.prototype.Ia=Ti;var eo=[];function to(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var n=Ge(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5))throw Yi(n,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=n,!0}function Ln(e){switch(e.h){case 0:e.h!=0?Ln(e):Xs(e.g);break;case 1:lt(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ln(e);else{var t=Ge(e.g);lt(e=e.g,e.g+t)}break;case 5:lt(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!to(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Ln(e)}break;default:throw Yi(e.h,e.l)}}function Yt(e,t,n){const s=e.g.l,r=Ge(e.g),i=e.g.g+r;let o=i-s;if(o<=0&&(e.g.l=i,n(t,e,void 0,void 0,void 0),o=i-e.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${r} bytes, instead read ${r-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=i,e.g.l=s,t}function Zs(e){var t=Ge(e.g),n=Zi(e=e.g,t);if(e=e.h,n2){var s,r=e;(s=cs)||(s=cs=new TextDecoder("utf-8",{fatal:!0})),t=n+t,r=n===0&&t===r.length?r:r.subarray(n,t);try{var i=s.decode(r)}catch(a){if(hn===void 0){try{s.decode(new Uint8Array([128]))}catch{}try{s.decode(new Uint8Array([97])),hn=!0}catch{hn=!1}}throw!hn&&(cs=void 0),a}}else{t=(i=n)+t,n=[];let a,c=null;for(;i<t;){var o=e[i++];o<128?n.push(o):o<224?i>=t?ot():(a=e[i++],o<194||(192&a)!=128?(i--,ot()):n.push((31&o)<<6|63&a)):o<240?i>=t-1?ot():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(s=e[i++]))!=128?(i--,ot()):n.push((15&o)<<12|(63&a)<<6|63&s)):o<=244?i>=t-2?ot():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30||(192&(s=e[i++]))!=128||(192&(r=e[i++]))!=128?(i--,ot()):(o=(7&o)<<18|(63&a)<<12|(63&s)<<6|63&r,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):ot(),n.length>=8192&&(c=hi(c,n),n.length=0)}i=hi(c,n)}return i}function no(e){const t=Ge(e.g);return Qi(e.g,t)}function Mn(e,t,n){var s=Ge(e.g);for(s=e.g.g+s;e.g.g<s;)n.push(t(e.g))}var Pn=[];function R2(e){return e}let Et;function Ee(e,t,n){t.g?t.m(e,t.g,t.h,n):t.m(e,t.h,n)}var d=class{constructor(e,t){this.u=Wi(e,t)}toJSON(){const e=!Et;try{return e&&(Et=Hi),so(this)}finally{e&&(Et=void 0)}}l(){var e=y1;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){const e=this.u;return new this.constructor(kn(e,0|e[p],!1))}N(){return!!(2&(0|this.u[p]))}};function so(e){var t=e.u;{t=(e=Et(t))!==t;let h=e.length;if(h){var n=e[h-1],s=bs(n);s?h--:n=void 0;var r=e;if(s){e:{var i,o=n,a=!1;if(o)for(let u in o)isNaN(+u)?(i??(i={}))[u]=o[u]:(s=o[u],Array.isArray(s)&&(fn(s)||xi(s)&&s.size===0)&&(s=null),s==null&&(a=!0),s!=null&&((i??(i={}))[u]=s));if(a||(i=o),i)for(let u in i){a=i;break e}a=null}o=a==null?n!=null:a!==n}for(;h>0&&((i=r[h-1])==null||fn(i)||xi(i)&&i.size===0);h--)var c=!0;(r!==e||o||c)&&(t?(c||o||a)&&(r.length=h):r=Array.prototype.slice.call(r,0,h),a&&r.push(a)),c=r}else c=e}return c}function ro(e){return e?/^\d+$/.test(e)?(yn(e),new Qs(T,N)):null:N2||(N2=new Qs(0,0))}d.prototype.W=Kt,d.prototype.toString=function(){try{return Et=R2,so(this).toString()}finally{Et=void 0}};var Qs=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let N2;function io(e){return e?/^-?\d+$/.test(e)?(yn(e),new er(T,N)):null:D2||(D2=new er(0,0))}var er=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let D2;function St(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 Tt(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Fn(e,t){if(t>=0)Tt(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Jt(e,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 xt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function ne(e,t,n){Tt(e.g,8*t+n)}function tr(e,t){return ne(e,t,2),t=e.g.end(),xt(e,t),t.push(e.h),t}function nr(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 On(e,t,n){ne(e,t,2),Tt(e.g,n.length),xt(e,e.g.end()),xt(e,n)}function Cn(e,t,n,s){n!=null&&(t=tr(e,t),s(n,e),nr(e,t))}function Se(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var sr=Se(),oo=Se(),rr=Se(),ir=Se(),ao=Se(),co=Se(),or=Se(),ho=Se(),lo=Se(),Lt=class{constructor(e,t,n){this.g=e,this.h=t,e=sr,this.l=!!e&&n===e||!1}};function In(e,t){return new Lt(e,t,sr)}function uo(e,t,n,s,r){Cn(e,n,wo(t,s),r)}const U2=In(function(e,t,n,s,r){return e.h===2&&(Yt(e,Ws(t,s,n),r),!0)},uo),B2=In(function(e,t,n,s,r){return e.h===2&&(Yt(e,Ws(t,s,n,!0),r),!0)},uo);var Rn=Symbol(),ar=Symbol(),fo=Symbol(),po=Symbol();let mo,go;function ut(e,t,n,s){var r=s[e];if(r)return r;(r={}).Pa=s,r.V=function(w){switch(typeof w){case"boolean":return Gi||(Gi=[0,void 0,!0]);case"number":return w>0?void 0:w===0?O2||(O2=[0,void 0]):[-w,void 0];case"string":return[0,w];case"object":return w}}(s[0]);var i=s[1];let o=1;i&&i.constructor===Object&&(r.ga=i,typeof(i=s[++o])=="function"&&(r.la=!0,mo??(mo=i),go??(go=s[o+1]),i=s[o+=2]));const a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=s[++o]}for(c=1;i!==void 0;){let w;typeof i=="number"&&(c+=i,i=s[++o]);var h=void 0;if(i instanceof Lt?w=i:(w=U2,o--),w?.l){i=s[++o],h=s;var u=o;typeof i=="function"&&(i=i(),h[u]=i),h=i}for(u=c+1,typeof(i=s[++o])=="number"&&i<0&&(u-=i,i=s[++o]);c<u;c++){const y=a[c];h?n(r,c,w,h,y):t(r,c,w,y)}}return s[e]=r}function yo(e){return Array.isArray(e)?e[0]instanceof Lt?e:[B2,e]:[e,void 0]}function wo(e,t){return e instanceof d?e.u:Array.isArray(e)?Xe(e,t,!1):void 0}function cr(e,t,n,s){const r=n.g;e[t]=s?(i,o,a)=>r(i,o,a,s):r}function hr(e,t,n,s,r){const i=n.g;let o,a;e[t]=(c,h,u)=>i(c,h,u,a||(a=ut(ar,cr,hr,s).V),o||(o=lr(s)),r)}function lr(e){let t=e[fo];if(t!=null)return t;const n=ut(ar,cr,hr,e);return t=n.la?(s,r)=>mo(s,r,n):(s,r)=>{const i=0|s[p];for(;to(r)&&r.h!=4;){var o=r.m,a=n[o];if(a==null){var c=n.ga;c&&(c=c[o])&&(c=G2(c))!=null&&(a=n[o]=c)}a!=null&&a(r,s,o)||(o=(a=r).l,Ln(a),a.fa?a=void 0:(c=a.g.g-o,a.g.g=o,a=Qi(a.g,c)),o=s,a&&((c=o[mt])?c.push(a):o[mt]=[a]))}return 16384&i&>(s),!0},e[fo]=t}function G2(e){const t=(e=yo(e))[0].g;if(e=e[1]){const n=lr(e),s=ut(ar,cr,hr,e).V;return(r,i,o)=>t(r,i,o,s,n)}return t}function Nn(e,t,n){e[t]=n.h}function Dn(e,t,n,s){let r,i;const o=n.h;e[t]=(a,c,h)=>o(a,c,h,i||(i=ut(Rn,Nn,Dn,s).V),r||(r=_o(s)))}function _o(e){let t=e[po];if(!t){const n=ut(Rn,Nn,Dn,e);t=(s,r)=>vo(s,r,n),e[po]=t}return t}function vo(e,t,n){for(var s=0|e[p],r=512&s?0:-1,i=e.length,o=512&s?1:0,a=i+(256&s?-1:0);o<a;o++){const c=e[o];if(c==null)continue;const h=o-r,u=bo(n,h);u&&u(t,c,h)}if(256&s){s=e[i-1];for(const c in s)r=+c,Number.isNaN(r)||(i=s[r])!=null&&(a=bo(n,r))&&a(t,i,r)}if(e=As(e))for(xt(t,t.g.end()),n=0;n<e.length;n++)xt(t,ms(e[n])||new Uint8Array(0))}function bo(e,t){var n=e[t];if(n)return n;if((n=e.ga)&&(n=n[t])){var s=(n=yo(n))[0].h;if(n=n[1]){const r=_o(n),i=ut(Rn,Nn,Dn,n).V;n=e.la?go(i,r):(o,a,c)=>s(o,a,c,i,r)}else n=s;return e[t]=n}}function Mt(e,t){if(Array.isArray(t)){var n=0|t[p];if(4&n)return t;for(var s=0,r=0;s<t.length;s++){const i=e(t[s]);i!=null&&(t[r++]=i)}return r<s&&(t.length=r),j(t,-12289&(5|n)),2&n&&Object.freeze(t),t}}function X(e,t,n){return new Lt(e,t,n)}function Pt(e,t,n){return new Lt(e,t,n)}function q(e,t,n){R(e,0|e[p],t,n)}var j2=In(function(e,t,n,s,r){return e.h===2&&(e=Yt(e,Xe([void 0,void 0],s,!0),r),Ke(s=0|t[p]),(r=Ne(t,s,n))instanceof fe?2&r.L?((r=r.X()).push(e),R(t,s,n,r)):r.Na(e):Array.isArray(r)?(2&(0|r[p])&&R(t,s,n,r=Ki(r)),r.push(e)):R(t,s,n,[e]),!0)},function(e,t,n,s,r){if(t instanceof fe)t.forEach((i,o)=>{Cn(e,n,Xe([o,i],s,!1),r)});else if(Array.isArray(t))for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&Cn(e,n,Xe(o,s,!1),r)}});function ko(e,t,n){if(t=function(s){if(s==null)return s;const r=typeof s;if(r==="bigint")return String(Ms(64,s));if(vn(s)){if(r==="string")return Fs(s);if(r==="number")return Ps(s)}}(t),t!=null&&(typeof t=="string"&&io(t),t!=null))switch(ne(e,n,0),typeof t){case"number":e=e.g,yt(t),St(e,T,N);break;case"bigint":n=BigInt.asUintN(64,t),n=new er(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),St(e.g,n.h,n.g);break;default:n=io(t),St(e.g,n.h,n.g)}}function Ao(e,t,n){(t=_t(t))!=null&&t!=null&&(ne(e,n,0),Fn(e.g,t))}function Eo(e,t,n){(t=Ii(t))!=null&&(ne(e,n,0),e.g.g.push(t?1:0))}function So(e,t,n){(t=bt(t))!=null&&On(e,n,li(t))}function To(e,t,n,s,r){Cn(e,n,wo(t,s),r)}function xo(e,t,n){(t=t==null||typeof t=="string"||Ht(t)||t instanceof Re?t:void 0)!=null&&On(e,n,Ks(t).buffer)}function Lo(e,t,n){return(e.h===5||e.h===2)&&(t=At(t,0|t[p],n,!1,!1),e.h==2?Mn(e,Ys,t):t.push(Ys(e.g)),!0)}var je=X(function(e,t,n){if(e.h!==1)return!1;var s=e.g;e=qs(s);const r=qs(s);s=2*(r>>31)+1;const i=r>>>20&2047;return e=4294967296*(1048575&r)+e,q(t,n,i==2047?e?NaN:s*(1/0):i==0?5e-324*s*e:s*Math.pow(2,i-1075)*(e+4503599627370496)),!0},function(e,t,n){(t=$e(t))!=null&&(ne(e,n,1),e=e.g,(n=Fi||(Fi=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),T=n.getUint32(0,!0),N=n.getUint32(4,!0),Jt(e,T),Jt(e,N))},Se()),V=X(function(e,t,n){return e.h===5&&(q(t,n,Ys(e.g)),!0)},function(e,t,n){(t=$e(t))!=null&&(ne(e,n,5),e=e.g,Ss(t),Jt(e,T))},or),V2=Pt(Lo,function(e,t,n){if((t=Mt($e,t))!=null)for(let o=0;o<t.length;o++){var s=e,r=n,i=t[o];i!=null&&(ne(s,r,5),s=s.g,Ss(i),Jt(s,T))}},or),ur=Pt(Lo,function(e,t,n){if((t=Mt($e,t))!=null&&t.length){ne(e,n,2),Tt(e.g,4*t.length);for(let s=0;s<t.length;s++)n=e.g,Ss(t[s]),Jt(n,T)}},or),Je=X(function(e,t,n){return e.h===0&&(q(t,n,$s(e.g,xs)),!0)},ko,co),dr=X(function(e,t,n){return e.h===0&&(q(t,n,(e=$s(e.g,xs))===0?void 0:e),!0)},ko,co),H2=X(function(e,t,n){return e.h===0&&(q(t,n,$s(e.g,Ts)),!0)},function(e,t,n){if((t=E2(t))!=null&&(typeof t=="string"&&ro(t),t!=null))switch(ne(e,n,0),typeof t){case"number":e=e.g,yt(t),St(e,T,N);break;case"bigint":n=BigInt.asUintN(64,t),n=new Qs(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),St(e.g,n.h,n.g);break;default:n=ro(t),St(e.g,n.h,n.g)}},Se()),D=X(function(e,t,n){return e.h===0&&(q(t,n,Ye(e.g)),!0)},Ao,ir),Un=Pt(function(e,t,n){return(e.h===0||e.h===2)&&(t=At(t,0|t[p],n,!1,!1),e.h==2?Mn(e,Ye,t):t.push(Ye(e.g)),!0)},function(e,t,n){if((t=Mt(_t,t))!=null&&t.length){n=tr(e,n);for(let s=0;s<t.length;s++)Fn(e.g,t[s]);nr(e,n)}},ir),Ft=X(function(e,t,n){return e.h===0&&(q(t,n,(e=Ye(e.g))===0?void 0:e),!0)},Ao,ir),F=X(function(e,t,n){return e.h===0&&(q(t,n,Xs(e.g)),!0)},Eo,oo),Ot=X(function(e,t,n){return e.h===0&&(q(t,n,(e=Xs(e.g))===!1?void 0:e),!0)},Eo,oo),$=Pt(function(e,t,n){return e.h===2&&(e=Zs(e),At(t,0|t[p],n,!1).push(e),!0)},function(e,t,n){if((t=Mt(bt,t))!=null)for(let o=0;o<t.length;o++){var s=e,r=n,i=t[o];i!=null&&On(s,r,li(i))}},rr),Ze=X(function(e,t,n){return e.h===2&&(q(t,n,(e=Zs(e))===""?void 0:e),!0)},So,rr),E=X(function(e,t,n){return e.h===2&&(q(t,n,Zs(e)),!0)},So,rr),W=function(e,t,n=sr){return new Lt(e,t,n)}(function(e,t,n,s,r){return e.h===2&&(s=Xe(void 0,s,!0),At(t,0|t[p],n,!0).push(s),Yt(e,s,r),!0)},function(e,t,n,s,r){if(Array.isArray(t))for(let i=0;i<t.length;i++)To(e,t[i],n,s,r)}),S=In(function(e,t,n,s,r,i){return e.h===2&&($i(t,0|t[p],i,n),Yt(e,t=Ws(t,s,n),r),!0)},To),Mo=X(function(e,t,n){return e.h===2&&(q(t,n,no(e)),!0)},xo,ho),W2=Pt(function(e,t,n){return(e.h===0||e.h===2)&&(t=At(t,0|t[p],n,!1,!1),e.h==2?Mn(e,Ge,t):t.push(Ge(e.g)),!0)},function(e,t,n){if((t=Mt(Ri,t))!=null)for(let o=0;o<t.length;o++){var s=e,r=n,i=t[o];i!=null&&(ne(s,r,0),Tt(s.g,i))}},ao),z2=X(function(e,t,n){return e.h===0&&(q(t,n,(e=Ge(e.g))===0?void 0:e),!0)},function(e,t,n){(t=Ri(t))!=null&&t!=null&&(ne(e,n,0),Tt(e.g,t))},ao),ge=X(function(e,t,n){return e.h===0&&(q(t,n,Ye(e.g)),!0)},function(e,t,n){(t=_t(t))!=null&&(t=parseInt(t,10),ne(e,n,0),Fn(e.g,t))},lo);class K2{constructor(t,n){this.h=t,this.g=n,this.l=k,this.m=g,this.defaultValue=void 0}}function Te(e,t){return new K2(e,t)}function Qe(e,t){return(n,s)=>{if(Pn.length){const i=Pn.pop();i.o(s),Js(i.g,n,s),n=i}else n=new class{constructor(i,o){if(eo.length){const a=eo.pop();Js(a,i,o),i=a}else i=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,Js(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ba=!1}}(i,o);this.g=i,this.l=this.g.g,this.h=this.m=-1,this.o(o)}o({fa:i=!1}={}){this.fa=i}}(n,s);try{const i=new e,o=i.u;lr(t)(o,n);var r=i}finally{n.g.clear(),n.m=-1,n.h=-1,Pn.length<100&&Pn.push(n)}return r}}function Bn(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const o=this.g;return this.g=[],o}}}};vo(this.u,t,ut(Rn,Nn,Dn,e)),xt(t,t.g.end());const n=new Uint8Array(t.h),s=t.l,r=s.length;let i=0;for(let o=0;o<r;o++){const a=s[o];n.set(a,i),i+=a.length}return t.l=[n],n}}var Po=class extends d{constructor(e){super(e)}},Fo=[0,Ze,X(function(e,t,n){return e.h===2&&(q(t,n,(e=no(e))===at()?void 0:e),!0)},function(e,t,n){if(t!=null){if(t instanceof d){const s=t.Ra;return void(s&&(t=s(t),t!=null&&On(e,n,Ks(t).buffer)))}if(Array.isArray(t))return}xo(e,t,n)},ho)];let fr,Oo=globalThis.trustedTypes;function Co(e){fr===void 0&&(fr=function(){let n=null;if(!Oo)return n;try{const s=r=>r;n=Oo.createPolicy("goog#html",{createHTML:s,createScript:s,createScriptURL:s})}catch{}return n}());var t=fr;return new class{constructor(n){this.g=n}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function $2(e,...t){if(t.length===0)return Co(e[0]);let n=e[0];for(let s=0;s<t.length;s++)n+=encodeURIComponent(t[s])+e[s+1];return Co(n)}var Io=[0,D,ge,F,-1,Un,ge,-1],X2=class extends d{constructor(e){super(e)}},Ro=[0,F,E,F,ge,-1,Pt(function(e,t,n){return(e.h===0||e.h===2)&&(t=At(t,0|t[p],n,!1,!1),e.h==2?Mn(e,I2,t):t.push(Ye(e.g)),!0)},function(e,t,n){if((t=Mt(_t,t))!=null&&t.length){n=tr(e,n);for(let s=0;s<t.length;s++)Fn(e.g,t[s]);nr(e,n)}},lo),E,-1,[0,F,-1],ge,F,-1],No=[0,E,-2],Do=class extends d{constructor(e){super(e)}},Uo=[0],Bo=[0,D,F,1,F,-3],se=class extends d{constructor(e){super(e,2)}},H={};H[336783863]=[0,E,F,-1,D,[0,[1,2,3,4,5,6,7,8],S,Uo,S,Ro,S,No,S,Bo,S,Io,S,[0,E,-2],S,[0,E,ge],S,[0,ge,E]],[0,E],F,[0,[1,3],[2,4],S,[0,Un],-1,S,[0,$],-1,W,[0,E,-1]],E];var Go=[0,dr,-1,Ot,-3,dr,Un,Ze,Ft,dr,-1,Ot,Ft,Ot,-2,Ze];function re(e,t){Gs(e,2,vt(t),"")}function L(e,t){xn(e,3,t)}function b(e,t){xn(e,4,t)}var Y=class extends d{constructor(e){super(e,500)}o(e){return g(this,0,7,e)}},Zt=[-1,{}],jo=[0,E,1,Zt],Vo=[0,E,$,Zt];function ie(e,t){Sn(e,1,Y,t)}function M(e,t){xn(e,10,t)}function A(e,t){xn(e,15,t)}var Q=class extends d{constructor(e){super(e,500)}o(e){return g(this,0,1001,e)}},Ho=[-500,W,[-500,Ze,-1,$,-3,[-2,H,F],W,Fo,Ft,-1,jo,Vo,W,[0,Ze,Ot],Ze,Go,Ft,$,987,$],4,W,[-500,E,-1,[-1,{}],998,E],W,[-500,E,$,-1,[-2,{},F],997,$,-1],Ft,W,[-500,E,$,Zt,998,$],$,Ft,jo,Vo,W,[0,Ze,-1,Zt],$,-2,Go,Ze,-1,Ot,[0,Ot,z2],978,Zt,W,Fo];Q.prototype.g=Bn(Ho);var q2=Qe(Q,Ho),Y2=class extends d{constructor(e){super(e)}},Wo=class extends d{constructor(e){super(e)}g(){return Ue(this,Y2,1)}},zo=[0,W,[0,D,V,E,-1]],Gn=Qe(Wo,zo),J2=class extends d{constructor(e){super(e)}},Z2=class extends d{constructor(e){super(e)}},pr=class extends d{constructor(e){super(e)}h(){return k(this,J2,2)}g(){return Ue(this,Z2,5)}},Ko=Qe(class extends d{constructor(e){super(e)}},[0,$,Un,ur,[0,ge,[0,D,-3],[0,V,-3],[0,D,-1,[0,W,[0,D,-2]]],W,[0,V,-1,E,V]],E,-1,Je,W,[0,D,V],$,Je]),$o=class extends d{constructor(e){super(e)}},Ct=Qe(class extends d{constructor(e){super(e)}},[0,W,[0,V,-4]]),Xo=class extends d{constructor(e){super(e)}},Qt=Qe(class extends d{constructor(e){super(e)}},[0,W,[0,V,-4]]),Q2=class extends d{constructor(e){super(e)}},e1=[0,D,-1,ur,ge],qo=class extends d{constructor(e){super(e)}};qo.prototype.g=Bn([0,V,-4,Je]);var t1=class extends d{constructor(e){super(e)}},n1=Qe(class extends d{constructor(e){super(e)}},[0,W,[0,1,D,E,zo],Je]),Yo=class extends d{constructor(e){super(e)}},s1=class extends d{constructor(e){super(e)}oa(){const e=zi(this);return e??at()}},r1=class extends d{constructor(e){super(e)}},Jo=[1,2],i1=Qe(class extends d{constructor(e){super(e)}},[0,W,[0,Jo,S,[0,ur],S,[0,Mo],D,E],Je]),mr=class extends d{constructor(e){super(e)}},Zo=[0,E,D,V,$,-1],Qo=class extends d{constructor(e){super(e)}},o1=[0,F,-1],ea=class extends d{constructor(e){super(e)}},jn=[1,2,3,4,5],Vn=class extends d{constructor(e){super(e)}g(){return zi(this)!=null}h(){return me(this,2)!=null}},O=class extends d{constructor(e){super(e)}g(){return Ii(kt(this,2))??!1}},ta=[0,Mo,E,[0,D,Je,-1],[0,H2,Je]],B=[0,ta,F,[0,jn,S,Bo,S,Ro,S,Io,S,Uo,S,No],ge],Hn=class extends d{constructor(e){super(e)}},gr=[0,B,V,-1,D],a1=Te(502141897,Hn);H[502141897]=gr;var c1=Qe(class extends d{constructor(e){super(e)}},[0,[0,ge,-1,V2,W2],e1]),na=class extends d{constructor(e){super(e)}},sa=class extends d{constructor(e){super(e)}},yr=[0,B,V,[0,B],F],ra=[0,B,gr,yr,V,[0,[0,ta]]],h1=Te(508968150,sa);H[508968150]=ra,H[508968149]=yr;var ia=class extends d{constructor(e){super(e)}},l1=Te(513916220,ia);H[513916220]=[0,B,ra,D];var It=class extends d{constructor(e){super(e)}h(){return k(this,mr,2)}g(){x(this,2)}},oa=[0,B,Zo];H[478825465]=oa;var u1=class extends d{constructor(e){super(e)}},aa=class extends d{constructor(e){super(e)}},wr=class extends d{constructor(e){super(e)}},_r=class extends d{constructor(e){super(e)}},ca=class extends d{constructor(e){super(e)}},ha=[0,B,[0,B],oa,-1],la=[0,B,V,D],vr=[0,B,V],ua=[0,B,la,vr,V],d1=Te(479097054,ca);H[479097054]=[0,B,ua,ha],H[463370452]=ha,H[464864288]=la;var f1=Te(462713202,_r);H[462713202]=ua,H[474472470]=vr;var p1=class extends d{constructor(e){super(e)}},da=class extends d{constructor(e){super(e)}},fa=class extends d{constructor(e){super(e)}},pa=class extends d{constructor(e){super(e)}},br=[0,B,V,-1,D],kr=[0,B,V,F];pa.prototype.g=Bn([0,B,vr,[0,B],gr,yr,br,kr]);var ma=class extends d{constructor(e){super(e)}},m1=Te(456383383,ma);H[456383383]=[0,B,Zo];var ga=class extends d{constructor(e){super(e)}},g1=Te(476348187,ga);H[476348187]=[0,B,o1];var ya=class extends d{constructor(e){super(e)}},wa=class extends d{constructor(e){super(e)}},_a=[0,ge,-1],y1=Te(458105876,class extends d{constructor(e){super(e)}g(){var e=this.u;const t=0|e[p],n=2&t;return e=function(s,r,i){var o=wa;const a=2&r;let c=!1;if(i==null){if(a)return ji();i=[]}else if(i.constructor===fe){if(!(2&i.L)||a)return i;i=i.X()}else Array.isArray(i)?c=!!(2&(0|i[p])):i=[];if(a){if(!i.length)return ji();c||(c=!0,gt(i))}else c&&(c=!1,i=Ki(i));return c||(64&(0|i[p])?i[p]&=-33:32&r&&dn(i,32)),R(s,r,2,o=new fe(i,o,S2,void 0)),o}(e,t,Ne(e,t,2)),!n&&wa&&(e.ra=!0),e}});H[458105876]=[0,_a,j2,[!0,Je,[0,E,-1,$]]];var Ar=class extends d{constructor(e){super(e)}},va=Te(458105758,Ar);H[458105758]=[0,B,E,_a];var ba=class extends d{constructor(e){super(e)}},w1=Te(443442058,ba);H[443442058]=[0,B,E,D,V,$,-1,F,V],H[514774813]=br;var ka=class extends d{constructor(e){super(e)}},_1=Te(516587230,ka);function Er(e,t){return t=t?t.clone():new mr,e.displayNamesLocale!==void 0?x(t,1,vt(e.displayNamesLocale)):e.displayNamesLocale===void 0&&x(t,1),e.maxResults!==void 0?Le(t,2,e.maxResults):"maxResults"in e&&x(t,2),e.scoreThreshold!==void 0?f(t,3,e.scoreThreshold):"scoreThreshold"in e&&x(t,3),e.categoryAllowlist!==void 0?Tn(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&x(t,4),e.categoryDenylist!==void 0?Tn(t,5,e.categoryDenylist):"categoryDenylist"in e&&x(t,5),t}function Sr(e,t=-1,n=""){return{categories:e.map(s=>({index:pe(s,1)??0??-1,score:U(s,2)??0,categoryName:me(s,3)??""??"",displayName:me(s,4)??""??""})),headIndex:t,headName:n}}function Aa(e){var t=ht(e,3,$e,ct()),n=ht(e,2,_t,ct()),s=ht(e,1,bt,ct()),r=ht(e,9,bt,ct());const i={categories:[],keypoints:[]};for(let o=0;o<t.length;o++)i.categories.push({score:t[o],index:n[o]??-1,categoryName:s[o]??"",displayName:r[o]??""});if((t=k(e,pr,4)?.h())&&(i.boundingBox={originX:pe(t,1)??0,originY:pe(t,2)??0,width:pe(t,3)??0,height:pe(t,4)??0,angle:0}),k(e,pr,4)?.g().length)for(const o of k(e,pr,4).g())i.keypoints.push({x:En(o,1)??0,y:En(o,2)??0,score:En(o,4)??0,label:me(o,3)??""});return i}function Wn(e){const t=[];for(const n of Ue(e,Xo,1))t.push({x:U(n,1)??0,y:U(n,2)??0,z:U(n,3)??0,visibility:U(n,4)??0});return t}function en(e){const t=[];for(const n of Ue(e,$o,1))t.push({x:U(n,1)??0,y:U(n,2)??0,z:U(n,3)??0,visibility:U(n,4)??0});return t}function Ea(e){return Array.from(e,t=>t>127?t-256:t)}function Sa(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,s=0,r=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i],s+=e[i]*e[i],r+=t[i]*t[i];if(s<=0||r<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(s*r)}let zn;H[516587230]=[0,B,br,kr,V],H[518928384]=kr;const v1=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 Ta(){if(zn===void 0)try{await WebAssembly.instantiate(v1),zn=!0}catch{zn=!1}return zn}async function tn(e,t=$2``){const n=await Ta()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var dt=class{};function xa(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function La(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((n,s)=>{t.addEventListener("load",()=>{n()},!1),t.addEventListener("error",r=>{s(r)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Ma(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function m(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 Pa(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);const[s,r]=Ma(t);return!e.l||s===e.i.canvas.width&&r===e.i.canvas.height||(e.i.canvas.width=s,e.i.canvas.height=r),[s,r]}function Fa(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const s=new Uint32Array(t.length);for(let r=0;r<t.length;r++)s[r]=e.i.stringToNewUTF8(t[r]);t=e.i._malloc(4*s.length),e.i.HEAPU32.set(s,t>>2),n(t);for(const r of s)e.i._free(r);e.i._free(t)}function Me(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function et(e,t,n){let s=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(r,i,o)=>{i?(n(s,o),s=[]):s.push(r)}}dt.forVisionTasks=function(e){return tn("vision",e)},dt.forTextTasks=function(e){return tn("text",e)},dt.forGenAiExperimentalTasks=function(e){return tn("genai_experimental",e)},dt.forGenAiTasks=function(e){return tn("genai",e)},dt.forAudioTasks=function(e){return tn("audio",e)},dt.isSimdSupported=function(){return Ta()};async function b1(e,t,n,s){return e=await(async(r,i,o,a,c)=>{if(i&&await La(i),!self.ModuleFactory||o&&(await La(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((i=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new r(c,a)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:r=>r.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&r.endsWith(".data")?n.assetBinaryPath.toString():r}),await e.o(s),e}function Tr(e,t){const n=k(e.baseOptions,Vn,1)||new Vn;typeof t=="string"?(x(n,2,vt(t)),x(n,1)):t instanceof Uint8Array&&(x(n,1,ks(t,!1)),x(n,2)),g(e.baseOptions,0,1,n)}function Oa(e){try{const t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(n=>n.message).join(", "))}finally{e.G=[]}}function l(e,t){e.B=Math.max(e.B,t)}function Kn(e,t){e.A=new Y,re(e.A,"PassThroughCalculator"),L(e.A,"free_memory"),b(e.A,"free_memory_unused_out"),M(t,"free_memory"),ie(t,e.A)}function Rt(e,t){L(e.A,t),b(e.A,t+"_unused_out")}function $n(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var Xn=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(k(this.baseOptions,Vn,1)?.g()||k(this.baseOptions,Vn,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(s,r){let i=k(s.baseOptions,ea,3);if(!i){var o=i=new ea,a=new Do;Xt(o,4,jn,a)}"delegate"in r&&(r.delegate==="GPU"?(r=i,o=new X2,Xt(r,2,jn,o)):(r=i,o=new Do,Xt(r,4,jn,o))),g(s.baseOptions,0,3,i)}(this,n),n.modelAssetPath)return fetch(n.modelAssetPath.toString()).then(s=>{if(s.ok)return s.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${s.status})`)}).then(s=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(s),!0,!1,!1),Tr(this,"/model.dat"),this.m(),this.I()});if(n.modelAssetBuffer instanceof Uint8Array)Tr(this,n.modelAssetBuffer);else if(n.modelAssetBuffer)return async function(s){const r=[];for(var i=0;;){const{done:o,value:a}=await s.read();if(o)break;r.push(a),i+=a.length}if(r.length===0)return new Uint8Array(0);if(r.length===1)return r[0];s=new Uint8Array(i),i=0;for(const o of r)s.set(o,i),i+=o.length;return s}(n.modelAssetBuffer).then(s=>{Tr(this,s),this.m(),this.I()})}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da(t=>{e=q2(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((n,s)=>{this.G.push(Error(s))}),this.g.La(),this.g.setGraph(e,t),this.A=void 0,Oa(this)}finishProcessing(){this.g.finishProcessing(),Oa(this)}close(){this.A=void 0,this.g.closeGraph()}};function Ve(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Xn.prototype.close=Xn.prototype.close,function(e,t){e=e.split(".");var n,s=it;for((e[0]in s)||s.execScript===void 0||s.execScript("var "+e[0]);e.length&&(n=e.shift());)e.length||t===void 0?s=s[n]&&s[n]!==Object.prototype[n]?s[n]:s[n]={}:s[n]=t}("TaskRunner",Xn);class k1{constructor(t,n,s,r){this.g=t,this.h=n,this.m=s,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 Ca(e,t,n){const s=e.g;if(n=Ve(s.createShader(n),"Failed to create WebGL shader"),s.shaderSource(n,t),s.compileShader(n),!s.getShaderParameter(n,s.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${s.getShaderInfoLog(n)}`);return s.attachShader(e.h,n),n}function Ia(e,t){const n=e.g,s=Ve(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(s);const r=Ve(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,r),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);const i=Ve(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.I),n.vertexAttribPointer(e.I,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 k1(n,s,r,i)}function xr(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Lr(e,t,n,s){return xr(e,t),e.h||(e.m(),e.C()),n?(e.s||(e.s=Ia(e,!0)),n=e.s):(e.v||(e.v=Ia(e,!1)),n=e.v),t.useProgram(e.h),n.bind(),e.l(),e=s(),n.g.bindVertexArray(null),e}function qn(e,t,n){return xr(e,t),e=Ve(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 Yn(e,t,n){xr(e,t),e.A||(e.A=Ve(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function Mr(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Pr=class{G(){return`
|
|
57
|
+
precision mediump float;
|
|
58
|
+
varying vec2 vTex;
|
|
59
|
+
uniform sampler2D inputTexture;
|
|
60
|
+
void main() {
|
|
61
|
+
gl_FragColor = texture2D(inputTexture, vTex);
|
|
62
|
+
}
|
|
63
|
+
`}m(){const e=this.g;if(this.h=Ve(e.createProgram(),"Failed to create WebGL program"),this.aa=Ca(this,`
|
|
64
|
+
attribute vec2 aVertex;
|
|
65
|
+
attribute vec2 aTex;
|
|
66
|
+
varying vec2 vTex;
|
|
67
|
+
void main(void) {
|
|
68
|
+
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
69
|
+
vTex = aTex;
|
|
70
|
+
}`,e.VERTEX_SHADER),this.Z=Ca(this,this.G(),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.I=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.aa),e.deleteShader(this.Z)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function He(e,t){switch(t){case 0:return e.g.find(n=>n instanceof Uint8Array);case 1:return e.g.find(n=>n instanceof Float32Array);case 2:return e.g.find(n=>typeof WebGLTexture<"u"&&n instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Fr(e){var t=He(e,1);if(!t){if(t=He(e,0))t=new Float32Array(t).map(s=>s/255);else{t=new Float32Array(e.width*e.height);const s=Nt(e);var n=Or(e);if(Yn(n,s,Ra(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),s.readPixels(0,0,e.width,e.height,s.RGBA,s.FLOAT,n);for(let r=0,i=0;r<t.length;++r,i+=4)t[r]=n[i]}else s.readPixels(0,0,e.width,e.height,s.RED,s.FLOAT,t)}e.g.push(t)}return t}function Ra(e){let t=He(e,2);if(!t){const n=Nt(e);t=Da(e);const s=Fr(e),r=Na(e);n.texImage2D(n.TEXTURE_2D,0,r,e.width,e.height,0,n.RED,n.FLOAT,s),Cr(e)}return t}function Nt(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Ve(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Na(e){if(e=Nt(e),!Jn)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Jn=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Jn=e.R16F}return Jn}function Or(e){return e.l||(e.l=new Pr),e.l}function Da(e){const t=Nt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=He(e,2);return n||(n=qn(Or(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function Cr(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Jn,z=class{constructor(e,t,n,s,r,i,o){this.g=e,this.m=t,this.j=n,this.canvas=s,this.l=r,this.width=i,this.height=o,this.j&&--Ua===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!He(this,0)}ja(){return!!He(this,1)}P(){return!!He(this,2)}ia(){return(t=He(e=this,0))||(t=Fr(e),t=new Uint8Array(t.map(n=>255*n)),e.g.push(t)),t;var e,t}ha(){return Fr(this)}M(){return Ra(this)}clone(){const e=[];for(const 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}`);{const s=Nt(this),r=Or(this);s.activeTexture(s.TEXTURE1),n=qn(r,s,this.m?s.LINEAR:s.NEAREST),s.bindTexture(s.TEXTURE_2D,n);const i=Na(this);s.texImage2D(s.TEXTURE_2D,0,i,this.width,this.height,0,s.RED,s.FLOAT,null),s.bindTexture(s.TEXTURE_2D,null),Yn(r,s,n),Lr(r,s,!1,()=>{Da(this),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4),Cr(this)}),Mr(r),Cr(this)}}e.push(n)}return new z(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Nt(this).deleteTexture(He(this,2)),Ua=-1}};z.prototype.close=z.prototype.close,z.prototype.clone=z.prototype.clone,z.prototype.getAsWebGLTexture=z.prototype.M,z.prototype.getAsFloat32Array=z.prototype.ha,z.prototype.getAsUint8Array=z.prototype.ia,z.prototype.hasWebGLTexture=z.prototype.P,z.prototype.hasFloat32Array=z.prototype.ja,z.prototype.hasUint8Array=z.prototype.Fa;var Ua=250;function Pe(e,t){switch(t){case 0:return e.g.find(n=>n instanceof ImageData);case 1:return e.g.find(n=>typeof ImageBitmap<"u"&&n instanceof ImageBitmap);case 2:return e.g.find(n=>typeof WebGLTexture<"u"&&n instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Ba(e){var t=Pe(e,0);if(!t){t=Dt(e);const n=Qn(e),s=new Uint8Array(e.width*e.height*4);Yn(n,t,Zn(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,s),Mr(n),t=new ImageData(new Uint8ClampedArray(s.buffer),e.width,e.height),e.g.push(t)}return t}function Zn(e){let t=Pe(e,2);if(!t){const n=Dt(e);t=es(e);const s=Pe(e,1)||Ba(e);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,s),nn(e)}return t}function Dt(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Ve(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Qn(e){return e.l||(e.l=new Pr),e.l}function es(e){const t=Dt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=Pe(e,2);return n||(n=qn(Qn(e),t),e.g.push(n),e.m=!0),t.bindTexture(t.TEXTURE_2D,n),n}function nn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Ga(e){const t=Dt(e);return Lr(Qn(e),t,!0,()=>function(n,s){const r=n.canvas;if(r.width===n.width&&r.height===n.height)return s();const i=r.width,o=r.height;return r.width=n.width,r.height=n.height,n=s(),r.width=i,r.height=o,n}(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()}))}var K=class{constructor(e,t,n,s,r,i,o){this.g=e,this.j=t,this.m=n,this.canvas=s,this.l=r,this.width=i,this.height=o,(this.j||this.m)&&--ja===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Pe(this,0)}ka(){return!!Pe(this,1)}P(){return!!Pe(this,2)}Ca(){return Ba(this)}Ba(){var e=Pe(this,1);return e||(Zn(this),es(this),e=Ga(this),nn(this),this.g.push(e),this.j=!0),e}M(){return Zn(this)}clone(){const e=[];for(const t of this.g){let n;if(t instanceof ImageData)n=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const s=Dt(this),r=Qn(this);s.activeTexture(s.TEXTURE1),n=qn(r,s),s.bindTexture(s.TEXTURE_2D,n),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,this.width,this.height,0,s.RGBA,s.UNSIGNED_BYTE,null),s.bindTexture(s.TEXTURE_2D,null),Yn(r,s,n),Lr(r,s,!1,()=>{es(this),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4),nn(this)}),Mr(r),nn(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Zn(this),es(this),n=Ga(this),nn(this)}e.push(n)}return new K(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Pe(this,1).close(),this.m&&Dt(this).deleteTexture(Pe(this,2)),ja=-1}};K.prototype.close=K.prototype.close,K.prototype.clone=K.prototype.clone,K.prototype.getAsWebGLTexture=K.prototype.M,K.prototype.getAsImageBitmap=K.prototype.Ba,K.prototype.getAsImageData=K.prototype.Ca,K.prototype.hasWebGLTexture=K.prototype.P,K.prototype.hasImageBitmap=K.prototype.ka,K.prototype.hasImageData=K.prototype.Ea;var ja=250;function xe(...e){return e.map(([t,n])=>({start:t,end:n}))}const A1=function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}}((Va=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?this.i.canvas=t:xa()?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"))}async initializeGraph(e){const 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){const n=e.length,s=this.i._malloc(n);this.i.HEAPU8.set(e,s),t?this.i._changeBinaryGraph(n,s):this.i._changeTextGraph(n,s),this.i._free(s)}configureAudio(e,t,n,s,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),m(this,s||"input_audio",i=>{m(this,r=r||"audio_header",o=>{this.i._configureAudio(i,o,e,t??0,n)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Me(this,"__graph_config__",t=>{e(t)}),m(this,"__graph_config__",t=>{this.i._getGraphConfig(t,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,s,r){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),m(this,s,o=>{this.i._addAudioToInputStream(this.g,t,n,o,r)})}addGpuBufferToStream(e,t,n){m(this,t,s=>{const[r,i]=Pa(this,e,s);this.i._addBoundTextureToStream(s,r,i,n)})}addBoolToStream(e,t,n){m(this,t,s=>{this.i._addBoolToInputStream(e,s,n)})}addDoubleToStream(e,t,n){m(this,t,s=>{this.i._addDoubleToInputStream(e,s,n)})}addFloatToStream(e,t,n){m(this,t,s=>{this.i._addFloatToInputStream(e,s,n)})}addIntToStream(e,t,n){m(this,t,s=>{this.i._addIntToInputStream(e,s,n)})}addUintToStream(e,t,n){m(this,t,s=>{this.i._addUintToInputStream(e,s,n)})}addStringToStream(e,t,n){m(this,t,s=>{m(this,e,r=>{this.i._addStringToInputStream(r,s,n)})})}addStringRecordToStream(e,t,n){m(this,t,s=>{Fa(this,Object.keys(e),r=>{Fa(this,Object.values(e),i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(e).length,s,n)})})})}addProtoToStream(e,t,n,s){m(this,n,r=>{m(this,t,i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,r,s),this.i._free(o)})})}addEmptyPacketToStream(e,t){m(this,e,n=>{this.i._addEmptyPacketToInputStream(n,t)})}addBoolVectorToStream(e,t,n){m(this,t,s=>{const r=this.i._allocateBoolVector(e.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(r,i);this.i._addBoolVectorToInputStream(r,s,n)})}addDoubleVectorToStream(e,t,n){m(this,t,s=>{const r=this.i._allocateDoubleVector(e.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(r,i);this.i._addDoubleVectorToInputStream(r,s,n)})}addFloatVectorToStream(e,t,n){m(this,t,s=>{const r=this.i._allocateFloatVector(e.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(r,i);this.i._addFloatVectorToInputStream(r,s,n)})}addIntVectorToStream(e,t,n){m(this,t,s=>{const r=this.i._allocateIntVector(e.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(r,i);this.i._addIntVectorToInputStream(r,s,n)})}addUintVectorToStream(e,t,n){m(this,t,s=>{const r=this.i._allocateUintVector(e.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(r,i);this.i._addUintVectorToInputStream(r,s,n)})}addStringVectorToStream(e,t,n){m(this,t,s=>{const r=this.i._allocateStringVector(e.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const i of e)m(this,i,o=>{this.i._addStringVectorEntry(r,o)});this.i._addStringVectorToInputStream(r,s,n)})}addBoolToInputSidePacket(e,t){m(this,t,n=>{this.i._addBoolToInputSidePacket(e,n)})}addDoubleToInputSidePacket(e,t){m(this,t,n=>{this.i._addDoubleToInputSidePacket(e,n)})}addFloatToInputSidePacket(e,t){m(this,t,n=>{this.i._addFloatToInputSidePacket(e,n)})}addIntToInputSidePacket(e,t){m(this,t,n=>{this.i._addIntToInputSidePacket(e,n)})}addUintToInputSidePacket(e,t){m(this,t,n=>{this.i._addUintToInputSidePacket(e,n)})}addStringToInputSidePacket(e,t){m(this,t,n=>{m(this,e,s=>{this.i._addStringToInputSidePacket(s,n)})})}addProtoToInputSidePacket(e,t,n){m(this,n,s=>{m(this,t,r=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,r,s),this.i._free(i)})})}addBoolVectorToInputSidePacket(e,t){m(this,t,n=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const r of e)this.i._addBoolVectorEntry(s,r);this.i._addBoolVectorToInputSidePacket(s,n)})}addDoubleVectorToInputSidePacket(e,t){m(this,t,n=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const r of e)this.i._addDoubleVectorEntry(s,r);this.i._addDoubleVectorToInputSidePacket(s,n)})}addFloatVectorToInputSidePacket(e,t){m(this,t,n=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const r of e)this.i._addFloatVectorEntry(s,r);this.i._addFloatVectorToInputSidePacket(s,n)})}addIntVectorToInputSidePacket(e,t){m(this,t,n=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const r of e)this.i._addIntVectorEntry(s,r);this.i._addIntVectorToInputSidePacket(s,n)})}addUintVectorToInputSidePacket(e,t){m(this,t,n=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const r of e)this.i._addUintVectorEntry(s,r);this.i._addUintVectorToInputSidePacket(s,n)})}addStringVectorToInputSidePacket(e,t){m(this,t,n=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const r of e)m(this,r,i=>{this.i._addStringVectorEntry(s,i)});this.i._addStringVectorToInputSidePacket(s,n)})}attachBoolListener(e,t){Me(this,e,t),m(this,e,n=>{this.i._attachBoolListener(n)})}attachBoolVectorListener(e,t){et(this,e,t),m(this,e,n=>{this.i._attachBoolVectorListener(n)})}attachIntListener(e,t){Me(this,e,t),m(this,e,n=>{this.i._attachIntListener(n)})}attachIntVectorListener(e,t){et(this,e,t),m(this,e,n=>{this.i._attachIntVectorListener(n)})}attachUintListener(e,t){Me(this,e,t),m(this,e,n=>{this.i._attachUintListener(n)})}attachUintVectorListener(e,t){et(this,e,t),m(this,e,n=>{this.i._attachUintVectorListener(n)})}attachDoubleListener(e,t){Me(this,e,t),m(this,e,n=>{this.i._attachDoubleListener(n)})}attachDoubleVectorListener(e,t){et(this,e,t),m(this,e,n=>{this.i._attachDoubleVectorListener(n)})}attachFloatListener(e,t){Me(this,e,t),m(this,e,n=>{this.i._attachFloatListener(n)})}attachFloatVectorListener(e,t){et(this,e,t),m(this,e,n=>{this.i._attachFloatVectorListener(n)})}attachStringListener(e,t){Me(this,e,t),m(this,e,n=>{this.i._attachStringListener(n)})}attachStringVectorListener(e,t){et(this,e,t),m(this,e,n=>{this.i._attachStringVectorListener(n)})}attachProtoListener(e,t,n){Me(this,e,t),m(this,e,s=>{this.i._attachProtoListener(s,n||!1)})}attachProtoVectorListener(e,t,n){et(this,e,t),m(this,e,s=>{this.i._attachProtoVectorListener(s,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?'),Me(this,e,(s,r)=>{s=new Float32Array(s.buffer,s.byteOffset,s.length/4),t(s,r)}),m(this,e,s=>{this.i._attachAudioListener(s,n||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Va{get ea(){return this.i}qa(e,t,n){m(this,t,s=>{const[r,i]=Pa(this,e,s);this.ea._addBoundTextureAsImageToStream(s,r,i,n)})}U(e,t){Me(this,e,t),m(this,e,n=>{this.ea._attachImageListener(n)})}ca(e,t){et(this,e,t),m(this,e,n=>{this.ea._attachImageVectorListener(n)})}}));var Va,ye=class extends A1{};async function v(e,t,n){return async function(s,r,i,o){return b1(s,r,i,o)}(e,n.canvas??(xa()?void 0:document.createElement("canvas")),t,n)}function Ha(e,t,n,s){if(e.T){const i=new qo;if(n?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var r=n.regionOfInterest;if(r.left>=r.right||r.top>=r.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(r.left<0||r.top<0||r.right>1||r.bottom>1)throw Error("Expected RectF values to be in [0,1].");f(i,1,(r.left+r.right)/2),f(i,2,(r.top+r.bottom)/2),f(i,4,r.right-r.left),f(i,3,r.bottom-r.top)}else f(i,1,.5),f(i,2,.5),f(i,4,1),f(i,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(f(i,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){const[o,a]=Ma(t);n=U(i,3)*a/o,r=U(i,4)*o/a,f(i,4,n),f(i,3,r)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.T,s)}e.g.qa(t,e.aa,s??performance.now()),e.finishProcessing()}function we(e,t,n){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ha(e,t,n,e.B+1)}function Fe(e,t,n,s){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ha(e,t,n,s)}function Ut(e,t,n,s){var r=t.data;const i=t.width,o=i*(t=t.height);if((r instanceof Uint8Array||r instanceof Float32Array)&&r.length!==o)throw Error("Unsupported channel count: "+r.length/o);return e=new z([r],n,!1,e.g.i.canvas,e.O,i,t),s?e.clone():e}var ee=class extends Xn{constructor(e,t,n,s){super(e),this.g=e,this.aa=t,this.T=n,this.pa=s,this.O=new Pr}l(e,t=!0){if("runningMode"in e&&qt(this.baseOptions,2,!!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.O.close(),super.close()}};ee.prototype.close=ee.prototype.close;var _e=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},g(e=this.h=new Hn,0,1,t=new O),f(this.h,2,.5),f(this.h,3,.3)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&f(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&f(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},we(this,e,t),this.j}F(e,t,n){return this.j={detections:[]},Fe(this,e,n,t),this.j}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect_in"),A(e,"detections");const t=new se;Ee(t,a1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect_in"),b(n,"DETECTIONS:detections"),n.o(t),ie(e,n),this.g.attachProtoVectorListener("detections",(s,r)=>{for(const i of s)s=Ko(i),this.j.detections.push(Aa(s));l(this,r)}),this.g.attachEmptyPacketListener("detections",s=>{l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.F,_e.prototype.detect=_e.prototype.D,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=async function(e,t){return v(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return v(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return v(_e,e,t)};var Ir=xe([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]),Rr=xe([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]),Nr=xe([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Wa=xe([474,475],[475,476],[476,477],[477,474]),Dr=xe([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]),Ur=xe([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),za=xe([469,470],[470,471],[471,472],[472,469]),Br=xe([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]),Ka=[...Ir,...Rr,...Nr,...Dr,...Ur,...Br],$a=xe([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 Xa(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var C=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,g(e=this.h=new sa,0,1,t=new O),this.v=new na,g(this.h,0,3,this.v),this.s=new Hn,g(this.h,0,2,this.s),Le(this.s,4,1),f(this.s,2,.5),f(this.v,2,.5),f(this.h,4,.5)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return"numFaces"in e&&Le(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&f(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&f(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&f(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Xa(this),we(this,e,t),this.j}F(e,t,n){return Xa(this),Fe(this,e,n,t),this.j}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect"),A(e,"face_landmarks");const t=new se;Ee(t,h1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),b(n,"NORM_LANDMARKS:face_landmarks"),n.o(t),ie(e,n),this.g.attachProtoVectorListener("face_landmarks",(s,r)=>{for(const i of s)s=Qt(i),this.j.faceLandmarks.push(Wn(s));l(this,r)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{l(this,s)}),this.outputFaceBlendshapes&&(A(e,"blendshapes"),b(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(s,r)=>{if(this.outputFaceBlendshapes)for(const i of s)s=Gn(i),this.j.faceBlendshapes.push(Sr(s.g()??[]));l(this,r)}),this.g.attachEmptyPacketListener("blendshapes",s=>{l(this,s)})),this.outputFacialTransformationMatrixes&&(A(e,"face_geometry"),b(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(s,r)=>{if(this.outputFacialTransformationMatrixes)for(const i of s)(s=k(c1(i),Q2,2))&&this.j.facialTransformationMatrixes.push({rows:pe(s,1)??0??0,columns:pe(s,2)??0??0,data:ht(s,3,$e,ct()).slice()??[]});l(this,r)}),this.g.attachEmptyPacketListener("face_geometry",s=>{l(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};C.prototype.detectForVideo=C.prototype.F,C.prototype.detect=C.prototype.D,C.prototype.setOptions=C.prototype.o,C.createFromModelPath=function(e,t){return v(C,e,{baseOptions:{modelAssetPath:t}})},C.createFromModelBuffer=function(e,t){return v(C,e,{baseOptions:{modelAssetBuffer:t}})},C.createFromOptions=function(e,t){return v(C,e,t)},C.FACE_LANDMARKS_LIPS=Ir,C.FACE_LANDMARKS_LEFT_EYE=Rr,C.FACE_LANDMARKS_LEFT_EYEBROW=Nr,C.FACE_LANDMARKS_LEFT_IRIS=Wa,C.FACE_LANDMARKS_RIGHT_EYE=Dr,C.FACE_LANDMARKS_RIGHT_EYEBROW=Ur,C.FACE_LANDMARKS_RIGHT_IRIS=za,C.FACE_LANDMARKS_FACE_OVAL=Br,C.FACE_LANDMARKS_CONTOURS=Ka,C.FACE_LANDMARKS_TESSELATION=$a;var Oe=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!0),g(e=this.j=new ia,0,1,t=new O)}get baseOptions(){return k(this.j,O,1)}set baseOptions(e){g(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,n){const s=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:n,we(this,e,s??{}),!this.h)return this.s}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect"),A(e,"stylized_image");const t=new se;Ee(t,l1,this.j);const n=new Y;re(n,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),b(n,"STYLIZED_IMAGE:stylized_image"),n.o(t),ie(e,n),this.g.U("stylized_image",(s,r)=>{var i=!this.h,o=s.data,a=s.width;const c=a*(s=s.height);if(o instanceof Uint8Array)if(o.length===3*c){const h=new Uint8ClampedArray(4*c);for(let u=0;u<c;++u)h[4*u]=o[3*u],h[4*u+1]=o[3*u+1],h[4*u+2]=o[3*u+2],h[4*u+3]=255;o=new ImageData(h,a,s)}else{if(o.length!==4*c)throw Error("Unsupported channel count: "+o.length/c);o=new ImageData(new Uint8ClampedArray(o.buffer,o.byteOffset,o.length),a,s)}else if(!(o instanceof WebGLTexture))throw Error(`Unsupported format: ${o.constructor.name}`);a=new K([o],!1,!1,this.g.i.canvas,this.O,a,s),this.s=i=i?a.clone():a,this.h&&this.h(i),l(this,r)}),this.g.attachEmptyPacketListener("stylized_image",s=>{this.s=null,this.h&&this.h(null),l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Oe.prototype.stylize=Oe.prototype.Oa,Oe.prototype.setOptions=Oe.prototype.o,Oe.createFromModelPath=function(e,t){return v(Oe,e,{baseOptions:{modelAssetPath:t}})},Oe.createFromModelBuffer=function(e,t){return v(Oe,e,{baseOptions:{modelAssetBuffer:t}})},Oe.createFromOptions=function(e,t){return v(Oe,e,t)};var Gr=xe([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 qa(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Ya(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 Ja(e,t=!0){const n=[];for(const r of e){var s=Gn(r);e=[];for(const i of s.g())s=t&&pe(i,1)!=null?pe(i,1)??0:-1,e.push({score:U(i,2)??0,index:s,categoryName:me(i,3)??""??"",displayName:me(i,4)??""??""});n.push(e)}return n}var oe=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],g(e=this.j=new ca,0,1,t=new O),this.s=new _r,g(this.j,0,2,this.s),this.C=new wr,g(this.s,0,3,this.C),this.v=new aa,g(this.s,0,2,this.v),this.h=new u1,g(this.j,0,3,this.h),f(this.v,2,.5),f(this.s,4,.5),f(this.C,2,.5)}get baseOptions(){return k(this.j,O,1)}set baseOptions(e){g(this.j,0,1,e)}o(e){if(Le(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&f(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&f(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&f(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new It,n=t,s=Er(e.cannedGesturesClassifierOptions,k(this.h,It,3)?.h());g(n,0,2,s),g(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&k(this.h,It,3)?.g();return e.customGesturesClassifierOptions?(g(n=t=new It,0,2,s=Er(e.customGesturesClassifierOptions,k(this.h,It,4)?.h())),g(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&k(this.h,It,4)?.g(),this.l(e)}Ja(e,t){return qa(this),we(this,e,t),Ya(this)}Ka(e,t,n){return qa(this),Fe(this,e,n,t),Ya(this)}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect"),A(e,"hand_gestures"),A(e,"hand_landmarks"),A(e,"world_hand_landmarks"),A(e,"handedness");const t=new se;Ee(t,d1,this.j);const n=new Y;re(n,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),b(n,"HAND_GESTURES:hand_gestures"),b(n,"LANDMARKS:hand_landmarks"),b(n,"WORLD_LANDMARKS:world_hand_landmarks"),b(n,"HANDEDNESS:handedness"),n.o(t),ie(e,n),this.g.attachProtoVectorListener("hand_landmarks",(s,r)=>{for(const i of s){s=Qt(i);const o=[];for(const a of Ue(s,Xo,1))o.push({x:U(a,1)??0,y:U(a,2)??0,z:U(a,3)??0,visibility:U(a,4)??0});this.landmarks.push(o)}l(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("world_hand_landmarks",(s,r)=>{for(const i of s){s=Ct(i);const o=[];for(const a of Ue(s,$o,1))o.push({x:U(a,1)??0,y:U(a,2)??0,z:U(a,3)??0,visibility:U(a,4)??0});this.worldLandmarks.push(o)}l(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("hand_gestures",(s,r)=>{this.gestures.push(...Ja(s,!1)),l(this,r)}),this.g.attachEmptyPacketListener("hand_gestures",s=>{l(this,s)}),this.g.attachProtoVectorListener("handedness",(s,r)=>{this.handedness.push(...Ja(s)),l(this,r)}),this.g.attachEmptyPacketListener("handedness",s=>{l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Za(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}oe.prototype.recognizeForVideo=oe.prototype.Ka,oe.prototype.recognize=oe.prototype.Ja,oe.prototype.setOptions=oe.prototype.o,oe.createFromModelPath=function(e,t){return v(oe,e,{baseOptions:{modelAssetPath:t}})},oe.createFromModelBuffer=function(e,t){return v(oe,e,{baseOptions:{modelAssetBuffer:t}})},oe.createFromOptions=function(e,t){return v(oe,e,t)},oe.HAND_CONNECTIONS=Gr;var ae=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],g(e=this.h=new _r,0,1,t=new O),this.s=new wr,g(this.h,0,3,this.s),this.j=new aa,g(this.h,0,2,this.j),Le(this.j,3,1),f(this.j,2,.5),f(this.s,2,.5),f(this.h,4,.5)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return"numHands"in e&&Le(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&f(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&f(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&f(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],we(this,e,t),Za(this)}F(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Fe(this,e,n,t),Za(this)}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect"),A(e,"hand_landmarks"),A(e,"world_hand_landmarks"),A(e,"handedness");const t=new se;Ee(t,f1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),b(n,"LANDMARKS:hand_landmarks"),b(n,"WORLD_LANDMARKS:world_hand_landmarks"),b(n,"HANDEDNESS:handedness"),n.o(t),ie(e,n),this.g.attachProtoVectorListener("hand_landmarks",(s,r)=>{for(const i of s)s=Qt(i),this.landmarks.push(Wn(s));l(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("world_hand_landmarks",(s,r)=>{for(const i of s)s=Ct(i),this.worldLandmarks.push(en(s));l(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoVectorListener("handedness",(s,r)=>{var i=this.handedness,o=i.push;const a=[];for(const c of s){s=Gn(c);const h=[];for(const u of s.g())h.push({score:U(u,2)??0,index:pe(u,1)??0??-1,categoryName:me(u,3)??""??"",displayName:me(u,4)??""??""});a.push(h)}o.call(i,...a),l(this,r)}),this.g.attachEmptyPacketListener("handedness",s=>{l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ae.prototype.detectForVideo=ae.prototype.F,ae.prototype.detect=ae.prototype.D,ae.prototype.setOptions=ae.prototype.o,ae.createFromModelPath=function(e,t){return v(ae,e,{baseOptions:{modelAssetPath:t}})},ae.createFromModelBuffer=function(e,t){return v(ae,e,{baseOptions:{modelAssetBuffer:t}})},ae.createFromOptions=function(e,t){return v(ae,e,t)},ae.HAND_CONNECTIONS=Gr;var Qa=xe([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 ec(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function tc(e){try{if(!e.C)return e.h;e.C(e.h)}finally{$n(e)}}function ts(e,t){e=Qt(e),t.push(Wn(e))}var I=class extends ee{constructor(e,t){super(new ye(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,g(e=this.j=new pa,0,1,t=new O),this.J=new wr,g(this.j,0,2,this.J),this.Z=new p1,g(this.j,0,3,this.Z),this.s=new Hn,g(this.j,0,4,this.s),this.H=new na,g(this.j,0,5,this.H),this.v=new da,g(this.j,0,6,this.v),this.K=new fa,g(this.j,0,7,this.K),f(this.s,2,.5),f(this.s,3,.3),f(this.H,2,.5),f(this.v,2,.5),f(this.v,3,.3),f(this.K,2,.5),f(this.J,2,.5)}get baseOptions(){return k(this.j,O,1)}set baseOptions(e){g(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&f(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&f(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&f(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&f(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&f(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&f(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&f(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,n){const s=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:n,ec(this),we(this,e,s),tc(this)}F(e,t,n,s){const r=typeof n!="function"?n:{};return this.C=typeof n=="function"?n:s,ec(this),Fe(this,e,r,t),tc(this)}m(){var e=new Q;M(e,"input_frames_image"),A(e,"pose_landmarks"),A(e,"pose_world_landmarks"),A(e,"face_landmarks"),A(e,"left_hand_landmarks"),A(e,"left_hand_world_landmarks"),A(e,"right_hand_landmarks"),A(e,"right_hand_world_landmarks");const t=new se,n=new Po;Gs(n,1,vt("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(r,i){if(i!=null)if(Array.isArray(i))x(r,2,Hi(i));else{if(!(typeof i=="string"||i instanceof Re||Ht(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Gs(r,2,ks(i,!1),at())}}(n,this.j.g());const s=new Y;re(s,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Sn(s,8,Po,n),L(s,"IMAGE:input_frames_image"),b(s,"POSE_LANDMARKS:pose_landmarks"),b(s,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),b(s,"FACE_LANDMARKS:face_landmarks"),b(s,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),b(s,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),b(s,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),b(s,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),s.o(t),ie(e,s),Kn(this,e),this.g.attachProtoListener("pose_landmarks",(r,i)=>{ts(r,this.h.poseLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("pose_world_landmarks",(r,i)=>{var o=this.h.poseWorldLandmarks;r=Ct(r),o.push(en(r)),l(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",r=>{l(this,r)}),this.outputPoseSegmentationMasks&&(b(s,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Rt(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",(r,i)=>{this.h.poseSegmentationMasks=[Ut(this,r,!0,!this.C)],l(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",r=>{this.h.poseSegmentationMasks=[],l(this,r)})),this.g.attachProtoListener("face_landmarks",(r,i)=>{ts(r,this.h.faceLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",r=>{l(this,r)}),this.outputFaceBlendshapes&&(A(e,"extra_blendshapes"),b(s,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(r,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(r=Gn(r),o.push(Sr(r.g()??[]))),l(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",r=>{l(this,r)})),this.g.attachProtoListener("left_hand_landmarks",(r,i)=>{ts(r,this.h.leftHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("left_hand_world_landmarks",(r,i)=>{var o=this.h.leftHandWorldLandmarks;r=Ct(r),o.push(en(r)),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("right_hand_landmarks",(r,i)=>{ts(r,this.h.rightHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoListener("right_hand_world_landmarks",(r,i)=>{var o=this.h.rightHandWorldLandmarks;r=Ct(r),o.push(en(r)),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",r=>{l(this,r)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};I.prototype.detectForVideo=I.prototype.F,I.prototype.detect=I.prototype.D,I.prototype.setOptions=I.prototype.o,I.createFromModelPath=function(e,t){return v(I,e,{baseOptions:{modelAssetPath:t}})},I.createFromModelBuffer=function(e,t){return v(I,e,{baseOptions:{modelAssetBuffer:t}})},I.createFromOptions=function(e,t){return v(I,e,t)},I.HAND_CONNECTIONS=Gr,I.POSE_CONNECTIONS=Qa,I.FACE_LANDMARKS_LIPS=Ir,I.FACE_LANDMARKS_LEFT_EYE=Rr,I.FACE_LANDMARKS_LEFT_EYEBROW=Nr,I.FACE_LANDMARKS_LEFT_IRIS=Wa,I.FACE_LANDMARKS_RIGHT_EYE=Dr,I.FACE_LANDMARKS_RIGHT_EYEBROW=Ur,I.FACE_LANDMARKS_RIGHT_IRIS=za,I.FACE_LANDMARKS_FACE_OVAL=Br,I.FACE_LANDMARKS_CONTOURS=Ka,I.FACE_LANDMARKS_TESSELATION=$a;var ve=class extends ee{constructor(e,t){super(new ye(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},g(e=this.h=new ma,0,1,t=new O)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return g(this.h,0,2,Er(e,k(this.h,mr,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},we(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},Fe(this,e,n,t),this.j}m(){var e=new Q;M(e,"input_image"),M(e,"norm_rect"),A(e,"classifications");const t=new se;Ee(t,m1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),L(n,"IMAGE:input_image"),L(n,"NORM_RECT:norm_rect"),b(n,"CLASSIFICATIONS:classifications"),n.o(t),ie(e,n),this.g.attachProtoListener("classifications",(s,r)=>{this.j=function(i){const o={classifications:Ue(i,t1,1).map(a=>Sr(k(a,Wo,4)?.g()??[],pe(a,2)??0,me(a,3)??""))};return bn(kt(i,2))!=null&&(o.timestampMs=bn(kt(i,2))??0),o}(n1(s)),l(this,r)}),this.g.attachEmptyPacketListener("classifications",s=>{l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ve.prototype.classifyForVideo=ve.prototype.ta,ve.prototype.classify=ve.prototype.sa,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=function(e,t){return v(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return v(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return v(ve,e,t)};var ce=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!0),this.h=new ga,this.embeddings={embeddings:[]},g(e=this.h,0,1,t=new O)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){var t=this.h,n=k(this.h,Qo,2);return n=n?n.clone():new Qo,e.l2Normalize!==void 0?qt(n,1,e.l2Normalize):"l2Normalize"in e&&x(n,1),e.quantize!==void 0?qt(n,2,e.quantize):"quantize"in e&&x(n,2),g(t,0,2,n),this.l(e)}za(e,t){return we(this,e,t),this.embeddings}Aa(e,t,n){return Fe(this,e,n,t),this.embeddings}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect"),A(e,"embeddings_out");const t=new se;Ee(t,g1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),b(n,"EMBEDDINGS:embeddings_out"),n.o(t),ie(e,n),this.g.attachProtoListener("embeddings_out",(s,r)=>{s=i1(s),this.embeddings=function(i){return{embeddings:Ue(i,r1,1).map(o=>{const a={headIndex:pe(o,3)??0??-1,headName:me(o,4)??""??""};if(Xi(o,Yo,js(o,1))!==void 0)o=ht(o=k(o,Yo,js(o,1)),1,$e,ct()),a.floatEmbedding=o.slice();else{const c=new Uint8Array(0);a.quantizedEmbedding=k(o,s1,js(o,2))?.oa()?.h()??c}return a}),timestampMs:bn(kt(i,2))??0}}(s),l(this,r)}),this.g.attachEmptyPacketListener("embeddings_out",s=>{l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ce.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Sa(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Sa(Ea(e.quantizedEmbedding),Ea(t.quantizedEmbedding))}return e},ce.prototype.embedForVideo=ce.prototype.Aa,ce.prototype.embed=ce.prototype.za,ce.prototype.setOptions=ce.prototype.o,ce.createFromModelPath=function(e,t){return v(ce,e,{baseOptions:{modelAssetPath:t}})},ce.createFromModelBuffer=function(e,t){return v(ce,e,{baseOptions:{modelAssetBuffer:t}})},ce.createFromOptions=function(e,t){return v(ce,e,t)};var jr=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 nc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function sc(e){try{const t=new jr(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{$n(e)}}jr.prototype.close=jr.prototype.close;var te=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Ar,this.v=new ya,g(this.h,0,3,this.v),g(e=this.h,0,1,t=new O)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?x(this.h,2,vt(e.displayNamesLocale)):"displayNamesLocale"in e&&x(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){const t=Ue(e.da(),Y,1).filter(n=>(me(n,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(k(t[0],se,7)?.l()?.g()??new Map).forEach((n,s)=>{e.s[Number(s)]=me(n,1)??""})})(this)}segment(e,t,n){const s=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:n,nc(this),we(this,e,s),sc(this)}Ma(e,t,n,s){const r=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:s,nc(this),Fe(this,e,r,t),sc(this)}Da(){return this.s}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect");const t=new se;Ee(t,va,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),n.o(t),ie(e,n),Kn(this,e),this.outputConfidenceMasks&&(A(e,"confidence_masks"),b(n,"CONFIDENCE_MASKS:confidence_masks"),Rt(this,"confidence_masks"),this.g.ca("confidence_masks",(s,r)=>{this.confidenceMasks=s.map(i=>Ut(this,i,!0,!this.j)),l(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",s=>{this.confidenceMasks=[],l(this,s)})),this.outputCategoryMask&&(A(e,"category_mask"),b(n,"CATEGORY_MASK:category_mask"),Rt(this,"category_mask"),this.g.U("category_mask",(s,r)=>{this.categoryMask=Ut(this,s,!1,!this.j),l(this,r)}),this.g.attachEmptyPacketListener("category_mask",s=>{this.categoryMask=void 0,l(this,s)})),A(e,"quality_scores"),b(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(s,r)=>{this.qualityScores=s,l(this,r)}),this.g.attachEmptyPacketListener("quality_scores",s=>{this.categoryMask=void 0,l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};te.prototype.getLabels=te.prototype.Da,te.prototype.segmentForVideo=te.prototype.Ma,te.prototype.segment=te.prototype.segment,te.prototype.setOptions=te.prototype.o,te.createFromModelPath=function(e,t){return v(te,e,{baseOptions:{modelAssetPath:t}})},te.createFromModelBuffer=function(e,t){return v(te,e,{baseOptions:{modelAssetBuffer:t}})},te.createFromOptions=function(e,t){return v(te,e,t)};var Vr=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};Vr.prototype.close=Vr.prototype.close;var E1=class extends d{constructor(e){super(e)}},Bt=[0,D,-2],ns=[0,je,-3,F,je,-1],rc=[0,ns],ic=[0,ns,D,-1],Hr=class extends d{constructor(e){super(e)}},oc=[0,je,-1,F],S1=class extends d{constructor(e){super(e)}},ac=class extends d{constructor(e){super(e)}},Wr=[1,2,3,4,5,6,7,8,9,10,14,15],cc=class extends d{constructor(e){super(e)}};cc.prototype.g=Bn([0,W,[0,Wr,S,ns,S,[0,ns,Bt],S,rc,S,[0,rc,Bt],S,oc,S,[0,je,-3,F,ge],S,[0,je,-3,F],S,[0,E,je,-2,F,D,F,-1,2,je,Bt],S,ic,S,[0,ic,Bt],je,Bt,E,S,[0,je,-3,F,Bt,-1],S,[0,W,oc]],E,[0,E,D,-1,F]]);var Ce=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Ar,this.s=new ya,g(this.h,0,3,this.s),g(e=this.h,0,1,t=new O)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(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,s){const r=typeof n!="function"?n:{};this.j=typeof n=="function"?n:s,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.B+1,s=new cc;const i=new ac;var o=new E1;if(Le(o,1,255),g(i,0,12,o),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Hr;qt(a,3,!0),f(a,1,t.keypoint.x),f(a,2,t.keypoint.y),Xt(i,5,Wr,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(o=new S1,t.scribble))qt(t=new Hr,3,!0),f(t,1,a.x),f(t,2,a.y),Sn(o,1,Hr,t);Xt(i,15,Wr,o)}Sn(s,1,ac,i),this.g.addProtoToStream(s.g(),"drishti.RenderData","roi_in",n),we(this,e,r);e:{try{const h=new Vr(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=h;break e}this.j(h)}finally{$n(this)}c=void 0}return c}m(){var e=new Q;M(e,"image_in"),M(e,"roi_in"),M(e,"norm_rect_in");const t=new se;Ee(t,va,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),L(n,"IMAGE:image_in"),L(n,"ROI:roi_in"),L(n,"NORM_RECT:norm_rect_in"),n.o(t),ie(e,n),Kn(this,e),this.outputConfidenceMasks&&(A(e,"confidence_masks"),b(n,"CONFIDENCE_MASKS:confidence_masks"),Rt(this,"confidence_masks"),this.g.ca("confidence_masks",(s,r)=>{this.confidenceMasks=s.map(i=>Ut(this,i,!0,!this.j)),l(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",s=>{this.confidenceMasks=[],l(this,s)})),this.outputCategoryMask&&(A(e,"category_mask"),b(n,"CATEGORY_MASK:category_mask"),Rt(this,"category_mask"),this.g.U("category_mask",(s,r)=>{this.categoryMask=Ut(this,s,!1,!this.j),l(this,r)}),this.g.attachEmptyPacketListener("category_mask",s=>{this.categoryMask=void 0,l(this,s)})),A(e,"quality_scores"),b(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(s,r)=>{this.qualityScores=s,l(this,r)}),this.g.attachEmptyPacketListener("quality_scores",s=>{this.categoryMask=void 0,l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ce.prototype.segment=Ce.prototype.segment,Ce.prototype.setOptions=Ce.prototype.o,Ce.createFromModelPath=function(e,t){return v(Ce,e,{baseOptions:{modelAssetPath:t}})},Ce.createFromModelBuffer=function(e,t){return v(Ce,e,{baseOptions:{modelAssetBuffer:t}})},Ce.createFromOptions=function(e,t){return v(Ce,e,t)};var be=class extends ee{constructor(e,t){super(new ye(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},g(e=this.h=new ba,0,1,t=new O)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?x(this.h,2,vt(e.displayNamesLocale)):"displayNamesLocale"in e&&x(this.h,2),e.maxResults!==void 0?Le(this.h,3,e.maxResults):"maxResults"in e&&x(this.h,3),e.scoreThreshold!==void 0?f(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&x(this.h,4),e.categoryAllowlist!==void 0?Tn(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&x(this.h,5),e.categoryDenylist!==void 0?Tn(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&x(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},we(this,e,t),this.j}F(e,t,n){return this.j={detections:[]},Fe(this,e,n,t),this.j}m(){var e=new Q;M(e,"input_frame_gpu"),M(e,"norm_rect"),A(e,"detections");const t=new se;Ee(t,w1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.ObjectDetectorGraph"),L(n,"IMAGE:input_frame_gpu"),L(n,"NORM_RECT:norm_rect"),b(n,"DETECTIONS:detections"),n.o(t),ie(e,n),this.g.attachProtoVectorListener("detections",(s,r)=>{for(const i of s)s=Ko(i),this.j.detections.push(Aa(s));l(this,r)}),this.g.attachEmptyPacketListener("detections",s=>{l(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};be.prototype.detectForVideo=be.prototype.F,be.prototype.detect=be.prototype.D,be.prototype.setOptions=be.prototype.o,be.createFromModelPath=async function(e,t){return v(be,e,{baseOptions:{modelAssetPath:t}})},be.createFromModelBuffer=function(e,t){return v(be,e,{baseOptions:{modelAssetBuffer:t}})},be.createFromOptions=function(e,t){return v(be,e,t)};var zr=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach(e=>{e.close()})}};function hc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function lc(e){try{const t=new zr(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{$n(e)}}zr.prototype.close=zr.prototype.close;var he=class extends ee{constructor(e,t){super(new ye(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,g(e=this.h=new ka,0,1,t=new O),this.v=new fa,g(this.h,0,3,this.v),this.j=new da,g(this.h,0,2,this.j),Le(this.j,4,1),f(this.j,2,.5),f(this.v,2,.5),f(this.h,4,.5)}get baseOptions(){return k(this.h,O,1)}set baseOptions(e){g(this.h,0,1,e)}o(e){return"numPoses"in e&&Le(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&f(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&f(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&f(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,n){const s=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:n,hc(this),we(this,e,s),lc(this)}F(e,t,n,s){const r=typeof n!="function"?n:{};return this.s=typeof n=="function"?n:s,hc(this),Fe(this,e,r,t),lc(this)}m(){var e=new Q;M(e,"image_in"),M(e,"norm_rect"),A(e,"normalized_landmarks"),A(e,"world_landmarks"),A(e,"segmentation_masks");const t=new se;Ee(t,_1,this.h);const n=new Y;re(n,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),b(n,"NORM_LANDMARKS:normalized_landmarks"),b(n,"WORLD_LANDMARKS:world_landmarks"),n.o(t),ie(e,n),Kn(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(s,r)=>{this.landmarks=[];for(const i of s)s=Qt(i),this.landmarks.push(Wn(s));l(this,r)}),this.g.attachEmptyPacketListener("normalized_landmarks",s=>{this.landmarks=[],l(this,s)}),this.g.attachProtoVectorListener("world_landmarks",(s,r)=>{this.worldLandmarks=[];for(const i of s)s=Ct(i),this.worldLandmarks.push(en(s));l(this,r)}),this.g.attachEmptyPacketListener("world_landmarks",s=>{this.worldLandmarks=[],l(this,s)}),this.outputSegmentationMasks&&(b(n,"SEGMENTATION_MASK:segmentation_masks"),Rt(this,"segmentation_masks"),this.g.ca("segmentation_masks",(s,r)=>{this.segmentationMasks=s.map(i=>Ut(this,i,!0,!this.s)),l(this,r)}),this.g.attachEmptyPacketListener("segmentation_masks",s=>{this.segmentationMasks=[],l(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};he.prototype.detectForVideo=he.prototype.F,he.prototype.detect=he.prototype.D,he.prototype.setOptions=he.prototype.o,he.createFromModelPath=function(e,t){return v(he,e,{baseOptions:{modelAssetPath:t}})},he.createFromModelBuffer=function(e,t){return v(he,e,{baseOptions:{modelAssetBuffer:t}})},he.createFromOptions=function(e,t){return v(he,e,t)},he.POSE_CONNECTIONS=Qa;const T1=-1,x1=1;function L1(e){return Math.abs(e[14]??0)>=Math.abs(e[11]??0)?(n,s)=>e[s*4+n]:(n,s)=>e[n*4+s]}function M1(e){const t=L1(e),n=180/Math.PI,s=Math.atan2(-t(2,0),Math.hypot(t(0,0),t(1,0)))*n,r=Math.atan2(t(2,1),t(2,2))*n,i=Math.atan2(t(1,0),t(0,0))*n;return{yaw:T1*s,pitch:x1*r,roll:i}}const P1=/^(?:[IWEF]\d{4} \d\d:\d\d:\d\d\.\d+\s+\d+ \S+:\d+\]|(?:INFO|WARNING|ERROR): .*(?:TensorFlow|XNNPACK|delegate)|Graph successfully started running)/,Kr=["log","info","warn","error","debug"];let uc=0,$r=null;function F1(){if(uc++===0){const t=Kr.map(s=>console[s]),n=t.map(s=>(...r)=>{typeof r[0]=="string"&&P1.test(r[0])||s.apply(console,r)});Kr.forEach((s,r)=>{console[s]=n[r]}),$r=()=>Kr.forEach((s,r)=>{console[s]===n[r]&&(console[s]=t[r])})}let e=!1;return()=>{e||(e=!0,--uc===0&&($r?.(),$r=null))}}async function O1(e,t){const n=F1();try{const s=await dt.isSimdSupported()?t.runtime:t.runtimeCompat,r={wasmLoaderPath:`${e}${s}.js`,wasmBinaryPath:`${e}${s}.wasm`},i=a=>({baseOptions:{modelAssetPath:e+t.model,delegate:a},runningMode:"VIDEO",numFaces:2,minFaceDetectionConfidence:.5,outputFaceBlendshapes:!0,outputFacialTransformationMatrixes:!0});let o;try{o=await C.createFromOptions(r,i("GPU"))}catch{o=await C.createFromOptions(r,i("CPU"))}return{detect:(a,c,h)=>dc(o.detectForVideo(a,c),h),close:()=>{try{o.close()}catch{}finally{n()}}}}catch(s){throw n(),s}}function dc(e,t){const n=e.faceLandmarks||[];if(n.length===0)return{t,faceCount:0};const s=n.map(w=>{let y=1,le=1,ke=0,P=0;for(const _ of w)_.x<y&&(y=_.x),_.y<le&&(le=_.y),_.x>ke&&(ke=_.x),_.y>P&&(P=_.y);return{x0:y,y0:le,x1:ke,y1:P,area:(ke-y)*(P-le)}});let r=0;s.forEach((w,y)=>{w.area>s[r].area&&(r=y)});const i=s[r],o={};for(const w of e.faceBlendshapes?.[r]?.categories||[])o[w.categoryName]=w.score;const a=e.facialTransformationMatrixes?.[r];if(!a)return{t,faceCount:n.length};const{yaw:c,pitch:h,roll:u}=M1(a.data);return{t,faceCount:n.length,blink:((o.eyeBlinkLeft??0)+(o.eyeBlinkRight??0))/2,jawOpen:o.jawOpen??0,smile:((o.mouthSmileLeft??0)+(o.mouthSmileRight??0))/2,yaw:c,pitch:h,roll:u,centerX:(i.x0+i.x1)/2,centerY:(i.y0+i.y1)/2,boxHeight:i.y1-i.y0}}const C1=Object.freeze(Object.defineProperty({__proto__:null,createEngine:O1,toSignals:dc},Symbol.toStringTag,{value:"Module"}));return Gt.PowerCredLiveness=e2,Gt.VERSION=t2,Gt.defaultStrings=Zr,Object.defineProperty(Gt,Symbol.toStringTag,{value:"Module"}),Gt}({});
|