@simprints/simface-sdk 0.2.1 → 0.4.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/dist/simface-sdk.js +2588 -2397
- package/dist/simface-sdk.umd.cjs +17 -40
- package/package.json +4 -1
package/dist/simface-sdk.umd.cjs
CHANGED
|
@@ -1,81 +1,64 @@
|
|
|
1
|
-
(function(O,Ye){typeof exports=="object"&&typeof module<"u"?Ye(exports):typeof define=="function"&&define.amd?define(["exports"],Ye):(O=typeof globalThis<"u"?globalThis:O||self,Ye(O.SimFaceSDK={}))})(this,(function(O){"use strict";var w2;class Ye{constructor(t){this.apiUrl=t.apiUrl.replace(/\/$/,""),this.projectId=t.projectId,this.apiKey=t.apiKey}async validateAPIKey(){const t=await fetch(`${this.apiUrl}/api/v1/auth/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:this.projectId,apiKey:this.apiKey})});if(!t.ok){const r=await t.json();throw new Error(r.error||"API key validation failed")}return t.json()}async enroll(t,r){const n=new FormData;n.append("projectId",this.projectId),n.append("apiKey",this.apiKey),n.append("clientId",t),n.append("image",r,"face.jpg");const s=await fetch(`${this.apiUrl}/api/v1/enroll`,{method:"POST",body:n});if(s.status===409)return{success:!1,clientId:t,alreadyEnrolled:!0,message:"User already enrolled"};if(!s.ok){const i=await s.json();throw new Error(i.error||"Enrollment failed")}return s.json()}async verify(t,r){const n=new FormData;n.append("projectId",this.projectId),n.append("apiKey",this.apiKey),n.append("clientId",t),n.append("image",r,"face.jpg");const s=await fetch(`${this.apiUrl}/api/v1/verify`,{method:"POST",body:n});if(s.status===404)return{match:!1,score:0,threshold:0,notEnrolled:!0,message:"User not enrolled"};if(!s.ok){const i=await s.json();throw new Error(i.error||"Verification failed")}return s.json()}}const E2="2147483647";async function pn(){var e;if(T2())return k2();if(!((e=navigator.mediaDevices)!=null&&e.getUserMedia))throw new Error("In-browser camera capture is not supported in this browser.");return S2()}async function S2(){let e;try{e=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"}},audio:!1})}catch(n){throw new Error(C2(n))}let t=!1;const r=()=>{t||(t=!0,e.getTracks().forEach(n=>n.stop()))};return new Promise((n,s)=>{let i=!1,o=null,a=null;const c=()=>{a&&window.removeEventListener("keydown",a),r(),o==null||o.remove()},u=(h,l)=>{if(!i){if(i=!0,c(),l){s(l);return}n(h)}};try{o=document.createElement("div"),o.setAttribute("data-simface-camera-overlay","true"),o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),Je(o,{position:"fixed",inset:"0",zIndex:E2,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(15, 23, 42, 0.82)"});const h=document.createElement("div");Je(h,{width:"min(100%, 520px)",display:"flex",flexDirection:"column",gap:"16px",padding:"20px",borderRadius:"18px",background:"#020617",color:"#e2e8f0",boxShadow:"0 24px 60px rgba(15, 23, 42, 0.35)"});const l=document.createElement("h2");l.textContent="Capture a face photo",Je(l,{margin:"0",fontSize:"1.25rem",fontWeight:"700"});const m=document.createElement("p");m.textContent="Allow camera access, then position your face and take a photo.",Je(m,{margin:"0",color:"#cbd5e1",fontSize:"0.95rem",lineHeight:"1.5"});const _=document.createElement("video");_.autoplay=!0,_.muted=!0,_.playsInline=!0,_.srcObject=e,Je(_,{width:"100%",minHeight:"280px",borderRadius:"14px",background:"#000",objectFit:"cover"});const S=document.createElement("div");Je(S,{display:"flex",flexWrap:"wrap",gap:"12px",justifyContent:"flex-end"});const yt=Ys("Cancel","secondary");yt.dataset.simfaceAction="cancel";const ve=Ys("Take photo","primary");ve.dataset.simfaceAction="capture",ve.disabled=!0,S.append(yt,ve),h.append(l,m,_,S),o.append(h),document.body.appendChild(o),a=Z=>{Z.key==="Escape"&&u(null)},yt.addEventListener("click",()=>u(null)),window.addEventListener("keydown",a),ve.addEventListener("click",async()=>{try{const Z=await P2(_);u(Z)}catch(Z){u(null,Z instanceof Error?Z:new Error("Failed to capture an image."))}}),L2(_).then(()=>{ve.disabled=!1}).catch(Z=>{u(null,Z instanceof Error?Z:new Error("Failed to start the camera preview."))})}catch(h){u(null,h instanceof Error?h:new Error("Failed to open the camera capture UI."))}})}function k2(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/*",t.capture="user",t.style.display="none",t.addEventListener("change",()=>{var i;const s=((i=t.files)==null?void 0:i[0])??null;n(),e(s)});const r=()=>{setTimeout(()=>{var s;(s=t.files)!=null&&s.length||(n(),e(null))},500)};window.addEventListener("focus",r,{once:!0});function n(){window.removeEventListener("focus",r),t.remove()}document.body.appendChild(t),t.click()})}function T2(){return/WhatsApp/i.test(navigator.userAgent)}async function L2(e){if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){await e.play();return}await new Promise((t,r)=>{const n=()=>{i(),t()},s=()=>{i(),r(new Error("Failed to start the camera preview."))},i=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",s)};e.addEventListener("loadedmetadata",n,{once:!0}),e.addEventListener("error",s,{once:!0})}),await e.play()}function P2(e){if(!e.videoWidth||!e.videoHeight)return Promise.reject(new Error("Camera preview is not ready yet."));const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const r=t.getContext("2d");return r?(r.drawImage(e,0,0,t.width,t.height),new Promise((n,s)=>{t.toBlob(i=>{if(!i){s(new Error("Failed to capture an image."));return}n(i)},"image/jpeg",.92)})):Promise.reject(new Error("Failed to initialize camera capture."))}function Ys(e,t){const r=document.createElement("button");return r.type="button",r.textContent=e,Je(r,{border:"none",borderRadius:"999px",padding:"12px 18px",font:'600 15px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',cursor:"pointer",color:t==="primary"?"#fff":"#0f172a",background:t==="primary"?"#2563eb":"#e2e8f0"}),r}function Je(e,t){Object.assign(e.style,t)}function C2(e){if(e instanceof DOMException)switch(e.name){case"NotAllowedError":case"SecurityError":return"Camera access was denied. Allow camera access and try again.";case"NotFoundError":return"No camera was found on this device.";case"NotReadableError":return"The camera is already in use by another application.";default:return e.message||"Failed to access the camera."}return e instanceof Error?e.message:"Failed to access the camera."}function gn(e){return new Promise((t,r)=>{const n=URL.createObjectURL(e),s=new Image;s.onload=()=>{URL.revokeObjectURL(n),t(s)},s.onerror=()=>{URL.revokeObjectURL(n),r(new Error("Failed to load captured image"))},s.src=n})}function Js(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>r(new Error("Failed to read image")),n.readAsDataURL(e)})}var _t=typeof self<"u"?self:{};function Jt(e,t){e:{for(var r=["CLOSURE_FLAGS"],n=_t,s=0;s<r.length;s++)if((n=n[r[s]])==null){r=null;break e}r=n}return(e=r&&r[e])!=null?e:t}function Ze(){throw Error("Invalid UTF8")}function Zs(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let kr,mn;const $2=typeof TextDecoder<"u";let F2;const M2=typeof TextEncoder<"u";function Qs(e){if(M2)e=(F2||(F2=new TextEncoder)).encode(e);else{let r=0;const n=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&s<e.length){const i=e.charCodeAt(++s);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}s--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}function ei(e){_t.setTimeout((()=>{throw e}),0)}var yn,x2=Jt(610401301,!1),ti=Jt(748402147,!0),_n=Jt(824648567,!0),vn=Jt(824656860,Jt(1,!0));function ri(){var e=_t.navigator;return e&&(e=e.userAgent)?e:""}const ni=_t.navigator;function Tr(e){return Tr[" "](e),e}yn=ni&&ni.userAgentData||null,Tr[" "]=function(){};const si={};let Zt=null;function O2(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const n=new Uint8Array(r);let s=0;return(function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),l=Zt[h];if(l!=null)return l;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}ii();let c=0;for(;;){const u=a(-1),h=a(0),l=a(64),m=a(64);if(m===64&&u===-1)break;o(u<<2|h>>4),l!=64&&(o(h<<4&240|l>>2),m!=64&&o(l<<6&192|m))}})(e,(function(i){n[s++]=i})),s!==r?n.subarray(0,s):n}function ii(){if(!Zt){Zt={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const n=e.concat(t[r].split(""));si[r]=n;for(let s=0;s<n.length;s++){const i=n[s];Zt[i]===void 0&&(Zt[i]=s)}}}}var I2=typeof Uint8Array<"u",oi=!(!(x2&&yn&&yn.brands.length>0)&&(ri().indexOf("Trident")!=-1||ri().indexOf("MSIE")!=-1))&&typeof btoa=="function";const ai=/[-_.]/g,R2={"-":"+",_:"/",".":"="};function N2(e){return R2[e]||""}function ci(e){if(!oi)return O2(e);e=ai.test(e)?e.replace(ai,N2):e,e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function bn(e){return I2&&e!=null&&e instanceof Uint8Array}var vt={};function Qe(){return U2||(U2=new Se(null,vt))}function wn(e){hi(vt);var t=e.g;return(t=t==null||bn(t)?t:typeof t=="string"?ci(t):null)==null?t:e.g=t}var Se=class{h(){return new Uint8Array(wn(this)||0)}constructor(t,r){if(hi(r),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let U2,D2;function hi(e){if(e!==vt)throw Error("illegal external caller")}function ui(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function An(e){return ui(e=Error(e),"warning"),e}function bt(e,t){if(e!=null){var r=D2??(D2={}),n=r[e]||0;n>=t||(r[e]=n+1,ui(e=Error(),"incident"),ei(e))}}function wt(){return typeof BigInt=="function"}var At=typeof Symbol=="function"&&typeof Symbol()=="symbol";function ke(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var B2=ke("jas",void 0,!0),li=ke(void 0,"0di"),Qt=ke(void 0,"1oa"),te=ke(void 0,Symbol()),j2=ke(void 0,"0ub"),V2=ke(void 0,"0ubs"),En=ke(void 0,"0ubsb"),G2=ke(void 0,"0actk"),Et=ke("m_m","Pa",!0),di=ke();const fi={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},pi=Object.defineProperties,f=At?B2:"Ga";var et;const gi=[];function er(e,t){At||f in e||pi(e,fi),e[f]|=t}function j(e,t){At||f in e||pi(e,fi),e[f]=t}function tr(e){return er(e,34),e}function rr(e){return er(e,8192),e}j(gi,7),et=Object.freeze(gi);var St={};function re(e,t){return t===void 0?e.h!==tt&&!!(2&(0|e.v[f])):!!(2&t)&&e.h!==tt}const tt={};function Sn(e,t){if(e!=null){if(typeof e=="string")e=e?new Se(e,vt):Qe();else if(e.constructor!==Se)if(bn(e))e=e.length?new Se(new Uint8Array(e),vt):Qe();else{if(!t)throw Error();e=void 0}}return e}class mi{constructor(t,r,n){this.g=t,this.h=r,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var H2=Object.freeze({});function yi(e,t,r){const n=128&t?0:-1,s=e.length;var i;(i=!!s)&&(i=(i=e[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-n,e[t]);if(i){e=e[s-1];for(const a in e)!isNaN(a)&&r(+a,e[a])}}var _i={};function kt(e){return 128&e?_i:void 0}function Lr(e){return e.Na=!0,e}var z2=Lr((e=>typeof e=="number")),vi=Lr((e=>typeof e=="string")),W2=Lr((e=>typeof e=="boolean")),Pr=typeof _t.BigInt=="function"&&typeof _t.BigInt(0)=="bigint";function ne(e){var t=e;if(vi(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(z2(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Pr?BigInt(e):e=W2(e)?e?"1":"0":vi(e)?e.trim()||"0":String(e)}var kn=Lr((e=>Pr?e>=q2&&e<=Y2:e[0]==="-"?bi(e,K2):bi(e,X2)));const K2=Number.MIN_SAFE_INTEGER.toString(),q2=Pr?BigInt(Number.MIN_SAFE_INTEGER):void 0,X2=Number.MAX_SAFE_INTEGER.toString(),Y2=Pr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function bi(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const n=e[r],s=t[r];if(n>s)return!1;if(n<s)return!0}}const J2=typeof Uint8Array.prototype.slice=="function";let Z2,$=0,U=0;function wi(e){const t=e>>>0;$=t,U=(e-t)/4294967296>>>0}function Tt(e){if(e<0){wi(-e);const[t,r]=$n($,U);$=t>>>0,U=r>>>0}else wi(e)}function Tn(e){const t=Z2||(Z2=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),U=0,$=t.getUint32(0,!0)}function Ln(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:nr(e,t)}function Q2(e,t){return ne(wt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):nr(e,t))}function Pn(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Ln(e,t))=="number"?r?-e:e:r?"-"+e:e}function Ai(e,t){return wt()?ne(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ne(Cn(e,t))}function nr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else wt()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Ei(r)+Ei(e));return r}function Ei(e){return e=String(e),"0000000".slice(e.length)+e}function Cn(e,t){if(2147483648&t)if(wt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,n]=$n(e,t);e="-"+nr(r,n)}else e=nr(e,t);return e}function Cr(e){if(e.length<16)Tt(Number(e));else if(wt())e=BigInt(e),$=Number(e&BigInt(4294967295))>>>0,U=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");U=$=0;const r=e.length;for(let n=t,s=(r-t)%6+t;s<=r;n=s,s+=6){const i=Number(e.slice(n,s));U*=1e6,$=1e6*$+i,$>=4294967296&&(U+=Math.trunc($/4294967296),U>>>=0,$>>>=0)}if(t){const[n,s]=$n($,U);$=n,U=s}}}function $n(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function be(e){return Array.prototype.slice.call(e)}const sr=typeof BigInt=="function"?BigInt.asIntN:void 0,e1=typeof BigInt=="function"?BigInt.asUintN:void 0,rt=Number.isSafeInteger,$r=Number.isFinite,Lt=Math.trunc,t1=ne(0);function ir(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function Te(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function or(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function Si(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const r1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function ar(e){switch(typeof e){case"bigint":return!0;case"number":return $r(e);case"string":return r1.test(e);default:return!1}}function Pt(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return $r(e)?0|e:void 0}function ki(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return $r(e)?e>>>0:void 0}function Ti(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Cr(e),Cn($,U))}function Fn(e){return e=Lt(e),rt(e)||(Tt(e),e=Pn($,U)),e}function Li(e){var t=Lt(Number(e));return rt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Ti(e))}function Pi(e){var t=Lt(Number(e));return rt(t)?ne(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),wt()?ne(sr(64,BigInt(e))):ne(Ti(e)))}function Ci(e){return rt(e)?e=ne(Fn(e)):(e=Lt(e),rt(e)?e=String(e):(Tt(e),e=Cn($,U)),e=ne(e)),e}function n1(e){return e==null?e:typeof e=="bigint"?(kn(e)?e=Number(e):(e=sr(64,e),e=kn(e)?Number(e):String(e)),e):ar(e)?typeof e=="number"?Fn(e):Li(e):void 0}function Fr(e){const t=typeof e;return e==null?e:t==="bigint"?ne(sr(64,e)):ar(e)?t==="string"?Pi(e):Ci(e):void 0}function $i(e){if(typeof e!="string")throw Error();return e}function cr(e){if(e!=null&&typeof e!="string")throw Error();return e}function X(e){return e==null||typeof e=="string"?e:void 0}function Mn(e,t,r,n){return e!=null&&e[Et]===St?e:Array.isArray(e)?((n=(r=0|e[f])|32&n|2&n)!==r&&j(e,n),new t(e)):(r?2&n?((e=t[li])||(tr((e=new t).v),e=t[li]=e),t=e):t=new t:t=void 0,t)}function s1(e,t,r){if(t)e:{if(!ar(t=e))throw An("int64");switch(typeof t){case"string":t=Pi(t);break e;case"bigint":t=ne(sr(64,t));break e;default:t=Ci(t)}}else t=Fr(e);return(e=t)==null?r?t1:void 0:e}const i1={};let o1=(function(){try{return Tr(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class xn{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),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,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}}const a1=o1?(Object.setPrototypeOf(xn.prototype,Map.prototype),Object.defineProperties(xn.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),xn):class extends Map{constructor(){super()}};function Fi(e){return e}function On(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var Oe=class extends a1{constructor(e,t,r=Fi,n=Fi){super(),this.J=0|e[f],this.K=t,this.S=r,this.fa=this.K?c1:n;for(let s=0;s<e.length;s++){const i=e[s],o=r(i[0],!1,!0);let a=i[1];t?a===void 0&&(a=null):a=n(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return rr(Array.from(super.entries(),e))}clear(){On(this),super.clear()}delete(e){return On(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new mi(e,h1,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new mi(e,Oe.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((r,n,s)=>{e.call(t,s.get(n),n,s)})):super.forEach(e,t)}set(e,t){return On(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function c1(e,t,r,n,s,i){return e=Mn(e,n,r,i),s&&(e=Nn(e)),e}function h1(e){return[e,this.get(e)]}let u1;function Mi(){return u1||(u1=new Oe(tr([]),void 0,void 0,void 0,i1))}function Mr(e){return te?e[te]:void 0}function xr(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}Oe.prototype.toJSON=void 0;var In=class{};const l1={Ka:!0};function d1(e,t){t<100||bt(V2,1)}function Or(e,t,r,n){const s=n!==void 0;n=!!n;var i,o=te;!s&&At&&o&&(i=e[o])&&xr(i,d1),o=[];var a=e.length;let c;i=4294967295;let u=!1;const h=!!(64&t),l=h?128&t?0:-1:void 0;1&t||(c=a&&e[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!h||128&t||s||(u=!0,i=i-l+l)),t=void 0;for(var m=0;m<a;m++){let _=e[m];if(_!=null&&(_=r(_,n))!=null)if(h&&m>=i){const S=m-l;(t??(t={}))[S]=_}else o[m]=_}if(c)for(let _ in c){if((a=c[_])==null||(a=r(a,n))==null)continue;let S;m=+_,h&&!Number.isNaN(m)&&(S=m+l)<i?o[S]=a:(t??(t={}))[_]=a}return t&&(u?o.push(t):o[i]=t),s&&te&&(e=Mr(e))&&e instanceof In&&(o[te]=(function(_){const S=new In;return xr(_,((yt,ve,Z)=>{S[ve]=be(Z)})),S.da=_.da,S})(e)),o}function f1(e){return e[0]=hr(e[0]),e[1]=hr(e[1]),e}function hr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return kn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[f];return e.length===0&&1&t?void 0:Or(e,t,hr)}if(e!=null&&e[Et]===St)return xi(e);if(e instanceof Se){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(oi){for(var r="",n=0,s=t.length-10240;n<s;)r+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?t.subarray(n):t),t=btoa(r)}else{r===void 0&&(r=0),ii(),r=si[r],n=Array(Math.floor(t.length/3)),s=r[64]||"";let u=0,h=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],a=t[u+2],c=r[i>>2];i=r[(3&i)<<4|o>>4],o=r[(15&o)<<2|a>>6],a=r[63&a],n[h++]=c+i+o+a}switch(c=0,a=s,t.length-u){case 2:a=r[(15&(c=t[u+1]))<<2]||s;case 1:t=t[u],n[h]=r[t>>2]+r[(3&t)<<4|c>>4]+a+s}t=n.join("")}e=e.g=t}return e}return e instanceof Oe?e=e.size!==0?e.V(f1):void 0:void 0}return e}function xi(e){return Or(e=e.v,0|e[f],hr)}let p1,g1;function nt(e,t){return Oi(e,t[0],t[1])}function Oi(e,t,r,n=0){if(e==null){var s=32;r?(e=[r],s|=128):e=[],t&&(s=-16760833&s|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(s=0|e[f],ti&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&(function(){if(ti)throw Error("carr");bt(G2,5)})(),256&s)throw Error("farr");if(64&s)return(s|n)!==s&&j(e,s|n),e;if(r&&(s|=128,r!==e[0]))throw Error("mid");e:{s|=64;var i=(r=e).length;if(i){var o=i-1;const c=r[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(r[i+t]=c[a],delete c[a]);s=-16760833&s|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&a)<<14}}}return j(e,64|s|n),e}function m1(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[f];return e.length===0&&1&r?void 0:Ii(e,r,t)}if(e!=null&&e[Et]===St)return Ri(e);if(e instanceof Oe){if(2&(t=e.J))return e;if(!e.size)return;if(r=tr(e.V()),e.K)for(e=0;e<r.length;e++){const n=r[e];let s=n[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[Et]===St?Ri(s):Array.isArray(s)?Ii(s,0|s[f],!!(32&t)):void 0,n[1]=s}return r}return e instanceof Se?e:void 0}function Ii(e,t,r){return 2&t||(!r||4096&t||16&t?e=Ct(e,t,!1,r&&!(16&t)):(er(e,34),4&t&&Object.freeze(e))),e}function Rn(e,t,r){return e=new e.constructor(t),r&&(e.h=tt),e.m=tt,e}function Ri(e){const t=e.v,r=0|t[f];return re(e,r)?e:Un(e,t,r)?Rn(e,t):Ct(t,r)}function Ct(e,t,r,n){return n??(n=!!(34&t)),e=Or(e,t,m1,n),n=32,r&&(n|=2),j(e,t=16769217&t|n),e}function Nn(e){const t=e.v,r=0|t[f];return re(e,r)?Un(e,t,r)?Rn(e,t,!0):new e.constructor(Ct(t,r,!1)):e}function $t(e){if(e.h!==tt)return!1;var t=e.v;return er(t=Ct(t,0|t[f]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Ft(e){if(!$t(e)&&re(e,0|e.v[f]))throw Error()}function st(e,t){t===void 0&&(t=0|e[f]),32&t&&!(4096&t)&&j(e,4096|t)}function Un(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(j(t,2|r),e.h=tt,!0)}const y1=ne(0),Be={};function L(e,t,r,n,s){if((t=Ie(e.v,t,r,s))!==null||n&&e.m!==tt)return t}function Ie(e,t,r,n){if(t===-1)return null;const s=t+(r?0:-1),i=e.length-1;let o,a;if(!(i<1+(r?0:-1))){if(s>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],a=!0;else{if(s!==i)return;r=o}else r=e[s];if(n&&r!=null){if((n=n(r))==null)return n;if(!Object.is(n,r))return a?o[t]=n:e[s]=n,n}return r}}function k(e,t,r,n){Ft(e),V(e=e.v,0|e[f],t,r,n)}function V(e,t,r,n,s){const i=r+(s?0:-1);var o=e.length-1;if(o>=1+(s?0:-1)&&i>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[r]=n,t}return i<=o?(e[i]=n,t):(n!==void 0&&(r>=(o=(t??(t=0|e[f]))>>14&1023||536870912)?n!=null&&(e[o+(s?0:-1)]={[r]:n}):e[i]=n),t)}function it(){return H2===void 0?2:4}function ot(e,t,r,n,s){let i=e.v,o=0|i[f];n=re(e,o)?1:n,s=!!s||n===3,n===2&&$t(e)&&(i=e.v,o=0|i[f]);let a=(e=Dn(i,t))===et?7:0|e[f],c=Bn(a,o);var u=!(4&c);if(u){4&c&&(e=be(e),a=0,c=ct(c,o),o=V(i,o,t,e));let h=0,l=0;for(;h<e.length;h++){const m=r(e[h]);m!=null&&(e[l++]=m)}l<h&&(e.length=l),r=-513&(4|c),c=r&=-1025,c&=-4097}return c!==a&&(j(e,c),2&c&&Object.freeze(e)),Ni(e,c,i,o,t,n,u,s)}function Ni(e,t,r,n,s,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&n)?at(t)||((t|=!e.length||o&&!(4096&t)||32&n&&!(4096&t||16&t)?2:256)!==c&&j(e,t),Object.freeze(e)):(i===2&&at(t)&&(e=be(e),c=0,t=ct(t,n),n=V(r,n,s,e)),at(t)||(a||(t|=16),t!==c&&j(e,t))),2&t||!(4096&t||16&t)||st(r,n),e}function Dn(e,t,r){return e=Ie(e,t,r),Array.isArray(e)?e:et}function Bn(e,t){return 2&t&&(e|=2),1|e}function at(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Ui(e){return Sn(e,!0)}function Di(e){e=be(e);for(let t=0;t<e.length;t++){const r=e[t]=be(e[t]);Array.isArray(r[1])&&(r[1]=tr(r[1]))}return rr(e)}function je(e,t,r,n){Ft(e),V(e=e.v,0|e[f],t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Mt(e,t,r){if(2&t)throw Error();const n=kt(t);let s=Dn(e,r,n),i=s===et?7:0|s[f],o=Bn(i,t);return(2&o||at(o)||16&o)&&(o===i||at(o)||j(s,o),s=be(s),i=0,o=ct(o,t),V(e,t,r,s,n)),o&=-13,o!==i&&j(s,o),s}function jn(e,t){var r=Wo;return Gn(Vn(e=e.v),e,void 0,r)===t?t:-1}function Vn(e){if(At)return e[Qt]??(e[Qt]=new Map);if(Qt in e)return e[Qt];const t=new Map;return Object.defineProperty(e,Qt,{value:t}),t}function Bi(e,t,r,n,s){const i=Vn(e),o=Gn(i,e,t,r,s);return o!==n&&(o&&(t=V(e,t,o,void 0,s)),i.set(r,n)),t}function Gn(e,t,r,n,s){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){const a=n[o];Ie(t,a,s)!=null&&(i!==0&&(r=V(t,r,i,void 0,s)),i=a)}return e.set(n,i),i}function Hn(e,t,r){let n=0|e[f];const s=kt(n),i=Ie(e,r,s);let o;if(i!=null&&i[Et]===St){if(!re(i))return $t(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[f];2&a&&(o=Ct(o,a))}return o=nt(o,t),o!==i&&V(e,n,r,o,s),o}function ji(e,t,r,n,s){let i=!1;if((n=Ie(e,n,s,(o=>{const a=Mn(o,r,!1,t);return i=a!==o&&a!=null,a})))!=null)return i&&!re(n)&&st(e,t),n}function A(e,t,r,n){let s=e.v,i=0|s[f];if((t=ji(s,i,t,r,n))==null)return t;if(i=0|s[f],!re(e,i)){const o=Nn(t);o!==t&&($t(e)&&(s=e.v,i=0|s[f]),i=V(s,i,r,t=o,n),st(s,i))}return t}function Vi(e,t,r,n,s,i,o,a){var c=re(e,r);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&$t(e)&&(r=0|(t=e.v)[f]);var u=(e=Dn(t,s))===et?7:0|e[f],h=Bn(u,r);if(a=!(4&h)){var l=e,m=r;const _=!!(2&h);_&&(m|=2);let S=!_,yt=!0,ve=0,Z=0;for(;ve<l.length;ve++){const Xs=Mn(l[ve],n,!1,m);if(Xs instanceof n){if(!_){const A2=re(Xs);S&&(S=!A2),yt&&(yt=A2)}l[Z++]=Xs}}Z<ve&&(l.length=Z),h|=4,h=yt?-4097&h:4096|h,h=S?8|h:-9&h}if(h!==u&&(j(e,h),2&h&&Object.freeze(e)),c&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&r)))){for(at(h)&&(e=be(e),h=ct(h,r),r=V(t,r,s,e)),n=e,c=h,u=0;u<n.length;u++)(l=n[u])!==(h=Nn(l))&&(n[u]=h);c|=8,j(e,h=c=n.length?4096|c:-4097&c)}return Ni(e,h,t,r,s,i,a,o)}function Re(e,t,r){const n=e.v;return Vi(e,n,0|n[f],t,r,it(),!1,!0)}function Gi(e){return e==null&&(e=void 0),e}function v(e,t,r,n,s){return k(e,r,n=Gi(n),s),n&&!re(n)&&st(e.v),e}function ur(e,t,r,n){e:{var s=n=Gi(n);Ft(e);const i=e.v;let o=0|i[f];if(s==null){const a=Vn(i);if(Gn(a,i,o,r)!==t)break e;a.set(r,0)}else o=Bi(i,o,r,t);V(i,o,t,s)}n&&!re(n)&&st(e.v)}function ct(e,t){return-273&(2&t?2|e:-3&e)}function zn(e,t,r,n){var s=n;Ft(e),e=Vi(e,n=e.v,0|n[f],r,t,2,!0),s=s??new r,e.push(s),t=r=e===et?7:0|e[f],(s=re(s))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&j(e,r),s||st(n)}function pe(e,t,r){return Pt(L(e,t,void 0,r))}function Hi(e){return(vn?L(e,2,void 0,void 0,Fr):Fr(L(e,2)))??y1}function I(e,t){return L(e,t,void 0,void 0,Te)??0}function Ne(e,t,r){if(r!=null){if(typeof r!="number"||!$r(r))throw An("int32");r|=0}k(e,t,r)}function y(e,t,r){k(e,t,ir(r))}function se(e,t,r){je(e,t,cr(r),"")}function Ir(e,t,r){{Ft(e);const o=e.v;let a=0|o[f];if(r==null)V(o,a,t);else{var n=e=r===et?7:0|r[f],s=at(e),i=s||Object.isFrozen(r);for(s||(e=0),i||(r=be(r),n=0,e=ct(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(vn?1024:0),s=0;s<r.length;s++){const c=r[s],u=$i(c);Object.is(c,u)||(i&&(r=be(r),n=0,e=ct(e,a),i=!1),r[s]=u)}e!==n&&(i&&(r=be(r),e=ct(e,a)),j(r,e)),V(o,a,t,r)}}}function Rr(e,t,r){Ft(e),ot(e,t,X,2,!0).push($i(r))}var xt=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function Wn(e,t){if(typeof e=="string")return new xt(ci(e),t);if(Array.isArray(e))return new xt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new xt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new xt(e,!1);if(e.constructor===Se)return t=wn(e)||new Uint8Array(0),new xt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new xt(e,!1);throw Error()}function Ot(e,t){let r,n=0,s=0,i=0;const o=e.h;let a=e.g;do r=o[a++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(s|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[a++],s|=(127&r)<<i;if(ht(e,a),!(128&r))return t(n>>>0,s>>>0);throw Error()}function Kn(e){let t=0,r=e.g;const n=r+10,s=e.h;for(;r<n;){const i=s[r++];if(t|=i,(128&i)==0)return ht(e,r),!!(127&t)}throw Error()}function Ve(e){const t=e.h;let r=e.g,n=t[r++],s=127&n;if(128&n&&(n=t[r++],s|=(127&n)<<7,128&n&&(n=t[r++],s|=(127&n)<<14,128&n&&(n=t[r++],s|=(127&n)<<21,128&n&&(n=t[r++],s|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return ht(e,r),s}function Ue(e){return Ve(e)>>>0}function Nr(e){var t=e.h;const r=e.g;var n=t[r],s=t[r+1];const i=t[r+2];return t=t[r+3],ht(e,e.g+4),e=2*((s=(n<<0|s<<8|i<<16|t<<24)>>>0)>>31)+1,n=s>>>23&255,s&=8388607,n==255?s?NaN:e*(1/0):n==0?1401298464324817e-60*e*s:e*Math.pow(2,n-150)*(s+8388608)}function _1(e){return Ve(e)}function ht(e,t){if(e.g=t,t>e.l)throw Error()}function zi(e,t){if(t<0)throw Error();const r=e.g;if((t=r+t)>e.l)throw Error();return e.g=t,r}function Wi(e,t){if(t==0)return Qe();var r=zi(e,t);return e.Y&&e.j?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):J2?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Qe():new Se(r,vt)}var Ki=[];function qi(e,t,r,n){if(Br.length){const s=Br.pop();return s.o(n),s.g.init(e,t,r,n),s}return new v1(e,t,r,n)}function Xi(e){e.g.clear(),e.l=-1,e.h=-1,Br.length<100&&Br.push(e)}function Yi(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=Ue(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function Ur(e){switch(e.h){case 0:e.h!=0?Ur(e):Kn(e.g);break;case 1:ht(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ur(e);else{var t=Ue(e.g);ht(e=e.g,e.g+t)}break;case 5:ht(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!Yi(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}Ur(e)}break;default:throw Error()}}function lr(e,t,r){const n=e.g.l;var s=Ue(e.g);let i=(s=e.g.g+s)-n;if(i<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error();return e.g.g=s,e.g.l=n,t}function qn(e){var t=Ue(e.g),r=zi(e=e.g,t);if(e=e.h,$2){var n,s=e;(n=mn)||(n=mn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,s=r===0&&t===s.length?s:s.subarray(r,t);try{var i=n.decode(s)}catch(a){if(kr===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),kr=!0}catch{kr=!1}}throw!kr&&(mn=void 0),a}}else{t=(i=r)+t,r=[];let a,c=null;for(;i<t;){var o=e[i++];o<128?r.push(o):o<224?i>=t?Ze():(a=e[i++],o<194||(192&a)!=128?(i--,Ze()):r.push((31&o)<<6|63&a)):o<240?i>=t-1?Ze():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(n=e[i++]))!=128?(i--,Ze()):r.push((15&o)<<12|(63&a)<<6|63&n)):o<=244?i>=t-2?Ze():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(n=e[i++]))!=128||(192&(s=e[i++]))!=128?(i--,Ze()):(o=(7&o)<<18|(63&a)<<12|(63&n)<<6|63&s,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):Ze(),r.length>=8192&&(c=Zs(c,r),r.length=0)}i=Zs(c,r)}return i}function Ji(e){const t=Ue(e.g);return Wi(e.g,t)}function Dr(e,t,r){var n=Ue(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var v1=class{constructor(e,t,r,n){if(Ki.length){const s=Ki.pop();s.init(e,t,r,n),e=s}else e=new class{constructor(s,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,a)}init(s,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,s&&(s=Wn(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,n);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(n)}o({ha:e=!1}={}){this.ha=e}},Br=[];function Zi(e){return e?/^\d+$/.test(e)?(Cr(e),new Xn($,U)):null:b1||(b1=new Xn(0,0))}var Xn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let b1;function Qi(e){return e?/^-?\d+$/.test(e)?(Cr(e),new Yn($,U)):null:w1||(w1=new Yn(0,0))}var Yn=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let w1;function It(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function Rt(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function jr(e,t){if(t>=0)Rt(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Jn(e){var t=$;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Nt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function ge(e,t,r){Rt(e.g,8*t+r)}function Zn(e,t){return ge(e,t,2),t=e.g.end(),Nt(e,t),t.push(e.h),t}function Qn(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function Vr(e,t,r){ge(e,t,2),Rt(e.g,r.length),Nt(e,e.g.end()),Nt(e,r)}function Gr(e,t,r,n){r!=null&&(t=Zn(e,t),n(r,e),Qn(e,t))}function Le(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var es=Le(),eo=Le(),ts=Le(),rs=Le(),to=Le(),ro=Le(),A1=Le(),Hr=Le(),no=Le(),so=Le();function Pe(e,t,r){var n=e.v;te&&te in n&&(n=n[te])&&delete n[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var p=class{constructor(e,t){this.v=Oi(e,t,void 0,2048)}toJSON(){return xi(this)}j(){var s;var e=sc,t=this.v,r=e.g,n=te;if(At&&n&&((s=t[n])==null?void 0:s[r])!=null&&bt(j2,3),t=e.g,di&&te&&di===void 0&&(n=(r=this.v)[te])&&(n=n.da))try{n(r,t,l1)}catch(i){ei(i)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[f];return Un(this,e,t)?Rn(this,e,!0):new this.constructor(Ct(e,t,!1))}};p.prototype[Et]=St,p.prototype.toString=function(){return this.v.toString()};var Ut=class{constructor(e,t,r){this.g=e,this.h=t,e=es,this.l=!!e&&r===e||!1}};function zr(e,t){return new Ut(e,t,es)}function io(e,t,r,n,s){Gr(e,r,lo(t,n),s)}const E1=zr((function(e,t,r,n,s){return e.h===2&&(lr(e,Hn(t,n,r),s),!0)}),io),S1=zr((function(e,t,r,n,s){return e.h===2&&(lr(e,Hn(t,n,r),s),!0)}),io);var Wr=Symbol(),Kr=Symbol(),ns=Symbol(),oo=Symbol(),ao=Symbol();let co,ho;function ut(e,t,r,n){var s=n[e];if(s)return s;(s={}).qa=n,s.T=(function(l){switch(typeof l){case"boolean":return p1||(p1=[0,void 0,!0]);case"number":return l>0?void 0:l===0?g1||(g1=[0,void 0]):[-l,void 0];case"string":return[0,l];case"object":return l}})(n[0]);var i=n[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=n[++o])=="function"&&(s.ma=!0,co??(co=i),ho??(ho=n[o+1]),i=n[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=n[++o]}for(c=1;i!==void 0;){let l;typeof i=="number"&&(c+=i,i=n[++o]);var u=void 0;if(i instanceof Ut?l=i:(l=E1,o--),l==null?void 0:l.l){i=n[++o],u=n;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=n[++o])=="number"&&i<0&&(h-=i,i=n[++o]);c<h;c++){const m=a[c];u?r(s,c,l,u,m):t(s,c,l,m)}}return n[e]=s}function uo(e){return Array.isArray(e)?e[0]instanceof Ut?e:[S1,e]:[e,void 0]}function lo(e,t){return e instanceof p?e.v:Array.isArray(e)?nt(e,t):void 0}function ss(e,t,r,n){const s=r.g;e[t]=n?(i,o,a)=>s(i,o,a,n):s}function is(e,t,r,n,s){const i=r.g;let o,a;e[t]=(c,u,h)=>i(c,u,h,a||(a=ut(Kr,ss,is,n).T),o||(o=os(n)),s)}function os(e){let t=e[ns];if(t!=null)return t;const r=ut(Kr,ss,is,e);return t=r.ma?(n,s)=>co(n,s,r):(n,s)=>{for(;Yi(s)&&s.h!=4;){var i=s.l,o=r[i];if(o==null){var a=r.ba;a&&(a=a[i])&&(a=T1(a))!=null&&(o=r[i]=a)}if(o==null||!o(s,n,i)){if(o=(a=s).m,Ur(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=Wi(a.g,c);o=void 0,a=n,c&&((o=a[te]??(a[te]=new In))[i]??(o[i]=[])).push(c)}}return(n=Mr(n))&&(n.da=r.qa[ao]),!0},e[ns]=t,e[ao]=k1.bind(e),t}function k1(e,t,r,n){var s=this[Kr];const i=this[ns],o=nt(void 0,s.T),a=Mr(e);if(a){var c=!1,u=s.ba;if(u){if(s=(h,l,m)=>{if(m.length!==0)if(u[l])for(const _ of m){h=qi(_);try{c=!0,i(o,h)}finally{Xi(h)}}else n==null||n(e,l,m)},t==null)xr(a,s);else if(a!=null){const h=a[t];h&&s(a,t,h)}if(c){let h=0|e[f];if(2&h&&2048&h&&!(r!=null&&r.Ka))throw Error();const l=kt(h),m=(_,S)=>{if(Ie(e,_,l)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}S!=null&&(h=V(e,h,_,S,l)),delete a[_]};t==null?yi(o,0|o[f],((_,S)=>{m(_,S)})):m(t,Ie(o,t,l))}}}}function T1(e){const t=(e=uo(e))[0].g;if(e=e[1]){const r=os(e),n=ut(Kr,ss,is,e).T;return(s,i,o)=>t(s,i,o,n,r)}return t}function qr(e,t,r){e[t]=r.h}function Xr(e,t,r,n){let s,i;const o=r.h;e[t]=(a,c,u)=>o(a,c,u,i||(i=ut(Wr,qr,Xr,n).T),s||(s=fo(n)))}function fo(e){let t=e[oo];if(!t){const r=ut(Wr,qr,Xr,e);t=(n,s)=>po(n,s,r),e[oo]=t}return t}function po(e,t,r){yi(e,0|e[f],((n,s)=>{if(s!=null){var i=(function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=uo(c))[0].h;if(c=c[1]){const h=fo(c),l=ut(Wr,qr,Xr,c).T;c=o.ma?ho(l,h):(m,_,S)=>u(m,_,S,l,h)}else c=u;return o[a]=c}})(r,n);i?i(t,s,n):n<500||bt(En,3)}})),(e=Mr(e))&&xr(e,((n,s,i)=>{for(Nt(t,t.g.end()),n=0;n<i.length;n++)Nt(t,wn(i[n])||new Uint8Array(0))}))}const L1=ne(0);function Dt(e,t){if(Array.isArray(t)){var r=0|t[f];if(4&r)return t;for(var n=0,s=0;n<t.length;n++){const i=e(t[n]);i!=null&&(t[s++]=i)}return s<n&&(t.length=s),(e=-1537&(5|r))!==r&&j(t,e),2&e&&Object.freeze(t),t}}function J(e,t,r){return new Ut(e,t,r)}function Bt(e,t,r){return new Ut(e,t,r)}function H(e,t,r){V(e,0|e[f],t,r,kt(0|e[f]))}var P1=zr((function(e,t,r,n,s){if(e.h!==2)return!1;if(e=be(e=lr(e,nt([void 0,void 0],n),s)),s=kt(n=0|t[f]),2&n)throw Error();let i=Ie(t,r,s);if(i instanceof Oe)(2&i.J)!=0?(i=i.V(),i.push(e),V(t,n,r,i,s)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[f];8192&o||j(i,o|=8192),2&o&&(i=Di(i),V(t,n,r,i,s)),i.push(e)}else V(t,n,r,rr([e]),s);return!0}),(function(e,t,r,n,s){if(t instanceof Oe)t.forEach(((i,o)=>{Gr(e,r,nt([o,i],n),s)}));else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&Gr(e,r,nt(o,n),s)}rr(t)}}));function go(e,t,r){(t=Te(t))!=null&&(ge(e,r,5),e=e.g,Tn(t),Jn(e))}function mo(e,t,r){if(t=(function(n){if(n==null)return n;const s=typeof n;if(s==="bigint")return String(sr(64,n));if(ar(n)){if(s==="string")return Li(n);if(s==="number")return Fn(n)}})(t),t!=null&&(typeof t=="string"&&Qi(t),t!=null))switch(ge(e,r,0),typeof t){case"number":e=e.g,Tt(t),It(e,$,U);break;case"bigint":r=BigInt.asUintN(64,t),r=new Yn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),It(e.g,r.h,r.g);break;default:r=Qi(t),It(e.g,r.h,r.g)}}function yo(e,t,r){(t=Pt(t))!=null&&t!=null&&(ge(e,r,0),jr(e.g,t))}function _o(e,t,r){(t=Si(t))!=null&&(ge(e,r,0),e.g.g.push(t?1:0))}function vo(e,t,r){(t=X(t))!=null&&Vr(e,r,Qs(t))}function bo(e,t,r,n,s){Gr(e,r,lo(t,n),s)}function wo(e,t,r){(t=t==null||typeof t=="string"||t instanceof Se?t:void 0)!=null&&Vr(e,r,Wn(t,!0).buffer)}function Ao(e,t,r){return(e.h===5||e.h===2)&&(t=Mt(t,0|t[f],r),e.h==2?Dr(e,Nr,t):t.push(Nr(e.g)),!0)}var D=J((function(e,t,r){return e.h===5&&(H(t,r,Nr(e.g)),!0)}),go,Hr),C1=Bt(Ao,(function(e,t,r){if((t=Dt(Te,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(ge(n,s,5),n=n.g,Tn(i),Jn(n))}}),Hr),as=Bt(Ao,(function(e,t,r){if((t=Dt(Te,t))!=null&&t.length){ge(e,r,2),Rt(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Tn(t[n]),Jn(r)}}),Hr),$1=J((function(e,t,r){return e.h===5&&(H(t,r,(e=Nr(e.g))===0?void 0:e),!0)}),go,Hr),Ge=J((function(e,t,r){return _n?(e.h!==0?e=!1:(H(t,r,Ot(e.g,Ai)),e=!0),e):e.h===0&&(H(t,r,Ot(e.g,Pn)),!0)}),mo,ro),cs=J((function(e,t,r){return _n?(e.h!==0?t=!1:(H(t,r,(e=Ot(e.g,Ai))===L1?void 0:e),t=!0),t):e.h===0&&(H(t,r,(e=Ot(e.g,Pn))===0?void 0:e),!0)}),mo,ro),F1=J((function(e,t,r){return _n?(e.h!==0?e=!1:(H(t,r,Ot(e.g,Q2)),e=!0),e):e.h===0&&(H(t,r,Ot(e.g,Ln)),!0)}),(function(e,t,r){if(t=(function(n){if(n==null)return n;var s=typeof n;if(s==="bigint")return String(e1(64,n));if(ar(n)){if(s==="string")return s=Lt(Number(n)),rt(s)&&s>=0?n=String(s):((s=n.indexOf("."))!==-1&&(n=n.substring(0,s)),(s=n[0]!=="-"&&((s=n.length)<20||s===20&&n<="18446744073709551615"))||(Cr(n),n=nr($,U))),n;if(s==="number")return(n=Lt(n))>=0&&rt(n)||(Tt(n),n=Ln($,U)),n}})(t),t!=null&&(typeof t=="string"&&Zi(t),t!=null))switch(ge(e,r,0),typeof t){case"number":e=e.g,Tt(t),It(e,$,U);break;case"bigint":r=BigInt.asUintN(64,t),r=new Xn(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),It(e.g,r.h,r.g);break;default:r=Zi(t),It(e.g,r.h,r.g)}}),A1),z=J((function(e,t,r){return e.h===0&&(H(t,r,Ve(e.g)),!0)}),yo,rs),dr=Bt((function(e,t,r){return(e.h===0||e.h===2)&&(t=Mt(t,0|t[f],r),e.h==2?Dr(e,Ve,t):t.push(Ve(e.g)),!0)}),(function(e,t,r){if((t=Dt(Pt,t))!=null&&t.length){r=Zn(e,r);for(let n=0;n<t.length;n++)jr(e.g,t[n]);Qn(e,r)}}),rs),jt=J((function(e,t,r){return e.h===0&&(H(t,r,(e=Ve(e.g))===0?void 0:e),!0)}),yo,rs),R=J((function(e,t,r){return e.h===0&&(H(t,r,Kn(e.g)),!0)}),_o,eo),lt=J((function(e,t,r){return e.h===0&&(H(t,r,(e=Kn(e.g))===!1?void 0:e),!0)}),_o,eo),Y=Bt((function(e,t,r){return e.h===2&&(e=qn(e),Mt(t,0|t[f],r).push(e),!0)}),(function(e,t,r){if((t=Dt(X,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&Vr(n,s,Qs(i))}}),ts),He=J((function(e,t,r){return e.h===2&&(H(t,r,(e=qn(e))===""?void 0:e),!0)}),vo,ts),T=J((function(e,t,r){return e.h===2&&(H(t,r,qn(e)),!0)}),vo,ts),W=(function(e,t,r=es){return new Ut(e,t,r)})((function(e,t,r,n,s){return e.h===2&&(n=nt(void 0,n),Mt(t,0|t[f],r).push(n),lr(e,n,s),!0)}),(function(e,t,r,n,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)bo(e,t[i],r,n,s);1&(e=0|t[f])||j(t,1|e)}})),N=zr((function(e,t,r,n,s,i){if(e.h!==2)return!1;let o=0|t[f];return Bi(t,o,i,r,kt(o)),lr(e,t=Hn(t,n,r),s),!0}),bo),Eo=J((function(e,t,r){return e.h===2&&(H(t,r,Ji(e)),!0)}),wo,no),M1=Bt((function(e,t,r){return(e.h===0||e.h===2)&&(t=Mt(t,0|t[f],r),e.h==2?Dr(e,Ue,t):t.push(Ue(e.g)),!0)}),(function(e,t,r){if((t=Dt(ki,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(ge(n,s,0),Rt(n.g,i))}}),to),x1=J((function(e,t,r){return e.h===0&&(H(t,r,(e=Ue(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=ki(t))!=null&&t!=null&&(ge(e,r,0),Rt(e.g,t))}),to),ie=J((function(e,t,r){return e.h===0&&(H(t,r,Ve(e.g)),!0)}),(function(e,t,r){(t=Pt(t))!=null&&(t=parseInt(t,10),ge(e,r,0),jr(e.g,t))}),so);class O1{constructor(t,r){var n=oe;this.g=t,this.h=r,this.m=A,this.j=v,this.defaultValue=void 0,this.l=n.Oa!=null?_i:void 0}register(){Tr(this)}}function Ce(e,t){return new O1(e,t)}function ze(e,t){return(r,n)=>{{const i={ea:!0};n&&Object.assign(i,n),r=qi(r,void 0,void 0,i);try{const o=new e,a=o.v;os(t)(a,r);var s=o}finally{Xi(r)}}return s}}function Yr(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}}}};po(this.v,t,ut(Wr,qr,Xr,e)),Nt(t,t.g.end());const r=new Uint8Array(t.h),n=t.l,s=n.length;let i=0;for(let o=0;o<s;o++){const a=n[o];r.set(a,i),i+=a.length}return t.l=[r],r}}var So=class extends p{constructor(e){super(e)}},ko=[0,He,J((function(e,t,r){return e.h===2&&(H(t,r,(e=Ji(e))===Qe()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof p){const n=t.Ra;return void(n?(t=n(t),t!=null&&Vr(e,r,Wn(t,!0).buffer)):bt(En,3))}if(Array.isArray(t))return void bt(En,3)}wo(e,t,r)}),no)];let hs,To=globalThis.trustedTypes;function Lo(e){var t;return hs===void 0&&(hs=(function(){let r=null;if(!To)return r;try{const n=s=>s;r=To.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})()),e=(t=hs)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function I1(e,...t){if(t.length===0)return Lo(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return Lo(r)}var Po=[0,z,ie,R,-1,dr,ie,-1,R],R1=class extends p{constructor(e){super(e)}},Co=[0,R,T,R,ie,-1,Bt((function(e,t,r){return(e.h===0||e.h===2)&&(t=Mt(t,0|t[f],r),e.h==2?Dr(e,_1,t):t.push(Ve(e.g)),!0)}),(function(e,t,r){if((t=Dt(Pt,t))!=null&&t.length){r=Zn(e,r);for(let n=0;n<t.length;n++)jr(e.g,t[n]);Qn(e,r)}}),so),T,-1,[0,R,-1],ie,R,-1],$o=[0,3,R,-1,2,[0,z],[0,ie,R],[0,T,-1],[0]],Fo=[0,T,-2],Mo=class extends p{constructor(e){super(e)}},xo=[0],Oo=[0,z,R,1,R,-4],oe=class extends p{constructor(e){super(e,2)}},G={};G[336783863]=[0,T,R,-1,z,[0,[1,2,3,4,5,6,7,8,9],N,xo,N,Co,N,Fo,N,Oo,N,Po,N,[0,T,-2],N,[0,T,ie],N,$o,N,[0,ie,-1,R]],[0,T],R,[0,[1,3],[2,4],N,[0,dr],-1,N,[0,Y],-1,W,[0,T,-1]],T];var Io=[0,cs,-1,lt,-3,cs,dr,He,jt,cs,-1,lt,jt,lt,-2,He];function P(e,t){Rr(e,3,t)}function b(e,t){Rr(e,4,t)}var Q=class extends p{constructor(e){super(e,500)}o(e){return v(this,0,7,e)}},fr=[-1,{}],Ro=[0,T,1,fr],No=[0,T,Y,fr];function me(e,t){zn(e,1,Q,t)}function F(e,t){Rr(e,10,t)}function E(e,t){Rr(e,15,t)}var ae=class extends p{constructor(e){super(e,500)}o(e){return v(this,0,1001,e)}},Uo=[-500,W,[-500,He,-1,Y,-3,[-2,G,R],W,ko,jt,-1,Ro,No,W,[0,He,lt],He,Io,jt,Y,987,Y],4,W,[-500,T,-1,[-1,{}],998,T],W,[-500,T,Y,-1,[-2,{},R],997,Y,-1],jt,W,[-500,T,Y,fr,998,Y],Y,jt,Ro,No,W,[0,He,-1,fr],Y,-2,Io,He,-1,lt,[0,lt,x1],978,fr,W,ko];ae.prototype.g=Yr(Uo);var N1=ze(ae,Uo),U1=class extends p{constructor(e){super(e)}},Do=class extends p{constructor(e){super(e)}g(){return Re(this,U1,1)}},Bo=[0,W,[0,z,D,T,-1]],Jr=ze(Do,Bo),D1=class extends p{constructor(e){super(e)}},B1=class extends p{constructor(e){super(e)}},us=class extends p{constructor(e){super(e)}l(){return A(this,D1,2)}g(){return Re(this,B1,5)}},jo=ze(class extends p{constructor(e){super(e)}},[0,Y,dr,as,[0,ie,[0,z,-3],[0,D,-3],[0,z,-1,[0,W,[0,z,-2]]],W,[0,D,-1,T,D]],T,-1,Ge,W,[0,z,D],Y,Ge]),Vo=class extends p{constructor(e){super(e)}},Vt=ze(class extends p{constructor(e){super(e)}},[0,W,[0,D,-4]]),Go=class extends p{constructor(e){super(e)}},pr=ze(class extends p{constructor(e){super(e)}},[0,W,[0,D,-4]]),j1=class extends p{constructor(e){super(e)}},V1=[0,z,-1,as,ie],Ho=class extends p{constructor(e){super(e)}};Ho.prototype.g=Yr([0,D,-4,Ge]);var G1=class extends p{constructor(e){super(e)}},H1=ze(class extends p{constructor(e){super(e)}},[0,W,[0,1,z,T,Bo],Ge]),zo=class extends p{constructor(e){super(e)}},z1=class extends p{constructor(e){super(e)}na(){const e=L(this,1,void 0,void 0,Ui);return e??Qe()}},W1=class extends p{constructor(e){super(e)}},Wo=[1,2],K1=ze(class extends p{constructor(e){super(e)}},[0,W,[0,Wo,N,[0,as],N,[0,Eo],z,T],Ge]),ls=class extends p{constructor(e){super(e)}},Ko=[0,T,z,D,Y,-1],qo=class extends p{constructor(e){super(e)}},q1=[0,R,-1],Xo=class extends p{constructor(e){super(e)}},Zr=[1,2,3,4,5,6],Qr=class extends p{constructor(e){super(e)}g(){return L(this,1,void 0,void 0,Ui)!=null}l(){return X(L(this,2))!=null}},M=class extends p{constructor(e){super(e)}g(){return Si(L(this,2))??!1}},Yo=[0,Eo,T,[0,z,Ge,-1],[0,F1,Ge]],B=[0,Yo,R,[0,Zr,N,Oo,N,Co,N,Po,N,xo,N,Fo,N,$o],ie],en=class extends p{constructor(e){super(e)}},ds=[0,B,D,-1,z],X1=Ce(502141897,en);G[502141897]=ds;var Y1=ze(class extends p{constructor(e){super(e)}},[0,[0,ie,-1,C1,M1],V1]),Jo=class extends p{constructor(e){super(e)}},Zo=class extends p{constructor(e){super(e)}},fs=[0,B,D,[0,B],R],J1=Ce(508968150,Zo);G[508968150]=[0,B,ds,fs,D,[0,[0,Yo]]],G[508968149]=fs;var Gt=class extends p{constructor(e){super(e)}l(){return A(this,ls,2)}g(){k(this,2)}},Qo=[0,B,Ko];G[478825465]=Qo;var Z1=class extends p{constructor(e){super(e)}},ea=class extends p{constructor(e){super(e)}},ps=class extends p{constructor(e){super(e)}},gs=class extends p{constructor(e){super(e)}},ta=class extends p{constructor(e){super(e)}},ra=[0,B,[0,B],Qo,-1],na=[0,B,D,z],ms=[0,B,D],sa=[0,B,na,ms,D],Q1=Ce(479097054,ta);G[479097054]=[0,B,sa,ra],G[463370452]=ra,G[464864288]=na;var ec=Ce(462713202,gs);G[462713202]=sa,G[474472470]=ms;var tc=class extends p{constructor(e){super(e)}},ia=class extends p{constructor(e){super(e)}},oa=class extends p{constructor(e){super(e)}},aa=class extends p{constructor(e){super(e)}},ys=[0,B,D,-1,z],_s=[0,B,D,R];aa.prototype.g=Yr([0,B,ms,[0,B],ds,fs,ys,_s]);var ca=class extends p{constructor(e){super(e)}},rc=Ce(456383383,ca);G[456383383]=[0,B,Ko];var ha=class extends p{constructor(e){super(e)}},nc=Ce(476348187,ha);G[476348187]=[0,B,q1];var ua=class extends p{constructor(e){super(e)}},la=class extends p{constructor(e){super(e)}},da=[0,ie,-1],sc=Ce(458105876,class extends p{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[f];return e=re(this,r),t=(function(n,s,i,o){var a=la;!o&&$t(n)&&(i=0|(s=n.v)[f]);var c=Ie(s,2);if(n=!1,c==null){if(o)return Mi();c=[]}else if(c.constructor===Oe){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?n=!!(2&(0|c[f])):c=[];if(o){if(!c.length)return Mi();n||(n=!0,tr(c))}else n&&(n=!1,rr(c),c=Di(c));return!n&&32&i&&er(c,32),i=V(s,i,2,o=new Oe(c,a,s1,void 0)),n||st(s,i),o})(this,t,r,e),!e&&la&&(t.ra=!0),t}});G[458105876]=[0,da,P1,[!0,Ge,[0,T,-1,Y]],[0,dr,R,ie]];var vs=class extends p{constructor(e){super(e)}},fa=Ce(458105758,vs);G[458105758]=[0,B,T,da];var bs=class extends p{constructor(e){super(e)}},pa=[0,$1,-1,lt],ic=class extends p{constructor(e){super(e)}},ga=class extends p{constructor(e){super(e)}},ws=[1,2];ga.prototype.g=Yr([0,ws,N,pa,N,[0,W,pa]]);var ma=class extends p{constructor(e){super(e)}},oc=Ce(443442058,ma);G[443442058]=[0,B,T,z,D,Y,-1,R,D],G[514774813]=ys;var ya=class extends p{constructor(e){super(e)}},ac=Ce(516587230,ya);function As(e,t){return t=t?t.clone():new ls,e.displayNamesLocale!==void 0?k(t,1,cr(e.displayNamesLocale)):e.displayNamesLocale===void 0&&k(t,1),e.maxResults!==void 0?Ne(t,2,e.maxResults):"maxResults"in e&&k(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&k(t,3),e.categoryAllowlist!==void 0?Ir(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&k(t,4),e.categoryDenylist!==void 0?Ir(t,5,e.categoryDenylist):"categoryDenylist"in e&&k(t,5),t}function _a(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Es(e,t=-1,r=""){return{categories:e.map((n=>({index:pe(n,1)??0??-1,score:I(n,2)??0,categoryName:X(L(n,3))??""??"",displayName:X(L(n,4))??""??""}))),headIndex:t,headName:r}}function cc(e){const t={classifications:Re(e,G1,1).map((r=>{var n;return Es(((n=A(r,Do,4))==null?void 0:n.g())??[],pe(r,2)??0,X(L(r,3))??"")}))};return(function(r){return n1(vn?L(r,2,void 0,void 0,Fr):L(r,2))})(e)!=null&&(t.timestampMs=_a(Hi(e))),t}function va(e){var o,a;var t=ot(e,3,Te,it()),r=ot(e,2,Pt,it()),n=ot(e,1,X,it()),s=ot(e,9,X,it());const i={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)i.categories.push({score:t[c],index:r[c]??-1,categoryName:n[c]??"",displayName:s[c]??""});if((t=(o=A(e,us,4))==null?void 0:o.l())&&(i.boundingBox={originX:pe(t,1,Be)??0,originY:pe(t,2,Be)??0,width:pe(t,3,Be)??0,height:pe(t,4,Be)??0,angle:0}),(a=A(e,us,4))==null?void 0:a.g().length)for(const c of A(e,us,4).g())i.keypoints.push({x:L(c,1,void 0,Be,Te)??0,y:L(c,2,void 0,Be,Te)??0,score:L(c,4,void 0,Be,Te)??0,label:X(L(c,3,void 0,Be))??""});return i}function tn(e){const t=[];for(const r of Re(e,Go,1))t.push({x:I(r,1)??0,y:I(r,2)??0,z:I(r,3)??0,visibility:I(r,4)??0});return t}function gr(e){const t=[];for(const r of Re(e,Vo,1))t.push({x:I(r,1)??0,y:I(r,2)??0,z:I(r,3)??0,visibility:I(r,4)??0});return t}function ba(e){return Array.from(e,(t=>t>127?t-256:t))}function wa(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,s=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],n+=e[i]*e[i],s+=t[i]*t[i];if(n<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*s)}let rn;G[516587230]=[0,B,ys,_s,D],G[518928384]=_s;const hc=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 Aa(){if(rn===void 0)try{await WebAssembly.instantiate(hc),rn=!0}catch{rn=!1}return rn}async function mr(e,t=I1``){const r=await Aa()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var dt=class{};function Ea(){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 Sa(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(s=>{n(s)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function ka(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 g(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Ta(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=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&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[n,s]=ka(t);return!e.l||n===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=s),[n,s]}function La(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let s=0;s<t.length;s++)n[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(const s of n)e.i._free(s);e.i._free(t)}function $e(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function We(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,i,o)=>{i?(r(n,o),n=[]):n.push(s)}}dt.forVisionTasks=function(e){return mr("vision",e)},dt.forTextTasks=function(e){return mr("text",e)},dt.forGenAiExperimentalTasks=function(e){return mr("genai_experimental",e)},dt.forGenAiTasks=function(e){return mr("genai",e)},dt.forAudioTasks=function(e){return mr("audio",e)},dt.isSimdSupported=function(){return Aa()};async function uc(e,t,r,n){return e=await(async(s,i,o,a,c)=>{if(i&&await Sa(i),!self.ModuleFactory||o&&(await Sa(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 s(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&s.endsWith(".data")?r.assetBinaryPath.toString():s}),await e.o(n),e}function Ss(e,t){const r=A(e.baseOptions,Qr,1)||new Qr;typeof t=="string"?(k(r,2,cr(t)),k(r,1)):t instanceof Uint8Array&&(k(r,1,Sn(t,!1)),k(r,2)),v(e.baseOptions,0,1,r)}function Pa(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map((r=>r.message)).join(", "))}finally{e.H=[]}}function d(e,t){e.C=Math.max(e.C,t)}function nn(e,t){e.B=new Q,se(e.B,2,"PassThroughCalculator"),P(e.B,"free_memory"),b(e.B,"free_memory_unused_out"),F(t,"free_memory"),me(t,e.B)}function Ht(e,t){P(e.B,t),b(e.B,t+"_unused_out")}function sn(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var ks=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,n,s,i,o,a;if(t){const c=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=A(this.baseOptions,Qr,1))!=null&&s.g()||(i=A(this.baseOptions,Qr,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(a=e.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(u,h){let l=A(u.baseOptions,Xo,3);if(!l){var m=l=new Xo,_=new Mo;ur(m,4,Zr,_)}"delegate"in h&&(h.delegate==="GPU"?(h=l,m=new R1,ur(h,2,Zr,m)):(h=l,m=new Mo,ur(h,4,Zr,m))),v(u.baseOptions,0,3,l)})(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then((u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`)})).then((u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),Ss(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)Ss(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(u){const h=[];for(var l=0;;){const{done:m,value:_}=await u.read();if(m)break;h.push(_),l+=_.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(l),l=0;for(const m of h)u.set(m,l),l+=m.length;return u})(c.modelAssetBuffer).then((u=>{Ss(this,u),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=N1(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.H.push(Error(n))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Pa(this)}finishProcessing(){this.g.finishProcessing(),Pa(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ke(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}ks.prototype.close=ks.prototype.close;class lc{constructor(t,r,n,s){this.g=t,this.h=r,this.m=n,this.l=s}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,r){const n=e.g;if(r=Ke(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function $a(e,t){const r=e.g,n=Ke(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);const s=Ke(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const i=Ke(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.L),r.vertexAttribPointer(e.L,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new lc(r,n,s,i)}function Ts(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function dc(e,t,r,n){return Ts(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=$a(e,!0)),r=e.u):(e.A||(e.A=$a(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function Fa(e,t,r){return Ts(e,t),e=Ke(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,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ma(e,t,r){Ts(e,t),e.B||(e.B=Ke(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function fc(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var xa=class{H(){return`
|
|
1
|
+
(function(B,ut){typeof exports=="object"&&typeof module<"u"?ut(exports):typeof define=="function"&&define.amd?define(["exports"],ut):(B=typeof globalThis<"u"?globalThis:B||self,ut(B.SimFaceSDK={}))})(this,(function(B){"use strict";var Kc;class ut{constructor(t){this.apiUrl=t.apiUrl.replace(/\/$/,""),this.projectId=t.projectId,this.apiKey=t.apiKey}async validateAPIKey(){const t=await fetch(`${this.apiUrl}/api/v1/auth/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:this.projectId,apiKey:this.apiKey})});if(!t.ok){const n=await t.json();throw new Error(n.error||"API key validation failed")}return t.json()}async enroll(t,n){const r=new FormData;r.append("projectId",this.projectId),r.append("apiKey",this.apiKey),r.append("clientId",t),r.append("image",n,"face.jpg");const s=await fetch(`${this.apiUrl}/api/v1/enroll`,{method:"POST",body:r});if(s.status===409)return{success:!1,clientId:t,alreadyEnrolled:!0,message:"User already enrolled"};if(!s.ok){const i=await s.json();throw new Error(i.error||"Enrollment failed")}return s.json()}async verify(t,n){const r=new FormData;r.append("projectId",this.projectId),r.append("apiKey",this.apiKey),r.append("clientId",t),r.append("image",n,"face.jpg");const s=await fetch(`${this.apiUrl}/api/v1/verify`,{method:"POST",body:r});if(s.status===404)return{match:!1,score:0,threshold:0,notEnrolled:!0,message:"User not enrolled"};if(!s.ok){const i=await s.json();throw new Error(i.error||"Verification failed")}return s.json()}}var Mt=typeof self<"u"?self:{};function dn(e,t){e:{for(var n=["CLOSURE_FLAGS"],r=Mt,s=0;s<n.length;s++)if((r=r[n[s]])==null){n=null;break e}n=r}return(e=n&&n[e])!=null?e:t}function lt(){throw Error("Invalid UTF8")}function li(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let jn,Fr;const Yc=typeof TextDecoder<"u";let qc;const Qc=typeof TextEncoder<"u";function di(e){if(Qc)e=(qc||(qc=new TextEncoder)).encode(e);else{let n=0;const r=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(t<128)r[n++]=t;else{if(t<2048)r[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&s<e.length){const i=e.charCodeAt(++s);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,r[n++]=t>>18|240,r[n++]=t>>12&63|128,r[n++]=t>>6&63|128,r[n++]=63&t|128;continue}s--}t=65533}r[n++]=t>>12|224,r[n++]=t>>6&63|128}r[n++]=63&t|128}}e=n===r.length?r:r.subarray(0,n)}return e}function fi(e){Mt.setTimeout((()=>{throw e}),0)}var Or,Jc=dn(610401301,!1),pi=dn(748402147,!0),Mr=dn(824648567,!0),$r=dn(824656860,dn(1,!0));function gi(){var e=Mt.navigator;return e&&(e=e.userAgent)?e:""}const mi=Mt.navigator;function Vn(e){return Vn[" "](e),e}Or=mi&&mi.userAgentData||null,Vn[" "]=function(){};const yi={};let fn=null;function Zc(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 r=new Uint8Array(n);let s=0;return(function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),l=fn[h];if(l!=null)return l;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}_i();let c=0;for(;;){const u=a(-1),h=a(0),l=a(64),m=a(64);if(m===64&&u===-1)break;o(u<<2|h>>4),l!=64&&(o(h<<4&240|l>>2),m!=64&&o(l<<6&192|m))}})(e,(function(i){r[s++]=i})),s!==n?r.subarray(0,s):r}function _i(){if(!fn){fn={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=e.concat(t[n].split(""));yi[n]=r;for(let s=0;s<r.length;s++){const i=r[s];fn[i]===void 0&&(fn[i]=s)}}}}var e2=typeof Uint8Array<"u",vi=!(!(Jc&&Or&&Or.brands.length>0)&&(gi().indexOf("Trident")!=-1||gi().indexOf("MSIE")!=-1))&&typeof btoa=="function";const bi=/[-_.]/g,t2={"-":"+",_:"/",".":"="};function n2(e){return t2[e]||""}function wi(e){if(!vi)return Zc(e);e=bi.test(e)?e.replace(bi,n2):e,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 Ir(e){return e2&&e!=null&&e instanceof Uint8Array}var $t={};function dt(){return r2||(r2=new $e(null,$t))}function Rr(e){Ai($t);var t=e.g;return(t=t==null||Ir(t)?t:typeof t=="string"?wi(t):null)==null?t:e.g=t}var $e=class{h(){return new Uint8Array(Rr(this)||0)}constructor(t,n){if(Ai(n),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let r2,s2;function Ai(e){if(e!==$t)throw Error("illegal external caller")}function Ei(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Nr(e){return Ei(e=Error(e),"warning"),e}function It(e,t){if(e!=null){var n=s2??(s2={}),r=n[e]||0;r>=t||(n[e]=r+1,Ei(e=Error(),"incident"),fi(e))}}function Rt(){return typeof BigInt=="function"}var Nt=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Ie(e,t,n=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var i2=Ie("jas",void 0,!0),ki=Ie(void 0,"0di"),pn=Ie(void 0,"1oa"),oe=Ie(void 0,Symbol()),o2=Ie(void 0,"0ub"),a2=Ie(void 0,"0ubs"),Ur=Ie(void 0,"0ubsb"),c2=Ie(void 0,"0actk"),Ut=Ie("m_m","Pa",!0),Si=Ie();const Ti={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Li=Object.defineProperties,f=Nt?i2:"Ga";var ft;const Ci=[];function gn(e,t){Nt||f in e||Li(e,Ti),e[f]|=t}function j(e,t){Nt||f in e||Li(e,Ti),e[f]=t}function mn(e){return gn(e,34),e}function yn(e){return gn(e,8192),e}j(Ci,7),ft=Object.freeze(Ci);var Dt={};function ae(e,t){return t===void 0?e.h!==pt&&!!(2&(0|e.v[f])):!!(2&t)&&e.h!==pt}const pt={};function Dr(e,t){if(e!=null){if(typeof e=="string")e=e?new $e(e,$t):dt();else if(e.constructor!==$e)if(Ir(e))e=e.length?new $e(new Uint8Array(e),$t):dt();else{if(!t)throw Error();e=void 0}}return e}class xi{constructor(t,n,r){this.g=t,this.h=n,this.l=r}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var h2=Object.freeze({});function Pi(e,t,n){const r=128&t?0:-1,s=e.length;var i;(i=!!s)&&(i=(i=e[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(t=128&t?1:0;t<o;t++)n(t-r,e[t]);if(i){e=e[s-1];for(const a in e)!isNaN(a)&&n(+a,e[a])}}var Fi={};function Bt(e){return 128&e?Fi:void 0}function Gn(e){return e.Na=!0,e}var u2=Gn((e=>typeof e=="number")),Oi=Gn((e=>typeof e=="string")),l2=Gn((e=>typeof e=="boolean")),Hn=typeof Mt.BigInt=="function"&&typeof Mt.BigInt(0)=="bigint";function ce(e){var t=e;if(Oi(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(u2(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Hn?BigInt(e):e=l2(e)?e?"1":"0":Oi(e)?e.trim()||"0":String(e)}var Br=Gn((e=>Hn?e>=f2&&e<=g2:e[0]==="-"?Mi(e,d2):Mi(e,p2)));const d2=Number.MIN_SAFE_INTEGER.toString(),f2=Hn?BigInt(Number.MIN_SAFE_INTEGER):void 0,p2=Number.MAX_SAFE_INTEGER.toString(),g2=Hn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Mi(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 r=e[n],s=t[n];if(r>s)return!1;if(r<s)return!0}}const m2=typeof Uint8Array.prototype.slice=="function";let y2,P=0,N=0;function $i(e){const t=e>>>0;P=t,N=(e-t)/4294967296>>>0}function jt(e){if(e<0){$i(-e);const[t,n]=zr(P,N);P=t>>>0,N=n>>>0}else $i(e)}function jr(e){const t=y2||(y2=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),N=0,P=t.getUint32(0,!0)}function Vr(e,t){const n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:_n(e,t)}function _2(e,t){return ce(Rt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):_n(e,t))}function Gr(e,t){const n=2147483648&t;return n&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Vr(e,t))=="number"?n?-e:e:n?"-"+e:e}function Ii(e,t){return Rt()?ce(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ce(Hr(e,t))}function _n(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=""+(4294967296*t+e);else Rt()?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+Ri(n)+Ri(e));return n}function Ri(e){return e=String(e),"0000000".slice(e.length)+e}function Hr(e,t){if(2147483648&t)if(Rt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[n,r]=zr(e,t);e="-"+_n(n,r)}else e=_n(e,t);return e}function zn(e){if(e.length<16)jt(Number(e));else if(Rt())e=BigInt(e),P=Number(e&BigInt(4294967295))>>>0,N=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");N=P=0;const n=e.length;for(let r=t,s=(n-t)%6+t;s<=n;r=s,s+=6){const i=Number(e.slice(r,s));N*=1e6,P=1e6*P+i,P>=4294967296&&(N+=Math.trunc(P/4294967296),N>>>=0,P>>>=0)}if(t){const[r,s]=zr(P,N);P=r,N=s}}}function zr(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Ce(e){return Array.prototype.slice.call(e)}const vn=typeof BigInt=="function"?BigInt.asIntN:void 0,v2=typeof BigInt=="function"?BigInt.asUintN:void 0,gt=Number.isSafeInteger,Wn=Number.isFinite,Vt=Math.trunc,b2=ce(0);function bn(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function Re(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function wn(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function Ni(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const w2=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function An(e){switch(typeof e){case"bigint":return!0;case"number":return Wn(e);case"string":return w2.test(e);default:return!1}}function Gt(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 Ui(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 Di(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(zn(e),Hr(P,N))}function Wr(e){return e=Vt(e),gt(e)||(jt(e),e=Gr(P,N)),e}function Bi(e){var t=Vt(Number(e));return gt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Di(e))}function ji(e){var t=Vt(Number(e));return gt(t)?ce(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Rt()?ce(vn(64,BigInt(e))):ce(Di(e)))}function Vi(e){return gt(e)?e=ce(Wr(e)):(e=Vt(e),gt(e)?e=String(e):(jt(e),e=Hr(P,N)),e=ce(e)),e}function A2(e){return e==null?e:typeof e=="bigint"?(Br(e)?e=Number(e):(e=vn(64,e),e=Br(e)?Number(e):String(e)),e):An(e)?typeof e=="number"?Wr(e):Bi(e):void 0}function Kn(e){const t=typeof e;return e==null?e:t==="bigint"?ce(vn(64,e)):An(e)?t==="string"?ji(e):Vi(e):void 0}function Gi(e){if(typeof e!="string")throw Error();return e}function En(e){if(e!=null&&typeof e!="string")throw Error();return e}function q(e){return e==null||typeof e=="string"?e:void 0}function Kr(e,t,n,r){return e!=null&&e[Ut]===Dt?e:Array.isArray(e)?((r=(n=0|e[f])|32&r|2&r)!==n&&j(e,r),new t(e)):(n?2&r?((e=t[ki])||(mn((e=new t).v),e=t[ki]=e),t=e):t=new t:t=void 0,t)}function E2(e,t,n){if(t)e:{if(!An(t=e))throw Nr("int64");switch(typeof t){case"string":t=ji(t);break e;case"bigint":t=ce(vn(64,t));break e;default:t=Vi(t)}}else t=Kn(e);return(e=t)==null?n?b2:void 0:e}const k2={};let S2=(function(){try{return Vn(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class Xr{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 T2=S2?(Object.setPrototypeOf(Xr.prototype,Map.prototype),Object.defineProperties(Xr.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Xr):class extends Map{constructor(){super()}};function Hi(e){return e}function Yr(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var ze=class extends T2{constructor(e,t,n=Hi,r=Hi){super(),this.J=0|e[f],this.K=t,this.S=n,this.fa=this.K?L2:r;for(let s=0;s<e.length;s++){const i=e[s],o=n(i[0],!1,!0);let a=i[1];t?a===void 0&&(a=null):a=r(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return yn(Array.from(super.entries(),e))}clear(){Yr(this),super.clear()}delete(e){return Yr(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new xi(e,C2,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new xi(e,ze.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((n,r,s)=>{e.call(t,s.get(r),r,s)})):super.forEach(e,t)}set(e,t){return Yr(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var n=this.K;return n?((n=this.fa(t,!1,!0,n,this.ra,this.J))!==t&&super.set(e,n),n):t}}[Symbol.iterator](){return this.entries()}};function L2(e,t,n,r,s,i){return e=Kr(e,r,n,i),s&&(e=Jr(e)),e}function C2(e){return[e,this.get(e)]}let x2;function zi(){return x2||(x2=new ze(mn([]),void 0,void 0,void 0,k2))}function Xn(e){return oe?e[oe]:void 0}function Yn(e,t){for(const n in e)!isNaN(n)&&t(e,+n,e[n])}ze.prototype.toJSON=void 0;var qr=class{};const P2={Ka:!0};function F2(e,t){t<100||It(a2,1)}function qn(e,t,n,r){const s=r!==void 0;r=!!r;var i,o=oe;!s&&Nt&&o&&(i=e[o])&&Yn(i,F2),o=[];var a=e.length;let c;i=4294967295;let u=!1;const h=!!(64&t),l=h?128&t?0:-1:void 0;1&t||(c=a&&e[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!h||128&t||s||(u=!0,i=i-l+l)),t=void 0;for(var m=0;m<a;m++){let v=e[m];if(v!=null&&(v=n(v,r))!=null)if(h&&m>=i){const k=m-l;(t??(t={}))[k]=v}else o[m]=v}if(c)for(let v in c){if((a=c[v])==null||(a=n(a,r))==null)continue;let k;m=+v,h&&!Number.isNaN(m)&&(k=m+l)<i?o[k]=a:(t??(t={}))[v]=a}return t&&(u?o.push(t):o[i]=t),s&&oe&&(e=Xn(e))&&e instanceof qr&&(o[oe]=(function(v){const k=new qr;return Yn(v,((Ft,Le,Qe)=>{k[Le]=Ce(Qe)})),k.da=v.da,k})(e)),o}function O2(e){return e[0]=kn(e[0]),e[1]=kn(e[1]),e}function kn(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Br(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[f];return e.length===0&&1&t?void 0:qn(e,t,kn)}if(e!=null&&e[Ut]===Dt)return Wi(e);if(e instanceof $e){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(vi){for(var n="",r=0,s=t.length-10240;r<s;)n+=String.fromCharCode.apply(null,t.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?t.subarray(r):t),t=btoa(n)}else{n===void 0&&(n=0),_i(),n=yi[n],r=Array(Math.floor(t.length/3)),s=n[64]||"";let u=0,h=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],a=t[u+2],c=n[i>>2];i=n[(3&i)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],r[h++]=c+i+o+a}switch(c=0,a=s,t.length-u){case 2:a=n[(15&(c=t[u+1]))<<2]||s;case 1:t=t[u],r[h]=n[t>>2]+n[(3&t)<<4|c>>4]+a+s}t=r.join("")}e=e.g=t}return e}return e instanceof ze?e=e.size!==0?e.V(O2):void 0:void 0}return e}function Wi(e){return qn(e=e.v,0|e[f],kn)}let M2,$2;function mt(e,t){return Ki(e,t[0],t[1])}function Ki(e,t,n,r=0){if(e==null){var s=32;n?(e=[n],s|=128):e=[],t&&(s=-16760833&s|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(s=0|e[f],pi&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&(function(){if(pi)throw Error("carr");It(c2,5)})(),256&s)throw Error("farr");if(64&s)return(s|r)!==s&&j(e,s|r),e;if(n&&(s|=128,n!==e[0]))throw Error("mid");e:{s|=64;var i=(n=e).length;if(i){var o=i-1;const c=n[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(n[i+t]=c[a],delete c[a]);s=-16760833&s|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&a)<<14}}}return j(e,64|s|r),e}function I2(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var n=0|e[f];return e.length===0&&1&n?void 0:Xi(e,n,t)}if(e!=null&&e[Ut]===Dt)return Yi(e);if(e instanceof ze){if(2&(t=e.J))return e;if(!e.size)return;if(n=mn(e.V()),e.K)for(e=0;e<n.length;e++){const r=n[e];let s=r[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[Ut]===Dt?Yi(s):Array.isArray(s)?Xi(s,0|s[f],!!(32&t)):void 0,r[1]=s}return n}return e instanceof $e?e:void 0}function Xi(e,t,n){return 2&t||(!n||4096&t||16&t?e=Ht(e,t,!1,n&&!(16&t)):(gn(e,34),4&t&&Object.freeze(e))),e}function Qr(e,t,n){return e=new e.constructor(t),n&&(e.h=pt),e.m=pt,e}function Yi(e){const t=e.v,n=0|t[f];return ae(e,n)?e:Zr(e,t,n)?Qr(e,t):Ht(t,n)}function Ht(e,t,n,r){return r??(r=!!(34&t)),e=qn(e,t,I2,r),r=32,n&&(r|=2),j(e,t=16769217&t|r),e}function Jr(e){const t=e.v,n=0|t[f];return ae(e,n)?Zr(e,t,n)?Qr(e,t,!0):new e.constructor(Ht(t,n,!1)):e}function zt(e){if(e.h!==pt)return!1;var t=e.v;return gn(t=Ht(t,0|t[f]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Wt(e){if(!zt(e)&&ae(e,0|e.v[f]))throw Error()}function yt(e,t){t===void 0&&(t=0|e[f]),32&t&&!(4096&t)&&j(e,4096|t)}function Zr(e,t,n){return!!(2&n)||!(!(32&n)||4096&n)&&(j(t,2|n),e.h=pt,!0)}const R2=ce(0),et={};function L(e,t,n,r,s){if((t=We(e.v,t,n,s))!==null||r&&e.m!==pt)return t}function We(e,t,n,r){if(t===-1)return null;const s=t+(n?0:-1),i=e.length-1;let o,a;if(!(i<1+(n?0:-1))){if(s>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)n=o[t],a=!0;else{if(s!==i)return;n=o}else n=e[s];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return a?o[t]=r:e[s]=r,r}return n}}function S(e,t,n,r){Wt(e),V(e=e.v,0|e[f],t,n,r)}function V(e,t,n,r,s){const i=n+(s?0:-1);var o=e.length-1;if(o>=1+(s?0:-1)&&i>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[n]=r,t}return i<=o?(e[i]=r,t):(r!==void 0&&(n>=(o=(t??(t=0|e[f]))>>14&1023||536870912)?r!=null&&(e[o+(s?0:-1)]={[n]:r}):e[i]=r),t)}function _t(){return h2===void 0?2:4}function vt(e,t,n,r,s){let i=e.v,o=0|i[f];r=ae(e,o)?1:r,s=!!s||r===3,r===2&&zt(e)&&(i=e.v,o=0|i[f]);let a=(e=es(i,t))===ft?7:0|e[f],c=ts(a,o);var u=!(4&c);if(u){4&c&&(e=Ce(e),a=0,c=wt(c,o),o=V(i,o,t,e));let h=0,l=0;for(;h<e.length;h++){const m=n(e[h]);m!=null&&(e[l++]=m)}l<h&&(e.length=l),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==a&&(j(e,c),2&c&&Object.freeze(e)),qi(e,c,i,o,t,r,u,s)}function qi(e,t,n,r,s,i,o,a){let c=t;return i===1||i===4&&(2&t||!(16&t)&&32&r)?bt(t)||((t|=!e.length||o&&!(4096&t)||32&r&&!(4096&t||16&t)?2:256)!==c&&j(e,t),Object.freeze(e)):(i===2&&bt(t)&&(e=Ce(e),c=0,t=wt(t,r),r=V(n,r,s,e)),bt(t)||(a||(t|=16),t!==c&&j(e,t))),2&t||!(4096&t||16&t)||yt(n,r),e}function es(e,t,n){return e=We(e,t,n),Array.isArray(e)?e:ft}function ts(e,t){return 2&t&&(e|=2),1|e}function bt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function Qi(e){return Dr(e,!0)}function Ji(e){e=Ce(e);for(let t=0;t<e.length;t++){const n=e[t]=Ce(e[t]);Array.isArray(n[1])&&(n[1]=mn(n[1]))}return yn(e)}function tt(e,t,n,r){Wt(e),V(e=e.v,0|e[f],t,(r==="0"?Number(n)===0:n===r)?void 0:n)}function Kt(e,t,n){if(2&t)throw Error();const r=Bt(t);let s=es(e,n,r),i=s===ft?7:0|s[f],o=ts(i,t);return(2&o||bt(o)||16&o)&&(o===i||bt(o)||j(s,o),s=Ce(s),i=0,o=wt(o,t),V(e,t,n,s,r)),o&=-13,o!==i&&j(s,o),s}function ns(e,t){var n=ia;return ss(rs(e=e.v),e,void 0,n)===t?t:-1}function rs(e){if(Nt)return e[pn]??(e[pn]=new Map);if(pn in e)return e[pn];const t=new Map;return Object.defineProperty(e,pn,{value:t}),t}function Zi(e,t,n,r,s){const i=rs(e),o=ss(i,e,t,n,s);return o!==r&&(o&&(t=V(e,t,o,void 0,s)),i.set(n,r)),t}function ss(e,t,n,r,s){let i=e.get(r);if(i!=null)return i;i=0;for(let o=0;o<r.length;o++){const a=r[o];We(t,a,s)!=null&&(i!==0&&(n=V(t,n,i,void 0,s)),i=a)}return e.set(r,i),i}function is(e,t,n){let r=0|e[f];const s=Bt(r),i=We(e,n,s);let o;if(i!=null&&i[Ut]===Dt){if(!ae(i))return zt(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[f];2&a&&(o=Ht(o,a))}return o=mt(o,t),o!==i&&V(e,r,n,o,s),o}function eo(e,t,n,r,s){let i=!1;if((r=We(e,r,s,(o=>{const a=Kr(o,n,!1,t);return i=a!==o&&a!=null,a})))!=null)return i&&!ae(r)&&yt(e,t),r}function A(e,t,n,r){let s=e.v,i=0|s[f];if((t=eo(s,i,t,n,r))==null)return t;if(i=0|s[f],!ae(e,i)){const o=Jr(t);o!==t&&(zt(e)&&(s=e.v,i=0|s[f]),i=V(s,i,n,t=o,r),yt(s,i))}return t}function to(e,t,n,r,s,i,o,a){var c=ae(e,n);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&zt(e)&&(n=0|(t=e.v)[f]);var u=(e=es(t,s))===ft?7:0|e[f],h=ts(u,n);if(a=!(4&h)){var l=e,m=n;const v=!!(2&h);v&&(m|=2);let k=!v,Ft=!0,Le=0,Qe=0;for(;Le<l.length;Le++){const Bn=Kr(l[Le],r,!1,m);if(Bn instanceof r){if(!v){const Ge=ae(Bn);k&&(k=!Ge),Ft&&(Ft=Ge)}l[Qe++]=Bn}}Qe<Le&&(l.length=Qe),h|=4,h=Ft?-4097&h:4096|h,h=k?8|h:-9&h}if(h!==u&&(j(e,h),2&h&&Object.freeze(e)),c&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&n)))){for(bt(h)&&(e=Ce(e),h=wt(h,n),n=V(t,n,s,e)),r=e,c=h,u=0;u<r.length;u++)(l=r[u])!==(h=Jr(l))&&(r[u]=h);c|=8,j(e,h=c=r.length?4096|c:-4097&c)}return qi(e,h,t,n,s,i,a,o)}function Ke(e,t,n){const r=e.v;return to(e,r,0|r[f],t,n,_t(),!1,!0)}function no(e){return e==null&&(e=void 0),e}function _(e,t,n,r,s){return S(e,n,r=no(r),s),r&&!ae(r)&&yt(e.v),e}function Sn(e,t,n,r){e:{var s=r=no(r);Wt(e);const i=e.v;let o=0|i[f];if(s==null){const a=rs(i);if(ss(a,i,o,n)!==t)break e;a.set(n,0)}else o=Zi(i,o,n,t);V(i,o,t,s)}r&&!ae(r)&&yt(e.v)}function wt(e,t){return-273&(2&t?2|e:-3&e)}function os(e,t,n,r){var s=r;Wt(e),e=to(e,r=e.v,0|r[f],n,t,2,!0),s=s??new n,e.push(s),t=n=e===ft?7:0|e[f],(s=ae(s))?(n&=-9,e.length===1&&(n&=-4097)):n|=4096,n!==t&&j(e,n),s||yt(r)}function Ae(e,t,n){return Gt(L(e,t,void 0,n))}function ro(e){return($r?L(e,2,void 0,void 0,Kn):Kn(L(e,2)))??R2}function $(e,t){return L(e,t,void 0,void 0,Re)??0}function Xe(e,t,n){if(n!=null){if(typeof n!="number"||!Wn(n))throw Nr("int32");n|=0}S(e,t,n)}function y(e,t,n){S(e,t,bn(n))}function he(e,t,n){tt(e,t,En(n),"")}function Qn(e,t,n){{Wt(e);const o=e.v;let a=0|o[f];if(n==null)V(o,a,t);else{var r=e=n===ft?7:0|n[f],s=bt(e),i=s||Object.isFrozen(n);for(s||(e=0),i||(n=Ce(n),r=0,e=wt(e,a),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??($r?1024:0),s=0;s<n.length;s++){const c=n[s],u=Gi(c);Object.is(c,u)||(i&&(n=Ce(n),r=0,e=wt(e,a),i=!1),n[s]=u)}e!==r&&(i&&(n=Ce(n),e=wt(e,a)),j(n,e)),V(o,a,t,n)}}}function Jn(e,t,n){Wt(e),vt(e,t,q,2,!0).push(Gi(n))}var Xt=class{constructor(e,t,n){if(this.buffer=e,n&&!t)throw Error();this.g=t}};function as(e,t){if(typeof e=="string")return new Xt(wi(e),t);if(Array.isArray(e))return new Xt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new Xt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new Xt(e,!1);if(e.constructor===$e)return t=Rr(e)||new Uint8Array(0),new Xt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Xt(e,!1);throw Error()}function Yt(e,t){let n,r=0,s=0,i=0;const o=e.h;let a=e.g;do n=o[a++],r|=(127&n)<<i,i+=7;while(i<32&&128&n);if(i>32)for(s|=(127&n)>>4,i=3;i<32&&128&n;i+=7)n=o[a++],s|=(127&n)<<i;if(At(e,a),!(128&n))return t(r>>>0,s>>>0);throw Error()}function cs(e){let t=0,n=e.g;const r=n+10,s=e.h;for(;n<r;){const i=s[n++];if(t|=i,(128&i)==0)return At(e,n),!!(127&t)}throw Error()}function nt(e){const t=e.h;let n=e.g,r=t[n++],s=127&r;if(128&r&&(r=t[n++],s|=(127&r)<<7,128&r&&(r=t[n++],s|=(127&r)<<14,128&r&&(r=t[n++],s|=(127&r)<<21,128&r&&(r=t[n++],s|=r<<28,128&r&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw Error();return At(e,n),s}function Ye(e){return nt(e)>>>0}function Zn(e){var t=e.h;const n=e.g;var r=t[n],s=t[n+1];const i=t[n+2];return t=t[n+3],At(e,e.g+4),e=2*((s=(r<<0|s<<8|i<<16|t<<24)>>>0)>>31)+1,r=s>>>23&255,s&=8388607,r==255?s?NaN:e*(1/0):r==0?1401298464324817e-60*e*s:e*Math.pow(2,r-150)*(s+8388608)}function N2(e){return nt(e)}function At(e,t){if(e.g=t,t>e.l)throw Error()}function so(e,t){if(t<0)throw Error();const n=e.g;if((t=n+t)>e.l)throw Error();return e.g=t,n}function io(e,t){if(t==0)return dt();var n=so(e,t);return e.Y&&e.j?n=e.h.subarray(n,n+t):(e=e.h,n=n===(t=n+t)?new Uint8Array(0):m2?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?dt():new $e(n,$t)}var oo=[];function ao(e,t,n,r){if(nr.length){const s=nr.pop();return s.o(r),s.g.init(e,t,n,r),s}return new U2(e,t,n,r)}function co(e){e.g.clear(),e.l=-1,e.h=-1,nr.length<100&&nr.push(e)}function ho(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=Ye(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function er(e){switch(e.h){case 0:e.h!=0?er(e):cs(e.g);break;case 1:At(e=e.g,e.g+8);break;case 2:if(e.h!=2)er(e);else{var t=Ye(e.g);At(e=e.g,e.g+t)}break;case 5:At(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!ho(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}er(e)}break;default:throw Error()}}function Tn(e,t,n){const r=e.g.l;var s=Ye(e.g);let i=(s=e.g.g+s)-r;if(i<=0&&(e.g.l=s,n(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error();return e.g.g=s,e.g.l=r,t}function hs(e){var t=Ye(e.g),n=so(e=e.g,t);if(e=e.h,Yc){var r,s=e;(r=Fr)||(r=Fr=new TextDecoder("utf-8",{fatal:!0})),t=n+t,s=n===0&&t===s.length?s:s.subarray(n,t);try{var i=r.decode(s)}catch(a){if(jn===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),jn=!0}catch{jn=!1}}throw!jn&&(Fr=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?lt():(a=e[i++],o<194||(192&a)!=128?(i--,lt()):n.push((31&o)<<6|63&a)):o<240?i>=t-1?lt():(a=e[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(r=e[i++]))!=128?(i--,lt()):n.push((15&o)<<12|(63&a)<<6|63&r)):o<=244?i>=t-2?lt():(a=e[i++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(r=e[i++]))!=128||(192&(s=e[i++]))!=128?(i--,lt()):(o=(7&o)<<18|(63&a)<<12|(63&r)<<6|63&s,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):lt(),n.length>=8192&&(c=li(c,n),n.length=0)}i=li(c,n)}return i}function uo(e){const t=Ye(e.g);return io(e.g,t)}function tr(e,t,n){var r=Ye(e.g);for(r=e.g.g+r;e.g.g<r;)n.push(t(e.g))}var U2=class{constructor(e,t,n,r){if(oo.length){const s=oo.pop();s.init(e,t,n,r),e=s}else e=new class{constructor(s,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,a)}init(s,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,s&&(s=as(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,n,r);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:e=!1}={}){this.ha=e}},nr=[];function lo(e){return e?/^\d+$/.test(e)?(zn(e),new us(P,N)):null:D2||(D2=new us(0,0))}var us=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let D2;function fo(e){return e?/^-?\d+$/.test(e)?(zn(e),new ls(P,N)):null:B2||(B2=new ls(0,0))}var ls=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let B2;function qt(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 Qt(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function rr(e,t){if(t>=0)Qt(e,t);else{for(let n=0;n<9;n++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ds(e){var t=P;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 Jt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ee(e,t,n){Qt(e.g,8*t+n)}function fs(e,t){return Ee(e,t,2),t=e.g.end(),Jt(e,t),t.push(e.h),t}function ps(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 sr(e,t,n){Ee(e,t,2),Qt(e.g,n.length),Jt(e,e.g.end()),Jt(e,n)}function ir(e,t,n,r){n!=null&&(t=fs(e,t),r(n,e),ps(e,t))}function Ne(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var gs=Ne(),po=Ne(),ms=Ne(),ys=Ne(),go=Ne(),mo=Ne(),j2=Ne(),or=Ne(),yo=Ne(),_o=Ne();function Ue(e,t,n){var r=e.v;oe&&oe in r&&(r=r[oe])&&delete r[t.g],t.h?t.j(e,t.h,t.g,n,t.l):t.j(e,t.g,n,t.l)}var p=class{constructor(e,t){this.v=Ki(e,t,void 0,2048)}toJSON(){return Wi(this)}j(){var s;var e=E1,t=this.v,n=e.g,r=oe;if(Nt&&r&&((s=t[r])==null?void 0:s[n])!=null&&It(o2,3),t=e.g,Si&&oe&&Si===void 0&&(r=(n=this.v)[oe])&&(r=r.da))try{r(n,t,P2)}catch(i){fi(i)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[f];return Zr(this,e,t)?Qr(this,e,!0):new this.constructor(Ht(e,t,!1))}};p.prototype[Ut]=Dt,p.prototype.toString=function(){return this.v.toString()};var Zt=class{constructor(e,t,n){this.g=e,this.h=t,e=gs,this.l=!!e&&n===e||!1}};function ar(e,t){return new Zt(e,t,gs)}function vo(e,t,n,r,s){ir(e,n,So(t,r),s)}const V2=ar((function(e,t,n,r,s){return e.h===2&&(Tn(e,is(t,r,n),s),!0)}),vo),G2=ar((function(e,t,n,r,s){return e.h===2&&(Tn(e,is(t,r,n),s),!0)}),vo);var cr=Symbol(),hr=Symbol(),_s=Symbol(),bo=Symbol(),wo=Symbol();let Ao,Eo;function Et(e,t,n,r){var s=r[e];if(s)return s;(s={}).qa=r,s.T=(function(l){switch(typeof l){case"boolean":return M2||(M2=[0,void 0,!0]);case"number":return l>0?void 0:l===0?$2||($2=[0,void 0]):[-l,void 0];case"string":return[0,l];case"object":return l}})(r[0]);var i=r[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=r[++o])=="function"&&(s.ma=!0,Ao??(Ao=i),Eo??(Eo=r[o+1]),i=r[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=r[++o]}for(c=1;i!==void 0;){let l;typeof i=="number"&&(c+=i,i=r[++o]);var u=void 0;if(i instanceof Zt?l=i:(l=V2,o--),l==null?void 0:l.l){i=r[++o],u=r;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=r[++o])=="number"&&i<0&&(h-=i,i=r[++o]);c<h;c++){const m=a[c];u?n(s,c,l,u,m):t(s,c,l,m)}}return r[e]=s}function ko(e){return Array.isArray(e)?e[0]instanceof Zt?e:[G2,e]:[e,void 0]}function So(e,t){return e instanceof p?e.v:Array.isArray(e)?mt(e,t):void 0}function vs(e,t,n,r){const s=n.g;e[t]=r?(i,o,a)=>s(i,o,a,r):s}function bs(e,t,n,r,s){const i=n.g;let o,a;e[t]=(c,u,h)=>i(c,u,h,a||(a=Et(hr,vs,bs,r).T),o||(o=ws(r)),s)}function ws(e){let t=e[_s];if(t!=null)return t;const n=Et(hr,vs,bs,e);return t=n.ma?(r,s)=>Ao(r,s,n):(r,s)=>{for(;ho(s)&&s.h!=4;){var i=s.l,o=n[i];if(o==null){var a=n.ba;a&&(a=a[i])&&(a=z2(a))!=null&&(o=n[i]=a)}if(o==null||!o(s,r,i)){if(o=(a=s).m,er(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=io(a.g,c);o=void 0,a=r,c&&((o=a[oe]??(a[oe]=new qr))[i]??(o[i]=[])).push(c)}}return(r=Xn(r))&&(r.da=n.qa[wo]),!0},e[_s]=t,e[wo]=H2.bind(e),t}function H2(e,t,n,r){var s=this[hr];const i=this[_s],o=mt(void 0,s.T),a=Xn(e);if(a){var c=!1,u=s.ba;if(u){if(s=(h,l,m)=>{if(m.length!==0)if(u[l])for(const v of m){h=ao(v);try{c=!0,i(o,h)}finally{co(h)}}else r==null||r(e,l,m)},t==null)Yn(a,s);else if(a!=null){const h=a[t];h&&s(a,t,h)}if(c){let h=0|e[f];if(2&h&&2048&h&&!(n!=null&&n.Ka))throw Error();const l=Bt(h),m=(v,k)=>{if(We(e,v,l)!=null){if((n==null?void 0:n.Qa)===1)return;throw Error()}k!=null&&(h=V(e,h,v,k,l)),delete a[v]};t==null?Pi(o,0|o[f],((v,k)=>{m(v,k)})):m(t,We(o,t,l))}}}}function z2(e){const t=(e=ko(e))[0].g;if(e=e[1]){const n=ws(e),r=Et(hr,vs,bs,e).T;return(s,i,o)=>t(s,i,o,r,n)}return t}function ur(e,t,n){e[t]=n.h}function lr(e,t,n,r){let s,i;const o=n.h;e[t]=(a,c,u)=>o(a,c,u,i||(i=Et(cr,ur,lr,r).T),s||(s=To(r)))}function To(e){let t=e[bo];if(!t){const n=Et(cr,ur,lr,e);t=(r,s)=>Lo(r,s,n),e[bo]=t}return t}function Lo(e,t,n){Pi(e,0|e[f],((r,s)=>{if(s!=null){var i=(function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=ko(c))[0].h;if(c=c[1]){const h=To(c),l=Et(cr,ur,lr,c).T;c=o.ma?Eo(l,h):(m,v,k)=>u(m,v,k,l,h)}else c=u;return o[a]=c}})(n,r);i?i(t,s,r):r<500||It(Ur,3)}})),(e=Xn(e))&&Yn(e,((r,s,i)=>{for(Jt(t,t.g.end()),r=0;r<i.length;r++)Jt(t,Rr(i[r])||new Uint8Array(0))}))}const W2=ce(0);function en(e,t){if(Array.isArray(t)){var n=0|t[f];if(4&n)return t;for(var r=0,s=0;r<t.length;r++){const i=e(t[r]);i!=null&&(t[s++]=i)}return s<r&&(t.length=s),(e=-1537&(5|n))!==n&&j(t,e),2&e&&Object.freeze(t),t}}function ee(e,t,n){return new Zt(e,t,n)}function tn(e,t,n){return new Zt(e,t,n)}function z(e,t,n){V(e,0|e[f],t,n,Bt(0|e[f]))}var K2=ar((function(e,t,n,r,s){if(e.h!==2)return!1;if(e=Ce(e=Tn(e,mt([void 0,void 0],r),s)),s=Bt(r=0|t[f]),2&r)throw Error();let i=We(t,n,s);if(i instanceof ze)(2&i.J)!=0?(i=i.V(),i.push(e),V(t,r,n,i,s)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[f];8192&o||j(i,o|=8192),2&o&&(i=Ji(i),V(t,r,n,i,s)),i.push(e)}else V(t,r,n,yn([e]),s);return!0}),(function(e,t,n,r,s){if(t instanceof ze)t.forEach(((i,o)=>{ir(e,n,mt([o,i],r),s)}));else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&ir(e,n,mt(o,r),s)}yn(t)}}));function Co(e,t,n){(t=Re(t))!=null&&(Ee(e,n,5),e=e.g,jr(t),ds(e))}function xo(e,t,n){if(t=(function(r){if(r==null)return r;const s=typeof r;if(s==="bigint")return String(vn(64,r));if(An(r)){if(s==="string")return Bi(r);if(s==="number")return Wr(r)}})(t),t!=null&&(typeof t=="string"&&fo(t),t!=null))switch(Ee(e,n,0),typeof t){case"number":e=e.g,jt(t),qt(e,P,N);break;case"bigint":n=BigInt.asUintN(64,t),n=new ls(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),qt(e.g,n.h,n.g);break;default:n=fo(t),qt(e.g,n.h,n.g)}}function Po(e,t,n){(t=Gt(t))!=null&&t!=null&&(Ee(e,n,0),rr(e.g,t))}function Fo(e,t,n){(t=Ni(t))!=null&&(Ee(e,n,0),e.g.g.push(t?1:0))}function Oo(e,t,n){(t=q(t))!=null&&sr(e,n,di(t))}function Mo(e,t,n,r,s){ir(e,n,So(t,r),s)}function $o(e,t,n){(t=t==null||typeof t=="string"||t instanceof $e?t:void 0)!=null&&sr(e,n,as(t,!0).buffer)}function Io(e,t,n){return(e.h===5||e.h===2)&&(t=Kt(t,0|t[f],n),e.h==2?tr(e,Zn,t):t.push(Zn(e.g)),!0)}var U=ee((function(e,t,n){return e.h===5&&(z(t,n,Zn(e.g)),!0)}),Co,or),X2=tn(Io,(function(e,t,n){if((t=en(Re,t))!=null)for(let o=0;o<t.length;o++){var r=e,s=n,i=t[o];i!=null&&(Ee(r,s,5),r=r.g,jr(i),ds(r))}}),or),As=tn(Io,(function(e,t,n){if((t=en(Re,t))!=null&&t.length){Ee(e,n,2),Qt(e.g,4*t.length);for(let r=0;r<t.length;r++)n=e.g,jr(t[r]),ds(n)}}),or),Y2=ee((function(e,t,n){return e.h===5&&(z(t,n,(e=Zn(e.g))===0?void 0:e),!0)}),Co,or),rt=ee((function(e,t,n){return Mr?(e.h!==0?e=!1:(z(t,n,Yt(e.g,Ii)),e=!0),e):e.h===0&&(z(t,n,Yt(e.g,Gr)),!0)}),xo,mo),Es=ee((function(e,t,n){return Mr?(e.h!==0?t=!1:(z(t,n,(e=Yt(e.g,Ii))===W2?void 0:e),t=!0),t):e.h===0&&(z(t,n,(e=Yt(e.g,Gr))===0?void 0:e),!0)}),xo,mo),q2=ee((function(e,t,n){return Mr?(e.h!==0?e=!1:(z(t,n,Yt(e.g,_2)),e=!0),e):e.h===0&&(z(t,n,Yt(e.g,Vr)),!0)}),(function(e,t,n){if(t=(function(r){if(r==null)return r;var s=typeof r;if(s==="bigint")return String(v2(64,r));if(An(r)){if(s==="string")return s=Vt(Number(r)),gt(s)&&s>=0?r=String(s):((s=r.indexOf("."))!==-1&&(r=r.substring(0,s)),(s=r[0]!=="-"&&((s=r.length)<20||s===20&&r<="18446744073709551615"))||(zn(r),r=_n(P,N))),r;if(s==="number")return(r=Vt(r))>=0&>(r)||(jt(r),r=Vr(P,N)),r}})(t),t!=null&&(typeof t=="string"&&lo(t),t!=null))switch(Ee(e,n,0),typeof t){case"number":e=e.g,jt(t),qt(e,P,N);break;case"bigint":n=BigInt.asUintN(64,t),n=new us(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),qt(e.g,n.h,n.g);break;default:n=lo(t),qt(e.g,n.h,n.g)}}),j2),W=ee((function(e,t,n){return e.h===0&&(z(t,n,nt(e.g)),!0)}),Po,ys),Ln=tn((function(e,t,n){return(e.h===0||e.h===2)&&(t=Kt(t,0|t[f],n),e.h==2?tr(e,nt,t):t.push(nt(e.g)),!0)}),(function(e,t,n){if((t=en(Gt,t))!=null&&t.length){n=fs(e,n);for(let r=0;r<t.length;r++)rr(e.g,t[r]);ps(e,n)}}),ys),nn=ee((function(e,t,n){return e.h===0&&(z(t,n,(e=nt(e.g))===0?void 0:e),!0)}),Po,ys),I=ee((function(e,t,n){return e.h===0&&(z(t,n,cs(e.g)),!0)}),Fo,po),kt=ee((function(e,t,n){return e.h===0&&(z(t,n,(e=cs(e.g))===!1?void 0:e),!0)}),Fo,po),Q=tn((function(e,t,n){return e.h===2&&(e=hs(e),Kt(t,0|t[f],n).push(e),!0)}),(function(e,t,n){if((t=en(q,t))!=null)for(let o=0;o<t.length;o++){var r=e,s=n,i=t[o];i!=null&&sr(r,s,di(i))}}),ms),st=ee((function(e,t,n){return e.h===2&&(z(t,n,(e=hs(e))===""?void 0:e),!0)}),Oo,ms),T=ee((function(e,t,n){return e.h===2&&(z(t,n,hs(e)),!0)}),Oo,ms),K=(function(e,t,n=gs){return new Zt(e,t,n)})((function(e,t,n,r,s){return e.h===2&&(r=mt(void 0,r),Kt(t,0|t[f],n).push(r),Tn(e,r,s),!0)}),(function(e,t,n,r,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)Mo(e,t[i],n,r,s);1&(e=0|t[f])||j(t,1|e)}})),R=ar((function(e,t,n,r,s,i){if(e.h!==2)return!1;let o=0|t[f];return Zi(t,o,i,n,Bt(o)),Tn(e,t=is(t,r,n),s),!0}),Mo),Ro=ee((function(e,t,n){return e.h===2&&(z(t,n,uo(e)),!0)}),$o,yo),Q2=tn((function(e,t,n){return(e.h===0||e.h===2)&&(t=Kt(t,0|t[f],n),e.h==2?tr(e,Ye,t):t.push(Ye(e.g)),!0)}),(function(e,t,n){if((t=en(Ui,t))!=null)for(let o=0;o<t.length;o++){var r=e,s=n,i=t[o];i!=null&&(Ee(r,s,0),Qt(r.g,i))}}),go),J2=ee((function(e,t,n){return e.h===0&&(z(t,n,(e=Ye(e.g))===0?void 0:e),!0)}),(function(e,t,n){(t=Ui(t))!=null&&t!=null&&(Ee(e,n,0),Qt(e.g,t))}),go),ue=ee((function(e,t,n){return e.h===0&&(z(t,n,nt(e.g)),!0)}),(function(e,t,n){(t=Gt(t))!=null&&(t=parseInt(t,10),Ee(e,n,0),rr(e.g,t))}),_o);class Z2{constructor(t,n){var r=le;this.g=t,this.h=n,this.m=A,this.j=_,this.defaultValue=void 0,this.l=r.Oa!=null?Fi:void 0}register(){Vn(this)}}function De(e,t){return new Z2(e,t)}function it(e,t){return(n,r)=>{{const i={ea:!0};r&&Object.assign(i,r),n=ao(n,void 0,void 0,i);try{const o=new e,a=o.v;ws(t)(a,n);var s=o}finally{co(n)}}return s}}function dr(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}}}};Lo(this.v,t,Et(cr,ur,lr,e)),Jt(t,t.g.end());const n=new Uint8Array(t.h),r=t.l,s=r.length;let i=0;for(let o=0;o<s;o++){const a=r[o];n.set(a,i),i+=a.length}return t.l=[n],n}}var No=class extends p{constructor(e){super(e)}},Uo=[0,st,ee((function(e,t,n){return e.h===2&&(z(t,n,(e=uo(e))===dt()?void 0:e),!0)}),(function(e,t,n){if(t!=null){if(t instanceof p){const r=t.Ra;return void(r?(t=r(t),t!=null&&sr(e,n,as(t,!0).buffer)):It(Ur,3))}if(Array.isArray(t))return void It(Ur,3)}$o(e,t,n)}),yo)];let ks,Do=globalThis.trustedTypes;function Bo(e){var t;return ks===void 0&&(ks=(function(){let n=null;if(!Do)return n;try{const r=s=>s;n=Do.createPolicy("goog#html",{createHTML:r,createScript:r,createScriptURL:r})}catch{}return n})()),e=(t=ks)?t.createScriptURL(e):e,new class{constructor(n){this.g=n}toString(){return this.g+""}}(e)}function e1(e,...t){if(t.length===0)return Bo(e[0]);let n=e[0];for(let r=0;r<t.length;r++)n+=encodeURIComponent(t[r])+e[r+1];return Bo(n)}var jo=[0,W,ue,I,-1,Ln,ue,-1,I],t1=class extends p{constructor(e){super(e)}},Vo=[0,I,T,I,ue,-1,tn((function(e,t,n){return(e.h===0||e.h===2)&&(t=Kt(t,0|t[f],n),e.h==2?tr(e,N2,t):t.push(nt(e.g)),!0)}),(function(e,t,n){if((t=en(Gt,t))!=null&&t.length){n=fs(e,n);for(let r=0;r<t.length;r++)rr(e.g,t[r]);ps(e,n)}}),_o),T,-1,[0,I,-1],ue,I,-1],Go=[0,3,I,-1,2,[0,W],[0,ue,I],[0,T,-1],[0]],Ho=[0,T,-2],zo=class extends p{constructor(e){super(e)}},Wo=[0],Ko=[0,W,I,1,I,-4],le=class extends p{constructor(e){super(e,2)}},G={};G[336783863]=[0,T,I,-1,W,[0,[1,2,3,4,5,6,7,8,9],R,Wo,R,Vo,R,Ho,R,Ko,R,jo,R,[0,T,-2],R,[0,T,ue],R,Go,R,[0,ue,-1,I]],[0,T],I,[0,[1,3],[2,4],R,[0,Ln],-1,R,[0,Q],-1,K,[0,T,-1]],T];var Xo=[0,Es,-1,kt,-3,Es,Ln,st,nn,Es,-1,kt,nn,kt,-2,st];function C(e,t){Jn(e,3,t)}function b(e,t){Jn(e,4,t)}var ne=class extends p{constructor(e){super(e,500)}o(e){return _(this,0,7,e)}},Cn=[-1,{}],Yo=[0,T,1,Cn],qo=[0,T,Q,Cn];function ke(e,t){os(e,1,ne,t)}function F(e,t){Jn(e,10,t)}function E(e,t){Jn(e,15,t)}var de=class extends p{constructor(e){super(e,500)}o(e){return _(this,0,1001,e)}},Qo=[-500,K,[-500,st,-1,Q,-3,[-2,G,I],K,Uo,nn,-1,Yo,qo,K,[0,st,kt],st,Xo,nn,Q,987,Q],4,K,[-500,T,-1,[-1,{}],998,T],K,[-500,T,Q,-1,[-2,{},I],997,Q,-1],nn,K,[-500,T,Q,Cn,998,Q],Q,nn,Yo,qo,K,[0,st,-1,Cn],Q,-2,Xo,st,-1,kt,[0,kt,J2],978,Cn,K,Uo];de.prototype.g=dr(Qo);var n1=it(de,Qo),r1=class extends p{constructor(e){super(e)}},Jo=class extends p{constructor(e){super(e)}g(){return Ke(this,r1,1)}},Zo=[0,K,[0,W,U,T,-1]],fr=it(Jo,Zo),s1=class extends p{constructor(e){super(e)}},i1=class extends p{constructor(e){super(e)}},Ss=class extends p{constructor(e){super(e)}l(){return A(this,s1,2)}g(){return Ke(this,i1,5)}},ea=it(class extends p{constructor(e){super(e)}},[0,Q,Ln,As,[0,ue,[0,W,-3],[0,U,-3],[0,W,-1,[0,K,[0,W,-2]]],K,[0,U,-1,T,U]],T,-1,rt,K,[0,W,U],Q,rt]),ta=class extends p{constructor(e){super(e)}},rn=it(class extends p{constructor(e){super(e)}},[0,K,[0,U,-4]]),na=class extends p{constructor(e){super(e)}},xn=it(class extends p{constructor(e){super(e)}},[0,K,[0,U,-4]]),o1=class extends p{constructor(e){super(e)}},a1=[0,W,-1,As,ue],ra=class extends p{constructor(e){super(e)}};ra.prototype.g=dr([0,U,-4,rt]);var c1=class extends p{constructor(e){super(e)}},h1=it(class extends p{constructor(e){super(e)}},[0,K,[0,1,W,T,Zo],rt]),sa=class extends p{constructor(e){super(e)}},u1=class extends p{constructor(e){super(e)}na(){const e=L(this,1,void 0,void 0,Qi);return e??dt()}},l1=class extends p{constructor(e){super(e)}},ia=[1,2],d1=it(class extends p{constructor(e){super(e)}},[0,K,[0,ia,R,[0,As],R,[0,Ro],W,T],rt]),Ts=class extends p{constructor(e){super(e)}},oa=[0,T,W,U,Q,-1],aa=class extends p{constructor(e){super(e)}},f1=[0,I,-1],ca=class extends p{constructor(e){super(e)}},pr=[1,2,3,4,5,6],gr=class extends p{constructor(e){super(e)}g(){return L(this,1,void 0,void 0,Qi)!=null}l(){return q(L(this,2))!=null}},O=class extends p{constructor(e){super(e)}g(){return Ni(L(this,2))??!1}},ha=[0,Ro,T,[0,W,rt,-1],[0,q2,rt]],D=[0,ha,I,[0,pr,R,Ko,R,Vo,R,jo,R,Wo,R,Ho,R,Go],ue],mr=class extends p{constructor(e){super(e)}},Ls=[0,D,U,-1,W],p1=De(502141897,mr);G[502141897]=Ls;var g1=it(class extends p{constructor(e){super(e)}},[0,[0,ue,-1,X2,Q2],a1]),ua=class extends p{constructor(e){super(e)}},la=class extends p{constructor(e){super(e)}},Cs=[0,D,U,[0,D],I],m1=De(508968150,la);G[508968150]=[0,D,Ls,Cs,U,[0,[0,ha]]],G[508968149]=Cs;var sn=class extends p{constructor(e){super(e)}l(){return A(this,Ts,2)}g(){S(this,2)}},da=[0,D,oa];G[478825465]=da;var y1=class extends p{constructor(e){super(e)}},fa=class extends p{constructor(e){super(e)}},xs=class extends p{constructor(e){super(e)}},Ps=class extends p{constructor(e){super(e)}},pa=class extends p{constructor(e){super(e)}},ga=[0,D,[0,D],da,-1],ma=[0,D,U,W],Fs=[0,D,U],ya=[0,D,ma,Fs,U],_1=De(479097054,pa);G[479097054]=[0,D,ya,ga],G[463370452]=ga,G[464864288]=ma;var v1=De(462713202,Ps);G[462713202]=ya,G[474472470]=Fs;var b1=class extends p{constructor(e){super(e)}},_a=class extends p{constructor(e){super(e)}},va=class extends p{constructor(e){super(e)}},ba=class extends p{constructor(e){super(e)}},Os=[0,D,U,-1,W],Ms=[0,D,U,I];ba.prototype.g=dr([0,D,Fs,[0,D],Ls,Cs,Os,Ms]);var wa=class extends p{constructor(e){super(e)}},w1=De(456383383,wa);G[456383383]=[0,D,oa];var Aa=class extends p{constructor(e){super(e)}},A1=De(476348187,Aa);G[476348187]=[0,D,f1];var Ea=class extends p{constructor(e){super(e)}},ka=class extends p{constructor(e){super(e)}},Sa=[0,ue,-1],E1=De(458105876,class extends p{constructor(e){super(e)}g(){let e;var t=this.v;const n=0|t[f];return e=ae(this,n),t=(function(r,s,i,o){var a=ka;!o&&zt(r)&&(i=0|(s=r.v)[f]);var c=We(s,2);if(r=!1,c==null){if(o)return zi();c=[]}else if(c.constructor===ze){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?r=!!(2&(0|c[f])):c=[];if(o){if(!c.length)return zi();r||(r=!0,mn(c))}else r&&(r=!1,yn(c),c=Ji(c));return!r&&32&i&&gn(c,32),i=V(s,i,2,o=new ze(c,a,E2,void 0)),r||yt(s,i),o})(this,t,n,e),!e&&ka&&(t.ra=!0),t}});G[458105876]=[0,Sa,K2,[!0,rt,[0,T,-1,Q]],[0,Ln,I,ue]];var $s=class extends p{constructor(e){super(e)}},Ta=De(458105758,$s);G[458105758]=[0,D,T,Sa];var Is=class extends p{constructor(e){super(e)}},La=[0,Y2,-1,kt],k1=class extends p{constructor(e){super(e)}},Ca=class extends p{constructor(e){super(e)}},Rs=[1,2];Ca.prototype.g=dr([0,Rs,R,La,R,[0,K,La]]);var xa=class extends p{constructor(e){super(e)}},S1=De(443442058,xa);G[443442058]=[0,D,T,W,U,Q,-1,I,U],G[514774813]=Os;var Pa=class extends p{constructor(e){super(e)}},T1=De(516587230,Pa);function Ns(e,t){return t=t?t.clone():new Ts,e.displayNamesLocale!==void 0?S(t,1,En(e.displayNamesLocale)):e.displayNamesLocale===void 0&&S(t,1),e.maxResults!==void 0?Xe(t,2,e.maxResults):"maxResults"in e&&S(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&S(t,3),e.categoryAllowlist!==void 0?Qn(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&S(t,4),e.categoryDenylist!==void 0?Qn(t,5,e.categoryDenylist):"categoryDenylist"in e&&S(t,5),t}function Fa(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Us(e,t=-1,n=""){return{categories:e.map((r=>({index:Ae(r,1)??0??-1,score:$(r,2)??0,categoryName:q(L(r,3))??""??"",displayName:q(L(r,4))??""??""}))),headIndex:t,headName:n}}function L1(e){const t={classifications:Ke(e,c1,1).map((n=>{var r;return Us(((r=A(n,Jo,4))==null?void 0:r.g())??[],Ae(n,2)??0,q(L(n,3))??"")}))};return(function(n){return A2($r?L(n,2,void 0,void 0,Kn):L(n,2))})(e)!=null&&(t.timestampMs=Fa(ro(e))),t}function Oa(e){var o,a;var t=vt(e,3,Re,_t()),n=vt(e,2,Gt,_t()),r=vt(e,1,q,_t()),s=vt(e,9,q,_t());const i={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)i.categories.push({score:t[c],index:n[c]??-1,categoryName:r[c]??"",displayName:s[c]??""});if((t=(o=A(e,Ss,4))==null?void 0:o.l())&&(i.boundingBox={originX:Ae(t,1,et)??0,originY:Ae(t,2,et)??0,width:Ae(t,3,et)??0,height:Ae(t,4,et)??0,angle:0}),(a=A(e,Ss,4))==null?void 0:a.g().length)for(const c of A(e,Ss,4).g())i.keypoints.push({x:L(c,1,void 0,et,Re)??0,y:L(c,2,void 0,et,Re)??0,score:L(c,4,void 0,et,Re)??0,label:q(L(c,3,void 0,et))??""});return i}function yr(e){const t=[];for(const n of Ke(e,na,1))t.push({x:$(n,1)??0,y:$(n,2)??0,z:$(n,3)??0,visibility:$(n,4)??0});return t}function Pn(e){const t=[];for(const n of Ke(e,ta,1))t.push({x:$(n,1)??0,y:$(n,2)??0,z:$(n,3)??0,visibility:$(n,4)??0});return t}function Ma(e){return Array.from(e,(t=>t>127?t-256:t))}function $a(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let n=0,r=0,s=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i],r+=e[i]*e[i],s+=t[i]*t[i];if(r<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*s)}let _r;G[516587230]=[0,D,Os,Ms,U],G[518928384]=Ms;const C1=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 Ia(){if(_r===void 0)try{await WebAssembly.instantiate(C1),_r=!0}catch{_r=!1}return _r}async function Fn(e,t=e1``){const n=await Ia()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var St=class{};function Ra(){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 Na(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((n,r)=>{t.addEventListener("load",(()=>{n()}),!1),t.addEventListener("error",(s=>{r(s)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Ua(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 g(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 Da(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[r,s]=Ua(t);return!e.l||r===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=s),[r,s]}function Ba(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(t.length);for(let s=0;s<t.length;s++)r[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*r.length),e.i.HEAPU32.set(r,t>>2),n(t);for(const s of r)e.i._free(s);e.i._free(t)}function Be(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function ot(e,t,n){let r=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,i,o)=>{i?(n(r,o),r=[]):r.push(s)}}St.forVisionTasks=function(e){return Fn("vision",e)},St.forTextTasks=function(e){return Fn("text",e)},St.forGenAiExperimentalTasks=function(e){return Fn("genai_experimental",e)},St.forGenAiTasks=function(e){return Fn("genai",e)},St.forAudioTasks=function(e){return Fn("audio",e)},St.isSimdSupported=function(){return Ia()};async function x1(e,t,n,r){return e=await(async(s,i,o,a,c)=>{if(i&&await Na(i),!self.ModuleFactory||o&&(await Na(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 s(c,a)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&s.endsWith(".data")?n.assetBinaryPath.toString():s}),await e.o(r),e}function Ds(e,t){const n=A(e.baseOptions,gr,1)||new gr;typeof t=="string"?(S(n,2,En(t)),S(n,1)):t instanceof Uint8Array&&(S(n,1,Dr(t,!1)),S(n,2)),_(e.baseOptions,0,1,n)}function ja(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map((n=>n.message)).join(", "))}finally{e.H=[]}}function d(e,t){e.C=Math.max(e.C,t)}function vr(e,t){e.B=new ne,he(e.B,2,"PassThroughCalculator"),C(e.B,"free_memory"),b(e.B,"free_memory_unused_out"),F(t,"free_memory"),ke(t,e.B)}function on(e,t){C(e.B,t),b(e.B,t+"_unused_out")}function br(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Bs=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var n,r,s,i,o,a;if(t){const c=e.baseOptions||{};if((n=e.baseOptions)!=null&&n.modelAssetBuffer&&((r=e.baseOptions)!=null&&r.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=A(this.baseOptions,gr,1))!=null&&s.g()||(i=A(this.baseOptions,gr,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(a=e.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(u,h){let l=A(u.baseOptions,ca,3);if(!l){var m=l=new ca,v=new zo;Sn(m,4,pr,v)}"delegate"in h&&(h.delegate==="GPU"?(h=l,m=new t1,Sn(h,2,pr,m)):(h=l,m=new zo,Sn(h,4,pr,m))),_(u.baseOptions,0,3,l)})(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then((u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`)})).then((u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),Ds(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)Ds(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(u){const h=[];for(var l=0;;){const{done:m,value:v}=await u.read();if(m)break;h.push(v),l+=v.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(l),l=0;for(const m of h)u.set(m,l),l+=m.length;return u})(c.modelAssetBuffer).then((u=>{Ds(this,u),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=n1(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((n,r)=>{this.H.push(Error(r))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,ja(this)}finishProcessing(){this.g.finishProcessing(),ja(this)}close(){this.B=void 0,this.g.closeGraph()}};function at(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Bs.prototype.close=Bs.prototype.close;class P1{constructor(t,n,r,s){this.g=t,this.h=n,this.m=r,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Va(e,t,n){const r=e.g;if(n=at(r.createShader(n),"Failed to create WebGL shader"),r.shaderSource(n,t),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(e.h,n),n}function Ga(e,t){const n=e.g,r=at(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const s=at(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,s),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=at(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(e.L),n.vertexAttribPointer(e.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new P1(n,r,s,i)}function js(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function F1(e,t,n,r){return js(e,t),e.h||(e.m(),e.D()),n?(e.u||(e.u=Ga(e,!0)),n=e.u):(e.A||(e.A=Ga(e,!1)),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=r(),n.g.bindVertexArray(null),e}function Ha(e,t,n){return js(e,t),e=at(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 za(e,t,n){js(e,t),e.B||(e.B=at(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}function O1(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Wa=class{H(){return`
|
|
2
2
|
precision mediump float;
|
|
3
3
|
varying vec2 vTex;
|
|
4
4
|
uniform sampler2D inputTexture;
|
|
5
5
|
void main() {
|
|
6
6
|
gl_FragColor = texture2D(inputTexture, vTex);
|
|
7
7
|
}
|
|
8
|
-
`}m(){const e=this.g;if(this.h=
|
|
8
|
+
`}m(){const e=this.g;if(this.h=at(e.createProgram(),"Failed to create WebGL program"),this.X=Va(this,`
|
|
9
9
|
attribute vec2 aVertex;
|
|
10
10
|
attribute vec2 aTex;
|
|
11
11
|
varying vec2 vTex;
|
|
12
12
|
void main(void) {
|
|
13
13
|
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
14
14
|
vTex = aTex;
|
|
15
|
-
}`,e.VERTEX_SHADER),this.W=Ca(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function De(e,t){switch(t){case 0:return e.g.find((r=>r instanceof Uint8Array));case 1:return e.g.find((r=>r instanceof Float32Array));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Ls(e){var t=De(e,1);if(!t){if(t=De(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);const n=zt(e);var r=Ps(e);if(Ma(r,n,Oa(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){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let s=0,i=0;s<t.length;++s,i+=4)t[s]=r[i]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Oa(e){let t=De(e,2);if(!t){const r=zt(e);t=Ra(e);const n=Ls(e),s=Ia(e);r.texImage2D(r.TEXTURE_2D,0,s,e.width,e.height,0,r.RED,r.FLOAT,n),Cs(e)}return t}function zt(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=Ke(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Ia(e){if(e=zt(e),!on)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))on=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");on=e.R16F}return on}function Ps(e){return e.l||(e.l=new xa),e.l}function Ra(e){const t=zt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=De(e,2);return r||(r=Fa(Ps(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Cs(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var on,K=class{constructor(e,t,r,n,s,i,o){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=s,this.width=i,this.height=o,this.j&&--Na===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!De(this,0)}ka(){return!!De(this,1)}R(){return!!De(this,2)}ja(){return(t=De(e=this,0))||(t=Ls(e),t=new Uint8Array(t.map((r=>Math.round(255*r)))),e.g.push(t)),t;var e,t}ia(){return Ls(this)}N(){return Oa(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=zt(this),s=Ps(this);n.activeTexture(n.TEXTURE1),r=Fa(s,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);const i=Ia(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Ma(s,n,r),dc(s,n,!1,(()=>{Ra(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Cs(this)})),fc(s),Cs(this)}}e.push(r)}return new K(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&zt(this).deleteTexture(De(this,2)),Na=-1}};K.prototype.close=K.prototype.close,K.prototype.clone=K.prototype.clone,K.prototype.getAsWebGLTexture=K.prototype.N,K.prototype.getAsFloat32Array=K.prototype.ia,K.prototype.getAsUint8Array=K.prototype.ja,K.prototype.hasWebGLTexture=K.prototype.R,K.prototype.hasFloat32Array=K.prototype.ka,K.prototype.hasUint8Array=K.prototype.Fa;var Na=250;function we(...e){return e.map((([t,r])=>({start:t,end:r})))}const pc=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((Ua=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:Ea()?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 r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,n||"input_audio",(i=>{g(this,s=s||"audio_header",(o=>{this.i._configureAudio(i,o,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){$e(this,"__graph_config__",(t=>{e(t)})),g(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,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,s){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),g(this,n,(o=>{this.i._addAudioToInputStream(this.g,t,r,o,s)}))}addGpuBufferToStream(e,t,r){g(this,t,(n=>{const[s,i]=Ta(this,e,n);this.i._addBoundTextureToStream(n,s,i,r)}))}addBoolToStream(e,t,r){g(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){g(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){g(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){g(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){g(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){g(this,t,(n=>{g(this,e,(s=>{this.i._addStringToInputStream(s,n,r)}))}))}addStringRecordToStream(e,t,r){g(this,t,(n=>{La(this,Object.keys(e),(s=>{La(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){g(this,r,(s=>{g(this,t,(i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,s,n),this.i._free(o)}))}))}addEmptyPacketToStream(e,t){g(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){g(this,t,(n=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,n,r)}))}addDoubleVectorToStream(e,t,r){g(this,t,(n=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,n,r)}))}addFloatVectorToStream(e,t,r){g(this,t,(n=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,n,r)}))}addIntVectorToStream(e,t,r){g(this,t,(n=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,n,r)}))}addUintVectorToStream(e,t,r){g(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 i of e)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,n,r)}))}addStringVectorToStream(e,t,r){g(this,t,(n=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of e)g(this,i,(o=>{this.i._addStringVectorEntry(s,o)}));this.i._addStringVectorToInputStream(s,n,r)}))}addBoolToInputSidePacket(e,t){g(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){g(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){g(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){g(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){g(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){g(this,t,(r=>{g(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){g(this,r,(n=>{g(this,t,(s=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,s,n),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){g(this,t,(r=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){g(this,t,(r=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){g(this,t,(r=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){g(this,t,(r=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){g(this,t,(r=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){g(this,t,(r=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)g(this,s,(i=>{this.i._addStringVectorEntry(n,i)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){$e(this,e,t),g(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){We(this,e,t),g(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){$e(this,e,t),g(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){We(this,e,t),g(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),$e(this,e,((n,s)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,s)})),g(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Ua{get ga(){return this.i}pa(e,t,r){g(this,t,(n=>{const[s,i]=Ta(this,e,n);this.ga._addBoundTextureAsImageToStream(n,s,i,r)}))}Z(e,t){$e(this,e,t),g(this,e,(r=>{this.ga._attachImageListener(r)}))}aa(e,t){We(this,e,t),g(this,e,(r=>{this.ga._attachImageVectorListener(r)}))}}));var Ua,Ae=class extends pc{};async function w(e,t,r){return(async function(n,s,i,o){return uc(n,s,i,o)})(e,r.canvas??(Ea()?void 0:document.createElement("canvas")),t,r)}function Da(e,t,r,n){if(e.U){const i=new Ho;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var s=r.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(i,1,(s.left+s.right)/2),y(i,2,(s.top+s.bottom)/2),y(i,4,s.right-s.left),y(i,3,s.bottom-s.top)}else y(i,1,.5),y(i,2,.5),y(i,4,1),y(i,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(y(i,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[o,a]=ka(t);r=I(i,3)*a/o,s=I(i,4)*o/a,y(i,4,r),y(i,3,s)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.pa(t,e.X,n??performance.now()),e.finishProcessing()}function Ee(e,t,r){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Da(e,t,r,e.C+1)}function Fe(e,t,r,n){var s;if(!((s=e.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Da(e,t,r,n)}function Wt(e,t,r,n){var s=t.data;const i=t.width,o=i*(t=t.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return e=new K([s],r,!1,e.g.i.canvas,e.P,i,t),n?e.clone():e}var ce=class extends ks{constructor(e,t,r,n){super(e),this.g=e,this.X=t,this.U=r,this.oa=n,this.P=new xa}l(e,t=!0){if("runningMode"in e&&k(this.baseOptions,2,or(!!e.runningMode&&e.runningMode!=="IMAGE")),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};ce.prototype.close=ce.prototype.close;var he=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},v(e=this.h=new en,0,1,t=new M),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Ee(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect_in"),E(e,"detections");const t=new oe;Pe(t,X1,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect_in"),b(r,"DETECTIONS:detections"),r.o(t),me(e,r),this.g.attachProtoVectorListener("detections",((n,s)=>{for(const i of n)n=jo(i),this.j.detections.push(va(n));d(this,s)})),this.g.attachEmptyPacketListener("detections",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};he.prototype.detectForVideo=he.prototype.G,he.prototype.detect=he.prototype.F,he.prototype.setOptions=he.prototype.o,he.createFromModelPath=async function(e,t){return w(he,e,{baseOptions:{modelAssetPath:t}})},he.createFromModelBuffer=function(e,t){return w(he,e,{baseOptions:{modelAssetBuffer:t}})},he.createFromOptions=function(e,t){return w(he,e,t)};var $s=we([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]),Fs=we([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]),Ms=we([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Ba=we([474,475],[475,476],[476,477],[477,474]),xs=we([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]),Os=we([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),ja=we([469,470],[470,471],[471,472],[472,469]),Is=we([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]),Va=[...$s,...Fs,...Ms,...xs,...Os,...Is],Ga=we([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 Ha(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var x=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,v(e=this.h=new Zo,0,1,t=new M),this.A=new Jo,v(this.h,0,3,this.A),this.u=new en,v(this.h,0,2,this.u),Ne(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numFaces"in e&&Ne(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return Ha(this),Ee(this,e,t),this.j}G(e,t,r){return Ha(this),Fe(this,e,r,t),this.j}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect"),E(e,"face_landmarks");const t=new oe;Pe(t,J1,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),b(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),me(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,s)=>{for(const i of n)n=pr(i),this.j.faceLandmarks.push(tn(n));d(this,s)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{d(this,n)})),this.outputFaceBlendshapes&&(E(e,"blendshapes"),b(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,s)=>{if(this.outputFaceBlendshapes)for(const i of n)n=Jr(i),this.j.faceBlendshapes.push(Es(n.g()??[]));d(this,s)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{d(this,n)}))),this.outputFacialTransformationMatrixes&&(E(e,"face_geometry"),b(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of n)(n=A(n=Y1(i),j1,2))&&this.j.facialTransformationMatrixes.push({rows:pe(n,1)??0??0,columns:pe(n,2)??0??0,data:ot(n,3,Te,it()).slice()??[]});d(this,s)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{d(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};x.prototype.detectForVideo=x.prototype.G,x.prototype.detect=x.prototype.F,x.prototype.setOptions=x.prototype.o,x.createFromModelPath=function(e,t){return w(x,e,{baseOptions:{modelAssetPath:t}})},x.createFromModelBuffer=function(e,t){return w(x,e,{baseOptions:{modelAssetBuffer:t}})},x.createFromOptions=function(e,t){return w(x,e,t)},x.FACE_LANDMARKS_LIPS=$s,x.FACE_LANDMARKS_LEFT_EYE=Fs,x.FACE_LANDMARKS_LEFT_EYEBROW=Ms,x.FACE_LANDMARKS_LEFT_IRIS=Ba,x.FACE_LANDMARKS_RIGHT_EYE=xs,x.FACE_LANDMARKS_RIGHT_EYEBROW=Os,x.FACE_LANDMARKS_RIGHT_IRIS=ja,x.FACE_LANDMARKS_FACE_OVAL=Is,x.FACE_LANDMARKS_CONTOURS=Va,x.FACE_LANDMARKS_TESSELATION=Ga;var Rs=we([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 za(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Wa(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 Ka(e,t=!0){const r=[];for(const s of e){var n=Jr(s);e=[];for(const i of n.g())n=t&&pe(i,1)!=null?pe(i,1)??0:-1,e.push({score:I(i,2)??0,index:n,categoryName:X(L(i,3))??""??"",displayName:X(L(i,4))??""??""});r.push(e)}return r}var ue=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.j=new ta,0,1,t=new M),this.u=new gs,v(this.j,0,2,this.u),this.D=new ps,v(this.u,0,3,this.D),this.A=new ea,v(this.u,0,2,this.A),this.h=new Z1,v(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return A(this.j,M,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){var s,i,o,a;if(Ne(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Gt,r=t,n=As(e.cannedGesturesClassifierOptions,(s=A(this.h,Gt,3))==null?void 0:s.l());v(r,0,2,n),v(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=A(this.h,Gt,3))==null||i.g());return e.customGesturesClassifierOptions?(v(r=t=new Gt,0,2,n=As(e.customGesturesClassifierOptions,(o=A(this.h,Gt,4))==null?void 0:o.l())),v(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=A(this.h,Gt,4))==null||a.g()),this.l(e)}Ha(e,t){return za(this),Ee(this,e,t),Wa(this)}Ia(e,t,r){return za(this),Fe(this,e,r,t),Wa(this)}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect"),E(e,"hand_gestures"),E(e,"hand_landmarks"),E(e,"world_hand_landmarks"),E(e,"handedness");const t=new oe;Pe(t,Q1,this.j);const r=new Q;se(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),b(r,"HAND_GESTURES:hand_gestures"),b(r,"LANDMARKS:hand_landmarks"),b(r,"WORLD_LANDMARKS:world_hand_landmarks"),b(r,"HANDEDNESS:handedness"),r.o(t),me(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,s)=>{for(const i of n){n=pr(i);const o=[];for(const a of Re(n,Go,1))o.push({x:I(a,1)??0,y:I(a,2)??0,z:I(a,3)??0,visibility:I(a,4)??0});this.landmarks.push(o)}d(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,s)=>{for(const i of n){n=Vt(i);const o=[];for(const a of Re(n,Vo,1))o.push({x:I(a,1)??0,y:I(a,2)??0,z:I(a,3)??0,visibility:I(a,4)??0});this.worldLandmarks.push(o)}d(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,s)=>{this.gestures.push(...Ka(n,!1)),d(this,s)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{d(this,n)})),this.g.attachProtoVectorListener("handedness",((n,s)=>{this.handedness.push(...Ka(n)),d(this,s)})),this.g.attachEmptyPacketListener("handedness",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function qa(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ue.prototype.recognizeForVideo=ue.prototype.Ia,ue.prototype.recognize=ue.prototype.Ha,ue.prototype.setOptions=ue.prototype.o,ue.createFromModelPath=function(e,t){return w(ue,e,{baseOptions:{modelAssetPath:t}})},ue.createFromModelBuffer=function(e,t){return w(ue,e,{baseOptions:{modelAssetBuffer:t}})},ue.createFromOptions=function(e,t){return w(ue,e,t)},ue.HAND_CONNECTIONS=Rs;var le=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],v(e=this.h=new gs,0,1,t=new M),this.u=new ps,v(this.h,0,3,this.u),this.j=new ea,v(this.h,0,2,this.j),Ne(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numHands"in e&&Ne(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ee(this,e,t),qa(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Fe(this,e,r,t),qa(this)}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect"),E(e,"hand_landmarks"),E(e,"world_hand_landmarks"),E(e,"handedness");const t=new oe;Pe(t,ec,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),b(r,"LANDMARKS:hand_landmarks"),b(r,"WORLD_LANDMARKS:world_hand_landmarks"),b(r,"HANDEDNESS:handedness"),r.o(t),me(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,s)=>{for(const i of n)n=pr(i),this.landmarks.push(tn(n));d(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,s)=>{for(const i of n)n=Vt(i),this.worldLandmarks.push(gr(n));d(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{d(this,n)})),this.g.attachProtoVectorListener("handedness",((n,s)=>{var i=this.handedness,o=i.push;const a=[];for(const c of n){n=Jr(c);const u=[];for(const h of n.g())u.push({score:I(h,2)??0,index:pe(h,1)??0??-1,categoryName:X(L(h,3))??""??"",displayName:X(L(h,4))??""??""});a.push(u)}o.call(i,...a),d(this,s)})),this.g.attachEmptyPacketListener("handedness",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};le.prototype.detectForVideo=le.prototype.G,le.prototype.detect=le.prototype.F,le.prototype.setOptions=le.prototype.o,le.createFromModelPath=function(e,t){return w(le,e,{baseOptions:{modelAssetPath:t}})},le.createFromModelBuffer=function(e,t){return w(le,e,{baseOptions:{modelAssetBuffer:t}})},le.createFromOptions=function(e,t){return w(le,e,t)},le.HAND_CONNECTIONS=Rs;var Xa=we([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 Ya(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Ja(e){try{if(!e.D)return e.h;e.D(e.h)}finally{sn(e)}}function an(e,t){e=pr(e),t.push(tn(e))}var C=class extends ce{constructor(e,t){super(new Ae(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,v(e=this.j=new aa,0,1,t=new M),this.I=new ps,v(this.j,0,2,this.I),this.W=new tc,v(this.j,0,3,this.W),this.u=new en,v(this.j,0,4,this.u),this.O=new Jo,v(this.j,0,5,this.O),this.A=new ia,v(this.j,0,6,this.A),this.M=new oa,v(this.j,0,7,this.M),y(this.u,2,.5),y(this.u,3,.3),y(this.O,2,.5),y(this.A,2,.5),y(this.A,3,.3),y(this.M,2,.5),y(this.I,2,.5)}get baseOptions(){return A(this.j,M,1)}set baseOptions(e){v(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,Ya(this),Ee(this,e,n),Ja(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:n,Ya(this),Fe(this,e,s,t),Ja(this)}m(){var e=new ae;F(e,"input_frames_image"),E(e,"pose_landmarks"),E(e,"pose_world_landmarks"),E(e,"face_landmarks"),E(e,"left_hand_landmarks"),E(e,"left_hand_world_landmarks"),E(e,"right_hand_landmarks"),E(e,"right_hand_world_landmarks");const t=new oe,r=new So;se(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(s,i){if(i!=null)if(Array.isArray(i))k(s,2,Or(i,0,hr));else{if(!(typeof i=="string"||i instanceof Se||bn(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");je(s,2,Sn(i,!1),Qe())}})(r,this.j.g());const n=new Q;se(n,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),zn(n,8,So,r),P(n,"IMAGE:input_frames_image"),b(n,"POSE_LANDMARKS:pose_landmarks"),b(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),b(n,"FACE_LANDMARKS:face_landmarks"),b(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),b(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),b(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),b(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),me(e,n),nn(this,e),this.g.attachProtoListener("pose_landmarks",((s,i)=>{an(s,this.h.poseLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("pose_world_landmarks",((s,i)=>{var o=this.h.poseWorldLandmarks;s=Vt(s),o.push(gr(s)),d(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(s=>{d(this,s)})),this.outputPoseSegmentationMasks&&(b(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ht(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((s,i)=>{this.h.poseSegmentationMasks=[Wt(this,s,!0,!this.D)],d(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(s=>{this.h.poseSegmentationMasks=[],d(this,s)}))),this.g.attachProtoListener("face_landmarks",((s,i)=>{an(s,this.h.faceLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{d(this,s)})),this.outputFaceBlendshapes&&(E(e,"extra_blendshapes"),b(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=Jr(s),o.push(Es(s.g()??[]))),d(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(s=>{d(this,s)}))),this.g.attachProtoListener("left_hand_landmarks",((s,i)=>{an(s,this.h.leftHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("left_hand_world_landmarks",((s,i)=>{var o=this.h.leftHandWorldLandmarks;s=Vt(s),o.push(gr(s)),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("right_hand_landmarks",((s,i)=>{an(s,this.h.rightHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("right_hand_world_landmarks",((s,i)=>{var o=this.h.rightHandWorldLandmarks;s=Vt(s),o.push(gr(s)),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};C.prototype.detectForVideo=C.prototype.G,C.prototype.detect=C.prototype.F,C.prototype.setOptions=C.prototype.o,C.createFromModelPath=function(e,t){return w(C,e,{baseOptions:{modelAssetPath:t}})},C.createFromModelBuffer=function(e,t){return w(C,e,{baseOptions:{modelAssetBuffer:t}})},C.createFromOptions=function(e,t){return w(C,e,t)},C.HAND_CONNECTIONS=Rs,C.POSE_CONNECTIONS=Xa,C.FACE_LANDMARKS_LIPS=$s,C.FACE_LANDMARKS_LEFT_EYE=Fs,C.FACE_LANDMARKS_LEFT_EYEBROW=Ms,C.FACE_LANDMARKS_LEFT_IRIS=Ba,C.FACE_LANDMARKS_RIGHT_EYE=xs,C.FACE_LANDMARKS_RIGHT_EYEBROW=Os,C.FACE_LANDMARKS_RIGHT_IRIS=ja,C.FACE_LANDMARKS_FACE_OVAL=Is,C.FACE_LANDMARKS_CONTOURS=Va,C.FACE_LANDMARKS_TESSELATION=Ga;var ye=class extends ce{constructor(e,t){super(new Ae(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},v(e=this.h=new ca,0,1,t=new M)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return v(this.h,0,2,As(e,A(this.h,ls,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Ee(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;F(e,"input_image"),F(e,"norm_rect"),E(e,"classifications");const t=new oe;Pe(t,rc,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),P(r,"IMAGE:input_image"),P(r,"NORM_RECT:norm_rect"),b(r,"CLASSIFICATIONS:classifications"),r.o(t),me(e,r),this.g.attachProtoListener("classifications",((n,s)=>{this.j=cc(H1(n)),d(this,s)})),this.g.attachEmptyPacketListener("classifications",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.prototype.classifyForVideo=ye.prototype.ta,ye.prototype.classify=ye.prototype.sa,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return w(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return w(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return w(ye,e,t)};var de=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect",!0),this.h=new ha,this.embeddings={embeddings:[]},v(e=this.h,0,1,t=new M)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){var t=this.h,r=A(this.h,qo,2);return r=r?r.clone():new qo,e.l2Normalize!==void 0?k(r,1,or(e.l2Normalize)):"l2Normalize"in e&&k(r,1),e.quantize!==void 0?k(r,2,or(e.quantize)):"quantize"in e&&k(r,2),v(t,0,2,r),this.l(e)}za(e,t){return Ee(this,e,t),this.embeddings}Aa(e,t,r){return Fe(this,e,r,t),this.embeddings}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect"),E(e,"embeddings_out");const t=new oe;Pe(t,nc,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),b(r,"EMBEDDINGS:embeddings_out"),r.o(t),me(e,r),this.g.attachProtoListener("embeddings_out",((n,s)=>{n=K1(n),this.embeddings=(function(i){return{embeddings:Re(i,W1,1).map((o=>{var u,h;const a={headIndex:pe(o,3)??0??-1,headName:X(L(o,4))??""??""};var c=o.v;return ji(c,0|c[f],zo,jn(o,1))!==void 0?(o=ot(o=A(o,zo,jn(o,1),void 0),1,Te,it()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,z1,jn(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a})),timestampMs:_a(Hi(i))}})(n),d(this,s)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};de.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=wa(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=wa(ba(e.quantizedEmbedding),ba(t.quantizedEmbedding))}return e},de.prototype.embedForVideo=de.prototype.Aa,de.prototype.embed=de.prototype.za,de.prototype.setOptions=de.prototype.o,de.createFromModelPath=function(e,t){return w(de,e,{baseOptions:{modelAssetPath:t}})},de.createFromModelBuffer=function(e,t){return w(de,e,{baseOptions:{modelAssetBuffer:t}})},de.createFromOptions=function(e,t){return w(de,e,t)};var Ns=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach((r=>{r.close()})),(t=this.categoryMask)==null||t.close()}};function gc(e){var r,n;const t=(function(s){return Re(s,Q,1)})(e.ca()).filter((s=>(X(L(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((n=(r=A(t[0],oe,7))==null?void 0:r.j())==null?void 0:n.g())??new Map).forEach(((s,i)=>{e.u[Number(i)]=X(L(s,1))??""}))}function Za(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Qa(e){try{const t=new Ns(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{sn(e)}}Ns.prototype.close=Ns.prototype.close;var ee=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new vs,this.A=new ua,v(this.h,0,3,this.A),v(e=this.h,0,1,t=new M)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?k(this.h,2,cr(e.displayNamesLocale)):"displayNamesLocale"in e&&k(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){gc(this)}segment(e,t,r){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Za(this),Ee(this,e,n),Qa(this)}La(e,t,r,n){const s=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Za(this),Fe(this,e,s,t),Qa(this)}Da(){return this.u}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect");const t=new oe;Pe(t,fa,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),r.o(t),me(e,r),nn(this,e),this.outputConfidenceMasks&&(E(e,"confidence_masks"),b(r,"CONFIDENCE_MASKS:confidence_masks"),Ht(this,"confidence_masks"),this.g.aa("confidence_masks",((n,s)=>{this.confidenceMasks=n.map((i=>Wt(this,i,!0,!this.j))),d(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],d(this,n)}))),this.outputCategoryMask&&(E(e,"category_mask"),b(r,"CATEGORY_MASK:category_mask"),Ht(this,"category_mask"),this.g.Z("category_mask",((n,s)=>{this.categoryMask=Wt(this,n,!1,!this.j),d(this,s)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,d(this,n)}))),E(e,"quality_scores"),b(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,s)=>{this.qualityScores=n,d(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ee.prototype.getLabels=ee.prototype.Da,ee.prototype.segmentForVideo=ee.prototype.La,ee.prototype.segment=ee.prototype.segment,ee.prototype.setOptions=ee.prototype.o,ee.createFromModelPath=function(e,t){return w(ee,e,{baseOptions:{modelAssetPath:t}})},ee.createFromModelBuffer=function(e,t){return w(ee,e,{baseOptions:{modelAssetBuffer:t}})},ee.createFromOptions=function(e,t){return w(ee,e,t)};var Us=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach((r=>{r.close()})),(t=this.categoryMask)==null||t.close()}};Us.prototype.close=Us.prototype.close;var Me=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new vs,this.u=new ua,v(this.h,0,3,this.u),v(e=this.h,0,1,t=new M)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(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,r,n){const s=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,n=new ga,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new bs;je(i,3,or(!0),!1),je(i,1,ir(t.keypoint.x),0),je(i,2,ir(t.keypoint.y),0),ur(n,1,ws,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new ic;for(i of t.scribble)je(t=new bs,3,or(!0),!1),je(t,1,ir(i.x),0),je(t,2,ir(i.y),0),zn(a,1,bs,t);ur(n,2,ws,a)}}this.g.addProtoToStream(n.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),Ee(this,e,s);e:{try{const a=new Us(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{sn(this)}o=void 0}return o}m(){var e=new ae;F(e,"image_in"),F(e,"roi_in"),F(e,"norm_rect_in");const t=new oe;Pe(t,fa,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),P(r,"IMAGE:image_in"),P(r,"ROI:roi_in"),P(r,"NORM_RECT:norm_rect_in"),r.o(t),me(e,r),nn(this,e),this.outputConfidenceMasks&&(E(e,"confidence_masks"),b(r,"CONFIDENCE_MASKS:confidence_masks"),Ht(this,"confidence_masks"),this.g.aa("confidence_masks",((n,s)=>{this.confidenceMasks=n.map((i=>Wt(this,i,!0,!this.j))),d(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],d(this,n)}))),this.outputCategoryMask&&(E(e,"category_mask"),b(r,"CATEGORY_MASK:category_mask"),Ht(this,"category_mask"),this.g.Z("category_mask",((n,s)=>{this.categoryMask=Wt(this,n,!1,!this.j),d(this,s)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,d(this,n)}))),E(e,"quality_scores"),b(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,s)=>{this.qualityScores=n,d(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Me.prototype.segment=Me.prototype.segment,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return w(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return w(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return w(Me,e,t)};var _e=class extends ce{constructor(e,t){super(new Ae(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},v(e=this.h=new ma,0,1,t=new M)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?k(this.h,2,cr(e.displayNamesLocale)):"displayNamesLocale"in e&&k(this.h,2),e.maxResults!==void 0?Ne(this.h,3,e.maxResults):"maxResults"in e&&k(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&k(this.h,4),e.categoryAllowlist!==void 0?Ir(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&k(this.h,5),e.categoryDenylist!==void 0?Ir(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&k(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Ee(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Fe(this,e,r,t),this.j}m(){var e=new ae;F(e,"input_frame_gpu"),F(e,"norm_rect"),E(e,"detections");const t=new oe;Pe(t,oc,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),P(r,"IMAGE:input_frame_gpu"),P(r,"NORM_RECT:norm_rect"),b(r,"DETECTIONS:detections"),r.o(t),me(e,r),this.g.attachProtoVectorListener("detections",((n,s)=>{for(const i of n)n=jo(i),this.j.detections.push(va(n));d(this,s)})),this.g.attachEmptyPacketListener("detections",(n=>{d(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.G,_e.prototype.detect=_e.prototype.F,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=async function(e,t){return w(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return w(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return w(_e,e,t)};var Ds=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach((t=>{t.close()}))}};function e2(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function t2(e){try{const t=new Ds(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{sn(e)}}Ds.prototype.close=Ds.prototype.close;var fe=class extends ce{constructor(e,t){super(new Ae(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,v(e=this.h=new ya,0,1,t=new M),this.A=new oa,v(this.h,0,3,this.A),this.j=new ia,v(this.h,0,2,this.j),Ne(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,M,1)}set baseOptions(e){v(this.h,0,1,e)}o(e){return"numPoses"in e&&Ne(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,e2(this),Ee(this,e,n),t2(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:n,e2(this),Fe(this,e,s,t),t2(this)}m(){var e=new ae;F(e,"image_in"),F(e,"norm_rect"),E(e,"normalized_landmarks"),E(e,"world_landmarks"),E(e,"segmentation_masks");const t=new oe;Pe(t,ac,this.h);const r=new Q;se(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),P(r,"IMAGE:image_in"),P(r,"NORM_RECT:norm_rect"),b(r,"NORM_LANDMARKS:normalized_landmarks"),b(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),me(e,r),nn(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,s)=>{this.landmarks=[];for(const i of n)n=pr(i),this.landmarks.push(tn(n));d(this,s)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],d(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,s)=>{this.worldLandmarks=[];for(const i of n)n=Vt(i),this.worldLandmarks.push(gr(n));d(this,s)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],d(this,n)})),this.outputSegmentationMasks&&(b(r,"SEGMENTATION_MASK:segmentation_masks"),Ht(this,"segmentation_masks"),this.g.aa("segmentation_masks",((n,s)=>{this.segmentationMasks=n.map((i=>Wt(this,i,!0,!this.u))),d(this,s)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],d(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};fe.prototype.detectForVideo=fe.prototype.G,fe.prototype.detect=fe.prototype.F,fe.prototype.setOptions=fe.prototype.o,fe.createFromModelPath=function(e,t){return w(fe,e,{baseOptions:{modelAssetPath:t}})},fe.createFromModelBuffer=function(e,t){return w(fe,e,{baseOptions:{modelAssetBuffer:t}})},fe.createFromOptions=function(e,t){return w(fe,e,t)},fe.POSE_CONNECTIONS=Xa;const mc="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm",yc="https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",_c=.7,vc=.08,bc=.85,r2=.25;let cn=null;async function wc(){if(cn)return cn;const e=await dt.forVisionTasks(mc);return cn=await he.createFromOptions(e,{baseOptions:{modelAssetPath:yc},runningMode:"IMAGE",minDetectionConfidence:_c}),cn}async function Bs(e){var _,S;const n=(await wc()).detect(e).detections;if(n.length===0)return{hasFace:!1,faceCount:0,confidence:0,isCentered:!1,message:"No face detected. Please ensure your face is visible and well-lit."};if(n.length>1)return{hasFace:!0,faceCount:n.length,confidence:((_=n[0].categories[0])==null?void 0:_.score)??0,isCentered:!1,message:"Multiple faces detected. Please ensure only your face is in the frame."};const s=n[0],i=s.boundingBox,o=((S=s.categories[0])==null?void 0:S.score)??0;if(!i)return{hasFace:!0,faceCount:1,confidence:o,isCentered:!1,message:"Face detected but could not determine position."};const a=e.naturalWidth,c=e.naturalHeight,u=i.width*i.height/(a*c);if(u<vc)return{hasFace:!0,faceCount:1,confidence:o,isCentered:!1,message:"Face is too far away. Please move closer to the camera."};if(u>bc)return{hasFace:!0,faceCount:1,confidence:o,isCentered:!1,message:"Face is too close. Please move further from the camera."};const h=(i.originX+i.width/2)/a,l=(i.originY+i.height/2)/c;return Math.abs(h-.5)<r2&&Math.abs(l-.5)<r2?{hasFace:!0,faceCount:1,confidence:o,isCentered:!0,message:"Face looks good!"}:{hasFace:!0,faceCount:1,confidence:o,isCentered:!1,message:"Please center your face in the frame."}}/**
|
|
15
|
+
}`,e.VERTEX_SHADER),this.W=Va(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function qe(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 Vs(e){var t=qe(e,1);if(!t){if(t=qe(e,0))t=new Float32Array(t).map((r=>r/255));else{t=new Float32Array(e.width*e.height);const r=an(e);var n=Gs(e);if(za(n,r,Ka(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){n=new Float32Array(e.width*e.height*4),r.readPixels(0,0,e.width,e.height,r.RGBA,r.FLOAT,n);for(let s=0,i=0;s<t.length;++s,i+=4)t[s]=n[i]}else r.readPixels(0,0,e.width,e.height,r.RED,r.FLOAT,t)}e.g.push(t)}return t}function Ka(e){let t=qe(e,2);if(!t){const n=an(e);t=Ya(e);const r=Vs(e),s=Xa(e);n.texImage2D(n.TEXTURE_2D,0,s,e.width,e.height,0,n.RED,n.FLOAT,r),Hs(e)}return t}function an(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=at(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Xa(e){if(e=an(e),!wr)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))wr=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");wr=e.R16F}return wr}function Gs(e){return e.l||(e.l=new Wa),e.l}function Ya(e){const t=an(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=qe(e,2);return n||(n=Ha(Gs(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function Hs(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var wr,X=class{constructor(e,t,n,r,s,i,o){this.g=e,this.m=t,this.j=n,this.canvas=r,this.l=s,this.width=i,this.height=o,this.j&&--qa===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!qe(this,0)}ka(){return!!qe(this,1)}R(){return!!qe(this,2)}ja(){return(t=qe(e=this,0))||(t=Vs(e),t=new Uint8Array(t.map((n=>Math.round(255*n)))),e.g.push(t)),t;var e,t}ia(){return Vs(this)}N(){return Ka(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 r=an(this),s=Gs(this);r.activeTexture(r.TEXTURE1),n=Ha(s,r,this.m?r.LINEAR:r.NEAREST),r.bindTexture(r.TEXTURE_2D,n);const i=Xa(this);r.texImage2D(r.TEXTURE_2D,0,i,this.width,this.height,0,r.RED,r.FLOAT,null),r.bindTexture(r.TEXTURE_2D,null),za(s,r,n),F1(s,r,!1,(()=>{Ya(this),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),Hs(this)})),O1(s),Hs(this)}}e.push(n)}return new X(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&an(this).deleteTexture(qe(this,2)),qa=-1}};X.prototype.close=X.prototype.close,X.prototype.clone=X.prototype.clone,X.prototype.getAsWebGLTexture=X.prototype.N,X.prototype.getAsFloat32Array=X.prototype.ia,X.prototype.getAsUint8Array=X.prototype.ja,X.prototype.hasWebGLTexture=X.prototype.R,X.prototype.hasFloat32Array=X.prototype.ka,X.prototype.hasUint8Array=X.prototype.Fa;var qa=250;function xe(...e){return e.map((([t,n])=>({start:t,end:n})))}const M1=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((Qa=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:Ra()?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,r=this.i._malloc(n);this.i.HEAPU8.set(e,r),t?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(e,t,n,r,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,r||"input_audio",(i=>{g(this,s=s||"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}ca(e){Be(this,"__graph_config__",(t=>{e(t)})),g(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,r,s){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),g(this,r,(o=>{this.i._addAudioToInputStream(this.g,t,n,o,s)}))}addGpuBufferToStream(e,t,n){g(this,t,(r=>{const[s,i]=Da(this,e,r);this.i._addBoundTextureToStream(r,s,i,n)}))}addBoolToStream(e,t,n){g(this,t,(r=>{this.i._addBoolToInputStream(e,r,n)}))}addDoubleToStream(e,t,n){g(this,t,(r=>{this.i._addDoubleToInputStream(e,r,n)}))}addFloatToStream(e,t,n){g(this,t,(r=>{this.i._addFloatToInputStream(e,r,n)}))}addIntToStream(e,t,n){g(this,t,(r=>{this.i._addIntToInputStream(e,r,n)}))}addUintToStream(e,t,n){g(this,t,(r=>{this.i._addUintToInputStream(e,r,n)}))}addStringToStream(e,t,n){g(this,t,(r=>{g(this,e,(s=>{this.i._addStringToInputStream(s,r,n)}))}))}addStringRecordToStream(e,t,n){g(this,t,(r=>{Ba(this,Object.keys(e),(s=>{Ba(this,Object.values(e),(i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(e).length,r,n)}))}))}))}addProtoToStream(e,t,n,r){g(this,n,(s=>{g(this,t,(i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,s,r),this.i._free(o)}))}))}addEmptyPacketToStream(e,t){g(this,e,(n=>{this.i._addEmptyPacketToInputStream(n,t)}))}addBoolVectorToStream(e,t,n){g(this,t,(r=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,r,n)}))}addDoubleVectorToStream(e,t,n){g(this,t,(r=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,r,n)}))}addFloatVectorToStream(e,t,n){g(this,t,(r=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,r,n)}))}addIntVectorToStream(e,t,n){g(this,t,(r=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,r,n)}))}addUintVectorToStream(e,t,n){g(this,t,(r=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,r,n)}))}addStringVectorToStream(e,t,n){g(this,t,(r=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of e)g(this,i,(o=>{this.i._addStringVectorEntry(s,o)}));this.i._addStringVectorToInputStream(s,r,n)}))}addBoolToInputSidePacket(e,t){g(this,t,(n=>{this.i._addBoolToInputSidePacket(e,n)}))}addDoubleToInputSidePacket(e,t){g(this,t,(n=>{this.i._addDoubleToInputSidePacket(e,n)}))}addFloatToInputSidePacket(e,t){g(this,t,(n=>{this.i._addFloatToInputSidePacket(e,n)}))}addIntToInputSidePacket(e,t){g(this,t,(n=>{this.i._addIntToInputSidePacket(e,n)}))}addUintToInputSidePacket(e,t){g(this,t,(n=>{this.i._addUintToInputSidePacket(e,n)}))}addStringToInputSidePacket(e,t){g(this,t,(n=>{g(this,e,(r=>{this.i._addStringToInputSidePacket(r,n)}))}))}addProtoToInputSidePacket(e,t,n){g(this,n,(r=>{g(this,t,(s=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,s,r),this.i._free(i)}))}))}addBoolVectorToInputSidePacket(e,t){g(this,t,(n=>{const r=this.i._allocateBoolVector(e.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(r,s);this.i._addBoolVectorToInputSidePacket(r,n)}))}addDoubleVectorToInputSidePacket(e,t){g(this,t,(n=>{const r=this.i._allocateDoubleVector(e.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(r,s);this.i._addDoubleVectorToInputSidePacket(r,n)}))}addFloatVectorToInputSidePacket(e,t){g(this,t,(n=>{const r=this.i._allocateFloatVector(e.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(r,s);this.i._addFloatVectorToInputSidePacket(r,n)}))}addIntVectorToInputSidePacket(e,t){g(this,t,(n=>{const r=this.i._allocateIntVector(e.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(r,s);this.i._addIntVectorToInputSidePacket(r,n)}))}addUintVectorToInputSidePacket(e,t){g(this,t,(n=>{const r=this.i._allocateUintVector(e.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(r,s);this.i._addUintVectorToInputSidePacket(r,n)}))}addStringVectorToInputSidePacket(e,t){g(this,t,(n=>{const r=this.i._allocateStringVector(e.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of e)g(this,s,(i=>{this.i._addStringVectorEntry(r,i)}));this.i._addStringVectorToInputSidePacket(r,n)}))}attachBoolListener(e,t){Be(this,e,t),g(this,e,(n=>{this.i._attachBoolListener(n)}))}attachBoolVectorListener(e,t){ot(this,e,t),g(this,e,(n=>{this.i._attachBoolVectorListener(n)}))}attachIntListener(e,t){Be(this,e,t),g(this,e,(n=>{this.i._attachIntListener(n)}))}attachIntVectorListener(e,t){ot(this,e,t),g(this,e,(n=>{this.i._attachIntVectorListener(n)}))}attachUintListener(e,t){Be(this,e,t),g(this,e,(n=>{this.i._attachUintListener(n)}))}attachUintVectorListener(e,t){ot(this,e,t),g(this,e,(n=>{this.i._attachUintVectorListener(n)}))}attachDoubleListener(e,t){Be(this,e,t),g(this,e,(n=>{this.i._attachDoubleListener(n)}))}attachDoubleVectorListener(e,t){ot(this,e,t),g(this,e,(n=>{this.i._attachDoubleVectorListener(n)}))}attachFloatListener(e,t){Be(this,e,t),g(this,e,(n=>{this.i._attachFloatListener(n)}))}attachFloatVectorListener(e,t){ot(this,e,t),g(this,e,(n=>{this.i._attachFloatVectorListener(n)}))}attachStringListener(e,t){Be(this,e,t),g(this,e,(n=>{this.i._attachStringListener(n)}))}attachStringVectorListener(e,t){ot(this,e,t),g(this,e,(n=>{this.i._attachStringVectorListener(n)}))}attachProtoListener(e,t,n){Be(this,e,t),g(this,e,(r=>{this.i._attachProtoListener(r,n||!1)}))}attachProtoVectorListener(e,t,n){ot(this,e,t),g(this,e,(r=>{this.i._attachProtoVectorListener(r,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?'),Be(this,e,((r,s)=>{r=new Float32Array(r.buffer,r.byteOffset,r.length/4),t(r,s)})),g(this,e,(r=>{this.i._attachAudioListener(r,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Qa{get ga(){return this.i}pa(e,t,n){g(this,t,(r=>{const[s,i]=Da(this,e,r);this.ga._addBoundTextureAsImageToStream(r,s,i,n)}))}Z(e,t){Be(this,e,t),g(this,e,(n=>{this.ga._attachImageListener(n)}))}aa(e,t){ot(this,e,t),g(this,e,(n=>{this.ga._attachImageVectorListener(n)}))}}));var Qa,Pe=class extends M1{};async function w(e,t,n){return(async function(r,s,i,o){return x1(r,s,i,o)})(e,n.canvas??(Ra()?void 0:document.createElement("canvas")),t,n)}function Ja(e,t,n,r){if(e.U){const i=new ra;if(n!=null&&n.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var s=n.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(i,1,(s.left+s.right)/2),y(i,2,(s.top+s.bottom)/2),y(i,4,s.right-s.left),y(i,3,s.bottom-s.top)}else y(i,1,.5),y(i,2,.5),y(i,4,1),y(i,3,1);if(n!=null&&n.rotationDegrees){if((n==null?void 0:n.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(y(i,5,-Math.PI*n.rotationDegrees/180),(n==null?void 0:n.rotationDegrees)%180!=0){const[o,a]=Ua(t);n=$(i,3)*a/o,s=$(i,4)*o/a,y(i,4,n),y(i,3,s)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,r)}e.g.pa(t,e.X,r??performance.now()),e.finishProcessing()}function Fe(e,t,n){var r;if((r=e.baseOptions)!=null&&r.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ja(e,t,n,e.C+1)}function je(e,t,n,r){var s;if(!((s=e.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ja(e,t,n,r)}function cn(e,t,n,r){var s=t.data;const i=t.width,o=i*(t=t.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return e=new X([s],n,!1,e.g.i.canvas,e.P,i,t),r?e.clone():e}var fe=class extends Bs{constructor(e,t,n,r){super(e),this.g=e,this.X=t,this.U=n,this.oa=r,this.P=new Wa}l(e,t=!0){if("runningMode"in e&&S(this.baseOptions,2,wn(!!e.runningMode&&e.runningMode!=="IMAGE")),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};fe.prototype.close=fe.prototype.close;var pe=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},_(e=this.h=new mr,0,1,t=new O),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Fe(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},je(this,e,n,t),this.j}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect_in"),E(e,"detections");const t=new le;Ue(t,p1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),C(n,"IMAGE:image_in"),C(n,"NORM_RECT:norm_rect_in"),b(n,"DETECTIONS:detections"),n.o(t),ke(e,n),this.g.attachProtoVectorListener("detections",((r,s)=>{for(const i of r)r=ea(i),this.j.detections.push(Oa(r));d(this,s)})),this.g.attachEmptyPacketListener("detections",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};pe.prototype.detectForVideo=pe.prototype.G,pe.prototype.detect=pe.prototype.F,pe.prototype.setOptions=pe.prototype.o,pe.createFromModelPath=async function(e,t){return w(pe,e,{baseOptions:{modelAssetPath:t}})},pe.createFromModelBuffer=function(e,t){return w(pe,e,{baseOptions:{modelAssetBuffer:t}})},pe.createFromOptions=function(e,t){return w(pe,e,t)};var zs=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]),Ws=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]),Ks=xe([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Za=xe([474,475],[475,476],[476,477],[477,474]),Xs=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]),Ys=xe([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),ec=xe([469,470],[470,471],[471,472],[472,469]),qs=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]),tc=[...zs,...Ws,...Ks,...Xs,...Ys,...qs],nc=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 rc(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var M=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,_(e=this.h=new la,0,1,t=new O),this.A=new ua,_(this.h,0,3,this.A),this.u=new mr,_(this.h,0,2,this.u),Xe(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"numFaces"in e&&Xe(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return rc(this),Fe(this,e,t),this.j}G(e,t,n){return rc(this),je(this,e,n,t),this.j}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect"),E(e,"face_landmarks");const t=new le;Ue(t,m1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),C(n,"IMAGE:image_in"),C(n,"NORM_RECT:norm_rect"),b(n,"NORM_LANDMARKS:face_landmarks"),n.o(t),ke(e,n),this.g.attachProtoVectorListener("face_landmarks",((r,s)=>{for(const i of r)r=xn(i),this.j.faceLandmarks.push(yr(r));d(this,s)})),this.g.attachEmptyPacketListener("face_landmarks",(r=>{d(this,r)})),this.outputFaceBlendshapes&&(E(e,"blendshapes"),b(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((r,s)=>{if(this.outputFaceBlendshapes)for(const i of r)r=fr(i),this.j.faceBlendshapes.push(Us(r.g()??[]));d(this,s)})),this.g.attachEmptyPacketListener("blendshapes",(r=>{d(this,r)}))),this.outputFacialTransformationMatrixes&&(E(e,"face_geometry"),b(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((r,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of r)(r=A(r=g1(i),o1,2))&&this.j.facialTransformationMatrixes.push({rows:Ae(r,1)??0??0,columns:Ae(r,2)??0??0,data:vt(r,3,Re,_t()).slice()??[]});d(this,s)})),this.g.attachEmptyPacketListener("face_geometry",(r=>{d(this,r)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};M.prototype.detectForVideo=M.prototype.G,M.prototype.detect=M.prototype.F,M.prototype.setOptions=M.prototype.o,M.createFromModelPath=function(e,t){return w(M,e,{baseOptions:{modelAssetPath:t}})},M.createFromModelBuffer=function(e,t){return w(M,e,{baseOptions:{modelAssetBuffer:t}})},M.createFromOptions=function(e,t){return w(M,e,t)},M.FACE_LANDMARKS_LIPS=zs,M.FACE_LANDMARKS_LEFT_EYE=Ws,M.FACE_LANDMARKS_LEFT_EYEBROW=Ks,M.FACE_LANDMARKS_LEFT_IRIS=Za,M.FACE_LANDMARKS_RIGHT_EYE=Xs,M.FACE_LANDMARKS_RIGHT_EYEBROW=Ys,M.FACE_LANDMARKS_RIGHT_IRIS=ec,M.FACE_LANDMARKS_FACE_OVAL=qs,M.FACE_LANDMARKS_CONTOURS=tc,M.FACE_LANDMARKS_TESSELATION=nc;var Qs=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 sc(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function ic(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 oc(e,t=!0){const n=[];for(const s of e){var r=fr(s);e=[];for(const i of r.g())r=t&&Ae(i,1)!=null?Ae(i,1)??0:-1,e.push({score:$(i,2)??0,index:r,categoryName:q(L(i,3))??""??"",displayName:q(L(i,4))??""??""});n.push(e)}return n}var ge=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],_(e=this.j=new pa,0,1,t=new O),this.u=new Ps,_(this.j,0,2,this.u),this.D=new xs,_(this.u,0,3,this.D),this.A=new fa,_(this.u,0,2,this.A),this.h=new y1,_(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return A(this.j,O,1)}set baseOptions(e){_(this.j,0,1,e)}o(e){var s,i,o,a;if(Xe(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new sn,n=t,r=Ns(e.cannedGesturesClassifierOptions,(s=A(this.h,sn,3))==null?void 0:s.l());_(n,0,2,r),_(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=A(this.h,sn,3))==null||i.g());return e.customGesturesClassifierOptions?(_(n=t=new sn,0,2,r=Ns(e.customGesturesClassifierOptions,(o=A(this.h,sn,4))==null?void 0:o.l())),_(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=A(this.h,sn,4))==null||a.g()),this.l(e)}Ha(e,t){return sc(this),Fe(this,e,t),ic(this)}Ia(e,t,n){return sc(this),je(this,e,n,t),ic(this)}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect"),E(e,"hand_gestures"),E(e,"hand_landmarks"),E(e,"world_hand_landmarks"),E(e,"handedness");const t=new le;Ue(t,_1,this.j);const n=new ne;he(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),C(n,"IMAGE:image_in"),C(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),ke(e,n),this.g.attachProtoVectorListener("hand_landmarks",((r,s)=>{for(const i of r){r=xn(i);const o=[];for(const a of Ke(r,na,1))o.push({x:$(a,1)??0,y:$(a,2)??0,z:$(a,3)??0,visibility:$(a,4)??0});this.landmarks.push(o)}d(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(r=>{d(this,r)})),this.g.attachProtoVectorListener("world_hand_landmarks",((r,s)=>{for(const i of r){r=rn(i);const o=[];for(const a of Ke(r,ta,1))o.push({x:$(a,1)??0,y:$(a,2)??0,z:$(a,3)??0,visibility:$(a,4)??0});this.worldLandmarks.push(o)}d(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(r=>{d(this,r)})),this.g.attachProtoVectorListener("hand_gestures",((r,s)=>{this.gestures.push(...oc(r,!1)),d(this,s)})),this.g.attachEmptyPacketListener("hand_gestures",(r=>{d(this,r)})),this.g.attachProtoVectorListener("handedness",((r,s)=>{this.handedness.push(...oc(r)),d(this,s)})),this.g.attachEmptyPacketListener("handedness",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function ac(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ge.prototype.recognizeForVideo=ge.prototype.Ia,ge.prototype.recognize=ge.prototype.Ha,ge.prototype.setOptions=ge.prototype.o,ge.createFromModelPath=function(e,t){return w(ge,e,{baseOptions:{modelAssetPath:t}})},ge.createFromModelBuffer=function(e,t){return w(ge,e,{baseOptions:{modelAssetBuffer:t}})},ge.createFromOptions=function(e,t){return w(ge,e,t)},ge.HAND_CONNECTIONS=Qs;var me=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],_(e=this.h=new Ps,0,1,t=new O),this.u=new xs,_(this.h,0,3,this.u),this.j=new fa,_(this.h,0,2,this.j),Xe(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"numHands"in e&&Xe(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Fe(this,e,t),ac(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],je(this,e,n,t),ac(this)}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect"),E(e,"hand_landmarks"),E(e,"world_hand_landmarks"),E(e,"handedness");const t=new le;Ue(t,v1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),C(n,"IMAGE:image_in"),C(n,"NORM_RECT:norm_rect"),b(n,"LANDMARKS:hand_landmarks"),b(n,"WORLD_LANDMARKS:world_hand_landmarks"),b(n,"HANDEDNESS:handedness"),n.o(t),ke(e,n),this.g.attachProtoVectorListener("hand_landmarks",((r,s)=>{for(const i of r)r=xn(i),this.landmarks.push(yr(r));d(this,s)})),this.g.attachEmptyPacketListener("hand_landmarks",(r=>{d(this,r)})),this.g.attachProtoVectorListener("world_hand_landmarks",((r,s)=>{for(const i of r)r=rn(i),this.worldLandmarks.push(Pn(r));d(this,s)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(r=>{d(this,r)})),this.g.attachProtoVectorListener("handedness",((r,s)=>{var i=this.handedness,o=i.push;const a=[];for(const c of r){r=fr(c);const u=[];for(const h of r.g())u.push({score:$(h,2)??0,index:Ae(h,1)??0??-1,categoryName:q(L(h,3))??""??"",displayName:q(L(h,4))??""??""});a.push(u)}o.call(i,...a),d(this,s)})),this.g.attachEmptyPacketListener("handedness",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};me.prototype.detectForVideo=me.prototype.G,me.prototype.detect=me.prototype.F,me.prototype.setOptions=me.prototype.o,me.createFromModelPath=function(e,t){return w(me,e,{baseOptions:{modelAssetPath:t}})},me.createFromModelBuffer=function(e,t){return w(me,e,{baseOptions:{modelAssetBuffer:t}})},me.createFromOptions=function(e,t){return w(me,e,t)},me.HAND_CONNECTIONS=Qs;var cc=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 hc(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function uc(e){try{if(!e.D)return e.h;e.D(e.h)}finally{br(e)}}function Ar(e,t){e=xn(e),t.push(yr(e))}var x=class extends fe{constructor(e,t){super(new Pe(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,_(e=this.j=new ba,0,1,t=new O),this.I=new xs,_(this.j,0,2,this.I),this.W=new b1,_(this.j,0,3,this.W),this.u=new mr,_(this.j,0,4,this.u),this.O=new ua,_(this.j,0,5,this.O),this.A=new _a,_(this.j,0,6,this.A),this.M=new va,_(this.j,0,7,this.M),y(this.u,2,.5),y(this.u,3,.3),y(this.O,2,.5),y(this.A,2,.5),y(this.A,3,.3),y(this.M,2,.5),y(this.I,2,.5)}get baseOptions(){return A(this.j,O,1)}set baseOptions(e){_(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,n){const r=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:n,hc(this),Fe(this,e,r),uc(this)}G(e,t,n,r){const s=typeof n!="function"?n:{};return this.D=typeof n=="function"?n:r,hc(this),je(this,e,s,t),uc(this)}m(){var e=new de;F(e,"input_frames_image"),E(e,"pose_landmarks"),E(e,"pose_world_landmarks"),E(e,"face_landmarks"),E(e,"left_hand_landmarks"),E(e,"left_hand_world_landmarks"),E(e,"right_hand_landmarks"),E(e,"right_hand_world_landmarks");const t=new le,n=new No;he(n,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(s,i){if(i!=null)if(Array.isArray(i))S(s,2,qn(i,0,kn));else{if(!(typeof i=="string"||i instanceof $e||Ir(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");tt(s,2,Dr(i,!1),dt())}})(n,this.j.g());const r=new ne;he(r,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),os(r,8,No,n),C(r,"IMAGE:input_frames_image"),b(r,"POSE_LANDMARKS:pose_landmarks"),b(r,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),b(r,"FACE_LANDMARKS:face_landmarks"),b(r,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),b(r,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),b(r,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),b(r,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),r.o(t),ke(e,r),vr(this,e),this.g.attachProtoListener("pose_landmarks",((s,i)=>{Ar(s,this.h.poseLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("pose_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("pose_world_landmarks",((s,i)=>{var o=this.h.poseWorldLandmarks;s=rn(s),o.push(Pn(s)),d(this,i)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(s=>{d(this,s)})),this.outputPoseSegmentationMasks&&(b(r,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),on(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((s,i)=>{this.h.poseSegmentationMasks=[cn(this,s,!0,!this.D)],d(this,i)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(s=>{this.h.poseSegmentationMasks=[],d(this,s)}))),this.g.attachProtoListener("face_landmarks",((s,i)=>{Ar(s,this.h.faceLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(s=>{d(this,s)})),this.outputFaceBlendshapes&&(E(e,"extra_blendshapes"),b(r,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=fr(s),o.push(Us(s.g()??[]))),d(this,i)})),this.g.attachEmptyPacketListener("extra_blendshapes",(s=>{d(this,s)}))),this.g.attachProtoListener("left_hand_landmarks",((s,i)=>{Ar(s,this.h.leftHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("left_hand_world_landmarks",((s,i)=>{var o=this.h.leftHandWorldLandmarks;s=rn(s),o.push(Pn(s)),d(this,i)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("right_hand_landmarks",((s,i)=>{Ar(s,this.h.rightHandLandmarks),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(s=>{d(this,s)})),this.g.attachProtoListener("right_hand_world_landmarks",((s,i)=>{var o=this.h.rightHandWorldLandmarks;s=rn(s),o.push(Pn(s)),d(this,i)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(s=>{d(this,s)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};x.prototype.detectForVideo=x.prototype.G,x.prototype.detect=x.prototype.F,x.prototype.setOptions=x.prototype.o,x.createFromModelPath=function(e,t){return w(x,e,{baseOptions:{modelAssetPath:t}})},x.createFromModelBuffer=function(e,t){return w(x,e,{baseOptions:{modelAssetBuffer:t}})},x.createFromOptions=function(e,t){return w(x,e,t)},x.HAND_CONNECTIONS=Qs,x.POSE_CONNECTIONS=cc,x.FACE_LANDMARKS_LIPS=zs,x.FACE_LANDMARKS_LEFT_EYE=Ws,x.FACE_LANDMARKS_LEFT_EYEBROW=Ks,x.FACE_LANDMARKS_LEFT_IRIS=Za,x.FACE_LANDMARKS_RIGHT_EYE=Xs,x.FACE_LANDMARKS_RIGHT_EYEBROW=Ys,x.FACE_LANDMARKS_RIGHT_IRIS=ec,x.FACE_LANDMARKS_FACE_OVAL=qs,x.FACE_LANDMARKS_CONTOURS=tc,x.FACE_LANDMARKS_TESSELATION=nc;var Se=class extends fe{constructor(e,t){super(new Pe(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},_(e=this.h=new wa,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return _(this.h,0,2,Ns(e,A(this.h,Ts,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Fe(this,e,t),this.j}ta(e,t,n){return this.j={classifications:[]},je(this,e,n,t),this.j}m(){var e=new de;F(e,"input_image"),F(e,"norm_rect"),E(e,"classifications");const t=new le;Ue(t,w1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),C(n,"IMAGE:input_image"),C(n,"NORM_RECT:norm_rect"),b(n,"CLASSIFICATIONS:classifications"),n.o(t),ke(e,n),this.g.attachProtoListener("classifications",((r,s)=>{this.j=L1(h1(r)),d(this,s)})),this.g.attachEmptyPacketListener("classifications",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Se.prototype.classifyForVideo=Se.prototype.ta,Se.prototype.classify=Se.prototype.sa,Se.prototype.setOptions=Se.prototype.o,Se.createFromModelPath=function(e,t){return w(Se,e,{baseOptions:{modelAssetPath:t}})},Se.createFromModelBuffer=function(e,t){return w(Se,e,{baseOptions:{modelAssetBuffer:t}})},Se.createFromOptions=function(e,t){return w(Se,e,t)};var ye=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect",!0),this.h=new Aa,this.embeddings={embeddings:[]},_(e=this.h,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){var t=this.h,n=A(this.h,aa,2);return n=n?n.clone():new aa,e.l2Normalize!==void 0?S(n,1,wn(e.l2Normalize)):"l2Normalize"in e&&S(n,1),e.quantize!==void 0?S(n,2,wn(e.quantize)):"quantize"in e&&S(n,2),_(t,0,2,n),this.l(e)}za(e,t){return Fe(this,e,t),this.embeddings}Aa(e,t,n){return je(this,e,n,t),this.embeddings}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect"),E(e,"embeddings_out");const t=new le;Ue(t,A1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),C(n,"IMAGE:image_in"),C(n,"NORM_RECT:norm_rect"),b(n,"EMBEDDINGS:embeddings_out"),n.o(t),ke(e,n),this.g.attachProtoListener("embeddings_out",((r,s)=>{r=d1(r),this.embeddings=(function(i){return{embeddings:Ke(i,l1,1).map((o=>{var u,h;const a={headIndex:Ae(o,3)??0??-1,headName:q(L(o,4))??""??""};var c=o.v;return eo(c,0|c[f],sa,ns(o,1))!==void 0?(o=vt(o=A(o,sa,ns(o,1),void 0),1,Re,_t()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,u1,ns(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a})),timestampMs:Fa(ro(i))}})(r),d(this,s)})),this.g.attachEmptyPacketListener("embeddings_out",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=$a(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=$a(Ma(e.quantizedEmbedding),Ma(t.quantizedEmbedding))}return e},ye.prototype.embedForVideo=ye.prototype.Aa,ye.prototype.embed=ye.prototype.za,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return w(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return w(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return w(ye,e,t)};var Js=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach((n=>{n.close()})),(t=this.categoryMask)==null||t.close()}};function $1(e){var n,r;const t=(function(s){return Ke(s,ne,1)})(e.ca()).filter((s=>(q(L(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((r=(n=A(t[0],le,7))==null?void 0:n.j())==null?void 0:r.g())??new Map).forEach(((s,i)=>{e.u[Number(i)]=q(L(s,1))??""}))}function lc(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function dc(e){try{const t=new Js(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{br(e)}}Js.prototype.close=Js.prototype.close;var re=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new $s,this.A=new Ea,_(this.h,0,3,this.A),_(e=this.h,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?S(this.h,2,En(e.displayNamesLocale)):"displayNamesLocale"in e&&S(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){$1(this)}segment(e,t,n){const r=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:n,lc(this),Fe(this,e,r),dc(this)}La(e,t,n,r){const s=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:r,lc(this),je(this,e,s,t),dc(this)}Da(){return this.u}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect");const t=new le;Ue(t,Ta,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),C(n,"IMAGE:image_in"),C(n,"NORM_RECT:norm_rect"),n.o(t),ke(e,n),vr(this,e),this.outputConfidenceMasks&&(E(e,"confidence_masks"),b(n,"CONFIDENCE_MASKS:confidence_masks"),on(this,"confidence_masks"),this.g.aa("confidence_masks",((r,s)=>{this.confidenceMasks=r.map((i=>cn(this,i,!0,!this.j))),d(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(r=>{this.confidenceMasks=[],d(this,r)}))),this.outputCategoryMask&&(E(e,"category_mask"),b(n,"CATEGORY_MASK:category_mask"),on(this,"category_mask"),this.g.Z("category_mask",((r,s)=>{this.categoryMask=cn(this,r,!1,!this.j),d(this,s)})),this.g.attachEmptyPacketListener("category_mask",(r=>{this.categoryMask=void 0,d(this,r)}))),E(e,"quality_scores"),b(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((r,s)=>{this.qualityScores=r,d(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(r=>{this.categoryMask=void 0,d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};re.prototype.getLabels=re.prototype.Da,re.prototype.segmentForVideo=re.prototype.La,re.prototype.segment=re.prototype.segment,re.prototype.setOptions=re.prototype.o,re.createFromModelPath=function(e,t){return w(re,e,{baseOptions:{modelAssetPath:t}})},re.createFromModelBuffer=function(e,t){return w(re,e,{baseOptions:{modelAssetBuffer:t}})},re.createFromOptions=function(e,t){return w(re,e,t)};var Zs=class{constructor(e,t,n){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=n}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach((n=>{n.close()})),(t=this.categoryMask)==null||t.close()}};Zs.prototype.close=Zs.prototype.close;var Ve=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new $s,this.u=new Ea,_(this.h,0,3,this.u),_(e=this.h,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,n,r){const s=typeof n!="function"?n:{};if(this.j=typeof n=="function"?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Ca,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new Is;tt(i,3,wn(!0),!1),tt(i,1,bn(t.keypoint.x),0),tt(i,2,bn(t.keypoint.y),0),Sn(r,1,Rs,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new k1;for(i of t.scribble)tt(t=new Is,3,wn(!0),!1),tt(t,1,bn(i.x),0),tt(t,2,bn(i.y),0),os(a,1,Is,t);Sn(r,2,Rs,a)}}this.g.addProtoToStream(r.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),Fe(this,e,s);e:{try{const a=new Zs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{br(this)}o=void 0}return o}m(){var e=new de;F(e,"image_in"),F(e,"roi_in"),F(e,"norm_rect_in");const t=new le;Ue(t,Ta,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),C(n,"IMAGE:image_in"),C(n,"ROI:roi_in"),C(n,"NORM_RECT:norm_rect_in"),n.o(t),ke(e,n),vr(this,e),this.outputConfidenceMasks&&(E(e,"confidence_masks"),b(n,"CONFIDENCE_MASKS:confidence_masks"),on(this,"confidence_masks"),this.g.aa("confidence_masks",((r,s)=>{this.confidenceMasks=r.map((i=>cn(this,i,!0,!this.j))),d(this,s)})),this.g.attachEmptyPacketListener("confidence_masks",(r=>{this.confidenceMasks=[],d(this,r)}))),this.outputCategoryMask&&(E(e,"category_mask"),b(n,"CATEGORY_MASK:category_mask"),on(this,"category_mask"),this.g.Z("category_mask",((r,s)=>{this.categoryMask=cn(this,r,!1,!this.j),d(this,s)})),this.g.attachEmptyPacketListener("category_mask",(r=>{this.categoryMask=void 0,d(this,r)}))),E(e,"quality_scores"),b(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((r,s)=>{this.qualityScores=r,d(this,s)})),this.g.attachEmptyPacketListener("quality_scores",(r=>{this.categoryMask=void 0,d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.segment=Ve.prototype.segment,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return w(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return w(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return w(Ve,e,t)};var Te=class extends fe{constructor(e,t){super(new Pe(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},_(e=this.h=new xa,0,1,t=new O)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?S(this.h,2,En(e.displayNamesLocale)):"displayNamesLocale"in e&&S(this.h,2),e.maxResults!==void 0?Xe(this.h,3,e.maxResults):"maxResults"in e&&S(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&S(this.h,4),e.categoryAllowlist!==void 0?Qn(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&S(this.h,5),e.categoryDenylist!==void 0?Qn(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&S(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Fe(this,e,t),this.j}G(e,t,n){return this.j={detections:[]},je(this,e,n,t),this.j}m(){var e=new de;F(e,"input_frame_gpu"),F(e,"norm_rect"),E(e,"detections");const t=new le;Ue(t,S1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),C(n,"IMAGE:input_frame_gpu"),C(n,"NORM_RECT:norm_rect"),b(n,"DETECTIONS:detections"),n.o(t),ke(e,n),this.g.attachProtoVectorListener("detections",((r,s)=>{for(const i of r)r=ea(i),this.j.detections.push(Oa(r));d(this,s)})),this.g.attachEmptyPacketListener("detections",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Te.prototype.detectForVideo=Te.prototype.G,Te.prototype.detect=Te.prototype.F,Te.prototype.setOptions=Te.prototype.o,Te.createFromModelPath=async function(e,t){return w(Te,e,{baseOptions:{modelAssetPath:t}})},Te.createFromModelBuffer=function(e,t){return w(Te,e,{baseOptions:{modelAssetBuffer:t}})},Te.createFromOptions=function(e,t){return w(Te,e,t)};var ei=class{constructor(e,t,n){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=n}close(){var e;(e=this.segmentationMasks)==null||e.forEach((t=>{t.close()}))}};function fc(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function pc(e){try{const t=new ei(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{br(e)}}ei.prototype.close=ei.prototype.close;var _e=class extends fe{constructor(e,t){super(new Pe(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,_(e=this.h=new Pa,0,1,t=new O),this.A=new va,_(this.h,0,3,this.A),this.j=new _a,_(this.h,0,2,this.j),Xe(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return A(this.h,O,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"numPoses"in e&&Xe(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,n){const r=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:n,fc(this),Fe(this,e,r),pc(this)}G(e,t,n,r){const s=typeof n!="function"?n:{};return this.u=typeof n=="function"?n:r,fc(this),je(this,e,s,t),pc(this)}m(){var e=new de;F(e,"image_in"),F(e,"norm_rect"),E(e,"normalized_landmarks"),E(e,"world_landmarks"),E(e,"segmentation_masks");const t=new le;Ue(t,T1,this.h);const n=new ne;he(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),C(n,"IMAGE:image_in"),C(n,"NORM_RECT:norm_rect"),b(n,"NORM_LANDMARKS:normalized_landmarks"),b(n,"WORLD_LANDMARKS:world_landmarks"),n.o(t),ke(e,n),vr(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((r,s)=>{this.landmarks=[];for(const i of r)r=xn(i),this.landmarks.push(yr(r));d(this,s)})),this.g.attachEmptyPacketListener("normalized_landmarks",(r=>{this.landmarks=[],d(this,r)})),this.g.attachProtoVectorListener("world_landmarks",((r,s)=>{this.worldLandmarks=[];for(const i of r)r=rn(i),this.worldLandmarks.push(Pn(r));d(this,s)})),this.g.attachEmptyPacketListener("world_landmarks",(r=>{this.worldLandmarks=[],d(this,r)})),this.outputSegmentationMasks&&(b(n,"SEGMENTATION_MASK:segmentation_masks"),on(this,"segmentation_masks"),this.g.aa("segmentation_masks",((r,s)=>{this.segmentationMasks=r.map((i=>cn(this,i,!0,!this.u))),d(this,s)})),this.g.attachEmptyPacketListener("segmentation_masks",(r=>{this.segmentationMasks=[],d(this,r)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.G,_e.prototype.detect=_e.prototype.F,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=function(e,t){return w(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return w(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return w(_e,e,t)},_e.POSE_CONNECTIONS=cc;const I1=.1,R1=.42,gc=.14,mc=.18,yc=.12,N1=0,U1=1,D1=2;function _c(e){var h;const{detections:t,width:n,height:r}=e;if(t.length===0)return{hasFace:!1,faceCount:0,confidence:0,isCentered:!1,passesQualityChecks:!1,feedback:"no-face",message:"No face detected. Center your face in the oval and look at the camera."};if(t.length>1)return{hasFace:!0,faceCount:t.length,confidence:((h=t[0])==null?void 0:h.confidence)??0,isCentered:!1,passesQualityChecks:!1,feedback:"multiple-faces",message:"Multiple faces detected. Make sure only one person is in view."};const s=t[0],i=s.boundingBox;if(!i)return{hasFace:!0,faceCount:1,confidence:s.confidence,isCentered:!1,passesQualityChecks:!1,feedback:"face-unclear",message:"Face detected, but the frame is unclear. Hold still and try again."};const o=i.width*i.height/(n*r);if(o<I1)return Tt(s.confidence,"too-far","Move closer to the camera.");if(o>R1)return Tt(s.confidence,"too-close","Move slightly farther away.");const a=(i.originX+i.width/2)/n,c=(i.originY+i.height/2)/r;if(a<.5-gc)return Tt(s.confidence,"move-right","Move your face a little to the right.");if(a>.5+gc)return Tt(s.confidence,"move-left","Move your face a little to the left.");if(c<.5-mc)return Tt(s.confidence,"move-down","Move your face slightly down.");if(c>.5+mc)return Tt(s.confidence,"move-up","Move your face slightly up.");const u=B1(s.keypoints);return u?Tt(s.confidence,u.feedback,u.message):{hasFace:!0,faceCount:1,confidence:s.confidence,isCentered:!0,passesQualityChecks:!0,feedback:"good",message:"Hold still. Capturing automatically..."}}function B1(e){const t=e[N1],n=e[U1],r=e[D1];if(!t||!n||!r)return null;const s=(t.x+n.x)/2,i=Math.abs(n.x-t.x);if(i===0)return null;const o=(r.x-s)/i;return o<=-yc?{feedback:"turn-right",message:"Turn slightly right so your face points at the camera."}:o>=yc?{feedback:"turn-left",message:"Turn slightly left so your face points at the camera."}:null}function Tt(e,t,n){return{hasFace:!0,faceCount:1,confidence:e,isCentered:!1,passesQualityChecks:!1,feedback:t,message:n}}function $h(e){return e}const j1="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/wasm",V1="https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",G1=.7;let vc=null,bc=null,wc=null;function H1(){return vc??(vc=St.forVisionTasks(j1)),vc}function z1(){return bc??(bc=Ec("IMAGE")),bc}function Ac(){return wc??(wc=Ec("VIDEO")),wc}async function Ec(e){const t=await H1();return pe.createFromOptions(t,{baseOptions:{modelAssetPath:V1},runningMode:e,minDetectionConfidence:G1})}async function kc(e){const n=(await z1()).detect(e);return _c({detections:Sc(n.detections),width:e.naturalWidth,height:e.naturalHeight})}async function W1(e,t){const r=(await Ac()).detectForVideo(e,t);return _c({detections:Sc(r.detections),width:e.videoWidth,height:e.videoHeight})}function Sc(e){return e.map(t=>{var n;return{boundingBox:t.boundingBox?{originX:t.boundingBox.originX,originY:t.boundingBox.originY,width:t.boundingBox.width,height:t.boundingBox.height}:void 0,confidence:((n=t.categories[0])==null?void 0:n.score)??0,keypoints:t.keypoints.map(r=>({x:r.x,y:r.y}))}})}const K1="2147483647",X1=180,Y1=3;async function ti(){var t;if(Z1())return J1();if(!((t=navigator.mediaDevices)!=null&&t.getUserMedia))throw new Error("In-browser camera capture is not supported in this browser.");const e=await q1()?"auto":"manual";return Q1(e)}async function q1(){if(typeof window.requestAnimationFrame!="function"||typeof window.cancelAnimationFrame!="function"||!document.createElement("canvas").getContext("2d"))return!1;try{return await Ac(),!0}catch{return!1}}async function Q1(e){let t;try{t=await navigator.mediaDevices.getUserMedia({video:{facingMode:{ideal:"user"}},audio:!1})}catch(s){throw new Error(sh(s))}let n=!1;const r=()=>{n||(n=!0,t.getTracks().forEach(s=>s.stop()))};return new Promise((s,i)=>{let o=!1,a=e,c=null,u="",h=null,l=null,m=null,v=0,k=0,Ft=!1,Le=!1,Qe=!1;const Bn=()=>{l!==null&&window.cancelAnimationFrame(l),m&&window.removeEventListener("keydown",m),u&&URL.revokeObjectURL(u),r(),c==null||c.remove()},Ge=(se,He)=>{if(!o){if(o=!0,Bn(),He){i(He);return}s(se)}},ui=(se,He,Oe,Me,ve,H,te,be)=>{Le=!1,k=0,u&&(URL.revokeObjectURL(u),u=""),h=null,He.replaceChildren(se,rh()),Qe&&th(se),Oe.textContent=a==="auto"?"Center your face":"Take a face photo",Me.textContent=a==="auto"?"Keep your face inside the oval. We will capture automatically when the framing looks good.":"Line up your face in the oval, then take a photo manually.",ve.textContent=a==="auto"?"Looking for a single face in frame...":"When you are ready, press Take photo.",kr(ve,a==="auto"?"neutral":"manual"),be.style.display=a==="manual"?"inline-flex":"none",be.disabled=!0,H.replaceChildren(te,be)},Xc=(se,He,Oe,Me,ve,H,te,be,Je,we,Z)=>{Le=!0,k=0,u&&URL.revokeObjectURL(u),u=URL.createObjectURL(we),h=we;const Ze=document.createElement("img");Ze.alt="Captured face preview",Ze.src=u,J(Ze,{position:"absolute",inset:"0",zIndex:"1",width:"100%",height:"100%",objectFit:"cover"}),He.replaceChildren(se,Ze),Oe.textContent="Review your photo",Me.textContent=(Z==null?void 0:Z.passesQualityChecks)===!1?"The capture did not pass the checks. Retake the photo.":"Confirm this photo or retake it.",ve.textContent=(Z==null?void 0:Z.message)??"Review the captured image before continuing.",kr(ve,Z?Z.passesQualityChecks?"success":"error":"manual"),H.replaceChildren(te,Je),(Z==null?void 0:Z.passesQualityChecks)!==!1&&H.append(be)};try{let se=function(){o||Le||a!=="auto"||(l=window.requestAnimationFrame(async ie=>{if(Le||Ft||ie-v<X1){se();return}v=ie,Ft=!0;try{const Ot=await W1(H,ie);if(te.textContent=Ot.message,kr(te,Ot.passesQualityChecks?"success":"neutral"),Ot.passesQualityChecks?k+=1:k=0,k>=Y1){const Mh=await Tc(H);Xc(H,ve,Oe,Me,te,be,Je,Z,Ze,Mh,Ot);return}}catch{a="manual",ui(H,ve,Oe,Me,te,be,Je,we),we.disabled=!1,te.textContent="Automatic capture is unavailable in this browser. Use Take photo instead.",kr(te,"manual")}finally{Ft=!1}se()}))};c=document.createElement("div"),c.setAttribute("data-simface-camera-overlay","true"),c.setAttribute("role","dialog"),c.setAttribute("aria-modal","true"),J(c,{position:"fixed",inset:"0",zIndex:K1,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"rgba(15, 23, 42, 0.82)"});const He=document.createElement("div");J(He,{width:"min(100%, 560px)",display:"flex",flexDirection:"column",gap:"16px",padding:"20px",borderRadius:"20px",background:"#020617",color:"#e2e8f0",boxShadow:"0 24px 60px rgba(15, 23, 42, 0.35)"});const Oe=document.createElement("h2");J(Oe,{margin:"0",fontSize:"1.25rem",fontWeight:"700"});const Me=document.createElement("p");J(Me,{margin:"0",color:"#cbd5e1",fontSize:"0.95rem",lineHeight:"1.5"});const ve=document.createElement("div");J(ve,{position:"relative",overflow:"hidden",width:"100%",aspectRatio:"3 / 4",minHeight:"320px",borderRadius:"18px",background:"#000"});const H=document.createElement("video");H.autoplay=!0,H.muted=!0,H.playsInline=!0,H.srcObject=t,J(H,{width:"100%",height:"100%",objectFit:"cover"});const te=document.createElement("div");J(te,{borderRadius:"14px",padding:"12px 14px",font:'600 14px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'});const be=document.createElement("div");J(be,{display:"flex",flexWrap:"wrap",gap:"12px",justifyContent:"flex-end"});const Je=Er("Cancel","secondary");Je.dataset.simfaceAction="cancel";const we=Er("Take photo","primary");we.dataset.simfaceAction="capture",we.style.display=a==="manual"?"inline-flex":"none",we.disabled=!0;const Z=Er("Use photo","primary");Z.dataset.simfaceAction="confirm";const Ze=Er("Retake","secondary");Ze.dataset.simfaceAction="retake",He.append(Oe,Me,ve,te,be),c.append(He),document.body.appendChild(c),ui(H,ve,Oe,Me,te,be,Je,we),m=ie=>{ie.key==="Escape"&&Ge(null)},Je.addEventListener("click",()=>Ge(null)),Z.addEventListener("click",async()=>{if(!h){Ge(null,new Error("Failed to confirm the photo."));return}Ge(h)}),Ze.addEventListener("click",()=>{ui(H,ve,Oe,Me,te,be,Je,we),a==="manual"&&Qe&&(we.disabled=!1),a==="auto"&&se()}),we.addEventListener("click",async()=>{if(!Le)try{const ie=await Tc(H),Ot=await nh(ie);Xc(H,ve,Oe,Me,te,be,Je,Z,Ze,ie,Ot)}catch(ie){Ge(null,ie instanceof Error?ie:new Error("Failed to capture an image."))}}),window.addEventListener("keydown",m),eh(H).then(()=>{if(Qe=!0,a==="manual"){we.disabled=!1;return}se()}).catch(ie=>{Ge(null,ie instanceof Error?ie:new Error("Failed to start the camera preview."))})}catch(se){Ge(null,se instanceof Error?se:new Error("Failed to open the camera capture UI."))}})}function J1(){return new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/*",t.capture="user",t.style.display="none",t.addEventListener("change",()=>{var i;const s=((i=t.files)==null?void 0:i[0])??null;r(),e(s)});const n=()=>{setTimeout(()=>{var s;(s=t.files)!=null&&s.length||(r(),e(null))},500)};window.addEventListener("focus",n,{once:!0});function r(){window.removeEventListener("focus",n),t.remove()}document.body.appendChild(t),t.click()})}function Z1(){return/WhatsApp/i.test(navigator.userAgent)}async function eh(e){if(e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){await e.play();return}await new Promise((t,n)=>{const r=()=>{i(),t()},s=()=>{i(),n(new Error("Failed to start the camera preview."))},i=()=>{e.removeEventListener("loadedmetadata",r),e.removeEventListener("error",s)};e.addEventListener("loadedmetadata",r,{once:!0}),e.addEventListener("error",s,{once:!0})}),await e.play()}function Tc(e){if(!e.videoWidth||!e.videoHeight)return Promise.reject(new Error("Camera preview is not ready yet."));const t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0,t.width,t.height),new Promise((r,s)=>{t.toBlob(i=>{if(!i){s(new Error("Failed to capture an image."));return}r(i)},"image/jpeg",.92)})):Promise.reject(new Error("Failed to initialize camera capture."))}function th(e){e.play().catch(()=>{})}async function nh(e){try{const t=await Lc(e);return await kc(t)}catch{return null}}function Er(e,t){const n=document.createElement("button");return n.type="button",n.textContent=e,J(n,{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"999px",padding:"12px 18px",font:'600 15px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',cursor:"pointer",color:t==="primary"?"#fff":"#0f172a",background:t==="primary"?"#2563eb":"#e2e8f0"}),n}function rh(){const e=document.createElement("div");J(e,{position:"absolute",inset:"0",pointerEvents:"none"});const t=document.createElement("div");return J(t,{position:"absolute",left:"50%",top:"50%",width:"64%",height:"76%",transform:"translate(-50%, -50%)",borderRadius:"999px",border:"3px solid rgba(255, 255, 255, 0.9)",boxShadow:"0 0 0 9999px rgba(2, 6, 23, 0.34)"}),e.append(t),e}function kr(e,t){switch(t){case"success":J(e,{background:"#dcfce7",color:"#166534"});return;case"error":J(e,{background:"#fee2e2",color:"#991b1b"});return;case"manual":J(e,{background:"#e0f2fe",color:"#0f172a"});return;default:J(e,{background:"#e2e8f0",color:"#0f172a"})}}function J(e,t){Object.assign(e.style,t)}function sh(e){if(e instanceof DOMException)switch(e.name){case"NotAllowedError":case"SecurityError":return"Camera access was denied. Allow camera access and try again.";case"NotFoundError":return"No camera was found on this device.";case"NotReadableError":return"The camera is already in use by another application.";default:return e.message||"Failed to access the camera."}return e instanceof Error?e.message:"Failed to access the camera."}function Lc(e){return new Promise((t,n)=>{const r=URL.createObjectURL(e),s=new Image;s.onload=()=>{URL.revokeObjectURL(r),t(s)},s.onerror=()=>{URL.revokeObjectURL(r),n(new Error("Failed to load captured image"))},s.src=r})}function ih(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(new Error("Failed to read image")),r.readAsDataURL(e)})}/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2019 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/const
|
|
19
|
+
*/const Sr=globalThis,ni=Sr.ShadowRoot&&(Sr.ShadyCSS===void 0||Sr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ri=Symbol(),Cc=new WeakMap;let xc=class{constructor(t,n,r){if(this._$cssResult$=!0,r!==ri)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}get styleSheet(){let t=this.o;const n=this.t;if(ni&&t===void 0){const r=n!==void 0&&n.length===1;r&&(t=Cc.get(n)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Cc.set(n,t))}return t}toString(){return this.cssText}};const oh=e=>new xc(typeof e=="string"?e:e+"",void 0,ri),ah=(e,...t)=>{const n=e.length===1?e[0]:t.reduce((r,s,i)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[i+1],e[0]);return new xc(n,e,ri)},ch=(e,t)=>{if(ni)e.adoptedStyleSheets=t.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of t){const r=document.createElement("style"),s=Sr.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=n.cssText,e.appendChild(r)}},Pc=ni?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let n="";for(const r of t.cssRules)n+=r.cssText;return oh(n)})(e):e;/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const{is:
|
|
23
|
+
*/const{is:hh,defineProperty:uh,getOwnPropertyDescriptor:lh,getOwnPropertyNames:dh,getOwnPropertySymbols:fh,getPrototypeOf:ph}=Object,ct=globalThis,Fc=ct.trustedTypes,gh=Fc?Fc.emptyScript:"",si=ct.reactiveElementPolyfillSupport,On=(e,t)=>e,Tr={toAttribute(e,t){switch(t){case Boolean:e=e?gh:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},ii=(e,t)=>!hh(e,t),Oc={attribute:!0,type:String,converter:Tr,reflect:!1,useDefault:!1,hasChanged:ii};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ct.litPropertyMetadata??(ct.litPropertyMetadata=new WeakMap);let hn=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,n=Oc){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(t,n),!n.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(t,r,n);s!==void 0&&uh(this.prototype,t,s)}}static getPropertyDescriptor(t,n,r){const{get:s,set:i}=lh(this.prototype,t)??{get(){return this[n]},set(o){this[n]=o}};return{get:s,set(o){const a=s==null?void 0:s.call(this);i==null||i.call(this,o),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Oc}static _$Ei(){if(this.hasOwnProperty(On("elementProperties")))return;const t=ph(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(On("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(On("properties"))){const n=this.properties,r=[...dh(n),...fh(n)];for(const s of r)this.createProperty(s,n[s])}const t=this[Symbol.metadata];if(t!==null){const n=litPropertyMetadata.get(t);if(n!==void 0)for(const[r,s]of n)this.elementProperties.set(r,s)}this._$Eh=new Map;for(const[n,r]of this.elementProperties){const s=this._$Eu(n,r);s!==void 0&&this._$Eh.set(s,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const n=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const s of r)n.unshift(Pc(s))}else t!==void 0&&n.push(Pc(t));return n}static _$Eu(t,n){const r=n.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(n=>n(this))}addController(t){var n;(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)==null||n.call(t))}removeController(t){var n;(n=this._$EO)==null||n.delete(t)}_$E_(){const t=new Map,n=this.constructor.elementProperties;for(const r of n.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ch(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$EO)==null||t.forEach(n=>{var r;return(r=n.hostConnected)==null?void 0:r.call(n)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(n=>{var r;return(r=n.hostDisconnected)==null?void 0:r.call(n)})}attributeChangedCallback(t,n,r){this._$AK(t,r)}_$ET(t,n){var i;const r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){const o=(((i=r.converter)==null?void 0:i.toAttribute)!==void 0?r.converter:Tr).toAttribute(n,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,n){var i,o;const r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){const a=r.getPropertyOptions(s),c=typeof a.converter=="function"?{fromAttribute:a.converter}:((i=a.converter)==null?void 0:i.fromAttribute)!==void 0?a.converter:Tr;this._$Em=s;const u=c.fromAttribute(n,a.type);this[s]=u??((o=this._$Ej)==null?void 0:o.get(s))??u,this._$Em=null}}requestUpdate(t,n,r,s=!1,i){var o;if(t!==void 0){const a=this.constructor;if(s===!1&&(i=this[t]),r??(r=a.getPropertyOptions(t)),!((r.hasChanged??ii)(i,n)||r.useDefault&&r.reflect&&i===((o=this._$Ej)==null?void 0:o.get(t))&&!this.hasAttribute(a._$Eu(t,r))))return;this.C(t,n,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,n,{useDefault:r,reflect:s,wrapped:i},o){r&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??n??this[t]),i!==!0||o!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(n=void 0),this._$AL.set(t,n)),s===!0&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[i,o]of s){const{wrapped:a}=o,c=this[i];a!==!0||this._$AL.has(i)||c===void 0||this.C(i,void 0,o,c)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(r=this._$EO)==null||r.forEach(s=>{var i;return(i=s.hostUpdate)==null?void 0:i.call(s)}),this.update(n)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(n)}willUpdate(t){}_$AE(t){var n;(n=this._$EO)==null||n.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(n=>this._$ET(n,this[n]))),this._$EM()}updated(t){}firstUpdated(t){}};hn.elementStyles=[],hn.shadowRootOptions={mode:"open"},hn[On("elementProperties")]=new Map,hn[On("finalized")]=new Map,si==null||si({ReactiveElement:hn}),(ct.reactiveElementVersions??(ct.reactiveElementVersions=[])).push("2.1.2");/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
28
|
-
\f\r]`,
|
|
29
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
27
|
+
*/const Mn=globalThis,Mc=e=>e,Lr=Mn.trustedTypes,$c=Lr?Lr.createPolicy("lit-html",{createHTML:e=>e}):void 0,Ic="$lit$",ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Rc="?"+ht,mh=`<${Rc}>`,Lt=document,$n=()=>Lt.createComment(""),In=e=>e===null||typeof e!="object"&&typeof e!="function",oi=Array.isArray,yh=e=>oi(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",ai=`[
|
|
28
|
+
\f\r]`,Rn=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Nc=/-->/g,Uc=/>/g,Ct=RegExp(`>|${ai}(?:([^\\s"'>=/]+)(${ai}*=${ai}*(?:[^
|
|
29
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dc=/'/g,Bc=/"/g,jc=/^(?:script|style|textarea|title)$/i,_h=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),Cr=_h(1),un=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),Vc=new WeakMap,xt=Lt.createTreeWalker(Lt,129);function Gc(e,t){if(!oi(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return $c!==void 0?$c.createHTML(t):t}const vh=(e,t)=>{const n=e.length-1,r=[];let s,i=t===2?"<svg>":t===3?"<math>":"",o=Rn;for(let a=0;a<n;a++){const c=e[a];let u,h,l=-1,m=0;for(;m<c.length&&(o.lastIndex=m,h=o.exec(c),h!==null);)m=o.lastIndex,o===Rn?h[1]==="!--"?o=Nc:h[1]!==void 0?o=Uc:h[2]!==void 0?(jc.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=Ct):h[3]!==void 0&&(o=Ct):o===Ct?h[0]===">"?(o=s??Rn,l=-1):h[1]===void 0?l=-2:(l=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Ct:h[3]==='"'?Bc:Dc):o===Bc||o===Dc?o=Ct:o===Nc||o===Uc?o=Rn:(o=Ct,s=void 0);const v=o===Ct&&e[a+1].startsWith("/>")?" ":"";i+=o===Rn?c+mh:l>=0?(r.push(u),c.slice(0,l)+Ic+c.slice(l)+ht+v):c+ht+(l===-2?a:v)}return[Gc(e,i+(e[n]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]};class Nn{constructor({strings:t,_$litType$:n},r){let s;this.parts=[];let i=0,o=0;const a=t.length-1,c=this.parts,[u,h]=vh(t,n);if(this.el=Nn.createElement(u,r),xt.currentNode=this.el.content,n===2||n===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(s=xt.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(const l of s.getAttributeNames())if(l.endsWith(Ic)){const m=h[o++],v=s.getAttribute(l).split(ht),k=/([.?@])?(.*)/.exec(m);c.push({type:1,index:i,name:k[2],strings:v,ctor:k[1]==="."?wh:k[1]==="?"?Ah:k[1]==="@"?Eh:xr}),s.removeAttribute(l)}else l.startsWith(ht)&&(c.push({type:6,index:i}),s.removeAttribute(l));if(jc.test(s.tagName)){const l=s.textContent.split(ht),m=l.length-1;if(m>0){s.textContent=Lr?Lr.emptyScript:"";for(let v=0;v<m;v++)s.append(l[v],$n()),xt.nextNode(),c.push({type:2,index:++i});s.append(l[m],$n())}}}else if(s.nodeType===8)if(s.data===Rc)c.push({type:2,index:i});else{let l=-1;for(;(l=s.data.indexOf(ht,l+1))!==-1;)c.push({type:7,index:i}),l+=ht.length-1}i++}}static createElement(t,n){const r=Lt.createElement("template");return r.innerHTML=t,r}}function ln(e,t,n=e,r){var o,a;if(t===un)return t;let s=r!==void 0?(o=n._$Co)==null?void 0:o[r]:n._$Cl;const i=In(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==i&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),i===void 0?s=void 0:(s=new i(e),s._$AT(e,n,r)),r!==void 0?(n._$Co??(n._$Co=[]))[r]=s:n._$Cl=s),s!==void 0&&(t=ln(e,s._$AS(e,t.values),s,r)),t}class bh{constructor(t,n){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:n},parts:r}=this._$AD,s=((t==null?void 0:t.creationScope)??Lt).importNode(n,!0);xt.currentNode=s;let i=xt.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Un(i,i.nextSibling,this,t):c.type===1?u=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(u=new kh(i,this,t)),this._$AV.push(u),c=r[++a]}o!==(c==null?void 0:c.index)&&(i=xt.nextNode(),o++)}return xt.currentNode=Lt,s}p(t){let n=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,n),n+=r.strings.length-2):r._$AI(t[n])),n++}}class Un{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,n,r,s){this.type=2,this._$AH=Y,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=r,this.options=s,this._$Cv=(s==null?void 0:s.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=n.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,n=this){t=ln(this,t,n),In(t)?t===Y||t==null||t===""?(this._$AH!==Y&&this._$AR(),this._$AH=Y):t!==this._$AH&&t!==un&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):yh(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Y&&In(this._$AH)?this._$AA.nextSibling.data=t:this.T(Lt.createTextNode(t)),this._$AH=t}$(t){var i;const{values:n,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Nn.createElement(Gc(r.h,r.h[0]),this.options)),r);if(((i=this._$AH)==null?void 0:i._$AD)===s)this._$AH.p(n);else{const o=new bh(s,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}_$AC(t){let n=Vc.get(t.strings);return n===void 0&&Vc.set(t.strings,n=new Nn(t)),n}k(t){oi(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let r,s=0;for(const i of t)s===n.length?n.push(r=new Un(this.O($n()),this.O($n()),this,this.options)):r=n[s],r._$AI(i),s++;s<n.length&&(this._$AR(r&&r._$AB.nextSibling,s),n.length=s)}_$AR(t=this._$AA.nextSibling,n){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,n);t!==this._$AB;){const s=Mc(t).nextSibling;Mc(t).remove(),t=s}}setConnected(t){var n;this._$AM===void 0&&(this._$Cv=t,(n=this._$AP)==null||n.call(this,t))}}class xr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,n,r,s,i){this.type=1,this._$AH=Y,this._$AN=void 0,this.element=t,this.name=n,this._$AM=s,this.options=i,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Y}_$AI(t,n=this,r,s){const i=this.strings;let o=!1;if(i===void 0)t=ln(this,t,n,0),o=!In(t)||t!==this._$AH&&t!==un,o&&(this._$AH=t);else{const a=t;let c,u;for(t=i[0],c=0;c<i.length-1;c++)u=ln(this,a[r+c],n,c),u===un&&(u=this._$AH[c]),o||(o=!In(u)||u!==this._$AH[c]),u===Y?t=Y:t!==Y&&(t+=(u??"")+i[c+1]),this._$AH[c]=u}o&&!s&&this.j(t)}j(t){t===Y?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class wh extends xr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Y?void 0:t}}class Ah extends xr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Y)}}class Eh extends xr{constructor(t,n,r,s,i){super(t,n,r,s,i),this.type=5}_$AI(t,n=this){if((t=ln(this,t,n,0)??Y)===un)return;const r=this._$AH,s=t===Y&&r!==Y||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==Y&&(r===Y||s);s&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,t):this._$AH.handleEvent(t)}}class kh{constructor(t,n,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ln(this,t)}}const ci=Mn.litHtmlPolyfillSupport;ci==null||ci(Nn,Un),(Mn.litHtmlVersions??(Mn.litHtmlVersions=[])).push("3.3.2");const Sh=(e,t,n)=>{const r=(n==null?void 0:n.renderBefore)??t;let s=r._$litPart$;if(s===void 0){const i=(n==null?void 0:n.renderBefore)??null;r._$litPart$=s=new Un(t.insertBefore($n(),i),i,void 0,n??{})}return s._$AI(e),s};/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
32
32
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/const
|
|
33
|
+
*/const Pt=globalThis;class Dn extends hn{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const t=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=t.firstChild),t}update(t){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Sh(n,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return un}}Dn._$litElement$=!0,Dn.finalized=!0,(Kc=Pt.litElementHydrateSupport)==null||Kc.call(Pt,{LitElement:Dn});const hi=Pt.litElementPolyfillSupport;hi==null||hi({LitElement:Dn}),(Pt.litElementVersions??(Pt.litElementVersions=[])).push("4.2.2");/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2017 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
|
-
*/const
|
|
37
|
+
*/const Th=e=>(t,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)};/**
|
|
38
38
|
* @license
|
|
39
39
|
* Copyright 2017 Google LLC
|
|
40
40
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
41
|
-
*/const
|
|
41
|
+
*/const Lh={attribute:!0,type:String,converter:Tr,reflect:!1,hasChanged:ii},Ch=(e=Lh,t,n)=>{const{kind:r,metadata:s}=n;let i=globalThis.litPropertyMetadata.get(s);if(i===void 0&&globalThis.litPropertyMetadata.set(s,i=new Map),r==="setter"&&((e=Object.create(e)).wrapped=!0),i.set(n.name,e),r==="accessor"){const{name:o}=n;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,e,!0,a)},init(a){return a!==void 0&&this.C(o,void 0,e,a),a}}}if(r==="setter"){const{name:o}=n;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,e,!0,a)}}throw Error("Unsupported decorator location: "+r)};function Hc(e){return(t,n)=>typeof n=="object"?Ch(e,t,n):((r,s,i)=>{const o=s.hasOwnProperty(i);return s.constructor.createProperty(i,r),o?Object.getOwnPropertyDescriptor(s,i):void 0})(e,t,n)}/**
|
|
42
42
|
* @license
|
|
43
43
|
* Copyright 2017 Google LLC
|
|
44
44
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
45
|
-
*/function
|
|
45
|
+
*/function zc(e){return Hc({...e,state:!0,attribute:!1})}var xh=Object.defineProperty,Ph=Object.getOwnPropertyDescriptor,Pr=(e,t,n,r)=>{for(var s=r>1?void 0:r?Ph(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&xh(t,n,s),s};B.SimFaceCapture=class extends Dn{constructor(){super(...arguments),this.label="Take a selfie",this.captureState="idle",this.errorMessage=""}render(){return Cr`
|
|
46
46
|
<div class="container">
|
|
47
47
|
${this.renderState()}
|
|
48
48
|
</div>
|
|
49
|
-
`}renderState(){
|
|
49
|
+
`}renderState(){switch(this.captureState){case"idle":return Cr`
|
|
50
50
|
<p>${this.label}</p>
|
|
51
51
|
<button class="btn btn-primary" @click=${this.handleCapture}>
|
|
52
52
|
📷 Open Camera
|
|
53
53
|
</button>
|
|
54
|
-
`;case"capturing":return
|
|
54
|
+
`;case"capturing":return Cr`
|
|
55
55
|
<p>Opening camera...</p>
|
|
56
56
|
<div class="spinner"></div>
|
|
57
|
-
`;case"
|
|
58
|
-
<p>Checking image quality...</p>
|
|
59
|
-
<div class="spinner"></div>
|
|
60
|
-
`;case"preview":return xe`
|
|
61
|
-
${this.previewUrl?xe`<img class="preview-img" src=${this.previewUrl} alt="Captured face" />`:""}
|
|
62
|
-
${this.qualityResult?xe`
|
|
63
|
-
<div class="quality-msg ${this.qualityResult.isCentered&&this.qualityResult.hasFace?"quality-good":"quality-bad"}">
|
|
64
|
-
${this.qualityResult.message}
|
|
65
|
-
</div>
|
|
66
|
-
`:""}
|
|
67
|
-
${(t=this.qualityResult)!=null&&t.isCentered&&((r=this.qualityResult)!=null&&r.hasFace)?xe`
|
|
68
|
-
<button class="btn btn-primary" @click=${this.handleConfirm}>✓ Use this photo</button>
|
|
69
|
-
<button class="btn btn-secondary" @click=${this.handleRetake}>↻ Retake</button>
|
|
70
|
-
`:xe`
|
|
71
|
-
<button class="btn btn-primary" @click=${this.handleRetake}>↻ Try again</button>
|
|
72
|
-
<button class="btn btn-secondary" @click=${this.handleCancel}>Cancel</button>
|
|
73
|
-
`}
|
|
74
|
-
`;case"error":return xe`
|
|
57
|
+
`;case"error":return Cr`
|
|
75
58
|
<div class="quality-msg quality-bad">${this.errorMessage}</div>
|
|
76
59
|
<button class="btn btn-primary" @click=${this.handleRetake}>↻ Try again</button>
|
|
77
60
|
<button class="btn btn-secondary" @click=${this.handleCancel}>Cancel</button>
|
|
78
|
-
`}}async handleCapture(){this.captureState="capturing";try{const t=await
|
|
61
|
+
`}}async handleCapture(){this.captureState="capturing";try{const t=await ti();if(!t){this.dispatchEvent(new CustomEvent("simface-cancelled",{bubbles:!0,composed:!0})),this.captureState="idle";return}this.dispatchEvent(new CustomEvent("simface-captured",{detail:{imageBlob:t},bubbles:!0,composed:!0})),this.reset()}catch(t){this.errorMessage=t instanceof Error?t.message:"Capture failed",this.captureState="error",this.dispatchEvent(new CustomEvent("simface-error",{detail:{error:this.errorMessage},bubbles:!0,composed:!0}))}}handleRetake(){this.reset(),this.handleCapture()}handleCancel(){this.dispatchEvent(new CustomEvent("simface-cancelled",{bubbles:!0,composed:!0})),this.reset()}reset(){this.captureState="idle",this.errorMessage=""}},B.SimFaceCapture.styles=ah`
|
|
79
62
|
:host {
|
|
80
63
|
display: block;
|
|
81
64
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
@@ -91,12 +74,6 @@
|
|
|
91
74
|
background: #fafafa;
|
|
92
75
|
}
|
|
93
76
|
|
|
94
|
-
.preview-img {
|
|
95
|
-
max-width: 100%;
|
|
96
|
-
border-radius: 8px;
|
|
97
|
-
margin: 12px 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
77
|
.btn {
|
|
101
78
|
display: inline-block;
|
|
102
79
|
padding: 12px 24px;
|
|
@@ -152,4 +129,4 @@
|
|
|
152
129
|
@keyframes spin {
|
|
153
130
|
to { transform: rotate(360deg); }
|
|
154
131
|
}
|
|
155
|
-
`,
|
|
132
|
+
`,Pr([Hc({type:String})],B.SimFaceCapture.prototype,"label",2),Pr([zc()],B.SimFaceCapture.prototype,"captureState",2),Pr([zc()],B.SimFaceCapture.prototype,"errorMessage",2),B.SimFaceCapture=Pr([Th("simface-capture")],B.SimFaceCapture);async function Fh(e,t){const n=new ut(e);await n.validateAPIKey();const r=await Wc();if(!r)return{success:!1,clientId:t,message:"Capture cancelled by user"};const s=await n.enroll(t,r);return s.alreadyEnrolled,s}async function Oh(e,t){const n=new ut(e);await n.validateAPIKey();const r=await Wc();return r?n.verify(t,r):{match:!1,score:0,threshold:0,message:"Capture cancelled by user"}}async function Wc(){return ti()}B.SimFaceAPIClient=ut,B.assessFaceQuality=kc,B.blobToDataURL=ih,B.blobToImage=Lc,B.captureFromCamera=ti,B.enroll=Fh,B.verify=Oh,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
|