@sekyro/elements 0.0.0-stage → 0.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE +29 -0
  3. package/README.md +247 -2
  4. package/custom-elements.json +355 -0
  5. package/dist/cdn/chunks/background-monitor-GCMNCJMG-UXYQ5GX7.js +1 -0
  6. package/dist/cdn/chunks/camera-trait-HVV5ZEDI-JB4HN6S3.js +1 -0
  7. package/dist/cdn/chunks/capture-session-doc-K6LVXAGQ-SY3B27LY.js +1 -0
  8. package/dist/cdn/chunks/chunk-2SENV5CV.js +1 -0
  9. package/dist/cdn/chunks/chunk-2ZVKLBJD.js +14 -0
  10. package/dist/cdn/chunks/chunk-3KIFGAEK.js +1 -0
  11. package/dist/cdn/chunks/chunk-3VYQXVW4.js +1 -0
  12. package/dist/cdn/chunks/chunk-4FHWXBOB.js +1 -0
  13. package/dist/cdn/chunks/chunk-562ANROG.js +1 -0
  14. package/dist/cdn/chunks/chunk-6MEPT5ZS.js +1 -0
  15. package/dist/cdn/chunks/chunk-7HJH5Q4M.js +1 -0
  16. package/dist/cdn/chunks/chunk-7XAIG23G.js +1 -0
  17. package/dist/cdn/chunks/chunk-C66GZ7NN.js +1 -0
  18. package/dist/cdn/chunks/chunk-CMDITVXF.js +1 -0
  19. package/dist/cdn/chunks/chunk-CMS5FVGM.js +1 -0
  20. package/dist/cdn/chunks/chunk-D334IAZJ.js +1 -0
  21. package/dist/cdn/chunks/chunk-ET7NCKUV.js +1 -0
  22. package/dist/cdn/chunks/chunk-FAIDO3QL.js +1 -0
  23. package/dist/cdn/chunks/chunk-HDJ6JFXX.js +1 -0
  24. package/dist/cdn/chunks/chunk-HODE7UDG.js +1 -0
  25. package/dist/cdn/chunks/chunk-IBOJTLL7.js +1 -0
  26. package/dist/cdn/chunks/chunk-IFGPCCJH.js +1 -0
  27. package/dist/cdn/chunks/chunk-JM3CYFFZ.js +1 -0
  28. package/dist/cdn/chunks/chunk-JOZCJGRV.js +1 -0
  29. package/dist/cdn/chunks/chunk-KPGTFHQU.js +1 -0
  30. package/dist/cdn/chunks/chunk-OBPBHX2J.js +1 -0
  31. package/dist/cdn/chunks/chunk-OIJVTJML.js +1 -0
  32. package/dist/cdn/chunks/chunk-RK4HVNRS.js +1 -0
  33. package/dist/cdn/chunks/chunk-RRLXNT33.js +1 -0
  34. package/dist/cdn/chunks/chunk-SK6UAYX2.js +1 -0
  35. package/dist/cdn/chunks/chunk-T4M2J44L.js +1 -0
  36. package/dist/cdn/chunks/chunk-TCW6XNLI.js +1 -0
  37. package/dist/cdn/chunks/chunk-UYAVCSQ4.js +25 -0
  38. package/dist/cdn/chunks/chunk-UZWMCNZI.js +1 -0
  39. package/dist/cdn/chunks/chunk-X767DBO7.js +1 -0
  40. package/dist/cdn/chunks/chunk-XYQGAQBQ.js +1 -0
  41. package/dist/cdn/chunks/chunk-YEPHU5PX.js +1 -0
  42. package/dist/cdn/chunks/chunk-YMGCOMYZ.js +1 -0
  43. package/dist/cdn/chunks/chunk-Z3EEB4CI.js +1 -0
  44. package/dist/cdn/chunks/chunk-ZKEOHGBY.js +33 -0
  45. package/dist/cdn/chunks/clip-inspect-HZ7N2YOP-DCDXB76T.js +1 -0
  46. package/dist/cdn/chunks/create-document-capture-LNX6NFSK-A4LP25Y5.js +1 -0
  47. package/dist/cdn/chunks/create-portrait-capture-VRZZOMJS-I4FBRNBP.js +1 -0
  48. package/dist/cdn/chunks/detector-scanic-F3Y5X3DF-FGVR4NEM.js +1 -0
  49. package/dist/cdn/chunks/document-capture-view-JIKJWCFG-MMCEL43X.js +1 -0
  50. package/dist/cdn/chunks/eid-view-IW2ZP2NG-EB5SCHBD.js +1 -0
  51. package/dist/cdn/chunks/email-otp-view-VDTMZ4R5-Y5QHQDIB.js +1 -0
  52. package/dist/cdn/chunks/flow-views-N4FMOYIR-FDN6ATHN.js +1 -0
  53. package/dist/cdn/chunks/icao-gate-SO6YJ7RV-MPW6W3QN.js +1 -0
  54. package/dist/cdn/chunks/icao-tuning-DCZCMCEQ-ZQSK7ZOV.js +1 -0
  55. package/dist/cdn/chunks/keyframe-rank-R4NPQGN3-VRURE6OQ.js +1 -0
  56. package/dist/cdn/chunks/landmarker-3BBP3RBY-DDXMOLGK.js +1 -0
  57. package/dist/cdn/chunks/mrz-band-DCXFWDBD-OPMO6HYS.js +1 -0
  58. package/dist/cdn/chunks/overlay-de-F7GCMCGJ-FBTP3BSM.js +1 -0
  59. package/dist/cdn/chunks/overlay-es-HIO7CIKS-GDHVHUQW.js +1 -0
  60. package/dist/cdn/chunks/overlay-pt-YC4HRHKL-J3TGRZRW.js +1 -0
  61. package/dist/cdn/chunks/plan-runner-DIRERYBF-FANNXQNO.js +1 -0
  62. package/dist/cdn/chunks/portrait-capture-view-LWESDZPM-SEOHMLJQ.js +1 -0
  63. package/dist/cdn/chunks/portrait-review-view-FU3QSO4K-DZHDIMQX.js +1 -0
  64. package/dist/cdn/chunks/print-4WOMNRBE-DNXJ7ERA.js +11 -0
  65. package/dist/cdn/chunks/scanic-ml-stub-XPNKT2N3-YSXFN7KY.js +1 -0
  66. package/dist/cdn/chunks/segmenter-3CVPTZMM-WGI6XGWN.js +1 -0
  67. package/dist/cdn/chunks/turnstile-N4K4U2AI-SLP55XAA.js +1 -0
  68. package/dist/cdn/chunks/upload-file-C4MFKLT3-DXCNEDXP.js +1 -0
  69. package/dist/cdn/chunks/vision_bundle-WBHR7TEE.js +41 -0
  70. package/dist/cdn/define.js +1 -0
  71. package/dist/cdn/index.js +1 -0
  72. package/dist/chunk-43YHL2WG.js +1 -0
  73. package/dist/chunk-4QI2LTJD.js +1 -0
  74. package/dist/chunk-73JRPFCO.js +33 -0
  75. package/dist/chunk-HSQWGTF7.js +1 -0
  76. package/dist/chunk-JJNFGW3A.js +25 -0
  77. package/dist/chunk-JQ3ANVKN.js +1 -0
  78. package/dist/chunk-KU4DZ3OQ.js +1 -0
  79. package/dist/chunk-OSBGOI4W.js +14 -0
  80. package/dist/chunk-RPLVIGTS.js +1 -0
  81. package/dist/chunk-SEE6MST7.js +1 -0
  82. package/dist/chunk-TPIBYY2S.js +1 -0
  83. package/dist/chunk-UT2KIR2K.js +1 -0
  84. package/dist/chunk-W2UTL5PI.js +1 -0
  85. package/dist/chunk-WWGJDMZQ.js +1 -0
  86. package/dist/chunk-X5K27NXI.js +1 -0
  87. package/dist/chunk-X5WMOOH2.js +1 -0
  88. package/dist/define.cjs +66 -0
  89. package/dist/define.d.cts +7 -0
  90. package/dist/define.d.ts +7 -0
  91. package/dist/define.js +1 -0
  92. package/dist/document-capture-view-JIKJWCFG-OWMTF5A3.js +1 -0
  93. package/dist/eid-view-IW2ZP2NG-SKEYTRTX.js +1 -0
  94. package/dist/email-otp-view-VDTMZ4R5-EO7T6SL4.js +1 -0
  95. package/dist/flow-views-N4FMOYIR-J54ADNRO.js +1 -0
  96. package/dist/fonts/Cairo-OFL.txt +93 -0
  97. package/dist/fonts/Geist-OFL.txt +93 -0
  98. package/dist/fonts/Inter-OFL.txt +93 -0
  99. package/dist/fonts/SekyroCairo-Bold.woff2 +0 -0
  100. package/dist/fonts/SekyroCairo-Regular.woff2 +0 -0
  101. package/dist/fonts/SekyroCairo-SemiBold.woff2 +0 -0
  102. package/dist/fonts/SekyroGeist-Bold.woff2 +0 -0
  103. package/dist/fonts/SekyroGeist-SemiBold.woff2 +0 -0
  104. package/dist/fonts/SekyroInter-Medium.woff2 +0 -0
  105. package/dist/fonts/SekyroInter-Regular.woff2 +0 -0
  106. package/dist/fonts/SekyroInter-SemiBold.woff2 +0 -0
  107. package/dist/index.cjs +66 -0
  108. package/dist/index.d.cts +1099 -0
  109. package/dist/index.d.ts +1099 -0
  110. package/dist/index.js +1 -0
  111. package/dist/overlay-de-F7GCMCGJ-7OI7SGX4.js +1 -0
  112. package/dist/overlay-es-HIO7CIKS-LXC2SFGY.js +1 -0
  113. package/dist/overlay-pt-YC4HRHKL-2QCRICEV.js +1 -0
  114. package/dist/portrait-capture-view-LWESDZPM-XZOM6LXG.js +1 -0
  115. package/dist/portrait-review-view-FU3QSO4K-AGWEX2EQ.js +1 -0
  116. package/dist/styles.css +1475 -0
  117. package/package.json +117 -4
  118. package/sbom.cdx.json +153 -0
  119. package/types/empty.js +2 -0
  120. package/types/events.d.ts +9 -0
  121. package/types/jsx.d.ts +15 -0
  122. package/types/svelte.d.ts +16 -0
  123. package/types/vue.d.ts +15 -0
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var O={enabled:!0,hz:3,segmenterTimeoutMs:8e3,segmenterBudgetMs:120,maskThreshold:.5,maxColorStd:28,maxEdgeDensity:.08,edgeLuma:24,maxGradient:.18,minPixels:300,timeoutMs:4e3},Y=12e3,w=n((a,h,t)=>Math.min(t,Math.max(h,Math.round(a))),"b");function Z(a,h,t){let{x:i,y:r,width:d,height:o}=a;if(t)return[{x:i-1.5*d,y:r-.8*o,width:4*d,height:2.8*o}];let s=r-.4*o,p=1.4*o;return[{x:i-.9*d,y:s,width:.75*d,height:p},{x:i+1.15*d,y:s,width:.75*d,height:p}].map(u=>{let y=Math.max(0,u.x),x=Math.min(h.width,u.x+u.width);return{x:y,y:u.y,width:Math.max(0,x-y),height:u.height}})}n(Z,"W");function _(a,h,t,i=O){let r=t!==null&&t.width>0&&t.height>0,d=Z(h,a,r),o=d.reduce((e,m)=>e+Math.max(0,m.width)*Math.max(0,m.height),0);if(o<=0)return null;let s=Math.max(1,Math.floor(Math.sqrt(o/Y))),p=r?t.data instanceof Float32Array?1:1/255:1,u=n((e,m)=>{if(!r)return!1;let T=w(e/a.width*t.width-.5,0,t.width-1),k=w(m/a.height*t.height-.5,0,t.height-1);return t.data[k*t.width+T]*p>=i.maskThreshold},"h"),y=n(e=>.299*a.data[e]+.587*a.data[e+1]+.114*a.data[e+2],"M"),x=0,C=[0,0,0],D=[0,0,0],S=0,E=0,G=0,L=0,P=0,z=0,B=0,q=0,F=0,j=0,Q=Math.min(...d.map(e=>e.x)),R=Math.max(...d.map(e=>e.x+e.width)),U=Math.min(...d.map(e=>e.y)),V=Math.max(...d.map(e=>e.y+e.height)),W=(Q+R)/2,X=(U+V)/2;for(let e of d){let m=w(e.x,0,a.width),T=w(e.x+e.width,0,a.width),k=w(e.y,0,a.height),J=w(e.y+e.height,0,a.height);for(let g=k;g<J;g+=s)for(let M=m;M<T;M+=s){if(u(M,g))continue;let K=(g*a.width+M)*4;for(let l=0;l<3;l+=1){let f=a.data[K+l];C[l]=C[l]+f,D[l]=D[l]+f*f}x+=1;let b=y(K);M<W?(G+=b,L+=1):(P+=b,z+=1),g<X?(B+=b,q+=1):(F+=b,j+=1);for(let[l,f]of[[M+s,g],[M,g+s]])l>=T||f>=J||u(l,f)||(S+=1,Math.abs(y((f*a.width+l)*4)-b)>i.edgeLuma&&(E+=1))}}if(x<i.minPixels)return null;let A=0;for(let e=0;e<3;e+=1){let m=C[e]/x;A+=Math.max(0,D[e]/x-m*m)}let N=Math.sqrt(A/3),v=S===0?0:E/S,c=n((e,m)=>m===0?null:e/m,"f"),H=n((e,m)=>e===null||m===null?0:Math.abs(e-m)/255,"R"),I=Math.max(H(c(G,L),c(P,z)),H(c(B,q),c(F,j)));return{method:r?"segmenter":"strip",uniform:N<=i.maxColorStd&&v<=i.maxEdgeDensity&&I<=i.maxGradient,colorStd:Math.round(N*10)/10,edgeDensity:Math.round(v*1e3)/1e3,gradient:Math.round(I*1e3)/1e3,pixels:x}}n(_,"Z");function $(a){let h=a!==null&&typeof a=="object"?a:{},t=O,i=n((r,d,o,s)=>typeof r=="number"&&Number.isFinite(r)&&r>=o&&r<=s?r:d,"r");return{enabled:typeof h.enabled=="boolean"?h.enabled:t.enabled,hz:i(h.hz,t.hz,.5,15),segmenterTimeoutMs:i(h.segmenterTimeoutMs,t.segmenterTimeoutMs,0,6e4),segmenterBudgetMs:i(h.segmenterBudgetMs,t.segmenterBudgetMs,1,2e3),maskThreshold:i(h.maskThreshold,t.maskThreshold,0,1),maxColorStd:i(h.maxColorStd,t.maxColorStd,0,255),maxEdgeDensity:i(h.maxEdgeDensity,t.maxEdgeDensity,0,1),edgeLuma:i(h.edgeLuma,t.edgeLuma,0,255),maxGradient:i(h.maxGradient,t.maxGradient,0,1),minPixels:i(h.minPixels,t.minPixels,1,1e6),timeoutMs:i(h.timeoutMs,t.timeoutMs,0,6e4)}}n($,"$");export{O as a,_ as b,$ as c};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-4FHWXBOB.js";var m=2e4,d="face_landmarker.task";function u(a){let t=[],r=a.faceLandmarks??[];for(let e=0;e<r.length;e+=1){let o=r[e]??[],l=a.faceBlendshapes?.[e]?.categories,s=null;if(l!==void 0){s={};for(let n of l)s[n.categoryName]=n.score}let c=a.facialTransformationMatrixes?.[e]?.data;t.push({landmarks:o.map(n=>({x:n.x,y:n.y})),blendshapes:s,matrix:c!==void 0&&c.length>=16?[...c]:null})}return t}i(u,"d");async function f(a){let t=a.replace(/\/+$/,""),r=await import("./vision_bundle-WBHR7TEE.js"),e=await r.FilesetResolver.forVisionTasks(t),o=await r.FaceLandmarker.createFromOptions(e,{baseOptions:{modelAssetPath:`${t}/${d}`,delegate:"CPU"},runningMode:"VIDEO",numFaces:2,outputFaceBlendshapes:!0,outputFacialTransformationMatrixes:!0});return{detect(l,s){try{return u(o.detectForVideo(l,s))}catch{return[]}},close(){try{o.close()}catch{}}}}i(f,"u");export{m as a,d as b,u as c,f as d};
@@ -0,0 +1 @@
1
+ import{a as g}from"./chunk-4FHWXBOB.js";var P=[468,473],U=[[33,133],[362,263]],$=[[33,7,163,144,145,153,154,155,133,173,157,158,159,160,161,246],[362,382,381,380,374,373,390,249,263,466,388,387,386,385,384,398]],Z=1;function Y(e){let l=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY,r=Number.NEGATIVE_INFINITY;for(let i of e)i.x<l&&(l=i.x),i.y<a&&(a=i.y),i.x>n&&(n=i.x),i.y>r&&(r=i.y);return e.length===0?{x:0,y:0,width:0,height:0}:{x:l,y:a,width:n-l,height:r-a}}g(Y,"j");var G=g((e,l)=>({x:(e.x+l.x)/2,y:(e.y+l.y)/2}),"A");function re(e,l,a){if(e.length<468)return null;let n=g(M=>{let b=e[M];return{x:b.x*l,y:b.y*a}},"a"),r=[0,1].map(M=>{let b=e.length>P[1]?n(P[M]):null,[u,h]=U[M];return b??G(n(u),n(h))}),i=$.map(M=>Y(M.map(n))),s=[];for(let M=0;M<Math.min(e.length,468);M+=1)s.push(n(M));let[f,m]=r,o=f.x>m.x,y=o?m:f,p=o?f:m;return{leftEye:y,rightEye:p,iod:Math.hypot(p.x-y.x,p.y-y.y),box:Y(s),nose:n(Z),leftEyeBox:o?i[1]:i[0],rightEyeBox:o?i[0]:i[1]}}g(re,"se");var S=180/Math.PI;function ee(e,l="column"){if(e.length<16||e.some(M=>!Number.isFinite(M)))return null;let a=g((M,b)=>l==="column"?e[b*4+M]:e[M*4+b],"o"),n=Math.hypot(a(0,0),a(1,0),a(2,0))||1,r=a(0,0)/n,i=a(1,0)/n,s=a(2,0)/n,f=a(2,1)/n,m=a(2,2)/n,o=Math.asin(Math.max(-1,Math.min(1,-s)))*S,y=Math.atan2(f,m)*S,p=Math.atan2(i,r)*S;return{yaw:o,pitch:y,roll:p}}g(ee,"W");function le(e){return Math.atan2(e.rightEye.y-e.leftEye.y,e.rightEye.x-e.leftEye.x)*S}g(le,"U");var H={width:480,height:640,eyeX:240,eyeY:289,iodMin:120,iodMax:160};function V(e){let l=H,a=e.iod>=l.iodMin&&e.iod<=l.iodMax?1:l.iodMin/Math.max(e.iod,1e-6),n=l.width/a,r=l.height/a,i=G(e.leftEye,e.rightEye);return{x:i.x-l.eyeX/l.width*n,y:i.y-l.eyeY/l.height*r,width:n,height:r}}g(V,"F");function te(e,l,a){let n=Math.max(0,-e.x),r=Math.max(0,-e.y),i=Math.max(0,e.x+e.width-l),s=Math.max(0,e.y+e.height-a);return Math.max((n+i)/e.width,(r+s)/e.height)}g(te,"Y");function ue(e,l,a,n){let r=V(e),i=r.x+r.width/2,s=r.y+r.height/2,f=H.width/H.height,m=Math.max(r.height*n.margin,n.minHeight,n.minWidth/f);m=Math.min(m,a,l/f);let o=m*f,y=Math.min(Math.max(i-o/2,0),Math.max(0,l-o)),p=Math.min(Math.max(s-m/2,0),Math.max(0,a-m));return{x:Math.round(y),y:Math.round(p),width:Math.round(o),height:Math.round(m)}}g(ue,"ue");var R=["face","framing","pose","eyes","mouth","glare","lighting","background","resolution","sharpness"],B=new Set(["glare","background"]),v=g(e=>({pass:!0,value:e,coach:null}),"k"),x=g((e,l)=>({pass:!1,value:e,coach:l}),"x"),O=g((e,l)=>({pass:e,value:null,coach:e?null:l,none:!0}),"O");function ae(e,l){let a=e.pose,n;if(a!==null){let u=a.pitch-l.pitchOffsetDeg,h=Math.max(Math.abs(a.yaw),Math.abs(u),Math.abs(a.roll));n=Math.abs(a.yaw)<=l.yawDeg&&Math.abs(u)<=l.pitchDeg&&Math.abs(a.roll)<=l.rollDeg?v(h):x(h,"pose")}else n={...O(!1,"pose"),value:e.eyeLineRoll??null};let r=O(!1,"eyes");if(e.eyes!==null){let{left:u,right:h}=e.eyes,d=Math.min(u,h),c=e.baselines,N=1-l.eyes.blinkMax;if(c!=null&&c.left>0&&c.left<=1&&c.right>0&&c.right<=1){let k=Math.max(u,h)>=N-1e-9&&d>=l.eyes.lowerEyeMin-1e-9&&u>=l.eyes.relativeMin*c.left-1e-9&&h>=l.eyes.relativeMin*c.right-1e-9,I=Math.min(u/c.left,h/c.right);r=k?v(I):x(I,"eyes")}else{let k=e.baseline,I=Math.max(N,k!==null&&k>0&&k<=1?l.eyes.relativeMin*k:0),L=k!==null&&k>0?d/k:null;r=d>=I-1e-9?v(L):x(L,"eyes")}}let i=O(!1,"mouth");if(e.mouth!==null){let{jawOpen:u,smile:h,pucker:d}=e.mouth,c=Math.max(u/l.mouth.jawOpenMax,h/l.mouth.smileMax,d/l.mouth.puckerMax);i=u<=l.mouth.jawOpenMax&&h<=l.mouth.smileMax&&d<=l.mouth.puckerMax?v(c):x(c,"mouth")}let s=e.lighting,f=O(!0,"lighting");if(s!==null){let[u,h]=l.lighting.faceLuma,[d,c]=l.lighting.halfRatio;f=s.faceLuma<u||s.faceLuma>h||s.clipped>l.lighting.clippedMax?x(s.faceLuma,"lighting"):s.halfRatio<d||s.halfRatio>c?x(s.halfRatio,"lighting_side"):v(s.faceLuma)}let m=e.uniformity,o=e.background,y=l.background.required?m!=null&&l.backgroundCheck.enabled?m.uniform?v(m.colorStd):x(m.colorStd,"background"):o===null?O(!0,"background"):o.luma>=l.background.lumaMin&&o.sd<=l.background.lumaSdMax?v(o.luma):x(o.luma,"background"):O(!0,"background"),p=l.resolution,M=Math.min(e.frameWidth,e.frameHeight)>=p.minWidth&&Math.max(e.frameWidth,e.frameHeight)>=p.minHeight,b=e.iod>=p.minIodPx&&M?v(e.iod):x(e.iod,"resolution");return{pose:n,eyes:r,mouth:i,lighting:f,background:y,resolution:b}}g(ae,"te");function q(e){let l=e?.eyeBlinkLeft,a=e?.eyeBlinkRight;return typeof l!="number"||typeof a!="number"?null:{left:1-l,right:1-a,blinkLeft:l,blinkRight:a}}g(q,"D");function ne(e,l){if(e.length===0)return null;let a=[...e].sort((r,i)=>r-i),n=Math.min(a.length-1,Math.max(0,Math.ceil(l*a.length)-1));return a[n]}g(ne,"oe");function D(e,l,a,n=null){let r={},i=e.geometry;if(e.faces!==1||i===null){let h=e.faces>1?x(e.faces,"multiple_faces"):x(e.faces,"no_face");for(let d of R)r[d]=d==="face"?h:O(!1,"no_face");return{results:r,pose:null}}r.face=v(1);let s=V(i),f=te(s,e.frameWidth,e.frameHeight);r.framing=s.height>e.frameHeight*1.02||s.width>e.frameWidth*1.02?x(f,"too_close"):f>.02?x(f,"center"):v(f);let m=e.matrix!=null?ee(e.matrix):null,o=q(e.blendshapes),y=e.blendshapes,p=e.stats??null,M=ae({pose:m,eyeLineRoll:Math.abs(le(i)),eyes:o,baseline:a,baselines:n,mouth:y==null?null:{jawOpen:y.jawOpen??0,smile:Math.max(y.mouthSmileLeft??0,y.mouthSmileRight??0),pucker:y.mouthPucker??0},lighting:p?.lighting??null,background:p?.background??null,uniformity:e.backgroundCheck??null,iod:i.iod,frameWidth:e.frameWidth,frameHeight:e.frameHeight},l);Object.assign(r,M);let b=p?.eyeSpecular??null;r.glare=b===null?O(!0,"glare"):b<=l.glare.specularMax?v(b):x(b,"glare");let u=p?.sharpness??null;return r.sharpness=u===null||u>=l.sharpnessMin?v(u):x(u,"hold_still"),{results:r,pose:m}}g(D,"V");var ie={pose:"pose",eyes:"eyes",mouth:"mouth",glare:"glare",lighting:"lighting",background:"background",framing:"resolution",resolution:"resolution"};function he(e,l={}){let a=l.policy==="alert",n=new Map,r=0,i=null,s=null,f={},m=[],o=null,y=null,p=null,M=0,b=g(u=>{let h=ne(m.map(u),e.baseline.percentile);return h===null||h<=0?null:Math.min(1,h)},"y");return{push(u,h){let d=D(u,e,null),c=u.blendshapes;if(d.results.face.pass&&c!=null){let t=g(Q=>Math.round(Math.min(1,Math.max(0,Q??0))*1e3)/1e3,"t"),w={jawOpen:t(c.jawOpen),smile:t(Math.max(c.mouthSmileLeft??0,c.mouthSmileRight??0)),pucker:t(c.mouthPucker)};p===null&&(M=h);let _=p?.lowest??w;p={elapsedMs:Math.round(h-M),latest:w,lowest:{jawOpen:Math.min(_.jawOpen,w.jawOpen),smile:Math.min(_.smile,w.smile),pucker:Math.min(_.pucker,w.pucker)}}}let N=q(u.blendshapes);N!==null&&d.results.face.pass&&d.results.pose.pass&&m.push({at:h,left:N.left,right:N.right}),m=m.filter(t=>h-t.at<=e.baseline.windowMs);let k=m.length>=e.baseline.minSamples,I=k?b(t=>(t.left+t.right)/2):null,L=k?b(t=>t.left):null,T=k?b(t=>t.right):null,W=L!==null&&T!==null?{left:L,right:T}:null,{results:E,pose:A}=D(u,e,I,W);for(let t of R)E[t].pass&&(t!=="eyes"||I!==null)?n.has(t)||n.set(t,h):n.delete(t);let F=g(t=>{let w=n.get(t);return w!==void 0&&h-w>=e.holdMs},"H");R.filter(t=>!B.has(t)).every(F)?i??(i=h):i=null;let X=g(t=>t==="background"&&u.backgroundCheck!=null?e.backgroundCheck.timeoutMs:e.softGraceMs,"X"),z=g(t=>B.has(t)&&!E[t].pass&&i!==null&&h-i>=X(t),"J"),j=R.map(t=>({criterion:t,pass:E[t].pass,held:F(t),waived:z(t),value:E[t].value,coach:E[t].pass?null:E[t].coach}));r=j.every(t=>t.pass||t.waived)?r+1:0;let C=j.find(t=>!t.pass&&!t.waived)??null,J=j.filter(t=>t.held||t.waived).length;E.face.pass&&E.framing.pass?s??(s=h):s=null;let K=j.every(t=>t.held||t.waived)&&r>=e.holdFrames||a&&s!==null&&h-s>=e.alertGraceMs;f={};for(let t of R){let w=ie[t];w!==void 0&&E[t].none!==!0&&(f[w]=(f[w]??!0)&&E[t].pass)}return y=u.backgroundCheck??null,o={criteria:j,coach:C?.coach??"hold",failing:C?.criterion??null,progress:J/j.length,ready:K,baseline:I,baselines:W,pose:A},o},last:g(()=>o,"last"),scores:g(()=>p,"scores"),summary(){let u={criteria:{}};if(o===null)return u;u.verdict={...f},o.baseline!==null&&Math.round(o.baseline*1e3)>0&&(u.baselineEyeOpenness=Math.round(o.baseline*1e3)/1e3);let h=o.baselines;h!==null&&Math.round(h.left*1e3)>0&&Math.round(h.right*1e3)>0&&(u.baselineEyeOpennessLeft=Math.round(h.left*1e3)/1e3,u.baselineEyeOpennessRight=Math.round(h.right*1e3)/1e3);for(let d of o.criteria){let c=d.value===null||!Number.isFinite(d.value)?null:Math.round(d.value*1e3)/1e3;u.criteria[d.criterion]=d.waived?{pass:d.pass,value:c,waived:!0}:{pass:d.pass,value:c}}if(y!==null&&e.background.required){let{pixels:d,...c}=y;u.backgroundCheck=c}return u},reset(){n.clear(),r=0,i=null,s=null,f={},o=null,y=null,p=null}}}g(he,"me");export{re as a,V as b,ue as c,R as d,ae as e,q as f,ne as g,D as h,he as i};
@@ -0,0 +1 @@
1
+ import{d as Et,e as Bt,f as Wt,g as qt}from"./chunk-TCW6XNLI.js";import{a as it,b as zt,c as rt,d as Ht}from"./chunk-UZWMCNZI.js";import{a as kt,b as V,c as Tt,d as _t,e as St,g as At,h as tt,i as It,j as xt,k as Nt,l as Lt}from"./chunk-D334IAZJ.js";import{a as Dt,b as Rt,c as Ct,d as Ot,e as Pt,f as et,g as K,h as Gt,i as Ut,j as Ft}from"./chunk-RRLXNT33.js";import{a as o}from"./chunk-4FHWXBOB.js";var me=1e4,C,pe=(C=class{constructor(t,e){this.tier="blaze",this.inner=t,e!==void 0&&(this.fallbackReason=e)}static async create(t,e){let r=await import("./vision_bundle-WBHR7TEE.js"),s=await r.FilesetResolver.forVisionTasks(t),a=await r.FaceDetector.createFromOptions(s,{baseOptions:{modelAssetPath:`${t}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new C(a,e)}async detect(t,e,r){let s;try{s=this.inner.detect(t).detections}catch{return null}let a=ge(s);if(a?.boundingBox===void 0)return null;let n=Z(t),l=ve(a.keypoints,n),c=a.keypoints?.[2],h={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...l!==void 0?{eyes:l}:{},...c!==void 0?{nose:{x:c.x*n.width,y:c.y*n.height}}:{},score:a.categories[0]?.score??0,extraFaces:Kt(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return Xt(h,t,e,r)}destroy(){try{this.inner.close()}catch{}}},o(C,"t"),C);function ge(i){let t,e=-1;for(let r of i){let s=r.categories[0]?.score??0;s>e&&(t=r,e=s)}return t}o(ge,"R");function ve(i,t){let e=i?.[0],r=i?.[1];if(e===void 0||r===void 0)return;let s=o(l=>({x:l.x*t.width,y:l.y*t.height}),"n"),[a,n]=[s(e),s(r)];return a.x<=n.x?{left:a,right:n}:{left:n,right:a}}o(ve,"T");function ye(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}o(ye,"E");var we=4;async function be(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let t=new i({fastMode:!0,maxDetectedFaces:we});return await t.detect(ye()),{ok:!0,instance:t}}catch(t){return{ok:!1,reason:`smoke_failed:${t instanceof Error?t.message:String(t)}`}}}o(be,"w");var P,Me=(P=class{constructor(t,e){this.tier="native",this.inner=t,e!==void 0&&(this.fallbackReason=e)}async detect(t,e,r){let s;try{s=await this.inner.detect(t)}catch{return null}let a=s.map(d=>d.boundingBox),n=-1;a.forEach((d,u)=>{let v=a[n];(v===void 0||d.width*d.height>v.width*v.height)&&(n=u)});let l=s[n];if(l===void 0)return null;let c=ke(l.landmarks),h={box:{x:l.boundingBox.x,y:l.boundingBox.y,width:l.boundingBox.width,height:l.boundingBox.height},...c!==void 0?{eyes:c}:{},score:1,extraFaces:Kt(a,n)};return Xt(h,t,e,r)}destroy(){}},o(P,"b"),P);function ke(i){if(i===void 0)return;let t=i.filter(s=>s.type==="eye").map(s=>s.locations[0]).filter(s=>s!==void 0),[e,r]=t;if(!(e===void 0||r===void 0))return e.x<=r.x?{left:e,right:r}:{left:r,right:e}}o(ke,"S");var Te=.25;function Kt(i,t){let e=i[t],r=e===void 0?0:e.width*e.height;if(!(r>0))return 0;let s=0;return i.forEach((a,n)=>{n!==t&&a.width*a.height>=Te*r&&(s+=1)}),s}o(Kt,"f");var at="/models-v3",_e=["native","blaze"],G,nt=(G=class extends Error{constructor(t){super(`no detector tier available (${t})`),this.name="DetectorLadderError",this.fallbackReason=t}},o(G,"x"),G);function Z(i){let t=i;if(typeof t.videoWidth=="number"&&t.videoWidth>0)return{width:t.videoWidth,height:t.videoHeight??0};if(typeof t.naturalWidth=="number"&&t.naturalWidth>0)return{width:t.naturalWidth,height:t.naturalHeight??0};let e=typeof t.width=="number"?t.width:0,r=typeof t.height=="number"?t.height:0;return{width:e,height:r}}o(Z,"y");function Xt(i,t,e,r){let s=Z(t),a=s.width>0?e/s.width:1,n=s.height>0?r/s.height:1,l=o(c=>({x:c.x*a,y:c.y*n}),"s");return{box:{x:i.box.x*a,y:i.box.y*n,width:i.box.width*a,height:i.box.height*n},...i.eyes!==void 0?{eyes:{left:l(i.eyes.left),right:l(i.eyes.right)}}:{},...i.nose!==void 0?{nose:l(i.nose)}:{},score:i.score,...i.extraFaces!==void 0?{extraFaces:i.extraFaces}:{}}}o(Xt,"h");function Ee(i){return i instanceof Error?i.message:String(i)}o(Ee,"C");async function x(i){let t=i.preferred??_e,e=[];for(let r of t){if(r==="native"){let s=await be();if(s.ok)return new Me(s.instance,st(e));e.push(`native:${s.reason}`);continue}try{return await Se(pe.create(i.v3AssetBaseUrl??at,st(e)),i.blazeInitTimeoutMs??me)}catch(s){e.push(s instanceof Vt?"blaze:blaze_init_timeout":`blaze:${Ee(s)}`)}}throw new nt(st(e)??"no_tier_available")}o(x,"O");function st(i){return i.length>0?i.join("; "):void 0}o(st,"v");var U,Vt=(U=class extends Error{},o(U,"g"),U);function Se(i,t){return new Promise((e,r)=>{let s=setTimeout(()=>{r(new Vt(`init exceeded ${t}ms`)),i.then(a=>a.destroy(),()=>{})},t);i.then(a=>{clearTimeout(s),e(a)},a=>{clearTimeout(s),r(a)})})}o(Se,"W");var R=1;function Zt(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(Zt,"K");function Ae(i,t={}){let e=t.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==R){a.bitmap?.close?.();return}if(a.type==="init"){e(a.options).then(n=>{r=n;let l={v:R,type:"ready",tier:n.tier,...n.fallbackReason!==void 0?{fallbackReason:n.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let n=o(l=>{let c={v:R,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){n(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(n,()=>n(null))}}}o(Ae,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Ae(self);var O,jt=(O=class{constructor(t,e){this.pending=new Map,this.nextId=1,this.worker=t,this.tier=e.tier,e.fallbackReason!==void 0&&(this.fallbackReason=e.fallbackReason),t.addEventListener("message",r=>{let s=r.data;if(s.v!==R||s.type!=="result")return;let a=this.pending.get(s.id);this.pending.delete(s.id),a?.(s.observation)})}static create(t,e,r=1e4){return new Promise((s,a)=>{let n=setTimeout(()=>{t.removeEventListener("message",l),t.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=o(h=>{let d=h.data;d.v!==R||d.type!=="ready"||(clearTimeout(n),t.removeEventListener("message",l),s(new O(t,d)))},"s");t.addEventListener("message",l);let c={v:R,type:"init",options:e};t.postMessage(c)})}async detect(t,e,r){let s;try{typeof ImageBitmap<"u"&&t instanceof ImageBitmap?s=t:typeof createImageBitmap=="function"?s=await createImageBitmap(t):s=t}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(n=>{this.pending.set(a,n);let l={v:R,type:"detect",id:a,bitmap:s,streamWidth:e,streamHeight:r};this.worker.postMessage(l,[s])})}destroy(){for(let t of this.pending.values())t(null);this.pending.clear(),this.worker.terminate()}},o(O,"t"),O);var Ie=[...Dt.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],se=new Set;function xe(i){let t=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return t?Number(t[1]):null}o(xe,"De");function De(i=Ce(),t=globalThis.navigator?.userAgent){if(i===void 0)return"";let e=xe(t)===126;for(let r of Ie)if(!(se.has(r)||e&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(De,"he");function $t(i){i!==""&&se.add(i)}o($t,"F");function Re(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Re,"fe");function ae(i){let t=/codecs=["']?([^,;"']+)/i.exec(i);return t?t[1].trim():i.split(";")[0].trim()}o(ae,"ut");function Ce(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?t=>i.isTypeSupported(t):void 0}o(Ce,"Oe");var ne=2500,Oe=1e3,Pe=1500,Yt=25e5,Ge=100,Ue=700,Fe=20,Ne=1500,j=null;function Le(){return j??(j=import("./clip-inspect-HZ7N2YOP-DCDXB76T.js").catch(i=>{throw j=null,i})),j.catch(()=>null)}o(Le,"Ne");var N,D=(N=class extends Error{constructor(t,e){super(e??t),this.kind=t}},o(N,"S"),N),Be=100;function Qt(i,t){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<t-Be}o(Qt,"U");function We(i,t){return i.stats?t.stats?i.stats.durationMs>t.stats.durationMs:!0:!1}o(We,"ge");var L,qe=(L=class{constructor(t={}){this.recorder=null,this.stream=null,this.chunks=[],this.bytes=0,this.hardStopTimer=null,this.graceTimer=null,this.pollTimer=null,this.settled=!1,this.now=t.now??(()=>globalThis.performance?.now?.()??Date.now())}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.pollTimer&&clearInterval(this.pollTimer),this.hardStopTimer=null,this.graceTimer=null,this.pollTimer=null}record(t,e,r,s=ne,a){let n=De(),l=Le();return this.recordRaw(t,e,r,s,a,n).then(c=>ze(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=n),c})}recordRaw(t,e,r,s,a,n){return this.recorder&&!this.settled?Promise.reject(new D("generic","record() called while a recording is in flight — ClipRecorder handles one recording at a time")):(this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=t,new Promise((l,c)=>{let h;try{h=new MediaRecorder(t,n?{mimeType:n,videoBitsPerSecond:Yt}:{videoBitsPerSecond:Yt})}catch{try{h=new MediaRecorder(t)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=o(p=>{this.settled||(this.settled=!0,this.clearTimers(),p())},"d"),u=o(()=>d(()=>{let p=Re(h.mimeType||n||Rt),M=new Blob(this.chunks,{type:p});if(M.size===0){c(new D("generic","empty clip"));return}if(et(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:p,requestedMimeType:n})}),"u");h.ondataavailable=p=>{p.data&&p.data.size&&(this.chunks.push(p.data),this.bytes+=p.data.size,this.bytes>Pt&&d(()=>{try{h.state!=="inactive"&&h.stop()}catch{}c(new D("cliptoolarge"))}))},h.onstop=u,h.onerror=()=>d(()=>c(new D("generic")));let v=this.now();if(r!==void 0||a!==void 0){let p=!1;h.onstart=()=>{if(!(p||this.settled)&&(p=!0,v=this.now(),r!==void 0))try{r()}catch{}}}try{h.start(Oe)}catch{d(()=>c(new D("generic")));return}let w=o(()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||e?.(),h.state!=="inactive"){try{h.stop()}catch{u()}this.graceTimer=setTimeout(u,Pe)}else u()},"v"),m=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let g=null,y=!1;this.hardStopTimer=setTimeout(w,s+Ue),this.pollTimer=setInterval(()=>{if(this.settled||y)return;let p=null;try{p=a.latest()}catch{p=null}let M=p?.presentationTimeMs;M!==void 0&&Number.isFinite(M)&&M>=v&&g===null&&(g=M);let T=g!==null&&M!==void 0&&M-g>=s,A=g===null&&this.now()-m>=s;if(!(!T&&!A)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,A){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Ge)}},Fe)}))}stop(t){this.clearTimers();let e=this.recorder;if(e&&e.state!=="inactive")try{e.stop()}catch{}this.recorder=null,(t??this.stream)?.getTracks().forEach(r=>r.stop()),this.stream=null}},o(L,"I"),L);async function ze(i,t){let e,r=new Promise(h=>{e=setTimeout(()=>h(null),Ne)}),s=await Promise.race([t,r]);if(clearTimeout(e),s===null)return i;let a;try{a=await s.blobBytes(i.blob)}catch{return{...i,stats:null}}let n=s.inspectClipBytes(a);if(n?.container!=="webm")return{...i,stats:n};let l=s.withWebmDuration(a,n.durationMs);if(l===null)return{...i,stats:n};let c=s.inspectClipBytes(l);return c===null||c.frames!==n.frames||c.durationMs!==n.durationMs?{...i,stats:n}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:n}}o(ze,"He");var He=["magenta","yellow","green","blue"],Ke={magenta:"rgb(255, 72, 150)",yellow:"rgb(255, 190, 0)",green:"rgb(0, 238, 175)",blue:"rgb(25, 150, 255)",dark:"rgb(0, 0, 0)"};function zi(i){return Ke[i]}o(zi,"ft");var Xe=4,Ve=4,$=o(i=>typeof i=="number"&&Number.isFinite(i),"D");function oe(i){if(typeof i!="object"||i===null)return!1;let t=i;if(typeof t.nonce!="string"||t.nonce.length===0||!Array.isArray(t.colours)||t.colours.length<1||t.colours.length>8||!t.colours.every(r=>He.includes(r))||!Array.isArray(t.onsetsMs)||t.onsetsMs.length!==t.colours.length)return!1;let e=-1;for(let r of t.onsetsMs){if(!$(r)||r<0||r<=e)return!1;e=r}return!(!$(t.holdMs)||t.holdMs<=0||!$(t.endMs)||t.endMs<=e||!$(t.clipMs)||t.clipMs<t.endMs||t.clipMs>8e3)}o(oe,"be");function Ze(i,t){return oe(i)?Math.max(t,Math.ceil(i.clipMs)):t}o(Ze,"ye");function je(i,t){let e=t.now??(()=>performance.now()),r=oe(i)?i:void 0,s=[],a=null,n=null,l=null,c=!1,h=null,d=o(m=>{h=m;try{t.paint(m)}catch{}},"d"),u=o(m=>{let g=t.frames?.()??null;return g!==null&&l!==null?g.mediaTimeMs+(m-g.presentationTimeMs)-l:m-(n??m)},"u"),v=o((m,g,y=0)=>{if(c)return;let p=Math.max(0,m-u(e()));a=setTimeout(()=>{if(a=null,!c){if(y<Xe&&u(e())<m-Ve){v(m,g,y+1);return}g()}},p)},"f"),w=o(m=>{if(r===void 0)return;let g=r.endMs;if(m>=r.colours.length){v(g,()=>d(null));return}let y=r.onsetsMs[m],p=m+1<r.onsetsMs.length?r.onsetsMs[m+1]:g;v(y,()=>{let M=u(e());if(M>g){h!==null&&d(null);return}let T=r.colours[m];d(T);let A=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(A,Math.round(M)),colour:T});let k=y+r.holdMs;if(k<p){v(k,()=>{if(u(e())>g){h!==null&&d(null);return}d("dark"),w(m+1)});return}w(m+1)})},"v");return{started(m){if(r===void 0||c||n!==null)return;n=m;let g=t.frames?.()??null;l=g===null?null:g.mediaTimeMs+(m-g.presentationTimeMs),w(0)},stop(){c||(c=!0,a!==null&&clearTimeout(a),a=null,h!==null&&d(null))},report(){return r===void 0?void 0:{nonce:r.nonce,rendered:[...s]}}}}o(je,"Me");function $e(i,t,e=.92){return new Promise((r,s)=>{let a=i.videoWidth,n=i.videoHeight;if(!a||!n){s(new Error("video-not-ready"));return}let l=t.getContext("2d");if(!l){s(new Error("no-2d-context"));return}t.width=a,t.height=n,l.scale(-1,1),l.drawImage(i,-a,0),t.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",e)})}o($e,"Se");var B,Ye=(B=class{constructor(t){this.timer=null,this.frameCallbackId=null,this.running=!1,this.busy=!1,this.lastRunAt=Number.NEGATIVE_INFINITY,this.degradeCount=0,this.durations=[],this.options=t,this.periodMs=1e3/t.cadenceHz}start(){if(this.running)return;this.running=!0;let t=this.options.video;if(typeof t?.requestVideoFrameCallback=="function"){let e=o(()=>{this.running&&(this.frameCallbackId=t.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),e()}))},"t");e();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let t=this.durations.length===0?0:this.durations.reduce((e,r)=>e+r,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:t}}now(){return this.options.now?.()??performance.now()}tick(){if(!this.running)return;if(this.busy){this.degradeCount+=1;return}this.busy=!0,this.lastRunAt=this.now();let t=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-t),this.durations.length>20&&this.durations.shift()})}},o(B,"O"),B),Qe=Object.freeze({Q_GOOD:.6,RISE_PER_S:.9,FALL_PER_S:.25,CENTER_FALLOFF_IOD_MULTIPLE:1.35,BOX_EYE_OFFSET_FACTOR:.12,IOD_BOX_PROXY_FACTOR:.42,SIZE_IDEAL_MIN:.12,SIZE_IDEAL_MAX:.3,SIZE_HARD_MIN:.08,SIZE_HARD_MAX:.45,ROLL_MAX_DEG:25,MOTION_VELOCITY_IOD_PER_S:.5,MOTION_TAU_S:.4,MOTION_DEADBAND_IOD_PER_S:.1,READY_WINDOW_MS:500,GUIDE_SIZE:.6,GUIDE_CENTERING:.6,GUIDE_POSE:.6,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,GUIDE_MOTION:.5}),F=o(i=>Math.min(1,Math.max(0,i)),"_"),W,Jt=(W=class{constructor(t={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...Qe,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(t){let{observation:e,quality:r,timestampMs:s}=t,a=this.lastTickAt===null?0:Math.max(0,(s-this.lastTickAt)/1e3);this.lastTickAt=s;let n={presence:0,single:1,centering:0,size:0,pose:0,sharpness:F(r.sharpness),exposure:F(r.exposure),motion:1};if(e!==null){n.presence=1,n.single=(e.extraFaces??0)>0?0:1;let d=this.geometryOf(e,t);n.centering=d.centering,n.size=d.size,n.pose=d.pose,n.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(n.presence,n.single,n.centering,n.size,n.pose,n.sharpness,n.exposure,n.motion);this.p=F(this.p+(l>=this.t.Q_GOOD?this.t.RISE_PER_S*l:-this.t.FALL_PER_S*(1-l))*a),this.qWindow.push({at:s,q:l}),this.qWindow=this.qWindow.filter(d=>d.at>=s-this.t.READY_WINDOW_MS);let c=this.qWindow.map(d=>d.q);if(c.length>=3){let d=Math.min(...c),u=c.indexOf(d);c=c.filter((v,w)=>w!==u)}let h=this.p>=1&&c.every(d=>d>=this.t.Q_GOOD);return{at:s,q:l,p:this.p,factors:n,guidanceKey:this.guidanceOf(n,r,l),ready:h,accepted:l>=this.t.Q_GOOD}}geometryOf(t,e){let{box:r,eyes:s}=t,a={x:e.frameWidth/2,y:e.frameHeight/2},n=Math.min(e.frameWidth,e.frameHeight),l=s!==void 0?{x:(s.left.x+s.right.x)/2,y:(s.left.y+s.right.y)/2}:{x:r.x+r.width/2,y:r.y+r.height/2-this.t.BOX_EYE_OFFSET_FACTOR*r.height},c=s!==void 0?Math.hypot(s.right.x-s.left.x,s.right.y-s.left.y):this.t.IOD_BOX_PROXY_FACTOR*r.width,h=Math.hypot(l.x-a.x,l.y-a.y),d=c<=0?0:1-F(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=n>0?c/n:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let v;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?v=0:u<this.t.SIZE_IDEAL_MIN?v=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?v=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):v=1;let w=1;if(s!==void 0){let m=Math.abs(Math.atan2(s.right.y-s.left.y,s.right.x-s.left.x))*180/Math.PI;w=1-F(m/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:v,pose:w}}motionOf(t,e,r){let s=this.lastCenter;if(this.lastCenter={...t,at:r},s===null||e<=0)return 1;let a=(r-s.at)/1e3;if(a<=0)return 1;let n=Math.hypot(t.x-s.x,t.y-s.y)/e/a;n<=this.t.MOTION_DEADBAND_IOD_PER_S&&(n=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*n+(1-l)*this.velocityEma,1-F(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(t,e,r){if(t.presence<=0)return"fcv3.no_face";if(t.single<=0)return"fcv3.one_face";if(t.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(t.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(t.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(t.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(e);if(t.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(t.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(r<this.t.Q_GOOD){let s=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(e)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=s[0];for(let n of s)t[n[0]]<t[a[0]]&&(a=n);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(t){let e=(it[0]+it[1])/2;return t.meanLuma<e?"fcv3.more_light":"fcv3.too_bright"}},o(W,"k"),W),Je=["single","size","centering","pose","exposure","sharpness","motion"];function ti(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let t="single";for(let e of Je)i.factors[e]<i.factors[t]&&(t=e);return t}o(ti,"Ze");var q,te=(q=class{constructor(){this.blocked={},this.acceptedMs=0,this.ticks=0,this.lastAt=null}record(t){let e=this.lastAt===null?0:Math.max(0,t.at-this.lastAt);this.lastAt=t.at,this.ticks+=1;let r=ti(t);if(r===null){this.acceptedMs+=e;return}let s=this.blocked[r]??{count:0,ms:0};s.count+=1,s.ms+=e,this.blocked[r]=s}summary(){let t={};for(let[e,r]of Object.entries(this.blocked))t[e]={count:r.count,ms:Math.round(r.ms)};return{blocked:t,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}},o(q,"w"),q),ei=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],ii=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^caméra (avant|arrière)\b/i,/^cámara (frontal|trasera|delantera)\b/i,/^câmera (frontal|traseira)\b/i,/^(front|rück)kamera\b/i,/^الكاميرا (الأمامية|الخلفية)/,/^camera2? ?\d+, facing (front|back|external)/i,/facetime/i,/\b(integrated|built-in|builtin) (web)?cam(era)?\b/i,/\b(hd )?web ?cam\b/i,/\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i];function ri(i){let t=(i??"").trim().toLowerCase();return t.length===0?"unknown":ei.some(e=>t.includes(e))?"known_virtual":ii.some(e=>e.test(t))?"platform":"unknown"}o(ri,"je");function ee(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ee,"Te");function si(i=globalThis){return ee(i.navigator?.mediaDevices?.getUserMedia)&&ee(i.MediaStreamTrack?.prototype?.getSettings)}o(si,"$e");async function ai(i,t=globalThis){let e=t.crypto?.subtle?.digest;if(typeof e=="function")try{let r=new Uint8Array(await e.call(t.crypto?.subtle,"SHA-256",new TextEncoder().encode(i)));return Array.from(r.subarray(0,8),s=>s.toString(16).padStart(2,"0")).join("")}catch{return}}o(ai,"Je");async function ni(i,t=globalThis){let e={};try{e=typeof i.getSettings=="function"?i.getSettings()??{}:{}}catch{e={}}let r={};if((e.facingMode==="user"||e.facingMode==="environment"||e.facingMode==="left"||e.facingMode==="right")&&(r.facingMode=e.facingMode),typeof e.frameRate=="number"&&Number.isFinite(e.frameRate)&&(r.frameRate=e.frameRate),typeof e.width=="number"&&Number.isFinite(e.width)&&(r.width=e.width),typeof e.height=="number"&&Number.isFinite(e.height)&&(r.height=e.height),typeof e.deviceId=="string"&&e.deviceId.length>0){let a=await ai(e.deviceId,t);a!==void 0&&(r.deviceIdHash=a)}let s;try{s=i.label}catch{s=void 0}return{trackSettings:r,capabilitiesPresent:typeof i.getCapabilities=="function",labelClass:ri(s),prototypesIntact:si(t)}}o(ni,"Ce");var ot=o(i=>Math.round(i*100)/100,"H");function oi(i){let t=i,e=typeof t?.requestVideoFrameCallback=="function",r=null,s=null,a=0,n=0,l=0,c=0,h=0,d=0,u=o(()=>{!e||t?.requestVideoFrameCallback===void 0||(r=t.requestVideoFrameCallback((v,w)=>{if(r=null,!e)return;let m=w.presentationTime;if(s!==null){let g=m-s.presentationTimeMs;n+=1;let y=g-l;l+=y/n,c+=y*(g-l)}typeof w.captureTime=="number"&&Number.isFinite(w.captureTime)&&(h+=m-w.captureTime,d+=1),a+=1,s={mediaTimeMs:w.mediaTime*1e3,presentationTimeMs:m},u()}))},"u");return u(),{latest:o(()=>s,"latest"),stats:o(()=>({n:a,meanGapMs:n===0?0:ot(l),stdGapMs:n<2?0:ot(Math.sqrt(c/(n-1))),captureLatencyMs:d===0?null:ot(h/d)}),"stats"),stop:o(()=>{e&&(e=!1,r!==null&&t?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}o(oi,"Ee");function li(i,t,e){return{...i,rvfc:t,rampPainter:e}}o(li,"_e");var ci=1e3,lt="fcv3.hold_upright",hi=200,ct=4,ui=600,di=1e3,ie={sharpness:1,exposure:1,meanLuma:128};function fi(i,t){return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),new Promise((e,r)=>t.toBlob(s=>s?e(s):r(new Error("empty-keyframe")),"image/jpeg",.92))}o(fi,"it");function mi(){return V()==="phone"}o(mi,"at");var z,le=(z=class{constructor(t){this.handlers=new Map,this.stateValue="idle",this.attempt=0,this.stream=null,this.detector=null,this.scheduler=null,this.gate=null,this.profiler=null,this.lastGuidanceKey=null,this.positioningStartedAt=0,this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.fired=!1,this.carriedDegrade=0,this.carriedMeans=[],this.blockStats=null,this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY,this.uprightGuard=!1,this.trackProvenance=null,this.ramp=null,this.snapshotCanvas=null,this.options=t,this.facing=t.facingMode??"user"}get state(){return this.stateValue}on(t,e){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(e),()=>r?.delete(e)}emit(t,e){for(let r of[...this.handlers.get(t)??[]])r(e)}async start(t={}){t.facingMode!==void 0&&(this.facing=t.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}restart(t){this.facing=t,this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(t){let{options:e}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.uprightGuard=(e.isPhone??mi)(),this.setState("preflight");let r=Ct();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let s=e.getUserMedia??(h=>navigator.mediaDevices.getUserMedia(h)),a;this.cameraRequestedAt=this.now();try{let{facingMode:h,...d}=kt(Tt(),this.facing).video;a=await Lt(this.facing,d,{getUserMedia:s,enumerateDevices:vi(e)})}catch(h){if(t!==this.attempt)return;if(h instanceof Nt){this.fail("backcamera",{phase:"acquiring",name:K(h)});return}this.fail(Ut(h),{phase:"acquiring",name:K(h)});return}if(Et(a),Ft(a),t!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let n=a.getVideoTracks?.()[0];if(this.trackProvenance=n===void 0?null:ni(n).catch(()=>null),this.facing=_t(a)??this.facing,e.video.srcObject=a,await e.video.play().catch(()=>{}),t!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let h={v3AssetBaseUrl:e.v3AssetBaseUrl},d=e.createDetector??(e.createWorker!==void 0&&Zt()?async()=>{try{return await jt.create(e.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(v){t===this.attempt&&this.fail("models",{phase:"models",name:K(v)},v instanceof nt?v.fallbackReason:gi(v));return}if(t!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=Bt(),c=e.deviceClass??Wt(l);this.profiler=new qt(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new Jt(e.thresholds??{}),this.blockStats=new te,this.lastGateSnapshotAt=this.now(),e.rankKeyframes?.()&&import("./keyframe-rank-R4NPQGN3-VRURE6OQ.js").then(h=>ht=h,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(t)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(t){let e=this.profiler;if(e===null)return;if(this.scheduler!==null){let s=this.scheduler.stats();this.carriedDegrade+=s.degradeCount,s.meanDetectMs>0&&this.carriedMeans.push(s.meanDetectMs),this.scheduler.stop()}let r=new Ye({cadenceHz:e.profile.cadenceHz,video:this.options.video,now:this.options.now,run:o(()=>this.detectTick(t),"run")});this.scheduler=r,r.start()}async detectTick(t){let{detector:e,gate:r,profiler:s}=this,a=this.options.video;if(t!==this.attempt||e===null||r===null||s===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(t);return}let n=s.deviceClass,l=this.now(),c=this.options.makeSnapshot?.(a,s.profile.inputWidth)??this.defaultSnapshot(a,s.profile.inputWidth),h=null;try{h=await e.detect(c,a.videoWidth,a.videoHeight)}catch{h=null}if(t!==this.attempt||this.fired)return;s.record(this.now()-l),s.deviceClass!==n&&this.startScheduler(t);let d=h===null?ie:this.options.measureQuality?.(a,h.box)??this.defaultQuality(a,h.box),u=r.tick({timestampMs:this.now(),observation:h,quality:d,frameWidth:a.videoWidth,frameHeight:a.videoHeight});u.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=u.at),this.blockStats?.record(u),!u.ready&&u.at-this.lastGateSnapshotAt>=ci&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:t}),u.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=u.guidanceKey,this.emit("guidance",{key:u.guidanceKey})),u.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=u.at,this.fire(t))}async fire(t){let{options:e}=this,r=this.scheduler;r?.stop(),this.reportGate(!0);let s=r?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...s.meanDetectMs>0?[s.meanDetectMs]:[]];e.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+s.degradeCount,meanDetectMs:a.length===0?0:a.reduce((k,b)=>k+b,0)/a.length});let n=e.mode??"clip",l=e.rankKeyframes?.()&&ht?ht.default(this,t).catch(()=>this.collectKeyframes(t)):this.collectKeyframes(t);if(n==="photo"){let k=this.watchRotation(t,null),b=await l;if(k(),t!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(t!==this.attempt)return;this.finishCapture({keyframe:b.blob,previewDataUrl:b.previewDataUrl,...I});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=e.screenRamp?.(),d=h!==void 0,u=null;l.then(k=>{u=k},()=>{});let v=o(()=>{t===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"f"),w=Ze(h,ne),m=null,g,y=0;try{let k=this.recordTake(t,c,h,w,void 0).then(_=>_,_=>({failed:_})),[b,I]=await Promise.all([k,l]);if(g=I,t!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;$t(b.failed.requestedMimeType??"")}else m=b,Qt(b.clip,w)?b.clip.stats===null&&$t(b.clip.requestedMimeType??""):v();if(m===null||Qt(m.clip,w)){y=1,e.telemetry?.({type:"clip_retake",reason:m===null?"error":m.clip.stats===null?"unreadable":"short"});let _=null;try{_=await this.recordTake(t,c,h,w,v)}catch(H){if(m===null)throw H}if(t!==this.attempt)return;_!==null&&(m===null||We(_.clip,m.clip))&&(m=_),_===null&&v()}}catch(k){if(t!==this.attempt)return;let b=k.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:K(k)});return}if(m===null){this.fail("recorder",{phase:"recording"});return}let{clip:p,rvfc:M,report:T}=m;if(et(p.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(g===null){this.fail("generic",{phase:"keyframes"});return}let A=await this.provenance(M,d);t===this.attempt&&this.finishCapture({clip:p.blob,clipMimeType:p.mimeType,...p.stats?{clipStats:p.stats}:{},clipRetakes:y,keyframe:g.blob,previewDataUrl:g.previewDataUrl,...T!==void 0&&T.rendered.length>0?{screenRamp:T}:{},...A})}async recordTake(t,e,r,s,a){let n=this.options.createRecorder?.()??new qe({now:o(()=>this.now(),"now")}),l=oi(this.options.video),c=je(r,{paint:o(u=>{(u===null||t===this.attempt)&&this.emit("ramp",{colour:u})},"paint"),now:o(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=o(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(t,n);try{return{clip:await n.record(e,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report()}}finally{d(),h()}}async provenance(t,e){let r=this.trackProvenance;if(r===null)return{};let s,a=new Promise(l=>{s=setTimeout(()=>l(null),di)}),n=await Promise.race([r,a]);return clearTimeout(s),n===null?{}:{provenance:li(n,t,e)}}isLandscape(){let t=this.options.video;return this.uprightGuard&&t.videoWidth>t.videoHeight}holdUpright(t){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,single:1,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:t}),this.lastGuidanceKey!==lt&&(this.lastGuidanceKey=lt,this.emit("guidance",{key:lt}))}watchRotation(t,e){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=o(()=>{if(t!==this.attempt||e!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(t,e))},"n"),a=setInterval(s,hi);r.addEventListener?.("resize",s);let n=!1;function l(){n||(n=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return o(l,"o"),l}abortRecording(t,e){if(t!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{e?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new Jt(this.options.thresholds??{}),this.blockStats=new te,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(t){let e=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=ui/(ct-1),s=null;for(let a=0;a<ct;a+=1){if(t!==this.attempt)return s;try{let n=await e(this.options.video);(s===null||n.sharpness>s.sharpness)&&(s=n)}catch{}a<ct-1&&await pi(r)}return s}finishCapture(t){this.stopTracks(),this.setState("captured");let e=this.captureTiming();this.emit("artifacts",e===void 0?t:{...t,timing:e})}captureTiming(){let t={},e=o((r,s,a)=>{s!==null&&a!==null&&(t[r]=Math.max(0,Math.round(a-s)))},"t");return e("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),e("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),e("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(t).length>0?t:void 0}async defaultKeyframe(t){let e=document.createElement("canvas"),r=await(this.facing==="user"?$e:fi)(t,e),s=e.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:s,sharpness:this.centerSharpness(t)}}defaultSnapshot(t,e){try{let r=this.snapshotCanvas??document.createElement("canvas"),s=e/Math.max(1,t.videoWidth),a=Math.max(1,Math.round(t.videoWidth*s)),n=Math.max(1,Math.round(t.videoHeight*s)),l=r.getContext("2d");return l===null?t:(r.width!==a&&(r.width=a),r.height!==n&&(r.height=n),l.drawImage(t,0,0,a,n),this.snapshotCanvas=r,r)}catch{return t}}defaultQuality(t,e){let r=re(t,e,96);return r===null?ie:{sharpness:rt(r),exposure:Ht(r),meanLuma:zt(r)}}centerSharpness(t){let e=Z(t),r=re(t,{x:e.width*.25,y:e.height*.25,width:e.width*.5,height:e.height*.5},96);return r===null?0:rt(r)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(t){let e=this.blockStats,r=this.profiler;if(e===null||r===null)return;let s=e.summary();t&&(this.blockStats=null),s.ticks!==0&&this.options.telemetry?.({type:"gate",final:t,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...s})}stopTracks(){if(this.stream!==null){for(let t of this.stream.getTracks())t.stop();this.stream=null}}fail(t,e,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:t,fallbackReason:r});let{phase:s,name:a}=e;this.emit("error",{kind:t,retryable:t!=="insecure"&&t!=="unsupported",detail:a===void 0?{phase:s}:{phase:s,name:a}})}setState(t){this.stateValue=t,this.emit("statechange",{state:t})}now(){return this.options.now?.()??performance.now()}},o(z,"ke"),z),ht;function pi(i){return new Promise(t=>setTimeout(t,i))}o(pi,"st");function gi(i){return i instanceof Error?i.message:String(i)}o(gi,"ot");function re(i,t,e){try{let r=document.createElement("canvas"),s=e/Math.max(1,t.width);r.width=Math.max(1,Math.round(t.width*s)),r.height=Math.max(1,Math.round(t.height*s));let a=r.getContext("2d");return a===null?null:(a.drawImage(i,t.x,t.y,t.width,t.height,0,0,r.width,r.height),a.getImageData(0,0,r.width,r.height))}catch{return null}}o(re,"we");function vi(i){if(i.enumerateDevices!==void 0)return i.enumerateDevices;if(i.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}o(vi,"lt");var yi=12e4,ce=13e4,wi=3e3,bi=1200,ut=Symbol.for("@sekyro/web.preload.v1");function ft(){let i=globalThis;return i[ut]??(i[ut]=new Map),i[ut]}o(ft,"g");function Y(i){let t=(i??at).replace(/\/+$/,"");return t===""?"/":t}o(Y,"S");function ue(i){let t=ft(),e=t.get(i);return e===void 0&&(e={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},t.set(i,e)),e}o(ue,"se");function dt(i,t){if(i.status!==t){i.status=t;for(let e of[...i.listeners])e(t)}}o(dt,"A");var Mi=o(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:yi}),"x"),ki=Mi;function Ti(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}o(Ti,"pe");function _i(){return navigator.connection?.saveData===!0}o(_i,"me");function Ei(i){let t=window;if(typeof t.requestIdleCallback=="function"){let r=t.requestIdleCallback(i,{timeout:wi});return()=>t.cancelIdleCallback?.(r)}let e=setTimeout(i,bi);return()=>clearTimeout(e)}o(Ei,"ve");function Si(i,t){let e,r=new Promise(l=>{e=l}),s=!1,a=o(()=>{},"d"),n={promise:r,settle:o(l=>{s||(s=!0,a(),i.scheduled===n&&(i.scheduled=null),e(l))},"settle")};return i.scheduled=n,a=Ei(()=>{s||n.settle(mt(i,t))}),r}o(Si,"ge");function mt(i,t){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;dt(i,"loading");let e=new Promise(n=>n(ki(t)));i.detectorPromise=e;let r,s=new Promise((n,l)=>{r=setTimeout(()=>{e.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${ce} ms`))},ce)}),a=Promise.race([e,s]).then(n=>i.detectorPromise!==e?(n.destroy(),i.status):(i.detector=n,dt(i,"ready"),"ready"),n=>(i.detectorPromise===e&&(i.detectorPromise=null,i.detector=null,dt(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",n)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}o(mt,"I");function Yi(i={}){if(!Ti())return Promise.resolve("idle");let t=Y(i.assetBaseUrl),e=ue(t);return i.respectSaveData===!0&&_i()?Promise.resolve(e.status):(e.status==="loading"||e.status==="ready")&&e.promise!==null?e.promise:i.idle===!0?e.scheduled?.promise??Si(e,t):mt(e,t)}o(Yi,"we");function Qi(i){return ft().get(Y(i))?.status??"idle"}o(Qi,"ke");function Ji(i,t){let e=ue(Y(t));return e.listeners.add(i),()=>{e.listeners.delete(i)}}o(Ji,"De");function Ai(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:o((...t)=>i.detect(...t),"detect"),destroy:o(()=>{},"destroy")}}o(Ai,"he");function Ii(i){let t=Y(i),e=ft().get(t);if(!(e===void 0||e.detector===null&&e.detectorPromise===null&&e.scheduled===null))return async()=>{e.scheduled!==null&&mt(e,t);let r=e.promise;for(;e.detector===null&&r!==null&&(await r,e.promise!==r);)r=e.promise;return e.detector!==null?Ai(e.detector):x({v3AssetBaseUrl:t})}}o(Ii,"oe");function xi(i){switch(i){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}o(xi,"Ce");function Di(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}o(Di,"Se");function he(i){switch(i){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return i;case"backcamera":return"notfound";default:{let t=i;return"generic"}}}o(he,"ie");function Ri(i,t,e){if(e===void 0)return{kind:he(i),retryable:t};let r=Gt(e.name);return{kind:he(i),retryable:t,detail:{...r!==void 0?{name:r}:{},phase:e.phase,engineKind:i}}}o(Ri,"Le");var Ci=new Set(["captured","uploading","checking"]);function Oi(i,t={},e,r=()=>"self",s=()=>{},a){let n=t.now??(()=>performance.now()),l=t.canChooseFacing??At,c="user",h=It(),d=r(),u=St(),v=!Ot(),w=t.engineOptions,m=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:o(()=>{let f=Ii(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},g={video:i.video,mode:v?"photo":"clip",rankKeyframes:e,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:o(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...t.engineOptions??{},...m},y=t.createEngine?.(g)??new le(g),p="idle",M=null,T=0,A=!1,k="full",b=null,I=null,_=0,H=0,pt=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(_=i.video.videoWidth,H=i.video.videoHeight)},"K"),gt=xt({enabled:i.keepScreenAwake!==!1}),X=o(f=>{p=f,gt.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"M"),Q=o(()=>u.emit("gate",{progress:T,hint:M,faceDetected:A}),"R"),vt=o(()=>{let f=y.animations??"full";f!==k&&(k=f,u.emit("profile",{animations:k}))},"G"),de=[y.on("statechange",({state:f})=>{let E=Di(f);E==="starting"&&p!=="starting"&&(M=null,T=0,A=!1,b=null,I=null,_=0,H=0),X(E),vt(),E==="recording"&&(pt(),b=n(),M="hold",T=1,Q())}),y.on("checks",f=>{pt(),T=f.progress,A=f.factors.presence>0,Q(),vt()}),y.on("guidance",({key:f})=>{M=xi(f),Q()}),y.on("frozen",({previewDataUrl:f})=>{I=n(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(p!=="captured")return;let E=V(),S=f.clipStats,bt=S!==void 0?Math.round(S.durationMs):b!==null&&I!==null?Math.max(0,Math.round(I-b)):void 0,Mt=S!==void 0&&S.frames>1&&S.durationMs>0?Math.round(S.frames*1e4/S.durationMs)/10:void 0;u.emit("captured",{keyframe:f.keyframe,...f.clip!==void 0?{clip:f.clip}:{},...f.clipMimeType!==void 0?{clipMime:f.clipMimeType}:{},width:i.video.videoWidth||_,height:i.video.videoHeight||H,...bt!==void 0?{clipMs:bt}:{},...S!==void 0?{clipFrames:S.frames}:{},...Mt!==void 0?{fps:Mt}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ae(f.clipMimeType)}:{},captureChannel:E==="desktop"?"desktop":"mobile",formFactor:E,...v?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:y.facingMode,mode:d,...f.timing,...f.screenRamp!==void 0?{screenRamp:f.screenRamp}:{},...f.provenance!==void 0?{provenance:f.provenance}:{}})}),y.on("error",({kind:f,retryable:E,detail:S})=>{f==="backcamera"&&fe()||u.emit("error",Ri(f,E,S))})],yt=!1;function fe(){return J||yt||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(yt=!0,a.onModeChange("self"),d="self",c=tt("self"),X("mode_switch"),y.restart(c),!0)}o(fe,"ce");let wt=o(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"W"),J=!1;return{handle:{get state(){return p},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:o((f,E)=>u.on(f,E),"on"),start:o(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),y.start({facingMode:c})),"start"),retry:o(()=>y.retry(),"retry"),switchCamera:o(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:wt,setCaptureMode:o(async f=>{if(f===r()||!await wt()||J||Ci.has(p)||a===void 0)return!1;a.onModeChange(f),d=f;let E=tt(f);return c=E,p==="idle"||(X("mode_switch"),y.restart(E)),!0},"setCaptureMode"),destroy:o(()=>{J=!0;for(let f of de)f();gt.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:o(f=>{p!==f&&X(f)},"setFlowState")}}o(Oi,"Ee");function tr(i){return Oi(i).handle}o(tr,"ze");export{zi as a,Yi as b,Qi as c,Ji as d,Ri as e,Oi as f,tr as g};
@@ -0,0 +1 @@
1
+ import{b as N}from"./chunk-ET7NCKUV.js";import{a as c}from"./chunk-4FHWXBOB.js";var E=2;function k(a){let u=a.tuning,s=a.now??(()=>performance.now()),l=null,r=!1,g=!1,f=Number.NEGATIVE_INFINITY,m=null,x=0,i=null,t=null,T=0,d=!1,y=c(()=>{if(d||!u.enabled)return;d=!0;let n=(a.createSegmenter??(e=>import("./segmenter-3CVPTZMM-WGI6XGWN.js").then(o=>o.createSelfieSegmenter(e))))(a.assetBaseUrl);t=setTimeout(()=>{l===null&&(r=!0)},u.segmenterTimeoutMs),n.then(e=>{t!==null&&clearTimeout(t),g||r?e.close():l=e},()=>{t!==null&&clearTimeout(t),r=!0})},"T");return{measure(n,e,o,B){if(!u.enabled||n.pixels===null)return null;y();let h=s();if(h-f<1e3/u.hz)return m;f=h;let p=n.width/Math.max(1,o),w=n.height/Math.max(1,B),S={x:e.x*p,y:e.y*w,width:e.width*p,height:e.height*w},M=null;if(l!==null&&!r){let b=Math.max(h,x+1);x=b;let A=s();M=l.segment(n.source,b);let I=s()-A;T+=1,T>E&&(i=i===null?I:i*.7+I*.3),i!==null&&i>u.segmenterBudgetMs&&(r=!0,l.close(),l=null)}return m=N(n.pixels,S,M,u),m},close(){g=!0,t!==null&&clearTimeout(t),l?.close(),l=null}}}c(k,"L");export{k as a};
@@ -0,0 +1 @@
1
+ import{d as v}from"./chunk-YEPHU5PX.js";import{a as y,b as C}from"./chunk-UYAVCSQ4.js";import{a as d}from"./chunk-RK4HVNRS.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var r=p(y(),1),o=p(C(),1),m=p(y(),1);function w(t,e,i){let[n,c]=(0,r.useState)(!1),s=(0,r.useRef)(i);return s.current=i,(0,r.useEffect)(()=>{t&&(c(!0),s.current())},[t,e]),[n,()=>c(!1)]}a(w,"I");d(w,"useWrongCode");function x({id:t,value:e,onChange:i,length:n=6,describedBy:c,invalid:s}){let[k,f]=(0,r.useState)(!1),[h,N]=(0,r.useState)(0);(0,r.useEffect)(()=>{s&&N(l=>l+1)},[s]);let g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=setTimeout(()=>g.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(l)},[]);let b=e.length<n?e.length:-1;return(0,o.jsxs)("div",{className:"sekyro-otp-boxes",dir:"ltr",children:[(0,o.jsx)("div",{className:`sekyro-otp-row${h>0?" is-shaking":""}`,"aria-hidden":"true",children:Array.from({length:n},(l,u)=>(0,o.jsx)("span",{className:`sekyro-otp-box${u<e.length?" is-filled":""}${k&&u===b?" is-current":""}${s?" is-invalid":""}`,children:e[u]!==void 0?(0,o.jsx)("span",{className:"sekyro-otp-digit",children:e[u]},e[u]):null},u))},h),(0,o.jsx)("input",{ref:g,id:t,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:e,"aria-describedby":c,"aria-invalid":s||void 0,onFocus:a(()=>f(!0),"onFocus"),onBlur:a(()=>f(!1),"onBlur"),onChange:a(l=>i(v(l.target.value).replace(/\D/g,"").slice(0,n)),"onChange")})]})}a(x,"S");d(x,"CodeInput");function I(t){let[e,i]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!t)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[t]),e}a(I,"B");d(I,"useNow");export{w as a,x as b,I as c};
@@ -0,0 +1 @@
1
+ import{a as j,b as ge,c as me,i as fe}from"./chunk-HDJ6JFXX.js";import{b as ye}from"./chunk-T4M2J44L.js";import{d as we}from"./chunk-FAIDO3QL.js";import{a as pe}from"./chunk-IBOJTLL7.js";import{d as re,e as le,g as oe,h as W,i as se,j as ue,k as z,l as de}from"./chunk-D334IAZJ.js";import{g as _,i as he,j as ce}from"./chunk-RRLXNT33.js";import{a as s}from"./chunk-4FHWXBOB.js";var Ee=250,Ie=180,Ue=96;function qe(i){let{data:t,width:e,height:a}=i,n=new Uint8Array(e*a);for(let r=0,o=0;r<n.length;r+=1,o+=4)n[r]=Math.round(.299*(t[o]??0)+.587*(t[o+1]??0)+.114*(t[o+2]??0));return{data:n,width:e,height:a}}s(qe,"xe");function G(i,t){return{x0:Math.max(0,Math.floor(i.x)),y0:Math.max(0,Math.floor(i.y)),x1:Math.min(t.width,Math.ceil(i.x+i.width)),y1:Math.min(t.height,Math.ceil(i.y+i.height))}}s(G,"W");function q(i,t,e){let a=G(t,i),n=e===void 0?null:G(e,i),r=0,o=0,c=0,g=0;for(let u=a.y0;u<a.y1;u+=1)for(let x=a.x0;x<a.x1;x+=1){if(n!==null&&x>=n.x0&&x<n.x1&&u>=n.y0&&u<n.y1)continue;let D=i.data[u*i.width+x];r+=1,o+=D,c+=D*D,D>=Ee&&(g+=1)}if(r===0)return{mean:0,sd:0,clipped:0,count:0};let d=o/r;return{mean:d,sd:Math.sqrt(Math.max(0,c/r-d*d)),clipped:g/r,count:r}}s(q,"T");function xe(i){let{box:t}=i,e=(i.leftEye.y+i.rightEye.y)/2-.1*t.height,a=t.y+.85*t.height;return{x:t.x+.15*t.width,y:e,width:.7*t.width,height:Math.max(1,a-e)}}s(xe,"ve");function Be(i,t){let e=xe(t),a=q(i,e);if(a.count===0)return null;let n=Math.min(Math.max(t.nose.x,e.x+1),e.x+e.width-1),r=q(i,{x:e.x,y:e.y,width:n-e.x,height:e.height}),o=q(i,{x:n,y:e.y,width:e.x+e.width-n,height:e.height}),c=o.mean>0?r.mean/o.mean:r.mean>0?Number.POSITIVE_INFINITY:1;return{faceLuma:a.mean,halfRatio:c,clipped:a.clipped}}s(Be,"Be");function Fe(i,t){let e=0,a=0;for(let n of[t.leftEyeBox,t.rightEyeBox]){let r=n.width*.15,o=n.height*.5,c=q(i,{x:n.x-r,y:n.y-o,width:n.width+2*r,height:n.height+2*o});e+=c.count,a+=c.clipped*c.count}return e===0?null:a/e}s(Fe,"Ge");function He(i,t){let e=ge(t),{box:a}=t,n={x:a.x-.2*a.width,y:e.y,width:1.4*a.width,height:a.y+a.height-e.y},r=0,o=0,c=0;for(let d of[e.x,e.x+.8*e.width]){let u=q(i,{x:d,y:e.y+.04*e.height,width:.2*e.width,height:.25*e.height},n);r+=u.count,o+=u.mean*u.count,c+=(u.sd*u.sd+u.mean*u.mean)*u.count}if(r===0)return null;let g=o/r;return{luma:g,sd:Math.sqrt(Math.max(0,c/r-g*g)),count:r}}s(He,"Ae");function Pe(i,t){let e=G(xe(t),i),a=Math.max(1,Math.floor(Math.max(e.x1-e.x0,e.y1-e.y0)/Ue)),n=s((d,u)=>i.data[u*i.width+d],"r"),r=0,o=0,c=0;for(let d=e.y0+a;d<e.y1-a;d+=a)for(let u=e.x0+a;u<e.x1-a;u+=a){let x=n(u,d-a)+n(u-a,d)+n(u+a,d)+n(u,d+a)-4*n(u,d);r+=1,o+=x,c+=x*x}if(r===0)return null;let g=o/r;return Math.min(1,Math.max(0,c/r-g*g)/Ie)}s(Pe,"Oe");function je(i,t){return{lighting:Be(i,t),eyeSpecular:Fe(i,t),background:He(i,t),sharpness:Pe(i,t)}}s(je,"we");var Oe="/models-v3",Ve=640,Ae=.92;function Y(i){return{width:i.videoWidth||0,height:i.videoHeight||0}}s(Y,"Y");function $(i,t){if(typeof document<"u"){let e=document.createElement("canvas");return e.width=i,e.height=t,e}return typeof OffscreenCanvas=="function"?new OffscreenCanvas(i,t):null}s($,"j");function Ke(){let i=null;return(t,e)=>{let{width:a,height:n}=Y(t);if(a===0||n===0)return null;let r=e===null?1:Math.min(1,e/Math.max(a,n)),o=Math.round(a*r),c=Math.round(n*r),g;e===null?g=$(o,c):((i===null||i.width!==o||i.height!==c)&&(i=$(o,c)),g=i);let d=g?.getContext("2d",{willReadFrequently:!0});if(g==null||d==null)return null;d.drawImage(t,0,0,o,c);let u=null;try{u=d.getImageData(0,0,o,c)}catch{u=null}return{source:g,width:o,height:c,pixels:u}}}s(Ke,"He");async function Re(i,t,e,a){let n=Math.round(e*t.width/t.height),r=$(n,e),o=r?.getContext("2d");if(r==null||o==null)throw new Error("canvas unavailable");return o.fillStyle="#fff",o.fillRect(0,0,n,e),o.drawImage(i.source,t.x,t.y,t.width,t.height,0,0,n,e),"convertToBlob"in r?r.convertToBlob({type:"image/jpeg",quality:a}):new Promise((c,g)=>{r.toBlob(d=>d===null?g(new Error("encode failed")):c(d),"image/jpeg",a)})}s(Re,"qe");var I,Le=(I=class extends Error{},s(I,"z"),I);function Ne(i,t,e){return new Promise((a,n)=>{let r=setTimeout(()=>{n(new Le(`init exceeded ${t}ms`)),i.then(e,()=>{})},t);i.then(o=>{clearTimeout(r),a(o)},o=>{clearTimeout(r),n(o)})})}s(Ne,"Ne");function We(i){if(i instanceof z)return{kind:"notfound",retryable:!0,detail:{name:i.name,phase:"acquiring",engineKind:"backcamera"}};let t=he(i),e=t==="overconstrained"?"generic":t,a=_(i);return{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:{...a!==void 0?{name:a}:{},phase:"acquiring",engineKind:t}}}s(We,"Ve");function _e(i,t,e,a){let n=i.length===1?i[0]:void 0,r=n===void 0?null:j(n.landmarks,e,a),o=null;if(n!==void 0&&t.pixels!==null){let c=j(n.landmarks,t.width,t.height),g=qe(t.pixels);c!==null&&(o=je(g,c))}return{frameWidth:e,frameHeight:a,faces:i.length,geometry:r,matrix:n?.matrix??null,blendshapes:n?.blendshapes??null,stats:o}}s(_e,"Ke");function tt(i,t={},e=()=>"self",a){let n=ye(i.tuning,i.tuningVersion),r=le(),o=t.now??(()=>performance.now()),c=t.setTimer??((l,h)=>setTimeout(l,h)),g=t.clearTimer??(l=>clearTimeout(l)),d=t.grabFrame??Ke(),u=t.encodeRegion??Re,x=t.getUserMedia??(l=>navigator.mediaDevices.getUserMedia(l)),D=t.enumerateDevices??(t.getUserMedia===void 0&&typeof navigator<"u"&&typeof navigator.mediaDevices?.enumerateDevices=="function"?()=>navigator.mediaDevices.enumerateDevices():void 0),ve=t.createLandmarker??we,J=i.assetBaseUrl??Oe,Q=ue({enabled:i.keepScreenAwake!==!1}),E=fe(n,{policy:i.policy??"reject"}),b=i.video,X=pe({tuning:n.backgroundCheck,assetBaseUrl:J,...t.createSegmenter!==void 0?{createSegmenter:t.createSegmenter}:{},now:o}),m="idle",k=null,v=null,B=null,O=!1,y=!1,w=0,Z=0,V=[],M="user",A=se(),ee=!1,Me=t.canChooseFacing??oe,C=s(l=>{m===l||y||(m=l,Q.setActive(l==="starting"||l==="gating"),r.emit("state",l))},"k"),K=s(()=>{B!==null&&g(B),B=null},"D"),F=s(()=>{K();for(let l of k?.getTracks()??[])l.stop();k=null;try{b.srcObject=null}catch{}},"I"),R=s(l=>{F(),C("error"),r.emit("error",l)},"_"),te=s(()=>{let l=Math.max(o(),Z+1);return Z=l,l},"ee"),be=s(async l=>{let h=d(b,null),{width:T,height:S}=h??Y(b);if(h===null||v===null){E.reset();return}let f=v.detect(h.source,te()),p=(f.length===1?f:V.length===1?V:[])[0],U=p===void 0?null:j(p.landmarks,T,S);if(U===null){E.reset();return}let P=me(U,T,S,{margin:n.cropMargin,minWidth:n.resolution.minWidth,minHeight:n.resolution.minHeight}),N=Math.max(n.resolution.minHeight,P.height),De=await u(h,P,N,Ae);if(y||l!==w)return;let ae={image:De,width:Math.round(N*P.width/P.height),height:N,gate:E.summary(),facingMode:M};n.tuningVersion!==null&&(ae.tuningVersion=n.tuningVersion),K(),C("captured"),r.emit("captured",ae)},"Me"),L=s(async l=>{if(!(y||l!==w||m!=="gating"||v===null)){if(!O){O=!0;try{let h=d(b,Ve);if(h!==null){let{width:T,height:S}=Y(b),f=v.detect(h.source,te());V=f;let p=_e(f,h,T||h.width,S||h.height);p.geometry!==null&&n.background.required&&(p.backgroundCheck=X.measure(h,p.geometry.box,T||h.width,S||h.height));let U=E.push(p,o());if(y||l!==w||(r.emit("gate",U),U.ready&&(await be(l),m!=="gating")))return}}catch{}finally{O=!1}}!y&&l===w&&m==="gating"&&(B=c(()=>{L(l)},1e3/n.cadenceHz))}},"H"),ke=s(()=>Ne(ve(J),2e4,l=>l.close()),"Pe"),Ce=s(l=>{let h=e()==="assisted"?"assisted":"self";return ee||A.facing(h,i.facing),A.facing(h,l)},"Le"),ie=!1;function Te(){return ie||a===void 0||a.session()!=="choice"||e()!=="assisted"?!1:(ie=!0,a.onModeChange("self"),M=W("self"),C("mode_switch"),H({facing:M}),!0)}s(Te,"Se");let H=s(async l=>{if(y||m==="starting"||m==="gating")return;w+=1;let h=w;E.reset(),C("starting");let T=Ce(l?.facing);if(k!==null&&T!==M&&F(),M=T,ee=!0,k===null&&t.getUserMedia===void 0&&(typeof navigator>"u"||typeof navigator.mediaDevices?.getUserMedia!="function")){let f=typeof window<"u"&&window.isSecureContext===!1?"insecure":"unsupported";R({kind:f,retryable:!1,detail:{phase:"preflight",engineKind:f}});return}let S=v!==null?Promise.resolve(v):ke();S.catch(()=>{});try{if(k===null){let f=await de(M,{width:{ideal:n.camera.width},height:{ideal:n.camera.height}},{getUserMedia:x,...D!==void 0?{enumerateDevices:D}:{}});if(y||h!==w){for(let p of f.getTracks())p.stop();return}k=f,ce(f),M=re(f)??M,b.srcObject=k,b.muted=!0,b.playsInline=!0,await b.play().catch(()=>{})}}catch(f){if(y||h!==w||f instanceof z&&Te())return;R(We(f));return}try{v=await S}catch(f){if(!y&&h===w){let p=_(f);R({kind:"generic",retryable:!0,detail:{...p!==void 0?{name:p}:{},phase:"models",engineKind:"models"}})}return}y||h!==w||(C("gating"),L(h))},"R"),ne=s(async()=>a!==void 0&&a.session()==="choice"&&await Me().catch(()=>!1),"ne"),Se=s(()=>m==="idle"||m==="starting"||m==="gating"||m==="error","Fe");return{handle:{get state(){return m},get captureMode(){return e()},get facingMode(){return M},on:s((l,h)=>r.on(l,h),"on"),start:H,retry:s(()=>{if(!y){if(k!==null&&v!==null&&m!=="error"){w+=1;let l=w;K(),E.reset(),C("gating"),L(l);return}m="idle",H()}},"retry"),switchCamera:s(()=>A.refuseSwitch(e()==="assisted"?"assisted":"self"),"switchCamera"),canSwitchCaptureMode:ne,setCaptureMode:s(async l=>{if(y||a===void 0||l===e()||!await ne()||y||!Se())return!1;a.onModeChange(l);let h=W(l);return m==="idle"&&k===null||(w+=1,F(),M=h,C("mode_switch"),H({facing:h})),!0},"setCaptureMode"),destroy:s(()=>{y||(w+=1,F(),Q.setActive(!1),y=!0,v?.close(),v=null,X.close(),r.clear())},"destroy")},gateScores:s(()=>E.scores(),"gateScores"),setFlowState:s(l=>{(m==="captured"||m==="uploading"||m==="checking"||m==="done"&&l==="done")&&C(l)},"setFlowState")}}s(tt,"ct");function it(){import("./vision_bundle-WBHR7TEE.js").catch(()=>{})}s(it,"ut");export{Ve as a,Ae as b,Ke as c,_e as d,tt as e,it as f};
@@ -0,0 +1 @@
1
+ var e={"eid.identifierTitle":"التحقق عبر {provider}","eid.identifierTitleGeneric":"التحقق بهويتك الرقمية","eid.identifierDescription":"أدخل رقمك الوطني. سيعرض لك تطبيق {provider} رمزًا.","eid.identifierDescriptionGeneric":"أدخل رقمك الوطني. سيعرض لك تطبيق الهوية الرقمية رمزًا.","eid.boundDescription":"سيعرض لك تطبيق {provider} رمزًا.","eid.boundDescriptionGeneric":"سيعرض لك تطبيق الهوية الرقمية رمزًا.","eid.start":"احصل على رمزي","eid.codeTitle":"أدخل رمز {provider}","eid.codeTitleGeneric":"أدخل رمز الهوية الرقمية","eid.codeHelp":"افتح تطبيق {provider} لرؤية رمزك","eid.codeHelpGeneric":"افتح تطبيق الهوية الرقمية الوطنية لرؤية رمزك","eid.codeLabel":"الرمز","eid.verify":"تحقّق من الرمز","eid.resend":"احصل على رمز جديد","eid.resendIn":"رمز جديد خلال {seconds} ثانية","eid.noResendsLeft":"لم يعد بإمكانك طلب رمز جديد","eid.expiresIn":"ينتهي الرمز خلال {time}","eid.expired":"انتهت صلاحية الرمز. اطلب رمزًا جديدًا","eid.useCamera":"التحقق بالكاميرا بدلًا من ذلك","reasons.eid_identifier_invalid":"تحقّق من رقمك الوطني وأعد إدخاله","reasons.eid_code_invalid":"الرمز غير صحيح. تحقّق منه وأعد إدخاله","reasons.eid_code_expired":"انتهت صلاحية رمزك. اطلب رمزًا جديدًا للمتابعة","reasons.eid_locked":"أُدخلت رموز غير صحيحة عدة مرات. تم قفل الدخول بالهوية الرقمية لهذا التحقق","reasons.eid_not_enrolled":"هذا الرقم الوطني غير مفعّل للدخول بالهوية الرقمية","reasons.eid_unavailable":"الدخول بالهوية الرقمية غير متاح حاليًا. أعد المحاولة بعد قليل","reasons.eid_resend_too_soon":"انتظر قليلًا قبل طلب رمز جديد","reasons.eid_resend_limit":"لا يمكنك طلب رموز أخرى. أدخل آخر رمز وصلك","eid.continueHint":"بعد {provider}، ستلتقط صورة حية سريعة.","eid.continueHintGeneric":"بعد الهوية الرقمية الوطنية، ستلتقط صورة حية سريعة.","eid.resendsRemaining.zero":"لا يمكنك طلب رمز جديد","eid.resendsRemaining.one":"يمكنك طلب رمز جديد واحد","eid.resendsRemaining.two":"يمكنك طلب رمزين جديدين","eid.resendsRemaining.few":"يمكنك طلب {count} رموز جديدة","eid.resendsRemaining.many":"يمكنك طلب {count} رمزًا جديدًا","eid.resendsRemaining.other":"يمكنك طلب {count} رمز جديد","eid.codeAttemptsRemaining.zero":"لم تتبقَّ أي محاولة","eid.codeAttemptsRemaining.one":"تبقّت محاولة واحدة","eid.codeAttemptsRemaining.two":"تبقّت محاولتان","eid.codeAttemptsRemaining.few":"تبقّت {count} محاولات","eid.codeAttemptsRemaining.many":"تبقّت {count} محاولة","eid.codeAttemptsRemaining.other":"تبقّت {count} محاولة"},i={"eid.identifierTitle":"Verify with {provider}","eid.identifierTitleGeneric":"Verify with your eID","eid.identifierDescription":"Enter your national number. {provider} will show you a code in its app.","eid.identifierDescriptionGeneric":"Enter your national number. Your national eID app will show you a code.","eid.boundDescription":"{provider} will show you a code in its app.","eid.boundDescriptionGeneric":"Your national eID app will show you a code.","eid.start":"Get my code","eid.codeTitle":"Enter your {provider} code","eid.codeTitleGeneric":"Enter your eID code","eid.codeHelp":"Open the {provider} app to see your code","eid.codeHelpGeneric":"Open your national eID app to see your code","eid.codeLabel":"Code","eid.verify":"Verify code","eid.resend":"Get a new code","eid.resendIn":"Get a new code in {seconds}s","eid.noResendsLeft":"You can't get more codes","eid.expiresIn":"Code expires in {time}","eid.expired":"This code has expired. Get a new code","eid.useCamera":"Verify with my camera instead","reasons.eid_identifier_invalid":"Check your national number and enter it again","reasons.eid_code_invalid":"That code is incorrect. Check it and enter it again","reasons.eid_code_expired":"Your code has expired. Get a new code to continue","reasons.eid_locked":"Too many incorrect codes. eID sign-in is locked for this verification","reasons.eid_not_enrolled":"This national number isn't set up for eID sign-in","reasons.eid_unavailable":"eID sign-in isn't available right now. Try again in a moment","reasons.eid_resend_too_soon":"Wait a moment before asking for a new code","reasons.eid_resend_limit":"You can't get more codes. Enter the last code you received","eid.continueHint":"After {provider}, you'll take a quick live photo.","eid.continueHintGeneric":"After your national eID, you'll take a quick live photo.","eid.resendsRemaining.one":"{count} new code left","eid.resendsRemaining.other":"{count} new codes left","eid.codeAttemptsRemaining.one":"{count} try left","eid.codeAttemptsRemaining.other":"{count} tries left"},n={"eid.identifierTitle":"Vérifier avec {provider}","eid.identifierTitleGeneric":"Vérifier avec votre eID","eid.identifierDescription":"Saisissez votre numéro national. {provider} vous affichera un code dans son application.","eid.identifierDescriptionGeneric":"Saisissez votre numéro national. Votre application eID vous affichera un code.","eid.boundDescription":"{provider} vous affichera un code dans son application.","eid.boundDescriptionGeneric":"Votre application eID vous affichera un code.","eid.start":"Recevoir mon code","eid.codeTitle":"Votre code {provider}","eid.codeTitleGeneric":"Saisissez votre code eID","eid.codeHelp":"Ouvrez l'application {provider} pour voir votre code","eid.codeHelpGeneric":"Ouvrez votre application eID nationale pour voir votre code","eid.codeLabel":"Code","eid.verify":"Vérifier le code","eid.resend":"Recevoir un nouveau code","eid.resendIn":"Nouveau code dans {seconds} s","eid.noResendsLeft":"Vous ne pouvez plus demander de nouveau code","eid.expiresIn":"Le code expire dans {time}","eid.expired":"Ce code a expiré. Demandez un nouveau code","eid.useCamera":"Vérifier plutôt avec ma caméra","reasons.eid_identifier_invalid":"Vérifiez votre numéro national et saisissez-le à nouveau","reasons.eid_code_invalid":"Ce code est incorrect. Vérifiez-le et saisissez-le à nouveau","reasons.eid_code_expired":"Votre code a expiré. Demandez un nouveau code pour continuer","reasons.eid_locked":"Trop de codes incorrects. La connexion eID est bloquée pour cette vérification","reasons.eid_not_enrolled":"Ce numéro national n'est pas activé pour la connexion eID","reasons.eid_unavailable":"La connexion eID n'est pas disponible pour le moment. Réessayez dans un instant","reasons.eid_resend_too_soon":"Patientez un instant avant de demander un nouveau code","reasons.eid_resend_limit":"Vous ne pouvez plus demander de code. Saisissez le dernier code reçu","eid.continueHint":"Après {provider}, vous prendrez une photo rapide en direct.","eid.continueHintGeneric":"Après votre eID nationale, vous prendrez une photo rapide en direct.","eid.resendsRemaining.one":"{count} nouveau code possible","eid.resendsRemaining.other":"{count} nouveaux codes possibles","eid.codeAttemptsRemaining.one":"{count} essai restant","eid.codeAttemptsRemaining.other":"{count} essais restants"};export{e as a,i as b,n as c};
@@ -0,0 +1 @@
1
+ import{a as ee,b as he,c as fe,d as ge,f as ve}from"./chunk-SK6UAYX2.js";import{c as ye}from"./chunk-CMS5FVGM.js";import{e as Y}from"./chunk-HODE7UDG.js";import{e as pe,j as me}from"./chunk-D334IAZJ.js";import{g as X}from"./chunk-RRLXNT33.js";import{a as n}from"./chunk-4FHWXBOB.js";var We={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function qe(e){let{deviceMemory:t,effectiveType:r,saveData:i,downlinkMbps:l,sourceLongEdge:u}=e,s=i===!0||r==="slow-2g"||r==="2g"||l!=null&&l>0&&l<1,d=t!=null&&t<=2,c=r==="4g"||l!=null&&l>=5,v=t!=null&&t>=6,f;s||d?f="low":c&&v?f="good":f="mid";let y=We[f],M=u&&u>0?Math.min(y.maxLongEdge,u):y.maxLongEdge;return{tier:f,...y,maxLongEdge:M}}n(qe,"He");function Fe(e){let t={};try{let r=navigator;typeof r.deviceMemory=="number"&&(t.deviceMemory=r.deviceMemory);let i=r.connection;i&&(t.effectiveType=i.effectiveType,t.saveData=i.saveData,t.downlinkMbps=i.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),qe(t)}n(Fe,"ke");function Ie(e,t,r){let i=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),l=(t+r)/2;return Math.max(t,r-i*(r-l))}n(Ie,"Xe");function Be(e,t,r){let i=Math.max(e,t),l=i>0?Math.min(1,r/i):1;return{width:Math.max(1,Math.round(e*l)),height:Math.max(1,Math.round(t*l))}}n(Be,"Ve");async function ze(e,t){let r=t.startQ,i=await e(r);for(let l=0;l<4&&!(i.size<=t.budgetBytes||r<=t.qMin);l++)r=Math.max(t.qMin,r-.08),i=await e(r);return{blob:i,quality:r}}n(ze,"Ye");async function Oe(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:s}=Be(t,r,i.maxLongEdge),d=document.createElement("canvas");d.width=u,d.height=s;let c=d.getContext("2d");if(!c)return null;c.drawImage(e,0,0,u,s);let v=n(F=>new Promise((g,m)=>{d.toBlob(h=>h?g(h):m(new Error("canvas toBlob returned null")),"image/jpeg",F)}),"f"),f=Ie(l,i.qMin,i.qMax),{blob:y,quality:M}=await ze(v,{startQ:f,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{d.width=0,d.height=0});if(y.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:y,quality:M,width:u,height:s}}n(Oe,"De");async function Ue(e){let t=Fe(Math.max(e.width,e.height)),r=await Oe(e,e.width,e.height,t,.5);if(r===null)throw new Error("canvas encode unavailable");return{blob:r.blob,width:r.width,height:r.height}}n(Ue,"Z");function xe(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}n(xe,"te");var Te=n(e=>e==="recto"?"verso":"recto","Ce"),Ce=n(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","Re"),ne=n(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"ne");function te(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}n(te,"ee");function Ne(e,t,r){if(e.phase==="result")return{...e,lastReportAt:r};let i=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:l,awaySince:u}=e;i&&(u=u??r),u!==void 0&&r-u>=250&&(l=!0),i||(u=void 0);let s=e.flipTimeoutSpent&&!(l&&!e.flipped),d={...e,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:s,lastArea:t.areaFrac};if(!Ce(e))return d;if(e.needFlip&&!l){if(!t.ready)return{...d,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...d,goodSince:void 0,phase:e.restPhase};let v=e.goodSince??r;return r-v>=1800?{...d,goodSince:v,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...d,goodSince:v,phase:e.restPhase}}return t.ready?{...d,phase:"capturing",goodSince:e.goodSince??r}:{...d,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}n(Ne,"Qe");function Ve(e,t){if(!Ce(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}n(Ve,"Ke");function je(e,t,r){let i=e.layout==="singlePage",l=i?{recto:t}:e.captured,u=i?[]:[...e.pending,t],s={...e,captured:l,pending:u,lastShot:t,lastCaptureAt:r,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return i||ne({captured:l,pending:u})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}n(je,"je");function Re(e,t,r){return e.pending.includes(t)?{...e,pending:e.pending.filter(i=>i!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:Te(r),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}n(Re,"xe");function Ge(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return Re(e,t,r);let i=e.pending.filter(c=>c!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(ne(l)!==1||e.layout==="singlePage")return l;let u=Te(r),s=u==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",d=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...l,restPhase:s,current:u,phase:d?s:e.phase}}n(Ge,"$e");function He(e,t){let r=t.id??e.captured[t.side],i={...e.captured};(t.id===void 0||i[t.side]===t.id)&&delete i[t.side];let l=e.pending.filter(v=>v!==r),u=e.layout==="twoSided"&&ne({captured:i,pending:l})>0,s=e.lastShotByTimeout||r===e.lastShot!==e.flipped,d=u&&!s,c=d?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(v=>v!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:c,restPhase:c,current:t.side,needFlip:d,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}n(He,"Je");function _e(e,t){switch(t.type){case"report":return Ne(te(e,t.at),t.report,t.at);case"tick":return Ve(te(e,t.at),t.at);case"captured":return je(te(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return Ge(e,t.id,t.side);case"duplicate":return Re(e,t.id,t.side);case"readOk":{let r=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],i=["recto","verso"].filter(u=>e.captured[u]!==void 0),l=e.phase==="reading"&&e.pending.length===0&&i.every(u=>r.includes(u));return{...e,readSides:r,flipTimeoutSpent:!1,phase:l?"result":e.phase}}case"readFailed":return He(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...xe(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}n(_e,"ve");function Ye(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}n(Ye,"Ze");async function Je(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-DCXFWDBD-OPMO6HYS.js");return Ye(r,e,t)}n(Je,"et");async function we(e,t=480,r,i=r!=null){let l=r??{x:0,y:0,width:e.width,height:e.height},u=Math.max(1,Math.round(l.height/l.width*t)),s=document.createElement("canvas");s.width=t,s.height=u;try{let d=s.getContext("2d");return d===null?"recto":(d.drawImage(e,l.x,l.y,l.width,l.height,0,0,t,u),await Je(d.getImageData(0,0,t,u),i))}finally{s.width=0,s.height=0}}n(we,"re");var re=n((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"oe"),J=n(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"Y");async function Qe(e,t,r,i){let l=i.decode??(c=>createImageBitmap(c)),u=n(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"l"),s;try{s=await u()}catch{try{await new Promise(c=>setTimeout(c,i.retryMs??300)),s=await u()}catch{return null}}let d=s.mrzBox;return d===void 0?null:{engine:i.engine,source:"live_mrz",format:r.format,lineCount:re(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===r.digest,band:[J(d[0]),J(d[1]),J(Math.min(d[2],1-d[0])),J(Math.min(d[3],1-d[1]))],digest:r.digest,framesToValid:re(r.framesToValid,1,1e3),msToValid:re(r.msToValid,0,12e4)}}n(Qe,"Le");var $e=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]),Ke=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function Ze(e,t=globalThis){let r=t.WebAssembly?.validate;if(typeof r!="function")return{ok:!1,reason:"simd"};try{if(!r.call(t.WebAssembly,$e)||!r.call(t.WebAssembly,Ke))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}if(typeof t.Worker!="function")return{ok:!1,reason:"worker"};if(typeof t.createImageBitmap!="function")return{ok:!1,reason:"bitmap"};let i=t.navigator?.deviceMemory;return typeof i=="number"&&i<e.minDeviceMemoryGb?{ok:!1,reason:"memory"}:{ok:!0}}n(Ze,"_e");function Xe(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}n(Xe,"Te");var U,E=(U=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},n(U,"T"),U);function Me(){let e=n(t=>(t.close(),Promise.reject(new E("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:n(()=>{},"dispose")}}n(Me,"Ee");function et(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Me()}catch{return Me()}let r=new Map,i=0,l=!1,u=!1,s=!1;t.addEventListener("message",m=>{let h=m.data,x=r.get(h.id);x&&(r.delete(h.id),x.resolve(h))});let d=n(()=>{for(let m of r.values())m.reject(new E("error"));r.clear(),v()},"u");t.addEventListener("error",d),t.addEventListener("messageerror",d);function c(m,h=[]){if(l)return Promise.reject(new E("disposed"));let x=++i;return new Promise((W,q)=>{r.set(x,{resolve:W,reject:q});try{t.postMessage({...m,id:x},h)}catch{r.delete(x),q(new E("error"))}})}n(c,"c");function v(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let m of r.values())m.reject(new E("disposed"));r.clear()}}n(v,"f");let f=(async()=>{let m=await c({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(m.kind==="failed")return m.reason;if(m.kind!=="ready")return"error";let h=await c({kind:"warmup"});return h.kind!=="ready"?"error":{warmupMs:h.warmupMs,downloadMs:m.downloadMs,cached:m.cached}})().catch(()=>"error"),y,M=new Promise(m=>{y=setTimeout(()=>m("timeout"),e.tuning.loadTimeoutMs)}),F=Promise.race([f,M]).then(m=>(clearTimeout(y),typeof m=="string"?v():s=!0,l&&typeof m!="string"?"error":m));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",v,{once:!0});async function g(m,h,x){if(l)throw h.close(),new E("disposed");if(!s)throw h.close(),new E("not_ready");if(u)throw h.close(),new E("busy");u=!0;let W;try{let q=new Promise((V,b)=>{W=setTimeout(()=>{b(new E("timeout")),v()},e.tuning.readTimeoutMs??1e4)}),P=await Promise.race([c(m,[h]),q]);if(P.kind===x){let{id:V,...b}=P;return b}throw new E(P.kind==="error"?P.code:P.kind==="failed"?P.reason:"error")}finally{clearTimeout(W),u=!1}}return n(g,"w"),{ready:F,get busy(){return u},bandRead:n((m,h=e.tuning.detectorLimit)=>g({kind:"band",bitmap:m,detectorLimit:h},m,"band"),"bandRead"),stillRead:n((m,h,x=e.tuning.detectorLimit)=>g({kind:"still",bitmap:m,region:h,detectorLimit:x},m,"band"),"stillRead"),layoutRead:n((m,h)=>g({kind:"layout",bitmap:m,detectorLimit:h},m,"layout"),"layoutRead"),dispose:v}}n(et,"Oe");var Q="sekyro-ocr-1",ae=n(e=>e!==null&&typeof e=="object"?e:{},"ae"),R=n((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"v"),be=n((e,t)=>typeof e=="boolean"?e:t,"Pe"),ke=n(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"Ae");function tt(e,t={}){let r=ae(e),i=ae(r.liveMrz),l=ae(r.frontLock),u=ke(t.engine??Q),s=t.mode==="off",d=n(h=>h.enabled===!0?h.arm==="live"?"live":"control":null,"u"),c=d(i),v=d(l),f=n((h,x)=>!s&&x==="live"&&ke(h.minEngine??Q)<=u,"p"),y=ge,M=f(i,c)?{detectorLimit:R(i.detectorLimit,320,1600,y.detectorLimit),bandMaxWidthPx:R(i.bandMaxWidthPx,320,4096,y.bandMaxWidthPx),minBandWidthPx:R(i.minBandWidthPx,0,4096,y.minBandWidthPx),bandTop:R(i.bandTop,0,.95,y.bandTop),minIntervalMs:R(i.minIntervalMs,0,5e3,y.minIntervalMs),stableReads:Math.round(R(i.stableReads,1,10,y.stableReads)),profileReads:Math.round(R(i.profileReads,1,100,y.profileReads)),maxReadMs:R(i.maxReadMs,50,6e4,y.maxReadMs),searchTimeoutMs:R(i.searchTimeoutMs,1e3,12e4,y.searchTimeoutMs),hint:be(i.hint,!0),stillConfirm:be(i.stillConfirm,!0)}:null,F=fe,g=n((h,x,W)=>R(l[h],x,W,F[h]),"h"),m=f(l,v)?{minLines:Math.round(g("minLines",1,50)),fillMin:g("fillMin",0,1),fillMax:g("fillMax",0,2),offsetMax:g("offsetMax",0,1),steadyFillDelta:g("steadyFillDelta",0,1),steadyOffsetDelta:g("steadyOffsetDelta",0,1),layoutShiftMax:g("layoutShiftMax",0,1),lineCountDelta:Math.round(g("lineCountDelta",0,50)),lockMs:g("lockMs",0,3e4),steadyMs:g("steadyMs",0,3e4),minFrames:Math.round(g("minFrames",1,100)),minIntervalMs:g("minIntervalMs",0,5e3),maxWidthPx:g("maxWidthPx",160,2048),detectorLimit:g("detectorLimit",320,1600),searchTimeoutMs:g("searchTimeoutMs",1e3,12e4)}:null;return{enabled:M!==null||m!==null,liveMrz:M,textLock:m,liveMrzArm:c,frontLockArm:v,load:{detectorLimit:M?.detectorLimit??m?.detectorLimit??y.detectorLimit,loadTimeoutMs:R(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:R(i.maxDownloadMs,1e3,12e4,2e4),minDeviceMemoryGb:R(i.minDeviceMemoryGb,0,64,2)},reportSampleRate:R(i.reportSampleRate,0,1,1)}}n(tt,"Be");function rt(e,t){return e.enabled?!(t.probe??Ze)({minDeviceMemoryGb:e.load.minDeviceMemoryGb}).ok||(t.slow??Xe)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:et({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{}})}:{ok:!1,reason:"off"}}n(rt,"Ie");function at(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}n(at,"rt");var B=n(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"F"),ie=n((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"ie");function it(e){let t=e.assist??null,r=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,i=typeof e.load=="string"?e.load:null,l=t!==null?t.outcome:i==="unsupported"||i==="download"||i==="integrity"?i:i==="error"||i==="timeout"?"error":"off",u={kind:"live_mrz",platform:"web",engine:e.engine??Q,arm:e.arm,capture:e.capture,outcome:l,reads:ie(t?.reads??0,0,1e4)??0,browser:e.browser??at()},s=n((d,c)=>{c!==void 0&&(u[d]=c)},"s");return s("format",t?.format),s("framesToValid",ie(t?.framesToValid,1,1e4)),s("msToValid",B(t?.msToValid)),s("framesToLock",ie(t?.framesToLock,1,1e4)),s("msToLock",B(t?.msToLock)),s("msToCapture",B(e.msToCapture)),s("readP50Ms",B(t?.readP50Ms)),s("readP90Ms",B(t?.readP90Ms)),s("deviceClass",t?.deviceClass),r!==null&&(s("warmupMs",B(r.warmupMs)),s("downloadMs",B(r.downloadMs)),s("cached",r.cached)),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),u}n(it,"We");function Se(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}n(Se,"se");var nt=2;async function ot(e){let t=await import("./capture-session-doc-K6LVXAGQ-SY3B27LY.js");return new t.CaptureSessionDoc(e)}n(ot,"at");function lt(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}n(lt,"it");function st(e,t,r){let i=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],l=0;for(let u=0;u<i.length;u+=1){let s=i[u],d=i[(u+1)%i.length];l+=s.x*d.y-d.x*s.y}return t>0&&r>0?Math.abs(l)/2/(t*r):0}n(st,"st");function ft(){import("./capture-session-doc-K6LVXAGQ-SY3B27LY.js").then(e=>e.warmDocDetector()).catch(()=>{})}n(ft,"Gt");function gt(e){return dt(e,{}).handle}n(gt,"qt");function dt(e,t){let r=pe(),i=me({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),d=e.documentType==="passport"||e.side==="single",c=xe(d?"singlePage":"twoSided",s());if(!d&&(e.side==="recto"||e.side==="verso")){let a=e.side==="recto"?"verso":"recto";c={...c,captured:{[a]:"server"},readSides:[a],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let v="idle",f=null,y=null,M=!0,F=0,g=0,m=!1,h=!1,x="",W=null,q,P=null,V=[],b=t.webOcr!==void 0?tt(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,N=null,z=b===null||!b.enabled?"off":null,j=null,G=null,oe=new WeakMap,$="";if(b!==null&&b.enabled&&t.webOcr!==void 0){let a=t.webOcr,o=rt(b,{baseUrl:e.liveMrz?.assetBaseUrl??a.baseUrl,salt:a.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...a.createWorker!==void 0?{createWorker:a.createWorker}:{}});if(o.ok){N=o.engine;let p=new ve({textLock:b.textLock,liveMrz:b.liveMrz});j=p;let w=o.engine;w.ready.then(A=>{z=A,typeof A!="string"&&M&&p.setEngine(w)})}else z=o.reason}let O=n(a=>{let o=JSON.stringify(a);o!==$&&($=o,r.emit("mrz",a))},"N"),le=n((a,o)=>{let p=t.webOcr?.reports;if(p===void 0||b===null||a===void 0)return;let w=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",A=w!=="recto"?b.liveMrzArm??b.frontLockArm:b.frontLockArm;if(A===null||Math.random()>=b.reportSampleRate)return;let L=a.via==="live_mrz"?G:null,C=n(()=>{let D=L?.value??null;p([it({arm:A,capture:w,assist:a.ocr??null,load:A==="control"?"off":z,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...D!==null&&D.stillConfirmed!==void 0?{stillConfirmed:D.stillConfirmed}:{},...o!==void 0?{typeMismatch:Se(o.format,e.documentType==="passport"?"passport":"card")}:{}})])},"x");L!==null&&L.value===null?Promise.race([L.promise,new Promise(D=>setTimeout(D,3e3))]).then(C):C()},"le"),I=n(a=>{!M||a===v||(v=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"W"),Ae=n((a,o)=>o===void 0?null:d?"single":a.captured.recto===o?"recto":a.captured.verso===o?"verso":null,"Fe"),Le=n(a=>({phase:a.phase,captured:d?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(o=>a.captured[o]!==void 0),expected:d?null:a.current??null,notice:a.notice??null,lastShot:Ae(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:h}),"ze"),se=n(()=>{let a=f;a!==null&&a.captureNow().catch(()=>T({type:"captureFailed",at:s()}))},"ce");function T(a){if(!M)return;let o=c;c=_e(c,a),c.phase==="capturing"&&o.phase!=="capturing"&&Promise.resolve().then(se),c.phase==="result"&&o.phase!=="result"&&(I("done"),de());let p=Le(c),w=JSON.stringify(p);w!==x&&(x=w,r.emit("scan",p))}n(T,"R");function de(){P!==null&&clearInterval(P),P=null;for(let a of V.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}n(de,"de");let ue=n(()=>f?.captureReport?.(),"me"),K=!1,ce=n((a,o)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,o)}catch{}},"pe"),H=n(a=>{$="",!(f===null||c.phase==="reading"||c.phase==="result")&&(K=!1,f.rearm(d?"single":c.current??a))},"H"),Pe=n(async(a,o,p,w)=>{if(G=null,w!==void 0&&N!==null&&b?.liveMrz?.hint===!0){let k={promise:Qe(N,a,w,{engine:Q,detectorLimit:b.liveMrz.detectorLimit}).catch(()=>null),value:null};k.promise.then(S=>{k.value=S}),G=k}w!==void 0&&Se(w.format,e.documentType==="passport"?"passport":"card")&&O({state:"mismatch",format:w.format});let A=ue();ce(A,"captured"),K=!0,le(A,w);let L=p===void 0?W:p===null?null:{quad:lt(p),frameWidth:0,frameHeight:0,inStill:!0},C={decoded:null},D=n(()=>(C.decoded??(C.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),C.decoded),"E");try{await De(a,o,L,D,G)}finally{C.decoded!==null&&(await C.decoded)?.close()}},"Ne"),De=n(async(a,o,p,w,A)=>{let L=`shot-${F+=1}`;if(T({type:"captured",id:L,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!m&&u>0){let k=await(t.measureSharpness!==void 0?t.measureSharpness(a,p):w().then(S=>S===null?-1:he(S,ee(p?.quad??null,p?.inStill===!0?S:{width:p?.frameWidth??0,height:p?.frameHeight??0},S)))).catch(()=>-1);if(!M)return;if(Number.isFinite(k)&&k>=0&&k<u){m=!0;let S=d?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");T({type:"readFailed",side:S,id:L,issue:"blurry"}),H(S);return}}m=!1;let C;if(d)C="single";else{let k=c.current,S=await(t.classify!==void 0?t.classify(a):w().then(_=>_===null?k??"recto":p?.inStill===!0?we(_,480,null,!0):we(_,480,ee(p?.quad??null,{width:p?.frameWidth??0,height:p?.frameHeight??0},_)))).catch(()=>k??"recto");if(!M)return;if(c.captured[S]!==void 0&&g<nt){g+=1,T({type:"duplicate",id:L,side:S}),H(S==="recto"?"verso":"recto");return}C=c.captured[S]!==void 0&&k!==void 0?k:S,g=0,T({type:"classified",id:L,side:C})}let D=C==="verso"?"verso":"recto";try{let k=t.encode!==void 0?await t.encode(a):await w().then(S=>{if(S===null)throw new Error("the still could not be decoded");return Ue(S)});if(!M)return;A!==null&&oe.set(k.blob,A),r.emit("captured",{image:k.blob,side:C,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:k.width,height:k.height,previewDataUrl:o}),t.deferRead!==!0&&T({type:"readOk",side:D})}catch(k){T({type:"readFailed",side:D,id:L,issue:"technical"}),r.emit("error",Y("generic",!0,{phase:"keyframes",name:X(k)}))}H(D==="recto"?"verso":"recto")},"Ue"),Ee=n(a=>{V.push(a.on("statechange",({state:o})=>{o==="preflight"||o==="acquiring"?I("starting"):o==="positioning"?I("scanning"):o==="captured"?I("captured"):o==="error"&&I("error")}),a.on("feedback",({key:o,reticle:p})=>r.emit("feedback",{key:o,reticle:p})),a.on("checks",o=>{r.emit("gate",{progress:o.p,quad:o.quad,frameWidth:o.frameWidth,frameHeight:o.frameHeight,...o.guide!==void 0?{guide:{detected:o.guide.detected,fill:o.guide.fill,offsetX:o.guide.offsetX??0,offsetY:o.guide.offsetY??0}}:{}});let p=o.ocr?.mrz;p!==void 0&&(p.state==="fallback"?O({state:"fallback",reason:p.reason}):p.state==="valid"?O({state:"valid",format:p.format}):p.state==="reading"?O({state:"reading",...p.format?{format:p.format}:{},...p.coach?{coach:p.coach}:{}}):O({state:"searching"}));let w=o.quad===null?0:st(o.quad,o.frameWidth,o.frameHeight);W=o.quad===null?null:{quad:o.quad,frameWidth:o.frameWidth,frameHeight:o.frameHeight},T({type:"report",report:{present:o.quad!==null&&o.plausible||o.guide?.detected===!0,ready:o.ready===!0,locking:o.p>=.5,areaFrac:w},at:s()})}),a.on("error",({kind:o,retryable:p,detail:w})=>r.emit("error",Y(o,p,w))),a.on("artifacts",o=>{Pe(o.keyframe,o.previewDataUrl,o.docRegion,o.liveMrz)}))},"Ge"),Z=n(()=>(y??(y=(async()=>{if(M){if(f===null){let a;try{a=await(t.createEngine??ot)({...t.engineOptions??{},...q!==void 0?{guide:q}:{},video:e.video,format:ye(e.documentType),side:d?"single":e.side??"recto",autoCapture:!1,...j!==null?{ocr:j}:{}})}catch(p){I("error"),r.emit("error",Y("models",!0,{phase:"models",name:X(p)}));return}if(!M){a.destroy();return}f=a,Ee(a);let o=t.tickMs??500;o>0&&(P=setInterval(()=>T({type:"tick",at:s()}),o))}T({type:"clockRestart"}),b!==null&&b.liveMrzArm==="live"&&(z==="unsupported"||z==="off")&&O({state:"fallback",reason:z}),await f.start()}})().finally(()=>{y=null})),y),"j");return{handle:{get state(){return v},on:n((a,o)=>r.on(a,o),"on"),start:Z,retry:n(()=>{if(f===null&&c.phase==="result"){T({type:"retake"}),g=0,m=!1,Z();return}if(f!==null&&v!=="error"){T({type:"retake"}),g=0,m=!1,f.rearm(d?"single":void 0);return}Z()},"retry"),setSide:n(a=>{d||a==="single"||(c.current!==a&&(c={...c,current:a}),T({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f?.rearm(a))},"setSide"),shutter:se,focusAt:n((a,o)=>{f?.focusAt?.(a,o)},"focusAt"),setGuide:n(a=>{q=a,f?.setGuide?.(a)},"setGuide"),setTorch:n(a=>{h=a,f?.setTorch(a),T({type:"tick",at:s()})},"setTorch"),destroy:n(()=>{if(M&&f!==null&&v!=="done"){let a=ue();!K&&a!==void 0&&a.ticks>0&&ce(a,"abandoned"),le(a,void 0)}M=!1,de(),j?.setEngine(null),N?.dispose(),N=null,r.clear()},"destroy")},setFlowState:n(a=>{(c.phase==="reading"||c.phase==="result")&&I(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:n((a,o)=>{let p=a==="verso"?"verso":"recto";T(o.ok?{type:"readOk",side:p}:{type:"readFailed",side:p,issue:o.issue}),o.ok||H(p)},"settle"),takeDeviceRead:n(a=>oe.get(a.image)?.value??null,"takeDeviceRead")}}n(dt,"ut");export{nt as a,ft as b,gt as c,dt as d};
@@ -0,0 +1 @@
1
+ import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-UYAVCSQ4.js";import{a as i}from"./chunk-RK4HVNRS.js";import{a as o,c as b}from"./chunk-4FHWXBOB.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};
@@ -0,0 +1 @@
1
+ import{b,t as r,v as l,y as o}from"./chunk-UYAVCSQ4.js";import{a as i}from"./chunk-RK4HVNRS.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-4FHWXBOB.js";var c=Object.defineProperty,n=e((a,r)=>c(a,"name",{value:r,configurable:!0}),"d");export{n as a};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var v=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm;codecs=vp8","video/webm"];var b="video/webm";function c(e){if(e instanceof TypeError)return"insecure";switch(e?.name??""){case"NotAllowedError":case"PermissionDeniedError":return"permission";case"NotFoundError":case"DevicesNotFoundError":return"notfound";case"NotReadableError":case"TrackStartError":return"inuse";case"OverconstrainedError":case"ConstraintNotSatisfiedError":return"overconstrained";default:return"generic"}}n(c,"f");function w(){let e=globalThis;if(typeof e.window<"u"&&e.window.isSecureContext===!1)return"INSECURE_CONTEXT";let r=e.navigator?.mediaDevices;return!r||typeof r.getUserMedia!="function"?"UNSUPPORTED":"OK"}n(w,"x");function y(){let e=globalThis.MediaRecorder;return typeof e<"u"&&typeof e.isTypeSupported=="function"}n(y,"S");var d=8*1024*1024;function k(e){return e.size>d}n(k,"T");var u=40;function p(e){if(e===null||typeof e!="object"&&typeof e!="function")return;let r;try{r=e.name}catch{return}return f(r)}n(p,"E");function f(e){if(typeof e!="string")return;let r=e.replace(/[^A-Za-z]/g,"").slice(0,u);return r===""?void 0:r}n(f,"k");function E(e){let r=c(e);if(r!=="generic")return r;switch(p(e)){case"AbortError":return"inuse";case"SecurityError":return"permission";default:return r}}n(E,"N");var a=Symbol.for("sekyro.web.cameraStreams"),s=globalThis,i=s[a]??(s[a]=new Set);function g(e){try{i.add(e)}catch{}}n(g,"I");function h(e){let r=0;for(let t of[...i])if(t!==e){i.delete(t);try{for(let o of t.getTracks())o.readyState!=="ended"&&(o.stop(),r+=1)}catch{}}return r}n(h,"D");function l(e){let r=e.toLowerCase();return r===""?"unknown":/front|facing front|user|selfie|face ?time/.test(r)?"front":/ultra|0\.5x|wide angle/.test(r)?"ultra":/tele|zoom|periscope|[2-9]x/.test(r)?"tele":/depth|tof|infrared|\bir\b|truedepth|lidar|macro|monochrome|mono\b/.test(r)?"depth":/dual|triple/.test(r)?"virtual":/back|rear|environment|facing back|arrière|خلفية/.test(r)?"main":"unknown"}n(l,"y");function m(e){let r=/camera2?\s*(\d+)/i.exec(e);return r?Number(r[1]):Number.POSITIVE_INFINITY}n(m,"b");function T(e){let r={main:0,virtual:1,ultra:9,tele:9,depth:9,front:9,unknown:9};return e.filter(t=>(t.kind===void 0||t.kind==="videoinput")&&t.deviceId!=="").map((t,o)=>({id:t.deviceId,kind:l(t.label),index:m(t.label),i:o})).filter(t=>r[t.kind]<9).sort((t,o)=>r[t.kind]-r[o.kind]||t.index-o.index||t.i-o.i).map(t=>t.id)}n(T,"L");export{v as a,b,w as c,y as d,d as e,k as f,p as g,f as h,E as i,g as j,h as k,T as l};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var z=Object.freeze({minLines:4,fillMin:.55,fillMax:.98,offsetMax:.12,steadyFillDelta:.04,steadyOffsetDelta:.03,layoutShiftMax:.025,lineCountDelta:1,lockMs:600,steadyMs:900,minFrames:3});function R(r,t){let e=r.lineBoxes;if(e.length===0)return{lineCount:0,detected:!1,fill:0,offsetX:0,offsetY:0,centers:[]};let s=Math.min(...e.map(i=>i[0])),a=Math.max(...e.map(i=>i[0]+i[2])),l=Math.min(...e.map(i=>i[1])),h=Math.max(...e.map(i=>i[1]+i[3]));return{lineCount:e.length,detected:e.length>=t.minLines,fill:a-s,offsetX:(s+a)/2-.5,offsetY:(l+h)/2-.5,centers:e.map(i=>[i[0]+i[2]/2,i[1]+i[3]/2])}}n(R,"y");function N(r,t){if(r.centers.length===0||t.centers.length===0)return Number.POSITIVE_INFINITY;let e=0;for(let[s,a]of t.centers){let l=Number.POSITIVE_INFINITY;for(let[h,i]of r.centers)l=Math.min(l,Math.hypot(s-h,a-i));e+=l}return e/t.centers.length}n(N,"x");var x,O=(x=class{constructor(t=z){this.t=t,this.last=null,this.goodSince=null,this.steadySince=null,this.frames=0}offer(t,e,s={glareOk:!0,sharpOk:!0}){let a=this.t,l=R(t,a),h=this.last;this.last=l;let i=l.fill>=a.fillMin&&l.fill<=a.fillMax,o=Math.abs(l.offsetX)<=a.offsetMax&&Math.abs(l.offsetY)<=a.offsetMax,c=h!==null&&h.detected&&Math.abs(l.lineCount-h.lineCount)<=a.lineCountDelta&&N(h,l)<=a.layoutShiftMax,u=l.detected&&s.glareOk&&s.sharpOk&&i&&c&&h!==null&&Math.abs(l.fill-h.fill)<=a.steadyFillDelta&&Math.abs(l.offsetX-h.offsetX)<=a.steadyOffsetDelta&&Math.abs(l.offsetY-h.offsetY)<=a.steadyOffsetDelta,g=u&&o,m=l.detected?s.glareOk?l.fill<a.fillMin?"closer":l.fill>a.fillMax?"farther":o?s.sharpOk?void 0:"blurry":"center":"glare":void 0;return u?(this.frames++,this.steadySince??(this.steadySince=e),this.goodSince=g?this.goodSince??e:null,(this.goodSince!==null&&e-this.goodSince>=a.lockMs||e-this.steadySince>=a.steadyMs)&&this.frames>=a.minFrames?{state:"locked"}:{state:"locking",...m?{hint:m}:{}}):(this.goodSince=null,this.steadySince=null,this.frames=l.detected?1:0,{state:l.detected?"locking":"searching",...m?{hint:m}:{}})}reset(){this.last=null,this.goodSince=null,this.steadySince=null,this.frames=0}},n(x,"c"),x);var C=[[1,0],[0,1],[1,1],[1,-1]];function E(r){let{width:t,height:e,data:s}=r;if(t<16||e<16)return-1;let a=new Uint8Array(t*e);for(let h=0,i=0;h<a.length;h+=1,i+=4)a[h]=Math.round(.299*(s[i]??0)+.587*(s[i+1]??0)+.114*(s[i+2]??0));let l=-1;for(let[h,i]of C){let o=new Uint32Array(256),c=new Float64Array(256),u=0;for(let d=1;d<e-1;d+=1){let f=d*t,F=(d+i)*t,_=(d-i)*t;for(let p=1;p<t-1;p+=1){let T=a[F+p+h]??0,I=a[_+p-h]??0,S=Math.abs(T-I);o[S]=(o[S]??0)+1,c[S]=(c[S]??0)+Math.abs(T+I-2*(a[f+p]??0)),u+=1}}let g=Math.max(1,Math.floor(u/20)),m=0,M=0,k=0;for(let d=255;d>=0&&m<g;d-=1){let f=o[d]??0;m+=f,M+=f*d,k+=c[d]??0}if(M===0)return 0;let y=k/M;l=l<0?y:Math.min(l,y)}return l}n(E,"w");var A=.06;function B(r,t,e,s=A){if(r===null||t.width<=0||t.height<=0)return null;let a=[r.topLeft,r.topRight,r.bottomRight,r.bottomLeft],l=e.width/t.width,h=e.height/t.height,i=Math.min(...a.map(f=>f.x))*l,o=Math.max(...a.map(f=>f.x))*l,c=Math.min(...a.map(f=>f.y))*h,u=Math.max(...a.map(f=>f.y))*h,g=(o-i)*s,m=(u-c)*s,M=Math.max(0,Math.floor(i-g)),k=Math.max(0,Math.floor(c-m)),y=Math.min(e.width,Math.ceil(o+g)),d=Math.min(e.height,Math.ceil(u+m));return y-M<16||d-k<16?null:{x:M,y:k,width:y-M,height:d-k}}n(B,"P");function X(r,t){let e=t??{x:0,y:0,width:r.width,height:r.height},s=Math.min(1,1e3/Math.max(e.width,e.height)),a=Math.max(1,Math.round(e.width*s)),l=Math.max(1,Math.round(e.height*s)),h=document.createElement("canvas");h.width=a,h.height=l;try{let i=h.getContext("2d",{willReadFrequently:!0});return i===null?-1:(i.imageSmoothingQuality="high",i.drawImage(r,e.x,e.y,e.width,e.height,0,0,a,l),E(i.getImageData(0,0,a,l)))}catch{return-1}finally{h.width=0,h.height=0}}n(X,"B");var b,G=(b=class{constructor(t=2){this.stableReads=t,this.last=null,this.run=0}offer(t){return t===null?(this.reset(),!1):(this.run=t===this.last?this.run+1:1,this.last=t,this.run>=this.stableReads)}reset(){this.last=null,this.run=0}},n(b,"k"),b),L=Object.freeze({...z,minIntervalMs:150,maxWidthPx:480,detectorLimit:960,searchTimeoutMs:12e3}),P=Object.freeze({detectorLimit:960,bandMaxWidthPx:1280,minBandWidthPx:900,bandTop:.55,minIntervalMs:150,stableReads:2,profileReads:5,maxReadMs:1200,searchTimeoutMs:12e3}),V=n((r,t,e)=>createImageBitmap(r,Math.round(t.x),Math.round(t.y),Math.max(1,Math.round(t.w)),Math.max(1,Math.round(t.h)),{resizeWidth:Math.max(1,Math.round(Math.min(t.w,e))),resizeQuality:"high"}),"C"),w=n((r,t)=>{if(r.length===0)return 0;let e=[...r].sort((s,a)=>s-a);return e[Math.min(e.length-1,Math.floor(e.length*t))]},"x");function Y(r){return r<=250?"fast":r<=600?"mid":"slow"}n(Y,"G");function j(r,t,e){let s=r.y+r.h*t,a=Math.min(e,r.y+r.h*1.05);return{x:r.x,y:s,w:r.w,h:Math.max(1,a-s)}}n(j,"Y");var v,U=(v=class{constructor(t){this.o=t,this.engine=null,this.gen=0,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.firstSeen=null,this.reads=0,this.times=[],this.mrzState={state:"searching"},this.lockState={state:"searching"},this.fallback=null,this.lockOff=!1,this.lockError=!1,this.fired=null,this.valid=null,this.faceMode="off",this.disabled=!1,this.crop=t.crop??V,this.mrzGate=new G(t.liveMrz?.stableReads??2),this.lockGate=new O(t.textLock??L)}setEngine(t){this.engine=t}get bandTop(){return this.o.liveMrz?.bandTop??P.bandTop}get hasEngine(){return this.engine!==null&&!this.disabled}reset(){this.gen++,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.firstSeen=null,this.reads=0,this.times=[],this.mrzGate.reset(),this.lockGate.reset(),this.mrzState={state:"searching"},this.lockState={state:"searching"},this.fallback=null,this.lockOff=!1,this.lockError=!1,this.fired=null,this.valid=null,this.faceMode="off"}rearmFace(){this.gen++,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.mrzGate.reset(),this.lockGate.reset(),this.fired=null,this.valid=null,this.fallback===null&&(this.mrzState={state:"searching"}),this.lockOff||(this.lockState={state:"searching"})}liveCapture(){return this.fired?.via==="live_mrz"?this.valid:null}modeFor(t){return this.engine===null||this.disabled?"off":t.mrzFace&&this.o.liveMrz!==null&&this.fallback===null?"live_mrz":this.o.textLock!==null&&!this.lockOff?"text_lock":"off"}tick(t){let e=this.modeFor(t);return e!=="off"&&(this.faceMode=e),this.fired!==null?{ready:!0,via:this.fired.via,suspendQuality:this.fired.via==="live_mrz",mode:e,...this.states()}:e==="live_mrz"?this.liveTick(t,this.o.liveMrz):e==="text_lock"?this.lockTick(t,this.o.textLock):{ready:!1,suspendQuality:!1,mode:e,...this.states()}}states(){return{...this.faceMode==="live_mrz"||this.fallback!==null?{mrz:this.fallback!==null?{state:"fallback",reason:this.fallback}:this.mrzState}:{},...this.faceMode==="text_lock"?{lock:this.lockState}:{}}}canRead(t,e){let s=this.engine;return s!==null&&!this.inFlight&&!s.busy&&t-this.lastReadAt>=e}fall(t){this.fallback=t,this.mrzGate.reset()}liveTick(t,e){let s=n(()=>this.fallback!==null?{ready:!1,suspendQuality:!1,mode:"live_mrz",mrz:{state:"fallback",reason:this.fallback}}:{ready:!1,suspendQuality:!0,mode:"live_mrz",mrz:this.mrzState},"r");if(!t.present||t.band===null)return this.mrzGate.reset(),this.mrzState={state:"searching"},s();if(this.firstSeen??(this.firstSeen=t.atMs),t.atMs-this.firstSeen>e.searchTimeoutMs)return this.fall("timeout"),s();if(t.band.w<e.minBandWidthPx)return t.card!==null&&t.card.w<e.minBandWidthPx?(this.fall("unsupported"),s()):(this.mrzState={state:"reading",coach:t.portrait?"turnSideways":"moveCloser"},{ready:!1,suspendQuality:!1,mode:"live_mrz",mrz:this.mrzState});if(!this.canRead(t.atMs,e.minIntervalMs))return s();this.inFlight=!0,this.lastReadAt=t.atMs;let a=this.gen,l=this.engine,h=t.glareOk?t.sharpOk?void 0:"holdStill":"glare";return this.crop(t.video,t.band,e.bandMaxWidthPx).then(i=>l.bandRead(i,e.detectorLimit)).then(i=>{if(a===this.gen){if(this.reads++,this.times.push(i.ms),this.times.length>8&&this.times.shift(),this.reads>=e.profileReads&&w(this.times,.5)>e.maxReadMs)return this.fall("slow");if(this.mrzGate.offer(i.valid?i.digest??null:null)&&i.format&&i.digest){this.valid={format:i.format,...i.documentCode!==void 0?{documentCode:i.documentCode}:{},digest:i.digest,lineCount:i.lineCount,framesToValid:this.reads,msToValid:Math.round(t.atMs-(this.firstSeen??t.atMs))},this.mrzState={state:"valid",format:i.format},this.fired={via:"live_mrz",at:t.atMs};return}this.mrzState={state:"reading",...h?{coach:h}:{},...i.format?{format:i.format}:{}}}}).catch(()=>{a===this.gen&&this.fall("error")}).finally(()=>{a===this.gen&&(this.inFlight=!1)}),s()}lockTick(t,e){let s=n(()=>({ready:!1,suspendQuality:!1,mode:"text_lock",lock:this.lockState,...this.fallback!==null?{mrz:{state:"fallback",reason:this.fallback}}:{}}),"r");if(!t.present||t.card===null)return this.lockGate.reset(),this.lockState={state:"searching"},s();if(this.firstSeen??(this.firstSeen=t.atMs),t.atMs-this.firstSeen>e.searchTimeoutMs)return this.lockOff=!0,s();if(!this.canRead(t.atMs,e.minIntervalMs))return s();this.inFlight=!0,this.lastReadAt=t.atMs;let a=this.gen,l=this.engine,h={glareOk:t.glareOk,sharpOk:t.sharpOk};return this.crop(t.video,t.card,e.maxWidthPx).then(i=>l.layoutRead(i,e.detectorLimit)).then(i=>{if(a!==this.gen)return;this.reads++,this.times.push(i.ms),this.times.length>8&&this.times.shift();let o=this.lockGate.offer(i,t.atMs,h);this.lockState=o.state==="locked"?{state:"locked"}:{state:o.state,...o.hint?{hint:o.hint}:{}},o.state==="locked"&&(this.fired={via:"text_lock",at:t.atMs})}).catch(()=>{a===this.gen&&(this.lockOff=!0,this.lockError=!0)}).finally(()=>{a===this.gen&&(this.inFlight=!1)}),s()}disable(){this.disabled=!0,this.reset()}report(t,e,s){let a=this.faceMode;if(a==="off")return null;let l=w(this.times,.5),h={capture:t,mode:a,reads:this.reads,...this.times.length>0?{readP50Ms:Math.round(l),readP90Ms:Math.round(w(this.times,.9)),deviceClass:Y(l)}:{}};return a==="live_mrz"?this.fired?.via==="live_mrz"&&this.valid!==null&&e==="live_mrz"?{...h,outcome:"valid",format:this.valid.format,framesToValid:this.valid.framesToValid,msToValid:this.valid.msToValid}:this.fallback!==null?{...h,outcome:this.fallback}:{...h,outcome:s-(this.firstSeen??s)>=(this.o.liveMrz?.searchTimeoutMs??1/0)?"timeout":"off"}:this.fired?.via==="text_lock"?{...h,outcome:"locked",framesToLock:Math.max(1,this.reads),msToLock:Math.round(this.fired.at-(this.firstSeen??this.fired.at))}:{...h,outcome:this.lockError?"error":this.lockOff?"timeout":"off"}}},n(v,"L"),v);export{B as a,X as b,L as c,P as d,j as e,U as f};
@@ -0,0 +1 @@
1
+ import{a as f,c as x}from"./chunk-ET7NCKUV.js";import{a as u}from"./chunk-4FHWXBOB.js";var k={id_document:{pose:{yawDeg:7,pitchDeg:7,rollDeg:5,pitchOffsetDeg:4},eyes:{relativeMin:.62,blinkMax:.48,lowerEyeMin:.32},mouth:{jawOpenMax:.13,smileMax:.28,puckerMax:.48},lighting:{faceLuma:[95,185],halfRatio:[.77,1.31],clippedMax:.015},background:{required:!0,lumaMin:165,lumaSdMax:20},resolution:{minIodPx:110,minWidth:480,minHeight:640}},selfie:{pose:{yawDeg:7,pitchDeg:7,rollDeg:7,pitchOffsetDeg:4},eyes:{relativeMin:.62,blinkMax:.48,lowerEyeMin:.32},mouth:{jawOpenMax:.13,smileMax:.28,puckerMax:.28},lighting:{faceLuma:[95,185],halfRatio:[.77,1.31],clippedMax:.015},background:{required:!1,lumaMin:165,lumaSdMax:20},resolution:{minIodPx:100,minWidth:480,minHeight:640}}};function w(r){let n=k[r];return{profile:r,backgroundCheck:f,...n.pose,holdMs:500,alertGraceMs:3e3,eyes:{...n.eyes},mouth:{...n.mouth},lighting:{...n.lighting,faceLuma:[n.lighting.faceLuma[0],n.lighting.faceLuma[1]],halfRatio:[n.lighting.halfRatio[0],n.lighting.halfRatio[1]]},background:{...n.background},resolution:{...n.resolution},holdFrames:3,cadenceHz:10,baseline:{windowMs:3e3,minSamples:6,percentile:.8},sharpnessMin:.25,glare:{specularMax:.01},softGraceMs:4e3,cropMargin:1.25,camera:{width:1920,height:1080}}}u(w,"k");var D=w("id_document"),N=/^[A-Za-z0-9._-]{1,64}$/;function i(r,n,a,t){return typeof r=="number"&&Number.isFinite(r)&&r>=a&&r<=t?r:n}u(i,"n");function b(r,n,a,t){if(!Array.isArray(r)||r.length!==2)return[n[0],n[1]];let[e,c]=r,o=i(e,Number.NaN,a,t),s=i(c,Number.NaN,a,t);return Number.isNaN(o)||Number.isNaN(s)||o>s?[n[0],n[1]]:[o,s]}u(b,"x");function l(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{}}u(l,"o");function H(r,n){let a=l(r),t=a.profile==="selfie"?"selfie":"id_document",e=t==="selfie"?w(t):D,c=l(a.eyes),o=l(a.mouth),s=l(a.lighting),h=l(a.background),g=l(a.resolution),M=l(a.baseline),y=l(a.glare),m=l(a.camera),d=typeof h.required=="boolean"?h.required:e.background.required,p=x(a.backgroundCheck);return{profile:t,yawDeg:i(a.yawDeg,e.yawDeg,1,45),pitchDeg:i(a.pitchDeg,e.pitchDeg,1,45),pitchOffsetDeg:i(a.pitchOffsetDeg,e.pitchOffsetDeg,-20,20),rollDeg:i(a.rollDeg,e.rollDeg,1,45),holdMs:i(a.holdMs,e.holdMs,0,5e3),alertGraceMs:i(a.alertGraceMs,e.alertGraceMs,0,6e4),eyes:{relativeMin:i(c.relativeMin,e.eyes.relativeMin,0,1),blinkMax:i(c.blinkMax,e.eyes.blinkMax,0,1),lowerEyeMin:i(c.lowerEyeMin,e.eyes.lowerEyeMin,0,1)},mouth:{jawOpenMax:i(o.jawOpenMax,e.mouth.jawOpenMax,0,1),smileMax:i(o.smileMax,e.mouth.smileMax,0,1),puckerMax:i(o.puckerMax,e.mouth.puckerMax,0,1)},lighting:{faceLuma:b(s.faceLuma,e.lighting.faceLuma,0,255),halfRatio:b(s.halfRatio,e.lighting.halfRatio,0,10),clippedMax:i(s.clippedMax,e.lighting.clippedMax,0,1)},background:{required:d,lumaMin:i(h.lumaMin,e.background.lumaMin,0,255),lumaSdMax:i(h.lumaSdMax,e.background.lumaSdMax,0,255)},resolution:{minIodPx:i(g.minIodPx,e.resolution.minIodPx,1,2e3),minWidth:i(g.minWidth,e.resolution.minWidth,1,8e3),minHeight:i(g.minHeight,e.resolution.minHeight,1,8e3)},holdFrames:Math.round(i(a.holdFrames,e.holdFrames,1,60)),cadenceHz:i(a.cadenceHz,e.cadenceHz,1,30),baseline:{windowMs:i(M.windowMs,e.baseline.windowMs,200,3e4),minSamples:Math.round(i(M.minSamples,e.baseline.minSamples,1,300)),percentile:i(M.percentile,e.baseline.percentile,.5,1)},sharpnessMin:i(a.sharpnessMin,e.sharpnessMin,0,1),glare:{specularMax:i(y.specularMax,e.glare.specularMax,0,1)},softGraceMs:i(a.softGraceMs,e.softGraceMs,0,6e4),cropMargin:i(a.cropMargin,e.cropMargin,1,2),camera:{width:Math.round(i(m.width,e.camera.width,320,4096)),height:Math.round(i(m.height,e.camera.height,240,4096))},backgroundCheck:d?p:{...p,enabled:!1},tuningVersion:typeof n=="string"&&N.test(n)?n:null}}u(H,"R");export{D as a,H as b};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.22",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-4WOMNRBE-DNXJ7ERA.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let g=await i,p=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...p?[{kind:"web_local",value:p.slice(0,128)}]:[],...g?[{kind:"web_fp",value:g}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-HVV5ZEDI-JB4HN6S3.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};