@biopassid/face-sdk
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -1,21 +0,21 @@ | ||
var at=Object.create;var pe=Object.defineProperty;var it=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var lt=Object.getPrototypeOf,ct=Object.prototype.hasOwnProperty;var Ye=r=>pe(r,"__esModule",{value:!0});var st=(r,a)=>{for(var i in a)pe(r,i,{get:a[i],enumerable:!0})},Ge=(r,a,i,t)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of ot(a))!ct.call(r,n)&&(i||n!=="default")&&pe(r,n,{get:()=>a[n],enumerable:!(t=it(a,n))||t.enumerable});return r},ve=(r,a)=>Ge(Ye(pe(r!=null?at(lt(r)):{},"default",!a&&r&&r.__esModule?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r),dt=(r=>(a,i)=>r&&r.get(a)||(i=Ge(Ye({}),a,1),r&&r.set(a,i),i))(typeof WeakMap!="undefined"?new WeakMap:0);var mt={};st(mt,{useCamera:()=>Be});var Xe="generic/permissions_denied";var Oe="generic/operation_canceled";var Ue="generic/not_permitted";async function De(){try{let r={audio:!1,video:!0};return(await navigator.mediaDevices.getUserMedia(r)).getTracks().forEach(i=>{i.stop()}),!0}catch(r){return console.log(r),!1}}var be=require("@4backs/render-function");var Ne=ve(require("@4backs/render-function/r"));function Ae(r,a){return(0,Ne.default)({tag:"img",attributes:{src:r},style:{width:a}})}function Z(r){let{size:a,backgroundColor:i,onPressed:t,horizontalMargin:n="20px",label:e,icon:o,svgIconCreator:m,padding:l}=r;function g(){let s=[];return o.enabled&&o.source.length==0&&s.push((0,be.r)({tag:"div",style:{width:o.size},children:m(o.color)})),o.enabled&&o.source.length>0&&s.push(Ae(o.source,o.size)),e.enabled&&o.enabled&&s.push((0,be.r)({tag:"div",style:{width:"8px"}})),e.enabled&&s.push((0,be.r)({tag:"p",children:e.content,style:{fontSize:e.fontSize,color:e.color,fontWeight:e.fontWeight}})),s}return(0,be.r)({tag:"button",style:{minWidth:a,height:a,borderRadius:"9999px",cursor:"pointer",background:i,display:"flex",alignItems:"center",justifyContent:"center",padding:l,margin:`0 ${n}`,border:"none"},onClick:t,children:g()})}var Je=require("@4backs/render-function");function qe(r){return new Promise(a=>{setTimeout(()=>{a()},r)})}function ye(r){let a=!1,i="",t=(0,Je.r)({tag:"video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#363738",transform:"scaleX(-1)"},attributes:{id:"biopass_camera",autoplay:"",playsinline:"",muted:""}});async function n(l){return new Promise((g,s)=>{let{aspectRatio:c,preferredResolution:x}=r,T={audio:!1,video:{facingMode:l!=null?"user":void 0,deviceId:l!=null?{exact:l}:void 0,aspectRatio:c,height:c>1?x:void 0,width:c<1?x:void 0}};navigator.mediaDevices.getUserMedia(T).then(C=>{var d;let h=C.getTracks()[0].getSettings();i=(d=h.deviceId)!=null?d:"",t.style.transform=h.facingMode=="user"?"scaleX(-1)":"scaleX(1)",t.srcObject=C,t.play(),t.onloadedmetadata=()=>{a=!0,g()}}).catch(C=>s(C))})}async function e(){let l=t.srcObject;l&&l.getTracks().forEach(function(s){s.stop()}),t.srcObject=null,a=!1}async function o(){if(a){a=!1,e(),await qe(300);let l=(await navigator.mediaDevices.enumerateDevices()).filter(c=>c.kind=="videoinput").map(c=>c.deviceId),g=l.indexOf(i);if(l.length==1||g<0){await n();return}if(g==l.length-1){await n(l[0]);return}let s=l[g+1];await n(s)}}return{get element(){return t},initCamera:n,dispose:e,checkIfIsInitialized:()=>a,switchCamera:o}}var Ke=require("@4backs/render-function");function ke(){let r=(0,Ke.r)({tag:"canvas",style:{position:"absolute",display:"none"}});function a(t){return r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),{base64:r.toDataURL("image/jpg"),height:r.height,width:r.width}}return{get element(){return r},takePicture:a}}var j=require("@4backs/render-function");var xe=require("@4backs/render-function");function Fe(r){let{color:a,opacity:i}=r;return`<svg preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M565 0H0V350H565V0ZM346.833 172.288C347.007 170.954 347.18 169.63 347.354 168.334C350.952 143.942 346.742 122.747 335.71 107.633C324.916 92.949 307.602 83.9174 284.37 83.4243H280.59C257.422 83.9174 240.108 92.949 229.378 107.633C218.282 122.747 214.072 143.942 217.616 168.334C218.1 171.648 218.529 175.091 218.949 178.598L219.031 179.182C220.647 191.794 222.364 205.117 226.328 215.701C231.752 230.203 241.45 242.924 251.934 252.019C262.426 261.115 273.64 266.457 282.361 266.575H282.599C291.32 266.521 302.598 261.115 313.027 252.019C323.574 242.924 333.208 230.148 338.633 215.701C342.66 204.953 344.422 191.374 346.011 178.598C346.267 176.461 346.55 174.361 346.833 172.288Z" fill="${a}" fill-opacity="${i}"/> | ||
var Be=Object.create;var D=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,Le=Object.prototype.hasOwnProperty;var de=e=>D(e,"__esModule",{value:!0});var Oe=(e,n)=>{for(var r in n)D(e,r,{get:n[r],enumerable:!0})},ue=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Ie(n))!Le.call(e,t)&&(r||t!=="default")&&D(e,t,{get:()=>n[t],enumerable:!(i=Me(n,t))||i.enumerable});return e},T=(e,n)=>ue(de(D(e!=null?Be(Te(e)):{},"default",!n&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),ze=(e=>(n,r)=>e&&e.get(n)||(r=ue(de({}),n,1),e&&e.set(n,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var Re={};Oe(Re,{useCamera:()=>N});var me="generic/permissions_denied";var fe="generic/operation_canceled";var pe="generic/not_permitted";async function K(){try{let e={audio:!1,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch(e){return console.log(e),!1}}var L=require("@4backs/render-function");var ge=T(require("@4backs/render-function/r"));function Q(e,n){return(0,ge.default)({tag:"img",attributes:{src:e},style:{width:n}})}function P(e){let{size:n,backgroundColor:r,onPressed:i,horizontalMargin:t="20px",label:o,icon:c,svgIconCreator:d,padding:s}=e;function m(){let l=[];return c.enabled&&c.source.length==0&&l.push((0,L.r)({tag:"div",style:{width:c.size},children:d(c.color)})),c.enabled&&c.source.length>0&&l.push(Q(c.source,c.size)),o.enabled&&c.enabled&&l.push((0,L.r)({tag:"div",style:{width:"8px"}})),o.enabled&&l.push((0,L.r)({tag:"p",children:o.content,style:{fontSize:o.fontSize,color:o.color,fontWeight:o.fontWeight}})),l}return(0,L.r)({tag:"button",style:{minWidth:n,height:n,borderRadius:"9999px",cursor:"pointer",background:r,display:"flex",alignItems:"center",justifyContent:"center",padding:s,margin:`0 ${t}`,border:"none"},onClick:i,children:m()})}var Ce=require("@4backs/render-function");function ee(e){return new Promise(n=>{setTimeout(()=>{n()},e)})}function A(e){let n=!1,r="",i=(0,Ce.r)({tag:"video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#363738",transform:"scaleX(-1)"},attributes:{id:"biopass_camera",autoplay:"",playsinline:"",muted:""}});async function t(s){return new Promise((m,l)=>{let{aspectRatio:a,preferredResolution:g}=e,k={audio:!1,video:{facingMode:s!=null?"user":void 0,deviceId:s!=null?{exact:s}:void 0,aspectRatio:a,height:a>1?g:void 0,width:a<1?g:void 0}};navigator.mediaDevices.getUserMedia(k).then(f=>{let p=f.getTracks()[0].getSettings();r=p.deviceId??"",i.style.transform=p.facingMode=="user"?"scaleX(-1)":"scaleX(1)",i.srcObject=f,i.play(),i.onloadedmetadata=()=>{n=!0,m()}}).catch(f=>l(f))})}async function o(){let s=i.srcObject;s&&s.getTracks().forEach(function(l){l.stop()}),i.srcObject=null,n=!1}async function c(){if(n){n=!1,o(),await ee(300);let s=(await navigator.mediaDevices.enumerateDevices()).filter(a=>a.kind=="videoinput").map(a=>a.deviceId),m=s.indexOf(r);if(s.length==1||m<0){await t();return}if(m==s.length-1){await t(s[0]);return}let l=s[m+1];await t(l)}}return{get element(){return i},initCamera:t,dispose:o,checkIfIsInitialized:()=>n,switchCamera:c}}var he=require("@4backs/render-function");function q(){let e=(0,he.r)({tag:"canvas",style:{position:"absolute",display:"none"}});function n(i){return e.width=i.videoWidth,e.height=i.videoHeight,e.getContext("2d").drawImage(i,0,0,i.videoWidth,i.videoHeight),{base64:e.toDataURL("image/jpg"),height:e.height,width:e.width}}return{get element(){return e},takePicture:n}}var E=require("@4backs/render-function");var F=require("@4backs/render-function");function te(e){let{color:n,opacity:r}=e;return`<svg preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M565 0H0V350H565V0ZM346.833 172.288C347.007 170.954 347.18 169.63 347.354 168.334C350.952 143.942 346.742 122.747 335.71 107.633C324.916 92.949 307.602 83.9174 284.37 83.4243H280.59C257.422 83.9174 240.108 92.949 229.378 107.633C218.282 122.747 214.072 143.942 217.616 168.334C218.1 171.648 218.529 175.091 218.949 178.598L219.031 179.182C220.647 191.794 222.364 205.117 226.328 215.701C231.752 230.203 241.45 242.924 251.934 252.019C262.426 261.115 273.64 266.457 282.361 266.575H282.599C291.32 266.521 302.598 261.115 313.027 252.019C323.574 242.924 333.208 230.148 338.633 215.701C342.66 204.953 344.422 191.374 346.011 178.598C346.267 176.461 346.55 174.361 346.833 172.288Z" fill="${n}" fill-opacity="${r}"/> | ||
</svg> | ||
`}function We(r){return`<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350"><path d="M282.83,266.07v-.5h0c-8.56-.11-19.66-5.37-30.11-14.43A91.58,91.58,0,0,1,227.27,215c-3.94-10.52-5.65-23.78-7.27-36.41h0l-.08-.57h0c-.42-3.5-.85-6.95-1.34-10.27-3.53-24.3.67-45.35,11.67-60.33,10.63-14.54,27.78-23.52,50.82-24h3.77c23.09.49,40.25,9.47,50.94,24,10.93,15,15.13,36,11.55,60.33h0c-.17,1.29-.35,2.62-.52,3.95-.28,2.07-.57,4.18-.82,6.32-1.6,12.79-3.35,26.3-7.36,37a91.33,91.33,0,0,1-25.46,36.11h0c-10.39,9.06-21.55,14.38-30.1,14.43h0" fill="none" stroke="${r.color}" stroke-width="${r.thickness}"/></svg> | ||
`}function _e(r){var o,m,l,g,s,c;let a={enabled:(o=r==null?void 0:r.enabled)!=null?o:!0,backgroundColor:(m=r==null?void 0:r.backgroundColor)!=null?m:"black",backgroundOpacity:(l=r==null?void 0:r.backgroundOpacity)!=null?l:.6,frameColor:(g=r==null?void 0:r.frameColor)!=null?g:"white",frameThickness:(s=r==null?void 0:r.frameThickness)!=null?s:3,type:(c=r==null?void 0:r.type)!=null?c:"face"};function i(){if(a.type=="face")return{mask:Fe({color:a.backgroundColor,opacity:a.backgroundOpacity}),frame:We({color:a.frameColor,thickness:a.frameThickness})}}let t=i(),n=(0,xe.r)({tag:"div",style:{width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},children:[(0,xe.r)({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:t==null?void 0:t.mask}),(0,xe.r)({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:t==null?void 0:t.frame})]});return{get element(){return n}}}function q(){throw Ue}var G=require("face-api.js"),Pe=require("@4backs/render-function");function Ve(r){var d,f,u,P,L,w,v,R,z,y;let{canTakePhotoCallback:a,modelsDirectory:i,enabled:t,subtitle:n,title:e}=r,o={enabled:(d=e==null?void 0:e.enabled)!=null?d:!1,color:(f=e==null?void 0:e.color)!=null?f:"white",content:(u=e==null?void 0:e.content)!=null?u:"Captura Facial",fontSize:(P=e==null?void 0:e.fontSize)!=null?P:"1.5rem",fontWeight:(L=e==null?void 0:e.fontWeight)!=null?L:"600"},m={enabled:(w=n==null?void 0:n.enabled)!=null?w:!0,color:(v=n==null?void 0:n.color)!=null?v:"white",content:(R=n==null?void 0:n.content)!=null?R:"",fontSize:(z=n==null?void 0:n.fontSize)!=null?z:"1rem",fontWeight:(y=n==null?void 0:n.fontWeight)!=null?y:"normal"},l=(0,Pe.r)({tag:"p",style:{color:m.color,fontWeight:m.fontWeight,fontSize:m.fontSize,textAlign:"center",margin:"0",padding:"0"},children:m.content}),g=(0,Pe.r)({tag:"div",style:{position:"absolute",top:"6%",right:"0",left:"0"},children:[(0,Pe.r)({tag:"p",children:o.content,style:{color:o.color,fontWeight:o.fontWeight,fontSize:o.fontSize,textAlign:"center",padding:"0",margin:"0"}}),l]}),s=!1;async function c(){let k=document.querySelector("#biopass_camera");if(k&&s){let p=await(0,G.detectAllFaces)(k,new G.TinyFaceDetectorOptions);if(p.length==0)l.innerText="Nenhuma face detectada",a(!1);else if(p.length>1)l.innerText="M\xFAltiplas faces detectadas",a(!1);else if(p.length==1){let E=p[0].relativeBox,b={x:E.x+E.width/2,y:E.y+E.height/2},M=p[0].imageWidth<p[0].imageHeight,H=M?.4:.45,S=M?.6:.55,B=.5,D=.6;b.x<H?(l.innerText="Mova seu rosto para a esquerda",a(!1)):b.x>S?(l.innerText="Mova seu rosto para a direita",a(!1)):b.y<B?(l.innerText="Mova seu rosto para baixo",a(!1)):b.y>D?(l.innerText="Mova seu rosto para cima",a(!1)):(l.innerText="Mantenha o rosto parado",a(!0))}setTimeout(()=>{requestAnimationFrame(()=>c())},100)}}async function x(){s=!0,t&&c()}async function T(){t&&await(0,G.loadTinyFaceDetectorModel)(i)}async function C(){s=!1}return{get element(){return g},startCapture:x,loadModel:T,stop:C}}var Qe=require("@4backs/render-function");function we(r){var f,u,P,L,w,v,R,z,y,k,p,E,b,M,H,S,B,D,_,A,I,F;let{onClick:a,active:i,options:t,top:n,left:e,right:o,svgIconCreator:m}=r,l={enabled:(u=(f=t==null?void 0:t.icon)==null?void 0:f.enabled)!=null?u:!0,color:(L=(P=t==null?void 0:t.icon)==null?void 0:P.color)!=null?L:"white",size:(v=(w=t==null?void 0:t.icon)==null?void 0:w.size)!=null?v:"30px",source:(z=(R=t==null?void 0:t.icon)==null?void 0:R.source)!=null?z:""},g={enabled:((y=t==null?void 0:t.label)==null?void 0:y.enabled)||((k=t==null?void 0:t.label)==null?void 0:k.content)!=null&&((p=t==null?void 0:t.label)==null?void 0:p.content.length)>0,color:(b=(E=t==null?void 0:t.label)==null?void 0:E.color)!=null?b:"black",content:(H=(M=t==null?void 0:t.label)==null?void 0:M.content)!=null?H:"",fontSize:(B=(S=t==null?void 0:t.label)==null?void 0:S.fontSize)!=null?B:"1rem",fontWeight:(_=(D=t==null?void 0:t.label)==null?void 0:D.fontWeight)!=null?_:"normal"},s=(A=t==null?void 0:t.backgroundColor)!=null?A:"transparent",c=(I=t==null?void 0:t.size)!=null?I:"50px",x=g.enabled?"0 25px":"0",T=(F=t==null?void 0:t.padding)!=null?F:x,C=(0,Qe.r)({tag:"div",style:{position:"absolute",top:n,left:e,right:o,opacity:i?"1":"0",pointerEvents:i?"all":"none"},children:[Z({backgroundColor:s,size:c,onPressed:a,icon:l,label:g,svgIconCreator:m,padding:T})]}),h={get element(){return C},active:i};return new Proxy(h,{get:(V,W)=>{if(W in V)return V[W]},set(V,W,$){return W==="element"||W==="active"&&($?(C.style.opacity="1",C.style.pointerEvents="all"):(C.style.opacity="0",C.style.pointerEvents="none")),!0}})}function Ee(r){return` | ||
`}function ne(e){return`<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350"><path d="M282.83,266.07v-.5h0c-8.56-.11-19.66-5.37-30.11-14.43A91.58,91.58,0,0,1,227.27,215c-3.94-10.52-5.65-23.78-7.27-36.41h0l-.08-.57h0c-.42-3.5-.85-6.95-1.34-10.27-3.53-24.3.67-45.35,11.67-60.33,10.63-14.54,27.78-23.52,50.82-24h3.77c23.09.49,40.25,9.47,50.94,24,10.93,15,15.13,36,11.55,60.33h0c-.17,1.29-.35,2.62-.52,3.95-.28,2.07-.57,4.18-.82,6.32-1.6,12.79-3.35,26.3-7.36,37a91.33,91.33,0,0,1-25.46,36.11h0c-10.39,9.06-21.55,14.38-30.1,14.43h0" fill="none" stroke="${e.color}" stroke-width="${e.thickness}"/></svg> | ||
`}function oe(e){let n={enabled:e?.enabled??!0,backgroundColor:e?.backgroundColor??"black",backgroundOpacity:e?.backgroundOpacity??.6,frameColor:e?.frameColor??"white",frameThickness:e?.frameThickness??3,type:e?.type??"face"};function r(){if(n.type=="face")return{mask:te({color:n.backgroundColor,opacity:n.backgroundOpacity}),frame:ne({color:n.frameColor,thickness:n.frameThickness})}}let i=r(),t=(0,F.r)({tag:"div",style:{width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},children:[(0,F.r)({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:i?.mask}),(0,F.r)({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:i?.frame})]});return{get element(){return t}}}function y(){throw pe}var B=require("face-api.js"),W=require("@4backs/render-function");function ie(e){let{canTakePhotoCallback:n,modelsDirectory:r,enabled:i,subtitle:t,title:o}=e,c={enabled:o?.enabled??!1,color:o?.color??"white",content:o?.content??"Captura Facial",fontSize:o?.fontSize??"1.5rem",fontWeight:o?.fontWeight??"600"},d={enabled:t?.enabled??!0,color:t?.color??"white",content:t?.content??"",fontSize:t?.fontSize??"1rem",fontWeight:t?.fontWeight??"normal"},s=(0,W.r)({tag:"p",style:{color:d.color,fontWeight:d.fontWeight,fontSize:d.fontSize,textAlign:"center",margin:"0",padding:"0"},children:d.content}),m=(0,W.r)({tag:"div",style:{position:"absolute",top:"6%",right:"0",left:"0"},children:[(0,W.r)({tag:"p",children:c.content,style:{color:c.color,fontWeight:c.fontWeight,fontSize:c.fontSize,textAlign:"center",padding:"0",margin:"0"}}),s]}),l=!1;async function a(){let C=document.querySelector("#biopass_camera");if(C&&l){let b=await(0,B.detectAllFaces)(C,new B.TinyFaceDetectorOptions);if(b.length==0)s.innerText="Nenhuma face detectada",n(!1);else if(b.length>1)s.innerText="M\xFAltiplas faces detectadas",n(!1);else if(b.length==1){let u=b[0].relativeBox,v={x:u.x+u.width/2,y:u.y+u.height/2},w=b[0].imageWidth<b[0].imageHeight,x=w?.4:.45,h=w?.6:.55,I=.5,O=.6;v.x<x?(s.innerText="Mova seu rosto para a esquerda",n(!1)):v.x>h?(s.innerText="Mova seu rosto para a direita",n(!1)):v.y<I?(s.innerText="Mova seu rosto para baixo",n(!1)):v.y>O?(s.innerText="Mova seu rosto para cima",n(!1)):(s.innerText="Mantenha o rosto parado",n(!0))}setTimeout(()=>{requestAnimationFrame(()=>a())},100)}}async function g(){l=!0,i&&a()}async function k(){i&&await(0,B.loadTinyFaceDetectorModel)(r)}async function f(){l=!1}return{get element(){return m},startCapture:g,loadModel:k,stop:f}}var be=require("@4backs/render-function");function _(e){let{onClick:n,active:r,options:i,top:t,left:o,right:c,svgIconCreator:d}=e,s={enabled:i?.icon?.enabled??!0,color:i?.icon?.color??"white",size:i?.icon?.size??"30px",source:i?.icon?.source??""},m={enabled:i?.label?.enabled||i?.label?.content!=null&&i?.label?.content.length>0,color:i?.label?.color??"black",content:i?.label?.content??"",fontSize:i?.label?.fontSize??"1rem",fontWeight:i?.label?.fontWeight??"normal"},l=i?.backgroundColor??"transparent",a=i?.size??"50px",g=m.enabled?"0 25px":"0",k=i?.padding??g,f=(0,be.r)({tag:"div",style:{position:"absolute",top:t,left:o,right:c,opacity:r?"1":"0",pointerEvents:r?"all":"none"},children:[P({backgroundColor:l,size:a,onPressed:n,icon:s,label:m,svgIconCreator:d,padding:k})]}),p={get element(){return f},active:r};return new Proxy(p,{get:(b,u)=>{if(u in b)return b[u]},set(b,u,v){return u==="element"||u==="active"&&(v?(f.style.opacity="1",f.style.pointerEvents="all"):(f.style.opacity="0",f.style.pointerEvents="none")),!0}})}function V(e){return` | ||
<svg preserveAspectRatio="xMidYMin meet" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1408 11.3621C12.9871 10.7967 13.982 10.4949 14.9997 10.4949C16.3645 10.4949 17.6734 11.037 18.6384 12.0021C19.6035 12.9671 20.1456 14.276 20.1456 15.6408C20.1456 16.6585 19.8438 17.6534 19.2784 18.4997C18.7129 19.3459 17.9093 20.0055 16.969 20.395C16.0287 20.7844 14.994 20.8863 13.9958 20.6878C12.9976 20.4892 12.0807 19.9991 11.361 19.2795C10.6414 18.5598 10.1513 17.6429 9.95272 16.6447C9.75416 15.6465 9.85607 14.6118 10.2455 13.6715C10.635 12.7312 11.2946 11.9276 12.1408 11.3621ZM16.1279 12.9172C15.5892 12.6941 14.9965 12.6357 14.4246 12.7495C13.8528 12.8632 13.3275 13.144 12.9152 13.5563C12.5029 13.9685 12.2222 14.4938 12.1084 15.0657C11.9947 15.6375 12.0531 16.2302 12.2762 16.7689C12.4993 17.3076 12.8772 17.768 13.3619 18.0919C13.8467 18.4158 14.4167 18.5887 14.9997 18.5887C15.7816 18.5887 16.5314 18.2781 17.0842 17.7253C17.6371 17.1724 17.9477 16.4226 17.9477 15.6408C17.9477 15.0577 17.7748 14.4878 17.4509 14.003C17.1269 13.5182 16.6665 13.1404 16.1279 12.9172Z" fill="${r}"/> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.4541 3.75003C19.2417 3.74699 20.0109 3.989 20.6549 4.44254C21.2979 4.89536 21.7844 5.53665 22.0472 6.27781L22.5334 7.79695H24.4426C24.9466 7.79688 25.4455 7.89714 25.9103 8.0919C26.3752 8.28666 26.7966 8.57201 27.15 8.93132C27.5034 9.29062 27.7818 9.71669 27.9688 10.1847C28.1559 10.6527 28.2478 11.1532 28.2394 11.6571V22.4531C28.2394 23.4601 27.8394 24.4258 27.1274 25.1379C26.4153 25.85 25.4495 26.25 24.4425 26.25H5.55692C4.54992 26.25 3.58416 25.85 2.8721 25.1379C2.16004 24.4258 1.76001 23.4601 1.76001 22.4531V11.6613C1.76001 10.6543 2.16004 9.68854 2.8721 8.97648C3.58416 8.26443 4.54992 7.86439 5.55692 7.86439H7.4661L7.9529 6.34312C8.20491 5.58928 8.68715 4.93351 9.33167 4.46829C9.97653 4.0028 10.7513 3.75157 11.5466 3.75003L18.4541 3.75003ZM10.6796 6.24673C10.9521 6.05169 11.279 5.94719 11.6141 5.94797H18.5203C18.8554 5.94719 19.1822 6.05169 19.4547 6.24673C19.7273 6.44184 19.9317 6.71769 20.0389 7.03528L20.0395 7.03708L20.7677 9.24873C20.8383 9.458 20.9704 9.64115 21.1466 9.77429C21.3215 9.90648 21.532 9.98328 21.7509 9.99489H24.4425C24.8666 9.99489 25.2733 10.1634 25.5732 10.4632C25.873 10.7631 26.0415 11.1698 26.0415 11.5939V22.3856C26.0415 22.8097 25.873 23.2164 25.5732 23.5163C25.2733 23.8161 24.8666 23.9846 24.4425 23.9846H5.55692C5.13285 23.9846 4.72615 23.8161 4.42628 23.5163C4.12642 23.2164 3.95795 22.8097 3.95795 22.3856V11.5939C3.95795 11.1698 4.12642 10.7631 4.42628 10.4632C4.72615 10.1634 5.13285 9.99489 5.55692 9.99489L8.2679 9.99523C8.50755 10.0077 8.7447 9.94146 8.94315 9.80652C9.14139 9.67171 9.29034 9.47511 9.36687 9.24793L10.0948 7.03709L10.0954 7.03528C10.2027 6.71769 10.4071 6.44184 10.6796 6.24673Z" fill="${r}"/> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1408 11.3621C12.9871 10.7967 13.982 10.4949 14.9997 10.4949C16.3645 10.4949 17.6734 11.037 18.6384 12.0021C19.6035 12.9671 20.1456 14.276 20.1456 15.6408C20.1456 16.6585 19.8438 17.6534 19.2784 18.4997C18.7129 19.3459 17.9093 20.0055 16.969 20.395C16.0287 20.7844 14.994 20.8863 13.9958 20.6878C12.9976 20.4892 12.0807 19.9991 11.361 19.2795C10.6414 18.5598 10.1513 17.6429 9.95272 16.6447C9.75416 15.6465 9.85607 14.6118 10.2455 13.6715C10.635 12.7312 11.2946 11.9276 12.1408 11.3621ZM16.1279 12.9172C15.5892 12.6941 14.9965 12.6357 14.4246 12.7495C13.8528 12.8632 13.3275 13.144 12.9152 13.5563C12.5029 13.9685 12.2222 14.4938 12.1084 15.0657C11.9947 15.6375 12.0531 16.2302 12.2762 16.7689C12.4993 17.3076 12.8772 17.768 13.3619 18.0919C13.8467 18.4158 14.4167 18.5887 14.9997 18.5887C15.7816 18.5887 16.5314 18.2781 17.0842 17.7253C17.6371 17.1724 17.9477 16.4226 17.9477 15.6408C17.9477 15.0577 17.7748 14.4878 17.4509 14.003C17.1269 13.5182 16.6665 13.1404 16.1279 12.9172Z" fill="${e}"/> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.4541 3.75003C19.2417 3.74699 20.0109 3.989 20.6549 4.44254C21.2979 4.89536 21.7844 5.53665 22.0472 6.27781L22.5334 7.79695H24.4426C24.9466 7.79688 25.4455 7.89714 25.9103 8.0919C26.3752 8.28666 26.7966 8.57201 27.15 8.93132C27.5034 9.29062 27.7818 9.71669 27.9688 10.1847C28.1559 10.6527 28.2478 11.1532 28.2394 11.6571V22.4531C28.2394 23.4601 27.8394 24.4258 27.1274 25.1379C26.4153 25.85 25.4495 26.25 24.4425 26.25H5.55692C4.54992 26.25 3.58416 25.85 2.8721 25.1379C2.16004 24.4258 1.76001 23.4601 1.76001 22.4531V11.6613C1.76001 10.6543 2.16004 9.68854 2.8721 8.97648C3.58416 8.26443 4.54992 7.86439 5.55692 7.86439H7.4661L7.9529 6.34312C8.20491 5.58928 8.68715 4.93351 9.33167 4.46829C9.97653 4.0028 10.7513 3.75157 11.5466 3.75003L18.4541 3.75003ZM10.6796 6.24673C10.9521 6.05169 11.279 5.94719 11.6141 5.94797H18.5203C18.8554 5.94719 19.1822 6.05169 19.4547 6.24673C19.7273 6.44184 19.9317 6.71769 20.0389 7.03528L20.0395 7.03708L20.7677 9.24873C20.8383 9.458 20.9704 9.64115 21.1466 9.77429C21.3215 9.90648 21.532 9.98328 21.7509 9.99489H24.4425C24.8666 9.99489 25.2733 10.1634 25.5732 10.4632C25.873 10.7631 26.0415 11.1698 26.0415 11.5939V22.3856C26.0415 22.8097 25.873 23.2164 25.5732 23.5163C25.2733 23.8161 24.8666 23.9846 24.4425 23.9846H5.55692C5.13285 23.9846 4.72615 23.8161 4.42628 23.5163C4.12642 23.2164 3.95795 22.8097 3.95795 22.3856V11.5939C3.95795 11.1698 4.12642 10.7631 4.42628 10.4632C4.72615 10.1634 5.13285 9.99489 5.55692 9.99489L8.2679 9.99523C8.50755 10.0077 8.7447 9.94146 8.94315 9.80652C9.14139 9.67171 9.29034 9.47511 9.36687 9.24793L10.0948 7.03709L10.0954 7.03528C10.2027 6.71769 10.4071 6.44184 10.6796 6.24673Z" fill="${e}"/> | ||
</svg> | ||
`}function Me(r){return` | ||
`}function Z(e){return` | ||
<svg preserveAspectRatio="xMidYMin meet" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M26.8073 6.52089C26.6436 6.35584 26.4489 6.22483 26.2343 6.13543C26.0197 6.04603 25.7895 6 25.557 6C25.3246 6 25.0944 6.04603 24.8798 6.13543C24.6652 6.22483 24.4705 6.35584 24.3068 6.52089L11.1875 19.6578L5.67561 14.1283C5.50564 13.9641 5.30499 13.835 5.08512 13.7484C4.86525 13.6617 4.63047 13.6192 4.39418 13.6233C4.1579 13.6274 3.92473 13.678 3.70799 13.7722C3.49125 13.8664 3.29519 14.0024 3.131 14.1723C2.96681 14.3423 2.8377 14.543 2.75105 14.7628C2.66441 14.9827 2.62191 15.2175 2.626 15.4538C2.63009 15.6901 2.68068 15.9232 2.77488 16.14C2.86908 16.3567 3.00505 16.5528 3.17502 16.717L9.93718 23.4791C10.1009 23.6442 10.2956 23.7752 10.5102 23.8646C10.7248 23.954 10.955 24 11.1875 24C11.4199 24 11.6501 23.954 11.8647 23.8646C12.0793 23.7752 12.2741 23.6442 12.4378 23.4791L26.8073 9.10953C26.9861 8.94463 27.1287 8.74449 27.2263 8.52173C27.3239 8.29897 27.3743 8.05841 27.3743 7.81521C27.3743 7.57202 27.3239 7.33146 27.2263 7.1087C27.1287 6.88593 26.9861 6.6858 26.8073 6.52089Z" fill="${r}"/> | ||
<path d="M26.8073 6.52089C26.6436 6.35584 26.4489 6.22483 26.2343 6.13543C26.0197 6.04603 25.7895 6 25.557 6C25.3246 6 25.0944 6.04603 24.8798 6.13543C24.6652 6.22483 24.4705 6.35584 24.3068 6.52089L11.1875 19.6578L5.67561 14.1283C5.50564 13.9641 5.30499 13.835 5.08512 13.7484C4.86525 13.6617 4.63047 13.6192 4.39418 13.6233C4.1579 13.6274 3.92473 13.678 3.70799 13.7722C3.49125 13.8664 3.29519 14.0024 3.131 14.1723C2.96681 14.3423 2.8377 14.543 2.75105 14.7628C2.66441 14.9827 2.62191 15.2175 2.626 15.4538C2.63009 15.6901 2.68068 15.9232 2.77488 16.14C2.86908 16.3567 3.00505 16.5528 3.17502 16.717L9.93718 23.4791C10.1009 23.6442 10.2956 23.7752 10.5102 23.8646C10.7248 23.954 10.955 24 11.1875 24C11.4199 24 11.6501 23.954 11.8647 23.8646C12.0793 23.7752 12.2741 23.6442 12.4378 23.4791L26.8073 9.10953C26.9861 8.94463 27.1287 8.74449 27.2263 8.52173C27.3239 8.29897 27.3743 8.05841 27.3743 7.81521C27.3743 7.57202 27.3239 7.33146 27.2263 7.1087C27.1287 6.88593 26.9861 6.6858 26.8073 6.52089Z" fill="${e}"/> | ||
</svg> | ||
`}function X(r){return` | ||
`}function M(e){return` | ||
<svg preserveAspectRatio="xMidYMin meet" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M17.1133 14.9987L23.558 8.56902C23.8402 8.2868 23.9988 7.90402 23.9988 7.5049C23.9988 7.10577 23.8402 6.723 23.558 6.44077C23.2758 6.15855 22.893 6 22.4939 6C22.0948 6 21.712 6.15855 21.4298 6.44077L15.0001 12.8855L8.57036 6.44077C8.28813 6.15855 7.90536 6 7.50623 6C7.10711 6 6.72433 6.15855 6.44211 6.44077C6.15989 6.723 6.00134 7.10577 6.00134 7.5049C6.00134 7.90402 6.15989 8.2868 6.44211 8.56902L12.8868 14.9987L6.44211 21.4284C6.30163 21.5678 6.19014 21.7335 6.11405 21.9162C6.03795 22.0988 5.99878 22.2947 5.99878 22.4925C5.99878 22.6904 6.03795 22.8863 6.11405 23.0689C6.19014 23.2516 6.30163 23.4173 6.44211 23.5567C6.58144 23.6971 6.74721 23.8086 6.92984 23.8847C7.11248 23.9608 7.30838 24 7.50623 24C7.70409 24 7.89999 23.9608 8.08262 23.8847C8.26526 23.8086 8.43103 23.6971 8.57036 23.5567L15.0001 17.112L21.4298 23.5567C21.5691 23.6971 21.7349 23.8086 21.9175 23.8847C22.1001 23.9608 22.296 24 22.4939 24C22.6917 24 22.8876 23.9608 23.0703 23.8847C23.2529 23.8086 23.4187 23.6971 23.558 23.5567C23.6985 23.4173 23.81 23.2516 23.8861 23.0689C23.9622 22.8863 24.0013 22.6904 24.0013 22.4925C24.0013 22.2947 23.9622 22.0988 23.8861 21.9162C23.81 21.7335 23.6985 21.5678 23.558 21.4284L17.1133 14.9987Z" fill="${r}"/> | ||
<path d="M17.1133 14.9987L23.558 8.56902C23.8402 8.2868 23.9988 7.90402 23.9988 7.5049C23.9988 7.10577 23.8402 6.723 23.558 6.44077C23.2758 6.15855 22.893 6 22.4939 6C22.0948 6 21.712 6.15855 21.4298 6.44077L15.0001 12.8855L8.57036 6.44077C8.28813 6.15855 7.90536 6 7.50623 6C7.10711 6 6.72433 6.15855 6.44211 6.44077C6.15989 6.723 6.00134 7.10577 6.00134 7.5049C6.00134 7.90402 6.15989 8.2868 6.44211 8.56902L12.8868 14.9987L6.44211 21.4284C6.30163 21.5678 6.19014 21.7335 6.11405 21.9162C6.03795 22.0988 5.99878 22.2947 5.99878 22.4925C5.99878 22.6904 6.03795 22.8863 6.11405 23.0689C6.19014 23.2516 6.30163 23.4173 6.44211 23.5567C6.58144 23.6971 6.74721 23.8086 6.92984 23.8847C7.11248 23.9608 7.30838 24 7.50623 24C7.70409 24 7.89999 23.9608 8.08262 23.8847C8.26526 23.8086 8.43103 23.6971 8.57036 23.5567L15.0001 17.112L21.4298 23.5567C21.5691 23.6971 21.7349 23.8086 21.9175 23.8847C22.1001 23.9608 22.296 24 22.4939 24C22.6917 24 22.8876 23.9608 23.0703 23.8847C23.2529 23.8086 23.4187 23.6971 23.558 23.5567C23.6985 23.4173 23.81 23.2516 23.8861 23.0689C23.9622 22.8863 24.0013 22.6904 24.0013 22.4925C24.0013 22.2947 23.9622 22.0988 23.8861 21.9162C23.81 21.7335 23.6985 21.5678 23.558 21.4284L17.1133 14.9987Z" fill="${e}"/> | ||
</svg> | ||
`}function Ze(r){return` | ||
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin meet" viewBox="0 0 25 25" fill="none" ><path fill="${r}" d="M12.29,5.21l1.5,1.5a1,1,0,0,0,1.42,0,1,1,0,0,0,.13-1.21H19a1,1,0,0,0,0-2H15.34a1,1,0,0,0-.13-1.21,1,1,0,0,0-1.42,0l-1.5,1.5a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76A1,1,0,0,0,12.29,5.21ZM22.92,9.12a1,1,0,0,0-.21-.33l-1.5-1.5a1,1,0,0,0-1.42,0,1,1,0,0,0-.13,1.21H16a1,1,0,0,0,0,2h3.66a1,1,0,0,0,.13,1.21,1,1,0,0,0,1.42,0l1.5-1.5a1,1,0,0,0,.21-.33A1,1,0,0,0,22.92,9.12ZM11,10a4,4,0,1,0,4,4A4,4,0,0,0,11,10Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,11,16Zm9-3a1,1,0,0,0-1,1v5a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V11a1,1,0,0,1,1-1H6a1,1,0,0,0,1-.69l.54-1.62A1,1,0,0,1,8.44,7H10a1,1,0,0,0,0-2H8.44A3,3,0,0,0,5.59,7.06L5.28,8H4a3,3,0,0,0-3,3v8a3,3,0,0,0,3,3H18a3,3,0,0,0,3-3V14A1,1,0,0,0,20,13Z"/></svg> | ||
`}function Ie(r){var A,I,F,V,W,$,O,U,N,J,K,Q,ee,te,ne,re,ae,ie,oe,le,ce,se,de,me,ue,fe,ge,Ce;let{request:a,onCancel:i,onFinish:t,controller:n,options:e}=r,o=(I=(A=e==null?void 0:e.mask)==null?void 0:A.enabled)!=null?I:!0,m=(V=(F=e==null?void 0:e.confirmButton)==null?void 0:F.enabled)!=null?V:!0,l=($=(W=e==null?void 0:e.loading)==null?void 0:W.enabled)!=null?$:!0,g=(U=(O=e==null?void 0:e.backButton)==null?void 0:O.enabled)!=null?U:!0,s=(J=(N=e==null?void 0:e.faceDetection)==null?void 0:N.enabled)!=null?J:!0,c=(Q=(K=e==null?void 0:e.faceDetection)==null?void 0:K.autoCapture)!=null?Q:!1,x=(te=(ee=e==null?void 0:e.captureButton)==null?void 0:ee.enabled)!=null?te:!0,T=(re=(ne=e==null?void 0:e.switchButton)==null?void 0:ne.enabled)!=null?re:!0,C=x&&!c||c&&!s,h=null,d=ye({aspectRatio:(ie=(ae=e==null?void 0:e.cameraPresets)==null?void 0:ae.aspectRatio)!=null?ie:16/9,preferredResolution:(le=(oe=e==null?void 0:e.cameraPresets)==null?void 0:oe.preferredResolution)!=null?le:480,deviceId:(se=(ce=e==null?void 0:e.cameraPresets)==null?void 0:ce.deviceId)!=null?se:""}),f=ke(),u=Le({active:!1,disabled:s,onClick:b,options:e==null?void 0:e.captureButton}),P=Re({active:!1,onFinish:M,onCancel:H,cancelButtonOptions:e==null?void 0:e.cancelButton,confirmButtonOptions:e==null?void 0:e.confirmButton}),L=Te(""),w=ze({active:!1,options:e==null?void 0:e.loading}),v=Ve({canTakePhotoCallback:p,modelsDirectory:(de=e==null?void 0:e.modelsDirectory)!=null?de:"/models",enabled:s,subtitle:(me=e==null?void 0:e.legend)==null?void 0:me.subtitle,title:(ue=e==null?void 0:e.legend)==null?void 0:ue.title}),R=_e(e==null?void 0:e.mask),z=we({active:!1,onClick:B,options:e==null?void 0:e.backButton,svgIconCreator:X,left:"0",top:"10px"}),y=we({active:!1,onClick:()=>E(),options:e==null?void 0:e.switchButton,svgIconCreator:Ze,right:"0",top:"10px"}),k=null;function p(Y){u.disabled=!Y,Y?Y&&c&&!k&&(k=setTimeout(()=>{b(),M()},3e3)):(clearTimeout(k),k=null)}async function E(){v.stop(),await d.switchCamera(),v.startCapture()}function b(){d.checkIfIsInitialized()&&(h=f.takePicture(d.element),L.image=h.base64,u.active=!1,P.active=!0,y.active=!1,n&&(n.confirmPicture=M,n.rejectPicture=H,n.takePicture=q))}async function M(){P.active=!1,w.active=!0,n&&(n.confirmPicture=q,n.rejectPicture=q,n.takePicture=q,n.cancel=q);try{await a(h)}finally{d.dispose(),v.stop(),t(),w.active=!1,L.image=""}}function H(){h=null,L.image="",P.active=!1,u.active=!0,y.active=!0,n&&(n.confirmPicture=q,n.rejectPicture=q,n.takePicture=b)}async function S(){await d.initCamera(),s?(await v.loadModel(),v.startCapture()):u.active=!0,z.active=!0,y.active=!0}function B(){n&&(n.confirmPicture=q,n.rejectPicture=q,n.takePicture=q,n.cancel=q),h=null,d.dispose(),v.stop(),i()}let D=(0,j.r)({tag:"div",style:{position:"relative",width:(fe=e==null?void 0:e.width)!=null?fe:"100%",height:(ge=e==null?void 0:e.height)!=null?ge:"100%",fontFamily:(Ce=e==null?void 0:e.fontFamily)!=null?Ce:"inherit"},children:[d.element,o?R.element:(0,j.r)({tag:"div"}),v.element,C?u.element:(0,j.r)({tag:"div"}),L.element,m?P.element:(0,j.r)({tag:"div"}),l?w.element:(0,j.r)({tag:"div"}),g?z.element:(0,j.r)({tag:"div"}),T?y.element:(0,j.r)({tag:"div"})]});return n&&(n.cancel=B,n.takePicture=b),{get element(){return D},initCamera:S}}var et=ve(require("@4backs/render-function/r"));function Te(r){let a=(0,et.default)({tag:"img",style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",objectFit:"cover",opacity:r.length>0?"1":"0",transition:".3s",display:r.length>0?"block":"none",transform:"scaleX(-1)"}});r.length>0&&a.setAttribute("src",r);let i={get element(){return a},image:r};return new Proxy(i,{get:(n,e)=>{if(e in n)return n[e]},set(n,e,o){if(e==="element")return!0;if(e==="image"){let m=n.element.getAttribute("src")!=null&&n.element.getAttribute("src").length>0;m&&o.length>0?n.element.setAttribute("src",o):m&&o.length==0?(n.element.style.opacity="0",setTimeout(()=>{n.element.style.display="none",n.element.setAttribute("src","")},300)):!m&&o.length>0&&(n.element.style.opacity="0",n.element.style.display="block",n.element.setAttribute("src",o),setTimeout(()=>{n.element.style.opacity="1"},50)),n.image=o}return!0}})}var tt=ve(require("@4backs/render-function/r"));function Le(r){var C,h,d,f,u,P,L,w,v,R,z,y,k,p,E,b,M,H,S,B,D,_;let{onClick:a,active:i,options:t,disabled:n}=r,e={enabled:(h=(C=t==null?void 0:t.icon)==null?void 0:C.enabled)!=null?h:!0,color:(f=(d=t==null?void 0:t.icon)==null?void 0:d.color)!=null?f:"black",size:(P=(u=t==null?void 0:t.icon)==null?void 0:u.size)!=null?P:"30px",source:(w=(L=t==null?void 0:t.icon)==null?void 0:L.source)!=null?w:""},o={enabled:((v=t==null?void 0:t.label)==null?void 0:v.enabled)||((R=t==null?void 0:t.label)==null?void 0:R.content)!=null&&((z=t==null?void 0:t.label)==null?void 0:z.content.length)>0,color:(k=(y=t==null?void 0:t.label)==null?void 0:y.color)!=null?k:"black",content:(E=(p=t==null?void 0:t.label)==null?void 0:p.content)!=null?E:"",fontSize:(M=(b=t==null?void 0:t.label)==null?void 0:b.fontSize)!=null?M:"1rem",fontWeight:(S=(H=t==null?void 0:t.label)==null?void 0:H.fontWeight)!=null?S:"normal"},m=(B=t==null?void 0:t.backgroundColor)!=null?B:"white",l=(D=t==null?void 0:t.size)!=null?D:"50px",g=o.enabled?"0 25px":"0",s=(_=t==null?void 0:t.padding)!=null?_:g,c=(0,tt.default)({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:n?".3":"1",pointerEvents:i&&!n?"all":"none"},children:[Z({backgroundColor:m,size:l,onPressed:a,icon:e,label:o,svgIconCreator:Ee,padding:s})]}),x={get element(){return c},disabled:n,active:i};return new Proxy(x,{get:(A,I)=>{if(I in A)return A[I]},set(A,I,F){return I==="element"||(I==="active"?F?(c.style.opacity="1",c.style.pointerEvents="all"):(c.style.opacity="0",c.style.pointerEvents="none"):I=="disabled"&&(F?(c.style.opacity=".3",c.style.pointerEvents="none"):(c.style.opacity="1",c.style.pointerEvents="all"))),!0}})}var He=ve(require("@4backs/render-function/r"));function ze(r){var s,c,x,T,C,h;let{active:a,options:i}=r,t={enabled:(s=i==null?void 0:i.enabled)!=null?s:!0,backgroundColor:(c=i==null?void 0:i.backgroundColor)!=null?c:"white",dotsColor:(x=i==null?void 0:i.dotsColor)!=null?x:"black",dotsSize:(T=i==null?void 0:i.dotsSize)!=null?T:"5px",dotsSpacing:(C=i==null?void 0:i.dotsSpacing)!=null?C:"3px",size:(h=i==null?void 0:i.size)!=null?h:"50px"};function n(d){return(0,He.default)({tag:"div",attributes:{class:"loading_dot"},style:{width:t.dotsSize,height:t.dotsSize,borderRadius:"9999px",background:t.dotsColor,marginRight:d?void 0:t.dotsSpacing,opacity:".5"}})}let e=(0,He.default)({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:a?"1":"0",pointerEvents:a?"all":"none"},children:[(0,He.default)({tag:"div",style:{width:t.size,height:t.size,background:t.backgroundColor,borderRadius:"9999px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 25px"},children:Array(3).fill(void 0).map((d,f)=>n(f==2))})]}),o={get element(){return e},active:a};function m(){let d=Array.from(e.querySelectorAll(".loading_dot"));d&&typeof document.body.animate<"u"&&d.forEach(f=>{f.getAnimations().forEach(u=>u.cancel())})}function l(){let d=Array.from(e.querySelectorAll(".loading_dot"));d&&typeof document.body.animate<"u"&&d.forEach((f,u)=>{f.animate([{opacity:".5",transform:"scale(.8)"},{opacity:"1",transform:"scale(1)"},{opacity:"1",transform:"scale(1)"},{opacity:".5",transform:"scale(.8)"}],{duration:1e3,iterations:1/0,delay:u*100})})}return a&&l(),new Proxy(o,{get:(d,f)=>{if(f in d)return d[f]},set(d,f,u){return f==="element"||f==="active"&&(m(),u?(e.style.opacity="1",l()):e.style.opacity="0"),!0}})}var nt=ve(require("@4backs/render-function/r"));function Re(r){var w,v,R,z,y,k,p,E,b,M,H,S,B,D,_,A,I,F,V,W,$,O,U,N,J,K,Q,ee,te,ne,re,ae,ie,oe,le,ce,se,de,me,ue,fe,ge,Ce,Y;let{onFinish:a,onCancel:i,active:t,cancelButtonOptions:n,confirmButtonOptions:e}=r,o={enabled:(v=(w=n==null?void 0:n.icon)==null?void 0:w.enabled)!=null?v:!0,color:(z=(R=n==null?void 0:n.icon)==null?void 0:R.color)!=null?z:"white",size:(k=(y=n==null?void 0:n.icon)==null?void 0:y.size)!=null?k:"30px",source:(E=(p=n==null?void 0:n.icon)==null?void 0:p.source)!=null?E:""},m={enabled:((b=n==null?void 0:n.label)==null?void 0:b.enabled)||((M=n==null?void 0:n.label)==null?void 0:M.content)!=null&&((H=n==null?void 0:n.label)==null?void 0:H.content.length)>0,color:(B=(S=n==null?void 0:n.label)==null?void 0:S.color)!=null?B:"white",content:(_=(D=n==null?void 0:n.label)==null?void 0:D.content)!=null?_:"",fontSize:(I=(A=n==null?void 0:n.label)==null?void 0:A.fontSize)!=null?I:"1rem",fontWeight:(V=(F=n==null?void 0:n.label)==null?void 0:F.fontWeight)!=null?V:"normal"},l=(W=n==null?void 0:n.backgroundColor)!=null?W:"red",g=($=n==null?void 0:n.size)!=null?$:"50px",s=m.enabled?"0 25px":"0",c=(O=n==null?void 0:n.padding)!=null?O:s,x={enabled:(N=(U=e==null?void 0:e.icon)==null?void 0:U.enabled)!=null?N:!0,color:(K=(J=e==null?void 0:e.icon)==null?void 0:J.color)!=null?K:"black",size:(ee=(Q=e==null?void 0:e.icon)==null?void 0:Q.size)!=null?ee:"30px",source:(ne=(te=e==null?void 0:e.icon)==null?void 0:te.source)!=null?ne:""},T={enabled:((re=e==null?void 0:e.label)==null?void 0:re.enabled)||((ae=e==null?void 0:e.label)==null?void 0:ae.content)!=null&&((ie=e==null?void 0:e.label)==null?void 0:ie.content.length)>0,color:(le=(oe=e==null?void 0:e.label)==null?void 0:oe.color)!=null?le:"black",content:(se=(ce=e==null?void 0:e.label)==null?void 0:ce.content)!=null?se:"",fontSize:(me=(de=e==null?void 0:e.label)==null?void 0:de.fontSize)!=null?me:"1rem",fontWeight:(fe=(ue=e==null?void 0:e.label)==null?void 0:ue.fontWeight)!=null?fe:"normal"},C=(ge=e==null?void 0:e.backgroundColor)!=null?ge:"white",h=(Ce=e==null?void 0:e.size)!=null?Ce:"50px",d=T.enabled?"0 25px":"0",f=(Y=e==null?void 0:e.padding)!=null?Y:d,u=(0,nt.default)({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:t?"1":"0",pointerEvents:t?"all":"none"},children:[Z({backgroundColor:l,size:g,onPressed:i,icon:o,label:m,svgIconCreator:X,padding:c}),Z({backgroundColor:C,size:h,onPressed:a,icon:x,label:T,svgIconCreator:Me,padding:f})]}),P={get element(){return u},active:t};return new Proxy(P,{get:(Se,he)=>{if(he in Se)return Se[he]},set(Se,he,rt){return he==="element"||he==="active"&&(rt?(u.style.opacity="1",u.style.pointerEvents="all"):(u.style.opacity="0",u.style.pointerEvents="none")),!0}})}function je(r){let{data:a,request:i,onCancel:t,controller:n}=r,e=Ie({onCancel:()=>{a.element.innerHTML="",t()},onFinish:()=>{a.element.innerHTML=""},request:i,controller:n,options:a.options});a.element.innerHTML="",a.element.appendChild(e.element),e.initCamera()}async function $e(r,a){return await De()?new Promise((t,n)=>{async function e(o){try{let m=await a(o);t(m)}catch(m){throw n(m),m}}je({data:r,onCancel:()=>n(Oe),request:e,controller:r.controller})}):Promise.reject(Xe)}function Be(){function r(a){return $e(a,t=>Promise.resolve(t))}return{takePicture:r}}typeof window<"u"&&(window.useCamera=Be);module.exports=dt(mt); | ||
`}function re(e){return` | ||
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin meet" viewBox="0 0 25 25" fill="none" ><path fill="${e}" d="M12.29,5.21l1.5,1.5a1,1,0,0,0,1.42,0,1,1,0,0,0,.13-1.21H19a1,1,0,0,0,0-2H15.34a1,1,0,0,0-.13-1.21,1,1,0,0,0-1.42,0l-1.5,1.5a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76A1,1,0,0,0,12.29,5.21ZM22.92,9.12a1,1,0,0,0-.21-.33l-1.5-1.5a1,1,0,0,0-1.42,0,1,1,0,0,0-.13,1.21H16a1,1,0,0,0,0,2h3.66a1,1,0,0,0,.13,1.21,1,1,0,0,0,1.42,0l1.5-1.5a1,1,0,0,0,.21-.33A1,1,0,0,0,22.92,9.12ZM11,10a4,4,0,1,0,4,4A4,4,0,0,0,11,10Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,11,16Zm9-3a1,1,0,0,0-1,1v5a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V11a1,1,0,0,1,1-1H6a1,1,0,0,0,1-.69l.54-1.62A1,1,0,0,1,8.44,7H10a1,1,0,0,0,0-2H8.44A3,3,0,0,0,5.59,7.06L5.28,8H4a3,3,0,0,0-3,3v8a3,3,0,0,0,3,3H18a3,3,0,0,0,3-3V14A1,1,0,0,0,20,13Z"/></svg> | ||
`}function j(e){let{request:n,onCancel:r,onFinish:i,controller:t,options:o}=e,c=o?.mask?.enabled??!0,d=o?.confirmButton?.enabled??!0,s=o?.loading?.enabled??!0,m=o?.backButton?.enabled??!0,l=o?.faceDetection?.enabled??!0,a=o?.faceDetection?.autoCapture??!1,g=o?.captureButton?.enabled??!0,k=o?.switchButton?.enabled??!0,f=g&&!a||a&&!l,p=null,C=A({aspectRatio:o?.cameraPresets?.aspectRatio??16/9,preferredResolution:o?.cameraPresets?.preferredResolution??480,deviceId:o?.cameraPresets?.deviceId??""}),b=q(),u=Y({active:!1,disabled:l,onClick:H,options:o?.captureButton}),v=X({active:!1,onFinish:J,onCancel:ce,cancelButtonOptions:o?.cancelButton,confirmButtonOptions:o?.confirmButton}),w=$(""),x=G({active:!1,options:o?.loading}),h=ie({canTakePhotoCallback:xe,modelsDirectory:o?.modelsDirectory??"/models",enabled:l,subtitle:o?.legend?.subtitle,title:o?.legend?.title}),I=oe(o?.mask),O=_({active:!1,onClick:se,options:o?.backButton,svgIconCreator:M,left:"0",top:"10px"}),z=_({active:!1,onClick:()=>Pe(),options:o?.switchButton,svgIconCreator:re,right:"0",top:"10px"}),R=null;function xe(S){u.disabled=!S,S?S&&a&&!R&&(R=setTimeout(()=>{H(),J()},3e3)):(clearTimeout(R),R=null)}async function Pe(){h.stop(),await C.switchCamera(),h.startCapture()}function H(){C.checkIfIsInitialized()&&(p=b.takePicture(C.element),w.image=p.base64,u.active=!1,v.active=!0,z.active=!1,t&&(t.confirmPicture=J,t.rejectPicture=ce,t.takePicture=y))}async function J(){v.active=!1,x.active=!0,t&&(t.confirmPicture=y,t.rejectPicture=y,t.takePicture=y,t.cancel=y);try{await n(p)}finally{C.dispose(),h.stop(),i(),x.active=!1,w.image=""}}function ce(){p=null,w.image="",v.active=!1,u.active=!0,z.active=!0,t&&(t.confirmPicture=y,t.rejectPicture=y,t.takePicture=H)}async function we(){await C.initCamera(),l?(await h.loadModel(),h.startCapture()):u.active=!0,O.active=!0,z.active=!0}function se(){t&&(t.confirmPicture=y,t.rejectPicture=y,t.takePicture=y,t.cancel=y),p=null,C.dispose(),h.stop(),r()}let Ee=(0,E.r)({tag:"div",style:{position:"relative",width:o?.width??"100%",height:o?.height??"100%",fontFamily:o?.fontFamily??"inherit"},children:[C.element,c?I.element:(0,E.r)({tag:"div"}),h.element,f?u.element:(0,E.r)({tag:"div"}),w.element,d?v.element:(0,E.r)({tag:"div"}),s?x.element:(0,E.r)({tag:"div"}),m?O.element:(0,E.r)({tag:"div"}),k?z.element:(0,E.r)({tag:"div"})]});return t&&(t.cancel=se,t.takePicture=H),{get element(){return Ee},initCamera:we}}var ve=T(require("@4backs/render-function/r"));function $(e){let n=(0,ve.default)({tag:"img",style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",objectFit:"cover",opacity:e.length>0?"1":"0",transition:".3s",display:e.length>0?"block":"none",transform:"scaleX(-1)"}});e.length>0&&n.setAttribute("src",e);let r={get element(){return n},image:e};return new Proxy(r,{get:(t,o)=>{if(o in t)return t[o]},set(t,o,c){if(o==="element")return!0;if(o==="image"){let d=t.element.getAttribute("src")!=null&&t.element.getAttribute("src").length>0;d&&c.length>0?t.element.setAttribute("src",c):d&&c.length==0?(t.element.style.opacity="0",setTimeout(()=>{t.element.style.display="none",t.element.setAttribute("src","")},300)):!d&&c.length>0&&(t.element.style.opacity="0",t.element.style.display="block",t.element.setAttribute("src",c),setTimeout(()=>{t.element.style.opacity="1"},50)),t.image=c}return!0}})}var ye=T(require("@4backs/render-function/r"));function Y(e){let{onClick:n,active:r,options:i,disabled:t}=e,o={enabled:i?.icon?.enabled??!0,color:i?.icon?.color??"black",size:i?.icon?.size??"30px",source:i?.icon?.source??""},c={enabled:i?.label?.enabled||i?.label?.content!=null&&i?.label?.content.length>0,color:i?.label?.color??"black",content:i?.label?.content??"",fontSize:i?.label?.fontSize??"1rem",fontWeight:i?.label?.fontWeight??"normal"},d=i?.backgroundColor??"white",s=i?.size??"50px",m=c.enabled?"0 25px":"0",l=i?.padding??m,a=(0,ye.default)({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:t?".3":"1",pointerEvents:r&&!t?"all":"none"},children:[P({backgroundColor:d,size:s,onPressed:n,icon:o,label:c,svgIconCreator:V,padding:l})]}),g={get element(){return a},disabled:t,active:r};return new Proxy(g,{get:(f,p)=>{if(p in f)return f[p]},set(f,p,C){return p==="element"||(p==="active"?C?(a.style.opacity="1",a.style.pointerEvents="all"):(a.style.opacity="0",a.style.pointerEvents="none"):p=="disabled"&&(C?(a.style.opacity=".3",a.style.pointerEvents="none"):(a.style.opacity="1",a.style.pointerEvents="all"))),!0}})}var U=T(require("@4backs/render-function/r"));function G(e){let{active:n,options:r}=e,i={enabled:r?.enabled??!0,backgroundColor:r?.backgroundColor??"white",dotsColor:r?.dotsColor??"black",dotsSize:r?.dotsSize??"5px",dotsSpacing:r?.dotsSpacing??"3px",size:r?.size??"50px"};function t(l){return(0,U.default)({tag:"div",attributes:{class:"loading_dot"},style:{width:i.dotsSize,height:i.dotsSize,borderRadius:"9999px",background:i.dotsColor,marginRight:l?void 0:i.dotsSpacing,opacity:".5"}})}let o=(0,U.default)({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:n?"1":"0",pointerEvents:n?"all":"none"},children:[(0,U.default)({tag:"div",style:{width:i.size,height:i.size,background:i.backgroundColor,borderRadius:"9999px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 25px"},children:Array(3).fill(void 0).map((l,a)=>t(a==2))})]}),c={get element(){return o},active:n};function d(){let l=Array.from(o.querySelectorAll(".loading_dot"));l&&typeof document.body.animate<"u"&&l.forEach(a=>{a.getAnimations().forEach(g=>g.cancel())})}function s(){let l=Array.from(o.querySelectorAll(".loading_dot"));l&&typeof document.body.animate<"u"&&l.forEach((a,g)=>{a.animate([{opacity:".5",transform:"scale(.8)"},{opacity:"1",transform:"scale(1)"},{opacity:"1",transform:"scale(1)"},{opacity:".5",transform:"scale(.8)"}],{duration:1e3,iterations:1/0,delay:g*100})})}return n&&s(),new Proxy(c,{get:(l,a)=>{if(a in l)return l[a]},set(l,a,g){return a==="element"||a==="active"&&(d(),g?(o.style.opacity="1",s()):o.style.opacity="0"),!0}})}var ke=T(require("@4backs/render-function/r"));function X(e){let{onFinish:n,onCancel:r,active:i,cancelButtonOptions:t,confirmButtonOptions:o}=e,c={enabled:t?.icon?.enabled??!0,color:t?.icon?.color??"white",size:t?.icon?.size??"30px",source:t?.icon?.source??""},d={enabled:t?.label?.enabled||t?.label?.content!=null&&t?.label?.content.length>0,color:t?.label?.color??"white",content:t?.label?.content??"",fontSize:t?.label?.fontSize??"1rem",fontWeight:t?.label?.fontWeight??"normal"},s=t?.backgroundColor??"red",m=t?.size??"50px",l=d.enabled?"0 25px":"0",a=t?.padding??l,g={enabled:o?.icon?.enabled??!0,color:o?.icon?.color??"black",size:o?.icon?.size??"30px",source:o?.icon?.source??""},k={enabled:o?.label?.enabled||o?.label?.content!=null&&o?.label?.content.length>0,color:o?.label?.color??"black",content:o?.label?.content??"",fontSize:o?.label?.fontSize??"1rem",fontWeight:o?.label?.fontWeight??"normal"},f=o?.backgroundColor??"white",p=o?.size??"50px",C=k.enabled?"0 25px":"0",b=o?.padding??C,u=(0,ke.default)({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:i?"1":"0",pointerEvents:i?"all":"none"},children:[P({backgroundColor:s,size:m,onPressed:r,icon:c,label:d,svgIconCreator:M,padding:a}),P({backgroundColor:f,size:p,onPressed:n,icon:g,label:k,svgIconCreator:Z,padding:b})]}),v={get element(){return u},active:i};return new Proxy(v,{get:(x,h)=>{if(h in x)return x[h]},set(x,h,I){return h==="element"||h==="active"&&(I?(u.style.opacity="1",u.style.pointerEvents="all"):(u.style.opacity="0",u.style.pointerEvents="none")),!0}})}function ae(e){let{data:n,request:r,onCancel:i,controller:t}=e,o=j({onCancel:()=>{n.element.innerHTML="",i()},onFinish:()=>{n.element.innerHTML=""},request:r,controller:t,options:n.options});n.element.innerHTML="",n.element.appendChild(o.element),o.initCamera()}async function le(e,n){return await K()?new Promise((i,t)=>{async function o(c){try{let d=await n(c);i(d)}catch(d){throw t(d),d}}ae({data:e,onCancel:()=>t(fe),request:o,controller:e.controller})}):Promise.reject(me)}function N(){function e(n){return le(n,i=>Promise.resolve(i))}return{takePicture:e}}typeof window<"u"&&(window.useCamera=N);module.exports=ze(Re); | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,21 +0,21 @@ | ||
var Ze="generic/permissions_denied";var je="generic/operation_canceled";var $e="generic/not_permitted";async function Te(){try{let r={audio:!1,video:!0};return(await navigator.mediaDevices.getUserMedia(r)).getTracks().forEach(i=>{i.stop()}),!0}catch(r){return console.log(r),!1}}import{r as he}from"@4backs/render-function";import Ge from"@4backs/render-function/r";function Le(r,a){return Ge({tag:"img",attributes:{src:r},style:{width:a}})}function Z(r){let{size:a,backgroundColor:i,onPressed:t,horizontalMargin:n="20px",label:e,icon:o,svgIconCreator:m,padding:l}=r;function g(){let s=[];return o.enabled&&o.source.length==0&&s.push(he({tag:"div",style:{width:o.size},children:m(o.color)})),o.enabled&&o.source.length>0&&s.push(Le(o.source,o.size)),e.enabled&&o.enabled&&s.push(he({tag:"div",style:{width:"8px"}})),e.enabled&&s.push(he({tag:"p",children:e.content,style:{fontSize:e.fontSize,color:e.color,fontWeight:e.fontWeight}})),s}return he({tag:"button",style:{minWidth:a,height:a,borderRadius:"9999px",cursor:"pointer",background:i,display:"flex",alignItems:"center",justifyContent:"center",padding:l,margin:`0 ${n}`,border:"none"},onClick:t,children:g()})}import{r as Xe}from"@4backs/render-function";function ze(r){return new Promise(a=>{setTimeout(()=>{a()},r)})}function ve(r){let a=!1,i="",t=Xe({tag:"video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#363738",transform:"scaleX(-1)"},attributes:{id:"biopass_camera",autoplay:"",playsinline:"",muted:""}});async function n(l){return new Promise((g,s)=>{let{aspectRatio:c,preferredResolution:x}=r,T={audio:!1,video:{facingMode:l!=null?"user":void 0,deviceId:l!=null?{exact:l}:void 0,aspectRatio:c,height:c>1?x:void 0,width:c<1?x:void 0}};navigator.mediaDevices.getUserMedia(T).then(C=>{var d;let h=C.getTracks()[0].getSettings();i=(d=h.deviceId)!=null?d:"",t.style.transform=h.facingMode=="user"?"scaleX(-1)":"scaleX(1)",t.srcObject=C,t.play(),t.onloadedmetadata=()=>{a=!0,g()}}).catch(C=>s(C))})}async function e(){let l=t.srcObject;l&&l.getTracks().forEach(function(s){s.stop()}),t.srcObject=null,a=!1}async function o(){if(a){a=!1,e(),await ze(300);let l=(await navigator.mediaDevices.enumerateDevices()).filter(c=>c.kind=="videoinput").map(c=>c.deviceId),g=l.indexOf(i);if(l.length==1||g<0){await n();return}if(g==l.length-1){await n(l[0]);return}let s=l[g+1];await n(s)}}return{get element(){return t},initCamera:n,dispose:e,checkIfIsInitialized:()=>a,switchCamera:o}}import{r as Oe}from"@4backs/render-function";function be(){let r=Oe({tag:"canvas",style:{position:"absolute",display:"none"}});function a(t){return r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),{base64:r.toDataURL("image/jpg"),height:r.height,width:r.width}}return{get element(){return r},takePicture:a}}import{r as Y}from"@4backs/render-function";import{r as Be}from"@4backs/render-function";function Re(r){let{color:a,opacity:i}=r;return`<svg preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M565 0H0V350H565V0ZM346.833 172.288C347.007 170.954 347.18 169.63 347.354 168.334C350.952 143.942 346.742 122.747 335.71 107.633C324.916 92.949 307.602 83.9174 284.37 83.4243H280.59C257.422 83.9174 240.108 92.949 229.378 107.633C218.282 122.747 214.072 143.942 217.616 168.334C218.1 171.648 218.529 175.091 218.949 178.598L219.031 179.182C220.647 191.794 222.364 205.117 226.328 215.701C231.752 230.203 241.45 242.924 251.934 252.019C262.426 261.115 273.64 266.457 282.361 266.575H282.599C291.32 266.521 302.598 261.115 313.027 252.019C323.574 242.924 333.208 230.148 338.633 215.701C342.66 204.953 344.422 191.374 346.011 178.598C346.267 176.461 346.55 174.361 346.833 172.288Z" fill="${a}" fill-opacity="${i}"/> | ||
var le="generic/permissions_denied";var ce="generic/operation_canceled";var se="generic/not_permitted";async function $(){try{let o={audio:!1,video:!0};return(await navigator.mediaDevices.getUserMedia(o)).getTracks().forEach(l=>{l.stop()}),!0}catch(o){return console.log(o),!1}}import{r as R}from"@4backs/render-function";import pe from"@4backs/render-function/r";function Y(o,i){return pe({tag:"img",attributes:{src:o},style:{width:i}})}function P(o){let{size:i,backgroundColor:l,onPressed:n,horizontalMargin:e="20px",label:t,icon:c,svgIconCreator:d,padding:s}=o;function m(){let a=[];return c.enabled&&c.source.length==0&&a.push(R({tag:"div",style:{width:c.size},children:d(c.color)})),c.enabled&&c.source.length>0&&a.push(Y(c.source,c.size)),t.enabled&&c.enabled&&a.push(R({tag:"div",style:{width:"8px"}})),t.enabled&&a.push(R({tag:"p",children:t.content,style:{fontSize:t.fontSize,color:t.color,fontWeight:t.fontWeight}})),a}return R({tag:"button",style:{minWidth:i,height:i,borderRadius:"9999px",cursor:"pointer",background:l,display:"flex",alignItems:"center",justifyContent:"center",padding:s,margin:`0 ${e}`,border:"none"},onClick:n,children:m()})}import{r as ge}from"@4backs/render-function";function G(o){return new Promise(i=>{setTimeout(()=>{i()},o)})}function H(o){let i=!1,l="",n=ge({tag:"video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#363738",transform:"scaleX(-1)"},attributes:{id:"biopass_camera",autoplay:"",playsinline:"",muted:""}});async function e(s){return new Promise((m,a)=>{let{aspectRatio:r,preferredResolution:g}=o,k={audio:!1,video:{facingMode:s!=null?"user":void 0,deviceId:s!=null?{exact:s}:void 0,aspectRatio:r,height:r>1?g:void 0,width:r<1?g:void 0}};navigator.mediaDevices.getUserMedia(k).then(f=>{let p=f.getTracks()[0].getSettings();l=p.deviceId??"",n.style.transform=p.facingMode=="user"?"scaleX(-1)":"scaleX(1)",n.srcObject=f,n.play(),n.onloadedmetadata=()=>{i=!0,m()}}).catch(f=>a(f))})}async function t(){let s=n.srcObject;s&&s.getTracks().forEach(function(a){a.stop()}),n.srcObject=null,i=!1}async function c(){if(i){i=!1,t(),await G(300);let s=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind=="videoinput").map(r=>r.deviceId),m=s.indexOf(l);if(s.length==1||m<0){await e();return}if(m==s.length-1){await e(s[0]);return}let a=s[m+1];await e(a)}}return{get element(){return n},initCamera:e,dispose:t,checkIfIsInitialized:()=>i,switchCamera:c}}import{r as Ce}from"@4backs/render-function";function S(){let o=Ce({tag:"canvas",style:{position:"absolute",display:"none"}});function i(n){return o.width=n.videoWidth,o.height=n.videoHeight,o.getContext("2d").drawImage(n,0,0,n.videoWidth,n.videoHeight),{base64:o.toDataURL("image/jpg"),height:o.height,width:o.width}}return{get element(){return o},takePicture:i}}import{r as E}from"@4backs/render-function";import{r as N}from"@4backs/render-function";function X(o){let{color:i,opacity:l}=o;return`<svg preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M565 0H0V350H565V0ZM346.833 172.288C347.007 170.954 347.18 169.63 347.354 168.334C350.952 143.942 346.742 122.747 335.71 107.633C324.916 92.949 307.602 83.9174 284.37 83.4243H280.59C257.422 83.9174 240.108 92.949 229.378 107.633C218.282 122.747 214.072 143.942 217.616 168.334C218.1 171.648 218.529 175.091 218.949 178.598L219.031 179.182C220.647 191.794 222.364 205.117 226.328 215.701C231.752 230.203 241.45 242.924 251.934 252.019C262.426 261.115 273.64 266.457 282.361 266.575H282.599C291.32 266.521 302.598 261.115 313.027 252.019C323.574 242.924 333.208 230.148 338.633 215.701C342.66 204.953 344.422 191.374 346.011 178.598C346.267 176.461 346.55 174.361 346.833 172.288Z" fill="${i}" fill-opacity="${l}"/> | ||
</svg> | ||
`}function He(r){return`<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350"><path d="M282.83,266.07v-.5h0c-8.56-.11-19.66-5.37-30.11-14.43A91.58,91.58,0,0,1,227.27,215c-3.94-10.52-5.65-23.78-7.27-36.41h0l-.08-.57h0c-.42-3.5-.85-6.95-1.34-10.27-3.53-24.3.67-45.35,11.67-60.33,10.63-14.54,27.78-23.52,50.82-24h3.77c23.09.49,40.25,9.47,50.94,24,10.93,15,15.13,36,11.55,60.33h0c-.17,1.29-.35,2.62-.52,3.95-.28,2.07-.57,4.18-.82,6.32-1.6,12.79-3.35,26.3-7.36,37a91.33,91.33,0,0,1-25.46,36.11h0c-10.39,9.06-21.55,14.38-30.1,14.43h0" fill="none" stroke="${r.color}" stroke-width="${r.thickness}"/></svg> | ||
`}function Se(r){var o,m,l,g,s,c;let a={enabled:(o=r==null?void 0:r.enabled)!=null?o:!0,backgroundColor:(m=r==null?void 0:r.backgroundColor)!=null?m:"black",backgroundOpacity:(l=r==null?void 0:r.backgroundOpacity)!=null?l:.6,frameColor:(g=r==null?void 0:r.frameColor)!=null?g:"white",frameThickness:(s=r==null?void 0:r.frameThickness)!=null?s:3,type:(c=r==null?void 0:r.type)!=null?c:"face"};function i(){if(a.type=="face")return{mask:Re({color:a.backgroundColor,opacity:a.backgroundOpacity}),frame:He({color:a.frameColor,thickness:a.frameThickness})}}let t=i(),n=Be({tag:"div",style:{width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},children:[Be({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:t==null?void 0:t.mask}),Be({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:t==null?void 0:t.frame})]});return{get element(){return n}}}function q(){throw $e}import{detectAllFaces as Ue,loadTinyFaceDetectorModel as Ne,TinyFaceDetectorOptions as Je}from"face-api.js";import{r as De}from"@4backs/render-function";function Ae(r){var d,f,u,P,L,w,v,R,z,y;let{canTakePhotoCallback:a,modelsDirectory:i,enabled:t,subtitle:n,title:e}=r,o={enabled:(d=e==null?void 0:e.enabled)!=null?d:!1,color:(f=e==null?void 0:e.color)!=null?f:"white",content:(u=e==null?void 0:e.content)!=null?u:"Captura Facial",fontSize:(P=e==null?void 0:e.fontSize)!=null?P:"1.5rem",fontWeight:(L=e==null?void 0:e.fontWeight)!=null?L:"600"},m={enabled:(w=n==null?void 0:n.enabled)!=null?w:!0,color:(v=n==null?void 0:n.color)!=null?v:"white",content:(R=n==null?void 0:n.content)!=null?R:"",fontSize:(z=n==null?void 0:n.fontSize)!=null?z:"1rem",fontWeight:(y=n==null?void 0:n.fontWeight)!=null?y:"normal"},l=De({tag:"p",style:{color:m.color,fontWeight:m.fontWeight,fontSize:m.fontSize,textAlign:"center",margin:"0",padding:"0"},children:m.content}),g=De({tag:"div",style:{position:"absolute",top:"6%",right:"0",left:"0"},children:[De({tag:"p",children:o.content,style:{color:o.color,fontWeight:o.fontWeight,fontSize:o.fontSize,textAlign:"center",padding:"0",margin:"0"}}),l]}),s=!1;async function c(){let k=document.querySelector("#biopass_camera");if(k&&s){let p=await Ue(k,new Je);if(p.length==0)l.innerText="Nenhuma face detectada",a(!1);else if(p.length>1)l.innerText="M\xFAltiplas faces detectadas",a(!1);else if(p.length==1){let E=p[0].relativeBox,b={x:E.x+E.width/2,y:E.y+E.height/2},M=p[0].imageWidth<p[0].imageHeight,H=M?.4:.45,S=M?.6:.55,B=.5,D=.6;b.x<H?(l.innerText="Mova seu rosto para a esquerda",a(!1)):b.x>S?(l.innerText="Mova seu rosto para a direita",a(!1)):b.y<B?(l.innerText="Mova seu rosto para baixo",a(!1)):b.y>D?(l.innerText="Mova seu rosto para cima",a(!1)):(l.innerText="Mantenha o rosto parado",a(!0))}setTimeout(()=>{requestAnimationFrame(()=>c())},100)}}async function x(){s=!0,t&&c()}async function T(){t&&await Ne(i)}async function C(){s=!1}return{get element(){return g},startCapture:x,loadModel:T,stop:C}}import{r as Ke}from"@4backs/render-function";function pe(r){var f,u,P,L,w,v,R,z,y,k,p,E,b,M,H,S,B,D,_,A,I,F;let{onClick:a,active:i,options:t,top:n,left:e,right:o,svgIconCreator:m}=r,l={enabled:(u=(f=t==null?void 0:t.icon)==null?void 0:f.enabled)!=null?u:!0,color:(L=(P=t==null?void 0:t.icon)==null?void 0:P.color)!=null?L:"white",size:(v=(w=t==null?void 0:t.icon)==null?void 0:w.size)!=null?v:"30px",source:(z=(R=t==null?void 0:t.icon)==null?void 0:R.source)!=null?z:""},g={enabled:((y=t==null?void 0:t.label)==null?void 0:y.enabled)||((k=t==null?void 0:t.label)==null?void 0:k.content)!=null&&((p=t==null?void 0:t.label)==null?void 0:p.content.length)>0,color:(b=(E=t==null?void 0:t.label)==null?void 0:E.color)!=null?b:"black",content:(H=(M=t==null?void 0:t.label)==null?void 0:M.content)!=null?H:"",fontSize:(B=(S=t==null?void 0:t.label)==null?void 0:S.fontSize)!=null?B:"1rem",fontWeight:(_=(D=t==null?void 0:t.label)==null?void 0:D.fontWeight)!=null?_:"normal"},s=(A=t==null?void 0:t.backgroundColor)!=null?A:"transparent",c=(I=t==null?void 0:t.size)!=null?I:"50px",x=g.enabled?"0 25px":"0",T=(F=t==null?void 0:t.padding)!=null?F:x,C=Ke({tag:"div",style:{position:"absolute",top:n,left:e,right:o,opacity:i?"1":"0",pointerEvents:i?"all":"none"},children:[Z({backgroundColor:s,size:c,onPressed:a,icon:l,label:g,svgIconCreator:m,padding:T})]}),h={get element(){return C},active:i};return new Proxy(h,{get:(V,W)=>{if(W in V)return V[W]},set(V,W,j){return W==="element"||W==="active"&&(j?(C.style.opacity="1",C.style.pointerEvents="all"):(C.style.opacity="0",C.style.pointerEvents="none")),!0}})}function ye(r){return` | ||
`}function U(o){return`<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" width="100%" height="100%" viewBox="0 0 565 350"><path d="M282.83,266.07v-.5h0c-8.56-.11-19.66-5.37-30.11-14.43A91.58,91.58,0,0,1,227.27,215c-3.94-10.52-5.65-23.78-7.27-36.41h0l-.08-.57h0c-.42-3.5-.85-6.95-1.34-10.27-3.53-24.3.67-45.35,11.67-60.33,10.63-14.54,27.78-23.52,50.82-24h3.77c23.09.49,40.25,9.47,50.94,24,10.93,15,15.13,36,11.55,60.33h0c-.17,1.29-.35,2.62-.52,3.95-.28,2.07-.57,4.18-.82,6.32-1.6,12.79-3.35,26.3-7.36,37a91.33,91.33,0,0,1-25.46,36.11h0c-10.39,9.06-21.55,14.38-30.1,14.43h0" fill="none" stroke="${o.color}" stroke-width="${o.thickness}"/></svg> | ||
`}function J(o){let i={enabled:o?.enabled??!0,backgroundColor:o?.backgroundColor??"black",backgroundOpacity:o?.backgroundOpacity??.6,frameColor:o?.frameColor??"white",frameThickness:o?.frameThickness??3,type:o?.type??"face"};function l(){if(i.type=="face")return{mask:X({color:i.backgroundColor,opacity:i.backgroundOpacity}),frame:U({color:i.frameColor,thickness:i.frameThickness})}}let n=l(),e=N({tag:"div",style:{width:"100%",height:"100%",position:"absolute",top:"0",left:"0"},children:[N({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:n?.mask}),N({tag:"div",style:{width:"100%",height:"100%",position:"absolute"},children:n?.frame})]});return{get element(){return e}}}function y(){throw se}import{detectAllFaces as he,loadTinyFaceDetectorModel as be,TinyFaceDetectorOptions as ve}from"face-api.js";import{r as K}from"@4backs/render-function";function Q(o){let{canTakePhotoCallback:i,modelsDirectory:l,enabled:n,subtitle:e,title:t}=o,c={enabled:t?.enabled??!1,color:t?.color??"white",content:t?.content??"Captura Facial",fontSize:t?.fontSize??"1.5rem",fontWeight:t?.fontWeight??"600"},d={enabled:e?.enabled??!0,color:e?.color??"white",content:e?.content??"",fontSize:e?.fontSize??"1rem",fontWeight:e?.fontWeight??"normal"},s=K({tag:"p",style:{color:d.color,fontWeight:d.fontWeight,fontSize:d.fontSize,textAlign:"center",margin:"0",padding:"0"},children:d.content}),m=K({tag:"div",style:{position:"absolute",top:"6%",right:"0",left:"0"},children:[K({tag:"p",children:c.content,style:{color:c.color,fontWeight:c.fontWeight,fontSize:c.fontSize,textAlign:"center",padding:"0",margin:"0"}}),s]}),a=!1;async function r(){let C=document.querySelector("#biopass_camera");if(C&&a){let b=await he(C,new ve);if(b.length==0)s.innerText="Nenhuma face detectada",i(!1);else if(b.length>1)s.innerText="M\xFAltiplas faces detectadas",i(!1);else if(b.length==1){let u=b[0].relativeBox,v={x:u.x+u.width/2,y:u.y+u.height/2},w=b[0].imageWidth<b[0].imageHeight,x=w?.4:.45,h=w?.6:.55,M=.5,I=.6;v.x<x?(s.innerText="Mova seu rosto para a esquerda",i(!1)):v.x>h?(s.innerText="Mova seu rosto para a direita",i(!1)):v.y<M?(s.innerText="Mova seu rosto para baixo",i(!1)):v.y>I?(s.innerText="Mova seu rosto para cima",i(!1)):(s.innerText="Mantenha o rosto parado",i(!0))}setTimeout(()=>{requestAnimationFrame(()=>r())},100)}}async function g(){a=!0,n&&r()}async function k(){n&&await be(l)}async function f(){a=!1}return{get element(){return m},startCapture:g,loadModel:k,stop:f}}import{r as ye}from"@4backs/render-function";function D(o){let{onClick:i,active:l,options:n,top:e,left:t,right:c,svgIconCreator:d}=o,s={enabled:n?.icon?.enabled??!0,color:n?.icon?.color??"white",size:n?.icon?.size??"30px",source:n?.icon?.source??""},m={enabled:n?.label?.enabled||n?.label?.content!=null&&n?.label?.content.length>0,color:n?.label?.color??"black",content:n?.label?.content??"",fontSize:n?.label?.fontSize??"1rem",fontWeight:n?.label?.fontWeight??"normal"},a=n?.backgroundColor??"transparent",r=n?.size??"50px",g=m.enabled?"0 25px":"0",k=n?.padding??g,f=ye({tag:"div",style:{position:"absolute",top:e,left:t,right:c,opacity:l?"1":"0",pointerEvents:l?"all":"none"},children:[P({backgroundColor:a,size:r,onPressed:i,icon:s,label:m,svgIconCreator:d,padding:k})]}),p={get element(){return f},active:l};return new Proxy(p,{get:(b,u)=>{if(u in b)return b[u]},set(b,u,v){return u==="element"||u==="active"&&(v?(f.style.opacity="1",f.style.pointerEvents="all"):(f.style.opacity="0",f.style.pointerEvents="none")),!0}})}function A(o){return` | ||
<svg preserveAspectRatio="xMidYMin meet" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1408 11.3621C12.9871 10.7967 13.982 10.4949 14.9997 10.4949C16.3645 10.4949 17.6734 11.037 18.6384 12.0021C19.6035 12.9671 20.1456 14.276 20.1456 15.6408C20.1456 16.6585 19.8438 17.6534 19.2784 18.4997C18.7129 19.3459 17.9093 20.0055 16.969 20.395C16.0287 20.7844 14.994 20.8863 13.9958 20.6878C12.9976 20.4892 12.0807 19.9991 11.361 19.2795C10.6414 18.5598 10.1513 17.6429 9.95272 16.6447C9.75416 15.6465 9.85607 14.6118 10.2455 13.6715C10.635 12.7312 11.2946 11.9276 12.1408 11.3621ZM16.1279 12.9172C15.5892 12.6941 14.9965 12.6357 14.4246 12.7495C13.8528 12.8632 13.3275 13.144 12.9152 13.5563C12.5029 13.9685 12.2222 14.4938 12.1084 15.0657C11.9947 15.6375 12.0531 16.2302 12.2762 16.7689C12.4993 17.3076 12.8772 17.768 13.3619 18.0919C13.8467 18.4158 14.4167 18.5887 14.9997 18.5887C15.7816 18.5887 16.5314 18.2781 17.0842 17.7253C17.6371 17.1724 17.9477 16.4226 17.9477 15.6408C17.9477 15.0577 17.7748 14.4878 17.4509 14.003C17.1269 13.5182 16.6665 13.1404 16.1279 12.9172Z" fill="${r}"/> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.4541 3.75003C19.2417 3.74699 20.0109 3.989 20.6549 4.44254C21.2979 4.89536 21.7844 5.53665 22.0472 6.27781L22.5334 7.79695H24.4426C24.9466 7.79688 25.4455 7.89714 25.9103 8.0919C26.3752 8.28666 26.7966 8.57201 27.15 8.93132C27.5034 9.29062 27.7818 9.71669 27.9688 10.1847C28.1559 10.6527 28.2478 11.1532 28.2394 11.6571V22.4531C28.2394 23.4601 27.8394 24.4258 27.1274 25.1379C26.4153 25.85 25.4495 26.25 24.4425 26.25H5.55692C4.54992 26.25 3.58416 25.85 2.8721 25.1379C2.16004 24.4258 1.76001 23.4601 1.76001 22.4531V11.6613C1.76001 10.6543 2.16004 9.68854 2.8721 8.97648C3.58416 8.26443 4.54992 7.86439 5.55692 7.86439H7.4661L7.9529 6.34312C8.20491 5.58928 8.68715 4.93351 9.33167 4.46829C9.97653 4.0028 10.7513 3.75157 11.5466 3.75003L18.4541 3.75003ZM10.6796 6.24673C10.9521 6.05169 11.279 5.94719 11.6141 5.94797H18.5203C18.8554 5.94719 19.1822 6.05169 19.4547 6.24673C19.7273 6.44184 19.9317 6.71769 20.0389 7.03528L20.0395 7.03708L20.7677 9.24873C20.8383 9.458 20.9704 9.64115 21.1466 9.77429C21.3215 9.90648 21.532 9.98328 21.7509 9.99489H24.4425C24.8666 9.99489 25.2733 10.1634 25.5732 10.4632C25.873 10.7631 26.0415 11.1698 26.0415 11.5939V22.3856C26.0415 22.8097 25.873 23.2164 25.5732 23.5163C25.2733 23.8161 24.8666 23.9846 24.4425 23.9846H5.55692C5.13285 23.9846 4.72615 23.8161 4.42628 23.5163C4.12642 23.2164 3.95795 22.8097 3.95795 22.3856V11.5939C3.95795 11.1698 4.12642 10.7631 4.42628 10.4632C4.72615 10.1634 5.13285 9.99489 5.55692 9.99489L8.2679 9.99523C8.50755 10.0077 8.7447 9.94146 8.94315 9.80652C9.14139 9.67171 9.29034 9.47511 9.36687 9.24793L10.0948 7.03709L10.0954 7.03528C10.2027 6.71769 10.4071 6.44184 10.6796 6.24673Z" fill="${r}"/> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.1408 11.3621C12.9871 10.7967 13.982 10.4949 14.9997 10.4949C16.3645 10.4949 17.6734 11.037 18.6384 12.0021C19.6035 12.9671 20.1456 14.276 20.1456 15.6408C20.1456 16.6585 19.8438 17.6534 19.2784 18.4997C18.7129 19.3459 17.9093 20.0055 16.969 20.395C16.0287 20.7844 14.994 20.8863 13.9958 20.6878C12.9976 20.4892 12.0807 19.9991 11.361 19.2795C10.6414 18.5598 10.1513 17.6429 9.95272 16.6447C9.75416 15.6465 9.85607 14.6118 10.2455 13.6715C10.635 12.7312 11.2946 11.9276 12.1408 11.3621ZM16.1279 12.9172C15.5892 12.6941 14.9965 12.6357 14.4246 12.7495C13.8528 12.8632 13.3275 13.144 12.9152 13.5563C12.5029 13.9685 12.2222 14.4938 12.1084 15.0657C11.9947 15.6375 12.0531 16.2302 12.2762 16.7689C12.4993 17.3076 12.8772 17.768 13.3619 18.0919C13.8467 18.4158 14.4167 18.5887 14.9997 18.5887C15.7816 18.5887 16.5314 18.2781 17.0842 17.7253C17.6371 17.1724 17.9477 16.4226 17.9477 15.6408C17.9477 15.0577 17.7748 14.4878 17.4509 14.003C17.1269 13.5182 16.6665 13.1404 16.1279 12.9172Z" fill="${o}"/> | ||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.4541 3.75003C19.2417 3.74699 20.0109 3.989 20.6549 4.44254C21.2979 4.89536 21.7844 5.53665 22.0472 6.27781L22.5334 7.79695H24.4426C24.9466 7.79688 25.4455 7.89714 25.9103 8.0919C26.3752 8.28666 26.7966 8.57201 27.15 8.93132C27.5034 9.29062 27.7818 9.71669 27.9688 10.1847C28.1559 10.6527 28.2478 11.1532 28.2394 11.6571V22.4531C28.2394 23.4601 27.8394 24.4258 27.1274 25.1379C26.4153 25.85 25.4495 26.25 24.4425 26.25H5.55692C4.54992 26.25 3.58416 25.85 2.8721 25.1379C2.16004 24.4258 1.76001 23.4601 1.76001 22.4531V11.6613C1.76001 10.6543 2.16004 9.68854 2.8721 8.97648C3.58416 8.26443 4.54992 7.86439 5.55692 7.86439H7.4661L7.9529 6.34312C8.20491 5.58928 8.68715 4.93351 9.33167 4.46829C9.97653 4.0028 10.7513 3.75157 11.5466 3.75003L18.4541 3.75003ZM10.6796 6.24673C10.9521 6.05169 11.279 5.94719 11.6141 5.94797H18.5203C18.8554 5.94719 19.1822 6.05169 19.4547 6.24673C19.7273 6.44184 19.9317 6.71769 20.0389 7.03528L20.0395 7.03708L20.7677 9.24873C20.8383 9.458 20.9704 9.64115 21.1466 9.77429C21.3215 9.90648 21.532 9.98328 21.7509 9.99489H24.4425C24.8666 9.99489 25.2733 10.1634 25.5732 10.4632C25.873 10.7631 26.0415 11.1698 26.0415 11.5939V22.3856C26.0415 22.8097 25.873 23.2164 25.5732 23.5163C25.2733 23.8161 24.8666 23.9846 24.4425 23.9846H5.55692C5.13285 23.9846 4.72615 23.8161 4.42628 23.5163C4.12642 23.2164 3.95795 22.8097 3.95795 22.3856V11.5939C3.95795 11.1698 4.12642 10.7631 4.42628 10.4632C4.72615 10.1634 5.13285 9.99489 5.55692 9.99489L8.2679 9.99523C8.50755 10.0077 8.7447 9.94146 8.94315 9.80652C9.14139 9.67171 9.29034 9.47511 9.36687 9.24793L10.0948 7.03709L10.0954 7.03528C10.2027 6.71769 10.4071 6.44184 10.6796 6.24673Z" fill="${o}"/> | ||
</svg> | ||
`}function ke(r){return` | ||
`}function q(o){return` | ||
<svg preserveAspectRatio="xMidYMin meet" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M26.8073 6.52089C26.6436 6.35584 26.4489 6.22483 26.2343 6.13543C26.0197 6.04603 25.7895 6 25.557 6C25.3246 6 25.0944 6.04603 24.8798 6.13543C24.6652 6.22483 24.4705 6.35584 24.3068 6.52089L11.1875 19.6578L5.67561 14.1283C5.50564 13.9641 5.30499 13.835 5.08512 13.7484C4.86525 13.6617 4.63047 13.6192 4.39418 13.6233C4.1579 13.6274 3.92473 13.678 3.70799 13.7722C3.49125 13.8664 3.29519 14.0024 3.131 14.1723C2.96681 14.3423 2.8377 14.543 2.75105 14.7628C2.66441 14.9827 2.62191 15.2175 2.626 15.4538C2.63009 15.6901 2.68068 15.9232 2.77488 16.14C2.86908 16.3567 3.00505 16.5528 3.17502 16.717L9.93718 23.4791C10.1009 23.6442 10.2956 23.7752 10.5102 23.8646C10.7248 23.954 10.955 24 11.1875 24C11.4199 24 11.6501 23.954 11.8647 23.8646C12.0793 23.7752 12.2741 23.6442 12.4378 23.4791L26.8073 9.10953C26.9861 8.94463 27.1287 8.74449 27.2263 8.52173C27.3239 8.29897 27.3743 8.05841 27.3743 7.81521C27.3743 7.57202 27.3239 7.33146 27.2263 7.1087C27.1287 6.88593 26.9861 6.6858 26.8073 6.52089Z" fill="${r}"/> | ||
<path d="M26.8073 6.52089C26.6436 6.35584 26.4489 6.22483 26.2343 6.13543C26.0197 6.04603 25.7895 6 25.557 6C25.3246 6 25.0944 6.04603 24.8798 6.13543C24.6652 6.22483 24.4705 6.35584 24.3068 6.52089L11.1875 19.6578L5.67561 14.1283C5.50564 13.9641 5.30499 13.835 5.08512 13.7484C4.86525 13.6617 4.63047 13.6192 4.39418 13.6233C4.1579 13.6274 3.92473 13.678 3.70799 13.7722C3.49125 13.8664 3.29519 14.0024 3.131 14.1723C2.96681 14.3423 2.8377 14.543 2.75105 14.7628C2.66441 14.9827 2.62191 15.2175 2.626 15.4538C2.63009 15.6901 2.68068 15.9232 2.77488 16.14C2.86908 16.3567 3.00505 16.5528 3.17502 16.717L9.93718 23.4791C10.1009 23.6442 10.2956 23.7752 10.5102 23.8646C10.7248 23.954 10.955 24 11.1875 24C11.4199 24 11.6501 23.954 11.8647 23.8646C12.0793 23.7752 12.2741 23.6442 12.4378 23.4791L26.8073 9.10953C26.9861 8.94463 27.1287 8.74449 27.2263 8.52173C27.3239 8.29897 27.3743 8.05841 27.3743 7.81521C27.3743 7.57202 27.3239 7.33146 27.2263 7.1087C27.1287 6.88593 26.9861 6.6858 26.8073 6.52089Z" fill="${o}"/> | ||
</svg> | ||
`}function G(r){return` | ||
`}function B(o){return` | ||
<svg preserveAspectRatio="xMidYMin meet" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M17.1133 14.9987L23.558 8.56902C23.8402 8.2868 23.9988 7.90402 23.9988 7.5049C23.9988 7.10577 23.8402 6.723 23.558 6.44077C23.2758 6.15855 22.893 6 22.4939 6C22.0948 6 21.712 6.15855 21.4298 6.44077L15.0001 12.8855L8.57036 6.44077C8.28813 6.15855 7.90536 6 7.50623 6C7.10711 6 6.72433 6.15855 6.44211 6.44077C6.15989 6.723 6.00134 7.10577 6.00134 7.5049C6.00134 7.90402 6.15989 8.2868 6.44211 8.56902L12.8868 14.9987L6.44211 21.4284C6.30163 21.5678 6.19014 21.7335 6.11405 21.9162C6.03795 22.0988 5.99878 22.2947 5.99878 22.4925C5.99878 22.6904 6.03795 22.8863 6.11405 23.0689C6.19014 23.2516 6.30163 23.4173 6.44211 23.5567C6.58144 23.6971 6.74721 23.8086 6.92984 23.8847C7.11248 23.9608 7.30838 24 7.50623 24C7.70409 24 7.89999 23.9608 8.08262 23.8847C8.26526 23.8086 8.43103 23.6971 8.57036 23.5567L15.0001 17.112L21.4298 23.5567C21.5691 23.6971 21.7349 23.8086 21.9175 23.8847C22.1001 23.9608 22.296 24 22.4939 24C22.6917 24 22.8876 23.9608 23.0703 23.8847C23.2529 23.8086 23.4187 23.6971 23.558 23.5567C23.6985 23.4173 23.81 23.2516 23.8861 23.0689C23.9622 22.8863 24.0013 22.6904 24.0013 22.4925C24.0013 22.2947 23.9622 22.0988 23.8861 21.9162C23.81 21.7335 23.6985 21.5678 23.558 21.4284L17.1133 14.9987Z" fill="${r}"/> | ||
<path d="M17.1133 14.9987L23.558 8.56902C23.8402 8.2868 23.9988 7.90402 23.9988 7.5049C23.9988 7.10577 23.8402 6.723 23.558 6.44077C23.2758 6.15855 22.893 6 22.4939 6C22.0948 6 21.712 6.15855 21.4298 6.44077L15.0001 12.8855L8.57036 6.44077C8.28813 6.15855 7.90536 6 7.50623 6C7.10711 6 6.72433 6.15855 6.44211 6.44077C6.15989 6.723 6.00134 7.10577 6.00134 7.5049C6.00134 7.90402 6.15989 8.2868 6.44211 8.56902L12.8868 14.9987L6.44211 21.4284C6.30163 21.5678 6.19014 21.7335 6.11405 21.9162C6.03795 22.0988 5.99878 22.2947 5.99878 22.4925C5.99878 22.6904 6.03795 22.8863 6.11405 23.0689C6.19014 23.2516 6.30163 23.4173 6.44211 23.5567C6.58144 23.6971 6.74721 23.8086 6.92984 23.8847C7.11248 23.9608 7.30838 24 7.50623 24C7.70409 24 7.89999 23.9608 8.08262 23.8847C8.26526 23.8086 8.43103 23.6971 8.57036 23.5567L15.0001 17.112L21.4298 23.5567C21.5691 23.6971 21.7349 23.8086 21.9175 23.8847C22.1001 23.9608 22.296 24 22.4939 24C22.6917 24 22.8876 23.9608 23.0703 23.8847C23.2529 23.8086 23.4187 23.6971 23.558 23.5567C23.6985 23.4173 23.81 23.2516 23.8861 23.0689C23.9622 22.8863 24.0013 22.6904 24.0013 22.4925C24.0013 22.2947 23.9622 22.0988 23.8861 21.9162C23.81 21.7335 23.6985 21.5678 23.558 21.4284L17.1133 14.9987Z" fill="${o}"/> | ||
</svg> | ||
`}function qe(r){return` | ||
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin meet" viewBox="0 0 25 25" fill="none" ><path fill="${r}" d="M12.29,5.21l1.5,1.5a1,1,0,0,0,1.42,0,1,1,0,0,0,.13-1.21H19a1,1,0,0,0,0-2H15.34a1,1,0,0,0-.13-1.21,1,1,0,0,0-1.42,0l-1.5,1.5a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76A1,1,0,0,0,12.29,5.21ZM22.92,9.12a1,1,0,0,0-.21-.33l-1.5-1.5a1,1,0,0,0-1.42,0,1,1,0,0,0-.13,1.21H16a1,1,0,0,0,0,2h3.66a1,1,0,0,0,.13,1.21,1,1,0,0,0,1.42,0l1.5-1.5a1,1,0,0,0,.21-.33A1,1,0,0,0,22.92,9.12ZM11,10a4,4,0,1,0,4,4A4,4,0,0,0,11,10Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,11,16Zm9-3a1,1,0,0,0-1,1v5a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V11a1,1,0,0,1,1-1H6a1,1,0,0,0,1-.69l.54-1.62A1,1,0,0,1,8.44,7H10a1,1,0,0,0,0-2H8.44A3,3,0,0,0,5.59,7.06L5.28,8H4a3,3,0,0,0-3,3v8a3,3,0,0,0,3,3H18a3,3,0,0,0,3-3V14A1,1,0,0,0,20,13Z"/></svg> | ||
`}function xe(r){var A,I,F,V,W,j,X,O,U,N,J,K,Q,ee,te,ne,re,ae,ie,oe,le,ce,se,de,me,ue,fe,ge;let{request:a,onCancel:i,onFinish:t,controller:n,options:e}=r,o=(I=(A=e==null?void 0:e.mask)==null?void 0:A.enabled)!=null?I:!0,m=(V=(F=e==null?void 0:e.confirmButton)==null?void 0:F.enabled)!=null?V:!0,l=(j=(W=e==null?void 0:e.loading)==null?void 0:W.enabled)!=null?j:!0,g=(O=(X=e==null?void 0:e.backButton)==null?void 0:X.enabled)!=null?O:!0,s=(N=(U=e==null?void 0:e.faceDetection)==null?void 0:U.enabled)!=null?N:!0,c=(K=(J=e==null?void 0:e.faceDetection)==null?void 0:J.autoCapture)!=null?K:!1,x=(ee=(Q=e==null?void 0:e.captureButton)==null?void 0:Q.enabled)!=null?ee:!0,T=(ne=(te=e==null?void 0:e.switchButton)==null?void 0:te.enabled)!=null?ne:!0,C=x&&!c||c&&!s,h=null,d=ve({aspectRatio:(ae=(re=e==null?void 0:e.cameraPresets)==null?void 0:re.aspectRatio)!=null?ae:16/9,preferredResolution:(oe=(ie=e==null?void 0:e.cameraPresets)==null?void 0:ie.preferredResolution)!=null?oe:480,deviceId:(ce=(le=e==null?void 0:e.cameraPresets)==null?void 0:le.deviceId)!=null?ce:""}),f=be(),u=we({active:!1,disabled:s,onClick:b,options:e==null?void 0:e.captureButton}),P=Me({active:!1,onFinish:M,onCancel:H,cancelButtonOptions:e==null?void 0:e.cancelButton,confirmButtonOptions:e==null?void 0:e.confirmButton}),L=Pe(""),w=Ee({active:!1,options:e==null?void 0:e.loading}),v=Ae({canTakePhotoCallback:p,modelsDirectory:(se=e==null?void 0:e.modelsDirectory)!=null?se:"/models",enabled:s,subtitle:(de=e==null?void 0:e.legend)==null?void 0:de.subtitle,title:(me=e==null?void 0:e.legend)==null?void 0:me.title}),R=Se(e==null?void 0:e.mask),z=pe({active:!1,onClick:B,options:e==null?void 0:e.backButton,svgIconCreator:G,left:"0",top:"10px"}),y=pe({active:!1,onClick:()=>E(),options:e==null?void 0:e.switchButton,svgIconCreator:qe,right:"0",top:"10px"}),k=null;function p($){u.disabled=!$,$?$&&c&&!k&&(k=setTimeout(()=>{b(),M()},3e3)):(clearTimeout(k),k=null)}async function E(){v.stop(),await d.switchCamera(),v.startCapture()}function b(){d.checkIfIsInitialized()&&(h=f.takePicture(d.element),L.image=h.base64,u.active=!1,P.active=!0,y.active=!1,n&&(n.confirmPicture=M,n.rejectPicture=H,n.takePicture=q))}async function M(){P.active=!1,w.active=!0,n&&(n.confirmPicture=q,n.rejectPicture=q,n.takePicture=q,n.cancel=q);try{await a(h)}finally{d.dispose(),v.stop(),t(),w.active=!1,L.image=""}}function H(){h=null,L.image="",P.active=!1,u.active=!0,y.active=!0,n&&(n.confirmPicture=q,n.rejectPicture=q,n.takePicture=b)}async function S(){await d.initCamera(),s?(await v.loadModel(),v.startCapture()):u.active=!0,z.active=!0,y.active=!0}function B(){n&&(n.confirmPicture=q,n.rejectPicture=q,n.takePicture=q,n.cancel=q),h=null,d.dispose(),v.stop(),i()}let D=Y({tag:"div",style:{position:"relative",width:(ue=e==null?void 0:e.width)!=null?ue:"100%",height:(fe=e==null?void 0:e.height)!=null?fe:"100%",fontFamily:(ge=e==null?void 0:e.fontFamily)!=null?ge:"inherit"},children:[d.element,o?R.element:Y({tag:"div"}),v.element,C?u.element:Y({tag:"div"}),L.element,m?P.element:Y({tag:"div"}),l?w.element:Y({tag:"div"}),g?z.element:Y({tag:"div"}),T?y.element:Y({tag:"div"})]});return n&&(n.cancel=B,n.takePicture=b),{get element(){return D},initCamera:S}}import Qe from"@4backs/render-function/r";function Pe(r){let a=Qe({tag:"img",style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",objectFit:"cover",opacity:r.length>0?"1":"0",transition:".3s",display:r.length>0?"block":"none",transform:"scaleX(-1)"}});r.length>0&&a.setAttribute("src",r);let i={get element(){return a},image:r};return new Proxy(i,{get:(n,e)=>{if(e in n)return n[e]},set(n,e,o){if(e==="element")return!0;if(e==="image"){let m=n.element.getAttribute("src")!=null&&n.element.getAttribute("src").length>0;m&&o.length>0?n.element.setAttribute("src",o):m&&o.length==0?(n.element.style.opacity="0",setTimeout(()=>{n.element.style.display="none",n.element.setAttribute("src","")},300)):!m&&o.length>0&&(n.element.style.opacity="0",n.element.style.display="block",n.element.setAttribute("src",o),setTimeout(()=>{n.element.style.opacity="1"},50)),n.image=o}return!0}})}import et from"@4backs/render-function/r";function we(r){var C,h,d,f,u,P,L,w,v,R,z,y,k,p,E,b,M,H,S,B,D,_;let{onClick:a,active:i,options:t,disabled:n}=r,e={enabled:(h=(C=t==null?void 0:t.icon)==null?void 0:C.enabled)!=null?h:!0,color:(f=(d=t==null?void 0:t.icon)==null?void 0:d.color)!=null?f:"black",size:(P=(u=t==null?void 0:t.icon)==null?void 0:u.size)!=null?P:"30px",source:(w=(L=t==null?void 0:t.icon)==null?void 0:L.source)!=null?w:""},o={enabled:((v=t==null?void 0:t.label)==null?void 0:v.enabled)||((R=t==null?void 0:t.label)==null?void 0:R.content)!=null&&((z=t==null?void 0:t.label)==null?void 0:z.content.length)>0,color:(k=(y=t==null?void 0:t.label)==null?void 0:y.color)!=null?k:"black",content:(E=(p=t==null?void 0:t.label)==null?void 0:p.content)!=null?E:"",fontSize:(M=(b=t==null?void 0:t.label)==null?void 0:b.fontSize)!=null?M:"1rem",fontWeight:(S=(H=t==null?void 0:t.label)==null?void 0:H.fontWeight)!=null?S:"normal"},m=(B=t==null?void 0:t.backgroundColor)!=null?B:"white",l=(D=t==null?void 0:t.size)!=null?D:"50px",g=o.enabled?"0 25px":"0",s=(_=t==null?void 0:t.padding)!=null?_:g,c=et({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:n?".3":"1",pointerEvents:i&&!n?"all":"none"},children:[Z({backgroundColor:m,size:l,onPressed:a,icon:e,label:o,svgIconCreator:ye,padding:s})]}),x={get element(){return c},disabled:n,active:i};return new Proxy(x,{get:(A,I)=>{if(I in A)return A[I]},set(A,I,F){return I==="element"||(I==="active"?F?(c.style.opacity="1",c.style.pointerEvents="all"):(c.style.opacity="0",c.style.pointerEvents="none"):I=="disabled"&&(F?(c.style.opacity=".3",c.style.pointerEvents="none"):(c.style.opacity="1",c.style.pointerEvents="all"))),!0}})}import Fe from"@4backs/render-function/r";function Ee(r){var s,c,x,T,C,h;let{active:a,options:i}=r,t={enabled:(s=i==null?void 0:i.enabled)!=null?s:!0,backgroundColor:(c=i==null?void 0:i.backgroundColor)!=null?c:"white",dotsColor:(x=i==null?void 0:i.dotsColor)!=null?x:"black",dotsSize:(T=i==null?void 0:i.dotsSize)!=null?T:"5px",dotsSpacing:(C=i==null?void 0:i.dotsSpacing)!=null?C:"3px",size:(h=i==null?void 0:i.size)!=null?h:"50px"};function n(d){return Fe({tag:"div",attributes:{class:"loading_dot"},style:{width:t.dotsSize,height:t.dotsSize,borderRadius:"9999px",background:t.dotsColor,marginRight:d?void 0:t.dotsSpacing,opacity:".5"}})}let e=Fe({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:a?"1":"0",pointerEvents:a?"all":"none"},children:[Fe({tag:"div",style:{width:t.size,height:t.size,background:t.backgroundColor,borderRadius:"9999px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 25px"},children:Array(3).fill(void 0).map((d,f)=>n(f==2))})]}),o={get element(){return e},active:a};function m(){let d=Array.from(e.querySelectorAll(".loading_dot"));d&&typeof document.body.animate<"u"&&d.forEach(f=>{f.getAnimations().forEach(u=>u.cancel())})}function l(){let d=Array.from(e.querySelectorAll(".loading_dot"));d&&typeof document.body.animate<"u"&&d.forEach((f,u)=>{f.animate([{opacity:".5",transform:"scale(.8)"},{opacity:"1",transform:"scale(1)"},{opacity:"1",transform:"scale(1)"},{opacity:".5",transform:"scale(.8)"}],{duration:1e3,iterations:1/0,delay:u*100})})}return a&&l(),new Proxy(o,{get:(d,f)=>{if(f in d)return d[f]},set(d,f,u){return f==="element"||f==="active"&&(m(),u?(e.style.opacity="1",l()):e.style.opacity="0"),!0}})}import tt from"@4backs/render-function/r";function Me(r){var w,v,R,z,y,k,p,E,b,M,H,S,B,D,_,A,I,F,V,W,j,X,O,U,N,J,K,Q,ee,te,ne,re,ae,ie,oe,le,ce,se,de,me,ue,fe,ge,$;let{onFinish:a,onCancel:i,active:t,cancelButtonOptions:n,confirmButtonOptions:e}=r,o={enabled:(v=(w=n==null?void 0:n.icon)==null?void 0:w.enabled)!=null?v:!0,color:(z=(R=n==null?void 0:n.icon)==null?void 0:R.color)!=null?z:"white",size:(k=(y=n==null?void 0:n.icon)==null?void 0:y.size)!=null?k:"30px",source:(E=(p=n==null?void 0:n.icon)==null?void 0:p.source)!=null?E:""},m={enabled:((b=n==null?void 0:n.label)==null?void 0:b.enabled)||((M=n==null?void 0:n.label)==null?void 0:M.content)!=null&&((H=n==null?void 0:n.label)==null?void 0:H.content.length)>0,color:(B=(S=n==null?void 0:n.label)==null?void 0:S.color)!=null?B:"white",content:(_=(D=n==null?void 0:n.label)==null?void 0:D.content)!=null?_:"",fontSize:(I=(A=n==null?void 0:n.label)==null?void 0:A.fontSize)!=null?I:"1rem",fontWeight:(V=(F=n==null?void 0:n.label)==null?void 0:F.fontWeight)!=null?V:"normal"},l=(W=n==null?void 0:n.backgroundColor)!=null?W:"red",g=(j=n==null?void 0:n.size)!=null?j:"50px",s=m.enabled?"0 25px":"0",c=(X=n==null?void 0:n.padding)!=null?X:s,x={enabled:(U=(O=e==null?void 0:e.icon)==null?void 0:O.enabled)!=null?U:!0,color:(J=(N=e==null?void 0:e.icon)==null?void 0:N.color)!=null?J:"black",size:(Q=(K=e==null?void 0:e.icon)==null?void 0:K.size)!=null?Q:"30px",source:(te=(ee=e==null?void 0:e.icon)==null?void 0:ee.source)!=null?te:""},T={enabled:((ne=e==null?void 0:e.label)==null?void 0:ne.enabled)||((re=e==null?void 0:e.label)==null?void 0:re.content)!=null&&((ae=e==null?void 0:e.label)==null?void 0:ae.content.length)>0,color:(oe=(ie=e==null?void 0:e.label)==null?void 0:ie.color)!=null?oe:"black",content:(ce=(le=e==null?void 0:e.label)==null?void 0:le.content)!=null?ce:"",fontSize:(de=(se=e==null?void 0:e.label)==null?void 0:se.fontSize)!=null?de:"1rem",fontWeight:(ue=(me=e==null?void 0:e.label)==null?void 0:me.fontWeight)!=null?ue:"normal"},C=(fe=e==null?void 0:e.backgroundColor)!=null?fe:"white",h=(ge=e==null?void 0:e.size)!=null?ge:"50px",d=T.enabled?"0 25px":"0",f=($=e==null?void 0:e.padding)!=null?$:d,u=tt({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:t?"1":"0",pointerEvents:t?"all":"none"},children:[Z({backgroundColor:l,size:g,onPressed:i,icon:o,label:m,svgIconCreator:G,padding:c}),Z({backgroundColor:C,size:h,onPressed:a,icon:x,label:T,svgIconCreator:ke,padding:f})]}),P={get element(){return u},active:t};return new Proxy(P,{get:(Ie,Ce)=>{if(Ce in Ie)return Ie[Ce]},set(Ie,Ce,Ye){return Ce==="element"||Ce==="active"&&(Ye?(u.style.opacity="1",u.style.pointerEvents="all"):(u.style.opacity="0",u.style.pointerEvents="none")),!0}})}function We(r){let{data:a,request:i,onCancel:t,controller:n}=r,e=xe({onCancel:()=>{a.element.innerHTML="",t()},onFinish:()=>{a.element.innerHTML=""},request:i,controller:n,options:a.options});a.element.innerHTML="",a.element.appendChild(e.element),e.initCamera()}async function _e(r,a){return await Te()?new Promise((t,n)=>{async function e(o){try{let m=await a(o);t(m)}catch(m){throw n(m),m}}We({data:r,onCancel:()=>n(je),request:e,controller:r.controller})}):Promise.reject(Ze)}function Ve(){function r(a){return _e(a,t=>Promise.resolve(t))}return{takePicture:r}}typeof window<"u"&&(window.useCamera=Ve);export{Ve as useCamera}; | ||
`}function ee(o){return` | ||
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMin meet" viewBox="0 0 25 25" fill="none" ><path fill="${o}" d="M12.29,5.21l1.5,1.5a1,1,0,0,0,1.42,0,1,1,0,0,0,.13-1.21H19a1,1,0,0,0,0-2H15.34a1,1,0,0,0-.13-1.21,1,1,0,0,0-1.42,0l-1.5,1.5a1,1,0,0,0-.21.33,1,1,0,0,0,0,.76A1,1,0,0,0,12.29,5.21ZM22.92,9.12a1,1,0,0,0-.21-.33l-1.5-1.5a1,1,0,0,0-1.42,0,1,1,0,0,0-.13,1.21H16a1,1,0,0,0,0,2h3.66a1,1,0,0,0,.13,1.21,1,1,0,0,0,1.42,0l1.5-1.5a1,1,0,0,0,.21-.33A1,1,0,0,0,22.92,9.12ZM11,10a4,4,0,1,0,4,4A4,4,0,0,0,11,10Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,11,16Zm9-3a1,1,0,0,0-1,1v5a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V11a1,1,0,0,1,1-1H6a1,1,0,0,0,1-.69l.54-1.62A1,1,0,0,1,8.44,7H10a1,1,0,0,0,0-2H8.44A3,3,0,0,0,5.59,7.06L5.28,8H4a3,3,0,0,0-3,3v8a3,3,0,0,0,3,3H18a3,3,0,0,0,3-3V14A1,1,0,0,0,20,13Z"/></svg> | ||
`}function F(o){let{request:i,onCancel:l,onFinish:n,controller:e,options:t}=o,c=t?.mask?.enabled??!0,d=t?.confirmButton?.enabled??!0,s=t?.loading?.enabled??!0,m=t?.backButton?.enabled??!0,a=t?.faceDetection?.enabled??!0,r=t?.faceDetection?.autoCapture??!1,g=t?.captureButton?.enabled??!0,k=t?.switchButton?.enabled??!0,f=g&&!r||r&&!a,p=null,C=H({aspectRatio:t?.cameraPresets?.aspectRatio??16/9,preferredResolution:t?.cameraPresets?.preferredResolution??480,deviceId:t?.cameraPresets?.deviceId??""}),b=S(),u=_({active:!1,disabled:a,onClick:O,options:t?.captureButton}),v=Z({active:!1,onFinish:j,onCancel:re,cancelButtonOptions:t?.cancelButton,confirmButtonOptions:t?.confirmButton}),w=W(""),x=V({active:!1,options:t?.loading}),h=Q({canTakePhotoCallback:de,modelsDirectory:t?.modelsDirectory??"/models",enabled:a,subtitle:t?.legend?.subtitle,title:t?.legend?.title}),M=J(t?.mask),I=D({active:!1,onClick:ae,options:t?.backButton,svgIconCreator:B,left:"0",top:"10px"}),T=D({active:!1,onClick:()=>ue(),options:t?.switchButton,svgIconCreator:ee,right:"0",top:"10px"}),L=null;function de(z){u.disabled=!z,z?z&&r&&!L&&(L=setTimeout(()=>{O(),j()},3e3)):(clearTimeout(L),L=null)}async function ue(){h.stop(),await C.switchCamera(),h.startCapture()}function O(){C.checkIfIsInitialized()&&(p=b.takePicture(C.element),w.image=p.base64,u.active=!1,v.active=!0,T.active=!1,e&&(e.confirmPicture=j,e.rejectPicture=re,e.takePicture=y))}async function j(){v.active=!1,x.active=!0,e&&(e.confirmPicture=y,e.rejectPicture=y,e.takePicture=y,e.cancel=y);try{await i(p)}finally{C.dispose(),h.stop(),n(),x.active=!1,w.image=""}}function re(){p=null,w.image="",v.active=!1,u.active=!0,T.active=!0,e&&(e.confirmPicture=y,e.rejectPicture=y,e.takePicture=O)}async function me(){await C.initCamera(),a?(await h.loadModel(),h.startCapture()):u.active=!0,I.active=!0,T.active=!0}function ae(){e&&(e.confirmPicture=y,e.rejectPicture=y,e.takePicture=y,e.cancel=y),p=null,C.dispose(),h.stop(),l()}let fe=E({tag:"div",style:{position:"relative",width:t?.width??"100%",height:t?.height??"100%",fontFamily:t?.fontFamily??"inherit"},children:[C.element,c?M.element:E({tag:"div"}),h.element,f?u.element:E({tag:"div"}),w.element,d?v.element:E({tag:"div"}),s?x.element:E({tag:"div"}),m?I.element:E({tag:"div"}),k?T.element:E({tag:"div"})]});return e&&(e.cancel=ae,e.takePicture=O),{get element(){return fe},initCamera:me}}import ke from"@4backs/render-function/r";function W(o){let i=ke({tag:"img",style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",objectFit:"cover",opacity:o.length>0?"1":"0",transition:".3s",display:o.length>0?"block":"none",transform:"scaleX(-1)"}});o.length>0&&i.setAttribute("src",o);let l={get element(){return i},image:o};return new Proxy(l,{get:(e,t)=>{if(t in e)return e[t]},set(e,t,c){if(t==="element")return!0;if(t==="image"){let d=e.element.getAttribute("src")!=null&&e.element.getAttribute("src").length>0;d&&c.length>0?e.element.setAttribute("src",c):d&&c.length==0?(e.element.style.opacity="0",setTimeout(()=>{e.element.style.display="none",e.element.setAttribute("src","")},300)):!d&&c.length>0&&(e.element.style.opacity="0",e.element.style.display="block",e.element.setAttribute("src",c),setTimeout(()=>{e.element.style.opacity="1"},50)),e.image=c}return!0}})}import xe from"@4backs/render-function/r";function _(o){let{onClick:i,active:l,options:n,disabled:e}=o,t={enabled:n?.icon?.enabled??!0,color:n?.icon?.color??"black",size:n?.icon?.size??"30px",source:n?.icon?.source??""},c={enabled:n?.label?.enabled||n?.label?.content!=null&&n?.label?.content.length>0,color:n?.label?.color??"black",content:n?.label?.content??"",fontSize:n?.label?.fontSize??"1rem",fontWeight:n?.label?.fontWeight??"normal"},d=n?.backgroundColor??"white",s=n?.size??"50px",m=c.enabled?"0 25px":"0",a=n?.padding??m,r=xe({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:e?".3":"1",pointerEvents:l&&!e?"all":"none"},children:[P({backgroundColor:d,size:s,onPressed:i,icon:t,label:c,svgIconCreator:A,padding:a})]}),g={get element(){return r},disabled:e,active:l};return new Proxy(g,{get:(f,p)=>{if(p in f)return f[p]},set(f,p,C){return p==="element"||(p==="active"?C?(r.style.opacity="1",r.style.pointerEvents="all"):(r.style.opacity="0",r.style.pointerEvents="none"):p=="disabled"&&(C?(r.style.opacity=".3",r.style.pointerEvents="none"):(r.style.opacity="1",r.style.pointerEvents="all"))),!0}})}import te from"@4backs/render-function/r";function V(o){let{active:i,options:l}=o,n={enabled:l?.enabled??!0,backgroundColor:l?.backgroundColor??"white",dotsColor:l?.dotsColor??"black",dotsSize:l?.dotsSize??"5px",dotsSpacing:l?.dotsSpacing??"3px",size:l?.size??"50px"};function e(a){return te({tag:"div",attributes:{class:"loading_dot"},style:{width:n.dotsSize,height:n.dotsSize,borderRadius:"9999px",background:n.dotsColor,marginRight:a?void 0:n.dotsSpacing,opacity:".5"}})}let t=te({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:i?"1":"0",pointerEvents:i?"all":"none"},children:[te({tag:"div",style:{width:n.size,height:n.size,background:n.backgroundColor,borderRadius:"9999px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 25px"},children:Array(3).fill(void 0).map((a,r)=>e(r==2))})]}),c={get element(){return t},active:i};function d(){let a=Array.from(t.querySelectorAll(".loading_dot"));a&&typeof document.body.animate<"u"&&a.forEach(r=>{r.getAnimations().forEach(g=>g.cancel())})}function s(){let a=Array.from(t.querySelectorAll(".loading_dot"));a&&typeof document.body.animate<"u"&&a.forEach((r,g)=>{r.animate([{opacity:".5",transform:"scale(.8)"},{opacity:"1",transform:"scale(1)"},{opacity:"1",transform:"scale(1)"},{opacity:".5",transform:"scale(.8)"}],{duration:1e3,iterations:1/0,delay:g*100})})}return i&&s(),new Proxy(c,{get:(a,r)=>{if(r in a)return a[r]},set(a,r,g){return r==="element"||r==="active"&&(d(),g?(t.style.opacity="1",s()):t.style.opacity="0"),!0}})}import Pe from"@4backs/render-function/r";function Z(o){let{onFinish:i,onCancel:l,active:n,cancelButtonOptions:e,confirmButtonOptions:t}=o,c={enabled:e?.icon?.enabled??!0,color:e?.icon?.color??"white",size:e?.icon?.size??"30px",source:e?.icon?.source??""},d={enabled:e?.label?.enabled||e?.label?.content!=null&&e?.label?.content.length>0,color:e?.label?.color??"white",content:e?.label?.content??"",fontSize:e?.label?.fontSize??"1rem",fontWeight:e?.label?.fontWeight??"normal"},s=e?.backgroundColor??"red",m=e?.size??"50px",a=d.enabled?"0 25px":"0",r=e?.padding??a,g={enabled:t?.icon?.enabled??!0,color:t?.icon?.color??"black",size:t?.icon?.size??"30px",source:t?.icon?.source??""},k={enabled:t?.label?.enabled||t?.label?.content!=null&&t?.label?.content.length>0,color:t?.label?.color??"black",content:t?.label?.content??"",fontSize:t?.label?.fontSize??"1rem",fontWeight:t?.label?.fontWeight??"normal"},f=t?.backgroundColor??"white",p=t?.size??"50px",C=k.enabled?"0 25px":"0",b=t?.padding??C,u=Pe({tag:"div",style:{position:"absolute",bottom:"20px",left:"0",right:"0",display:"flex",alignItems:"center",justifyContent:"center",transition:".3s",opacity:n?"1":"0",pointerEvents:n?"all":"none"},children:[P({backgroundColor:s,size:m,onPressed:l,icon:c,label:d,svgIconCreator:B,padding:r}),P({backgroundColor:f,size:p,onPressed:i,icon:g,label:k,svgIconCreator:q,padding:b})]}),v={get element(){return u},active:n};return new Proxy(v,{get:(x,h)=>{if(h in x)return x[h]},set(x,h,M){return h==="element"||h==="active"&&(M?(u.style.opacity="1",u.style.pointerEvents="all"):(u.style.opacity="0",u.style.pointerEvents="none")),!0}})}function ne(o){let{data:i,request:l,onCancel:n,controller:e}=o,t=F({onCancel:()=>{i.element.innerHTML="",n()},onFinish:()=>{i.element.innerHTML=""},request:l,controller:e,options:i.options});i.element.innerHTML="",i.element.appendChild(t.element),t.initCamera()}async function oe(o,i){return await $()?new Promise((n,e)=>{async function t(c){try{let d=await i(c);n(d)}catch(d){throw e(d),d}}ne({data:o,onCancel:()=>e(ce),request:t,controller:o.controller})}):Promise.reject(le)}function ie(){function o(i){return oe(i,n=>Promise.resolve(n))}return{takePicture:o}}typeof window<"u"&&(window.useCamera=ie);export{ie as useCamera}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@biopassid/face-sdk", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
3350758
6256