@swan-admin/swan-web-component 1.0.114 → 1.0.116

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 (326) hide show
  1. package/dist/BodyScan-266TM1IY.js +2 -0
  2. package/dist/BodyScan-266TM1IY.js.map +1 -0
  3. package/dist/BodyScan-6DkuHYY1.js +2 -0
  4. package/dist/BodyScan-6DkuHYY1.js.map +1 -0
  5. package/dist/BodyScan-9r5xhZtT.js +2 -0
  6. package/dist/BodyScan-9r5xhZtT.js.map +1 -0
  7. package/dist/BodyScan-B5rbj0lx.js +2 -0
  8. package/dist/BodyScan-B5rbj0lx.js.map +1 -0
  9. package/dist/BodyScan-BDIHkyr1.js +2 -0
  10. package/dist/BodyScan-BDIHkyr1.js.map +1 -0
  11. package/dist/BodyScan-BHAi6fgF.js +2 -0
  12. package/dist/BodyScan-BHAi6fgF.js.map +1 -0
  13. package/dist/BodyScan-BRHehCvZ.js +2 -0
  14. package/dist/BodyScan-BRHehCvZ.js.map +1 -0
  15. package/dist/BodyScan-BS1ERcCz.js +2 -0
  16. package/dist/BodyScan-BS1ERcCz.js.map +1 -0
  17. package/dist/BodyScan-BSyeQRam.js +2 -0
  18. package/dist/BodyScan-BSyeQRam.js.map +1 -0
  19. package/dist/BodyScan-BYiULEJt.js +2 -0
  20. package/dist/BodyScan-BYiULEJt.js.map +1 -0
  21. package/dist/BodyScan-Ba0_SdEv.js +2 -0
  22. package/dist/BodyScan-Ba0_SdEv.js.map +1 -0
  23. package/dist/BodyScan-BdDkcHs5.js +2 -0
  24. package/dist/BodyScan-BdDkcHs5.js.map +1 -0
  25. package/dist/BodyScan-BeRh1VEM.js +2 -0
  26. package/dist/BodyScan-BeRh1VEM.js.map +1 -0
  27. package/dist/BodyScan-Bv0FKlE_.js +2 -0
  28. package/dist/BodyScan-Bv0FKlE_.js.map +1 -0
  29. package/dist/BodyScan-C4uag-I5.js +2 -0
  30. package/dist/BodyScan-C4uag-I5.js.map +1 -0
  31. package/dist/BodyScan-C7ccmu4z.js +2 -0
  32. package/dist/BodyScan-C7ccmu4z.js.map +1 -0
  33. package/dist/BodyScan-C84F8j4s.js +2 -0
  34. package/dist/BodyScan-C84F8j4s.js.map +1 -0
  35. package/dist/BodyScan-CCQYp6d5.js +2 -0
  36. package/dist/BodyScan-CCQYp6d5.js.map +1 -0
  37. package/dist/BodyScan-CKWEpJua.js +2 -0
  38. package/dist/BodyScan-CKWEpJua.js.map +1 -0
  39. package/dist/BodyScan-CN98BKFZ.js +2 -0
  40. package/dist/BodyScan-CN98BKFZ.js.map +1 -0
  41. package/dist/BodyScan-CPP9J8Ct.js +2 -0
  42. package/dist/BodyScan-CPP9J8Ct.js.map +1 -0
  43. package/dist/BodyScan-CR5-H0UA.js +2 -0
  44. package/dist/BodyScan-CR5-H0UA.js.map +1 -0
  45. package/dist/BodyScan-CSP5yePt.js +2 -0
  46. package/dist/BodyScan-CSP5yePt.js.map +1 -0
  47. package/dist/BodyScan-C_ZAWWXZ.js +2 -0
  48. package/dist/BodyScan-C_ZAWWXZ.js.map +1 -0
  49. package/dist/BodyScan-CadnO5G7.js +2 -0
  50. package/dist/BodyScan-CadnO5G7.js.map +1 -0
  51. package/dist/BodyScan-CdGuDf3C.js +2 -0
  52. package/dist/BodyScan-CdGuDf3C.js.map +1 -0
  53. package/dist/BodyScan-CdL7FlA2.js +2 -0
  54. package/dist/BodyScan-CdL7FlA2.js.map +1 -0
  55. package/dist/BodyScan-Cw9EbZpT.js +2 -0
  56. package/dist/BodyScan-Cw9EbZpT.js.map +1 -0
  57. package/dist/BodyScan-CwRmpuqZ.js +2 -0
  58. package/dist/BodyScan-CwRmpuqZ.js.map +1 -0
  59. package/dist/BodyScan-D3adkbYi.js +2 -0
  60. package/dist/BodyScan-D3adkbYi.js.map +1 -0
  61. package/dist/BodyScan-D3sbCXE3.js +2 -0
  62. package/dist/BodyScan-D3sbCXE3.js.map +1 -0
  63. package/dist/BodyScan-DCprskz_.js +2 -0
  64. package/dist/BodyScan-DCprskz_.js.map +1 -0
  65. package/dist/BodyScan-DFXvZoV8.js +2 -0
  66. package/dist/BodyScan-DFXvZoV8.js.map +1 -0
  67. package/dist/BodyScan-DMVMpieA.js +2 -0
  68. package/dist/BodyScan-DMVMpieA.js.map +1 -0
  69. package/dist/BodyScan-DR6nx-J3.js +2 -0
  70. package/dist/BodyScan-DR6nx-J3.js.map +1 -0
  71. package/dist/BodyScan-DTpf6JPk.js +2 -0
  72. package/dist/BodyScan-DTpf6JPk.js.map +1 -0
  73. package/dist/BodyScan-DV7xfyrh.js +2 -0
  74. package/dist/BodyScan-DV7xfyrh.js.map +1 -0
  75. package/dist/BodyScan-DZ0v1aWY.js +2 -0
  76. package/dist/BodyScan-DZ0v1aWY.js.map +1 -0
  77. package/dist/BodyScan-DePDK-lV.js +2 -0
  78. package/dist/BodyScan-DePDK-lV.js.map +1 -0
  79. package/dist/BodyScan-Dh5XpuVl.js +2 -0
  80. package/dist/BodyScan-Dh5XpuVl.js.map +1 -0
  81. package/dist/BodyScan-DmleTPju.js +2 -0
  82. package/dist/BodyScan-DmleTPju.js.map +1 -0
  83. package/dist/BodyScan-DmsLdodt.js +2 -0
  84. package/dist/BodyScan-DmsLdodt.js.map +1 -0
  85. package/dist/BodyScan-Do7DMvoE.js +2 -0
  86. package/dist/BodyScan-Do7DMvoE.js.map +1 -0
  87. package/dist/BodyScan-DpSLSJkg.js +2 -0
  88. package/dist/BodyScan-DpSLSJkg.js.map +1 -0
  89. package/dist/BodyScan-DshLNWwS.js +2 -0
  90. package/dist/BodyScan-DshLNWwS.js.map +1 -0
  91. package/dist/BodyScan-GsUKrJbz.js +2 -0
  92. package/dist/BodyScan-GsUKrJbz.js.map +1 -0
  93. package/dist/BodyScan-L9522Lbf.js +2 -0
  94. package/dist/BodyScan-L9522Lbf.js.map +1 -0
  95. package/dist/BodyScan-MAcTx2L_.js +2 -0
  96. package/dist/BodyScan-MAcTx2L_.js.map +1 -0
  97. package/dist/BodyScan-NmlecKAu.js +2 -0
  98. package/dist/BodyScan-NmlecKAu.js.map +1 -0
  99. package/dist/BodyScan-OtYm2KGr.js +2 -0
  100. package/dist/BodyScan-OtYm2KGr.js.map +1 -0
  101. package/dist/BodyScan-UrOz9iX3.js +2 -0
  102. package/dist/BodyScan-UrOz9iX3.js.map +1 -0
  103. package/dist/BodyScan-YlIT9lwi.js +2 -0
  104. package/dist/BodyScan-YlIT9lwi.js.map +1 -0
  105. package/dist/BodyScan-Z0QgXmsy.js +2 -0
  106. package/dist/BodyScan-Z0QgXmsy.js.map +1 -0
  107. package/dist/BodyScan-grQSzLIy.js +2 -0
  108. package/dist/BodyScan-grQSzLIy.js.map +1 -0
  109. package/dist/BodyScan-hL7iBlIZ.js +2 -0
  110. package/dist/BodyScan-hL7iBlIZ.js.map +1 -0
  111. package/dist/BodyScan-i6cTFkQH.js +2 -0
  112. package/dist/BodyScan-i6cTFkQH.js.map +1 -0
  113. package/dist/BodyScan-iqP_d120.js +2 -0
  114. package/dist/BodyScan-iqP_d120.js.map +1 -0
  115. package/dist/BodyScan-ivkSAzu4.js +2 -0
  116. package/dist/BodyScan-ivkSAzu4.js.map +1 -0
  117. package/dist/BodyScan-rVGG8jfb.js +2 -0
  118. package/dist/BodyScan-rVGG8jfb.js.map +1 -0
  119. package/dist/FaceScan-3X6MQMEX.js +2 -0
  120. package/dist/FaceScan-3X6MQMEX.js.map +1 -0
  121. package/dist/FaceScan-B5Ig13YK.js +2 -0
  122. package/dist/FaceScan-B5Ig13YK.js.map +1 -0
  123. package/dist/FaceScan-BEYwgG5s.js +2 -0
  124. package/dist/FaceScan-BEYwgG5s.js.map +1 -0
  125. package/dist/FaceScan-BJwQ3zJy.js +2 -0
  126. package/dist/FaceScan-BJwQ3zJy.js.map +1 -0
  127. package/dist/FaceScan-BKNQASGz.js +2 -0
  128. package/dist/FaceScan-BKNQASGz.js.map +1 -0
  129. package/dist/FaceScan-BUCUq-Ky.js +2 -0
  130. package/dist/FaceScan-BUCUq-Ky.js.map +1 -0
  131. package/dist/FaceScan-BXeNhTPp.js +2 -0
  132. package/dist/FaceScan-BXeNhTPp.js.map +1 -0
  133. package/dist/FaceScan-BoeC5FYB.js +2 -0
  134. package/dist/FaceScan-BoeC5FYB.js.map +1 -0
  135. package/dist/FaceScan-BsdZKlOZ.js +2 -0
  136. package/dist/FaceScan-BsdZKlOZ.js.map +1 -0
  137. package/dist/FaceScan-C89mYHyf.js +2 -0
  138. package/dist/FaceScan-C89mYHyf.js.map +1 -0
  139. package/dist/FaceScan-CAYo5Sx3.js +2 -0
  140. package/dist/FaceScan-CAYo5Sx3.js.map +1 -0
  141. package/dist/FaceScan-CDd3-sHM.js +2 -0
  142. package/dist/FaceScan-CDd3-sHM.js.map +1 -0
  143. package/dist/FaceScan-CDup4cr6.js +2 -0
  144. package/dist/FaceScan-CDup4cr6.js.map +1 -0
  145. package/dist/FaceScan-CEKFYJ7H.js +2 -0
  146. package/dist/FaceScan-CEKFYJ7H.js.map +1 -0
  147. package/dist/FaceScan-CKosTv3D.js +2 -0
  148. package/dist/FaceScan-CKosTv3D.js.map +1 -0
  149. package/dist/FaceScan-CQvW2N4-.js +2 -0
  150. package/dist/FaceScan-CQvW2N4-.js.map +1 -0
  151. package/dist/FaceScan-CUOi23K0.js +2 -0
  152. package/dist/FaceScan-CUOi23K0.js.map +1 -0
  153. package/dist/FaceScan-CX9evcWd.js +2 -0
  154. package/dist/FaceScan-CX9evcWd.js.map +1 -0
  155. package/dist/FaceScan-CaUr_UkA.js +2 -0
  156. package/dist/FaceScan-CaUr_UkA.js.map +1 -0
  157. package/dist/FaceScan-CjN4rVmd.js +2 -0
  158. package/dist/FaceScan-CjN4rVmd.js.map +1 -0
  159. package/dist/FaceScan-CkIu9qjW.js +2 -0
  160. package/dist/FaceScan-CkIu9qjW.js.map +1 -0
  161. package/dist/FaceScan-CnRj1Yix.js +2 -0
  162. package/dist/FaceScan-CnRj1Yix.js.map +1 -0
  163. package/dist/FaceScan-CoYz9-ne.js +2 -0
  164. package/dist/FaceScan-CoYz9-ne.js.map +1 -0
  165. package/dist/FaceScan-CpOUXeSp.js +2 -0
  166. package/dist/FaceScan-CpOUXeSp.js.map +1 -0
  167. package/dist/FaceScan-Cthc-Mpu.js +2 -0
  168. package/dist/FaceScan-Cthc-Mpu.js.map +1 -0
  169. package/dist/FaceScan-Cxdni73m.js +2 -0
  170. package/dist/FaceScan-Cxdni73m.js.map +1 -0
  171. package/dist/FaceScan-Czg2RLuu.js +2 -0
  172. package/dist/FaceScan-Czg2RLuu.js.map +1 -0
  173. package/dist/FaceScan-D4uGzUfl.js +2 -0
  174. package/dist/FaceScan-D4uGzUfl.js.map +1 -0
  175. package/dist/FaceScan-DINxXMKv.js +2 -0
  176. package/dist/FaceScan-DINxXMKv.js.map +1 -0
  177. package/dist/FaceScan-DL21ykY_.js +2 -0
  178. package/dist/FaceScan-DL21ykY_.js.map +1 -0
  179. package/dist/FaceScan-DR_OKG51.js +2 -0
  180. package/dist/FaceScan-DR_OKG51.js.map +1 -0
  181. package/dist/FaceScan-DmjXFO5E.js +2 -0
  182. package/dist/FaceScan-DmjXFO5E.js.map +1 -0
  183. package/dist/FaceScan-ECW1q_Bc.js +2 -0
  184. package/dist/FaceScan-ECW1q_Bc.js.map +1 -0
  185. package/dist/FaceScan-HkWW9fIU.js +2 -0
  186. package/dist/FaceScan-HkWW9fIU.js.map +1 -0
  187. package/dist/FaceScan-KJ_k17JE.js +2 -0
  188. package/dist/FaceScan-KJ_k17JE.js.map +1 -0
  189. package/dist/FaceScan-MB0mPOC4.js +2 -0
  190. package/dist/FaceScan-MB0mPOC4.js.map +1 -0
  191. package/dist/FaceScan-O63Wbjt7.js +2 -0
  192. package/dist/FaceScan-O63Wbjt7.js.map +1 -0
  193. package/dist/FaceScan-UGdieN4m.js +2 -0
  194. package/dist/FaceScan-UGdieN4m.js.map +1 -0
  195. package/dist/FaceScan-X-iTekPu.js +2 -0
  196. package/dist/FaceScan-X-iTekPu.js.map +1 -0
  197. package/dist/FaceScan-YY0nhUc-.js +2 -0
  198. package/dist/FaceScan-YY0nhUc-.js.map +1 -0
  199. package/dist/FaceScan-aTY9dK-E.js +2 -0
  200. package/dist/FaceScan-aTY9dK-E.js.map +1 -0
  201. package/dist/FaceScan-gLauGMHv.js +2 -0
  202. package/dist/FaceScan-gLauGMHv.js.map +1 -0
  203. package/dist/FaceScan-gcS5xK0C.js +2 -0
  204. package/dist/FaceScan-gcS5xK0C.js.map +1 -0
  205. package/dist/FaceScan-k2iKowYL.js +2 -0
  206. package/dist/FaceScan-k2iKowYL.js.map +1 -0
  207. package/dist/FaceScan-ksOwbYeM.js +2 -0
  208. package/dist/FaceScan-ksOwbYeM.js.map +1 -0
  209. package/dist/FaceScan-sAMtjY_G.js +2 -0
  210. package/dist/FaceScan-sAMtjY_G.js.map +1 -0
  211. package/dist/FaceScan-srkhPOLY.js +2 -0
  212. package/dist/FaceScan-srkhPOLY.js.map +1 -0
  213. package/dist/FaceScan-tfgID8J-.js +2 -0
  214. package/dist/FaceScan-tfgID8J-.js.map +1 -0
  215. package/dist/LoadingScreen-6-Dztgm-.js +2 -0
  216. package/dist/LoadingScreen-6-Dztgm-.js.map +1 -0
  217. package/dist/LoadingScreen-B-Mv028i.js +2 -0
  218. package/dist/LoadingScreen-B-Mv028i.js.map +1 -0
  219. package/dist/LoadingScreen-B27DzMIt.js +2 -0
  220. package/dist/LoadingScreen-B27DzMIt.js.map +1 -0
  221. package/dist/LoadingScreen-B5iS2xWa.js +2 -0
  222. package/dist/LoadingScreen-B5iS2xWa.js.map +1 -0
  223. package/dist/LoadingScreen-Bj3uzfuT.js +2 -0
  224. package/dist/LoadingScreen-Bj3uzfuT.js.map +1 -0
  225. package/dist/LoadingScreen-BjhVLzbU.js +2 -0
  226. package/dist/LoadingScreen-BjhVLzbU.js.map +1 -0
  227. package/dist/LoadingScreen-BoqG9-bi.js +2 -0
  228. package/dist/LoadingScreen-BoqG9-bi.js.map +1 -0
  229. package/dist/LoadingScreen-Bpbe8TTf.js +2 -0
  230. package/dist/LoadingScreen-Bpbe8TTf.js.map +1 -0
  231. package/dist/LoadingScreen-BwJk45mz.js +2 -0
  232. package/dist/LoadingScreen-BwJk45mz.js.map +1 -0
  233. package/dist/LoadingScreen-C0x3_zHI.js +2 -0
  234. package/dist/LoadingScreen-C0x3_zHI.js.map +1 -0
  235. package/dist/LoadingScreen-C2p1rVUR.js +2 -0
  236. package/dist/LoadingScreen-C2p1rVUR.js.map +1 -0
  237. package/dist/LoadingScreen-C9yWL5Pc.js +2 -0
  238. package/dist/LoadingScreen-C9yWL5Pc.js.map +1 -0
  239. package/dist/LoadingScreen-CCaeHSK3.js +2 -0
  240. package/dist/LoadingScreen-CCaeHSK3.js.map +1 -0
  241. package/dist/LoadingScreen-CGbxyNyP.js +2 -0
  242. package/dist/LoadingScreen-CGbxyNyP.js.map +1 -0
  243. package/dist/LoadingScreen-CcAK_ftO.js +2 -0
  244. package/dist/LoadingScreen-CcAK_ftO.js.map +1 -0
  245. package/dist/LoadingScreen-CdA6xTi9.js +2 -0
  246. package/dist/LoadingScreen-CdA6xTi9.js.map +1 -0
  247. package/dist/LoadingScreen-CgzB83o8.js +2 -0
  248. package/dist/LoadingScreen-CgzB83o8.js.map +1 -0
  249. package/dist/LoadingScreen-Csi-kWWH.js +2 -0
  250. package/dist/LoadingScreen-Csi-kWWH.js.map +1 -0
  251. package/dist/LoadingScreen-CtyswN5E.js +2 -0
  252. package/dist/LoadingScreen-CtyswN5E.js.map +1 -0
  253. package/dist/LoadingScreen-CvTw4HCH.js +2 -0
  254. package/dist/LoadingScreen-CvTw4HCH.js.map +1 -0
  255. package/dist/LoadingScreen-CzLNKXb1.js +2 -0
  256. package/dist/LoadingScreen-CzLNKXb1.js.map +1 -0
  257. package/dist/LoadingScreen-D1nnEFNR.js +2 -0
  258. package/dist/LoadingScreen-D1nnEFNR.js.map +1 -0
  259. package/dist/LoadingScreen-DAMI7lHa.js +2 -0
  260. package/dist/LoadingScreen-DAMI7lHa.js.map +1 -0
  261. package/dist/LoadingScreen-DOyxaBGy.js +2 -0
  262. package/dist/LoadingScreen-DOyxaBGy.js.map +1 -0
  263. package/dist/LoadingScreen-DVjp9x4z.js +2 -0
  264. package/dist/LoadingScreen-DVjp9x4z.js.map +1 -0
  265. package/dist/LoadingScreen-DZBvMyMp.js +2 -0
  266. package/dist/LoadingScreen-DZBvMyMp.js.map +1 -0
  267. package/dist/LoadingScreen-DcZYWJaQ.js +2 -0
  268. package/dist/LoadingScreen-DcZYWJaQ.js.map +1 -0
  269. package/dist/LoadingScreen-DfhwWaDP.js +2 -0
  270. package/dist/LoadingScreen-DfhwWaDP.js.map +1 -0
  271. package/dist/LoadingScreen-DhbtuXrJ.js +2 -0
  272. package/dist/LoadingScreen-DhbtuXrJ.js.map +1 -0
  273. package/dist/LoadingScreen-Dib6A2Ve.js +2 -0
  274. package/dist/LoadingScreen-Dib6A2Ve.js.map +1 -0
  275. package/dist/LoadingScreen-DjYv3mcm.js +2 -0
  276. package/dist/LoadingScreen-DjYv3mcm.js.map +1 -0
  277. package/dist/LoadingScreen-DjbTg0B7.js +2 -0
  278. package/dist/LoadingScreen-DjbTg0B7.js.map +1 -0
  279. package/dist/LoadingScreen-DrHVz3VF.js +2 -0
  280. package/dist/LoadingScreen-DrHVz3VF.js.map +1 -0
  281. package/dist/LoadingScreen-DzHMcCLq.js +2 -0
  282. package/dist/LoadingScreen-DzHMcCLq.js.map +1 -0
  283. package/dist/LoadingScreen-HEWqrS0h.js +2 -0
  284. package/dist/LoadingScreen-HEWqrS0h.js.map +1 -0
  285. package/dist/LoadingScreen-NaDsFeSL.js +2 -0
  286. package/dist/LoadingScreen-NaDsFeSL.js.map +1 -0
  287. package/dist/LoadingScreen-QJ0014wx.js +2 -0
  288. package/dist/LoadingScreen-QJ0014wx.js.map +1 -0
  289. package/dist/LoadingScreen-XpTbgEdb.js +2 -0
  290. package/dist/LoadingScreen-XpTbgEdb.js.map +1 -0
  291. package/dist/LoadingScreen-mkx7zXm3.js +2 -0
  292. package/dist/LoadingScreen-mkx7zXm3.js.map +1 -0
  293. package/dist/LoadingScreen-xK5L8Cwd.js +2 -0
  294. package/dist/LoadingScreen-xK5L8Cwd.js.map +1 -0
  295. package/dist/bodyScan.d.ts +2 -2
  296. package/dist/bodyScan.js +1 -1
  297. package/dist/bodyScan.mjs +1 -1
  298. package/dist/faceScan.d.ts +2 -2
  299. package/dist/faceScan.js +1 -1
  300. package/dist/faceScan.mjs +1 -1
  301. package/dist/index.d.ts +2 -2
  302. package/dist/index.js +1 -1
  303. package/dist/index.mjs +1 -1
  304. package/dist/interfaces-9gH-zdwN.d.ts +172 -0
  305. package/dist/interfaces-B-8WwrSS.d.ts +205 -0
  306. package/dist/interfaces-BEjFALPD.d.ts +172 -0
  307. package/dist/interfaces-BIz9uFrG.d.ts +169 -0
  308. package/dist/interfaces-BdmYhSHQ.d.ts +178 -0
  309. package/dist/interfaces-BkHveLwI.d.ts +206 -0
  310. package/dist/interfaces-BsHu082_.d.ts +175 -0
  311. package/dist/interfaces-DDDU9Drs.d.ts +204 -0
  312. package/dist/interfaces-DQ9_eGDO.d.ts +206 -0
  313. package/dist/interfaces-DRQdRcUH.d.ts +167 -0
  314. package/dist/interfaces-DtTdp0w3.d.ts +180 -0
  315. package/dist/interfaces-LWgRZJ8r.d.ts +165 -0
  316. package/dist/interfaces-eRPH_aoH.d.ts +167 -0
  317. package/dist/interfaces-wwqeKDrE.d.ts +179 -0
  318. package/dist/pose-detection.esm-BLeo_q1f.js +18 -0
  319. package/dist/pose-detection.esm-BLeo_q1f.js.map +1 -0
  320. package/dist/pose-detection.esm-BaWguRmj.js +18 -0
  321. package/dist/pose-detection.esm-BaWguRmj.js.map +1 -0
  322. package/dist/pose-detection.esm-BpdMeLUd.js +18 -0
  323. package/dist/pose-detection.esm-BpdMeLUd.js.map +1 -0
  324. package/dist/pose-detection.esm-CUXej2pM.js +18 -0
  325. package/dist/pose-detection.esm-CUXej2pM.js.map +1 -0
  326. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BodyScan-D3adkbYi.js","sources":["../src/utils/context/mediaContext.tsx","../src/Icons/SwitchIcon.tsx","../src/components/bodyScan/LevelScreen.tsx","../src/components/bodyScan/CameraScanChild.tsx","../src/customHooks/useTensorFlow.ts","../src/components/bodyScan/ScanningComponent.tsx","../src/components/bodyScan/AngleDetector.tsx","../src/components/Modal.tsx","../src/components/bodyScan/CameraPermission.tsx","../src/components/bodyScan/VideoPlayer.tsx","../src/components/bodyScan/ScanErrorMessage.tsx","../src/components/Signup.tsx","../src/components/bodyScan/BodyScanSteps.tsx","../src/components/bodyScan/BodyScan.tsx","../src/customHooks/useGyroSensor.ts"],"sourcesContent":["\"use client\"\nimport React, {\n createContext,\n Dispatch,\n ReactNode,\n SetStateAction,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n} from \"react\";\n\nexport const MEDIA_TYPES = {\n DESKTOP: \"DESKTOP\",\n TAB: \"TAB\",\n MOBILE: \"MOBILE\",\n};\n\ninterface MediaContextType {\n size: number[];\n setSize: Dispatch<SetStateAction<number[]>>;\n clearInputs: boolean;\n setClearInputs: Dispatch<SetStateAction<boolean>>;\n media: string;\n}\n\nexport const MediaContext = createContext<MediaContextType | undefined>(\n undefined\n);\n\nfunction MediaContextProvider({ children }: { children: ReactNode }) {\n const [size, setSize] = useState([window?.innerWidth, window?.innerHeight]);\n const [clearInputs, setClearInputs] = useState(false);\n\n const updateSize = () => {\n setSize([window?.innerWidth, window?.innerHeight]);\n };\n useEffect(() => {\n updateSize();\n }, []);\n useLayoutEffect(() => {\n window.addEventListener(\"resize\", updateSize);\n return () => window.removeEventListener(\"resize\", updateSize);\n }, [updateSize]);\n let media = MEDIA_TYPES.DESKTOP;\n if (size[0] > 768 && size[0] < 1024) {\n media = MEDIA_TYPES.TAB;\n }\n if (size[0] < 768) {\n media = MEDIA_TYPES.MOBILE;\n }\n\n const mediaDetails = useMemo(\n () => ({\n size,\n setSize,\n clearInputs,\n setClearInputs,\n media,\n }),\n [size, clearInputs, media]\n );\n\n return (\n <MediaContext.Provider value={mediaDetails}>\n {children}\n </MediaContext.Provider>\n );\n}\n\nexport default MediaContextProvider;\n","import React from \"react\";\n\nfunction SwitchIcon({ size = 16 }: { size?: number }) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 25 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M22.6968 14.6968C22.6968 16.8185 21.8539 18.8533 20.3536 20.3536C18.8533 21.8539 16.8185 22.6968 14.6968 22.6968\"\n stroke=\"white\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M18.6968 11.6968V10.6968C18.6968 10.1663 18.4861 9.65764 18.111 9.28256C17.7359 8.90749 17.2272 8.69678 16.6968 8.69678C16.1663 8.69678 15.6576 8.90749 15.2826 9.28256C14.9075 9.65764 14.6968 10.1663 14.6968 10.6968\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M14.6968 10.6968V9.69678C14.6968 9.16634 14.4861 8.65764 14.111 8.28256C13.7359 7.90749 13.2272 7.69678 12.6968 7.69678C12.1663 7.69678 11.6576 7.90749 11.2826 8.28256C10.9075 8.65764 10.6968 9.16634 10.6968 9.69678V10.6968\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M10.6968 10.1968V4.69678C10.6968 4.16634 10.4861 3.65764 10.111 3.28256C9.73592 2.90749 9.22721 2.69678 8.69678 2.69678C8.16634 2.69678 7.65764 2.90749 7.28256 3.28256C6.90749 3.65764 6.69678 4.16634 6.69678 4.69678V14.6968\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M18.6969 11.6968C18.6969 11.1663 18.9076 10.6576 19.2827 10.2826C19.6577 9.90749 20.1664 9.69678 20.6969 9.69678C21.2273 9.69678 21.736 9.90749 22.1111 10.2826C22.4862 10.6576 22.6969 11.1663 22.6969 11.6968V14.6968C22.6969 16.8185 21.854 18.8533 20.3537 20.3536C18.8534 21.8539 16.8186 22.6968 14.6969 22.6968H12.6969C9.89688 22.6968 8.19688 21.8368 6.70688 20.3568L3.10688 16.7568C2.76282 16.3757 2.57847 15.8769 2.592 15.3637C2.60554 14.8505 2.81593 14.3621 3.1796 13.9997C3.54327 13.6373 4.03238 13.4287 4.54565 13.417C5.05892 13.4053 5.55704 13.5914 5.93688 13.9368L7.69688 15.6968\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nexport default React.memo(SwitchIcon);\n","/* eslint-disable no-nested-ternary */\n\nimport React, { useCallback, useContext, useMemo } from \"react\";\nimport Header from \"../Header\";\nimport cn from \"clsx\";\nimport { LevelScreenProps } from \"../../types/interfaces\";\nimport SwitchIcon from \"../../Icons/SwitchIcon\";\nimport { LanguageContext } from \"../../utils/context/languageContext\";\nimport { LanguageKeys } from \"../../utils/languageKeys\";\nimport { useConfig } from \"../../utils/context/configContext\";\n\nfunction LevelScreen({ angle, countdown, isScanning, isInTargetRange, stabilityScore, children }: Omit<LevelScreenProps, \"config\">) {\n\tconst { translate } = useContext(LanguageContext) || {};\n\tconst config = useConfig();\n\n\tconst getProximityToTarget = useCallback(() => {\n\t\tif (angle < 80) return Math.max(0, Math.min(100, (angle - 60) * 10));\n\t\tif (angle > 95) return Math.max(0, Math.min(100, (105 - angle) * 10));\n\t\treturn 100;\n\t}, [angle]);\n\n\tconst backgroundColor = useMemo(() => {\n\t\tif (isScanning) return config?.style?.angleDetector?.successAngleBackground || \"#4f46e5\";\n\n\t\tconst proximity = getProximityToTarget();\n\t\tif (proximity === 0) return config?.style?.angleDetector?.successAngleLowBackground || \"#ffffff\";\n\t\tif (proximity === 100) return config?.style?.angleDetector?.successAngleBackground || \"#4f46e5\";\n\n const r = Math.round(255 - (255 - 139) * (proximity / 100));\n const g = Math.round(255 - (255 - 92) * (proximity / 100));\n const b = Math.round(255 - (255 - 246) * (proximity / 100));\n return `rgb(${r}, ${g}, ${b})`;\n }, [isScanning, getProximityToTarget]);\n\n\tconst handelTextColour = useCallback((isLight: boolean, proximity: number) => {\n\t\tif (proximity > 70) {\n\t\t\treturn isLight ? `text-[${config?.style?.angleDetector?.successAngleTextLightColor}]/70` : `text-[${config?.style?.angleDetector?.successAngleTextLightColor}]`;\n\t\t}\n\t\treturn isLight ? `text-[${config?.style?.angleDetector?.successAngleTextLightColor}]/40` : `text-[${config?.style?.angleDetector?.successAngleTextDarkColor}]/70`;\n\t}, []);\n\n\tconst getTextColor = useCallback(\n\t\t(isLight = false) => {\n\t\t\tconst proximity = getProximityToTarget();\n\t\t\tif (isScanning) return `text-[${config?.style?.angleDetector?.successAngleTextLightColor}]`;\n\t\t\treturn handelTextColour(isLight, proximity);\n\t\t},\n\t\t[isScanning, getProximityToTarget],\n\t);\n\n\tconst handelColourCode = useCallback((isLight: boolean, proximity: number) => {\n\t\tif (proximity > 70) {\n\t\t\treturn isLight ? config?.style?.angleDetector?.successAngleTextLightColor : config?.style?.angleDetector?.successAngleTextLightColor;\n\t\t}\n\t\treturn isLight ? config?.style?.angleDetector?.successAngleTextLightColor : config?.style?.angleDetector?.successAngleTextDarkColor;\n\t}, []);\n\tconst getColorCode = useCallback(\n\t\t(isLight = false) => {\n\t\t\tconst proximity = getProximityToTarget();\n\t\t\tif (isScanning) return config?.style?.angleDetector?.successAngleTextLightColor;\n\t\t\treturn handelColourCode(isLight, proximity);\n\t\t},\n\t\t[isScanning, getProximityToTarget],\n\t);\n\tconst cd = countdown;\n\tfunction fixVh() {\n\t\tdocument.documentElement.style.setProperty(\"--real-vh\", window.innerHeight + \"px\");\n\t}\n\tfixVh();\n\twindow.addEventListener(\"resize\", fixVh);\n\treturn (\n\t\t<div\n\t\t\tclassName=\"flex w-screen flex-col items-center h-[var(--real-vh)] overflow-hidden touch-none justify-center transition-all duration-300 max-w-[28rem] mx-auto\"\n\t\t\tstyle={{ backgroundColor }}\n\t\t\t// onDoubleClick={onDoubleClick}\n\t\t>\n\t\t\t<div className=\"flex justify-start fixed top-[.5rem] max-w-[28rem] mx-auto w-full px-[1rem]\">\n\t\t\t\t<div className=\"flex justify-start \">\n\t\t\t\t\t<Header noTitle />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{cd !== null ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"relative flex h-[6rem] w-[6rem] items-center justify-center rounded-[9999px] bg-[#fff]/20 transition-all duration-300\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tborder: `2px solid ${getColorCode()}`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={`text-[3rem] font-bold text-[${getColorCode()}]`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tfontFamily: config?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n color: getColorCode(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{cd}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : isScanning ? (\n\t\t\t\t<div className=\"relative flex flex-col items-center justify-center\">\n\t\t\t\t\t<div className=\"relative flex h-16 w-16 items-center justify-center rounded-[9999px] border-2 bg-[#fff]/30 border-[#fff]\">\n\t\t\t\t\t\t<div className=\"h-4 w-4 rounded-[9999px] animate-pulse bg-[#fff]/80\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\"relative flex h-[4rem] w-[4rem] items-center justify-center rounded-[9999px] \", isInTargetRange ? \"bg-[#fff]/20 border-[#fff]\" : \"bg-[#fff]/10 border-[#fff]\")}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\ttransform: `translateY(${(90 - angle) * 3}px)`,\n\t\t\t\t\t\ttransition: \"transform 0.2s ease-out\",\n\t\t\t\t\t\tborder: `2px solid ${getColorCode()}`,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div className={`h-[1rem] w-[1rem] rounded-[9999px] bg-[${getColorCode()}]/80`}\n style={{\n\t\t\t\t\t\tbackgroundColor: `${getColorCode()}B3`,\n\t\t\t\t\t}}\n />\n\t\t\t\t\t<div\n\t\t\t\t\t\t// className=\" text-[#fff]\"\n\t\t\t\t\t\tclassName={cn(\"mt-[.5rem] text-center w-[180px] flex-col flex items-center absolute top-[60px]\", getTextColor())}\n style={{\n\t\t\t\t\t\tcolor: getColorCode(),\n\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SwitchIcon size={30} />\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tfontFamily: config?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{\" \"}\n\t\t\t\t\t\t\t{translate?.(LanguageKeys.startLevelCheck)}\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{cd !== null && (\n\t\t\t\t<div className=\"absolute bottom-[8rem] text-center\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cn(\"text-sm font-medium px-4 py-1.5 bg-black/20 rounded-[9999px] mt-8\", getTextColor())}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tfontFamily: config?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n color: getColorCode(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{translate?.(LanguageKeys.leavePhone)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{isInTargetRange && cd === null && !isScanning && (\n\t\t\t\t<div className=\"absolute bottom-[8rem] w-[12rem]\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={`h-[.375rem] w-full bg-[${getColorCode()}]/20 rounded-[9999px] overflow-hidden`}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackgroundColor: `${getColorCode()}33`, // 20% opacity\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={`h-full bg-[${getColorCode()}]/70 transition-all duration-300 rounded-[9999px]`}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\twidth: `${angle}%`,\n\t\t\t\t\t\t\t\tbackgroundColor: `${getColorCode()}B3`,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\n {cd === null && !isScanning && (\n <div className=\"absolute bottom-[5rem] text-center\">\n <div className={cn(\"text-[1.5rem] font-light\", getTextColor())}\n style={{\n\t\t\t\t\t\tcolor: getColorCode(),\n\t\t\t\t\t}}\n >\n {Math.round(angle)}°\n </div>\n </div>\n )}\n\n\t\t\t{cd === null && !isScanning && (\n\t\t\t\t<div className=\"absolute bottom-[2rem] text-center max-w-[20rem] mx-auto\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cn(\"text-[.75rem] opacity-50\", getTextColor())}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tfontFamily: config?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n color: getColorCode(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{translate?.(LanguageKeys.placePhoneUpright)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n}\nexport default React.memo(LevelScreen);\n","import { useContext } from \"react\";\nimport Webcam from \"react-webcam\";\nimport { CameraScanChildProps } from \"../../types/interfaces\";\nimport { MEDIA_TYPES, MediaContext } from \"../../utils/context/mediaContext\";\nimport { LanguageContext } from \"../../utils/context/languageContext\";\nimport { pauseIcon, voiceOverAssetsPath } from \"../../utils/constants\";\nimport SpecificButton from \"../../atoms/specificButton/SpecificButton\";\nimport { LanguageKeys } from \"../../utils/languageKeys\";\nimport { X } from \"lucide-react\";\n\n\n\nfunction CameraScanChild({\n handleShowStreamCamera,\n loadingCam,\n handleUserMedia,\n handlePause,\n pause,\n recordingStarted,\n startSendingVideoFrames,\n showPause,\n webcamRef,\n handleUserMediaError,\n resetDetector,\n videoConstraints,\n webcamKey,\n}: Omit<CameraScanChildProps, \"config\">) {\n const { media } = useContext(MediaContext) || {};\n const { translate } = useContext(LanguageContext) || {};\n\n return (\n <div className=\"App w-screen h-[100vh] relative \">\n <span\n onClick={() => {\n handleShowStreamCamera();\n resetDetector();\n }}\n className=\"fixed right-[20px] top-[20px] z-[999]\"\n >\n <X className=\"text-[#fff]\" />\n </span>\n\n <div className=\"w-full h-full overflow-hidden \">\n {media === MEDIA_TYPES.MOBILE && (\n <Webcam\n key={webcamKey}\n audio={false}\n ref={webcamRef}\n screenshotQuality={1}\n videoConstraints={videoConstraints}\n mirrored\n screenshotFormat=\"image/jpeg\"\n onUserMedia={handleUserMedia}\n onUserMediaError={handleUserMediaError}\n style={{\n position: \"fixed\",\n top: 0,\n bottom: 0,\n zIndex: 0,\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n }}\n />\n )}\n </div>\n\n <div className=\"fixed bottom-[30px] w-full z-[999] flex flex-col gap-4 items-center justify-center\">\n {showPause && (\n <SpecificButton\n className=\"!w-[180px] !h-[40px] !py-[0] mx-auto \"\n prefix={pauseIcon}\n buttonText={translate?.(LanguageKeys.pause)}\n buttonFunc={handlePause}\n btnSecondary\n />\n )}\n\n {pause ? (\n <div>\n <SpecificButton\n className=\"!w-[180px] !h-[40px] !py-[0] mx-auto\"\n buttonText={translate?.(LanguageKeys.restart)}\n buttonFunc={handleShowStreamCamera}\n btnSecondary\n />\n </div>\n ) : !recordingStarted ? (\n <SpecificButton\n className={`!w-[180px] !h-[40px] !py-[0] mx-auto !bg-[#ffffff] !text-[#000000] ${\n loadingCam ? \"!opacity-50\" : \"\"\n }`}\n buttonText={translate?.(LanguageKeys.startScan)}\n buttonFunc={startSendingVideoFrames}\n disabled={loadingCam}\n />\n ) : null}\n </div>\n\n <audio\n id=\"audioElement\"\n crossOrigin=\"anonymous\"\n preload=\"auto\"\n style={{\n position: \"absolute\",\n zIndex: -99999,\n }}\n src={`${voiceOverAssetsPath}scanAudioInstructions/silence.mp3`}\n />\n </div>\n );\n}\n\nexport default CameraScanChild;\n","import { useState, useRef, useEffect } from \"react\";\n// We keep this, but we will make it optional in the logic below\n\ntype KeypointTuple = [number, number, number];\n\n// GLOBAL SINGLETONS (Persist across component re-mounts)\n// This prevents reloading the heavy model if the user navigates away and back.\nlet globalLoadingPromise: Promise<boolean> | null = null;\nlet globalDetector: any = null;\nlet globalPoseLib: any = null;\n\nexport default function useTensorFlow() {\n const [consecutiveFronts, setConsecutiveFronts] = useState(0);\n const [spinPhase, setSpinPhase] = useState(0);\n const [isLoaded, setIsLoaded] = useState(false);\n\n const spinPhaseRef = useRef(0);\n const consecutiveFrontsRef = useRef(0);\n const mounted = useRef(true);\n\n useEffect(() => {\n mounted.current = true; // Reset on mount\n\n // 1. If already loaded globally, just use it.\n if (globalDetector) {\n setIsLoaded(true);\n return;\n }\n\n // 2. If not loading, start the process.\n if (!globalLoadingPromise) {\n globalLoadingPromise = loadDependenciesGlobal();\n }\n\n // 3. Wait for the global promise to resolve.\n globalLoadingPromise.then((success) => {\n if (success && mounted.current) {\n setIsLoaded(true);\n }\n });\n\n return () => {\n mounted.current = false;\n };\n }, []);\n\n /**\n * Loads TensorFlow/MediaPipe dynamically.\n * This logic is ISOLATED from the server.\n */\n async function loadDependenciesGlobal(): Promise<boolean> {\n // GUARDRAIL 1: Strict Environment Check\n // Ensure we are in a browser environment with media capabilities\n if (\n typeof window === 'undefined' || \n typeof navigator === 'undefined'\n ) {\n return false;\n }\n \n try {\n console.log(\"Starting TensorFlow preload...\");\n \n // GUARDRAIL 2: Dynamic Imports\n // These heavy modules are only fetched by the browser, never the server.\n const [poseLib, tfjsCore, tfjsBackend] = await Promise.all([\n import(\"@tensorflow-models/pose-detection\"),\n import(\"@tensorflow/tfjs-core\"),\n import(\"@tensorflow/tfjs-backend-webgl\") // Triggers backend registration side-effect\n ]);\n \n globalPoseLib = poseLib;\n \n // Explicitly set the backend to WebGL for performance\n await tfjsCore.setBackend('webgl');\n await tfjsCore.ready();\n console.log(\"TensorFlow backend ready (WebGL)\");\n\n // GUARDRAIL 3: Zero-Config Asset Loading\n // If TENSORFLOW_SOLUTION_PATH fails or is missing, we must fallback \n // to a CDN so the user doesn't have to copy files manually.\n const modelConfig = {\n runtime: \"mediapipe\",\n modelType: \"full\",\n solutionPath:\"https://cdn.jsdelivr.net/npm/@mediapipe/pose\", // Fallback for Zero Config\n } as const;\n\n try {\n globalDetector = await globalPoseLib.createDetector(\n globalPoseLib.SupportedModels.BlazePose,\n modelConfig\n );\n console.log(\"MediaPipe detector created successfully\");\n } catch (mediapipeError) {\n console.warn(\"MediaPipe failed, falling back to TFJS runtime:\", mediapipeError);\n \n // Fallback to TFJS runtime (slower but works without external assets)\n globalDetector = await globalPoseLib.createDetector(\n globalPoseLib.SupportedModels.BlazePose,\n {\n runtime: \"tfjs\",\n modelType: \"full\",\n }\n );\n console.log(\"TFJS detector created successfully\");\n }\n \n return true;\n } catch (error) {\n console.error(\"Failed to load TensorFlow dependencies:\", error);\n globalLoadingPromise = null; // Reset so retry is possible\n return false;\n }\n }\n\n function isFrontFrame(body: KeypointTuple[]) {\n // Guardrail: Ensure points exist before filtering\n if (!body || body.length === 0) return false;\n return body.filter((p) => p[2] > 0.7).length === 22;\n }\n\n const poseDetector = async (callback: () => void, webcamRef: any) => {\n // GUARDRAIL 4: Runtime Safety\n // Check if everything is truly ready before calculating\n if (!globalDetector || !mounted.current || !webcamRef?.current?.video) {\n return;\n }\n \n // Check if video is actually playing and has data\n const video = webcamRef.current.video;\n if (video.readyState < 2) return; \n\n try {\n const poses = await globalDetector.estimatePoses(\n video,\n { flipHorizontal: false }\n );\n\n if (!poses || !poses.length) return;\n\n const keypoints = poses[0].keypoints;\n \n // Standardize keypoints\n const body: KeypointTuple[] = keypoints\n .slice(11) // Ignore face keypoints (0-10)\n .map((kp: any) => [\n kp.x > 0 && kp.x < 720 ? kp.x : -1,\n kp.y > 0 && kp.y < 1280 ? kp.y : -1,\n kp.score ?? 0,\n ]);\n\n if (spinPhaseRef.current === 0 && !isFrontFrame(body)) {\n setConsecutiveFronts((prev) => prev + 1);\n }\n\n if (spinPhaseRef.current === 1 && isFrontFrame(body)) {\n setConsecutiveFronts((prev) => prev + 1);\n }\n\n if (spinPhaseRef.current === 2) callback();\n } catch (err) {\n console.error(\"Pose detection error:\", err);\n }\n };\n\n useEffect(() => {\n consecutiveFrontsRef.current = consecutiveFronts;\n if (consecutiveFronts > 6 && spinPhaseRef.current < 2) {\n setSpinPhase((s) => s + 1);\n setConsecutiveFronts(0);\n }\n }, [consecutiveFronts]);\n\n useEffect(() => {\n spinPhaseRef.current = spinPhase;\n }, [spinPhase]);\n\n const resetDetector = () => {\n spinPhaseRef.current = 0;\n consecutiveFrontsRef.current = 0;\n setConsecutiveFronts(0);\n setSpinPhase(0);\n };\n\n const retryLoading = async () => {\n if (!globalDetector && !globalLoadingPromise) {\n globalLoadingPromise = loadDependenciesGlobal();\n const success = await globalLoadingPromise;\n if (success && mounted.current) {\n setIsLoaded(true);\n }\n }\n };\n\n return { \n poseDetector, \n isLoaded,\n spinPhase,\n resetDetector,\n retryLoading\n };\n}","/* eslint-disable no-use-before-define */\nimport React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from \"react\";\nimport CameraScanChild from \"./CameraScanChild\";\nimport posthog from \"posthog-js\";\nimport Webcam from \"react-webcam\";\nimport { ScanningComponentProps } from \"../../types/interfaces\";\nimport useTensorFlow from \"../../customHooks/useTensorFlow\";\nimport ParamsContext from \"../../utils/context/paramsContext\";\nimport {\n\tgenerateUuid,\n\tgetCurrentTimeInSeconds,\n\tgetPreferredMediaRecorderTypes,\n\tgetRecordingExtension,\n\tgetRecordingMimeType,\n\tgetSupportedMediaRecorderTypes,\n\thandleScanTimeCapture,\n\trescanSupportCaptureEvent,\n} from \"../../utils/utils\";\nimport speechService from \"../../utils/service/speechService\";\nimport { videoConstraintsExact, videoConstraintsFallback, videoTypes, voiceOverAssetsPath } from \"../../utils/constants\";\n\nlet id: string | null = null;\nlet audioTimeoutId: number | undefined | NodeJS.Timeout;\nlet lastVideoPlayed: {\n\tskipCount: number;\n\tno_of_times_skipped: number;\n\taudioName: string;\n} | null = null;\n\nfunction ScanningComponent({ setIsScanLocked, resetDetector, scanID, setIsVideoUploaded, setScanFailsError, setScanStartTime, setScanUniqueKey, userDetails }: Omit<ScanningComponentProps, \"config\">) {\n\tconst { gender, heightInCm, email, shopDomain } = userDetails;\n\tconst webcamRef = useRef<Webcam | null>(null);\n\tconst mediaRecorderRef = useRef<MediaRecorder | null>(null);\n\tconst recordedFpsRef = useRef<number | null>(null);\n\tconst [recordedChunks, setRecordedChunks] = useState<Blob[]>([]);\n\tconst [loadingCam, setLoadingCam] = useState(true);\n\tconst [recordingStarted, setRecordingStarted] = useState(false);\n\tconst [faceDone, setFaceDone] = useState(false);\n\tconst [mediaRecorderStopped, setMediaRecorderStopped] = useState(true);\n\tconst [isScanning, setIsScanning] = useState(false);\n\tconst captureVideoTimeOutHandle = useRef<number | null | NodeJS.Timeout>(null);\n\tconst [audioSource, setAudioSource] = useState(\"\");\n\tconst [audioSourceList, setAudioSourceList] = useState<string[]>([]);\n\tconst [emptyAudioSource, setEmptyAudioSource] = useState(\"\");\n\tconst [startAgain, setStartAgain] = useState(false);\n\tconst [showRestart, setRestart] = useState(false);\n\tconst [pause, setPause] = useState(false);\n\tconst [events, setEvents] = useState<any>([]);\n\tconst [showPause, setShowPause] = useState(false);\n\tconst allowAudioToPlay = useRef(true);\n\tconst { poseDetector } = useTensorFlow();\n\tconst firstScan = useRef(true);\n\tconst poseStoppedRef = useRef(false);\n\tconst [supportedTypes, setSupportedTypes] = useState<string[]>([]);\n\tconst [webcamKey, setWebcamKey] = useState(0);\n\tconst [currentVideoConstraints, setCurrentVideoConstraints] = useState<MediaTrackConstraints>(videoConstraintsExact);\n\n\tlet counter = 0;\n\n\tconst { setStartGyro, handleFileUpload, setUploadLoading, swan, onScanStart } = useContext(ParamsContext);\n\n\tconst handleShowStreamCamera = () => {\n\t\tposeStoppedRef.current = false;\n\t\tclearTimeout(audioTimeoutId);\n\t\tif (captureVideoTimeOutHandle.current) clearTimeout(captureVideoTimeOutHandle.current);\n\t\tsetScanUniqueKey(generateUuid());\n\t\tsetScanFailsError(\"\");\n\t\tsetUploadLoading?.(false);\n\t\tsetRecordedChunks([]);\n\t\trecordedFpsRef.current = null;\n\t\tsetLoadingCam(true);\n\t\tsetRecordingStarted(false);\n\t\tsetFaceDone(false);\n\t\tsetMediaRecorderStopped(true);\n\t\tsetIsScanning(false);\n\t\tcaptureVideoTimeOutHandle.current = null;\n\t\tsetAudioSource(\"\");\n\t\tsetAudioSourceList([]);\n\t\tsetEmptyAudioSource(\"\");\n\t\tsetStartAgain(!startAgain);\n\t\tsetStartGyro(false);\n\t\tspeechService.stopAudio();\n\t\tsetRestart(false);\n\t\tsetPause(false);\n\t\tcounter = 0;\n\t\tif (mediaRecorderRef.current !== null) {\n\t\t\tmediaRecorderRef.current.stop();\n\t\t}\n\n\t\tevents.forEach((el: any) => {\n\t\t\tif (mediaRecorderRef.current) mediaRecorderRef.current.removeEventListener(\"dataavailable\", el);\n\t\t});\n\n\t\tsetEvents([]);\n\t\tallowAudioToPlay.current = true;\n\t\tsetShowPause(false);\n\t\tsetIsVideoUploaded(false);\n\t\tif (webcamRef.current?.stream) {\n\t\t\tsetLoadingCam(false);\n\t\t}\n\t};\n\n\tconst handleUserMedia = useCallback(() => {\n\t\tsetTimeout(() => {\n\t\t\tsetLoadingCam(false);\n\t\t}, 1000);\n\t}, []);\n\n\tconst handleUserMediaError = useCallback(\n\t\t(error: string | DOMException) => {\n\t\t\tconsole.log(\"camera error\", error);\n\t\t\t// Retry once with relaxed constraints for broader device compatibility.\n\t\t\tif (currentVideoConstraints === videoConstraintsExact) {\n\t\t\t\tsetCurrentVideoConstraints(videoConstraintsFallback);\n\t\t\t\tsetWebcamKey((prev) => prev + 1);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetLoadingCam(false);\n\t\t},\n\t\t[currentVideoConstraints],\n\t);\n\n\tconst handleReScan = useCallback(() => {\n\t\trescanSupportCaptureEvent({\n\t\t\teventName: `${shopDomain}/rescan`,\n\t\t\temail,\n\t\t\tscanID: scanID,\n\t\t\theight: heightInCm,\n\t\t\tgender,\n\t\t\tstatus: false,\n\t\t});\n\t\tallowAudioToPlay.current = false;\n\t\thandleShowStreamCamera();\n\t\tstartSendingVideoFrames();\n\t}, [handleShowStreamCamera, scanID, email]);\n\n\tconst handlePause = useCallback(() => {\n\t\tallowAudioToPlay.current = false;\n\t\tsetPause(true);\n\t\tsetShowPause(false);\n\t\tif (captureVideoTimeOutHandle.current) clearTimeout(captureVideoTimeOutHandle.current);\n\t\tif (mediaRecorderRef.current) {\n\t\t\tmediaRecorderRef.current.pause();\n\t\t}\n\t\tspeechService.stopAudio();\n\t\tswan.poseDetection.disconnect();\n\t\tcounter = 0;\n\t\tif (mediaRecorderRef.current) {\n\t\t\tmediaRecorderRef.current.stop();\n\t\t}\n\t\tevents.forEach((el: any) => {\n\t\t\tif (mediaRecorderRef.current) mediaRecorderRef.current.removeEventListener(\"dataavailable\", el);\n\t\t});\n\t\tsetEvents([]);\n\t\tclearTimeout(audioTimeoutId);\n\t}, [mediaRecorderRef, events, speechService, allowAudioToPlay]);\n\n\t// const supportedTypes = videoTypes.filter((type) => MediaRecorder.isTypeSupported(type));\n\tconst preferredVideoTypes = useMemo(() => getPreferredMediaRecorderTypes(), []);\n\tconst recordingMimeType = getRecordingMimeType(supportedTypes);\n\tconst recordingExtension = getRecordingExtension(recordingMimeType);\n\n\tconst stopRecording = useCallback(async () => {\n\t\tallowAudioToPlay.current = true;\n\t\tawait speechService.playAudio(`${voiceOverAssetsPath}SpotOn.mp3`);\n\t\tsetPause(false);\n\t\tsetShowPause(false);\n\t\tif (captureVideoTimeOutHandle.current) clearTimeout(captureVideoTimeOutHandle.current);\n\t\tsetRecordingStarted(false);\n\t}, [captureVideoTimeOutHandle, speechService]);\n\n\tconst handleSocket = useCallback(async () => {\n\t\ttry {\n\t\t\tid = await swan.poseDetection.connect();\n\n\t\t\tposthog.capture(`${shopDomain}/pose_detection_connected`, {\n\t\t\t\tscanID: scanID,\n\t\t\t\temail,\n\t\t\t\tid,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconsole.log(error, \"while connecting websocket\");\n\t\t}\n\t}, [scanID, shopDomain, email]);\n\n\tconst handleSpinDataAvailable = useCallback(\n\t\t({ data }: BlobEvent) => {\n\t\t\tif (data && data.size > 0 && allowAudioToPlay.current) {\n\t\t\t\tsetRecordedChunks((prev) => prev.concat(data));\n\t\t\t\tif (!poseStoppedRef.current && webcamRef.current) {\n\t\t\t\t\tposeStoppedRef.current = true;\n\t\t\t\t\tposeDetector(() => {\n\t\t\t\t\t\tstopRecording();\n\t\t\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\t\t\teventName: `${shopDomain}/tensorFlow`,\n\t\t\t\t\t\t\tscanID: scanID,\n\t\t\t\t\t\t\temail,\n\t\t\t\t\t\t\tmessage: \"recording stopped by tensorflow \",\n\t\t\t\t\t\t});\n\t\t\t\t\t}, webcamRef);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[stopRecording, handleScanTimeCapture, shopDomain, scanID, email, webcamRef],\n\t);\n\n\tconst playAudio = useCallback(async () => {\n\t\tif (audioSourceList.length > 0 && allowAudioToPlay.current) {\n\t\t\tawait speechService.playAudio(voiceOverAssetsPath + audioSourceList[audioSourceList.length - 1]);\n\t\t\tif (allowAudioToPlay.current) {\n\t\t\t\taudioTimeoutId = setTimeout(playAudio, 2000);\n\t\t\t}\n\t\t}\n\t}, [audioSourceList, allowAudioToPlay]);\n\n\t\tconst handleStartCaptureClick = useCallback(() => {\n\t\tif (mediaRecorderRef && mediaRecorderRef.current) {\n\t\t\tmediaRecorderRef.current.stop();\n\t\t}\n\t\tsetRecordingStarted(true);\n\t\ttry {\n\t\t\tif (webcamRef && webcamRef.current && webcamRef.current.stream) {\n\t\t\t\t// Capture FPS from stream settings\n\t\t\t\tconst videoTrack = webcamRef.current.stream.getVideoTracks()[0];\n\t\t\t\tif (videoTrack) {\n\t\t\t\t\tconst settings = videoTrack.getSettings();\n\t\t\t\t\trecordedFpsRef.current = settings.frameRate || null;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst mediaRecorderOptions: MediaRecorderOptions = {\n\t\t\t\t\tvideoBitsPerSecond: 1_500_000,\n\t\t\t\t};\n\t\t\t\tif (supportedTypes[0]) {\n\t\t\t\t\tmediaRecorderOptions.mimeType = supportedTypes[0];\n\t\t\t\t}\n\t\t\t\tmediaRecorderRef.current = new MediaRecorder(webcamRef.current.stream, mediaRecorderOptions);\n\t\t\t\tmediaRecorderRef.current.addEventListener(\"dataavailable\", handleSpinDataAvailable);\n\n\t\t\t\tsetEvents([...events, handleSpinDataAvailable]);\n\t\t\t\tmediaRecorderRef.current.start(1000);\n\t\t\t\tsetMediaRecorderStopped(false);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(\"error while using media recorder\", e);\n\t\t}\n\t}, [webcamRef, supportedTypes, handleSpinDataAvailable, events]);\n\n\tconst postPoseProcess = useCallback(async () => {\n\t\tif (captureVideoTimeOutHandle.current) {\n\t\t\tclearTimeout(captureVideoTimeOutHandle.current);\n\t\t}\n\t\thandleStartCaptureClick();\n\t\tif (allowAudioToPlay.current) {\n\t\t\tcaptureVideoTimeOutHandle.current = setTimeout(async () => {\n\t\t\t\tif (allowAudioToPlay.current) {\n\t\t\t\t\tawait speechService.playAudio(`${voiceOverAssetsPath}SpotOn.mp3`);\n\t\t\t\t\tsetRecordingStarted(false);\n\t\t\t\t}\n\t\t\t}, 15000);\n\t\t}\n\t\tsetFaceDone(true);\n\t\tif (allowAudioToPlay.current) {\n\t\t\tawait speechService.playAudio(`${voiceOverAssetsPath}Spin.mp3`);\n\t\t}\n\t}, [handleStartCaptureClick, allowAudioToPlay, speechService]);\n\n\tconst handleDataAvailable = useCallback(\n\t\t({ data }: BlobEvent) => {\n\t\t\tif (data.size > 0 && swan.poseDetection.connected()) {\n\t\t\t\tswan.poseDetection.poseStatus(async (data:any) => {\n\t\t\t\t\tif (data && data.audio && data.audio.length > 0) {\n\t\t\t\t\t\tconst audio = document.querySelector(\"#audioElement\") as HTMLAudioElement | null;\n\t\t\t\t\t\tif (data.status === true && data.sid === id) {\n\t\t\t\t\t\t\tif (counter < 2) {\n\t\t\t\t\t\t\t\tif (counter === 0 && audio?.paused) {\n\t\t\t\t\t\t\t\t\tawait speechService.playAudio(voiceOverAssetsPath + data.audio);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcounter += 1;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tsetEmptyAudioSource(data.audio);\n\t\t\t\t\t\t\t\tclearTimeout(audioTimeoutId);\n\t\t\t\t\t\t\t\tswan.poseDetection.disconnect();\n\t\t\t\t\t\t\t\tsetTimeout(postPoseProcess, 1000);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcounter = 0;\n\t\t\t\t\t\t\tif (audio?.paused && (!lastVideoPlayed || lastVideoPlayed?.audioName !== data.audio)) {\n\t\t\t\t\t\t\t\tlastVideoPlayed = {\n\t\t\t\t\t\t\t\t\tskipCount: 2,\n\t\t\t\t\t\t\t\t\tno_of_times_skipped: 0,\n\t\t\t\t\t\t\t\t\taudioName: data.audio,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\tspeechService.playAudio(voiceOverAssetsPath + data.audio);\n\t\t\t\t\t\t\t} else if (lastVideoPlayed?.audioName === data.audio && audio?.paused) {\n\t\t\t\t\t\t\t\tif (lastVideoPlayed && lastVideoPlayed.no_of_times_skipped >= lastVideoPlayed.skipCount) {\n\t\t\t\t\t\t\t\t\tlastVideoPlayed.no_of_times_skipped = 0;\n\t\t\t\t\t\t\t\t\tspeechService.playAudio(voiceOverAssetsPath + data.audio);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (lastVideoPlayed) lastVideoPlayed.no_of_times_skipped += 1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif (webcamRef?.current && webcamRef.current.getScreenshot() !== null) {\n\t\t\t\t\tswan.poseDetection.videoEmit({\n\t\t\t\t\t\timage: webcamRef.current.getScreenshot() || \"\",\n\t\t\t\t\t\tscanId: scanID,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[webcamRef, scanID, swan, id, counter, postPoseProcess, speechService],\n\t);\n\n\tconst startSendingVideoFrames = useCallback(async () => {\n\t\tsetIsScanning(true);\n\t\tsetStartGyro(true);\n\t\tonScanStart?.();\n\t\tif (firstScan.current) {\n\t\t\tfirstScan.current = false;\n\t\t\thandleScanTimeCapture({\n\t\t\t\teventName: \"scan started\",\n\t\t\t\tscanID: scanID,\n\t\t\t\tstatus: \"success\",\n\t\t\t\temail,\n\t\t\t});\n\t\t}\n\t\tsetScanStartTime(getCurrentTimeInSeconds());\n\t\tsetLoadingCam(true);\n\t\tif (allowAudioToPlay.current) {\n\t\t\tawait speechService.playAudio(`${voiceOverAssetsPath}StartScan.mp3`);\n\t\t}\n\t\tif (allowAudioToPlay.current) {\n\t\t\tawait speechService.playAudio(`${voiceOverAssetsPath}LiftArmsAndHoldAtHip.mp3`);\n\t\t}\n\t\tif (allowAudioToPlay.current) {\n\t\t\tsetIsScanning(false);\n\t\t\tsetRecordingStarted(true);\n\t\t\tsetRestart(true);\n\t\t\tsetShowPause(true);\n\t\t\thandleUserMedia();\n\t\t}\n\t\ttry {\n\t\t\tif (webcamRef && webcamRef.current && webcamRef.current.stream && allowAudioToPlay.current) {\n\t\t\t\t// Capture FPS from stream settings\n\t\t\t\tconst videoTrack = webcamRef.current.stream.getVideoTracks()[0];\n\t\t\t\tif (videoTrack) {\n\t\t\t\t\tconst settings = videoTrack.getSettings();\n\t\t\t\t\trecordedFpsRef.current = settings.frameRate || null;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst mediaRecorderOptions: MediaRecorderOptions = {\n\t\t\t\t\tvideoBitsPerSecond: 1_500_000,\n\t\t\t\t};\n\t\t\t\tif (supportedTypes[0]) {\n\t\t\t\t\tmediaRecorderOptions.mimeType = supportedTypes[0];\n\t\t\t\t}\n\t\t\t\tif (allowAudioToPlay.current) {\n\t\t\t\t\tmediaRecorderRef.current = new MediaRecorder(webcamRef.current.stream, mediaRecorderOptions);\n\t\t\t\t}\n\t\t\t\tif (allowAudioToPlay.current && mediaRecorderRef.current) {\n\t\t\t\t\tmediaRecorderRef.current.addEventListener(\"dataavailable\", handleDataAvailable);\n\t\t\t\t}\n\n\t\t\t\tsetEvents([...events, handleDataAvailable]);\n\t\t\t\tif (mediaRecorderRef.current) mediaRecorderRef.current.start(1000);\n\t\t\t\tsetMediaRecorderStopped(false);\n\t\t\t\tif (allowAudioToPlay.current) {\n\t\t\t\t\taudioTimeoutId = setTimeout(playAudio, 2000);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tconsole.log(\"error ----------\", err);\n\t\t}\n\t}, [webcamRef, supportedTypes, handleDataAvailable, events, playAudio, allowAudioToPlay, onScanStart]);\n\n\tuseEffect(() => {\n\t\tif (shopDomain) {\n\t\t\tsetIsScanLocked(true);\n\t\t\thandleSocket();\n\t\t}\n\t\treturn () => {\n\t\t\tif (id) {\n\t\t\t\tswan.poseDetection.disconnect();\n\t\t\t\tposthog.capture(`${shopDomain}/pose_detection_disconnected`, {\n\t\t\t\t\tscanID: scanID,\n\t\t\t\t\temail,\n\t\t\t\t\tid,\n\t\t\t\t});\n\t\t\t}\n\t\t\tevents.forEach((el: any) => {\n\t\t\t\tmediaRecorderRef?.current?.removeEventListener(\"dataavailable\", el);\n\t\t\t});\n\t\t};\n\t}, [startAgain, shopDomain]);\n\tuseEffect(() => {\n\t\taudioSourceList.push(audioSource);\n\t}, [audioSource]);\n\n\tuseEffect(() => {\n\t\tsetAudioSourceList([]);\n\t}, [emptyAudioSource]);\n\tuseEffect(() => {\n\t\tconst bypassChecksToBackup = recordedChunks.length && recordedChunks.length > 0;\n\t\tif (!mediaRecorderStopped && bypassChecksToBackup && !recordingStarted && allowAudioToPlay.current && !pause) {\n\t\t\tif (mediaRecorderRef && mediaRecorderRef.current) {\n\t\t\t\tif (!recordingStarted) {\n\t\t\t\t\tmediaRecorderRef.current.stop();\n\t\t\t\t\tsetMediaRecorderStopped(true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [mediaRecorderStopped, recordingStarted, recordedChunks, pause]);\n\n\tuseEffect(() => {\n\t\tconst bypassChecksToBackup = recordedChunks.length && recordedChunks.length > 0;\n\t\tif (!mediaRecorderStopped && bypassChecksToBackup && !recordingStarted) {\n\t\t\tif (mediaRecorderRef && mediaRecorderRef.current && allowAudioToPlay.current && !pause) {\n\t\t\t\tif (!recordingStarted) {\n\t\t\t\t\tconst videoFile = new File(recordedChunks, `${scanID}.${recordingExtension}`, {\n\t\t\t\t\t\ttype: recordingMimeType,\n\t\t\t\t\t});\n\t\t\t\t\tsetUploadLoading?.(true);\n\t\t\t\t\tsetScanFailsError(\"\");\n\t\t\t\t\t// Pass FPS captured at recording time\n\t\t\t\t\thandleFileUpload?.(videoFile, recordedFpsRef.current);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"No video found to upload.\");\n\t\t}\n\t}, [mediaRecorderStopped, recordingStarted, recordedChunks, pause, mediaRecorderRef, allowAudioToPlay]);\n\tuseEffect(() => {\n\t\tconst supported = getSupportedMediaRecorderTypes(preferredVideoTypes, videoTypes);\n\t\tsetSupportedTypes(supported);\n\t}, [preferredVideoTypes]);\n\tuseEffect(() => {\n\t\thandleShowStreamCamera();\n\t}, []);\n\n\treturn (\n\t\t<CameraScanChild\n\t\t\tresetDetector={resetDetector}\n\t\t\thandleShowStreamCamera={handleShowStreamCamera}\n\t\t\tloadingCam={loadingCam}\n\t\t\thandlePause={handlePause}\n\t\t\tshowRestart={showRestart}\n\t\t\tpause={pause}\n\t\t\thandleReScan={handleReScan}\n\t\t\trecordingStarted={recordingStarted}\n\t\t\tisScanning={isScanning}\n\t\t\tstartSendingVideoFrames={startSendingVideoFrames}\n\t\t\tfaceDone={faceDone}\n\t\t\tstopRecording={stopRecording}\n\t\t\tshowPause={showPause}\n\t\t\twebcamRef={webcamRef}\n\t\t\thandleUserMedia={handleUserMedia}\n\t\t\thandleUserMediaError={handleUserMediaError}\n\t\t\tvideoConstraints={currentVideoConstraints}\n\t\t\twebcamKey={webcamKey}\n\t\t\t/>\n\t);\n}\n\nexport default React.memo(ScanningComponent);\n","/* eslint-disable no-use-before-define */\n\nimport { useEffect, useState, useRef } from \"react\";\nimport { IOSDeviceOrientationEvent } from \"../../customHooks/useGyroSensor\";\nimport LevelScreen from \"./LevelScreen\";\nimport ScanningComponent from \"./ScanningComponent\";\nimport { AngleDetectorProps } from \"../../types/interfaces\";\n\nexport default function AngleDetector({\n scanID,\n userDetails,\n setIsVideoUploaded,\n setScanFailsError,\n setScanStartTime,\n setScanUniqueKey,\n}: Omit<AngleDetectorProps, \"config\">) {\n const [angle, setAngle] = useState(90);\n const [calibrationOffset, setCalibrationOffset] = useState(0);\n const [countdown, setCountdown] = useState<number | null>(null);\n const [isScanning, setIsScanning] = useState(false);\n const [stabilityScore, setStabilityScore] = useState(0);\n const lastAnglesRef = useRef<number[]>([]);\n const [isScanLocked, setIsScanLocked] = useState(false);\n const calibratedAngle = angle - calibrationOffset;\n const isInTargetRange = calibratedAngle >= 80 && calibratedAngle <= 95;\n\n const resetDetector = () => {\n setAngle(90);\n setCalibrationOffset(0);\n setCountdown(null);\n setIsScanning(false);\n setStabilityScore(0);\n setIsScanLocked(false);\n lastAnglesRef.current = [];\n };\n\n useEffect(() => {\n if (typeof window !== \"undefined\" && window.DeviceOrientationEvent) {\n const handleOrientation = (event: DeviceOrientationEvent) => {\n if (event.beta !== null) {\n let newAngle = Math.abs(event.beta);\n if (event.gamma !== null) {\n newAngle *= Math.cos((event.gamma * Math.PI) / 180);\n }\n newAngle = Math.max(0, Math.min(180, newAngle));\n setAngle(newAngle);\n }\n };\n\n const requestPermission = async () => {\n const DeviceOrientation =\n DeviceOrientationEvent as unknown as IOSDeviceOrientationEvent;\n\n if (\n DeviceOrientation &&\n typeof DeviceOrientation.requestPermission === \"function\"\n ) {\n try {\n const permission = await DeviceOrientation.requestPermission();\n if (permission === \"granted\") {\n // wrappedHandler = timeout(handleOrientation, 2000);\n window.addEventListener(\"deviceorientation\", handleOrientation);\n }\n } catch (e) {\n console.error(\"Permission error\", e);\n }\n } else {\n // wrappedHandler = handleOrientation;\n window.addEventListener(\"deviceorientation\", handleOrientation);\n }\n\n return () => {\n if (handleOrientation) {\n window.removeEventListener(\"deviceorientation\", handleOrientation);\n }\n };\n };\n\n document.addEventListener(\"click\", requestPermission, { once: true });\n }\n }, []);\n\n useEffect(() => {\n lastAnglesRef.current = [\n ...lastAnglesRef.current.slice(-4),\n calibratedAngle,\n ];\n\n if (lastAnglesRef.current.length >= 5) {\n const variation =\n Math.max(...lastAnglesRef.current) - Math.min(...lastAnglesRef.current);\n if (isInTargetRange && variation < 2) {\n setStabilityScore((prev) => Math.min(100, prev + 10));\n } else {\n setStabilityScore((prev) => Math.max(0, prev - 20));\n }\n }\n\n if (!isInTargetRange && (countdown !== null || isScanning)) {\n resetCountdown();\n }\n }, [calibratedAngle, isInTargetRange, countdown, isScanning]);\n\n\tuseEffect(() => {\n\t\tif (stabilityScore >= 100 && countdown === null && !isScanning ) {\n\t\t\tstartCountdown();\n\t\t}\n\t\tif (stabilityScore < 50 && countdown !== null) {\n\t\t\tresetCountdown();\n\t\t}\n\t}, [stabilityScore, countdown, isScanning]);\n\n const startCountdown = () => {\n setCountdown(3);\n const timer = setInterval(() => {\n setCountdown((prev) => {\n if (prev === null || prev <= 1) {\n clearInterval(timer);\n setIsScanning(true);\n return null;\n }\n return prev - 1;\n });\n }, 1000);\n };\n\n const resetCountdown = () => {\n setCountdown(null);\n if (!isScanLocked) {\n setIsScanning(false);\n }\n };\n\n\n return (\n <LevelScreen\n angle={calibratedAngle}\n countdown={countdown}\n isScanning={isScanning}\n isInTargetRange={isInTargetRange}\n stabilityScore={stabilityScore}\n >\n {isScanning && (\n <ScanningComponent\n setIsScanLocked={setIsScanLocked}\n resetDetector={resetDetector}\n scanID={scanID}\n userDetails={userDetails}\n setIsVideoUploaded={setIsVideoUploaded}\n setScanFailsError={setScanFailsError}\n setScanStartTime={setScanStartTime}\n setScanUniqueKey={setScanUniqueKey}\n />\n )}\n </LevelScreen>\n );\n}\n","import { useContext } from \"react\";\nimport {Dialog} from \"@mui/material\";\nimport { getBrowserName } from \"../utils/utils\";\nimport { LanguageContext } from \"../utils/context/languageContext\";\nimport { LanguageKeys } from \"../utils/languageKeys\";\nimport { Config } from \"../types/interfaces\";\n\nfunction Modal({ message, config }: { message?: string; config?: Config }) {\n const { translate } = useContext(LanguageContext) || {};\n\n\n\n return (\n <Dialog open className=\"confirm-modal\">\n <div className=\"modal-main\">\n <div className=\"text-center\">\n {message ? (\n <>\n <h2\n style={{\n fontFamily:\n config?.style?.heading?.headingFontFamily ||\n \"SeriouslyNostalgic Fn\",\n fontSize: config?.style?.heading?.headingFontSize || \"32px\",\n color: config?.style?.heading?.headingColor || \"#000\",\n fontWeight:\n config?.style?.heading?.headingFontWeight || \"normal\",\n }}\n >\n {translate?.(LanguageKeys.cameraAlreadyInUse)}\n </h2>\n <p\n className=\"mt-[0.5rem] text-sm\"\n style={{\n fontFamily:\n config?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n fontSize: config?.style?.base?.baseFontSize || \"16px\",\n color: config?.style?.base?.baseTextColor || \"#000\",\n }}\n >\n {translate?.(LanguageKeys.tryClosingBrowser)}\n </p>\n </>\n ) : (\n <>\n <h2\n style={{\n fontFamily:\n config?.style?.heading?.headingFontFamily ||\n \"SeriouslyNostalgic Fn\",\n fontSize: config?.style?.heading?.headingFontSize || \"32px\",\n color: config?.style?.heading?.headingColor || \"#000\",\n fontWeight:\n config?.style?.heading?.headingFontWeight || \"normal\",\n }}\n >\n {translate?.(LanguageKeys.checkCameraSettings)}\n </h2>\n <p\n className=\"mt-[0.5rem] text-sm\"\n style={{\n fontFamily:\n config?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n fontSize: config?.style?.base?.baseFontSize || \"16px\",\n color: config?.style?.base?.baseTextColor || \"#000\",\n }}\n >{`${translate?.(\n LanguageKeys.setting\n )} > ${getBrowserName()} > ${translate?.(\n LanguageKeys.enableCameraPermissions\n )}`}</p>\n </>\n )}\n </div>\n </div>\n </Dialog>\n );\n}\n\nexport default Modal;\n","import { useEffect, useState, useRef, useCallback, Dispatch, SetStateAction } from \"react\";\nimport Webcam from \"react-webcam\";\nimport Modal from \"../Modal\";\nimport LoadingScreen from \"../LoadingScreen\";\nimport { checkCameraPermission } from \"../../utils/utils\";\nimport { videoConstraints } from \"../../utils/constants\";\n\n\nfunction CameraPermission({ setShowDrawer, config,loader }: { setShowDrawer?: Dispatch<SetStateAction<boolean>>; config?: any,loader?:string }) {\n\tconst [showDeniedModal, setShowDeniedModal] = useState({\n\t\tdisabled: false,\n\t\tmessage: \"\",\n\t});\n\tconst [loading, setLoading] = useState(true);\n\tconst webcamRef = useRef(null);\n\n\tconst handleCameraPermission = useCallback(async () => {\n\t\tconst permission = await checkCameraPermission();\n\t\tsetShowDeniedModal(permission);\n\t\tsetLoading(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\thandleCameraPermission();\n\t}, []);\n\n\tif (loading) {\n\t\treturn <LoadingScreen url={loader} loaderType=\"black\" />\n\t}\n\n\tif (showDeniedModal?.disabled) {\n\t\treturn <Modal config={config} message={showDeniedModal?.message} />;\n\t}\n\treturn (\n\t\t<Webcam\n\t\t\taudio={false}\n\t\t\tref={webcamRef}\n\t\t\tscreenshotQuality={1}\n\t\t\tvideoConstraints={videoConstraints}\n\t\t\tmirrored\n\t\t\tonUserMedia={() => setShowDrawer?.(true)}\n\t\t\tscreenshotFormat=\"image/jpeg\"\n\t\t\tstyle={{\n\t\t\t\tposition: \"relative\",\n\t\t\t\ttop: 0,\n\t\t\t\tbottom: 0,\n\t\t\t\tzIndex: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100%\",\n\t\t\t\tobjectFit: \"cover\",\n\t\t\t}}\n\t\t/>\n\t);\n}\n\nexport default CameraPermission;\n","\nimport React, { useEffect, useRef } from \"react\";\nimport videojs from \"video.js\";\nimport type Player from \"video.js/dist/types/player\";\nimport { videoPoster } from \"../../utils/constants\";\n\nfunction VideoPlayer({ link, onReady, wrapperClassName = \"[&_video]:rounded-t-[20px] w-full h-full\" }: { link?: string; wrapperClassName?: string; onReady?: (args: Player) => void }) {\n\tconst videoReference = useRef<HTMLVideoElement | null>(null);\n\tconst playerReference = useRef<Player | null>(null);\n\n\tlet videoJsOptions: any = {\n\t\tautoplay: true,\n\t\tcontrols: false,\n\t\tresponsive: true,\n\t\tfluid: true,\n\t\tmuted: true,\n\t\tnavigationUI: \"hide\",\n\t\tpreload: \"metadata\",\n\t\tposter: videoPoster,\n\t};\n\n\tuseEffect(() => {\n\t\tif (!playerReference.current && link && videoReference?.current) {\n\t\t\tconst player = videojs(videoReference.current, {\n\t\t\t\t...videoJsOptions,\n\t\t\t});\n\t\t\tplayer.ready(() => {\n\t\t\t\tplayerReference.current = player;\n\n\t\t\t\tconst updatedOptions = {\n\t\t\t\t\t...videoJsOptions,\n\t\t\t\t\tsources: [{ src: link, type: \"application/x-mpegURL\" }],\n\t\t\t\t};\n\n\t\t\t\tplayer.autoplay(updatedOptions.autoplay);\n\t\t\t\tplayer.src(updatedOptions.sources);\n\n\t\t\t\tonReady?.(player);\n\t\t\t});\n\t\t}\n\t}, [link, videoReference]);\n\n\tuseEffect(() => {\n\t\tconst player = playerReference.current;\n\t\treturn () => {\n\t\t\tif (player && !player.isDisposed()) {\n\t\t\t\tplayer.dispose();\n\t\t\t\tplayerReference.current = null;\n\t\t\t}\n\t\t};\n\t}, [playerReference]);\n\n\treturn (\n\t\t<div className={wrapperClassName}>\n\t\t\t<video ref={videoReference} muted className=\"video-js\" playsInline onDrag={(e) => e.preventDefault()} />\n\t\t</div>\n\t);\n}\nexport default VideoPlayer;\n","import { useContext, useState } from \"react\";\nimport {Dialog} from \"@mui/material\";\nimport { LanguageContext } from \"../../utils/context/languageContext\";\nimport Header from \"../Header\";\nimport VideoPlayer from \"./VideoPlayer\";\nimport { ScanErrorMessageProps } from \"../../types/interfaces\";\nimport { generateUuid, handleErrorMessage } from \"../../utils/utils\";\nimport { GENDER, VIDEO_POSTER_GENDER_BASED } from \"../../utils/constants\";\nimport SpecificButton from \"../../atoms/specificButton/SpecificButton\";\nimport { LanguageKeys } from \"../../utils/languageKeys\";\nimport { X } from \"lucide-react\";\nimport { useConfig } from \"../../utils/context/configContext\";\n\nfunction ScanErrorMessage({ scanFailsError, onNext, gender, setScanUniqueKey, setIsVideoUploaded }: ScanErrorMessageProps) {\n\tconst { translate } = useContext(LanguageContext) || {};\n\tconst resolvedConfig = useConfig();\n\tconst [showModal, setShowModal] = useState(false);\n\n\tconst handleBtnClick = () => {\n\t\tif (onNext) {\n\t\t\tonNext?.();\n\t\t} else {\n\t\t\tsetScanUniqueKey?.(generateUuid());\n\t\t}\n\t\tsetIsVideoUploaded?.(false);\n\t};\n\n\tconst handleShowModal = () => {\n\t\tsetShowModal(!showModal);\n\t};\n\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"flex flex-col h-full max-w-[28rem] mx-auto w-full rounded-t-[20px] overflow-y-auto\" style={{ background: resolvedConfig?.style?.base?.backgroundColor }}>\n\t\t\t\t<div className=\"w-full max-w-[28rem] mx-auto pt-[1rem] px-[1rem]\">\n\t\t\t\t\t<Header noTitle />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"flex-1\">\n\t\t\t\t\t{scanFailsError && (\n\t\t\t\t\t\t<div className=\"px-[1rem]\">\n\t\t\t\t\t\t\t<h2\n\t\t\t\t\t\t\t\tclassName=\"text-center\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tfontFamily: resolvedConfig?.style?.heading?.headingFontFamily || \"SeriouslyNostalgic Fn\",\n\t\t\t\t\t\t\t\t\tfontSize: resolvedConfig?.style?.heading?.headingFontSize || \"32px\",\n\t\t\t\t\t\t\t\t\tcolor: resolvedConfig?.style?.heading?.headingColor || \"#000\",\n\t\t\t\t\t\t\t\t\tfontWeight: resolvedConfig?.style?.heading?.headingFontWeight || \"normal\",\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{translate?.(LanguageKeys.issueWithScan)}\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tfontFamily: resolvedConfig?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n\t\t\t\t\t\t\t\t\tfontSize: resolvedConfig?.style?.base?.baseFontSize || \"16px\",\n\t\t\t\t\t\t\t\t\tcolor: resolvedConfig?.style?.base?.baseTextColor || \"#1E1E1E\",\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{translate?.(LanguageKeys.reason)}\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tfontFamily: resolvedConfig?.style?.base?.baseFontFamily || \"Inter, sans-serif\",\n\t\t\t\t\t\t\t\t\tfontSize: resolvedConfig?.style?.base?.baseFontSize || \"16px\",\n\t\t\t\t\t\t\t\t\tcolor: resolvedConfig?.style?.base?.baseTextColor || \"#1E1E1E\",\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{handleErrorMessage(scanFailsError)}\n\t\t\t\t\t\t\t</p>\n\n\t\t\t\t\t\t\t<img className=\"my-[0.5rem] aspect-[2/1.4] w-full object-cover\" onClick={handleShowModal} src={VIDEO_POSTER_GENDER_BASED[gender]} alt=\"icon\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{scanFailsError && (\n\t\t\t\t\t<div className=\"p-[1rem] flex gap-[0.5rem]\">\n\t\t\t\t\t\t<SpecificButton disabled={false} buttonText={translate?.(LanguageKeys.scanAgain)} className=\"!shadow-none\" buttonFunc={handleBtnClick} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{showModal && (\n\t\t\t\t<Dialog className=\"w-screen h-screen video-modal\" onClose={handleShowModal} open={showModal}>\n\t\t\t\t\t<div className=\"flex justifyEnd \">\n\t\t\t\t\t\t<span className=\"closeBtn\" onClick={handleShowModal}>\n\t\t\t\t\t\t\t<X className=\"absolute right-[8px] top-[8px] text-white z-[9]\" />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"aspect-video object-cover rounded-[20px] \">\n\t\t\t\t\t\t<VideoPlayer link={gender ? GENDER[gender].PRE_LINK : GENDER.male.PRE_LINK} wrapperClassName=\"w-screen h-screen fixed top-[0] left-[0]\" />\n\t\t\t\t\t</div>\n\t\t\t\t</Dialog>\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nexport default ScanErrorMessage;\n","import { useCallback, useContext, useEffect, useState } from \"react\";\nimport {Box,Drawer} from \"@mui/material\";\nimport { posthog } from \"posthog-js\";\nimport Header from \"./Header\";\nimport CameraPermission from \"./bodyScan/CameraPermission\";\nimport { SignUpProps } from \"../types/interfaces\";\nimport { CLOTHING_BANNER_SCAN, CLOTHING_CUSTOM_FIT_SCAN, CLOTHING_CUSTOM_SCAN, maleMeasurementProgress, measurementProgress } from \"../utils/constants\";\nimport { GenderType } from \"../utils/enums\";\nimport SpecificButton from \"../atoms/specificButton/SpecificButton\";\nimport { LanguageContext } from \"../utils/context/languageContext\";\nimport { LanguageKeys } from \"../utils/languageKeys\";\n\nfunction SignUp({\n\tscanId,\n\tuserDetails,\n\tconfig,\n\tisVideoUploadedCorrect,\n\tisMeasurementAvailable,\n\tonComplete,\n\tisSuccess,\n\tonCustomScanSuccess,\n\tswan,\n}: SignUpProps) {\n\tconst { gender, shopDomain, heightInCm, deviceFocalLength, userName, email, scanType } = userDetails || {};\n\tconst isCustom = [CLOTHING_CUSTOM_SCAN, CLOTHING_BANNER_SCAN, CLOTHING_CUSTOM_FIT_SCAN].includes(scanType ?? \"\");\n\tconst [showDrawer, setShowDrawer] = useState(true);\n\tconst handlePostHogEvent = () => {\n\t\tposthog.capture(shopDomain??\"\", {\n\t\t\tscanID: scanId,\n\t\t\temail: email,\n\t\t\theight: heightInCm,\n\t\t\tfocalLength: deviceFocalLength,\n\t\t\tclothesFit: \"0\",\n\t\t\tgender: gender,\n\t\t});\n\t};\n\n\tconst handleSignUp = useCallback(async () => {\n\t\ttry {\n\t\t\tif (isCustom) {\n\t\t\t\tawait swan?.auth.addUser({\n\t\t\t\t\tscanId,\n\t\t\t\t\temail,\n\t\t\t\t\tname: userName,\n\t\t\t\t\tgender,\n\t\t\t\t\theight: heightInCm,\n\t\t\t\t});\n\t\t\t\tonCustomScanSuccess?.();\n\t\t\t}\n\t\t\thandlePostHogEvent();\n\t\t} catch (error) {\n\t\t\tconsole.log(error);\n\t\t}\n\t}, [isCustom]);\n\n\tconst { translate } = useContext(LanguageContext) || {};\n\n\tuseEffect(() => {\n\t\tif (isVideoUploadedCorrect || isMeasurementAvailable) {\n\t\t\thandleSignUp();\n\t\t}\n\t}, [isVideoUploadedCorrect, isMeasurementAvailable]);\n\n\tconst showNextButton = isSuccess || isVideoUploadedCorrect || isMeasurementAvailable;\n\n\treturn (\n\t\t<Box className=\"flex h-full w-full flex-col \">\n\t\t\t<div className=\"h-full w-full flex-col items-center justify-center flex\">\n\t\t\t\t<CameraPermission loader={config?.loader} setShowDrawer={setShowDrawer} />\n\t\t\t\t<Drawer\n\t\t\t\t\topen={showDrawer}\n\t\t\t\t\tonClose={(_, reason) => {\n\t\t\t\t\t\tif (reason === \"backdropClick\") {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"camera-drawer\"\n\t\t\t\t\tanchor=\"bottom\"\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"max-w-[28rem] mx-auto w-full h-full flex text-center flex-col justify-between items-center bg-primary rounded-t-[30px] p-[1rem]\"\n\t\t\t\t\t\tstyle={{ background: config?.style?.base?.backgroundColor }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className=\"w-full h-full flex flex-col\">\n\t\t\t\t\t\t\t<Header title={translate?.(LanguageKeys.measurementsBeingTaken)} />\n\t\t\t\t\t\t\t<div className=\"flex items-center justify-center flex-1\">\n\t\t\t\t\t\t\t\t<video preload=\"auto\" className=\"max-h-[calc(100vh-450px)] mx-auto w-full object-contain border-none\" muted loop autoPlay playsInline>\n\t\t\t\t\t\t\t\t\t<source src={gender === GenderType.Male ? maleMeasurementProgress : measurementProgress} type=\"video/mp4\" />\n\t\t\t\t\t\t\t\t</video>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t{showNextButton && <SpecificButton className=\"!w-[180px] mx-auto\" buttonText={translate?.(LanguageKeys.next)} buttonFunc={()=>{onComplete?.()\n\t\t\t\t\t\t\t}} />}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</Drawer>\n\t\t\t</div>\n\t\t</Box>\n\t);\n}\nexport default SignUp;\n","\"use client\";\nimport { useContext } from \"react\";\nimport AngleDetector from \"./AngleDetector\";\nimport CameraPermission from \"./CameraPermission\";\nimport Modal from \"../Modal\";\nimport { Drawer } from \"@mui/material\";\nimport ScanErrorMessage from \"./ScanErrorMessage\";\nimport LoadingScreen from \"../LoadingScreen\";\nimport SignUp from \"../Signup\";\nimport { useConfig } from \"../../utils/context/configContext\";\nimport ParamsContext from \"../../utils/context/paramsContext\";\n\nexport const BodyScanSteps = () => {\n\tconst {\n\t\tuserDetails,\n\t\tonRetry,\n\t\tisError,\n\t\tisSuccess,\n\t\tgender,\n\t\tscanUniqueKey,\n\t\tscanFailsError,\n\t\tsetScanUniqueKey,\n\t\tsetIsVideoUploaded,\n\t\tisMeasurementAvailable,\n\t\tisVideoUploadedCorrect,\n\t\tloading,\n\t\tshowDeniedModal,\n\t\tuploadLoading,\n\t\tsetScanFailsError,\n\t\tsetScanStartTime,\n\t\thandleShowStreamCamera,\n\t\tonCustomScanSuccess,\n\t\tswan,\n\t\tonComplete,\n\t} = useContext(ParamsContext);\n\tconst resolvedConfig = useConfig();\n\n\tif (isError) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<CameraPermission />\n\t\t\t\t<Drawer\n\t\t\t\t\tanchor=\"bottom\"\n\t\t\t\t\topen={true}\n\t\t\t\t\tclassName=\"camera-drawer\"\n\t\t\t\t\tonClose={(event, reason) => {\n\t\t\t\t\t\tif (reason === \"backdropClick\") {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ScanErrorMessage scanFailsError onNext={onRetry} gender={gender} />\n\t\t\t\t</Drawer>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif (isSuccess) {\n\t\treturn <SignUp isSuccess onComplete={onComplete} />;\n\t}\n\n\tif (loading) {\n\t\treturn (\n\t\t\t<div className=\"flex top-0 !mt-0 left-0 z-[999] absolute justify-center items-center w-full h-full\" style={{ background: resolvedConfig?.style?.base?.backgroundColor }}>\n\t\t\t\t<LoadingScreen url={resolvedConfig?.loader} loaderType=\"black\" />\n\t\t\t</div>\n\t\t);\n\t}\n\tif (showDeniedModal.disabled) {\n\t\treturn <Modal />;\n\t}\n\n\tif (!uploadLoading && !scanFailsError && !isMeasurementAvailable && !isVideoUploadedCorrect) {\n\t\treturn (\n\t\t\t<AngleDetector\n\t\t\t\tscanID={scanUniqueKey}\n\t\t\t\tuserDetails={userDetails}\n\t\t\t\tsetIsVideoUploaded={setIsVideoUploaded}\n\t\t\t\tsetScanFailsError={setScanFailsError}\n\t\t\t\tsetScanStartTime={setScanStartTime}\n\t\t\t\tsetScanUniqueKey={setScanUniqueKey}\n\t\t\t/>\n\t\t);\n\t}\n\tif ((uploadLoading || isMeasurementAvailable || isVideoUploadedCorrect) && !scanFailsError) {\n\t\treturn (\n\t\t\t<SignUp\n\t\t\t\tscanId={scanUniqueKey}\n\t\t\t\tisMeasurementAvailable={isMeasurementAvailable}\n\t\t\t\tuserDetails={userDetails}\n\t\t\t\tisVideoUploadedCorrect={isVideoUploadedCorrect}\n\t\t\t\tonCustomScanSuccess={onCustomScanSuccess}\n\t\t\t\tswan={swan}\n\t\t\t\tonComplete={onComplete}\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<CameraPermission />\n\t\t\t<Drawer\n\t\t\t\tanchor=\"bottom\"\n\t\t\t\topen\n\t\t\t\tclassName=\"camera-drawer\"\n\t\t\t\tonClose={(event, reason) => {\n\t\t\t\t\tif (reason === \"backdropClick\") {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<ScanErrorMessage\n\t\t\t\t\tscanFailsError={scanFailsError}\n\t\t\t\t\tonNext={() => {\n\t\t\t\t\t\tonRetry?.();\n\t\t\t\t\t\thandleShowStreamCamera();\n\t\t\t\t\t}}\n\t\t\t\t\tsetScanUniqueKey={setScanUniqueKey}\n\t\t\t\t\tgender={gender}\n\t\t\t\t\tsetIsVideoUploaded={setIsVideoUploaded}\n\t\t\t\t/>\n\t\t\t</Drawer>\n\t\t</>\n\t);\n};\n","\"use client\";\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport useGyroSensor from \"../../customHooks/useGyroSensor\";\nimport usePosthogPageview from \"../../customHooks/usePosthogPageview\";\nimport {\n\tcheckCameraPermission,\n\tcreateObjectMetadataArray,\n\tgenerateUuid,\n\tgetCurrentTimeInSeconds,\n\tgetVideoFPS,\n\thandleErrorMessage,\n\thandleScanTimeCapture,\n\thandleWebSocketCapture,\n} from \"../../utils/utils\";\nimport LanguageContextProvider from \"../../utils/context/languageContext\";\nimport { ConfigProvider } from \"../../utils/context/configContext\";\nimport { getSwanService } from \"../../utils/service/swanService\";\nimport ParamsContext from \"../../utils/context/paramsContext\";\nimport MediaContextProvider from \"../../utils/context/mediaContext\";\nimport { BodyScanProps, UserDetails } from \"../../types/interfaces\";\nimport { BodyScanSteps } from \"./BodyScanSteps\";\n\nconst clothesFit = \"0\";\n\nexport const BodyScan: React.FC<BodyScanProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonRetry,\n\t\tonScanStart,\n\t\tonUploadingStart,\n\t\tonUploadingEnd,\n\t\tonMeasurementSocketStart,\n\t\tonMeasurementSocketClose,\n\t\tonScanSuccessIntermediate,\n\t\tonScanError,\n\t\tonScanSuccess,\n\t\tonCustomScanSuccess,\n\t\tonComplete,\n\t\tisError,\n\t\tisSuccess,\n\t} = props;\n\tconst userDetails: UserDetails = {\n\t\temail: \"\",\n\t\tshopDomain: \"\",\n\t\tgender: \"male\",\n\t\theightInCm: 0,\n\t\tscanType: \"\",\n\t\tdeviceFocalLength: 0,\n\t\tdeviceModelName: \"\",\n\t\t...(props.userDetails ?? {}),\n\t};\n\tconst token = props.token ?? \"\";\n\tconst { gender, scanType, shopDomain, heightInCm, email, deviceFocalLength, deviceModelName, callbackUrl } = userDetails;\n\tconst swan = useMemo(() => getSwanService(token), [token]);\n\tconst [uploadLoading, setUploadLoading] = useState(false);\n\tconst [isVideoUploadedCorrect, setIsVideoUploadedCorrect] = useState(false);\n\tconst [isMeasurementAvailable, setIsMeasurementAvailable] = useState(false);\n\tconst [showDeniedModal, setShowDeniedModal] = useState({\n\t\tdisabled: false,\n\t\tmessage: \"\",\n\t});\n\tconst [scanFailsError, setScanFailsError] = useState(\"\");\n\tconst [isVideoUploaded, setIsVideoUploaded] = useState(false);\n\tconst [loading, setLoading] = useState(true);\n\tconst [startGyro, setStartGyro] = useState(false);\n\tconst [scanUniqueKey, setScanUniqueKey] = useState(\"\");\n\tconst [scanStartTime, setScanStartTime] = useState<number | null>(getCurrentTimeInSeconds());\n\tconst { gyroData } = useGyroSensor(startGyro);\n\tusePosthogPageview();\n\n\tconst handleShowStreamCamera = useCallback(() => {\n\t\tsetScanUniqueKey(generateUuid());\n\t\tsetScanFailsError(\"\");\n\t\tsetUploadLoading(false);\n\t\tsetIsVideoUploaded(false);\n\t}, []);\n\n\tconst onError = (data: any) => {\n\t\tonScanError?.({ ...data, message: handleErrorMessage(data) });\n\t\tclearScanStartTimeAndScanId();\n\t\tsetIsMeasurementAvailable(false);\n\t\tsetScanFailsError(data);\n\t\tsetIsVideoUploadedCorrect(false);\n\t\thandleScanTimeCapture({\n\t\t\teventName: `${shopDomain}/measurement_failed/fit-view`,\n\t\t\tscanID: scanUniqueKey,\n\t\t\tstatus: \"failed\",\n\t\t\temail,\n\t\t\tmessage: handleErrorMessage(data),\n\t\t});\n\t\tif (scanStartTime)\n\t\t\thandleScanTimeCapture({\n\t\t\t\teventName: `${shopDomain}/scan_completion_time`,\n\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tcompletionTime: getCurrentTimeInSeconds() - scanStartTime,\n\t\t\t\temail,\n\t\t\t});\n\t};\n\n\tconst clearScanStartTimeAndScanId = () => {\n\t\tsetScanStartTime(null);\n\t\tsetScanUniqueKey(\"\");\n\t};\n\n\tconst onSuccess = useCallback(\n\t\tasync (data: any) => {\n\t\t\tif (data && data?.scanStatus === \"success\" && data?.resultType === \"intermediate\" && data?.code === 200) {\n\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\teventName: `${shopDomain}/measurement_success/intermediate`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t\tsetIsVideoUploadedCorrect(true);\n\t\t\t\tonScanSuccessIntermediate?.(data);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonScanSuccess?.(data);\n\t\t\tsetIsVideoUploadedCorrect(true);\n\t\t\tclearScanStartTimeAndScanId();\n\t\t\tconst scanIdToSet = scanUniqueKey;\n\t\t\tsetIsMeasurementAvailable(true);\n\t\t\thandleScanTimeCapture({\n\t\t\t\teventName: `${shopDomain}/measurement_success/fit-view`,\n\t\t\t\tscanID: scanIdToSet,\n\t\t\t\tstatus: \"success\",\n\t\t\t\temail,\n\t\t\t});\n\t\t\tif (scanStartTime)\n\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\teventName: `${shopDomain}/scan_completion_time`,\n\t\t\t\t\tscanID: scanIdToSet,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\tcompletionTime: getCurrentTimeInSeconds() - scanStartTime,\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t},\n\t\t[scanType, shopDomain, scanUniqueKey],\n\t);\n\n\tconst handleMeasurementRecommendation = (scanId?: string) => {\n\t\tsetIsMeasurementAvailable(false);\n\t\tsetScanFailsError(\"\");\n\t\tsetIsVideoUploadedCorrect(false);\n\t\tswan.measurement.handleMeasurementSocket({\n\t\t\tscanId: scanId || scanUniqueKey,\n\t\t\tonPreopen: () => {\n\t\t\t\thandleWebSocketCapture({\n\t\t\t\t\teventName: `${shopDomain}/webSocket`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tconnection: \"pre_open\",\n\t\t\t\t\ttype: \"measurement_recommendation\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t},\n\t\t\tonOpen: () => {\n\t\t\t\tonMeasurementSocketStart?.();\n\t\t\t\thandleWebSocketCapture({\n\t\t\t\t\teventName: `${shopDomain}/webSocket`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tconnection: \"open\",\n\t\t\t\t\ttype: \"measurement_recommendation\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t},\n\t\t\tonClose: () => {\n\t\t\t\tonMeasurementSocketClose?.();\n\t\t\t\thandleWebSocketCapture({\n\t\t\t\t\teventName: `${shopDomain}/webSocket`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tconnection: \"close\",\n\t\t\t\t\ttype: \"measurement_recommendation\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t},\n\t\t\tonError: (err) => {\n\t\t\t\tonError(err);\n\t\t\t\thandleWebSocketCapture({\n\t\t\t\t\teventName: `${shopDomain}/webSocket`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tconnection: \"error\",\n\t\t\t\t\ttype: \"measurement_recommendation\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t},\n\t\t\tonSuccess: (data) => {\n\t\t\t\thandleWebSocketCapture({\n\t\t\t\t\teventName: `${shopDomain}/webSocket`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tconnection: \"success\",\n\t\t\t\t\ttype: \"measurement_recommendation\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t\tonSuccess(data);\n\t\t\t},\n\t\t});\n\t};\n\n\tconst handleFileUpload = useCallback(\n\t\tasync (file: File, recordedFps?: number | null) => {\n\t\t\tconst fileSizeInMB = Number((file.size / (1024 * 1024)).toFixed(2));\n\t\t\t// Use FPS captured at recording time, fallback to calculation if not available\n\t\t\tconst videoFps = recordedFps !== undefined && recordedFps !== null ? recordedFps : await getVideoFPS(file);\n\t\t\tconst arrayMetaData = createObjectMetadataArray({\n\t\t\t\tgender,\n\t\t\t\tfocal_length: `${deviceFocalLength}`,\n\t\t\t\theight: `${heightInCm}`,\n\t\t\t\tcustomer_store_url: shopDomain,\n\t\t\t\tclothes_fit: clothesFit,\n\t\t\t\tscan_type: scanType,\n\t\t\t\tcallback_url: callbackUrl,\n\t\t\t});\n\t\t\thandleScanTimeCapture({\n\t\t\t\teventName: `${shopDomain}/body_scan_meta_data`,\n\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\temail,\n\t\t\t\tdata: JSON.stringify([...arrayMetaData, { fileSizeInMB, video_fps: videoFps || 0 }]),\n\t\t\t});\n\t\t\tonUploadingStart?.();\n\t\t\ttry {\n\t\t\t\tawait swan.fileUpload.uploadFileFrontend({\n\t\t\t\t\tfile,\n\t\t\t\t\tarrayMetaData,\n\t\t\t\t\tscanId: scanUniqueKey,\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t\tawait swan.fileUpload.setDeviceInfo({\n\t\t\t\t\tmodel: deviceModelName,\n\t\t\t\t\tdetection: \"manual\",\n\t\t\t\t\tgyro: gyroData,\n\t\t\t\t\tscanId: scanUniqueKey,\n\t\t\t\t});\n\t\t\t\tconsole.log(\"video successfully uploaded\");\n\t\t\t\tsetIsVideoUploaded(false);\n\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\teventName: `${shopDomain}/scan_success`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\temail,\n\t\t\t\t\tdata: JSON.stringify(arrayMetaData),\n\t\t\t\t});\n\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\teventName: \"scan finished\",\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tstatus: \"success\",\n\t\t\t\t\temail,\n\t\t\t\t});\n\t\t\t\tsetScanStartTime(getCurrentTimeInSeconds());\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tsetIsVideoUploaded(true);\n\t\t\t\t}, 3000);\n\t\t\t} catch (error) {\n\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\teventName: \"scan finished\",\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\temail,\n\t\t\t\t\tmessage: handleErrorMessage(error),\n\t\t\t\t});\n\t\t\t\thandleScanTimeCapture({\n\t\t\t\t\teventName: `${shopDomain}/scan_failed`,\n\t\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\temail,\n\t\t\t\t\tmessage: handleErrorMessage(error),\n\t\t\t\t\tdata: JSON.stringify(arrayMetaData),\n\t\t\t\t});\n\t\t\t\tsetScanFailsError(handleErrorMessage(error));\n\t\t\t\tsetIsVideoUploaded(false);\n\t\t\t\tconsole.log(error, \"video upload failed\");\n\t\t\t} finally {\n\t\t\t\tsetStartGyro(false);\n\t\t\t\tonUploadingEnd?.();\n\t\t\t}\n\t\t},\n\t\t[scanUniqueKey, gyroData, onUploadingStart, onUploadingEnd],\n\t);\n\tconst checkMeasurementStatus = useCallback(\n\t\tasync (scanId: string) => {\n\t\t\ttry {\n\t\t\t\tconst res = await swan.measurement.getMeasurementResult(scanId);\n\t\t\t\tconst isMeasured = res?.data?.isMeasured;\n\t\t\t\tconst tempScanStartTime = scanStartTime || getCurrentTimeInSeconds();\n\t\t\t\tconst currentTimeInSeconds = getCurrentTimeInSeconds();\n\t\t\t\tconst fiveMinutesInSeconds = 5 * 60;\n\t\t\t\tsetLoading(false);\n\t\t\t\tif (isMeasured === false) {\n\t\t\t\t\tclearScanStartTimeAndScanId();\n\t\t\t\t\tsetScanUniqueKey(generateUuid());\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetUploadLoading(true);\n\t\t\t\tif (isMeasured === true) {\n\t\t\t\t\tawait onSuccess(null);\n\t\t\t\t} else if (isMeasured === null && tempScanStartTime > currentTimeInSeconds + fiveMinutesInSeconds) {\n\t\t\t\t\tonError(res?.data?.error);\n\t\t\t\t} else {\n\t\t\t\t\thandleMeasurementRecommendation(scanId);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconsole.log(error);\n\t\t\t\tclearScanStartTimeAndScanId();\n\t\t\t\tsetScanUniqueKey(generateUuid());\n\t\t\t\tsetUploadLoading(false);\n\t\t\t}\n\t\t},\n\t\t[onError, onSuccess, setScanUniqueKey],\n\t);\n\n\tconst handleCameraPermission = useCallback(async () => {\n\t\tif (+heightInCm < 152.4 || +heightInCm > 213.36) {\n\t\t\tonScanError?.({\n\t\t\t\tmessage: \"Height must be between 152.4cm (5ft) and 213.36cm (7ft)\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst permission = await checkCameraPermission();\n\t\tif (permission.disabled) {\n\t\t\thandleScanTimeCapture({\n\t\t\t\teventName: `${shopDomain}/camera_activation`,\n\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\tstatus: \"failed\",\n\t\t\t\temail,\n\t\t\t});\n\t\t\tsetLoading(false);\n\t\t} else {\n\t\t\tconst scanId = scanUniqueKey;\n\t\t\tif (scanId) {\n\t\t\t\tcheckMeasurementStatus(scanId);\n\t\t\t} else {\n\t\t\t\tsetLoading(false);\n\t\t\t}\n\t\t\thandleScanTimeCapture({\n\t\t\t\teventName: `${shopDomain}/camera_activation`,\n\t\t\t\tscanID: scanUniqueKey,\n\t\t\t\tstatus: \"success\",\n\t\t\t\temail,\n\t\t\t});\n\t\t}\n\t\tsetShowDeniedModal(permission);\n\t\tsetScanFailsError(\"\");\n\t\tsetIsVideoUploaded(false);\n\t}, [checkMeasurementStatus, email, scanUniqueKey, setScanUniqueKey, shopDomain]);\n\n\tuseEffect(() => {\n\t\tif (isError || isSuccess) return;\n\t\tif (shopDomain) {\n\t\t\thandleCameraPermission();\n\t\t}\n\t}, [shopDomain, heightInCm, isError, isSuccess]);\n\n\tuseEffect(() => {\n\t\tif (isError || isSuccess) return;\n\t\tif (isVideoUploaded && shopDomain && scanUniqueKey) {\n\t\t\thandleMeasurementRecommendation();\n\t\t}\n\t}, [isVideoUploaded, shopDomain, scanUniqueKey, isError, isSuccess]);\n\treturn (\n\t\t<LanguageContextProvider>\n\t\t\t<ConfigProvider config={config}>\n\t\t\t\t<MediaContextProvider>\n\t\t\t\t<ParamsContext.Provider\n\t\t\t\t\tvalue={{\n\t\t\t\t\t\tuserDetails,\n\t\t\t\t\t\tonRetry,\n\t\t\t\t\t\tonScanError,\n\t\t\t\t\t\tisError,\n\t\t\t\t\t\tisSuccess,\n\t\t\t\t\t\tonScanSuccess,\n\t\t\t\t\t\tgender,\n\t\t\t\t\t\tscanUniqueKey,\n\t\t\t\t\t\tscanFailsError,\n\t\t\t\t\t\tsetScanUniqueKey,\n\t\t\t\t\t\tsetIsVideoUploaded,\n\t\t\t\t\t\tisMeasurementAvailable,\n\t\t\t\t\t\tisVideoUploadedCorrect,\n\t\t\t\t\t\tloading,\n\t\t\t\t\t\tshowDeniedModal,\n\t\t\t\t\t\tuploadLoading,\n\t\t\t\t\t\tsetStartGyro,\n\t\t\t\t\t\thandleFileUpload,\n\t\t\t\t\t\tsetUploadLoading,\n\t\t\t\t\t\thandleShowStreamCamera,\n\t\t\t\t\t\tsetScanFailsError,\n\t\t\t\t\t\tsetScanStartTime,\n\t\t\t\t\t\tonScanStart,\n\t\t\t\t\t\tonCustomScanSuccess,\n\t\t\t\t\t\tonComplete,\n\t\t\t\t\t\tswan,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<BodyScanSteps />\n\t\t\t\t</ParamsContext.Provider>\n\t\t\t\t</MediaContextProvider>\n\t\t\t</ConfigProvider>\n\t\t</LanguageContextProvider>\n\t);\n};\n","import { useCallback, useEffect, useState } from \"react\";\n\ninterface GyroDataItem {\n alpha?: string;\n beta?: string;\n gamma?: string;\n timestamp?: string;\n}\n\nexport interface IOSDeviceOrientationEvent extends DeviceOrientationEvent {\n requestPermission?: () => Promise<PermissionState>;\n}\n\nfunction useGyroSensor(startGyro: boolean) {\n const [gyroData, setGyroData] = useState<GyroDataItem[]>([]);\n const [permissionGranted, setPermissionGranted] = useState(false);\n\n const handleOrientation = useCallback((event: DeviceOrientationEvent) => {\n try {\n const { alpha, beta, gamma } = event;\n setGyroData((prev: GyroDataItem[]) => [\n ...prev,\n {\n alpha: alpha?.toString() || undefined,\n beta: beta?.toString() || undefined,\n gamma: gamma?.toString() || undefined,\n timestamp: new Date().toISOString(),\n },\n ]);\n } catch (error) {\n console.log(error);\n }\n }, []);\n\n const requestPermission = useCallback(async () => {\n const DeviceOrientation =\n DeviceOrientationEvent as unknown as IOSDeviceOrientationEvent;\n\n if (\n typeof DeviceOrientation !== \"undefined\" &&\n typeof DeviceOrientation.requestPermission === \"function\"\n ) {\n try {\n const response = await DeviceOrientation.requestPermission();\n if (response === \"granted\") {\n setPermissionGranted(true);\n } else {\n console.warn(\"Device orientation permission denied.\");\n }\n } catch (error) {\n console.error(\"Error requesting device orientation permission:\", error);\n }\n } else {\n // Permission not required on non-iOS devices\n setPermissionGranted(true);\n }\n }, []);\n\n useEffect(() => {\n if (startGyro && permissionGranted) {\n window.addEventListener(\"deviceorientation\", handleOrientation);\n } else {\n setGyroData([]);\n }\n return () => {\n window.removeEventListener(\"deviceorientation\", handleOrientation);\n };\n }, [startGyro, permissionGranted, handleOrientation]);\n\n useEffect(() => {\n if (startGyro) {\n requestPermission();\n }\n }, [startGyro, requestPermission]);\n\n return { gyroData };\n}\n\nexport default useGyroSensor;\n"],"names":["MEDIA_TYPES","MediaContext","createContext","undefined","MediaContextProvider","children","size","setSize","useState","window","innerWidth","innerHeight","clearInputs","setClearInputs","updateSize","useEffect","useLayoutEffect","addEventListener","removeEventListener","media","mediaDetails","useMemo","_jsx","Provider","value","SwitchIcon$1","React","memo","_jsxs","width","height","viewBox","fill","xmlns","d","stroke","strokeWidth","strokeLinecap","strokeLinejoin","LevelScreen$1","angle","countdown","isScanning","isInTargetRange","stabilityScore","translate","useContext","LanguageContext","config","useConfig","getProximityToTarget","useCallback","Math","max","min","backgroundColor","style","angleDetector","successAngleBackground","proximity","successAngleLowBackground","round","handelTextColour","isLight","successAngleTextLightColor","successAngleTextDarkColor","getTextColor","handelColourCode","getColorCode","cd","fixVh","document","documentElement","setProperty","className","Header","noTitle","border","fontFamily","base","baseFontFamily","color","cn","transform","transition","SwitchIcon","LanguageKeys","startLevelCheck","leavePhone","placePhoneUpright","CameraScanChild","handleShowStreamCamera","loadingCam","handleUserMedia","handlePause","pause","recordingStarted","startSendingVideoFrames","showPause","webcamRef","handleUserMediaError","resetDetector","videoConstraints","webcamKey","onClick","X","Webcam","audio","ref","screenshotQuality","mirrored","screenshotFormat","onUserMedia","onUserMediaError","position","top","bottom","zIndex","objectFit","SpecificButton","prefix","pauseIcon","buttonText","buttonFunc","btnSecondary","restart","startScan","disabled","id","crossOrigin","preload","src","voiceOverAssetsPath","globalLoadingPromise","globalDetector","globalPoseLib","audioTimeoutId","lastVideoPlayed","ScanningComponent$1","setIsScanLocked","scanID","setIsVideoUploaded","setScanFailsError","setScanStartTime","setScanUniqueKey","userDetails","gender","heightInCm","email","shopDomain","useRef","mediaRecorderRef","recordedFpsRef","recordedChunks","setRecordedChunks","setLoadingCam","setRecordingStarted","faceDone","setFaceDone","mediaRecorderStopped","setMediaRecorderStopped","setIsScanning","captureVideoTimeOutHandle","audioSource","setAudioSource","audioSourceList","setAudioSourceList","emptyAudioSource","setEmptyAudioSource","startAgain","setStartAgain","showRestart","setRestart","setPause","events","setEvents","setShowPause","allowAudioToPlay","poseDetector","consecutiveFronts","setConsecutiveFronts","spinPhase","setSpinPhase","isLoaded","setIsLoaded","spinPhaseRef","consecutiveFrontsRef","mounted","async","loadDependenciesGlobal","navigator","console","log","poseLib","tfjsCore","tfjsBackend","Promise","all","resolve","then","require","import","setBackend","ready","modelConfig","runtime","modelType","solutionPath","createDetector","SupportedModels","BlazePose","mediapipeError","warn","error","isFrontFrame","body","length","filter","p","current","success","s","callback","video","readyState","poses","estimatePoses","flipHorizontal","keypoints","slice","map","kp","x","y","score","prev","err","retryLoading","useTensorFlow","firstScan","poseStoppedRef","supportedTypes","setSupportedTypes","setWebcamKey","currentVideoConstraints","setCurrentVideoConstraints","videoConstraintsExact","counter","setStartGyro","handleFileUpload","setUploadLoading","swan","onScanStart","ParamsContext","clearTimeout","generateUuid","speechService","stopAudio","stop","forEach","el","stream","setTimeout","videoConstraintsFallback","handleReScan","rescanSupportCaptureEvent","eventName","status","poseDetection","disconnect","preferredVideoTypes","getPreferredMediaRecorderTypes","recordingMimeType","getRecordingMimeType","recordingExtension","getRecordingExtension","stopRecording","playAudio","handleSocket","connect","posthog","capture","handleSpinDataAvailable","data","concat","handleScanTimeCapture","message","handleStartCaptureClick","videoTrack","getVideoTracks","settings","getSettings","frameRate","mediaRecorderOptions","videoBitsPerSecond","mimeType","MediaRecorder","start","e","postPoseProcess","handleDataAvailable","connected","poseStatus","querySelector","sid","paused","audioName","no_of_times_skipped","skipCount","getScreenshot","videoEmit","image","scanId","getCurrentTimeInSeconds","push","bypassChecksToBackup","videoFile","File","type","supported","getSupportedMediaRecorderTypes","videoTypes","AngleDetector","setAngle","calibrationOffset","setCalibrationOffset","setCountdown","setStabilityScore","lastAnglesRef","isScanLocked","calibratedAngle","DeviceOrientationEvent","handleOrientation","event","beta","newAngle","abs","gamma","cos","PI","requestPermission","DeviceOrientation","once","variation","resetCountdown","startCountdown","timer","setInterval","clearInterval","LevelScreen","ScanningComponent","Modal","Dialog","open","_Fragment","heading","headingFontFamily","fontSize","headingFontSize","headingColor","fontWeight","headingFontWeight","cameraAlreadyInUse","baseFontSize","baseTextColor","tryClosingBrowser","checkCameraSettings","setting","getBrowserName","enableCameraPermissions","CameraPermission","setShowDrawer","loader","showDeniedModal","setShowDeniedModal","loading","setLoading","handleCameraPermission","permission","checkCameraPermission","LoadingScreen","url","loaderType","VideoPlayer","link","onReady","wrapperClassName","videoReference","playerReference","videoJsOptions","autoplay","controls","responsive","fluid","muted","navigationUI","poster","videoPoster","player","videojs","updatedOptions","sources","isDisposed","dispose","playsInline","onDrag","preventDefault","ScanErrorMessage","scanFailsError","onNext","resolvedConfig","showModal","setShowModal","handleShowModal","background","issueWithScan","reason","handleErrorMessage","VIDEO_POSTER_GENDER_BASED","alt","scanAgain","onClose","GENDER","PRE_LINK","male","SignUp","isVideoUploadedCorrect","isMeasurementAvailable","onComplete","isSuccess","onCustomScanSuccess","deviceFocalLength","userName","scanType","isCustom","CLOTHING_CUSTOM_SCAN","CLOTHING_BANNER_SCAN","CLOTHING_CUSTOM_FIT_SCAN","includes","showDrawer","handleSignUp","auth","addUser","name","focalLength","clothesFit","showNextButton","Box","Drawer","_","anchor","title","measurementsBeingTaken","loop","autoPlay","GenderType","Male","maleMeasurementProgress","measurementProgress","next","BodyScanSteps","onRetry","isError","scanUniqueKey","uploadLoading","props","onUploadingStart","onUploadingEnd","onMeasurementSocketStart","onMeasurementSocketClose","onScanSuccessIntermediate","onScanError","onScanSuccess","deviceModelName","token","callbackUrl","getSwanService","setIsVideoUploadedCorrect","setIsMeasurementAvailable","isVideoUploaded","startGyro","scanStartTime","gyroData","setGyroData","permissionGranted","setPermissionGranted","alpha","toString","timestamp","Date","toISOString","useGyroSensor","usePosthogPageview","onError","clearScanStartTimeAndScanId","completionTime","onSuccess","scanStatus","resultType","code","scanIdToSet","handleMeasurementRecommendation","measurement","handleMeasurementSocket","onPreopen","handleWebSocketCapture","connection","onOpen","file","recordedFps","fileSizeInMB","Number","toFixed","videoFps","getVideoFPS","arrayMetaData","createObjectMetadataArray","focal_length","customer_store_url","clothes_fit","scan_type","callback_url","JSON","stringify","video_fps","fileUpload","uploadFileFrontend","setDeviceInfo","model","detection","gyro","checkMeasurementStatus","res","getMeasurementResult","isMeasured","tempScanStartTime","currentTimeInSeconds","fiveMinutesInSeconds","LanguageContextProvider","ConfigProvider"],"mappings":"2PAYO,MAAMA,EACF,UADEA,EAEN,MAFMA,EAGH,SAWGC,EAAeC,EAAAA,mBAC1BC,GAGF,SAASC,GAAqBC,SAAEA,IAC9B,MAAOC,EAAMC,GAAWC,EAAAA,SAAS,CAACC,QAAQC,WAAYD,QAAQE,eACvDC,EAAaC,GAAkBL,EAAAA,UAAS,GAEzCM,EAAa,KACjBP,EAAQ,CAACE,QAAQC,WAAYD,QAAQE,eAEvCI,EAAAA,UAAU,KACRD,KACC,IACHE,EAAAA,gBAAgB,KACdP,OAAOQ,iBAAiB,SAAUH,GAC3B,IAAML,OAAOS,oBAAoB,SAAUJ,IACjD,CAACA,IACJ,IAAIK,EAAQnB,EACRM,EAAK,GAAK,KAAOA,EAAK,GAAK,OAC7Ba,EAAQnB,GAENM,EAAK,GAAK,MACZa,EAAQnB,GAGV,MAAMoB,EAAeC,EAAAA,QACnB,KAAA,CACEf,OACAC,UACAK,cACAC,iBACAM,UAEF,CAACb,EAAMM,EAAaO,IAGtB,OACEG,EAAAA,IAACrB,EAAasB,SAAQ,CAACC,MAAOJ,EAAYf,SACvCA,GAGP,CClBA,IAAAoB,EAAeC,EAAMC,KAhDrB,UAAoBrB,KAAEA,EAAO,KAC3B,OACEsB,EAAAA,KAAA,MAAA,CACEC,MAAOvB,EACPwB,OAAQxB,EACRyB,QAAQ,YACRC,KAAK,OACLC,MAAM,6BAA4B5B,SAAA,CAElCiB,EAAAA,IAAA,OAAA,CACEY,EAAE,mHACFC,OAAO,QACPC,YAAY,IACZC,cAAc,QACdC,eAAe,UAEjBhB,EAAAA,IAAA,OAAA,CACEY,EAAE,0NACFC,OAAO,eACPC,YAAY,IACZC,cAAc,QACdC,eAAe,UAEjBhB,EAAAA,IAAA,OAAA,CACEY,EAAE,kOACFC,OAAO,eACPC,YAAY,IACZC,cAAc,QACdC,eAAe,UAEjBhB,MA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EAAAA,YAAYyI,UAC1C,IAAKzC,EAAa,QAAUA,EAAa,OAIxC,YAHAoU,IAAc,CACbzL,QAAS,4DAKX,MAAM4F,QAAmBC,0BACzB,GAAID,EAAW3P,SACd8J,wBAAsB,CACrBnB,UAAW,GAAGrH,sBACdT,OAAQmU,EACRpM,OAAQ,SACRvH,UAEDoO,GAAW,OACL,CACSuF,EAEdoE,GAFcpE,GAIdvF,GAAW,GAEZ3F,wBAAsB,CACrBnB,UAAW,GAAGrH,sBACdT,OAAQmU,EACRpM,OAAQ,UACRvH,SAED,CACDkO,EAAmBI,GACnB5O,EAAkB,IAClBD,GAAmB,IACjB,CAACsY,GAAwB/X,EAAO2T,EAAe/T,EAAkBK,IAepE,OAbAtI,EAAAA,UAAU,KACL+b,GAAWjC,GACXxR,GACHoO,MAEC,CAACpO,EAAYF,EAAY2T,EAASjC,IAErC9Z,EAAAA,UAAU,KACL+b,GAAWjC,GACXkD,GAAmB1U,GAAc0T,GACpCsC,MAEC,CAACtB,EAAiB1U,EAAY0T,EAAeD,EAASjC,IAExDvZ,EAAAA,IAACogB,EAAAA,wBAAuB,CAAArhB,SACvBiB,EAAAA,IAACqgB,EAAAA,eAAc,CAAC3e,OAAQA,WACvB1B,EAAAA,IAAClB,YACDkB,EAAAA,IAACuO,gBAActO,SAAQ,CACtBC,MAAO,CACNyH,cACA4T,UACAU,cACAT,UACAjC,YACA2C,gBACAtU,SACA6T,gBACAvD,iBACAxQ,mBACAH,qBACA8R,yBACAD,yBACAnD,UACAF,kBACA2F,gBACAxN,eACAC,oBACAC,mBACA/J,yBACAmD,oBACAC,mBACA6G,cACAkL,sBACAF,aACAjL,QACAtP,SAEDiB,EAAAA,IAACsb,EAAa,CAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),s=require("posthog-js"),a=require("./LoadingScreen-BjhVLzbU.js"),n=require("clsx"),r=require("react-webcam"),o=require("lucide-react"),i=require("@mui/material"),c=require("video.js");const l="DESKTOP",u="TAB",d="MOBILE",m=t.createContext(void 0);function f({children:s}){const[a,n]=t.useState([window?.innerWidth,window?.innerHeight]),[r,o]=t.useState(!1),i=()=>{n([window?.innerWidth,window?.innerHeight])};t.useEffect(()=>{i()},[]),t.useLayoutEffect(()=>(window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)),[i]);let c=l;a[0]>768&&a[0]<1024&&(c=u),a[0]<768&&(c=d);const f=t.useMemo(()=>({size:a,setSize:n,clearInputs:r,setClearInputs:o,media:c}),[a,r,c]);return e.jsx(m.Provider,{value:f,children:s})}var h=t.memo(function({size:t=16}){return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 25 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M22.6968 14.6968C22.6968 16.8185 21.8539 18.8533 20.3536 20.3536C18.8533 21.8539 16.8185 22.6968 14.6968 22.6968",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M18.6968 11.6968V10.6968C18.6968 10.1663 18.4861 9.65764 18.111 9.28256C17.7359 8.90749 17.2272 8.69678 16.6968 8.69678C16.1663 8.69678 15.6576 8.90749 15.2826 9.28256C14.9075 9.65764 14.6968 10.1663 14.6968 10.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M14.6968 10.6968V9.69678C14.6968 9.16634 14.4861 8.65764 14.111 8.28256C13.7359 7.90749 13.2272 7.69678 12.6968 7.69678C12.1663 7.69678 11.6576 7.90749 11.2826 8.28256C10.9075 8.65764 10.6968 9.16634 10.6968 9.69678V10.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M10.6968 10.1968V4.69678C10.6968 4.16634 10.4861 3.65764 10.111 3.28256C9.73592 2.90749 9.22721 2.69678 8.69678 2.69678C8.16634 2.69678 7.65764 2.90749 7.28256 3.28256C6.90749 3.65764 6.69678 4.16634 6.69678 4.69678V14.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M18.6969 11.6968C18.6969 11.1663 18.9076 10.6576 19.2827 10.2826C19.6577 9.90749 20.1664 9.69678 20.6969 9.69678C21.2273 9.69678 21.736 9.90749 22.1111 10.2826C22.4862 10.6576 22.6969 11.1663 22.6969 11.6968V14.6968C22.6969 16.8185 21.854 18.8533 20.3537 20.3536C18.8534 21.8539 16.8186 22.6968 14.6969 22.6968H12.6969C9.89688 22.6968 8.19688 21.8368 6.70688 20.3568L3.10688 16.7568C2.76282 16.3757 2.57847 15.8769 2.592 15.3637C2.60554 14.8505 2.81593 14.3621 3.1796 13.9997C3.54327 13.6373 4.03238 13.4287 4.54565 13.417C5.05892 13.4053 5.55704 13.5914 5.93688 13.9368L7.69688 15.6968",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})});var g=t.memo(function({angle:s,countdown:r,isScanning:o,isInTargetRange:i,stabilityScore:c,children:l,config:u}){const{translate:d}=t.useContext(a.LanguageContext)||{},m=t.useCallback(()=>s<80?Math.max(0,Math.min(100,10*(s-60))):s>95?Math.max(0,Math.min(100,10*(105-s))):100,[s]),f=t.useMemo(()=>{if(o)return u?.style?.angleDetector?.successAngleBackground||"#4f46e5";const e=m();if(0===e)return u?.style?.angleDetector?.successAngleLowBackground||"#ffffff";if(100===e)return u?.style?.angleDetector?.successAngleBackground||"#4f46e5";return`rgb(${Math.round(255-e/100*116)}, ${Math.round(255-e/100*163)}, ${Math.round(255-e/100*9)})`},[o,m]),g=t.useCallback((e,t)=>t>70?e?`text-[${u?.style?.angleDetector?.successAngleTextLightColor}]/70`:`text-[${u?.style?.angleDetector?.successAngleTextLightColor}]`:e?`text-[${u?.style?.angleDetector?.successAngleTextLightColor}]/40`:`text-[${u?.style?.angleDetector?.successAngleTextDarkColor}]/70`,[]),p=t.useCallback((e=!1)=>{const t=m();return o?`text-[${u?.style?.angleDetector?.successAngleTextLightColor}]`:g(e,t)},[o,m]),x=t.useCallback((e,t)=>t>70||e?u?.style?.angleDetector?.successAngleTextLightColor:u?.style?.angleDetector?.successAngleTextDarkColor,[]),y=t.useCallback((e=!1)=>{const t=m();return o?u?.style?.angleDetector?.successAngleTextLightColor:x(e,t)},[o,m]),S=r;function v(){document.documentElement.style.setProperty("--real-vh",window.innerHeight+"px")}return v(),window.addEventListener("resize",v),e.jsxs("div",{className:"flex w-screen flex-col items-center h-[var(--real-vh)] overflow-hidden touch-none justify-center transition-all duration-300 max-w-[28rem] mx-auto",style:{backgroundColor:f},children:[e.jsx("div",{className:"flex justify-start fixed top-[.5rem] max-w-[28rem] mx-auto w-full px-[1rem]",children:e.jsx("div",{className:"flex justify-start ",children:e.jsx(a.Header,{noTitle:!0,resolvedConfig:u})})}),null!==S?e.jsx("div",{className:"relative flex h-[6rem] w-[6rem] items-center justify-center rounded-[9999px] bg-[#fff]/20 transition-all duration-300",style:{border:`2px solid ${y()}`},children:e.jsx("div",{className:`text-[3rem] font-bold text-[${y()}]`,style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif",color:y()},children:S})}):o?e.jsxs("div",{className:"relative flex flex-col items-center justify-center",children:[e.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-[9999px] border-2 bg-[#fff]/30 border-[#fff]",children:e.jsx("div",{className:"h-4 w-4 rounded-[9999px] animate-pulse bg-[#fff]/80"})}),l]}):e.jsxs("div",{className:n("relative flex h-[4rem] w-[4rem] items-center justify-center rounded-[9999px] ",i?"bg-[#fff]/20 border-[#fff]":"bg-[#fff]/10 border-[#fff]"),style:{transform:`translateY(${3*(90-s)}px)`,transition:"transform 0.2s ease-out",border:`2px solid ${y()}`},children:[e.jsx("div",{className:`h-[1rem] w-[1rem] rounded-[9999px] bg-[${y()}]/80`,style:{backgroundColor:`${y()}B3`}}),e.jsxs("div",{className:n("mt-[.5rem] text-center w-[180px] flex-col flex items-center absolute top-[60px]",p()),style:{color:y()},children:[e.jsx(h,{size:30}),e.jsxs("p",{style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif"},children:[" ",d?.(a.LanguageKeys.startLevelCheck),e.jsx("br",{})]})]})]}),null!==S&&e.jsx("div",{className:"absolute bottom-[8rem] text-center",children:e.jsx("div",{className:n("text-sm font-medium px-4 py-1.5 bg-black/20 rounded-[9999px] mt-8",p()),style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif",color:y()},children:d?.(a.LanguageKeys.leavePhone)})}),i&&null===S&&!o&&e.jsx("div",{className:"absolute bottom-[8rem] w-[12rem]",children:e.jsx("div",{className:`h-[.375rem] w-full bg-[${y()}]/20 rounded-[9999px] overflow-hidden`,style:{backgroundColor:`${y()}33`},children:e.jsx("div",{className:`h-full bg-[${y()}]/70 transition-all duration-300 rounded-[9999px]`,style:{width:`${s}%`,backgroundColor:`${y()}B3`}})})}),null===S&&!o&&e.jsx("div",{className:"absolute bottom-[5rem] text-center",children:e.jsxs("div",{className:n("text-[1.5rem] font-light",p()),style:{color:y()},children:[Math.round(s),"°"]})}),null===S&&!o&&e.jsx("div",{className:"absolute bottom-[2rem] text-center max-w-[20rem] mx-auto",children:e.jsx("div",{className:n("text-[.75rem] opacity-50",p()),style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif",color:y()},children:d?.(a.LanguageKeys.placePhoneUpright)})})]})});function p({handleShowStreamCamera:s,loadingCam:n,handleUserMedia:i,handlePause:c,pause:l,recordingStarted:u,startSendingVideoFrames:f,showPause:h,webcamRef:g,resetDetector:p,config:x}){const{media:y}=t.useContext(m)||{},{translate:S}=t.useContext(a.LanguageContext)||{};return e.jsxs("div",{className:"App w-screen h-[100vh] relative ",children:[e.jsx("span",{onClick:()=>{s(),p()},className:"fixed right-[20px] top-[20px] z-[999]",children:e.jsx(o.X,{className:"text-[#fff]"})}),e.jsx("div",{className:"w-full h-full overflow-hidden ",children:y===d&&e.jsx(r,{audio:!1,ref:g,screenshotQuality:1,videoConstraints:a.videoConstraints,mirrored:!0,screenshotFormat:"image/jpeg",onUserMedia:i,style:{position:"fixed",top:0,bottom:0,zIndex:0,width:"100%",height:"100%",objectFit:"cover"}})}),e.jsxs("div",{className:"fixed bottom-[30px] w-full z-[999] flex flex-col gap-4 items-center justify-center",children:[h&&e.jsx(a.SpecificButton,{className:"!w-[180px] !h-[40px] !py-[0] mx-auto ",prefix:a.pauseIcon,buttonText:S?.(a.LanguageKeys.pause),buttonFunc:c,resolvedConfig:x,btnSecondary:!0}),l?e.jsx("div",{children:e.jsx(a.SpecificButton,{className:"!w-[180px] !h-[40px] !py-[0] mx-auto",buttonText:S?.(a.LanguageKeys.restart),buttonFunc:s,resolvedConfig:x,btnSecondary:!0})}):u?null:e.jsx(a.SpecificButton,{className:"!w-[180px] !h-[40px] !py-[0] mx-auto !bg-[#ffffff] !text-[#000000] "+(n?"!opacity-50":""),buttonText:S?.(a.LanguageKeys.startScan),buttonFunc:f,disabled:n,resolvedConfig:x})]}),e.jsx("audio",{id:"audioElement",crossOrigin:"anonymous",preload:"auto",style:{position:"absolute",zIndex:-99999},src:`${a.voiceOverAssetsPath}scanAudioInstructions/silence.mp3`})]})}let x=null,y=null,S=null;let v,b=null,C=null;var w=t.memo(function({setIsScanLocked:n,resetDetector:r,scanID:o,setIsVideoUploaded:i,setScanFailsError:c,setScanStartTime:l,setScanUniqueKey:u,userDetails:d,config:m}){const{gender:f,heightInCm:h,email:g,shopDomain:w}=d,j=t.useRef(null),N=t.useRef(null),[F,k]=t.useState([]),[E,D]=t.useState(!0),[T,I]=t.useState(!1),[L,M]=t.useState(!1),[_,A]=t.useState(!0),[P,U]=t.useState(!1),$=t.useRef(null),[R,z]=t.useState(""),[K,O]=t.useState([]),[V,q]=t.useState(""),[B,W]=t.useState(!1),[H,G]=t.useState(!1),[J,Q]=t.useState(!1),[X,Y]=t.useState([]),[Z,ee]=t.useState(!1),te=t.useRef(!0),{poseDetector:se}=function(){const[e,s]=t.useState(0),[a,n]=t.useState(0),[r,o]=t.useState(!1),i=t.useRef(0),c=t.useRef(0),l=t.useRef(!0);async function u(){if("undefined"==typeof window||"undefined"==typeof navigator)return!1;try{console.log("Starting TensorFlow preload...");const[e,t,s]=await Promise.all([Promise.resolve().then(function(){return require("./pose-detection.esm-BaWguRmj.js")}),import("@tensorflow/tfjs-core"),import("@tensorflow/tfjs-backend-webgl")]);S=e,await t.setBackend("webgl"),await t.ready(),console.log("TensorFlow backend ready (WebGL)");const a={runtime:"mediapipe",modelType:"full",solutionPath:"https://cdn.jsdelivr.net/npm/@mediapipe/pose"};try{y=await S.createDetector(S.SupportedModels.BlazePose,a),console.log("MediaPipe detector created successfully")}catch(e){console.warn("MediaPipe failed, falling back to TFJS runtime:",e),y=await S.createDetector(S.SupportedModels.BlazePose,{runtime:"tfjs",modelType:"full"}),console.log("TFJS detector created successfully")}return!0}catch(e){return console.error("Failed to load TensorFlow dependencies:",e),x=null,!1}}function d(e){return!(!e||0===e.length)&&22===e.filter(e=>e[2]>.7).length}return t.useEffect(()=>{if(l.current=!0,!y)return x||(x=u()),x.then(e=>{e&&l.current&&o(!0)}),()=>{l.current=!1};o(!0)},[]),t.useEffect(()=>{c.current=e,e>6&&i.current<2&&(n(e=>e+1),s(0))},[e]),t.useEffect(()=>{i.current=a},[a]),{poseDetector:async(e,t)=>{if(!y||!l.current||!t?.current?.video)return;const a=t.current.video;if(!(a.readyState<2))try{const t=await y.estimatePoses(a,{flipHorizontal:!1});if(!t||!t.length)return;const n=t[0].keypoints.slice(11).map(e=>[e.x>0&&e.x<720?e.x:-1,e.y>0&&e.y<1280?e.y:-1,e.score??0]);0!==i.current||d(n)||s(e=>e+1),1===i.current&&d(n)&&s(e=>e+1),2===i.current&&e()}catch(e){console.error("Pose detection error:",e)}},isLoaded:r,spinPhase:a,resetDetector:()=>{i.current=0,c.current=0,s(0),n(0)},retryLoading:async()=>{y||x||(x=u(),await x&&l.current&&o(!0))}}}(),ae=t.useRef(!0),ne=t.useRef(!1),re=t.useRef(0),oe=t.useRef(0),ie=t.useRef(!1),ce=t.useRef(()=>{}),[le,ue]=t.useState([]),{setStartGyro:de,handleFileUpload:me,setUploadLoading:fe}=t.useContext(a.ParamsContext),he=()=>{ne.current=!1,clearTimeout(v),$.current&&clearTimeout($.current),u(a.generateUuid()),c(""),fe?.(!1),k([]),D(!0),I(!1),M(!1),A(!0),U(!1),$.current=null,z(""),O([]),q(""),W(!B),de(!1),a.speechService.stopAudio(),G(!1),Q(!1),re.current=0,oe.current=0,ie.current=!1,null!==N.current&&N.current.stop(),X.forEach(e=>{N.current&&N.current.removeEventListener("dataavailable",e)}),Y([]),te.current=!0,ee(!1),i(!1),j.current?.stream&&D(!1)},ge=t.useCallback(()=>{setTimeout(()=>{D(!1)},1e3)},[]),pe=t.useCallback(()=>{a.rescanSupportCaptureEvent({eventName:`${w}/rescan`,email:g,scanID:o,height:h,gender:f,status:!1}),te.current=!1,he(),Ne()},[he,o,g]),xe=t.useCallback(()=>{te.current=!1,Q(!0),ee(!1),$.current&&clearTimeout($.current),N.current&&N.current.pause(),a.speechService.stopAudio(),a.swan.poseDetection.disconnect(),re.current=0,oe.current=0,ie.current=!1,N.current&&N.current.stop(),X.forEach(e=>{N.current&&N.current.removeEventListener("dataavailable",e)}),Y([]),clearTimeout(v)},[N,X,a.speechService,te]),ye=t.useCallback(async()=>{te.current=!0,await a.speechService.playAudio(`${a.voiceOverAssetsPath}SpotOn.mp3`),Q(!1),ee(!1),$.current&&clearTimeout($.current),I(!1)},[$,a.speechService]),Se=t.useCallback(async()=>{try{b=await a.swan.poseDetection.connect(),s.capture(`${w}/pose_detection_connected`,{scanID:o,email:g,id:b})}catch(e){console.log(e,"while connecting websocket")}},[o,w,g]),ve=t.useCallback(({data:e})=>{e&&e.size>0&&te.current&&(k(t=>t.concat(e)),!ne.current&&j.current&&(ne.current=!0,se(()=>{ye(),a.handleScanTimeCapture({eventName:`${w}/tensorFlow`,scanID:o,email:g,message:"recording stopped by tensorflow "})},j)))},[ye,a.handleScanTimeCapture,w,o,g,j]),be=t.useCallback(async()=>{K.length>0&&te.current&&(await a.speechService.playAudio(a.voiceOverAssetsPath+K[K.length-1]),te.current&&(v=setTimeout(be,2e3)))},[K,te]),Ce=t.useCallback(()=>{N&&N.current&&N.current.stop(),I(!0);try{if(j&&j.current&&j.current.stream){const e={mimeType:le[0]};N.current=new MediaRecorder(j.current.stream,e),N.current.addEventListener("dataavailable",ve),Y([...X,ve]),N.current.start(1e3),A(!1)}}catch(e){console.log("error while using media recorder",e)}},[j,le,ve,X]),we=t.useCallback(async()=>{$.current&&clearTimeout($.current),Ce(),te.current&&($.current=setTimeout(async()=>{te.current&&(await a.speechService.playAudio(`${a.voiceOverAssetsPath}SpotOn.mp3`),I(!1))},15e3)),M(!0),te.current&&await a.speechService.playAudio(`${a.voiceOverAssetsPath}Spin.mp3`)},[Ce,te,a.speechService]);t.useEffect(()=>{ce.current=we},[we]);const je=t.useCallback(({data:e})=>{e.size>0&&a.swan.poseDetection.connected()&&(ie.current||(ie.current=!0,a.swan.poseDetection.poseStatus(async e=>{if(e&&e.audio&&e.audio.length>0){const t=document.querySelector("#audioElement");!0===e.status&&e.sid===b?(oe.current=0,re.current<2?(0===re.current&&t?.paused&&await a.speechService.playAudio(a.voiceOverAssetsPath+e.audio),re.current+=1):(q(e.audio),clearTimeout(v),a.swan.poseDetection.disconnect(),ie.current=!1,setTimeout(()=>ce.current(),1e3))):(oe.current+=1,oe.current>=3&&(re.current=0),!t?.paused||C&&C?.audioName===e.audio?C?.audioName===e.audio&&t?.paused&&(C&&C.no_of_times_skipped>=C.skipCount?(C.no_of_times_skipped=0,a.speechService.playAudio(a.voiceOverAssetsPath+e.audio)):C&&(C.no_of_times_skipped+=1)):(C={skipCount:2,no_of_times_skipped:0,audioName:e.audio},a.speechService.playAudio(a.voiceOverAssetsPath+e.audio)))}})),j?.current&&null!==j.current.getScreenshot()&&a.swan.poseDetection.videoEmit({image:j.current.getScreenshot()||"",scanId:o}))},[j,o,a.swan,b,a.speechService]),Ne=t.useCallback(async()=>{U(!0),de(!0),ae.current&&(ae.current=!1,a.handleScanTimeCapture({eventName:"scan started",scanID:o,status:"success",email:g})),l(a.getCurrentTimeInSeconds()),D(!0),te.current&&await a.speechService.playAudio(`${a.voiceOverAssetsPath}StartScan.mp3`),te.current&&await a.speechService.playAudio(`${a.voiceOverAssetsPath}LiftArmsAndHoldAtHip.mp3`),te.current&&(U(!1),I(!0),G(!0),ee(!0),ge());try{if(j&&j.current&&j.current.stream&&te.current){const e={mimeType:le[0]};te.current&&(N.current=new MediaRecorder(j.current.stream,e)),te.current&&N.current&&N.current.addEventListener("dataavailable",je),Y([...X,je]),N.current&&N.current.start(1e3),A(!1),te.current&&(v=setTimeout(be,2e3))}}catch(e){console.log("error ----------",e)}},[j,le,je,X,be,te]);return t.useEffect(()=>(w&&(n(!0),Se()),()=>{b&&(a.swan.poseDetection.disconnect(),s.capture(`${w}/pose_detection_disconnected`,{scanID:o,email:g,id:b})),X.forEach(e=>{N?.current?.removeEventListener("dataavailable",e)})}),[B,w]),t.useEffect(()=>{K.push(R)},[R]),t.useEffect(()=>{O([])},[V]),t.useEffect(()=>{const e=F.length&&F.length>0;_||!e||T||!te.current||J||N&&N.current&&(T||(N.current.stop(),A(!0)))},[_,T,F,J]),t.useEffect(()=>{const e=F.length&&F.length>0;if(_||!e||T)console.log("No video found to upload");else if(N&&N.current&&te.current&&!J&&!T){const e=new File(F,`${o}.webm`,{type:"video/webm"});fe?.(!0),c(""),me?.(e)}},[_,T,F,J,N,te]),t.useEffect(()=>{if("undefined"!=typeof MediaRecorder){const e=a.videoTypes.filter(e=>MediaRecorder.isTypeSupported(e));ue(e)}},[]),t.useEffect(()=>{he()},[]),e.jsx(p,{resetDetector:r,handleShowStreamCamera:he,loadingCam:E,handlePause:xe,showRestart:H,pause:J,handleReScan:pe,recordingStarted:T,isScanning:P,startSendingVideoFrames:Ne,faceDone:L,stopRecording:ye,showPause:Z,webcamRef:j,handleUserMedia:ge,config:m})});function j({scanID:s,userDetails:a,setIsVideoUploaded:n,setScanFailsError:r,setScanStartTime:o,setScanUniqueKey:i,config:c}){const[l,u]=t.useState(90),[d,m]=t.useState(0),[f,h]=t.useState(null),[p,x]=t.useState(!1),[y,S]=t.useState(0),v=t.useRef([]),[b,C]=t.useState(!1),j=l-d,N=j>=80&&j<=95;t.useEffect(()=>{if("undefined"!=typeof window&&window.DeviceOrientationEvent){const e=e=>{if(null!==e.beta){let t=Math.abs(e.beta);null!==e.gamma&&(t*=Math.cos(e.gamma*Math.PI/180)),t=Math.max(0,Math.min(180,t)),u(t)}},t=async()=>{const t=DeviceOrientationEvent;if(t&&"function"==typeof t.requestPermission)try{"granted"===await t.requestPermission()&&window.addEventListener("deviceorientation",e)}catch(e){console.error("Permission error",e)}else window.addEventListener("deviceorientation",e);return()=>{e&&window.removeEventListener("deviceorientation",e)}};document.addEventListener("click",t,{once:!0})}},[]),t.useEffect(()=>{if(v.current=[...v.current.slice(-4),j],v.current.length>=5){const e=Math.max(...v.current)-Math.min(...v.current);S(N&&e<2?e=>Math.min(100,e+10):e=>Math.max(0,e-20))}N||null===f&&!p||k()},[j,N,f,p]),t.useEffect(()=>{y>=100&&null===f&&!p&&F(),y<50&&null!==f&&k()},[y,f,p]);const F=()=>{h(3);const e=setInterval(()=>{h(t=>null===t||t<=1?(clearInterval(e),x(!0),null):t-1)},1e3)},k=()=>{h(null),b||x(!1)};return e.jsx(g,{angle:j,countdown:f,isScanning:p,isInTargetRange:N,stabilityScore:y,config:c,children:p&&e.jsx(w,{setIsScanLocked:C,resetDetector:()=>{u(90),m(0),h(null),x(!1),S(0),C(!1),v.current=[]},scanID:s,userDetails:a,setIsVideoUploaded:n,setScanFailsError:r,setScanStartTime:o,setScanUniqueKey:i,config:c})})}function N({message:s,config:n}){const{translate:r}=t.useContext(a.LanguageContext)||{};return e.jsx(i.Dialog,{open:!0,className:"confirm-modal",children:e.jsx("div",{className:"modal-main",children:e.jsx("div",{className:"text-center",children:s?e.jsxs(e.Fragment,{children:[e.jsx("h2",{style:{fontFamily:n?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:n?.style?.heading?.headingFontSize||"32px",color:n?.style?.heading?.headingColor||"#000",fontWeight:n?.style?.heading?.headingFontWeight||"normal"},children:r?.(a.LanguageKeys.cameraAlreadyInUse)}),e.jsx("p",{className:"mt-[0.5rem] text-sm",style:{fontFamily:n?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:n?.style?.base?.baseFontSize||"16px",color:n?.style?.base?.baseTextColor||"#000"},children:r?.(a.LanguageKeys.tryClosingBrowser)})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{style:{fontFamily:n?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:n?.style?.heading?.headingFontSize||"32px",color:n?.style?.heading?.headingColor||"#000",fontWeight:n?.style?.heading?.headingFontWeight||"normal"},children:r?.(a.LanguageKeys.checkCameraSettings)}),e.jsx("p",{className:"mt-[0.5rem] text-sm",style:{fontFamily:n?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:n?.style?.base?.baseFontSize||"16px",color:n?.style?.base?.baseTextColor||"#000"},children:`${r?.(a.LanguageKeys.setting)} > ${a.getBrowserName()} > ${r?.(a.LanguageKeys.enableCameraPermissions)}`})]})})})})}function F({setShowDrawer:s,config:n,loader:o}){const[i,c]=t.useState({disabled:!1,message:""}),[l,u]=t.useState(!0),d=t.useRef(null),m=t.useCallback(async()=>{const e=await a.checkCameraPermission();c(e),u(!1)},[]);return t.useEffect(()=>{m()},[]),l?e.jsx(a.LoadingScreen,{url:o,loaderType:"black"}):i?.disabled?e.jsx(N,{config:n,message:i?.message}):e.jsx(r,{audio:!1,ref:d,screenshotQuality:1,videoConstraints:a.videoConstraints,mirrored:!0,onUserMedia:()=>s?.(!0),screenshotFormat:"image/jpeg",style:{position:"relative",top:0,bottom:0,zIndex:0,width:"100%",height:"100%",objectFit:"cover"}})}function k({link:s,onReady:n,wrapperClassName:r="[&_video]:rounded-t-[20px] w-full h-full"}){const o=t.useRef(null),i=t.useRef(null);let l={autoplay:!0,controls:!1,responsive:!0,fluid:!0,muted:!0,navigationUI:"hide",preload:"metadata",poster:a.videoPoster};return t.useEffect(()=>{if(!i.current&&s&&o?.current){const e=c(o.current,{...l});e.ready(()=>{i.current=e;const t={...l,sources:[{src:s,type:"application/x-mpegURL"}]};e.autoplay(t.autoplay),e.src(t.sources),n?.(e)})}},[s,o]),t.useEffect(()=>{const e=i.current;return()=>{e&&!e.isDisposed()&&(e.dispose(),i.current=null)}},[i]),e.jsx("div",{className:r,children:e.jsx("video",{ref:o,muted:!0,className:"video-js",playsInline:!0,onDrag:e=>e.preventDefault()})})}function E({scanFailsError:s,serverAtCapacity:n=!1,onNext:r,gender:c,setScanUniqueKey:l,resolvedConfig:u,setIsVideoUploaded:d}){const{translate:m}=t.useContext(a.LanguageContext)||{},[f,h]=t.useState(!1),g=()=>{h(!f)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full max-w-[28rem] mx-auto w-full rounded-t-[20px] overflow-y-auto",style:{background:u?.style?.base?.backgroundColor},children:[e.jsx("div",{className:"w-full max-w-[28rem] mx-auto pt-[1rem] px-[1rem]",children:e.jsx(a.Header,{noTitle:!0,resolvedConfig:u})}),e.jsxs("div",{className:"flex-1",children:[s&&e.jsxs("div",{className:"px-[1rem]",children:[e.jsx("h2",{className:"text-center",style:{fontFamily:u?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:u?.style?.heading?.headingFontSize||"32px",color:u?.style?.heading?.headingColor||"#000",fontWeight:u?.style?.heading?.headingFontWeight||"normal"},children:m?.(a.LanguageKeys.issueWithScan)}),e.jsx("p",{style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:u?.style?.base?.baseFontSize||"16px",color:u?.style?.base?.baseTextColor||"#1E1E1E"},children:m?.(a.LanguageKeys.reason)}),e.jsx("p",{style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:u?.style?.base?.baseFontSize||"16px",color:u?.style?.base?.baseTextColor||"#1E1E1E"},children:a.handleErrorMessage(s)}),e.jsx("img",{className:"my-[0.5rem] aspect-[2/1.4] w-full object-cover",onClick:g,src:a.VIDEO_POSTER_GENDER_BASED[c],alt:"icon"})]}),n&&e.jsxs("div",{className:"p-[1rem] text-center",children:[e.jsx("h3",{style:{fontFamily:u?.style?.heading?.headingFontFamily||"SeriouslyNostalgic Fn",fontSize:u?.style?.heading?.headingFontSize||"32px",color:u?.style?.heading?.headingColor||"#000",fontWeight:u?.style?.heading?.headingFontWeight||"normal"},children:m?.(a.LanguageKeys.serverAtCapacity)}),e.jsx("p",{className:"text-base mt-[0.5rem]",style:{fontFamily:u?.style?.base?.baseFontFamily||"Inter, sans-serif",fontSize:u?.style?.base?.baseFontSize||"16px",color:u?.style?.base?.baseTextColor||"#1E1E1E"},children:m?.(a.LanguageKeys.serverAtCapacityDescription)})]})]}),s&&e.jsx("div",{className:"p-[1rem] flex gap-[0.5rem]",children:e.jsx(a.SpecificButton,{disabled:!1,buttonText:m?.(a.LanguageKeys.scanAgain),className:"!shadow-none",buttonFunc:()=>{r?r?.():l(a.generateUuid()),d(!1)},resolvedConfig:u})})]}),f&&e.jsxs(i.Dialog,{className:"w-screen h-screen video-modal",onClose:g,open:f,children:[e.jsx("div",{className:"flex justifyEnd ",children:e.jsx("span",{className:"closeBtn",onClick:g,children:e.jsx(o.X,{className:"absolute right-[8px] top-[8px] text-white z-[9]"})})}),e.jsx("div",{className:"aspect-video object-cover rounded-[20px] ",children:e.jsx(k,{link:c?a.GENDER[c].PRE_LINK:a.GENDER.male.PRE_LINK,wrapperClassName:"w-screen h-screen fixed top-[0] left-[0]"})})]})]})}function D({scanId:n,userDetails:r,config:o,isFaceScan:c,isVideoUploadedCorrect:l,isMeasurementAvailable:u,onScanSuccess:d,isSuccess:m,onVideoUploaded:f}){const{gender:h,shopDomain:g,heightInCm:p,deviceFocalLength:x,userName:y,email:S,scanType:v}=r,b=[a.CLOTHING_CUSTOM_SCAN,a.CLOTHING_BANNER_SCAN,a.CLOTHING_CUSTOM_FIT_SCAN].includes(v),[C,w]=t.useState(!0),j=t.useCallback(async()=>{try{b&&(await a.swan.auth.addUser({scanId:n,email:S,name:y,gender:h,height:p}),f?.()),s.posthog.capture(g,{scanID:n,email:S,height:p,focalLength:x,clothesFit:"0",gender:h})}catch(e){console.log(e)}},[b]),{translate:N}=t.useContext(a.LanguageContext)||{};t.useEffect(()=>{(l||u)&&j()},[l,u]);const k=m||(c?u&&l:l||u);return e.jsx(i.Box,{className:"flex h-full w-full flex-col ",children:e.jsxs("div",{className:"h-full w-full flex-col items-center justify-center flex",children:[e.jsx(F,{loader:o?.loader,setShowDrawer:w}),e.jsx(i.Drawer,{open:C,onClose:(e,t)=>{},className:"camera-drawer",anchor:"bottom",children:e.jsx("div",{className:"max-w-[28rem] mx-auto w-full h-full flex text-center flex-col justify-between items-center bg-primary rounded-t-[30px] p-[1rem]",style:{background:o?.style?.base?.backgroundColor},children:e.jsxs("div",{className:"w-full h-full flex flex-col",children:[e.jsx(a.Header,{title:N?.(a.LanguageKeys.measurementsBeingTaken),resolvedConfig:o}),e.jsx("div",{className:"flex items-center justify-center flex-1",children:e.jsx("video",{preload:"auto",className:"max-h-[calc(100vh-450px)] mx-auto w-full object-contain border-none",muted:!0,loop:!0,autoPlay:!0,playsInline:!0,children:e.jsx("source",{src:h===a.GenderType.Male?a.maleMeasurementProgress:a.measurementProgress,type:"video/mp4"})})}),k&&e.jsx(a.SpecificButton,{resolvedConfig:o,className:"!w-[180px] mx-auto",buttonText:N?.(a.LanguageKeys.next),buttonFunc:()=>{d?.(),f?.()}})]})})})]})})}const T=()=>{const{userDetails:s,config:n,onRetry:r,isError:o,isSuccess:c,onScanSuccess:l,gender:u,scanUniqueKey:d,scanFailsError:m,setScanUniqueKey:f,setIsVideoUploaded:h,isMeasurementAvailable:g,isVideoUploadedCorrect:p,loading:x,showDeniedModal:y,uploadLoading:S,setScanFailsError:v,setScanStartTime:b,handleShowStreamCamera:C,onVideoUploaded:w}=t.useContext(a.ParamsContext),{setPreferredLanguage:k}=t.useContext(a.LanguageContext)||{},T=a.useLocalConfig(n);return t.useEffect(()=>{k?.(T?.language)},[T]),o?e.jsxs(e.Fragment,{children:[e.jsx(F,{}),e.jsx(i.Drawer,{anchor:"bottom",open:!0,className:"camera-drawer",onClose:(e,t)=>{},children:e.jsx(E,{scanFailsError:m||o,onNext:()=>{r?.(),C()},setScanUniqueKey:f,gender:u,resolvedConfig:T,setIsVideoUploaded:h})})]}):c?e.jsx(D,{isFaceScan:!1,scanId:d,isMeasurementAvailable:g,userDetails:s,isVideoUploadedCorrect:p,config:T,isSuccess:c,onVideoUploaded:w}):x?e.jsx("div",{className:"flex top-0 !mt-0 left-0 z-[999] absolute justify-center items-center w-full h-full",style:{background:T?.style?.base?.backgroundColor},children:e.jsx(a.LoadingScreen,{url:T?.loader,loaderType:"black"})}):y.disabled?e.jsx(N,{}):S||m||g||p?(S||g||p)&&!m?e.jsx(D,{isFaceScan:!1,scanId:d,isMeasurementAvailable:g,userDetails:s,onScanSuccess:l,isVideoUploadedCorrect:p,config:T,onVideoUploaded:w}):e.jsxs(e.Fragment,{children:[e.jsx(F,{}),e.jsx(i.Drawer,{anchor:"bottom",open:!0,className:"camera-drawer",onClose:(e,t)=>{},children:e.jsx(E,{scanFailsError:m,onNext:()=>{r?.(),C()},setScanUniqueKey:f,gender:u,resolvedConfig:T,setIsVideoUploaded:h})})]}):e.jsx(j,{config:T,scanID:d,userDetails:s,setIsVideoUploaded:h,setScanFailsError:v,setScanStartTime:b,setScanUniqueKey:f})};exports.BodyScan=({userDetails:n,config:r,onRetry:o,onScanError:i,isError:c,isSuccess:l,onScanSuccess:u,onVideoUploaded:d})=>{const{gender:m,scanType:h,shopDomain:g,heightInCm:p,email:x,deviceFocalLength:y,deviceModelName:S,callbackUrl:v}=n,[b,C]=t.useState(!1),[w,j]=t.useState(!1),[N,F]=t.useState(!1),[k,E]=t.useState({disabled:!1,message:""}),[D,I]=t.useState(""),[L,M]=t.useState(!1),[_,A]=t.useState(!0),[P,U]=t.useState(!1),[$,R]=t.useState(""),[z,K]=t.useState(a.getCurrentTimeInSeconds()),{gyroData:O}=function(e){const[s,a]=t.useState([]),[n,r]=t.useState(!1),o=t.useCallback(e=>{try{const{alpha:t,beta:s,gamma:n}=e;a(e=>[...e,{alpha:t?.toString()||void 0,beta:s?.toString()||void 0,gamma:n?.toString()||void 0,timestamp:(new Date).toISOString()}])}catch(e){console.log(e)}},[]),i=t.useCallback(async()=>{const e=DeviceOrientationEvent;if(void 0!==e&&"function"==typeof e.requestPermission)try{"granted"===await e.requestPermission()?r(!0):console.warn("Device orientation permission denied.")}catch(e){console.error("Error requesting device orientation permission:",e)}else r(!0)},[]);return t.useEffect(()=>(e&&n?window.addEventListener("deviceorientation",o):a([]),()=>{window.removeEventListener("deviceorientation",o)}),[e,n,o]),t.useEffect(()=>{e&&i()},[e,i]),{gyroData:s}}(P),V=t.useCallback(()=>{R(a.generateUuid()),I(""),C(!1),M(!1)},[]),q=e=>{i({...e,message:a.handleErrorMessage(e)}),B(),F(!1),I(e),j(!1),a.handleScanTimeCapture({eventName:`${g}/measurement_failed/fit-view`,scanID:$,status:"failed",email:x,message:a.handleErrorMessage(e)}),z&&a.handleScanTimeCapture({eventName:`${g}/scan_completion_time`,scanID:$,status:"failed",completionTime:a.getCurrentTimeInSeconds()-z,email:x})},B=()=>{K(null),R("")},W=t.useCallback(async e=>{if(e&&"success"===e?.scanStatus&&"intermediate"===e?.resultType&&200===e?.code)return a.handleScanTimeCapture({eventName:`${g}/measurement_success/intermediate`,scanID:$,status:"success",email:x}),void j(!0);j(!0),B();const t=$;F(!0),a.handleScanTimeCapture({eventName:`${g}/measurement_success/fit-view`,scanID:t,status:"success",email:x}),z&&a.handleScanTimeCapture({eventName:`${g}/scan_completion_time`,scanID:t,status:"success",completionTime:a.getCurrentTimeInSeconds()-z,email:x})},[h,g,$]),H=e=>{F(!1),I(""),j(!1),a.swan.measurement.handleMeasurementSocket({scanId:e||$,onPreopen:()=>{a.handleWebSocketCapture({eventName:`${g}/webSocket`,scanID:$,connection:"pre_open",type:"measurement_recommendation",email:x})},onOpen:()=>{a.handleWebSocketCapture({eventName:`${g}/webSocket`,scanID:$,connection:"open",type:"measurement_recommendation",email:x})},onClose:()=>a.handleWebSocketCapture({eventName:`${g}/webSocket`,scanID:$,connection:"close",type:"measurement_recommendation",email:x}),onError:e=>{q(e),a.handleWebSocketCapture({eventName:`${g}/webSocket`,scanID:$,connection:"error",type:"measurement_recommendation",email:x})},onSuccess:e=>{a.handleWebSocketCapture({eventName:`${g}/webSocket`,scanID:$,connection:"success",type:"measurement_recommendation",email:x}),W(e)}})},G=t.useCallback(async e=>{const t=a.createObjectMetadataArray({gender:m,focal_length:`${y}`,height:`${p}`,customer_store_url:g,clothes_fit:"0",scan_type:h,callback_url:v});a.handleScanTimeCapture({eventName:`${g}/body_scan_meta_data`,scanID:$,email:x,data:JSON.stringify(t)});try{await a.swan.fileUpload.uploadFileFrontend({file:e,arrayMetaData:t,scanId:$,email:x}),await a.swan.fileUpload.setDeviceInfo({model:S,detection:"manual",gyro:O,scanId:$}),console.log("video successfully uploaded"),M(!1),a.handleScanTimeCapture({eventName:`${g}/scan_success`,scanID:$,status:"success",email:x,data:JSON.stringify(t)}),a.handleScanTimeCapture({eventName:"scan finished",scanID:$,status:"success",email:x}),K(a.getCurrentTimeInSeconds()),setTimeout(()=>{M(!0)},3e3)}catch(e){a.handleScanTimeCapture({eventName:"scan finished",scanID:$,status:"failed",email:x,message:a.handleErrorMessage(e)}),a.handleScanTimeCapture({eventName:`${g}/scan_failed`,scanID:$,status:"failed",email:x,message:a.handleErrorMessage(e),data:JSON.stringify(t)}),I(a.handleErrorMessage(e)),M(!1),i?.({message:a.handleErrorMessage(e)}),B()}finally{U(!1)}},[$,O]),J=t.useCallback(async e=>{try{const t=await a.swan.measurement.getMeasurementResult(e),s=t?.data?.isMeasured,n=z||a.getCurrentTimeInSeconds(),r=a.getCurrentTimeInSeconds(),o=300;if(A(!1),!1===s)return B(),void R(a.generateUuid());C(!0),!0===s?await W(null):null===s&&n>r+o?q(t?.data?.error):H(e)}catch(e){console.log(e),B(),R(a.generateUuid()),C(!1)}},[q,W,R]),Q=t.useCallback(async()=>{if(+p<152.4||+p>213.36)return void i({message:"Height must be between 152.4cm (5ft) and 213.36cm (7ft)"});const e=await a.checkCameraPermission();if(e.disabled)a.handleScanTimeCapture({eventName:`${g}/camera_activation`,scanID:$,status:"failed",email:x}),A(!1);else{$?J($):A(!1),a.handleScanTimeCapture({eventName:`${g}/camera_activation`,scanID:$,status:"success",email:x})}E(e),I(""),M(!1)},[J,x,$,R,g]);return t.useEffect(()=>{s.init(a.posthogPublicKey,{api_host:a.posthogPublicHost}),s.capture("$pageview")},[]),t.useEffect(()=>{c||l||g&&Q()},[g,p,c,l]),t.useEffect(()=>{c||l||L&&g&&$&&H()},[L,g,$,c,l]),e.jsx(a.LanguageContextProvider,{children:e.jsx(f,{children:e.jsx(a.ParamsContext.Provider,{value:{userDetails:n,config:r,onRetry:o,onScanError:i,isError:c,isSuccess:l,onScanSuccess:u,gender:m,scanUniqueKey:$,scanFailsError:D,setScanUniqueKey:R,setIsVideoUploaded:M,isMeasurementAvailable:N,isVideoUploadedCorrect:w,loading:_,showDeniedModal:k,uploadLoading:b,setStartGyro:U,handleFileUpload:G,setUploadLoading:C,handleShowStreamCamera:V,setScanFailsError:I,setScanStartTime:K,onVideoUploaded:d},children:e.jsx(T,{})})})})};
2
+ //# sourceMappingURL=BodyScan-D3sbCXE3.js.map