@maxr0ssi/glide-web-ui 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +75 -0
  2. package/dist/components/GlideDemo.d.ts +16 -0
  3. package/dist/components/GlideDemo.d.ts.map +1 -0
  4. package/dist/components/ScrollArea.d.ts +15 -0
  5. package/dist/components/ScrollArea.d.ts.map +1 -0
  6. package/dist/components/Visualizer.d.ts +20 -0
  7. package/dist/components/Visualizer.d.ts.map +1 -0
  8. package/dist/core/collections.d.ts +22 -0
  9. package/dist/core/collections.d.ts.map +1 -0
  10. package/dist/core/config.d.ts +68 -0
  11. package/dist/core/config.d.ts.map +1 -0
  12. package/dist/core/types.d.ts +35 -0
  13. package/dist/core/types.d.ts.map +1 -0
  14. package/dist/features/alignment.d.ts +36 -0
  15. package/dist/features/alignment.d.ts.map +1 -0
  16. package/dist/features/kinematics.d.ts +31 -0
  17. package/dist/features/kinematics.d.ts.map +1 -0
  18. package/dist/features/poses.d.ts +14 -0
  19. package/dist/features/poses.d.ts.map +1 -0
  20. package/dist/gestures/touchproof-detector.d.ts +37 -0
  21. package/dist/gestures/touchproof-detector.d.ts.map +1 -0
  22. package/dist/gestures/touchproof-scoring.d.ts +30 -0
  23. package/dist/gestures/touchproof-scoring.d.ts.map +1 -0
  24. package/dist/gestures/touchproof-signals.d.ts +16 -0
  25. package/dist/gestures/touchproof-signals.d.ts.map +1 -0
  26. package/dist/gestures/velocity-controller.d.ts +24 -0
  27. package/dist/gestures/velocity-controller.d.ts.map +1 -0
  28. package/dist/gestures/velocity-tracker.d.ts +23 -0
  29. package/dist/gestures/velocity-tracker.d.ts.map +1 -0
  30. package/dist/glide-demo.cjs.js +15 -0
  31. package/dist/glide-demo.es.js +4441 -0
  32. package/dist/hooks/useGlide.d.ts +31 -0
  33. package/dist/hooks/useGlide.d.ts.map +1 -0
  34. package/dist/index.d.ts +9 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/perception/hand-detector.d.ts +21 -0
  37. package/dist/perception/hand-detector.d.ts.map +1 -0
  38. package/package.json +57 -0
@@ -0,0 +1,15 @@
1
+ "use strict";var n1=Object.defineProperty;var i1=(e,t,n)=>t in e?n1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var A=(e,t,n)=>i1(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),M=require("react");function $s(){return{cameraIndex:0,frameWidth:960,mirror:!0,touchThresholdPixels:50,gates:{presenceConf:.7,poses:["open_palm","pointing_index","two_up"],preStillMs:150,maxIdleRmsSpeed:.08},kinematics:{emaAlpha:.35,bufferFrames:24,frameLookback:5},touchproof:{proximityEnter:.25,proximityExit:.4,proximityHardCap:.5,angleEnterDeg:24,angleExitDeg:32,angleHardCapDeg:45,correlationFrames:5,correlationMin:.7,visibilityAsymmetryMin:.12,framesToEnter:4,framesToExit:3,fusedEnterThreshold:.75,fusedExitThreshold:.65,emaAlpha:.3,smoothProximity:!0,proximityMode:"adaptive",baselineLearningRate:.02,relativeTouchThreshold:.85,distanceNearPx:200,distanceFarPx:50,kD:.3,kTheta:2,mfcWindowFrames:5,mfcPatchSize:15,mfcCorrMin:.7,mfcMagRatioMin:.6,mfcMagRatioMax:1.4},scroll:{enabled:!0,pixelsPerDegree:5,maxVelocity:100,accelerationCurve:1.5}}}function r1(e){const t=$s();return{...t,...e,gates:{...t.gates,...e.gates},kinematics:{...t.kinematics,...e.kinematics},touchproof:{...t.touchproof,...e.touchproof},scroll:{...t.scroll,...e.scroll}}}class nn{constructor(t){A(this,"_buf");A(this,"_head");A(this,"_size");A(this,"_capacity");if(t<1)throw new RangeError("capacity must be >= 1");this._capacity=t,this._buf=new Array(t),this._head=0,this._size=0}get length(){return this._size}get capacity(){return this._capacity}push(t){const n=(this._head+this._size)%this._capacity;this._buf[n]=t,this._size<this._capacity?this._size++:this._head=(this._head+1)%this._capacity}at(t){if(t<0||t>=this._size)throw new RangeError(`index ${t} out of range [0, ${this._size})`);return this._buf[(this._head+t)%this._capacity]}fromEnd(t){if(t>=0||-t>this._size)throw new RangeError(`offset ${t} out of range`);return this.at(this._size+t)}first(){return this._size>0?this.at(0):void 0}last(){return this._size>0?this.at(this._size-1):void 0}clear(){this._head=0,this._size=0}toArray(){const t=[];for(let n=0;n<this._size;n++)t.push(this.at(n));return t}*[Symbol.iterator](){for(let t=0;t<this._size;t++)yield this.at(t)}}class ot{constructor(t=.35,n=24){A(this,"emaAlpha");A(this,"_idxTipEma",null);A(this,"_midTipEma",null);A(this,"trail");A(this,"trailMid");A(this,"trailMean");this.emaAlpha=t,this.trail=new nn(n),this.trailMid=new nn(n),this.trailMean=new nn(n)}static mean(t){const n=Math.max(t.length,1),i=t.reduce((s,o)=>s+o[0],0),r=t.reduce((s,o)=>s+o[1],0);return[i/n,r/n]}static rot(t,n,i){const r=Math.cos(i),s=Math.sin(i);return[r*t-s*n,s*t+r*n]}static ema(t,n,i){return t==null?n:[i*n[0]+(1-i)*t[0],i*n[1]+(1-i)*t[1]]}compute(t){if(!t||t.length<21)return null;const n=t[0],i=[t[5],t[9],t[13],t[17]],[r,s]=ot.mean([[n.x,n.y],...i.map(nt=>[nt.x,nt.y])]),o=t[9],a=Math.atan2(o.y-n.y,o.x-n.x),c=t[8],h=t[12],l=t[5],u=t[9],f=[c.x-r,c.y-s],v=[h.x-r,h.y-s],b=ot.rot(f[0],f[1],-a),F=ot.rot(v[0],v[1],-a);this._idxTipEma=ot.ema(this._idxTipEma,b,this.emaAlpha),this._midTipEma=ot.ema(this._midTipEma,F,this.emaAlpha);const P=Math.hypot(c.x-l.x,c.y-l.y),W=Math.hypot(h.x-u.x,h.y-u.y);this.trail.push(this._idxTipEma),this.trailMid.push(this._midTipEma);const te=(this._idxTipEma[0]+this._midTipEma[0])/2,ve=(this._idxTipEma[1]+this._midTipEma[1])/2;return this.trailMean.push([te,ve]),{palmX:r,palmY:s,thetaRad:a,indexTipRel:this._idxTipEma,middleTipRel:this._midTipEma,fingerLengthIdx:P,fingerLengthMid:W}}getMeanFingertip(){return this._idxTipEma==null||this._midTipEma==null?null:[(this._idxTipEma[0]+this._midTipEma[0])/2,(this._idxTipEma[1]+this._midTipEma[1])/2]}getFingerSpeeds(t=1){let n=null,i=null;if(this.trail.length>t){const r=this.trail.fromEnd(-1),s=this.trail.fromEnd(-(t+1));n=Math.hypot(r[0]-s[0],r[1]-s[1])}if(this.trailMid.length>t){const r=this.trailMid.fromEnd(-1),s=this.trailMid.fromEnd(-(t+1));i=Math.hypot(r[0]-s[0],r[1]-s[1])}return[n,i]}}var rt=(e=>(e.UNARMED="UNARMED",e.READY="READY",e.ARMED="ARMED",e.COOLDOWN="COOLDOWN",e))(rt||{});function s1(){return{openPalm:!1,pointingIndex:!1,twoUp:!1}}function o1(e){const t=s1();if(!e||e.length<21)return t;const n=e[5],i=e[17],r=e[8],s=e[12],o=e[16],a=Math.abs(n.x-i.x);return t.openPalm=a>.12,t.pointingIndex=r.y<s.y-.02,t.twoUp=r.y<o.y-.02&&s.y<o.y-.02,t}class a1{constructor(){A(this,"palmCenter",null);A(this,"thetaRad",null);A(this,"scale",null);A(this,"imageWidth",null);A(this,"imageHeight",null)}update(t,n,i){if(!t||t.length<21)return!1;this.imageWidth=n,this.imageHeight=i;const r=t[0],s=[5,9,13,17],o=[[r.x,r.y]];for(const F of s)o.push([t[F].x,t[F].y]);const a=o.reduce((F,P)=>F+P[0],0)/o.length,c=o.reduce((F,P)=>F+P[1],0)/o.length;this.palmCenter=[a,c];const h=t[9],l=h.x-r.x,u=h.y-r.y;this.thetaRad=Math.atan2(u,l);const f=t[8],v=t[5],b=Math.hypot(f.x-v.x,f.y-v.y);return this.scale=Math.max(b,.001),!0}normalizedToPixel(t,n){return this.imageWidth==null||this.imageHeight==null?[0,0]:[Math.round(t*this.imageWidth),Math.round(n*this.imageHeight)]}pixelToNormalized(t,n){return this.imageWidth==null||this.imageHeight==null?[0,0]:[t/this.imageWidth,n/this.imageHeight]}toHandAligned(t,n){if(this.palmCenter==null||this.thetaRad==null||this.scale==null)return[0,0];const i=t-this.palmCenter[0],r=n-this.palmCenter[1],s=Math.cos(-this.thetaRad),o=Math.sin(-this.thetaRad),a=s*i-o*r,c=o*i+s*r;return[a/this.scale,c/this.scale]}fromHandAligned(t,n){if(this.palmCenter==null||this.thetaRad==null||this.scale==null)return[0,0];const i=t*this.scale,r=n*this.scale,s=Math.cos(this.thetaRad),o=Math.sin(this.thetaRad),a=s*i-o*r,c=o*i+s*r;return[a+this.palmCenter[0],c+this.palmCenter[1]]}getFingertipPixels(t){if(!t||t.length<21)return[[0,0],[0,0]];const n=t[8],i=t[12];return[this.normalizedToPixel(n.x,n.y),this.normalizedToPixel(i.x,i.y)]}getNormalizedDistance(t){if(!t||t.length<21||this.scale==null)return 1/0;const n=t[8],i=t[12],r=this.toHandAligned(n.x,n.y),s=this.toHandAligned(i.x,i.y);return Math.hypot(r[0]-s[0],r[1]-s[1])}getNormalizedDistanceLog(t){if(!t||t.length<21)return 1/0;const n=t[8],i=t[12],r=this.normalizedToPixel(n.x,n.y),s=this.normalizedToPixel(i.x,i.y),o=Math.hypot(r[0]-s[0],r[1]-s[1]);return Math.log(1+o)/Math.log(1+30)}getFingertipAngle(t){if(!t||t.length<21)return 0;const n=t[8],i=t[12],r=this.toHandAligned(n.x,n.y),s=this.toHandAligned(i.x,i.y),o=Math.hypot(r[0],r[1]),a=Math.hypot(s[0],s[1]);if(o<1e-6||a<1e-6)return 0;const c=r[0]*s[0]+r[1]*s[1],h=Math.max(-1,Math.min(1,c/(o*a)));return Math.acos(h)*(180/Math.PI)}getHandDistanceFactor(){if(this.scale==null||this.imageWidth==null||this.imageHeight==null)return .5;const t=this.scale*Math.max(this.imageWidth,this.imageHeight);return Math.max(0,Math.min(1,(200-t)/150))}getFingerLengthPixels(){return this.scale==null||this.imageWidth==null||this.imageHeight==null?100:this.scale*Math.max(this.imageWidth,this.imageHeight)}}function c1(e,t,n){return e<=t?1:e>=n?0:1-(e-t)/(n-t)}function h1(e,t,n){return e<=t?1:e>=n?0:1-(e-t)/(n-t)}function l1(e,t,n){if(e.visibility==null||t.visibility==null)return .5;const i=Math.abs(e.visibility-t.visibility);return i>=n?1:i/n}function u1(e,t,n,i){if(e.length<n)return .5;const r=[],s=[],o=[],a=[];for(let u=1;u<e.length;u++)r.push(e[u][0]-e[u-1][0]),s.push(e[u][1]-e[u-1][1]),o.push(t[u][0]-t[u-1][0]),a.push(t[u][1]-t[u-1][1]);const c=Wr(r,o),h=Wr(s,a);let l;return c!=null&&h!=null?l=(c+h)/2:c!=null?l=c:h!=null?l=h:l=.5,l>=i?1:Math.max(0,l)}function Wr(e,t){const n=Math.min(e.length,t.length);if(n<2)return null;const i=e.slice(0,n).reduce((c,h)=>c+h,0)/n,r=t.slice(0,n).reduce((c,h)=>c+h,0)/n;let s=0,o=0,a=0;for(let c=0;c<n;c++){const h=e[c]-i,l=t[c]-r;s+=h*h,o+=l*l,a+=h*l}return s<1e-9||o<1e-9?s<1e-9&&o<1e-9?1:0:a/Math.sqrt(s*o)}function d1(e,t,n,i){if(n.proximityMode==="adaptive"&&i!=null){const a=i/(e+.001),c=n.relativeTouchThreshold;return 1/(1+Math.exp(-6*(a-c)))}const r=n.kD,s=n.proximityEnter*(1+r*t),o=n.proximityExit*(1+r*t);return e<=s?1:e>=o?0:1-(e-s)/(o-s)}function f1(e,t,n){const i=n.kTheta,r=n.angleEnterDeg-i*(1-t),s=n.angleExitDeg-i*(1-t);return e<=r?1:e>=s?0:1-(e-r)/(s-r)}function g1(e){if(e>.7)return{proximity:.45,angle:.2,mfc:.3,occlusion:.05};if(e<.3)return{proximity:.4,angle:.3,mfc:.25,occlusion:.05};const t=(e-.3)/.4,n={proximity:.4,angle:.3,mfc:.25,occlusion:.05},i={proximity:.45,angle:.2,mfc:.3,occlusion:.05};return{proximity:n.proximity*(1-t)+i.proximity*t,angle:n.angle*(1-t)+i.angle*t,mfc:n.mfc*(1-t)+i.mfc*t,occlusion:n.occlusion*(1-t)+i.occlusion*t}}function Ln(){return{proximityScore:0,angleScore:0,correlationScore:0,visibilityScore:0,mfcScore:0,distanceFactor:.5,fusedScore:0,isTouching:!1}}class p1{constructor(t){A(this,"config");A(this,"aligner");A(this,"state",rt.UNARMED);A(this,"_enterCounter",0);A(this,"_exitCounter",0);A(this,"_idxPositions");A(this,"_midPositions");A(this,"_proximityEma",null);A(this,"_angleEma",null);A(this,"_baselineClose",null);A(this,"_baselineFar",null);A(this,"_baselineAlpha");A(this,"_lastMfcScore",.5);this.config=t,this.aligner=new a1,this._idxPositions=new nn(t.correlationFrames+1),this._midPositions=new nn(t.correlationFrames+1),this._baselineAlpha=t.baselineLearningRate}update(t,n,i){if(!this.aligner.update(t,n,i)||t.length<21)return Ln();const r=t[8],s=t[12],o=this.config.proximityMode==="logarithmic"?this.aligner.getNormalizedDistanceLog(t):this.aligner.getNormalizedDistance(t);if(o>this.config.proximityHardCap)return{proximityScore:0,angleScore:0,correlationScore:0,visibilityScore:0,mfcScore:0,distanceFactor:this.aligner.getHandDistanceFactor(),fusedScore:0,isTouching:!1};const a=c1(o,this.config.proximityEnter,this.config.proximityExit);let c;this.config.smoothProximity?(this._proximityEma==null?this._proximityEma=a:this._proximityEma=this.config.emaAlpha*a+(1-this.config.emaAlpha)*this._proximityEma,c=this._proximityEma):c=a;const h=this.aligner.getFingertipAngle(t);if(h>this.config.angleHardCapDeg)return{proximityScore:c,angleScore:0,correlationScore:0,visibilityScore:0,mfcScore:0,distanceFactor:this.aligner.getHandDistanceFactor(),fusedScore:0,isTouching:!1};const l=.2;this._angleEma==null?this._angleEma=h:this._angleEma=l*h+(1-l)*this._angleEma,h1(this._angleEma,this.config.angleEnterDeg,this.config.angleExitDeg);const u=this.aligner.toHandAligned(r.x,r.y),f=this.aligner.toHandAligned(s.x,s.y);this._idxPositions.push(u),this._midPositions.push(f);const v=u1(this._idxPositions.toArray(),this._midPositions.toArray(),this.config.correlationFrames,this.config.correlationMin),b=l1(r,s,this.config.visibilityAsymmetryMin),F=this.aligner.getHandDistanceFactor();this._updateBaseline(o,F);const P=this._lastMfcScore,W=g1(F),te=this._getBaselineDistance(F),ve=d1(o,F,this.config,te),nt=f1(h,F,this.config),An=W.proximity*ve+W.angle*nt+W.mfc*P+W.occlusion*b,oi=this._updateState(An);return{proximityScore:ve,angleScore:nt,correlationScore:v,visibilityScore:b,mfcScore:P,distanceFactor:F,fusedScore:An,isTouching:oi}}_updateState(t){if(this.state===rt.UNARMED){if(t>this.config.fusedEnterThreshold){if(this._enterCounter++,this._enterCounter>=this.config.framesToEnter)return this.state=rt.READY,this._enterCounter=0,!0}else this._enterCounter=0;return!1}if(this.state===rt.READY){if(t<this.config.fusedExitThreshold){if(this._exitCounter++,this._exitCounter>=this.config.framesToExit)return this.state=rt.UNARMED,this._exitCounter=0,!1}else this._exitCounter=0;return!0}return!1}_updateBaseline(t,n){this.state===rt.UNARMED&&(n<.3?this._baselineClose==null?this._baselineClose=t:this._baselineClose=this._baselineAlpha*t+(1-this._baselineAlpha)*this._baselineClose:n>.7&&(this._baselineFar==null?this._baselineFar=t:this._baselineFar=this._baselineAlpha*t+(1-this._baselineAlpha)*this._baselineFar))}_getBaselineDistance(t){if(this._baselineClose==null||this._baselineFar==null)return null;if(t<.3)return this._baselineClose;if(t>.7)return this._baselineFar;const n=(t-.3)/.4;return this._baselineClose*(1-n)+this._baselineFar*n}}function m1(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function Kr(){return{x:0,y:0}}class y1{constructor(t=100,n=.3){A(this,"windowMs");A(this,"smoothingFactor");A(this,"samples",[]);A(this,"lastVelocity",null);A(this,"minSamples",2);A(this,"noiseThreshold",.5);this.windowMs=t,this.smoothingFactor=n}update(t,n,i,r){if(!i)return this.reset(),null;const s=(t[0]+n[0])/2,o=(t[1]+n[1])/2;this.samples.push({x:s,y:o,timestampMs:r});const a=r-this.windowMs;for(;this.samples.length>0&&this.samples[0].timestampMs<a;)this.samples.shift();if(this.samples.length<this.minSamples)return null;let c=this._calculateVelocity();return this.lastVelocity&&c&&(c={x:this.smoothingFactor*c.x+(1-this.smoothingFactor)*this.lastVelocity.x,y:this.smoothingFactor*c.y+(1-this.smoothingFactor)*this.lastVelocity.y}),this.lastVelocity=c,c}_calculateVelocity(){if(this.samples.length<2)return null;const t=this.samples[0],n=this.samples[this.samples.length-1],i=n.timestampMs-t.timestampMs;if(i<=0)return null;let r=(n.x-t.x)*1e3/i,s=(n.y-t.y)*1e3/i;return Math.abs(r)<this.noiseThreshold/1e3&&(r=0),Math.abs(s)<this.noiseThreshold/1e3&&(s=0),{x:r,y:s}}reset(){this.samples=[],this.lastVelocity=null}}var Tt=(e=>(e.IDLE="idle",e.SCROLLING="scrolling",e))(Tt||{});class _1{constructor(t=.001,n=200){A(this,"minVelocity");A(this,"scrollDelayMs");A(this,"state","idle");A(this,"wasTouching",!1);A(this,"touchStartMs",null);this.minVelocity=t,this.scrollDelayMs=n}update(t,n,i,r){return i?(this.state="idle",this.touchStartMs=null,{velocity:Kr(),state:this.state,isActive:!1}):(this.state==="idle"?n&&t&&m1(t)>this.minVelocity?(this.touchStartMs==null&&(this.touchStartMs=r),r-this.touchStartMs>=this.scrollDelayMs&&(this.state="scrolling")):n||(this.touchStartMs=null):this.state==="scrolling"&&!n&&this.wasTouching&&(this.state="idle",this.touchStartMs=null),this.wasTouching=n,{velocity:t??Kr(),state:this.state,isActive:this.state==="scrolling"&&n})}}var kt=typeof self<"u"?self:{};function an(e,t){e:{for(var n=["CLOSURE_FLAGS"],i=kt,r=0;r<n.length;r++)if((i=i[n[r]])==null){n=null;break e}n=i}return(e=n&&n[e])!=null?e:t}function it(){throw Error("Invalid UTF8")}function qr(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let En,ui;const v1=typeof TextDecoder<"u";let A1;const b1=typeof TextEncoder<"u";function Js(e){if(b1)e=(A1||(A1=new TextEncoder)).encode(e);else{let n=0;const i=new Uint8Array(3*e.length);for(let r=0;r<e.length;r++){var t=e.charCodeAt(r);if(t<128)i[n++]=t;else{if(t<2048)i[n++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&r<e.length){const s=e.charCodeAt(++r);if(s>=56320&&s<=57343){t=1024*(t-55296)+s-56320+65536,i[n++]=t>>18|240,i[n++]=t>>12&63|128,i[n++]=t>>6&63|128,i[n++]=63&t|128;continue}r--}t=65533}i[n++]=t>>12|224,i[n++]=t>>6&63|128}i[n++]=63&t|128}}e=n===i.length?i:i.subarray(0,n)}return e}function Zs(e){kt.setTimeout((()=>{throw e}),0)}var Ai,w1=an(610401301,!1),Xr=an(748402147,!0),ji=an(824648567,!0),Ui=an(824656860,an(1,!0));function Yr(){var e=kt.navigator;return e&&(e=e.userAgent)?e:""}const $r=kt.navigator;function Dn(e){return Dn[" "](e),e}Ai=$r&&$r.userAgentData||null,Dn[" "]=function(){};const Qs={};let en=null;function E1(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 i=new Uint8Array(n);let r=0;return(function(s,o){function a(h){for(;c<s.length;){const l=s.charAt(c++),u=en[l];if(u!=null)return u;if(!/^[\s\xa0]*$/.test(l))throw Error("Unknown base64 encoding at char: "+l)}return h}eo();let c=0;for(;;){const h=a(-1),l=a(0),u=a(64),f=a(64);if(f===64&&h===-1)break;o(h<<2|l>>4),u!=64&&(o(l<<4&240|u>>2),f!=64&&o(u<<6&192|f))}})(e,(function(s){i[r++]=s})),r!==n?i.subarray(0,r):i}function eo(){if(!en){en={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const i=e.concat(t[n].split(""));Qs[n]=i;for(let r=0;r<i.length;r++){const s=i[r];en[s]===void 0&&(en[s]=r)}}}}var x1=typeof Uint8Array<"u",to=!(!(w1&&Ai&&Ai.brands.length>0)&&(Yr().indexOf("Trident")!=-1||Yr().indexOf("MSIE")!=-1))&&typeof btoa=="function";const Jr=/[-_.]/g,S1={"-":"+",_:"/",".":"="};function T1(e){return S1[e]||""}function no(e){if(!to)return E1(e);e=Jr.test(e)?e.replace(Jr,T1):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 Vi(e){return x1&&e!=null&&e instanceof Uint8Array}var Mt={};function gt(){return k1||(k1=new Ne(null,Mt))}function Gi(e){io(Mt);var t=e.g;return(t=t==null||Vi(t)?t:typeof t=="string"?no(t):null)==null?t:e.g=t}var Ne=class{h(){return new Uint8Array(Gi(this)||0)}constructor(e,t){if(io(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let k1,M1;function io(e){if(e!==Mt)throw Error("illegal external caller")}function ro(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function bi(e){return ro(e=Error(e),"warning"),e}function Lt(e,t){if(e!=null){var n=M1??(M1={}),i=n[e]||0;i>=t||(n[e]=i+1,ro(e=Error(),"incident"),Zs(e))}}function jt(){return typeof BigInt=="function"}var Ut=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Ce(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 L1=Ce("jas",void 0,!0),Zr=Ce(void 0,"0di"),Zt=Ce(void 0,"1oa"),ue=Ce(void 0,Symbol()),F1=Ce(void 0,"0ub"),P1=Ce(void 0,"0ubs"),wi=Ce(void 0,"0ubsb"),R1=Ce(void 0,"0actk"),Ft=Ce("m_m","Pa",!0),Qr=Ce();const so={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},oo=Object.defineProperties,g=Ut?L1:"Ga";var yt;const es=[];function dn(e,t){Ut||g in e||oo(e,so),e[g]|=t}function X(e,t){Ut||g in e||oo(e,so),e[g]=t}function fn(e){return dn(e,34),e}function cn(e){return dn(e,8192),e}X(es,7),yt=Object.freeze(es);var Pt={};function fe(e,t){return t===void 0?e.h!==pt&&!!(2&(0|e.v[g])):!!(2&t)&&e.h!==pt}const pt={};function Hi(e,t){if(e!=null){if(typeof e=="string")e=e?new Ne(e,Mt):gt();else if(e.constructor!==Ne)if(Vi(e))e=e.length?new Ne(new Uint8Array(e),Mt):gt();else{if(!t)throw Error();e=void 0}}return e}class ts{constructor(t,n,i){this.g=t,this.h=n,this.l=i}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var O1=Object.freeze({});function ao(e,t,n){const i=128&t?0:-1,r=e.length;var s;(s=!!r)&&(s=(s=e[r-1])!=null&&typeof s=="object"&&s.constructor===Object);const o=r+(s?-1:0);for(t=128&t?1:0;t<o;t++)n(t-i,e[t]);if(s){e=e[r-1];for(const a in e)!isNaN(a)&&n(+a,e[a])}}var co={};function Vt(e){return 128&e?co:void 0}function Bn(e){return e.Na=!0,e}var N1=Bn((e=>typeof e=="number")),ns=Bn((e=>typeof e=="string")),C1=Bn((e=>typeof e=="boolean")),jn=typeof kt.BigInt=="function"&&typeof kt.BigInt(0)=="bigint";function de(e){var t=e;if(ns(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(N1(t)&&!Number.isSafeInteger(t))throw Error(String(t));return jn?BigInt(e):e=C1(e)?e?"1":"0":ns(e)?e.trim()||"0":String(e)}var Ei=Bn((e=>jn?e>=D1&&e<=j1:e[0]==="-"?is(e,I1):is(e,B1)));const I1=Number.MIN_SAFE_INTEGER.toString(),D1=jn?BigInt(Number.MIN_SAFE_INTEGER):void 0,B1=Number.MAX_SAFE_INTEGER.toString(),j1=jn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function is(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 i=e[n],r=t[n];if(i>r)return!1;if(i<r)return!0}}const U1=typeof Uint8Array.prototype.slice=="function";let V1,C=0,G=0;function rs(e){const t=e>>>0;C=t,G=(e-t)/4294967296>>>0}function Rt(e){if(e<0){rs(-e);const[t,n]=qi(C,G);C=t>>>0,G=n>>>0}else rs(e)}function zi(e){const t=V1||(V1=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),G=0,C=t.getUint32(0,!0)}function xi(e,t){const n=4294967296*t+(e>>>0);return Number.isSafeInteger(n)?n:hn(e,t)}function G1(e,t){return de(jt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):hn(e,t))}function Wi(e,t){const n=2147483648&t;return n&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=xi(e,t))=="number"?n?-e:e:n?"-"+e:e}function ho(e,t){return jt()?de(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):de(Ki(e,t))}function hn(e,t){if(e>>>=0,(t>>>=0)<=2097151)var n=""+(4294967296*t+e);else jt()?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+ss(n)+ss(e));return n}function ss(e){return e=String(e),"0000000".slice(e.length)+e}function Ki(e,t){if(2147483648&t)if(jt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[n,i]=qi(e,t);e="-"+hn(n,i)}else e=hn(e,t);return e}function Un(e){if(e.length<16)Rt(Number(e));else if(jt())e=BigInt(e),C=Number(e&BigInt(4294967295))>>>0,G=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");G=C=0;const n=e.length;for(let i=t,r=(n-t)%6+t;r<=n;i=r,r+=6){const s=Number(e.slice(i,r));G*=1e6,C=1e6*C+s,C>=4294967296&&(G+=Math.trunc(C/4294967296),G>>>=0,C>>>=0)}if(t){const[i,r]=qi(C,G);C=i,G=r}}}function qi(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ke(e){return Array.prototype.slice.call(e)}const gn=typeof BigInt=="function"?BigInt.asIntN:void 0,H1=typeof BigInt=="function"?BigInt.asUintN:void 0,mt=Number.isSafeInteger,Vn=Number.isFinite,Ot=Math.trunc,z1=de(0);function tn(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 Oe(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function ln(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 lo(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const W1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function pn(e){switch(typeof e){case"bigint":return!0;case"number":return Vn(e);case"string":return W1.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 Vn(e)?0|e:void 0}function uo(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Vn(e)?e>>>0:void 0}function fo(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(Un(e),Ki(C,G))}function Xi(e){return e=Ot(e),mt(e)||(Rt(e),e=Wi(C,G)),e}function go(e){var t=Ot(Number(e));return mt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),fo(e))}function po(e){var t=Ot(Number(e));return mt(t)?de(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),jt()?de(gn(64,BigInt(e))):de(fo(e)))}function mo(e){return mt(e)?e=de(Xi(e)):(e=Ot(e),mt(e)?e=String(e):(Rt(e),e=Ki(C,G)),e=de(e)),e}function K1(e){return e==null?e:typeof e=="bigint"?(Ei(e)?e=Number(e):(e=gn(64,e),e=Ei(e)?Number(e):String(e)),e):pn(e)?typeof e=="number"?Xi(e):go(e):void 0}function Fn(e){const t=typeof e;return e==null?e:t==="bigint"?de(gn(64,e)):pn(e)?t==="string"?po(e):mo(e):void 0}function yo(e){if(typeof e!="string")throw Error();return e}function mn(e){if(e!=null&&typeof e!="string")throw Error();return e}function Q(e){return e==null||typeof e=="string"?e:void 0}function Yi(e,t,n,i){return e!=null&&e[Ft]===Pt?e:Array.isArray(e)?((i=(n=0|e[g])|32&i|2&i)!==n&&X(e,i),new t(e)):(n?2&i?((e=t[Zr])||(fn((e=new t).v),e=t[Zr]=e),t=e):t=new t:t=void 0,t)}function q1(e,t,n){if(t)e:{if(!pn(t=e))throw bi("int64");switch(typeof t){case"string":t=po(t);break e;case"bigint":t=de(gn(64,t));break e;default:t=mo(t)}}else t=Fn(e);return(e=t)==null?n?z1:void 0:e}const X1={};let Y1=(function(){try{return Dn(new class extends Map{constructor(){super()}}),!1}catch{return!0}})();class di{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 $1=Y1?(Object.setPrototypeOf(di.prototype,Map.prototype),Object.defineProperties(di.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),di):class extends Map{constructor(){super()}};function os(e){return e}function fi(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var Ve=class extends $1{constructor(e,t,n=os,i=os){super(),this.J=0|e[g],this.K=t,this.S=n,this.fa=this.K?J1:i;for(let r=0;r<e.length;r++){const s=e[r],o=n(s[0],!1,!0);let a=s[1];t?a===void 0&&(a=null):a=i(s[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(e){return cn(Array.from(super.entries(),e))}clear(){fi(this),super.clear()}delete(e){return fi(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new ts(e,Z1,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new ts(e,Ve.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach(((n,i,r)=>{e.call(t,r.get(i),i,r)})):super.forEach(e,t)}set(e,t){return fi(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){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 J1(e,t,n,i,r,s){return e=Yi(e,i,n,s),r&&(e=Ji(e)),e}function Z1(e){return[e,this.get(e)]}let Q1;function as(){return Q1||(Q1=new Ve(fn([]),void 0,void 0,void 0,X1))}function Gn(e){return ue?e[ue]:void 0}function Pn(e,t){for(const n in e)!isNaN(n)&&t(e,+n,e[n])}Ve.prototype.toJSON=void 0;var Si=class{};const e2={Ka:!0};function t2(e,t){t<100||Lt(P1,1)}function Hn(e,t,n,i){const r=i!==void 0;i=!!i;var s,o=ue;!r&&Ut&&o&&(s=e[o])&&Pn(s,t2),o=[];var a=e.length;let c;s=4294967295;let h=!1;const l=!!(64&t),u=l?128&t?0:-1:void 0;1&t||(c=a&&e[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?s=--a:c=void 0,!l||128&t||r||(h=!0,s=s-u+u)),t=void 0;for(var f=0;f<a;f++){let v=e[f];if(v!=null&&(v=n(v,i))!=null)if(l&&f>=s){const b=f-u;(t??(t={}))[b]=v}else o[f]=v}if(c)for(let v in c){if((a=c[v])==null||(a=n(a,i))==null)continue;let b;f=+v,l&&!Number.isNaN(f)&&(b=f+u)<s?o[b]=a:(t??(t={}))[v]=a}return t&&(h?o.push(t):o[s]=t),r&&ue&&(e=Gn(e))&&e instanceof Si&&(o[ue]=(function(v){const b=new Si;return Pn(v,((F,P,W)=>{b[P]=ke(W)})),b.da=v.da,b})(e)),o}function n2(e){return e[0]=un(e[0]),e[1]=un(e[1]),e}function un(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Ei(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[g];return e.length===0&&1&t?void 0:Hn(e,t,un)}if(e!=null&&e[Ft]===Pt)return _o(e);if(e instanceof Ne){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(to){for(var n="",i=0,r=t.length-10240;i<r;)n+=String.fromCharCode.apply(null,t.subarray(i,i+=10240));n+=String.fromCharCode.apply(null,i?t.subarray(i):t),t=btoa(n)}else{n===void 0&&(n=0),eo(),n=Qs[n],i=Array(Math.floor(t.length/3)),r=n[64]||"";let h=0,l=0;for(;h<t.length-2;h+=3){var s=t[h],o=t[h+1],a=t[h+2],c=n[s>>2];s=n[(3&s)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],i[l++]=c+s+o+a}switch(c=0,a=r,t.length-h){case 2:a=n[(15&(c=t[h+1]))<<2]||r;case 1:t=t[h],i[l]=n[t>>2]+n[(3&t)<<4|c>>4]+a+r}t=i.join("")}e=e.g=t}return e}return e instanceof Ve?e=e.size!==0?e.V(n2):void 0:void 0}return e}function _o(e){return Hn(e=e.v,0|e[g],un)}let i2,r2;function ht(e,t){return vo(e,t[0],t[1])}function vo(e,t,n,i=0){if(e==null){var r=32;n?(e=[n],r|=128):e=[],t&&(r=-16760833&r|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(r=0|e[g],Xr&&1&r)throw Error("rfarr");if(2048&r&&!(2&r)&&(function(){if(Xr)throw Error("carr");Lt(R1,5)})(),256&r)throw Error("farr");if(64&r)return(r|i)!==r&&X(e,r|i),e;if(n&&(r|=128,n!==e[0]))throw Error("mid");e:{r|=64;var s=(n=e).length;if(s){var o=s-1;const c=n[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=t=128&r?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(s=+a)<o&&(n[s+t]=c[a],delete c[a]);r=-16760833&r|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,s-(128&r?0:-1)))>1024)throw Error("spvt");r=-16760833&r|(1023&a)<<14}}}return X(e,64|r|i),e}function s2(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var n=0|e[g];return e.length===0&&1&n?void 0:cs(e,n,t)}if(e!=null&&e[Ft]===Pt)return hs(e);if(e instanceof Ve){if(2&(t=e.J))return e;if(!e.size)return;if(n=fn(e.V()),e.K)for(e=0;e<n.length;e++){const i=n[e];let r=i[1];r=r==null||typeof r!="object"?void 0:r!=null&&r[Ft]===Pt?hs(r):Array.isArray(r)?cs(r,0|r[g],!!(32&t)):void 0,i[1]=r}return n}return e instanceof Ne?e:void 0}function cs(e,t,n){return 2&t||(!n||4096&t||16&t?e=Ht(e,t,!1,n&&!(16&t)):(dn(e,34),4&t&&Object.freeze(e))),e}function $i(e,t,n){return e=new e.constructor(t),n&&(e.h=pt),e.m=pt,e}function hs(e){const t=e.v,n=0|t[g];return fe(e,n)?e:Zi(e,t,n)?$i(e,t):Ht(t,n)}function Ht(e,t,n,i){return i??(i=!!(34&t)),e=Hn(e,t,s2,i),i=32,n&&(i|=2),X(e,t=16769217&t|i),e}function Ji(e){const t=e.v,n=0|t[g];return fe(e,n)?Zi(e,t,n)?$i(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 dn(t=Ht(t,0|t[g]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function Wt(e){if(!zt(e)&&fe(e,0|e.v[g]))throw Error()}function _t(e,t){t===void 0&&(t=0|e[g]),32&t&&!(4096&t)&&X(e,4096|t)}function Zi(e,t,n){return!!(2&n)||!(!(32&n)||4096&n)&&(X(t,2|n),e.h=pt,!0)}const o2=de(0),Xe={};function O(e,t,n,i,r){if((t=Ge(e.v,t,n,r))!==null||i&&e.m!==pt)return t}function Ge(e,t,n,i){if(t===-1)return null;const r=t+(n?0:-1),s=e.length-1;let o,a;if(!(s<1+(n?0:-1))){if(r>=s)if(o=e[s],o!=null&&typeof o=="object"&&o.constructor===Object)n=o[t],a=!0;else{if(r!==s)return;n=o}else n=e[r];if(i&&n!=null){if((i=i(n))==null)return i;if(!Object.is(i,n))return a?o[t]=i:e[r]=i,i}return n}}function k(e,t,n,i){Wt(e),K(e=e.v,0|e[g],t,n,i)}function K(e,t,n,i,r){const s=n+(r?0:-1);var o=e.length-1;if(o>=1+(r?0:-1)&&s>=o){const a=e[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[n]=i,t}return s<=o?(e[s]=i,t):(i!==void 0&&(n>=(o=(t??(t=0|e[g]))>>14&1023||536870912)?i!=null&&(e[o+(r?0:-1)]={[n]:i}):e[s]=i),t)}function at(){return O1===void 0?2:4}function ct(e,t,n,i,r){let s=e.v,o=0|s[g];i=fe(e,o)?1:i,r=!!r||i===3,i===2&&zt(e)&&(s=e.v,o=0|s[g]);let a=(e=Qi(s,t))===yt?7:0|e[g],c=er(a,o);var h=!(4&c);if(h){4&c&&(e=ke(e),a=0,c=ut(c,o),o=K(s,o,t,e));let l=0,u=0;for(;l<e.length;l++){const f=n(e[l]);f!=null&&(e[u++]=f)}u<l&&(e.length=u),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==a&&(X(e,c),2&c&&Object.freeze(e)),Ao(e,c,s,o,t,i,h,r)}function Ao(e,t,n,i,r,s,o,a){let c=t;return s===1||s===4&&(2&t||!(16&t)&&32&i)?lt(t)||((t|=!e.length||o&&!(4096&t)||32&i&&!(4096&t||16&t)?2:256)!==c&&X(e,t),Object.freeze(e)):(s===2&&lt(t)&&(e=ke(e),c=0,t=ut(t,i),i=K(n,i,r,e)),lt(t)||(a||(t|=16),t!==c&&X(e,t))),2&t||!(4096&t||16&t)||_t(n,i),e}function Qi(e,t,n){return e=Ge(e,t,n),Array.isArray(e)?e:yt}function er(e,t){return 2&t&&(e|=2),1|e}function lt(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function bo(e){return Hi(e,!0)}function wo(e){e=ke(e);for(let t=0;t<e.length;t++){const n=e[t]=ke(e[t]);Array.isArray(n[1])&&(n[1]=fn(n[1]))}return cn(e)}function $e(e,t,n,i){Wt(e),K(e=e.v,0|e[g],t,(i==="0"?Number(n)===0:n===i)?void 0:n)}function Kt(e,t,n){if(2&t)throw Error();const i=Vt(t);let r=Qi(e,n,i),s=r===yt?7:0|r[g],o=er(s,t);return(2&o||lt(o)||16&o)&&(o===s||lt(o)||X(r,o),r=ke(r),s=0,o=ut(o,t),K(e,t,n,r,i)),o&=-13,o!==s&&X(r,o),r}function gi(e,t){var n=ga;return nr(tr(e=e.v),e,void 0,n)===t?t:-1}function tr(e){if(Ut)return e[Zt]??(e[Zt]=new Map);if(Zt in e)return e[Zt];const t=new Map;return Object.defineProperty(e,Zt,{value:t}),t}function Eo(e,t,n,i,r){const s=tr(e),o=nr(s,e,t,n,r);return o!==i&&(o&&(t=K(e,t,o,void 0,r)),s.set(n,i)),t}function nr(e,t,n,i,r){let s=e.get(i);if(s!=null)return s;s=0;for(let o=0;o<i.length;o++){const a=i[o];Ge(t,a,r)!=null&&(s!==0&&(n=K(t,n,s,void 0,r)),s=a)}return e.set(i,s),s}function ir(e,t,n){let i=0|e[g];const r=Vt(i),s=Ge(e,n,r);let o;if(s!=null&&s[Ft]===Pt){if(!fe(s))return zt(s),s.v;o=s.v}else Array.isArray(s)&&(o=s);if(o){const a=0|o[g];2&a&&(o=Ht(o,a))}return o=ht(o,t),o!==s&&K(e,i,n,o,r),o}function xo(e,t,n,i,r){let s=!1;if((i=Ge(e,i,r,(o=>{const a=Yi(o,n,!1,t);return s=a!==o&&a!=null,a})))!=null)return s&&!fe(i)&&_t(e,t),i}function S(e,t,n,i){let r=e.v,s=0|r[g];if((t=xo(r,s,t,n,i))==null)return t;if(s=0|r[g],!fe(e,s)){const o=Ji(t);o!==t&&(zt(e)&&(r=e.v,s=0|r[g]),s=K(r,s,n,t=o,i),_t(r,s))}return t}function So(e,t,n,i,r,s,o,a){var c=fe(e,n);s=c?1:s,o=!!o||s===3,c=a&&!c,(s===2||c)&&zt(e)&&(n=0|(t=e.v)[g]);var h=(e=Qi(t,r))===yt?7:0|e[g],l=er(h,n);if(a=!(4&l)){var u=e,f=n;const v=!!(2&l);v&&(f|=2);let b=!v,F=!0,P=0,W=0;for(;P<u.length;P++){const te=Yi(u[P],i,!1,f);if(te instanceof i){if(!v){const ve=fe(te);b&&(b=!ve),F&&(F=ve)}u[W++]=te}}W<P&&(u.length=W),l|=4,l=F?-4097&l:4096|l,l=b?8|l:-9&l}if(l!==h&&(X(e,l),2&l&&Object.freeze(e)),c&&!(8&l||!e.length&&(s===1||s===4&&(2&l||!(16&l)&&32&n)))){for(lt(l)&&(e=ke(e),l=ut(l,n),n=K(t,n,r,e)),i=e,c=l,h=0;h<i.length;h++)(u=i[h])!==(l=Ji(u))&&(i[h]=l);c|=8,X(e,l=c=i.length?4096|c:-4097&c)}return Ao(e,l,t,n,r,s,a,o)}function He(e,t,n){const i=e.v;return So(e,i,0|i[g],t,n,at(),!1,!0)}function To(e){return e==null&&(e=void 0),e}function _(e,t,n,i,r){return k(e,n,i=To(i),r),i&&!fe(i)&&_t(e.v),e}function rn(e,t,n,i){e:{var r=i=To(i);Wt(e);const s=e.v;let o=0|s[g];if(r==null){const a=tr(s);if(nr(a,s,o,n)!==t)break e;a.set(n,0)}else o=Eo(s,o,n,t);K(s,o,t,r)}i&&!fe(i)&&_t(e.v)}function ut(e,t){return-273&(2&t?2|e:-3&e)}function rr(e,t,n,i){var r=i;Wt(e),e=So(e,i=e.v,0|i[g],n,t,2,!0),r=r??new n,e.push(r),t=n=e===yt?7:0|e[g],(r=fe(r))?(n&=-9,e.length===1&&(n&=-4097)):n|=4096,n!==t&&X(e,n),r||_t(i)}function Ee(e,t,n){return Gt(O(e,t,void 0,n))}function ko(e){return(Ui?O(e,2,void 0,void 0,Fn):Fn(O(e,2)))??o2}function U(e,t){return O(e,t,void 0,void 0,Oe)??0}function ze(e,t,n){if(n!=null){if(typeof n!="number"||!Vn(n))throw bi("int32");n|=0}k(e,t,n)}function y(e,t,n){k(e,t,tn(n))}function ge(e,t,n){$e(e,t,mn(n),"")}function Rn(e,t,n){{Wt(e);const o=e.v;let a=0|o[g];if(n==null)K(o,a,t);else{var i=e=n===yt?7:0|n[g],r=lt(e),s=r||Object.isFrozen(n);for(r||(e=0),s||(n=ke(n),i=0,e=ut(e,a),s=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(Ui?1024:0),r=0;r<n.length;r++){const c=n[r],h=yo(c);Object.is(c,h)||(s&&(n=ke(n),i=0,e=ut(e,a),s=!1),n[r]=h)}e!==i&&(s&&(n=ke(n),e=ut(e,a)),X(n,e)),K(o,a,t,n)}}}function zn(e,t,n){Wt(e),ct(e,t,Q,2,!0).push(yo(n))}var bt=class{constructor(e,t,n){if(this.buffer=e,n&&!t)throw Error();this.g=t}};function sr(e,t){if(typeof e=="string")return new bt(no(e),t);if(Array.isArray(e))return new bt(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new bt(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new bt(e,!1);if(e.constructor===Ne)return t=Gi(e)||new Uint8Array(0),new bt(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new bt(e,!1);throw Error()}function Nt(e,t){let n,i=0,r=0,s=0;const o=e.h;let a=e.g;do n=o[a++],i|=(127&n)<<s,s+=7;while(s<32&&128&n);if(s>32)for(r|=(127&n)>>4,s=3;s<32&&128&n;s+=7)n=o[a++],r|=(127&n)<<s;if(dt(e,a),!(128&n))return t(i>>>0,r>>>0);throw Error()}function or(e){let t=0,n=e.g;const i=n+10,r=e.h;for(;n<i;){const s=r[n++];if(t|=s,(128&s)==0)return dt(e,n),!!(127&t)}throw Error()}function Qe(e){const t=e.h;let n=e.g,i=t[n++],r=127&i;if(128&i&&(i=t[n++],r|=(127&i)<<7,128&i&&(i=t[n++],r|=(127&i)<<14,128&i&&(i=t[n++],r|=(127&i)<<21,128&i&&(i=t[n++],r|=i<<28,128&i&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++]&&128&t[n++])))))throw Error();return dt(e,n),r}function We(e){return Qe(e)>>>0}function On(e){var t=e.h;const n=e.g;var i=t[n],r=t[n+1];const s=t[n+2];return t=t[n+3],dt(e,e.g+4),e=2*((r=(i<<0|r<<8|s<<16|t<<24)>>>0)>>31)+1,i=r>>>23&255,r&=8388607,i==255?r?NaN:e*(1/0):i==0?1401298464324817e-60*e*r:e*Math.pow(2,i-150)*(r+8388608)}function a2(e){return Qe(e)}function dt(e,t){if(e.g=t,t>e.l)throw Error()}function Mo(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 Lo(e,t){if(t==0)return gt();var n=Mo(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):U1?e.slice(n,t):new Uint8Array(e.subarray(n,t))),n.length==0?gt():new Ne(n,Mt)}var ls=[];function Fo(e,t,n,i){if(Nn.length){const r=Nn.pop();return r.o(i),r.g.init(e,t,n,i),r}return new c2(e,t,n,i)}function Po(e){e.g.clear(),e.l=-1,e.h=-1,Nn.length<100&&Nn.push(e)}function Ro(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var n=We(e.g);if(t=n>>>3,!((n&=7)>=0&&n<=5)||t<1)throw Error();return e.l=t,e.h=n,!0}function kn(e){switch(e.h){case 0:e.h!=0?kn(e):or(e.g);break;case 1:dt(e=e.g,e.g+8);break;case 2:if(e.h!=2)kn(e);else{var t=We(e.g);dt(e=e.g,e.g+t)}break;case 5:dt(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!Ro(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}kn(e)}break;default:throw Error()}}function yn(e,t,n){const i=e.g.l;var r=We(e.g);let s=(r=e.g.g+r)-i;if(s<=0&&(e.g.l=r,n(t,e,void 0,void 0,void 0),s=r-e.g.g),s)throw Error();return e.g.g=r,e.g.l=i,t}function ar(e){var t=We(e.g),n=Mo(e=e.g,t);if(e=e.h,v1){var i,r=e;(i=ui)||(i=ui=new TextDecoder("utf-8",{fatal:!0})),t=n+t,r=n===0&&t===r.length?r:r.subarray(n,t);try{var s=i.decode(r)}catch(a){if(En===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),En=!0}catch{En=!1}}throw!En&&(ui=void 0),a}}else{t=(s=n)+t,n=[];let a,c=null;for(;s<t;){var o=e[s++];o<128?n.push(o):o<224?s>=t?it():(a=e[s++],o<194||(192&a)!=128?(s--,it()):n.push((31&o)<<6|63&a)):o<240?s>=t-1?it():(a=e[s++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(i=e[s++]))!=128?(s--,it()):n.push((15&o)<<12|(63&a)<<6|63&i)):o<=244?s>=t-2?it():(a=e[s++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(i=e[s++]))!=128||(192&(r=e[s++]))!=128?(s--,it()):(o=(7&o)<<18|(63&a)<<12|(63&i)<<6|63&r,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):it(),n.length>=8192&&(c=qr(c,n),n.length=0)}s=qr(c,n)}return s}function Oo(e){const t=We(e.g);return Lo(e.g,t)}function Wn(e,t,n){var i=We(e.g);for(i=e.g.g+i;e.g.g<i;)n.push(t(e.g))}var c2=class{constructor(e,t,n,i){if(ls.length){const r=ls.pop();r.init(e,t,n,i),e=r}else e=new class{constructor(r,s,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(r,s,o,a)}init(r,s,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,r&&(r=sr(r,this.ea),this.h=r.buffer,this.j=r.g,this.m=s||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,i);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(i)}o({ha:e=!1}={}){this.ha=e}},Nn=[];function us(e){return e?/^\d+$/.test(e)?(Un(e),new Ti(C,G)):null:h2||(h2=new Ti(0,0))}var Ti=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let h2;function ds(e){return e?/^-?\d+$/.test(e)?(Un(e),new ki(C,G)):null:l2||(l2=new ki(0,0))}var ki=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let l2;function xt(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 Kn(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 cr(e){var t=C;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 Ct(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function xe(e,t,n){qt(e.g,8*t+n)}function hr(e,t){return xe(e,t,2),t=e.g.end(),Ct(e,t),t.push(e.h),t}function lr(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 qn(e,t,n){xe(e,t,2),qt(e.g,n.length),Ct(e,e.g.end()),Ct(e,n)}function Cn(e,t,n,i){n!=null&&(t=hr(e,t),i(n,e),lr(e,t))}function Ie(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var ur=Ie(),No=Ie(),dr=Ie(),fr=Ie(),Co=Ie(),Io=Ie(),u2=Ie(),Xn=Ie(),Do=Ie(),Bo=Ie();function De(e,t,n){var i=e.v;ue&&ue in i&&(i=i[ue])&&delete i[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=vo(e,t,void 0,2048)}toJSON(){return _o(this)}j(){var r;var e=q2,t=this.v,n=e.g,i=ue;if(Ut&&i&&((r=t[i])==null?void 0:r[n])!=null&&Lt(F1,3),t=e.g,Qr&&ue&&Qr===void 0&&(i=(n=this.v)[ue])&&(i=i.da))try{i(n,t,e2)}catch(s){Zs(s)}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[g];return Zi(this,e,t)?$i(this,e,!0):new this.constructor(Ht(e,t,!1))}};p.prototype[Ft]=Pt,p.prototype.toString=function(){return this.v.toString()};var Xt=class{constructor(e,t,n){this.g=e,this.h=t,e=ur,this.l=!!e&&n===e||!1}};function Yn(e,t){return new Xt(e,t,ur)}function jo(e,t,n,i,r){Cn(e,n,Ho(t,i),r)}const d2=Yn((function(e,t,n,i,r){return e.h===2&&(yn(e,ir(t,i,n),r),!0)}),jo),f2=Yn((function(e,t,n,i,r){return e.h===2&&(yn(e,ir(t,i,n),r),!0)}),jo);var $n=Symbol(),Jn=Symbol(),Mi=Symbol(),fs=Symbol(),gs=Symbol();let Uo,Vo;function vt(e,t,n,i){var r=i[e];if(r)return r;(r={}).qa=i,r.T=(function(u){switch(typeof u){case"boolean":return i2||(i2=[0,void 0,!0]);case"number":return u>0?void 0:u===0?r2||(r2=[0,void 0]):[-u,void 0];case"string":return[0,u];case"object":return u}})(i[0]);var s=i[1];let o=1;s&&s.constructor===Object&&(r.ba=s,typeof(s=i[++o])=="function"&&(r.ma=!0,Uo??(Uo=s),Vo??(Vo=i[o+1]),s=i[o+=2]));const a={};for(;s&&Array.isArray(s)&&s.length&&typeof s[0]=="number"&&s[0]>0;){for(var c=0;c<s.length;c++)a[s[c]]=s;s=i[++o]}for(c=1;s!==void 0;){let u;typeof s=="number"&&(c+=s,s=i[++o]);var h=void 0;if(s instanceof Xt?u=s:(u=d2,o--),u==null?void 0:u.l){s=i[++o],h=i;var l=o;typeof s=="function"&&(s=s(),h[l]=s),h=s}for(l=c+1,typeof(s=i[++o])=="number"&&s<0&&(l-=s,s=i[++o]);c<l;c++){const f=a[c];h?n(r,c,u,h,f):t(r,c,u,f)}}return i[e]=r}function Go(e){return Array.isArray(e)?e[0]instanceof Xt?e:[f2,e]:[e,void 0]}function Ho(e,t){return e instanceof p?e.v:Array.isArray(e)?ht(e,t):void 0}function gr(e,t,n,i){const r=n.g;e[t]=i?(s,o,a)=>r(s,o,a,i):r}function pr(e,t,n,i,r){const s=n.g;let o,a;e[t]=(c,h,l)=>s(c,h,l,a||(a=vt(Jn,gr,pr,i).T),o||(o=mr(i)),r)}function mr(e){let t=e[Mi];if(t!=null)return t;const n=vt(Jn,gr,pr,e);return t=n.ma?(i,r)=>Uo(i,r,n):(i,r)=>{for(;Ro(r)&&r.h!=4;){var s=r.l,o=n[s];if(o==null){var a=n.ba;a&&(a=a[s])&&(a=p2(a))!=null&&(o=n[s]=a)}if(o==null||!o(r,i,s)){if(o=(a=r).m,kn(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=Lo(a.g,c);o=void 0,a=i,c&&((o=a[ue]??(a[ue]=new Si))[s]??(o[s]=[])).push(c)}}return(i=Gn(i))&&(i.da=n.qa[gs]),!0},e[Mi]=t,e[gs]=g2.bind(e),t}function g2(e,t,n,i){var r=this[Jn];const s=this[Mi],o=ht(void 0,r.T),a=Gn(e);if(a){var c=!1,h=r.ba;if(h){if(r=(l,u,f)=>{if(f.length!==0)if(h[u])for(const v of f){l=Fo(v);try{c=!0,s(o,l)}finally{Po(l)}}else i==null||i(e,u,f)},t==null)Pn(a,r);else if(a!=null){const l=a[t];l&&r(a,t,l)}if(c){let l=0|e[g];if(2&l&&2048&l&&!(n!=null&&n.Ka))throw Error();const u=Vt(l),f=(v,b)=>{if(Ge(e,v,u)!=null){if((n==null?void 0:n.Qa)===1)return;throw Error()}b!=null&&(l=K(e,l,v,b,u)),delete a[v]};t==null?ao(o,0|o[g],((v,b)=>{f(v,b)})):f(t,Ge(o,t,u))}}}}function p2(e){const t=(e=Go(e))[0].g;if(e=e[1]){const n=mr(e),i=vt(Jn,gr,pr,e).T;return(r,s,o)=>t(r,s,o,i,n)}return t}function Zn(e,t,n){e[t]=n.h}function Qn(e,t,n,i){let r,s;const o=n.h;e[t]=(a,c,h)=>o(a,c,h,s||(s=vt($n,Zn,Qn,i).T),r||(r=zo(i)))}function zo(e){let t=e[fs];if(!t){const n=vt($n,Zn,Qn,e);t=(i,r)=>Wo(i,r,n),e[fs]=t}return t}function Wo(e,t,n){ao(e,0|e[g],((i,r)=>{if(r!=null){var s=(function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var h=(c=Go(c))[0].h;if(c=c[1]){const l=zo(c),u=vt($n,Zn,Qn,c).T;c=o.ma?Vo(u,l):(f,v,b)=>h(f,v,b,u,l)}else c=h;return o[a]=c}})(n,i);s?s(t,r,i):i<500||Lt(wi,3)}})),(e=Gn(e))&&Pn(e,((i,r,s)=>{for(Ct(t,t.g.end()),i=0;i<s.length;i++)Ct(t,Gi(s[i])||new Uint8Array(0))}))}const m2=de(0);function Yt(e,t){if(Array.isArray(t)){var n=0|t[g];if(4&n)return t;for(var i=0,r=0;i<t.length;i++){const s=e(t[i]);s!=null&&(t[r++]=s)}return r<i&&(t.length=r),(e=-1537&(5|n))!==n&&X(t,e),2&e&&Object.freeze(t),t}}function ne(e,t,n){return new Xt(e,t,n)}function $t(e,t,n){return new Xt(e,t,n)}function Z(e,t,n){K(e,0|e[g],t,n,Vt(0|e[g]))}var y2=Yn((function(e,t,n,i,r){if(e.h!==2)return!1;if(e=ke(e=yn(e,ht([void 0,void 0],i),r)),r=Vt(i=0|t[g]),2&i)throw Error();let s=Ge(t,n,r);if(s instanceof Ve)(2&s.J)!=0?(s=s.V(),s.push(e),K(t,i,n,s,r)):s.Ma(e);else if(Array.isArray(s)){var o=0|s[g];8192&o||X(s,o|=8192),2&o&&(s=wo(s),K(t,i,n,s,r)),s.push(e)}else K(t,i,n,cn([e]),r);return!0}),(function(e,t,n,i,r){if(t instanceof Ve)t.forEach(((s,o)=>{Cn(e,n,ht([o,s],i),r)}));else if(Array.isArray(t)){for(let s=0;s<t.length;s++){const o=t[s];Array.isArray(o)&&Cn(e,n,ht(o,i),r)}cn(t)}}));function Ko(e,t,n){(t=Oe(t))!=null&&(xe(e,n,5),e=e.g,zi(t),cr(e))}function qo(e,t,n){if(t=(function(i){if(i==null)return i;const r=typeof i;if(r==="bigint")return String(gn(64,i));if(pn(i)){if(r==="string")return go(i);if(r==="number")return Xi(i)}})(t),t!=null&&(typeof t=="string"&&ds(t),t!=null))switch(xe(e,n,0),typeof t){case"number":e=e.g,Rt(t),xt(e,C,G);break;case"bigint":n=BigInt.asUintN(64,t),n=new ki(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),xt(e.g,n.h,n.g);break;default:n=ds(t),xt(e.g,n.h,n.g)}}function Xo(e,t,n){(t=Gt(t))!=null&&t!=null&&(xe(e,n,0),Kn(e.g,t))}function Yo(e,t,n){(t=lo(t))!=null&&(xe(e,n,0),e.g.g.push(t?1:0))}function $o(e,t,n){(t=Q(t))!=null&&qn(e,n,Js(t))}function Jo(e,t,n,i,r){Cn(e,n,Ho(t,i),r)}function Zo(e,t,n){(t=t==null||typeof t=="string"||t instanceof Ne?t:void 0)!=null&&qn(e,n,sr(t,!0).buffer)}function Qo(e,t,n){return(e.h===5||e.h===2)&&(t=Kt(t,0|t[g],n),e.h==2?Wn(e,On,t):t.push(On(e.g)),!0)}var H=ne((function(e,t,n){return e.h===5&&(Z(t,n,On(e.g)),!0)}),Ko,Xn),_2=$t(Qo,(function(e,t,n){if((t=Yt(Oe,t))!=null)for(let o=0;o<t.length;o++){var i=e,r=n,s=t[o];s!=null&&(xe(i,r,5),i=i.g,zi(s),cr(i))}}),Xn),yr=$t(Qo,(function(e,t,n){if((t=Yt(Oe,t))!=null&&t.length){xe(e,n,2),qt(e.g,4*t.length);for(let i=0;i<t.length;i++)n=e.g,zi(t[i]),cr(n)}}),Xn),v2=ne((function(e,t,n){return e.h===5&&(Z(t,n,(e=On(e.g))===0?void 0:e),!0)}),Ko,Xn),et=ne((function(e,t,n){return ji?(e.h!==0?e=!1:(Z(t,n,Nt(e.g,ho)),e=!0),e):e.h===0&&(Z(t,n,Nt(e.g,Wi)),!0)}),qo,Io),pi=ne((function(e,t,n){return ji?(e.h!==0?t=!1:(Z(t,n,(e=Nt(e.g,ho))===m2?void 0:e),t=!0),t):e.h===0&&(Z(t,n,(e=Nt(e.g,Wi))===0?void 0:e),!0)}),qo,Io),A2=ne((function(e,t,n){return ji?(e.h!==0?e=!1:(Z(t,n,Nt(e.g,G1)),e=!0),e):e.h===0&&(Z(t,n,Nt(e.g,xi)),!0)}),(function(e,t,n){if(t=(function(i){if(i==null)return i;var r=typeof i;if(r==="bigint")return String(H1(64,i));if(pn(i)){if(r==="string")return r=Ot(Number(i)),mt(r)&&r>=0?i=String(r):((r=i.indexOf("."))!==-1&&(i=i.substring(0,r)),(r=i[0]!=="-"&&((r=i.length)<20||r===20&&i<="18446744073709551615"))||(Un(i),i=hn(C,G))),i;if(r==="number")return(i=Ot(i))>=0&&mt(i)||(Rt(i),i=xi(C,G)),i}})(t),t!=null&&(typeof t=="string"&&us(t),t!=null))switch(xe(e,n,0),typeof t){case"number":e=e.g,Rt(t),xt(e,C,G);break;case"bigint":n=BigInt.asUintN(64,t),n=new Ti(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),xt(e.g,n.h,n.g);break;default:n=us(t),xt(e.g,n.h,n.g)}}),u2),J=ne((function(e,t,n){return e.h===0&&(Z(t,n,Qe(e.g)),!0)}),Xo,fr),_n=$t((function(e,t,n){return(e.h===0||e.h===2)&&(t=Kt(t,0|t[g],n),e.h==2?Wn(e,Qe,t):t.push(Qe(e.g)),!0)}),(function(e,t,n){if((t=Yt(Gt,t))!=null&&t.length){n=hr(e,n);for(let i=0;i<t.length;i++)Kn(e.g,t[i]);lr(e,n)}}),fr),Et=ne((function(e,t,n){return e.h===0&&(Z(t,n,(e=Qe(e.g))===0?void 0:e),!0)}),Xo,fr),V=ne((function(e,t,n){return e.h===0&&(Z(t,n,or(e.g)),!0)}),Yo,No),ft=ne((function(e,t,n){return e.h===0&&(Z(t,n,(e=or(e.g))===!1?void 0:e),!0)}),Yo,No),ee=$t((function(e,t,n){return e.h===2&&(e=ar(e),Kt(t,0|t[g],n).push(e),!0)}),(function(e,t,n){if((t=Yt(Q,t))!=null)for(let o=0;o<t.length;o++){var i=e,r=n,s=t[o];s!=null&&qn(i,r,Js(s))}}),dr),Je=ne((function(e,t,n){return e.h===2&&(Z(t,n,(e=ar(e))===""?void 0:e),!0)}),$o,dr),L=ne((function(e,t,n){return e.h===2&&(Z(t,n,ar(e)),!0)}),$o,dr),$=(function(e,t,n=ur){return new Xt(e,t,n)})((function(e,t,n,i,r){return e.h===2&&(i=ht(void 0,i),Kt(t,0|t[g],n).push(i),yn(e,i,r),!0)}),(function(e,t,n,i,r){if(Array.isArray(t)){for(let s=0;s<t.length;s++)Jo(e,t[s],n,i,r);1&(e=0|t[g])||X(t,1|e)}})),j=Yn((function(e,t,n,i,r,s){if(e.h!==2)return!1;let o=0|t[g];return Eo(t,o,s,n,Vt(o)),yn(e,t=ir(t,i,n),r),!0}),Jo),ea=ne((function(e,t,n){return e.h===2&&(Z(t,n,Oo(e)),!0)}),Zo,Do),b2=$t((function(e,t,n){return(e.h===0||e.h===2)&&(t=Kt(t,0|t[g],n),e.h==2?Wn(e,We,t):t.push(We(e.g)),!0)}),(function(e,t,n){if((t=Yt(uo,t))!=null)for(let o=0;o<t.length;o++){var i=e,r=n,s=t[o];s!=null&&(xe(i,r,0),qt(i.g,s))}}),Co),w2=ne((function(e,t,n){return e.h===0&&(Z(t,n,(e=We(e.g))===0?void 0:e),!0)}),(function(e,t,n){(t=uo(t))!=null&&t!=null&&(xe(e,n,0),qt(e.g,t))}),Co),pe=ne((function(e,t,n){return e.h===0&&(Z(t,n,Qe(e.g)),!0)}),(function(e,t,n){(t=Gt(t))!=null&&(t=parseInt(t,10),xe(e,n,0),Kn(e.g,t))}),Bo);class E2{constructor(t,n){var i=ye;this.g=t,this.h=n,this.m=S,this.j=_,this.defaultValue=void 0,this.l=i.Oa!=null?co:void 0}register(){Dn(this)}}function Be(e,t){return new E2(e,t)}function tt(e,t){return(n,i)=>{{const s={ea:!0};i&&Object.assign(s,i),n=Fo(n,void 0,void 0,s);try{const o=new e,a=o.v;mr(t)(a,n);var r=o}finally{Po(n)}}return r}}function ei(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}}}};Wo(this.v,t,vt($n,Zn,Qn,e)),Ct(t,t.g.end());const n=new Uint8Array(t.h),i=t.l,r=i.length;let s=0;for(let o=0;o<r;o++){const a=i[o];n.set(a,s),s+=a.length}return t.l=[n],n}}var ps=class extends p{constructor(e){super(e)}},ms=[0,Je,ne((function(e,t,n){return e.h===2&&(Z(t,n,(e=Oo(e))===gt()?void 0:e),!0)}),(function(e,t,n){if(t!=null){if(t instanceof p){const i=t.Ra;return void(i?(t=i(t),t!=null&&qn(e,n,sr(t,!0).buffer)):Lt(wi,3))}if(Array.isArray(t))return void Lt(wi,3)}Zo(e,t,n)}),Do)];let mi,ys=globalThis.trustedTypes;function _s(e){var t;return mi===void 0&&(mi=(function(){let n=null;if(!ys)return n;try{const i=r=>r;n=ys.createPolicy("goog#html",{createHTML:i,createScript:i,createScriptURL:i})}catch{}return n})()),e=(t=mi)?t.createScriptURL(e):e,new class{constructor(n){this.g=n}toString(){return this.g+""}}(e)}function x2(e,...t){if(t.length===0)return _s(e[0]);let n=e[0];for(let i=0;i<t.length;i++)n+=encodeURIComponent(t[i])+e[i+1];return _s(n)}var ta=[0,J,pe,V,-1,_n,pe,-1,V],S2=class extends p{constructor(e){super(e)}},na=[0,V,L,V,pe,-1,$t((function(e,t,n){return(e.h===0||e.h===2)&&(t=Kt(t,0|t[g],n),e.h==2?Wn(e,a2,t):t.push(Qe(e.g)),!0)}),(function(e,t,n){if((t=Yt(Gt,t))!=null&&t.length){n=hr(e,n);for(let i=0;i<t.length;i++)Kn(e.g,t[i]);lr(e,n)}}),Bo),L,-1,[0,V,-1],pe,V,-1],ia=[0,3,V,-1,2,[0,J],[0,pe,V],[0,L,-1],[0]],ra=[0,L,-2],vs=class extends p{constructor(e){super(e)}},sa=[0],oa=[0,J,V,1,V,-4],ye=class extends p{constructor(e){super(e,2)}},q={};q[336783863]=[0,L,V,-1,J,[0,[1,2,3,4,5,6,7,8,9],j,sa,j,na,j,ra,j,oa,j,ta,j,[0,L,-2],j,[0,L,pe],j,ia,j,[0,pe,-1,V]],[0,L],V,[0,[1,3],[2,4],j,[0,_n],-1,j,[0,ee],-1,$,[0,L,-1]],L];var As=[0,pi,-1,ft,-3,pi,_n,Je,Et,pi,-1,ft,Et,ft,-2,Je];function N(e,t){zn(e,3,t)}function E(e,t){zn(e,4,t)}var oe=class extends p{constructor(e){super(e,500)}o(e){return _(this,0,7,e)}},sn=[-1,{}],bs=[0,L,1,sn],ws=[0,L,ee,sn];function Se(e,t){rr(e,1,oe,t)}function I(e,t){zn(e,10,t)}function T(e,t){zn(e,15,t)}var _e=class extends p{constructor(e){super(e,500)}o(e){return _(this,0,1001,e)}},aa=[-500,$,[-500,Je,-1,ee,-3,[-2,q,V],$,ms,Et,-1,bs,ws,$,[0,Je,ft],Je,As,Et,ee,987,ee],4,$,[-500,L,-1,[-1,{}],998,L],$,[-500,L,ee,-1,[-2,{},V],997,ee,-1],Et,$,[-500,L,ee,sn,998,ee],ee,Et,bs,ws,$,[0,Je,-1,sn],ee,-2,As,Je,-1,ft,[0,ft,w2],978,sn,$,ms];_e.prototype.g=ei(aa);var T2=tt(_e,aa),k2=class extends p{constructor(e){super(e)}},ca=class extends p{constructor(e){super(e)}g(){return He(this,k2,1)}},ha=[0,$,[0,J,H,L,-1]],ti=tt(ca,ha),M2=class extends p{constructor(e){super(e)}},L2=class extends p{constructor(e){super(e)}},yi=class extends p{constructor(e){super(e)}l(){return S(this,M2,2)}g(){return He(this,L2,5)}},la=tt(class extends p{constructor(e){super(e)}},[0,ee,_n,yr,[0,pe,[0,J,-3],[0,H,-3],[0,J,-1,[0,$,[0,J,-2]]],$,[0,H,-1,L,H]],L,-1,et,$,[0,J,H],ee,et]),ua=class extends p{constructor(e){super(e)}},St=tt(class extends p{constructor(e){super(e)}},[0,$,[0,H,-4]]),da=class extends p{constructor(e){super(e)}},vn=tt(class extends p{constructor(e){super(e)}},[0,$,[0,H,-4]]),F2=class extends p{constructor(e){super(e)}},P2=[0,J,-1,yr,pe],fa=class extends p{constructor(e){super(e)}};fa.prototype.g=ei([0,H,-4,et]);var R2=class extends p{constructor(e){super(e)}},O2=tt(class extends p{constructor(e){super(e)}},[0,$,[0,1,J,L,ha],et]),Es=class extends p{constructor(e){super(e)}},N2=class extends p{constructor(e){super(e)}na(){const e=O(this,1,void 0,void 0,bo);return e??gt()}},C2=class extends p{constructor(e){super(e)}},ga=[1,2],I2=tt(class extends p{constructor(e){super(e)}},[0,$,[0,ga,j,[0,yr],j,[0,ea],J,L],et]),_r=class extends p{constructor(e){super(e)}},pa=[0,L,J,H,ee,-1],xs=class extends p{constructor(e){super(e)}},D2=[0,V,-1],Ss=class extends p{constructor(e){super(e)}},Mn=[1,2,3,4,5,6],In=class extends p{constructor(e){super(e)}g(){return O(this,1,void 0,void 0,bo)!=null}l(){return Q(O(this,2))!=null}},B=class extends p{constructor(e){super(e)}g(){return lo(O(this,2))??!1}},ma=[0,ea,L,[0,J,et,-1],[0,A2,et]],z=[0,ma,V,[0,Mn,j,oa,j,na,j,ta,j,sa,j,ra,j,ia],pe],ni=class extends p{constructor(e){super(e)}},vr=[0,z,H,-1,J],B2=Be(502141897,ni);q[502141897]=vr;var j2=tt(class extends p{constructor(e){super(e)}},[0,[0,pe,-1,_2,b2],P2]),ya=class extends p{constructor(e){super(e)}},_a=class extends p{constructor(e){super(e)}},Li=[0,z,H,[0,z],V],U2=Be(508968150,_a);q[508968150]=[0,z,vr,Li,H,[0,[0,ma]]],q[508968149]=Li;var wt=class extends p{constructor(e){super(e)}l(){return S(this,_r,2)}g(){k(this,2)}},va=[0,z,pa];q[478825465]=va;var V2=class extends p{constructor(e){super(e)}},Aa=class extends p{constructor(e){super(e)}},Ar=class extends p{constructor(e){super(e)}},br=class extends p{constructor(e){super(e)}},ba=class extends p{constructor(e){super(e)}},Ts=[0,z,[0,z],va,-1],wa=[0,z,H,J],wr=[0,z,H],Ea=[0,z,wa,wr,H],G2=Be(479097054,ba);q[479097054]=[0,z,Ea,Ts],q[463370452]=Ts,q[464864288]=wa;var H2=Be(462713202,br);q[462713202]=Ea,q[474472470]=wr;var z2=class extends p{constructor(e){super(e)}},xa=class extends p{constructor(e){super(e)}},Sa=class extends p{constructor(e){super(e)}},Ta=class extends p{constructor(e){super(e)}},Er=[0,z,H,-1,J],Fi=[0,z,H,V];Ta.prototype.g=ei([0,z,wr,[0,z],vr,Li,Er,Fi]);var ka=class extends p{constructor(e){super(e)}},W2=Be(456383383,ka);q[456383383]=[0,z,pa];var Ma=class extends p{constructor(e){super(e)}},K2=Be(476348187,Ma);q[476348187]=[0,z,D2];var La=class extends p{constructor(e){super(e)}},ks=class extends p{constructor(e){super(e)}},Fa=[0,pe,-1],q2=Be(458105876,class extends p{constructor(e){super(e)}g(){let e;var t=this.v;const n=0|t[g];return e=fe(this,n),t=(function(i,r,s,o){var a=ks;!o&&zt(i)&&(s=0|(r=i.v)[g]);var c=Ge(r,2);if(i=!1,c==null){if(o)return as();c=[]}else if(c.constructor===Ve){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?i=!!(2&(0|c[g])):c=[];if(o){if(!c.length)return as();i||(i=!0,fn(c))}else i&&(i=!1,cn(c),c=wo(c));return!i&&32&s&&dn(c,32),s=K(r,s,2,o=new Ve(c,a,q1,void 0)),i||_t(r,s),o})(this,t,n,e),!e&&ks&&(t.ra=!0),t}});q[458105876]=[0,Fa,y2,[!0,et,[0,L,-1,ee]],[0,_n,V,pe]];var xr=class extends p{constructor(e){super(e)}},Pa=Be(458105758,xr);q[458105758]=[0,z,L,Fa];var _i=class extends p{constructor(e){super(e)}},Ms=[0,v2,-1,ft],X2=class extends p{constructor(e){super(e)}},Ra=class extends p{constructor(e){super(e)}},Pi=[1,2];Ra.prototype.g=ei([0,Pi,j,Ms,j,[0,$,Ms]]);var Oa=class extends p{constructor(e){super(e)}},Y2=Be(443442058,Oa);q[443442058]=[0,z,L,J,H,ee,-1,V,H],q[514774813]=Er;var Na=class extends p{constructor(e){super(e)}},$2=Be(516587230,Na);function Ri(e,t){return t=t?t.clone():new _r,e.displayNamesLocale!==void 0?k(t,1,mn(e.displayNamesLocale)):e.displayNamesLocale===void 0&&k(t,1),e.maxResults!==void 0?ze(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?Rn(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&k(t,4),e.categoryDenylist!==void 0?Rn(t,5,e.categoryDenylist):"categoryDenylist"in e&&k(t,5),t}function Ca(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function Sr(e,t=-1,n=""){return{categories:e.map((i=>({index:Ee(i,1)??0??-1,score:U(i,2)??0,categoryName:Q(O(i,3))??""??"",displayName:Q(O(i,4))??""??""}))),headIndex:t,headName:n}}function J2(e){const t={classifications:He(e,R2,1).map((n=>{var i;return Sr(((i=S(n,ca,4))==null?void 0:i.g())??[],Ee(n,2)??0,Q(O(n,3))??"")}))};return(function(n){return K1(Ui?O(n,2,void 0,void 0,Fn):O(n,2))})(e)!=null&&(t.timestampMs=Ca(ko(e))),t}function Ia(e){var o,a;var t=ct(e,3,Oe,at()),n=ct(e,2,Gt,at()),i=ct(e,1,Q,at()),r=ct(e,9,Q,at());const s={categories:[],keypoints:[]};for(let c=0;c<t.length;c++)s.categories.push({score:t[c],index:n[c]??-1,categoryName:i[c]??"",displayName:r[c]??""});if((t=(o=S(e,yi,4))==null?void 0:o.l())&&(s.boundingBox={originX:Ee(t,1,Xe)??0,originY:Ee(t,2,Xe)??0,width:Ee(t,3,Xe)??0,height:Ee(t,4,Xe)??0,angle:0}),(a=S(e,yi,4))==null?void 0:a.g().length)for(const c of S(e,yi,4).g())s.keypoints.push({x:O(c,1,void 0,Xe,Oe)??0,y:O(c,2,void 0,Xe,Oe)??0,score:O(c,4,void 0,Xe,Oe)??0,label:Q(O(c,3,void 0,Xe))??""});return s}function ii(e){const t=[];for(const n of He(e,da,1))t.push({x:U(n,1)??0,y:U(n,2)??0,z:U(n,3)??0,visibility:U(n,4)??0});return t}function on(e){const t=[];for(const n of He(e,ua,1))t.push({x:U(n,1)??0,y:U(n,2)??0,z:U(n,3)??0,visibility:U(n,4)??0});return t}function Ls(e){return Array.from(e,(t=>t>127?t-256:t))}function Fs(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,i=0,r=0;for(let s=0;s<e.length;s++)n+=e[s]*t[s],i+=e[s]*e[s],r+=t[s]*t[s];if(i<=0||r<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(i*r)}let xn;q[516587230]=[0,z,Er,Fi,H],q[518928384]=Fi;const Z2=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 Da(){if(xn===void 0)try{await WebAssembly.instantiate(Z2),xn=!0}catch{xn=!1}return xn}async function Qt(e,t=x2``){const n=await Da()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}}var st=class{};function Ba(){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 Ps(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((n,i)=>{t.addEventListener("load",(()=>{n()}),!1),t.addEventListener("error",(r=>{i(r)}),!1),document.body.appendChild(t)}))}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function ja(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function m(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Rs(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[i,r]=ja(t);return!e.l||i===e.i.canvas.width&&r===e.i.canvas.height||(e.i.canvas.width=i,e.i.canvas.height=r),[i,r]}function Os(e,t,n){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const i=new Uint32Array(t.length);for(let r=0;r<t.length;r++)i[r]=e.i.stringToNewUTF8(t[r]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),n(t);for(const r of i)e.i._free(r);e.i._free(t)}function Pe(e,t,n){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=n}function Ye(e,t,n){let i=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(r,s,o)=>{s?(n(i,o),i=[]):i.push(r)}}st.forVisionTasks=function(e){return Qt("vision",e)},st.forTextTasks=function(e){return Qt("text",e)},st.forGenAiExperimentalTasks=function(e){return Qt("genai_experimental",e)},st.forGenAiTasks=function(e){return Qt("genai",e)},st.forAudioTasks=function(e){return Qt("audio",e)},st.isSimdSupported=function(){return Da()};async function Q2(e,t,n,i){return e=await(async(r,s,o,a,c)=>{if(s&&await Ps(s),!self.ModuleFactory||o&&(await Ps(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((s=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(s.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new r(c,a)})(e,n.wasmLoaderPath,n.assetLoaderPath,t,{locateFile:r=>r.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&r.endsWith(".data")?n.assetBinaryPath.toString():r}),await e.o(i),e}function vi(e,t){const n=S(e.baseOptions,In,1)||new In;typeof t=="string"?(k(n,2,mn(t)),k(n,1)):t instanceof Uint8Array&&(k(n,1,Hi(t,!1)),k(n,2)),_(e.baseOptions,0,1,n)}function Ns(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 ri(e,t){e.B=new oe,ge(e.B,2,"PassThroughCalculator"),N(e.B,"free_memory"),E(e.B,"free_memory_unused_out"),I(t,"free_memory"),Se(t,e.B)}function It(e,t){N(e.B,t),E(e.B,t+"_unused_out")}function si(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Oi=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var n,i,r,s,o,a;if(t){const c=e.baseOptions||{};if((n=e.baseOptions)!=null&&n.modelAssetBuffer&&((i=e.baseOptions)!=null&&i.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((r=S(this.baseOptions,In,1))!=null&&r.g()||(s=S(this.baseOptions,In,1))!=null&&s.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(h,l){let u=S(h.baseOptions,Ss,3);if(!u){var f=u=new Ss,v=new vs;rn(f,4,Mn,v)}"delegate"in l&&(l.delegate==="GPU"?(l=u,f=new S2,rn(l,2,Mn,f)):(l=u,f=new vs,rn(l,4,Mn,f))),_(h.baseOptions,0,3,u)})(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then((h=>{if(h.ok)return h.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${h.status})`)})).then((h=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(h),!0,!1,!1),vi(this,"/model.dat"),this.m(),this.L()}));if(c.modelAssetBuffer instanceof Uint8Array)vi(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return(async function(h){const l=[];for(var u=0;;){const{done:f,value:v}=await h.read();if(f)break;l.push(v),u+=v.length}if(l.length===0)return new Uint8Array(0);if(l.length===1)return l[0];h=new Uint8Array(u),u=0;for(const f of l)h.set(f,u),u+=f.length;return h})(c.modelAssetBuffer).then((h=>{vi(this,h),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca((t=>{e=T2(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((n,i)=>{this.H.push(Error(i))})),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Ns(this)}finishProcessing(){this.g.finishProcessing(),Ns(this)}close(){this.B=void 0,this.g.closeGraph()}};function Ze(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Oi.prototype.close=Oi.prototype.close;class ec{constructor(t,n,i,r){this.g=t,this.h=n,this.m=i,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Cs(e,t,n){const i=e.g;if(n=Ze(i.createShader(n),"Failed to create WebGL shader"),i.shaderSource(n,t),i.compileShader(n),!i.getShaderParameter(n,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(n)}`);return i.attachShader(e.h,n),n}function Is(e,t){const n=e.g,i=Ze(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(i);const r=Ze(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,r),n.enableVertexAttribArray(e.O),n.vertexAttribPointer(e.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const s=Ze(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,s),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 ec(n,i,r,s)}function Tr(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function tc(e,t,n,i){return Tr(e,t),e.h||(e.m(),e.D()),n?(e.u||(e.u=Is(e,!0)),n=e.u):(e.A||(e.A=Is(e,!1)),n=e.A),t.useProgram(e.h),n.bind(),e.l(),e=i(),n.g.bindVertexArray(null),e}function Ua(e,t,n){return Tr(e,t),e=Ze(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 Va(e,t,n){Tr(e,t),e.B||(e.B=Ze(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 nc(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ga=class{H(){return`
2
+ precision mediump float;
3
+ varying vec2 vTex;
4
+ uniform sampler2D inputTexture;
5
+ void main() {
6
+ gl_FragColor = texture2D(inputTexture, vTex);
7
+ }
8
+ `}m(){const e=this.g;if(this.h=Ze(e.createProgram(),"Failed to create WebGL program"),this.X=Cs(this,`
9
+ attribute vec2 aVertex;
10
+ attribute vec2 aTex;
11
+ varying vec2 vTex;
12
+ void main(void) {
13
+ gl_Position = vec4(aVertex, 0.0, 1.0);
14
+ vTex = aTex;
15
+ }`,e.VERTEX_SHADER),this.W=Cs(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 Ue(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 Ni(e){var t=Ue(e,1);if(!t){if(t=Ue(e,0))t=new Float32Array(t).map((i=>i/255));else{t=new Float32Array(e.width*e.height);const i=Dt(e);var n=kr(e);if(Va(n,i,Ha(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),i.readPixels(0,0,e.width,e.height,i.RGBA,i.FLOAT,n);for(let r=0,s=0;r<t.length;++r,s+=4)t[r]=n[s]}else i.readPixels(0,0,e.width,e.height,i.RED,i.FLOAT,t)}e.g.push(t)}return t}function Ha(e){let t=Ue(e,2);if(!t){const n=Dt(e);t=Wa(e);const i=Ni(e),r=za(e);n.texImage2D(n.TEXTURE_2D,0,r,e.width,e.height,0,n.RED,n.FLOAT,i),Ci(e)}return t}function Dt(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Ze(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function za(e){if(e=Dt(e),!Sn)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Sn=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Sn=e.R16F}return Sn}function kr(e){return e.l||(e.l=new Ga),e.l}function Wa(e){const t=Dt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let n=Ue(e,2);return n||(n=Ua(kr(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(n),e.j=!0),t.bindTexture(t.TEXTURE_2D,n),n}function Ci(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Sn,Y=class{constructor(e,t,n,i,r,s,o){this.g=e,this.m=t,this.j=n,this.canvas=i,this.l=r,this.width=s,this.height=o,this.j&&--Ds===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Ue(this,0)}ka(){return!!Ue(this,1)}R(){return!!Ue(this,2)}ja(){return(t=Ue(e=this,0))||(t=Ni(e),t=new Uint8Array(t.map((n=>Math.round(255*n)))),e.g.push(t)),t;var e,t}ia(){return Ni(this)}N(){return Ha(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 i=Dt(this),r=kr(this);i.activeTexture(i.TEXTURE1),n=Ua(r,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,n);const s=za(this);i.texImage2D(i.TEXTURE_2D,0,s,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),Va(r,i,n),tc(r,i,!1,(()=>{Wa(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ci(this)})),nc(r),Ci(this)}}e.push(n)}return new Y(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Dt(this).deleteTexture(Ue(this,2)),Ds=-1}};Y.prototype.close=Y.prototype.close,Y.prototype.clone=Y.prototype.clone,Y.prototype.getAsWebGLTexture=Y.prototype.N,Y.prototype.getAsFloat32Array=Y.prototype.ia,Y.prototype.getAsUint8Array=Y.prototype.ja,Y.prototype.hasWebGLTexture=Y.prototype.R,Y.prototype.hasFloat32Array=Y.prototype.ka,Y.prototype.hasUint8Array=Y.prototype.Fa;var Ds=250;function Me(...e){return e.map((([t,n])=>({start:t,end:n})))}const ic=(function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}})((Bs=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:Ba()?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,i=this.i._malloc(n);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(n,i):this.i._changeTextGraph(n,i),this.i._free(i)}configureAudio(e,t,n,i,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),m(this,i||"input_audio",(s=>{m(this,r=r||"audio_header",(o=>{this.i._configureAudio(s,o,e,t??0,n)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Pe(this,"__graph_config__",(t=>{e(t)})),m(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,n){this.addAudioToStreamWithShape(e,0,0,t,n)}addAudioToStreamWithShape(e,t,n,i,r){const s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),m(this,i,(o=>{this.i._addAudioToInputStream(this.g,t,n,o,r)}))}addGpuBufferToStream(e,t,n){m(this,t,(i=>{const[r,s]=Rs(this,e,i);this.i._addBoundTextureToStream(i,r,s,n)}))}addBoolToStream(e,t,n){m(this,t,(i=>{this.i._addBoolToInputStream(e,i,n)}))}addDoubleToStream(e,t,n){m(this,t,(i=>{this.i._addDoubleToInputStream(e,i,n)}))}addFloatToStream(e,t,n){m(this,t,(i=>{this.i._addFloatToInputStream(e,i,n)}))}addIntToStream(e,t,n){m(this,t,(i=>{this.i._addIntToInputStream(e,i,n)}))}addUintToStream(e,t,n){m(this,t,(i=>{this.i._addUintToInputStream(e,i,n)}))}addStringToStream(e,t,n){m(this,t,(i=>{m(this,e,(r=>{this.i._addStringToInputStream(r,i,n)}))}))}addStringRecordToStream(e,t,n){m(this,t,(i=>{Os(this,Object.keys(e),(r=>{Os(this,Object.values(e),(s=>{this.i._addFlatHashMapToInputStream(r,s,Object.keys(e).length,i,n)}))}))}))}addProtoToStream(e,t,n,i){m(this,n,(r=>{m(this,t,(s=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,s,r,i),this.i._free(o)}))}))}addEmptyPacketToStream(e,t){m(this,e,(n=>{this.i._addEmptyPacketToInputStream(n,t)}))}addBoolVectorToStream(e,t,n){m(this,t,(i=>{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._addBoolVectorToInputStream(r,i,n)}))}addDoubleVectorToStream(e,t,n){m(this,t,(i=>{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._addDoubleVectorToInputStream(r,i,n)}))}addFloatVectorToStream(e,t,n){m(this,t,(i=>{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._addFloatVectorToInputStream(r,i,n)}))}addIntVectorToStream(e,t,n){m(this,t,(i=>{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._addIntVectorToInputStream(r,i,n)}))}addUintVectorToStream(e,t,n){m(this,t,(i=>{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._addUintVectorToInputStream(r,i,n)}))}addStringVectorToStream(e,t,n){m(this,t,(i=>{const r=this.i._allocateStringVector(e.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of e)m(this,s,(o=>{this.i._addStringVectorEntry(r,o)}));this.i._addStringVectorToInputStream(r,i,n)}))}addBoolToInputSidePacket(e,t){m(this,t,(n=>{this.i._addBoolToInputSidePacket(e,n)}))}addDoubleToInputSidePacket(e,t){m(this,t,(n=>{this.i._addDoubleToInputSidePacket(e,n)}))}addFloatToInputSidePacket(e,t){m(this,t,(n=>{this.i._addFloatToInputSidePacket(e,n)}))}addIntToInputSidePacket(e,t){m(this,t,(n=>{this.i._addIntToInputSidePacket(e,n)}))}addUintToInputSidePacket(e,t){m(this,t,(n=>{this.i._addUintToInputSidePacket(e,n)}))}addStringToInputSidePacket(e,t){m(this,t,(n=>{m(this,e,(i=>{this.i._addStringToInputSidePacket(i,n)}))}))}addProtoToInputSidePacket(e,t,n){m(this,n,(i=>{m(this,t,(r=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,r,i),this.i._free(s)}))}))}addBoolVectorToInputSidePacket(e,t){m(this,t,(n=>{const i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(const r of e)this.i._addBoolVectorEntry(i,r);this.i._addBoolVectorToInputSidePacket(i,n)}))}addDoubleVectorToInputSidePacket(e,t){m(this,t,(n=>{const i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(const r of e)this.i._addDoubleVectorEntry(i,r);this.i._addDoubleVectorToInputSidePacket(i,n)}))}addFloatVectorToInputSidePacket(e,t){m(this,t,(n=>{const i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(const r of e)this.i._addFloatVectorEntry(i,r);this.i._addFloatVectorToInputSidePacket(i,n)}))}addIntVectorToInputSidePacket(e,t){m(this,t,(n=>{const i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(const r of e)this.i._addIntVectorEntry(i,r);this.i._addIntVectorToInputSidePacket(i,n)}))}addUintVectorToInputSidePacket(e,t){m(this,t,(n=>{const i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(const r of e)this.i._addUintVectorEntry(i,r);this.i._addUintVectorToInputSidePacket(i,n)}))}addStringVectorToInputSidePacket(e,t){m(this,t,(n=>{const i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(const r of e)m(this,r,(s=>{this.i._addStringVectorEntry(i,s)}));this.i._addStringVectorToInputSidePacket(i,n)}))}attachBoolListener(e,t){Pe(this,e,t),m(this,e,(n=>{this.i._attachBoolListener(n)}))}attachBoolVectorListener(e,t){Ye(this,e,t),m(this,e,(n=>{this.i._attachBoolVectorListener(n)}))}attachIntListener(e,t){Pe(this,e,t),m(this,e,(n=>{this.i._attachIntListener(n)}))}attachIntVectorListener(e,t){Ye(this,e,t),m(this,e,(n=>{this.i._attachIntVectorListener(n)}))}attachUintListener(e,t){Pe(this,e,t),m(this,e,(n=>{this.i._attachUintListener(n)}))}attachUintVectorListener(e,t){Ye(this,e,t),m(this,e,(n=>{this.i._attachUintVectorListener(n)}))}attachDoubleListener(e,t){Pe(this,e,t),m(this,e,(n=>{this.i._attachDoubleListener(n)}))}attachDoubleVectorListener(e,t){Ye(this,e,t),m(this,e,(n=>{this.i._attachDoubleVectorListener(n)}))}attachFloatListener(e,t){Pe(this,e,t),m(this,e,(n=>{this.i._attachFloatListener(n)}))}attachFloatVectorListener(e,t){Ye(this,e,t),m(this,e,(n=>{this.i._attachFloatVectorListener(n)}))}attachStringListener(e,t){Pe(this,e,t),m(this,e,(n=>{this.i._attachStringListener(n)}))}attachStringVectorListener(e,t){Ye(this,e,t),m(this,e,(n=>{this.i._attachStringVectorListener(n)}))}attachProtoListener(e,t,n){Pe(this,e,t),m(this,e,(i=>{this.i._attachProtoListener(i,n||!1)}))}attachProtoVectorListener(e,t,n){Ye(this,e,t),m(this,e,(i=>{this.i._attachProtoVectorListener(i,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?'),Pe(this,e,((i,r)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,r)})),m(this,e,(i=>{this.i._attachAudioListener(i,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Bs{get ga(){return this.i}pa(e,t,n){m(this,t,(i=>{const[r,s]=Rs(this,e,i);this.ga._addBoundTextureAsImageToStream(i,r,s,n)}))}Z(e,t){Pe(this,e,t),m(this,e,(n=>{this.ga._attachImageListener(n)}))}aa(e,t){Ye(this,e,t),m(this,e,(n=>{this.ga._attachImageVectorListener(n)}))}}));var Bs,Le=class extends ic{};async function x(e,t,n){return(async function(i,r,s,o){return Q2(i,r,s,o)})(e,n.canvas??(Ba()?void 0:document.createElement("canvas")),t,n)}function Ka(e,t,n,i){if(e.U){const s=new fa;if(n!=null&&n.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var r=n.regionOfInterest;if(r.left>=r.right||r.top>=r.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(r.left<0||r.top<0||r.right>1||r.bottom>1)throw Error("Expected RectF values to be in [0,1].");y(s,1,(r.left+r.right)/2),y(s,2,(r.top+r.bottom)/2),y(s,4,r.right-r.left),y(s,3,r.bottom-r.top)}else y(s,1,.5),y(s,2,.5),y(s,4,1),y(s,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(s,5,-Math.PI*n.rotationDegrees/180),(n==null?void 0:n.rotationDegrees)%180!=0){const[o,a]=ja(t);n=U(s,3)*a/o,r=U(s,4)*o/a,y(s,4,n),y(s,3,r)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,i)}e.g.pa(t,e.X,i??performance.now()),e.finishProcessing()}function Fe(e,t,n){var i;if((i=e.baseOptions)!=null&&i.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ka(e,t,n,e.C+1)}function je(e,t,n,i){var r;if(!((r=e.baseOptions)!=null&&r.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ka(e,t,n,i)}function Bt(e,t,n,i){var r=t.data;const s=t.width,o=s*(t=t.height);if((r instanceof Uint8Array||r instanceof Float32Array)&&r.length!==o)throw Error("Unsupported channel count: "+r.length/o);return e=new Y([r],n,!1,e.g.i.canvas,e.P,s,t),i?e.clone():e}var me=class extends Oi{constructor(e,t,n,i){super(e),this.g=e,this.X=t,this.U=n,this.oa=i,this.P=new Ga}l(e,t=!0){if("runningMode"in e&&k(this.baseOptions,2,ln(!!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()}};me.prototype.close=me.prototype.close;var Ae=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},_(e=this.h=new ni,0,1,t=new B),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return S(this.h,B,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 _e;I(e,"image_in"),I(e,"norm_rect_in"),T(e,"detections");const t=new ye;De(t,B2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect_in"),E(n,"DETECTIONS:detections"),n.o(t),Se(e,n),this.g.attachProtoVectorListener("detections",((i,r)=>{for(const s of i)i=la(s),this.j.detections.push(Ia(i));d(this,r)})),this.g.attachEmptyPacketListener("detections",(i=>{d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ae.prototype.detectForVideo=Ae.prototype.G,Ae.prototype.detect=Ae.prototype.F,Ae.prototype.setOptions=Ae.prototype.o,Ae.createFromModelPath=async function(e,t){return x(Ae,e,{baseOptions:{modelAssetPath:t}})},Ae.createFromModelBuffer=function(e,t){return x(Ae,e,{baseOptions:{modelAssetBuffer:t}})},Ae.createFromOptions=function(e,t){return x(Ae,e,t)};var Mr=Me([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]),Lr=Me([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]),Fr=Me([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),qa=Me([474,475],[475,476],[476,477],[477,474]),Pr=Me([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]),Rr=Me([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Xa=Me([469,470],[470,471],[471,472],[472,469]),Or=Me([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]),Ya=[...Mr,...Lr,...Fr,...Pr,...Rr,...Or],$a=Me([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 js(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var D=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,_(e=this.h=new _a,0,1,t=new B),this.A=new ya,_(this.h,0,3,this.A),this.u=new ni,_(this.h,0,2,this.u),ze(this.u,4,1),y(this.u,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"numFaces"in e&&ze(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 js(this),Fe(this,e,t),this.j}G(e,t,n){return js(this),je(this,e,n,t),this.j}m(){var e=new _e;I(e,"image_in"),I(e,"norm_rect"),T(e,"face_landmarks");const t=new ye;De(t,U2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect"),E(n,"NORM_LANDMARKS:face_landmarks"),n.o(t),Se(e,n),this.g.attachProtoVectorListener("face_landmarks",((i,r)=>{for(const s of i)i=vn(s),this.j.faceLandmarks.push(ii(i));d(this,r)})),this.g.attachEmptyPacketListener("face_landmarks",(i=>{d(this,i)})),this.outputFaceBlendshapes&&(T(e,"blendshapes"),E(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((i,r)=>{if(this.outputFaceBlendshapes)for(const s of i)i=ti(s),this.j.faceBlendshapes.push(Sr(i.g()??[]));d(this,r)})),this.g.attachEmptyPacketListener("blendshapes",(i=>{d(this,i)}))),this.outputFacialTransformationMatrixes&&(T(e,"face_geometry"),E(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((i,r)=>{if(this.outputFacialTransformationMatrixes)for(const s of i)(i=S(i=j2(s),F2,2))&&this.j.facialTransformationMatrixes.push({rows:Ee(i,1)??0??0,columns:Ee(i,2)??0??0,data:ct(i,3,Oe,at()).slice()??[]});d(this,r)})),this.g.attachEmptyPacketListener("face_geometry",(i=>{d(this,i)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};D.prototype.detectForVideo=D.prototype.G,D.prototype.detect=D.prototype.F,D.prototype.setOptions=D.prototype.o,D.createFromModelPath=function(e,t){return x(D,e,{baseOptions:{modelAssetPath:t}})},D.createFromModelBuffer=function(e,t){return x(D,e,{baseOptions:{modelAssetBuffer:t}})},D.createFromOptions=function(e,t){return x(D,e,t)},D.FACE_LANDMARKS_LIPS=Mr,D.FACE_LANDMARKS_LEFT_EYE=Lr,D.FACE_LANDMARKS_LEFT_EYEBROW=Fr,D.FACE_LANDMARKS_LEFT_IRIS=qa,D.FACE_LANDMARKS_RIGHT_EYE=Pr,D.FACE_LANDMARKS_RIGHT_EYEBROW=Rr,D.FACE_LANDMARKS_RIGHT_IRIS=Xa,D.FACE_LANDMARKS_FACE_OVAL=Or,D.FACE_LANDMARKS_CONTOURS=Ya,D.FACE_LANDMARKS_TESSELATION=$a;var Nr=Me([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 Us(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Vs(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 Gs(e,t=!0){const n=[];for(const r of e){var i=ti(r);e=[];for(const s of i.g())i=t&&Ee(s,1)!=null?Ee(s,1)??0:-1,e.push({score:U(s,2)??0,index:i,categoryName:Q(O(s,3))??""??"",displayName:Q(O(s,4))??""??""});n.push(e)}return n}var ce=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],_(e=this.j=new ba,0,1,t=new B),this.u=new br,_(this.j,0,2,this.u),this.D=new Ar,_(this.u,0,3,this.D),this.A=new Aa,_(this.u,0,2,this.A),this.h=new V2,_(this.j,0,3,this.h),y(this.A,2,.5),y(this.u,4,.5),y(this.D,2,.5)}get baseOptions(){return S(this.j,B,1)}set baseOptions(e){_(this.j,0,1,e)}o(e){var r,s,o,a;if(ze(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 wt,n=t,i=Ri(e.cannedGesturesClassifierOptions,(r=S(this.h,wt,3))==null?void 0:r.l());_(n,0,2,i),_(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((s=S(this.h,wt,3))==null||s.g());return e.customGesturesClassifierOptions?(_(n=t=new wt,0,2,i=Ri(e.customGesturesClassifierOptions,(o=S(this.h,wt,4))==null?void 0:o.l())),_(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((a=S(this.h,wt,4))==null||a.g()),this.l(e)}Ha(e,t){return Us(this),Fe(this,e,t),Vs(this)}Ia(e,t,n){return Us(this),je(this,e,n,t),Vs(this)}m(){var e=new _e;I(e,"image_in"),I(e,"norm_rect"),T(e,"hand_gestures"),T(e,"hand_landmarks"),T(e,"world_hand_landmarks"),T(e,"handedness");const t=new ye;De(t,G2,this.j);const n=new oe;ge(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect"),E(n,"HAND_GESTURES:hand_gestures"),E(n,"LANDMARKS:hand_landmarks"),E(n,"WORLD_LANDMARKS:world_hand_landmarks"),E(n,"HANDEDNESS:handedness"),n.o(t),Se(e,n),this.g.attachProtoVectorListener("hand_landmarks",((i,r)=>{for(const s of i){i=vn(s);const o=[];for(const a of He(i,da,1))o.push({x:U(a,1)??0,y:U(a,2)??0,z:U(a,3)??0,visibility:U(a,4)??0});this.landmarks.push(o)}d(this,r)})),this.g.attachEmptyPacketListener("hand_landmarks",(i=>{d(this,i)})),this.g.attachProtoVectorListener("world_hand_landmarks",((i,r)=>{for(const s of i){i=St(s);const o=[];for(const a of He(i,ua,1))o.push({x:U(a,1)??0,y:U(a,2)??0,z:U(a,3)??0,visibility:U(a,4)??0});this.worldLandmarks.push(o)}d(this,r)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(i=>{d(this,i)})),this.g.attachProtoVectorListener("hand_gestures",((i,r)=>{this.gestures.push(...Gs(i,!1)),d(this,r)})),this.g.attachEmptyPacketListener("hand_gestures",(i=>{d(this,i)})),this.g.attachProtoVectorListener("handedness",((i,r)=>{this.handedness.push(...Gs(i)),d(this,r)})),this.g.attachEmptyPacketListener("handedness",(i=>{d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Hs(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ce.prototype.recognizeForVideo=ce.prototype.Ia,ce.prototype.recognize=ce.prototype.Ha,ce.prototype.setOptions=ce.prototype.o,ce.createFromModelPath=function(e,t){return x(ce,e,{baseOptions:{modelAssetPath:t}})},ce.createFromModelBuffer=function(e,t){return x(ce,e,{baseOptions:{modelAssetBuffer:t}})},ce.createFromOptions=function(e,t){return x(ce,e,t)},ce.HAND_CONNECTIONS=Nr;var se=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],_(e=this.h=new br,0,1,t=new B),this.u=new Ar,_(this.h,0,3,this.u),this.j=new Aa,_(this.h,0,2,this.j),ze(this.j,3,1),y(this.j,2,.5),y(this.u,2,.5),y(this.h,4,.5)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"numHands"in e&&ze(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),Hs(this)}G(e,t,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],je(this,e,n,t),Hs(this)}m(){var e=new _e;I(e,"image_in"),I(e,"norm_rect"),T(e,"hand_landmarks"),T(e,"world_hand_landmarks"),T(e,"handedness");const t=new ye;De(t,H2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect"),E(n,"LANDMARKS:hand_landmarks"),E(n,"WORLD_LANDMARKS:world_hand_landmarks"),E(n,"HANDEDNESS:handedness"),n.o(t),Se(e,n),this.g.attachProtoVectorListener("hand_landmarks",((i,r)=>{for(const s of i)i=vn(s),this.landmarks.push(ii(i));d(this,r)})),this.g.attachEmptyPacketListener("hand_landmarks",(i=>{d(this,i)})),this.g.attachProtoVectorListener("world_hand_landmarks",((i,r)=>{for(const s of i)i=St(s),this.worldLandmarks.push(on(i));d(this,r)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(i=>{d(this,i)})),this.g.attachProtoVectorListener("handedness",((i,r)=>{var s=this.handedness,o=s.push;const a=[];for(const c of i){i=ti(c);const h=[];for(const l of i.g())h.push({score:U(l,2)??0,index:Ee(l,1)??0??-1,categoryName:Q(O(l,3))??""??"",displayName:Q(O(l,4))??""??""});a.push(h)}o.call(s,...a),d(this,r)})),this.g.attachEmptyPacketListener("handedness",(i=>{d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};se.prototype.detectForVideo=se.prototype.G,se.prototype.detect=se.prototype.F,se.prototype.setOptions=se.prototype.o,se.createFromModelPath=function(e,t){return x(se,e,{baseOptions:{modelAssetPath:t}})},se.createFromModelBuffer=function(e,t){return x(se,e,{baseOptions:{modelAssetBuffer:t}})},se.createFromOptions=function(e,t){return x(se,e,t)},se.HAND_CONNECTIONS=Nr;var Ja=Me([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 zs(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Ws(e){try{if(!e.D)return e.h;e.D(e.h)}finally{si(e)}}function Tn(e,t){e=vn(e),t.push(ii(e))}var R=class extends me{constructor(e,t){super(new Le(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 Ta,0,1,t=new B),this.I=new Ar,_(this.j,0,2,this.I),this.W=new z2,_(this.j,0,3,this.W),this.u=new ni,_(this.j,0,4,this.u),this.O=new ya,_(this.j,0,5,this.O),this.A=new xa,_(this.j,0,6,this.A),this.M=new Sa,_(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 S(this.j,B,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 i=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:n,zs(this),Fe(this,e,i),Ws(this)}G(e,t,n,i){const r=typeof n!="function"?n:{};return this.D=typeof n=="function"?n:i,zs(this),je(this,e,r,t),Ws(this)}m(){var e=new _e;I(e,"input_frames_image"),T(e,"pose_landmarks"),T(e,"pose_world_landmarks"),T(e,"face_landmarks"),T(e,"left_hand_landmarks"),T(e,"left_hand_world_landmarks"),T(e,"right_hand_landmarks"),T(e,"right_hand_world_landmarks");const t=new ye,n=new ps;ge(n,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),(function(r,s){if(s!=null)if(Array.isArray(s))k(r,2,Hn(s,0,un));else{if(!(typeof s=="string"||s instanceof Ne||Vi(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");$e(r,2,Hi(s,!1),gt())}})(n,this.j.g());const i=new oe;ge(i,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),rr(i,8,ps,n),N(i,"IMAGE:input_frames_image"),E(i,"POSE_LANDMARKS:pose_landmarks"),E(i,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),E(i,"FACE_LANDMARKS:face_landmarks"),E(i,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),E(i,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),E(i,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),E(i,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),i.o(t),Se(e,i),ri(this,e),this.g.attachProtoListener("pose_landmarks",((r,s)=>{Tn(r,this.h.poseLandmarks),d(this,s)})),this.g.attachEmptyPacketListener("pose_landmarks",(r=>{d(this,r)})),this.g.attachProtoListener("pose_world_landmarks",((r,s)=>{var o=this.h.poseWorldLandmarks;r=St(r),o.push(on(r)),d(this,s)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(r=>{d(this,r)})),this.outputPoseSegmentationMasks&&(E(i,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),It(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",((r,s)=>{this.h.poseSegmentationMasks=[Bt(this,r,!0,!this.D)],d(this,s)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(r=>{this.h.poseSegmentationMasks=[],d(this,r)}))),this.g.attachProtoListener("face_landmarks",((r,s)=>{Tn(r,this.h.faceLandmarks),d(this,s)})),this.g.attachEmptyPacketListener("face_landmarks",(r=>{d(this,r)})),this.outputFaceBlendshapes&&(T(e,"extra_blendshapes"),E(i,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((r,s)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(r=ti(r),o.push(Sr(r.g()??[]))),d(this,s)})),this.g.attachEmptyPacketListener("extra_blendshapes",(r=>{d(this,r)}))),this.g.attachProtoListener("left_hand_landmarks",((r,s)=>{Tn(r,this.h.leftHandLandmarks),d(this,s)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(r=>{d(this,r)})),this.g.attachProtoListener("left_hand_world_landmarks",((r,s)=>{var o=this.h.leftHandWorldLandmarks;r=St(r),o.push(on(r)),d(this,s)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(r=>{d(this,r)})),this.g.attachProtoListener("right_hand_landmarks",((r,s)=>{Tn(r,this.h.rightHandLandmarks),d(this,s)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(r=>{d(this,r)})),this.g.attachProtoListener("right_hand_world_landmarks",((r,s)=>{var o=this.h.rightHandWorldLandmarks;r=St(r),o.push(on(r)),d(this,s)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(r=>{d(this,r)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};R.prototype.detectForVideo=R.prototype.G,R.prototype.detect=R.prototype.F,R.prototype.setOptions=R.prototype.o,R.createFromModelPath=function(e,t){return x(R,e,{baseOptions:{modelAssetPath:t}})},R.createFromModelBuffer=function(e,t){return x(R,e,{baseOptions:{modelAssetBuffer:t}})},R.createFromOptions=function(e,t){return x(R,e,t)},R.HAND_CONNECTIONS=Nr,R.POSE_CONNECTIONS=Ja,R.FACE_LANDMARKS_LIPS=Mr,R.FACE_LANDMARKS_LEFT_EYE=Lr,R.FACE_LANDMARKS_LEFT_EYEBROW=Fr,R.FACE_LANDMARKS_LEFT_IRIS=qa,R.FACE_LANDMARKS_RIGHT_EYE=Pr,R.FACE_LANDMARKS_RIGHT_EYEBROW=Rr,R.FACE_LANDMARKS_RIGHT_IRIS=Xa,R.FACE_LANDMARKS_FACE_OVAL=Or,R.FACE_LANDMARKS_CONTOURS=Ya,R.FACE_LANDMARKS_TESSELATION=$a;var be=class extends me{constructor(e,t){super(new Le(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},_(e=this.h=new ka,0,1,t=new B)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return _(this.h,0,2,Ri(e,S(this.h,_r,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 _e;I(e,"input_image"),I(e,"norm_rect"),T(e,"classifications");const t=new ye;De(t,W2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),N(n,"IMAGE:input_image"),N(n,"NORM_RECT:norm_rect"),E(n,"CLASSIFICATIONS:classifications"),n.o(t),Se(e,n),this.g.attachProtoListener("classifications",((i,r)=>{this.j=J2(O2(i)),d(this,r)})),this.g.attachEmptyPacketListener("classifications",(i=>{d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};be.prototype.classifyForVideo=be.prototype.ta,be.prototype.classify=be.prototype.sa,be.prototype.setOptions=be.prototype.o,be.createFromModelPath=function(e,t){return x(be,e,{baseOptions:{modelAssetPath:t}})},be.createFromModelBuffer=function(e,t){return x(be,e,{baseOptions:{modelAssetBuffer:t}})},be.createFromOptions=function(e,t){return x(be,e,t)};var he=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect",!0),this.h=new Ma,this.embeddings={embeddings:[]},_(e=this.h,0,1,t=new B)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){var t=this.h,n=S(this.h,xs,2);return n=n?n.clone():new xs,e.l2Normalize!==void 0?k(n,1,ln(e.l2Normalize)):"l2Normalize"in e&&k(n,1),e.quantize!==void 0?k(n,2,ln(e.quantize)):"quantize"in e&&k(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 _e;I(e,"image_in"),I(e,"norm_rect"),T(e,"embeddings_out");const t=new ye;De(t,K2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect"),E(n,"EMBEDDINGS:embeddings_out"),n.o(t),Se(e,n),this.g.attachProtoListener("embeddings_out",((i,r)=>{i=I2(i),this.embeddings=(function(s){return{embeddings:He(s,C2,1).map((o=>{var h,l;const a={headIndex:Ee(o,3)??0??-1,headName:Q(O(o,4))??""??""};var c=o.v;return xo(c,0|c[g],Es,gi(o,1))!==void 0?(o=ct(o=S(o,Es,gi(o,1),void 0),1,Oe,at()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((l=(h=S(o,N2,gi(o,2),void 0))==null?void 0:h.na())==null?void 0:l.h())??c),a})),timestampMs:Ca(ko(s))}})(i),d(this,r)})),this.g.attachEmptyPacketListener("embeddings_out",(i=>{d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};he.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Fs(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Fs(Ls(e.quantizedEmbedding),Ls(t.quantizedEmbedding))}return e},he.prototype.embedForVideo=he.prototype.Aa,he.prototype.embed=he.prototype.za,he.prototype.setOptions=he.prototype.o,he.createFromModelPath=function(e,t){return x(he,e,{baseOptions:{modelAssetPath:t}})},he.createFromModelBuffer=function(e,t){return x(he,e,{baseOptions:{modelAssetBuffer:t}})},he.createFromOptions=function(e,t){return x(he,e,t)};var Ii=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 rc(e){var n,i;const t=(function(r){return He(r,oe,1)})(e.ca()).filter((r=>(Q(O(r,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&&(((i=(n=S(t[0],ye,7))==null?void 0:n.j())==null?void 0:i.g())??new Map).forEach(((r,s)=>{e.u[Number(s)]=Q(O(r,1))??""}))}function Ks(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function qs(e){try{const t=new Ii(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{si(e)}}Ii.prototype.close=Ii.prototype.close;var re=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xr,this.A=new La,_(this.h,0,3,this.A),_(e=this.h,0,1,t=new B)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?k(this.h,2,mn(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(){rc(this)}segment(e,t,n){const i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:n,Ks(this),Fe(this,e,i),qs(this)}La(e,t,n,i){const r=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:i,Ks(this),je(this,e,r,t),qs(this)}Da(){return this.u}m(){var e=new _e;I(e,"image_in"),I(e,"norm_rect");const t=new ye;De(t,Pa,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect"),n.o(t),Se(e,n),ri(this,e),this.outputConfidenceMasks&&(T(e,"confidence_masks"),E(n,"CONFIDENCE_MASKS:confidence_masks"),It(this,"confidence_masks"),this.g.aa("confidence_masks",((i,r)=>{this.confidenceMasks=i.map((s=>Bt(this,s,!0,!this.j))),d(this,r)})),this.g.attachEmptyPacketListener("confidence_masks",(i=>{this.confidenceMasks=[],d(this,i)}))),this.outputCategoryMask&&(T(e,"category_mask"),E(n,"CATEGORY_MASK:category_mask"),It(this,"category_mask"),this.g.Z("category_mask",((i,r)=>{this.categoryMask=Bt(this,i,!1,!this.j),d(this,r)})),this.g.attachEmptyPacketListener("category_mask",(i=>{this.categoryMask=void 0,d(this,i)}))),T(e,"quality_scores"),E(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((i,r)=>{this.qualityScores=i,d(this,r)})),this.g.attachEmptyPacketListener("quality_scores",(i=>{this.categoryMask=void 0,d(this,i)})),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 x(re,e,{baseOptions:{modelAssetPath:t}})},re.createFromModelBuffer=function(e,t){return x(re,e,{baseOptions:{modelAssetBuffer:t}})},re.createFromOptions=function(e,t){return x(re,e,t)};var Di=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()}};Di.prototype.close=Di.prototype.close;var Re=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new xr,this.u=new La,_(this.h,0,3,this.u),_(e=this.h,0,1,t=new B)}get baseOptions(){return S(this.h,B,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,i){const r=typeof n!="function"?n:{};if(this.j=typeof n=="function"?n:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,i=new Ra,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var s=new _i;$e(s,3,ln(!0),!1),$e(s,1,tn(t.keypoint.x),0),$e(s,2,tn(t.keypoint.y),0),rn(i,1,Pi,s)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new X2;for(s of t.scribble)$e(t=new _i,3,ln(!0),!1),$e(t,1,tn(s.x),0),$e(t,2,tn(s.y),0),rr(a,1,_i,t);rn(i,2,Pi,a)}}this.g.addProtoToStream(i.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),Fe(this,e,r);e:{try{const a=new Di(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break e}this.j(a)}finally{si(this)}o=void 0}return o}m(){var e=new _e;I(e,"image_in"),I(e,"roi_in"),I(e,"norm_rect_in");const t=new ye;De(t,Pa,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),N(n,"IMAGE:image_in"),N(n,"ROI:roi_in"),N(n,"NORM_RECT:norm_rect_in"),n.o(t),Se(e,n),ri(this,e),this.outputConfidenceMasks&&(T(e,"confidence_masks"),E(n,"CONFIDENCE_MASKS:confidence_masks"),It(this,"confidence_masks"),this.g.aa("confidence_masks",((i,r)=>{this.confidenceMasks=i.map((s=>Bt(this,s,!0,!this.j))),d(this,r)})),this.g.attachEmptyPacketListener("confidence_masks",(i=>{this.confidenceMasks=[],d(this,i)}))),this.outputCategoryMask&&(T(e,"category_mask"),E(n,"CATEGORY_MASK:category_mask"),It(this,"category_mask"),this.g.Z("category_mask",((i,r)=>{this.categoryMask=Bt(this,i,!1,!this.j),d(this,r)})),this.g.attachEmptyPacketListener("category_mask",(i=>{this.categoryMask=void 0,d(this,i)}))),T(e,"quality_scores"),E(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((i,r)=>{this.qualityScores=i,d(this,r)})),this.g.attachEmptyPacketListener("quality_scores",(i=>{this.categoryMask=void 0,d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Re.prototype.segment=Re.prototype.segment,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=function(e,t){return x(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return x(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return x(Re,e,t)};var we=class extends me{constructor(e,t){super(new Le(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},_(e=this.h=new Oa,0,1,t=new B)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?k(this.h,2,mn(e.displayNamesLocale)):"displayNamesLocale"in e&&k(this.h,2),e.maxResults!==void 0?ze(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?Rn(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&k(this.h,5),e.categoryDenylist!==void 0?Rn(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&k(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 _e;I(e,"input_frame_gpu"),I(e,"norm_rect"),T(e,"detections");const t=new ye;De(t,Y2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),N(n,"IMAGE:input_frame_gpu"),N(n,"NORM_RECT:norm_rect"),E(n,"DETECTIONS:detections"),n.o(t),Se(e,n),this.g.attachProtoVectorListener("detections",((i,r)=>{for(const s of i)i=la(s),this.j.detections.push(Ia(i));d(this,r)})),this.g.attachEmptyPacketListener("detections",(i=>{d(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};we.prototype.detectForVideo=we.prototype.G,we.prototype.detect=we.prototype.F,we.prototype.setOptions=we.prototype.o,we.createFromModelPath=async function(e,t){return x(we,e,{baseOptions:{modelAssetPath:t}})},we.createFromModelBuffer=function(e,t){return x(we,e,{baseOptions:{modelAssetBuffer:t}})},we.createFromOptions=function(e,t){return x(we,e,t)};var Bi=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 Xs(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Ys(e){try{const t=new Bi(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{si(e)}}Bi.prototype.close=Bi.prototype.close;var le=class extends me{constructor(e,t){super(new Le(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,_(e=this.h=new Na,0,1,t=new B),this.A=new Sa,_(this.h,0,3,this.A),this.j=new xa,_(this.h,0,2,this.j),ze(this.j,4,1),y(this.j,2,.5),y(this.A,2,.5),y(this.h,4,.5)}get baseOptions(){return S(this.h,B,1)}set baseOptions(e){_(this.h,0,1,e)}o(e){return"numPoses"in e&&ze(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 i=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:n,Xs(this),Fe(this,e,i),Ys(this)}G(e,t,n,i){const r=typeof n!="function"?n:{};return this.u=typeof n=="function"?n:i,Xs(this),je(this,e,r,t),Ys(this)}m(){var e=new _e;I(e,"image_in"),I(e,"norm_rect"),T(e,"normalized_landmarks"),T(e,"world_landmarks"),T(e,"segmentation_masks");const t=new ye;De(t,$2,this.h);const n=new oe;ge(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),N(n,"IMAGE:image_in"),N(n,"NORM_RECT:norm_rect"),E(n,"NORM_LANDMARKS:normalized_landmarks"),E(n,"WORLD_LANDMARKS:world_landmarks"),n.o(t),Se(e,n),ri(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((i,r)=>{this.landmarks=[];for(const s of i)i=vn(s),this.landmarks.push(ii(i));d(this,r)})),this.g.attachEmptyPacketListener("normalized_landmarks",(i=>{this.landmarks=[],d(this,i)})),this.g.attachProtoVectorListener("world_landmarks",((i,r)=>{this.worldLandmarks=[];for(const s of i)i=St(s),this.worldLandmarks.push(on(i));d(this,r)})),this.g.attachEmptyPacketListener("world_landmarks",(i=>{this.worldLandmarks=[],d(this,i)})),this.outputSegmentationMasks&&(E(n,"SEGMENTATION_MASK:segmentation_masks"),It(this,"segmentation_masks"),this.g.aa("segmentation_masks",((i,r)=>{this.segmentationMasks=i.map((s=>Bt(this,s,!0,!this.u))),d(this,r)})),this.g.attachEmptyPacketListener("segmentation_masks",(i=>{this.segmentationMasks=[],d(this,i)}))),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 x(le,e,{baseOptions:{modelAssetPath:t}})},le.createFromModelBuffer=function(e,t){return x(le,e,{baseOptions:{modelAssetBuffer:t}})},le.createFromOptions=function(e,t){return x(le,e,t)},le.POSE_CONNECTIONS=Ja;const sc="https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",oc="https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm";class ac{constructor(){A(this,"landmarker",null);A(this,"_ready",!1)}get isReady(){return this._ready}async initialize(t){const n=(t==null?void 0:t.wasmPath)??oc,i=(t==null?void 0:t.modelPath)??sc,r=await st.forVisionTasks(n);this.landmarker=await se.createFromOptions(r,{baseOptions:{modelAssetPath:i,delegate:"GPU"},runningMode:"VIDEO",numHands:(t==null?void 0:t.numHands)??1,minHandDetectionConfidence:(t==null?void 0:t.minDetectionConfidence)??.5,minTrackingConfidence:(t==null?void 0:t.minTrackingConfidence)??.5}),this._ready=!0}detect(t,n){var c,h,l,u,f,v;if(!this.landmarker)return null;const i=this.landmarker.detectForVideo(t,n);if(!i.landmarks||i.landmarks.length===0)return null;const r=i.landmarks[0],s=((l=(h=(c=i.handednesses)==null?void 0:c[0])==null?void 0:h[0])==null?void 0:l.categoryName)??"Right",o=((v=(f=(u=i.handednesses)==null?void 0:u[0])==null?void 0:f[0])==null?void 0:v.score)??0;return{landmarks:r.map(b=>({x:b.x,y:b.y,visibility:b.visibility??void 0})),handedness:s,confidence:o}}destroy(){var t;(t=this.landmarker)==null||t.close(),this.landmarker=null,this._ready=!1}}function Za(e={}){const{modelPath:t,config:n,enabled:i=!0}=e,r=M.useRef(null),s=M.useRef(null),o=M.useRef(0),a=M.useRef(0),c=M.useRef(0),[h,l]=M.useState(!1),[u,f]=M.useState(!1),[v,b]=M.useState(null),[F,P]=M.useState(Ln()),[W,te]=M.useState(null),[ve,nt]=M.useState(Tt.IDLE),[An,oi]=M.useState(null),[Qa,e1]=M.useState(0),Cr=M.useRef(n?r1(n):$s()),ai=M.useRef(null),Ir=M.useRef(null),ci=M.useRef(null),hi=M.useRef(null),li=M.useRef(null),Dr=M.useRef(0),Br=M.useCallback(()=>{const ie=Cr.current;Ir.current=new ot(ie.kinematics.emaAlpha,ie.kinematics.bufferFrames),ci.current=new p1(ie.touchproof),hi.current=new y1,li.current=new _1},[]),bn=M.useCallback(()=>{var Vr;const ie=r.current,Ke=ai.current;if(!ie||!(Ke!=null&&Ke.isReady)||ie.readyState<2){o.current=requestAnimationFrame(bn);return}const At=performance.now(),ae=ie.videoWidth,Te=ie.videoHeight,qe=Ke.detect(ie,At);let Jt=Ln(),wn=null,jr=Tt.IDLE,Ur=null;if(qe&&qe.landmarks.length>=21){Ur=qe.landmarks,(Vr=Ir.current)==null||Vr.compute(qe.landmarks);const t1=o1(qe.landmarks);ci.current&&(Jt=ci.current.update(qe.landmarks,ae,Te));const Gr=qe.landmarks[8],Hr=qe.landmarks[12];if(hi.current&&(wn=hi.current.update([Gr.x,Gr.y],[Hr.x,Hr.y],Jt.isTouching,At)),li.current){const zr=li.current.update(wn,Jt.isTouching,t1.openPalm&&!Jt.isTouching,At);jr=zr.state,wn=zr.velocity}}Dr.current++,Dr.current%2===0&&(P(Jt),te(wn),nt(jr),oi(Ur)),a.current++,At-c.current>=1e3&&(e1(a.current),a.current=0,c.current=At),o.current=requestAnimationFrame(bn)},[]);return M.useEffect(()=>{if(!i)return;let ie=!1;const Ke=new ac;return ai.current=Ke,(async()=>{f(!0),b(null);try{const ae=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});if(ie){ae.getTracks().forEach(Te=>Te.stop());return}if(r.current&&(r.current.srcObject=ae,await r.current.play()),await Ke.initialize({modelPath:t}),ie)return;Br(),l(!0),f(!1),o.current=requestAnimationFrame(bn)}catch(ae){if(ie)return;const Te=ae instanceof Error?ae.message:"Failed to initialize Glide";Te.includes("Permission")||Te.includes("NotAllowed")?b("Camera access denied. Please allow camera access and reload."):Te.includes("NotFound")||Te.includes("DevicesNotFound")?b("No camera found. Please connect a camera and reload."):b(Te),f(!1)}})(),()=>{ie=!0,cancelAnimationFrame(o.current);const ae=r.current;ae!=null&&ae.srcObject&&(ae.srcObject.getTracks().forEach(Te=>Te.stop()),ae.srcObject=null),Ke.destroy(),ai.current=null}},[i,t,Br,bn]),{videoRef:r,canvasRef:s,isReady:h,isLoading:u,error:v,signals:F,velocity:W,gestureState:ve,landmarks:An,fps:Qa,config:Cr.current}}const cc=[[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],[17,18],[18,19],[19,20],[0,17]],hc=({videoRef:e,canvasRef:t,landmarks:n,signals:i,gestureState:r,fps:s,isLoading:o,error:a})=>{M.useEffect(()=>{const h=t.current,l=e.current;if(!h||!l)return;const u=h.getContext("2d");if(!u)return;const v=setInterval(()=>{if(h.width=l.videoWidth||640,h.height=l.videoHeight||480,u.clearRect(0,0,h.width,h.height),!n||n.length<21)return;const b=h.width,F=h.height;u.lineWidth=2,u.strokeStyle="rgba(255, 255, 255, 0.6)";for(const[P,W]of cc){const te=n[P],ve=n[W];u.beginPath(),u.moveTo(te.x*b,te.y*F),u.lineTo(ve.x*b,ve.y*F),u.stroke()}for(let P=0;P<n.length;P++){const W=n[P],te=P===8||P===12;u.beginPath(),u.arc(W.x*b,W.y*F,te?6:3,0,Math.PI*2),te?u.fillStyle=i.isTouching?"#22c55e":"#ef4444":u.fillStyle="rgba(255, 255, 255, 0.8)",u.fill()}},50);return()=>clearInterval(v)},[t,e,n,i.isTouching]);const c=[{label:"Proximity",value:i.proximityScore,color:"#3b82f6"},{label:"Angle",value:i.angleScore,color:"#8b5cf6"},{label:"Correlation",value:i.correlationScore,color:"#06b6d4"},{label:"Visibility",value:i.visibilityScore,color:"#f59e0b"},{label:"Fused",value:i.fusedScore,color:i.isTouching?"#22c55e":"#ef4444"}];return w.jsxs("div",{className:"glide-visualizer",children:[w.jsxs("div",{className:"glide-video-container",children:[w.jsx("video",{ref:e,autoPlay:!0,playsInline:!0,muted:!0,style:{width:"100%",height:"100%",objectFit:"cover",transform:"scaleX(-1)"}}),w.jsx("canvas",{ref:t,className:"glide-canvas-overlay",style:{transform:"scaleX(-1)"}}),w.jsxs("div",{className:"glide-status-overlay",children:[w.jsxs("span",{className:"glide-fps",children:[s," FPS"]}),w.jsx("span",{className:`glide-state glide-state--${r}`,children:r===Tt.SCROLLING?"SCROLLING":"IDLE"})]}),o&&w.jsxs("div",{className:"glide-loading-overlay",children:[w.jsx("div",{className:"glide-spinner"}),w.jsx("p",{children:"Loading hand detection model..."})]}),a&&w.jsx("div",{className:"glide-error-overlay",children:w.jsx("p",{children:a})})]}),w.jsxs("div",{className:"glide-signal-dashboard",children:[c.map(h=>w.jsxs("div",{className:"glide-signal-row",children:[w.jsx("span",{className:"glide-signal-label",children:h.label}),w.jsx("div",{className:"glide-signal-bar-bg",children:w.jsx("div",{className:"glide-signal-bar-fill",style:{width:`${Math.max(0,Math.min(100,h.value*100))}%`,backgroundColor:h.color}})}),w.jsx("span",{className:"glide-signal-value",children:h.value.toFixed(2)})]},h.label)),w.jsxs("div",{className:"glide-signal-row",children:[w.jsx("span",{className:"glide-signal-label",children:"Distance"}),w.jsx("div",{className:"glide-signal-bar-bg",children:w.jsx("div",{className:"glide-signal-bar-fill",style:{width:`${i.distanceFactor*100}%`,backgroundColor:"#64748b"}})}),w.jsx("span",{className:"glide-signal-value",children:i.distanceFactor.toFixed(2)})]})]})]})},lc=w.jsxs(w.Fragment,{children:[w.jsx("h2",{children:"Scroll Demo"}),w.jsx("p",{children:"This area responds to your Glide gestures. Pinch your index and middle fingers together, then move them up or down to scroll."}),Array.from({length:20},(e,t)=>w.jsxs("div",{className:"glide-scroll-section",children:[w.jsxs("h3",{children:["Section ",t+1]}),w.jsx("p",{children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."}),w.jsx("p",{children:"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."})]},t))]}),uc=({velocity:e,gestureState:t,isActive:n,children:i})=>{const r=M.useRef(null);return M.useEffect(()=>{if(!n||t!==Tt.SCROLLING||!e||!r.current)return;const s=-e.y*1400;r.current.scrollBy({top:s/60})},[e,t,n]),w.jsx("div",{ref:r,className:`glide-scroll-area ${n?"glide-scroll-area--active":""}`,children:i??lc})},dc=({modelPath:e,config:t,showVisualizer:n=!0,scrollContent:i,className:r="",style:s})=>{const o=Za({modelPath:e,config:t}),a=i===null;return w.jsxs("div",{className:`glide-demo ${a?"glide-demo--full":""} ${r}`,style:s,children:[n&&w.jsx(hc,{videoRef:o.videoRef,canvasRef:o.canvasRef,landmarks:o.landmarks,signals:o.signals,gestureState:o.gestureState,fps:o.fps,isLoading:o.isLoading,error:o.error}),!a&&w.jsx(uc,{velocity:o.velocity,gestureState:o.gestureState,isActive:o.gestureState===Tt.SCROLLING,children:i})]})};exports.GlideDemo=dc;exports.useGlide=Za;