@smileid/web-components 11.0.1 → 11.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var SmartCameraWeb=function(P){"use strict";var mu=Object.defineProperty,gu=Object.defineProperties;var vu=Object.getOwnPropertyDescriptors;var Pr=Object.getOwnPropertySymbols;var K2=Object.prototype.hasOwnProperty,J2=Object.prototype.propertyIsEnumerable;var da=Math.pow,ha=(P,J,ie)=>J in P?mu(P,J,{enumerable:!0,configurable:!0,writable:!0,value:ie}):P[J]=ie,Fe=(P,J)=>{for(var ie in J||(J={}))K2.call(J,ie)&&ha(P,ie,J[ie]);if(Pr)for(var ie of Pr(J))J2.call(J,ie)&&ha(P,ie,J[ie]);return P},qi=(P,J)=>gu(P,vu(J));var ua=(P,J)=>{var ie={};for(var Pe in P)K2.call(P,Pe)&&J.indexOf(Pe)<0&&(ie[Pe]=P[Pe]);if(P!=null&&Pr)for(var Pe of Pr(P))J.indexOf(Pe)<0&&J2.call(P,Pe)&&(ie[Pe]=P[Pe]);return ie};var li=(P,J,ie)=>ha(P,typeof J!="symbol"?J+"":J,ie);var M=(P,J,ie)=>new Promise((Pe,Sn)=>{var $r=_t=>{try{Wi(ie.next(_t))}catch(hi){Sn(hi)}},Nr=_t=>{try{Wi(ie.throw(_t))}catch(hi){Sn(hi)}},Wi=_t=>_t.done?Pe(_t.value):Promise.resolve(_t.value).then($r,Nr);Wi((ie=ie.apply(P,J)).next())});var rt;function J(e){const t=[...Array(30)].map(()=>Math.random().toString(36)[3]).join("");return`${e}-${t}`}function ie(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}function Pe(e){return e&&e.clientHeight<e.scrollHeight}function Sn(e,t){const{offsetHeight:i,offsetTop:n}=e,{offsetHeight:r,scrollTop:s}=t,o=n<s,a=n+i>s+r;o?t.scrollTo(0,n):a&&t.scrollTo(0,n-r+i)}class $r extends HTMLElement{constructor(){super(),this.handleRoaming=this.handleRoaming.bind(this)}connectedCallback(){this.trigger=this.querySelector("smileid-combobox-trigger"),document.addEventListener("click",this.handleRoaming),this.addEventListener("focusout",this.handleRoaming),this.addEventListener("blur",this.handleRoaming)}disconnectedCallback(){document.removeEventListener("click",this.handleRoaming),this.removeEventListener("focusout",this.handleRoaming),this.removeEventListener("blur",this.handleRoaming)}handleRoaming(t){const i=t.relatedTarget||t.target;this.contains(i)||this.trigger.getAttribute("expanded")==="true"&&this.trigger.setAttribute("expanded","false")}}class Nr extends HTMLElement{constructor(){super(),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleSelection=this.handleSelection.bind(this),this.toggleExpansionState=this.toggleExpansionState.bind(this)}get type(){return this.getAttribute("type")||"text"}get label(){return this.getAttribute("label")||""}get value(){return this.getAttribute("value")||""}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){if(!this.label)throw new Error("<combobox-trigger>: a label attribute is required");this.innerHTML=`${this.type==="text"?`
1
+ var SmartCameraWeb=function(P){"use strict";var vu=Object.defineProperty,bu=Object.defineProperties;var wu=Object.getOwnPropertyDescriptors;var Pr=Object.getOwnPropertySymbols;var K2=Object.prototype.hasOwnProperty,J2=Object.prototype.propertyIsEnumerable;var da=Math.pow,ha=(P,J,ie)=>J in P?vu(P,J,{enumerable:!0,configurable:!0,writable:!0,value:ie}):P[J]=ie,Fe=(P,J)=>{for(var ie in J||(J={}))K2.call(J,ie)&&ha(P,ie,J[ie]);if(Pr)for(var ie of Pr(J))J2.call(J,ie)&&ha(P,ie,J[ie]);return P},qi=(P,J)=>bu(P,wu(J));var ua=(P,J)=>{var ie={};for(var Pe in P)K2.call(P,Pe)&&J.indexOf(Pe)<0&&(ie[Pe]=P[Pe]);if(P!=null&&Pr)for(var Pe of Pr(P))J.indexOf(Pe)<0&&J2.call(P,Pe)&&(ie[Pe]=P[Pe]);return ie};var li=(P,J,ie)=>ha(P,typeof J!="symbol"?J+"":J,ie);var L=(P,J,ie)=>new Promise((Pe,Sn)=>{var $r=_t=>{try{Wi(ie.next(_t))}catch(hi){Sn(hi)}},Nr=_t=>{try{Wi(ie.throw(_t))}catch(hi){Sn(hi)}},Wi=_t=>_t.done?Pe(_t.value):Promise.resolve(_t.value).then($r,Nr);Wi((ie=ie.apply(P,J)).next())});var rt;function J(e){const t=[...Array(30)].map(()=>Math.random().toString(36)[3]).join("");return`${e}-${t}`}function ie(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}function Pe(e){return e&&e.clientHeight<e.scrollHeight}function Sn(e,t){const{offsetHeight:i,offsetTop:n}=e,{offsetHeight:r,scrollTop:s}=t,o=n<s,a=n+i>s+r;o?t.scrollTo(0,n):a&&t.scrollTo(0,n-r+i)}class $r extends HTMLElement{constructor(){super(),this.handleRoaming=this.handleRoaming.bind(this)}connectedCallback(){this.trigger=this.querySelector("smileid-combobox-trigger"),document.addEventListener("click",this.handleRoaming),this.addEventListener("focusout",this.handleRoaming),this.addEventListener("blur",this.handleRoaming)}disconnectedCallback(){document.removeEventListener("click",this.handleRoaming),this.removeEventListener("focusout",this.handleRoaming),this.removeEventListener("blur",this.handleRoaming)}handleRoaming(t){const i=t.relatedTarget||t.target;this.contains(i)||this.trigger.getAttribute("expanded")==="true"&&this.trigger.setAttribute("expanded","false")}}class Nr extends HTMLElement{constructor(){super(),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleSelection=this.handleSelection.bind(this),this.toggleExpansionState=this.toggleExpansionState.bind(this)}get type(){return this.getAttribute("type")||"text"}get label(){return this.getAttribute("label")||""}get value(){return this.getAttribute("value")||""}get disabled(){return this.hasAttribute("disabled")}connectedCallback(){if(!this.label)throw new Error("<combobox-trigger>: a label attribute is required");this.innerHTML=`${this.type==="text"?`
2
2
  <div>
3
3
  <input ${this.value?`value="${this.value}" `:""}${this.disabled?" disabled ":""}type="text" placeholder="${this.label}" />
4
4
  <button ${this.disabled?"disabled ":""}tabindex='-1' type='button'>
@@ -423,7 +423,7 @@ ${Q2}
423
423
  left: 1.25rem;
424
424
  }
425
425
 
426
- </style>`,wt=class wt{static getMedia(t){return M(this,null,function*(){return wt.stream=yield navigator.mediaDevices.getUserMedia(t),wt.stream})}static stopMedia(){wt.stream&&(wt.stream.getTracks().forEach(t=>t.stop()),wt.stream=null)}static supportsAgentMode(){return M(this,null,function*(){try{const i=(yield navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput");let n=!1;return i.forEach(r=>r.label.toLowerCase().includes("back")||r.label.toLowerCase().includes("rear")?(n=!0,!0):!1),n}catch(t){return console.warn("Error accessing media devices: ",t),!1}})}static isSamsungMultiCameraDevice(){const t=navigator.userAgent.match(/SM-[N|G]\d{3}/);if(!t)return!1;const i=parseInt(t[0].match(/\d{3}/)[0],10);return!Number.isNaN(i)&&i>=970}static handleCameraError(t){switch(t.name){case"NotAllowedError":case"SecurityError":return`
426
+ </style>`,wt=class wt{static getMedia(t){return L(this,null,function*(){return wt.stream=yield navigator.mediaDevices.getUserMedia(t),wt.stream})}static stopMedia(){wt.stream&&(wt.stream.getTracks().forEach(t=>t.stop()),wt.stream=null)}static supportsAgentMode(){return L(this,null,function*(){try{const i=(yield navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput");let n=!1;return i.forEach(r=>r.label.toLowerCase().includes("back")||r.label.toLowerCase().includes("rear")?(n=!0,!0):!1),n}catch(t){return console.warn("Error accessing media devices: ",t),!1}})}static isSamsungMultiCameraDevice(){const t=navigator.userAgent.match(/SM-[N|G]\d{3}/);if(!t)return!1;const i=parseInt(t[0].match(/\d{3}/)[0],10);return!Number.isNaN(i)&&i>=970}static handleCameraError(t){switch(t.name){case"NotAllowedError":case"SecurityError":return`
427
427
  Looks like camera access was not granted, or was blocked by a browser
428
428
  level setting / extension. Please follow the prompt from the URL bar,
429
429
  or extensions, and enable access.
@@ -716,7 +716,7 @@ button[data-type="icon"] {
716
716
  </div>
717
717
  </div>
718
718
  </div>
719
- `}const ui=.6;class ih extends HTMLElement{constructor(){super(),this.templateString=th.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.IdSides={back:"Back",front:"Front"}}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}getUserMedia(){return M(this,null,function*(){if(!F.stream&&this.hasAttribute("data-camera-error")){try{yield F.getMedia({audio:!1,video:qi(Fe({},F.environmentOptions),{aspectRatio:{ideal:1.7777777777777777}})})}catch(t){console.error(t.constraint),console.error(t.message)}this.handleIDStream(F.stream)}})}_captureIDImage(){const t=this._drawIDImage();this._stopIDVideoStream(),this.dispatchEvent(new CustomEvent("document-capture.publish",{detail:Fe({},t)}))}_drawIDImage(t=this._IDVideo){const i=document.createElement("canvas");if(this.isPortraitCaptureView){i.width=t.videoWidth,i.height=i.width*16/9;const c=document.createElement("canvas");c.width=i.width,c.height=i.height,this.updatePortraitId(i,t,1,1),this.updatePortraitId(c,t);const l=i.toDataURL("image/jpeg"),d=c.toDataURL("image/jpeg");return Fe({image:l,originalHeight:i.height,originalWidth:i.width,previewImage:d},this.idCardRegion)}i.width=2240,i.height=1260;const n=i.width/(t.videoWidth/t.videoHeight);i.height=n;const r=document.createElement("canvas");if(r.height=i.height,r.width=i.width,t.videoWidth<t.videoHeight){const c=document.createElement("canvas");r.height=i.width/1.75,i.width=2240,i.height=i.width/1.77,this._capturePortraitToLandscapeImage(c,t),this._drawLandscapeImageFromCanvas(i,c,1,1),this._drawLandscapeImageFromCanvas(r,c)}else this._drawLandscapeImage(i,t,1,1),this._drawLandscapeImage(r,t);const o=i.toDataURL("image/jpeg"),a=r.toDataURL("image/jpeg");return Fe({image:o,originalHeight:i.height,originalWidth:i.width,previewImage:a},this.idCardRegion)}_drawImage(t,i=!0,n=F.stream){this.resetErrorMessage();const r=t.getContext("2d");if(r.drawImage(n,0,0,n.videoWidth,n.videoHeight,0,0,t.width,t.height),i){const s=r.getImageData(0,0,t.width,t.height);if(eh(s.data))return r;throw new Error("Unable to capture webcam images - Please try another device")}else return r}handleIDStream(t){try{const i=this.shadowRoot.querySelector("canvas");i&&i.remove();let n=null,r=null;n=document.createElement("video"),r=document.createElement("canvas");const s=this.shadowRoot.querySelector(".id-video-container");n.muted=!0,n.setAttribute("muted","true"),n.autoplay=!0,n.playsInline=!0,"srcObject"in n?n.srcObject=t:n.src=window.URL.createObjectURL(t),r.width=s.clientWidth,r.height=s.clientWidth*9/16,this.isPortraitCaptureView&&(r.height=s.clientWidth*16/9),n.onloadedmetadata=()=>{n.play(),this.shadowRoot.querySelector("#loader").hidden=!0,this.shadowRoot.querySelector(".id-video").hidden=!1,this.shadowRoot.querySelector(".actions").hidden=!1,i||s.prepend(r)};const o=()=>{if(n.paused||n.ended)return;n.removeEventListener("playing",o);const c=n.videoWidth/n.videoHeight<1;if(this.isPortraitCaptureView){this.updatePortraitId(r,n),requestAnimationFrame(o);return}if(c){s.classList.add("mobile-camera-screen");const l=document.createElement("canvas");this._capturePortraitToLandscapeImage(l,n),this._drawLandscapeImageFromCanvas(r,l)}else this._drawLandscapeImage(r,n);requestAnimationFrame(o)};n.addEventListener("playing",o),this._IDStream=t,this._IDVideo=n}catch(i){this.setAttribute("data-camera-error",F.handleCameraError(i)),i.name!=="AbortError"&&console.error(i),F.stopMedia()}}_drawLandscapeImage(t,i=this._IDVideo,n=ui,r=ui){const s=this.height?this.height/i.videoHeight:n,o=this.width?this.width/i.videoWidth:r,a=(1-n)/2,c=(1-r)/2,l=i.videoWidth*o,d=i.videoHeight*s,h=i.videoWidth*c,u=i.videoHeight*a;t.getContext("2d").drawImage(i,h,u,l,d,0,0,t.width,t.height)}_capturePortraitToLandscapeImage(t,i=this._IDVideo){const{videoHeight:n,videoWidth:r}=i,s=r,o=r*9/16,a=0,c=(n-o)/2;t.width=s,t.height=o,t.getContext("2d").drawImage(i,a,c,s,o,0,0,t.width,t.height)}_drawLandscapeImageFromCanvas(t,i,n=ui,r=ui){const s=this.height?this.height/i.height:n,o=this.width?this.width/i.width:r,a=(1-n)/2,c=(1-r)/2,l=i.width*o,d=i.height*s,h=i.width*c,u=i.height*a;t.getContext("2d").drawImage(i,h,u,l,d,0,0,t.width,t.height)}_drawPortraitToLandscapeImage(t,i=this._IDVideo){const{videoHeight:n,videoWidth:r}=i,s=600,o=400;t.width=s,t.height=o;const a=(r-s)/2,c=(n-o)/2;t.getContext("2d").drawImage(i,a,c,s,o,0,0,t.width,t.height)}updatePortraitId(t,i=this._IDVideo,n=ui,r=ui){const{videoWidth:s,videoHeight:o}=i;if(s&&o){const a=document.createElement("canvas"),c=9/16;let l,d,h,u;s/o>c?(d=o,l=d*c,h=(s-l)/2,u=0):(l=s,d=l,h=0,u=0),a.height=d,a.width=l,a.getContext("2d").drawImage(i,h,u,l,d,0,0,a.width,a.height);const p=this.height?this.height/l:n,f=this.width?this.width/d:r,m=(1-n)/2,v=(1-r)/2,g=l*f,b=d*p,_=l*v,E=d*m;t.getContext("2d").drawImage(a,_,E,g,b,0,0,t.width,t.height)}}_stopIDVideoStream(t=this._IDStream){t.getTracks().forEach(i=>i.stop())}setUpEventListeners(){this.captureIDImage=this.shadowRoot.querySelector("#capture-id-image"),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),F.stream&&this.handleIDStream(F.stream),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.captureIDImage.addEventListener("click",()=>{this._captureIDImage()}),this.getUserMedia()}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get documentCaptureModes(){return this.getAttribute("document-capture-modes")||"camera"}get supportBothCaptureModes(){const t=this.documentCaptureModes;return t.includes("camera")&&t.includes("upload")}get title(){return this.getAttribute("title")||`${this.IdSides[this.sideOfId]} of ${this.documentName}`}get height(){return this.getAttribute("height")}get width(){return this.getAttribute("width")}get hidden(){return this.getAttribute("hidden")}get sideOfId(){return(this.getAttribute("side-of-id")||"front").toLowerCase()}get isFrontOfId(){return this.sideOfId==="front"}get isBackOfId(){return!this.isFrontOfId}get documentType(){return this.getAttribute("document-type")||""}get documentName(){return this.getAttribute("document-name")||"Document"}get isPortraitCaptureView(){return this.getAttribute("document-type")==="GREEN_BOOK"}get cameraError(){return this.getAttribute("data-camera-error")}static get observedAttributes(){return["data-camera-error","data-camera-ready","document-name","document-type","hidden","hide-back-to-host","show-navigation","title"]}attributeChangedCallback(t){switch(t){case"data-camera-error":case"data-camera-ready":case"document-name":case"document-type":case"hidden":case"title":this.connectedCallback();break}}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture.cancelled")),F.stopMedia()}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture.close")),F.stopMedia()}}"customElements"in window&&!customElements.get("document-capture")&&window.customElements.define("document-capture",ih);function nh(){return`
719
+ `}const ui=.6;class ih extends HTMLElement{constructor(){super(),this.templateString=th.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.IdSides={back:"Back",front:"Front"}}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}getUserMedia(){return L(this,null,function*(){if(!F.stream&&this.hasAttribute("data-camera-error")){try{yield F.getMedia({audio:!1,video:qi(Fe({},F.environmentOptions),{aspectRatio:{ideal:1.7777777777777777}})})}catch(t){console.error(t.constraint),console.error(t.message)}this.handleIDStream(F.stream)}})}_captureIDImage(){const t=this._drawIDImage();this._stopIDVideoStream(),this.dispatchEvent(new CustomEvent("document-capture.publish",{detail:Fe({},t)}))}_drawIDImage(t=this._IDVideo){const i=document.createElement("canvas");if(this.isPortraitCaptureView){i.width=t.videoWidth,i.height=i.width*16/9;const c=document.createElement("canvas");c.width=i.width,c.height=i.height,this.updatePortraitId(i,t,1,1),this.updatePortraitId(c,t);const l=i.toDataURL("image/jpeg"),d=c.toDataURL("image/jpeg");return Fe({image:l,originalHeight:i.height,originalWidth:i.width,previewImage:d},this.idCardRegion)}i.width=2240,i.height=1260;const n=i.width/(t.videoWidth/t.videoHeight);i.height=n;const r=document.createElement("canvas");if(r.height=i.height,r.width=i.width,t.videoWidth<t.videoHeight){const c=document.createElement("canvas");r.height=i.width/1.75,i.width=2240,i.height=i.width/1.77,this._capturePortraitToLandscapeImage(c,t),this._drawLandscapeImageFromCanvas(i,c,1,1),this._drawLandscapeImageFromCanvas(r,c)}else this._drawLandscapeImage(i,t,1,1),this._drawLandscapeImage(r,t);const o=i.toDataURL("image/jpeg"),a=r.toDataURL("image/jpeg");return Fe({image:o,originalHeight:i.height,originalWidth:i.width,previewImage:a},this.idCardRegion)}_drawImage(t,i=!0,n=F.stream){this.resetErrorMessage();const r=t.getContext("2d");if(r.drawImage(n,0,0,n.videoWidth,n.videoHeight,0,0,t.width,t.height),i){const s=r.getImageData(0,0,t.width,t.height);if(eh(s.data))return r;throw new Error("Unable to capture webcam images - Please try another device")}else return r}handleIDStream(t){try{const i=this.shadowRoot.querySelector("canvas");i&&i.remove();let n=null,r=null;n=document.createElement("video"),r=document.createElement("canvas");const s=this.shadowRoot.querySelector(".id-video-container");n.muted=!0,n.setAttribute("muted","true"),n.autoplay=!0,n.playsInline=!0,"srcObject"in n?n.srcObject=t:n.src=window.URL.createObjectURL(t),r.width=s.clientWidth,r.height=s.clientWidth*9/16,this.isPortraitCaptureView&&(r.height=s.clientWidth*16/9),n.onloadedmetadata=()=>{n.play(),this.shadowRoot.querySelector("#loader").hidden=!0,this.shadowRoot.querySelector(".id-video").hidden=!1,this.shadowRoot.querySelector(".actions").hidden=!1,i||s.prepend(r)};const o=()=>{if(n.paused||n.ended)return;n.removeEventListener("playing",o);const c=n.videoWidth/n.videoHeight<1;if(this.isPortraitCaptureView){this.updatePortraitId(r,n),requestAnimationFrame(o);return}if(c){s.classList.add("mobile-camera-screen");const l=document.createElement("canvas");this._capturePortraitToLandscapeImage(l,n),this._drawLandscapeImageFromCanvas(r,l)}else this._drawLandscapeImage(r,n);requestAnimationFrame(o)};n.addEventListener("playing",o),this._IDStream=t,this._IDVideo=n}catch(i){this.setAttribute("data-camera-error",F.handleCameraError(i)),i.name!=="AbortError"&&console.error(i),F.stopMedia()}}_drawLandscapeImage(t,i=this._IDVideo,n=ui,r=ui){const s=this.height?this.height/i.videoHeight:n,o=this.width?this.width/i.videoWidth:r,a=(1-n)/2,c=(1-r)/2,l=i.videoWidth*o,d=i.videoHeight*s,h=i.videoWidth*c,u=i.videoHeight*a;t.getContext("2d").drawImage(i,h,u,l,d,0,0,t.width,t.height)}_capturePortraitToLandscapeImage(t,i=this._IDVideo){const{videoHeight:n,videoWidth:r}=i,s=r,o=r*9/16,a=0,c=(n-o)/2;t.width=s,t.height=o,t.getContext("2d").drawImage(i,a,c,s,o,0,0,t.width,t.height)}_drawLandscapeImageFromCanvas(t,i,n=ui,r=ui){const s=this.height?this.height/i.height:n,o=this.width?this.width/i.width:r,a=(1-n)/2,c=(1-r)/2,l=i.width*o,d=i.height*s,h=i.width*c,u=i.height*a;t.getContext("2d").drawImage(i,h,u,l,d,0,0,t.width,t.height)}_drawPortraitToLandscapeImage(t,i=this._IDVideo){const{videoHeight:n,videoWidth:r}=i,s=600,o=400;t.width=s,t.height=o;const a=(r-s)/2,c=(n-o)/2;t.getContext("2d").drawImage(i,a,c,s,o,0,0,t.width,t.height)}updatePortraitId(t,i=this._IDVideo,n=ui,r=ui){const{videoWidth:s,videoHeight:o}=i;if(s&&o){const a=document.createElement("canvas"),c=9/16;let l,d,h,u;s/o>c?(d=o,l=d*c,h=(s-l)/2,u=0):(l=s,d=l,h=0,u=0),a.height=d,a.width=l,a.getContext("2d").drawImage(i,h,u,l,d,0,0,a.width,a.height);const p=this.height?this.height/l:n,f=this.width?this.width/d:r,m=(1-n)/2,v=(1-r)/2,g=l*f,b=d*p,_=l*v,E=d*m;t.getContext("2d").drawImage(a,_,E,g,b,0,0,t.width,t.height)}}_stopIDVideoStream(t=this._IDStream){t.getTracks().forEach(i=>i.stop())}setUpEventListeners(){this.captureIDImage=this.shadowRoot.querySelector("#capture-id-image"),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),F.stream&&this.handleIDStream(F.stream),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.captureIDImage.addEventListener("click",()=>{this._captureIDImage()}),this.getUserMedia()}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get documentCaptureModes(){return this.getAttribute("document-capture-modes")||"camera"}get supportBothCaptureModes(){const t=this.documentCaptureModes;return t.includes("camera")&&t.includes("upload")}get title(){return this.getAttribute("title")||`${this.IdSides[this.sideOfId]} of ${this.documentName}`}get height(){return this.getAttribute("height")}get width(){return this.getAttribute("width")}get hidden(){return this.getAttribute("hidden")}get sideOfId(){return(this.getAttribute("side-of-id")||"front").toLowerCase()}get isFrontOfId(){return this.sideOfId==="front"}get isBackOfId(){return!this.isFrontOfId}get documentType(){return this.getAttribute("document-type")||""}get documentName(){return this.getAttribute("document-name")||"Document"}get isPortraitCaptureView(){return this.getAttribute("document-type")==="GREEN_BOOK"}get cameraError(){return this.getAttribute("data-camera-error")}static get observedAttributes(){return["data-camera-error","data-camera-ready","document-name","document-type","hidden","hide-back-to-host","show-navigation","title"]}attributeChangedCallback(t){switch(t){case"data-camera-error":case"data-camera-ready":case"document-name":case"document-type":case"hidden":case"title":this.connectedCallback();break}}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture.cancelled")),F.stopMedia()}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture.close")),F.stopMedia()}}"customElements"in window&&!customElements.get("document-capture")&&window.customElements.define("document-capture",ih);function nh(){return`
720
720
  <style>
721
721
  .retake-photo.button[data-variant~="ghost"] {
722
722
  color: #FF5805;
@@ -960,7 +960,7 @@ button[data-type="icon"] {
960
960
  `}
961
961
  </div>
962
962
  </div>
963
- `}class rh extends HTMLElement{constructor(){super(),this.templateString=nh.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"})}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}static get observedAttributes(){return["hide-back-to-host","show-navigation","data-image"]}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get imageSrc(){return this.getAttribute("data-image")}get title(){return this.getAttribute("title")||"Submit Front of ID"}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture-review.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture-review.close"))}attributeChangedCallback(t){switch(t){case"data-image":case"hide-back-to-host":case"show-navigation":this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners();break}}setUpEventListeners(){this.selectIDImage=this.shadowRoot.querySelector("#select-id-image"),this.reCaptureIDImage=this.shadowRoot.querySelector("#re-capture-id-image"),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.selectIDImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("document-capture-review.accepted",{detail:{}}))}),this.reCaptureIDImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("document-capture-review.rejected",{detail:{}}))})}}"customElements"in window&&!customElements.get("document-capture-review")&&window.customElements.define("document-capture-review",rh);let sh=(rt=class{static getHumanSize(t){const i=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(t)/Math.log(1024)),i.length-1),r=t/da(1024,n);return n===0?`${t} bytes`:`${r.toFixed(0)} ${i[n]}`}static getData(t){return new Promise((i,n)=>{const r=new FileReader;r.onload=s=>{i(s.target.result)},r.onerror=()=>{n(new Error("An error occurred reading the file. Please check the file, and try again"))},r.readAsDataURL(t)})}static retrieve(t){return M(this,null,function*(){if(t.length>1)throw new Error("Only one file upload is permitted at a time");const i=t[0];if(!rt.supportedTypes.includes(i.type))throw new Error("Unsupported file format. Please ensure that you are providing a JPG or PNG image");if(i.size>rt.memoryLimit)throw new Error(`${i.name} is too large. Please ensure that the file is less than ${rt.getHumanSize(rt.memoryLimit)}.`);return yield rt.getData(i)})}},li(rt,"memoryLimit",1024e4),li(rt,"supportedTypes",["image/jpeg","image/png"]),rt);function oh(){return`<svg xmlns="http://www.w3.org/2000/svg" width="173" height="103" viewBox="0 0 173 103" fill="none">
963
+ `}class rh extends HTMLElement{constructor(){super(),this.templateString=nh.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"})}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}static get observedAttributes(){return["hide-back-to-host","show-navigation","data-image"]}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get imageSrc(){return this.getAttribute("data-image")}get title(){return this.getAttribute("title")||"Submit Front of ID"}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture-review.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture-review.close"))}attributeChangedCallback(t){switch(t){case"data-image":case"hide-back-to-host":case"show-navigation":this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners();break}}setUpEventListeners(){this.selectIDImage=this.shadowRoot.querySelector("#select-id-image"),this.reCaptureIDImage=this.shadowRoot.querySelector("#re-capture-id-image"),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.selectIDImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("document-capture-review.accepted",{detail:{}}))}),this.reCaptureIDImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("document-capture-review.rejected",{detail:{}}))})}}"customElements"in window&&!customElements.get("document-capture-review")&&window.customElements.define("document-capture-review",rh);let sh=(rt=class{static getHumanSize(t){const i=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(t)/Math.log(1024)),i.length-1),r=t/da(1024,n);return n===0?`${t} bytes`:`${r.toFixed(0)} ${i[n]}`}static getData(t){return new Promise((i,n)=>{const r=new FileReader;r.onload=s=>{i(s.target.result)},r.onerror=()=>{n(new Error("An error occurred reading the file. Please check the file, and try again"))},r.readAsDataURL(t)})}static retrieve(t){return L(this,null,function*(){if(t.length>1)throw new Error("Only one file upload is permitted at a time");const i=t[0];if(!rt.supportedTypes.includes(i.type))throw new Error("Unsupported file format. Please ensure that you are providing a JPG or PNG image");if(i.size>rt.memoryLimit)throw new Error(`${i.name} is too large. Please ensure that the file is less than ${rt.getHumanSize(rt.memoryLimit)}.`);return yield rt.getData(i)})}},li(rt,"memoryLimit",1024e4),li(rt,"supportedTypes",["image/jpeg","image/png"]),rt);function oh(){return`<svg xmlns="http://www.w3.org/2000/svg" width="173" height="103" viewBox="0 0 173 103" fill="none">
964
964
  <path d="M15.3799 21.2759C15.3799 16.8576 18.9616 13.2759 23.3799 13.2759H64.2764C68.6947 13.2759 72.2764 16.8576 72.2764 21.2759V73.5517C72.2764 77.97 68.6947 81.5517 64.2764 81.5517H23.3799C18.9616 81.5517 15.3799 77.97 15.3799 73.5517V21.2759Z" fill="#F6C969"/>
965
965
  <g filter="url(#filter0_d_1281_4127)">
966
966
  <path d="M60.2117 80.8741C60.2117 80.8741 49.3661 81.5134 44.1952 81.5134C39.0242 81.5134 28.1787 80.8741 28.1787 80.8741C28.1787 80.8741 34.6256 78.4515 35.3307 76.8701C35.7001 76.0962 35.8344 73.2362 35.9015 70.578C35.9687 67.9199 35.9015 65.5646 35.9015 65.5646L44.1952 65.6992L52.4888 65.5646C52.4888 65.5646 52.3881 72.0921 52.7575 75.3223C52.7813 75.8503 52.8832 76.372 53.0597 76.8701C53.7984 78.4515 60.2117 80.8741 60.2117 80.8741Z" fill="url(#paint0_linear_1281_4127)"/>
@@ -1352,7 +1352,7 @@ ${this.hideAttribution?"":`
1352
1352
  </div>
1353
1353
  </div>
1354
1354
  ${st(this.themeColor)}
1355
- `}class lh extends HTMLElement{constructor(){super(),this.templateString=ch.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"})}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.takeDocumentPhotoButton=this.shadowRoot.querySelector("#take-photo"),this.uploadDocumentPhotoButton=this.shadowRoot.querySelector("#upload-photo"),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.takeDocumentPhotoButton&&this.takeDocumentPhotoButton.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("document-capture-instructions.capture"))}),this.uploadDocumentPhotoButton&&this.uploadDocumentPhotoButton.addEventListener("change",i=>M(this,null,function*(){this.shadowRoot.querySelector("#error").innerHTML="";try{const{files:n}=i.target,r=yield sh.retrieve(n);this.dispatchEvent(new CustomEvent("document-capture-instructions.upload",{detail:{image:r,previewImage:r}}))}catch(n){this.shadowRoot.querySelector("#error").innerHTML=n.message}}))}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get documentCaptureModes(){return this.getAttribute("document-capture-modes")||"camera"}get supportBothCaptureModes(){const t=this.documentCaptureModes;return t.includes("camera")&&t.includes("upload")}get title(){return this.getAttribute("title")||"Submit Front of ID"}get sideOfId(){return(this.getAttribute("side-of-id")||"front").toLowerCase()}get isFrontOfId(){return this.sideOfId==="front"}get isBackOfId(){return!this.isFrontOfId}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture-instructions.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture-instructions.close"))}}"customElements"in window&&!customElements.get("document-capture-instructions")&&window.customElements.define("document-capture-instructions",lh);const Xi={version:"11.0.1"},hh=Xi.version,B=document.querySelector("smart-camera-web");function Bt(e){return M(this,null,function*(){try{const t=yield F.getMedia({audio:!1,video:F.environmentOptions}),n=(yield navigator.mediaDevices.enumerateDevices()).find(r=>r.kind==="videoinput"&&t.getVideoTracks()[0].getSettings().deviceId===r.deviceId);B==null||B.dispatchEvent(new CustomEvent("metadata.camera-name",{detail:{cameraName:n==null?void 0:n.label}})),e.removeAttribute("data-camera-error"),e.setAttribute("data-camera-ready",!0)}catch(t){e.removeAttribute("data-camera-ready"),e.setAttribute("data-camera-error",F.handleCameraError(t))}})}class ba extends HTMLElement{constructor(){super(),this.activeScreen=null,this.smartCameraWeb=this.closest("smart-camera-web"),B==null||B.dispatchEvent(new CustomEvent("metadata.initialize"))}connectedCallback(){this.innerHTML=`
1355
+ `}class lh extends HTMLElement{constructor(){super(),this.templateString=ch.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"})}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.takeDocumentPhotoButton=this.shadowRoot.querySelector("#take-photo"),this.uploadDocumentPhotoButton=this.shadowRoot.querySelector("#upload-photo"),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.takeDocumentPhotoButton&&this.takeDocumentPhotoButton.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("document-capture-instructions.capture"))}),this.uploadDocumentPhotoButton&&this.uploadDocumentPhotoButton.addEventListener("change",i=>L(this,null,function*(){this.shadowRoot.querySelector("#error").innerHTML="";try{const{files:n}=i.target,r=yield sh.retrieve(n);this.dispatchEvent(new CustomEvent("document-capture-instructions.upload",{detail:{image:r,previewImage:r}}))}catch(n){this.shadowRoot.querySelector("#error").innerHTML=n.message}}))}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get documentCaptureModes(){return this.getAttribute("document-capture-modes")||"camera"}get supportBothCaptureModes(){const t=this.documentCaptureModes;return t.includes("camera")&&t.includes("upload")}get title(){return this.getAttribute("title")||"Submit Front of ID"}get sideOfId(){return(this.getAttribute("side-of-id")||"front").toLowerCase()}get isFrontOfId(){return this.sideOfId==="front"}get isBackOfId(){return!this.isFrontOfId}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture-instructions.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture-instructions.close"))}}"customElements"in window&&!customElements.get("document-capture-instructions")&&window.customElements.define("document-capture-instructions",lh);const Xi={version:"11.0.3"},hh=Xi.version,B=document.querySelector("smart-camera-web");function Bt(e){return L(this,null,function*(){try{const t=yield F.getMedia({audio:!1,video:F.environmentOptions}),n=(yield navigator.mediaDevices.enumerateDevices()).find(r=>r.kind==="videoinput"&&t.getVideoTracks()[0].getSettings().deviceId===r.deviceId);B==null||B.dispatchEvent(new CustomEvent("metadata.camera-name",{detail:{cameraName:n==null?void 0:n.label}})),e.removeAttribute("data-camera-error"),e.setAttribute("data-camera-ready",!0)}catch(t){e.removeAttribute("data-camera-ready"),e.setAttribute("data-camera-error",F.handleCameraError(t))}})}class ba extends HTMLElement{constructor(){super(),this.activeScreen=null,this.smartCameraWeb=this.closest("smart-camera-web"),B==null||B.dispatchEvent(new CustomEvent("metadata.initialize"))}connectedCallback(){this.innerHTML=`
1356
1356
  ${st(this.themeColor)}
1357
1357
  <div style="height: 100%;">
1358
1358
  <document-capture-instructions theme-color='${this.themeColor}' id='document-capture-instructions-front' ${this.title}
@@ -1373,14 +1373,7 @@ ${this.hideAttribution?"":`
1373
1373
  <document-capture-review id='front-of-document-capture-review' theme-color='${this.themeColor}' ${this.hideAttribution} hidden></document-capture-review>
1374
1374
  <document-capture-review id='back-of-document-capture-review' theme-color='${this.themeColor}' ${this.hideAttribution} hidden></document-capture-review>
1375
1375
  </div>
1376
- `,this._data={images:[],meta:{libraryVersion:hh}},this.documentInstruction=this.querySelector("document-capture-instructions"),this.documentInstructionBack=this.querySelector("#document-capture-instructions-back"),this.idCapture=this.querySelector("#document-capture-front"),this.idReview=this.querySelector("#front-of-document-capture-review"),this.idCaptureBack=this.querySelector("#document-capture-back"),this.backOfIdReview=this.querySelector("#back-of-document-capture-review"),this.thankYouScreen=this.querySelector("thank-you"),this.hideInstructions?(Bt(this.idCapture),this.setActiveScreen(this.idCapture)):this.setActiveScreen(this.documentInstruction),this.setUpEventListeners()}disconnectedCallback(){F.stopMedia(),B==null||B.dispatchEvent(new CustomEvent("metadata.cleanup")),this.activeScreen&&this.activeScreen.removeAttribute("hidden"),this.activeScreen=null,this.innerHTML=""}setUpEventListeners(){this.documentInstruction.addEventListener("document-capture-instructions.cancelled",()=>{this.handleBackEvents()}),this.documentInstruction.addEventListener("document-capture-instructions.capture",()=>M(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-capture-start")),B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-origin",{detail:{imageOrigin:"camera_manual_capture"}})),this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)})),this.documentInstruction.addEventListener("document-capture-instructions.upload",i=>M(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-origin",{detail:{imageOrigin:"gallery"}})),this.idReview.setAttribute("data-image",i.detail.previewImage),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_IMAGE_BASE64}),this.setActiveScreen(this.idReview)})),this.idCapture.addEventListener("document-capture.publish",i=>{B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-capture-end")),this.idReview.setAttribute("data-image",i.detail.previewImage),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_IMAGE_BASE64}),F.stopMedia(),this.setActiveScreen(this.idReview)}),this.idCapture.addEventListener("document-capture.cancelled",()=>{this.hideInstructions?this.handleBackEvents():this.setActiveScreen(this.documentInstruction)}),this.idReview.addEventListener("document-capture-review.rejected",()=>M(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-capture-retry")),this.idReview.removeAttribute("data-image"),this._data.images.pop(),this.hideInstructions?(this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)):this.setActiveScreen(this.documentInstruction)})),this.idReview.addEventListener("document-capture-review.accepted",()=>M(this,null,function*(){this.hideBackOfId?this._publishSelectedImages():this.hideInstructions?(this.setActiveScreen(this.idCaptureBack),yield Bt(this.idCaptureBack)):this.setActiveScreen(this.documentInstructionBack)})),this.documentInstructionBack.addEventListener("document-capture-instructions.capture",()=>M(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-capture-start")),B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-origin",{detail:{imageOrigin:"camera_manual_capture"}})),this.setActiveScreen(this.idCaptureBack),yield Bt(this.idCaptureBack)})),this.documentInstructionBack.addEventListener("document-capture-instructions.cancelled",()=>M(this,null,function*(){this.idReview.removeAttribute("data-image"),this._data.images.pop(),this.hideInstructions?(this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)):this.setActiveScreen(this.documentInstruction)})),this.documentInstructionBack.addEventListener("document-capture-instructions.upload",i=>M(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-origin",{detail:{imageOrigin:"gallery"}})),this.backOfIdReview.setAttribute("data-image",i.detail.image),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_BACK_IMAGE_BASE64}),this.setActiveScreen(this.backOfIdReview)})),this.idCaptureBack.addEventListener("document-capture.publish",i=>{B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-capture-end")),this.backOfIdReview.setAttribute("data-image",i.detail.previewImage),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_BACK_IMAGE_BASE64}),this.setActiveScreen(this.backOfIdReview),F.stopMedia()}),this.idCaptureBack.addEventListener("document-capture.cancelled",()=>M(this,null,function*(){this.hideInstructions?(this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)):this.setActiveScreen(this.documentInstructionBack)})),this.backOfIdReview.addEventListener("document-capture-review.rejected",()=>M(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-capture-retry")),this.backOfIdReview.removeAttribute("data-image"),this._data.images.pop(),this.hideInstructions?(this.setActiveScreen(this.idCaptureBack),yield Bt(this.idCaptureBack)):this.setActiveScreen(this.documentInstructionBack)})),this.backOfIdReview.addEventListener("document-capture-review.accepted",()=>{this._publishSelectedImages()}),[this.documentInstruction,this.idCapture,this.documentInstructionBack,this.idCaptureBack,this.idReview,this.backOfIdReview].forEach(i=>{i.addEventListener(`${i.nodeName.toLowerCase()}.close`,()=>this.handleCloseEvents())})}_publishSelectedImages(){this.dispatchEvent(new CustomEvent("document-capture-screens.publish",{detail:this._data}))}get hideInstructions(){return this.hasAttribute("hide-instructions")}get hideBackOfId(){return this.hasAttribute("hide-back-of-id")}get showNavigation(){return this.hasAttribute("show-navigation")?"show-navigation":""}get title(){return this.hasAttribute("title")?`title=${this.getAttribute("title")}`:""}get documentCaptureModes(){return this.hasAttribute("document-capture-modes")?`document-capture-modes='${this.getAttribute("document-capture-modes")}'`:""}get documentType(){return this.hasAttribute("document-type")?`document-type='${this.getAttribute("document-type")}'`:""}get hideAttribution(){return this.hasAttribute("hide-attribution")?"hide-attribution":""}get themeColor(){return this.getAttribute("theme-color")||"#001096"}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture-screens.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture-screens.close"))}setActiveScreen(t){var i;(i=this.activeScreen)==null||i.setAttribute("hidden",""),t.removeAttribute("hidden"),this.activeScreen=t}static get observedAttributes(){return["document-capture-modes","document-type","hide-back-to-host","show-navigation","hide-back-of-id"]}attributeChangedCallback(t){switch(t){case"document-capture-modes":case"document-type":case"hide-back-of-id":case"hide-back-to-host":case"show-navigation":this.connectedCallback();break}}}"customElements"in window&&!customElements.get("document-capture-screens")&&customElements.define("document-capture-screens",ba);var Mn=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function wa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yi={exports:{}};/*!
1377
- * validate.js 0.13.1
1378
- *
1379
- * (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
1380
- * Validate.js may be freely distributed under the MIT license.
1381
- * For all details and documentation:
1382
- * http://validatejs.org/
1383
- */var dh=Yi.exports,ya;function uh(){return ya||(ya=1,function(e,t){(function(i,n,r){var s=function(a,c,l){l=o.extend({},o.options,l);var d=o.runValidations(a,c,l);if(d.some(function(h){return o.isPromise(h.error)}))throw new Error("Use validate.async if you want support for promises");return s.processValidationResults(d,l)},o=s;o.extend=function(a){return[].slice.call(arguments,1).forEach(function(c){for(var l in c)a[l]=c[l]}),a},o.extend(s,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var a=o.format("%{major}.%{minor}.%{patch}",o.version);return o.isEmpty(o.version.metadata)||(a+="+"+o.version.metadata),a}},Promise:typeof Promise!="undefined"?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(a,c,l){var d=[],h,u,p,f,m,v,g;(o.isDomElement(a)||o.isJqueryElement(a))&&(a=o.collectFormValues(a));for(h in c){p=o.getDeepObjectValue(a,h),f=o.result(c[h],p,a,h,l,c);for(u in f){if(m=o.validators[u],!m)throw g=o.format("Unknown validator %{name}",{name:u}),new Error(g);v=f[u],v=o.result(v,p,a,h,l,c),v&&d.push({attribute:h,value:p,validator:u,globalOptions:l,attributes:a,options:v,error:m.call(m,p,v,h,a,l)})}}return d},processValidationResults:function(a,c){a=o.pruneEmptyErrors(a,c),a=o.expandMultipleErrors(a,c),a=o.convertErrorMessages(a,c);var l=c.format||"grouped";if(typeof o.formatters[l]=="function")a=o.formatters[l](a);else throw new Error(o.format("Unknown format %{format}",c));return o.isEmpty(a)?void 0:a},async:function(a,c,l){l=o.extend({},o.async.options,l);var d=l.wrapErrors||function(u){return u};l.cleanAttributes!==!1&&(a=o.cleanAttributes(a,c));var h=o.runValidations(a,c,l);return new o.Promise(function(u,p){o.waitForResults(h).then(function(){var f=o.processValidationResults(h,l);f?p(new d(f,l,a,c)):u(a)},function(f){p(f)})})},single:function(a,c,l){return l=o.extend({},o.single.options,l,{format:"flat",fullMessages:!1}),o({single:a},{single:c},l)},waitForResults:function(a){return a.reduce(function(c,l){return o.isPromise(l.error)?c.then(function(){return l.error.then(function(d){l.error=d||null})}):c},new o.Promise(function(c){c()}))},result:function(a){var c=[].slice.call(arguments,1);return typeof a=="function"&&(a=a.apply(null,c)),a},isNumber:function(a){return typeof a=="number"&&!isNaN(a)},isFunction:function(a){return typeof a=="function"},isInteger:function(a){return o.isNumber(a)&&a%1===0},isBoolean:function(a){return typeof a=="boolean"},isObject:function(a){return a===Object(a)},isDate:function(a){return a instanceof Date},isDefined:function(a){return a!=null},isPromise:function(a){return!!a&&o.isFunction(a.then)},isJqueryElement:function(a){return a&&o.isString(a.jquery)},isDomElement:function(a){return!a||!a.querySelectorAll||!a.querySelector?!1:o.isObject(document)&&a===document?!0:typeof HTMLElement=="object"?a instanceof HTMLElement:a&&typeof a=="object"&&a!==null&&a.nodeType===1&&typeof a.nodeName=="string"},isEmpty:function(a){var c;if(!o.isDefined(a))return!0;if(o.isFunction(a))return!1;if(o.isString(a))return o.EMPTY_STRING_REGEXP.test(a);if(o.isArray(a))return a.length===0;if(o.isDate(a))return!1;if(o.isObject(a)){for(c in a)return!1;return!0}return!1},format:o.extend(function(a,c){return o.isString(a)?a.replace(o.format.FORMAT_REGEXP,function(l,d,h){return d==="%"?"%{"+h+"}":String(c[h])}):a},{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(a){return o.isNumber(a)?a*100%1===0?""+a:parseFloat(Math.round(a*100)/100).toFixed(2):o.isArray(a)?a.map(function(c){return o.prettify(c)}).join(", "):o.isObject(a)?o.isDefined(a.toString)?a.toString():JSON.stringify(a):(a=""+a,a.replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,function(c,l,d){return""+l+" "+d.toLowerCase()}).toLowerCase())},stringifyValue:function(a,c){var l=c&&c.prettify||o.prettify;return l(a)},isString:function(a){return typeof a=="string"},isArray:function(a){return{}.toString.call(a)==="[object Array]"},isHash:function(a){return o.isObject(a)&&!o.isArray(a)&&!o.isFunction(a)},contains:function(a,c){return o.isDefined(a)?o.isArray(a)?a.indexOf(c)!==-1:c in a:!1},unique:function(a){return o.isArray(a)?a.filter(function(c,l,d){return d.indexOf(c)==l}):a},forEachKeyInKeypath:function(a,c,l){if(o.isString(c)){var d="",h,u=!1;for(h=0;h<c.length;++h)switch(c[h]){case".":u?(u=!1,d+="."):(a=l(a,d,!1),d="");break;case"\\":u?(u=!1,d+="\\"):u=!0;break;default:u=!1,d+=c[h];break}return l(a,d,!0)}},getDeepObjectValue:function(a,c){if(o.isObject(a))return o.forEachKeyInKeypath(a,c,function(l,d){if(o.isObject(l))return l[d]})},collectFormValues:function(a,c){var l={},d,h,u,p,f,m;if(o.isJqueryElement(a)&&(a=a[0]),!a)return l;for(c=c||{},p=a.querySelectorAll("input[name], textarea[name]"),d=0;d<p.length;++d)if(u=p.item(d),!o.isDefined(u.getAttribute("data-ignored"))){var v=u.name.replace(/\./g,"\\\\.");m=o.sanitizeFormValue(u.value,c),u.type==="number"?m=m?+m:null:u.type==="checkbox"?u.attributes.value?u.checked||(m=l[v]||null):m=u.checked:u.type==="radio"&&(u.checked||(m=l[v]||null)),l[v]=m}for(p=a.querySelectorAll("select[name]"),d=0;d<p.length;++d)if(u=p.item(d),!o.isDefined(u.getAttribute("data-ignored"))){if(u.multiple){m=[];for(h in u.options)f=u.options[h],f&&f.selected&&m.push(o.sanitizeFormValue(f.value,c))}else{var g=typeof u.options[u.selectedIndex]!="undefined"?u.options[u.selectedIndex].value:"";m=o.sanitizeFormValue(g,c)}l[u.name]=m}return l},sanitizeFormValue:function(a,c){return c.trim&&o.isString(a)&&(a=a.trim()),c.nullify!==!1&&a===""?null:a},capitalize:function(a){return o.isString(a)?a[0].toUpperCase()+a.slice(1):a},pruneEmptyErrors:function(a){return a.filter(function(c){return!o.isEmpty(c.error)})},expandMultipleErrors:function(a){var c=[];return a.forEach(function(l){o.isArray(l.error)?l.error.forEach(function(d){c.push(o.extend({},l,{error:d}))}):c.push(l)}),c},convertErrorMessages:function(a,c){c=c||{};var l=[],d=c.prettify||o.prettify;return a.forEach(function(h){var u=o.result(h.error,h.value,h.attribute,h.options,h.attributes,h.globalOptions);if(!o.isString(u)){l.push(h);return}u[0]==="^"?u=u.slice(1):c.fullMessages!==!1&&(u=o.capitalize(d(h.attribute))+" "+u),u=u.replace(/\\\^/g,"^"),u=o.format(u,{value:o.stringifyValue(h.value,c)}),l.push(o.extend({},h,{error:u}))}),l},groupErrorsByAttribute:function(a){var c={};return a.forEach(function(l){var d=c[l.attribute];d?d.push(l):c[l.attribute]=[l]}),c},flattenErrorsToArray:function(a){return a.map(function(c){return c.error}).filter(function(c,l,d){return d.indexOf(c)===l})},cleanAttributes:function(a,c){function l(u,p,f){return o.isObject(u[p])?u[p]:u[p]=f?!0:{}}function d(u){var p={},f;for(f in u)u[f]&&o.forEachKeyInKeypath(p,f,l);return p}function h(u,p){if(!o.isObject(u))return u;var f=o.extend({},u),m,v;for(v in u)m=p[v],o.isObject(m)?f[v]=h(f[v],m):m||delete f[v];return f}return!o.isObject(c)||!o.isObject(a)?{}:(c=d(c),h(a,c))},exposeModule:function(a,c,l,d,h){l?(d&&d.exports&&(l=d.exports=a),l.validate=a):(c.validate=a,a.isFunction(h)&&h.amd&&h([],function(){return a}))},warn:function(a){typeof console!="undefined"&&console.warn&&console.warn("[validate.js] "+a)},error:function(a){typeof console!="undefined"&&console.error&&console.error("[validate.js] "+a)}}),s.validators={presence:function(a,c){if(c=o.extend({},this.options,c),c.allowEmpty!==!1?!o.isDefined(a):o.isEmpty(a))return c.message||this.message||"can't be blank"},length:function(a,c,l){if(o.isDefined(a)){c=o.extend({},this.options,c);var d=c.is,h=c.maximum,u=c.minimum,p=c.tokenizer||function(g){return g},f,m=[];a=p(a);var v=a.length;if(!o.isNumber(v))return c.message||this.notValid||"has an incorrect length";if(o.isNumber(d)&&v!==d&&(f=c.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",m.push(o.format(f,{count:d}))),o.isNumber(u)&&v<u&&(f=c.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",m.push(o.format(f,{count:u}))),o.isNumber(h)&&v>h&&(f=c.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",m.push(o.format(f,{count:h}))),m.length>0)return c.message||m}},numericality:function(a,c,l,d,h){if(o.isDefined(a)){c=o.extend({},this.options,c);var u=[],p,f,m={greaterThan:function(E,L){return E>L},greaterThanOrEqualTo:function(E,L){return E>=L},equalTo:function(E,L){return E===L},lessThan:function(E,L){return E<L},lessThanOrEqualTo:function(E,L){return E<=L},divisibleBy:function(E,L){return E%L===0}},v=c.prettify||h&&h.prettify||o.prettify;if(o.isString(a)&&c.strict){var g="^-?(0|[1-9]\\d*)";if(c.onlyInteger||(g+="(\\.\\d+)?"),g+="$",!new RegExp(g).test(a))return c.message||c.notValid||this.notValid||this.message||"must be a valid number"}if(c.noStrings!==!0&&o.isString(a)&&!o.isEmpty(a)&&(a=+a),!o.isNumber(a))return c.message||c.notValid||this.notValid||this.message||"is not a number";if(c.onlyInteger&&!o.isInteger(a))return c.message||c.notInteger||this.notInteger||this.message||"must be an integer";for(p in m)if(f=c[p],o.isNumber(f)&&!m[p](a,f)){var b="not"+o.capitalize(p),_=c[b]||this[b]||this.message||"must be %{type} %{count}";u.push(o.format(_,{count:f,type:v(p)}))}if(c.odd&&a%2!==1&&u.push(c.notOdd||this.notOdd||this.message||"must be odd"),c.even&&a%2!==0&&u.push(c.notEven||this.notEven||this.message||"must be even"),u.length)return c.message||u}},datetime:o.extend(function(a,c){if(!o.isFunction(this.parse)||!o.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(o.isDefined(a)){c=o.extend({},this.options,c);var l,d=[],h=c.earliest?this.parse(c.earliest,c):NaN,u=c.latest?this.parse(c.latest,c):NaN;if(a=this.parse(a,c),isNaN(a)||c.dateOnly&&a%864e5!==0)return l=c.notValid||c.message||this.notValid||"must be a valid date",o.format(l,{value:arguments[0]});if(!isNaN(h)&&a<h&&(l=c.tooEarly||c.message||this.tooEarly||"must be no earlier than %{date}",l=o.format(l,{value:this.format(a,c),date:this.format(h,c)}),d.push(l)),!isNaN(u)&&a>u&&(l=c.tooLate||c.message||this.tooLate||"must be no later than %{date}",l=o.format(l,{date:this.format(u,c),value:this.format(a,c)}),d.push(l)),d.length)return o.unique(d)}},{parse:null,format:null}),date:function(a,c){return c=o.extend({},c,{dateOnly:!0}),o.validators.datetime.call(o.validators.datetime,a,c)},format:function(a,c){(o.isString(c)||c instanceof RegExp)&&(c={pattern:c}),c=o.extend({},this.options,c);var l=c.message||this.message||"is invalid",d=c.pattern,h;if(o.isDefined(a)&&(!o.isString(a)||(o.isString(d)&&(d=new RegExp(c.pattern,c.flags)),h=d.exec(a),!h||h[0].length!=a.length)))return l},inclusion:function(a,c){if(o.isDefined(a)&&(o.isArray(c)&&(c={within:c}),c=o.extend({},this.options,c),!o.contains(c.within,a))){var l=c.message||this.message||"^%{value} is not included in the list";return o.format(l,{value:a})}},exclusion:function(a,c){if(o.isDefined(a)&&(o.isArray(c)&&(c={within:c}),c=o.extend({},this.options,c),!!o.contains(c.within,a))){var l=c.message||this.message||"^%{value} is restricted";return o.isString(c.within[a])&&(a=c.within[a]),o.format(l,{value:a})}},email:o.extend(function(a,c){c=o.extend({},this.options,c);var l=c.message||this.message||"is not a valid email";if(o.isDefined(a)&&(!o.isString(a)||!this.PATTERN.exec(a)))return l},{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(a,c,l,d,h){if(o.isDefined(a)){o.isString(c)&&(c={attribute:c}),c=o.extend({},this.options,c);var u=c.message||this.message||"is not equal to %{attribute}";if(o.isEmpty(c.attribute)||!o.isString(c.attribute))throw new Error("The attribute must be a non empty string");var p=o.getDeepObjectValue(d,c.attribute),f=c.comparator||function(v,g){return v===g},m=c.prettify||h&&h.prettify||o.prettify;if(!f(a,p,c,l,d))return o.format(u,{attribute:m(c.attribute)})}},url:function(a,c){if(o.isDefined(a)){c=o.extend({},this.options,c);var l=c.message||this.message||"is not a valid url",d=c.schemes||this.schemes||["http","https"],h=c.allowLocal||this.allowLocal||!1,u=c.allowDataUrl||this.allowDataUrl||!1;if(!o.isString(a))return l;var p="^(?:(?:"+d.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",f="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(h?f+="?":p+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",p+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+f+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",u){var m="\\w+\\/[-+.\\w]+(?:;[\\w=]+)*",v="[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*",g="data:(?:"+m+")?(?:;base64)?,"+v;p="(?:"+p+")|(?:^"+g+"$)"}var b=new RegExp(p,"i");if(!b.exec(a))return l}},type:o.extend(function(a,c,l,d,h){if(o.isString(c)&&(c={type:c}),!!o.isDefined(a)){var u=o.extend({},this.options,c),p=u.type;if(!o.isDefined(p))throw new Error("No type was specified");var f;if(o.isFunction(p)?f=p:f=this.types[p],!o.isFunction(f))throw new Error("validate.validators.type.types."+p+" must be a function.");if(!f(a,u,l,d,h)){var m=c.message||this.messages[p]||this.message||u.message||(o.isFunction(p)?"must be of the correct type":"must be of type %{type}");return o.isFunction(m)&&(m=m(a,c,l,d,h)),o.format(m,{attribute:o.prettify(l),type:p})}}},{types:{object:function(a){return o.isObject(a)&&!o.isArray(a)},array:o.isArray,integer:o.isInteger,number:o.isNumber,string:o.isString,date:o.isDate,boolean:o.isBoolean},messages:{}})},s.formatters={detailed:function(a){return a},flat:o.flattenErrorsToArray,grouped:function(a){var c;a=o.groupErrorsByAttribute(a);for(c in a)a[c]=o.flattenErrorsToArray(a[c]);return a},constraint:function(a){var c;a=o.groupErrorsByAttribute(a);for(c in a)a[c]=a[c].map(function(l){return l.validator}).sort();return a}},s.exposeModule(s,this,i,n,r)}).call(dh,t,e,null)}(Yi,Yi.exports)),Yi.exports}var ph=uh();const fh=wa(ph);function Hr(e,t){return fetch(e,{body:JSON.stringify(t),cache:"no-cache",headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",mode:"cors"})}function mh(){return`
1376
+ `,this._data={images:[],meta:{libraryVersion:hh}},this.documentInstruction=this.querySelector("document-capture-instructions"),this.documentInstructionBack=this.querySelector("#document-capture-instructions-back"),this.idCapture=this.querySelector("#document-capture-front"),this.idReview=this.querySelector("#front-of-document-capture-review"),this.idCaptureBack=this.querySelector("#document-capture-back"),this.backOfIdReview=this.querySelector("#back-of-document-capture-review"),this.thankYouScreen=this.querySelector("thank-you"),this.hideInstructions?(Bt(this.idCapture),this.setActiveScreen(this.idCapture)):this.setActiveScreen(this.documentInstruction),this.setUpEventListeners()}disconnectedCallback(){F.stopMedia(),B==null||B.dispatchEvent(new CustomEvent("metadata.cleanup")),this.activeScreen&&this.activeScreen.removeAttribute("hidden"),this.activeScreen=null,this.innerHTML=""}setUpEventListeners(){this.documentInstruction.addEventListener("document-capture-instructions.cancelled",()=>{this.handleBackEvents()}),this.documentInstruction.addEventListener("document-capture-instructions.capture",()=>L(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-capture-start")),B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-origin",{detail:{imageOrigin:"camera_manual_capture"}})),this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)})),this.documentInstruction.addEventListener("document-capture-instructions.upload",i=>L(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-origin",{detail:{imageOrigin:"gallery"}})),this.idReview.setAttribute("data-image",i.detail.previewImage),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_IMAGE_BASE64}),this.setActiveScreen(this.idReview)})),this.idCapture.addEventListener("document-capture.publish",i=>{B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-capture-end")),this.idReview.setAttribute("data-image",i.detail.previewImage),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_IMAGE_BASE64}),F.stopMedia(),this.setActiveScreen(this.idReview)}),this.idCapture.addEventListener("document-capture.cancelled",()=>{this.hideInstructions?this.handleBackEvents():this.setActiveScreen(this.documentInstruction)}),this.idReview.addEventListener("document-capture-review.rejected",()=>L(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-front-capture-retry")),this.idReview.removeAttribute("data-image"),this._data.images.pop(),this.hideInstructions?(this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)):this.setActiveScreen(this.documentInstruction)})),this.idReview.addEventListener("document-capture-review.accepted",()=>L(this,null,function*(){this.hideBackOfId?this._publishSelectedImages():this.hideInstructions?(this.setActiveScreen(this.idCaptureBack),yield Bt(this.idCaptureBack)):this.setActiveScreen(this.documentInstructionBack)})),this.documentInstructionBack.addEventListener("document-capture-instructions.capture",()=>L(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-capture-start")),B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-origin",{detail:{imageOrigin:"camera_manual_capture"}})),this.setActiveScreen(this.idCaptureBack),yield Bt(this.idCaptureBack)})),this.documentInstructionBack.addEventListener("document-capture-instructions.cancelled",()=>L(this,null,function*(){this.idReview.removeAttribute("data-image"),this._data.images.pop(),this.hideInstructions?(this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)):this.setActiveScreen(this.documentInstruction)})),this.documentInstructionBack.addEventListener("document-capture-instructions.upload",i=>L(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-origin",{detail:{imageOrigin:"gallery"}})),this.backOfIdReview.setAttribute("data-image",i.detail.image),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_BACK_IMAGE_BASE64}),this.setActiveScreen(this.backOfIdReview)})),this.idCaptureBack.addEventListener("document-capture.publish",i=>{B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-capture-end")),this.backOfIdReview.setAttribute("data-image",i.detail.previewImage),this._data.images.push({image:i.detail.image.split(",")[1],image_type_id:di.ID_CARD_BACK_IMAGE_BASE64}),this.setActiveScreen(this.backOfIdReview),F.stopMedia()}),this.idCaptureBack.addEventListener("document-capture.cancelled",()=>L(this,null,function*(){this.hideInstructions?(this.setActiveScreen(this.idCapture),yield Bt(this.idCapture)):this.setActiveScreen(this.documentInstructionBack)})),this.backOfIdReview.addEventListener("document-capture-review.rejected",()=>L(this,null,function*(){B==null||B.dispatchEvent(new CustomEvent("metadata.document-back-capture-retry")),this.backOfIdReview.removeAttribute("data-image"),this._data.images.pop(),this.hideInstructions?(this.setActiveScreen(this.idCaptureBack),yield Bt(this.idCaptureBack)):this.setActiveScreen(this.documentInstructionBack)})),this.backOfIdReview.addEventListener("document-capture-review.accepted",()=>{this._publishSelectedImages()}),[this.documentInstruction,this.idCapture,this.documentInstructionBack,this.idCaptureBack,this.idReview,this.backOfIdReview].forEach(i=>{i.addEventListener(`${i.nodeName.toLowerCase()}.close`,()=>this.handleCloseEvents())})}_publishSelectedImages(){this.dispatchEvent(new CustomEvent("document-capture-screens.publish",{detail:this._data}))}get hideInstructions(){return this.hasAttribute("hide-instructions")}get hideBackOfId(){return this.hasAttribute("hide-back-of-id")}get showNavigation(){return this.hasAttribute("show-navigation")?"show-navigation":""}get title(){return this.hasAttribute("title")?`title=${this.getAttribute("title")}`:""}get documentCaptureModes(){return this.hasAttribute("document-capture-modes")?`document-capture-modes='${this.getAttribute("document-capture-modes")}'`:""}get documentType(){return this.hasAttribute("document-type")?`document-type='${this.getAttribute("document-type")}'`:""}get hideAttribution(){return this.hasAttribute("hide-attribution")?"hide-attribution":""}get themeColor(){return this.getAttribute("theme-color")||"#001096"}handleBackEvents(){this.dispatchEvent(new CustomEvent("document-capture-screens.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("document-capture-screens.close"))}setActiveScreen(t){var i;(i=this.activeScreen)==null||i.setAttribute("hidden",""),t.removeAttribute("hidden"),this.activeScreen=t}static get observedAttributes(){return["document-capture-modes","document-type","hide-back-to-host","show-navigation","hide-back-of-id"]}attributeChangedCallback(t){switch(t){case"document-capture-modes":case"document-type":case"hide-back-of-id":case"hide-back-to-host":case"show-navigation":this.connectedCallback();break}}}"customElements"in window&&!customElements.get("document-capture-screens")&&customElements.define("document-capture-screens",ba);var Ln=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function wa(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yi={exports:{}};var dh=Yi.exports,ya;function uh(){return ya||(ya=1,function(e,t){(function(i,n,r){var s=function(a,c,l){l=o.extend({},o.options,l);var d=o.runValidations(a,c,l);if(d.some(function(h){return o.isPromise(h.error)}))throw new Error("Use validate.async if you want support for promises");return s.processValidationResults(d,l)},o=s;o.extend=function(a){return[].slice.call(arguments,1).forEach(function(c){for(var l in c)a[l]=c[l]}),a},o.extend(s,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var a=o.format("%{major}.%{minor}.%{patch}",o.version);return o.isEmpty(o.version.metadata)||(a+="+"+o.version.metadata),a}},Promise:typeof Promise!="undefined"?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(a,c,l){var d=[],h,u,p,f,m,v,g;(o.isDomElement(a)||o.isJqueryElement(a))&&(a=o.collectFormValues(a));for(h in c){p=o.getDeepObjectValue(a,h),f=o.result(c[h],p,a,h,l,c);for(u in f){if(m=o.validators[u],!m)throw g=o.format("Unknown validator %{name}",{name:u}),new Error(g);v=f[u],v=o.result(v,p,a,h,l,c),v&&d.push({attribute:h,value:p,validator:u,globalOptions:l,attributes:a,options:v,error:m.call(m,p,v,h,a,l)})}}return d},processValidationResults:function(a,c){a=o.pruneEmptyErrors(a,c),a=o.expandMultipleErrors(a,c),a=o.convertErrorMessages(a,c);var l=c.format||"grouped";if(typeof o.formatters[l]=="function")a=o.formatters[l](a);else throw new Error(o.format("Unknown format %{format}",c));return o.isEmpty(a)?void 0:a},async:function(a,c,l){l=o.extend({},o.async.options,l);var d=l.wrapErrors||function(u){return u};l.cleanAttributes!==!1&&(a=o.cleanAttributes(a,c));var h=o.runValidations(a,c,l);return new o.Promise(function(u,p){o.waitForResults(h).then(function(){var f=o.processValidationResults(h,l);f?p(new d(f,l,a,c)):u(a)},function(f){p(f)})})},single:function(a,c,l){return l=o.extend({},o.single.options,l,{format:"flat",fullMessages:!1}),o({single:a},{single:c},l)},waitForResults:function(a){return a.reduce(function(c,l){return o.isPromise(l.error)?c.then(function(){return l.error.then(function(d){l.error=d||null})}):c},new o.Promise(function(c){c()}))},result:function(a){var c=[].slice.call(arguments,1);return typeof a=="function"&&(a=a.apply(null,c)),a},isNumber:function(a){return typeof a=="number"&&!isNaN(a)},isFunction:function(a){return typeof a=="function"},isInteger:function(a){return o.isNumber(a)&&a%1===0},isBoolean:function(a){return typeof a=="boolean"},isObject:function(a){return a===Object(a)},isDate:function(a){return a instanceof Date},isDefined:function(a){return a!=null},isPromise:function(a){return!!a&&o.isFunction(a.then)},isJqueryElement:function(a){return a&&o.isString(a.jquery)},isDomElement:function(a){return!a||!a.querySelectorAll||!a.querySelector?!1:o.isObject(document)&&a===document?!0:typeof HTMLElement=="object"?a instanceof HTMLElement:a&&typeof a=="object"&&a!==null&&a.nodeType===1&&typeof a.nodeName=="string"},isEmpty:function(a){var c;if(!o.isDefined(a))return!0;if(o.isFunction(a))return!1;if(o.isString(a))return o.EMPTY_STRING_REGEXP.test(a);if(o.isArray(a))return a.length===0;if(o.isDate(a))return!1;if(o.isObject(a)){for(c in a)return!1;return!0}return!1},format:o.extend(function(a,c){return o.isString(a)?a.replace(o.format.FORMAT_REGEXP,function(l,d,h){return d==="%"?"%{"+h+"}":String(c[h])}):a},{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(a){return o.isNumber(a)?a*100%1===0?""+a:parseFloat(Math.round(a*100)/100).toFixed(2):o.isArray(a)?a.map(function(c){return o.prettify(c)}).join(", "):o.isObject(a)?o.isDefined(a.toString)?a.toString():JSON.stringify(a):(a=""+a,a.replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,function(c,l,d){return""+l+" "+d.toLowerCase()}).toLowerCase())},stringifyValue:function(a,c){var l=c&&c.prettify||o.prettify;return l(a)},isString:function(a){return typeof a=="string"},isArray:function(a){return{}.toString.call(a)==="[object Array]"},isHash:function(a){return o.isObject(a)&&!o.isArray(a)&&!o.isFunction(a)},contains:function(a,c){return o.isDefined(a)?o.isArray(a)?a.indexOf(c)!==-1:c in a:!1},unique:function(a){return o.isArray(a)?a.filter(function(c,l,d){return d.indexOf(c)==l}):a},forEachKeyInKeypath:function(a,c,l){if(o.isString(c)){var d="",h,u=!1;for(h=0;h<c.length;++h)switch(c[h]){case".":u?(u=!1,d+="."):(a=l(a,d,!1),d="");break;case"\\":u?(u=!1,d+="\\"):u=!0;break;default:u=!1,d+=c[h];break}return l(a,d,!0)}},getDeepObjectValue:function(a,c){if(o.isObject(a))return o.forEachKeyInKeypath(a,c,function(l,d){if(o.isObject(l))return l[d]})},collectFormValues:function(a,c){var l={},d,h,u,p,f,m;if(o.isJqueryElement(a)&&(a=a[0]),!a)return l;for(c=c||{},p=a.querySelectorAll("input[name], textarea[name]"),d=0;d<p.length;++d)if(u=p.item(d),!o.isDefined(u.getAttribute("data-ignored"))){var v=u.name.replace(/\./g,"\\\\.");m=o.sanitizeFormValue(u.value,c),u.type==="number"?m=m?+m:null:u.type==="checkbox"?u.attributes.value?u.checked||(m=l[v]||null):m=u.checked:u.type==="radio"&&(u.checked||(m=l[v]||null)),l[v]=m}for(p=a.querySelectorAll("select[name]"),d=0;d<p.length;++d)if(u=p.item(d),!o.isDefined(u.getAttribute("data-ignored"))){if(u.multiple){m=[];for(h in u.options)f=u.options[h],f&&f.selected&&m.push(o.sanitizeFormValue(f.value,c))}else{var g=typeof u.options[u.selectedIndex]!="undefined"?u.options[u.selectedIndex].value:"";m=o.sanitizeFormValue(g,c)}l[u.name]=m}return l},sanitizeFormValue:function(a,c){return c.trim&&o.isString(a)&&(a=a.trim()),c.nullify!==!1&&a===""?null:a},capitalize:function(a){return o.isString(a)?a[0].toUpperCase()+a.slice(1):a},pruneEmptyErrors:function(a){return a.filter(function(c){return!o.isEmpty(c.error)})},expandMultipleErrors:function(a){var c=[];return a.forEach(function(l){o.isArray(l.error)?l.error.forEach(function(d){c.push(o.extend({},l,{error:d}))}):c.push(l)}),c},convertErrorMessages:function(a,c){c=c||{};var l=[],d=c.prettify||o.prettify;return a.forEach(function(h){var u=o.result(h.error,h.value,h.attribute,h.options,h.attributes,h.globalOptions);if(!o.isString(u)){l.push(h);return}u[0]==="^"?u=u.slice(1):c.fullMessages!==!1&&(u=o.capitalize(d(h.attribute))+" "+u),u=u.replace(/\\\^/g,"^"),u=o.format(u,{value:o.stringifyValue(h.value,c)}),l.push(o.extend({},h,{error:u}))}),l},groupErrorsByAttribute:function(a){var c={};return a.forEach(function(l){var d=c[l.attribute];d?d.push(l):c[l.attribute]=[l]}),c},flattenErrorsToArray:function(a){return a.map(function(c){return c.error}).filter(function(c,l,d){return d.indexOf(c)===l})},cleanAttributes:function(a,c){function l(u,p,f){return o.isObject(u[p])?u[p]:u[p]=f?!0:{}}function d(u){var p={},f;for(f in u)u[f]&&o.forEachKeyInKeypath(p,f,l);return p}function h(u,p){if(!o.isObject(u))return u;var f=o.extend({},u),m,v;for(v in u)m=p[v],o.isObject(m)?f[v]=h(f[v],m):m||delete f[v];return f}return!o.isObject(c)||!o.isObject(a)?{}:(c=d(c),h(a,c))},exposeModule:function(a,c,l,d,h){l?(d&&d.exports&&(l=d.exports=a),l.validate=a):(c.validate=a,a.isFunction(h)&&h.amd&&h([],function(){return a}))},warn:function(a){typeof console!="undefined"&&console.warn&&console.warn("[validate.js] "+a)},error:function(a){typeof console!="undefined"&&console.error&&console.error("[validate.js] "+a)}}),s.validators={presence:function(a,c){if(c=o.extend({},this.options,c),c.allowEmpty!==!1?!o.isDefined(a):o.isEmpty(a))return c.message||this.message||"can't be blank"},length:function(a,c,l){if(o.isDefined(a)){c=o.extend({},this.options,c);var d=c.is,h=c.maximum,u=c.minimum,p=c.tokenizer||function(g){return g},f,m=[];a=p(a);var v=a.length;if(!o.isNumber(v))return c.message||this.notValid||"has an incorrect length";if(o.isNumber(d)&&v!==d&&(f=c.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",m.push(o.format(f,{count:d}))),o.isNumber(u)&&v<u&&(f=c.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",m.push(o.format(f,{count:u}))),o.isNumber(h)&&v>h&&(f=c.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",m.push(o.format(f,{count:h}))),m.length>0)return c.message||m}},numericality:function(a,c,l,d,h){if(o.isDefined(a)){c=o.extend({},this.options,c);var u=[],p,f,m={greaterThan:function(E,M){return E>M},greaterThanOrEqualTo:function(E,M){return E>=M},equalTo:function(E,M){return E===M},lessThan:function(E,M){return E<M},lessThanOrEqualTo:function(E,M){return E<=M},divisibleBy:function(E,M){return E%M===0}},v=c.prettify||h&&h.prettify||o.prettify;if(o.isString(a)&&c.strict){var g="^-?(0|[1-9]\\d*)";if(c.onlyInteger||(g+="(\\.\\d+)?"),g+="$",!new RegExp(g).test(a))return c.message||c.notValid||this.notValid||this.message||"must be a valid number"}if(c.noStrings!==!0&&o.isString(a)&&!o.isEmpty(a)&&(a=+a),!o.isNumber(a))return c.message||c.notValid||this.notValid||this.message||"is not a number";if(c.onlyInteger&&!o.isInteger(a))return c.message||c.notInteger||this.notInteger||this.message||"must be an integer";for(p in m)if(f=c[p],o.isNumber(f)&&!m[p](a,f)){var b="not"+o.capitalize(p),_=c[b]||this[b]||this.message||"must be %{type} %{count}";u.push(o.format(_,{count:f,type:v(p)}))}if(c.odd&&a%2!==1&&u.push(c.notOdd||this.notOdd||this.message||"must be odd"),c.even&&a%2!==0&&u.push(c.notEven||this.notEven||this.message||"must be even"),u.length)return c.message||u}},datetime:o.extend(function(a,c){if(!o.isFunction(this.parse)||!o.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(o.isDefined(a)){c=o.extend({},this.options,c);var l,d=[],h=c.earliest?this.parse(c.earliest,c):NaN,u=c.latest?this.parse(c.latest,c):NaN;if(a=this.parse(a,c),isNaN(a)||c.dateOnly&&a%864e5!==0)return l=c.notValid||c.message||this.notValid||"must be a valid date",o.format(l,{value:arguments[0]});if(!isNaN(h)&&a<h&&(l=c.tooEarly||c.message||this.tooEarly||"must be no earlier than %{date}",l=o.format(l,{value:this.format(a,c),date:this.format(h,c)}),d.push(l)),!isNaN(u)&&a>u&&(l=c.tooLate||c.message||this.tooLate||"must be no later than %{date}",l=o.format(l,{date:this.format(u,c),value:this.format(a,c)}),d.push(l)),d.length)return o.unique(d)}},{parse:null,format:null}),date:function(a,c){return c=o.extend({},c,{dateOnly:!0}),o.validators.datetime.call(o.validators.datetime,a,c)},format:function(a,c){(o.isString(c)||c instanceof RegExp)&&(c={pattern:c}),c=o.extend({},this.options,c);var l=c.message||this.message||"is invalid",d=c.pattern,h;if(o.isDefined(a)&&(!o.isString(a)||(o.isString(d)&&(d=new RegExp(c.pattern,c.flags)),h=d.exec(a),!h||h[0].length!=a.length)))return l},inclusion:function(a,c){if(o.isDefined(a)&&(o.isArray(c)&&(c={within:c}),c=o.extend({},this.options,c),!o.contains(c.within,a))){var l=c.message||this.message||"^%{value} is not included in the list";return o.format(l,{value:a})}},exclusion:function(a,c){if(o.isDefined(a)&&(o.isArray(c)&&(c={within:c}),c=o.extend({},this.options,c),!!o.contains(c.within,a))){var l=c.message||this.message||"^%{value} is restricted";return o.isString(c.within[a])&&(a=c.within[a]),o.format(l,{value:a})}},email:o.extend(function(a,c){c=o.extend({},this.options,c);var l=c.message||this.message||"is not a valid email";if(o.isDefined(a)&&(!o.isString(a)||!this.PATTERN.exec(a)))return l},{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(a,c,l,d,h){if(o.isDefined(a)){o.isString(c)&&(c={attribute:c}),c=o.extend({},this.options,c);var u=c.message||this.message||"is not equal to %{attribute}";if(o.isEmpty(c.attribute)||!o.isString(c.attribute))throw new Error("The attribute must be a non empty string");var p=o.getDeepObjectValue(d,c.attribute),f=c.comparator||function(v,g){return v===g},m=c.prettify||h&&h.prettify||o.prettify;if(!f(a,p,c,l,d))return o.format(u,{attribute:m(c.attribute)})}},url:function(a,c){if(o.isDefined(a)){c=o.extend({},this.options,c);var l=c.message||this.message||"is not a valid url",d=c.schemes||this.schemes||["http","https"],h=c.allowLocal||this.allowLocal||!1,u=c.allowDataUrl||this.allowDataUrl||!1;if(!o.isString(a))return l;var p="^(?:(?:"+d.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",f="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";if(h?f+="?":p+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",p+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+f+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",u){var m="\\w+\\/[-+.\\w]+(?:;[\\w=]+)*",v="[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*",g="data:(?:"+m+")?(?:;base64)?,"+v;p="(?:"+p+")|(?:^"+g+"$)"}var b=new RegExp(p,"i");if(!b.exec(a))return l}},type:o.extend(function(a,c,l,d,h){if(o.isString(c)&&(c={type:c}),!!o.isDefined(a)){var u=o.extend({},this.options,c),p=u.type;if(!o.isDefined(p))throw new Error("No type was specified");var f;if(o.isFunction(p)?f=p:f=this.types[p],!o.isFunction(f))throw new Error("validate.validators.type.types."+p+" must be a function.");if(!f(a,u,l,d,h)){var m=c.message||this.messages[p]||this.message||u.message||(o.isFunction(p)?"must be of the correct type":"must be of type %{type}");return o.isFunction(m)&&(m=m(a,c,l,d,h)),o.format(m,{attribute:o.prettify(l),type:p})}}},{types:{object:function(a){return o.isObject(a)&&!o.isArray(a)},array:o.isArray,integer:o.isInteger,number:o.isNumber,string:o.isString,date:o.isDate,boolean:o.isBoolean},messages:{}})},s.formatters={detailed:function(a){return a},flat:o.flattenErrorsToArray,grouped:function(a){var c;a=o.groupErrorsByAttribute(a);for(c in a)a[c]=o.flattenErrorsToArray(a[c]);return a},constraint:function(a){var c;a=o.groupErrorsByAttribute(a);for(c in a)a[c]=a[c].map(function(l){return l.validator}).sort();return a}},s.exposeModule(s,this,i,n,r)}).call(dh,t,e,null)}(Yi,Yi.exports)),Yi.exports}var ph=uh();const fh=wa(ph);function Hr(e,t){return fetch(e,{body:JSON.stringify(t),cache:"no-cache",headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",mode:"cors"})}function mh(){return`
1384
1377
  <style>
1385
1378
  *,
1386
1379
  *::before,
@@ -1847,7 +1840,7 @@ ${this.hideAttribution?"":`
1847
1840
  </form>
1848
1841
  </div>
1849
1842
  </div>
1850
- `}class _a extends HTMLElement{constructor(){super(),this.templateString=mh.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.modes=[],this["otp-delivery-mode"]="",this.queryOtpModes=this.queryOtpModes.bind(this),this.selectOtpMode=this.selectOtpMode.bind(this),this.submitOtp=this.submitOtp.bind(this),this.switchContactMethod=this.switchContactMethod.bind(this),this.handleTotpConsentGrant=this.handleTotpConsentGrant.bind(this),this.handleTotpConsentContactMethodsOutdated=this.handleTotpConsentContactMethodsOutdated.bind(this),this.pages=[]}static get observedAttributes(){return["modes","otp-delivery-mode"]}attributeChangedCallback(t){switch(t){case"modes":case"otp-delivery-mode":{const i=document.createElement("template");i.innerHTML=this.render();const n=i.content.cloneNode(!0).querySelector(`#${this.activeScreen.id}`);n.hidden=!1,this.shadowRoot.replaceChild(n,this.activeScreen),this.setUpEventListeners(),this.setActiveScreen(n);break}}}setUpEventListeners(){this.idEntryScreen=this.shadowRoot.querySelector("#id-entry"),this.selectModeScreen=this.shadowRoot.querySelector("#select-mode"),this.otpVerificationScreen=this.shadowRoot.querySelector("#otp-verification"),this.activeScreen||(this.activeScreen=this.idEntryScreen),this.queryOtpModesButton=this.idEntryScreen.querySelector("#query-otp-modes"),this.backButton=this.idEntryScreen.querySelector("#back-button"),this.selectOtpModeButton=this.selectModeScreen.querySelector("#select-otp-mode"),this.entryBackbutton=this.selectModeScreen.querySelector("#back-to-entry-button"),this.contactMethodsOutdatedButton=this.selectModeScreen.querySelector("#contact-methods-outdated"),this.submitOtpButton=this.otpVerificationScreen.querySelector("#submit-otp"),this.switchContactMethodButton=this.otpVerificationScreen.querySelector(".try-another-method");const t=this.shadowRoot.querySelectorAll(".close-iframe");this.idNumberInput=this.idEntryScreen.querySelector("#id_number"),this.modeInputs=this.selectModeScreen.querySelectorAll('[name="mode"]'),this.otpInput=this.otpVerificationScreen.querySelector("#totp-token"),this.queryOtpModesButton.addEventListener("click",i=>this.queryOtpModes(i)),this.selectOtpModeButton.addEventListener("click",i=>this.selectOtpMode(i)),this.submitOtpButton.addEventListener("click",i=>this.submitOtp(i)),this.switchContactMethodButton.addEventListener("click",i=>this.switchContactMethod(i)),this.contactMethodsOutdatedButton.addEventListener("click",i=>this.handleTotpConsentContactMethodsOutdated(i)),this.entryBackbutton.addEventListener("click",()=>{this.handleBackClick()}),this.backButton.addEventListener("click",()=>{this.handleBackClick()}),t.forEach(i=>{i.addEventListener("click",()=>{this.closeWindow()},!1)})}closeWindow(){const t=window.parent;[t.parent,t].forEach(i=>{i.postMessage("SmileIdentity::Close","*")})}handleBackClick(){const t=this.pages.pop();t?this.setActiveScreen(t):this.dispatchEvent(new CustomEvent("end-user-consent.totp.cancelled",{}))}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}switchContactMethod(){this.queryOtpModes()}resetForm(){this.activeScreen.querySelectorAll("[aria-invalid]").forEach(n=>n.removeAttribute("aria-invalid")),this.activeScreen.querySelectorAll(".validation-message").forEach(n=>n.remove())}handleIdNumberValidationErrors(t){Object.keys(t).forEach(n=>{const r=this.activeScreen.querySelector(`#${n}`);r.setAttribute("aria-invalid","true"),r.setAttribute("aria-describedby",`${n}-hint`);const s=document.createElement("div");s.setAttribute("id",`${n}-hint`),s.setAttribute("class","validation-message"),s.textContent=t[n][0],r.insertAdjacentElement("afterend",s)})}handleActiveScreenErrors(t){const i=this.activeScreen.querySelector('[type="submit"]'),n=document.createElement("div");n.setAttribute("class","validation-message"),n.textContent=t,i.insertAdjacentElement("beforebegin",n)}validateIdNumber(t){const i={id_number:{format:new RegExp(this.idRegex),presence:{allowEmpty:!1,message:"is required"}}},n=fh({id_number:t},i);return n&&this.handleIdNumberValidationErrors(n),n}queryOtpModes(t){return M(this,null,function*(){t&&(t.preventDefault(),this.resetForm());const i=this.validateIdNumber(this.idNumberInput.value);if(localStorage.setItem("idNumber",this.idNumberInput.value||this.idNumber),!i){const n={country:this.country,id_number:this.idNumber,id_type:this.idType,partner_id:this.partnerId,token:this.token},r=`${this.baseUrl}/totp_consent`;try{this.toggleLoading();const s=yield Hr(r,n),o=yield s.json();this.toggleLoading(),s.ok?(this.sessionId=o.session_id,this.modes=o.modes,this.setActiveScreen(this.selectModeScreen),this.setAttribute("modes",o.modes)):this.handleActiveScreenErrors(o.error)}catch(s){this.toggleLoading(),this.handleActiveScreenErrors(s.message)}}})}selectOtpMode(t){return M(this,null,function*(){t.preventDefault(),this.resetForm(),this.mode=Array.prototype.find.call(this.modeInputs,r=>r.checked).value;const i={country:this.country,id_number:this.idNumber,id_type:this.idType,mode:this.mode,partner_id:this.partnerId,session_id:this.sessionId,token:this.token},n=`${this.baseUrl}/totp_consent/mode`;try{this.toggleLoading();const r=yield Hr(n,i),s=yield r.json();this.toggleLoading(),r.ok?(this.selectedOtpDeliveryMode=this.modes.filter(o=>o[this.mode])[0][this.mode],this.setActiveScreen(this.otpVerificationScreen),this.setAttribute("otp-delivery-mode",this.selectedOtpDeliveryMode)):this.handleActiveScreenErrors(s.error)}catch(r){this.toggleLoading(),this.handleActiveScreenErrors(r.message)}})}submitOtp(t){return M(this,null,function*(){t.preventDefault(),this.resetForm(),this.otp=this.otpInput.value;const i={country:this.country,id_number:this.idNumber,id_type:this.idType,otp:this.otp,partner_id:this.partnerId,session_id:this.sessionId,token:this.token},n=`${this.baseUrl}/totp_consent/otp`;try{this.toggleLoading();const r=yield Hr(n,i),s=yield r.json();this.toggleLoading(),r.ok?this.handleTotpConsentGrant(t):this.handleActiveScreenErrors(s.error)}catch(r){this.toggleLoading(),this.handleActiveScreenErrors(r.message)}})}toggleLoading(){const t=this.activeScreen.querySelector('button[type="submit"]'),i=t.querySelector(".text"),n=t.querySelector("svg"),r=t.querySelector(".spinner");t.toggleAttribute("disabled"),i.toggleAttribute("hidden"),n.toggleAttribute("hidden"),r.toggleAttribute("hidden")}setActiveScreen(t){this.activeScreen.hidden=!0,t.hidden=!1,this.activeScreen=t}get baseUrl(){return this.getAttribute("base-url")}get country(){return this.getAttribute("country")}get idHint(){return this.getAttribute("id-hint")||"Your BVN should be 11 digits long"}get idNumber(){return localStorage.getItem("idNumber")}get idRegex(){return this.getAttribute("id-regex")}get idType(){return this.getAttribute("id-type")}get idTypeLabel(){return this.getAttribute("id-type-label")}get partnerId(){return this.getAttribute("partner-id")}get partnerName(){return this.getAttribute("partner-name")}get token(){return this.getAttribute("token")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideBack(){return this.hasAttribute("hide-back")}get showNavigation(){return this.hasAttribute("show-navigation")}handleTotpConsentGrant(){const t=new CustomEvent("end-user-consent.totp.granted",{detail:{consented:{contact_information:!0,document_information:!0,personal_details:!0},id_number:this.idNumber,session_id:this.sessionId}});this.dispatchEvent(t)}handleTotpConsentContactMethodsOutdated(){const t="end-user-consent.totp.denied.contact-methods-outdated",i=new CustomEvent(t,{detail:{data:{id_number:this.idNumber,session_id:this.sessionId},message:t}});this.dispatchEvent(i)}}"customElements"in window&&!window.customElements.get("totp-consent")&&window.customElements.define("totp-consent",_a);class gh extends HTMLElement{constructor(){super();const t=document.createElement("template");t.innerHTML=`
1843
+ `}class _a extends HTMLElement{constructor(){super(),this.templateString=mh.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.modes=[],this["otp-delivery-mode"]="",this.queryOtpModes=this.queryOtpModes.bind(this),this.selectOtpMode=this.selectOtpMode.bind(this),this.submitOtp=this.submitOtp.bind(this),this.switchContactMethod=this.switchContactMethod.bind(this),this.handleTotpConsentGrant=this.handleTotpConsentGrant.bind(this),this.handleTotpConsentContactMethodsOutdated=this.handleTotpConsentContactMethodsOutdated.bind(this),this.pages=[]}static get observedAttributes(){return["modes","otp-delivery-mode"]}attributeChangedCallback(t){switch(t){case"modes":case"otp-delivery-mode":{const i=document.createElement("template");i.innerHTML=this.render();const n=i.content.cloneNode(!0).querySelector(`#${this.activeScreen.id}`);n.hidden=!1,this.shadowRoot.replaceChild(n,this.activeScreen),this.setUpEventListeners(),this.setActiveScreen(n);break}}}setUpEventListeners(){this.idEntryScreen=this.shadowRoot.querySelector("#id-entry"),this.selectModeScreen=this.shadowRoot.querySelector("#select-mode"),this.otpVerificationScreen=this.shadowRoot.querySelector("#otp-verification"),this.activeScreen||(this.activeScreen=this.idEntryScreen),this.queryOtpModesButton=this.idEntryScreen.querySelector("#query-otp-modes"),this.backButton=this.idEntryScreen.querySelector("#back-button"),this.selectOtpModeButton=this.selectModeScreen.querySelector("#select-otp-mode"),this.entryBackbutton=this.selectModeScreen.querySelector("#back-to-entry-button"),this.contactMethodsOutdatedButton=this.selectModeScreen.querySelector("#contact-methods-outdated"),this.submitOtpButton=this.otpVerificationScreen.querySelector("#submit-otp"),this.switchContactMethodButton=this.otpVerificationScreen.querySelector(".try-another-method");const t=this.shadowRoot.querySelectorAll(".close-iframe");this.idNumberInput=this.idEntryScreen.querySelector("#id_number"),this.modeInputs=this.selectModeScreen.querySelectorAll('[name="mode"]'),this.otpInput=this.otpVerificationScreen.querySelector("#totp-token"),this.queryOtpModesButton.addEventListener("click",i=>this.queryOtpModes(i)),this.selectOtpModeButton.addEventListener("click",i=>this.selectOtpMode(i)),this.submitOtpButton.addEventListener("click",i=>this.submitOtp(i)),this.switchContactMethodButton.addEventListener("click",i=>this.switchContactMethod(i)),this.contactMethodsOutdatedButton.addEventListener("click",i=>this.handleTotpConsentContactMethodsOutdated(i)),this.entryBackbutton.addEventListener("click",()=>{this.handleBackClick()}),this.backButton.addEventListener("click",()=>{this.handleBackClick()}),t.forEach(i=>{i.addEventListener("click",()=>{this.closeWindow()},!1)})}closeWindow(){const t=window.parent;[t.parent,t].forEach(i=>{i.postMessage("SmileIdentity::Close","*")})}handleBackClick(){const t=this.pages.pop();t?this.setActiveScreen(t):this.dispatchEvent(new CustomEvent("end-user-consent.totp.cancelled",{}))}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}switchContactMethod(){this.queryOtpModes()}resetForm(){this.activeScreen.querySelectorAll("[aria-invalid]").forEach(n=>n.removeAttribute("aria-invalid")),this.activeScreen.querySelectorAll(".validation-message").forEach(n=>n.remove())}handleIdNumberValidationErrors(t){Object.keys(t).forEach(n=>{const r=this.activeScreen.querySelector(`#${n}`);r.setAttribute("aria-invalid","true"),r.setAttribute("aria-describedby",`${n}-hint`);const s=document.createElement("div");s.setAttribute("id",`${n}-hint`),s.setAttribute("class","validation-message"),s.textContent=t[n][0],r.insertAdjacentElement("afterend",s)})}handleActiveScreenErrors(t){const i=this.activeScreen.querySelector('[type="submit"]'),n=document.createElement("div");n.setAttribute("class","validation-message"),n.textContent=t,i.insertAdjacentElement("beforebegin",n)}validateIdNumber(t){const i={id_number:{format:new RegExp(this.idRegex),presence:{allowEmpty:!1,message:"is required"}}},n=fh({id_number:t},i);return n&&this.handleIdNumberValidationErrors(n),n}queryOtpModes(t){return L(this,null,function*(){t&&(t.preventDefault(),this.resetForm());const i=this.validateIdNumber(this.idNumberInput.value);if(localStorage.setItem("idNumber",this.idNumberInput.value||this.idNumber),!i){const n={country:this.country,id_number:this.idNumber,id_type:this.idType,partner_id:this.partnerId,token:this.token},r=`${this.baseUrl}/totp_consent`;try{this.toggleLoading();const s=yield Hr(r,n),o=yield s.json();this.toggleLoading(),s.ok?(this.sessionId=o.session_id,this.modes=o.modes,this.setActiveScreen(this.selectModeScreen),this.setAttribute("modes",o.modes)):this.handleActiveScreenErrors(o.error)}catch(s){this.toggleLoading(),this.handleActiveScreenErrors(s.message)}}})}selectOtpMode(t){return L(this,null,function*(){t.preventDefault(),this.resetForm(),this.mode=Array.prototype.find.call(this.modeInputs,r=>r.checked).value;const i={country:this.country,id_number:this.idNumber,id_type:this.idType,mode:this.mode,partner_id:this.partnerId,session_id:this.sessionId,token:this.token},n=`${this.baseUrl}/totp_consent/mode`;try{this.toggleLoading();const r=yield Hr(n,i),s=yield r.json();this.toggleLoading(),r.ok?(this.selectedOtpDeliveryMode=this.modes.filter(o=>o[this.mode])[0][this.mode],this.setActiveScreen(this.otpVerificationScreen),this.setAttribute("otp-delivery-mode",this.selectedOtpDeliveryMode)):this.handleActiveScreenErrors(s.error)}catch(r){this.toggleLoading(),this.handleActiveScreenErrors(r.message)}})}submitOtp(t){return L(this,null,function*(){t.preventDefault(),this.resetForm(),this.otp=this.otpInput.value;const i={country:this.country,id_number:this.idNumber,id_type:this.idType,otp:this.otp,partner_id:this.partnerId,session_id:this.sessionId,token:this.token},n=`${this.baseUrl}/totp_consent/otp`;try{this.toggleLoading();const r=yield Hr(n,i),s=yield r.json();this.toggleLoading(),r.ok?this.handleTotpConsentGrant(t):this.handleActiveScreenErrors(s.error)}catch(r){this.toggleLoading(),this.handleActiveScreenErrors(r.message)}})}toggleLoading(){const t=this.activeScreen.querySelector('button[type="submit"]'),i=t.querySelector(".text"),n=t.querySelector("svg"),r=t.querySelector(".spinner");t.toggleAttribute("disabled"),i.toggleAttribute("hidden"),n.toggleAttribute("hidden"),r.toggleAttribute("hidden")}setActiveScreen(t){this.activeScreen.hidden=!0,t.hidden=!1,this.activeScreen=t}get baseUrl(){return this.getAttribute("base-url")}get country(){return this.getAttribute("country")}get idHint(){return this.getAttribute("id-hint")||"Your BVN should be 11 digits long"}get idNumber(){return localStorage.getItem("idNumber")}get idRegex(){return this.getAttribute("id-regex")}get idType(){return this.getAttribute("id-type")}get idTypeLabel(){return this.getAttribute("id-type-label")}get partnerId(){return this.getAttribute("partner-id")}get partnerName(){return this.getAttribute("partner-name")}get token(){return this.getAttribute("token")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideBack(){return this.hasAttribute("hide-back")}get showNavigation(){return this.hasAttribute("show-navigation")}handleTotpConsentGrant(){const t=new CustomEvent("end-user-consent.totp.granted",{detail:{consented:{contact_information:!0,document_information:!0,personal_details:!0},id_number:this.idNumber,session_id:this.sessionId}});this.dispatchEvent(t)}handleTotpConsentContactMethodsOutdated(){const t="end-user-consent.totp.denied.contact-methods-outdated",i=new CustomEvent(t,{detail:{data:{id_number:this.idNumber,session_id:this.sessionId},message:t}});this.dispatchEvent(i)}}"customElements"in window&&!window.customElements.get("totp-consent")&&window.customElements.define("totp-consent",_a);class gh extends HTMLElement{constructor(){super();const t=document.createElement("template");t.innerHTML=`
1851
1844
  <p style='margin-inline: auto; max-inline-size: 10rem'>
1852
1845
  <svg viewBox="0 0 90 9" fill="none" xmlns="http://www.w3.org/2000/svg">
1853
1846
  <path d="M0.544 7V1.4H2.616C3.064 1.4 3.43467 1.47467 3.728 1.624C4.02133 1.77333 4.24 1.97867 4.384 2.24C4.528 2.50133 4.6 2.79467 4.6 3.12C4.6 3.42933 4.53067 3.71467 4.392 3.976C4.25333 4.232 4.03733 4.44 3.744 4.6C3.45067 4.75467 3.07467 4.832 2.616 4.832H1.568V7H0.544ZM1.568 4H2.552C2.90933 4 3.16533 3.92267 3.32 3.768C3.48 3.608 3.56 3.392 3.56 3.12C3.56 2.84267 3.48 2.62667 3.32 2.472C3.16533 2.312 2.90933 2.232 2.552 2.232H1.568V4ZM7.08025 7.096C6.69625 7.096 6.34958 7.008 6.04025 6.832C5.73625 6.656 5.49358 6.41333 5.31225 6.104C5.13625 5.78933 5.04825 5.42667 5.04825 5.016C5.04825 4.60533 5.13892 4.24533 5.32025 3.936C5.50158 3.62133 5.74425 3.376 6.04825 3.2C6.35758 3.024 6.70425 2.936 7.08825 2.936C7.46692 2.936 7.80825 3.024 8.11225 3.2C8.42158 3.376 8.66425 3.62133 8.84025 3.936C9.02158 4.24533 9.11225 4.60533 9.11225 5.016C9.11225 5.42667 9.02158 5.78933 8.84025 6.104C8.66425 6.41333 8.42158 6.656 8.11225 6.832C7.80292 7.008 7.45892 7.096 7.08025 7.096ZM7.08025 6.208C7.34692 6.208 7.57892 6.10933 7.77625 5.912C7.97358 5.70933 8.07225 5.41067 8.07225 5.016C8.07225 4.62133 7.97358 4.32533 7.77625 4.128C7.57892 3.92533 7.34958 3.824 7.08825 3.824C6.81625 3.824 6.58158 3.92533 6.38425 4.128C6.19225 4.32533 6.09625 4.62133 6.09625 5.016C6.09625 5.41067 6.19225 5.70933 6.38425 5.912C6.58158 6.10933 6.81358 6.208 7.08025 6.208ZM10.6632 7L9.50319 3.032H10.5192L11.2072 5.888L12.0072 3.032H13.1432L13.9432 5.888L14.6392 3.032H15.6552L14.4872 7H13.4232L12.5752 4.032L11.7272 7H10.6632ZM18.0886 7.096C17.6886 7.096 17.334 7.01067 17.0246 6.84C16.7153 6.66933 16.4726 6.42933 16.2966 6.12C16.1206 5.81067 16.0326 5.45333 16.0326 5.048C16.0326 4.63733 16.118 4.272 16.2886 3.952C16.4646 3.632 16.7046 3.384 17.0086 3.208C17.318 3.02667 17.6806 2.936 18.0966 2.936C18.486 2.936 18.83 3.02133 19.1286 3.192C19.4273 3.36267 19.6593 3.59733 19.8246 3.896C19.9953 4.18933 20.0806 4.51733 20.0806 4.88C20.0806 4.93867 20.078 5 20.0726 5.064C20.0726 5.128 20.07 5.19467 20.0646 5.264H17.0486C17.07 5.57333 17.1766 5.816 17.3686 5.992C17.566 6.168 17.8033 6.256 18.0806 6.256C18.2886 6.256 18.462 6.21067 18.6006 6.12C18.7446 6.024 18.8513 5.90133 18.9206 5.752H19.9606C19.886 6.00267 19.7606 6.232 19.5846 6.44C19.414 6.64267 19.2006 6.80267 18.9446 6.92C18.694 7.03733 18.4086 7.096 18.0886 7.096ZM18.0966 3.768C17.846 3.768 17.6246 3.84 17.4326 3.984C17.2406 4.12267 17.118 4.336 17.0646 4.624H19.0406C19.0246 4.36267 18.9286 4.15467 18.7526 4C18.5766 3.84533 18.358 3.768 18.0966 3.768ZM20.9419 7V3.032H21.8539L21.9499 3.776C22.0939 3.52 22.2885 3.31733 22.5339 3.168C22.7845 3.01333 23.0779 2.936 23.4139 2.936V4.016H23.1259C22.9019 4.016 22.7019 4.05067 22.5259 4.12C22.3499 4.18933 22.2112 4.30933 22.1099 4.48C22.0139 4.65067 21.9659 4.888 21.9659 5.192V7H20.9419ZM25.9714 7.096C25.5714 7.096 25.2168 7.01067 24.9074 6.84C24.5981 6.66933 24.3554 6.42933 24.1794 6.12C24.0034 5.81067 23.9154 5.45333 23.9154 5.048C23.9154 4.63733 24.0008 4.272 24.1714 3.952C24.3474 3.632 24.5874 3.384 24.8914 3.208C25.2008 3.02667 25.5634 2.936 25.9794 2.936C26.3688 2.936 26.7128 3.02133 27.0114 3.192C27.3101 3.36267 27.5421 3.59733 27.7074 3.896C27.8781 4.18933 27.9634 4.51733 27.9634 4.88C27.9634 4.93867 27.9608 5 27.9554 5.064C27.9554 5.128 27.9528 5.19467 27.9474 5.264H24.9314C24.9528 5.57333 25.0594 5.816 25.2514 5.992C25.4488 6.168 25.6861 6.256 25.9634 6.256C26.1714 6.256 26.3448 6.21067 26.4834 6.12C26.6274 6.024 26.7341 5.90133 26.8034 5.752H27.8434C27.7688 6.00267 27.6434 6.232 27.4674 6.44C27.2968 6.64267 27.0834 6.80267 26.8274 6.92C26.5768 7.03733 26.2914 7.096 25.9714 7.096ZM25.9794 3.768C25.7288 3.768 25.5074 3.84 25.3154 3.984C25.1234 4.12267 25.0008 4.336 24.9474 4.624H26.9234C26.9074 4.36267 26.8114 4.15467 26.6354 4C26.4594 3.84533 26.2408 3.768 25.9794 3.768ZM30.6487 7.096C30.2754 7.096 29.942 7.00533 29.6487 6.824C29.3554 6.64267 29.1234 6.39467 28.9527 6.08C28.782 5.76533 28.6967 5.408 28.6967 5.008C28.6967 4.608 28.782 4.25333 28.9527 3.944C29.1234 3.62933 29.3554 3.384 29.6487 3.208C29.942 3.02667 30.2754 2.936 30.6487 2.936C30.9474 2.936 31.2087 2.992 31.4327 3.104C31.6567 3.216 31.838 3.37333 31.9767 3.576V1.24H33.0007V7H32.0887L31.9767 6.432C31.8487 6.608 31.678 6.76267 31.4647 6.896C31.2567 7.02933 30.9847 7.096 30.6487 7.096ZM30.8647 6.2C31.1954 6.2 31.4647 6.09067 31.6727 5.872C31.886 5.648 31.9927 5.36267 31.9927 5.016C31.9927 4.66933 31.886 4.38667 31.6727 4.168C31.4647 3.944 31.1954 3.832 30.8647 3.832C30.5394 3.832 30.27 3.94133 30.0567 4.16C29.8434 4.37867 29.7367 4.66133 29.7367 5.008C29.7367 5.35467 29.8434 5.64 30.0567 5.864C30.27 6.088 30.5394 6.2 30.8647 6.2ZM38.3017 7.096C38.003 7.096 37.7417 7.04 37.5177 6.928C37.2937 6.816 37.1124 6.65867 36.9737 6.456L36.8617 7H35.9497V1.24H36.9737V3.6C37.1017 3.424 37.2697 3.26933 37.4777 3.136C37.691 3.00267 37.9657 2.936 38.3017 2.936C38.675 2.936 39.0084 3.02667 39.3017 3.208C39.595 3.38933 39.827 3.63733 39.9977 3.952C40.1684 4.26667 40.2537 4.624 40.2537 5.024C40.2537 5.424 40.1684 5.78133 39.9977 6.096C39.827 6.40533 39.595 6.65067 39.3017 6.832C39.0084 7.008 38.675 7.096 38.3017 7.096ZM38.0857 6.2C38.411 6.2 38.6804 6.09067 38.8937 5.872C39.107 5.65333 39.2137 5.37067 39.2137 5.024C39.2137 4.67733 39.107 4.392 38.8937 4.168C38.6804 3.944 38.411 3.832 38.0857 3.832C37.755 3.832 37.483 3.944 37.2697 4.168C37.0617 4.38667 36.9577 4.66933 36.9577 5.016C36.9577 5.36267 37.0617 5.648 37.2697 5.872C37.483 6.09067 37.755 6.2 38.0857 6.2ZM41.3051 8.76L42.2251 6.736H41.9851L40.4411 3.032H41.5531L42.6651 5.824L43.8251 3.032H44.9131L42.3931 8.76H41.3051Z" fill="#001096"/>
@@ -3123,22 +3116,7 @@ ${this.hideAttribution?"":`
3123
3116
  `}
3124
3117
  </div>
3125
3118
  </div>
3126
- `}class _h extends HTMLElement{constructor(){super(),this.templateString=yh.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"})}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}static get observedAttributes(){return["hide-back-to-host","show-navigation","data-image","mirror-image"]}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get imageSrc(){return this.getAttribute("data-image")}get shouldMirror(){return this.getAttribute("mirror-image")!=="false"}get title(){return this.getAttribute("title")||"Submit Front of ID"}handleBackEvents(){this.dispatchEvent(new CustomEvent("selfie-capture-review.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("selfie-capture-review.close"))}attributeChangedCallback(t){switch(t){case"data-image":case"hide-back-to-host":case"show-navigation":case"mirror-image":this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners();break}}setUpEventListeners(){this.selectImage=this.shadowRoot.querySelector("#select-id-image"),this.reCaptureImage=this.shadowRoot.querySelector("#re-capture-image"),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.selectImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("selfie-capture-review.accepted",{detail:{}}))}),this.reCaptureImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("selfie-capture-review.rejected",{detail:{}}))})}}"customElements"in window&&!customElements.get("selfie-capture-review")&&window.customElements.define("selfie-capture-review",_h);var Ki,U,Ea,xa,Yt,ka,Aa,Sa,Ma,Ur,Vr,jr,Ji={},La=[],Ch=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qi=Array.isArray;function dt(e,t){for(var i in t)e[i]=t[i];return e}function Gr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ct(e,t,i){var n,r,s,o={};for(s in t)s=="key"?n=t[s]:s=="ref"?r=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?Ki.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return en(e,o,n,r,null)}function en(e,t,i,n,r){var s={type:e,props:t,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r==null?++Ea:r,__i:-1,__u:0};return r==null&&U.vnode!=null&&U.vnode(s),s}function Dt(e){return e.children}function tn(e,t){this.props=e,this.context=t}function pi(e,t){if(t==null)return e.__?pi(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?pi(e):null}function Ta(e){var t,i;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null){e.__e=e.__c.base=i.__e;break}return Ta(e)}}function Ia(e){(!e.__d&&(e.__d=!0)&&Yt.push(e)&&!Ln.__r++||ka!=U.debounceRendering)&&((ka=U.debounceRendering)||Aa)(Ln)}function Ln(){for(var e,t,i,n,r,s,o,a=1;Yt.length;)Yt.length>a&&Yt.sort(Sa),e=Yt.shift(),a=Yt.length,e.__d&&(i=void 0,r=(n=(t=e).__v).__e,s=[],o=[],t.__P&&((i=dt({},n)).__v=n.__v+1,U.vnode&&U.vnode(i),zr(t.__P,i,n,t.__n,t.__P.namespaceURI,32&n.__u?[r]:null,s,r==null?pi(n):r,!!(32&n.__u),o),i.__v=n.__v,i.__.__k[i.__i]=i,Pa(s,i,o),i.__e!=r&&Ta(i)));Ln.__r=0}function Fa(e,t,i,n,r,s,o,a,c,l,d){var h,u,p,f,m,v,g=n&&n.__k||La,b=t.length;for(c=Eh(i,t,g,c,b),h=0;h<b;h++)(p=i.__k[h])!=null&&(u=p.__i==-1?Ji:g[p.__i]||Ji,p.__i=h,v=zr(e,p,u,r,s,o,a,c,l,d),f=p.__e,p.ref&&u.ref!=p.ref&&(u.ref&&qr(u.ref,null,p),d.push(p.ref,p.__c||f,p)),m==null&&f!=null&&(m=f),4&p.__u||u.__k===p.__k?c=Ba(p,c,e):typeof p.type=="function"&&v!==void 0?c=v:f&&(c=f.nextSibling),p.__u&=-7);return i.__e=m,c}function Eh(e,t,i,n,r){var s,o,a,c,l,d=i.length,h=d,u=0;for(e.__k=new Array(r),s=0;s<r;s++)(o=t[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(c=s+u,(o=e.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?en(null,o,null,null,null):Qi(o)?en(Dt,{children:o},null,null,null):o.constructor==null&&o.__b>0?en(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,a=null,(l=o.__i=xh(o,i,c,h))!=-1&&(h--,(a=i[l])&&(a.__u|=2)),a==null||a.__v==null?(l==-1&&(r>d?u--:r<d&&u++),typeof o.type!="function"&&(o.__u|=4)):l!=c&&(l==c-1?u--:l==c+1?u++:(l>c?u--:u++,o.__u|=4))):e.__k[s]=null;if(h)for(s=0;s<d;s++)(a=i[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=pi(a)),Na(a,a));return n}function Ba(e,t,i){var n,r;if(typeof e.type=="function"){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=Ba(n[r],t,i));return t}e.__e!=t&&(t&&e.type&&!i.contains(t)&&(t=pi(e)),i.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Da(e,t){return t=t||[],e==null||typeof e=="boolean"||(Qi(e)?e.some(function(i){Da(i,t)}):t.push(e)),t}function xh(e,t,i,n){var r,s,o,a=e.key,c=e.type,l=t[i],d=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||d&&a==l.key&&c==l.type)return i;if(n>(d?1:0)){for(r=i-1,s=i+1;r>=0||s<t.length;)if((l=t[o=r>=0?r--:s++])!=null&&(2&l.__u)==0&&a==l.key&&c==l.type)return o}return-1}function Ra(e,t,i){t[0]=="-"?e.setProperty(t,i==null?"":i):e[t]=i==null?"":typeof i!="number"||Ch.test(t)?i:i+"px"}function Tn(e,t,i,n,r){var s,o;e:if(t=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)i&&t in i||Ra(e.style,t,"");if(i)for(t in i)n&&i[t]==n[t]||Ra(e.style,t,i[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(Ma,"$1")),o=t.toLowerCase(),t=o in e||t=="onFocusOut"||t=="onFocusIn"?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=i,i?n?i.u=n.u:(i.u=Ur,e.addEventListener(t,s?jr:Vr,s)):e.removeEventListener(t,s?jr:Vr,s);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=i==null?"":i;break e}catch(a){}typeof i=="function"||(i==null||i===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&i==1?"":i))}}function Oa(e){return function(t){if(this.l){var i=this.l[t.type+e];if(t.t==null)t.t=Ur++;else if(t.t<i.u)return;return i(U.event?U.event(t):t)}}}function zr(e,t,i,n,r,s,o,a,c,l){var d,h,u,p,f,m,v,g,b,_,E,L,w,T,I,O,be,ce=t.type;if(t.constructor!=null)return null;128&i.__u&&(c=!!(32&i.__u),s=[a=t.__e=i.__e]),(d=U.__b)&&d(t);e:if(typeof ce=="function")try{if(g=t.props,b="prototype"in ce&&ce.prototype.render,_=(d=ce.contextType)&&n[d.__c],E=d?_?_.props.value:d.__:n,i.__c?v=(h=t.__c=i.__c).__=h.__E:(b?t.__c=h=new ce(g,E):(t.__c=h=new tn(g,E),h.constructor=ce,h.render=Ah),_&&_.sub(h),h.props=g,h.state||(h.state={}),h.context=E,h.__n=n,u=h.__d=!0,h.__h=[],h._sb=[]),b&&h.__s==null&&(h.__s=h.state),b&&ce.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=dt({},h.__s)),dt(h.__s,ce.getDerivedStateFromProps(g,h.__s))),p=h.props,f=h.state,h.__v=t,u)b&&ce.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),b&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(b&&ce.getDerivedStateFromProps==null&&g!==p&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(g,E),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(g,h.__s,E)===!1||t.__v==i.__v){for(t.__v!=i.__v&&(h.props=g,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(re){re&&(re.__=t)}),L=0;L<h._sb.length;L++)h.__h.push(h._sb[L]);h._sb=[],h.__h.length&&o.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(g,h.__s,E),b&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(p,f,m)})}if(h.context=E,h.props=g,h.__P=e,h.__e=!1,w=U.__r,T=0,b){for(h.state=h.__s,h.__d=!1,w&&w(t),d=h.render(h.props,h.state,h.context),I=0;I<h._sb.length;I++)h.__h.push(h._sb[I]);h._sb=[]}else do h.__d=!1,w&&w(t),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++T<25);h.state=h.__s,h.getChildContext!=null&&(n=dt(dt({},n),h.getChildContext())),b&&!u&&h.getSnapshotBeforeUpdate!=null&&(m=h.getSnapshotBeforeUpdate(p,f)),O=d,d!=null&&d.type===Dt&&d.key==null&&(O=$a(d.props.children)),a=Fa(e,Qi(O)?O:[O],t,i,n,r,s,o,a,c,l),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(re){if(t.__v=null,c||s!=null)if(re.then){for(t.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else{for(be=s.length;be--;)Gr(s[be]);Zr(t)}else t.__e=i.__e,t.__k=i.__k,re.then||Zr(t);U.__e(re,t,i)}else s==null&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=kh(i.__e,t,i,n,r,s,o,c,l);return(d=U.diffed)&&d(t),128&t.__u?void 0:a}function Zr(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Zr)}function Pa(e,t,i){for(var n=0;n<i.length;n++)qr(i[n],i[++n],i[++n]);U.__c&&U.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(s){s.call(r)})}catch(s){U.__e(s,r.__v)}})}function $a(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Qi(e)?e.map($a):dt({},e)}function kh(e,t,i,n,r,s,o,a,c){var l,d,h,u,p,f,m,v=i.props,g=t.props,b=t.type;if(b=="svg"?r="http://www.w3.org/2000/svg":b=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(l=0;l<s.length;l++)if((p=s[l])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,s[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(g);e=document.createElementNS(r,b,g.is&&g),a&&(U.__m&&U.__m(t,s),a=!1),s=null}if(b==null)v===g||a&&e.data==g||(e.data=g);else{if(s=s&&Ki.call(e.childNodes),v=i.props||Ji,!a&&s!=null)for(v={},l=0;l<e.attributes.length;l++)v[(p=e.attributes[l]).name]=p.value;for(l in v)if(p=v[l],l!="children"){if(l=="dangerouslySetInnerHTML")h=p;else if(!(l in g)){if(l=="value"&&"defaultValue"in g||l=="checked"&&"defaultChecked"in g)continue;Tn(e,l,null,p,r)}}for(l in g)p=g[l],l=="children"?u=p:l=="dangerouslySetInnerHTML"?d=p:l=="value"?f=p:l=="checked"?m=p:a&&typeof p!="function"||v[l]===p||Tn(e,l,p,v[l],r);if(d)a||h&&(d.__html==h.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),Fa(t.type=="template"?e.content:e,Qi(u)?u:[u],t,i,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:i.__k&&pi(i,0),a,c),s!=null)for(l=s.length;l--;)Gr(s[l]);a||(l="value",b=="progress"&&f==null?e.removeAttribute("value"):f!=null&&(f!==e[l]||b=="progress"&&!f||b=="option"&&f!=v[l])&&Tn(e,l,f,v[l],r),l="checked",m!=null&&m!=e[l]&&Tn(e,l,m,v[l],r))}return e}function qr(e,t,i){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(r){U.__e(r,i)}}function Na(e,t,i){var n,r;if(U.unmount&&U.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||qr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){U.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(r=0;r<n.length;r++)n[r]&&Na(n[r],t,i||typeof e.type!="function");i||Gr(e.__e),e.__c=e.__=e.__e=void 0}function Ah(e,t,i){return this.constructor(e,i)}function In(e,t,i){var n,r,s,o;t==document&&(t=document.documentElement),U.__&&U.__(e,t),r=(n=typeof i=="function")?null:i&&i.__k||t.__k,s=[],o=[],zr(t,e=(!n&&i||t).__k=Ct(Dt,null,[e]),r||Ji,Ji,t.namespaceURI,!n&&i?[i]:r?null:t.firstChild?Ki.call(t.childNodes):null,s,!n&&i?i:r?r.__e:t.firstChild,n,o),Pa(s,e,o)}function Ha(e,t){In(e,t,Ha)}function Ua(e,t,i){var n,r,s,o,a=dt({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)s=="key"?n=t[s]:s=="ref"?r=t[s]:a[s]=t[s]===void 0&&o!=null?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?Ki.call(arguments,2):i),en(e.type,a,n||e.key,r||e.ref,null)}Ki=La.slice,U={__e:function(e,t,i,n){for(var r,s,o;t=t.__;)if((r=t.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(e)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,n||{}),o=r.__d),o)return r.__E=r}catch(a){e=a}throw e}},Ea=0,xa=function(e){return e!=null&&e.constructor==null},tn.prototype.setState=function(e,t){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dt({},this.state),typeof e=="function"&&(e=e(dt({},i),this.props)),e&&dt(i,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ia(this))},tn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ia(this))},tn.prototype.render=Dt,Yt=[],Aa=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Sa=function(e,t){return e.__v.__b-t.__v.__b},Ln.__r=0,Ma=/(PointerCapture)$|Capture$/i,Ur=0,Vr=Oa(!1),jr=Oa(!0);var Sh=0;function D(e,t,i,n,r,s){t||(t={});var o,a,c=t;if("ref"in c)for(a in c={},t)a=="ref"?o=t[a]:c[a]=t[a];var l={type:e,props:c,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sh,__i:-1,__u:0,__source:r,__self:s};if(typeof e=="function"&&(o=e.defaultProps))for(a in o)c[a]===void 0&&(c[a]=o[a]);return U.vnode&&U.vnode(l),l}var nn,le,Wr,Va,Fn=0,ja=[],fe=U,Ga=fe.__b,za=fe.__r,Za=fe.diffed,qa=fe.__c,Wa=fe.unmount,Xa=fe.__;function Xr(e,t){fe.__h&&fe.__h(le,e,Fn||t),Fn=0;var i=le.__H||(le.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function Kt(e){return Fn=1,Mh(Ja,e)}function Mh(e,t,i){var n=Xr(nn++,2);if(n.t=e,!n.__c&&(n.__=[Ja(void 0,t),function(a){var c=n.__N?n.__N[0]:n.__[0],l=n.t(c,a);c!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=le,!le.__f)){var r=function(a,c,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(u){return!!u.__c});if(d.every(function(u){return!u.__N}))return!s||s.call(this,a,c,l);var h=n.__c.props!==a;return d.forEach(function(u){if(u.__N){var p=u.__[0];u.__=u.__N,u.__N=void 0,p!==u.__[0]&&(h=!0)}}),s&&s.call(this,a,c,l)||h};le.__f=!0;var s=le.shouldComponentUpdate,o=le.componentWillUpdate;le.componentWillUpdate=function(a,c,l){if(this.__e){var d=s;s=void 0,r(a,c,l),s=d}o&&o.call(this,a,c,l)},le.shouldComponentUpdate=r}return n.__N||n.__}function ot(e,t){var i=Xr(nn++,3);!fe.__s&&Ka(i.__H,t)&&(i.__=e,i.u=t,le.__H.__h.push(i))}function xe(e){return Fn=5,Bn(function(){return{current:e}},[])}function Bn(e,t){var i=Xr(nn++,7);return Ka(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function Lh(){for(var e;e=ja.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Dn),e.__H.__h.forEach(Yr),e.__H.__h=[]}catch(t){e.__H.__h=[],fe.__e(t,e.__v)}}fe.__b=function(e){le=null,Ga&&Ga(e)},fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xa&&Xa(e,t)},fe.__r=function(e){za&&za(e),nn=0;var t=(le=e.__c).__H;t&&(Wr===le?(t.__h=[],le.__h=[],t.__.forEach(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(t.__h.forEach(Dn),t.__h.forEach(Yr),t.__h=[],nn=0)),Wr=le},fe.diffed=function(e){Za&&Za(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ja.push(t)!==1&&Va===fe.requestAnimationFrame||((Va=fe.requestAnimationFrame)||Th)(Lh)),t.__H.__.forEach(function(i){i.u&&(i.__H=i.u),i.u=void 0})),Wr=le=null},fe.__c=function(e,t){t.some(function(i){try{i.__h.forEach(Dn),i.__h=i.__h.filter(function(n){return!n.__||Yr(n)})}catch(n){t.some(function(r){r.__h&&(r.__h=[])}),t=[],fe.__e(n,i.__v)}}),qa&&qa(e,t)},fe.unmount=function(e){Wa&&Wa(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.forEach(function(n){try{Dn(n)}catch(r){t=r}}),i.__H=void 0,t&&fe.__e(t,i.__v))};var Ya=typeof requestAnimationFrame=="function";function Th(e){var t,i=function(){clearTimeout(n),Ya&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(i,35);Ya&&(t=requestAnimationFrame(i))}function Dn(e){var t=le,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),le=t}function Yr(e){var t=le;e.__c=e.__(),le=t}function Ka(e,t){return!e||e.length!==t.length||t.some(function(i,n){return i!==e[n]})}function Ja(e,t){return typeof t=="function"?t(e):t}/**
3127
- * @license @tabler/icons-preact v3.34.1 - MIT
3128
- *
3129
- * This source code is licensed under the MIT license.
3130
- * See the LICENSE file in the root directory of this source tree.
3131
- */var Ih={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/**
3132
- * @license @tabler/icons-preact v3.34.1 - MIT
3133
- *
3134
- * This source code is licensed under the MIT license.
3135
- * See the LICENSE file in the root directory of this source tree.
3136
- */const Fh=(e,t,i,n)=>{const r=f=>{var m=f,{color:s="currentColor",size:o=24,stroke:a=2,title:c,children:l,className:d="",class:h="",style:u}=m,p=ua(m,["color","size","stroke","title","children","className","class","style"]);return Ct("svg",Fe(qi(Fe({},Ih[e]),{width:String(o),height:String(o),class:["tabler-icon",`tabler-icon-${t}`,h,d].join(" "),"stroke-width":a,stroke:s,style:u}),p),[c&&Ct("title",{},c),...n.map(([v,g])=>Ct(v,g)),...Da(l)])};return r.displayName=`${i}`,r};/**
3137
- * @license @tabler/icons-preact v3.34.1 - MIT
3138
- *
3139
- * This source code is licensed under the MIT license.
3140
- * See the LICENSE file in the root directory of this source tree.
3141
- */var Bh=Fh("outline","loader-2","Loader2",[["path",{d:"M12 3a9 9 0 1 0 9 9",key:"svg-0"}]]);function Kr(){return(Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var Dh=["context","children"];function Rh(e){this.getChildContext=function(){return e.context};var t=e.children,i=function(n,r){if(n==null)return{};var s,o,a={},c=Object.keys(n);for(o=0;o<c.length;o++)r.indexOf(s=c[o])>=0||(a[s]=n[s]);return a}(e,Dh);return Ua(t,i)}function Oh(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=Ct(Rh,Kr({},this._props,{context:e.detail.context}),function t(i,n){if(i.nodeType===3)return i.data;if(i.nodeType!==1)return null;var r=[],s={},o=0,a=i.attributes,c=i.childNodes;for(o=a.length;o--;)a[o].name!=="slot"&&(s[a[o].name]=a[o].value,s[Qa(a[o].name)]=a[o].value);for(o=c.length;o--;){var l=t(c[o],null),d=c[o].slot;d?s[d]=Ct(e1,{name:d},l):r[o]=l}var h=n?Ct(e1,null,r):r;return Ct(n||i.nodeName.toLowerCase(),s,h)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Ha:In)(this._vdom,this._root)}function Qa(e){return e.replace(/-(\w)/g,function(t,i){return i?i.toUpperCase():""})}function Ph(e,t,i){if(this._vdom){var n={};n[e]=i=i==null?void 0:i,n[Qa(e)]=i,this._vdom=Ua(this._vdom,n),In(this._vdom,this._root)}}function $h(){In(this._vdom=null,this._root)}function e1(e,t){var i=this;return Ct("slot",Kr({},e,{ref:function(n){n?(i.ref=n,i._listener||(i._listener=function(r){r.stopPropagation(),r.detail.context=t},n.addEventListener("_preact",i._listener))):i.ref.removeEventListener("_preact",i._listener)}}))}function t1(e,t,i,n){function r(){var s=Reflect.construct(HTMLElement,[],r);return s._vdomComponent=e,s._root=n&&n.shadow?s.attachShadow({mode:n.mode||"open"}):s,s}return(r.prototype=Object.create(HTMLElement.prototype)).constructor=r,r.prototype.connectedCallback=Oh,r.prototype.attributeChangedCallback=Ph,r.prototype.disconnectedCallback=$h,i=i||e.observedAttributes||Object.keys(e.propTypes||{}),r.observedAttributes=i,i.forEach(function(s){Object.defineProperty(r.prototype,s,{get:function(){return this._vdom.props[s]},set:function(o){this._vdom?this.attributeChangedCallback(s,null,o):(this._props||(this._props={}),this._props[s]=o,this.connectedCallback());var a=typeof o;o!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(s,o)}})}),customElements.define(t||e.tagName||e.displayName||e.name,r)}const fi=(e,t=!1)=>typeof e=="boolean"?e:typeof e=="string"?e==="true"||e==="":t;var Nh=Symbol.for("preact-signals");function Rn(){if(Rt>1)Rt--;else{for(var e,t=!1;rn!==void 0;){var i=rn;for(rn=void 0,Jr++;i!==void 0;){var n=i.o;if(i.o=void 0,i.f&=-3,!(8&i.f)&&s1(i))try{i.c()}catch(r){t||(e=r,t=!0)}i=n}}if(Jr=0,Rt--,t)throw e}}function Hh(e){if(Rt>0)return e();Rt++;try{return e()}finally{Rn()}}var V=void 0;function i1(e){var t=V;V=void 0;try{return e()}finally{V=t}}var rn=void 0,Rt=0,Jr=0,On=0;function n1(e){if(V!==void 0){var t=e.n;if(t===void 0||t.t!==V)return t={i:0,S:e,p:V.s,n:void 0,t:V,e:void 0,x:void 0,r:t},V.s!==void 0&&(V.s.n=t),V.s=t,e.n=t,32&V.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=V.s,t.n=void 0,V.s.n=t,V.s=t),t}}function Ee(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched}Ee.prototype.brand=Nh,Ee.prototype.h=function(){return!0},Ee.prototype.S=function(e){var t=this,i=this.t;i!==e&&e.e===void 0&&(e.x=i,this.t=e,i!==void 0?i.e=e:i1(function(){var n;(n=t.W)==null||n.call(t)}))},Ee.prototype.U=function(e){var t=this;if(this.t!==void 0){var i=e.e,n=e.x;i!==void 0&&(i.x=n,e.e=void 0),n!==void 0&&(n.e=i,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&i1(function(){var r;(r=t.Z)==null||r.call(t)}))}},Ee.prototype.subscribe=function(e){var t=this;return sn(function(){var i=t.value,n=V;V=void 0;try{e(i)}finally{V=n}})},Ee.prototype.valueOf=function(){return this.value},Ee.prototype.toString=function(){return this.value+""},Ee.prototype.toJSON=function(){return this.value},Ee.prototype.peek=function(){var e=V;V=void 0;try{return this.value}finally{V=e}},Object.defineProperty(Ee.prototype,"value",{get:function(){var e=n1(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Jr>100)throw new Error("Cycle detected");this.v=e,this.i++,On++,Rt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Rn()}}}});function r1(e,t){return new Ee(e,t)}function s1(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function o1(e){for(var t=e.s;t!==void 0;t=t.n){var i=t.S.n;if(i!==void 0&&(t.r=i),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function a1(e){for(var t=e.s,i=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):i=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=i}function Jt(e,t){Ee.call(this,void 0),this.x=e,this.s=void 0,this.g=On-1,this.f=4,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched}Jt.prototype=new Ee,Jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===On))return!0;if(this.g=On,this.f|=1,this.i>0&&!s1(this))return this.f&=-2,!0;var e=V;try{o1(this),V=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(i){this.v=i,this.f|=16,this.i++}return V=e,a1(this),this.f&=-2,!0},Jt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ee.prototype.S.call(this,e)},Jt.prototype.U=function(e){if(this.t!==void 0&&(Ee.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Jt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=n1(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Qr(e,t){return new Jt(e,t)}function c1(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Rt++;var i=V;V=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,es(e),n}finally{V=i,Rn()}}}function es(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,c1(e)}function Uh(e){if(V!==this)throw new Error("Out-of-order effect");a1(this),V=e,this.f&=-2,8&this.f&&es(this),Rn()}function mi(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}mi.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},mi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,c1(this),o1(this),Rt++;var e=V;return V=this,Uh.bind(this,e)},mi.prototype.N=function(){2&this.f||(this.f|=2,this.o=rn,rn=this)},mi.prototype.d=function(){this.f|=8,1&this.f||es(this)},mi.prototype.dispose=function(){this.d()};function sn(e){var t=new mi(e);try{t.c()}catch(n){throw t.d(),n}var i=t.d.bind(t);return i[Symbol.dispose]=i,i}var l1,Pn,ts,h1=[];sn(function(){l1=this.N})();function gi(e,t){U[e]=t.bind(null,U[e]||function(){})}function $n(e){ts&&ts(),ts=e&&e.S()}function d1(e){var t=this,i=e.data,n=se(i);n.value=i;var r=Bn(function(){for(var a=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var l=Qr(function(){var p=n.value.value;return p===0?0:p===!0?"":p||""}),d=Qr(function(){return!Array.isArray(l.value)&&!xa(l.value)}),h=sn(function(){if(this.N=u1,d.value){var p=l.value;a.__v&&a.__v.__e&&a.__v.__e.nodeType===3&&(a.__v.__e.data=p)}}),u=t.__$u.d;return t.__$u.d=function(){h(),u.call(this)},[d,l]},[]),s=r[0],o=r[1];return s.value?o.peek():o.value}d1.displayName="_st",Object.defineProperties(Ee.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:d1},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),gi("__b",function(e,t){if(typeof t.type=="string"){var i,n=t.props;for(var r in n)if(r!=="children"){var s=n[r];s instanceof Ee&&(i||(t.__np=i={}),i[r]=s,n[r]=s.peek())}}e(t)}),gi("__r",function(e,t){if(t.type!==Dt){$n();var i,n=t.__c;n&&(n.__$f&=-2,(i=n.__$u)===void 0&&(n.__$u=i=function(r){var s;return sn(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Pn=n,$n(i)}e(t)}),gi("__e",function(e,t,i,n){$n(),Pn=void 0,e(t,i,n)}),gi("diffed",function(e,t){$n(),Pn=void 0;var i;if(typeof t.type=="string"&&(i=t.__e)){var n=t.__np,r=t.props;if(n){var s=i.U;if(s)for(var o in s){var a=s[o];a!==void 0&&!(o in n)&&(a.d(),s[o]=void 0)}else s={},i.U=s;for(var c in n){var l=s[c],d=n[c];l===void 0?(l=Vh(i,c,d,r),s[c]=l):l.o(d,r)}}}e(t)});function Vh(e,t,i,n){var r=t in e&&e.ownerSVGElement===void 0,s=r1(i);return{o:function(o,a){s.value=o,n=a},d:sn(function(){this.N=u1;var o=s.value.value;n[t]!==o&&(n[t]=o,r?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}gi("unmount",function(e,t){if(typeof t.type=="string"){var i=t.__e;if(i){var n=i.U;if(n){i.U=void 0;for(var r in n){var s=n[r];s&&s.d()}}}}else{var o=t.__c;if(o){var a=o.__$u;a&&(o.__$u=void 0,a.d())}}e(t)}),gi("__h",function(e,t,i,n){(n<3||n===9)&&(t.__$f|=2),e(t,i,n)}),tn.prototype.shouldComponentUpdate=function(e,t){var i=this.__$u,n=i&&i.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var s=2&this.__$f;if(!(n||s||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};function se(e,t){return Bn(function(){return r1(e,t)},[])}function is(e,t){var i=xe(e);return i.current=e,Pn.__$f|=4,Bn(function(){return Qr(function(){return i.current()},t)},[])}var jh=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Gh(){Hh(function(){for(var e;e=h1.shift();)l1.call(e)})}function u1(){h1.push(this)===1&&(U.requestAnimationFrame||jh)(Gh)}var ns,p1;function rs(){if(p1)return ns;p1=1;function e(t){var i=typeof t;return t!=null&&(i=="object"||i=="function")}return ns=e,ns}var ss,f1;function zh(){if(f1)return ss;f1=1;var e=typeof Mn=="object"&&Mn&&Mn.Object===Object&&Mn;return ss=e,ss}var os,m1;function g1(){if(m1)return os;m1=1;var e=zh(),t=typeof self=="object"&&self&&self.Object===Object&&self,i=e||t||Function("return this")();return os=i,os}var as,v1;function Zh(){if(v1)return as;v1=1;var e=g1(),t=function(){return e.Date.now()};return as=t,as}var cs,b1;function qh(){if(b1)return cs;b1=1;var e=/\s/;function t(i){for(var n=i.length;n--&&e.test(i.charAt(n)););return n}return cs=t,cs}var ls,w1;function Wh(){if(w1)return ls;w1=1;var e=qh(),t=/^\s+/;function i(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return ls=i,ls}var hs,y1;function _1(){if(y1)return hs;y1=1;var e=g1(),t=e.Symbol;return hs=t,hs}var ds,C1;function Xh(){if(C1)return ds;C1=1;var e=_1(),t=Object.prototype,i=t.hasOwnProperty,n=t.toString,r=e?e.toStringTag:void 0;function s(o){var a=i.call(o,r),c=o[r];try{o[r]=void 0;var l=!0}catch(h){}var d=n.call(o);return l&&(a?o[r]=c:delete o[r]),d}return ds=s,ds}var us,E1;function Yh(){if(E1)return us;E1=1;var e=Object.prototype,t=e.toString;function i(n){return t.call(n)}return us=i,us}var ps,x1;function Kh(){if(x1)return ps;x1=1;var e=_1(),t=Xh(),i=Yh(),n="[object Null]",r="[object Undefined]",s=e?e.toStringTag:void 0;function o(a){return a==null?a===void 0?r:n:s&&s in Object(a)?t(a):i(a)}return ps=o,ps}var fs,k1;function Jh(){if(k1)return fs;k1=1;function e(t){return t!=null&&typeof t=="object"}return fs=e,fs}var ms,A1;function Qh(){if(A1)return ms;A1=1;var e=Kh(),t=Jh(),i="[object Symbol]";function n(r){return typeof r=="symbol"||t(r)&&e(r)==i}return ms=n,ms}var gs,S1;function ed(){if(S1)return gs;S1=1;var e=Wh(),t=rs(),i=Qh(),n=NaN,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function c(l){if(typeof l=="number")return l;if(i(l))return n;if(t(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=t(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=e(l);var h=s.test(l);return h||o.test(l)?a(l.slice(2),h?2:8):r.test(l)?n:+l}return gs=c,gs}var vs,M1;function td(){if(M1)return vs;M1=1;var e=rs(),t=Zh(),i=ed(),n="Expected a function",r=Math.max,s=Math.min;function o(a,c,l){var d,h,u,p,f,m,v=0,g=!1,b=!1,_=!0;if(typeof a!="function")throw new TypeError(n);c=i(c)||0,e(l)&&(g=!!l.leading,b="maxWait"in l,u=b?r(i(l.maxWait)||0,c):u,_="trailing"in l?!!l.trailing:_);function E(Z){var ue=d,pe=h;return d=h=void 0,v=Z,p=a.apply(pe,ue),p}function L(Z){return v=Z,f=setTimeout(I,c),g?E(Z):p}function w(Z){var ue=Z-m,pe=Z-v,Ae=c-ue;return b?s(Ae,u-pe):Ae}function T(Z){var ue=Z-m,pe=Z-v;return m===void 0||ue>=c||ue<0||b&&pe>=u}function I(){var Z=t();if(T(Z))return O(Z);f=setTimeout(I,w(Z))}function O(Z){return f=void 0,_&&d?E(Z):(d=h=void 0,p)}function be(){f!==void 0&&clearTimeout(f),v=0,d=m=h=f=void 0}function ce(){return f===void 0?p:O(t())}function re(){var Z=t(),ue=T(Z);if(d=arguments,h=this,m=Z,ue){if(f===void 0)return L(m);if(b)return clearTimeout(f),f=setTimeout(I,c),E(m)}return f===void 0&&(f=setTimeout(I,c)),p}return re.cancel=be,re.flush=ce,re}return vs=o,vs}var bs,L1;function id(){if(L1)return bs;L1=1;var e=td(),t=rs(),i="Expected a function";function n(r,s,o){var a=!0,c=!0;if(typeof r!="function")throw new TypeError(i);return t(o)&&(a="leading"in o?!!o.leading:a,c="trailing"in o?!!o.trailing:c),e(r,s,{leading:a,maxWait:s,trailing:c})}return bs=n,bs}var nd=id();const T1=wa(nd),rd=(e="user")=>{var v;const t=xe(null),i=xe(null),[n,r]=Kt(e),[s,o]=Kt(!1),a=xe(null),c=xe(!1),l=xe(new Set),d=g=>{a.current=g};ot(()=>{const g=t.current;if(!g)return;const b=()=>{if(c.current&&a.current){const _=setTimeout(()=>{var E;(E=a.current)==null||E.call(a),c.current=!1,l.current.delete(_)},100);l.current.add(_)}};return g.addEventListener("loadedmetadata",b),()=>{g.removeEventListener("loadedmetadata",b),l.current.forEach(_=>clearTimeout(_)),l.current.clear()}},[(v=t.current)==null?void 0:v.src]),ot(()=>()=>{l.current.forEach(g=>clearTimeout(g)),l.current.clear()},[]);const h=(g,b)=>M(null,null,function*(){try{i.current&&(i.current.getTracks().forEach(be=>be.stop()),i.current=null),t.current&&(t.current.srcObject=null);const _=yield navigator.mediaDevices.getUserMedia({video:{facingMode:g||n}});i.current=_;const w=_.getVideoTracks()[0].getSettings().facingMode;(w&&w!==(g||n)||w&&w!==n)&&r(w);const O=(yield navigator.mediaDevices.enumerateDevices()).find(be=>be.kind==="videoinput"&&_.getVideoTracks()[0].getSettings().deviceId===be.deviceId);b==null||b(O==null?void 0:O.label),t.current&&(t.current.srcObject=_,yield t.current.play())}catch(_){console.error("Failed to start camera:",_)}}),u=()=>M(null,null,function*(){const g=n==="user"?"environment":"user";c.current=!0;const b=n;try{r(g),i.current&&(i.current.getTracks().forEach(_=>_.stop()),i.current=null),yield h(g)}catch(_){r(b),c.current=!1;try{yield h(b)}catch(E){console.error("Failed to restore previous camera:",E)}}}),p=()=>{const g=navigator.userAgent.toLowerCase(),b=g.includes("firefox")||g.includes("gecko")&&!g.includes("chrome")&&!g.includes("edge"),_="mozInnerScreenX"in window||"mozInputSource"in window||"mozPaintCount"in window||typeof window.InstallTrigger!="undefined",E=CSS.supports&&(CSS.supports("-moz-appearance","none")||CSS.supports("-moz-user-select","none"));return{isGecko:b||_||E,isChromium:g.includes("chrome")||g.includes("chromium")||g.includes("edge"),isWebKit:g.includes("webkit")&&!g.includes("chrome")}};return{videoRef:t,streamRef:i,facingMode:n,agentSupported:s,startCamera:h,switchCamera:u,checkAgentSupport:()=>M(null,null,function*(){var g,b;try{if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||navigator.maxTouchPoints&&navigator.maxTouchPoints>1){o(!0);return}const{isGecko:E}=p();let L=null,w=null;try{const I=yield navigator.mediaDevices.getUserMedia({video:{facingMode:"user"}});L=(g=I.getVideoTracks()[0].getSettings().deviceId)!=null?g:null,I.getTracks().forEach(O=>O.stop())}catch(I){}try{const I=yield navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});w=(b=I.getVideoTracks()[0].getSettings().deviceId)!=null?b:null,I.getTracks().forEach(O=>O.stop())}catch(I){}if(!(L&&w&&L!==w)){o(!1);return}o(!E)}catch(_){o(!1)}}),stopCamera:()=>{i.current&&(i.current.getTracks().forEach(g=>g.stop()),i.current=null),t.current&&(t.current.srcObject=null,t.current.load())},registerCameraSwitchCallback:d}};var vi=typeof self!="undefined"?self:{};function Qt(){throw Error("Invalid UTF8")}function I1(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Nn,ws;const sd=typeof TextDecoder!="undefined";let od;const ad=typeof TextEncoder!="undefined";function F1(e){if(ad)e=(od||(od=new TextEncoder)).encode(e);else{let i=0;const n=new Uint8Array(3*e.length);for(let r=0;r<e.length;r++){var t=e.charCodeAt(r);if(t<128)n[i++]=t;else{if(t<2048)n[i++]=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,n[i++]=t>>18|240,n[i++]=t>>12&63|128,n[i++]=t>>6&63|128,n[i++]=63&t|128;continue}r--}t=65533}n[i++]=t>>12|224,n[i++]=t>>6&63|128}n[i++]=63&t|128}}e=i===n.length?n:n.subarray(0,i)}return e}var ys,Hn;e:{for(var B1=["CLOSURE_FLAGS"],_s=vi,Cs=0;Cs<B1.length;Cs++)if((_s=_s[B1[Cs]])==null){Hn=null;break e}Hn=_s}var on,D1=Hn&&Hn[610401301];ys=D1!=null&&D1;const R1=vi.navigator;function Es(e){return!!ys&&!!on&&on.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Xe(e){var t;return(t=vi.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function Ot(){return!!ys&&!!on&&on.brands.length>0}function xs(){return Ot()?Es("Chromium"):(Xe("Chrome")||Xe("CriOS"))&&!(!Ot()&&Xe("Edge"))||Xe("Silk")}function Un(e){return Un[" "](e),e}on=R1&&R1.userAgentData||null,Un[" "]=function(){};var cd=!Ot()&&(Xe("Trident")||Xe("MSIE"));!Xe("Android")||xs(),xs(),Xe("Safari")&&(xs()||!Ot()&&Xe("Coast")||!Ot()&&Xe("Opera")||!Ot()&&Xe("Edge")||(Ot()?Es("Microsoft Edge"):Xe("Edg/"))||Ot()&&Es("Opera"));var O1={},an=null;function ld(e){const t=e.length;let i=3*t/4;i%3?i=Math.floor(i):"=.".indexOf(e[t-1])!=-1&&(i="=.".indexOf(e[t-2])!=-1?i-2:i-1);const n=new Uint8Array(i);let r=0;return function(s,o){function a(l){for(;c<s.length;){const d=s.charAt(c++),h=an[d];if(h!=null)return h;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return l}P1();let c=0;for(;;){const l=a(-1),d=a(0),h=a(64),u=a(64);if(u===64&&l===-1)break;o(l<<2|d>>4),h!=64&&(o(d<<4&240|h>>2),u!=64&&o(h<<6&192|u))}}(e,function(s){n[r++]=s}),r!==i?n.subarray(0,r):n}function P1(){if(!an){an={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let i=0;i<5;i++){const n=e.concat(t[i].split(""));O1[i]=n;for(let r=0;r<n.length;r++){const s=n[r];an[s]===void 0&&(an[s]=r)}}}}var $1=typeof Uint8Array!="undefined",N1=!cd&&typeof btoa=="function";function H1(e){if(!N1){var t;t===void 0&&(t=0),P1(),t=O1[t];var i=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var r=e[c],s=e[c+1],o=e[c+2],a=t[r>>2];r=t[(3&r)<<4|s>>4],s=t[(15&s)<<2|o>>6],o=t[63&o],i[l++]=a+r+s+o}switch(a=0,o=n,e.length-c){case 2:o=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],i[l]=t[e>>2]+t[(3&e)<<4|a>>4]+o+n}return i.join("")}for(t="",i=0,n=e.length-10240;i<n;)t+=String.fromCharCode.apply(null,e.subarray(i,i+=10240));return t+=String.fromCharCode.apply(null,i?e.subarray(i):e),btoa(t)}const U1=/[-_.]/g,hd={"-":"+",_:"/",".":"="};function dd(e){return hd[e]||""}function V1(e){if(!N1)return ld(e);U1.test(e)&&(e=e.replace(U1,dd)),e=atob(e);const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function ei(e){return $1&&e!=null&&e instanceof Uint8Array}var bi={};function ti(){return ud||(ud=new Et(null,bi))}function ks(e){j1(bi);var t=e.g;return(t=t==null||ei(t)?t:typeof t=="string"?V1(t):null)==null?t:e.g=t}var Et=class{h(){return new Uint8Array(ks(this)||0)}constructor(e,t){if(j1(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let ud,As;function j1(e){if(e!==bi)throw Error("illegal external caller")}function G1(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Ss(e){return G1(e=Error(e),"warning"),e}function Ms(e){if(e!=null){var t=As!=null?As:As={},i=t[e]||0;i>=5||(t[e]=i+1,G1(e=Error(),"incident"),function(n){vi.setTimeout(()=>{throw n},0)}(e))}}var Vn=typeof Symbol=="function"&&typeof Symbol()=="symbol";function wi(e,t,i=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?i&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var pd=wi("jas",void 0,!0),z1=wi(void 0,"0di"),cn=wi(void 0,"1oa"),yi=wi(void 0,Symbol()),fd=wi(void 0,"0actk"),Z1=wi(void 0,"8utk");const k=Vn?pd:"Ea",q1={Ea:{value:0,configurable:!0,writable:!0,enumerable:!1}},W1=Object.defineProperties;function jn(e,t){Vn||k in e||W1(e,q1),e[k]|=t}function me(e,t){Vn||k in e||W1(e,q1),e[k]=t}function _i(e){return jn(e,34),e}function md(e,t){me(t,-15615&(0|e))}function Ls(e,t){me(t,-15581&(34|e))}function Gn(){return typeof BigInt=="function"}function Be(e){return Array.prototype.slice.call(e)}var Ts,ln={};function zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function Is(e,t){if(e!=null){if(typeof e=="string")e=e?new Et(e,bi):ti();else if(e.constructor!==Et)if(ei(e))e=e.length?new Et(new Uint8Array(e),bi):ti();else{if(!t)throw Error();e=void 0}}return e}const X1=[];function Pt(e){if(2&e)throw Error()}me(X1,55),Ts=Object.freeze(X1);class Y1{constructor(t,i,n){this.g=t,this.h=i,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}function Fs(e){return yi?e[yi]:void 0}var gd=Object.freeze({});function Zn(e){return e.Na=!0,e}var vd=Zn(e=>typeof e=="number"),K1=Zn(e=>typeof e=="string"),bd=Zn(e=>typeof e=="boolean"),qn=typeof vi.BigInt=="function"&&typeof vi.BigInt(0)=="bigint";function $t(e){var t=e;if(K1(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(vd(t)&&!Number.isSafeInteger(t))throw Error(String(t));return qn?BigInt(e):e=bd(e)?e?"1":"0":K1(e)?e.trim()||"0":String(e)}var Bs=Zn(e=>qn?e>=yd&&e<=Cd:e[0]==="-"?J1(e,wd):J1(e,_d));const wd=Number.MIN_SAFE_INTEGER.toString(),yd=qn?BigInt(Number.MIN_SAFE_INTEGER):void 0,_d=Number.MAX_SAFE_INTEGER.toString(),Cd=qn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function J1(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let i=0;i<e.length;i++){const n=e[i],r=t[i];if(n>r)return!1;if(n<r)return!0}}const Ed=typeof Uint8Array.prototype.slice=="function";let Q1,q=0,oe=0;function ec(e){const t=e>>>0;q=t,oe=(e-t)/4294967296>>>0}function ii(e){if(e<0){ec(-e);const[t,i]=Ps(q,oe);q=t>>>0,oe=i>>>0}else ec(e)}function Ds(e){const t=Q1||(Q1=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),oe=0,q=t.getUint32(0,!0)}function Rs(e,t){const i=4294967296*t+(e>>>0);return Number.isSafeInteger(i)?i:hn(e,t)}function Os(e,t){const i=2147483648&t;return i&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Rs(e,t))=="number"?i?-e:e:i?"-"+e:e}function hn(e,t){if(e>>>=0,(t>>>=0)<=2097151)var i=""+(4294967296*t+e);else Gn()?i=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(i=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),i+=8147497*t,t*=2,e>=1e7&&(i+=e/1e7>>>0,e%=1e7),i>=1e7&&(t+=i/1e7>>>0,i%=1e7),i=t+tc(i)+tc(e));return i}function tc(e){return e=String(e),"0000000".slice(e.length)+e}function ic(){var e=q,t=oe;if(2147483648&t)if(Gn())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[i,n]=Ps(e,t);e="-"+hn(i,n)}else e=hn(e,t);return e}function Wn(e){if(e.length<16)ii(Number(e));else if(Gn())e=BigInt(e),q=Number(e&BigInt(4294967295))>>>0,oe=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");oe=q=0;const i=e.length;for(let n=t,r=(i-t)%6+t;r<=i;n=r,r+=6){const s=Number(e.slice(n,r));oe*=1e6,q=1e6*q+s,q>=4294967296&&(oe+=Math.trunc(q/4294967296),oe>>>=0,q>>>=0)}if(t){const[n,r]=Ps(q,oe);q=n,oe=r}}}function Ps(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}const dn=typeof BigInt=="function"?BigInt.asIntN:void 0,xd=typeof BigInt=="function"?BigInt.asUintN:void 0,Nt=Number.isSafeInteger,Xn=Number.isFinite,Ci=Math.trunc,kd=$t(0);function Ht(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function nc(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Ad=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function un(e){switch(typeof e){case"bigint":return!0;case"number":return Xn(e);case"string":return Ad.test(e);default:return!1}}function Ei(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Xn(e)?0|e:void 0}function rc(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Xn(e)?e>>>0:void 0}function sc(e){if(e[0]==="-")return!1;const t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function oc(e){const t=e.length;return e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337}function ac(e){return oc(e)?e:(Wn(e),ic())}function $s(e){return e=Ci(e),Nt(e)||(ii(e),e=Os(q,oe)),e}function cc(e){var t=Ci(Number(e));return Nt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),ac(e))}function lc(e){var t=Ci(Number(e));return Nt(t)?$t(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Gn()?$t(dn(64,BigInt(e))):$t(ac(e)))}function hc(e){if(Nt(e))e=$t($s(e));else{if(e=Ci(e),Nt(e))e=String(e);else{const t=String(e);oc(t)?e=t:(ii(e),e=ic())}e=$t(e)}return e}function Ns(e){return e==null?e:typeof e=="bigint"?(Bs(e)?e=Number(e):(e=dn(64,e),e=Bs(e)?Number(e):String(e)),e):un(e)?typeof e=="number"?$s(e):cc(e):void 0}function Sd(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(xd(64,e));if(un(e)){if(t==="string")return t=Ci(Number(e)),Nt(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),sc(e)||(Wn(e),e=hn(q,oe))),e;if(t==="number")return(e=Ci(e))>=0&&Nt(e)?e:function(i){if(i<0){ii(i);var n=hn(q,oe);return i=Number(n),Nt(i)?i:n}return sc(n=String(i))?n:(ii(i),Rs(q,oe))}(e)}}function dc(e){if(typeof e!="string")throw Error();return e}function xi(e){if(e!=null&&typeof e!="string")throw Error();return e}function ki(e){return e==null||typeof e=="string"?e:void 0}function Hs(e,t,i,n){if(e!=null&&typeof e=="object"&&e.W===ln)return e;if(!Array.isArray(e))return i?2&n?((e=t[z1])||(_i((e=new t).u),e=t[z1]=e),t=e):t=new t:t=void 0,t;let r=i=0|e[k];return r===0&&(r|=32&n),r|=2&n,r!==i&&me(e,r),new t(e)}function Md(e,t,i){if(t)e:{if(!un(t=e))throw Ss("int64");switch(typeof t){case"string":t=lc(t);break e;case"bigint":t=$t(dn(64,t));break e;default:t=hc(t)}}else e=typeof(t=e),t=t==null?t:e==="bigint"?$t(dn(64,t)):un(t)?e==="string"?lc(t):hc(t):void 0;return(e=t)==null?i?kd:void 0:e}function Ld(e){return e}const Td={};let Id=function(){try{return Un(new class extends Map{constructor(){super()}}),!1}catch(e){return!0}}();class Us{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,i){return this.g.set(t,i),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,i){return this.g.forEach(t,i)}[Symbol.iterator](){return this.entries()}}const Fd=Id?(Object.setPrototypeOf(Us.prototype,Map.prototype),Object.defineProperties(Us.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Us):class extends Map{constructor(){super()}};function uc(e){return e}function Vs(e){if(2&e.M)throw Error("Cannot mutate an immutable Map")}var ut=class extends Fd{constructor(e,t,i=uc,n=uc){super();let r=0|e[k];r|=64,me(e,r),this.M=r,this.I=t,this.S=i,this.X=this.I?Bd:n;for(let s=0;s<e.length;s++){const o=e[s],a=i(o[0],!1,!0);let c=o[1];t?c===void 0&&(c=null):c=n(o[1],!1,!0,void 0,void 0,r),super.set(a,c)}}La(){var e=$d;if(this.size!==0)return Array.from(super.entries(),t=>(t[0]=e(t[0]),t[1]=e(t[1]),t))}da(e=Dd){const t=[],i=super.entries();for(var n;!(n=i.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){Vs(this),super.clear()}delete(e){return Vs(this),super.delete(this.S(e,!0,!1))}entries(){if(this.I){var e=super.keys();e=new Y1(e,Rd,this)}else e=super.entries();return e}values(){if(this.I){var e=super.keys();e=new Y1(e,ut.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.I?super.forEach((i,n,r)=>{e.call(t,r.get(n),n,r)}):super.forEach(e,t)}set(e,t){return Vs(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.X(t,!0,!0,this.I,!1,this.M))}Ja(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.I?e===void 0?null:e:this.X(e,!1,!0,void 0,!1,this.M),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 i=this.I;return i?((i=this.X(t,!1,!0,i,this.pa,this.M))!==t&&super.set(e,i),i):t}}[Symbol.iterator](){return this.entries()}};function Bd(e,t,i,n,r,s){return e=Hs(e,n,i,s),r&&(e=Qn(e)),e}function Dd(e){return e}function Rd(e){return[e,this.get(e)]}let Od,Yn,pc,Pd;function fc(){return Od||(Od=new ut(_i([]),void 0,void 0,void 0,Td))}function js(e,t,i,n,r){if(e!=null){if(Array.isArray(e)){const s=0|e[k];return e.length===0&&1&s?void 0:r&&2&s?e:Kn(e,t,i,n!==void 0,r)}return t(e,n)}}function Kn(e,t,i,n,r){const s=n||i?0|e[k]:0,o=n?!!(32&s):void 0;let a=0;const c=(n=Be(e)).length;for(let f=0;f<c;f++){var l=n[f];if(f===c-1&&zn(l)){var d=t,h=i,u=o,p=r;let m;for(let v in l){const g=js(l[v],d,h,u,p);g!=null&&((m!=null?m:m={})[v]=g)}l=m}else l=js(n[f],t,i,o,r);n[f]=l,l!=null&&(a=f+1)}return a<c&&(n.length=a),i&&((e=Fs(e))&&(n[yi]=Be(e)),i(s,n)),n}function $d(e){return js(e,Gs,void 0,void 0,!1)}function Gs(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Bs(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(ei(e))return ei(e)&&Ms(Z1),H1(e);if(e.W===ln)return mc(e);if(e instanceof Et){const t=e.g;return t==null?"":typeof t=="string"?t:e.g=H1(t)}return e instanceof ut?e.La():void 0}return e}function mc(e){var t=e.u;e=Kn(t,Gs,void 0,void 0,!1);var i=0|t[k];if((t=e.length)&&!(512&i)){var n=e[t-1],r=!1;zn(n)?(t--,r=!0):n=void 0;var s=t-(i=512&i?0:-1),o=(Yn!=null?Yn:Ld)(s,i,e,n);if(n&&(e[t]=void 0),s<o&&n){for(var a in s=!0,n){const c=+a;c<=o?(e[r=c+i]=n[a],t=Math.max(r+1,t),r=!1,delete n[a]):s=!1}s&&(n=void 0)}for(s=t-1;t>0;s=t-1)if((a=e[s])==null)t--,r=!0;else{if(!((s-=i)>=o))break;(n!=null?n:n={})[s]=a,t--,r=!0}r&&(e.length=t),n&&e.push(n)}return e}function Ut(e,t,i){return e=gc(e,t[0],t[1],i?1:2),t!==pc&&i&&jn(e,8192),e}function gc(e,t,i,n){if(e==null){var r=96;i?(e=[i],r|=512):e=[],t&&(r=-16760833&r|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(8192&(r=0|e[k])||!(64&r)||2&r||Ms(fd),1024&r)throw Error("farr");if(64&r)return e;if(n===1||n===2||(r|=64),i&&(r|=512,i!==e[0]))throw Error("mid");e:{var s=(i=e).length;if(s){var o=s-1;if(zn(n=i[o])){if((o-=t=512&(r|=256)?0:-1)>=1024)throw Error("pvtlmt");for(var a in n)(s=+a)<o&&(i[s+t]=n[a],delete n[a]);r=-16760833&r|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,s-(512&r?0:-1)))>1024)throw Error("spvt");r=-16760833&r|(1023&a)<<14}}}return me(e,r),e}function zs(e,t,i=Ls){if(e!=null){if($1&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[k];return 2&n?e:(t&&(t=n===0||!!(32&n)&&!(64&n||!(16&n))),t?(me(e,34|n),4&n&&Object.freeze(e),e):Kn(e,zs,4&n?Ls:i,!0,!0))}return e.W===ln?e=2&(n=0|(i=e.u)[k])?e:new e.constructor(Jn(i,n,!0)):e instanceof ut&&!(2&e.M)&&(i=_i(e.da(zs)),e=new ut(i,e.I,e.S,e.X)),e}}function Jn(e,t,i){const n=i||2&t?Ls:md,r=!!(32&t);return e=function(s,o,a){const c=Be(s);var l=c.length;const d=256&o?c[l-1]:void 0;for(l+=d?-1:0,o=512&o?1:0;o<l;o++)c[o]=a(c[o]);if(d){o=c[o]={};for(const h in d)o[h]=a(d[h])}return(s=Fs(s))&&(c[yi]=Be(s)),c}(e,t,s=>zs(s,r,n)),jn(e,32|(i?2:0)),e}function Qn(e){const t=e.u,i=0|t[k];return 2&i?new e.constructor(Jn(t,i,!1)):e}function Ai(e,t){return xt(e=e.u,0|e[k],t)}function xt(e,t,i){if(i===-1)return null;const n=i+(512&t?0:-1),r=e.length-1;return n>=r&&256&t?e[r][i]:n<=r?e[n]:void 0}function W(e,t,i){const n=e.u;let r=0|n[k];return Pt(r),ne(n,r,t,i),e}function ne(e,t,i,n){const r=512&t?0:-1,s=i+r;var o=e.length-1;return s>=o&&256&t?(e[o][i]=n,t):s<=o?(e[s]=n,t):(n!==void 0&&(i>=(o=t>>14&1023||536870912)?n!=null&&(e[o+r]={[i]:n},me(e,t|=256)):e[s]=n),t)}function er(e,t){let i=0|(e=e.u)[k];const n=xt(e,i,t),r=Ht(n);return r!=null&&r!==n&&ne(e,i,t,r),r}function vc(e){let t=0|(e=e.u)[k];const i=xt(e,t,1),n=Is(i,!0);return n!=null&&n!==i&&ne(e,t,1,n),n}function ni(){return gd===void 0?2:4}function ri(e,t,i,n,r){const s=e.u,o=2&(e=0|s[k])?1:n;r=!!r;let a=0|(n=Zs(s,e,t))[k];if(!(4&a)){4&a&&(n=Be(n),a=St(a,e),e=ne(s,e,t,n));let c=0,l=0;for(;c<n.length;c++){const d=i(n[c]);d!=null&&(n[l++]=d)}l<c&&(n.length=l),a=qs(a,e),i=-2049&(20|a),a=i&=-4097,me(n,a),2&a&&Object.freeze(n)}return o===1||o===4&&32&a?kt(a)||(r=a,a|=2,a!==r&&me(n,a),Object.freeze(n)):(o===2&&kt(a)&&(n=Be(n),a=St(a,e),a=Vt(a,e,r),me(n,a),e=ne(s,e,t,n)),kt(a)||(t=a,a=Vt(a,e,r),a!==t&&me(n,a))),n}function Zs(e,t,i){return e=xt(e,t,i),Array.isArray(e)?e:Ts}function qs(e,t){return e===0&&(e=St(e,t)),1|e}function kt(e){return!!(2&e)&&!!(4&e)||!!(1024&e)}function bc(e){e=Be(e);for(let t=0;t<e.length;t++){const i=e[t]=Be(e[t]);Array.isArray(i[1])&&(i[1]=_i(i[1]))}return e}function Ws(e,t,i,n){let r=0|(e=e.u)[k];Pt(r),ne(e,r,t,(n==="0"?Number(i)===0:i===n)?void 0:i)}function Si(e,t,i,n){Pt(t);let r=Zs(e,t,i);const s=r!==Ts;if(64&t||!(8192&t)||!s){const o=s?0|r[k]:0;let a=o;(!s||2&a||kt(a)||4&a&&!(32&a))&&(r=Be(r),a=St(a,t),t=ne(e,t,i,r)),a=-13&qs(a,t),a=Vt(n?-17&a:16|a,t,!0),a!==o&&me(r,a)}return r}function Xs(e,t){var i=bl;return Ks(Ys(e=e.u),e,0|e[k],i)===t?t:-1}function Ys(e){var i;if(Vn)return(i=e[cn])!=null?i:e[cn]=new Map;if(cn in e)return e[cn];const t=new Map;return Object.defineProperty(e,cn,{value:t}),t}function wc(e,t,i,n){const r=Ys(e),s=Ks(r,e,t,i);return s!==n&&(s&&(t=ne(e,t,s)),r.set(i,n)),t}function Ks(e,t,i,n){let r=e.get(n);if(r!=null)return r;r=0;for(let s=0;s<n.length;s++){const o=n[s];xt(t,i,o)!=null&&(r!==0&&(i=ne(t,i,r)),r=o)}return e.set(n,r),r}function Js(e,t,i){let n=0|e[k];const r=xt(e,n,i);let s;if(r!=null&&r.W===ln)return(t=Qn(r))!==r&&ne(e,n,i,t),t.u;if(Array.isArray(r)){const o=0|r[k];s=2&o?Ut(Jn(r,o,!1),t,!0):64&o?r:Ut(s,t,!0)}else s=Ut(void 0,t,!0);return s!==r&&ne(e,n,i,s),s}function yc(e,t,i){let n=0|(e=e.u)[k];const r=xt(e,n,i);return(t=Hs(r,t,!1,n))!==r&&t!=null&&ne(e,n,i,t),t}function N(e,t,i){if((t=yc(e,t,i))==null)return t;let n=0|(e=e.u)[k];if(!(2&n)){const r=Qn(t);r!==t&&ne(e,n,i,t=r)}return t}function _c(e,t,i,n,r,s,o){e=e.u;var a=!!(2&t);const c=a?1:r;s=!!s,o&&(o=!a);var l=0|(r=Zs(e,t,n))[k];if(!(a=!!(4&l))){var d=r,h=t;const u=!!(2&(l=qs(l,t)));u&&(h|=2);let p=!u,f=!0,m=0,v=0;for(;m<d.length;m++){const g=Hs(d[m],i,!1,h);if(g instanceof i){if(!u){const b=!!(2&(0|g.u[k]));p&&(p=!b),f&&(f=b)}d[v++]=g}}v<m&&(d.length=v),l|=4,l=f?16|l:-17&l,me(d,l=p?8|l:-9&l),u&&Object.freeze(d)}if(o&&!(8&l||!r.length&&(c===1||c===4&&32&l))){for(kt(l)&&(r=Be(r),l=St(l,t),t=ne(e,t,n,r)),i=r,o=l,d=0;d<i.length;d++)(l=i[d])!==(h=Qn(l))&&(i[d]=h);o|=8,me(i,o=i.length?-17&o:16|o),l=o}return c===1||c===4&&32&l?kt(l)||(t=l,(l|=!r.length||16&l&&(!a||32&l)?2:1024)!==t&&me(r,l),Object.freeze(r)):(c===2&&kt(l)&&(me(r=Be(r),l=Vt(l=St(l,t),t,s)),t=ne(e,t,n,r)),kt(l)||(n=l,(l=Vt(l,t,s))!==n&&me(r,l))),r}function At(e,t,i){const n=0|e.u[k];return _c(e,n,t,i,ni(),!1,!(2&n))}function S(e,t,i,n){return n==null&&(n=void 0),W(e,i,n)}function pn(e,t,i,n){n==null&&(n=void 0);e:{let r=0|(e=e.u)[k];if(Pt(r),n==null){const s=Ys(e);if(Ks(s,e,r,i)!==t)break e;s.set(i,0)}else r=wc(e,r,i,t);ne(e,r,t,n)}}function St(e,t){return-1025&(e=32|(2&t?2|e:-3&e))}function Vt(e,t,i){return 32&t&&i||(e&=-33),e}function tr(e,t,i){Pt(0|e.u[k]),ri(e,t,ki,2,!0).push(dc(i))}function ir(e,t,i,n){const r=0|e.u[k];Pt(r),e=_c(e,r,i,t,2,!0),n=n!=null?n:new i,e.push(n),e[k]=2&(0|n.u[k])?-9&e[k]:-17&e[k]}function Ye(e,t){return Ei(Ai(e,t))}function Ke(e,t){return ki(Ai(e,t))}function he(e,t){var i;return(i=er(e,t))!=null?i:0}function fn(e,t,i){if(i!=null&&typeof i!="boolean")throw e=typeof i,Error(`Expected boolean but got ${e!="object"?e:i?Array.isArray(i)?"array":e:"null"}: ${i}`);W(e,t,i)}function pt(e,t,i){if(i!=null){if(typeof i!="number"||!Xn(i))throw Ss("int32");i|=0}W(e,t,i)}function x(e,t,i){if(i!=null&&typeof i!="number")throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);W(e,t,i)}function nr(e,t,i){{const o=e.u;let a=0|o[k];if(Pt(a),i==null)ne(o,a,t);else{var n=e=0|i[k],r=kt(e),s=r||Object.isFrozen(i);for(r||(e=0),s||(i=Be(i),n=0,e=Vt(e=St(e,a),a,!0),s=!1),e|=21,r=0;r<i.length;r++){const c=i[r],l=dc(c);Object.is(c,l)||(s&&(i=Be(i),n=0,e=Vt(e=St(e,a),a,!0),s=!1),i[r]=l)}e!==n&&(s&&(i=Be(i),e=Vt(e=St(e,a),a,!0)),me(i,e)),ne(o,a,t,i)}}}function Cc(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Qs(){return Error("Failed to read varint, encoding is invalid.")}function Ec(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function eo(e){if(typeof e=="string")return{buffer:V1(e),O:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Uint8Array)return{buffer:e,O:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Et)return{buffer:ks(e)||new Uint8Array(0),O:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function to(e,t){let i,n=0,r=0,s=0;const o=e.h;let a=e.g;do i=o[a++],n|=(127&i)<<s,s+=7;while(s<32&&128&i);for(s>32&&(r|=(127&i)>>4),s=3;s<32&&128&i;s+=7)i=o[a++],r|=(127&i)<<s;if(si(e,a),i<128)return t(n>>>0,r>>>0);throw Qs()}function io(e){let t=0,i=e.g;const n=i+10,r=e.h;for(;i<n;){const s=r[i++];if(t|=s,(128&s)==0)return si(e,i),!!(127&t)}throw Qs()}function jt(e){const t=e.h;let i=e.g,n=t[i++],r=127&n;if(128&n&&(n=t[i++],r|=(127&n)<<7,128&n&&(n=t[i++],r|=(127&n)<<14,128&n&&(n=t[i++],r|=(127&n)<<21,128&n&&(n=t[i++],r|=n<<28,128&n&&128&t[i++]&&128&t[i++]&&128&t[i++]&&128&t[i++]&&128&t[i++])))))throw Qs();return si(e,i),r}function Mt(e){return jt(e)>>>0}function no(e){var t=e.h;const i=e.g,n=t[i],r=t[i+1],s=t[i+2];return t=t[i+3],si(e,e.g+4),(n<<0|r<<8|s<<16|t<<24)>>>0}function ro(e){var t=no(e);e=2*(t>>31)+1;const i=t>>>23&255;return t&=8388607,i==255?t?NaN:e*(1/0):i==0?1401298464324817e-60*e*t:e*Math.pow(2,i-150)*(t+8388608)}function Nd(e){return jt(e)}function so(e,t,{aa:i=!1}={}){e.aa=i,t&&(t=eo(t),e.h=t.buffer,e.m=t.O,e.j=0,e.l=e.h.length,e.g=e.j)}function si(e,t){if(e.g=t,t>e.l)throw Ec(e.l,t)}function xc(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);const i=e.g,n=i+t;if(n>e.l)throw Ec(t,e.l-i);return e.g=n,i}function kc(e,t){if(t==0)return ti();var i=xc(e,t);return e.aa&&e.m?i=e.h.subarray(i,i+t):(e=e.h,i=i===(t=i+t)?new Uint8Array(0):Ed?e.slice(i,t):new Uint8Array(e.subarray(i,t))),i.length==0?ti():new Et(i,bi)}ut.prototype.toJSON=void 0;var Ac=[];function Sc(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var i=Mt(e.g);if(t=i>>>3,!((i&=7)>=0&&i<=5))throw Cc(i,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=i,!0}function rr(e){switch(e.h){case 0:e.h!=0?rr(e):io(e.g);break;case 1:si(e=e.g,e.g+8);break;case 2:if(e.h!=2)rr(e);else{var t=Mt(e.g);si(e=e.g,e.g+t)}break;case 5:si(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Sc(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}rr(e)}break;default:throw Cc(e.h,e.l)}}function mn(e,t,i){const n=e.g.l,r=Mt(e.g),s=e.g.g+r;let o=s-n;if(o<=0&&(e.g.l=s,i(t,e,void 0,void 0,void 0),o=s-e.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${r} bytes, instead read ${r-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=n,t}function oo(e){var t=Mt(e.g),i=xc(e=e.g,t);if(e=e.h,sd){var n,r=e;(n=ws)||(n=ws=new TextDecoder("utf-8",{fatal:!0})),t=i+t,r=i===0&&t===r.length?r:r.subarray(i,t);try{var s=n.decode(r)}catch(a){if(Nn===void 0){try{n.decode(new Uint8Array([128]))}catch(c){}try{n.decode(new Uint8Array([97])),Nn=!0}catch(c){Nn=!1}}throw!Nn&&(ws=void 0),a}}else{t=(s=i)+t,i=[];let a,c=null;for(;s<t;){var o=e[s++];o<128?i.push(o):o<224?s>=t?Qt():(a=e[s++],o<194||(192&a)!=128?(s--,Qt()):i.push((31&o)<<6|63&a)):o<240?s>=t-1?Qt():(a=e[s++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(n=e[s++]))!=128?(s--,Qt()):i.push((15&o)<<12|(63&a)<<6|63&n)):o<=244?s>=t-2?Qt():(a=e[s++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(n=e[s++]))!=128||(192&(r=e[s++]))!=128?(s--,Qt()):(o=(7&o)<<18|(63&a)<<12|(63&n)<<6|63&r,o-=65536,i.push(55296+(o>>10&1023),56320+(1023&o)))):Qt(),i.length>=8192&&(c=I1(c,i),i.length=0)}s=I1(c,i)}return s}function Mc(e){const t=Mt(e.g);return kc(e.g,t)}function sr(e,t,i){var n=Mt(e.g);for(n=e.g.g+n;e.g.g<n;)i.push(t(e.g))}var or=[];function at(e,t,i){t.g?t.m(e,t.g,t.h,i):t.m(e,t.h,i)}var C=class{constructor(e,t){this.u=gc(e,t)}toJSON(){try{var e=mc(this)}finally{Yn=void 0}return e}l(){var e=_0;return e.g?e.l(this,e.g,e.h):e.l(this,e.h,e.defaultValue)}clone(){const e=this.u;return new this.constructor(Jn(e,0|e[k],!1))}O(){return!!(2&(0|this.u[k]))}};function Lc(e){return e?/^\d+$/.test(e)?(Wn(e),new ao(q,oe)):null:Hd||(Hd=new ao(0,0))}C.prototype.W=ln,C.prototype.toString=function(){return this.u.toString()};var ao=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Hd;function Tc(e){return e?/^-?\d+$/.test(e)?(Wn(e),new co(q,oe)):null:Ud||(Ud=new co(0,0))}var co=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Ud;function Mi(e,t,i){for(;i>0||t>127;)e.g.push(127&t|128),t=(t>>>7|i<<25)>>>0,i>>>=7;e.g.push(t)}function Li(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ar(e,t){if(t>=0)Li(e,t);else{for(let i=0;i<9;i++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function gn(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Ti(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function $e(e,t,i){Li(e.g,8*t+i)}function lo(e,t){return $e(e,t,2),t=e.g.end(),Ti(e,t),t.push(e.h),t}function ho(e,t){var i=t.pop();for(i=e.h+e.g.length()-i;i>127;)t.push(127&i|128),i>>>=7,e.h++;t.push(i),e.h++}function cr(e,t,i){$e(e,t,2),Li(e.g,i.length),Ti(e,e.g.end()),Ti(e,i)}function lr(e,t,i,n){i!=null&&(t=lo(e,t),n(i,e),ho(e,t))}function ct(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var uo=ct(),Ic=ct(),po=ct(),fo=ct(),Fc=ct(),Bc=ct(),mo=ct(),Dc=ct(),Rc=ct(),Ii=class{constructor(e,t,i){this.g=e,this.h=t,e=uo,this.l=!!e&&i===e||!1}};function hr(e,t){return new Ii(e,t,uo)}function Oc(e,t,i,n,r){lr(e,i,Hc(t,n),r)}const Vd=hr(function(e,t,i,n,r){return e.h===2&&(mn(e,Js(t,n,i),r),!0)},Oc),jd=hr(function(e,t,i,n,r){return e.h===2&&(mn(e,Js(t,n,i),r),!0)},Oc);var dr=Symbol(),go=Symbol(),Pc=Symbol(),$c=Symbol();let ur,pr;function oi(e,t,i,n){var r=n[e];if(r)return r;(r={}).Ma=n,r.T=function(h){switch(typeof h){case"boolean":return pc||(pc=[0,void 0,!0]);case"number":return h>0?void 0:h===0?Pd||(Pd=[0,void 0]):[-h,void 0];case"string":return[0,h];case"object":return h}}(n[0]);var s=n[1];let o=1;s&&s.constructor===Object&&(r.ga=s,typeof(s=n[++o])=="function"&&(r.la=!0,ur!=null||(ur=s),pr!=null||(pr=n[o+1]),s=n[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=n[++o]}for(c=1;s!==void 0;){let h;typeof s=="number"&&(c+=s,s=n[++o]);var l=void 0;if(s instanceof Ii?h=s:(h=Vd,o--),h==null?void 0:h.l){s=n[++o],l=n;var d=o;typeof s=="function"&&(s=s(),l[d]=s),l=s}for(d=c+1,typeof(s=n[++o])=="number"&&s<0&&(d-=s,s=n[++o]);c<d;c++){const u=a[c];l?i(r,c,h,l,u):t(r,c,h,u)}}return n[e]=r}function Nc(e){return Array.isArray(e)?e[0]instanceof Ii?e:[jd,e]:[e,void 0]}function Hc(e,t){return e instanceof C?e.u:Array.isArray(e)?Ut(e,t,!1):void 0}function vo(e,t,i,n){const r=i.g;e[t]=n?(s,o,a)=>r(s,o,a,n):r}function bo(e,t,i,n,r){const s=i.g;let o,a;e[t]=(c,l,d)=>s(c,l,d,a||(a=oi(go,vo,bo,n).T),o||(o=wo(n)),r)}function wo(e){let t=e[Pc];if(t!=null)return t;const i=oi(go,vo,bo,e);return t=i.la?(n,r)=>ur(n,r,i):(n,r)=>{const s=0|n[k];for(;Sc(r)&&r.h!=4;){var o=r.m,a=i[o];if(a==null){var c=i.ga;c&&(c=c[o])&&(c=Gd(c))!=null&&(a=i[o]=c)}a!=null&&a(r,n,o)||(o=(a=r).l,rr(a),a.fa?a=void 0:(c=a.g.g-o,a.g.g=o,a=kc(a.g,c)),o=n,a&&((c=o[yi])?c.push(a):o[yi]=[a]))}return 8192&s&&_i(n),!0},e[Pc]=t}function Gd(e){const t=(e=Nc(e))[0].g;if(e=e[1]){const i=wo(e),n=oi(go,vo,bo,e).T;return(r,s,o)=>t(r,s,o,n,i)}return t}function fr(e,t,i){e[t]=i.h}function mr(e,t,i,n){let r,s;const o=i.h;e[t]=(a,c,l)=>o(a,c,l,s||(s=oi(dr,fr,mr,n).T),r||(r=Uc(n)))}function Uc(e){let t=e[$c];if(!t){const i=oi(dr,fr,mr,e);t=(n,r)=>Vc(n,r,i),e[$c]=t}return t}function Vc(e,t,i){(function(n,r,s){const o=512&r?0:-1,a=n.length,c=a+((r=64&r?256&r:!!a&&zn(n[a-1]))?-1:0);for(let l=0;l<c;l++)s(l-o,n[l]);if(r){n=n[a-1];for(const l in n)!isNaN(l)&&s(+l,n[l])}})(e,0|e[k]|(i.T[1]?512:0),(n,r)=>{if(r!=null){var s=function(o,a){var c=o[a];if(c)return c;if((c=o.ga)&&(c=c[a])){var l=(c=Nc(c))[0].h;if(c=c[1]){const d=Uc(c),h=oi(dr,fr,mr,c).T;c=o.la?pr(h,d):(u,p,f)=>l(u,p,f,h,d)}else c=l;return o[a]=c}}(i,n);s&&s(t,r,n)}}),(e=Fs(e))&&function(n,r){Ti(n,n.g.end());for(let s=0;s<r.length;s++)Ti(n,ks(r[s])||new Uint8Array(0))}(t,e)}function Fi(e,t){if(Array.isArray(t)){var i=0|t[k];if(4&i)return t;for(var n=0,r=0;n<t.length;n++){const s=e(t[n]);s!=null&&(t[r++]=s)}return r<n&&(t.length=r),me(t,-6145&(5|i)),2&i&&Object.freeze(t),t}}function Se(e,t,i){return new Ii(e,t,i)}function Bi(e,t,i){return new Ii(e,t,i)}function Me(e,t,i){ne(e,0|e[k],t,i)}var zd=hr(function(e,t,i,n,r){return e.h===2&&(e=mn(e,Ut([void 0,void 0],n,!0),r),Pt(n=0|t[k]),(r=xt(t,n,i))instanceof ut?(2&r.M)!=0?((r=r.da()).push(e),ne(t,n,i,r)):r.Ja(e):Array.isArray(r)?(2&(0|r[k])&&ne(t,n,i,r=bc(r)),r.push(e)):ne(t,n,i,[e]),!0)},function(e,t,i,n,r){if(t instanceof ut)t.forEach((s,o)=>{lr(e,i,Ut([o,s],n,!1),r)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){const o=t[s];Array.isArray(o)&&lr(e,i,Ut(o,n,!1),r)}});function jc(e,t,i){if(t=function(n){if(n==null)return n;const r=typeof n;if(r==="bigint")return String(dn(64,n));if(un(n)){if(r==="string")return cc(n);if(r==="number")return $s(n)}}(t),t!=null&&(typeof t=="string"&&Tc(t),t!=null))switch($e(e,i,0),typeof t){case"number":e=e.g,ii(t),Mi(e,q,oe);break;case"bigint":i=BigInt.asUintN(64,t),i=new co(Number(i&BigInt(4294967295)),Number(i>>BigInt(32))),Mi(e.g,i.h,i.g);break;default:i=Tc(t),Mi(e.g,i.h,i.g)}}function Gc(e,t,i){(t=Ei(t))!=null&&t!=null&&($e(e,i,0),ar(e.g,t))}function zc(e,t,i){(t=nc(t))!=null&&($e(e,i,0),e.g.g.push(t?1:0))}function Zc(e,t,i){(t=ki(t))!=null&&cr(e,i,F1(t))}function qc(e,t,i,n,r){lr(e,i,Hc(t,n),r)}function Wc(e,t,i){t==null||typeof t=="string"||t instanceof Et||(ei(t)?ei(t)&&Ms(Z1):t=void 0),t!=null&&cr(e,i,eo(t).buffer)}function Xc(e,t,i){return(e.h===5||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,ro,t):t.push(ro(e.g)),!0)}var Lt=Se(function(e,t,i){if(e.h!==1)return!1;var n=e.g;e=no(n);const r=no(n);n=2*(r>>31)+1;const s=r>>>20&2047;return e=4294967296*(1048575&r)+e,Me(t,i,s==2047?e?NaN:n*(1/0):s==0?5e-324*n*e:n*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,i){(t=Ht(t))!=null&&($e(e,i,1),e=e.g,(i=Q1||(Q1=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),q=i.getUint32(0,!0),oe=i.getUint32(4,!0),gn(e,q),gn(e,oe))},ct()),ge=Se(function(e,t,i){return e.h===5&&(Me(t,i,ro(e.g)),!0)},function(e,t,i){(t=Ht(t))!=null&&($e(e,i,5),e=e.g,Ds(t),gn(e,q))},mo),Zd=Bi(Xc,function(e,t,i){if((t=Fi(Ht,t))!=null)for(let o=0;o<t.length;o++){var n=e,r=i,s=t[o];s!=null&&($e(n,r,5),n=n.g,Ds(s),gn(n,q))}},mo),yo=Bi(Xc,function(e,t,i){if((t=Fi(Ht,t))!=null&&t.length){$e(e,i,2),Li(e.g,4*t.length);for(let n=0;n<t.length;n++)i=e.g,Ds(t[n]),gn(i,q)}},mo),Gt=Se(function(e,t,i){return e.h===0&&(Me(t,i,to(e.g,Os)),!0)},jc,Bc),_o=Se(function(e,t,i){return e.h===0&&(Me(t,i,(e=to(e.g,Os))===0?void 0:e),!0)},jc,Bc),qd=Se(function(e,t,i){return e.h===0&&(Me(t,i,to(e.g,Rs)),!0)},function(e,t,i){if((t=Sd(t))!=null&&(typeof t=="string"&&Lc(t),t!=null))switch($e(e,i,0),typeof t){case"number":e=e.g,ii(t),Mi(e,q,oe);break;case"bigint":i=BigInt.asUintN(64,t),i=new ao(Number(i&BigInt(4294967295)),Number(i>>BigInt(32))),Mi(e.g,i.h,i.g);break;default:i=Lc(t),Mi(e.g,i.h,i.g)}},ct()),ae=Se(function(e,t,i){return e.h===0&&(Me(t,i,jt(e.g)),!0)},Gc,fo),gr=Bi(function(e,t,i){return(e.h===0||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,jt,t):t.push(jt(e.g)),!0)},function(e,t,i){if((t=Fi(Ei,t))!=null&&t.length){i=lo(e,i);for(let n=0;n<t.length;n++)ar(e.g,t[n]);ho(e,i)}},fo),Di=Se(function(e,t,i){return e.h===0&&(Me(t,i,(e=jt(e.g))===0?void 0:e),!0)},Gc,fo),Q=Se(function(e,t,i){return e.h===0&&(Me(t,i,io(e.g)),!0)},zc,Ic),Ri=Se(function(e,t,i){return e.h===0&&(Me(t,i,(e=io(e.g))===!1?void 0:e),!0)},zc,Ic),ke=Bi(function(e,t,i){return e.h===2&&(e=oo(e),Si(t,0|t[k],i,!1).push(e),!0)},function(e,t,i){if((t=Fi(ki,t))!=null)for(let o=0;o<t.length;o++){var n=e,r=i,s=t[o];s!=null&&cr(n,r,F1(s))}},po),zt=Se(function(e,t,i){return e.h===2&&(Me(t,i,(e=oo(e))===""?void 0:e),!0)},Zc,po),j=Se(function(e,t,i){return e.h===2&&(Me(t,i,oo(e)),!0)},Zc,po),we=function(e,t,i=uo){return new Ii(e,t,i)}(function(e,t,i,n,r){return e.h===2&&(n=Ut(void 0,n,!0),Si(t,0|t[k],i,!0).push(n),mn(e,n,r),!0)},function(e,t,i,n,r){if(Array.isArray(t))for(let s=0;s<t.length;s++)qc(e,t[s],i,n,r)}),G=hr(function(e,t,i,n,r,s){return e.h===2&&(wc(t,0|t[k],s,i),mn(e,t=Js(t,n,i),r),!0)},qc),Yc=Se(function(e,t,i){return e.h===2&&(Me(t,i,Mc(e)),!0)},Wc,Dc),Wd=Bi(function(e,t,i){return(e.h===0||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,Mt,t):t.push(Mt(e.g)),!0)},function(e,t,i){if((t=Fi(rc,t))!=null)for(let o=0;o<t.length;o++){var n=e,r=i,s=t[o];s!=null&&($e(n,r,0),Li(n.g,s))}},Fc),Xd=Se(function(e,t,i){return e.h===0&&(Me(t,i,(e=Mt(e.g))===0?void 0:e),!0)},function(e,t,i){(t=rc(t))!=null&&t!=null&&($e(e,i,0),Li(e.g,t))},Fc),Ne=Se(function(e,t,i){return e.h===0&&(Me(t,i,jt(e.g)),!0)},function(e,t,i){(t=Ei(t))!=null&&(t=parseInt(t,10),$e(e,i,0),ar(e.g,t))},Rc);class Yd{constructor(t,i){this.h=t,this.g=i,this.l=N,this.m=S,this.defaultValue=void 0}register(){Un(this)}}function lt(e,t){return new Yd(e,t)}function Zt(e,t){return(i,n)=>{if(or.length){const s=or.pop();s.o(n),so(s.g,i,n),i=s}else i=new class{constructor(s,o){if(Ac.length){const a=Ac.pop();so(a,s,o),s=a}else s=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,so(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(s,o);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(o)}o({fa:s=!1}={}){this.fa=s}}(i,n);try{const s=new e,o=s.u;wo(t)(o,i);var r=s}finally{i.g.clear(),i.m=-1,i.h=-1,or.length<100&&or.push(i)}return r}}function vr(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}}}};Vc(this.u,t,oi(dr,fr,mr,e)),Ti(t,t.g.end());const i=new Uint8Array(t.h),n=t.l,r=n.length;let s=0;for(let o=0;o<r;o++){const a=n[o];i.set(a,s),s+=a.length}return t.l=[i],i}}var Kc=class extends C{constructor(e){super(e)}},Jc=[0,zt,Se(function(e,t,i){return e.h===2&&(Me(t,i,(e=Mc(e))===ti()?void 0:e),!0)},function(e,t,i){if(t!=null){if(t instanceof C){const n=t.Oa;return void(n&&(t=n(t),t!=null&&cr(e,i,eo(t).buffer)))}if(Array.isArray(t))return}Wc(e,t,i)},Dc)];let Co,Qc=globalThis.trustedTypes;function el(e){Co===void 0&&(Co=function(){let i=null;if(!Qc)return i;try{const n=r=>r;i=Qc.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch(n){}return i}());var t=Co;return new class{constructor(i){this.g=i}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Kd(e,...t){if(t.length===0)return el(e[0]);let i=e[0];for(let n=0;n<t.length;n++)i+=encodeURIComponent(t[n])+e[n+1];return el(i)}var tl=[0,ae,Ne,Q,-1,gr,Ne,-1],Jd=class extends C{constructor(e){super(e)}},il=[0,Q,j,Q,Ne,-1,Bi(function(e,t,i){return(e.h===0||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,Nd,t):t.push(jt(e.g)),!0)},function(e,t,i){if((t=Fi(Ei,t))!=null&&t.length){i=lo(e,i);for(let n=0;n<t.length;n++)ar(e.g,t[n]);ho(e,i)}},Rc),j,-1,[0,Q,-1],Ne,Q,-1],nl=[0,j,-2],rl=class extends C{constructor(e){super(e)}},sl=[0],ol=[0,ae,Q,1,Q,-3],He=class extends C{constructor(e){super(e,2)}},ve={};ve[336783863]=[0,j,Q,-1,ae,[0,[1,2,3,4,5,6,7,8,9],G,sl,G,il,G,nl,G,ol,G,tl,G,[0,j,-2],G,[0,j,Ne],G,[0,Ne,j,-1],G,[0,Ne,-1]],[0,j],Q,[0,[1,3],[2,4],G,[0,gr],-1,G,[0,ke],-1,we,[0,j,-1]],j];var al=[0,_o,-1,Ri,-3,_o,gr,zt,Di,_o,-1,Ri,Di,Ri,-2,zt];function Ue(e,t){Ws(e,2,xi(t),"")}function X(e,t){tr(e,3,t)}function $(e,t){tr(e,4,t)}var Le=class extends C{constructor(e){super(e,500)}o(e){return S(this,0,7,e)}},vn=[-1,{}],cl=[0,j,1,vn],ll=[0,j,ke,vn];function Ve(e,t){ir(e,1,Le,t)}function Y(e,t){tr(e,10,t)}function H(e,t){tr(e,15,t)}var De=class extends C{constructor(e){super(e,500)}o(e){return S(this,0,1001,e)}},hl=[-500,we,[-500,zt,-1,ke,-3,[-2,ve,Q],we,Jc,Di,-1,cl,ll,we,[0,zt,Ri],zt,al,Di,ke,987,ke],4,we,[-500,j,-1,[-1,{}],998,j],we,[-500,j,ke,-1,[-2,{},Q],997,ke,-1],Di,we,[-500,j,ke,vn,998,ke],ke,Di,cl,ll,we,[0,zt,-1,vn],ke,-2,al,zt,-1,Ri,[0,Ri,Xd],978,vn,we,Jc];De.prototype.g=vr(hl);var Qd=Zt(De,hl),e0=class extends C{constructor(e){super(e)}},dl=class extends C{constructor(e){super(e)}g(){return At(this,e0,1)}},ul=[0,we,[0,ae,ge,j,-1]],br=Zt(dl,ul),t0=class extends C{constructor(e){super(e)}},i0=class extends C{constructor(e){super(e)}},Eo=class extends C{constructor(e){super(e)}h(){return N(this,t0,2)}g(){return At(this,i0,5)}},pl=Zt(class extends C{constructor(e){super(e)}},[0,ke,gr,yo,[0,Ne,[0,ae,-3],[0,ge,-3],[0,ae,-1,[0,we,[0,ae,-2]]],we,[0,ge,-1,j,ge]],j,-1,Gt,we,[0,ae,ge],ke,Gt]),fl=class extends C{constructor(e){super(e)}},Oi=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,ge,-4]]),ml=class extends C{constructor(e){super(e)}},bn=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,ge,-4]]),n0=class extends C{constructor(e){super(e)}},r0=[0,ae,-1,yo,Ne],gl=class extends C{constructor(e){super(e)}};gl.prototype.g=vr([0,ge,-4,Gt]);var s0=class extends C{constructor(e){super(e)}},o0=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,1,ae,j,ul],Gt]),vl=class extends C{constructor(e){super(e)}},a0=class extends C{constructor(e){super(e)}ma(){const e=vc(this);return e==null?ti():e}},c0=class extends C{constructor(e){super(e)}},bl=[1,2],l0=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,bl,G,[0,yo],G,[0,Yc],ae,j],Gt]),xo=class extends C{constructor(e){super(e)}},wl=[0,j,ae,ge,ke,-1],yl=class extends C{constructor(e){super(e)}},h0=[0,Q,-1],_l=class extends C{constructor(e){super(e)}},wr=[1,2,3,4,5],yr=class extends C{constructor(e){super(e)}g(){return vc(this)!=null}h(){return Ke(this,2)!=null}},ee=class extends C{constructor(e){super(e)}g(){var e;return(e=nc(Ai(this,2)))!=null?e:!1}},Cl=[0,Yc,j,[0,ae,Gt,-1],[0,qd,Gt]],de=[0,Cl,Q,[0,wr,G,ol,G,il,G,tl,G,sl,G,nl],Ne],_r=class extends C{constructor(e){super(e)}},ko=[0,de,ge,-1,ae],d0=lt(502141897,_r);ve[502141897]=ko;var u0=Zt(class extends C{constructor(e){super(e)}},[0,[0,Ne,-1,Zd,Wd],r0]),El=class extends C{constructor(e){super(e)}},xl=class extends C{constructor(e){super(e)}},Ao=[0,de,ge,[0,de],Q],kl=[0,de,ko,Ao,ge,[0,[0,Cl]]],p0=lt(508968150,xl);ve[508968150]=kl,ve[508968149]=Ao;var Al=class extends C{constructor(e){super(e)}},f0=lt(513916220,Al);ve[513916220]=[0,de,kl,ae];var Pi=class extends C{constructor(e){super(e)}h(){return N(this,xo,2)}g(){W(this,2)}},Sl=[0,de,wl];ve[478825465]=Sl;var m0=class extends C{constructor(e){super(e)}},Ml=class extends C{constructor(e){super(e)}},So=class extends C{constructor(e){super(e)}},Mo=class extends C{constructor(e){super(e)}},Ll=class extends C{constructor(e){super(e)}},Tl=[0,de,[0,de],Sl,-1],Il=[0,de,ge,ae],Lo=[0,de,ge],Fl=[0,de,Il,Lo,ge],g0=lt(479097054,Ll);ve[479097054]=[0,de,Fl,Tl],ve[463370452]=Tl,ve[464864288]=Il;var v0=lt(462713202,Mo);ve[462713202]=Fl,ve[474472470]=Lo;var b0=class extends C{constructor(e){super(e)}},Bl=class extends C{constructor(e){super(e)}},Dl=class extends C{constructor(e){super(e)}},Rl=class extends C{constructor(e){super(e)}},To=[0,de,ge,-1,ae],Io=[0,de,ge,Q];Rl.prototype.g=vr([0,de,Lo,[0,de],ko,Ao,To,Io]);var Ol=class extends C{constructor(e){super(e)}},w0=lt(456383383,Ol);ve[456383383]=[0,de,wl];var Pl=class extends C{constructor(e){super(e)}},y0=lt(476348187,Pl);ve[476348187]=[0,de,h0];var $l=class extends C{constructor(e){super(e)}},Nl=class extends C{constructor(e){super(e)}},Hl=[0,Ne,-1],_0=lt(458105876,class extends C{constructor(e){super(e)}g(){var e=this.u;const t=0|e[k],i=2&t;return e=function(n,r,s){var o=Nl;const a=2&r;let c=!1;if(s==null){if(a)return fc();s=[]}else if(s.constructor===ut){if((2&s.M)==0||a)return s;s=s.da()}else Array.isArray(s)?c=!!(2&(0|s[k])):s=[];if(a){if(!s.length)return fc();c||(c=!0,_i(s))}else c&&(c=!1,s=bc(s));return c||(64&(0|s[k])?s[k]&=-33:32&r&&jn(s,32)),ne(n,r,2,o=new ut(s,o,Md,void 0)),o}(e,t,xt(e,t,2)),!i&&Nl&&(e.pa=!0),e}});ve[458105876]=[0,Hl,zd,[!0,Gt,[0,j,-1,ke]]];var Fo=class extends C{constructor(e){super(e)}},Ul=lt(458105758,Fo);ve[458105758]=[0,de,j,Hl];var Vl=class extends C{constructor(e){super(e)}},C0=lt(443442058,Vl);ve[443442058]=[0,de,j,ae,ge,ke,-1,Q,ge],ve[514774813]=To;var jl=class extends C{constructor(e){super(e)}},E0=lt(516587230,jl);function Bo(e,t){return t=t?t.clone():new xo,e.displayNamesLocale!==void 0?W(t,1,xi(e.displayNamesLocale)):e.displayNamesLocale===void 0&&W(t,1),e.maxResults!==void 0?pt(t,2,e.maxResults):"maxResults"in e&&W(t,2),e.scoreThreshold!==void 0?x(t,3,e.scoreThreshold):"scoreThreshold"in e&&W(t,3),e.categoryAllowlist!==void 0?nr(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&W(t,4),e.categoryDenylist!==void 0?nr(t,5,e.categoryDenylist):"categoryDenylist"in e&&W(t,5),t}function Do(e,t=-1,i=""){return{categories:e.map(n=>{var r,s,o,a,c,l,d;return{index:(s=(r=Ye(n,1))!=null?r:0)!=null?s:-1,score:(o=he(n,2))!=null?o:0,categoryName:(c=(a=Ke(n,3))!=null?a:"")!=null?c:"",displayName:(d=(l=Ke(n,4))!=null?l:"")!=null?d:""}}),headIndex:t,headName:i}}function Gl(e){var o,a,c,l,d,h,u,p,f,m,v,g,b;var t=ri(e,3,Ht,ni()),i=ri(e,2,Ei,ni()),n=ri(e,1,ki,ni()),r=ri(e,9,ki,ni());const s={categories:[],keypoints:[]};for(let _=0;_<t.length;_++)s.categories.push({score:t[_],index:(o=i[_])!=null?o:-1,categoryName:(a=n[_])!=null?a:"",displayName:(c=r[_])!=null?c:""});if((t=(l=N(e,Eo,4))==null?void 0:l.h())&&(s.boundingBox={originX:(d=Ye(t,1))!=null?d:0,originY:(h=Ye(t,2))!=null?h:0,width:(u=Ye(t,3))!=null?u:0,height:(p=Ye(t,4))!=null?p:0,angle:0}),(f=N(e,Eo,4))==null?void 0:f.g().length)for(const _ of N(e,Eo,4).g())s.keypoints.push({x:(m=er(_,1))!=null?m:0,y:(v=er(_,2))!=null?v:0,score:(g=er(_,4))!=null?g:0,label:(b=Ke(_,3))!=null?b:""});return s}function Cr(e){var i,n,r,s;const t=[];for(const o of At(e,ml,1))t.push({x:(i=he(o,1))!=null?i:0,y:(n=he(o,2))!=null?n:0,z:(r=he(o,3))!=null?r:0,visibility:(s=he(o,4))!=null?s:0});return t}function wn(e){var i,n,r,s;const t=[];for(const o of At(e,fl,1))t.push({x:(i=he(o,1))!=null?i:0,y:(n=he(o,2))!=null?n:0,z:(r=he(o,3))!=null?r:0,visibility:(s=he(o,4))!=null?s:0});return t}function zl(e){return Array.from(e,t=>t>127?t-256:t)}function Zl(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let i=0,n=0,r=0;for(let s=0;s<e.length;s++)i+=e[s]*t[s],n+=e[s]*e[s],r+=t[s]*t[s];if(n<=0||r<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return i/Math.sqrt(n*r)}let Er;ve[516587230]=[0,de,To,Io,ge],ve[518928384]=Io;const x0=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]);function ql(){return M(this,null,function*(){if(Er===void 0)try{yield WebAssembly.instantiate(x0),Er=!0}catch(e){Er=!1}return Er})}function yn(i){return M(this,arguments,function*(e,t=Kd``){const n=(yield ql())?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}})}var ai=class{};function Wl(){var e=navigator;return typeof OffscreenCanvas!="undefined"&&(!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))}function Xl(e){return M(this,null,function*(){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((i,n)=>{t.addEventListener("load",()=>{i()},!1),t.addEventListener("error",r=>{n(r)},!1),document.body.appendChild(t)})}importScripts(e.toString())})}function Yl(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 A(e,t,i){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),i(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Kl(e,t,i){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(i?e.i._bindTextureToStream(i):e.i._bindTextureToCanvas(),!(i=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&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);const[n,r]=Yl(t);return!e.l||n===e.i.canvas.width&&r===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=r),[n,r]}function Jl(e,t,i){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let r=0;r<t.length;r++)n[r]=e.i.stringToNewUTF8(t[r]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),i(t);for(const r of n)e.i._free(r);e.i._free(t)}function ft(e,t,i){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=i}function qt(e,t,i){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(r,s,o)=>{s?(i(n,o),n=[]):n.push(r)}}ai.forVisionTasks=function(e){return yn("vision",e)},ai.forTextTasks=function(e){return yn("text",e)},ai.forGenAiExperimentalTasks=function(e){return yn("genai_experimental",e)},ai.forGenAiTasks=function(e){return yn("genai",e)},ai.forAudioTasks=function(e){return yn("audio",e)},ai.isSimdSupported=function(){return ql()};function k0(e,t,i,n){return M(this,null,function*(){return e=yield((r,s,o,a,c)=>M(null,null,function*(){if(s&&(yield Xl(s)),!self.ModuleFactory||o&&(yield Xl(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=yield self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new r(c,a)}))(e,i.wasmLoaderPath,i.assetLoaderPath,t,{locateFile:r=>r.endsWith(".wasm")?i.wasmBinaryPath.toString():i.assetBinaryPath&&r.endsWith(".data")?i.assetBinaryPath.toString():r}),yield e.o(n),e})}function Ro(e,t){const i=N(e.baseOptions,yr,1)||new yr;typeof t=="string"?(W(i,2,xi(t)),W(i,1)):t instanceof Uint8Array&&(W(i,1,Is(t,!1)),W(i,2)),S(e.baseOptions,0,1,i)}function Ql(e){try{const t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(i=>i.message).join(", "))}finally{e.G=[]}}function y(e,t){e.B=Math.max(e.B,t)}function xr(e,t){e.A=new Le,Ue(e.A,"PassThroughCalculator"),X(e.A,"free_memory"),$(e.A,"free_memory_unused_out"),Y(t,"free_memory"),Ve(t,e.A)}function $i(e,t){X(e.A,t),$(e.A,t+"_unused_out")}function kr(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var Oo=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var i,n,r,s,o,a;if(t){const c=e.baseOptions||{};if((i=e.baseOptions)!=null&&i.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((r=N(this.baseOptions,yr,1))!=null&&r.g()||(s=N(this.baseOptions,yr,1))!=null&&s.h()||(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(l,d){let h=N(l.baseOptions,_l,3);if(!h){var u=h=new _l,p=new rl;pn(u,4,wr,p)}"delegate"in d&&(d.delegate==="GPU"?(d=h,u=new Jd,pn(d,2,wr,u)):(d=h,u=new rl,pn(d,4,wr,u))),S(l.baseOptions,0,3,h)}(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then(l=>{if(l.ok)return l.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${l.status})`)}).then(l=>{try{this.g.i.FS_unlink("/model.dat")}catch(d){}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(l),!0,!1,!1),Ro(this,"/model.dat"),this.m(),this.J()});if(c.modelAssetBuffer instanceof Uint8Array)Ro(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return function(l){return M(this,null,function*(){const d=[];for(var h=0;;){const{done:u,value:p}=yield l.read();if(u)break;d.push(p),h+=p.length}if(d.length===0)return new Uint8Array(0);if(d.length===1)return d[0];l=new Uint8Array(h),h=0;for(const u of d)l.set(u,h),h+=u.length;return l})}(c.modelAssetBuffer).then(l=>{Ro(this,l),this.m(),this.J()})}return this.m(),this.J(),Promise.resolve()}J(){}ca(){let e;if(this.g.ca(t=>{e=Qd(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((i,n)=>{this.G.push(Error(n))}),this.g.Ha(),this.g.setGraph(e,t),this.A=void 0,Ql(this)}finishProcessing(){this.g.finishProcessing(),Ql(this)}close(){this.A=void 0,this.g.closeGraph()}};function Te(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Oo.prototype.close=Oo.prototype.close;class A0{constructor(t,i,n,r){this.g=t,this.h=i,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function e2(e,t,i){const n=e.g;if(i=Te(n.createShader(i),"Failed to create WebGL shader"),n.shaderSource(i,t),n.compileShader(i),!n.getShaderParameter(i,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(i)}`);return n.attachShader(e.h,i),i}function t2(e,t){const i=e.g,n=Te(i.createVertexArray(),"Failed to create vertex array");i.bindVertexArray(n);const r=Te(i.createBuffer(),"Failed to create buffer");i.bindBuffer(i.ARRAY_BUFFER,r),i.enableVertexAttribArray(e.P),i.vertexAttribPointer(e.P,2,i.FLOAT,!1,0,0),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),i.STATIC_DRAW);const s=Te(i.createBuffer(),"Failed to create buffer");return i.bindBuffer(i.ARRAY_BUFFER,s),i.enableVertexAttribArray(e.J),i.vertexAttribPointer(e.J,2,i.FLOAT,!1,0,0),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),i.bindVertexArray(null),new A0(i,n,r,s)}function Po(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function _n(e,t,i,n){return Po(e,t),e.h||(e.m(),e.C()),i?(e.s||(e.s=t2(e,!0)),i=e.s):(e.v||(e.v=t2(e,!1)),i=e.v),t.useProgram(e.h),i.bind(),e.l(),e=n(),i.g.bindVertexArray(null),e}function Wt(e,t,i){return Po(e,t),e=Te(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,i!=null?i:t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,i!=null?i:t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ar(e,t,i){Po(e,t),e.A||(e.A=Te(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0)}function $o(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ni=class{G(){return`
3119
+ `}class _h extends HTMLElement{constructor(){super(),this.templateString=yh.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"})}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.setUpEventListeners()}static get observedAttributes(){return["hide-back-to-host","show-navigation","data-image","mirror-image"]}get hideBack(){return this.hasAttribute("hide-back-to-host")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}get imageSrc(){return this.getAttribute("data-image")}get shouldMirror(){return this.getAttribute("mirror-image")!=="false"}get title(){return this.getAttribute("title")||"Submit Front of ID"}handleBackEvents(){this.dispatchEvent(new CustomEvent("selfie-capture-review.cancelled"))}handleCloseEvents(){this.dispatchEvent(new CustomEvent("selfie-capture-review.close"))}attributeChangedCallback(t){switch(t){case"data-image":case"hide-back-to-host":case"show-navigation":case"mirror-image":this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners();break}}setUpEventListeners(){this.selectImage=this.shadowRoot.querySelector("#select-id-image"),this.reCaptureImage=this.shadowRoot.querySelector("#re-capture-image"),this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.handleCloseEvents()}),this.selectImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("selfie-capture-review.accepted",{detail:{}}))}),this.reCaptureImage.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("selfie-capture-review.rejected",{detail:{}}))})}}"customElements"in window&&!customElements.get("selfie-capture-review")&&window.customElements.define("selfie-capture-review",_h);var Ki,U,Ea,xa,Yt,ka,Aa,Sa,La,Ur,Vr,jr,Ji={},Ma=[],Ch=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qi=Array.isArray;function dt(e,t){for(var i in t)e[i]=t[i];return e}function Gr(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ct(e,t,i){var n,r,s,o={};for(s in t)s=="key"?n=t[s]:s=="ref"?r=t[s]:o[s]=t[s];if(arguments.length>2&&(o.children=arguments.length>3?Ki.call(arguments,2):i),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)o[s]===void 0&&(o[s]=e.defaultProps[s]);return en(e,o,n,r,null)}function en(e,t,i,n,r){var s={type:e,props:t,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r==null?++Ea:r,__i:-1,__u:0};return r==null&&U.vnode!=null&&U.vnode(s),s}function Dt(e){return e.children}function tn(e,t){this.props=e,this.context=t}function pi(e,t){if(t==null)return e.__?pi(e.__,e.__i+1):null;for(var i;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null)return i.__e;return typeof e.type=="function"?pi(e):null}function Ta(e){var t,i;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((i=e.__k[t])!=null&&i.__e!=null){e.__e=e.__c.base=i.__e;break}return Ta(e)}}function Ia(e){(!e.__d&&(e.__d=!0)&&Yt.push(e)&&!Mn.__r++||ka!=U.debounceRendering)&&((ka=U.debounceRendering)||Aa)(Mn)}function Mn(){for(var e,t,i,n,r,s,o,a=1;Yt.length;)Yt.length>a&&Yt.sort(Sa),e=Yt.shift(),a=Yt.length,e.__d&&(i=void 0,r=(n=(t=e).__v).__e,s=[],o=[],t.__P&&((i=dt({},n)).__v=n.__v+1,U.vnode&&U.vnode(i),zr(t.__P,i,n,t.__n,t.__P.namespaceURI,32&n.__u?[r]:null,s,r==null?pi(n):r,!!(32&n.__u),o),i.__v=n.__v,i.__.__k[i.__i]=i,Pa(s,i,o),i.__e!=r&&Ta(i)));Mn.__r=0}function Fa(e,t,i,n,r,s,o,a,c,l,d){var h,u,p,f,m,v,g=n&&n.__k||Ma,b=t.length;for(c=Eh(i,t,g,c,b),h=0;h<b;h++)(p=i.__k[h])!=null&&(u=p.__i==-1?Ji:g[p.__i]||Ji,p.__i=h,v=zr(e,p,u,r,s,o,a,c,l,d),f=p.__e,p.ref&&u.ref!=p.ref&&(u.ref&&qr(u.ref,null,p),d.push(p.ref,p.__c||f,p)),m==null&&f!=null&&(m=f),4&p.__u||u.__k===p.__k?c=Ba(p,c,e):typeof p.type=="function"&&v!==void 0?c=v:f&&(c=f.nextSibling),p.__u&=-7);return i.__e=m,c}function Eh(e,t,i,n,r){var s,o,a,c,l,d=i.length,h=d,u=0;for(e.__k=new Array(r),s=0;s<r;s++)(o=t[s])!=null&&typeof o!="boolean"&&typeof o!="function"?(c=s+u,(o=e.__k[s]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?en(null,o,null,null,null):Qi(o)?en(Dt,{children:o},null,null,null):o.constructor==null&&o.__b>0?en(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,a=null,(l=o.__i=xh(o,i,c,h))!=-1&&(h--,(a=i[l])&&(a.__u|=2)),a==null||a.__v==null?(l==-1&&(r>d?u--:r<d&&u++),typeof o.type!="function"&&(o.__u|=4)):l!=c&&(l==c-1?u--:l==c+1?u++:(l>c?u--:u++,o.__u|=4))):e.__k[s]=null;if(h)for(s=0;s<d;s++)(a=i[s])!=null&&(2&a.__u)==0&&(a.__e==n&&(n=pi(a)),Na(a,a));return n}function Ba(e,t,i){var n,r;if(typeof e.type=="function"){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=Ba(n[r],t,i));return t}e.__e!=t&&(t&&e.type&&!i.contains(t)&&(t=pi(e)),i.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Da(e,t){return t=t||[],e==null||typeof e=="boolean"||(Qi(e)?e.some(function(i){Da(i,t)}):t.push(e)),t}function xh(e,t,i,n){var r,s,o,a=e.key,c=e.type,l=t[i],d=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||d&&a==l.key&&c==l.type)return i;if(n>(d?1:0)){for(r=i-1,s=i+1;r>=0||s<t.length;)if((l=t[o=r>=0?r--:s++])!=null&&(2&l.__u)==0&&a==l.key&&c==l.type)return o}return-1}function Ra(e,t,i){t[0]=="-"?e.setProperty(t,i==null?"":i):e[t]=i==null?"":typeof i!="number"||Ch.test(t)?i:i+"px"}function Tn(e,t,i,n,r){var s,o;e:if(t=="style")if(typeof i=="string")e.style.cssText=i;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)i&&t in i||Ra(e.style,t,"");if(i)for(t in i)n&&i[t]==n[t]||Ra(e.style,t,i[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(La,"$1")),o=t.toLowerCase(),t=o in e||t=="onFocusOut"||t=="onFocusIn"?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=i,i?n?i.u=n.u:(i.u=Ur,e.addEventListener(t,s?jr:Vr,s)):e.removeEventListener(t,s?jr:Vr,s);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=i==null?"":i;break e}catch(a){}typeof i=="function"||(i==null||i===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&i==1?"":i))}}function Oa(e){return function(t){if(this.l){var i=this.l[t.type+e];if(t.t==null)t.t=Ur++;else if(t.t<i.u)return;return i(U.event?U.event(t):t)}}}function zr(e,t,i,n,r,s,o,a,c,l){var d,h,u,p,f,m,v,g,b,_,E,M,w,T,I,O,be,ce=t.type;if(t.constructor!=null)return null;128&i.__u&&(c=!!(32&i.__u),s=[a=t.__e=i.__e]),(d=U.__b)&&d(t);e:if(typeof ce=="function")try{if(g=t.props,b="prototype"in ce&&ce.prototype.render,_=(d=ce.contextType)&&n[d.__c],E=d?_?_.props.value:d.__:n,i.__c?v=(h=t.__c=i.__c).__=h.__E:(b?t.__c=h=new ce(g,E):(t.__c=h=new tn(g,E),h.constructor=ce,h.render=Ah),_&&_.sub(h),h.props=g,h.state||(h.state={}),h.context=E,h.__n=n,u=h.__d=!0,h.__h=[],h._sb=[]),b&&h.__s==null&&(h.__s=h.state),b&&ce.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=dt({},h.__s)),dt(h.__s,ce.getDerivedStateFromProps(g,h.__s))),p=h.props,f=h.state,h.__v=t,u)b&&ce.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),b&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(b&&ce.getDerivedStateFromProps==null&&g!==p&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(g,E),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(g,h.__s,E)===!1||t.__v==i.__v){for(t.__v!=i.__v&&(h.props=g,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(re){re&&(re.__=t)}),M=0;M<h._sb.length;M++)h.__h.push(h._sb[M]);h._sb=[],h.__h.length&&o.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(g,h.__s,E),b&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(p,f,m)})}if(h.context=E,h.props=g,h.__P=e,h.__e=!1,w=U.__r,T=0,b){for(h.state=h.__s,h.__d=!1,w&&w(t),d=h.render(h.props,h.state,h.context),I=0;I<h._sb.length;I++)h.__h.push(h._sb[I]);h._sb=[]}else do h.__d=!1,w&&w(t),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++T<25);h.state=h.__s,h.getChildContext!=null&&(n=dt(dt({},n),h.getChildContext())),b&&!u&&h.getSnapshotBeforeUpdate!=null&&(m=h.getSnapshotBeforeUpdate(p,f)),O=d,d!=null&&d.type===Dt&&d.key==null&&(O=$a(d.props.children)),a=Fa(e,Qi(O)?O:[O],t,i,n,r,s,o,a,c,l),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(re){if(t.__v=null,c||s!=null)if(re.then){for(t.__u|=c?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else{for(be=s.length;be--;)Gr(s[be]);Zr(t)}else t.__e=i.__e,t.__k=i.__k,re.then||Zr(t);U.__e(re,t,i)}else s==null&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=kh(i.__e,t,i,n,r,s,o,c,l);return(d=U.diffed)&&d(t),128&t.__u?void 0:a}function Zr(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Zr)}function Pa(e,t,i){for(var n=0;n<i.length;n++)qr(i[n],i[++n],i[++n]);U.__c&&U.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(s){s.call(r)})}catch(s){U.__e(s,r.__v)}})}function $a(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Qi(e)?e.map($a):dt({},e)}function kh(e,t,i,n,r,s,o,a,c){var l,d,h,u,p,f,m,v=i.props,g=t.props,b=t.type;if(b=="svg"?r="http://www.w3.org/2000/svg":b=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),s!=null){for(l=0;l<s.length;l++)if((p=s[l])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){e=p,s[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(g);e=document.createElementNS(r,b,g.is&&g),a&&(U.__m&&U.__m(t,s),a=!1),s=null}if(b==null)v===g||a&&e.data==g||(e.data=g);else{if(s=s&&Ki.call(e.childNodes),v=i.props||Ji,!a&&s!=null)for(v={},l=0;l<e.attributes.length;l++)v[(p=e.attributes[l]).name]=p.value;for(l in v)if(p=v[l],l!="children"){if(l=="dangerouslySetInnerHTML")h=p;else if(!(l in g)){if(l=="value"&&"defaultValue"in g||l=="checked"&&"defaultChecked"in g)continue;Tn(e,l,null,p,r)}}for(l in g)p=g[l],l=="children"?u=p:l=="dangerouslySetInnerHTML"?d=p:l=="value"?f=p:l=="checked"?m=p:a&&typeof p!="function"||v[l]===p||Tn(e,l,p,v[l],r);if(d)a||h&&(d.__html==h.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),Fa(t.type=="template"?e.content:e,Qi(u)?u:[u],t,i,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:i.__k&&pi(i,0),a,c),s!=null)for(l=s.length;l--;)Gr(s[l]);a||(l="value",b=="progress"&&f==null?e.removeAttribute("value"):f!=null&&(f!==e[l]||b=="progress"&&!f||b=="option"&&f!=v[l])&&Tn(e,l,f,v[l],r),l="checked",m!=null&&m!=e[l]&&Tn(e,l,m,v[l],r))}return e}function qr(e,t,i){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(r){U.__e(r,i)}}function Na(e,t,i){var n,r;if(U.unmount&&U.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||qr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){U.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(r=0;r<n.length;r++)n[r]&&Na(n[r],t,i||typeof e.type!="function");i||Gr(e.__e),e.__c=e.__=e.__e=void 0}function Ah(e,t,i){return this.constructor(e,i)}function In(e,t,i){var n,r,s,o;t==document&&(t=document.documentElement),U.__&&U.__(e,t),r=(n=typeof i=="function")?null:i&&i.__k||t.__k,s=[],o=[],zr(t,e=(!n&&i||t).__k=Ct(Dt,null,[e]),r||Ji,Ji,t.namespaceURI,!n&&i?[i]:r?null:t.firstChild?Ki.call(t.childNodes):null,s,!n&&i?i:r?r.__e:t.firstChild,n,o),Pa(s,e,o)}function Ha(e,t){In(e,t,Ha)}function Ua(e,t,i){var n,r,s,o,a=dt({},e.props);for(s in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)s=="key"?n=t[s]:s=="ref"?r=t[s]:a[s]=t[s]===void 0&&o!=null?o[s]:t[s];return arguments.length>2&&(a.children=arguments.length>3?Ki.call(arguments,2):i),en(e.type,a,n||e.key,r||e.ref,null)}Ki=Ma.slice,U={__e:function(e,t,i,n){for(var r,s,o;t=t.__;)if((r=t.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(e)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,n||{}),o=r.__d),o)return r.__E=r}catch(a){e=a}throw e}},Ea=0,xa=function(e){return e!=null&&e.constructor==null},tn.prototype.setState=function(e,t){var i;i=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dt({},this.state),typeof e=="function"&&(e=e(dt({},i),this.props)),e&&dt(i,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ia(this))},tn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ia(this))},tn.prototype.render=Dt,Yt=[],Aa=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Sa=function(e,t){return e.__v.__b-t.__v.__b},Mn.__r=0,La=/(PointerCapture)$|Capture$/i,Ur=0,Vr=Oa(!1),jr=Oa(!0);var Sh=0;function D(e,t,i,n,r,s){t||(t={});var o,a,c=t;if("ref"in c)for(a in c={},t)a=="ref"?o=t[a]:c[a]=t[a];var l={type:e,props:c,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sh,__i:-1,__u:0,__source:r,__self:s};if(typeof e=="function"&&(o=e.defaultProps))for(a in o)c[a]===void 0&&(c[a]=o[a]);return U.vnode&&U.vnode(l),l}var nn,le,Wr,Va,Fn=0,ja=[],fe=U,Ga=fe.__b,za=fe.__r,Za=fe.diffed,qa=fe.__c,Wa=fe.unmount,Xa=fe.__;function Xr(e,t){fe.__h&&fe.__h(le,e,Fn||t),Fn=0;var i=le.__H||(le.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function Kt(e){return Fn=1,Lh(Ja,e)}function Lh(e,t,i){var n=Xr(nn++,2);if(n.t=e,!n.__c&&(n.__=[Ja(void 0,t),function(a){var c=n.__N?n.__N[0]:n.__[0],l=n.t(c,a);c!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=le,!le.__f)){var r=function(a,c,l){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(u){return!!u.__c});if(d.every(function(u){return!u.__N}))return!s||s.call(this,a,c,l);var h=n.__c.props!==a;return d.forEach(function(u){if(u.__N){var p=u.__[0];u.__=u.__N,u.__N=void 0,p!==u.__[0]&&(h=!0)}}),s&&s.call(this,a,c,l)||h};le.__f=!0;var s=le.shouldComponentUpdate,o=le.componentWillUpdate;le.componentWillUpdate=function(a,c,l){if(this.__e){var d=s;s=void 0,r(a,c,l),s=d}o&&o.call(this,a,c,l)},le.shouldComponentUpdate=r}return n.__N||n.__}function ot(e,t){var i=Xr(nn++,3);!fe.__s&&Ka(i.__H,t)&&(i.__=e,i.u=t,le.__H.__h.push(i))}function xe(e){return Fn=5,Bn(function(){return{current:e}},[])}function Bn(e,t){var i=Xr(nn++,7);return Ka(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function Mh(){for(var e;e=ja.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Dn),e.__H.__h.forEach(Yr),e.__H.__h=[]}catch(t){e.__H.__h=[],fe.__e(t,e.__v)}}fe.__b=function(e){le=null,Ga&&Ga(e)},fe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xa&&Xa(e,t)},fe.__r=function(e){za&&za(e),nn=0;var t=(le=e.__c).__H;t&&(Wr===le?(t.__h=[],le.__h=[],t.__.forEach(function(i){i.__N&&(i.__=i.__N),i.u=i.__N=void 0})):(t.__h.forEach(Dn),t.__h.forEach(Yr),t.__h=[],nn=0)),Wr=le},fe.diffed=function(e){Za&&Za(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ja.push(t)!==1&&Va===fe.requestAnimationFrame||((Va=fe.requestAnimationFrame)||Th)(Mh)),t.__H.__.forEach(function(i){i.u&&(i.__H=i.u),i.u=void 0})),Wr=le=null},fe.__c=function(e,t){t.some(function(i){try{i.__h.forEach(Dn),i.__h=i.__h.filter(function(n){return!n.__||Yr(n)})}catch(n){t.some(function(r){r.__h&&(r.__h=[])}),t=[],fe.__e(n,i.__v)}}),qa&&qa(e,t)},fe.unmount=function(e){Wa&&Wa(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.forEach(function(n){try{Dn(n)}catch(r){t=r}}),i.__H=void 0,t&&fe.__e(t,i.__v))};var Ya=typeof requestAnimationFrame=="function";function Th(e){var t,i=function(){clearTimeout(n),Ya&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(i,35);Ya&&(t=requestAnimationFrame(i))}function Dn(e){var t=le,i=e.__c;typeof i=="function"&&(e.__c=void 0,i()),le=t}function Yr(e){var t=le;e.__c=e.__(),le=t}function Ka(e,t){return!e||e.length!==t.length||t.some(function(i,n){return i!==e[n]})}function Ja(e,t){return typeof t=="function"?t(e):t}var Ih={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};const Fh=(e,t,i,n)=>{const r=f=>{var m=f,{color:s="currentColor",size:o=24,stroke:a=2,title:c,children:l,className:d="",class:h="",style:u}=m,p=ua(m,["color","size","stroke","title","children","className","class","style"]);return Ct("svg",Fe(qi(Fe({},Ih[e]),{width:String(o),height:String(o),class:["tabler-icon",`tabler-icon-${t}`,h,d].join(" "),"stroke-width":a,stroke:s,style:u}),p),[c&&Ct("title",{},c),...n.map(([v,g])=>Ct(v,g)),...Da(l)])};return r.displayName=`${i}`,r};var Bh=Fh("outline","loader-2","Loader2",[["path",{d:"M12 3a9 9 0 1 0 9 9",key:"svg-0"}]]);function Kr(){return(Kr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var Dh=["context","children"];function Rh(e){this.getChildContext=function(){return e.context};var t=e.children,i=function(n,r){if(n==null)return{};var s,o,a={},c=Object.keys(n);for(o=0;o<c.length;o++)r.indexOf(s=c[o])>=0||(a[s]=n[s]);return a}(e,Dh);return Ua(t,i)}function Oh(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=Ct(Rh,Kr({},this._props,{context:e.detail.context}),function t(i,n){if(i.nodeType===3)return i.data;if(i.nodeType!==1)return null;var r=[],s={},o=0,a=i.attributes,c=i.childNodes;for(o=a.length;o--;)a[o].name!=="slot"&&(s[a[o].name]=a[o].value,s[Qa(a[o].name)]=a[o].value);for(o=c.length;o--;){var l=t(c[o],null),d=c[o].slot;d?s[d]=Ct(e1,{name:d},l):r[o]=l}var h=n?Ct(e1,null,r):r;return Ct(n||i.nodeName.toLowerCase(),s,h)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Ha:In)(this._vdom,this._root)}function Qa(e){return e.replace(/-(\w)/g,function(t,i){return i?i.toUpperCase():""})}function Ph(e,t,i){if(this._vdom){var n={};n[e]=i=i==null?void 0:i,n[Qa(e)]=i,this._vdom=Ua(this._vdom,n),In(this._vdom,this._root)}}function $h(){In(this._vdom=null,this._root)}function e1(e,t){var i=this;return Ct("slot",Kr({},e,{ref:function(n){n?(i.ref=n,i._listener||(i._listener=function(r){r.stopPropagation(),r.detail.context=t},n.addEventListener("_preact",i._listener))):i.ref.removeEventListener("_preact",i._listener)}}))}function t1(e,t,i,n){function r(){var s=Reflect.construct(HTMLElement,[],r);return s._vdomComponent=e,s._root=n&&n.shadow?s.attachShadow({mode:n.mode||"open"}):s,s}return(r.prototype=Object.create(HTMLElement.prototype)).constructor=r,r.prototype.connectedCallback=Oh,r.prototype.attributeChangedCallback=Ph,r.prototype.disconnectedCallback=$h,i=i||e.observedAttributes||Object.keys(e.propTypes||{}),r.observedAttributes=i,i.forEach(function(s){Object.defineProperty(r.prototype,s,{get:function(){return this._vdom.props[s]},set:function(o){this._vdom?this.attributeChangedCallback(s,null,o):(this._props||(this._props={}),this._props[s]=o,this.connectedCallback());var a=typeof o;o!=null&&a!=="string"&&a!=="boolean"&&a!=="number"||this.setAttribute(s,o)}})}),customElements.define(t||e.tagName||e.displayName||e.name,r)}const fi=(e,t=!1)=>typeof e=="boolean"?e:typeof e=="string"?e==="true"||e==="":t;var Nh=Symbol.for("preact-signals");function Rn(){if(Rt>1)Rt--;else{for(var e,t=!1;rn!==void 0;){var i=rn;for(rn=void 0,Jr++;i!==void 0;){var n=i.o;if(i.o=void 0,i.f&=-3,!(8&i.f)&&s1(i))try{i.c()}catch(r){t||(e=r,t=!0)}i=n}}if(Jr=0,Rt--,t)throw e}}function Hh(e){if(Rt>0)return e();Rt++;try{return e()}finally{Rn()}}var V=void 0;function i1(e){var t=V;V=void 0;try{return e()}finally{V=t}}var rn=void 0,Rt=0,Jr=0,On=0;function n1(e){if(V!==void 0){var t=e.n;if(t===void 0||t.t!==V)return t={i:0,S:e,p:V.s,n:void 0,t:V,e:void 0,x:void 0,r:t},V.s!==void 0&&(V.s.n=t),V.s=t,e.n=t,32&V.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=V.s,t.n=void 0,V.s.n=t,V.s=t),t}}function Ee(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched}Ee.prototype.brand=Nh,Ee.prototype.h=function(){return!0},Ee.prototype.S=function(e){var t=this,i=this.t;i!==e&&e.e===void 0&&(e.x=i,this.t=e,i!==void 0?i.e=e:i1(function(){var n;(n=t.W)==null||n.call(t)}))},Ee.prototype.U=function(e){var t=this;if(this.t!==void 0){var i=e.e,n=e.x;i!==void 0&&(i.x=n,e.e=void 0),n!==void 0&&(n.e=i,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&i1(function(){var r;(r=t.Z)==null||r.call(t)}))}},Ee.prototype.subscribe=function(e){var t=this;return sn(function(){var i=t.value,n=V;V=void 0;try{e(i)}finally{V=n}})},Ee.prototype.valueOf=function(){return this.value},Ee.prototype.toString=function(){return this.value+""},Ee.prototype.toJSON=function(){return this.value},Ee.prototype.peek=function(){var e=V;V=void 0;try{return this.value}finally{V=e}},Object.defineProperty(Ee.prototype,"value",{get:function(){var e=n1(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Jr>100)throw new Error("Cycle detected");this.v=e,this.i++,On++,Rt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Rn()}}}});function r1(e,t){return new Ee(e,t)}function s1(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function o1(e){for(var t=e.s;t!==void 0;t=t.n){var i=t.S.n;if(i!==void 0&&(t.r=i),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function a1(e){for(var t=e.s,i=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):i=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=i}function Jt(e,t){Ee.call(this,void 0),this.x=e,this.s=void 0,this.g=On-1,this.f=4,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched}Jt.prototype=new Ee,Jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===On))return!0;if(this.g=On,this.f|=1,this.i>0&&!s1(this))return this.f&=-2,!0;var e=V;try{o1(this),V=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(i){this.v=i,this.f|=16,this.i++}return V=e,a1(this),this.f&=-2,!0},Jt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ee.prototype.S.call(this,e)},Jt.prototype.U=function(e){if(this.t!==void 0&&(Ee.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Jt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=n1(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Qr(e,t){return new Jt(e,t)}function c1(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Rt++;var i=V;V=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,es(e),n}finally{V=i,Rn()}}}function es(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,c1(e)}function Uh(e){if(V!==this)throw new Error("Out-of-order effect");a1(this),V=e,this.f&=-2,8&this.f&&es(this),Rn()}function mi(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}mi.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},mi.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,c1(this),o1(this),Rt++;var e=V;return V=this,Uh.bind(this,e)},mi.prototype.N=function(){2&this.f||(this.f|=2,this.o=rn,rn=this)},mi.prototype.d=function(){this.f|=8,1&this.f||es(this)},mi.prototype.dispose=function(){this.d()};function sn(e){var t=new mi(e);try{t.c()}catch(n){throw t.d(),n}var i=t.d.bind(t);return i[Symbol.dispose]=i,i}var l1,Pn,ts,h1=[];sn(function(){l1=this.N})();function gi(e,t){U[e]=t.bind(null,U[e]||function(){})}function $n(e){ts&&ts(),ts=e&&e.S()}function d1(e){var t=this,i=e.data,n=se(i);n.value=i;var r=Bn(function(){for(var a=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var l=Qr(function(){var p=n.value.value;return p===0?0:p===!0?"":p||""}),d=Qr(function(){return!Array.isArray(l.value)&&!xa(l.value)}),h=sn(function(){if(this.N=u1,d.value){var p=l.value;a.__v&&a.__v.__e&&a.__v.__e.nodeType===3&&(a.__v.__e.data=p)}}),u=t.__$u.d;return t.__$u.d=function(){h(),u.call(this)},[d,l]},[]),s=r[0],o=r[1];return s.value?o.peek():o.value}d1.displayName="_st",Object.defineProperties(Ee.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:d1},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),gi("__b",function(e,t){if(typeof t.type=="string"){var i,n=t.props;for(var r in n)if(r!=="children"){var s=n[r];s instanceof Ee&&(i||(t.__np=i={}),i[r]=s,n[r]=s.peek())}}e(t)}),gi("__r",function(e,t){if(t.type!==Dt){$n();var i,n=t.__c;n&&(n.__$f&=-2,(i=n.__$u)===void 0&&(n.__$u=i=function(r){var s;return sn(function(){s=this}),s.c=function(){n.__$f|=1,n.setState({})},s}())),Pn=n,$n(i)}e(t)}),gi("__e",function(e,t,i,n){$n(),Pn=void 0,e(t,i,n)}),gi("diffed",function(e,t){$n(),Pn=void 0;var i;if(typeof t.type=="string"&&(i=t.__e)){var n=t.__np,r=t.props;if(n){var s=i.U;if(s)for(var o in s){var a=s[o];a!==void 0&&!(o in n)&&(a.d(),s[o]=void 0)}else s={},i.U=s;for(var c in n){var l=s[c],d=n[c];l===void 0?(l=Vh(i,c,d,r),s[c]=l):l.o(d,r)}}}e(t)});function Vh(e,t,i,n){var r=t in e&&e.ownerSVGElement===void 0,s=r1(i);return{o:function(o,a){s.value=o,n=a},d:sn(function(){this.N=u1;var o=s.value.value;n[t]!==o&&(n[t]=o,r?e[t]=o:o?e.setAttribute(t,o):e.removeAttribute(t))})}}gi("unmount",function(e,t){if(typeof t.type=="string"){var i=t.__e;if(i){var n=i.U;if(n){i.U=void 0;for(var r in n){var s=n[r];s&&s.d()}}}}else{var o=t.__c;if(o){var a=o.__$u;a&&(o.__$u=void 0,a.d())}}e(t)}),gi("__h",function(e,t,i,n){(n<3||n===9)&&(t.__$f|=2),e(t,i,n)}),tn.prototype.shouldComponentUpdate=function(e,t){var i=this.__$u,n=i&&i.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var s=2&this.__$f;if(!(n||s||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};function se(e,t){return Bn(function(){return r1(e,t)},[])}function is(e,t){var i=xe(e);return i.current=e,Pn.__$f|=4,Bn(function(){return Qr(function(){return i.current()},t)},[])}var jh=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Gh(){Hh(function(){for(var e;e=h1.shift();)l1.call(e)})}function u1(){h1.push(this)===1&&(U.requestAnimationFrame||jh)(Gh)}var ns,p1;function rs(){if(p1)return ns;p1=1;function e(t){var i=typeof t;return t!=null&&(i=="object"||i=="function")}return ns=e,ns}var ss,f1;function zh(){if(f1)return ss;f1=1;var e=typeof Ln=="object"&&Ln&&Ln.Object===Object&&Ln;return ss=e,ss}var os,m1;function g1(){if(m1)return os;m1=1;var e=zh(),t=typeof self=="object"&&self&&self.Object===Object&&self,i=e||t||Function("return this")();return os=i,os}var as,v1;function Zh(){if(v1)return as;v1=1;var e=g1(),t=function(){return e.Date.now()};return as=t,as}var cs,b1;function qh(){if(b1)return cs;b1=1;var e=/\s/;function t(i){for(var n=i.length;n--&&e.test(i.charAt(n)););return n}return cs=t,cs}var ls,w1;function Wh(){if(w1)return ls;w1=1;var e=qh(),t=/^\s+/;function i(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return ls=i,ls}var hs,y1;function _1(){if(y1)return hs;y1=1;var e=g1(),t=e.Symbol;return hs=t,hs}var ds,C1;function Xh(){if(C1)return ds;C1=1;var e=_1(),t=Object.prototype,i=t.hasOwnProperty,n=t.toString,r=e?e.toStringTag:void 0;function s(o){var a=i.call(o,r),c=o[r];try{o[r]=void 0;var l=!0}catch(h){}var d=n.call(o);return l&&(a?o[r]=c:delete o[r]),d}return ds=s,ds}var us,E1;function Yh(){if(E1)return us;E1=1;var e=Object.prototype,t=e.toString;function i(n){return t.call(n)}return us=i,us}var ps,x1;function Kh(){if(x1)return ps;x1=1;var e=_1(),t=Xh(),i=Yh(),n="[object Null]",r="[object Undefined]",s=e?e.toStringTag:void 0;function o(a){return a==null?a===void 0?r:n:s&&s in Object(a)?t(a):i(a)}return ps=o,ps}var fs,k1;function Jh(){if(k1)return fs;k1=1;function e(t){return t!=null&&typeof t=="object"}return fs=e,fs}var ms,A1;function Qh(){if(A1)return ms;A1=1;var e=Kh(),t=Jh(),i="[object Symbol]";function n(r){return typeof r=="symbol"||t(r)&&e(r)==i}return ms=n,ms}var gs,S1;function ed(){if(S1)return gs;S1=1;var e=Wh(),t=rs(),i=Qh(),n=NaN,r=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function c(l){if(typeof l=="number")return l;if(i(l))return n;if(t(l)){var d=typeof l.valueOf=="function"?l.valueOf():l;l=t(d)?d+"":d}if(typeof l!="string")return l===0?l:+l;l=e(l);var h=s.test(l);return h||o.test(l)?a(l.slice(2),h?2:8):r.test(l)?n:+l}return gs=c,gs}var vs,L1;function td(){if(L1)return vs;L1=1;var e=rs(),t=Zh(),i=ed(),n="Expected a function",r=Math.max,s=Math.min;function o(a,c,l){var d,h,u,p,f,m,v=0,g=!1,b=!1,_=!0;if(typeof a!="function")throw new TypeError(n);c=i(c)||0,e(l)&&(g=!!l.leading,b="maxWait"in l,u=b?r(i(l.maxWait)||0,c):u,_="trailing"in l?!!l.trailing:_);function E(Z){var ue=d,pe=h;return d=h=void 0,v=Z,p=a.apply(pe,ue),p}function M(Z){return v=Z,f=setTimeout(I,c),g?E(Z):p}function w(Z){var ue=Z-m,pe=Z-v,Ae=c-ue;return b?s(Ae,u-pe):Ae}function T(Z){var ue=Z-m,pe=Z-v;return m===void 0||ue>=c||ue<0||b&&pe>=u}function I(){var Z=t();if(T(Z))return O(Z);f=setTimeout(I,w(Z))}function O(Z){return f=void 0,_&&d?E(Z):(d=h=void 0,p)}function be(){f!==void 0&&clearTimeout(f),v=0,d=m=h=f=void 0}function ce(){return f===void 0?p:O(t())}function re(){var Z=t(),ue=T(Z);if(d=arguments,h=this,m=Z,ue){if(f===void 0)return M(m);if(b)return clearTimeout(f),f=setTimeout(I,c),E(m)}return f===void 0&&(f=setTimeout(I,c)),p}return re.cancel=be,re.flush=ce,re}return vs=o,vs}var bs,M1;function id(){if(M1)return bs;M1=1;var e=td(),t=rs(),i="Expected a function";function n(r,s,o){var a=!0,c=!0;if(typeof r!="function")throw new TypeError(i);return t(o)&&(a="leading"in o?!!o.leading:a,c="trailing"in o?!!o.trailing:c),e(r,s,{leading:a,maxWait:s,trailing:c})}return bs=n,bs}var nd=id();const T1=wa(nd),rd=(e="user")=>{var v;const t=xe(null),i=xe(null),[n,r]=Kt(e),[s,o]=Kt(!1),a=xe(null),c=xe(!1),l=xe(new Set),d=g=>{a.current=g};ot(()=>{const g=t.current;if(!g)return;const b=()=>{if(c.current&&a.current){const _=setTimeout(()=>{var E;(E=a.current)==null||E.call(a),c.current=!1,l.current.delete(_)},100);l.current.add(_)}};return g.addEventListener("loadedmetadata",b),()=>{g.removeEventListener("loadedmetadata",b),l.current.forEach(_=>clearTimeout(_)),l.current.clear()}},[(v=t.current)==null?void 0:v.src]),ot(()=>()=>{l.current.forEach(g=>clearTimeout(g)),l.current.clear()},[]);const h=(g,b)=>L(this,null,function*(){try{i.current&&(i.current.getTracks().forEach(be=>be.stop()),i.current=null),t.current&&(t.current.srcObject=null);const _=yield navigator.mediaDevices.getUserMedia({video:{facingMode:g||n}});i.current=_;const w=_.getVideoTracks()[0].getSettings().facingMode;(w&&w!==(g||n)||w&&w!==n)&&r(w);const O=(yield navigator.mediaDevices.enumerateDevices()).find(be=>be.kind==="videoinput"&&_.getVideoTracks()[0].getSettings().deviceId===be.deviceId);b==null||b(O==null?void 0:O.label),t.current&&(t.current.srcObject=_,yield t.current.play())}catch(_){console.error("Failed to start camera:",_)}}),u=()=>L(this,null,function*(){const g=n==="user"?"environment":"user";c.current=!0;const b=n;try{r(g),i.current&&(i.current.getTracks().forEach(_=>_.stop()),i.current=null),yield h(g)}catch(_){r(b),c.current=!1;try{yield h(b)}catch(E){console.error("Failed to restore previous camera:",E)}}}),p=()=>{const g=navigator.userAgent.toLowerCase(),b=g.includes("firefox")||g.includes("gecko")&&!g.includes("chrome")&&!g.includes("edge"),_="mozInnerScreenX"in window||"mozInputSource"in window||"mozPaintCount"in window||typeof window.InstallTrigger!="undefined",E=CSS.supports&&(CSS.supports("-moz-appearance","none")||CSS.supports("-moz-user-select","none"));return{isGecko:b||_||E,isChromium:g.includes("chrome")||g.includes("chromium")||g.includes("edge"),isWebKit:g.includes("webkit")&&!g.includes("chrome")}};return{videoRef:t,streamRef:i,facingMode:n,agentSupported:s,startCamera:h,switchCamera:u,checkAgentSupport:()=>L(this,null,function*(){var g,b;try{if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||navigator.maxTouchPoints&&navigator.maxTouchPoints>1){o(!0);return}const{isGecko:E}=p();let M=null,w=null;try{const I=yield navigator.mediaDevices.getUserMedia({video:{facingMode:"user"}});M=(g=I.getVideoTracks()[0].getSettings().deviceId)!=null?g:null,I.getTracks().forEach(O=>O.stop())}catch(I){}try{const I=yield navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});w=(b=I.getVideoTracks()[0].getSettings().deviceId)!=null?b:null,I.getTracks().forEach(O=>O.stop())}catch(I){}if(!(M&&w&&M!==w)){o(!1);return}o(!E)}catch(_){o(!1)}}),stopCamera:()=>{i.current&&(i.current.getTracks().forEach(g=>g.stop()),i.current=null),t.current&&(t.current.srcObject=null,t.current.load())},registerCameraSwitchCallback:d}};var vi=typeof self!="undefined"?self:{};function Qt(){throw Error("Invalid UTF8")}function I1(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Nn,ws;const sd=typeof TextDecoder!="undefined";let od;const ad=typeof TextEncoder!="undefined";function F1(e){if(ad)e=(od||(od=new TextEncoder)).encode(e);else{let i=0;const n=new Uint8Array(3*e.length);for(let r=0;r<e.length;r++){var t=e.charCodeAt(r);if(t<128)n[i++]=t;else{if(t<2048)n[i++]=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,n[i++]=t>>18|240,n[i++]=t>>12&63|128,n[i++]=t>>6&63|128,n[i++]=63&t|128;continue}r--}t=65533}n[i++]=t>>12|224,n[i++]=t>>6&63|128}n[i++]=63&t|128}}e=i===n.length?n:n.subarray(0,i)}return e}var ys,Hn;e:{for(var B1=["CLOSURE_FLAGS"],_s=vi,Cs=0;Cs<B1.length;Cs++)if((_s=_s[B1[Cs]])==null){Hn=null;break e}Hn=_s}var on,D1=Hn&&Hn[610401301];ys=D1!=null&&D1;const R1=vi.navigator;function Es(e){return!!ys&&!!on&&on.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Xe(e){var t;return(t=vi.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function Ot(){return!!ys&&!!on&&on.brands.length>0}function xs(){return Ot()?Es("Chromium"):(Xe("Chrome")||Xe("CriOS"))&&!(!Ot()&&Xe("Edge"))||Xe("Silk")}function Un(e){return Un[" "](e),e}on=R1&&R1.userAgentData||null,Un[" "]=function(){};var cd=!Ot()&&(Xe("Trident")||Xe("MSIE"));!Xe("Android")||xs(),xs(),Xe("Safari")&&(xs()||!Ot()&&Xe("Coast")||!Ot()&&Xe("Opera")||!Ot()&&Xe("Edge")||(Ot()?Es("Microsoft Edge"):Xe("Edg/"))||Ot()&&Es("Opera"));var O1={},an=null;function ld(e){const t=e.length;let i=3*t/4;i%3?i=Math.floor(i):"=.".indexOf(e[t-1])!=-1&&(i="=.".indexOf(e[t-2])!=-1?i-2:i-1);const n=new Uint8Array(i);let r=0;return function(s,o){function a(l){for(;c<s.length;){const d=s.charAt(c++),h=an[d];if(h!=null)return h;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return l}P1();let c=0;for(;;){const l=a(-1),d=a(0),h=a(64),u=a(64);if(u===64&&l===-1)break;o(l<<2|d>>4),h!=64&&(o(d<<4&240|h>>2),u!=64&&o(h<<6&192|u))}}(e,function(s){n[r++]=s}),r!==i?n.subarray(0,r):n}function P1(){if(!an){an={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let i=0;i<5;i++){const n=e.concat(t[i].split(""));O1[i]=n;for(let r=0;r<n.length;r++){const s=n[r];an[s]===void 0&&(an[s]=r)}}}}var $1=typeof Uint8Array!="undefined",N1=!cd&&typeof btoa=="function";function H1(e){if(!N1){var t;t===void 0&&(t=0),P1(),t=O1[t];var i=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var r=e[c],s=e[c+1],o=e[c+2],a=t[r>>2];r=t[(3&r)<<4|s>>4],s=t[(15&s)<<2|o>>6],o=t[63&o],i[l++]=a+r+s+o}switch(a=0,o=n,e.length-c){case 2:o=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],i[l]=t[e>>2]+t[(3&e)<<4|a>>4]+o+n}return i.join("")}for(t="",i=0,n=e.length-10240;i<n;)t+=String.fromCharCode.apply(null,e.subarray(i,i+=10240));return t+=String.fromCharCode.apply(null,i?e.subarray(i):e),btoa(t)}const U1=/[-_.]/g,hd={"-":"+",_:"/",".":"="};function dd(e){return hd[e]||""}function V1(e){if(!N1)return ld(e);U1.test(e)&&(e=e.replace(U1,dd)),e=atob(e);const t=new Uint8Array(e.length);for(let i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}function ei(e){return $1&&e!=null&&e instanceof Uint8Array}var bi={};function ti(){return ud||(ud=new Et(null,bi))}function ks(e){j1(bi);var t=e.g;return(t=t==null||ei(t)?t:typeof t=="string"?V1(t):null)==null?t:e.g=t}var Et=class{h(){return new Uint8Array(ks(this)||0)}constructor(e,t){if(j1(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let ud,As;function j1(e){if(e!==bi)throw Error("illegal external caller")}function G1(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Ss(e){return G1(e=Error(e),"warning"),e}function Ls(e){if(e!=null){var t=As!=null?As:As={},i=t[e]||0;i>=5||(t[e]=i+1,G1(e=Error(),"incident"),function(n){vi.setTimeout(()=>{throw n},0)}(e))}}var Vn=typeof Symbol=="function"&&typeof Symbol()=="symbol";function wi(e,t,i=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?i&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var pd=wi("jas",void 0,!0),z1=wi(void 0,"0di"),cn=wi(void 0,"1oa"),yi=wi(void 0,Symbol()),fd=wi(void 0,"0actk"),Z1=wi(void 0,"8utk");const k=Vn?pd:"Ea",q1={Ea:{value:0,configurable:!0,writable:!0,enumerable:!1}},W1=Object.defineProperties;function jn(e,t){Vn||k in e||W1(e,q1),e[k]|=t}function me(e,t){Vn||k in e||W1(e,q1),e[k]=t}function _i(e){return jn(e,34),e}function md(e,t){me(t,-15615&(0|e))}function Ms(e,t){me(t,-15581&(34|e))}function Gn(){return typeof BigInt=="function"}function Be(e){return Array.prototype.slice.call(e)}var Ts,ln={};function zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function Is(e,t){if(e!=null){if(typeof e=="string")e=e?new Et(e,bi):ti();else if(e.constructor!==Et)if(ei(e))e=e.length?new Et(new Uint8Array(e),bi):ti();else{if(!t)throw Error();e=void 0}}return e}const X1=[];function Pt(e){if(2&e)throw Error()}me(X1,55),Ts=Object.freeze(X1);class Y1{constructor(t,i,n){this.g=t,this.h=i,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}function Fs(e){return yi?e[yi]:void 0}var gd=Object.freeze({});function Zn(e){return e.Na=!0,e}var vd=Zn(e=>typeof e=="number"),K1=Zn(e=>typeof e=="string"),bd=Zn(e=>typeof e=="boolean"),qn=typeof vi.BigInt=="function"&&typeof vi.BigInt(0)=="bigint";function $t(e){var t=e;if(K1(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(vd(t)&&!Number.isSafeInteger(t))throw Error(String(t));return qn?BigInt(e):e=bd(e)?e?"1":"0":K1(e)?e.trim()||"0":String(e)}var Bs=Zn(e=>qn?e>=yd&&e<=Cd:e[0]==="-"?J1(e,wd):J1(e,_d));const wd=Number.MIN_SAFE_INTEGER.toString(),yd=qn?BigInt(Number.MIN_SAFE_INTEGER):void 0,_d=Number.MAX_SAFE_INTEGER.toString(),Cd=qn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function J1(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let i=0;i<e.length;i++){const n=e[i],r=t[i];if(n>r)return!1;if(n<r)return!0}}const Ed=typeof Uint8Array.prototype.slice=="function";let Q1,q=0,oe=0;function ec(e){const t=e>>>0;q=t,oe=(e-t)/4294967296>>>0}function ii(e){if(e<0){ec(-e);const[t,i]=Ps(q,oe);q=t>>>0,oe=i>>>0}else ec(e)}function Ds(e){const t=Q1||(Q1=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),oe=0,q=t.getUint32(0,!0)}function Rs(e,t){const i=4294967296*t+(e>>>0);return Number.isSafeInteger(i)?i:hn(e,t)}function Os(e,t){const i=2147483648&t;return i&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Rs(e,t))=="number"?i?-e:e:i?"-"+e:e}function hn(e,t){if(e>>>=0,(t>>>=0)<=2097151)var i=""+(4294967296*t+e);else Gn()?i=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(i=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),i+=8147497*t,t*=2,e>=1e7&&(i+=e/1e7>>>0,e%=1e7),i>=1e7&&(t+=i/1e7>>>0,i%=1e7),i=t+tc(i)+tc(e));return i}function tc(e){return e=String(e),"0000000".slice(e.length)+e}function ic(){var e=q,t=oe;if(2147483648&t)if(Gn())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[i,n]=Ps(e,t);e="-"+hn(i,n)}else e=hn(e,t);return e}function Wn(e){if(e.length<16)ii(Number(e));else if(Gn())e=BigInt(e),q=Number(e&BigInt(4294967295))>>>0,oe=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");oe=q=0;const i=e.length;for(let n=t,r=(i-t)%6+t;r<=i;n=r,r+=6){const s=Number(e.slice(n,r));oe*=1e6,q=1e6*q+s,q>=4294967296&&(oe+=Math.trunc(q/4294967296),oe>>>=0,q>>>=0)}if(t){const[n,r]=Ps(q,oe);q=n,oe=r}}}function Ps(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}const dn=typeof BigInt=="function"?BigInt.asIntN:void 0,xd=typeof BigInt=="function"?BigInt.asUintN:void 0,Nt=Number.isSafeInteger,Xn=Number.isFinite,Ci=Math.trunc,kd=$t(0);function Ht(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function nc(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const Ad=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function un(e){switch(typeof e){case"bigint":return!0;case"number":return Xn(e);case"string":return Ad.test(e);default:return!1}}function Ei(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Xn(e)?0|e:void 0}function rc(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Xn(e)?e>>>0:void 0}function sc(e){if(e[0]==="-")return!1;const t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function oc(e){const t=e.length;return e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337}function ac(e){return oc(e)?e:(Wn(e),ic())}function $s(e){return e=Ci(e),Nt(e)||(ii(e),e=Os(q,oe)),e}function cc(e){var t=Ci(Number(e));return Nt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),ac(e))}function lc(e){var t=Ci(Number(e));return Nt(t)?$t(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Gn()?$t(dn(64,BigInt(e))):$t(ac(e)))}function hc(e){if(Nt(e))e=$t($s(e));else{if(e=Ci(e),Nt(e))e=String(e);else{const t=String(e);oc(t)?e=t:(ii(e),e=ic())}e=$t(e)}return e}function Ns(e){return e==null?e:typeof e=="bigint"?(Bs(e)?e=Number(e):(e=dn(64,e),e=Bs(e)?Number(e):String(e)),e):un(e)?typeof e=="number"?$s(e):cc(e):void 0}function Sd(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(xd(64,e));if(un(e)){if(t==="string")return t=Ci(Number(e)),Nt(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),sc(e)||(Wn(e),e=hn(q,oe))),e;if(t==="number")return(e=Ci(e))>=0&&Nt(e)?e:function(i){if(i<0){ii(i);var n=hn(q,oe);return i=Number(n),Nt(i)?i:n}return sc(n=String(i))?n:(ii(i),Rs(q,oe))}(e)}}function dc(e){if(typeof e!="string")throw Error();return e}function xi(e){if(e!=null&&typeof e!="string")throw Error();return e}function ki(e){return e==null||typeof e=="string"?e:void 0}function Hs(e,t,i,n){if(e!=null&&typeof e=="object"&&e.W===ln)return e;if(!Array.isArray(e))return i?2&n?((e=t[z1])||(_i((e=new t).u),e=t[z1]=e),t=e):t=new t:t=void 0,t;let r=i=0|e[k];return r===0&&(r|=32&n),r|=2&n,r!==i&&me(e,r),new t(e)}function Ld(e,t,i){if(t)e:{if(!un(t=e))throw Ss("int64");switch(typeof t){case"string":t=lc(t);break e;case"bigint":t=$t(dn(64,t));break e;default:t=hc(t)}}else e=typeof(t=e),t=t==null?t:e==="bigint"?$t(dn(64,t)):un(t)?e==="string"?lc(t):hc(t):void 0;return(e=t)==null?i?kd:void 0:e}function Md(e){return e}const Td={};let Id=function(){try{return Un(new class extends Map{constructor(){super()}}),!1}catch(e){return!0}}();class Us{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,i){return this.g.set(t,i),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,i){return this.g.forEach(t,i)}[Symbol.iterator](){return this.entries()}}const Fd=Id?(Object.setPrototypeOf(Us.prototype,Map.prototype),Object.defineProperties(Us.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Us):class extends Map{constructor(){super()}};function uc(e){return e}function Vs(e){if(2&e.M)throw Error("Cannot mutate an immutable Map")}var ut=class extends Fd{constructor(e,t,i=uc,n=uc){super();let r=0|e[k];r|=64,me(e,r),this.M=r,this.I=t,this.S=i,this.X=this.I?Bd:n;for(let s=0;s<e.length;s++){const o=e[s],a=i(o[0],!1,!0);let c=o[1];t?c===void 0&&(c=null):c=n(o[1],!1,!0,void 0,void 0,r),super.set(a,c)}}La(){var e=$d;if(this.size!==0)return Array.from(super.entries(),t=>(t[0]=e(t[0]),t[1]=e(t[1]),t))}da(e=Dd){const t=[],i=super.entries();for(var n;!(n=i.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){Vs(this),super.clear()}delete(e){return Vs(this),super.delete(this.S(e,!0,!1))}entries(){if(this.I){var e=super.keys();e=new Y1(e,Rd,this)}else e=super.entries();return e}values(){if(this.I){var e=super.keys();e=new Y1(e,ut.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.I?super.forEach((i,n,r)=>{e.call(t,r.get(n),n,r)}):super.forEach(e,t)}set(e,t){return Vs(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.X(t,!0,!0,this.I,!1,this.M))}Ja(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.I?e===void 0?null:e:this.X(e,!1,!0,void 0,!1,this.M),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 i=this.I;return i?((i=this.X(t,!1,!0,i,this.pa,this.M))!==t&&super.set(e,i),i):t}}[Symbol.iterator](){return this.entries()}};function Bd(e,t,i,n,r,s){return e=Hs(e,n,i,s),r&&(e=Qn(e)),e}function Dd(e){return e}function Rd(e){return[e,this.get(e)]}let Od,Yn,pc,Pd;function fc(){return Od||(Od=new ut(_i([]),void 0,void 0,void 0,Td))}function js(e,t,i,n,r){if(e!=null){if(Array.isArray(e)){const s=0|e[k];return e.length===0&&1&s?void 0:r&&2&s?e:Kn(e,t,i,n!==void 0,r)}return t(e,n)}}function Kn(e,t,i,n,r){const s=n||i?0|e[k]:0,o=n?!!(32&s):void 0;let a=0;const c=(n=Be(e)).length;for(let f=0;f<c;f++){var l=n[f];if(f===c-1&&zn(l)){var d=t,h=i,u=o,p=r;let m;for(let v in l){const g=js(l[v],d,h,u,p);g!=null&&((m!=null?m:m={})[v]=g)}l=m}else l=js(n[f],t,i,o,r);n[f]=l,l!=null&&(a=f+1)}return a<c&&(n.length=a),i&&((e=Fs(e))&&(n[yi]=Be(e)),i(s,n)),n}function $d(e){return js(e,Gs,void 0,void 0,!1)}function Gs(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Bs(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(ei(e))return ei(e)&&Ls(Z1),H1(e);if(e.W===ln)return mc(e);if(e instanceof Et){const t=e.g;return t==null?"":typeof t=="string"?t:e.g=H1(t)}return e instanceof ut?e.La():void 0}return e}function mc(e){var t=e.u;e=Kn(t,Gs,void 0,void 0,!1);var i=0|t[k];if((t=e.length)&&!(512&i)){var n=e[t-1],r=!1;zn(n)?(t--,r=!0):n=void 0;var s=t-(i=512&i?0:-1),o=(Yn!=null?Yn:Md)(s,i,e,n);if(n&&(e[t]=void 0),s<o&&n){for(var a in s=!0,n){const c=+a;c<=o?(e[r=c+i]=n[a],t=Math.max(r+1,t),r=!1,delete n[a]):s=!1}s&&(n=void 0)}for(s=t-1;t>0;s=t-1)if((a=e[s])==null)t--,r=!0;else{if(!((s-=i)>=o))break;(n!=null?n:n={})[s]=a,t--,r=!0}r&&(e.length=t),n&&e.push(n)}return e}function Ut(e,t,i){return e=gc(e,t[0],t[1],i?1:2),t!==pc&&i&&jn(e,8192),e}function gc(e,t,i,n){if(e==null){var r=96;i?(e=[i],r|=512):e=[],t&&(r=-16760833&r|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(8192&(r=0|e[k])||!(64&r)||2&r||Ls(fd),1024&r)throw Error("farr");if(64&r)return e;if(n===1||n===2||(r|=64),i&&(r|=512,i!==e[0]))throw Error("mid");e:{var s=(i=e).length;if(s){var o=s-1;if(zn(n=i[o])){if((o-=t=512&(r|=256)?0:-1)>=1024)throw Error("pvtlmt");for(var a in n)(s=+a)<o&&(i[s+t]=n[a],delete n[a]);r=-16760833&r|(1023&o)<<14;break e}}if(t){if((a=Math.max(t,s-(512&r?0:-1)))>1024)throw Error("spvt");r=-16760833&r|(1023&a)<<14}}}return me(e,r),e}function zs(e,t,i=Ms){if(e!=null){if($1&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[k];return 2&n?e:(t&&(t=n===0||!!(32&n)&&!(64&n||!(16&n))),t?(me(e,34|n),4&n&&Object.freeze(e),e):Kn(e,zs,4&n?Ms:i,!0,!0))}return e.W===ln?e=2&(n=0|(i=e.u)[k])?e:new e.constructor(Jn(i,n,!0)):e instanceof ut&&!(2&e.M)&&(i=_i(e.da(zs)),e=new ut(i,e.I,e.S,e.X)),e}}function Jn(e,t,i){const n=i||2&t?Ms:md,r=!!(32&t);return e=function(s,o,a){const c=Be(s);var l=c.length;const d=256&o?c[l-1]:void 0;for(l+=d?-1:0,o=512&o?1:0;o<l;o++)c[o]=a(c[o]);if(d){o=c[o]={};for(const h in d)o[h]=a(d[h])}return(s=Fs(s))&&(c[yi]=Be(s)),c}(e,t,s=>zs(s,r,n)),jn(e,32|(i?2:0)),e}function Qn(e){const t=e.u,i=0|t[k];return 2&i?new e.constructor(Jn(t,i,!1)):e}function Ai(e,t){return xt(e=e.u,0|e[k],t)}function xt(e,t,i){if(i===-1)return null;const n=i+(512&t?0:-1),r=e.length-1;return n>=r&&256&t?e[r][i]:n<=r?e[n]:void 0}function W(e,t,i){const n=e.u;let r=0|n[k];return Pt(r),ne(n,r,t,i),e}function ne(e,t,i,n){const r=512&t?0:-1,s=i+r;var o=e.length-1;return s>=o&&256&t?(e[o][i]=n,t):s<=o?(e[s]=n,t):(n!==void 0&&(i>=(o=t>>14&1023||536870912)?n!=null&&(e[o+r]={[i]:n},me(e,t|=256)):e[s]=n),t)}function er(e,t){let i=0|(e=e.u)[k];const n=xt(e,i,t),r=Ht(n);return r!=null&&r!==n&&ne(e,i,t,r),r}function vc(e){let t=0|(e=e.u)[k];const i=xt(e,t,1),n=Is(i,!0);return n!=null&&n!==i&&ne(e,t,1,n),n}function ni(){return gd===void 0?2:4}function ri(e,t,i,n,r){const s=e.u,o=2&(e=0|s[k])?1:n;r=!!r;let a=0|(n=Zs(s,e,t))[k];if(!(4&a)){4&a&&(n=Be(n),a=St(a,e),e=ne(s,e,t,n));let c=0,l=0;for(;c<n.length;c++){const d=i(n[c]);d!=null&&(n[l++]=d)}l<c&&(n.length=l),a=qs(a,e),i=-2049&(20|a),a=i&=-4097,me(n,a),2&a&&Object.freeze(n)}return o===1||o===4&&32&a?kt(a)||(r=a,a|=2,a!==r&&me(n,a),Object.freeze(n)):(o===2&&kt(a)&&(n=Be(n),a=St(a,e),a=Vt(a,e,r),me(n,a),e=ne(s,e,t,n)),kt(a)||(t=a,a=Vt(a,e,r),a!==t&&me(n,a))),n}function Zs(e,t,i){return e=xt(e,t,i),Array.isArray(e)?e:Ts}function qs(e,t){return e===0&&(e=St(e,t)),1|e}function kt(e){return!!(2&e)&&!!(4&e)||!!(1024&e)}function bc(e){e=Be(e);for(let t=0;t<e.length;t++){const i=e[t]=Be(e[t]);Array.isArray(i[1])&&(i[1]=_i(i[1]))}return e}function Ws(e,t,i,n){let r=0|(e=e.u)[k];Pt(r),ne(e,r,t,(n==="0"?Number(i)===0:i===n)?void 0:i)}function Si(e,t,i,n){Pt(t);let r=Zs(e,t,i);const s=r!==Ts;if(64&t||!(8192&t)||!s){const o=s?0|r[k]:0;let a=o;(!s||2&a||kt(a)||4&a&&!(32&a))&&(r=Be(r),a=St(a,t),t=ne(e,t,i,r)),a=-13&qs(a,t),a=Vt(n?-17&a:16|a,t,!0),a!==o&&me(r,a)}return r}function Xs(e,t){var i=bl;return Ks(Ys(e=e.u),e,0|e[k],i)===t?t:-1}function Ys(e){var i;if(Vn)return(i=e[cn])!=null?i:e[cn]=new Map;if(cn in e)return e[cn];const t=new Map;return Object.defineProperty(e,cn,{value:t}),t}function wc(e,t,i,n){const r=Ys(e),s=Ks(r,e,t,i);return s!==n&&(s&&(t=ne(e,t,s)),r.set(i,n)),t}function Ks(e,t,i,n){let r=e.get(n);if(r!=null)return r;r=0;for(let s=0;s<n.length;s++){const o=n[s];xt(t,i,o)!=null&&(r!==0&&(i=ne(t,i,r)),r=o)}return e.set(n,r),r}function Js(e,t,i){let n=0|e[k];const r=xt(e,n,i);let s;if(r!=null&&r.W===ln)return(t=Qn(r))!==r&&ne(e,n,i,t),t.u;if(Array.isArray(r)){const o=0|r[k];s=2&o?Ut(Jn(r,o,!1),t,!0):64&o?r:Ut(s,t,!0)}else s=Ut(void 0,t,!0);return s!==r&&ne(e,n,i,s),s}function yc(e,t,i){let n=0|(e=e.u)[k];const r=xt(e,n,i);return(t=Hs(r,t,!1,n))!==r&&t!=null&&ne(e,n,i,t),t}function N(e,t,i){if((t=yc(e,t,i))==null)return t;let n=0|(e=e.u)[k];if(!(2&n)){const r=Qn(t);r!==t&&ne(e,n,i,t=r)}return t}function _c(e,t,i,n,r,s,o){e=e.u;var a=!!(2&t);const c=a?1:r;s=!!s,o&&(o=!a);var l=0|(r=Zs(e,t,n))[k];if(!(a=!!(4&l))){var d=r,h=t;const u=!!(2&(l=qs(l,t)));u&&(h|=2);let p=!u,f=!0,m=0,v=0;for(;m<d.length;m++){const g=Hs(d[m],i,!1,h);if(g instanceof i){if(!u){const b=!!(2&(0|g.u[k]));p&&(p=!b),f&&(f=b)}d[v++]=g}}v<m&&(d.length=v),l|=4,l=f?16|l:-17&l,me(d,l=p?8|l:-9&l),u&&Object.freeze(d)}if(o&&!(8&l||!r.length&&(c===1||c===4&&32&l))){for(kt(l)&&(r=Be(r),l=St(l,t),t=ne(e,t,n,r)),i=r,o=l,d=0;d<i.length;d++)(l=i[d])!==(h=Qn(l))&&(i[d]=h);o|=8,me(i,o=i.length?-17&o:16|o),l=o}return c===1||c===4&&32&l?kt(l)||(t=l,(l|=!r.length||16&l&&(!a||32&l)?2:1024)!==t&&me(r,l),Object.freeze(r)):(c===2&&kt(l)&&(me(r=Be(r),l=Vt(l=St(l,t),t,s)),t=ne(e,t,n,r)),kt(l)||(n=l,(l=Vt(l,t,s))!==n&&me(r,l))),r}function At(e,t,i){const n=0|e.u[k];return _c(e,n,t,i,ni(),!1,!(2&n))}function S(e,t,i,n){return n==null&&(n=void 0),W(e,i,n)}function pn(e,t,i,n){n==null&&(n=void 0);e:{let r=0|(e=e.u)[k];if(Pt(r),n==null){const s=Ys(e);if(Ks(s,e,r,i)!==t)break e;s.set(i,0)}else r=wc(e,r,i,t);ne(e,r,t,n)}}function St(e,t){return-1025&(e=32|(2&t?2|e:-3&e))}function Vt(e,t,i){return 32&t&&i||(e&=-33),e}function tr(e,t,i){Pt(0|e.u[k]),ri(e,t,ki,2,!0).push(dc(i))}function ir(e,t,i,n){const r=0|e.u[k];Pt(r),e=_c(e,r,i,t,2,!0),n=n!=null?n:new i,e.push(n),e[k]=2&(0|n.u[k])?-9&e[k]:-17&e[k]}function Ye(e,t){return Ei(Ai(e,t))}function Ke(e,t){return ki(Ai(e,t))}function he(e,t){var i;return(i=er(e,t))!=null?i:0}function fn(e,t,i){if(i!=null&&typeof i!="boolean")throw e=typeof i,Error(`Expected boolean but got ${e!="object"?e:i?Array.isArray(i)?"array":e:"null"}: ${i}`);W(e,t,i)}function pt(e,t,i){if(i!=null){if(typeof i!="number"||!Xn(i))throw Ss("int32");i|=0}W(e,t,i)}function x(e,t,i){if(i!=null&&typeof i!="number")throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);W(e,t,i)}function nr(e,t,i){{const o=e.u;let a=0|o[k];if(Pt(a),i==null)ne(o,a,t);else{var n=e=0|i[k],r=kt(e),s=r||Object.isFrozen(i);for(r||(e=0),s||(i=Be(i),n=0,e=Vt(e=St(e,a),a,!0),s=!1),e|=21,r=0;r<i.length;r++){const c=i[r],l=dc(c);Object.is(c,l)||(s&&(i=Be(i),n=0,e=Vt(e=St(e,a),a,!0),s=!1),i[r]=l)}e!==n&&(s&&(i=Be(i),e=Vt(e=St(e,a),a,!0)),me(i,e)),ne(o,a,t,i)}}}function Cc(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Qs(){return Error("Failed to read varint, encoding is invalid.")}function Ec(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function eo(e){if(typeof e=="string")return{buffer:V1(e),O:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Uint8Array)return{buffer:e,O:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),O:!1};if(e.constructor===Et)return{buffer:ks(e)||new Uint8Array(0),O:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function to(e,t){let i,n=0,r=0,s=0;const o=e.h;let a=e.g;do i=o[a++],n|=(127&i)<<s,s+=7;while(s<32&&128&i);for(s>32&&(r|=(127&i)>>4),s=3;s<32&&128&i;s+=7)i=o[a++],r|=(127&i)<<s;if(si(e,a),i<128)return t(n>>>0,r>>>0);throw Qs()}function io(e){let t=0,i=e.g;const n=i+10,r=e.h;for(;i<n;){const s=r[i++];if(t|=s,(128&s)==0)return si(e,i),!!(127&t)}throw Qs()}function jt(e){const t=e.h;let i=e.g,n=t[i++],r=127&n;if(128&n&&(n=t[i++],r|=(127&n)<<7,128&n&&(n=t[i++],r|=(127&n)<<14,128&n&&(n=t[i++],r|=(127&n)<<21,128&n&&(n=t[i++],r|=n<<28,128&n&&128&t[i++]&&128&t[i++]&&128&t[i++]&&128&t[i++]&&128&t[i++])))))throw Qs();return si(e,i),r}function Lt(e){return jt(e)>>>0}function no(e){var t=e.h;const i=e.g,n=t[i],r=t[i+1],s=t[i+2];return t=t[i+3],si(e,e.g+4),(n<<0|r<<8|s<<16|t<<24)>>>0}function ro(e){var t=no(e);e=2*(t>>31)+1;const i=t>>>23&255;return t&=8388607,i==255?t?NaN:e*(1/0):i==0?1401298464324817e-60*e*t:e*Math.pow(2,i-150)*(t+8388608)}function Nd(e){return jt(e)}function so(e,t,{aa:i=!1}={}){e.aa=i,t&&(t=eo(t),e.h=t.buffer,e.m=t.O,e.j=0,e.l=e.h.length,e.g=e.j)}function si(e,t){if(e.g=t,t>e.l)throw Ec(e.l,t)}function xc(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);const i=e.g,n=i+t;if(n>e.l)throw Ec(t,e.l-i);return e.g=n,i}function kc(e,t){if(t==0)return ti();var i=xc(e,t);return e.aa&&e.m?i=e.h.subarray(i,i+t):(e=e.h,i=i===(t=i+t)?new Uint8Array(0):Ed?e.slice(i,t):new Uint8Array(e.subarray(i,t))),i.length==0?ti():new Et(i,bi)}ut.prototype.toJSON=void 0;var Ac=[];function Sc(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var i=Lt(e.g);if(t=i>>>3,!((i&=7)>=0&&i<=5))throw Cc(i,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=i,!0}function rr(e){switch(e.h){case 0:e.h!=0?rr(e):io(e.g);break;case 1:si(e=e.g,e.g+8);break;case 2:if(e.h!=2)rr(e);else{var t=Lt(e.g);si(e=e.g,e.g+t)}break;case 5:si(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Sc(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}rr(e)}break;default:throw Cc(e.h,e.l)}}function mn(e,t,i){const n=e.g.l,r=Lt(e.g),s=e.g.g+r;let o=s-n;if(o<=0&&(e.g.l=s,i(t,e,void 0,void 0,void 0),o=s-e.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${r} bytes, instead read ${r-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=n,t}function oo(e){var t=Lt(e.g),i=xc(e=e.g,t);if(e=e.h,sd){var n,r=e;(n=ws)||(n=ws=new TextDecoder("utf-8",{fatal:!0})),t=i+t,r=i===0&&t===r.length?r:r.subarray(i,t);try{var s=n.decode(r)}catch(a){if(Nn===void 0){try{n.decode(new Uint8Array([128]))}catch(c){}try{n.decode(new Uint8Array([97])),Nn=!0}catch(c){Nn=!1}}throw!Nn&&(ws=void 0),a}}else{t=(s=i)+t,i=[];let a,c=null;for(;s<t;){var o=e[s++];o<128?i.push(o):o<224?s>=t?Qt():(a=e[s++],o<194||(192&a)!=128?(s--,Qt()):i.push((31&o)<<6|63&a)):o<240?s>=t-1?Qt():(a=e[s++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(n=e[s++]))!=128?(s--,Qt()):i.push((15&o)<<12|(63&a)<<6|63&n)):o<=244?s>=t-2?Qt():(a=e[s++],(192&a)!=128||a-144+(o<<28)>>30!=0||(192&(n=e[s++]))!=128||(192&(r=e[s++]))!=128?(s--,Qt()):(o=(7&o)<<18|(63&a)<<12|(63&n)<<6|63&r,o-=65536,i.push(55296+(o>>10&1023),56320+(1023&o)))):Qt(),i.length>=8192&&(c=I1(c,i),i.length=0)}s=I1(c,i)}return s}function Lc(e){const t=Lt(e.g);return kc(e.g,t)}function sr(e,t,i){var n=Lt(e.g);for(n=e.g.g+n;e.g.g<n;)i.push(t(e.g))}var or=[];function at(e,t,i){t.g?t.m(e,t.g,t.h,i):t.m(e,t.h,i)}var C=class{constructor(e,t){this.u=gc(e,t)}toJSON(){try{var e=mc(this)}finally{Yn=void 0}return e}l(){var e=_0;return e.g?e.l(this,e.g,e.h):e.l(this,e.h,e.defaultValue)}clone(){const e=this.u;return new this.constructor(Jn(e,0|e[k],!1))}O(){return!!(2&(0|this.u[k]))}};function Mc(e){return e?/^\d+$/.test(e)?(Wn(e),new ao(q,oe)):null:Hd||(Hd=new ao(0,0))}C.prototype.W=ln,C.prototype.toString=function(){return this.u.toString()};var ao=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Hd;function Tc(e){return e?/^-?\d+$/.test(e)?(Wn(e),new co(q,oe)):null:Ud||(Ud=new co(0,0))}var co=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let Ud;function Li(e,t,i){for(;i>0||t>127;)e.g.push(127&t|128),t=(t>>>7|i<<25)>>>0,i>>>=7;e.g.push(t)}function Mi(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ar(e,t){if(t>=0)Mi(e,t);else{for(let i=0;i<9;i++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function gn(e,t){e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function Ti(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function $e(e,t,i){Mi(e.g,8*t+i)}function lo(e,t){return $e(e,t,2),t=e.g.end(),Ti(e,t),t.push(e.h),t}function ho(e,t){var i=t.pop();for(i=e.h+e.g.length()-i;i>127;)t.push(127&i|128),i>>>=7,e.h++;t.push(i),e.h++}function cr(e,t,i){$e(e,t,2),Mi(e.g,i.length),Ti(e,e.g.end()),Ti(e,i)}function lr(e,t,i,n){i!=null&&(t=lo(e,t),n(i,e),ho(e,t))}function ct(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var uo=ct(),Ic=ct(),po=ct(),fo=ct(),Fc=ct(),Bc=ct(),mo=ct(),Dc=ct(),Rc=ct(),Ii=class{constructor(e,t,i){this.g=e,this.h=t,e=uo,this.l=!!e&&i===e||!1}};function hr(e,t){return new Ii(e,t,uo)}function Oc(e,t,i,n,r){lr(e,i,Hc(t,n),r)}const Vd=hr(function(e,t,i,n,r){return e.h===2&&(mn(e,Js(t,n,i),r),!0)},Oc),jd=hr(function(e,t,i,n,r){return e.h===2&&(mn(e,Js(t,n,i),r),!0)},Oc);var dr=Symbol(),go=Symbol(),Pc=Symbol(),$c=Symbol();let ur,pr;function oi(e,t,i,n){var r=n[e];if(r)return r;(r={}).Ma=n,r.T=function(h){switch(typeof h){case"boolean":return pc||(pc=[0,void 0,!0]);case"number":return h>0?void 0:h===0?Pd||(Pd=[0,void 0]):[-h,void 0];case"string":return[0,h];case"object":return h}}(n[0]);var s=n[1];let o=1;s&&s.constructor===Object&&(r.ga=s,typeof(s=n[++o])=="function"&&(r.la=!0,ur!=null||(ur=s),pr!=null||(pr=n[o+1]),s=n[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=n[++o]}for(c=1;s!==void 0;){let h;typeof s=="number"&&(c+=s,s=n[++o]);var l=void 0;if(s instanceof Ii?h=s:(h=Vd,o--),h==null?void 0:h.l){s=n[++o],l=n;var d=o;typeof s=="function"&&(s=s(),l[d]=s),l=s}for(d=c+1,typeof(s=n[++o])=="number"&&s<0&&(d-=s,s=n[++o]);c<d;c++){const u=a[c];l?i(r,c,h,l,u):t(r,c,h,u)}}return n[e]=r}function Nc(e){return Array.isArray(e)?e[0]instanceof Ii?e:[jd,e]:[e,void 0]}function Hc(e,t){return e instanceof C?e.u:Array.isArray(e)?Ut(e,t,!1):void 0}function vo(e,t,i,n){const r=i.g;e[t]=n?(s,o,a)=>r(s,o,a,n):r}function bo(e,t,i,n,r){const s=i.g;let o,a;e[t]=(c,l,d)=>s(c,l,d,a||(a=oi(go,vo,bo,n).T),o||(o=wo(n)),r)}function wo(e){let t=e[Pc];if(t!=null)return t;const i=oi(go,vo,bo,e);return t=i.la?(n,r)=>ur(n,r,i):(n,r)=>{const s=0|n[k];for(;Sc(r)&&r.h!=4;){var o=r.m,a=i[o];if(a==null){var c=i.ga;c&&(c=c[o])&&(c=Gd(c))!=null&&(a=i[o]=c)}a!=null&&a(r,n,o)||(o=(a=r).l,rr(a),a.fa?a=void 0:(c=a.g.g-o,a.g.g=o,a=kc(a.g,c)),o=n,a&&((c=o[yi])?c.push(a):o[yi]=[a]))}return 8192&s&&_i(n),!0},e[Pc]=t}function Gd(e){const t=(e=Nc(e))[0].g;if(e=e[1]){const i=wo(e),n=oi(go,vo,bo,e).T;return(r,s,o)=>t(r,s,o,n,i)}return t}function fr(e,t,i){e[t]=i.h}function mr(e,t,i,n){let r,s;const o=i.h;e[t]=(a,c,l)=>o(a,c,l,s||(s=oi(dr,fr,mr,n).T),r||(r=Uc(n)))}function Uc(e){let t=e[$c];if(!t){const i=oi(dr,fr,mr,e);t=(n,r)=>Vc(n,r,i),e[$c]=t}return t}function Vc(e,t,i){(function(n,r,s){const o=512&r?0:-1,a=n.length,c=a+((r=64&r?256&r:!!a&&zn(n[a-1]))?-1:0);for(let l=0;l<c;l++)s(l-o,n[l]);if(r){n=n[a-1];for(const l in n)!isNaN(l)&&s(+l,n[l])}})(e,0|e[k]|(i.T[1]?512:0),(n,r)=>{if(r!=null){var s=function(o,a){var c=o[a];if(c)return c;if((c=o.ga)&&(c=c[a])){var l=(c=Nc(c))[0].h;if(c=c[1]){const d=Uc(c),h=oi(dr,fr,mr,c).T;c=o.la?pr(h,d):(u,p,f)=>l(u,p,f,h,d)}else c=l;return o[a]=c}}(i,n);s&&s(t,r,n)}}),(e=Fs(e))&&function(n,r){Ti(n,n.g.end());for(let s=0;s<r.length;s++)Ti(n,ks(r[s])||new Uint8Array(0))}(t,e)}function Fi(e,t){if(Array.isArray(t)){var i=0|t[k];if(4&i)return t;for(var n=0,r=0;n<t.length;n++){const s=e(t[n]);s!=null&&(t[r++]=s)}return r<n&&(t.length=r),me(t,-6145&(5|i)),2&i&&Object.freeze(t),t}}function Se(e,t,i){return new Ii(e,t,i)}function Bi(e,t,i){return new Ii(e,t,i)}function Le(e,t,i){ne(e,0|e[k],t,i)}var zd=hr(function(e,t,i,n,r){return e.h===2&&(e=mn(e,Ut([void 0,void 0],n,!0),r),Pt(n=0|t[k]),(r=xt(t,n,i))instanceof ut?(2&r.M)!=0?((r=r.da()).push(e),ne(t,n,i,r)):r.Ja(e):Array.isArray(r)?(2&(0|r[k])&&ne(t,n,i,r=bc(r)),r.push(e)):ne(t,n,i,[e]),!0)},function(e,t,i,n,r){if(t instanceof ut)t.forEach((s,o)=>{lr(e,i,Ut([o,s],n,!1),r)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){const o=t[s];Array.isArray(o)&&lr(e,i,Ut(o,n,!1),r)}});function jc(e,t,i){if(t=function(n){if(n==null)return n;const r=typeof n;if(r==="bigint")return String(dn(64,n));if(un(n)){if(r==="string")return cc(n);if(r==="number")return $s(n)}}(t),t!=null&&(typeof t=="string"&&Tc(t),t!=null))switch($e(e,i,0),typeof t){case"number":e=e.g,ii(t),Li(e,q,oe);break;case"bigint":i=BigInt.asUintN(64,t),i=new co(Number(i&BigInt(4294967295)),Number(i>>BigInt(32))),Li(e.g,i.h,i.g);break;default:i=Tc(t),Li(e.g,i.h,i.g)}}function Gc(e,t,i){(t=Ei(t))!=null&&t!=null&&($e(e,i,0),ar(e.g,t))}function zc(e,t,i){(t=nc(t))!=null&&($e(e,i,0),e.g.g.push(t?1:0))}function Zc(e,t,i){(t=ki(t))!=null&&cr(e,i,F1(t))}function qc(e,t,i,n,r){lr(e,i,Hc(t,n),r)}function Wc(e,t,i){t==null||typeof t=="string"||t instanceof Et||(ei(t)?ei(t)&&Ls(Z1):t=void 0),t!=null&&cr(e,i,eo(t).buffer)}function Xc(e,t,i){return(e.h===5||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,ro,t):t.push(ro(e.g)),!0)}var Mt=Se(function(e,t,i){if(e.h!==1)return!1;var n=e.g;e=no(n);const r=no(n);n=2*(r>>31)+1;const s=r>>>20&2047;return e=4294967296*(1048575&r)+e,Le(t,i,s==2047?e?NaN:n*(1/0):s==0?5e-324*n*e:n*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,i){(t=Ht(t))!=null&&($e(e,i,1),e=e.g,(i=Q1||(Q1=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),q=i.getUint32(0,!0),oe=i.getUint32(4,!0),gn(e,q),gn(e,oe))},ct()),ge=Se(function(e,t,i){return e.h===5&&(Le(t,i,ro(e.g)),!0)},function(e,t,i){(t=Ht(t))!=null&&($e(e,i,5),e=e.g,Ds(t),gn(e,q))},mo),Zd=Bi(Xc,function(e,t,i){if((t=Fi(Ht,t))!=null)for(let o=0;o<t.length;o++){var n=e,r=i,s=t[o];s!=null&&($e(n,r,5),n=n.g,Ds(s),gn(n,q))}},mo),yo=Bi(Xc,function(e,t,i){if((t=Fi(Ht,t))!=null&&t.length){$e(e,i,2),Mi(e.g,4*t.length);for(let n=0;n<t.length;n++)i=e.g,Ds(t[n]),gn(i,q)}},mo),Gt=Se(function(e,t,i){return e.h===0&&(Le(t,i,to(e.g,Os)),!0)},jc,Bc),_o=Se(function(e,t,i){return e.h===0&&(Le(t,i,(e=to(e.g,Os))===0?void 0:e),!0)},jc,Bc),qd=Se(function(e,t,i){return e.h===0&&(Le(t,i,to(e.g,Rs)),!0)},function(e,t,i){if((t=Sd(t))!=null&&(typeof t=="string"&&Mc(t),t!=null))switch($e(e,i,0),typeof t){case"number":e=e.g,ii(t),Li(e,q,oe);break;case"bigint":i=BigInt.asUintN(64,t),i=new ao(Number(i&BigInt(4294967295)),Number(i>>BigInt(32))),Li(e.g,i.h,i.g);break;default:i=Mc(t),Li(e.g,i.h,i.g)}},ct()),ae=Se(function(e,t,i){return e.h===0&&(Le(t,i,jt(e.g)),!0)},Gc,fo),gr=Bi(function(e,t,i){return(e.h===0||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,jt,t):t.push(jt(e.g)),!0)},function(e,t,i){if((t=Fi(Ei,t))!=null&&t.length){i=lo(e,i);for(let n=0;n<t.length;n++)ar(e.g,t[n]);ho(e,i)}},fo),Di=Se(function(e,t,i){return e.h===0&&(Le(t,i,(e=jt(e.g))===0?void 0:e),!0)},Gc,fo),Q=Se(function(e,t,i){return e.h===0&&(Le(t,i,io(e.g)),!0)},zc,Ic),Ri=Se(function(e,t,i){return e.h===0&&(Le(t,i,(e=io(e.g))===!1?void 0:e),!0)},zc,Ic),ke=Bi(function(e,t,i){return e.h===2&&(e=oo(e),Si(t,0|t[k],i,!1).push(e),!0)},function(e,t,i){if((t=Fi(ki,t))!=null)for(let o=0;o<t.length;o++){var n=e,r=i,s=t[o];s!=null&&cr(n,r,F1(s))}},po),zt=Se(function(e,t,i){return e.h===2&&(Le(t,i,(e=oo(e))===""?void 0:e),!0)},Zc,po),j=Se(function(e,t,i){return e.h===2&&(Le(t,i,oo(e)),!0)},Zc,po),we=function(e,t,i=uo){return new Ii(e,t,i)}(function(e,t,i,n,r){return e.h===2&&(n=Ut(void 0,n,!0),Si(t,0|t[k],i,!0).push(n),mn(e,n,r),!0)},function(e,t,i,n,r){if(Array.isArray(t))for(let s=0;s<t.length;s++)qc(e,t[s],i,n,r)}),G=hr(function(e,t,i,n,r,s){return e.h===2&&(wc(t,0|t[k],s,i),mn(e,t=Js(t,n,i),r),!0)},qc),Yc=Se(function(e,t,i){return e.h===2&&(Le(t,i,Lc(e)),!0)},Wc,Dc),Wd=Bi(function(e,t,i){return(e.h===0||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,Lt,t):t.push(Lt(e.g)),!0)},function(e,t,i){if((t=Fi(rc,t))!=null)for(let o=0;o<t.length;o++){var n=e,r=i,s=t[o];s!=null&&($e(n,r,0),Mi(n.g,s))}},Fc),Xd=Se(function(e,t,i){return e.h===0&&(Le(t,i,(e=Lt(e.g))===0?void 0:e),!0)},function(e,t,i){(t=rc(t))!=null&&t!=null&&($e(e,i,0),Mi(e.g,t))},Fc),Ne=Se(function(e,t,i){return e.h===0&&(Le(t,i,jt(e.g)),!0)},function(e,t,i){(t=Ei(t))!=null&&(t=parseInt(t,10),$e(e,i,0),ar(e.g,t))},Rc);class Yd{constructor(t,i){this.h=t,this.g=i,this.l=N,this.m=S,this.defaultValue=void 0}register(){Un(this)}}function lt(e,t){return new Yd(e,t)}function Zt(e,t){return(i,n)=>{if(or.length){const s=or.pop();s.o(n),so(s.g,i,n),i=s}else i=new class{constructor(s,o){if(Ac.length){const a=Ac.pop();so(a,s,o),s=a}else s=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,so(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(s,o);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(o)}o({fa:s=!1}={}){this.fa=s}}(i,n);try{const s=new e,o=s.u;wo(t)(o,i);var r=s}finally{i.g.clear(),i.m=-1,i.h=-1,or.length<100&&or.push(i)}return r}}function vr(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}}}};Vc(this.u,t,oi(dr,fr,mr,e)),Ti(t,t.g.end());const i=new Uint8Array(t.h),n=t.l,r=n.length;let s=0;for(let o=0;o<r;o++){const a=n[o];i.set(a,s),s+=a.length}return t.l=[i],i}}var Kc=class extends C{constructor(e){super(e)}},Jc=[0,zt,Se(function(e,t,i){return e.h===2&&(Le(t,i,(e=Lc(e))===ti()?void 0:e),!0)},function(e,t,i){if(t!=null){if(t instanceof C){const n=t.Oa;return void(n&&(t=n(t),t!=null&&cr(e,i,eo(t).buffer)))}if(Array.isArray(t))return}Wc(e,t,i)},Dc)];let Co,Qc=globalThis.trustedTypes;function el(e){Co===void 0&&(Co=function(){let i=null;if(!Qc)return i;try{const n=r=>r;i=Qc.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch(n){}return i}());var t=Co;return new class{constructor(i){this.g=i}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Kd(e,...t){if(t.length===0)return el(e[0]);let i=e[0];for(let n=0;n<t.length;n++)i+=encodeURIComponent(t[n])+e[n+1];return el(i)}var tl=[0,ae,Ne,Q,-1,gr,Ne,-1],Jd=class extends C{constructor(e){super(e)}},il=[0,Q,j,Q,Ne,-1,Bi(function(e,t,i){return(e.h===0||e.h===2)&&(t=Si(t,0|t[k],i,!1),e.h==2?sr(e,Nd,t):t.push(jt(e.g)),!0)},function(e,t,i){if((t=Fi(Ei,t))!=null&&t.length){i=lo(e,i);for(let n=0;n<t.length;n++)ar(e.g,t[n]);ho(e,i)}},Rc),j,-1,[0,Q,-1],Ne,Q,-1],nl=[0,j,-2],rl=class extends C{constructor(e){super(e)}},sl=[0],ol=[0,ae,Q,1,Q,-3],He=class extends C{constructor(e){super(e,2)}},ve={};ve[336783863]=[0,j,Q,-1,ae,[0,[1,2,3,4,5,6,7,8,9],G,sl,G,il,G,nl,G,ol,G,tl,G,[0,j,-2],G,[0,j,Ne],G,[0,Ne,j,-1],G,[0,Ne,-1]],[0,j],Q,[0,[1,3],[2,4],G,[0,gr],-1,G,[0,ke],-1,we,[0,j,-1]],j];var al=[0,_o,-1,Ri,-3,_o,gr,zt,Di,_o,-1,Ri,Di,Ri,-2,zt];function Ue(e,t){Ws(e,2,xi(t),"")}function X(e,t){tr(e,3,t)}function $(e,t){tr(e,4,t)}var Me=class extends C{constructor(e){super(e,500)}o(e){return S(this,0,7,e)}},vn=[-1,{}],cl=[0,j,1,vn],ll=[0,j,ke,vn];function Ve(e,t){ir(e,1,Me,t)}function Y(e,t){tr(e,10,t)}function H(e,t){tr(e,15,t)}var De=class extends C{constructor(e){super(e,500)}o(e){return S(this,0,1001,e)}},hl=[-500,we,[-500,zt,-1,ke,-3,[-2,ve,Q],we,Jc,Di,-1,cl,ll,we,[0,zt,Ri],zt,al,Di,ke,987,ke],4,we,[-500,j,-1,[-1,{}],998,j],we,[-500,j,ke,-1,[-2,{},Q],997,ke,-1],Di,we,[-500,j,ke,vn,998,ke],ke,Di,cl,ll,we,[0,zt,-1,vn],ke,-2,al,zt,-1,Ri,[0,Ri,Xd],978,vn,we,Jc];De.prototype.g=vr(hl);var Qd=Zt(De,hl),e0=class extends C{constructor(e){super(e)}},dl=class extends C{constructor(e){super(e)}g(){return At(this,e0,1)}},ul=[0,we,[0,ae,ge,j,-1]],br=Zt(dl,ul),t0=class extends C{constructor(e){super(e)}},i0=class extends C{constructor(e){super(e)}},Eo=class extends C{constructor(e){super(e)}h(){return N(this,t0,2)}g(){return At(this,i0,5)}},pl=Zt(class extends C{constructor(e){super(e)}},[0,ke,gr,yo,[0,Ne,[0,ae,-3],[0,ge,-3],[0,ae,-1,[0,we,[0,ae,-2]]],we,[0,ge,-1,j,ge]],j,-1,Gt,we,[0,ae,ge],ke,Gt]),fl=class extends C{constructor(e){super(e)}},Oi=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,ge,-4]]),ml=class extends C{constructor(e){super(e)}},bn=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,ge,-4]]),n0=class extends C{constructor(e){super(e)}},r0=[0,ae,-1,yo,Ne],gl=class extends C{constructor(e){super(e)}};gl.prototype.g=vr([0,ge,-4,Gt]);var s0=class extends C{constructor(e){super(e)}},o0=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,1,ae,j,ul],Gt]),vl=class extends C{constructor(e){super(e)}},a0=class extends C{constructor(e){super(e)}ma(){const e=vc(this);return e==null?ti():e}},c0=class extends C{constructor(e){super(e)}},bl=[1,2],l0=Zt(class extends C{constructor(e){super(e)}},[0,we,[0,bl,G,[0,yo],G,[0,Yc],ae,j],Gt]),xo=class extends C{constructor(e){super(e)}},wl=[0,j,ae,ge,ke,-1],yl=class extends C{constructor(e){super(e)}},h0=[0,Q,-1],_l=class extends C{constructor(e){super(e)}},wr=[1,2,3,4,5],yr=class extends C{constructor(e){super(e)}g(){return vc(this)!=null}h(){return Ke(this,2)!=null}},ee=class extends C{constructor(e){super(e)}g(){var e;return(e=nc(Ai(this,2)))!=null?e:!1}},Cl=[0,Yc,j,[0,ae,Gt,-1],[0,qd,Gt]],de=[0,Cl,Q,[0,wr,G,ol,G,il,G,tl,G,sl,G,nl],Ne],_r=class extends C{constructor(e){super(e)}},ko=[0,de,ge,-1,ae],d0=lt(502141897,_r);ve[502141897]=ko;var u0=Zt(class extends C{constructor(e){super(e)}},[0,[0,Ne,-1,Zd,Wd],r0]),El=class extends C{constructor(e){super(e)}},xl=class extends C{constructor(e){super(e)}},Ao=[0,de,ge,[0,de],Q],kl=[0,de,ko,Ao,ge,[0,[0,Cl]]],p0=lt(508968150,xl);ve[508968150]=kl,ve[508968149]=Ao;var Al=class extends C{constructor(e){super(e)}},f0=lt(513916220,Al);ve[513916220]=[0,de,kl,ae];var Pi=class extends C{constructor(e){super(e)}h(){return N(this,xo,2)}g(){W(this,2)}},Sl=[0,de,wl];ve[478825465]=Sl;var m0=class extends C{constructor(e){super(e)}},Ll=class extends C{constructor(e){super(e)}},So=class extends C{constructor(e){super(e)}},Lo=class extends C{constructor(e){super(e)}},Ml=class extends C{constructor(e){super(e)}},Tl=[0,de,[0,de],Sl,-1],Il=[0,de,ge,ae],Mo=[0,de,ge],Fl=[0,de,Il,Mo,ge],g0=lt(479097054,Ml);ve[479097054]=[0,de,Fl,Tl],ve[463370452]=Tl,ve[464864288]=Il;var v0=lt(462713202,Lo);ve[462713202]=Fl,ve[474472470]=Mo;var b0=class extends C{constructor(e){super(e)}},Bl=class extends C{constructor(e){super(e)}},Dl=class extends C{constructor(e){super(e)}},Rl=class extends C{constructor(e){super(e)}},To=[0,de,ge,-1,ae],Io=[0,de,ge,Q];Rl.prototype.g=vr([0,de,Mo,[0,de],ko,Ao,To,Io]);var Ol=class extends C{constructor(e){super(e)}},w0=lt(456383383,Ol);ve[456383383]=[0,de,wl];var Pl=class extends C{constructor(e){super(e)}},y0=lt(476348187,Pl);ve[476348187]=[0,de,h0];var $l=class extends C{constructor(e){super(e)}},Nl=class extends C{constructor(e){super(e)}},Hl=[0,Ne,-1],_0=lt(458105876,class extends C{constructor(e){super(e)}g(){var e=this.u;const t=0|e[k],i=2&t;return e=function(n,r,s){var o=Nl;const a=2&r;let c=!1;if(s==null){if(a)return fc();s=[]}else if(s.constructor===ut){if((2&s.M)==0||a)return s;s=s.da()}else Array.isArray(s)?c=!!(2&(0|s[k])):s=[];if(a){if(!s.length)return fc();c||(c=!0,_i(s))}else c&&(c=!1,s=bc(s));return c||(64&(0|s[k])?s[k]&=-33:32&r&&jn(s,32)),ne(n,r,2,o=new ut(s,o,Ld,void 0)),o}(e,t,xt(e,t,2)),!i&&Nl&&(e.pa=!0),e}});ve[458105876]=[0,Hl,zd,[!0,Gt,[0,j,-1,ke]]];var Fo=class extends C{constructor(e){super(e)}},Ul=lt(458105758,Fo);ve[458105758]=[0,de,j,Hl];var Vl=class extends C{constructor(e){super(e)}},C0=lt(443442058,Vl);ve[443442058]=[0,de,j,ae,ge,ke,-1,Q,ge],ve[514774813]=To;var jl=class extends C{constructor(e){super(e)}},E0=lt(516587230,jl);function Bo(e,t){return t=t?t.clone():new xo,e.displayNamesLocale!==void 0?W(t,1,xi(e.displayNamesLocale)):e.displayNamesLocale===void 0&&W(t,1),e.maxResults!==void 0?pt(t,2,e.maxResults):"maxResults"in e&&W(t,2),e.scoreThreshold!==void 0?x(t,3,e.scoreThreshold):"scoreThreshold"in e&&W(t,3),e.categoryAllowlist!==void 0?nr(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&W(t,4),e.categoryDenylist!==void 0?nr(t,5,e.categoryDenylist):"categoryDenylist"in e&&W(t,5),t}function Do(e,t=-1,i=""){return{categories:e.map(n=>{var r,s,o,a,c,l,d;return{index:(s=(r=Ye(n,1))!=null?r:0)!=null?s:-1,score:(o=he(n,2))!=null?o:0,categoryName:(c=(a=Ke(n,3))!=null?a:"")!=null?c:"",displayName:(d=(l=Ke(n,4))!=null?l:"")!=null?d:""}}),headIndex:t,headName:i}}function Gl(e){var o,a,c,l,d,h,u,p,f,m,v,g,b;var t=ri(e,3,Ht,ni()),i=ri(e,2,Ei,ni()),n=ri(e,1,ki,ni()),r=ri(e,9,ki,ni());const s={categories:[],keypoints:[]};for(let _=0;_<t.length;_++)s.categories.push({score:t[_],index:(o=i[_])!=null?o:-1,categoryName:(a=n[_])!=null?a:"",displayName:(c=r[_])!=null?c:""});if((t=(l=N(e,Eo,4))==null?void 0:l.h())&&(s.boundingBox={originX:(d=Ye(t,1))!=null?d:0,originY:(h=Ye(t,2))!=null?h:0,width:(u=Ye(t,3))!=null?u:0,height:(p=Ye(t,4))!=null?p:0,angle:0}),(f=N(e,Eo,4))==null?void 0:f.g().length)for(const _ of N(e,Eo,4).g())s.keypoints.push({x:(m=er(_,1))!=null?m:0,y:(v=er(_,2))!=null?v:0,score:(g=er(_,4))!=null?g:0,label:(b=Ke(_,3))!=null?b:""});return s}function Cr(e){var i,n,r,s;const t=[];for(const o of At(e,ml,1))t.push({x:(i=he(o,1))!=null?i:0,y:(n=he(o,2))!=null?n:0,z:(r=he(o,3))!=null?r:0,visibility:(s=he(o,4))!=null?s:0});return t}function wn(e){var i,n,r,s;const t=[];for(const o of At(e,fl,1))t.push({x:(i=he(o,1))!=null?i:0,y:(n=he(o,2))!=null?n:0,z:(r=he(o,3))!=null?r:0,visibility:(s=he(o,4))!=null?s:0});return t}function zl(e){return Array.from(e,t=>t>127?t-256:t)}function Zl(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let i=0,n=0,r=0;for(let s=0;s<e.length;s++)i+=e[s]*t[s],n+=e[s]*e[s],r+=t[s]*t[s];if(n<=0||r<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return i/Math.sqrt(n*r)}let Er;ve[516587230]=[0,de,To,Io,ge],ve[518928384]=Io;const x0=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]);function ql(){return L(this,null,function*(){if(Er===void 0)try{yield WebAssembly.instantiate(x0),Er=!0}catch(e){Er=!1}return Er})}function yn(i){return L(this,arguments,function*(e,t=Kd``){const n=(yield ql())?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${n}.js`,wasmBinaryPath:`${t}/${e}_${n}.wasm`}})}var ai=class{};function Wl(){var e=navigator;return typeof OffscreenCanvas!="undefined"&&(!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))}function Xl(e){return L(this,null,function*(){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((i,n)=>{t.addEventListener("load",()=>{i()},!1),t.addEventListener("error",r=>{n(r)},!1),document.body.appendChild(t)})}importScripts(e.toString())})}function Yl(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 A(e,t,i){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),i(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Kl(e,t,i){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(i?e.i._bindTextureToStream(i):e.i._bindTextureToCanvas(),!(i=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&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);const[n,r]=Yl(t);return!e.l||n===e.i.canvas.width&&r===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=r),[n,r]}function Jl(e,t,i){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let r=0;r<t.length;r++)n[r]=e.i.stringToNewUTF8(t[r]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),i(t);for(const r of n)e.i._free(r);e.i._free(t)}function ft(e,t,i){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=i}function qt(e,t,i){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(r,s,o)=>{s?(i(n,o),n=[]):n.push(r)}}ai.forVisionTasks=function(e){return yn("vision",e)},ai.forTextTasks=function(e){return yn("text",e)},ai.forGenAiExperimentalTasks=function(e){return yn("genai_experimental",e)},ai.forGenAiTasks=function(e){return yn("genai",e)},ai.forAudioTasks=function(e){return yn("audio",e)},ai.isSimdSupported=function(){return ql()};function k0(e,t,i,n){return L(this,null,function*(){return e=yield((r,s,o,a,c)=>L(this,null,function*(){if(s&&(yield Xl(s)),!self.ModuleFactory||o&&(yield Xl(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=yield self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new r(c,a)}))(e,i.wasmLoaderPath,i.assetLoaderPath,t,{locateFile:r=>r.endsWith(".wasm")?i.wasmBinaryPath.toString():i.assetBinaryPath&&r.endsWith(".data")?i.assetBinaryPath.toString():r}),yield e.o(n),e})}function Ro(e,t){const i=N(e.baseOptions,yr,1)||new yr;typeof t=="string"?(W(i,2,xi(t)),W(i,1)):t instanceof Uint8Array&&(W(i,1,Is(t,!1)),W(i,2)),S(e.baseOptions,0,1,i)}function Ql(e){try{const t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(i=>i.message).join(", "))}finally{e.G=[]}}function y(e,t){e.B=Math.max(e.B,t)}function xr(e,t){e.A=new Me,Ue(e.A,"PassThroughCalculator"),X(e.A,"free_memory"),$(e.A,"free_memory_unused_out"),Y(t,"free_memory"),Ve(t,e.A)}function $i(e,t){X(e.A,t),$(e.A,t+"_unused_out")}function kr(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var Oo=class{constructor(e){this.g=e,this.G=[],this.B=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var i,n,r,s,o,a;if(t){const c=e.baseOptions||{};if((i=e.baseOptions)!=null&&i.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((r=N(this.baseOptions,yr,1))!=null&&r.g()||(s=N(this.baseOptions,yr,1))!=null&&s.h()||(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(l,d){let h=N(l.baseOptions,_l,3);if(!h){var u=h=new _l,p=new rl;pn(u,4,wr,p)}"delegate"in d&&(d.delegate==="GPU"?(d=h,u=new Jd,pn(d,2,wr,u)):(d=h,u=new rl,pn(d,4,wr,u))),S(l.baseOptions,0,3,h)}(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then(l=>{if(l.ok)return l.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${l.status})`)}).then(l=>{try{this.g.i.FS_unlink("/model.dat")}catch(d){}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(l),!0,!1,!1),Ro(this,"/model.dat"),this.m(),this.J()});if(c.modelAssetBuffer instanceof Uint8Array)Ro(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return function(l){return L(this,null,function*(){const d=[];for(var h=0;;){const{done:u,value:p}=yield l.read();if(u)break;d.push(p),h+=p.length}if(d.length===0)return new Uint8Array(0);if(d.length===1)return d[0];l=new Uint8Array(h),h=0;for(const u of d)l.set(u,h),h+=u.length;return l})}(c.modelAssetBuffer).then(l=>{Ro(this,l),this.m(),this.J()})}return this.m(),this.J(),Promise.resolve()}J(){}ca(){let e;if(this.g.ca(t=>{e=Qd(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((i,n)=>{this.G.push(Error(n))}),this.g.Ha(),this.g.setGraph(e,t),this.A=void 0,Ql(this)}finishProcessing(){this.g.finishProcessing(),Ql(this)}close(){this.A=void 0,this.g.closeGraph()}};function Te(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Oo.prototype.close=Oo.prototype.close;class A0{constructor(t,i,n,r){this.g=t,this.h=i,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function e2(e,t,i){const n=e.g;if(i=Te(n.createShader(i),"Failed to create WebGL shader"),n.shaderSource(i,t),n.compileShader(i),!n.getShaderParameter(i,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(i)}`);return n.attachShader(e.h,i),i}function t2(e,t){const i=e.g,n=Te(i.createVertexArray(),"Failed to create vertex array");i.bindVertexArray(n);const r=Te(i.createBuffer(),"Failed to create buffer");i.bindBuffer(i.ARRAY_BUFFER,r),i.enableVertexAttribArray(e.P),i.vertexAttribPointer(e.P,2,i.FLOAT,!1,0,0),i.bufferData(i.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),i.STATIC_DRAW);const s=Te(i.createBuffer(),"Failed to create buffer");return i.bindBuffer(i.ARRAY_BUFFER,s),i.enableVertexAttribArray(e.J),i.vertexAttribPointer(e.J,2,i.FLOAT,!1,0,0),i.bufferData(i.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),i.STATIC_DRAW),i.bindBuffer(i.ARRAY_BUFFER,null),i.bindVertexArray(null),new A0(i,n,r,s)}function Po(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function _n(e,t,i,n){return Po(e,t),e.h||(e.m(),e.C()),i?(e.s||(e.s=t2(e,!0)),i=e.s):(e.v||(e.v=t2(e,!1)),i=e.v),t.useProgram(e.h),i.bind(),e.l(),e=n(),i.g.bindVertexArray(null),e}function Wt(e,t,i){return Po(e,t),e=Te(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,i!=null?i:t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,i!=null?i:t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function Ar(e,t,i){Po(e,t),e.A||(e.A=Te(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0)}function $o(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ni=class{G(){return`
3142
3120
  precision mediump float;
3143
3121
  varying vec2 vTex;
3144
3122
  uniform sampler2D inputTexture;
@@ -3164,7 +3142,7 @@ ${this.hideAttribution?"":`
3164
3142
  vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
3165
3143
  gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
3166
3144
  }
3167
- `}C(){const e=this.g;e.activeTexture(e.TEXTURE1),this.B=Wt(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=Wt(this,e,e.NEAREST)}m(){super.m();const e=this.g;this.L=Te(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.U=Te(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.K=Te(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();const e=this.g;e.uniform1i(this.K,0),e.uniform1i(this.L,1),e.uniform1i(this.U,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},M0=class extends Ni{G(){return`
3145
+ `}C(){const e=this.g;e.activeTexture(e.TEXTURE1),this.B=Wt(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=Wt(this,e,e.NEAREST)}m(){super.m();const e=this.g;this.L=Te(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.U=Te(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.K=Te(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();const e=this.g;e.uniform1i(this.K,0),e.uniform1i(this.L,1),e.uniform1i(this.U,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},L0=class extends Ni{G(){return`
3168
3146
  precision mediump float;
3169
3147
  uniform sampler2D maskTexture;
3170
3148
  uniform sampler2D defaultTexture;
@@ -3178,7 +3156,7 @@ ${this.hideAttribution?"":`
3178
3156
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
3179
3157
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
3180
3158
  }
3181
- `}C(){const e=this.g;e.activeTexture(e.TEXTURE1),this.j=Wt(this,e),e.activeTexture(e.TEXTURE2),this.B=Wt(this,e)}m(){super.m();const e=this.g;this.K=Te(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.L=Te(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=Te(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();const e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.K,1),e.uniform1i(this.L,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Tt(e,t){switch(t){case 0:return e.g.find(i=>i instanceof Uint8Array);case 1:return e.g.find(i=>i instanceof Float32Array);case 2:return e.g.find(i=>typeof WebGLTexture!="undefined"&&i instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function No(e){var t=Tt(e,1);if(!t){if(t=Tt(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);const n=Hi(e);var i=Ho(e);if(Ar(i,n,i2(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){i=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,i);for(let r=0,s=0;r<t.length;++r,s+=4)t[r]=i[s]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function i2(e){let t=Tt(e,2);if(!t){const i=Hi(e);t=r2(e);const n=No(e),r=n2(e);i.texImage2D(i.TEXTURE_2D,0,r,e.width,e.height,0,i.RED,i.FLOAT,n),Uo(e)}return t}function Hi(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=Te(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function n2(e){if(e=Hi(e),!Sr)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Sr=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Sr=e.R16F}return Sr}function Ho(e){return e.l||(e.l=new Ni),e.l}function r2(e){const t=Hi(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let i=Tt(e,2);return i||(i=Wt(Ho(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(i),e.j=!0),t.bindTexture(t.TEXTURE_2D,i),i}function Uo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Sr,ye=class{constructor(e,t,i,n,r,s,o){this.g=e,this.m=t,this.j=i,this.canvas=n,this.l=r,this.width=s,this.height=o,this.j&&--s2===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!Tt(this,0)}ja(){return!!Tt(this,1)}R(){return!!Tt(this,2)}ia(){return(t=Tt(e=this,0))||(t=No(e),t=new Uint8Array(t.map(i=>255*i)),e.g.push(t)),t;var e,t}ha(){return No(this)}N(){return i2(this)}clone(){const e=[];for(const t of this.g){let i;if(t instanceof Uint8Array)i=new Uint8Array(t);else if(t instanceof Float32Array)i=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=Hi(this),r=Ho(this);n.activeTexture(n.TEXTURE1),i=Wt(r,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,i);const s=n2(this);n.texImage2D(n.TEXTURE_2D,0,s,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Ar(r,n,i),_n(r,n,!1,()=>{r2(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Uo(this)}),$o(r),Uo(this)}}e.push(i)}return new ye(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Hi(this).deleteTexture(Tt(this,2)),s2=-1}};ye.prototype.close=ye.prototype.close,ye.prototype.clone=ye.prototype.clone,ye.prototype.getAsWebGLTexture=ye.prototype.N,ye.prototype.getAsFloat32Array=ye.prototype.ha,ye.prototype.getAsUint8Array=ye.prototype.ia,ye.prototype.hasWebGLTexture=ye.prototype.R,ye.prototype.hasFloat32Array=ye.prototype.ja,ye.prototype.hasUint8Array=ye.prototype.Da;var s2=250;const L0={color:"white",lineWidth:4,radius:6};function Vo(e){return Fe(qi(Fe({},L0),{fillColor:(e=e||{}).color}),e)}function It(e,t){return e instanceof Function?e(t):e}function o2(e,t,i){return Math.max(Math.min(t,i),Math.min(Math.max(t,i),e))}function Cn(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function En(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function a2(e,t,i){var n;if(t.R())i(t.N());else{const r=t.ja()?t.ha():t.ia();e.m=(n=e.m)!=null?n:new Ni;const s=En(e);i((e=new ye([r],t.m,!1,s.canvas,e.m,t.width,t.height)).N()),e.close()}}function c2(e,t,i,n){const r=function(a){return a.g||(a.g=new S0),a.g}(e),s=En(e),o=Array.isArray(i)?new ImageData(new Uint8ClampedArray(i),1,1):i;_n(r,s,!0,()=>{(function(c,l,d,h){const u=c.g;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,c.B),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,d),c.H&&function(p,f){if(p!==f)return!1;p=p.entries(),f=f.entries();for(const[v,g]of p){p=v;const b=g;var m=f.next();if(m.done)return!1;const[_,E]=m.value;if(m=E,p!==_||b[0]!==m[0]||b[1]!==m[1]||b[2]!==m[2]||b[3]!==m[3])return!1}return!!f.next().done}(c.H,h))u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,c.j);else{c.H=h;const p=Array(1024).fill(0);h.forEach((f,m)=>{if(f.length!==4)throw Error(`Color at index ${m} is not a four-channel value.`);p[4*m]=f[0],p[4*m+1]=f[1],p[4*m+2]=f[2],p[4*m+3]=f[3]}),u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,c.j),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,256,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array(p))}})(r,t,o,n),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);const a=r.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)})}function l2(e,t,i,n){const r=En(e),s=function(c){return c.h||(c.h=new M0),c.h}(e),o=Array.isArray(i)?new ImageData(new Uint8ClampedArray(i),1,1):i,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;_n(s,r,!0,()=>{var c=s.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,s.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,s.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),r.bindTexture(r.TEXTURE_2D,null),(c=s.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)})}var Ie=class{constructor(e,t){typeof CanvasRenderingContext2D!="undefined"&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}wa(e,t){if(e){var i=Cn(this);t=Vo(t),i.save();var n=i.canvas,r=0;for(const s of e)i.fillStyle=It(t.fillColor,{index:r,from:s}),i.strokeStyle=It(t.color,{index:r,from:s}),i.lineWidth=It(t.lineWidth,{index:r,from:s}),(e=new Path2D).arc(s.x*n.width,s.y*n.height,It(t.radius,{index:r,from:s}),0,2*Math.PI),i.fill(e),i.stroke(e),++r;i.restore()}}va(e,t,i){if(e&&t){var n=Cn(this);i=Vo(i),n.save();var r=n.canvas,s=0;for(const o of t){n.beginPath(),t=e[o.start];const a=e[o.end];t&&a&&(n.strokeStyle=It(i.color,{index:s,from:t,to:a}),n.lineWidth=It(i.lineWidth,{index:s,from:t,to:a}),n.moveTo(t.x*r.width,t.y*r.height),n.lineTo(a.x*r.width,a.y*r.height)),++s,n.stroke()}n.restore()}}sa(e,t){const i=Cn(this);t=Vo(t),i.save(),i.beginPath(),i.lineWidth=It(t.lineWidth,{}),i.strokeStyle=It(t.color,{}),i.fillStyle=It(t.fillColor,{}),i.moveTo(e.originX,e.originY),i.lineTo(e.originX+e.width,e.originY),i.lineTo(e.originX+e.width,e.originY+e.height),i.lineTo(e.originX,e.originY+e.height),i.lineTo(e.originX,e.originY),i.stroke(),i.fill(),i.restore()}ta(e,t,i=[0,0,0,255]){this.l?function(n,r,s,o){const a=En(n);a2(n,r,c=>{c2(n,c,s,o),(c=Cn(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,i,t):c2(this,e.N(),i,t)}ua(e,t,i){this.l?function(n,r,s,o){const a=En(n);a2(n,r,c=>{l2(n,c,s,o),(c=Cn(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,i):l2(this,e.N(),t,i)}close(){var e,t,i;(e=this.g)==null||e.close(),this.g=void 0,(t=this.h)==null||t.close(),this.h=void 0,(i=this.m)==null||i.close(),this.m=void 0}};function mt(e,t){switch(t){case 0:return e.g.find(i=>i instanceof ImageData);case 1:return e.g.find(i=>typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap);case 2:return e.g.find(i=>typeof WebGLTexture!="undefined"&&i instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function h2(e){var t=mt(e,0);if(!t){t=Ui(e);const i=Lr(e),n=new Uint8Array(e.width*e.height*4);Ar(i,t,Mr(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),$o(i),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Mr(e){let t=mt(e,2);if(!t){const i=Ui(e);t=Tr(e);const n=mt(e,1)||h2(e);i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),xn(e)}return t}function Ui(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=Te(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Lr(e){return e.l||(e.l=new Ni),e.l}function Tr(e){const t=Ui(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let i=mt(e,2);return i||(i=Wt(Lr(e),t),e.g.push(i),e.m=!0),t.bindTexture(t.TEXTURE_2D,i),i}function xn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function d2(e){const t=Ui(e);return _n(Lr(e),t,!0,()=>function(i,n){const r=i.canvas;if(r.width===i.width&&r.height===i.height)return n();const s=r.width,o=r.height;return r.width=i.width,r.height=i.height,i=n(),r.width=s,r.height=o,i}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}Ie.prototype.close=Ie.prototype.close,Ie.prototype.drawConfidenceMask=Ie.prototype.ua,Ie.prototype.drawCategoryMask=Ie.prototype.ta,Ie.prototype.drawBoundingBox=Ie.prototype.sa,Ie.prototype.drawConnectors=Ie.prototype.va,Ie.prototype.drawLandmarks=Ie.prototype.wa,Ie.lerp=function(e,t,i,n,r){return o2(n*(1-(e-t)/(i-t))+r*(1-(i-e)/(i-t)),n,r)},Ie.clamp=o2;var _e=class{constructor(e,t,i,n,r,s,o){this.g=e,this.j=t,this.m=i,this.canvas=n,this.l=r,this.width=s,this.height=o,(this.j||this.m)&&--u2===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!mt(this,0)}ka(){return!!mt(this,1)}R(){return!!mt(this,2)}Aa(){return h2(this)}za(){var e=mt(this,1);return e||(Mr(this),Tr(this),e=d2(this),xn(this),this.g.push(e),this.j=!0),e}N(){return Mr(this)}clone(){const e=[];for(const t of this.g){let i;if(t instanceof ImageData)i=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const n=Ui(this),r=Lr(this);n.activeTexture(n.TEXTURE1),i=Wt(r,n),n.bindTexture(n.TEXTURE_2D,i),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),Ar(r,n,i),_n(r,n,!1,()=>{Tr(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),xn(this)}),$o(r),xn(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Mr(this),Tr(this),i=d2(this),xn(this)}e.push(i)}return new _e(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&mt(this,1).close(),this.m&&Ui(this).deleteTexture(mt(this,2)),u2=-1}};_e.prototype.close=_e.prototype.close,_e.prototype.clone=_e.prototype.clone,_e.prototype.getAsWebGLTexture=_e.prototype.N,_e.prototype.getAsImageBitmap=_e.prototype.za,_e.prototype.getAsImageData=_e.prototype.Aa,_e.prototype.hasWebGLTexture=_e.prototype.R,_e.prototype.hasImageBitmap=_e.prototype.ka,_e.prototype.hasImageData=_e.prototype.Ca;var u2=250;function ht(...e){return e.map(([t,i])=>({start:t,end:i}))}const T0=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}((p2=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:Wl()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}initializeGraph(e){return M(this,null,function*(){const t=yield(yield 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 i=e.length,n=this.i._malloc(i);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(i,n):this.i._changeTextGraph(i,n),this.i._free(n)}configureAudio(e,t,i,n,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),A(this,n||"input_audio",s=>{A(this,r=r||"audio_header",o=>{this.i._configureAudio(s,o,e,t!=null?t:0,i)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){ft(this,"__graph_config__",t=>{e(t)}),A(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,i){this.addAudioToStreamWithShape(e,0,0,t,i)}addAudioToStreamWithShape(e,t,i,n,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),A(this,n,o=>{this.i._addAudioToInputStream(this.g,t,i,o,r)})}addGpuBufferToStream(e,t,i){A(this,t,n=>{const[r,s]=Kl(this,e,n);this.i._addBoundTextureToStream(n,r,s,i)})}addBoolToStream(e,t,i){A(this,t,n=>{this.i._addBoolToInputStream(e,n,i)})}addDoubleToStream(e,t,i){A(this,t,n=>{this.i._addDoubleToInputStream(e,n,i)})}addFloatToStream(e,t,i){A(this,t,n=>{this.i._addFloatToInputStream(e,n,i)})}addIntToStream(e,t,i){A(this,t,n=>{this.i._addIntToInputStream(e,n,i)})}addUintToStream(e,t,i){A(this,t,n=>{this.i._addUintToInputStream(e,n,i)})}addStringToStream(e,t,i){A(this,t,n=>{A(this,e,r=>{this.i._addStringToInputStream(r,n,i)})})}addStringRecordToStream(e,t,i){A(this,t,n=>{Jl(this,Object.keys(e),r=>{Jl(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(r,s,Object.keys(e).length,n,i)})})})}addProtoToStream(e,t,i,n){A(this,i,r=>{A(this,t,s=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,s,r,n),this.i._free(o)})})}addEmptyPacketToStream(e,t){A(this,e,i=>{this.i._addEmptyPacketToInputStream(i,t)})}addBoolVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateBoolVector(e.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(r,s);this.i._addBoolVectorToInputStream(r,n,i)})}addDoubleVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateDoubleVector(e.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(r,s);this.i._addDoubleVectorToInputStream(r,n,i)})}addFloatVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateFloatVector(e.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(r,s);this.i._addFloatVectorToInputStream(r,n,i)})}addIntVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateIntVector(e.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(r,s);this.i._addIntVectorToInputStream(r,n,i)})}addUintVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateUintVector(e.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(r,s);this.i._addUintVectorToInputStream(r,n,i)})}addStringVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateStringVector(e.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of e)A(this,s,o=>{this.i._addStringVectorEntry(r,o)});this.i._addStringVectorToInputStream(r,n,i)})}addBoolToInputSidePacket(e,t){A(this,t,i=>{this.i._addBoolToInputSidePacket(e,i)})}addDoubleToInputSidePacket(e,t){A(this,t,i=>{this.i._addDoubleToInputSidePacket(e,i)})}addFloatToInputSidePacket(e,t){A(this,t,i=>{this.i._addFloatToInputSidePacket(e,i)})}addIntToInputSidePacket(e,t){A(this,t,i=>{this.i._addIntToInputSidePacket(e,i)})}addUintToInputSidePacket(e,t){A(this,t,i=>{this.i._addUintToInputSidePacket(e,i)})}addStringToInputSidePacket(e,t){A(this,t,i=>{A(this,e,n=>{this.i._addStringToInputSidePacket(n,i)})})}addProtoToInputSidePacket(e,t,i){A(this,i,n=>{A(this,t,r=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,r,n),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const r of e)this.i._addBoolVectorEntry(n,r);this.i._addBoolVectorToInputSidePacket(n,i)})}addDoubleVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const r of e)this.i._addDoubleVectorEntry(n,r);this.i._addDoubleVectorToInputSidePacket(n,i)})}addFloatVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const r of e)this.i._addFloatVectorEntry(n,r);this.i._addFloatVectorToInputSidePacket(n,i)})}addIntVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const r of e)this.i._addIntVectorEntry(n,r);this.i._addIntVectorToInputSidePacket(n,i)})}addUintVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const r of e)this.i._addUintVectorEntry(n,r);this.i._addUintVectorToInputSidePacket(n,i)})}addStringVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const r of e)A(this,r,s=>{this.i._addStringVectorEntry(n,s)});this.i._addStringVectorToInputSidePacket(n,i)})}attachBoolListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachBoolListener(i)})}attachBoolVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachBoolVectorListener(i)})}attachIntListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachIntListener(i)})}attachIntVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachIntVectorListener(i)})}attachUintListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachUintListener(i)})}attachUintVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachUintVectorListener(i)})}attachDoubleListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachDoubleListener(i)})}attachDoubleVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachDoubleVectorListener(i)})}attachFloatListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachFloatListener(i)})}attachFloatVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachFloatVectorListener(i)})}attachStringListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachStringListener(i)})}attachStringVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachStringVectorListener(i)})}attachProtoListener(e,t,i){ft(this,e,t),A(this,e,n=>{this.i._attachProtoListener(n,i||!1)})}attachProtoVectorListener(e,t,i){qt(this,e,t),A(this,e,n=>{this.i._attachProtoVectorListener(n,i||!1)})}attachAudioListener(e,t,i){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),ft(this,e,(n,r)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,r)}),A(this,e,n=>{this.i._attachAudioListener(n,i||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends p2{get ea(){return this.i}oa(e,t,i){A(this,t,n=>{const[r,s]=Kl(this,e,n);this.ea._addBoundTextureAsImageToStream(n,r,s,i)})}V(e,t){ft(this,e,t),A(this,e,i=>{this.ea._attachImageListener(i)})}ba(e,t){qt(this,e,t),A(this,e,i=>{this.ea._attachImageVectorListener(i)})}}));var p2,Je=class extends T0{};function R(e,t,i){return M(this,null,function*(){var n;return function(r,s,o,a){return M(this,null,function*(){return k0(r,s,o,a)})}(e,(n=i.canvas)!=null?n:Wl()?void 0:document.createElement("canvas"),t,i)})}function f2(e,t,i,n){if(e.U){const s=new gl;if(i!=null&&i.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var r=i.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].");x(s,1,(r.left+r.right)/2),x(s,2,(r.top+r.bottom)/2),x(s,4,r.right-r.left),x(s,3,r.bottom-r.top)}else x(s,1,.5),x(s,2,.5),x(s,4,1),x(s,3,1);if(i!=null&&i.rotationDegrees){if((i==null?void 0:i.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(x(s,5,-Math.PI*i.rotationDegrees/180),(i==null?void 0:i.rotationDegrees)%180!=0){const[o,a]=Yl(t);i=he(s,3)*a/o,r=he(s,4)*o/a,x(s,4,i),x(s,3,r)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.oa(t,e.Z,n!=null?n:performance.now()),e.finishProcessing()}function Qe(e,t,i){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");f2(e,t,i,e.B+1)}function gt(e,t,i,n){var r;if(!((r=e.baseOptions)!=null&&r.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");f2(e,t,i,n)}function Vi(e,t,i,n){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 ye([r],i,!1,e.g.i.canvas,e.P,s,t),n?e.clone():e}var Re=class extends Oo{constructor(e,t,i,n){super(e),this.g=e,this.Z=t,this.U=i,this.na=n,this.P=new Ni}l(e,t=!0){if("runningMode"in e&&fn(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};Re.prototype.close=Re.prototype.close;var et=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},S(e=this.h=new _r,0,1,t=new ee),x(this.h,2,.5),x(this.h,3,.3)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i;return"minDetectionConfidence"in e&&x(this.h,2,(t=e.minDetectionConfidence)!=null?t:.5),"minSuppressionThreshold"in e&&x(this.h,3,(i=e.minSuppressionThreshold)!=null?i:.3),this.l(e)}D(e,t){return this.j={detections:[]},Qe(this,e,t),this.j}F(e,t,i){return this.j={detections:[]},gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect_in"),H(e,"detections");const t=new He;at(t,d0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect_in"),$(i,"DETECTIONS:detections"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("detections",(n,r)=>{for(const s of n)n=pl(s),this.j.detections.push(Gl(n));y(this,r)}),this.g.attachEmptyPacketListener("detections",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};et.prototype.detectForVideo=et.prototype.F,et.prototype.detect=et.prototype.D,et.prototype.setOptions=et.prototype.o,et.createFromModelPath=function(e,t){return M(this,null,function*(){return R(et,e,{baseOptions:{modelAssetPath:t}})})},et.createFromModelBuffer=function(e,t){return R(et,e,{baseOptions:{modelAssetBuffer:t}})},et.createFromOptions=function(e,t){return R(et,e,t)};var jo=ht([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]),Go=ht([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]),zo=ht([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),m2=ht([474,475],[475,476],[476,477],[477,474]),Zo=ht([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]),qo=ht([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),g2=ht([469,470],[470,471],[471,472],[472,469]),Wo=ht([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]),v2=[...jo,...Go,...zo,...Zo,...qo,...Wo],b2=ht([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 w2(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,S(e=this.h=new xl,0,1,t=new ee),this.v=new El,S(this.h,0,3,this.v),this.s=new _r,S(this.h,0,2,this.s),pt(this.s,4,1),x(this.s,2,.5),x(this.v,2,.5),x(this.h,4,.5)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i,n,r;return"numFaces"in e&&pt(this.s,4,(t=e.numFaces)!=null?t:1),"minFaceDetectionConfidence"in e&&x(this.s,2,(i=e.minFaceDetectionConfidence)!=null?i:.5),"minTrackingConfidence"in e&&x(this.h,4,(n=e.minTrackingConfidence)!=null?n:.5),"minFacePresenceConfidence"in e&&x(this.v,2,(r=e.minFacePresenceConfidence)!=null?r:.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return w2(this),Qe(this,e,t),this.j}F(e,t,i){return w2(this),gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"face_landmarks");const t=new He;at(t,p0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"NORM_LANDMARKS:face_landmarks"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("face_landmarks",(n,r)=>{for(const s of n)n=bn(s),this.j.faceLandmarks.push(Cr(n));y(this,r)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{y(this,n)}),this.outputFaceBlendshapes&&(H(e,"blendshapes"),$(i,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,r)=>{var s;if(this.outputFaceBlendshapes)for(const o of n)n=br(o),this.j.faceBlendshapes.push(Do((s=n.g())!=null?s:[]));y(this,r)}),this.g.attachEmptyPacketListener("blendshapes",n=>{y(this,n)})),this.outputFacialTransformationMatrixes&&(H(e,"face_geometry"),$(i,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,r)=>{var s,o,a,c,l;if(this.outputFacialTransformationMatrixes)for(const d of n)(n=N(u0(d),n0,2))&&this.j.facialTransformationMatrixes.push({rows:(o=(s=Ye(n,1))!=null?s:0)!=null?o:0,columns:(c=(a=Ye(n,2))!=null?a:0)!=null?c:0,data:(l=ri(n,3,Ht,ni()).slice())!=null?l:[]});y(this,r)}),this.g.attachEmptyPacketListener("face_geometry",n=>{y(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.F,K.prototype.detect=K.prototype.D,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return R(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return R(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return R(K,e,t)},K.FACE_LANDMARKS_LIPS=jo,K.FACE_LANDMARKS_LEFT_EYE=Go,K.FACE_LANDMARKS_LEFT_EYEBROW=zo,K.FACE_LANDMARKS_LEFT_IRIS=m2,K.FACE_LANDMARKS_RIGHT_EYE=Zo,K.FACE_LANDMARKS_RIGHT_EYEBROW=qo,K.FACE_LANDMARKS_RIGHT_IRIS=g2,K.FACE_LANDMARKS_FACE_OVAL=Wo,K.FACE_LANDMARKS_CONTOURS=v2,K.FACE_LANDMARKS_TESSELATION=b2;var vt=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!0),S(e=this.j=new Al,0,1,t=new ee)}get baseOptions(){return N(this.j,ee,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,i){const n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:i,Qe(this,e,n!=null?n:{}),!this.h)return this.s}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"stylized_image");const t=new He;at(t,f0,this.j);const i=new Le;Ue(i,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"STYLIZED_IMAGE:stylized_image"),i.o(t),Ve(e,i),this.g.V("stylized_image",(n,r)=>{var s=!this.h,o=n.data,a=n.width;const c=a*(n=n.height);if(o instanceof Uint8Array)if(o.length===3*c){const l=new Uint8ClampedArray(4*c);for(let d=0;d<c;++d)l[4*d]=o[3*d],l[4*d+1]=o[3*d+1],l[4*d+2]=o[3*d+2],l[4*d+3]=255;o=new ImageData(l,a,n)}else{if(o.length!==4*c)throw Error("Unsupported channel count: "+o.length/c);o=new ImageData(new Uint8ClampedArray(o.buffer,o.byteOffset,o.length),a,n)}else if(!(o instanceof WebGLTexture))throw Error(`Unsupported format: ${o.constructor.name}`);a=new _e([o],!1,!1,this.g.i.canvas,this.P,a,n),this.s=s=s?a.clone():a,this.h&&this.h(s),y(this,r)}),this.g.attachEmptyPacketListener("stylized_image",n=>{this.s=null,this.h&&this.h(null),y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};vt.prototype.stylize=vt.prototype.Ka,vt.prototype.setOptions=vt.prototype.o,vt.createFromModelPath=function(e,t){return R(vt,e,{baseOptions:{modelAssetPath:t}})},vt.createFromModelBuffer=function(e,t){return R(vt,e,{baseOptions:{modelAssetBuffer:t}})},vt.createFromOptions=function(e,t){return R(vt,e,t)};var Xo=ht([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 y2(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function _2(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 C2(e,t=!0){var r,s,o,a,c,l;const i=[];for(const d of e){var n=br(d);e=[];for(const h of n.g())n=t&&Ye(h,1)!=null?(r=Ye(h,1))!=null?r:0:-1,e.push({score:(s=he(h,2))!=null?s:0,index:n,categoryName:(a=(o=Ke(h,3))!=null?o:"")!=null?a:"",displayName:(l=(c=Ke(h,4))!=null?c:"")!=null?l:""});i.push(e)}return i}var je=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.j=new Ll,0,1,t=new ee),this.s=new Mo,S(this.j,0,2,this.s),this.C=new So,S(this.s,0,3,this.C),this.v=new Ml,S(this.s,0,2,this.v),this.h=new m0,S(this.j,0,3,this.h),x(this.v,2,.5),x(this.s,4,.5),x(this.C,2,.5)}get baseOptions(){return N(this.j,ee,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var r,s,o,a,c,l,d,h;if(pt(this.v,3,(r=e.numHands)!=null?r:1),"minHandDetectionConfidence"in e&&x(this.v,2,(s=e.minHandDetectionConfidence)!=null?s:.5),"minTrackingConfidence"in e&&x(this.s,4,(o=e.minTrackingConfidence)!=null?o:.5),"minHandPresenceConfidence"in e&&x(this.C,2,(a=e.minHandPresenceConfidence)!=null?a:.5),e.cannedGesturesClassifierOptions){var t=new Pi,i=t,n=Bo(e.cannedGesturesClassifierOptions,(c=N(this.h,Pi,3))==null?void 0:c.h());S(i,0,2,n),S(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((l=N(this.h,Pi,3))==null||l.g());return e.customGesturesClassifierOptions?(S(i=t=new Pi,0,2,n=Bo(e.customGesturesClassifierOptions,(d=N(this.h,Pi,4))==null?void 0:d.h())),S(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((h=N(this.h,Pi,4))==null||h.g()),this.l(e)}Fa(e,t){return y2(this),Qe(this,e,t),_2(this)}Ga(e,t,i){return y2(this),gt(this,e,i,t),_2(this)}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"hand_gestures"),H(e,"hand_landmarks"),H(e,"world_hand_landmarks"),H(e,"handedness");const t=new He;at(t,g0,this.j);const i=new Le;Ue(i,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"HAND_GESTURES:hand_gestures"),$(i,"LANDMARKS:hand_landmarks"),$(i,"WORLD_LANDMARKS:world_hand_landmarks"),$(i,"HANDEDNESS:handedness"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("hand_landmarks",(n,r)=>{var s,o,a,c;for(const l of n){n=bn(l);const d=[];for(const h of At(n,ml,1))d.push({x:(s=he(h,1))!=null?s:0,y:(o=he(h,2))!=null?o:0,z:(a=he(h,3))!=null?a:0,visibility:(c=he(h,4))!=null?c:0});this.landmarks.push(d)}y(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,r)=>{var s,o,a,c;for(const l of n){n=Oi(l);const d=[];for(const h of At(n,fl,1))d.push({x:(s=he(h,1))!=null?s:0,y:(o=he(h,2))!=null?o:0,z:(a=he(h,3))!=null?a:0,visibility:(c=he(h,4))!=null?c:0});this.worldLandmarks.push(d)}y(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,r)=>{this.gestures.push(...C2(n,!1)),y(this,r)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{y(this,n)}),this.g.attachProtoVectorListener("handedness",(n,r)=>{this.handedness.push(...C2(n)),y(this,r)}),this.g.attachEmptyPacketListener("handedness",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function E2(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}je.prototype.recognizeForVideo=je.prototype.Ga,je.prototype.recognize=je.prototype.Fa,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=function(e,t){return R(je,e,{baseOptions:{modelAssetPath:t}})},je.createFromModelBuffer=function(e,t){return R(je,e,{baseOptions:{modelAssetBuffer:t}})},je.createFromOptions=function(e,t){return R(je,e,t)},je.HAND_CONNECTIONS=Xo;var Ge=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.h=new Mo,0,1,t=new ee),this.s=new So,S(this.h,0,3,this.s),this.j=new Ml,S(this.h,0,2,this.j),pt(this.j,3,1),x(this.j,2,.5),x(this.s,2,.5),x(this.h,4,.5)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i,n,r;return"numHands"in e&&pt(this.j,3,(t=e.numHands)!=null?t:1),"minHandDetectionConfidence"in e&&x(this.j,2,(i=e.minHandDetectionConfidence)!=null?i:.5),"minTrackingConfidence"in e&&x(this.h,4,(n=e.minTrackingConfidence)!=null?n:.5),"minHandPresenceConfidence"in e&&x(this.s,2,(r=e.minHandPresenceConfidence)!=null?r:.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Qe(this,e,t),E2(this)}F(e,t,i){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],gt(this,e,i,t),E2(this)}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"hand_landmarks"),H(e,"world_hand_landmarks"),H(e,"handedness");const t=new He;at(t,v0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"LANDMARKS:hand_landmarks"),$(i,"WORLD_LANDMARKS:world_hand_landmarks"),$(i,"HANDEDNESS:handedness"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("hand_landmarks",(n,r)=>{for(const s of n)n=bn(s),this.landmarks.push(Cr(n));y(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,r)=>{for(const s of n)n=Oi(s),this.worldLandmarks.push(wn(n));y(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("handedness",(n,r)=>{var c,l,d,h,u,p,f;var s=this.handedness,o=s.push;const a=[];for(const m of n){n=br(m);const v=[];for(const g of n.g())v.push({score:(c=he(g,2))!=null?c:0,index:(d=(l=Ye(g,1))!=null?l:0)!=null?d:-1,categoryName:(u=(h=Ke(g,3))!=null?h:"")!=null?u:"",displayName:(f=(p=Ke(g,4))!=null?p:"")!=null?f:""});a.push(v)}o.call(s,...a),y(this,r)}),this.g.attachEmptyPacketListener("handedness",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.detectForVideo=Ge.prototype.F,Ge.prototype.detect=Ge.prototype.D,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return R(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return R(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return R(Ge,e,t)},Ge.HAND_CONNECTIONS=Xo;var x2=ht([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 k2(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function A2(e){try{if(!e.C)return e.h;e.C(e.h)}finally{kr(e)}}function Ir(e,t){e=bn(e),t.push(Cr(e))}var te=class extends Re{constructor(e,t){super(new Je(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,S(e=this.j=new Rl,0,1,t=new ee),this.K=new So,S(this.j,0,2,this.K),this.Y=new b0,S(this.j,0,3,this.Y),this.s=new _r,S(this.j,0,4,this.s),this.H=new El,S(this.j,0,5,this.H),this.v=new Bl,S(this.j,0,6,this.v),this.L=new Dl,S(this.j,0,7,this.L),x(this.s,2,.5),x(this.s,3,.3),x(this.H,2,.5),x(this.v,2,.5),x(this.v,3,.3),x(this.L,2,.5),x(this.K,2,.5)}get baseOptions(){return N(this.j,ee,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var t,i,n,r,s,o,a;return"minFaceDetectionConfidence"in e&&x(this.s,2,(t=e.minFaceDetectionConfidence)!=null?t:.5),"minFaceSuppressionThreshold"in e&&x(this.s,3,(i=e.minFaceSuppressionThreshold)!=null?i:.3),"minFacePresenceConfidence"in e&&x(this.H,2,(n=e.minFacePresenceConfidence)!=null?n:.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&x(this.v,2,(r=e.minPoseDetectionConfidence)!=null?r:.5),"minPoseSuppressionThreshold"in e&&x(this.v,3,(s=e.minPoseSuppressionThreshold)!=null?s:.3),"minPosePresenceConfidence"in e&&x(this.L,2,(o=e.minPosePresenceConfidence)!=null?o:.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&x(this.K,2,(a=e.minHandLandmarksConfidence)!=null?a:.5),this.l(e)}D(e,t,i){const n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:i,k2(this),Qe(this,e,n),A2(this)}F(e,t,i,n){const r=typeof i!="function"?i:{};return this.C=typeof i=="function"?i:n,k2(this),gt(this,e,r,t),A2(this)}m(){var e=new De;Y(e,"input_frames_image"),H(e,"pose_landmarks"),H(e,"pose_world_landmarks"),H(e,"face_landmarks"),H(e,"left_hand_landmarks"),H(e,"left_hand_world_landmarks"),H(e,"right_hand_landmarks"),H(e,"right_hand_world_landmarks");const t=new He,i=new Kc;Ws(i,1,xi("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(r,s){if(s!=null)if(Array.isArray(s))W(r,2,Kn(s,Gs,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof Et||ei(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Ws(r,2,Is(s,!1),ti())}}(i,this.j.g());const n=new Le;Ue(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),ir(n,8,Kc,i),X(n,"IMAGE:input_frames_image"),$(n,"POSE_LANDMARKS:pose_landmarks"),$(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),$(n,"FACE_LANDMARKS:face_landmarks"),$(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),$(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),$(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),$(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Ve(e,n),xr(this,e),this.g.attachProtoListener("pose_landmarks",(r,s)=>{Ir(r,this.h.poseLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("pose_world_landmarks",(r,s)=>{var o=this.h.poseWorldLandmarks;r=Oi(r),o.push(wn(r)),y(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",r=>{y(this,r)}),this.outputPoseSegmentationMasks&&($(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),$i(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(r,s)=>{this.h.poseSegmentationMasks=[Vi(this,r,!0,!this.C)],y(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",r=>{this.h.poseSegmentationMasks=[],y(this,r)})),this.g.attachProtoListener("face_landmarks",(r,s)=>{Ir(r,this.h.faceLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",r=>{y(this,r)}),this.outputFaceBlendshapes&&(H(e,"extra_blendshapes"),$(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(r,s)=>{var a;var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(r=br(r),o.push(Do((a=r.g())!=null?a:[]))),y(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",r=>{y(this,r)})),this.g.attachProtoListener("left_hand_landmarks",(r,s)=>{Ir(r,this.h.leftHandLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("left_hand_world_landmarks",(r,s)=>{var o=this.h.leftHandWorldLandmarks;r=Oi(r),o.push(wn(r)),y(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("right_hand_landmarks",(r,s)=>{Ir(r,this.h.rightHandLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("right_hand_world_landmarks",(r,s)=>{var o=this.h.rightHandWorldLandmarks;r=Oi(r),o.push(wn(r)),y(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",r=>{y(this,r)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};te.prototype.detectForVideo=te.prototype.F,te.prototype.detect=te.prototype.D,te.prototype.setOptions=te.prototype.o,te.createFromModelPath=function(e,t){return R(te,e,{baseOptions:{modelAssetPath:t}})},te.createFromModelBuffer=function(e,t){return R(te,e,{baseOptions:{modelAssetBuffer:t}})},te.createFromOptions=function(e,t){return R(te,e,t)},te.HAND_CONNECTIONS=Xo,te.POSE_CONNECTIONS=x2,te.FACE_LANDMARKS_LIPS=jo,te.FACE_LANDMARKS_LEFT_EYE=Go,te.FACE_LANDMARKS_LEFT_EYEBROW=zo,te.FACE_LANDMARKS_LEFT_IRIS=m2,te.FACE_LANDMARKS_RIGHT_EYE=Zo,te.FACE_LANDMARKS_RIGHT_EYEBROW=qo,te.FACE_LANDMARKS_RIGHT_IRIS=g2,te.FACE_LANDMARKS_FACE_OVAL=Wo,te.FACE_LANDMARKS_CONTOURS=v2,te.FACE_LANDMARKS_TESSELATION=b2;var tt=class extends Re{constructor(e,t){super(new Je(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},S(e=this.h=new Ol,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return S(this.h,0,2,Bo(e,N(this.h,xo,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},Qe(this,e,t),this.j}ra(e,t,i){return this.j={classifications:[]},gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"input_image"),Y(e,"norm_rect"),H(e,"classifications");const t=new He;at(t,w0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),X(i,"IMAGE:input_image"),X(i,"NORM_RECT:norm_rect"),$(i,"CLASSIFICATIONS:classifications"),i.o(t),Ve(e,i),this.g.attachProtoListener("classifications",(n,r)=>{this.j=function(s){var a;const o={classifications:At(s,s0,1).map(c=>{var l,d,h,u;return Do((d=(l=N(c,dl,4))==null?void 0:l.g())!=null?d:[],(h=Ye(c,2))!=null?h:0,(u=Ke(c,3))!=null?u:"")})};return Ns(Ai(s,2))!=null&&(o.timestampMs=(a=Ns(Ai(s,2)))!=null?a:0),o}(o0(n)),y(this,r)}),this.g.attachEmptyPacketListener("classifications",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};tt.prototype.classifyForVideo=tt.prototype.ra,tt.prototype.classify=tt.prototype.qa,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(e,t){return R(tt,e,{baseOptions:{modelAssetPath:t}})},tt.createFromModelBuffer=function(e,t){return R(tt,e,{baseOptions:{modelAssetBuffer:t}})},tt.createFromOptions=function(e,t){return R(tt,e,t)};var ze=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!0),this.h=new Pl,this.embeddings={embeddings:[]},S(e=this.h,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t=this.h,i=N(this.h,yl,2);return i=i?i.clone():new yl,e.l2Normalize!==void 0?fn(i,1,e.l2Normalize):"l2Normalize"in e&&W(i,1),e.quantize!==void 0?fn(i,2,e.quantize):"quantize"in e&&W(i,2),S(t,0,2,i),this.l(e)}xa(e,t){return Qe(this,e,t),this.embeddings}ya(e,t,i){return gt(this,e,i,t),this.embeddings}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"embeddings_out");const t=new He;at(t,y0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"EMBEDDINGS:embeddings_out"),i.o(t),Ve(e,i),this.g.attachProtoListener("embeddings_out",(n,r)=>{n=l0(n),this.embeddings=function(s){var o;return{embeddings:At(s,c0,1).map(a=>{var l,d,h,u,p,f,m;const c={headIndex:(d=(l=Ye(a,3))!=null?l:0)!=null?d:-1,headName:(u=(h=Ke(a,4))!=null?h:"")!=null?u:""};if(yc(a,vl,Xs(a,1))!==void 0)a=ri(a=N(a,vl,Xs(a,1)),1,Ht,ni()),c.floatEmbedding=a.slice();else{const v=new Uint8Array(0);c.quantizedEmbedding=(m=(f=(p=N(a,a0,Xs(a,2)))==null?void 0:p.ma())==null?void 0:f.h())!=null?m:v}return c}),timestampMs:(o=Ns(Ai(s,2)))!=null?o:0}}(n),y(this,r)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Zl(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Zl(zl(e.quantizedEmbedding),zl(t.quantizedEmbedding))}return e},ze.prototype.embedForVideo=ze.prototype.ya,ze.prototype.embed=ze.prototype.xa,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=function(e,t){return R(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return R(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return R(ze,e,t)};var Yo=class{constructor(e,t,i){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=i}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(i=>{i.close()}),(t=this.categoryMask)==null||t.close()}};function S2(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function M2(e){try{const t=new Yo(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{kr(e)}}Yo.prototype.close=Yo.prototype.close;var Oe=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fo,this.v=new $l,S(this.h,0,3,this.v),S(e=this.h,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i;return e.displayNamesLocale!==void 0?W(this.h,2,xi(e.displayNamesLocale)):"displayNamesLocale"in e&&W(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=(t=e.outputCategoryMask)!=null?t:!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=(i=e.outputConfidenceMasks)!=null?i:!0),super.l(e)}J(){(function(e){var i,n,r;const t=At(e.ca(),Le,1).filter(s=>{var o;return((o=Ke(s,1))!=null?o:"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")});if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&((r=(n=(i=N(t[0],He,7))==null?void 0:i.l())==null?void 0:n.g())!=null?r:new Map).forEach((s,o)=>{var a;e.s[Number(o)]=(a=Ke(s,1))!=null?a:""})})(this)}segment(e,t,i){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:i,S2(this),Qe(this,e,n),M2(this)}Ia(e,t,i,n){const r=typeof i!="function"?i:{};return this.j=typeof i=="function"?i:n,S2(this),gt(this,e,r,t),M2(this)}Ba(){return this.s}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect");const t=new He;at(t,Ul,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),i.o(t),Ve(e,i),xr(this,e),this.outputConfidenceMasks&&(H(e,"confidence_masks"),$(i,"CONFIDENCE_MASKS:confidence_masks"),$i(this,"confidence_masks"),this.g.ba("confidence_masks",(n,r)=>{this.confidenceMasks=n.map(s=>Vi(this,s,!0,!this.j)),y(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],y(this,n)})),this.outputCategoryMask&&(H(e,"category_mask"),$(i,"CATEGORY_MASK:category_mask"),$i(this,"category_mask"),this.g.V("category_mask",(n,r)=>{this.categoryMask=Vi(this,n,!1,!this.j),y(this,r)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,y(this,n)})),H(e,"quality_scores"),$(i,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,r)=>{this.qualityScores=n,y(this,r)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Oe.prototype.getLabels=Oe.prototype.Ba,Oe.prototype.segmentForVideo=Oe.prototype.Ia,Oe.prototype.segment=Oe.prototype.segment,Oe.prototype.setOptions=Oe.prototype.o,Oe.createFromModelPath=function(e,t){return R(Oe,e,{baseOptions:{modelAssetPath:t}})},Oe.createFromModelBuffer=function(e,t){return R(Oe,e,{baseOptions:{modelAssetBuffer:t}})},Oe.createFromOptions=function(e,t){return R(Oe,e,t)};var Ko=class{constructor(e,t,i){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=i}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(i=>{i.close()}),(t=this.categoryMask)==null||t.close()}};Ko.prototype.close=Ko.prototype.close;var I0=class extends C{constructor(e){super(e)}},ji=[0,ae,-2],Fr=[0,Lt,-3,Q,Lt,-1],L2=[0,Fr],T2=[0,Fr,ae,-1],Jo=class extends C{constructor(e){super(e)}},I2=[0,Lt,-1,Q],F0=class extends C{constructor(e){super(e)}},F2=class extends C{constructor(e){super(e)}},Qo=[1,2,3,4,5,6,7,8,9,10,14,15],B2=class extends C{constructor(e){super(e)}};B2.prototype.g=vr([0,we,[0,Qo,G,Fr,G,[0,Fr,ji],G,L2,G,[0,L2,ji],G,I2,G,[0,Lt,-3,Q,Ne],G,[0,Lt,-3,Q],G,[0,j,Lt,-2,Q,ae,Q,-1,2,Lt,ji],G,T2,G,[0,T2,ji],Lt,ji,j,G,[0,Lt,-3,Q,ji,-1],G,[0,we,I2]],j,[0,j,ae,-1,Q]]);var bt=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fo,this.s=new $l,S(this.h,0,3,this.s),S(e=this.h,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i;return"outputCategoryMask"in e&&(this.outputCategoryMask=(t=e.outputCategoryMask)!=null?t:!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=(i=e.outputConfidenceMasks)!=null?i:!0),super.l(e)}segment(e,t,i,n){const r=typeof i!="function"?i:{};this.j=typeof i=="function"?i:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,i=this.B+1,n=new B2;const s=new F2;var o=new I0;if(pt(o,1,255),S(s,0,12,o),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Jo;fn(a,3,!0),x(a,1,t.keypoint.x),x(a,2,t.keypoint.y),pn(s,5,Qo,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(o=new F0,t.scribble))fn(t=new Jo,3,!0),x(t,1,a.x),x(t,2,a.y),ir(o,1,Jo,t);pn(s,15,Qo,o)}ir(n,1,F2,s),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",i),Qe(this,e,r);e:{try{const l=new Ko(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{kr(this)}c=void 0}return c}m(){var e=new De;Y(e,"image_in"),Y(e,"roi_in"),Y(e,"norm_rect_in");const t=new He;at(t,Ul,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),X(i,"IMAGE:image_in"),X(i,"ROI:roi_in"),X(i,"NORM_RECT:norm_rect_in"),i.o(t),Ve(e,i),xr(this,e),this.outputConfidenceMasks&&(H(e,"confidence_masks"),$(i,"CONFIDENCE_MASKS:confidence_masks"),$i(this,"confidence_masks"),this.g.ba("confidence_masks",(n,r)=>{this.confidenceMasks=n.map(s=>Vi(this,s,!0,!this.j)),y(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],y(this,n)})),this.outputCategoryMask&&(H(e,"category_mask"),$(i,"CATEGORY_MASK:category_mask"),$i(this,"category_mask"),this.g.V("category_mask",(n,r)=>{this.categoryMask=Vi(this,n,!1,!this.j),y(this,r)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,y(this,n)})),H(e,"quality_scores"),$(i,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,r)=>{this.qualityScores=n,y(this,r)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};bt.prototype.segment=bt.prototype.segment,bt.prototype.setOptions=bt.prototype.o,bt.createFromModelPath=function(e,t){return R(bt,e,{baseOptions:{modelAssetPath:t}})},bt.createFromModelBuffer=function(e,t){return R(bt,e,{baseOptions:{modelAssetBuffer:t}})},bt.createFromOptions=function(e,t){return R(bt,e,t)};var it=class extends Re{constructor(e,t){super(new Je(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},S(e=this.h=new Vl,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?W(this.h,2,xi(e.displayNamesLocale)):"displayNamesLocale"in e&&W(this.h,2),e.maxResults!==void 0?pt(this.h,3,e.maxResults):"maxResults"in e&&W(this.h,3),e.scoreThreshold!==void 0?x(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&W(this.h,4),e.categoryAllowlist!==void 0?nr(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&W(this.h,5),e.categoryDenylist!==void 0?nr(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&W(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},Qe(this,e,t),this.j}F(e,t,i){return this.j={detections:[]},gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"input_frame_gpu"),Y(e,"norm_rect"),H(e,"detections");const t=new He;at(t,C0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.ObjectDetectorGraph"),X(i,"IMAGE:input_frame_gpu"),X(i,"NORM_RECT:norm_rect"),$(i,"DETECTIONS:detections"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("detections",(n,r)=>{for(const s of n)n=pl(s),this.j.detections.push(Gl(n));y(this,r)}),this.g.attachEmptyPacketListener("detections",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};it.prototype.detectForVideo=it.prototype.F,it.prototype.detect=it.prototype.D,it.prototype.setOptions=it.prototype.o,it.createFromModelPath=function(e,t){return M(this,null,function*(){return R(it,e,{baseOptions:{modelAssetPath:t}})})},it.createFromModelBuffer=function(e,t){return R(it,e,{baseOptions:{modelAssetBuffer:t}})},it.createFromOptions=function(e,t){return R(it,e,t)};var ea=class{constructor(e,t,i){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=i}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function D2(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function R2(e){try{const t=new ea(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{kr(e)}}ea.prototype.close=ea.prototype.close;var Ze=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,S(e=this.h=new jl,0,1,t=new ee),this.v=new Dl,S(this.h,0,3,this.v),this.j=new Bl,S(this.h,0,2,this.j),pt(this.j,4,1),x(this.j,2,.5),x(this.v,2,.5),x(this.h,4,.5)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i,n,r,s;return"numPoses"in e&&pt(this.j,4,(t=e.numPoses)!=null?t:1),"minPoseDetectionConfidence"in e&&x(this.j,2,(i=e.minPoseDetectionConfidence)!=null?i:.5),"minTrackingConfidence"in e&&x(this.h,4,(n=e.minTrackingConfidence)!=null?n:.5),"minPosePresenceConfidence"in e&&x(this.v,2,(r=e.minPosePresenceConfidence)!=null?r:.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=(s=e.outputSegmentationMasks)!=null?s:!1),this.l(e)}D(e,t,i){const n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:i,D2(this),Qe(this,e,n),R2(this)}F(e,t,i,n){const r=typeof i!="function"?i:{};return this.s=typeof i=="function"?i:n,D2(this),gt(this,e,r,t),R2(this)}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"normalized_landmarks"),H(e,"world_landmarks"),H(e,"segmentation_masks");const t=new He;at(t,E0,this.h);const i=new Le;Ue(i,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"NORM_LANDMARKS:normalized_landmarks"),$(i,"WORLD_LANDMARKS:world_landmarks"),i.o(t),Ve(e,i),xr(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,r)=>{this.landmarks=[];for(const s of n)n=bn(s),this.landmarks.push(Cr(n));y(this,r)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],y(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,r)=>{this.worldLandmarks=[];for(const s of n)n=Oi(s),this.worldLandmarks.push(wn(n));y(this,r)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],y(this,n)}),this.outputSegmentationMasks&&($(i,"SEGMENTATION_MASK:segmentation_masks"),$i(this,"segmentation_masks"),this.g.ba("segmentation_masks",(n,r)=>{this.segmentationMasks=n.map(s=>Vi(this,s,!0,!this.s)),y(this,r)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],y(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ze.prototype.detectForVideo=Ze.prototype.F,Ze.prototype.detect=Ze.prototype.D,Ze.prototype.setOptions=Ze.prototype.o,Ze.createFromModelPath=function(e,t){return R(Ze,e,{baseOptions:{modelAssetPath:t}})},Ze.createFromModelBuffer=function(e,t){return R(Ze,e,{baseOptions:{modelAssetBuffer:t}})},Ze.createFromOptions=function(e,t){return R(Ze,e,t)},Ze.POSE_CONNECTIONS=x2;const B0=e=>{if(!e||e.length===0)return 0;const t=e[0];if(!t||t.length===0)return 0;let i=1,n=0,r=1,s=0;t.forEach(l=>{l&&typeof l.x=="number"&&typeof l.y=="number"&&(i=Math.min(i,l.x),n=Math.max(n,l.x),r=Math.min(r,l.y),s=Math.max(s,l.y))});const o=n-i,a=s-r;return Math.max(o,a)},D0=(e,t)=>{if(!e||e.length===0)return!1;const i=e[0];let n=1,r=0,s=1,o=0;i.forEach(re=>{n=Math.min(n,re.x),r=Math.max(r,re.x),s=Math.min(s,re.y),o=Math.max(o,re.y)});const a=.5,c=.6,l=t>1;let d,h;l?(d=.4,h=.3):(d=.35,h=.5);const u=(n+r)/2,p=(s+o)/2,f=.2,m=d*(1+f),v=h*(1+f),b=((re,Z)=>{const ue=(re-a)/m,pe=(Z-c)/v;return ue*ue+pe*pe<=1})(u,p),_=.2,E=.1,L=d*(1+_),w=h*(1+E),T=(re,Z)=>{const ue=(re-a)/L,pe=(Z-c)/w;return ue*ue+pe*pe<=1},I=T(n,s),O=T(r,s),be=T(n,o),ce=T(r,o);return b&&I&&O&&be&&ce},R0=e=>{if(!e||e.length===0)return 0;const t=e[0];if(!t||t.length===0)return 0;const i=t[13],n=t[14];if(!i||!n)return 0;const r=Math.abs(n.y-i.y),s=Math.min(...t.map(c=>c.y)),a=Math.max(...t.map(c=>c.y))-s;return a>0?r/a:0},O0=e=>{const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)return null;const n=e.videoWidth,r=e.videoHeight,s=Math.min(n,r),o=(n-s)/2,a=(r-s)/2;return t.width=s,t.height=s,i.drawImage(e,o,a,s,s,0,0,s,s),t},O2=(e,t,i,n)=>{const r=e.getContext("2d");if(!r)return;const s=e.width,o=e.height;r.clearRect(0,0,s,o);const a=new Ie(r);t.forEach(c=>{if(!c||c.length===0)return;const l="rgba(162, 155, 254,0.4)",d=2;r.strokeStyle="rgba(255, 255, 255, 0.6)",r.lineWidth=d,r.lineCap="round",r.lineJoin="round",a.drawLandmarks(c,{color:"rgba(9, 132, 227,0.7)",lineWidth:.5,radius:.5}),a.drawConnectors(c,K.FACE_LANDMARKS_FACE_OVAL,{color:l,lineWidth:d}),i>0&&i>=n&&a.drawConnectors(c,K.FACE_LANDMARKS_LIPS,{color:l,lineWidth:d})})},P2=e=>{const t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height)},P0=(e,t=!1)=>{const i=document.createElement("canvas"),n=i.getContext("2d");if(!n)return null;const r=e.videoHeight>e.videoWidth;t?r?(i.width=480,i.height=Math.max(640,i.width*e.videoHeight/e.videoWidth)):(i.width=640,i.height=Math.max(480,i.width*e.videoHeight/e.videoWidth)):r?(i.width=240,i.height=Math.max(320,i.width*e.videoHeight/e.videoWidth)):(i.width=320,i.height=Math.max(240,i.width*e.videoHeight/e.videoWidth));const s=1,o=e.videoWidth*s,a=e.videoHeight*s,c=(o-e.videoWidth)/2,l=(a-e.videoHeight)/2;return n.drawImage(e,-c,-l-0,o,a,0,0,i.width,i.height),i.toDataURL("image/jpeg")},$2={LIVENESS_IMAGE_BASE64:6,SELFIE_IMAGE_BASE64:2},N2={"multiple-faces":"Ensure only one face is visible","no-face":"Position your face in the oval","out-of-bounds":"Position your face in the oval","too-close":"Move farther away","too-far":"Move closer","neutral-expression":"Neutral expression","smile-required":"Smile!","open-mouth-smile":"Wider smile - teeth visible",initializing:"Initializing..."},$0=()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return!1;const i=t.getExtension("OES_texture_half_float"),n=t.getExtension("OES_texture_half_float_linear"),r=t.getExtension("EXT_color_buffer_half_float");return!!(i&&r&&n)},H2=()=>M(null,null,function*(){window.__smileIdentityMediapipe||(window.__smileIdentityMediapipe={instance:null,loading:null,loaded:!1});const e=window.__smileIdentityMediapipe;return e.loaded&&e.instance?e.instance:(e.loading||(e.loading=M(null,null,function*(){try{const t=yield ai.forVisionTasks("https://web-models.smileidentity.com/mediapipe-tasks-vision-wasm"),i=yield K.createFromOptions(t,{baseOptions:{modelAssetPath:"https://web-models.smileidentity.com/face_landmarker/face_landmarker.task",delegate:$0()?"GPU":"CPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO",numFaces:2});return e.instance=i,e.loaded=!0,e.loading=null,i}catch(t){throw e.loading=null,t}})),e.loading)}),kn=Xi.version,N0=({videoRef:e,canvasRef:t,interval:i,duration:n,smileThreshold:r,mouthOpenThreshold:s,minFaceSize:o,maxFaceSize:a,smileCooldown:c,getFacingMode:l})=>{const d=xe(null),h=xe(null),u=xe(null),p=xe(null),f=se(!1),m=se(!1),v=se("good"),g=se(!1),b=se(16/9),_=se([]),E=se(0),L=se(0),w=se(0),T=se(0),I=se(""),O=se(!0),be=se(!1),ce=se(!1),re=se(0),Z=se([]),ue=se(null),pe=se(1),Ae=se(0),z2=se(!1),Gi=is(()=>Math.floor(pe.value*.4)),Z2=is(()=>Math.floor(pe.value*.2)),ou=is(()=>f.value&&m.value&&v.value==="good"&&!g.value),ra=z=>{z&&N2[z]?I.value=N2[z]:I.value=""},qe=xe(T1(z=>{ra(z)},600)).current,au=()=>M(null,null,function*(){var z,Ce;try{((z=window.__smileIdentityMediapipe)==null?void 0:z.loaded)&&((Ce=window.__smileIdentityMediapipe)==null?void 0:Ce.instance)||(O.value=!0,ra("initializing")),d.current=yield H2(),O.value=!1}catch(yt){console.error("Failed to initialize MediaPipe:",yt),O.value=!1}}),cu=()=>{if(e.current&&t.current){const{videoWidth:z,videoHeight:Ce}=e.current;b.value=z/Ce,t.current.width=z,t.current.height=Ce,e.current.parentElement&&(t.current.style.left="50%",t.current.style.top="50%")}},lu=()=>{const z=Ae.value<Z2.value,Ce=Ae.value>=Gi.value;z?I.value="Capturing...":Ce?Date.now()-T.value>c?E.value>=r&&w.value<s?qe("open-mouth-smile"):qe("smile-required"):I.value="Keep smiling!":qe(null)},hu=()=>{O.value?ra("initializing"):g.value?qe("multiple-faces"):f.value?v.value==="too-close"?qe("too-close"):v.value==="too-far"?qe("too-far"):m.value?be.value?lu():I.value="Ready to capture":qe("out-of-bounds"):qe("no-face")},sa=()=>{h.current&&(cancelAnimationFrame(h.current),h.current=null)},oa=()=>M(null,null,function*(){var z,Ce;if(!d.current||!e.current){sa();return}if(e.current.videoWidth<=0||e.current.videoHeight<=0||e.current.readyState<2){h.current=requestAnimationFrame(oa);return}try{O.value&&(O.value=!1);const yt=O0(e.current),aa=yt||e.current,We=d.current.detectForVideo(aa,performance.now());if(_.value=We.faceLandmarks||[],We.faceLandmarks&&t.current&&e.current)if(yt){const Xt=e.current.videoWidth,ci=e.current.videoHeight,zi=Math.min(Xt,ci),ca=(Xt-zi)/(2*Xt),Rr=(ci-zi)/(2*ci),Or=zi/Xt,Zi=zi/ci,pu=We.faceLandmarks.map(fu=>fu.map(la=>({x:la.x*Or+ca,y:la.y*Zi+Rr,z:la.z})));O2(t.current,pu,Ae.value,Gi.value)}else O2(t.current,We.faceLandmarks,Ae.value,Gi.value);else t.current&&P2(t.current);const X2=We.faceLandmarks?We.faceLandmarks.length:0;g.value=X2>1;const Y2=We.faceBlendshapes&&We.faceBlendshapes.length>0&&X2===1;if(f.value=Y2,Y2&&We.faceLandmarks){const Xt=B0(We.faceLandmarks);L.value=Xt,Xt>a?v.value="too-close":Xt<o?v.value="too-far":v.value="good",m.value=D0(We.faceLandmarks,b.value);const ci=We.faceBlendshapes[0].categories,zi=((z=ci.find(Zi=>Zi.categoryName==="mouthSmileLeft"))==null?void 0:z.score)||0,ca=((Ce=ci.find(Zi=>Zi.categoryName==="mouthSmileRight"))==null?void 0:Ce.score)||0,Rr=R0(We.faceLandmarks),Or=(zi+ca)/2;E.value=Or,w.value=Rr,Or>=r&&Rr>=s&&(T.value=Date.now(),ce.value&&be.value&&p.current&&setTimeout(()=>{Date.now()-T.value<=100&&ce.value&&be.value&&p.current&&p.current()},0))}else E.value=0,L.value=0,w.value=0,m.value=!1,v.value="good";hu()}catch(yt){f.value=!1,m.value=!1,g.value=!1,v.value="good",w.value=0,be.value&&qe("no-face")}h.current=requestAnimationFrame(oa)}),du=()=>{h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(oa)},uu=()=>{if(!e.current)return;const z=Ae.value===pe.value-1,Ce=P0(e.current,z);Ce&&(z?ue.value=Ce:Z.value=[...Z.value,Ce],Ae.value++,re.value=pe.value-Ae.value)},Dr=()=>{if(u.current&&(clearInterval(u.current),u.current=null),be.value=!1,ce.value=!1,Ae.value>=pe.value&&ue.value){const z=Z.value.map(aa=>({image:aa.split(",")[1],image_type_id:$2.LIVENESS_IMAGE_BASE64})),Ce={image:ue.value.split(",")[1],image_type_id:$2.SELFIE_IMAGE_BASE64},yt={images:[...z,Ce],referenceImage:ue.value,previewImage:ue.value,facingMode:l(),meta:{libraryVersion:kn}};window.dispatchEvent(new CustomEvent("selfie-capture.publish",{detail:yt})),z2.value=!0}},An=()=>{u.current&&(clearInterval(u.current),u.current=null),ce.value=!0,!g.value&&f.value&&m.value&&v.value==="good"&&qe("smile-required")},q2=()=>{u.current&&clearInterval(u.current),u.current=setInterval(()=>{if(Ae.value>=pe.value){Dr();return}if(g.value){An();return}if(!f.value)return;if(!m.value){An();return}if(v.value!=="good"){An();return}if(Ae.value>=Gi.value&&Date.now()-T.value>c){An();return}uu()},i)},W2=()=>{if(f.value&&v.value==="good"&&m.value&&!g.value){if(Ae.value>=Gi.value&&Date.now()-T.value>c)return;ce.value=!1,qe(null),q2()}};return p.current=W2,{faceDetected:f,faceInBounds:m,faceProximity:v,multipleFaces:g,videoAspectRatio:b,faceLandmarks:_,currentSmileScore:E,currentFaceSize:L,currentMouthOpen:w,lastSmileTime:T,alertTitle:I,isInitializing:O,isReadyToCapture:ou,isCapturing:be,isPaused:ce,countdown:re,capturedImages:Z,referencePhoto:ue,totalCaptures:pe,capturesTaken:Ae,hasFinishedCapture:z2,smileCheckpoint:Gi,neutralZone:Z2,initializeFaceLandmarker:au,setupCanvas:cu,startDetectionLoop:du,stopDetectionLoop:sa,updateAlert:qe,startCapture:()=>M(null,null,function*(){Z.value=[],be.value=!0,ce.value=!1,pe.value=Math.ceil(n/i),Ae.value=0,re.value=pe.value;const z=document.querySelector("smart-camera-web");z==null||z.dispatchEvent(new CustomEvent("metadata.selfie-capture-start")),z==null||z.dispatchEvent(new CustomEvent("metadata.selfie-origin",{detail:{imageOrigin:{environment:"back_camera",user:"front_camera"}[l()]}})),q2()}),stopCapture:Dr,pauseCapture:An,resumeCapture:W2,handleCancel:()=>{Dr(),window.dispatchEvent(new CustomEvent("selfie-capture.cancelled",{detail:{meta:{libraryVersion:kn}}})),window.dispatchEvent(new CustomEvent("selfie-capture-screens.cancelled",{detail:{meta:{libraryVersion:kn}}}))},handleClose:()=>{Dr(),window.dispatchEvent(new CustomEvent("selfie-capture.close",{detail:{meta:{libraryVersion:kn}}})),window.dispatchEvent(new CustomEvent("selfie-capture-screens.close",{detail:{meta:{libraryVersion:kn}}}))},cleanup:()=>{u.current&&clearInterval(u.current),sa(),qe.cancel()},resetFaceDetectionState:()=>{f.value=!1,m.value=!1,v.value="good",g.value=!1,_.value=[],E.value=0,L.value=0,w.value=0,T.value=0,t.current&&P2(t.current)}}},H0=({progress:e,duration:t=1e3,themeColor:i="#001096"})=>{const n=xe(null),r=xe(e);return ot(()=>{const s=n.current;if(!s)return;const o=s.getTotalLength();s.style.opacity=e>0?"1":"0";const a=o*(1-r.current),c=o*(1-e);a!==c&&(s.style.transition="none",s.style.strokeDasharray=`${o} ${o}`,s.style.strokeDashoffset=`${a}`,s.getBoundingClientRect(),s.style.transition=`stroke-dashoffset ${t}ms ease-out`,s.style.strokeDashoffset=`${c}`,r.current=e)},[e,t]),D("div",{style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"},children:D("svg",{viewBox:"0 0 285 380",preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:[D("clipPath",{id:"selfie-clip-path",clipPathUnits:"objectBoundingBox",children:D("path",{d:"M0.085 0.382 C0.087 0.357 0.092 0.294 0.131 0.236 C0.200 0.133 0.340 0.063 0.501 0.063 C0.730 0.063 0.915 0.205 0.915 0.382 C0.915 0.424 0.899 0.513 0.891 0.549 C0.882 0.588 0.871 0.626 0.857 0.664 C0.792 0.825 0.639 0.937 0.501 0.937 C0.314 0.937 0.182 0.755 0.144 0.666 C0.126 0.624 0.110 0.557 0.107 0.547 C0.092 0.485 0.081 0.439 0.085 0.382 Z"})}),D("path",{d:"M142.693 24C208.319 24 261 77.97 261 145.008C261 160.97 256.319 194.788 254.129 208.356C251.64 223.188 248.348 237.875 244.27 252.35C225.747 313.203 182.328 356 142.693 356C89.414 356 51.871 286.667 41.016 252.948C35.937 236.987 31.356 211.748 30.559 207.857C26.277 184.114 22.991 166.556 24.285 145.008C24.883 135.631 26.277 111.789 37.431 89.742C57.049 50.636 96.983 24 142.693 24Z",stroke:i,fill:"none",style:{strokeWidth:"8"}}),D("path",{ref:n,d:"M142.693 24C208.319 24 261 77.97 261 145.008C261 160.97 256.319 194.788 254.129 208.356C251.64 223.188 248.348 237.875 244.27 252.35C225.747 313.203 182.328 356 142.693 356C89.414 356 51.871 286.667 41.016 252.948C35.937 236.987 31.356 211.748 30.559 207.857C26.277 184.114 22.991 166.556 24.285 145.008C24.883 135.631 26.277 111.789 37.431 89.742C57.049 50.636 96.983 24 142.693 24Z",stroke:"#22c55e",style:{strokeWidth:"8"},fill:"none",strokeLinecap:"round"})]})})},U0=({videoRef:e,canvasRef:t,facingMode:i,multipleFaces:n,progress:r,interval:s,themeColor:o})=>D(Dt,{children:[D("div",{className:"camera-preview-container",children:[D("div",{className:"video-wrapper",style:{clipPath:n?"none":"url(#selfie-clip-path)"},children:D("div",{className:"video-container",children:[D("video",{ref:e,autoPlay:!0,playsInline:!0,muted:!0,className:`camera-video ${i==="user"?"mirror":""}`}),D("canvas",{ref:t,className:`camera-canvas ${i==="user"?"mirror":""}`})]})}),!n&&D(H0,{progress:r,duration:s,themeColor:o})]}),D("style",{children:`
3159
+ `}C(){const e=this.g;e.activeTexture(e.TEXTURE1),this.j=Wt(this,e),e.activeTexture(e.TEXTURE2),this.B=Wt(this,e)}m(){super.m();const e=this.g;this.K=Te(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.L=Te(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=Te(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();const e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.K,1),e.uniform1i(this.L,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Tt(e,t){switch(t){case 0:return e.g.find(i=>i instanceof Uint8Array);case 1:return e.g.find(i=>i instanceof Float32Array);case 2:return e.g.find(i=>typeof WebGLTexture!="undefined"&&i instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function No(e){var t=Tt(e,1);if(!t){if(t=Tt(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);const n=Hi(e);var i=Ho(e);if(Ar(i,n,i2(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){i=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,i);for(let r=0,s=0;r<t.length;++r,s+=4)t[r]=i[s]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function i2(e){let t=Tt(e,2);if(!t){const i=Hi(e);t=r2(e);const n=No(e),r=n2(e);i.texImage2D(i.TEXTURE_2D,0,r,e.width,e.height,0,i.RED,i.FLOAT,n),Uo(e)}return t}function Hi(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=Te(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function n2(e){if(e=Hi(e),!Sr)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Sr=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Sr=e.R16F}return Sr}function Ho(e){return e.l||(e.l=new Ni),e.l}function r2(e){const t=Hi(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let i=Tt(e,2);return i||(i=Wt(Ho(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(i),e.j=!0),t.bindTexture(t.TEXTURE_2D,i),i}function Uo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Sr,ye=class{constructor(e,t,i,n,r,s,o){this.g=e,this.m=t,this.j=i,this.canvas=n,this.l=r,this.width=s,this.height=o,this.j&&--s2===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!Tt(this,0)}ja(){return!!Tt(this,1)}R(){return!!Tt(this,2)}ia(){return(t=Tt(e=this,0))||(t=No(e),t=new Uint8Array(t.map(i=>255*i)),e.g.push(t)),t;var e,t}ha(){return No(this)}N(){return i2(this)}clone(){const e=[];for(const t of this.g){let i;if(t instanceof Uint8Array)i=new Uint8Array(t);else if(t instanceof Float32Array)i=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=Hi(this),r=Ho(this);n.activeTexture(n.TEXTURE1),i=Wt(r,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,i);const s=n2(this);n.texImage2D(n.TEXTURE_2D,0,s,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),Ar(r,n,i),_n(r,n,!1,()=>{r2(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Uo(this)}),$o(r),Uo(this)}}e.push(i)}return new ye(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Hi(this).deleteTexture(Tt(this,2)),s2=-1}};ye.prototype.close=ye.prototype.close,ye.prototype.clone=ye.prototype.clone,ye.prototype.getAsWebGLTexture=ye.prototype.N,ye.prototype.getAsFloat32Array=ye.prototype.ha,ye.prototype.getAsUint8Array=ye.prototype.ia,ye.prototype.hasWebGLTexture=ye.prototype.R,ye.prototype.hasFloat32Array=ye.prototype.ja,ye.prototype.hasUint8Array=ye.prototype.Da;var s2=250;const M0={color:"white",lineWidth:4,radius:6};function Vo(e){return Fe(qi(Fe({},M0),{fillColor:(e=e||{}).color}),e)}function It(e,t){return e instanceof Function?e(t):e}function o2(e,t,i){return Math.max(Math.min(t,i),Math.min(Math.max(t,i),e))}function Cn(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function En(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function a2(e,t,i){var n;if(t.R())i(t.N());else{const r=t.ja()?t.ha():t.ia();e.m=(n=e.m)!=null?n:new Ni;const s=En(e);i((e=new ye([r],t.m,!1,s.canvas,e.m,t.width,t.height)).N()),e.close()}}function c2(e,t,i,n){const r=function(a){return a.g||(a.g=new S0),a.g}(e),s=En(e),o=Array.isArray(i)?new ImageData(new Uint8ClampedArray(i),1,1):i;_n(r,s,!0,()=>{(function(c,l,d,h){const u=c.g;if(u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l),u.activeTexture(u.TEXTURE1),u.bindTexture(u.TEXTURE_2D,c.B),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,d),c.H&&function(p,f){if(p!==f)return!1;p=p.entries(),f=f.entries();for(const[v,g]of p){p=v;const b=g;var m=f.next();if(m.done)return!1;const[_,E]=m.value;if(m=E,p!==_||b[0]!==m[0]||b[1]!==m[1]||b[2]!==m[2]||b[3]!==m[3])return!1}return!!f.next().done}(c.H,h))u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,c.j);else{c.H=h;const p=Array(1024).fill(0);h.forEach((f,m)=>{if(f.length!==4)throw Error(`Color at index ${m} is not a four-channel value.`);p[4*m]=f[0],p[4*m+1]=f[1],p[4*m+2]=f[2],p[4*m+3]=f[3]}),u.activeTexture(u.TEXTURE2),u.bindTexture(u.TEXTURE_2D,c.j),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,256,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array(p))}})(r,t,o,n),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);const a=r.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)})}function l2(e,t,i,n){const r=En(e),s=function(c){return c.h||(c.h=new L0),c.h}(e),o=Array.isArray(i)?new ImageData(new Uint8ClampedArray(i),1,1):i,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;_n(s,r,!0,()=>{var c=s.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,s.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,o),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,s.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),r.bindTexture(r.TEXTURE_2D,null),(c=s.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)})}var Ie=class{constructor(e,t){typeof CanvasRenderingContext2D!="undefined"&&e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}wa(e,t){if(e){var i=Cn(this);t=Vo(t),i.save();var n=i.canvas,r=0;for(const s of e)i.fillStyle=It(t.fillColor,{index:r,from:s}),i.strokeStyle=It(t.color,{index:r,from:s}),i.lineWidth=It(t.lineWidth,{index:r,from:s}),(e=new Path2D).arc(s.x*n.width,s.y*n.height,It(t.radius,{index:r,from:s}),0,2*Math.PI),i.fill(e),i.stroke(e),++r;i.restore()}}va(e,t,i){if(e&&t){var n=Cn(this);i=Vo(i),n.save();var r=n.canvas,s=0;for(const o of t){n.beginPath(),t=e[o.start];const a=e[o.end];t&&a&&(n.strokeStyle=It(i.color,{index:s,from:t,to:a}),n.lineWidth=It(i.lineWidth,{index:s,from:t,to:a}),n.moveTo(t.x*r.width,t.y*r.height),n.lineTo(a.x*r.width,a.y*r.height)),++s,n.stroke()}n.restore()}}sa(e,t){const i=Cn(this);t=Vo(t),i.save(),i.beginPath(),i.lineWidth=It(t.lineWidth,{}),i.strokeStyle=It(t.color,{}),i.fillStyle=It(t.fillColor,{}),i.moveTo(e.originX,e.originY),i.lineTo(e.originX+e.width,e.originY),i.lineTo(e.originX+e.width,e.originY+e.height),i.lineTo(e.originX,e.originY+e.height),i.lineTo(e.originX,e.originY),i.stroke(),i.fill(),i.restore()}ta(e,t,i=[0,0,0,255]){this.l?function(n,r,s,o){const a=En(n);a2(n,r,c=>{c2(n,c,s,o),(c=Cn(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,i,t):c2(this,e.N(),i,t)}ua(e,t,i){this.l?function(n,r,s,o){const a=En(n);a2(n,r,c=>{l2(n,c,s,o),(c=Cn(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,i):l2(this,e.N(),t,i)}close(){var e,t,i;(e=this.g)==null||e.close(),this.g=void 0,(t=this.h)==null||t.close(),this.h=void 0,(i=this.m)==null||i.close(),this.m=void 0}};function mt(e,t){switch(t){case 0:return e.g.find(i=>i instanceof ImageData);case 1:return e.g.find(i=>typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap);case 2:return e.g.find(i=>typeof WebGLTexture!="undefined"&&i instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function h2(e){var t=mt(e,0);if(!t){t=Ui(e);const i=Mr(e),n=new Uint8Array(e.width*e.height*4);Ar(i,t,Lr(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),$o(i),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Lr(e){let t=mt(e,2);if(!t){const i=Ui(e);t=Tr(e);const n=mt(e,1)||h2(e);i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),xn(e)}return t}function Ui(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=Te(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Mr(e){return e.l||(e.l=new Ni),e.l}function Tr(e){const t=Ui(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let i=mt(e,2);return i||(i=Wt(Mr(e),t),e.g.push(i),e.m=!0),t.bindTexture(t.TEXTURE_2D,i),i}function xn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function d2(e){const t=Ui(e);return _n(Mr(e),t,!0,()=>function(i,n){const r=i.canvas;if(r.width===i.width&&r.height===i.height)return n();const s=r.width,o=r.height;return r.width=i.width,r.height=i.height,i=n(),r.width=s,r.height=o,i}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}Ie.prototype.close=Ie.prototype.close,Ie.prototype.drawConfidenceMask=Ie.prototype.ua,Ie.prototype.drawCategoryMask=Ie.prototype.ta,Ie.prototype.drawBoundingBox=Ie.prototype.sa,Ie.prototype.drawConnectors=Ie.prototype.va,Ie.prototype.drawLandmarks=Ie.prototype.wa,Ie.lerp=function(e,t,i,n,r){return o2(n*(1-(e-t)/(i-t))+r*(1-(i-e)/(i-t)),n,r)},Ie.clamp=o2;var _e=class{constructor(e,t,i,n,r,s,o){this.g=e,this.j=t,this.m=i,this.canvas=n,this.l=r,this.width=s,this.height=o,(this.j||this.m)&&--u2===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!mt(this,0)}ka(){return!!mt(this,1)}R(){return!!mt(this,2)}Aa(){return h2(this)}za(){var e=mt(this,1);return e||(Lr(this),Tr(this),e=d2(this),xn(this),this.g.push(e),this.j=!0),e}N(){return Lr(this)}clone(){const e=[];for(const t of this.g){let i;if(t instanceof ImageData)i=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){const n=Ui(this),r=Mr(this);n.activeTexture(n.TEXTURE1),i=Wt(r,n),n.bindTexture(n.TEXTURE_2D,i),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),Ar(r,n,i),_n(r,n,!1,()=>{Tr(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),xn(this)}),$o(r),xn(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Lr(this),Tr(this),i=d2(this),xn(this)}e.push(i)}return new _e(e,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&mt(this,1).close(),this.m&&Ui(this).deleteTexture(mt(this,2)),u2=-1}};_e.prototype.close=_e.prototype.close,_e.prototype.clone=_e.prototype.clone,_e.prototype.getAsWebGLTexture=_e.prototype.N,_e.prototype.getAsImageBitmap=_e.prototype.za,_e.prototype.getAsImageData=_e.prototype.Aa,_e.prototype.hasWebGLTexture=_e.prototype.R,_e.prototype.hasImageBitmap=_e.prototype.ka,_e.prototype.hasImageData=_e.prototype.Ca;var u2=250;function ht(...e){return e.map(([t,i])=>({start:t,end:i}))}const T0=function(e){return class extends e{Ha(){this.i._registerModelResourcesGraphService()}}}((p2=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:Wl()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}initializeGraph(e){return L(this,null,function*(){const t=yield(yield 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 i=e.length,n=this.i._malloc(i);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(i,n):this.i._changeTextGraph(i,n),this.i._free(n)}configureAudio(e,t,i,n,r){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),A(this,n||"input_audio",s=>{A(this,r=r||"audio_header",o=>{this.i._configureAudio(s,o,e,t!=null?t:0,i)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){ft(this,"__graph_config__",t=>{e(t)}),A(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,i){this.addAudioToStreamWithShape(e,0,0,t,i)}addAudioToStreamWithShape(e,t,i,n,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),A(this,n,o=>{this.i._addAudioToInputStream(this.g,t,i,o,r)})}addGpuBufferToStream(e,t,i){A(this,t,n=>{const[r,s]=Kl(this,e,n);this.i._addBoundTextureToStream(n,r,s,i)})}addBoolToStream(e,t,i){A(this,t,n=>{this.i._addBoolToInputStream(e,n,i)})}addDoubleToStream(e,t,i){A(this,t,n=>{this.i._addDoubleToInputStream(e,n,i)})}addFloatToStream(e,t,i){A(this,t,n=>{this.i._addFloatToInputStream(e,n,i)})}addIntToStream(e,t,i){A(this,t,n=>{this.i._addIntToInputStream(e,n,i)})}addUintToStream(e,t,i){A(this,t,n=>{this.i._addUintToInputStream(e,n,i)})}addStringToStream(e,t,i){A(this,t,n=>{A(this,e,r=>{this.i._addStringToInputStream(r,n,i)})})}addStringRecordToStream(e,t,i){A(this,t,n=>{Jl(this,Object.keys(e),r=>{Jl(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(r,s,Object.keys(e).length,n,i)})})})}addProtoToStream(e,t,i,n){A(this,i,r=>{A(this,t,s=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,s,r,n),this.i._free(o)})})}addEmptyPacketToStream(e,t){A(this,e,i=>{this.i._addEmptyPacketToInputStream(i,t)})}addBoolVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateBoolVector(e.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(r,s);this.i._addBoolVectorToInputStream(r,n,i)})}addDoubleVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateDoubleVector(e.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(r,s);this.i._addDoubleVectorToInputStream(r,n,i)})}addFloatVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateFloatVector(e.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(r,s);this.i._addFloatVectorToInputStream(r,n,i)})}addIntVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateIntVector(e.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(r,s);this.i._addIntVectorToInputStream(r,n,i)})}addUintVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateUintVector(e.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(r,s);this.i._addUintVectorToInputStream(r,n,i)})}addStringVectorToStream(e,t,i){A(this,t,n=>{const r=this.i._allocateStringVector(e.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of e)A(this,s,o=>{this.i._addStringVectorEntry(r,o)});this.i._addStringVectorToInputStream(r,n,i)})}addBoolToInputSidePacket(e,t){A(this,t,i=>{this.i._addBoolToInputSidePacket(e,i)})}addDoubleToInputSidePacket(e,t){A(this,t,i=>{this.i._addDoubleToInputSidePacket(e,i)})}addFloatToInputSidePacket(e,t){A(this,t,i=>{this.i._addFloatToInputSidePacket(e,i)})}addIntToInputSidePacket(e,t){A(this,t,i=>{this.i._addIntToInputSidePacket(e,i)})}addUintToInputSidePacket(e,t){A(this,t,i=>{this.i._addUintToInputSidePacket(e,i)})}addStringToInputSidePacket(e,t){A(this,t,i=>{A(this,e,n=>{this.i._addStringToInputSidePacket(n,i)})})}addProtoToInputSidePacket(e,t,i){A(this,i,n=>{A(this,t,r=>{const s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,r,n),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const r of e)this.i._addBoolVectorEntry(n,r);this.i._addBoolVectorToInputSidePacket(n,i)})}addDoubleVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const r of e)this.i._addDoubleVectorEntry(n,r);this.i._addDoubleVectorToInputSidePacket(n,i)})}addFloatVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const r of e)this.i._addFloatVectorEntry(n,r);this.i._addFloatVectorToInputSidePacket(n,i)})}addIntVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const r of e)this.i._addIntVectorEntry(n,r);this.i._addIntVectorToInputSidePacket(n,i)})}addUintVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const r of e)this.i._addUintVectorEntry(n,r);this.i._addUintVectorToInputSidePacket(n,i)})}addStringVectorToInputSidePacket(e,t){A(this,t,i=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const r of e)A(this,r,s=>{this.i._addStringVectorEntry(n,s)});this.i._addStringVectorToInputSidePacket(n,i)})}attachBoolListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachBoolListener(i)})}attachBoolVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachBoolVectorListener(i)})}attachIntListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachIntListener(i)})}attachIntVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachIntVectorListener(i)})}attachUintListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachUintListener(i)})}attachUintVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachUintVectorListener(i)})}attachDoubleListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachDoubleListener(i)})}attachDoubleVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachDoubleVectorListener(i)})}attachFloatListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachFloatListener(i)})}attachFloatVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachFloatVectorListener(i)})}attachStringListener(e,t){ft(this,e,t),A(this,e,i=>{this.i._attachStringListener(i)})}attachStringVectorListener(e,t){qt(this,e,t),A(this,e,i=>{this.i._attachStringVectorListener(i)})}attachProtoListener(e,t,i){ft(this,e,t),A(this,e,n=>{this.i._attachProtoListener(n,i||!1)})}attachProtoVectorListener(e,t,i){qt(this,e,t),A(this,e,n=>{this.i._attachProtoVectorListener(n,i||!1)})}attachAudioListener(e,t,i){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),ft(this,e,(n,r)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,r)}),A(this,e,n=>{this.i._attachAudioListener(n,i||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends p2{get ea(){return this.i}oa(e,t,i){A(this,t,n=>{const[r,s]=Kl(this,e,n);this.ea._addBoundTextureAsImageToStream(n,r,s,i)})}V(e,t){ft(this,e,t),A(this,e,i=>{this.ea._attachImageListener(i)})}ba(e,t){qt(this,e,t),A(this,e,i=>{this.ea._attachImageVectorListener(i)})}}));var p2,Je=class extends T0{};function R(e,t,i){return L(this,null,function*(){var n;return function(r,s,o,a){return L(this,null,function*(){return k0(r,s,o,a)})}(e,(n=i.canvas)!=null?n:Wl()?void 0:document.createElement("canvas"),t,i)})}function f2(e,t,i,n){if(e.U){const s=new gl;if(i!=null&&i.regionOfInterest){if(!e.na)throw Error("This task doesn't support region-of-interest.");var r=i.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].");x(s,1,(r.left+r.right)/2),x(s,2,(r.top+r.bottom)/2),x(s,4,r.right-r.left),x(s,3,r.bottom-r.top)}else x(s,1,.5),x(s,2,.5),x(s,4,1),x(s,3,1);if(i!=null&&i.rotationDegrees){if((i==null?void 0:i.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(x(s,5,-Math.PI*i.rotationDegrees/180),(i==null?void 0:i.rotationDegrees)%180!=0){const[o,a]=Yl(t);i=he(s,3)*a/o,r=he(s,4)*o/a,x(s,4,i),x(s,3,r)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.oa(t,e.Z,n!=null?n:performance.now()),e.finishProcessing()}function Qe(e,t,i){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");f2(e,t,i,e.B+1)}function gt(e,t,i,n){var r;if(!((r=e.baseOptions)!=null&&r.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");f2(e,t,i,n)}function Vi(e,t,i,n){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 ye([r],i,!1,e.g.i.canvas,e.P,s,t),n?e.clone():e}var Re=class extends Oo{constructor(e,t,i,n){super(e),this.g=e,this.Z=t,this.U=i,this.na=n,this.P=new Ni}l(e,t=!0){if("runningMode"in e&&fn(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};Re.prototype.close=Re.prototype.close;var et=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},S(e=this.h=new _r,0,1,t=new ee),x(this.h,2,.5),x(this.h,3,.3)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i;return"minDetectionConfidence"in e&&x(this.h,2,(t=e.minDetectionConfidence)!=null?t:.5),"minSuppressionThreshold"in e&&x(this.h,3,(i=e.minSuppressionThreshold)!=null?i:.3),this.l(e)}D(e,t){return this.j={detections:[]},Qe(this,e,t),this.j}F(e,t,i){return this.j={detections:[]},gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect_in"),H(e,"detections");const t=new He;at(t,d0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect_in"),$(i,"DETECTIONS:detections"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("detections",(n,r)=>{for(const s of n)n=pl(s),this.j.detections.push(Gl(n));y(this,r)}),this.g.attachEmptyPacketListener("detections",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};et.prototype.detectForVideo=et.prototype.F,et.prototype.detect=et.prototype.D,et.prototype.setOptions=et.prototype.o,et.createFromModelPath=function(e,t){return L(this,null,function*(){return R(et,e,{baseOptions:{modelAssetPath:t}})})},et.createFromModelBuffer=function(e,t){return R(et,e,{baseOptions:{modelAssetBuffer:t}})},et.createFromOptions=function(e,t){return R(et,e,t)};var jo=ht([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]),Go=ht([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]),zo=ht([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),m2=ht([474,475],[475,476],[476,477],[477,474]),Zo=ht([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]),qo=ht([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),g2=ht([469,470],[470,471],[471,472],[472,469]),Wo=ht([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]),v2=[...jo,...Go,...zo,...Zo,...qo,...Wo],b2=ht([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 w2(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,S(e=this.h=new xl,0,1,t=new ee),this.v=new El,S(this.h,0,3,this.v),this.s=new _r,S(this.h,0,2,this.s),pt(this.s,4,1),x(this.s,2,.5),x(this.v,2,.5),x(this.h,4,.5)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i,n,r;return"numFaces"in e&&pt(this.s,4,(t=e.numFaces)!=null?t:1),"minFaceDetectionConfidence"in e&&x(this.s,2,(i=e.minFaceDetectionConfidence)!=null?i:.5),"minTrackingConfidence"in e&&x(this.h,4,(n=e.minTrackingConfidence)!=null?n:.5),"minFacePresenceConfidence"in e&&x(this.v,2,(r=e.minFacePresenceConfidence)!=null?r:.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return w2(this),Qe(this,e,t),this.j}F(e,t,i){return w2(this),gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"face_landmarks");const t=new He;at(t,p0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"NORM_LANDMARKS:face_landmarks"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("face_landmarks",(n,r)=>{for(const s of n)n=bn(s),this.j.faceLandmarks.push(Cr(n));y(this,r)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{y(this,n)}),this.outputFaceBlendshapes&&(H(e,"blendshapes"),$(i,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,r)=>{var s;if(this.outputFaceBlendshapes)for(const o of n)n=br(o),this.j.faceBlendshapes.push(Do((s=n.g())!=null?s:[]));y(this,r)}),this.g.attachEmptyPacketListener("blendshapes",n=>{y(this,n)})),this.outputFacialTransformationMatrixes&&(H(e,"face_geometry"),$(i,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,r)=>{var s,o,a,c,l;if(this.outputFacialTransformationMatrixes)for(const d of n)(n=N(u0(d),n0,2))&&this.j.facialTransformationMatrixes.push({rows:(o=(s=Ye(n,1))!=null?s:0)!=null?o:0,columns:(c=(a=Ye(n,2))!=null?a:0)!=null?c:0,data:(l=ri(n,3,Ht,ni()).slice())!=null?l:[]});y(this,r)}),this.g.attachEmptyPacketListener("face_geometry",n=>{y(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.F,K.prototype.detect=K.prototype.D,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return R(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return R(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return R(K,e,t)},K.FACE_LANDMARKS_LIPS=jo,K.FACE_LANDMARKS_LEFT_EYE=Go,K.FACE_LANDMARKS_LEFT_EYEBROW=zo,K.FACE_LANDMARKS_LEFT_IRIS=m2,K.FACE_LANDMARKS_RIGHT_EYE=Zo,K.FACE_LANDMARKS_RIGHT_EYEBROW=qo,K.FACE_LANDMARKS_RIGHT_IRIS=g2,K.FACE_LANDMARKS_FACE_OVAL=Wo,K.FACE_LANDMARKS_CONTOURS=v2,K.FACE_LANDMARKS_TESSELATION=b2;var vt=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!0),S(e=this.j=new Al,0,1,t=new ee)}get baseOptions(){return N(this.j,ee,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){return super.l(e)}Ka(e,t,i){const n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:i,Qe(this,e,n!=null?n:{}),!this.h)return this.s}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"stylized_image");const t=new He;at(t,f0,this.j);const i=new Me;Ue(i,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"STYLIZED_IMAGE:stylized_image"),i.o(t),Ve(e,i),this.g.V("stylized_image",(n,r)=>{var s=!this.h,o=n.data,a=n.width;const c=a*(n=n.height);if(o instanceof Uint8Array)if(o.length===3*c){const l=new Uint8ClampedArray(4*c);for(let d=0;d<c;++d)l[4*d]=o[3*d],l[4*d+1]=o[3*d+1],l[4*d+2]=o[3*d+2],l[4*d+3]=255;o=new ImageData(l,a,n)}else{if(o.length!==4*c)throw Error("Unsupported channel count: "+o.length/c);o=new ImageData(new Uint8ClampedArray(o.buffer,o.byteOffset,o.length),a,n)}else if(!(o instanceof WebGLTexture))throw Error(`Unsupported format: ${o.constructor.name}`);a=new _e([o],!1,!1,this.g.i.canvas,this.P,a,n),this.s=s=s?a.clone():a,this.h&&this.h(s),y(this,r)}),this.g.attachEmptyPacketListener("stylized_image",n=>{this.s=null,this.h&&this.h(null),y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};vt.prototype.stylize=vt.prototype.Ka,vt.prototype.setOptions=vt.prototype.o,vt.createFromModelPath=function(e,t){return R(vt,e,{baseOptions:{modelAssetPath:t}})},vt.createFromModelBuffer=function(e,t){return R(vt,e,{baseOptions:{modelAssetBuffer:t}})},vt.createFromOptions=function(e,t){return R(vt,e,t)};var Xo=ht([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 y2(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function _2(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 C2(e,t=!0){var r,s,o,a,c,l;const i=[];for(const d of e){var n=br(d);e=[];for(const h of n.g())n=t&&Ye(h,1)!=null?(r=Ye(h,1))!=null?r:0:-1,e.push({score:(s=he(h,2))!=null?s:0,index:n,categoryName:(a=(o=Ke(h,3))!=null?o:"")!=null?a:"",displayName:(l=(c=Ke(h,4))!=null?c:"")!=null?l:""});i.push(e)}return i}var je=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.j=new Ml,0,1,t=new ee),this.s=new Lo,S(this.j,0,2,this.s),this.C=new So,S(this.s,0,3,this.C),this.v=new Ll,S(this.s,0,2,this.v),this.h=new m0,S(this.j,0,3,this.h),x(this.v,2,.5),x(this.s,4,.5),x(this.C,2,.5)}get baseOptions(){return N(this.j,ee,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var r,s,o,a,c,l,d,h;if(pt(this.v,3,(r=e.numHands)!=null?r:1),"minHandDetectionConfidence"in e&&x(this.v,2,(s=e.minHandDetectionConfidence)!=null?s:.5),"minTrackingConfidence"in e&&x(this.s,4,(o=e.minTrackingConfidence)!=null?o:.5),"minHandPresenceConfidence"in e&&x(this.C,2,(a=e.minHandPresenceConfidence)!=null?a:.5),e.cannedGesturesClassifierOptions){var t=new Pi,i=t,n=Bo(e.cannedGesturesClassifierOptions,(c=N(this.h,Pi,3))==null?void 0:c.h());S(i,0,2,n),S(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((l=N(this.h,Pi,3))==null||l.g());return e.customGesturesClassifierOptions?(S(i=t=new Pi,0,2,n=Bo(e.customGesturesClassifierOptions,(d=N(this.h,Pi,4))==null?void 0:d.h())),S(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((h=N(this.h,Pi,4))==null||h.g()),this.l(e)}Fa(e,t){return y2(this),Qe(this,e,t),_2(this)}Ga(e,t,i){return y2(this),gt(this,e,i,t),_2(this)}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"hand_gestures"),H(e,"hand_landmarks"),H(e,"world_hand_landmarks"),H(e,"handedness");const t=new He;at(t,g0,this.j);const i=new Me;Ue(i,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"HAND_GESTURES:hand_gestures"),$(i,"LANDMARKS:hand_landmarks"),$(i,"WORLD_LANDMARKS:world_hand_landmarks"),$(i,"HANDEDNESS:handedness"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("hand_landmarks",(n,r)=>{var s,o,a,c;for(const l of n){n=bn(l);const d=[];for(const h of At(n,ml,1))d.push({x:(s=he(h,1))!=null?s:0,y:(o=he(h,2))!=null?o:0,z:(a=he(h,3))!=null?a:0,visibility:(c=he(h,4))!=null?c:0});this.landmarks.push(d)}y(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,r)=>{var s,o,a,c;for(const l of n){n=Oi(l);const d=[];for(const h of At(n,fl,1))d.push({x:(s=he(h,1))!=null?s:0,y:(o=he(h,2))!=null?o:0,z:(a=he(h,3))!=null?a:0,visibility:(c=he(h,4))!=null?c:0});this.worldLandmarks.push(d)}y(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,r)=>{this.gestures.push(...C2(n,!1)),y(this,r)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{y(this,n)}),this.g.attachProtoVectorListener("handedness",(n,r)=>{this.handedness.push(...C2(n)),y(this,r)}),this.g.attachEmptyPacketListener("handedness",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function E2(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}je.prototype.recognizeForVideo=je.prototype.Ga,je.prototype.recognize=je.prototype.Fa,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=function(e,t){return R(je,e,{baseOptions:{modelAssetPath:t}})},je.createFromModelBuffer=function(e,t){return R(je,e,{baseOptions:{modelAssetBuffer:t}})},je.createFromOptions=function(e,t){return R(je,e,t)},je.HAND_CONNECTIONS=Xo;var Ge=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],S(e=this.h=new Lo,0,1,t=new ee),this.s=new So,S(this.h,0,3,this.s),this.j=new Ll,S(this.h,0,2,this.j),pt(this.j,3,1),x(this.j,2,.5),x(this.s,2,.5),x(this.h,4,.5)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i,n,r;return"numHands"in e&&pt(this.j,3,(t=e.numHands)!=null?t:1),"minHandDetectionConfidence"in e&&x(this.j,2,(i=e.minHandDetectionConfidence)!=null?i:.5),"minTrackingConfidence"in e&&x(this.h,4,(n=e.minTrackingConfidence)!=null?n:.5),"minHandPresenceConfidence"in e&&x(this.s,2,(r=e.minHandPresenceConfidence)!=null?r:.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Qe(this,e,t),E2(this)}F(e,t,i){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],gt(this,e,i,t),E2(this)}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"hand_landmarks"),H(e,"world_hand_landmarks"),H(e,"handedness");const t=new He;at(t,v0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"LANDMARKS:hand_landmarks"),$(i,"WORLD_LANDMARKS:world_hand_landmarks"),$(i,"HANDEDNESS:handedness"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("hand_landmarks",(n,r)=>{for(const s of n)n=bn(s),this.landmarks.push(Cr(n));y(this,r)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,r)=>{for(const s of n)n=Oi(s),this.worldLandmarks.push(wn(n));y(this,r)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{y(this,n)}),this.g.attachProtoVectorListener("handedness",(n,r)=>{var c,l,d,h,u,p,f;var s=this.handedness,o=s.push;const a=[];for(const m of n){n=br(m);const v=[];for(const g of n.g())v.push({score:(c=he(g,2))!=null?c:0,index:(d=(l=Ye(g,1))!=null?l:0)!=null?d:-1,categoryName:(u=(h=Ke(g,3))!=null?h:"")!=null?u:"",displayName:(f=(p=Ke(g,4))!=null?p:"")!=null?f:""});a.push(v)}o.call(s,...a),y(this,r)}),this.g.attachEmptyPacketListener("handedness",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.detectForVideo=Ge.prototype.F,Ge.prototype.detect=Ge.prototype.D,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return R(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return R(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return R(Ge,e,t)},Ge.HAND_CONNECTIONS=Xo;var x2=ht([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 k2(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function A2(e){try{if(!e.C)return e.h;e.C(e.h)}finally{kr(e)}}function Ir(e,t){e=bn(e),t.push(Cr(e))}var te=class extends Re{constructor(e,t){super(new Je(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,S(e=this.j=new Rl,0,1,t=new ee),this.K=new So,S(this.j,0,2,this.K),this.Y=new b0,S(this.j,0,3,this.Y),this.s=new _r,S(this.j,0,4,this.s),this.H=new El,S(this.j,0,5,this.H),this.v=new Bl,S(this.j,0,6,this.v),this.L=new Dl,S(this.j,0,7,this.L),x(this.s,2,.5),x(this.s,3,.3),x(this.H,2,.5),x(this.v,2,.5),x(this.v,3,.3),x(this.L,2,.5),x(this.K,2,.5)}get baseOptions(){return N(this.j,ee,1)}set baseOptions(e){S(this.j,0,1,e)}o(e){var t,i,n,r,s,o,a;return"minFaceDetectionConfidence"in e&&x(this.s,2,(t=e.minFaceDetectionConfidence)!=null?t:.5),"minFaceSuppressionThreshold"in e&&x(this.s,3,(i=e.minFaceSuppressionThreshold)!=null?i:.3),"minFacePresenceConfidence"in e&&x(this.H,2,(n=e.minFacePresenceConfidence)!=null?n:.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&x(this.v,2,(r=e.minPoseDetectionConfidence)!=null?r:.5),"minPoseSuppressionThreshold"in e&&x(this.v,3,(s=e.minPoseSuppressionThreshold)!=null?s:.3),"minPosePresenceConfidence"in e&&x(this.L,2,(o=e.minPosePresenceConfidence)!=null?o:.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&x(this.K,2,(a=e.minHandLandmarksConfidence)!=null?a:.5),this.l(e)}D(e,t,i){const n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:i,k2(this),Qe(this,e,n),A2(this)}F(e,t,i,n){const r=typeof i!="function"?i:{};return this.C=typeof i=="function"?i:n,k2(this),gt(this,e,r,t),A2(this)}m(){var e=new De;Y(e,"input_frames_image"),H(e,"pose_landmarks"),H(e,"pose_world_landmarks"),H(e,"face_landmarks"),H(e,"left_hand_landmarks"),H(e,"left_hand_world_landmarks"),H(e,"right_hand_landmarks"),H(e,"right_hand_world_landmarks");const t=new He,i=new Kc;Ws(i,1,xi("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(r,s){if(s!=null)if(Array.isArray(s))W(r,2,Kn(s,Gs,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof Et||ei(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Ws(r,2,Is(s,!1),ti())}}(i,this.j.g());const n=new Me;Ue(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),ir(n,8,Kc,i),X(n,"IMAGE:input_frames_image"),$(n,"POSE_LANDMARKS:pose_landmarks"),$(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),$(n,"FACE_LANDMARKS:face_landmarks"),$(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),$(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),$(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),$(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Ve(e,n),xr(this,e),this.g.attachProtoListener("pose_landmarks",(r,s)=>{Ir(r,this.h.poseLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("pose_world_landmarks",(r,s)=>{var o=this.h.poseWorldLandmarks;r=Oi(r),o.push(wn(r)),y(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",r=>{y(this,r)}),this.outputPoseSegmentationMasks&&($(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),$i(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(r,s)=>{this.h.poseSegmentationMasks=[Vi(this,r,!0,!this.C)],y(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",r=>{this.h.poseSegmentationMasks=[],y(this,r)})),this.g.attachProtoListener("face_landmarks",(r,s)=>{Ir(r,this.h.faceLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",r=>{y(this,r)}),this.outputFaceBlendshapes&&(H(e,"extra_blendshapes"),$(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(r,s)=>{var a;var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(r=br(r),o.push(Do((a=r.g())!=null?a:[]))),y(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",r=>{y(this,r)})),this.g.attachProtoListener("left_hand_landmarks",(r,s)=>{Ir(r,this.h.leftHandLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("left_hand_world_landmarks",(r,s)=>{var o=this.h.leftHandWorldLandmarks;r=Oi(r),o.push(wn(r)),y(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("right_hand_landmarks",(r,s)=>{Ir(r,this.h.rightHandLandmarks),y(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",r=>{y(this,r)}),this.g.attachProtoListener("right_hand_world_landmarks",(r,s)=>{var o=this.h.rightHandWorldLandmarks;r=Oi(r),o.push(wn(r)),y(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",r=>{y(this,r)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};te.prototype.detectForVideo=te.prototype.F,te.prototype.detect=te.prototype.D,te.prototype.setOptions=te.prototype.o,te.createFromModelPath=function(e,t){return R(te,e,{baseOptions:{modelAssetPath:t}})},te.createFromModelBuffer=function(e,t){return R(te,e,{baseOptions:{modelAssetBuffer:t}})},te.createFromOptions=function(e,t){return R(te,e,t)},te.HAND_CONNECTIONS=Xo,te.POSE_CONNECTIONS=x2,te.FACE_LANDMARKS_LIPS=jo,te.FACE_LANDMARKS_LEFT_EYE=Go,te.FACE_LANDMARKS_LEFT_EYEBROW=zo,te.FACE_LANDMARKS_LEFT_IRIS=m2,te.FACE_LANDMARKS_RIGHT_EYE=Zo,te.FACE_LANDMARKS_RIGHT_EYEBROW=qo,te.FACE_LANDMARKS_RIGHT_IRIS=g2,te.FACE_LANDMARKS_FACE_OVAL=Wo,te.FACE_LANDMARKS_CONTOURS=v2,te.FACE_LANDMARKS_TESSELATION=b2;var tt=class extends Re{constructor(e,t){super(new Je(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},S(e=this.h=new Ol,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return S(this.h,0,2,Bo(e,N(this.h,xo,2))),this.l(e)}qa(e,t){return this.j={classifications:[]},Qe(this,e,t),this.j}ra(e,t,i){return this.j={classifications:[]},gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"input_image"),Y(e,"norm_rect"),H(e,"classifications");const t=new He;at(t,w0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),X(i,"IMAGE:input_image"),X(i,"NORM_RECT:norm_rect"),$(i,"CLASSIFICATIONS:classifications"),i.o(t),Ve(e,i),this.g.attachProtoListener("classifications",(n,r)=>{this.j=function(s){var a;const o={classifications:At(s,s0,1).map(c=>{var l,d,h,u;return Do((d=(l=N(c,dl,4))==null?void 0:l.g())!=null?d:[],(h=Ye(c,2))!=null?h:0,(u=Ke(c,3))!=null?u:"")})};return Ns(Ai(s,2))!=null&&(o.timestampMs=(a=Ns(Ai(s,2)))!=null?a:0),o}(o0(n)),y(this,r)}),this.g.attachEmptyPacketListener("classifications",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};tt.prototype.classifyForVideo=tt.prototype.ra,tt.prototype.classify=tt.prototype.qa,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(e,t){return R(tt,e,{baseOptions:{modelAssetPath:t}})},tt.createFromModelBuffer=function(e,t){return R(tt,e,{baseOptions:{modelAssetBuffer:t}})},tt.createFromOptions=function(e,t){return R(tt,e,t)};var ze=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!0),this.h=new Pl,this.embeddings={embeddings:[]},S(e=this.h,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t=this.h,i=N(this.h,yl,2);return i=i?i.clone():new yl,e.l2Normalize!==void 0?fn(i,1,e.l2Normalize):"l2Normalize"in e&&W(i,1),e.quantize!==void 0?fn(i,2,e.quantize):"quantize"in e&&W(i,2),S(t,0,2,i),this.l(e)}xa(e,t){return Qe(this,e,t),this.embeddings}ya(e,t,i){return gt(this,e,i,t),this.embeddings}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"embeddings_out");const t=new He;at(t,y0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"EMBEDDINGS:embeddings_out"),i.o(t),Ve(e,i),this.g.attachProtoListener("embeddings_out",(n,r)=>{n=l0(n),this.embeddings=function(s){var o;return{embeddings:At(s,c0,1).map(a=>{var l,d,h,u,p,f,m;const c={headIndex:(d=(l=Ye(a,3))!=null?l:0)!=null?d:-1,headName:(u=(h=Ke(a,4))!=null?h:"")!=null?u:""};if(yc(a,vl,Xs(a,1))!==void 0)a=ri(a=N(a,vl,Xs(a,1)),1,Ht,ni()),c.floatEmbedding=a.slice();else{const v=new Uint8Array(0);c.quantizedEmbedding=(m=(f=(p=N(a,a0,Xs(a,2)))==null?void 0:p.ma())==null?void 0:f.h())!=null?m:v}return c}),timestampMs:(o=Ns(Ai(s,2)))!=null?o:0}}(n),y(this,r)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ze.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Zl(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Zl(zl(e.quantizedEmbedding),zl(t.quantizedEmbedding))}return e},ze.prototype.embedForVideo=ze.prototype.ya,ze.prototype.embed=ze.prototype.xa,ze.prototype.setOptions=ze.prototype.o,ze.createFromModelPath=function(e,t){return R(ze,e,{baseOptions:{modelAssetPath:t}})},ze.createFromModelBuffer=function(e,t){return R(ze,e,{baseOptions:{modelAssetBuffer:t}})},ze.createFromOptions=function(e,t){return R(ze,e,t)};var Yo=class{constructor(e,t,i){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=i}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(i=>{i.close()}),(t=this.categoryMask)==null||t.close()}};function S2(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function L2(e){try{const t=new Yo(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{kr(e)}}Yo.prototype.close=Yo.prototype.close;var Oe=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fo,this.v=new $l,S(this.h,0,3,this.v),S(e=this.h,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i;return e.displayNamesLocale!==void 0?W(this.h,2,xi(e.displayNamesLocale)):"displayNamesLocale"in e&&W(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=(t=e.outputCategoryMask)!=null?t:!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=(i=e.outputConfidenceMasks)!=null?i:!0),super.l(e)}J(){(function(e){var i,n,r;const t=At(e.ca(),Me,1).filter(s=>{var o;return((o=Ke(s,1))!=null?o:"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")});if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&((r=(n=(i=N(t[0],He,7))==null?void 0:i.l())==null?void 0:n.g())!=null?r:new Map).forEach((s,o)=>{var a;e.s[Number(o)]=(a=Ke(s,1))!=null?a:""})})(this)}segment(e,t,i){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:i,S2(this),Qe(this,e,n),L2(this)}Ia(e,t,i,n){const r=typeof i!="function"?i:{};return this.j=typeof i=="function"?i:n,S2(this),gt(this,e,r,t),L2(this)}Ba(){return this.s}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect");const t=new He;at(t,Ul,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),i.o(t),Ve(e,i),xr(this,e),this.outputConfidenceMasks&&(H(e,"confidence_masks"),$(i,"CONFIDENCE_MASKS:confidence_masks"),$i(this,"confidence_masks"),this.g.ba("confidence_masks",(n,r)=>{this.confidenceMasks=n.map(s=>Vi(this,s,!0,!this.j)),y(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],y(this,n)})),this.outputCategoryMask&&(H(e,"category_mask"),$(i,"CATEGORY_MASK:category_mask"),$i(this,"category_mask"),this.g.V("category_mask",(n,r)=>{this.categoryMask=Vi(this,n,!1,!this.j),y(this,r)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,y(this,n)})),H(e,"quality_scores"),$(i,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,r)=>{this.qualityScores=n,y(this,r)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Oe.prototype.getLabels=Oe.prototype.Ba,Oe.prototype.segmentForVideo=Oe.prototype.Ia,Oe.prototype.segment=Oe.prototype.segment,Oe.prototype.setOptions=Oe.prototype.o,Oe.createFromModelPath=function(e,t){return R(Oe,e,{baseOptions:{modelAssetPath:t}})},Oe.createFromModelBuffer=function(e,t){return R(Oe,e,{baseOptions:{modelAssetBuffer:t}})},Oe.createFromOptions=function(e,t){return R(Oe,e,t)};var Ko=class{constructor(e,t,i){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=i}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(i=>{i.close()}),(t=this.categoryMask)==null||t.close()}};Ko.prototype.close=Ko.prototype.close;var I0=class extends C{constructor(e){super(e)}},ji=[0,ae,-2],Fr=[0,Mt,-3,Q,Mt,-1],M2=[0,Fr],T2=[0,Fr,ae,-1],Jo=class extends C{constructor(e){super(e)}},I2=[0,Mt,-1,Q],F0=class extends C{constructor(e){super(e)}},F2=class extends C{constructor(e){super(e)}},Qo=[1,2,3,4,5,6,7,8,9,10,14,15],B2=class extends C{constructor(e){super(e)}};B2.prototype.g=vr([0,we,[0,Qo,G,Fr,G,[0,Fr,ji],G,M2,G,[0,M2,ji],G,I2,G,[0,Mt,-3,Q,Ne],G,[0,Mt,-3,Q],G,[0,j,Mt,-2,Q,ae,Q,-1,2,Mt,ji],G,T2,G,[0,T2,ji],Mt,ji,j,G,[0,Mt,-3,Q,ji,-1],G,[0,we,I2]],j,[0,j,ae,-1,Q]]);var bt=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fo,this.s=new $l,S(this.h,0,3,this.s),S(e=this.h,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i;return"outputCategoryMask"in e&&(this.outputCategoryMask=(t=e.outputCategoryMask)!=null?t:!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=(i=e.outputConfidenceMasks)!=null?i:!0),super.l(e)}segment(e,t,i,n){const r=typeof i!="function"?i:{};this.j=typeof i=="function"?i:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,i=this.B+1,n=new B2;const s=new F2;var o=new I0;if(pt(o,1,255),S(s,0,12,o),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Jo;fn(a,3,!0),x(a,1,t.keypoint.x),x(a,2,t.keypoint.y),pn(s,5,Qo,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(o=new F0,t.scribble))fn(t=new Jo,3,!0),x(t,1,a.x),x(t,2,a.y),ir(o,1,Jo,t);pn(s,15,Qo,o)}ir(n,1,F2,s),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",i),Qe(this,e,r);e:{try{const l=new Ko(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{kr(this)}c=void 0}return c}m(){var e=new De;Y(e,"image_in"),Y(e,"roi_in"),Y(e,"norm_rect_in");const t=new He;at(t,Ul,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),X(i,"IMAGE:image_in"),X(i,"ROI:roi_in"),X(i,"NORM_RECT:norm_rect_in"),i.o(t),Ve(e,i),xr(this,e),this.outputConfidenceMasks&&(H(e,"confidence_masks"),$(i,"CONFIDENCE_MASKS:confidence_masks"),$i(this,"confidence_masks"),this.g.ba("confidence_masks",(n,r)=>{this.confidenceMasks=n.map(s=>Vi(this,s,!0,!this.j)),y(this,r)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],y(this,n)})),this.outputCategoryMask&&(H(e,"category_mask"),$(i,"CATEGORY_MASK:category_mask"),$i(this,"category_mask"),this.g.V("category_mask",(n,r)=>{this.categoryMask=Vi(this,n,!1,!this.j),y(this,r)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,y(this,n)})),H(e,"quality_scores"),$(i,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,r)=>{this.qualityScores=n,y(this,r)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};bt.prototype.segment=bt.prototype.segment,bt.prototype.setOptions=bt.prototype.o,bt.createFromModelPath=function(e,t){return R(bt,e,{baseOptions:{modelAssetPath:t}})},bt.createFromModelBuffer=function(e,t){return R(bt,e,{baseOptions:{modelAssetBuffer:t}})},bt.createFromOptions=function(e,t){return R(bt,e,t)};var it=class extends Re{constructor(e,t){super(new Je(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},S(e=this.h=new Vl,0,1,t=new ee)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?W(this.h,2,xi(e.displayNamesLocale)):"displayNamesLocale"in e&&W(this.h,2),e.maxResults!==void 0?pt(this.h,3,e.maxResults):"maxResults"in e&&W(this.h,3),e.scoreThreshold!==void 0?x(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&W(this.h,4),e.categoryAllowlist!==void 0?nr(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&W(this.h,5),e.categoryDenylist!==void 0?nr(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&W(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},Qe(this,e,t),this.j}F(e,t,i){return this.j={detections:[]},gt(this,e,i,t),this.j}m(){var e=new De;Y(e,"input_frame_gpu"),Y(e,"norm_rect"),H(e,"detections");const t=new He;at(t,C0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.ObjectDetectorGraph"),X(i,"IMAGE:input_frame_gpu"),X(i,"NORM_RECT:norm_rect"),$(i,"DETECTIONS:detections"),i.o(t),Ve(e,i),this.g.attachProtoVectorListener("detections",(n,r)=>{for(const s of n)n=pl(s),this.j.detections.push(Gl(n));y(this,r)}),this.g.attachEmptyPacketListener("detections",n=>{y(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};it.prototype.detectForVideo=it.prototype.F,it.prototype.detect=it.prototype.D,it.prototype.setOptions=it.prototype.o,it.createFromModelPath=function(e,t){return L(this,null,function*(){return R(it,e,{baseOptions:{modelAssetPath:t}})})},it.createFromModelBuffer=function(e,t){return R(it,e,{baseOptions:{modelAssetBuffer:t}})},it.createFromOptions=function(e,t){return R(it,e,t)};var ea=class{constructor(e,t,i){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=i}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function D2(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function R2(e){try{const t=new ea(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{kr(e)}}ea.prototype.close=ea.prototype.close;var Ze=class extends Re{constructor(e,t){super(new Je(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,S(e=this.h=new jl,0,1,t=new ee),this.v=new Dl,S(this.h,0,3,this.v),this.j=new Bl,S(this.h,0,2,this.j),pt(this.j,4,1),x(this.j,2,.5),x(this.v,2,.5),x(this.h,4,.5)}get baseOptions(){return N(this.h,ee,1)}set baseOptions(e){S(this.h,0,1,e)}o(e){var t,i,n,r,s;return"numPoses"in e&&pt(this.j,4,(t=e.numPoses)!=null?t:1),"minPoseDetectionConfidence"in e&&x(this.j,2,(i=e.minPoseDetectionConfidence)!=null?i:.5),"minTrackingConfidence"in e&&x(this.h,4,(n=e.minTrackingConfidence)!=null?n:.5),"minPosePresenceConfidence"in e&&x(this.v,2,(r=e.minPosePresenceConfidence)!=null?r:.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=(s=e.outputSegmentationMasks)!=null?s:!1),this.l(e)}D(e,t,i){const n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:i,D2(this),Qe(this,e,n),R2(this)}F(e,t,i,n){const r=typeof i!="function"?i:{};return this.s=typeof i=="function"?i:n,D2(this),gt(this,e,r,t),R2(this)}m(){var e=new De;Y(e,"image_in"),Y(e,"norm_rect"),H(e,"normalized_landmarks"),H(e,"world_landmarks"),H(e,"segmentation_masks");const t=new He;at(t,E0,this.h);const i=new Me;Ue(i,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),X(i,"IMAGE:image_in"),X(i,"NORM_RECT:norm_rect"),$(i,"NORM_LANDMARKS:normalized_landmarks"),$(i,"WORLD_LANDMARKS:world_landmarks"),i.o(t),Ve(e,i),xr(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,r)=>{this.landmarks=[];for(const s of n)n=bn(s),this.landmarks.push(Cr(n));y(this,r)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],y(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,r)=>{this.worldLandmarks=[];for(const s of n)n=Oi(s),this.worldLandmarks.push(wn(n));y(this,r)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],y(this,n)}),this.outputSegmentationMasks&&($(i,"SEGMENTATION_MASK:segmentation_masks"),$i(this,"segmentation_masks"),this.g.ba("segmentation_masks",(n,r)=>{this.segmentationMasks=n.map(s=>Vi(this,s,!0,!this.s)),y(this,r)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],y(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ze.prototype.detectForVideo=Ze.prototype.F,Ze.prototype.detect=Ze.prototype.D,Ze.prototype.setOptions=Ze.prototype.o,Ze.createFromModelPath=function(e,t){return R(Ze,e,{baseOptions:{modelAssetPath:t}})},Ze.createFromModelBuffer=function(e,t){return R(Ze,e,{baseOptions:{modelAssetBuffer:t}})},Ze.createFromOptions=function(e,t){return R(Ze,e,t)},Ze.POSE_CONNECTIONS=x2;const B0=e=>{if(!e||e.length===0)return 0;const t=e[0];if(!t||t.length===0)return 0;let i=1,n=0,r=1,s=0;t.forEach(l=>{l&&typeof l.x=="number"&&typeof l.y=="number"&&(i=Math.min(i,l.x),n=Math.max(n,l.x),r=Math.min(r,l.y),s=Math.max(s,l.y))});const o=n-i,a=s-r;return Math.max(o,a)},D0=(e,t)=>{if(!e||e.length===0)return!1;const i=e[0];let n=1,r=0,s=1,o=0;i.forEach(re=>{n=Math.min(n,re.x),r=Math.max(r,re.x),s=Math.min(s,re.y),o=Math.max(o,re.y)});const a=.5,c=.6,l=t>1;let d,h;l?(d=.4,h=.3):(d=.35,h=.5);const u=(n+r)/2,p=(s+o)/2,f=.2,m=d*(1+f),v=h*(1+f),b=((re,Z)=>{const ue=(re-a)/m,pe=(Z-c)/v;return ue*ue+pe*pe<=1})(u,p),_=.2,E=.1,M=d*(1+_),w=h*(1+E),T=(re,Z)=>{const ue=(re-a)/M,pe=(Z-c)/w;return ue*ue+pe*pe<=1},I=T(n,s),O=T(r,s),be=T(n,o),ce=T(r,o);return b&&I&&O&&be&&ce},R0=e=>{if(!e||e.length===0)return 0;const t=e[0];if(!t||t.length===0)return 0;const i=t[13],n=t[14];if(!i||!n)return 0;const r=Math.abs(n.y-i.y),s=Math.min(...t.map(c=>c.y)),a=Math.max(...t.map(c=>c.y))-s;return a>0?r/a:0},O0=e=>{const t=document.createElement("canvas"),i=t.getContext("2d");if(!i)return null;const n=e.videoWidth,r=e.videoHeight,s=Math.min(n,r),o=(n-s)/2,a=(r-s)/2;return t.width=s,t.height=s,i.drawImage(e,o,a,s,s,0,0,s,s),t},O2=(e,t,i,n)=>{const r=e.getContext("2d");if(!r)return;const s=e.width,o=e.height;r.clearRect(0,0,s,o);const a=new Ie(r);t.forEach(c=>{if(!c||c.length===0)return;const l="rgba(162, 155, 254,0.4)",d=2;r.strokeStyle="rgba(255, 255, 255, 0.6)",r.lineWidth=d,r.lineCap="round",r.lineJoin="round",a.drawLandmarks(c,{color:"rgba(9, 132, 227,0.7)",lineWidth:.5,radius:.5}),a.drawConnectors(c,K.FACE_LANDMARKS_FACE_OVAL,{color:l,lineWidth:d}),i>0&&i>=n&&a.drawConnectors(c,K.FACE_LANDMARKS_LIPS,{color:l,lineWidth:d})})},P2=e=>{const t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height)},P0=(e,t=!1)=>{const i=document.createElement("canvas"),n=i.getContext("2d");if(!n)return null;const r=e.videoHeight>e.videoWidth;t?r?(i.width=480,i.height=Math.max(640,i.width*e.videoHeight/e.videoWidth)):(i.width=640,i.height=Math.max(480,i.width*e.videoHeight/e.videoWidth)):r?(i.width=240,i.height=Math.max(320,i.width*e.videoHeight/e.videoWidth)):(i.width=320,i.height=Math.max(240,i.width*e.videoHeight/e.videoWidth));const s=1,o=e.videoWidth*s,a=e.videoHeight*s,c=(o-e.videoWidth)/2,l=(a-e.videoHeight)/2;return n.drawImage(e,-c,-l-0,o,a,0,0,i.width,i.height),i.toDataURL("image/jpeg")},$2={LIVENESS_IMAGE_BASE64:6,SELFIE_IMAGE_BASE64:2},N2={"multiple-faces":"Ensure only one face is visible","no-face":"Position your face in the oval","out-of-bounds":"Position your face in the oval","too-close":"Move farther away","too-far":"Move closer","neutral-expression":"Neutral expression","smile-required":"Smile!","open-mouth-smile":"Wider smile - teeth visible",initializing:"Initializing..."},$0=["sm-s936","sm-s931","sm-s938"],N0=()=>L(this,null,function*(){if(typeof navigator!="undefined"&&navigator.userAgentData)try{const{model:e}=yield navigator.userAgentData.getHighEntropyValues(["model"]);if(!e)return!1;const t=e.toLowerCase();return $0.some(i=>t.includes(i))}catch(e){return console.warn("UA-CH model fetch failed, falling back to UA string check.",e),!1}return!1}),H0=()=>{const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");if(!t)return!1;const i=t.getExtension("OES_texture_half_float"),n=t.getExtension("OES_texture_half_float_linear"),r=t.getExtension("EXT_color_buffer_half_float");return!!(i&&r&&n)},H2=()=>L(this,null,function*(){window.__smileIdentityMediapipe||(window.__smileIdentityMediapipe={instance:null,loading:null,loaded:!1});const e=window.__smileIdentityMediapipe;return e.loaded&&e.instance?e.instance:(e.loading||(e.loading=L(this,null,function*(){try{const t=yield ai.forVisionTasks("https://web-models.smileidentity.com/mediapipe-tasks-vision-wasm"),i=yield N0(),n=yield K.createFromOptions(t,{baseOptions:{modelAssetPath:"https://web-models.smileidentity.com/face_landmarker/face_landmarker.task",delegate:i||!H0()?"CPU":"GPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO",numFaces:2});return e.instance=n,e.loaded=!0,e.loading=null,n}catch(t){throw e.loading=null,t}})),e.loading)}),kn=Xi.version,U0=({videoRef:e,canvasRef:t,interval:i,duration:n,smileThreshold:r,mouthOpenThreshold:s,minFaceSize:o,maxFaceSize:a,smileCooldown:c,getFacingMode:l})=>{const d=xe(null),h=xe(null),u=xe(null),p=xe(null),f=se(!1),m=se(!1),v=se("good"),g=se(!1),b=se(16/9),_=se([]),E=se(0),M=se(0),w=se(0),T=se(0),I=se(""),O=se(!0),be=se(!1),ce=se(!1),re=se(0),Z=se([]),ue=se(null),pe=se(1),Ae=se(0),z2=se(!1),Gi=is(()=>Math.floor(pe.value*.4)),Z2=is(()=>Math.floor(pe.value*.2)),cu=is(()=>f.value&&m.value&&v.value==="good"&&!g.value),ra=z=>{z&&N2[z]?I.value=N2[z]:I.value=""},qe=xe(T1(z=>{ra(z)},600)).current,lu=()=>L(this,null,function*(){var z,Ce;try{((z=window.__smileIdentityMediapipe)==null?void 0:z.loaded)&&((Ce=window.__smileIdentityMediapipe)==null?void 0:Ce.instance)||(O.value=!0,ra("initializing")),d.current=yield H2(),O.value=!1}catch(yt){console.error("Failed to initialize MediaPipe:",yt),O.value=!1}}),hu=()=>{if(e.current&&t.current){const{videoWidth:z,videoHeight:Ce}=e.current;b.value=z/Ce,t.current.width=z,t.current.height=Ce,e.current.parentElement&&(t.current.style.left="50%",t.current.style.top="50%")}},du=()=>{const z=Ae.value<Z2.value,Ce=Ae.value>=Gi.value;z?I.value="Capturing...":Ce?Date.now()-T.value>c?E.value>=r&&w.value<s?qe("open-mouth-smile"):qe("smile-required"):I.value="Keep smiling!":qe(null)},uu=()=>{O.value?ra("initializing"):g.value?qe("multiple-faces"):f.value?v.value==="too-close"?qe("too-close"):v.value==="too-far"?qe("too-far"):m.value?be.value?du():I.value="Ready to capture":qe("out-of-bounds"):qe("no-face")},sa=()=>{h.current&&(cancelAnimationFrame(h.current),h.current=null)},oa=()=>L(this,null,function*(){var z,Ce;if(!d.current||!e.current){sa();return}if(e.current.videoWidth<=0||e.current.videoHeight<=0||e.current.readyState<2){h.current=requestAnimationFrame(oa);return}try{O.value&&(O.value=!1);const yt=O0(e.current),aa=yt||e.current,We=d.current.detectForVideo(aa,performance.now());if(_.value=We.faceLandmarks||[],We.faceLandmarks&&t.current&&e.current)if(yt){const Xt=e.current.videoWidth,ci=e.current.videoHeight,zi=Math.min(Xt,ci),ca=(Xt-zi)/(2*Xt),Rr=(ci-zi)/(2*ci),Or=zi/Xt,Zi=zi/ci,mu=We.faceLandmarks.map(gu=>gu.map(la=>({x:la.x*Or+ca,y:la.y*Zi+Rr,z:la.z})));O2(t.current,mu,Ae.value,Gi.value)}else O2(t.current,We.faceLandmarks,Ae.value,Gi.value);else t.current&&P2(t.current);const X2=We.faceLandmarks?We.faceLandmarks.length:0;g.value=X2>1;const Y2=We.faceBlendshapes&&We.faceBlendshapes.length>0&&X2===1;if(f.value=Y2,Y2&&We.faceLandmarks){const Xt=B0(We.faceLandmarks);M.value=Xt,Xt>a?v.value="too-close":Xt<o?v.value="too-far":v.value="good",m.value=D0(We.faceLandmarks,b.value);const ci=We.faceBlendshapes[0].categories,zi=((z=ci.find(Zi=>Zi.categoryName==="mouthSmileLeft"))==null?void 0:z.score)||0,ca=((Ce=ci.find(Zi=>Zi.categoryName==="mouthSmileRight"))==null?void 0:Ce.score)||0,Rr=R0(We.faceLandmarks),Or=(zi+ca)/2;E.value=Or,w.value=Rr,Or>=r&&Rr>=s&&(T.value=Date.now(),ce.value&&be.value&&p.current&&setTimeout(()=>{Date.now()-T.value<=100&&ce.value&&be.value&&p.current&&p.current()},0))}else E.value=0,M.value=0,w.value=0,m.value=!1,v.value="good";uu()}catch(yt){f.value=!1,m.value=!1,g.value=!1,v.value="good",w.value=0,be.value&&qe("no-face")}h.current=requestAnimationFrame(oa)}),pu=()=>{h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(oa)},fu=()=>{if(!e.current)return;const z=Ae.value===pe.value-1,Ce=P0(e.current,z);Ce&&(z?ue.value=Ce:Z.value=[...Z.value,Ce],Ae.value++,re.value=pe.value-Ae.value)},Dr=()=>{if(u.current&&(clearInterval(u.current),u.current=null),be.value=!1,ce.value=!1,Ae.value>=pe.value&&ue.value){const z=Z.value.map(aa=>({image:aa.split(",")[1],image_type_id:$2.LIVENESS_IMAGE_BASE64})),Ce={image:ue.value.split(",")[1],image_type_id:$2.SELFIE_IMAGE_BASE64},yt={images:[...z,Ce],referenceImage:ue.value,previewImage:ue.value,facingMode:l(),meta:{libraryVersion:kn}};window.dispatchEvent(new CustomEvent("selfie-capture.publish",{detail:yt})),z2.value=!0}},An=()=>{u.current&&(clearInterval(u.current),u.current=null),ce.value=!0,!g.value&&f.value&&m.value&&v.value==="good"&&qe("smile-required")},q2=()=>{u.current&&clearInterval(u.current),u.current=setInterval(()=>{if(Ae.value>=pe.value){Dr();return}if(g.value){An();return}if(!f.value)return;if(!m.value){An();return}if(v.value!=="good"){An();return}if(Ae.value>=Gi.value&&Date.now()-T.value>c){An();return}fu()},i)},W2=()=>{if(f.value&&v.value==="good"&&m.value&&!g.value){if(Ae.value>=Gi.value&&Date.now()-T.value>c)return;ce.value=!1,qe(null),q2()}};return p.current=W2,{faceDetected:f,faceInBounds:m,faceProximity:v,multipleFaces:g,videoAspectRatio:b,faceLandmarks:_,currentSmileScore:E,currentFaceSize:M,currentMouthOpen:w,lastSmileTime:T,alertTitle:I,isInitializing:O,isReadyToCapture:cu,isCapturing:be,isPaused:ce,countdown:re,capturedImages:Z,referencePhoto:ue,totalCaptures:pe,capturesTaken:Ae,hasFinishedCapture:z2,smileCheckpoint:Gi,neutralZone:Z2,initializeFaceLandmarker:lu,setupCanvas:hu,startDetectionLoop:pu,stopDetectionLoop:sa,updateAlert:qe,startCapture:()=>L(this,null,function*(){Z.value=[],be.value=!0,ce.value=!1,pe.value=Math.ceil(n/i),Ae.value=0,re.value=pe.value;const z=document.querySelector("smart-camera-web");z==null||z.dispatchEvent(new CustomEvent("metadata.selfie-capture-start")),z==null||z.dispatchEvent(new CustomEvent("metadata.selfie-origin",{detail:{imageOrigin:{environment:"back_camera",user:"front_camera"}[l()]}})),q2()}),stopCapture:Dr,pauseCapture:An,resumeCapture:W2,handleCancel:()=>{Dr(),window.dispatchEvent(new CustomEvent("selfie-capture.cancelled",{detail:{meta:{libraryVersion:kn}}})),window.dispatchEvent(new CustomEvent("selfie-capture-screens.cancelled",{detail:{meta:{libraryVersion:kn}}}))},handleClose:()=>{Dr(),window.dispatchEvent(new CustomEvent("selfie-capture.close",{detail:{meta:{libraryVersion:kn}}})),window.dispatchEvent(new CustomEvent("selfie-capture-screens.close",{detail:{meta:{libraryVersion:kn}}}))},cleanup:()=>{u.current&&clearInterval(u.current),sa(),qe.cancel()},resetFaceDetectionState:()=>{f.value=!1,m.value=!1,v.value="good",g.value=!1,_.value=[],E.value=0,M.value=0,w.value=0,T.value=0,t.current&&P2(t.current)}}},V0=({progress:e,duration:t=1e3,themeColor:i="#001096"})=>{const n=xe(null),r=xe(e);return ot(()=>{const s=n.current;if(!s)return;const o=s.getTotalLength();s.style.opacity=e>0?"1":"0";const a=o*(1-r.current),c=o*(1-e);a!==c&&(s.style.transition="none",s.style.strokeDasharray=`${o} ${o}`,s.style.strokeDashoffset=`${a}`,s.getBoundingClientRect(),s.style.transition=`stroke-dashoffset ${t}ms ease-out`,s.style.strokeDashoffset=`${c}`,r.current=e)},[e,t]),D("div",{style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"},children:D("svg",{viewBox:"0 0 285 380",preserveAspectRatio:"xMidYMid meet",style:{width:"100%",height:"100%"},children:[D("clipPath",{id:"selfie-clip-path",clipPathUnits:"objectBoundingBox",children:D("path",{d:"M0.085 0.382 C0.087 0.357 0.092 0.294 0.131 0.236 C0.200 0.133 0.340 0.063 0.501 0.063 C0.730 0.063 0.915 0.205 0.915 0.382 C0.915 0.424 0.899 0.513 0.891 0.549 C0.882 0.588 0.871 0.626 0.857 0.664 C0.792 0.825 0.639 0.937 0.501 0.937 C0.314 0.937 0.182 0.755 0.144 0.666 C0.126 0.624 0.110 0.557 0.107 0.547 C0.092 0.485 0.081 0.439 0.085 0.382 Z"})}),D("path",{d:"M142.693 24C208.319 24 261 77.97 261 145.008C261 160.97 256.319 194.788 254.129 208.356C251.64 223.188 248.348 237.875 244.27 252.35C225.747 313.203 182.328 356 142.693 356C89.414 356 51.871 286.667 41.016 252.948C35.937 236.987 31.356 211.748 30.559 207.857C26.277 184.114 22.991 166.556 24.285 145.008C24.883 135.631 26.277 111.789 37.431 89.742C57.049 50.636 96.983 24 142.693 24Z",stroke:i,fill:"none",style:{strokeWidth:"8"}}),D("path",{ref:n,d:"M142.693 24C208.319 24 261 77.97 261 145.008C261 160.97 256.319 194.788 254.129 208.356C251.64 223.188 248.348 237.875 244.27 252.35C225.747 313.203 182.328 356 142.693 356C89.414 356 51.871 286.667 41.016 252.948C35.937 236.987 31.356 211.748 30.559 207.857C26.277 184.114 22.991 166.556 24.285 145.008C24.883 135.631 26.277 111.789 37.431 89.742C57.049 50.636 96.983 24 142.693 24Z",stroke:"#22c55e",style:{strokeWidth:"8"},fill:"none",strokeLinecap:"round"})]})})},j0=({videoRef:e,canvasRef:t,facingMode:i,multipleFaces:n,progress:r,interval:s,themeColor:o})=>D(Dt,{children:[D("div",{className:"camera-preview-container",children:[D("div",{className:"video-wrapper",style:{clipPath:n?"none":"url(#selfie-clip-path)"},children:D("div",{className:"video-container",children:[D("video",{ref:e,autoPlay:!0,playsInline:!0,muted:!0,className:`camera-video ${i==="user"?"mirror":""}`}),D("canvas",{ref:t,className:`camera-canvas ${i==="user"?"mirror":""}`})]})}),!n&&D(V0,{progress:r,duration:s,themeColor:o})]}),D("style",{children:`
3182
3160
  .camera-preview-container {
3183
3161
  position: relative;
3184
3162
  width: 100%;
@@ -3219,7 +3197,7 @@ ${this.hideAttribution?"":`
3219
3197
  .camera-canvas {
3220
3198
  pointer-events: none;
3221
3199
  }
3222
- `})]}),V0=({alertTitle:e})=>e?D(Dt,{children:[D("div",{className:"alert-message",children:D("div",{className:"alert-title",children:e})}),D("style",{children:`
3200
+ `})]}),G0=({alertTitle:e})=>e?D(Dt,{children:[D("div",{className:"alert-message",children:D("div",{className:"alert-title",children:e})}),D("style",{children:`
3223
3201
  .alert-message {
3224
3202
  margin-top: 1.5rem;
3225
3203
  color: #000;
@@ -3235,7 +3213,7 @@ ${this.hideAttribution?"":`
3235
3213
  font-weight: bold;
3236
3214
  text-align: center;
3237
3215
  }
3238
- `})]}):null,j0=({isCapturing:e,hasFinishedCapture:t,isReadyToCapture:i,allowAgentMode:n,agentSupported:r,showAgentModeForTests:s,facingMode:o,themeColor:a="#001096",onStartCapture:c,onSwitchCamera:l})=>D(Dt,{children:[D("div",{className:"controls",children:[D("button",{id:"start-image-capture",class:"btn-primary",onClick:c,disabled:e||t||!i,children:"Start Capture"}),n&&(r||s)&&D("button",{id:"switch-camera",onClick:l,className:"agent-mode-btn",disabled:e||t,children:o==="user"?"Agent Mode Off":"Agent Mode On"})]}),D("style",{children:`
3216
+ `})]}):null,z0=({isCapturing:e,hasFinishedCapture:t,isReadyToCapture:i,allowAgentMode:n,agentSupported:r,showAgentModeForTests:s,facingMode:o,themeColor:a="#001096",onStartCapture:c,onSwitchCamera:l})=>D(Dt,{children:[D("div",{className:"controls",children:[D("button",{id:"start-image-capture",class:"btn-primary",onClick:c,disabled:e||t||!i,children:"Start Capture"}),n&&(r||s)&&D("button",{id:"switch-camera",onClick:l,className:"agent-mode-btn",disabled:e||t,children:o==="user"?"Agent Mode Off":"Agent Mode On"})]}),D("style",{children:`
3239
3217
  .controls {
3240
3218
  margin: 1.5rem 0;
3241
3219
  display: flex;
@@ -3260,7 +3238,7 @@ ${this.hideAttribution?"":`
3260
3238
  background: #ccc;
3261
3239
  cursor: not-allowed;
3262
3240
  }
3263
- `})]}),ta=({interval:e=350,duration:t=2800,"theme-color":i="#001096","show-navigation":n=!1,"allow-agent-mode":r=!1,"show-agent-mode-for-tests":s=!1,"hide-attribution":o=!1})=>{const a=xe(null),c=xe(null),l=fi(n),d=fi(r),h=fi(s),u=fi(o),p=300,f=.25,m=.05,v=.35,g=.5,b=d?"environment":"user",_=rd(b),E=se(!1),L=xe(T1(T=>{E.value=T},100)).current,w=N0({videoRef:_.videoRef,canvasRef:a,interval:e,duration:t,smileThreshold:f,mouthOpenThreshold:m,minFaceSize:v,maxFaceSize:g,smileCooldown:p,getFacingMode:()=>_.facingMode});return ot(()=>{const T=()=>M(null,null,function*(){yield _.startCamera(b,I=>{const O=document.querySelector("smart-camera-web");O==null||O.dispatchEvent(new CustomEvent("metadata.camera-name",{detail:{cameraName:I}}))}),yield _.checkAgentSupport(),yield w.initializeFaceLandmarker(),setTimeout(()=>{w.setupCanvas(),w.startDetectionLoop()},500)});return _.registerCameraSwitchCallback(()=>{try{w.resetFaceDetectionState(),w.setupCanvas(),w.stopDetectionLoop(),w.startDetectionLoop()}catch(I){console.error("Error during camera switch callback:",I)}}),T(),()=>{w.stopDetectionLoop(),_.stopCamera(),w.cleanup(),L.cancel()}},[]),ot(()=>{L(w.multipleFaces.value)},[w.multipleFaces.value]),ot(()=>{const T=c.current;if(T&&l){const I=()=>{w.handleCancel()},O=()=>{w.handleClose()};return T.addEventListener("navigation.back",I),T.addEventListener("navigation.close",O),()=>{T.removeEventListener("navigation.back",I),T.removeEventListener("navigation.close",O)}}},[l]),ot(()=>{if(w.hasFinishedCapture.value){const T=document.querySelector("smart-camera-web");T==null||T.dispatchEvent(new CustomEvent("metadata.selfie-capture-end"))}},[w.hasFinishedCapture.value]),D("div",{className:"smartselfie-capture",children:[l&&D("smileid-navigation",{ref:c,"theme-color":i}),D(U0,{videoRef:_.videoRef,canvasRef:a,facingMode:_.facingMode,multipleFaces:E.value,progress:w.capturesTaken.value>0?w.capturesTaken.value/w.totalCaptures.value:0,interval:e,themeColor:i}),D(V0,{alertTitle:w.alertTitle.value}),!w.isCapturing.value&&!w.hasFinishedCapture.value&&D(j0,{isCapturing:w.isCapturing.value,hasFinishedCapture:w.hasFinishedCapture.value,isReadyToCapture:w.isReadyToCapture.value,allowAgentMode:d,agentSupported:_.agentSupported,showAgentModeForTests:h,facingMode:_.facingMode,themeColor:i,onStartCapture:w.startCapture,onSwitchCamera:_.switchCamera}),!u&&D("powered-by-smile-id",{}),D("style",{children:`
3241
+ `})]}),ta=({interval:e=350,duration:t=2800,"theme-color":i="#001096","show-navigation":n=!1,"allow-agent-mode":r=!1,"show-agent-mode-for-tests":s=!1,"hide-attribution":o=!1})=>{const a=xe(null),c=xe(null),l=fi(n),d=fi(r),h=fi(s),u=fi(o),p=300,f=.25,m=.05,v=.35,g=.5,b=d?"environment":"user",_=rd(b),E=se(!1),M=xe(T1(T=>{E.value=T},100)).current,w=U0({videoRef:_.videoRef,canvasRef:a,interval:e,duration:t,smileThreshold:f,mouthOpenThreshold:m,minFaceSize:v,maxFaceSize:g,smileCooldown:p,getFacingMode:()=>_.facingMode});return ot(()=>{const T=()=>L(this,null,function*(){yield _.startCamera(b,I=>{const O=document.querySelector("smart-camera-web");O==null||O.dispatchEvent(new CustomEvent("metadata.camera-name",{detail:{cameraName:I}}))}),yield _.checkAgentSupport(),yield w.initializeFaceLandmarker(),setTimeout(()=>{w.setupCanvas(),w.startDetectionLoop()},500)});return _.registerCameraSwitchCallback(()=>{try{w.resetFaceDetectionState(),w.setupCanvas(),w.stopDetectionLoop(),w.startDetectionLoop()}catch(I){console.error("Error during camera switch callback:",I)}}),T(),()=>{w.stopDetectionLoop(),_.stopCamera(),w.cleanup(),M.cancel()}},[]),ot(()=>{M(w.multipleFaces.value)},[w.multipleFaces.value]),ot(()=>{const T=c.current;if(T&&l){const I=()=>{w.handleCancel()},O=()=>{w.handleClose()};return T.addEventListener("navigation.back",I),T.addEventListener("navigation.close",O),()=>{T.removeEventListener("navigation.back",I),T.removeEventListener("navigation.close",O)}}},[l]),ot(()=>{if(w.hasFinishedCapture.value){const T=document.querySelector("smart-camera-web");T==null||T.dispatchEvent(new CustomEvent("metadata.selfie-capture-end"))}},[w.hasFinishedCapture.value]),D("div",{className:"smartselfie-capture",children:[l&&D("smileid-navigation",{ref:c,"theme-color":i}),D(j0,{videoRef:_.videoRef,canvasRef:a,facingMode:_.facingMode,multipleFaces:E.value,progress:w.capturesTaken.value>0?w.capturesTaken.value/w.totalCaptures.value:0,interval:e,themeColor:i}),D(G0,{alertTitle:w.alertTitle.value}),!w.isCapturing.value&&!w.hasFinishedCapture.value&&D(z0,{isCapturing:w.isCapturing.value,hasFinishedCapture:w.hasFinishedCapture.value,isReadyToCapture:w.isReadyToCapture.value,allowAgentMode:d,agentSupported:_.agentSupported,showAgentModeForTests:h,facingMode:_.facingMode,themeColor:i,onStartCapture:w.startCapture,onSwitchCamera:_.switchCamera}),!u&&D("powered-by-smile-id",{}),D("style",{children:`
3264
3242
  * {
3265
3243
  box-sizing: border-box;
3266
3244
  }
@@ -3308,7 +3286,7 @@ ${this.hideAttribution?"":`
3308
3286
  padding: 1rem;
3309
3287
  font-family: sans-serif;
3310
3288
  }
3311
- `})]})};customElements.get("smartselfie-capture")||t1(ta,"smartselfie-capture",["interval","duration","theme-color","show-navigation","allow-agent-mode","show-agent-mode-for-tests","hide-attribution","disable-image-tests"],{shadow:!0});const G0=Xi.version,z0=8;function Z0(e,t=16){const i=new Set;for(let n=0;n<Math.min(e.length,1e4);n+=4)if(i.add(e[n]<<16|e[n+1]<<8|e[n+2]),i.size>t)return!0;return!1}function q0(e,t=z0){const i=[];if(e<t)throw new Error("SmartCameraWeb: Minimum required no of frames is ",t);const n=t-1,r=Math.floor(e/n);let s=1;for(let a=0;a<e;a+=r)i.length<8?i.push(a):(i[s]=a,i.sort((c,l)=>c-l),s+=1);const o=e-1;return i.length<8&&!i.includes(o)&&i.push(o),i}function W0(){return`
3289
+ `})]})};customElements.get("smartselfie-capture")||t1(ta,"smartselfie-capture",["interval","duration","theme-color","show-navigation","allow-agent-mode","show-agent-mode-for-tests","hide-attribution","disable-image-tests"],{shadow:!0});const Z0=Xi.version,q0=8;function W0(e,t=16){const i=new Set;for(let n=0;n<Math.min(e.length,1e4);n+=4)if(i.add(e[n]<<16|e[n+1]<<8|e[n+2]),i.size>t)return!0;return!1}function X0(e,t=q0){const i=[];if(e<t)throw new Error("SmartCameraWeb: Minimum required no of frames is ",t);const n=t-1,r=Math.floor(e/n);let s=1;for(let a=0;a<e;a+=r)i.length<8?i.push(a):(i[s]=a,i.sort((c,l)=>c-l),s+=1);const o=e-1;return i.length<8&&!i.includes(o)&&i.push(o),i}function Y0(){return`
3312
3290
  ${st(this.themeColor)}
3313
3291
  <style>
3314
3292
  :host {
@@ -3802,22 +3780,19 @@ ${this.hideAttribution?"":`
3802
3780
  ${this.hideAttribution?"":"<powered-by-smile-id></powered-by-smile-id>"}
3803
3781
  </div>
3804
3782
  </div>
3805
- `}function U2(i){return M(this,arguments,function*(e,t={facingMode:"user"}){try{const n=yield F.getMedia({audio:!1,video:t}),s=(yield navigator.mediaDevices.enumerateDevices()).find(a=>a.kind==="videoinput"&&n.getVideoTracks()[0].getSettings().deviceId===a.deviceId),o=document.querySelector("smart-camera-web");o==null||o.dispatchEvent(new CustomEvent("metadata.camera-name",{detail:{cameraName:s==null?void 0:s.label}})),e==null||e.removeAttribute("data-camera-error"),e==null||e.setAttribute("data-camera-ready",!0)}catch(n){e==null||e.removeAttribute("data-camera-ready"),e==null||e.setAttribute("data-camera-error",F.handleCameraError(n))}})}class X0 extends HTMLElement{constructor(){super(),this.templateString=W0.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.facingMode="user",this.allowAgentMode&&(this.facingMode="environment")}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.videoContainer=this.shadowRoot.querySelector(".video-container > .video"),this.init()}init(){this._videoStreamDurationInMS=7800,this._imageCaptureIntervalInMS=200,this._data={images:[],meta:{libraryVersion:G0}},this._rawImages=[],this.setUpEventListeners()}reset(){this.disconnectedCallback(),this.connectedCallback()}_startImageCapture(){this.startImageCapture.disabled=!0,this.switchCamera&&(this.switchCamera.disabled=!0);const t=document.querySelector("smart-camera-web");t==null||t.dispatchEvent(new CustomEvent("metadata.selfie-capture-start")),t==null||t.dispatchEvent(new CustomEvent("metadata.selfie-origin",{detail:{imageOrigin:{environment:"back_camera",user:"front_camera"}[this.inAgentMode?"environment":"user"]}}));const i=this.imageOutline.getTotalLength();this.imageOutline.style.transition="none",this.imageOutline.style.strokeDasharray=`${i} ${i}`,this.imageOutline.style.strokeDashoffset=i,this.imageOutline.getBoundingClientRect(),this.imageOutline.style.transition=`stroke-dashoffset ${this._videoStreamDurationInMS/1e3}s ease-in-out`,this.imageOutline.style.strokeDashoffset="0",setTimeout(()=>{this.smileCTABox.style.opacity=1,this.mouthAnim.beginElement()},1500),setTimeout(()=>{this.smileCTABox.style.opacity=0},3500),setTimeout(()=>{this.smileCTABox.style.opacity=1,this.smileCTA.textContent="WIDER SMILE",this.mouth.setAttribute("d","m 213.88314,319.4551 c -1.58,0.97 -0.35309,9.33393 1.50671,9.30586 6.05679,-0.0914 16.11631,0.17227 34.57066,0.13346 18.45435,-0.0388 28.15778,-0.0418 31.09964,-0.79956 1.80122,-0.46394 2.75061,-7.48365 1.16061,-8.45365 -1.6,-1.74874 -2.96432,-0.94348 -6.77747,-1.56441 -12.83012,0.04 -36.52534,0.50197 -41.29469,0.43262 -2.51525,-0.0713 -18.41588,-0.61 -20.01588,0.35 z m 57.29363,1.36599 c -9.24417,-2.23757 -8.08363,-2.42362 -20.78363,-2.42362 -12.7,0 -17.77931,2.69528 -26.84042,5.36549 12.57883,3.28731 33.57775,-4.29887 49.70067,2.24964 z"),this.mouthAnim.beginElement()},4e3),this._imageCaptureInterval=setInterval(()=>{this._capturePOLPhoto()},this._imageCaptureIntervalInMS),this._videoStreamTimeout=setTimeout(()=>{this._stopVideoStream()},this._videoStreamDurationInMS)}_switchCamera(){return M(this,null,function*(){this.facingMode=this.facingMode==="user"?"environment":"user",this.facingMode==="user"?this.shadowRoot.querySelector("video").classList.remove("agent-mode"):this.shadowRoot.querySelector("video").classList.add("agent-mode"),this.startImageCapture.disabled=!0,this.switchCamera.disabled=!0,F.stopMedia(),yield U2(this,{facingMode:this.facingMode}),this.handleStream(F.stream)})}_stopVideoStream(){try{clearTimeout(this._videoStreamTimeout),clearInterval(this._imageCaptureInterval),clearInterval(this._drawingInterval),this._capturePOLPhoto(),this._captureReferencePhoto(),F.stopMedia();const t=this._rawImages.length;this._data.referenceImage=this._referenceImage,this._data.previewImage=this._referenceImage;const i=q0(t);this._data.images=this._data.images.concat(i.map(n=>({image:this._rawImages[n].split(",")[1],image_type_id:di.LIVENESS_IMAGE_BASE64}))),this._publishImages()}catch(t){console.error(t)}}_capturePOLPhoto(){const t=document.createElement("canvas");this._video.videoHeight>this._video.videoWidth?(t.width=240,t.height=Math.max(320,t.width*this._video.videoHeight/this._video.videoWidth)):(t.height=240,t.width=Math.max(320,t.height*this._video.videoWidth/this._video.videoHeight)),this._drawImage(t,!1),this._rawImages.push(t.toDataURL("image/jpeg"))}_captureReferencePhoto(){const t=document.createElement("canvas");this._video.videoHeight>this._video.videoWidth?(t.width=480,t.height=Math.max(640,t.width*this._video.videoHeight/this._video.videoWidth)):(t.height=480,t.width=Math.max(640,t.height*this._video.videoWidth/this._video.videoHeight)),this._drawImage(t,!this.disableImageTests);const n=t.toDataURL("image/jpeg");this._referenceImage=n,this._data.images.push({image:n.split(",")[1],image_type_id:di.SELFIE_IMAGE_BASE64})}_publishImages(){const t=qi(Fe({},this._data),{facingMode:this.facingMode});this.dispatchEvent(new CustomEvent("selfie-capture.publish",{detail:t}))}resetErrorMessage(){this.errorMessage.textContent=""}_drawImage(t,i=!0,n=this._video){const r=t.getContext("2d");if(r.drawImage(n,0,0,n.videoWidth,n.videoHeight,0,0,t.width,t.height),i){const s=r.getImageData(0,0,t.width,t.height);if(Z0(s.data))return r;throw new Error("Unable to capture webcam images - Please try another device")}else return r}handleStream(t){try{const i=this.shadowRoot.querySelector(".video");if(!i)return;const n=this.shadowRoot.querySelector("video");let r=null;n?r=this.shadowRoot.querySelector("video"):r=document.createElement("video"),r.autoplay=!0,r.playsInline=!0,r.muted=!0,"srcObject"in r?r.srcObject=t:r.src=window.URL.createObjectURL(t),r.onloadedmetadata=()=>{r.play()},this._video=r,this._data.permissionGranted=!0,n||i.prepend(r)}catch(i){this.setAttribute("data-camera-error",F.handleCameraError(i)),i.name!=="AbortError"&&console.error(i),F.stopMedia()}}setUpEventListeners(){var t;this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.startImageCapture=this.shadowRoot.querySelector("#start-image-capture"),this.switchCamera=this.shadowRoot.querySelector("#switch-camera"),this.imageOutline=this.shadowRoot.querySelector("#image-outline path"),this.smileCTABox=this.shadowRoot.querySelector("#smile-cta-box"),this.smileCTA=this.shadowRoot.querySelector("#smile-cta"),this.mouth=this.shadowRoot.querySelector("#mouth"),this.mouthAnim=this.shadowRoot.querySelector("#mouthAnim"),this.startImageCapture.addEventListener("click",()=>{this._startImageCapture()}),(t=this.switchCamera)==null||t.addEventListener("click",()=>{this._switchCamera()}),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.closeWindow()}),F.stream?this.handleStream(F.stream):(this.hasAttribute("data-camera-ready")||!this.hasAttribute("data-camera-error"))&&U2(this,{facingMode:this.facingMode}),this.setupAgentMode()}disconnectedCallback(){F.stopMedia(),clearTimeout(this._videoStreamTimeout)}get hideBack(){return this.hasAttribute("hide-back")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}setupAgentMode(){return M(this,null,function*(){var i,n,r,s;if(!this.allowAgentMode)return;(yield F.supportsAgentMode())||this.hasAttribute("show-agent-mode-for-tests")?(this.switchCamera.hidden=!1,this.facingMode==="user"?(n=(i=this.shadowRoot.querySelector("video"))==null?void 0:i.classList)==null||n.remove("agent-mode"):(s=(r=this.shadowRoot.querySelector("video"))==null?void 0:r.classList)==null||s.add("agent-mode")):this.switchCamera.hidden=!0})}get hasAgentSupport(){return this.hasAttribute("has-agent-support")}get title(){return this.getAttribute("title")||"Submit Front of ID"}get hidden(){return this.getAttribute("hidden")}get cameraError(){return this.getAttribute("data-camera-error")}get disableImageTests(){return this.hasAttribute("disable-image-tests")}get allowAgentMode(){return this.getAttribute("allow-agent-mode")==="true"}get inAgentMode(){return this.facingMode==="environment"}static get observedAttributes(){return["allow-agent-mode","data-camera-error","data-camera-ready","disable-image-tests","hidden","hide-back-to-host","show-navigation","title"]}attributeChangedCallback(t){switch(t){case"data-camera-error":case"hidden":case"title":this.shadowRoot.innerHTML=this.render(),this.init();break;case"allow-agent-mode":this.shadowRoot.innerHTML.trim()?this.setupAgentMode():(this.shadowRoot.innerHTML=this.render(),this.init());break;case"show-navigation":if(this.shadowRoot.innerHTML.trim()){const i=this.shadowRoot.querySelector("smileid-navigation");i&&(this.showNavigation?i.setAttribute("show-navigation",""):i.removeAttribute("show-navigation"))}else this.shadowRoot.innerHTML=this.render(),this.init();break;case"data-camera-ready":this.hasAttribute("data-camera-ready")&&F.stream&&this.handleStream(F.stream);break}}handleBackEvents(){this.stopMedia(),this.dispatchEvent(new CustomEvent("selfie-capture.cancelled"))}closeWindow(){this.stopMedia(),this.dispatchEvent(new CustomEvent("selfie-capture.close"))}stopMedia(){this.removeAttribute("data-camera-ready"),F.stopMedia()}}"customElements"in window&&!customElements.get("selfie-capture")&&window.customElements.define("selfie-capture",X0);const Y0=r=>{var s=r,{timeout:e=2e4,"start-countdown":t=!1,hidden:i=!1}=s,n=ua(s,["timeout","start-countdown","hidden"]);const a=(()=>{try{return!!window.parent.Cypress||window.parent.navigator.userAgent.includes("Electron")&&window.parent.__Cypress}catch(E){return!1}})()||!!window.Cypress||window.navigator.userAgent.includes("Electron")&&window.__Cypress,c=fi(i),l=fi(t),[d,h]=Kt(!1),[u,p]=Kt(a?100:0),[f,m]=Kt(!1),[v,g]=Kt(!1),[b,_]=Kt(!1);if(ot(()=>{if(d||v||a)return;M(null,null,function*(){g(!0);try{yield H2(),h(!0)}catch(L){console.error("Failed to load Mediapipe:",L)}g(!1)})},[d,v]),ot(()=>{if(c||!l||d)return;const E=setInterval(()=>{p(L=>Math.min(L+1,100))},e/100);return()=>{clearInterval(E)}},[c,l,e,d]),ot(()=>{if(c||d||u<100)return;const L=setTimeout(()=>{const w=document.querySelector("selfie-capture");if(w&&!w.hasAttribute("data-backup-events-setup")){w.setAttribute("data-backup-events-setup","true");const T=I=>{const O=I;window.dispatchEvent(new CustomEvent(O.type,{detail:O.detail,bubbles:!0}))};return w.addEventListener("selfie-capture.publish",T),w.addEventListener("selfie-capture.cancelled",T),w.addEventListener("selfie-capture.close",T),()=>{w.removeEventListener("selfie-capture.publish",T),w.removeEventListener("selfie-capture.cancelled",T),w.removeEventListener("selfie-capture.close",T)}}},200);return()=>{clearTimeout(L)}},[c,d,u]),ot(()=>{if(c||v)return;const E=document.querySelector("smart-camera-web");E==null||E.dispatchEvent(new CustomEvent("metadata.active-liveness-version",{detail:{version:b?"0.0.1":"1.0.0"}}))},[b,c,v]),c)return null;if(f&&d&&!b)return D(ta,Fe({},n));if(!f&&d&&!b)return D(ta,Fe({},n));if(u>=100){b||_(!0);const E=Fe({},n);return delete E.hidden,D("selfie-capture",qi(Fe({},E),{ref:L=>{if(L&&!L.hasAttribute("data-events-setup")){L.setAttribute("data-events-setup","true");const w=T=>{const I=T;(I.type==="selfie-capture.publish"||I.type==="selfie-capture.cancelled"||I.type==="selfie-capture.close")&&m(!0),window.dispatchEvent(new CustomEvent(I.type,{detail:I.detail,bubbles:!0}))};L.addEventListener("selfie-capture.publish",w),L.addEventListener("selfie-capture.cancelled",w),L.addEventListener("selfie-capture.close",w)}}}))}return D("div",{style:{textAlign:"center",marginTop:"20%"},children:[D("div",{style:{marginBottom:"16px",display:"flex",justifyContent:"center"},children:D(Bh,{size:48,style:{animation:"spin 1s linear infinite"}})}),D("p",{children:["Loading... ",u,"%"]}),D("style",{children:`
3783
+ `}function U2(i){return L(this,arguments,function*(e,t={facingMode:"user"}){try{const n=yield F.getMedia({audio:!1,video:t}),s=(yield navigator.mediaDevices.enumerateDevices()).find(a=>a.kind==="videoinput"&&n.getVideoTracks()[0].getSettings().deviceId===a.deviceId),o=document.querySelector("smart-camera-web");o==null||o.dispatchEvent(new CustomEvent("metadata.camera-name",{detail:{cameraName:s==null?void 0:s.label}})),e==null||e.removeAttribute("data-camera-error"),e==null||e.setAttribute("data-camera-ready",!0)}catch(n){e==null||e.removeAttribute("data-camera-ready"),e==null||e.setAttribute("data-camera-error",F.handleCameraError(n))}})}class K0 extends HTMLElement{constructor(){super(),this.templateString=Y0.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.facingMode="user",this.allowAgentMode&&(this.facingMode="environment")}connectedCallback(){const t=document.createElement("template");t.innerHTML=this.render(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.videoContainer=this.shadowRoot.querySelector(".video-container > .video"),this.init()}init(){this._videoStreamDurationInMS=7800,this._imageCaptureIntervalInMS=200,this._data={images:[],meta:{libraryVersion:Z0}},this._rawImages=[],this.setUpEventListeners()}reset(){this.disconnectedCallback(),this.connectedCallback()}_startImageCapture(){this.startImageCapture.disabled=!0,this.switchCamera&&(this.switchCamera.disabled=!0);const t=document.querySelector("smart-camera-web");t==null||t.dispatchEvent(new CustomEvent("metadata.selfie-capture-start")),t==null||t.dispatchEvent(new CustomEvent("metadata.selfie-origin",{detail:{imageOrigin:{environment:"back_camera",user:"front_camera"}[this.inAgentMode?"environment":"user"]}}));const i=this.imageOutline.getTotalLength();this.imageOutline.style.transition="none",this.imageOutline.style.strokeDasharray=`${i} ${i}`,this.imageOutline.style.strokeDashoffset=i,this.imageOutline.getBoundingClientRect(),this.imageOutline.style.transition=`stroke-dashoffset ${this._videoStreamDurationInMS/1e3}s ease-in-out`,this.imageOutline.style.strokeDashoffset="0",setTimeout(()=>{this.smileCTABox.style.opacity=1,this.mouthAnim.beginElement()},1500),setTimeout(()=>{this.smileCTABox.style.opacity=0},3500),setTimeout(()=>{this.smileCTABox.style.opacity=1,this.smileCTA.textContent="WIDER SMILE",this.mouth.setAttribute("d","m 213.88314,319.4551 c -1.58,0.97 -0.35309,9.33393 1.50671,9.30586 6.05679,-0.0914 16.11631,0.17227 34.57066,0.13346 18.45435,-0.0388 28.15778,-0.0418 31.09964,-0.79956 1.80122,-0.46394 2.75061,-7.48365 1.16061,-8.45365 -1.6,-1.74874 -2.96432,-0.94348 -6.77747,-1.56441 -12.83012,0.04 -36.52534,0.50197 -41.29469,0.43262 -2.51525,-0.0713 -18.41588,-0.61 -20.01588,0.35 z m 57.29363,1.36599 c -9.24417,-2.23757 -8.08363,-2.42362 -20.78363,-2.42362 -12.7,0 -17.77931,2.69528 -26.84042,5.36549 12.57883,3.28731 33.57775,-4.29887 49.70067,2.24964 z"),this.mouthAnim.beginElement()},4e3),this._imageCaptureInterval=setInterval(()=>{this._capturePOLPhoto()},this._imageCaptureIntervalInMS),this._videoStreamTimeout=setTimeout(()=>{this._stopVideoStream()},this._videoStreamDurationInMS)}_switchCamera(){return L(this,null,function*(){this.facingMode=this.facingMode==="user"?"environment":"user",this.facingMode==="user"?this.shadowRoot.querySelector("video").classList.remove("agent-mode"):this.shadowRoot.querySelector("video").classList.add("agent-mode"),this.startImageCapture.disabled=!0,this.switchCamera.disabled=!0,F.stopMedia(),yield U2(this,{facingMode:this.facingMode}),this.handleStream(F.stream)})}_stopVideoStream(){try{clearTimeout(this._videoStreamTimeout),clearInterval(this._imageCaptureInterval),clearInterval(this._drawingInterval),this._capturePOLPhoto(),this._captureReferencePhoto(),F.stopMedia();const t=this._rawImages.length;this._data.referenceImage=this._referenceImage,this._data.previewImage=this._referenceImage;const i=X0(t);this._data.images=this._data.images.concat(i.map(n=>({image:this._rawImages[n].split(",")[1],image_type_id:di.LIVENESS_IMAGE_BASE64}))),this._publishImages()}catch(t){console.error(t)}}_capturePOLPhoto(){const t=document.createElement("canvas");this._video.videoHeight>this._video.videoWidth?(t.width=240,t.height=Math.max(320,t.width*this._video.videoHeight/this._video.videoWidth)):(t.height=240,t.width=Math.max(320,t.height*this._video.videoWidth/this._video.videoHeight)),this._drawImage(t,!1),this._rawImages.push(t.toDataURL("image/jpeg"))}_captureReferencePhoto(){const t=document.createElement("canvas");this._video.videoHeight>this._video.videoWidth?(t.width=480,t.height=Math.max(640,t.width*this._video.videoHeight/this._video.videoWidth)):(t.height=480,t.width=Math.max(640,t.height*this._video.videoWidth/this._video.videoHeight)),this._drawImage(t,!this.disableImageTests);const n=t.toDataURL("image/jpeg");this._referenceImage=n,this._data.images.push({image:n.split(",")[1],image_type_id:di.SELFIE_IMAGE_BASE64})}_publishImages(){const t=qi(Fe({},this._data),{facingMode:this.facingMode});this.dispatchEvent(new CustomEvent("selfie-capture.publish",{detail:t}))}resetErrorMessage(){this.errorMessage.textContent=""}_drawImage(t,i=!0,n=this._video){const r=t.getContext("2d");if(r.drawImage(n,0,0,n.videoWidth,n.videoHeight,0,0,t.width,t.height),i){const s=r.getImageData(0,0,t.width,t.height);if(W0(s.data))return r;throw new Error("Unable to capture webcam images - Please try another device")}else return r}handleStream(t){try{const i=this.shadowRoot.querySelector(".video");if(!i)return;const n=this.shadowRoot.querySelector("video");let r=null;n?r=this.shadowRoot.querySelector("video"):r=document.createElement("video"),r.autoplay=!0,r.playsInline=!0,r.muted=!0,"srcObject"in r?r.srcObject=t:r.src=window.URL.createObjectURL(t),r.onloadedmetadata=()=>{r.play()},this._video=r,this._data.permissionGranted=!0,n||i.prepend(r)}catch(i){this.setAttribute("data-camera-error",F.handleCameraError(i)),i.name!=="AbortError"&&console.error(i),F.stopMedia()}}setUpEventListeners(){var t;this.navigation=this.shadowRoot.querySelector("smileid-navigation"),this.startImageCapture=this.shadowRoot.querySelector("#start-image-capture"),this.switchCamera=this.shadowRoot.querySelector("#switch-camera"),this.imageOutline=this.shadowRoot.querySelector("#image-outline path"),this.smileCTABox=this.shadowRoot.querySelector("#smile-cta-box"),this.smileCTA=this.shadowRoot.querySelector("#smile-cta"),this.mouth=this.shadowRoot.querySelector("#mouth"),this.mouthAnim=this.shadowRoot.querySelector("#mouthAnim"),this.startImageCapture.addEventListener("click",()=>{this._startImageCapture()}),(t=this.switchCamera)==null||t.addEventListener("click",()=>{this._switchCamera()}),this.navigation.addEventListener("navigation.back",()=>{this.handleBackEvents()}),this.navigation.addEventListener("navigation.close",()=>{this.closeWindow()}),F.stream?this.handleStream(F.stream):(this.hasAttribute("data-camera-ready")||!this.hasAttribute("data-camera-error"))&&U2(this,{facingMode:this.facingMode}),this.setupAgentMode()}disconnectedCallback(){F.stopMedia(),clearTimeout(this._videoStreamTimeout)}get hideBack(){return this.hasAttribute("hide-back")}get showNavigation(){return this.hasAttribute("show-navigation")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}get hideAttribution(){return this.hasAttribute("hide-attribution")}setupAgentMode(){return L(this,null,function*(){var i,n,r,s;if(!this.allowAgentMode)return;(yield F.supportsAgentMode())||this.hasAttribute("show-agent-mode-for-tests")?(this.switchCamera.hidden=!1,this.facingMode==="user"?(n=(i=this.shadowRoot.querySelector("video"))==null?void 0:i.classList)==null||n.remove("agent-mode"):(s=(r=this.shadowRoot.querySelector("video"))==null?void 0:r.classList)==null||s.add("agent-mode")):this.switchCamera.hidden=!0})}get hasAgentSupport(){return this.hasAttribute("has-agent-support")}get title(){return this.getAttribute("title")||"Submit Front of ID"}get hidden(){return this.getAttribute("hidden")}get cameraError(){return this.getAttribute("data-camera-error")}get disableImageTests(){return this.hasAttribute("disable-image-tests")}get allowAgentMode(){return this.getAttribute("allow-agent-mode")==="true"}get inAgentMode(){return this.facingMode==="environment"}static get observedAttributes(){return["allow-agent-mode","data-camera-error","data-camera-ready","disable-image-tests","hidden","hide-back-to-host","show-navigation","title"]}attributeChangedCallback(t){switch(t){case"data-camera-error":case"hidden":case"title":this.shadowRoot.innerHTML=this.render(),this.init();break;case"allow-agent-mode":this.shadowRoot.innerHTML.trim()?this.setupAgentMode():(this.shadowRoot.innerHTML=this.render(),this.init());break;case"show-navigation":if(this.shadowRoot.innerHTML.trim()){const i=this.shadowRoot.querySelector("smileid-navigation");i&&(this.showNavigation?i.setAttribute("show-navigation",""):i.removeAttribute("show-navigation"))}else this.shadowRoot.innerHTML=this.render(),this.init();break;case"data-camera-ready":this.hasAttribute("data-camera-ready")&&F.stream&&this.handleStream(F.stream);break}}handleBackEvents(){this.stopMedia(),this.dispatchEvent(new CustomEvent("selfie-capture.cancelled"))}closeWindow(){this.stopMedia(),this.dispatchEvent(new CustomEvent("selfie-capture.close"))}stopMedia(){this.removeAttribute("data-camera-ready"),F.stopMedia()}}"customElements"in window&&!customElements.get("selfie-capture")&&window.customElements.define("selfie-capture",K0);const J0=r=>{var s=r,{timeout:e=2e4,"start-countdown":t=!1,hidden:i=!1}=s,n=ua(s,["timeout","start-countdown","hidden"]);const a=(()=>{try{return!!window.parent.Cypress||window.parent.navigator.userAgent.includes("Electron")&&window.parent.__Cypress}catch(E){return!1}})()||!!window.Cypress||window.navigator.userAgent.includes("Electron")&&window.__Cypress,c=fi(i),l=fi(t),[d,h]=Kt(!1),[u,p]=Kt(a?100:0),[f,m]=Kt(!1),[v,g]=Kt(!1),[b,_]=Kt(!1);if(ot(()=>{if(d||v||a)return;L(this,null,function*(){g(!0);try{yield H2(),h(!0)}catch(M){console.error("Failed to load Mediapipe:",M)}g(!1)})},[d,v]),ot(()=>{if(c||!l||d)return;const E=setInterval(()=>{p(M=>Math.min(M+1,100))},e/100);return()=>{clearInterval(E)}},[c,l,e,d]),ot(()=>{if(c||d||u<100)return;const M=setTimeout(()=>{const w=document.querySelector("selfie-capture");if(w&&!w.hasAttribute("data-backup-events-setup")){w.setAttribute("data-backup-events-setup","true");const T=I=>{const O=I;window.dispatchEvent(new CustomEvent(O.type,{detail:O.detail,bubbles:!0}))};return w.addEventListener("selfie-capture.publish",T),w.addEventListener("selfie-capture.cancelled",T),w.addEventListener("selfie-capture.close",T),()=>{w.removeEventListener("selfie-capture.publish",T),w.removeEventListener("selfie-capture.cancelled",T),w.removeEventListener("selfie-capture.close",T)}}},200);return()=>{clearTimeout(M)}},[c,d,u]),ot(()=>{if(c||v)return;const E=document.querySelector("smart-camera-web");E==null||E.dispatchEvent(new CustomEvent("metadata.active-liveness-version",{detail:{version:b?"0.0.1":"1.0.0"}}))},[b,c,v]),c)return null;if(f&&d&&!b)return D(ta,Fe({},n));if(!f&&d&&!b)return D(ta,Fe({},n));if(u>=100){b||_(!0);const E=Fe({},n);return delete E.hidden,D("selfie-capture",qi(Fe({},E),{ref:M=>{if(M&&!M.hasAttribute("data-events-setup")){M.setAttribute("data-events-setup","true");const w=T=>{const I=T;(I.type==="selfie-capture.publish"||I.type==="selfie-capture.cancelled"||I.type==="selfie-capture.close")&&m(!0),window.dispatchEvent(new CustomEvent(I.type,{detail:I.detail,bubbles:!0}))};M.addEventListener("selfie-capture.publish",w),M.addEventListener("selfie-capture.cancelled",w),M.addEventListener("selfie-capture.close",w)}}}))}return D("div",{style:{textAlign:"center",marginTop:"20%"},children:[D("div",{style:{marginBottom:"16px",display:"flex",justifyContent:"center"},children:D(Bh,{size:48,style:{animation:"spin 1s linear infinite"}})}),D("p",{children:["Loading... ",u,"%"]}),D("style",{children:`
3806
3784
  @keyframes spin {
3807
3785
  from { transform: rotate(0deg); }
3808
3786
  to { transform: rotate(360deg); }
3809
3787
  }
3810
- `})]})};customElements.get("selfie-capture-wrapper")||t1(Y0,"selfie-capture-wrapper",["timeout","interval","duration","theme-color","show-navigation","allow-agent-mode","show-agent-mode-for-tests","hide-attribution","disable-image-tests","key","start-countdown","hidden"],{shadow:!0});const K0=Xi.version,nt=document.querySelector("smart-camera-web"),J0=(e,t=0,i=0,n=.9)=>new Promise((r,s)=>{if(!e||typeof e!="string"){s(new Error("Invalid data URI provided"));return}if(t<0||t>=99||i<0||i>=99){s(new Error("Crop percentages must be between 0 and 99"));return}const o=new Image;o.onload=()=>{try{const a=document.createElement("canvas"),c=a.getContext("2d"),l=o.width,d=o.height,h=l*t/100,u=d*i/100,p=l-h*2,f=d-u*2;a.width=p,a.height=f,c.drawImage(o,h,u,p,f,0,0,p,f);const m=a.toDataURL("image/jpeg",n);r(m)}catch(a){s(new Error(`Failed to process image: ${a.message}`))}},o.onerror=()=>{s(new Error("Failed to load image from data URI"))},o.src=e});class V2 extends HTMLElement{constructor(){super(),this.activeScreen=null,this._remountKey=0,nt==null||nt.dispatchEvent(new CustomEvent("metadata.initialize"))}connectedCallback(){this.innerHTML=`
3788
+ `})]})};customElements.get("selfie-capture-wrapper")||t1(J0,"selfie-capture-wrapper",["timeout","interval","duration","theme-color","show-navigation","allow-agent-mode","show-agent-mode-for-tests","hide-attribution","disable-image-tests","key","start-countdown","hidden"],{shadow:!0});const Q0=Xi.version,nt=document.querySelector("smart-camera-web"),eu=(e,t=0,i=0,n=.9)=>new Promise((r,s)=>{if(!e||typeof e!="string"){s(new Error("Invalid data URI provided"));return}if(t<0||t>=99||i<0||i>=99){s(new Error("Crop percentages must be between 0 and 99"));return}const o=new Image;o.onload=()=>{try{const a=document.createElement("canvas"),c=a.getContext("2d"),l=o.width,d=o.height,h=l*t/100,u=d*i/100,p=l-h*2,f=d-u*2;a.width=p,a.height=f,c.drawImage(o,h,u,p,f,0,0,p,f);const m=a.toDataURL("image/jpeg",n);r(m)}catch(a){s(new Error(`Failed to process image: ${a.message}`))}},o.onerror=()=>{s(new Error("Failed to load image from data URI"))},o.src=e});class V2 extends HTMLElement{constructor(){super(),this.activeScreen=null,this._remountKey=0,nt==null||nt.dispatchEvent(new CustomEvent("metadata.initialize"))}connectedCallback(){this.innerHTML=`
3811
3789
  ${st(this.themeColor)}
3812
3790
  <div style="height: 100%;">
3813
3791
  <selfie-capture-instructions theme-color='${this.themeColor}' ${this.showNavigation} ${this.hideAttribution} ${this.hideBack} hidden></selfie-capture-instructions>
3814
3792
  <selfie-capture-wrapper theme-color='${this.themeColor}' ${this.showNavigation} ${this.allowAgentMode} ${this.allowAgentModeTests} ${this.hideAttribution} ${this.disableImageTests} key="${this._remountKey}" start-countdown="false" hidden></selfie-capture-wrapper>
3815
3793
  <selfie-capture-review theme-color='${this.themeColor}' ${this.showNavigation} ${this.hideAttribution} hidden></selfie-capture-review>
3816
3794
  </div>
3817
- `,this._data={images:[],meta:{libraryVersion:K0}},this.selfieInstruction=this.querySelector("selfie-capture-instructions"),this.selfieCapture=this.querySelector("selfie-capture-wrapper"),this.selfieReview=this.querySelector("selfie-capture-review"),this.getAttribute("initial-screen")==="selfie-capture"||this.hideInstructions?this.setActiveScreen(this.selfieCapture):this.setActiveScreen(this.selfieInstruction),this.setUpEventListeners()}getAgentMode(){return this.inAgentMode?"environment":"user"}disconnectedCallback(){F.stopMedia(),nt==null||nt.dispatchEvent(new CustomEvent("metadata.cleanup")),this._selfieWrapperListeners&&(this._selfieWrapperListeners.forEach(({event:t,handler:i})=>{window.removeEventListener(t,i)}),this._selfieWrapperListeners=null),this.activeScreen&&this.activeScreen.removeAttribute("hidden"),this.activeScreen=null,this.innerHTML=""}setUpEventListeners(){this.selfieInstruction.addEventListener("selfie-capture-instructions.capture",()=>M(this,null,function*(){this.setActiveScreen(this.selfieCapture)})),this.selfieInstruction.addEventListener("selfie-capture-instructions.cancelled",()=>{this.handleBackEvents()}),this.setupSelfieWrapperEventListeners(),this.selfieReview.addEventListener("selfie-capture-review.rejected",()=>M(this,null,function*(){nt==null||nt.dispatchEvent(new CustomEvent("metadata.selfie-capture-retry")),this.selfieReview.removeAttribute("data-image"),this.selfieReview.removeAttribute("mirror-image"),this._data.images=[],yield this.forceWrapperRemount(),this.setActiveScreen(this.selfieCapture)})),this.selfieReview.addEventListener("selfie-capture-review.accepted",()=>M(this,null,function*(){this._publishSelectedImages()})),[this.selfieInstruction,this.selfieCapture,this.selfieReview].forEach(t=>{t.addEventListener(`${t.nodeName.toLowerCase()}.close`,()=>{this.handleCloseEvent()})})}forceWrapperRemount(){return M(this,null,function*(){F.stopMedia(),this._remountKey++;const t=this.querySelector("div"),i=this.selfieCapture;if(i&&t){const n=document.createElement("selfie-capture-wrapper");Array.from(i.attributes).forEach(o=>{n.setAttribute(o.name,o.value)}),i.remove(),yield new Promise(o=>{setTimeout(o,50)}),n.setAttribute("key",this._remountKey.toString()),n.setAttribute("start-countdown","false"),n.setAttribute("hidden","");const s=t.querySelector("selfie-capture-review");s?t.insertBefore(n,s):t.appendChild(n),this.selfieCapture=n,this.setupSelfieWrapperEventListeners()}return new Promise(n=>{setTimeout(()=>{n()},200)})})}setActiveScreen(t){var i;this.activeScreen!==t&&((i=this.activeScreen)==null||i.setAttribute("hidden",""),t.removeAttribute("hidden"),this.activeScreen=t,t===this.selfieCapture?t.setAttribute("start-countdown","true"):this.selfieCapture&&this.selfieCapture.setAttribute("start-countdown","false"))}setupSelfieWrapperEventListeners(){this._selfieWrapperListeners&&this._selfieWrapperListeners.forEach(({event:r,handler:s})=>{window.removeEventListener(r,s)});const t=()=>M(this,null,function*(){if(F.stopMedia(),yield this.forceWrapperRemount(),this.hideInstructions){this.handleBackEvents();return}this.setActiveScreen(this.selfieInstruction)}),i=()=>M(this,null,function*(){F.stopMedia(),yield this.forceWrapperRemount(),this.handleCloseEvent()}),n=r=>M(this,null,function*(){nt==null||nt.dispatchEvent(new CustomEvent("metadata.selfie-capture-end")),this.selfieReview.setAttribute("data-image",yield J0(r.detail.referenceImage,20,20));const s=r.detail.facingMode==="user";this.selfieReview.setAttribute("mirror-image",s?"true":"false"),this._data.images=r.detail.images,F.stopMedia(),this.setActiveScreen(this.selfieReview)});this._selfieWrapperListeners=[{event:"selfie-capture.cancelled",handler:t},{event:"selfie-capture.close",handler:i},{event:"selfie-capture.publish",handler:n}],this._selfieWrapperListeners.forEach(({event:r,handler:s})=>{window.addEventListener(r,s)}),this.addEventListener("selfie-capture.publish",n)}_publishSelectedImages(){this.dispatchEvent(new CustomEvent("selfie-capture-screens.publish",{detail:this._data}))}get hideInstructions(){return this.hasAttribute("hide-instructions")}get hideAttribution(){return this.hasAttribute("hide-attribution")?'hide-attribution=""':""}get hideBackOfId(){return this.hasAttribute("hide-back-of-id")}get showNavigation(){return this.hasAttribute("show-navigation")?'show-navigation=""':""}get inAgentMode(){return this.getAttribute("allow-agent-mode")==="true"}get allowAgentMode(){return this.inAgentMode?'allow-agent-mode="true"':""}get allowAgentModeTests(){return this.hasAttribute("show-agent-mode-for-tests")?'show-agent-mode-for-tests=""':""}get hideBack(){return this.hasAttribute("hide-back-to-host")||this.hasAttribute("hide-back")?'hide-back=""':""}get disableImageTests(){return this.hasAttribute("disable-image-tests")?'disable-image-tests=""':""}get themeColor(){return this.getAttribute("theme-color")||"#001096"}handleBackEvents(){this.dispatchEvent(new CustomEvent("selfie-capture-screens.cancelled"))}handleCloseEvent(){this.dispatchEvent(new CustomEvent("selfie-capture-screens.close"))}static get observedAttributes(){return["title","hidden","show-navigation","hide-back-to-host","initial-screen","allow-agent-mode","show-agent-mode-for-tests","disable-image-tests"]}attributeChangedCallback(t){switch(t){case"title":case"hidden":case"initial-screen":case"allow-agent-mode":case"show-agent-mode-for-tests":case"disable-image-tests":this.connectedCallback();break}}}"customElements"in window&&!customElements.get("selfie-capture-screens")&&customElements.define("selfie-capture-screens",V2);/*!
3818
- * Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
3819
- * (c) 2025 Szymon Nowak | Released under the MIT license
3820
- */class Br{constructor(t,i,n,r){if(isNaN(t)||isNaN(i))throw new Error(`Point is invalid: (${t}, ${i})`);this.x=+t,this.y=+i,this.pressure=n||0,this.time=r||Date.now()}distanceTo(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))}equals(t){return this.x===t.x&&this.y===t.y&&this.pressure===t.pressure&&this.time===t.time}velocityFrom(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):0}}class ia{static fromPoints(t,i){const n=this.calculateControlPoints(t[0],t[1],t[2]).c2,r=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new ia(t[1],n,r,t[2],i.start,i.end)}static calculateControlPoints(t,i,n){const r=t.x-i.x,s=t.y-i.y,o=i.x-n.x,a=i.y-n.y,c={x:(t.x+i.x)/2,y:(t.y+i.y)/2},l={x:(i.x+n.x)/2,y:(i.y+n.y)/2},d=Math.sqrt(r*r+s*s),h=Math.sqrt(o*o+a*a),u=c.x-l.x,p=c.y-l.y,f=d+h==0?0:h/(d+h),m={x:l.x+u*f,y:l.y+p*f},v=i.x-m.x,g=i.y-m.y;return{c1:new Br(c.x+v,c.y+g),c2:new Br(l.x+v,l.y+g)}}constructor(t,i,n,r,s,o){this.startPoint=t,this.control2=i,this.control1=n,this.endPoint=r,this.startWidth=s,this.endWidth=o}length(){let i=0,n,r;for(let s=0;s<=10;s+=1){const o=s/10,a=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),c=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(s>0){const l=a-n,d=c-r;i+=Math.sqrt(l*l+d*d)}n=a,r=c}return i}point(t,i,n,r,s){return i*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*r*(1-t)*t*t+s*t*t*t}}class Q0{constructor(){try{this._et=new EventTarget}catch(t){this._et=document}}addEventListener(t,i,n){this._et.addEventListener(t,i,n)}dispatchEvent(t){return this._et.dispatchEvent(t)}removeEventListener(t,i,n){this._et.removeEventListener(t,i,n)}}function eu(e,t=250){let i=0,n=null,r,s,o;const a=()=>{i=Date.now(),n=null,r=e.apply(s,o),n||(s=null,o=[])};return function(...l){const d=Date.now(),h=t-(d-i);return s=this,o=l,h<=0||h>t?(n&&(clearTimeout(n),n=null),i=d,r=e.apply(s,o),n||(s=null,o=[])):n||(n=window.setTimeout(a,h)),r}}let tu=class pa extends Q0{constructor(t,i={}){var n,r,s;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this.velocityFilterWeight=i.velocityFilterWeight||.7,this.minWidth=i.minWidth||.5,this.maxWidth=i.maxWidth||2.5,this.throttle=(n=i.throttle)!==null&&n!==void 0?n:16,this.minDistance=(r=i.minDistance)!==null&&r!==void 0?r:5,this.dotSize=i.dotSize||0,this.penColor=i.penColor||"black",this.backgroundColor=i.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=i.compositeOperation||"source-over",this.canvasContextOptions=(s=i.canvasContextOptions)!==null&&s!==void 0?s:{},this._strokeMoveUpdate=this.throttle?eu(pa.prototype._strokeUpdate,this.throttle):pa.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:t,canvas:i}=this;t.fillStyle=this.backgroundColor,t.clearRect(0,0,i.width,i.height),t.fillRect(0,0,i.width,i.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._strokePointerId=void 0}fromDataURL(t,i={}){return new Promise((n,r)=>{const s=new Image,o=i.ratio||window.devicePixelRatio||1,a=i.width||this.canvas.width/o,c=i.height||this.canvas.height/o,l=i.xOffset||0,d=i.yOffset||0;this._reset(this._getPointGroupOptions()),s.onload=()=>{this._ctx.drawImage(s,l,d,a,c),n()},s.onerror=h=>{r(h)},s.crossOrigin="anonymous",s.src=t,this._isEmpty=!1})}toDataURL(t="image/png",i){switch(t){case"image/svg+xml":return typeof i!="object"&&(i=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(i))}`;default:return typeof i!="number"&&(i=void 0),this.canvas.toDataURL(t,i)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var t;const i=window.document===this.canvas.ownerDocument?window:(t=this.canvas.ownerDocument.defaultView)!==null&&t!==void 0?t:this.canvas.ownerDocument;return{addEventListener:i.addEventListener.bind(i),removeEventListener:i.removeEventListener.bind(i)}}_removeMoveUpEventListeners(){const{removeEventListener:t}=this._getListenerFunctions();t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp),t("mousemove",this._handleMouseMove),t("mouseup",this._handleMouseUp),t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(t,{clear:i=!0}={}){i&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}toData(){return this._data}_isLeftButtonPressed(t,i){return i?t.buttons===1:(t.buttons&1)===1}_pointerEventToSignatureEvent(t){return{event:t,type:t.type,x:t.clientX,y:t.clientY,pressure:"pressure"in t?t.pressure:0}}_touchEventToSignatureEvent(t){const i=t.changedTouches[0];return{event:t,type:t.type,x:i.clientX,y:i.clientY,pressure:i.force}}_handleMouseDown(t){!this._isLeftButtonPressed(t,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(t))}_handleMouseMove(t){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}_handleMouseUp(t){this._isLeftButtonPressed(t)||this._strokeEnd(this._pointerEventToSignatureEvent(t))}_handleTouchStart(t){t.targetTouches.length!==1||this._drawingStroke||(t.cancelable&&t.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(t)))}_handleTouchMove(t){if(t.targetTouches.length===1){if(t.cancelable&&t.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(t))}}_handleTouchEnd(t){t.targetTouches.length===0&&(t.cancelable&&t.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(t)))}_getPointerId(t){return t.persistentDeviceId||t.pointerId}_allowPointerId(t,i=!1){return typeof this._strokePointerId=="undefined"?i:this._getPointerId(t)===this._strokePointerId}_handlePointerDown(t){this._drawingStroke||!this._isLeftButtonPressed(t)||!this._allowPointerId(t,!0)||(this._strokePointerId=this._getPointerId(t),t.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(t)))}_handlePointerMove(t){if(this._allowPointerId(t)){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}t.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}}_handlePointerUp(t){this._isLeftButtonPressed(t)||!this._allowPointerId(t)||(t.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(t)))}_getPointGroupOptions(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}_strokeBegin(t){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0})))return;const{addEventListener:n}=this._getListenerFunctions();switch(t.event.type){case"mousedown":n("mousemove",this._handleMouseMove,{passive:!1}),n("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":n("touchmove",this._handleTouchMove,{passive:!1}),n("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":n("pointermove",this._handlePointerMove,{passive:!1}),n("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const r=this._getPointGroupOptions(),s=Object.assign(Object.assign({},r),{points:[]});this._data.push(s),this._reset(r),this._strokeUpdate(t)}_strokeUpdate(t){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(t);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));const i=this._createPoint(t.x,t.y,t.pressure),n=this._data[this._data.length-1],r=n.points,s=r.length>0&&r[r.length-1],o=s?i.distanceTo(s)<=this.minDistance:!1,a=this._getPointGroupOptions(n);if(!s||!(s&&o)){const c=this._addPoint(i,a);s?c&&this._drawCurve(c,a):this._drawDot(i,a),r.push({time:i.time,x:i.x,y:i.y,pressure:i.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}_strokeEnd(t,i=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(i&&this._strokeUpdate(t),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}_createPoint(t,i,n){const r=this.canvas.getBoundingClientRect();return new Br(t-r.left,i-r.top,n,new Date().getTime())}_addPoint(t,i){const{_lastPoints:n}=this;if(n.push(t),n.length>2){n.length===3&&n.unshift(n[0]);const r=this._calculateCurveWidths(n[1],n[2],i),s=ia.fromPoints(n,r);return n.shift(),s}return null}_calculateCurveWidths(t,i,n){const r=n.velocityFilterWeight*i.velocityFrom(t)+(1-n.velocityFilterWeight)*this._lastVelocity,s=this._strokeWidth(r,n),o={end:s,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=s,o}_strokeWidth(t,i){return Math.max(i.maxWidth/(t+1),i.minWidth)}_drawCurveSegment(t,i,n){const r=this._ctx;r.moveTo(t,i),r.arc(t,i,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,i){const n=this._ctx,r=t.endWidth-t.startWidth,s=Math.ceil(t.length())*2;n.beginPath(),n.fillStyle=i.penColor;for(let o=0;o<s;o+=1){const a=o/s,c=a*a,l=c*a,d=1-a,h=d*d,u=h*d;let p=u*t.startPoint.x;p+=3*h*a*t.control1.x,p+=3*d*c*t.control2.x,p+=l*t.endPoint.x;let f=u*t.startPoint.y;f+=3*h*a*t.control1.y,f+=3*d*c*t.control2.y,f+=l*t.endPoint.y;const m=Math.min(t.startWidth+l*r,i.maxWidth);this._drawCurveSegment(p,f,m)}n.closePath(),n.fill()}_drawDot(t,i){const n=this._ctx,r=i.dotSize>0?i.dotSize:(i.minWidth+i.maxWidth)/2;n.beginPath(),this._drawCurveSegment(t.x,t.y,r),n.closePath(),n.fillStyle=i.penColor,n.fill()}_fromData(t,i,n){for(const r of t){const{points:s}=r,o=this._getPointGroupOptions(r);if(s.length>1)for(let a=0;a<s.length;a+=1){const c=s[a],l=new Br(c.x,c.y,c.pressure,c.time);a===0&&this._reset(o);const d=this._addPoint(l,o);d&&i(d,o)}else this._reset(o),n(s[0],o)}}toSVG({includeBackgroundColor:t=!1}={}){const i=this._data,n=Math.max(window.devicePixelRatio||1,1),r=0,s=0,o=this.canvas.width/n,a=this.canvas.height/n,c=document.createElementNS("http://www.w3.org/2000/svg","svg");if(c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),c.setAttribute("viewBox",`${r} ${s} ${o} ${a}`),c.setAttribute("width",o.toString()),c.setAttribute("height",a.toString()),t&&this.backgroundColor){const l=document.createElement("rect");l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.setAttribute("fill",this.backgroundColor),c.appendChild(l)}return this._fromData(i,(l,{penColor:d})=>{const h=document.createElement("path");if(!isNaN(l.control1.x)&&!isNaN(l.control1.y)&&!isNaN(l.control2.x)&&!isNaN(l.control2.y)){const u=`M ${l.startPoint.x.toFixed(3)},${l.startPoint.y.toFixed(3)} C ${l.control1.x.toFixed(3)},${l.control1.y.toFixed(3)} ${l.control2.x.toFixed(3)},${l.control2.y.toFixed(3)} ${l.endPoint.x.toFixed(3)},${l.endPoint.y.toFixed(3)}`;h.setAttribute("d",u),h.setAttribute("stroke-width",(l.endWidth*2.25).toFixed(3)),h.setAttribute("stroke",d),h.setAttribute("fill","none"),h.setAttribute("stroke-linecap","round"),c.appendChild(h)}},(l,{penColor:d,dotSize:h,minWidth:u,maxWidth:p})=>{const f=document.createElement("circle"),m=h>0?h:(u+p)/2;f.setAttribute("r",m.toString()),f.setAttribute("cx",l.x.toString()),f.setAttribute("cy",l.y.toString()),f.setAttribute("fill",d),c.appendChild(f)}),c.outerHTML}};const Ft=class Ft{static getHumanSize(t){const i=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(t)/Math.log(1024)),i.length-1),r=t/da(1024,n);return n===0?`${t} bytes`:`${r.toFixed(0)} ${i[n]}`}static getData(t){return new Promise((i,n)=>{const r=new FileReader;r.onload=s=>{i(s.target.result)},r.onerror=()=>{n(new Error("An error occurred reading the file. Please check the file, and try again"))},r.readAsDataURL(t)})}static retrieve(t){return M(this,null,function*(){if(t.length>1)throw new Error("Only one file upload is permitted at a time");const i=t[0];if(!Ft.supportedTypes.includes(i.type))throw new Error("Unsupported file format. Please ensure that you are providing a JPG, PNG or SVG image");if(i.size>Ft.memoryLimit)throw new Error(`${i.name} is too large. Please ensure that the file is less than ${Ft.getHumanSize(Ft.memoryLimit)}.`);return yield Ft.getData(i)})}};li(Ft,"memoryLimit",2048e3),li(Ft,"supportedTypes",["image/jpeg","image/png","image/svg+xml"]);let na=Ft;class j2 extends HTMLElement{connectedCallback(){const t=this.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent=`
3795
+ `,this._data={images:[],meta:{libraryVersion:Q0}},this.selfieInstruction=this.querySelector("selfie-capture-instructions"),this.selfieCapture=this.querySelector("selfie-capture-wrapper"),this.selfieReview=this.querySelector("selfie-capture-review"),this.getAttribute("initial-screen")==="selfie-capture"||this.hideInstructions?this.setActiveScreen(this.selfieCapture):this.setActiveScreen(this.selfieInstruction),this.setUpEventListeners()}getAgentMode(){return this.inAgentMode?"environment":"user"}disconnectedCallback(){F.stopMedia(),nt==null||nt.dispatchEvent(new CustomEvent("metadata.cleanup")),this._selfieWrapperListeners&&(this._selfieWrapperListeners.forEach(({event:t,handler:i})=>{window.removeEventListener(t,i)}),this._selfieWrapperListeners=null),this.activeScreen&&this.activeScreen.removeAttribute("hidden"),this.activeScreen=null,this.innerHTML=""}setUpEventListeners(){this.selfieInstruction.addEventListener("selfie-capture-instructions.capture",()=>L(this,null,function*(){this.setActiveScreen(this.selfieCapture)})),this.selfieInstruction.addEventListener("selfie-capture-instructions.cancelled",()=>{this.handleBackEvents()}),this.setupSelfieWrapperEventListeners(),this.selfieReview.addEventListener("selfie-capture-review.rejected",()=>L(this,null,function*(){nt==null||nt.dispatchEvent(new CustomEvent("metadata.selfie-capture-retry")),this.selfieReview.removeAttribute("data-image"),this.selfieReview.removeAttribute("mirror-image"),this._data.images=[],yield this.forceWrapperRemount(),this.setActiveScreen(this.selfieCapture)})),this.selfieReview.addEventListener("selfie-capture-review.accepted",()=>L(this,null,function*(){this._publishSelectedImages()})),[this.selfieInstruction,this.selfieCapture,this.selfieReview].forEach(t=>{t.addEventListener(`${t.nodeName.toLowerCase()}.close`,()=>{this.handleCloseEvent()})})}forceWrapperRemount(){return L(this,null,function*(){F.stopMedia(),this._remountKey++;const t=this.querySelector("div"),i=this.selfieCapture;if(i&&t){const n=document.createElement("selfie-capture-wrapper");Array.from(i.attributes).forEach(o=>{n.setAttribute(o.name,o.value)}),i.remove(),yield new Promise(o=>{setTimeout(o,50)}),n.setAttribute("key",this._remountKey.toString()),n.setAttribute("start-countdown","false"),n.setAttribute("hidden","");const s=t.querySelector("selfie-capture-review");s?t.insertBefore(n,s):t.appendChild(n),this.selfieCapture=n,this.setupSelfieWrapperEventListeners()}return new Promise(n=>{setTimeout(()=>{n()},200)})})}setActiveScreen(t){var i;this.activeScreen!==t&&((i=this.activeScreen)==null||i.setAttribute("hidden",""),t.removeAttribute("hidden"),this.activeScreen=t,t===this.selfieCapture?t.setAttribute("start-countdown","true"):this.selfieCapture&&this.selfieCapture.setAttribute("start-countdown","false"))}setupSelfieWrapperEventListeners(){this._selfieWrapperListeners&&this._selfieWrapperListeners.forEach(({event:r,handler:s})=>{window.removeEventListener(r,s)});const t=()=>L(this,null,function*(){if(F.stopMedia(),yield this.forceWrapperRemount(),this.hideInstructions){this.handleBackEvents();return}this.setActiveScreen(this.selfieInstruction)}),i=()=>L(this,null,function*(){F.stopMedia(),yield this.forceWrapperRemount(),this.handleCloseEvent()}),n=r=>L(this,null,function*(){nt==null||nt.dispatchEvent(new CustomEvent("metadata.selfie-capture-end")),this.selfieReview.setAttribute("data-image",yield eu(r.detail.referenceImage,20,20));const s=r.detail.facingMode==="user";this.selfieReview.setAttribute("mirror-image",s?"true":"false"),this._data.images=r.detail.images,F.stopMedia(),this.setActiveScreen(this.selfieReview)});this._selfieWrapperListeners=[{event:"selfie-capture.cancelled",handler:t},{event:"selfie-capture.close",handler:i},{event:"selfie-capture.publish",handler:n}],this._selfieWrapperListeners.forEach(({event:r,handler:s})=>{window.addEventListener(r,s)}),this.addEventListener("selfie-capture.publish",n)}_publishSelectedImages(){this.dispatchEvent(new CustomEvent("selfie-capture-screens.publish",{detail:this._data}))}get hideInstructions(){return this.hasAttribute("hide-instructions")}get hideAttribution(){return this.hasAttribute("hide-attribution")?'hide-attribution=""':""}get hideBackOfId(){return this.hasAttribute("hide-back-of-id")}get showNavigation(){return this.hasAttribute("show-navigation")?'show-navigation=""':""}get inAgentMode(){return this.getAttribute("allow-agent-mode")==="true"}get allowAgentMode(){return this.inAgentMode?'allow-agent-mode="true"':""}get allowAgentModeTests(){return this.hasAttribute("show-agent-mode-for-tests")?'show-agent-mode-for-tests=""':""}get hideBack(){return this.hasAttribute("hide-back-to-host")||this.hasAttribute("hide-back")?'hide-back=""':""}get disableImageTests(){return this.hasAttribute("disable-image-tests")?'disable-image-tests=""':""}get themeColor(){return this.getAttribute("theme-color")||"#001096"}handleBackEvents(){this.dispatchEvent(new CustomEvent("selfie-capture-screens.cancelled"))}handleCloseEvent(){this.dispatchEvent(new CustomEvent("selfie-capture-screens.close"))}static get observedAttributes(){return["title","hidden","show-navigation","hide-back-to-host","initial-screen","allow-agent-mode","show-agent-mode-for-tests","disable-image-tests"]}attributeChangedCallback(t){switch(t){case"title":case"hidden":case"initial-screen":case"allow-agent-mode":case"show-agent-mode-for-tests":case"disable-image-tests":this.connectedCallback();break}}}"customElements"in window&&!customElements.get("selfie-capture-screens")&&customElements.define("selfie-capture-screens",V2);class Br{constructor(t,i,n,r){if(isNaN(t)||isNaN(i))throw new Error(`Point is invalid: (${t}, ${i})`);this.x=+t,this.y=+i,this.pressure=n||0,this.time=r||Date.now()}distanceTo(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))}equals(t){return this.x===t.x&&this.y===t.y&&this.pressure===t.pressure&&this.time===t.time}velocityFrom(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):0}}class ia{static fromPoints(t,i){const n=this.calculateControlPoints(t[0],t[1],t[2]).c2,r=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new ia(t[1],n,r,t[2],i.start,i.end)}static calculateControlPoints(t,i,n){const r=t.x-i.x,s=t.y-i.y,o=i.x-n.x,a=i.y-n.y,c={x:(t.x+i.x)/2,y:(t.y+i.y)/2},l={x:(i.x+n.x)/2,y:(i.y+n.y)/2},d=Math.sqrt(r*r+s*s),h=Math.sqrt(o*o+a*a),u=c.x-l.x,p=c.y-l.y,f=d+h==0?0:h/(d+h),m={x:l.x+u*f,y:l.y+p*f},v=i.x-m.x,g=i.y-m.y;return{c1:new Br(c.x+v,c.y+g),c2:new Br(l.x+v,l.y+g)}}constructor(t,i,n,r,s,o){this.startPoint=t,this.control2=i,this.control1=n,this.endPoint=r,this.startWidth=s,this.endWidth=o}length(){let i=0,n,r;for(let s=0;s<=10;s+=1){const o=s/10,a=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),c=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(s>0){const l=a-n,d=c-r;i+=Math.sqrt(l*l+d*d)}n=a,r=c}return i}point(t,i,n,r,s){return i*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*r*(1-t)*t*t+s*t*t*t}}class tu{constructor(){try{this._et=new EventTarget}catch(t){this._et=document}}addEventListener(t,i,n){this._et.addEventListener(t,i,n)}dispatchEvent(t){return this._et.dispatchEvent(t)}removeEventListener(t,i,n){this._et.removeEventListener(t,i,n)}}function iu(e,t=250){let i=0,n=null,r,s,o;const a=()=>{i=Date.now(),n=null,r=e.apply(s,o),n||(s=null,o=[])};return function(...l){const d=Date.now(),h=t-(d-i);return s=this,o=l,h<=0||h>t?(n&&(clearTimeout(n),n=null),i=d,r=e.apply(s,o),n||(s=null,o=[])):n||(n=window.setTimeout(a,h)),r}}let nu=class pa extends tu{constructor(t,i={}){var n,r,s;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this.velocityFilterWeight=i.velocityFilterWeight||.7,this.minWidth=i.minWidth||.5,this.maxWidth=i.maxWidth||2.5,this.throttle=(n=i.throttle)!==null&&n!==void 0?n:16,this.minDistance=(r=i.minDistance)!==null&&r!==void 0?r:5,this.dotSize=i.dotSize||0,this.penColor=i.penColor||"black",this.backgroundColor=i.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=i.compositeOperation||"source-over",this.canvasContextOptions=(s=i.canvasContextOptions)!==null&&s!==void 0?s:{},this._strokeMoveUpdate=this.throttle?iu(pa.prototype._strokeUpdate,this.throttle):pa.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:t,canvas:i}=this;t.fillStyle=this.backgroundColor,t.clearRect(0,0,i.width,i.height),t.fillRect(0,0,i.width,i.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._strokePointerId=void 0}fromDataURL(t,i={}){return new Promise((n,r)=>{const s=new Image,o=i.ratio||window.devicePixelRatio||1,a=i.width||this.canvas.width/o,c=i.height||this.canvas.height/o,l=i.xOffset||0,d=i.yOffset||0;this._reset(this._getPointGroupOptions()),s.onload=()=>{this._ctx.drawImage(s,l,d,a,c),n()},s.onerror=h=>{r(h)},s.crossOrigin="anonymous",s.src=t,this._isEmpty=!1})}toDataURL(t="image/png",i){switch(t){case"image/svg+xml":return typeof i!="object"&&(i=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(i))}`;default:return typeof i!="number"&&(i=void 0),this.canvas.toDataURL(t,i)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var t;const i=window.document===this.canvas.ownerDocument?window:(t=this.canvas.ownerDocument.defaultView)!==null&&t!==void 0?t:this.canvas.ownerDocument;return{addEventListener:i.addEventListener.bind(i),removeEventListener:i.removeEventListener.bind(i)}}_removeMoveUpEventListeners(){const{removeEventListener:t}=this._getListenerFunctions();t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp),t("mousemove",this._handleMouseMove),t("mouseup",this._handleMouseUp),t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(t,{clear:i=!0}={}){i&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}toData(){return this._data}_isLeftButtonPressed(t,i){return i?t.buttons===1:(t.buttons&1)===1}_pointerEventToSignatureEvent(t){return{event:t,type:t.type,x:t.clientX,y:t.clientY,pressure:"pressure"in t?t.pressure:0}}_touchEventToSignatureEvent(t){const i=t.changedTouches[0];return{event:t,type:t.type,x:i.clientX,y:i.clientY,pressure:i.force}}_handleMouseDown(t){!this._isLeftButtonPressed(t,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(t))}_handleMouseMove(t){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}_handleMouseUp(t){this._isLeftButtonPressed(t)||this._strokeEnd(this._pointerEventToSignatureEvent(t))}_handleTouchStart(t){t.targetTouches.length!==1||this._drawingStroke||(t.cancelable&&t.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(t)))}_handleTouchMove(t){if(t.targetTouches.length===1){if(t.cancelable&&t.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(t))}}_handleTouchEnd(t){t.targetTouches.length===0&&(t.cancelable&&t.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(t)))}_getPointerId(t){return t.persistentDeviceId||t.pointerId}_allowPointerId(t,i=!1){return typeof this._strokePointerId=="undefined"?i:this._getPointerId(t)===this._strokePointerId}_handlePointerDown(t){this._drawingStroke||!this._isLeftButtonPressed(t)||!this._allowPointerId(t,!0)||(this._strokePointerId=this._getPointerId(t),t.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(t)))}_handlePointerMove(t){if(this._allowPointerId(t)){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}t.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}}_handlePointerUp(t){this._isLeftButtonPressed(t)||!this._allowPointerId(t)||(t.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(t)))}_getPointGroupOptions(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}_strokeBegin(t){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0})))return;const{addEventListener:n}=this._getListenerFunctions();switch(t.event.type){case"mousedown":n("mousemove",this._handleMouseMove,{passive:!1}),n("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":n("touchmove",this._handleTouchMove,{passive:!1}),n("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":n("pointermove",this._handlePointerMove,{passive:!1}),n("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const r=this._getPointGroupOptions(),s=Object.assign(Object.assign({},r),{points:[]});this._data.push(s),this._reset(r),this._strokeUpdate(t)}_strokeUpdate(t){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(t);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));const i=this._createPoint(t.x,t.y,t.pressure),n=this._data[this._data.length-1],r=n.points,s=r.length>0&&r[r.length-1],o=s?i.distanceTo(s)<=this.minDistance:!1,a=this._getPointGroupOptions(n);if(!s||!(s&&o)){const c=this._addPoint(i,a);s?c&&this._drawCurve(c,a):this._drawDot(i,a),r.push({time:i.time,x:i.x,y:i.y,pressure:i.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}_strokeEnd(t,i=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(i&&this._strokeUpdate(t),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}_createPoint(t,i,n){const r=this.canvas.getBoundingClientRect();return new Br(t-r.left,i-r.top,n,new Date().getTime())}_addPoint(t,i){const{_lastPoints:n}=this;if(n.push(t),n.length>2){n.length===3&&n.unshift(n[0]);const r=this._calculateCurveWidths(n[1],n[2],i),s=ia.fromPoints(n,r);return n.shift(),s}return null}_calculateCurveWidths(t,i,n){const r=n.velocityFilterWeight*i.velocityFrom(t)+(1-n.velocityFilterWeight)*this._lastVelocity,s=this._strokeWidth(r,n),o={end:s,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=s,o}_strokeWidth(t,i){return Math.max(i.maxWidth/(t+1),i.minWidth)}_drawCurveSegment(t,i,n){const r=this._ctx;r.moveTo(t,i),r.arc(t,i,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,i){const n=this._ctx,r=t.endWidth-t.startWidth,s=Math.ceil(t.length())*2;n.beginPath(),n.fillStyle=i.penColor;for(let o=0;o<s;o+=1){const a=o/s,c=a*a,l=c*a,d=1-a,h=d*d,u=h*d;let p=u*t.startPoint.x;p+=3*h*a*t.control1.x,p+=3*d*c*t.control2.x,p+=l*t.endPoint.x;let f=u*t.startPoint.y;f+=3*h*a*t.control1.y,f+=3*d*c*t.control2.y,f+=l*t.endPoint.y;const m=Math.min(t.startWidth+l*r,i.maxWidth);this._drawCurveSegment(p,f,m)}n.closePath(),n.fill()}_drawDot(t,i){const n=this._ctx,r=i.dotSize>0?i.dotSize:(i.minWidth+i.maxWidth)/2;n.beginPath(),this._drawCurveSegment(t.x,t.y,r),n.closePath(),n.fillStyle=i.penColor,n.fill()}_fromData(t,i,n){for(const r of t){const{points:s}=r,o=this._getPointGroupOptions(r);if(s.length>1)for(let a=0;a<s.length;a+=1){const c=s[a],l=new Br(c.x,c.y,c.pressure,c.time);a===0&&this._reset(o);const d=this._addPoint(l,o);d&&i(d,o)}else this._reset(o),n(s[0],o)}}toSVG({includeBackgroundColor:t=!1}={}){const i=this._data,n=Math.max(window.devicePixelRatio||1,1),r=0,s=0,o=this.canvas.width/n,a=this.canvas.height/n,c=document.createElementNS("http://www.w3.org/2000/svg","svg");if(c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),c.setAttribute("viewBox",`${r} ${s} ${o} ${a}`),c.setAttribute("width",o.toString()),c.setAttribute("height",a.toString()),t&&this.backgroundColor){const l=document.createElement("rect");l.setAttribute("width","100%"),l.setAttribute("height","100%"),l.setAttribute("fill",this.backgroundColor),c.appendChild(l)}return this._fromData(i,(l,{penColor:d})=>{const h=document.createElement("path");if(!isNaN(l.control1.x)&&!isNaN(l.control1.y)&&!isNaN(l.control2.x)&&!isNaN(l.control2.y)){const u=`M ${l.startPoint.x.toFixed(3)},${l.startPoint.y.toFixed(3)} C ${l.control1.x.toFixed(3)},${l.control1.y.toFixed(3)} ${l.control2.x.toFixed(3)},${l.control2.y.toFixed(3)} ${l.endPoint.x.toFixed(3)},${l.endPoint.y.toFixed(3)}`;h.setAttribute("d",u),h.setAttribute("stroke-width",(l.endWidth*2.25).toFixed(3)),h.setAttribute("stroke",d),h.setAttribute("fill","none"),h.setAttribute("stroke-linecap","round"),c.appendChild(h)}},(l,{penColor:d,dotSize:h,minWidth:u,maxWidth:p})=>{const f=document.createElement("circle"),m=h>0?h:(u+p)/2;f.setAttribute("r",m.toString()),f.setAttribute("cx",l.x.toString()),f.setAttribute("cy",l.y.toString()),f.setAttribute("fill",d),c.appendChild(f)}),c.outerHTML}};const Ft=class Ft{static getHumanSize(t){const i=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(t)/Math.log(1024)),i.length-1),r=t/da(1024,n);return n===0?`${t} bytes`:`${r.toFixed(0)} ${i[n]}`}static getData(t){return new Promise((i,n)=>{const r=new FileReader;r.onload=s=>{i(s.target.result)},r.onerror=()=>{n(new Error("An error occurred reading the file. Please check the file, and try again"))},r.readAsDataURL(t)})}static retrieve(t){return L(this,null,function*(){if(t.length>1)throw new Error("Only one file upload is permitted at a time");const i=t[0];if(!Ft.supportedTypes.includes(i.type))throw new Error("Unsupported file format. Please ensure that you are providing a JPG, PNG or SVG image");if(i.size>Ft.memoryLimit)throw new Error(`${i.name} is too large. Please ensure that the file is less than ${Ft.getHumanSize(Ft.memoryLimit)}.`);return yield Ft.getData(i)})}};li(Ft,"memoryLimit",2048e3),li(Ft,"supportedTypes",["image/jpeg","image/png","image/svg+xml"]);let na=Ft;class j2 extends HTMLElement{connectedCallback(){const t=this.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent=`
3821
3796
  :host {
3822
3797
  display: block;
3823
3798
  block-size: auto;
@@ -3998,7 +3973,7 @@ button:disabled {
3998
3973
  />
3999
3974
  </svg>
4000
3975
  </button>
4001
- `,n.appendChild(r),n.appendChild(s),n.appendChild(o),this.allowUpload&&n.appendChild(p),n.appendChild(f),t.appendChild(i),t.appendChild(n),this.core=new tu(o),this.errorMessage=r.querySelector("#error"),window&&(window.onresize=this.resizeCanvas()),this.clearSignatureButton=s.querySelector("#clear"),this.clearSignatureButton.addEventListener("click",()=>this.clearSignature()),this.uploadSignatureButton=p.querySelector("#upload-signature"),this.uploadSignatureButton.addEventListener("change",m=>this.uploadSignature(m)),this.publishSignatureButton=f.querySelector("#publish"),this.publishSignatureButton.addEventListener("click",()=>this.publishSignature())}disconnectedCallback(){this.publishSignatureButton.removeEventListener("click",()=>this.publishSignature()),this.clearSignatureButton.removeEventListener("click",()=>this.clearSignature()),this.uploadSignatureButton.removeEventListener("change",t=>this.uploadSignature(t))}resizeCanvas(){const t=this.shadowRoot.querySelector("canvas"),i=Math.max(window.devicePixelRatio||1,1);t.width=(t.offsetWidth||t.width)*i,t.height=(t.offsetHeight||t.height)*i,t.getContext("2d").scale(i,i),this.core.fromData(this.core.toData())}publishSignature(){try{this.resetErrorMessage();const t=this.shadowRoot.querySelector("img");let i=t?t.src:void 0;if(!i&&!this.core.isEmpty()&&(i=this.core.toDataURL("image/svg+xml")),i)this.dispatchEvent(new CustomEvent("signature-pad.publish",{detail:i}));else throw new Error(`No signature present. ${this.allowUpload?"Draw or upload":"Draw"} a signature`)}catch(t){this.handleError(t.message)}}resetErrorMessage(){this.errorMessage.textContent=""}handleError(t){this.errorMessage.textContent=t}clearSignature(){this.resetErrorMessage();const t=this.shadowRoot.querySelector("canvas"),i=this.shadowRoot.querySelector("img");i&&(i.remove(),t.removeAttribute("hidden")),this.core.clear()}previewUpload(t){const i=this.shadowRoot.querySelector("canvas");let n=this.shadowRoot.querySelector("img");n||(n=document.createElement("img")),n.src=t,n.setAttribute("part","upload-preview-image"),i.setAttribute("hidden",!0),i.insertAdjacentElement("afterend",n)}uploadSignature(t){return M(this,null,function*(){try{this.resetErrorMessage();const{files:i}=t.target,n=yield na.retrieve(i);this.previewUpload(n)}catch(i){this.handleError(i.message)}})}get allowUpload(){return this.hasAttribute("allow-upload")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}}"customElements"in window&&!window.customElements.get("smileid-signature-pad")&&window.customElements.define("smileid-signature-pad",j2);function iu(){return`
3976
+ `,n.appendChild(r),n.appendChild(s),n.appendChild(o),this.allowUpload&&n.appendChild(p),n.appendChild(f),t.appendChild(i),t.appendChild(n),this.core=new nu(o),this.errorMessage=r.querySelector("#error"),window&&(window.onresize=this.resizeCanvas()),this.clearSignatureButton=s.querySelector("#clear"),this.clearSignatureButton.addEventListener("click",()=>this.clearSignature()),this.uploadSignatureButton=p.querySelector("#upload-signature"),this.uploadSignatureButton.addEventListener("change",m=>this.uploadSignature(m)),this.publishSignatureButton=f.querySelector("#publish"),this.publishSignatureButton.addEventListener("click",()=>this.publishSignature())}disconnectedCallback(){this.publishSignatureButton.removeEventListener("click",()=>this.publishSignature()),this.clearSignatureButton.removeEventListener("click",()=>this.clearSignature()),this.uploadSignatureButton.removeEventListener("change",t=>this.uploadSignature(t))}resizeCanvas(){const t=this.shadowRoot.querySelector("canvas"),i=Math.max(window.devicePixelRatio||1,1);t.width=(t.offsetWidth||t.width)*i,t.height=(t.offsetHeight||t.height)*i,t.getContext("2d").scale(i,i),this.core.fromData(this.core.toData())}publishSignature(){try{this.resetErrorMessage();const t=this.shadowRoot.querySelector("img");let i=t?t.src:void 0;if(!i&&!this.core.isEmpty()&&(i=this.core.toDataURL("image/svg+xml")),i)this.dispatchEvent(new CustomEvent("signature-pad.publish",{detail:i}));else throw new Error(`No signature present. ${this.allowUpload?"Draw or upload":"Draw"} a signature`)}catch(t){this.handleError(t.message)}}resetErrorMessage(){this.errorMessage.textContent=""}handleError(t){this.errorMessage.textContent=t}clearSignature(){this.resetErrorMessage();const t=this.shadowRoot.querySelector("canvas"),i=this.shadowRoot.querySelector("img");i&&(i.remove(),t.removeAttribute("hidden")),this.core.clear()}previewUpload(t){const i=this.shadowRoot.querySelector("canvas");let n=this.shadowRoot.querySelector("img");n||(n=document.createElement("img")),n.src=t,n.setAttribute("part","upload-preview-image"),i.setAttribute("hidden",!0),i.insertAdjacentElement("afterend",n)}uploadSignature(t){return L(this,null,function*(){try{this.resetErrorMessage();const{files:i}=t.target,n=yield na.retrieve(i);this.previewUpload(n)}catch(i){this.handleError(i.message)}})}get allowUpload(){return this.hasAttribute("allow-upload")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}}"customElements"in window&&!window.customElements.get("smileid-signature-pad")&&window.customElements.define("smileid-signature-pad",j2);function ru(){return`
4002
3977
  ${st(this.themeColor)}
4003
3978
  <style>
4004
3979
  .camera-permission-screen {
@@ -4073,7 +4048,7 @@ button:disabled {
4073
4048
  </div>
4074
4049
  </div>
4075
4050
  </div>
4076
- `}class nu extends HTMLElement{connectedCallback(){this.templateString=iu.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners()}setUpEventListeners(){const t=this.shadowRoot.querySelector("#error"),i=this.shadowRoot.getElementById("request-camera-access");t.textContent="",i.addEventListener("click",()=>M(this,null,function*(){i.setAttribute("disabled",!0);try{yield F.getMedia({audio:!1,video:!0}),this.dispatchEvent(new CustomEvent("camera-permission.granted"))}catch(n){this.dispatchEvent(new CustomEvent("camera-permission.denied",{detail:n})),t.textContent=F.handleCameraError(n)}i.removeAttribute("disabled")}))}get showNavigation(){return this.hasAttribute("show-navigation")}get hideAttribution(){return this.hasAttribute("hide-attribution")}get hideBack(){return this.hasAttribute("hide-back")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}}window.customElements&&!window.customElements.get("camera-permission")&&window.customElements.define("camera-permission",nu);const ru=Xi.version;function su(){return`
4051
+ `}class su extends HTMLElement{connectedCallback(){this.templateString=ru.bind(this),this.render=()=>this.templateString(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners()}setUpEventListeners(){const t=this.shadowRoot.querySelector("#error"),i=this.shadowRoot.getElementById("request-camera-access");t.textContent="",i.addEventListener("click",()=>L(this,null,function*(){i.setAttribute("disabled",!0);try{yield F.getMedia({audio:!1,video:!0}),this.dispatchEvent(new CustomEvent("camera-permission.granted"))}catch(n){this.dispatchEvent(new CustomEvent("camera-permission.denied",{detail:n})),t.textContent=F.handleCameraError(n)}i.removeAttribute("disabled")}))}get showNavigation(){return this.hasAttribute("show-navigation")}get hideAttribution(){return this.hasAttribute("hide-attribution")}get hideBack(){return this.hasAttribute("hide-back")}get themeColor(){return this.getAttribute("theme-color")||"#001096"}}window.customElements&&!window.customElements.get("camera-permission")&&window.customElements.define("camera-permission",su);const ou=Xi.version;function au(){return`
4077
4052
  <style>
4078
4053
  :host {
4079
4054
  display: block;
@@ -4089,5 +4064,5 @@ button:disabled {
4089
4064
  <document-capture-screens ${this.applyComponentThemeColor} document-type=${this.documentType} ${this.title} ${this.documentCaptureModes} ${this.showNavigation} ${this.hideAttribution}
4090
4065
  ${this.hideBackOfId} ${this.applyComponentThemeColor} hidden></document-capture-screens>
4091
4066
  </div>
4092
- `}class G2 extends HTMLElement{constructor(){super(),this.scwTemplateString=su.bind(this),this.render=()=>this.scwTemplateString(),this.attachShadow({mode:"open"}),this.activeScreen=null}connectedCallback(){this.shadowRoot.innerHTML=this.render(),this._data={images:[],meta:{libraryVersion:ru}},"mediaDevices"in navigator&&"getUserMedia"in navigator.mediaDevices?this.setUpEventListeners():this.shadowRoot.innerHTML='<h1 class="error-message">Your browser does not support this integration</h1>'}disconnectedCallback(){F.stopMedia(),this.activeScreen&&this.activeScreen.removeAttribute("hidden"),this.activeScreen=null,this.shadowRoot.innerHTML=""}static get observedAttributes(){return["allow-agent-mode","disable-image-tests","document-capture-modes","document-type","hide-attribution","hide-back-of-id","hide-back-to-host","show-navigation","theme-color"]}attributeChangedCallback(t){switch(t){case"allow-agent-mode":case"disable-image-tests":case"document-capture-modes":case"document-type":case"hide-attribution":case"hide-back-of-id":case"hide-back-to-host":case"show-navigation":case"theme-color":this.disconnectedCallback(),this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners();break}}setUpEventListeners(){this.cameraPermission=this.shadowRoot.querySelector("camera-permission"),this.SelfieCaptureScreens=this.shadowRoot.querySelector("selfie-capture-screens"),this.documentCapture=this.shadowRoot.querySelector("document-capture-screens"),this.hideInstructions?this.setActiveScreen(this.cameraPermission):this.setActiveScreen(this.SelfieCaptureScreens),this.cameraPermission.addEventListener("camera-permission.granted",()=>{this.setActiveScreen(this.SelfieCaptureScreens),this.SelfieCaptureScreens.removeAttribute("data-camera-error"),this.SelfieCaptureScreens.setAttribute("data-camera-ready",!0)}),this.SelfieCaptureScreens.addEventListener("selfie-capture-screens.publish",t=>{this._data.images=t.detail.images,this.captureId?this.setActiveScreen(this.documentCapture):this._publishSelectedImages()}),this.SelfieCaptureScreens.addEventListener("selfie-capture-screens.cancelled",()=>{this.hideInstructions?this.setActiveScreen(this.cameraPermission):this.handleBackEvents()}),this.SelfieCaptureScreens.addEventListener("selfie-capture-screens.back",()=>{this.hideInstructions||this.setActiveScreen(this.cameraPermission)}),this.documentCapture.addEventListener("document-capture-screens.publish",t=>{this._data.images=[...this._data.images,...t.detail.images],this._publishSelectedImages()}),this.documentCapture.addEventListener("document-capture-screens.cancelled",()=>{this.SelfieCaptureScreens.setAttribute("initial-screen","selfie-capture"),this.setActiveScreen(this.SelfieCaptureScreens),this.SelfieCaptureScreens.removeAttribute("data-camera-error"),this.SelfieCaptureScreens.setAttribute("data-camera-ready",!0)}),[this.cameraPermission,this.SelfieCaptureScreens,this.documentCapture].forEach(t=>{t.addEventListener(`${t.nodeName.toLowerCase()}.close`,()=>this.handleCloseEvent())}),this.documentCapture.addEventListener("document-capture-screens.back",()=>{this.setActiveScreen(this.SelfieCaptureScreens),this.reset()})}reset(){this.disconnectedCallback(),this.connectedCallback()}handleBackEvents(){this.dispatchEvent(new CustomEvent("smart-camera-web.cancelled"))}_publishSelectedImages(){this.dispatchEvent(new CustomEvent("smart-camera-web.publish",{detail:this._data}))}get captureId(){return this.hasAttribute("capture-id")}get documentType(){return this.getAttribute("document-type")}get isPortraitCaptureView(){return this.getAttribute("document-type")==="GREEN_BOOK"}get hideInstructions(){return this.hasAttribute("hide-instructions")?"hide-instructions":""}get hideBackOfId(){return this.hasAttribute("hide-back-of-id")?"hide-back-of-id":""}get showNavigation(){return this.hasAttribute("show-navigation")?"show-navigation":""}get hideBackToHost(){return this.hasAttribute("hide-back-to-host")||this.hasAttribute("hide-back")?"hide-back":""}get allowAgentMode(){return this.hasAttribute("allow-agent-mode")?`allow-agent-mode=${this.getAttribute("allow-agent-mode")}`:""}get allowAgentModeTests(){return this.hasAttribute("show-agent-mode-for-tests")?"show-agent-mode-for-tests":""}get title(){return this.hasAttribute("title")?`title=${this.getAttribute("title")}`:""}get documentCaptureModes(){return this.hasAttribute("document-capture-modes")?`document-capture-modes='${this.getAttribute("document-capture-modes")}'`:""}get disableImageTests(){return this.hasAttribute("disable-image-tests")?"disable-image-tests":""}get hideAttribution(){return this.hasAttribute("hide-attribution")?"hide-attribution":""}get hasThemeColor(){return this.hasAttribute("theme-color")&&![null,void 0,"null","undefined"].includes(this.getAttribute("theme-color"))}get themeColor(){return this.hasThemeColor?this.getAttribute("theme-color"):"#001096"}get applyComponentThemeColor(){return this.hasThemeColor?`theme-color='${this.themeColor}'`:""}setActiveScreen(t){var i;(i=this.activeScreen)==null||i.setAttribute("hidden",""),t.removeAttribute("hidden"),this.activeScreen=t}handleCloseEvent(){this.dispatchEvent(new CustomEvent("smart-camera-web.close"))}}return"customElements"in window&&!customElements.get("smart-camera-web")&&customElements.define("smart-camera-web",G2),P.DocumentCaptureScreens=ba,P.EndUserConsent=Ca,P.List=ma,P.Navigation=va,P.Option=ga,P.Root=hi,P.SelfieCaptureScreens=V2,P.SignaturePad=j2,P.SmartCameraWeb=G2,P.TotpConsent=_a,P.Trigger=fa,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),P}({});
4067
+ `}class G2 extends HTMLElement{constructor(){super(),this.scwTemplateString=au.bind(this),this.render=()=>this.scwTemplateString(),this.attachShadow({mode:"open"}),this.activeScreen=null}connectedCallback(){this.shadowRoot.innerHTML=this.render(),this._data={images:[],meta:{libraryVersion:ou}},"mediaDevices"in navigator&&"getUserMedia"in navigator.mediaDevices?this.setUpEventListeners():this.shadowRoot.innerHTML='<h1 class="error-message">Your browser does not support this integration</h1>'}disconnectedCallback(){F.stopMedia(),this.activeScreen&&this.activeScreen.removeAttribute("hidden"),this.activeScreen=null,this.shadowRoot.innerHTML=""}static get observedAttributes(){return["allow-agent-mode","disable-image-tests","document-capture-modes","document-type","hide-attribution","hide-back-of-id","hide-back-to-host","show-navigation","theme-color"]}attributeChangedCallback(t){switch(t){case"allow-agent-mode":case"disable-image-tests":case"document-capture-modes":case"document-type":case"hide-attribution":case"hide-back-of-id":case"hide-back-to-host":case"show-navigation":case"theme-color":this.disconnectedCallback(),this.shadowRoot.innerHTML=this.render(),this.setUpEventListeners();break}}setUpEventListeners(){this.cameraPermission=this.shadowRoot.querySelector("camera-permission"),this.SelfieCaptureScreens=this.shadowRoot.querySelector("selfie-capture-screens"),this.documentCapture=this.shadowRoot.querySelector("document-capture-screens"),this.hideInstructions?this.setActiveScreen(this.cameraPermission):this.setActiveScreen(this.SelfieCaptureScreens),this.cameraPermission.addEventListener("camera-permission.granted",()=>{this.setActiveScreen(this.SelfieCaptureScreens),this.SelfieCaptureScreens.removeAttribute("data-camera-error"),this.SelfieCaptureScreens.setAttribute("data-camera-ready",!0)}),this.SelfieCaptureScreens.addEventListener("selfie-capture-screens.publish",t=>{this._data.images=t.detail.images,this.captureId?this.setActiveScreen(this.documentCapture):this._publishSelectedImages()}),this.SelfieCaptureScreens.addEventListener("selfie-capture-screens.cancelled",()=>{this.hideInstructions?this.setActiveScreen(this.cameraPermission):this.handleBackEvents()}),this.SelfieCaptureScreens.addEventListener("selfie-capture-screens.back",()=>{this.hideInstructions||this.setActiveScreen(this.cameraPermission)}),this.documentCapture.addEventListener("document-capture-screens.publish",t=>{this._data.images=[...this._data.images,...t.detail.images],this._publishSelectedImages()}),this.documentCapture.addEventListener("document-capture-screens.cancelled",()=>{this.SelfieCaptureScreens.setAttribute("initial-screen","selfie-capture"),this.setActiveScreen(this.SelfieCaptureScreens),this.SelfieCaptureScreens.removeAttribute("data-camera-error"),this.SelfieCaptureScreens.setAttribute("data-camera-ready",!0)}),[this.cameraPermission,this.SelfieCaptureScreens,this.documentCapture].forEach(t=>{t.addEventListener(`${t.nodeName.toLowerCase()}.close`,()=>this.handleCloseEvent())}),this.documentCapture.addEventListener("document-capture-screens.back",()=>{this.setActiveScreen(this.SelfieCaptureScreens),this.reset()})}reset(){this.disconnectedCallback(),this.connectedCallback()}handleBackEvents(){this.dispatchEvent(new CustomEvent("smart-camera-web.cancelled"))}_publishSelectedImages(){this.dispatchEvent(new CustomEvent("smart-camera-web.publish",{detail:this._data}))}get captureId(){return this.hasAttribute("capture-id")}get documentType(){return this.getAttribute("document-type")}get isPortraitCaptureView(){return this.getAttribute("document-type")==="GREEN_BOOK"}get hideInstructions(){return this.hasAttribute("hide-instructions")?"hide-instructions":""}get hideBackOfId(){return this.hasAttribute("hide-back-of-id")?"hide-back-of-id":""}get showNavigation(){return this.hasAttribute("show-navigation")?"show-navigation":""}get hideBackToHost(){return this.hasAttribute("hide-back-to-host")||this.hasAttribute("hide-back")?"hide-back":""}get allowAgentMode(){return this.hasAttribute("allow-agent-mode")?`allow-agent-mode=${this.getAttribute("allow-agent-mode")}`:""}get allowAgentModeTests(){return this.hasAttribute("show-agent-mode-for-tests")?"show-agent-mode-for-tests":""}get title(){return this.hasAttribute("title")?`title=${this.getAttribute("title")}`:""}get documentCaptureModes(){return this.hasAttribute("document-capture-modes")?`document-capture-modes='${this.getAttribute("document-capture-modes")}'`:""}get disableImageTests(){return this.hasAttribute("disable-image-tests")?"disable-image-tests":""}get hideAttribution(){return this.hasAttribute("hide-attribution")?"hide-attribution":""}get hasThemeColor(){return this.hasAttribute("theme-color")&&![null,void 0,"null","undefined"].includes(this.getAttribute("theme-color"))}get themeColor(){return this.hasThemeColor?this.getAttribute("theme-color"):"#001096"}get applyComponentThemeColor(){return this.hasThemeColor?`theme-color='${this.themeColor}'`:""}setActiveScreen(t){var i;(i=this.activeScreen)==null||i.setAttribute("hidden",""),t.removeAttribute("hidden"),this.activeScreen=t}handleCloseEvent(){this.dispatchEvent(new CustomEvent("smart-camera-web.close"))}}return"customElements"in window&&!customElements.get("smart-camera-web")&&customElements.define("smart-camera-web",G2),P.DocumentCaptureScreens=ba,P.EndUserConsent=Ca,P.List=ma,P.Navigation=va,P.Option=ga,P.Root=hi,P.SelfieCaptureScreens=V2,P.SignaturePad=j2,P.SmartCameraWeb=G2,P.TotpConsent=_a,P.Trigger=fa,Object.defineProperty(P,Symbol.toStringTag,{value:"Module"}),P}({});
4093
4068
  //# sourceMappingURL=smart-camera-web.js.map