@subiz/widget-v4 4.1.68 → 4.1.70

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 (96) hide show
  1. package/compiled_src/chatbox/Rating.js +7 -3
  2. package/compiled_src/chatbox/Widget.js +16 -15
  3. package/compiled_src/plugin.js +9 -18
  4. package/dist/132.js +2796 -0
  5. package/dist/18e74ca84ff.132.js +1 -0
  6. package/dist/18e74ca84ff.27.js +1 -0
  7. package/dist/18e74ca84ff.278.js +1 -0
  8. package/dist/18e74ca84ff.459.js +1 -0
  9. package/dist/18e74ca84ff.490.js +1 -0
  10. package/dist/18e74ca84ff.497.js +1 -0
  11. package/dist/18e74ca84ff.74.js +1 -0
  12. package/dist/18e74ca84ff.997.js +1 -0
  13. package/dist/18e74ca84ff.app.js +1 -0
  14. package/dist/18e74ca84ff.index.html +33 -0
  15. package/dist/18e74ca84ff.library.html +33 -0
  16. package/dist/18e74ca84ff.library.js +1 -0
  17. package/dist/18e74ca84ff.preview.html +759 -0
  18. package/dist/18e74ca84ff.preview.js +1 -0
  19. package/dist/18e74ca84ff.screenshoot.js +1 -0
  20. package/dist/18e74ca84ff.webview.js +1 -0
  21. package/dist/27.js +107 -0
  22. package/dist/278.js +406 -0
  23. package/dist/459.js +107 -0
  24. package/dist/490.js +304 -0
  25. package/dist/497.js +6721 -0
  26. package/dist/74.js +372 -0
  27. package/dist/997.js +107 -0
  28. package/dist/HASH +1 -0
  29. package/dist/assets/img/Facebook.64607ec.png +0 -0
  30. package/dist/assets/img/Zalo.6845707.png +0 -0
  31. package/dist/assets/img/award1a.1a58e10.png +0 -0
  32. package/dist/assets/img/award3a.3b74423.png +0 -0
  33. package/dist/assets/img/award4a.ed6ccd4.png +0 -0
  34. package/dist/assets/img/award5.39eb7ae.png +0 -0
  35. package/dist/assets/img/bubble_default.7d5e4ab.svg +20 -0
  36. package/dist/assets/img/caret.998eb8f.svg +1 -0
  37. package/dist/assets/img/convos_empty.2353007.svg +72 -0
  38. package/dist/assets/img/default.06e6ee0.jpg +0 -0
  39. package/dist/assets/img/default_avatar.5b74dc1.png +0 -0
  40. package/dist/assets/img/done_gray.d7e8203.svg +4 -0
  41. package/dist/assets/img/done_green.b817fd4.svg +4 -0
  42. package/dist/assets/img/emoji/messenger/sub_23.529_58.824.d5faf14.png +0 -0
  43. package/dist/assets/img/emoji/messenger/sub_23.529_60.784.1420241.png +0 -0
  44. package/dist/assets/img/emoji/messenger/sub_25.490_0.000.1e6b2c0.png +0 -0
  45. package/dist/assets/img/emoji/messenger/sub_25.490_45.098.3dfbc08.png +0 -0
  46. package/dist/assets/img/emoji/messenger/sub_25.490_5.882.4b49e94.png +0 -0
  47. package/dist/assets/img/emoji/messenger/sub_27.451_72.549.7114f58.png +0 -0
  48. package/dist/assets/img/emoji/messenger/sub_27.451_84.314.231e2b7.png +0 -0
  49. package/dist/assets/img/emoji/messenger/sub_27.451_96.078.ddbb008.png +0 -0
  50. package/dist/assets/img/emoji/messenger/sub_29.412_5.882.61f3359.png +0 -0
  51. package/dist/assets/img/emoji/messenger/sub_58.824_100.000.6df72bc.png +0 -0
  52. package/dist/assets/img/emoji/messenger/sub_58.824_45.098.3d7a7ad.png +0 -0
  53. package/dist/assets/img/emoji/messenger/sub_58.824_47.059.0f4d6e2.png +0 -0
  54. package/dist/assets/img/emoji/messenger/sub_58.824_54.902.65724c1.png +0 -0
  55. package/dist/assets/img/emoji/messenger/sub_58.824_64.706.9da3cba.png +0 -0
  56. package/dist/assets/img/emoji/messenger/sub_58.824_72.549.edca5cf.png +0 -0
  57. package/dist/assets/img/emoji/messenger/sub_58.824_78.431.f910f2a.png +0 -0
  58. package/dist/assets/img/emoji/messenger/sub_58.824_88.235.def4e71.png +0 -0
  59. package/dist/assets/img/emoji/messenger/sub_60.784_11.765.49c03d0.png +0 -0
  60. package/dist/assets/img/emoji/messenger/sub_60.784_27.451.46b54e5.png +0 -0
  61. package/dist/assets/img/emoji/messenger/sub_60.784_29.412.e36d284.png +0 -0
  62. package/dist/assets/img/emoji/messenger/sub_60.784_3.922.bb191b0.png +0 -0
  63. package/dist/assets/img/emoji/messenger/sub_60.784_35.294.af7b927.png +0 -0
  64. package/dist/assets/img/emoji/messenger/sub_60.784_7.843.98f2a99.png +0 -0
  65. package/dist/assets/img/empty.29bed2d.svg +23 -0
  66. package/dist/assets/img/empty_1.0b98af0.svg +11 -0
  67. package/dist/assets/img/examplte_logo.f86535f.svg +1 -0
  68. package/dist/assets/img/external-link.90577cc.svg +1 -0
  69. package/dist/assets/img/fb_inverse_circle.36c2cfc.png +0 -0
  70. package/dist/assets/img/ghn.070f8e3.svg +17 -0
  71. package/dist/assets/img/ghtk.326eac1.svg +18 -0
  72. package/dist/assets/img/image_default.be0698b.png +0 -0
  73. package/dist/assets/img/info.ebce7ea.svg +1 -0
  74. package/dist/assets/img/loader.37000a7.svg +1 -0
  75. package/dist/assets/img/loading_static.a27f0ac.svg +10 -0
  76. package/dist/assets/img/main-service1.d536cc2.png +0 -0
  77. package/dist/assets/img/main-service2.9b99549.png +0 -0
  78. package/dist/assets/img/not_found_search.2ddb8d1.png +0 -0
  79. package/dist/assets/img/package.8d37d0f.svg +5 -0
  80. package/dist/assets/img/package_fade.763c001.svg +1 -0
  81. package/dist/assets/img/rating--average.1ea492c.svg +12 -0
  82. package/dist/assets/img/rating--great.e3d712e.svg +16 -0
  83. package/dist/assets/img/rating--poor.2938a25.svg +12 -0
  84. package/dist/assets/img/search.f9705ff.svg +1 -0
  85. package/dist/assets/img/send.6db52a9.svg +3 -0
  86. package/dist/assets/img/shop.f7dc7d8.svg +1 -0
  87. package/dist/assets/img/shop_faded.df7845a.svg +1 -0
  88. package/dist/assets/img/subiz-mono.877e9f5.svg +3 -0
  89. package/dist/assets/img/x.26fdfa3.svg +5 -0
  90. package/dist/malicious-app.js +15 -0
  91. package/dist/screenshoot.html +7 -0
  92. package/dist/screenshoot.js +6354 -0
  93. package/package.json +1 -1
  94. package/src/chatbox/Rating.js +8 -4
  95. package/src/chatbox/Widget.js +4 -4
  96. package/src/plugin.js +9 -18
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[459],{5488:(n,t,o)=>{o.r(t),o.d(t,{default:()=>a});const a=o(4056)},4056:(n,t,o)=>{o.r(t),o.d(t,{default:()=>e});var a=o(6314),r=o.n(a)()((function(n){return n[1]}));r.push([n.id,"@font-face {\n font-family: 'Dancing Script';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dancingscript/v25/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BMSoHTQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Dancing Script';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dancingscript/v25/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7BAyoHTQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Dancing Script';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/dancingscript/v25/If2cXTr6YS-zF4S-kcSWSVi_sxjsohD9F50Ruu7B7y0HTQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'EB Garamond';\n font-style: italic;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/ebgaramond/v27/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7e8QI96.ttf) format('truetype');\n}\n@font-face {\n font-family: 'EB Garamond';\n font-style: italic;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/ebgaramond/v27/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7eOQI96.ttf) format('truetype');\n}\n@font-face {\n font-family: 'EB Garamond';\n font-style: italic;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/ebgaramond/v27/SlGFmQSNjdsmc35JDF1K5GRwUjcdlttVFm-rI7diR496.ttf) format('truetype');\n}\n@font-face {\n font-family: 'EB Garamond';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/ebgaramond/v27/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-6_RUAw.ttf) format('truetype');\n}\n@font-face {\n font-family: 'EB Garamond';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/ebgaramond/v27/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-2fRUAw.ttf) format('truetype');\n}\n@font-face {\n font-family: 'EB Garamond';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/ebgaramond/v27/SlGDmQSNjdsmc35JDF1K5E55YMjF_7DPuGi-NfNUAw.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Inconsolata';\n font-style: normal;\n font-weight: 300;\n font-stretch: normal;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/inconsolata/v32/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp9s8aRo.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Inconsolata';\n font-style: normal;\n font-weight: 400;\n font-stretch: normal;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/inconsolata/v32/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8aRo.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Inconsolata';\n font-style: normal;\n font-weight: 500;\n font-stretch: normal;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/inconsolata/v32/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp7c8aRo.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: italic;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUFjIg1_i6t8kCHKm459Wx7xQYXK0vOoz6jq_p9aX8.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: italic;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUFjIg1_i6t8kCHKm459Wx7xQYXK0vOoz6jq6R9aX8.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: italic;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUFjIg1_i6t8kCHKm459Wx7xQYXK0vOoz6jq5Z9aX8.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: italic;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUFjIg1_i6t8kCHKm459Wx7xQYXK0vOoz6jq3p6aX8.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: italic;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUFjIg1_i6t8kCHKm459Wx7xQYXK0vOoz6jq0N6aX8.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCs16Ew-.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtr6Ew-.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCtZ6Ew-.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCu170w-.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/montserrat/v26/JTUHjIg1_i6t8kCHKm4532VJOt5-QNFgpCuM70w-.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: italic;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TjARc9.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: italic;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOkCnqEu92Fr1Mu52xP.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: italic;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51S7ABc9.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: italic;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOjCnqEu92Fr1Mu51TzBhc9.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmSU5vAw.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Me5Q.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmEU9vAw.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Roboto';\n font-style: normal;\n font-weight: 700;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/roboto/v30/KFOlCnqEu92Fr1MmWUlvAw.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Signika';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/signika/v25/vEF72_JTCgwQ5ejvMV0Ox_Kg1UwJ0tKfX4zNpD8E4ASzH1r93zuYzQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Signika';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/signika/v25/vEF72_JTCgwQ5ejvMV0Ox_Kg1UwJ0tKfX4zNpD8E4ASzH1r9gTuYzQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Signika';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/signika/v25/vEF72_JTCgwQ5ejvMV0Ox_Kg1UwJ0tKfX4zNpD8E4ASzH1r9szuYzQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Signika';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/signika/v25/vEF72_JTCgwQ5ejvMV0Ox_Kg1UwJ0tKfX4zNpD8E4ASzH1r9XzyYzQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Source Serif Pro';\n font-style: italic;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/sourceserifpro/v17/neIVzD-0qpwxpaWvjeD0X88SAOeauXEGCSmqwQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Source Serif Pro';\n font-style: italic;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/sourceserifpro/v17/neIWzD-0qpwxpaWvjeD0X88SAOeauXE-pQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Source Serif Pro';\n font-style: italic;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/sourceserifpro/v17/neIVzD-0qpwxpaWvjeD0X88SAOeauXEGfS-qwQ.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Source Serif Pro';\n font-style: normal;\n font-weight: 300;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/sourceserifpro/v17/neIXzD-0qpwxpaWvjeD0X88SAOeasd8chSs.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Source Serif Pro';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/sourceserifpro/v17/neIQzD-0qpwxpaWvjeD0X88SAOeaiXM.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Source Serif Pro';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/sourceserifpro/v17/neIXzD-0qpwxpaWvjeD0X88SAOeasasahSs.ttf) format('truetype');\n}\n@font-face {\n font-family: 'Yeseva One';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(https://fonts.gstatic.com/s/yesevaone/v22/OpNJno4ck8vc-xYpwWWxpio.ttf) format('truetype');\n}\n#sbz92 * {\n all: unset !important;\n}\n#sbz92 {\n z-index: 2000000100 !important;\n /* Handle on hover */\n}\n#sbz92 *,\n#sbz92 *::before,\n#sbz92 *::after {\n box-sizing: border-box !important;\n}\n#sbz92 [tabindex='-1']:focus:not(:focus-visible) {\n outline: 0 !important;\n}\n#sbz92 b,\n#sbz92 strong {\n font-weight: 500 !important;\n}\n#sbz92 a {\n color: #020202 !important;\n text-decoration: none !important;\n background-color: transparent !important;\n}\n#sbz92 a:hover {\n cursor: pointer !important;\n color: #000000 !important;\n text-decoration: underline !important;\n}\n#sbz92 a:not([href]) {\n color: inherit !important;\n text-decoration: none !important;\n}\n#sbz92 a:not([href]):hover {\n color: inherit !important;\n text-decoration: none !important;\n}\n#sbz92 img {\n vertical-align: middle !important;\n border-style: none !important;\n}\n#sbz92 svg {\n overflow: hidden !important;\n vertical-align: middle !important;\n}\n#sbz92 label {\n display: inline-block !important;\n}\n#sbz92 button {\n border-radius: 0 !important;\n}\n#sbz92 button:focus {\n outline: 1px dotted !important;\n outline: 5px auto -webkit-focus-ring-color !important;\n}\n#sbz92 input,\n#sbz92 button,\n#sbz92 select,\n#sbz92 optgroup,\n#sbz92 textarea {\n margin: 0 !important;\n}\n#sbz92 button,\n#sbz92 input {\n overflow: visible !important;\n}\n#sbz92 button,\n#sbz92 select {\n text-transform: none !important;\n}\n#sbz92 select {\n word-wrap: normal !important;\n}\n#sbz92 button,\n#sbz92 [type=\"button\"],\n#sbz92 [type=\"reset\"],\n#sbz92 [type=\"submit\"] {\n -webkit-appearance: button !important;\n}\n#sbz92 button:not(:disabled),\n#sbz92 [type='button']:not(:disabled),\n#sbz92 [type='reset']:not(:disabled),\n#sbz92 [type='submit']:not(:disabled) {\n cursor: pointer !important;\n}\n#sbz92 button::-moz-focus-inner,\n#sbz92 [type='button']::-moz-focus-inner,\n#sbz92 [type='reset']::-moz-focus-inner,\n#sbz92 [type='submit']::-moz-focus-inner {\n padding: 0 !important;\n border-style: none !important;\n}\n#sbz92 input[type='radio'],\n#sbz92 input[type='checkbox'] {\n box-sizing: border-box !important;\n padding: 0 !important;\n}\n#sbz92 input[type='date'],\n#sbz92 input[type='time'],\n#sbz92 input[type='datetime-local'],\n#sbz92 input[type='month'] {\n -webkit-appearance: listbox !important;\n}\n#sbz92 textarea {\n overflow: auto !important;\n resize: vertical !important;\n}\n#sbz92 [type='number']::-webkit-inner-spin-button,\n#sbz92 [type='number']::-webkit-outer-spin-button {\n height: auto !important;\n}\n#sbz92 [hidden] {\n display: none !important;\n}\n#sbz92 ::-webkit-input-placeholder {\n /* Edge */\n color: #777 !important;\n}\n#sbz92 :-ms-input-placeholder {\n /* Internet Explorer 10-11 */\n color: #777 !important;\n}\n#sbz92 ::placeholder {\n color: #777 !important;\n}\n#sbz92 div {\n display: block !important;\n text-rendering: geometricPrecision !important;\n -webkit-font-smoothing: antialiased !important;\n -moz-osx-font-smoothing: grayscale !important;\n}\n#sbz92 ::-webkit-scrollbar {\n width: 7px !important;\n height: 7px !important;\n}\n#sbz92 ::-webkit-scrollbar-track {\n border-radius: 10px !important;\n}\n#sbz92 ::-webkit-scrollbar-thumb {\n border-radius: 10px !important;\n background: #d6d6d6 !important;\n}\n#sbz92 ::-webkit-scrollbar-thumb:hover {\n background: #aaa !important;\n}\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n#sbz92 .fadeOut {\n animation-name: fadeOut !important;\n animation-duration: 150ms !important;\n}\n@keyframes fadeInDownCenter {\n from {\n opacity: 0;\n transform: translate3d(0, -2000px, 0) translateX(-50%);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0) translateX(-50%);\n }\n}\n#sbz92 .fadeInDownCenter {\n animation-name: fadeInDownCenter !important;\n animation-duration: 0.25s !important;\n}\n@keyframes fadeInUpCenter {\n from {\n opacity: 0;\n transform: translate3d(0, 400px, 0) translateX(-50%);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0) translateX(-50%);\n }\n}\n#sbz92 .fadeInUpCenter {\n animation-name: fadeInUpCenter !important;\n animation-duration: 0.25s !important;\n}\n@keyframes fadeInDown {\n from {\n opacity: 0;\n transform: translate3d(0, -1000px, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }\n}\n#sbz92 .fadeInDown {\n animation-name: fadeInDown !important;\n animation-duration: 0.5s !important;\n}\n@keyframes fadeInUpBig {\n from {\n opacity: 0;\n transform: translate3d(0, 400px, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }\n}\n#sbz92 .fadeInUpBig {\n animation-name: fadeInUpBig !important;\n animation-duration: 0.25s !important;\n}\n@keyframes fadeInRightBig {\n from {\n opacity: 0;\n transform: translateY(-50%) translateX(200px);\n }\n to {\n opacity: 1;\n transform: translateY(-50%) translateX(0px);\n }\n}\n#sbz92 .fadeInRightBig {\n animation-name: fadeInRightBig !important;\n animation-duration: 0.5s !important;\n}\n@keyframes fadeInLeftBig {\n from {\n opacity: 0;\n transform: translateY(-50%) translateX(-200px);\n }\n to {\n opacity: 1;\n transform: translateY(-50%) translateX(0px);\n }\n}\n#sbz92 .fadeInLeftBig {\n animation-name: fadeInLeftBig !important;\n animation-duration: 0.5s !important;\n}\n@keyframes zoomIn {\n from {\n opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5);\n }\n 50% {\n opacity: 1;\n }\n}\n#sbz92 .zoomIn {\n animation-name: zoomIn !important;\n transform-origin: top left !important;\n animation-duration: 0.15s !important;\n}\n@keyframes zoomOutCenter {\n from {\n opacity: 1;\n }\n 80% {\n opacity: 0.7;\n transform: scale3d(0.5, 0.5, 0.5) translateY(-50%) translateX(-50%);\n }\n}\n#sbz92 .zoomOutCenter {\n animation-name: zoomOutCenter !important;\n transform-origin: top left !important;\n animation-duration: 300ms !important;\n}\n@keyframes zoomInCenter {\n from {\n opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5) translateY(-50%) translateX(-50%);\n }\n 50% {\n opacity: 1;\n }\n}\n#sbz92 .zoomInCenter {\n animation-name: zoomInCenter !important;\n transform-origin: top left !important;\n animation-duration: 0.15s !important;\n}\n@keyframes zoomDownYX {\n 0% {\n transform: scaleY(1);\n }\n 50% {\n transform: scaleY(0.01) scaleZ(1);\n }\n 100% {\n transform: scaleY(0.01) scaleX(0) scaleZ(0);\n }\n}\n#sbz92 .zoomDownYX {\n animation-duration: 0.5s !important;\n animation-name: zoomDownYX !important;\n}\n@keyframes zoomUpYX {\n 0% {\n transform: scaleY(0.01) scaleX(0) scaleZ(0);\n }\n 50% {\n transform: scaleY(0.01) scaleZ(1);\n }\n 100% {\n transform: scaleY(1);\n }\n}\n#sbz92 .zoomUpYX {\n animation-duration: 0.5s !important;\n animation-name: zoomUpYX !important;\n}\n@keyframes bounceIn {\n from,\n 20%,\n 40%,\n 60%,\n 80%,\n to {\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n }\n 0% {\n opacity: 0;\n transform: scale3d(0.3, 0.3, 0.3);\n }\n 20% {\n transform: scale3d(1.1, 1.1, 1.1);\n }\n 40% {\n transform: scale3d(0.9, 0.9, 0.9);\n }\n 60% {\n opacity: 1;\n transform: scale3d(1.03, 1.03, 1.03);\n }\n 80% {\n transform: scale3d(0.97, 0.97, 0.97);\n }\n to {\n opacity: 1;\n transform: scale3d(1, 1, 1);\n }\n}\n#sbz92 .bounceIn {\n animation-duration: 0.5s !important;\n animation-name: bounceIn !important;\n}\n@keyframes shake {\n 0% {\n transform: skewX(-15deg);\n }\n 5% {\n transform: skewX(15deg);\n }\n 10% {\n transform: skewX(-15deg);\n }\n 15% {\n transform: skewX(15deg);\n }\n 20% {\n transform: skewX(0deg);\n }\n 100% {\n transform: skewX(0deg);\n }\n}\n#sbz92 .notif {\n cursor: pointer !important;\n font-family: Inter !important;\n font-size: 14px !important;\n position: absolute !important;\n user-select: none !important;\n}\n#sbz92 .notif__bottom-left {\n bottom: 20px !important;\n left: 20px !important;\n}\n#sbz92 .notif__top-left {\n top: 20px !important;\n left: 20px !important;\n}\n#sbz92 .notif__top-right {\n top: 20px !important;\n right: 40px !important;\n}\n#sbz92 .notif__bottom-right {\n bottom: 20px !important;\n right: 40px !important;\n}\n#sbz92 .notif__bottom-center {\n transform: translateX(-50%) !important;\n left: 50% !important;\n bottom: 20px !important;\n}\n#sbz92 .notif__top-center {\n transform: translateX(-50%) !important;\n left: 50% !important;\n top: 20px !important;\n}\n#sbz92 .notif_avatar {\n margin-left: 15px !important;\n margin-top: 10px !important;\n margin-bottom: 10px !important;\n overflow: hidden !important;\n width: 70px !important;\n height: 70px !important;\n z-index: 1 !important;\n}\n#sbz92 .notif_avatar__img {\n width: 100% !important;\n height: 100% !important;\n object-fit: cover !important;\n}\n#sbz92 .notif_body {\n z-index: 1 !important;\n display: flex !important;\n flex-direction: column !important;\n justify-content: center !important;\n position: relative !important;\n padding-top: 10px !important;\n padding-left: 20px !important;\n padding-bottom: 30px !important;\n padding-right: 30px !important;\n width: 235px !important;\n height: 100px !important;\n overflow: hidden !important;\n}\n#sbz92 .btn_close {\n background: white !important;\n padding: 0 !important;\n right: -25px !important;\n top: 0px !important;\n position: absolute !important;\n z-index: 10 !important;\n cursor: pointer !important;\n transition: background-color 0.2s ease-out !important;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 12px 28px 0px, rgba(0, 0, 0, 0.1) 0px 2px 4px 0px, rgba(255, 255, 255, 0.5) 0px 0px 0px 1px inset !important;\n border: none !important;\n width: 20px !important;\n height: 20px !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n border-radius: 50% !important;\n opacity: 0.7 !important;\n}\n#sbz92 .btn_close:hover {\n opacity: 1 !important;\n}\n#sbz92 .btn_close__icon {\n stroke: #444 !important;\n height: 16px !important;\n width: 16px !important;\n border: 0px !important;\n}\n#sbz92 .notif_bg {\n z-index: 0 !important;\n position: absolute !important;\n top: 50% !important;\n left: 50% !important;\n transform: translate(-50%, -50%) !important;\n}\n#sbz92 .notif_time {\n position: absolute !important;\n bottom: 15px !important;\n left: 20px !important;\n font-size: 12px !important;\n opacity: 0.5 !important;\n}\n#sbz92 .notif_title {\n white-space: nowrap !important;\n flex-shrink: 0 !important;\n text-overflow: ellipsis !important;\n overflow: hidden !important;\n}\n#sbz92 .notif_message {\n text-overflow: ellipsis !important;\n margin-top: 5px !important;\n overflow: hidden !important;\n}\ndiv#sbz92 {\n all: initial;\n}\nbody div#sbz92 {\n all: initial !important;\n}\n#sbz92 {\n z-index: 2000000100 !important;\n /* Handle on hover */\n}\n#sbz92 *,\n#sbz92 *::before,\n#sbz92 *::after {\n box-sizing: border-box;\n}\n#sbz92 [tabindex='-1']:focus:not(:focus-visible) {\n outline: 0;\n}\n#sbz92 b,\n#sbz92 strong {\n font-weight: 500;\n}\n#sbz92 a {\n color: #020202;\n text-decoration: none;\n background-color: transparent;\n}\n#sbz92 a:hover {\n cursor: pointer;\n color: #000000;\n text-decoration: underline;\n}\n#sbz92 a:not([href]) {\n color: inherit;\n text-decoration: none;\n}\n#sbz92 a:not([href]):hover {\n color: inherit;\n text-decoration: none;\n}\n#sbz92 img {\n vertical-align: middle;\n border-style: none;\n}\n#sbz92 svg {\n overflow: hidden;\n vertical-align: middle;\n}\n#sbz92 label {\n display: inline-block;\n}\n#sbz92 button {\n border-radius: 0;\n}\n#sbz92 button:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n#sbz92 input,\n#sbz92 button,\n#sbz92 select,\n#sbz92 optgroup,\n#sbz92 textarea {\n margin: 0;\n}\n#sbz92 button,\n#sbz92 input {\n overflow: visible;\n}\n#sbz92 button,\n#sbz92 select {\n text-transform: none;\n}\n#sbz92 select {\n word-wrap: normal;\n}\n#sbz92 button,\n#sbz92 [type=\"button\"],\n#sbz92 [type=\"reset\"],\n#sbz92 [type=\"submit\"] {\n -webkit-appearance: button;\n}\n#sbz92 button:not(:disabled),\n#sbz92 [type='button']:not(:disabled),\n#sbz92 [type='reset']:not(:disabled),\n#sbz92 [type='submit']:not(:disabled) {\n cursor: pointer;\n}\n#sbz92 button::-moz-focus-inner,\n#sbz92 [type='button']::-moz-focus-inner,\n#sbz92 [type='reset']::-moz-focus-inner,\n#sbz92 [type='submit']::-moz-focus-inner {\n padding: 0;\n border-style: none;\n}\n#sbz92 input[type='radio'],\n#sbz92 input[type='checkbox'] {\n box-sizing: border-box;\n padding: 0;\n}\n#sbz92 input[type='date'],\n#sbz92 input[type='time'],\n#sbz92 input[type='datetime-local'],\n#sbz92 input[type='month'] {\n -webkit-appearance: listbox;\n}\n#sbz92 textarea {\n overflow: auto;\n resize: vertical;\n}\n#sbz92 [type='number']::-webkit-inner-spin-button,\n#sbz92 [type='number']::-webkit-outer-spin-button {\n height: auto;\n}\n#sbz92 [hidden] {\n display: none;\n}\n#sbz92 ::-webkit-input-placeholder {\n /* Edge */\n color: #777;\n}\n#sbz92 :-ms-input-placeholder {\n /* Internet Explorer 10-11 */\n color: #777;\n}\n#sbz92 ::placeholder {\n color: #777;\n}\n#sbz92 div {\n display: block;\n text-rendering: geometricPrecision;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n#sbz92 ::-webkit-scrollbar {\n width: 7px;\n height: 7px;\n}\n#sbz92 ::-webkit-scrollbar-track {\n border-radius: 10px;\n}\n#sbz92 ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n background: #d6d6d6;\n}\n#sbz92 ::-webkit-scrollbar-thumb:hover {\n background: #aaa;\n}\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n#sbz92 .fadeOut {\n animation-name: fadeOut;\n animation-duration: 150ms;\n}\n@keyframes fadeInDownCenter {\n from {\n opacity: 0;\n transform: translate3d(0, -2000px, 0) translateX(-50%);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0) translateX(-50%);\n }\n}\n#sbz92 .fadeInDownCenter {\n animation-name: fadeInDownCenter;\n animation-duration: 0.25s;\n}\n@keyframes fadeInUpCenter {\n from {\n opacity: 0;\n transform: translate3d(0, 400px, 0) translateX(-50%);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0) translateX(-50%);\n }\n}\n#sbz92 .fadeInUpCenter {\n animation-name: fadeInUpCenter;\n animation-duration: 0.25s;\n}\n@keyframes fadeInDown {\n from {\n opacity: 0;\n transform: translate3d(0, -1000px, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }\n}\n#sbz92 .fadeInDown {\n animation-name: fadeInDown;\n animation-duration: 0.5s;\n}\n@keyframes fadeInUpBig {\n from {\n opacity: 0;\n transform: translate3d(0, 400px, 0);\n }\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }\n}\n#sbz92 .fadeInUpBig {\n animation-name: fadeInUpBig;\n animation-duration: 0.25s;\n}\n@keyframes fadeInRightBig {\n from {\n opacity: 0;\n transform: translateY(-50%) translateX(200px);\n }\n to {\n opacity: 1;\n transform: translateY(-50%) translateX(0px);\n }\n}\n#sbz92 .fadeInRightBig {\n animation-name: fadeInRightBig;\n animation-duration: 0.5s;\n}\n@keyframes fadeInLeftBig {\n from {\n opacity: 0;\n transform: translateY(-50%) translateX(-200px);\n }\n to {\n opacity: 1;\n transform: translateY(-50%) translateX(0px);\n }\n}\n#sbz92 .fadeInLeftBig {\n animation-name: fadeInLeftBig;\n animation-duration: 0.5s;\n}\n@keyframes zoomIn {\n from {\n opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5);\n }\n 50% {\n opacity: 1;\n }\n}\n#sbz92 .zoomIn {\n animation-name: zoomIn;\n transform-origin: top left;\n animation-duration: 0.15s;\n}\n@keyframes zoomOutCenter {\n from {\n opacity: 1;\n }\n 80% {\n opacity: 0.7;\n transform: scale3d(0.5, 0.5, 0.5) translateY(-50%) translateX(-50%);\n }\n}\n#sbz92 .zoomOutCenter {\n animation-name: zoomOutCenter;\n transform-origin: top left;\n animation-duration: 300ms;\n}\n@keyframes zoomInCenter {\n from {\n opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5) translateY(-50%) translateX(-50%);\n }\n 50% {\n opacity: 1;\n }\n}\n#sbz92 .zoomInCenter {\n animation-name: zoomInCenter;\n transform-origin: top left;\n animation-duration: 0.15s;\n}\n@keyframes zoomDownYX {\n 0% {\n transform: scaleY(1);\n }\n 50% {\n transform: scaleY(0.01) scaleZ(1);\n }\n 100% {\n transform: scaleY(0.01) scaleX(0) scaleZ(0);\n }\n}\n#sbz92 .zoomDownYX {\n animation-duration: 0.5s;\n animation-name: zoomDownYX;\n}\n@keyframes zoomUpYX {\n 0% {\n transform: scaleY(0.01) scaleX(0) scaleZ(0);\n }\n 50% {\n transform: scaleY(0.01) scaleZ(1);\n }\n 100% {\n transform: scaleY(1);\n }\n}\n#sbz92 .zoomUpYX {\n animation-duration: 0.5s;\n animation-name: zoomUpYX;\n}\n@keyframes bounceIn {\n from,\n 20%,\n 40%,\n 60%,\n 80%,\n to {\n animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n }\n 0% {\n opacity: 0;\n transform: scale3d(0.3, 0.3, 0.3);\n }\n 20% {\n transform: scale3d(1.1, 1.1, 1.1);\n }\n 40% {\n transform: scale3d(0.9, 0.9, 0.9);\n }\n 60% {\n opacity: 1;\n transform: scale3d(1.03, 1.03, 1.03);\n }\n 80% {\n transform: scale3d(0.97, 0.97, 0.97);\n }\n to {\n opacity: 1;\n transform: scale3d(1, 1, 1);\n }\n}\n#sbz92 .bounceIn {\n animation-duration: 0.5s;\n animation-name: bounceIn;\n}\n@keyframes shake {\n 0% {\n transform: skewX(-15deg);\n }\n 5% {\n transform: skewX(15deg);\n }\n 10% {\n transform: skewX(-15deg);\n }\n 15% {\n transform: skewX(15deg);\n }\n 20% {\n transform: skewX(0deg);\n }\n 100% {\n transform: skewX(0deg);\n }\n}\n#sbz92 .notif {\n cursor: pointer;\n font-family: Inter;\n font-size: 14px;\n position: absolute;\n user-select: none;\n}\n#sbz92 .notif__bottom-left {\n bottom: 20px;\n left: 20px;\n}\n#sbz92 .notif__top-left {\n top: 20px;\n left: 20px;\n}\n#sbz92 .notif__top-right {\n top: 20px;\n right: 40px;\n}\n#sbz92 .notif__bottom-right {\n bottom: 20px;\n right: 40px;\n}\n#sbz92 .notif__bottom-center {\n transform: translateX(-50%);\n left: 50%;\n bottom: 20px;\n}\n#sbz92 .notif__top-center {\n transform: translateX(-50%);\n left: 50%;\n top: 20px;\n}\n#sbz92 .notif_avatar {\n margin-left: 15px;\n margin-top: 10px;\n margin-bottom: 10px;\n overflow: hidden;\n width: 70px;\n height: 70px;\n z-index: 1;\n}\n#sbz92 .notif_avatar__img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n#sbz92 .notif_body {\n z-index: 1;\n display: flex;\n flex-direction: column;\n justify-content: center;\n position: relative;\n padding-top: 10px;\n padding-left: 20px;\n padding-bottom: 30px;\n padding-right: 30px;\n width: 235px;\n height: 100px;\n overflow: hidden;\n}\n#sbz92 .btn_close {\n background: white;\n padding: 0;\n right: -25px;\n top: 0px;\n position: absolute;\n z-index: 10;\n cursor: pointer;\n transition: background-color 0.2s ease-out;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 12px 28px 0px, rgba(0, 0, 0, 0.1) 0px 2px 4px 0px, rgba(255, 255, 255, 0.5) 0px 0px 0px 1px inset;\n border: none;\n width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n opacity: 0.7;\n}\n#sbz92 .btn_close:hover {\n opacity: 1;\n}\n#sbz92 .btn_close__icon {\n stroke: #444;\n height: 16px;\n width: 16px;\n border: 0px;\n}\n#sbz92 .notif_bg {\n z-index: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n#sbz92 .notif_time {\n position: absolute;\n bottom: 15px;\n left: 20px;\n font-size: 12px;\n opacity: 0.5;\n}\n#sbz92 .notif_title {\n white-space: nowrap;\n flex-shrink: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n#sbz92 .notif_message {\n text-overflow: ellipsis;\n margin-top: 5px;\n overflow: hidden;\n}\n",""]);const e=r},6314:n=>{n.exports=function(n){var t=[];return t.toString=function(){return this.map((function(t){var o=n(t);return t[2]?"@media ".concat(t[2]," {").concat(o,"}"):o})).join("")},t.i=function(n,o,a){"string"==typeof n&&(n=[[null,n,""]]);var r={};if(a)for(var e=0;e<this.length;e++){var i=this[e][0];null!=i&&(r[i]=!0)}for(var s=0;s<n.length;s++){var f=[].concat(n[s]);a&&r[f[0]]||(o&&(f[2]?f[2]="".concat(o," and ").concat(f[2]):f[2]=o),t.push(f))}},t}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[490],{1490:(t,e,s)=>{s.r(e),s.d(e,{default:()=>l});var i=s(1405),o=s(172),n=s(2840);let a=s.e(459).then(s.bind(s,5488));class l extends n.Mw{constructor(t){var e,s,o,n;super(t),e=this,o={close:!0,cssready:!1,closeAnimation:!0,imageReady:!1,user:{},timestamp:"",message:"",title:"",last_show:0},(s="symbol"==typeof(n=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(s="state"))?n:n+"")in e?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,i.A.setTimeout((async()=>{let{body:t}=await this.props.store.sendImpression(this.props.plugin.id);this.impressionToken=i.A.get(t,"impression_token")||"";let e=i.A.get(this.props,"plugin.notification.background_url");i.A.preloadImg(e,(()=>this.setState({imageReady:!0})))}))}setOver(t){this.mouse_leave=t?0:i.A.Date.now()}randomTimestampt(){let t=Math.floor(5*Math.random());return 0==t?this.props.t("just_now"):1==t?"1 "+this.props.t("minute_ago"):2==t?"2 "+this.props.t("minutes_ago"):3==t?"3 "+this.props.t("minutes_ago"):"4 "+this.props.t("minutes_ago")}onClick(t){if(this.props.plugin._dont_follow)return;this.props.store.sendConversion(this.props.plugin.id,null,this.impressionToken);let e=i.A.get(this.props,"plugin.notification.url");return e?(e.startsWith("http://")||e.startsWith("https://")||(e="//"+e),i.A.get(this.props,"plugin.notification.new_tab",!1)?window.open(e):void(window.location.href=e)):void 0}onCloseButtonClick(t){t.preventDefault(),t.stopPropagation(),this.setClose(!0)}renderCloseButton(){return(0,o.h)("div",{class:"btn_close",onClick:t=>this.onCloseButtonClick(t)},(0,o.h)("svg",{class:"btn_close__icon",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24","stroke-linecap":"round","stroke-linejoin":"round"},(0,o.h)("line",{x1:"18",y1:"6",x2:"6",y2:"18",style:"stroke-width: 3 !important;"}),(0,o.h)("line",{x1:"6",y1:"6",x2:"18",y2:"18",style:"stroke-width: 3 !important;"})))}async waitForT(){if(!this.props.t)return await i.A.sleep(100),this.waitForT()}async setClose(t){if(await this.waitForT(),this.props.t){if(!t){i.A.clearTimeout(this.lastCloseTimeout),this.setState({closeAnimation:!1});let t=this.randomTimestampt(),e=i.A.get(this.props,"plugin.notification.profiles",[]),s=e[Math.floor(Math.random()*i.A.size(e))]||{};s.avatar_url&&s.avatar_url.startsWith("http")&&await i.A.preloadImg(s.avatar_url),i.A.map(i.A.get(this.props.plugin,"notification.custom_avatar_urls"),(t=>{e.push({type:"person",fullname:r(),avatar_url:t,email:r().split(" ").join(".").toLowerCase()+"@gmail.com",address:h(),phone:"+84"+Math.floor(10*Math.random())+Math.floor(10*Math.random())+Math.floor(10*Math.random())+Math.floor(10*Math.random())+Math.floor(10*Math.random())+Math.floor(10*Math.random())+"xxxx",age:15+Math.floor(20*Math.random())})}));let o=i.A.get(this.props,"plugin.notification.i18n_message_quill_deltas",[]),n=o[Math.floor(Math.random()*i.A.size(o))],a=i.A.get(this.props,"plugin.notification.message_quill_deltas",[]),l=a[Math.floor(Math.random()*i.A.size(a))],p=i.A.get(this.props,"plugin.notification.i18n_title_quill_delta");return this.setState({close:!1,last_show:i.A.Date.now(),timestamp:t,user:s,title:this.props.t.i18n(p)||i.A.get(this.props,"plugin.notification.title_quill_delta"),message:this.props.t.i18n(n)||l})}this.setState({closeAnimation:!0}),this.mouse_leave=i.A.Date.now(),this.lastCloseTimeout=i.A.setTimeout((()=>this.setState({close:!0,closeAnimation:!1})),150),this.props.plugin._dont_close&&i.A.setTimeout((()=>this.setState({closeAnimation:!1,close:!1})),1e3)}}async refreshCSS(){let t=this.props.store.matchPlugin();if(!i.A.find(t,(t=>t.id===this.props.plugin.id)))return;let e=(await a).default.default.toString();i.A.setCss(this.props.plugin.id,this.$cssStyleDiv,e),this.setClose(this.state.close)}componentWillUnmount(){i.A.clearInterval(this.interval),i.A.setCss(this.props.plugin.id,this.$cssStyleDiv,"")}async componentDidMount(){this.setState({last_show:i.A.Date.now()}),this.$cssStyleDiv=document.getElementById("subiz-style-for-"+this.props.plugin.id),this.$cssStyleDiv||(this.$cssStyleDiv=document.createElement("style"),document.head.appendChild(this.$cssStyleDiv),this.$cssStyleDiv.type="text/css",this.$cssStyleDiv.id="subiz-style-for-"+this.props.plugin.id),this.props.store.onResetCSS(this,(()=>this.refreshCSS())),await this.refreshCSS(),this.interval=i.A.setInterval((()=>{if(this.props._destroy)return this.componentWillUnmount();let t=this.mouse_leave;return 0===t&&(t=i.A.Date.now()),i.A.Date.now()-t<1e3?void 0:this.state.close||this.props.plugin._dont_close?i.A.Date.now()-this.state.last_show>this.props.plugin.notification.interval_sec?this.setClose(!1):void 0:i.A.Date.now()-this.state.last_show>8e3?this.setClose(!0):void 0}),1e3),i.A.setTimeout((()=>{this.setState({cssready:!0}),this.setClose(!1)}),50)}renderTextFromQuillDelta(t,e){let s=i.A.parseJSON(t);if(!s||!s.ops)return null;let n=i.A.map(s.ops,(t=>{let s=null;if(!t.insert)return null;if("string"==typeof t.insert&&(s=t.insert),i.A.get(t,"insert.dynamicField")){let o=i.A.get(t,"insert.dynamicField.key");"user.fullname"===o&&(s=e.fullname),"user.email"===o&&(s=e.email),"user.address"===o&&(s=e.address),"user.phone"===o&&(s=e.phone)}return i.A.get(t,"attributes.bold")&&(s=(0,o.h)("b",null,s)),i.A.get(t,"attributes.italic")&&(s=(0,o.h)("b",null,s)),s})).filter((t=>t));return 1!=n.length||"\n"!=n[0]&&""!=n[0]?n:[]}render(){if(!this.props.t)return null;if(!this.state.cssready)return null;if(!this.state.imageReady)return null;if(this.state.close)return null;if(!this.state.message)return null;let t=i.A.get(this.props.plugin,"notification",{});if(!t)return null;let e="",s=i.A.get(t,"position","bottom-left");this.props.mobile&&(s=i.A.get(t,"mobile_position",s)),"top-left"===s||"top-right"===s?e="fadeInDown":"top-center"===s?e="fadeInDownCenter":"bottom-center"===s?e="fadeInUpCenter":("bottom-right"===s||(s="bottom-left"),e="fadeInUpBig");let n=this.state.user||{},a=t.subtext_style||{};void 0===a.color&&(a.color=i.A.get(t,"message_style.color","black"));let l="position: fixed !important; z-index: 1000000000 !important";this.props.plugin._preview&&(l="position: absolute !important;"),this.state.closeAnimation&&(e="fadeOut");let r=null;n.avatar_url&&(r=(0,o.h)("img",{alt:"notification avatar",class:"notif_avatar__img",src:n.avatar_url}));let h=(0,o.h)("div",{class:"notif_time",style:i.A.js2css(t.subtext_style)},this.state.timestamp),p=this.renderTextFromQuillDelta(this.state.title,n),u=this.renderTextFromQuillDelta(this.state.message,n);return i.A.size(p)||i.A.size(u)||(h=null),(0,o.h)("div",{class:e+" notif notif__"+s,onClick:t=>this.onClick(t),onmouseover:t=>this.setOver(!0),style:l,onmouseleave:t=>this.setOver(!1)},(0,o.h)("div",{style:"position: relative !important; display: flex !important; align-items: center !important;"},(0,o.h)("img",{alt:"notification background",class:"notif_bg",src:t.background_url,style:i.A.js2css(t.background_style)}),this.renderCloseButton(),(0,o.h)("div",{class:"notif_avatar",style:i.A.js2css(t.avatar_style)},r),(0,o.h)("div",{class:"notif_body"},(0,o.h)("div",{class:"notif_title",style:i.A.js2css(t.title_style)},p),(0,o.h)("div",{class:"notif_message",style:i.A.js2css(t.message_style)},u),h)))}}function r(){let t=["Kiều Thanh","Phương Anh","Lê Thùy Linh","Trang Nguyễn","Thanh Hoa","Hoài Đức","Huơng Giang"];return t[Math.floor(Math.random()*t.length)]}function h(){let t=["Dịch Vọng Hậu, Cầu Giấy","Quận 1, TP Hồ Chí Minh","Ngõ 34 Tôn Thất Thuyết","87 Phạm Hùng","Đống Đa, Hà Nội"];return t[Math.floor(Math.random()*t.length)]}}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[497],{1497:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>yt});var i=s(1405),r=s(2840),o=s(172);class a extends r.Mw{render(){var t=this.props.emojiCode;if(i.A.size(t)<3)return null;var e=t.replace(/:/g,"");return(0,o.h)("i",{"data-tooltip":t,class:`emoji emoji--${e}`})}}var n=s(1108);let l=s(2538);class h extends r.Mw{constructor(t){super(t),this.setState({opacity:0,previewEvent:{},displayPreview:!1}),this.loadGreeting(),this.props.store.onUpdate(this,(t=>this.forceUpdate())),this.props.store.onConvoEvent(this,(t=>{if("message_sent"!==i.A.get(t,"type"))return;let e=i.A.get(t,"by.type");if("system"!==e&&"agent"!==e)return;let s=!1;i.A.map(i.A.get(t,"data.message.attachments",[]),(t=>{t&&"quick_replies"===t.type&&(s=!0)})),s||this.setState({displayPreview:!0,previewEvent:t})}))}fixMissingSetting(t){return t=i.A.cloneDeep(t),i.A.get(t,"desktop_button.background_image_url")&&(t.desktop_button.background_image_url=this.props.store.replaceFileUrl(t.desktop_button.background_image_url)),i.A.get(t,"desktop_button.background_mask_url")&&(t.desktop_button.background_mask_url=this.props.store.replaceFileUrl(t.desktop_button.background_mask_url)),i.A.get(t,"mobile_button.background_image_url")&&(t.mobile_button.background_image_url=this.props.store.replaceFileUrl(t.mobile_button.background_image_url)),i.A.get(t,"mobile_button.background_mask_url")&&(t.mobile_button.background_mask_url=this.props.store.replaceFileUrl(t.mobile_button.background_mask_url)),t}render(){let t=this.props.plugin.chatbox,e=i.A.get(t,"desktop_button.position")||"right";if(this.props.store.isMobile()&&(e=i.A.get(t,"mobile_button.position")||e,i.A.get(t,"mobile_button.hidden")))return null;if(i.A.get(t,"desktop_button.hidden"))return null;let s="widget-layout widget-layout--"+e,r=this.state.opacity;return this.props.isShow||(s+=" widget-layout--hidden",r=0),(0,o.h)("div",{class:s,style:"opacity: "+r+" !important"},this.renderPreview(),this.renderButton())}ClearPreview(){this.setState({previewEvent:{}})}ShowGreeting(){if(this.props.store.isMobile()&&"acqjeefqeaoiagyfprap"===i.A.get(this.props.plugin,"chatbox.account_id",{}))return;let t=i.A.get(this.props.plugin,"chatbox.greeting",{}),e=this.props.store.matchAgent("*"),s=t.agent_id;s||(s=function(t){var e=i.A.filter(t,(t=>"agent"===t.type));return e[Math.floor(Math.random()*i.A.size(e))]||{}}(e).id);let r=this.props.t.i18n(i.A.get(t,"greeting",{}))||t.message;this.setState({previewEvent:{by:{id:s,type:"agent"},data:{message:{text:r,format:"plaintext"}}},displayPreview:!0})}HideGreeting(){this.setState({previewEvent:{}})}loadGreeting(){let t=this.props.plugin.chatbox;if((new i.A.Date).getTime()-this.props.store.matchClosePreviewAt()<p)return;let e=i.A.get(t,"greeting",{});(this.props.t.i18n(i.A.get(e,"greeting",{}))||e.message)&&e.enabled?this.ShowGreeting():this.setState({previewEvent:{}})}onClick(){let t=this.props.store.matchLastview();return i.A.get(t,"view")&&("list"!==t.view||i.A.size(this.props.store.matchConvo("*"))>0)?this.props.onClick&&this.props.onClick(Object.assign({},t.opts,{view:t.view})):this.onPreviewClick()}onPreviewClick(t){let e=i.A.convoOfEv(this.state.previewEvent);if(!e){let t=i.A.map(this.props.store.matchConvo("*")),s=i.A.find(t,(t=>!i.A.isConvoSeen(t,this.props.store.matchUser().id)));s||(s=t[0]||{}),e=s.id}this.closePreview(t),this.props.onClick&&this.props.onClick({view:"chat",cid:e})}renderUnread(){let t=this.props.store.matchUnread();return 0===t?null:(0,o.h)("div",{class:"chat-button--unread"},t)}renderPreview(){let t=this.props.store.matchAccount(),e=this.props.plugin.chatbox,r=i.A.get(this.state.previewEvent,"by.display_id",i.A.get(this.state.previewEvent,"by.id")),a=i.A.cloneDeep(this.props.store.matchAgent(r))||{};a.fullname=a.fullname||i.A.get(t,"name")||this.props.t("agent"),a.avatar_url=a.avatar_url||l;let n=i.A.get(e,"desktop_button.position")||"right";this.props.store.isMobile()&&(n=i.A.get(e,"mobile_button.position")||n),e&&e.hide_agent_profile&&(a=Object.assign({},t,{avatar_url:t.logo_url||s(3582),fullname:t.name||this.props.t("agent")}));let h="widget-preview widget-preview--"+n;this.state.displayPreview||(h+=" widget-preview--hidden");var p=this.renderMessagePreview(this.state.previewEvent,this.props.t("sent_you_a_message"));return 0===i.A.size(p)&&(h+=" widget-preview--hidden"),(0,o.h)("div",{class:h},(0,o.h)("div",{class:"widget-preview--body"},(0,o.h)("img",{alt:"widget avatar",class:"widget-preview--avatar",src:this.props.store.replaceFileUrl(a.avatar_url),onError:t=>this.onProfileError(t),onload:t=>this.onProfileReady()}),(0,o.h)("div",{class:"widget-preview--content",onClick:t=>this.onPreviewClick(t)},(0,o.h)("div",{class:"widget-preview--title"},a.fullname),(0,o.h)("p",{class:"widget-preview--message"},p)),(0,o.h)("div",{class:"widget-preview--btn-close",onClick:t=>this.closePreview(t)})),(0,o.h)("div",{class:"widget-preview--action",onClick:t=>this.onPreviewClick(t)},(0,o.h)("div",{class:"widget-preview--action-text"},this.props.t("chat_now"))))}onProfileReady(){this._buttonLoaded&&this.setState({opacity:1}),this._profileLoaded=!0}onButtonReady(){this._profileLoaded&&this.setState({opacity:1}),this._buttonLoaded=!0}renderButton(){let t=this.props.plugin.chatbox;t=this.fixMissingSetting(t);let e=i.A.get(t,"desktop_button.background_image_url")||i.A.get(t,"desktop_button.background_mask_url")||n,s=i.A.get(t,"background")||c,r=i.A.get(t,"desktop_button.position")||"right",a=i.A.get(t,"desktop_button.background_image_url"),l=i.A.get(t,"desktop_button.background_mask_url"),h=i.A.get(t,"desktop_button.width")||70,p=i.A.get(t,"desktop_button.height")||70;if(this.props.store.isMobile()){e=i.A.get(t,"mobile_button.background_image_url")||i.A.get(t,"mobile_button.background_mask_url")||e,r=i.A.get(t,"mobile_button.position")||r;let s=i.A.get(t,"mobile_button.background_image_url"),o=i.A.get(t,"mobile_button.background_mask_url");h=i.A.get(t,"mobile_button.width")||70,p=i.A.get(t,"mobile_button.height")||70,(s||o)&&(a=s,l=o)}let u="chat-button--white-bg";!a&&l&&(u+=" chat-button--white-bg--mask-only");let m="";a=this.props.store.replaceFileUrl(a),e=this.props.store.replaceFileUrl(e),l=this.props.store.replaceFileUrl(l),a||l||(u+=" chat-button--white-bg--mask-only",m=`\n\t\t\t\t-webkit-mask-image: url("${encodeURI(d)}") !important;\n\t\t\t\t-o-mask-image: url("${encodeURI(d)}") !important;\n\t\t\t\t-moz-mask-image: url("${encodeURI(d)}") !important;\n\t\t\t\tmask-image: url("${encodeURI(d)}") !important;\n\t\t\t\theight: ${p}px !important;\n\t\t\t\twidth: ${h}px !important;\n\t\t\t\tbackground: ${s} !important;\n\t\t\t\tbackground: ${s} !important;\n mask-size: cover !important;\n -webkit-mask-size: cover !important;\n -o-mask-size: cover !important;\n -moz-mask-size: cover !important;\n mask-size: cover !important;\n\t\t\t`),a&&l&&(m=`\n\t\t\t\t-webkit-mask-image: url("${encodeURI(l)}") !important;\n\t\t\t\t-o-mask-image: url("${encodeURI(l)}") !important;\n\t\t\t\t-moz-mask-image: url("${encodeURI(l)}") !important;\n\t\t\t\tmask-image: url("${encodeURI(l)}") !important;\n\t\t\t\tbackground-image: url("${encodeURI(a)}") !important;\n\t\t\t\tbackground-repeat: no-repeat !important;\n -webkit-mask-size: cover !important;\n -o-mask-size: cover !important;\n -moz-mask-size: cover !important;\n mask-size: cover !important;\n\t\t\t`),a&&!l&&(m=`\n\t\t\t\tbackground-image: url("${encodeURI(a)}") !important;\n\t\t\t\tbackground-repeat: no-repeat !important;\n\t\t\t`),!a&&l&&(m=`\n\t\t\t\t-webkit-mask-image: url("${encodeURI(l)}") !important;\n\t\t\t\t-o-mask-image: url("${encodeURI(l)}") !important;\n\t\t\t\t-moz-mask-image: url("${encodeURI(l)}") !important;\n\t\t\t\tmask-image: url("${encodeURI(l)}") !important;\n\t\t\t\theight: ${p}px !important;\n\t\t\t\twidth: ${h}px !important;\n\t\t\t\tbackground: ${s} !important;\n -webkit-mask-size: cover !important;\n -o-mask-size: cover !important;\n -moz-mask-size: cover !important;\n mask-size: cover !important;\n\t\t\t`);let g="chat-button chat-button--"+r,v=`\n\t\t\twidth: ${h-4}px !important;\n\t\t\theight: ${p-4}px !important;\n\n `;return(0,o.h)("div",{class:g,onClick:t=>this.onClick(t)},(0,o.h)("div",{class:u,style:v}),(0,o.h)("div",{class:"chat-button--img-container",style:m},(0,o.h)("img",{width:"70",height:"70",alt:"chat button",class:"chat-button--img",onload:()=>this.onButtonReady(),src:e,onError:(t,e)=>this.onChatButtonError(t,e)})),this.renderUnread())}onProfileError(t){t.target.src=l,this.onProfileReady()}onChatButtonError(t){this._onChatButtonErrorExecuted||(this._onChatButtonErrorExecuted=!0,t.target.src=n)}renderMessagePreview(t,e){e=e||"Sent you a message";let s=i.A.get(t,"data.message.text");var r=i.A.get(t,"data.message.format");if("delta"===r)return this.renderDeltaMessagePreview(t,e);if(r&&"plaintext"!==r&&(s=e),!s&&i.A.size(i.A.get(t,"data.message.attachments"))>0&&(s=e),!s)return null;let n=i.A.get(t,"by.type");return i.A.extractText(s).map((t=>"emoji"===t.type?(0,o.h)(a,{emojiCode:t.text,byType:n}):t.text))}renderDeltaMessagePreview(t,e){e=e||"Sent you a message";let s=i.A.get(t,"data.message.quill_delta");if(!s&&i.A.size(i.A.get(t,"data.message.attachments"))>0&&(s=e),!s)return;let r=i.A.parseJSON(s)||{};return r&&0!==i.A.size(r.ops)?i.A.map(r.ops,(t=>{let e=t.insert;return t.attributes,e.dynamicField?i.A.get(e,"dynamicField.text",""):e.emoji?(0,o.h)(a,{emojiCode:`:${e.emoji}:`}):"string"==typeof e?e:null})):null}closePreview(t){t&&(t.preventDefault(),t.stopPropagation()),this.setState({displayPreview:!1}),this.props.store.closePreview(),this.forceUpdate()}}const p=18e5,d="https://vcdn.subiz-cdn.com/file/bubble_11.svg?v=5",c="linear-gradient(280.16deg, #0053d3 22.03%, #0265ff 78.2%)";var u=s(9529);class m extends r.Mw{constructor(t){super(t)}render(){if(this.props.store.isMobile())return null;let t=this.props.store.matchUser()||{};var e=`https://subiz.com.vn/?utm_source=${window.location.host||`id-${t.account_id}`}&utm_medium=widget&utm_campaign=widget_referral`;return(0,o.h)("div",{class:"poweredby"},(0,o.h)("a",{href:e,class:"poweredby--text",target:"_blank",title:"Subiz"},(0,o.h)("img",{width:"14",height:"10",class:"poweredby--subiz-logo",src:u,alt:"power by subiz"})," Subiz"))}}class g extends r.Mw{constructor(t){super(t)}render(){let t=this.props.plugin.chatbox,e=this.props.store.matchAccount()||{};var r=this.props.tooltipPos||"bottom",a=this.props.mode||"primary";if(t&&t.hide_agent_profile)return(0,o.h)("div",{class:`group-avatar group-avatar--${a}`},(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":e.name,"data-tooltip-position":r},(0,o.h)("img",{width:35,height:35,alt:"agent avatar left",class:"avatar group-avatar--agent-left",src:this.props.store.replaceFileUrl(e.logo_url)||s(3582)})));let n=this.props.store.matchAgent("*");var l=i.A.map(this.props.agent_ids,(t=>n[t]));if(void 0===this.props.agent_ids||0===i.A.size(this.props.agent_ids)){var h=i.A.get(t,"header.agent_ids",[]);l=0!==(h=i.A.filter(h,(t=>!!n[t]))).length?i.A.map(h,(t=>n[t])):i.A.filter(n,(t=>"agent"===t.type))}if(0===(l=i.A.filter(l,(t=>!!t))).length)return(0,o.h)("div",{class:`group-avatar group-avatar--${a}`},(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":e.name,"data-tooltip-position":r},(0,o.h)("img",{width:35,height:35,alt:"agent avatar left",class:"avatar group-avatar--agent-left",src:this.props.store.replaceFileUrl(e.logo_url)||s(3582)})));if(1===l.length){var p=l[0],d="primary"===a?"group-avatar--agent-middle":"group-avatar--agent-left";return(0,o.h)("div",{class:`group-avatar group-avatar--${a}`},(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":p.fullname||e.name,"data-tooltip-position":r},(0,o.h)("img",{width:35,height:35,class:`avatar ${d}`,alt:"agent avatar",src:this.props.store.replaceFileUrl(p.avatar_url)||s(2538)})))}if(2===l.length){let t=l[0],i=l[1];return(0,o.h)("div",{class:`group-avatar group-avatar--${a}`},(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":t.fullname||e.name,"data-tooltip-position":r},(0,o.h)("img",{width:35,height:35,alt:"agent avatar left",class:"avatar group-avatar--agent-left",src:this.props.store.replaceFileUrl(t.avatar_url)||s(2538)})),(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":i.fullname||e.name,"data-tooltip-position":r},(0,o.h)("img",{alt:"agent avatar right",width:35,height:35,class:"avatar group-avatar--agent-right",src:this.props.store.replaceFileUrl(i.avatar_url)||s(2538)})))}let c=l[0],u=l[1],m=l[2];return(0,o.h)("div",{class:`group-avatar group-avatar--${a}`},(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":c.fullname||e.name,"data-tooltip-position":r},(0,o.h)("img",{width:35,height:35,alt:"agent avatar left",class:"avatar group-avatar--agent-left",src:this.props.store.replaceFileUrl(c.avatar_url)||s(2538)})),(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":u.fullname||e.name,"data-tooltip-position":r},(0,o.h)("img",{alt:"agent avatar middle",width:35,height:35,class:"avatar group-avatar--agent-middle",src:this.props.store.replaceFileUrl(u.avatar_url)||s(2538)})),(0,o.h)("div",{class:"d-inline-block pos-relative","data-tooltip":m.fullname||e.name,"data-tooltip-position":r},(0,o.h)("img",{width:35,height:35,alt:"agent avatar right",class:"avatar group-avatar--agent-right",src:this.props.store.replaceFileUrl(m.avatar_url)||s(2538)})))}}class v extends r.Mw{constructor(t){super(t)}render(){let t="widget-header",e=!1,s=!1,r=this.props.plugin.chatbox||{},a=i.A.get(r,"header.layout"),n="list"!==this.props.view&&!0,l=!n&&"classic"===a;return n||"classic"==a?t+=" widget-header--collapsed":(t+=" widget-header--convo-expanded",e="social"===a,s=!(e||l)),(0,o.h)("div",{class:t},this.renderCollapsedHeader(n||l,l),this.renderSocial(e),this.renderTeam(s))}renderCollapsedHeader(t,e){let s=this.props.plugin.chatbox||{},r=(this.props.store.matchAccount()||{}).is_online?this.props.t("agent_online"):this.props.t("agent_offline"),a=i.A.get(s,"tagline",{}),n=this.props.t.i18n(a)||s.introduction||r,l=i.A.map(this.getAgentJoined(this.props.cid),(t=>t.id)),h="widget-header--inner widget-header--inner--collapsed";t||(h+=" widget-header--inner--hidden");let p=null,d="";return e?d="padding-bottom: 75px !important;":p=this.renderBackButton(),(0,o.h)("div",{class:h,style:d},p,(0,o.h)(g,{plugin:this.props.plugin,store:this.props.store,mode:"secondary",agent_ids:l}),(0,o.h)("div",{class:"widget-header--title-container"},(0,o.h)("div",{class:"widget-header--title"},this.getTitle()),(0,o.h)("div",{class:"widget-header--description",title:n},n)),this.renderCloseButton())}renderSocial(t){let e=this.props.plugin.chatbox||{},s=this.props.store.matchAccount()||{},r=i.A.get(e,"header.links")||[],n=i.A.map(r,(t=>t.url&&t.type&&"subiz"!==t.type?"email"===t.type?(0,o.h)("div",null,(0,o.h)("a",{href:`mailto:${t.url}`,title:t.url},(0,o.h)("i",{class:`social__links-logo social__links-logo--${t.type}`}))):(0,o.h)("div",null,(0,o.h)("a",{href:t.url,target:"_blank",title:t.url},(0,o.h)("i",{class:`social__links-logo social__links-logo--${t.type}`}))):null)),l=i.A.get(e,"tagline",{});var h=this.props.t.i18n(l)||e.introduction||this.props.t("team_intro")||"Chúng tôi sẵn sàng trợ giúp :wave:.\nVui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn",p=i.A.extractText(h).map((t=>"emoji"===t.type?(0,o.h)(a,{emojiCode:t.text}):t.text));let d="widget-header--inner widget-header--inner--expanded";return t||(d+=" widget-header--inner--hidden"),(0,o.h)("div",{class:d},(0,o.h)("div",{class:"widget-header-expand-container"},(0,o.h)("div",{class:"widget-header--top-wrapper"},(0,o.h)("div",{class:"widget-header--title"},this.getTitle()),this.renderCloseButton()),(0,o.h)("div",{class:"widget_header__body widget_header__body__social"},(0,o.h)("img",{alt:"logo",class:"social__account_logo",src:this.props.store.replaceFileUrl(i.A.get(s,"logo_url"))}),(0,o.h)("div",null,(0,o.h)("div",{class:"social__introduction"},p),(0,o.h)("div",{class:"social__links"},n)))))}renderTeam(t){let e=this.props.plugin.chatbox||{},s=i.A.get(e,"tagline",{});var r=this.props.t.i18n(s)||e.introduction||this.props.t("team_intro")||"Chúng tôi sẵn sàng trợ giúp :wave:.\nVui lòng hỏi chúng tôi bất cứ điều gì hoặc chia sẻ phản hồi của bạn",n=i.A.extractText(r).map((t=>"emoji"===t.type?(0,o.h)(a,{emojiCode:t.text}):t.text));let l="widget-header--inner widget-header--inner--expanded";return t||(l+=" widget-header--inner--hidden"),(0,o.h)("div",{class:l},(0,o.h)("div",{class:"widget-header-expand-container"},(0,o.h)("div",{class:"widget-header--top-wrapper"},(0,o.h)("div",{class:"widget-header--title"},this.getTitle()),this.renderCloseButton()),(0,o.h)("div",{class:"widget_header__body"},(0,o.h)("div",{class:"widget-header--avatar-wrapper"},(0,o.h)(g,{plugin:this.props.plugin,store:this.props.store,mode:"primary"})),(0,o.h)("div",{class:"widget-header--title-container"},(0,o.h)("div",{class:"widget-header--description"},n)))))}getTitle(){let t=this.props.plugin.chatbox||{},e=this.props.store.matchAccount()||{},s=this.getAgentJoined(this.props.cid),r=i.A.get(this.props.plugin,"chatbox.caption",{}),o=this.props.t.i18n(r)||t.title;return f(s)||o||e.name||this.props.t("widget_title")}renderBackButton(){let t=this.props.store.matchConvo("*");if(0===i.A.size(t))return null;var e=null;let s=this.props.store.matchUser(),r=0;return i.A.map(t,(t=>{t.id!=this.props.cid&&(i.A.isConvoSeen(t,s.id)||r++)})),0!==r&&(e=(0,o.h)("span",{class:"widget-header--total-unread-convo"},r)),(0,o.h)("div",{class:"widget-header--wrap-button-back "+(r?"widget-header--has-convo-unred":""),onClick:t=>this.onBackClick(t)},(0,o.h)("div",{class:"widget-header--button-back","data-tooltip":this.props.t("menu_back")}),e)}renderCloseButton(){return(this.props.plugin.chatbox||{}).hide_close_button?null:(0,o.h)("div",{class:"widget-header--button widget-header--button-close","data-tooltip":this.props.t("close"),"data-tooltip-position":"bottom",onClick:t=>this.onCloseClick(t)},(0,o.h)("span",{class:"widget-header--button-close-icon"}))}onBackClick(t){t.stopPropagation(),t.preventDefault(),this.props.onGotoList&&this.props.onGotoList()}onCloseClick(t){t.stopPropagation(),t.preventDefault(),this.props.onClose&&this.props.onClose()}getAgentJoined(t){var e=this.props.store.matchConvo(t)||{};return i.A.filter(e.members,(t=>"agent"===t.type&&"active"===t.membership))}}let f=t=>(t=i.A.filter(t,(t=>i.A.trim(t.fullname)))).length?i.A.map(t,(t=>t.fullname)).join(", "):null;class _ extends r.Mw{constructor(t){var e,s,r,a;super(t),e=this,s="onEnter",r=i.A.throttle((function(){this.submitMessage()}),50),(s="symbol"==typeof(a=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(s))?a:a+"")in e?Object.defineProperty(e,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[s]=r,this.refFileInput=(0,o._3)(),this.refMessageInput=(0,o._3)(),this.props.store.onUpdate(this,(t=>this.forceUpdate())),this.props.store.onConvoEvent(this,(t=>{i.A.convoOfEv(t)===this.props.cid&&this.forceUpdate()})),this.focus(),this._forceUpdate=i.A.throttle((()=>{this.forceUpdate()}),500),this.resizeInput=i.A.throttle((function(){const t=this.refMessageInput.current;t.style.setProperty("height","1em","important");const e=Math.min(200,t.scrollHeight);t.style.setProperty("height",`${e}px`,"important")}),5)}blur(){const t=this.refMessageInput.current;t&&t.blur()}render(){var t=(0,o.h)("div",{class:"d-flex flex-row align-self-end"},this.renderEmoji(),(0,o.h)("div",{"data-tooltip-poasition":"top-left",class:"message-input--button message-input--attachment-button",onClick:t=>this.selectFile(t)}));i.A.trim(this.refMessageInput.current&&this.refMessageInput.current.value).length>0&&(t=(0,o.h)("div",{class:"d-flex flex-row align-self-end"},this.renderEmoji(),(0,o.h)("div",{"data-tooltip-position":"top-left",class:"message-input--button message-input--send-button",onClick:()=>this.submitMessage()})));var e="",s=this.hasUnfinishRequiredFormOrLock()||this.props.disabled;return s&&(e="message-input--disabled"),(0,o.h)("div",{class:`message-input ${e}`,onClick:t=>{this.refMessageInput.current&&this.refMessageInput.current.focus()}},(0,o.h)("input",{class:"d-none",ref:this.refFileInput,type:"file",onChange:t=>this.sendFile(t),multiple:!0}),(0,o.h)("textarea",{disabled:s,class:"message-input--input",maxlength:"1024",placeholder:this.props.t("message_input_help"),ref:this.refMessageInput,rows:"1",onInput:t=>this.onChange(t),onPaste:t=>this.pasteImage(t),"data-emojiable":"true",onKeydown:t=>this.onKeydown(t)}),t)}hasUnfinishRequiredFormOrLock(){let t=this.props.store.matchConvo(this.props.cid);if("ended"===i.A.get(t,"state"))return!1;let e=this.props.store.listEvents(this.props.cid);e=i.A.orderBy(e,"created","desc").filter((t=>"message_sent"===t.type));let s=i.A.get(e[0],"data.message.attachments",[]);if(i.A.find(s,(t=>i.A.get(t,"lock_input"))))return!0;var r;for(let t of e)if("user"!==i.A.get(t,"by.type")){r=t;break}s=i.A.get(r,"data.message.attachments",[]);let o=i.A.filter(s,(t=>{if(!t)return!1;if("form"!==t.type&&"ask_info_form"!==t.type)return!1;var e=t.form;return!(!e||!(i.A.parseJSON(e.state)||{}).require_finished&&"ask_info_form"!==t.type||function(t){let e=i.A.get(t,"fields")||[];return i.A.find(e,(t=>!!t.answered))}(t.form))}));return i.A.size(o)>0}renderEmojiPopup(){return this.state.openEmoji?(0,o.h)("div",{class:"emoji-picker","v-clickaway":t=>this.setState({openEmoji:!1})},(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":like:"),"data-tooltip":":like:",class:"emoji-picker--item emoji--like"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":unlike:"),"data-tooltip":":unlike:",class:"emoji-picker--item emoji--unlike"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":angry:"),"data-tooltip":":angry:",class:"emoji-picker--item emoji--angry"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":confused:"),"data-tooltip":":confused:",class:"emoji-picker--item emoji--confused"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":crying:"),"data-tooltip":":crying:",class:"emoji-picker--item emoji--crying"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":grinning:"),"data-tooltip":":grinning:",class:"emoji-picker--item emoji--grinning"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":heart-eyes:"),"data-tooltip":":heart-eyes:",class:"emoji-picker--item emoji--heart-eyes"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":neutral:"),"data-tooltip":":neutral:",class:"emoji-picker--item emoji--neutral"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":sad:"),"data-tooltip":":sad:",class:"emoji-picker--item emoji--sad"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":sleepy:"),"data-tooltip":":sleepy:",class:"emoji-picker--item emoji--sleepy"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":smiling:"),"data-tooltip":":smiling:",class:"emoji-picker--item emoji--smiling"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":surprised:"),"data-tooltip":":surprised:",class:"emoji-picker--item emoji--surprised"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":tired:"),"data-tooltip":":tired:",class:"emoji-picker--item emoji--tired"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":tongue-out:"),"data-tooltip":":tongue-out:",class:"emoji-picker--item emoji--tongue-out"})),(0,o.h)("div",{class:"emoji-picker-background-item"},(0,o.h)("div",{onClick:()=>this.emojiPick(":wink:"),"data-tooltip":":wink:",class:"emoji-picker--item emoji--wink"}))):null}focus(){this.props.disabled||(this.refMessageInput.current&&this.refMessageInput.current.focus(),i.A.setTimeout((()=>{this.refMessageInput.current&&this.refMessageInput.current.focus()})),i.A.setTimeout((()=>{this.refMessageInput.current&&this.refMessageInput.current.focus()}),100))}renderEmoji(){return(0,o.h)("div",null,this.renderEmojiPopup(),(0,o.h)("div",{class:"message-input--button message-input--emoji-button",onClick:t=>this.toggleEmoji(t)}))}toggleEmoji(t){t.stopPropagation(),this.focus(),this.props.disabled||this.setState({openEmoji:!this.state.openEmoji})}emojiPick(t){const e=this.refMessageInput.current,s=e.selectionStart,i=this.refMessageInput.current.value;this.setState({openEmoji:!1}),this.refMessageInput.current.value=[i.slice(0,s),t,i.slice(s)].join(""),this.resizeInput(),e.focus()}onKeydown(t){if(13===t.keyCode&&!1===t.shiftKey)return this.onEnter(),t.preventDefault();this._forceUpdate(),this.sendTyping()}onChange(){this.resizeInput()}selectFile(){this.props.disabled||this.refFileInput.current.click()}sendFile(){let t=this.refFileInput.current;this._sendFile(t.files),t.value=""}_sendFile(t){if(0===i.A.size(t))return;if(this.props.disabled)return;let e=i.A.map(t,(t=>({type:"file",mimetype:t.type,name:t.name,_file:t,size:t.size})));this.props.onSend&&this.props.onSend({attachments:e})}async submitMessage(t){(t=t||i.A.trim(this.refMessageInput.current.value)||"")&&(this.props.disabled||(this.refMessageInput.current.value="",this.resizeInput(),this.setState({openEmoji:!1}),this.props.onSend&&this.props.onSend({text:t,format:"plaintext"})))}sendTyping(){if(this.props.cid)return this.props.store.typing(this.props.cid)}pasteImage(t){if(!(window.File&&window.FileReader&&window.FileList&&window.Blob))return;let e=new i.A.Date;const s=`Paste-image-${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}-${e.getHours()}-${e.getMinutes()}-${e.getSeconds()}`;let r=null;const o=t.clipboardData.items[0];if(0===o.type.indexOf("image")&&(r=o.getAsFile()),!r)return;const a=[r,new ArrayBuffer],n=new File(a,`${s}.png`,{type:"image/png"});this._sendFile([n])}}class y extends r.Mw{constructor(t){var e,s,i,r;super(t),e=this,s="containerRef",i=(0,o._3)(),(s="symbol"==typeof(r=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(s))?r:r+"")in e?Object.defineProperty(e,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[s]=i,this.setState({ready:!1,errorIndecies:[]})}componentDidMount(){this.setImageFrameDimension()}setImageFrameDimension(){let t=this.containerRef.current;this.frameWidth=t?t.offsetWidth:267,this.frameHeight=240,this.setState({ready:!0})}onErrorImage(t){let e=this.state.errorIndecies||[];e.push(t),e=[...e],this.setState({errorIndecies:e})}calculateImageDimension(t){if(!t.width||!t.height)return{width:this.frameWidth,height:this.frameHeight};if(t.width/t.height-this.frameWidth/this.frameHeight>=0){let e=this.frameWidth,s=t.height*this.frameWidth/t.width;return s=Math.round(s),{width:e,height:s}}{let e=this.frameHeight,s=t.width*this.frameHeight/t.height;return s=Math.round(s),{width:s,height:e}}}renderImage(t,e){if(!this.state.ready)return;let r=i.A.get(this.props.ev,"by.type");if(!t.width||!t.height)return(0,o.h)("div",{class:`image-attachment image-attachment--${r}`},(0,o.h)("a",{href:this.props.store.replaceFileUrl(t.url),target:"_blank"},(0,o.h)("img",{alt:!0,class:"image-attachment__img",src:this.props.store.replaceFileUrl(t.thumbnail_url||t.url),onload:t=>this.props.onLoad&&this.props.onLoad()})));let{width:a,height:n}=this.calculateImageDimension(t),l=this.props.store.replaceFileUrl(t.thumbnail_url||t.url),h=this.props.store.replaceFileUrl(t.url);return this.state.errorIndecies.includes(e)&&(l=s(2876),h=l),(0,o.h)("div",{class:`image-attachment image-attachment--${r}`},(0,o.h)("a",{href:h,target:"_blank"},(0,o.h)("img",{alt:!0,ref:t=>{t&&(t.style.setProperty("width",`${a}px`,"important"),t.style.setProperty("height",`${n}px`,"important"))},class:"image-attachment__img",src:l,onload:t=>this.props.onLoad&&this.props.onLoad(),onerror:t=>this.onErrorImage(e)})))}render(){var t=i.A.get(this.props.ev,"data.message.attachments",[]),e=[];let s=i.A.get(this.props.ev,"by.type");if(i.A.each(t,((t,s)=>{if(t&&i.A.includes(t.mimetype,"image")&&t.url){var r=t.url;r.startsWith("https://")||r.startsWith("http://")||r.startsWith("content://")||r.startsWith("data:")||(t.url=this.props.store.FileURL+r),e.push(t)}})),0===e.length)return null;let r=i.A.map(e,((t,e)=>this.renderImage(t,e)));return"agent"===s?(0,o.h)("div",{class:"message-agent",ref:this.containerRef},r):(0,o.h)("div",{class:"message-user message-user-images-container",ref:this.containerRef},r)}}class b extends r.Mw{constructor(t){super(t)}render(){let t=i.A.get(this.props.ev,"by.type");var e=i.A.get(this.props.ev,"data.message.attachments",[]),s=[];if(i.A.each(e,((t,e)=>{t&&i.A.includes(t.mimetype,"audio")&&s.push(t)})),0===s.length)return null;var r=i.A.map(s,((e,s)=>(0,o.h)("div",{key:s,class:`audio-attachment audio-attachment--${t}`},(0,o.h)("audio",{class:"audio-attachment__audio",controls:!0},(0,o.h)("source",{src:this.props.store.replaceFileUrl(e.url),type:e.mimetype})))));return(0,o.h)("div",{class:`message-${t} message-${t}-audio`},r)}}class w extends r.Mw{render(){var t=i.A.get(this.props.ev,"by.type","agent"),e=i.A.get(this.props.ev,"data.message.attachments",[]),s=[];if(i.A.each(e,(t=>{t&&(t.url||t._file)&&(i.A.includes(t.mimetype,"video")||i.A.includes(t.mimetype,"audio")||i.A.includes(t.mimetype,"image")||"button"===t.type||"quick_replies"===t.type||"form"===t.type||"form_submit"===t.type||s.push(t))})),0===s.length)return null;var r=i.A.map(s,((e,s)=>(0,o.h)("div",{key:s,class:`file-attachment file-attachment--${t}`},(0,o.h)("a",{class:"file-attachment--link",href:this.props.store.replaceFileUrl(e.url),target:"_blank"},(0,o.h)("span",{class:"file-attachment--download mr-2"}),(0,o.h)("span",{class:"file-attachment--filename"},e.name)))));return(0,o.h)("div",{class:`message-${t}`},r)}}class A extends r.Mw{constructor(t){super(t)}render(){if(0===i.A.size(this.props.buttons))return null;var t=i.A.map(this.props.buttons,((t,e)=>"call_button"===t.type?(0,o.h)("a",{class:"url-button-attachment",href:"tel:"+t.phone_number,key:e,title:t.title},this.props.t.i18n(t.i18n_title)||t.title):"url_button"===t.type?(0,o.h)("a",{class:"url-button-attachment",href:t.url,target:"_blank",key:e,title:t.title},this.props.t.i18n(t.i18n_title)||t.title||t.url):"postback_button"===t.type?(0,o.h)("a",{class:"url-button-attachment",href:"javascript:;",onClick:e=>this.props.onSelect(t)},this.props.t.i18n(t.i18n_title)||t.title):("widget_ask_desktop_notify_button"===t.type||t.type,null)));return(0,o.h)("div",{class:"button-attachments"},t)}}class k extends r.Mw{constructor(t){super(t)}render(){if("user"===i.A.get(this.props.ev,"by.type"))return null;let t=[],e=i.A.get(this.props.ev,"data.message.attachments",[]);return i.A.each(e,((e,s)=>{e&&"button"===i.A.get(e,"type")&&i.A.each(i.A.get(e,"buttons")||[],(e=>t.push(e)))})),(0,o.h)(A,{store:this.props.store,buttons:t,t:this.props.t})}}class x extends r.Mw{constructor(t){super(t)}render(){if("user"===i.A.get(this.props.ev,"by.type"))return null;let t=[];if(i.A.map(i.A.get(this.props.ev,"data.message.attachments",[]),(e=>{e&&"quick_replies"===e.type&&(t=i.A.get(e,"quick_replies",[]))})),t=i.A.filter(t,(t=>t.title)),0===t.length)return null;let e=i.A.convoOfEv(this.props.ev),s=this.props.store.matchConvo(e);if("ended"===i.A.get(s,"state"))return null;let r=i.A.map(this.props.store.listEvents(e));r=i.A.orderBy(r,"created","asc").filter((t=>"message_sent"===t.type));let a=0;for(var n=0;n<r.length;n++)if(r[n].id===this.props.ev.id){a=n;break}for(n=a+1;n<r.length;n++)if("user"===i.A.get(r[n],"by.type"))return null;let l=i.A.map(t,(t=>(0,o.h)("div",{class:"message_quick_reply",onClick:e=>this.props.onSelect(t)},t.title)));return(0,o.h)("div",{class:"message_quick_replies"},l)}}class S extends r.Mw{constructor(t){super(t),this.setState({search:"",isShow:!1})}render(){let t=i.A.filter(this.props.items,(t=>{let e=this.state.search.toLowerCase();return(t||"").toLowerCase().indexOf(e)>-1})),e=i.A.map(t,(t=>(0,o.h)("li",{class:"custom-select--item-options",onClick:()=>this.add(t)},t))),s=i.A.map(this.props.selected,((t,e)=>(0,o.h)("div",{class:"custom-select--selected-item",onClick:t=>this.remove(t,e)},t,(0,o.h)("i",{class:"icn-delete delete-tag"})))),a=(0,o.h)("div",{class:"custom-select--wrap-options"},(0,o.h)("input",{onClick:t=>{t.preventDefault(),t.stopPropagation(),this.setState({isShow:!0})},type:"text",onInput:t=>this.setState({search:t.target.value}),value:this.state.search,placeholder:"Tìm kiếm",class:"custom-select--input-search"}),(0,o.h)("ul",{class:"custom-select--items-options"},e));return this.state.isShow||(a=null),(0,o.h)("div",{class:"form-control custom-select"},(0,o.h)(r.tW,{onClickaway:t=>this.clickaway()},(0,o.h)("div",{class:"custom-select--wrap-selected",onClick:()=>this.setState({isShow:!this.state.isShow})},(0,o.h)("div",{class:"custom-select--selected-items"},s),a,(0,o.h)("div",{class:"custom-select--icon-dropdown"},(0,o.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,o.h)("g",{opacity:"0.6"},(0,o.h)("path",{d:"M7 9.5L12 14.5L17 9.5H7Z",fill:"black"})))))))}clickaway(){this.setState({isShow:!1})}add(t){this.props.onAddItem&&this.props.onAddItem(t)}remove(t,e){t.preventDefault(),t.stopPropagation(),this.props.onRemoveItem&&this.props.onRemoveItem(e)}}class C extends r.Mw{constructor(t){super(t),this.props.store.onUpdate(this,(t=>this.forceUpdate()));let e=this.props.store.matchUser(),s=i.A.get(this.props.form,"fields")||[],r=i.A.map(s,(t=>{let s=t.is_required||!1;var r=i.A.parseJSON(t.state)||{};s||(s=r.require||!1);var o=i.A.getUserAttr(e,t.name,r.type||"text");return{name:t.name,items:t.items,value:i.A.parseJSON(t.answer)||i.A.parseJSON(t.default_answer)||o,is_required:s,label:t.title,type:t.input_type}}));this.setState({formData:r})}isSummited(){return!!i.A.find(this.state.formData,(t=>!!t.answered))||"ended"===this.props.store.matchConvo(i.A.convoOfEv(this.props.ev)).state}render(){if(0===i.A.size(this.state.formData))return null;let t=this.renderFields(),e=null;return this.isSummited()||(e=(0,o.h)("div",{class:"mt-2"},(0,o.h)("button",{onClick:t=>this.submit(),type:"button",class:"form-attachment--submit-btn"},this.props.t("btn_submit_form_attachment")))),(0,o.h)("div",{class:"form-attachment",onClick:t=>t.stopPropagation()},this.props.t(this.props.form.title)||this.props.t("capture_lead_title"),t,e)}focus(){if(this.props.store.isPreview)return;if(0===i.A.size(this.state.formData))return;let t;if(this.isFormFilled()){var e=Object.keys(this.state.formData),s=e[i.A.size(e)-1];t=this["field."+M(this.state.formData[s].name)]}else{var r=this.firstUnfilledField();if(!r)return;t=this["field."+M(r.name)]}t&&t.focus()}firstUnfilledField(){return i.A.find(this.state.formData,(t=>null==t.value||""===t.value))}isFormFilled(){return!i.A.find(this.state.formData,(t=>null==t.value||""===t.value))}onInputChange(t,e){let s=i.A.cloneDeep(this.state.formData);s[t].value=e,this.setState({formData:s})}onListAddItem(t,e){let s=i.A.cloneDeep(this.state.formData),r=s[t];r.value=r.value||[],r.value.push(e),this.setState({formData:s})}onListRemoveItem(t,e){let s=i.A.cloneDeep(this.state.formData),r=s[t];r.value=r.value||[],r.value.splice(e,1),this.setState({formData:s})}renderFields(){if(0===i.A.size(this.state.formData))return null;let t=null;return t=i.A.map(this.state.formData,((t,e)=>{let s=null;var r=t.error?"input--error":"";if("text"===t.type)s=this.isSummited()?(0,o.h)("div",{class:"form-control--container"},(0,o.h)("input",{disabled:!0,ref:e=>{this["field."+M(t.name)]=e},value:t.value,onInput:t=>this.onInputChange(e,t.target.value),class:`form-control ${r}`,type:"text"}),(0,o.h)("i",{class:"form-control--check"})):(0,o.h)("input",{ref:e=>{this["field."+M(t.name)]=e},value:t.value,onInput:t=>this.onInputChange(e,t.target.value),class:`form-control ${r}`,type:"text"});else if("number"===t.type)s=this.isSummited()?(0,o.h)("div",{class:"form-control--container"},(0,o.h)("input",{disabled:!0,ref:e=>{this["field."+M(t.name)]=e},value:t.value,onInput:t=>this.onInputChange(e,t.target.value),class:`form-control ${r}`,type:"number"}),(0,o.h)("i",{class:"form-control--check"})):(0,o.h)("input",{ref:e=>{this["field."+M(t.name)]=e},value:t.value,onInput:t=>this.onInputChange(e,t.target.value),class:`form-control ${r}`,type:"number"});else if("boolean"===t.type)s=(0,o.h)("div",{class:"checkbox"},(0,o.h)("input",{ref:e=>{this["field."+M(t.name)]=e},type:"checkbox",id:"checkbox."+this.props.ev.id+"."+t.name,onChange:t=>this.onInputChange(e,ev.target.checked),checked:t.value}),(0,o.h)("label",{class:"checkbox--label",for:"checkbox."+this.props.ev.id+"."+t.name},t.label),(0,o.h)("div",{class:"checkbox--check"},(0,o.h)("div",null)));else if("list"===t.type){let r=t.value||[],a=i.A.filter(i.A.get(t,"items",[]),(t=>!r.includes(t)));s=(0,o.h)(S,{selected:r,items:a,onAddItem:t=>this.onListAddItem(e,t),onRemoveItem:t=>this.onListRemoveItem(e,t)})}else"datetime"===t.type&&(s=(0,o.h)("input",{ref:e=>{this["field."+M(t.name)]=e},value:t.value,onInput:t=>this.onInputChange(e,t.target.value),class:`form-control ${r}`,type:"date"}));let a=t.label;return"fullname"===t.name?a=this.props.t("fullname"):"emails"===t.name?a=this.props.t("email"):"phones"===t.name&&(a=this.props.t("phones")),(0,o.h)("div",null,(0,o.h)("p",{class:"label mt-3"},a,t.is_required?(0,o.h)("span",{class:"ml-1 red"},"*"):""),t.error?(0,o.h)("div",{class:"form-control--valid-input--error"},t.error):"",s)})),(0,o.h)("div",null,t)}async submit(){var t=!1;if(i.A.map(this.state.formData,(e=>{e.is_required&&(void 0===e.value||""===e.value||0===i.A.size(e.value)&&Array.isArray(e.value))?(e.error=this.props.t("error_empty"),t=!0):e.error="","emails"===e.name&&e.value&&(i.A.isEmail(e.value)||(e.error=this.props.t("error_email_invalid"),t=!0))})),this.forceUpdate(),t)return;let e={},s=i.A.cloneDeep(this.state.formData);i.A.map(s,(t=>{var s={key:t.name};t.answered=(new i.A.Date).getTime(),"number"===t.type&&(s.number=parseInt(t.value),t.answer=i.A.stringify(s.number)),"datetime"===t.type&&(s.datetime=new i.A.Date(t.value).toISOString(),t.answer=i.A.stringify(s.datetime)),"list"===t.type&&(s.list=t.value,t.answer=i.A.stringify(s.list)),"text"!==t.type&&"boolean"!==t.type||(s[t.type]=t.value,t.answer=i.A.stringify(t.value)),i.A.setUserAttr(e,s)})),i.A.map(s,(t=>{let e=i.A.find(this.props.form.fields,(e=>e.name===t.name));e&&(e.answered=t.answered)})),this.setState({formData:s}),this.props.store.setUser(e);let r={attachments:[{type:"form_submit",form_submit:{state:'{"user_id":"'+this.props.store.matchUser().id+'"}',form_message_id:i.A.get(this.props.ev,"id"),fields:s}}]},o=i.A.convoOfEv(this.props.ev);this.props.store.sendConvoEvent(o,"message_sent",{message:r}),this.props.onSubmit&&this.props.onSubmit()}}function M(t){return btoa(t).split("=").join("")}class D extends r.Mw{constructor(t){super(t)}render(){if("user"===i.A.get(this.props.ev,"by.type"))return;let t=[],e=i.A.get(this.props.ev,"data.message.attachments")||[];i.A.each(e,(e=>{e&&("form"!==e.type&&"ask_info_form"!==e.type||(e.form._type=e.type,t.push(e.form)))}));let s=i.A.map(t,((t,e)=>(0,o.h)(C,{store:this.props.store,onSubmit:this.props.onSubmit,ref:t=>{this["form."+e]=t},key:e,form:t,ev:this.props.ev,t:this.props.t})));return 0===s.length?null:(0,o.h)("div",{class:"message-agent"},s)}focus(){var t=this["form.0"];t&&t.focus()}}class E extends r.Mw{constructor(t){super(t)}render(){return null}}function j(t){return t.touches&&t.touches.length?t.touches[0]:{}}class F extends r.Mw{constructor(t){super(t),this.state={focusing:0},this.galleryRef=(0,o._3)()}componentDidMount(){this.bindDrag()}focus(t){this.setState({focusing:t}),this.galleryRef.current.scrollTo({left:220*t,behavior:"smooth"})}render(){if("user"===i.A.get(this.props.ev,"by.type"))return null;let t=i.A.get(this.props.ev,"data.message.attachments",[]),e=i.A.filter(t,(t=>"generic"===i.A.get(t,"type")));return 0===e.length?null:i.A.map(e,((e,r)=>{var a=i.A.map(e.elements,(t=>{let e=this.props.t.i18n(t.i18n_title)||t.title,i=this.props.t.i18n(t.i18n_subtitle)||t.subtitle,r=e?(0,o.h)("div",{class:"generic-attachment--element-title"},e):null,a=i?(0,o.h)("div",{class:"generic-attachment--element-subtitle"},i):null,n=this.props.store.replaceFileUrl(t.image_url);return t.image_url||(n=s(2876)),(0,o.h)("div",{class:"generic-attachment--element swiper-slide"},(0,o.h)("div",null,(0,o.h)("img",{alt:"generic attachment element",class:"generic-attachment--element-img",src:n})),(0,o.h)("div",{class:"generic-attachment--element-content"},r,a),(0,o.h)(A,{buttons:t.buttons,onSelect:t=>this.props.onSelect(t),t:this.props.t}))}));let n=i.A.get(t,"0.elements",[]),l="generic-attachment-navigator generic-attachment-navigator--left",h="generic-attachment-navigator generic-attachment-navigator--right";return 0===this.state.focusing&&(l+=" generic-attachment-navigator--disabled"),this.state.focusing===n.length-1&&(h+=" generic-attachment-navigator--disabled"),(0,o.h)("div",{class:"generic-attachment-container"},(0,o.h)("div",{class:"generic-attachment",ref:this.galleryRef},a),!this.props.store.isMobile()&&(0,o.h)(o.FK,null,(0,o.h)("div",{class:l,onClick:t=>this.focus(this.state.focusing-1)},(0,o.h)("span",{class:"generic-attachment-navigator-icon"},"‹")),(0,o.h)("div",{class:h,onClick:t=>this.focus(this.state.focusing+1)},(0,o.h)("span",{class:"generic-attachment-navigator-icon"},"›"))))}))}bindDrag(){if(!this.props.store.isMobile())return;let t=document.getElementsByClassName("generic-attachment");i.A.map(t,(t=>{var e,s,i;(e=t)&&(e.removeEventListener("touchstart",e.md,0),window.removeEventListener("touchend",e.mu,0),window.removeEventListener("touchmove",e.mm,0),e.md=function(t){let r=j(t);e.hasAttribute("nochilddrag")&&document.elementFromPoint(r.pageX,r.pageY)||(i=1,s=r.clientX,t.preventDefault())},e.mu=()=>{i=0},e.mm=function(t){if(!i)return;let r=j(t);e.scrollLeft-=-s+r.clientX,s=r.clientX},e.addEventListener("touchstart",e.md,{passive:!0}),window.addEventListener("touchend",e.mu,{passive:!0}),window.addEventListener("touchmove",e.mm,{passive:!0}))}))}}class I extends r.Mw{render(){let t=i.A.get(this.props.ev,"by.type");if("user"===t)return null;let e=i.A.get(this.props.ev,"data.message.attachments",[]),r=i.A.filter(e,(t=>"product"===i.A.get(t,"type")||"product_preview"===i.A.get(t,"type")));if(r=r.filter((t=>t.product&&t.product.name)),0===r.length)return null;let a=this.props.store.matchAccount();return i.A.map(r,((e,r)=>{let n=e.product,l=[],h=n.url||n.mobile_url;this.props.store.isMobile()&&(h=n.mobile_url||n.url),h&&0==i.A.size(n.buttons)&&l.push((0,o.h)("a",{class:"product_attachment__btn",href:h,target:"_blank"},this.props.t("detail"),(0,o.h)("img",{src:s(3266),class:"product_attachment__btn_external_link"}))),console.log("P",n),i.A.size(n.buttons)>0&&(l=l.concat(i.A.map(n.buttons,((t,e)=>"call_button"===t.type?(0,o.h)("a",{class:"product_attachment__btn",href:"tel:"+t.phone_number,key:e,title:t.title},this.props.t.i18n(t.i18n_title)||t.title):"url_button"===t.type?(0,o.h)("a",{class:"product_attachment__btn",href:t.url,target:"_blank",key:e,title:t.title},this.props.t.i18n(t.i18n_title)||t.title||this.props.t("detail")," ",(0,o.h)("img",{src:s(3266),class:"product_attachment__btn_external_link"})):"postback_button"===t.type?(0,o.h)("a",{class:"product_attachment__btn",href:"javascript:;",onClick:e=>this.props.onPostback(t)},this.props.t.i18n(t.i18n_title)||t.title):void 0))));let p=(0,o.h)("a",{href:h,class:"product_attachment__title",target:"_blank"},n.name),d=null,c=n.description||n.long_description;c&&(d=(0,o.h)("div",{class:"product_attachment__subtitle"},c));let u=n.currency||i.A.get(a,"currency","VND"),m=null;n.price&&(m=(0,o.h)("div",{class:"product_attachment__price"},i.A.formatCurrency(n.price,u)));let g=this.props.store.replaceFileUrl(n.image);return n.image||(g=s(2876)),(0,o.h)("div",{class:"product_attachment product_attachment__"+t},(0,o.h)("div",null,(0,o.h)("a",{href:this.props.store.replaceFileUrl(n.image),target:"_blank"},(0,o.h)("img",{class:"product_attachment__img",src:g}))),p,d,m,(0,o.h)("div",{class:"product_attachment__btns"},l))}))}}class P extends r.Mw{render(){let t=i.A.get(this.props.ev,"by.type");if("user"===t)return null;this.props.store.matchAccount();var e=i.A.get(this.props.ev,"data.message.attachments",[]);let r=i.A.filter(e,(t=>"order"===t.type&&t.order)).map((t=>t.order));return 0===r.length?null:i.A.map(r,((e,r)=>{i.A.calcOrderTotal(e);let a=null;e.note&&(a=(0,o.h)("div",null,(0,o.h)("div",{class:"order_attachment__label"},this.props.t("note")),(0,o.h)("div",{class:"order_attachment__note",title:e.note},e.note)));let n=null;i.A.size(e.items)>0&&(n=(0,o.h)("div",null,(0,o.h)("div",{class:"order_attachment__label"},this.props.t("product")),i.A.map(e.items,(t=>{let e=t.product||{};return(0,o.h)("div",{class:"order_attachment__product"},(0,o.h)("img",{class:"order_attachment__product_img",alt:""+i.A.get(e,"id"),src:i.A.get(e,"image",s(2876))}),(0,o.h)("div",{style:"overflow: hidden !important;"},(0,o.h)("div",{class:"order_attachment__product_name",title:this.props.t.i18n(e.i18n_name)||e.name},this.props.t.i18n(e.i18n_name)||e.name),(0,o.h)("div",{class:"order_attachment__product_desc"},i.A.getProductPropName(e," / ")),(0,o.h)("div",{class:"order_attachment__product_desc"},this.props.t("qty")," ",t.quantity," · ",i.A.formatCurrency(e.price))))}))));let l=(0,o.h)("div",{class:"order_attachment__footer"},(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",null,this.props.t("total"))," ",(0,o.h)("div",null,(0,o.h)("b",{class:"order_attachment__total"},i.A.formatCurrency(e.total))))),h=i.A.find(i.A.get(e,"user.attributes",[]),(t=>"phones"===t.key))||{key:"phones",text:""},p=i.A.get(e,"shipping.address.phone","").trim();p=p||i.A.trim(h.text),p&&(p=this.props.t("phn")+": "+p);let d=null;(i.A.displayOrderShippingAddress(e)||p)&&(d=(0,o.h)("div",null,(0,o.h)("div",{class:"order_attachment__label"},this.props.t("ship_to")),(0,o.h)("div",null,i.A.displayOrderShippingAddress(e)),(0,o.h)("div",{class:"order_attachment__text_truncate"},p)));let c=null;e._discount_before_tax&&(c=(0,o.h)("div",{class:"order_attachment__footer"},(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("subtotal_before_tax"))," ",(0,o.h)("div",null,i.A.formatCurrency(e._order_value))),(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_before_tax"))," ",(0,o.h)("div",null,"-",i.A.formatCurrency(e._discount_before_tax)))));let u=(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("subtotal"))," ",(0,o.h)("div",{style:""},i.A.formatCurrency(e.subtotal))),m=null;if(e.total_tax){let t="";if(1===i.A.size(e._taxM)){let s=i.A.get(e._taxM,"0.tax",{});s.name&&s.percentage&&(t=`(${s.name} ${Math.round(s.percentage||0)/100}%)`)}m=(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("tax")," ",t),(0,o.h)("div",{style:""},i.A.formatCurrency(e.total_tax)))}let g=null;"percentage"===e.discount_type&&e.discount_percentage&&(g=(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_after_tax")," (",Math.round(e.discount_percentage/100),"%)")," ",(0,o.h)("div",{style:""},"-",i.A.formatCurrency(e._computed_discount)))),"amount"===e.discount_type&&e.discount_amount&&(g=(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("discount_after_tax"))," ",(0,o.h)("div",{class:"no-shrink"},"-",i.A.formatCurrency(e._computed_discount))));let v=null;i.A.get(e,"shipping.nominal_fee")&&(v=(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},this.props.t("shipping_fee"))," ",(0,o.h)("div",{style:""},i.A.formatCurrency(i.A.get(e,"shipping.nominal_fee",0)))));let f=null;return e.adjustment&&(f=(0,o.h)("div",{class:"d-flex align-items-center justify-content-between"},(0,o.h)("div",{class:"order_attachment__label no_margin"},e.adjustment_description)," ",(0,o.h)("div",{class:"no-shrink"},i.A.formatCurrency(e.adjustment)))),u=(0,o.h)("div",{class:"order_attachment__footer"},u,m,v,g,f),v||f||g||m||(u=null),(0,o.h)("div",{class:`order_attachment order_attachment__${t}`},(0,o.h)("div",{class:"order_attachment__header"},this.props.t("order"),(0,o.h)("span",{class:"order_attachment__text_muted order_attachment__text_sm"},i.A.getOrderDisplayName(e))),n,d,a,c,u,l)}))}}class R extends r.Mw{constructor(t){super(t)}render(){let t=i.A.get(this.props.ev,"by.type");var e=i.A.get(this.props.ev,"data.message.attachments",[]),s=[];if(i.A.each(e,((t,e)=>{t&&i.A.includes(t.mimetype,"video")&&s.push(t)})),0===s.length)return null;var r=i.A.map(s,((e,s)=>(0,o.h)("div",{class:`video-attachment video-attachment--${t}`},(0,o.h)("video",{class:"video-attachment__video",src:this.props.store.replaceFileUrl(e.url),width:"100%",height:"",poster:this.props.store.replaceFileUrl(e.thumbnail_url),controls:"controls",preload:"metadata"}))));return(0,o.h)("div",{class:`message-${t}`},r)}}class U extends r.Mw{render(){return"delta"===i.A.get(this.props.ev,"data.message.format","plaintext")?this.renderDelta():this.renderPlainText()}renderPlainText(){var t=i.A.get(this.props.ev,"data.message.text");if(t=i.A.trim(t),0===i.A.size(t))return null;let e=i.A.get(this.props.ev,"by.type");var s=i.A.extractText(t).map((t=>{if("emoji"===t.type)return(0,o.h)(a,{emojiCode:t.text,byType:e});if("link"===t.type){let e=t.text||"";return e.startsWith("//")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:")||(e="//"+e),(0,o.h)("a",{href:e,target:"_blank",onClick:t=>this.props.onLink(t,e)},t.text)}return"phone"===t.type?(0,o.h)("a",{href:"tel:"+t.text},t.text):"email"===t.type?(0,o.h)("a",{href:"mailto:"+t.text},t.text):t.text}));return 0===i.A.size(s)?null:"agent"===e?(0,o.h)("div",{class:"message-agent message-text--agent"},s):(0,o.h)("div",{class:"message-user message-text--user"},s)}renderDelta(){let t=i.A.get(this.props.ev,"data.message.quill_delta")||i.A.get(this.props.ev,"data.message.text"),e=i.A.parseJSON(t)||{};if(e=z(e),!e||0===i.A.size(e.ops))return null;let s=i.A.map(e.ops,(t=>{let e=t.insert,s=t.attributes;if(e.dynamicField)return i.A.get(e,"dynamicField.text","");if(e.mention){if("*"==e.mention.id||"all"==e.mention.id)return(0,o.h)("span",{class:"mention"},"@",this.$t("all"));let t=store.matchAgent(e.mention.id),s=i.A.getAgentDisplayName(t,e.mention.fullname);return(0,o.h)("span",{class:"mention","data-agent-id":t.id,"data-agent-fullname":s},"@",s)}if(e.emoji)return(0,o.h)(a,{emojiCode:`:${e.emoji}:`});if("string"==typeof e){let t=i.A.extractText(e).map(((t,e)=>{return"link"===t.type?(0,o.h)("a",{href:(s=t.text,s.startsWith("http://")||s.startsWith("https://")||s.startsWith("//")?s:"http://"+s),target:"_blank"},t.text):t.text;var s}));if(s){if(s.italic&&s.bold)return(0,o.h)("span",{style:"font-weight: bold !important; font-style: italic !important"},t);if(s.italic)return(0,o.h)("span",{style:"font-style: italic !important"},t);if(s.bold)return(0,o.h)("span",{style:"font-weight: bold !important"},t)}return(0,o.h)("span",null,t)}return null})),r=i.A.get(this.ev,"by.type");return"user"!==r&&(r="agent"),0===i.A.size(s)?null:"agent"===r?(0,o.h)("div",{class:"message-agent message-text--agent"},s):(0,o.h)("div",{class:"message-user message-text--user"},s)}}function z(t){if(!t)return t;if(!t.ops||!t.ops.length)return t;let e=t.ops[t.ops.length-1];if("string"!=typeof e.insert)return t;let s=e.insert.trimEnd();if(s){if(e.insert!=s){let e=t.ops.slice(),i=e.pop();return i.insert=s,e.push(i),{ops:e}}return t}let i=t.ops.slice();return i.pop(),z({ops:i})}var L=new i.A.Pubsub;i.A.setInterval((()=>L.publish("time")),2e4);class $ extends r.Mw{constructor(t){super(t),this.setState({t:"",langCode:"en_US"})}updateTime(){var t="";if(this.props.ago){if(this.props.short&&Math.abs(this.props.time-(new i.A.Date).getTime())>864e6){let e=new i.A.Date(this.props.time),s=e.getFullYear(),r=i.A.get(navigator,"languages.0","en-US"),o=e.toLocaleDateString(r,{month:"short"});t=e.getDate()+" "+o+" "+s}!t&&this.props.time>0&&(t=function(t,e){const s={s:"%d s",m:"1m",mm:"%dm",h:"1h",hh:"%dh",d:"1d",dd:"%dd",M:"1M",MM:"%M",y:"1y",yy:"%dy"},i=[{l:"s",r:44,d:1e3},{l:"m",r:89},{l:"mm",r:44,d:6e4},{l:"h",r:89},{l:"hh",r:21,d:36e5},{l:"d",r:35},{l:"dd",r:25,d:864e5},{l:"M",r:45},{l:"MM",r:10,d:2592e6},{l:"y",r:17},{l:"yy",d:31536e6}],r=i.length;let o,a;for(let n=0;n<r;n+=1){let r=i[n];r.d&&(o=(t-e)/r.d);let l=Math.round(Math.abs(o));if(l<=r.r||!r.r){l<=1&&n>0&&(r=i[n-1]),a=s[r.l].replace("%d",l);break}}return a}(this.props.time,(new i.A.Date).getTime()))}else t=i.A.shortTime(this.props.time,this.props.tzoffset);this.props.uppercase&&(t=t.toUpperCase()),t!==this.state.t&&this.setState({t})}componentDidMount(){L.on2(this,"time",(()=>this.updateTime())),this.updateTime()}render(){return(0,o.h)("span",{style:this.props.style},this.state.t)}}class O extends r.Mw{render(){let t=this.props.ev.ev;var e=null;if(this.props.ev.show_time&&(e=(0,o.h)("div",{class:"convo-event-time"},(0,o.h)($,{time:t.created}))),"conversation_rated"===t.type){var s=i.A.get(t,"data.conversation.ratings.0",{no_rating:!0,rating:0});return s.no_rating?null:(0,o.h)("div",{class:"convo-event"},e,(0,o.h)("div",{class:"info-message"},this.props.t("rated_as")+" "+this.props.t(function(t){return t?t<2?"poor":t<4?"average":"great":"poor"}(s.rating)).toLowerCase()))}return"conversation_state_updated"===t.type&&"ended"===i.A.get(t,"data.conversation.state")?(0,o.h)("div",{class:"convo-event"},e,(0,o.h)("div",{class:"info-message"},this.props.t("conversation_ended"))):null}}class T extends r.Mw{constructor(t){super(t),this.refForm=(0,o._3)()}render(){var t=i.A.get(this.props.event,"ev",{});switch(t.type){case"conversation_joined":break;case"message_sent":return this.renderMessageSent();case"conversation_state_updated":case"conversation_rating_requested":case"conversation_rated":return i.A.startsWith(t.id,"ev")?(0,o.h)(O,{t:this.props.t,store:this.props.store,ev:this.props.event}):null}return null}focus(){this.refForm.current&&this.refForm.current.focus()}chooseQuickReply(t){let e=i.A.get(this.props.event,"ev",{}),s={text:t.title,format:"plaintext"};t.payload&&(s.attachments=[{type:"postback",postback:{event_id:e.id,payload:t.payload}}]),this.props.onSend(s)}choosePostbackBtn(t){let e=i.A.get(this.props.event,"ev",{}),s={text:t.title,format:"plaintext"};t.payload&&(s.attachments=[{type:"postback",postback:{event_id:e.id,payload:t.payload}}]),this.props.onSend(s)}renderAgentAvatar(t){let e=i.A.get(t,"by.type"),r=i.A.get(t,"by.display_id",i.A.get(t,"by.id"));if("user"===e)return null;var a=this.getSenderName(t);let n=this.props.store.matchAccount();var l=n.logo_url||s(3582);if(i.A.get(this.props,"chatbox.hide_agent_profile"))return(0,o.h)("div",{class:"message-sender"},(0,o.h)("img",{alt:"sender",class:"message-sender-avatar",src:this.props.store.replaceFileUrl(l)}),(0,o.h)("p",{class:"message-sender-name"},n.name));let h=this.props.store.matchAgent("*");return"system"!==r&&"dummy"!==e&&"workflow"!==e&&(l=i.A.get(h[r],"avatar_url")||n.logo_url||s(2538)),(0,o.h)("div",{class:"message-sender"},(0,o.h)("img",{alt:"sender",class:"message-sender-avatar",src:this.props.store.replaceFileUrl(l)}),(0,o.h)("p",{class:"message-sender-name"},a))}renderMessageSent(){let t=this.props.event.ev;var e=null;this.props.event.show_time&&(e=(0,o.h)("div",{class:"convo-event-time"},(0,o.h)($,{time:t.created})));let s=new i.A.Date(t.created).toLocaleString();if("user"!==i.A.get(t,"by.type")){let i=null;return"lead"===this.props.event.mode&&(i=this.renderAgentAvatar(t)),(0,o.h)("div",{class:"convo-event agent-message",title:s},e,i,(0,o.h)(U,{store:this.props.store,ev:t,onLink:this.props.onLink}),(0,o.h)(y,{store:this.props.store,ev:t}),(0,o.h)(b,{store:this.props.store,ev:t}),(0,o.h)(R,{store:this.props.store,ev:t}),(0,o.h)(w,{store:this.props.store,ev:t}),(0,o.h)(k,{store:this.props.store,ev:t,t:this.props.t}),(0,o.h)(D,{store:this.props.store,onSubmit:this.props.onFormSubmit,ref:this.refForm,ev:t,t:this.props.t}),(0,o.h)(E,{store:this.props.store,ev:t,t:this.props.t}),(0,o.h)(F,{store:this.props.store,ev:t,onSelect:t=>this.choosePostbackBtn(t),t:this.props.t}),(0,o.h)(I,{t:this.props.t,onPostback:t=>this.choosePostbackBtn(t),store:this.props.store,ev:t}),(0,o.h)(P,{t:this.props.t,store:this.props.store,ev:t}),(0,o.h)(x,{store:this.props.store,ev:t,onSelect:t=>this.chooseQuickReply(t)}))}i.A.getMsgField(t,"idempotency")===t.id&&this.props.store.now()-t.created<900&&i.A.setTimeout((()=>this.setState({refresh:this.state.refresh})),1e3);let r=(0,o.h)("div",{class:"sending_dot"});(this.props.store.now()-t.created<900||i.A.getMsgField(t,"idempotency")!==t.id)&&(r=(0,o.h)("div",{class:"sending_dot sending_dot__hide"}));let a=null;"lead"===this.props.event.mode&&(a=(0,o.h)("div",{class:"pt-3"}));let n=null;if(t._error&&"message_sent"===t.type){let e=this.props.t("error_send_message");t._error_message&&(e=this.props.t(t._error_message)),n=(0,o.h)("a",{class:"message_error",src:"javascript:;",onClick:t=>this.resendMessage()},(0,o.h)("div",{class:"message_error__text"},e),(0,o.h)("div",{class:"message_error__icon"}))}return(0,o.h)("div",{class:"convo-event user-message",title:s},e,a,(0,o.h)("div",{class:"message-user__container"},r,(0,o.h)(U,{store:this.props.store,ev:t,refresh:this.state.refresh,onLink:this.props.onLink}),(0,o.h)(y,{store:this.props.store,ev:t}),(0,o.h)(b,{store:this.props.store,ev:t}),(0,o.h)(R,{store:this.props.store,ev:t}),(0,o.h)(w,{store:this.props.store,ev:t}),(0,o.h)(k,{store:this.props.store,ev:t,t:this.props.t}),(0,o.h)(D,{store:this.props.store,onSubmit:this.props.onFormSubmit,ref:this.refForm,ev:t}),(0,o.h)(I,{t:this.props.t,store:this.props.store,ev:t}),(0,o.h)(E,{store:this.props.store,ev:t})),n)}renderUpdateConvo(t){var e=i.A.get(t,"data.conversation.state");return"active"===e||"pending"===e?null:(0,o.h)("div",{class:"message-system"},this.props.t("conversation_state_updated",{state:e}))}resendMessage(){let t=i.A.convoOfEv(this.props.event.ev);const e=i.A.get(this.props.event,"ev.data.message");this.props.store.sendConvoEvent(t,"message_sent",{message:e})}getSenderName(t){let e=i.A.get(t,"by.type"),s=i.A.get(t,"by.display_id",i.A.get(t,"by.id"));if("user"===e)return i.A.getUserDisplayName(this.props.store.matchUser());let r=this.props.store.matchAccount();return"agent"===e?i.A.getAgentDisplayName(r,this.props.store.matchAgent(s)):"system"===s||"dummy"===e||"workflow"===e?r.name||"system":""}}const q=s(6973);class W extends r.Mw{render(){(this.props.mode+"").toLowerCase();let t=this.props.size||14,e=(Math.ceil(t/14),`width: ${t}px !important;height: ${t}px !important;`);return this.props.center?(0,o.h)("div",{class:"loading"},(0,o.h)("img",{alt:"loading",style:e,src:q})):(0,o.h)("img",{alt:"loading",style:e,src:q})}}const B=s(1370);class V extends r.Mw{constructor(t){super(t),this.props.store.onUpdate(this,(t=>this.forceUpdate())),this.props.store.onConvoEvent(this,(t=>this.onEvent(t))),this.loadConvo(),this.refBody=null,this.checkAndSeen=i.A.throttle((()=>{this.props.isShow&&this.isBottom()&&"visible"===this.props.store.browserVisibility&&document.hasFocus()&&this.props.store.seenConvo(this.props.cid)}),500),this.checkAndSeen()}componentDidUpdate(t){t.cid!==this.props.cid&&this.loadConvo()}render(){if(this.state.error)return this.renderError();let t=i.A.map(this.props.store.listEvents(this.props.cid));if(!this.state.loading&&0===i.A.size(t))return(0,o.h)("div",{ref:t=>this.refBody=t,class:"widget-body--events-container"},(0,o.h)("div",{class:"widget-body--empty"},(0,o.h)("div",{class:"widget-body--empty-icon"}),(0,o.h)("div",{class:"widget-body--empty-text"},this.props.t("empty_convo_text"))),(0,o.h)(m,{store:this.props.store}));t=i.A.orderBy(t,"created","asc"),this.props.store.matchConvo(this.props.cid),t=i.A.map(t,(t=>({ev:t}))),function(t,e){if(!((e=e.filter((t=>H(t.ev)))).length<1)){for(var s=1;s<e.length;s++){let t=e[s],r=e[s-1];H(t.ev)&&i.A.unixSec(t.ev.created)-i.A.unixSec(r.ev.created)>120&&(t.show_time=!0)}for(s=0;s<e.length;s++){let t=e[s];if("message_sent"===i.A.get(t,"ev.type")){t.show_time=!0;break}}for(s=0;s<e.length;s++){let t=e[s],r=e[s-1];"message_sent"!==t.ev.type||(t.mode="lead","message_sent"===i.A.get(r,"ev.type")&&i.A.get(r,"ev.by.id")===i.A.get(t,"ev.by.id")&&(t.mode="follow"))}}}(0,t);let e=i.A.map(t,(t=>(0,o.h)(T,{chatbox:this.props.chatbox,onLink:this.props.onLink,store:this.props.store,onFormSubmit:this.props.onFormSubmit,onSend:this.props.onSend,onPostback:this.props.onPostback,event:t,t:this.props.t,key:t.ev.id}))),s=null,r="opacity: 1 !important";return(this.state.loading||this.props.creating)&&(s=(0,o.h)(W,{static:!0,mode:i.A.get(this.props.chatbox,"primary_color","dark"),size:"120",center:!0}),r="opacity: 0 !important"),(0,o.h)(o.FK,null,s,(0,o.h)("div",{style:r,ref:t=>this.refBody=t,class:"widget-body--events-container",onMouseOver:this.checkAndSeen},(0,o.h)("div",{class:"widget-body--events"},e),(0,o.h)(m,{store:this.props.store})))}renderError(){let t=(0,o.h)("a",{href:"#",onclick:t=>this.loadConvo()},this.props.t("try_again"));return this.state.loading&&(t=(0,o.h)(W,{size:"16",mode:"blue"})),(0,o.h)("div",{class:"widget-body--events-container widget-body--events-container__error"},(0,o.h)("img",{alt:"empty",src:B}),(0,o.h)("div",{class:"widget_body__events__error_msg"},this.props.t("load_convo_error")),(0,o.h)("div",{class:"widget_body__events__error_retry"},t))}focus(){let t=this.props.store.listEvents(this.props.cid);var e;t=i.A.orderBy(i.A.map(t),"created","desc");for(let s of t)if("message_sent"===i.A.get(s,"type")&&"user"!==i.A.get(s,"by.type")){e=s;break}"user"===i.A.get(e,"by.type")&&(e=null);let s=i.A.get(e,"data.message.attachments",[]),r=this.props.store.matchConvo(this.props.cid);i.A.filter(s,(t=>{if(!t)return!1;if("form"!==t.type&&"ask_info_form"!==t.type)return!1;var e=t.form;return!(!e||!(i.A.parseJSON(e.state)||{}).require_finished&&"ask_info_form"!==t.type||function(t){let e=i.A.get(t,"fields")||[];return i.A.find(e,(t=>!!t.answered))}(t.form)||"ended"===r.state)}))}onEvent(t){if(i.A.convoOfEv(t)!==this.props.cid)return;let e=this.isBottom();var s=!1;"message_sent"===i.A.get(t,"type")&&t.id===i.A.getMsgField(t,"idempotency")&&(s=!0),(s||e)&&this.scrollToBottom()}async loadConvo(){if(!this.props.cid)return;this.lastContentOffsetY=0,this.setState({loading:!0});let t=this.props.store.listEvents(this.props.cid);if(0===i.A.size(t)){let t=this.props.cid,{error:e}=await this.props.store.fetchMoreEvents(t);if(this.setState({loading:!1}),t!==this.props.cid)return;if(e)return void this.setState({error:!0})}this.setState({loading:!0}),this.props.store.fetchMoreEvents(this.props.cid),this.setState({error:!1}),this.scrollToBottom(),i.A.setTimeout((()=>this.setState({loading:!1})),50)}isBottom(){let t=this.refBody;return!!t&&t.scrollHeight<t.scrollTop+t.offsetHeight+50}scrollToBottom(){i.A.setTimeout((()=>{const t=this.refBody;t&&(t.scrollTop=t.scrollHeight)})),i.A.setTimeout((()=>{const t=this.refBody;t&&(t.scrollTop=t.scrollHeight)}),200),this.props.isShow&&"visible"===this.props.store.browserVisibility&&document.hasFocus()&&this.props.store.seenConvo(this.props.cid)}}function H(t){let e=i.A.get(t,"type");return"message_sent"===e||"conversation_state_updated"===e}class Y extends r.Mw{constructor(t){super(t)}componentDidMount(){this.setState({isShow:!1,ev:{}}),this.props.store.onConvoEvent(this,(t=>{if(i.A.convoOfEv(t)!==this.props.cid)return;let e=this.props.store.matchUser();if(i.A.get(t,"by.id")===e.id)return;let s=i.A.get(this.state.ev,"by.id");return s&&i.A.get(t,"by.id")!==s?void 0:"message_sent"===i.A.get(t,"type")?(this.timer&&i.A.clearTimeout(this.timer),this.timer=null,void this.setState({isShow:!1})):void("conversation_typing"===i.A.get(t,"type")&&"agent"!=(this.props.store.matchAgent(i.A.get(t,"by.id"))||{}).type&&(this.setState({ev:t,isShow:!0}),this.timer&&i.A.clearTimeout(this.timer),this.timer=i.A.setTimeout((()=>{i.A.convoOfEv(t)===this.props.cid&&(this.timer=null,this.setState({isShow:!1}))}),5e3)))}))}render(){let t=this.props.store.matchAccount();var e=this.state.isShow?"":"typing--hidden";let s=i.A.get(this.state.ev,"by.display_id",i.A.get(this.state.ev,"by.id")),r=i.A.getAgentDisplayName(t,this.props.store.matchAgent(s));return(0,o.h)("div",{class:`typing ${e}`},r," ",this.props.t("typing"))}}const G=class{constructor(t){this.duration=t.duration||100,this.breakingV=t.breakingV||7,this.maxY=t.maxY||500,this.minY=t.minY||0}play(t,e,s){var r;this.stop();var o=a=>{a||(a=(new i.A.Date).getTime());var n=a-r,[l,h]=this.calcY(t,e,n);if(s(l),h)return this.stop();this.animationframe=window.requestAnimationFrame(o)};this.animationframe=window.requestAnimationFrame((t=>{r=t||(new i.A.Date).getTime(),o(r)}))}calcY(t,e,s){var i,r=function(t,e,s,i){if(N(t,e))return t;var r=t+(e-t)/i*s;return(t<e&&r>e||e<t&&r<e)&&(r=e),r}(e,i=e>this.maxY?this.maxY:e<this.minY?this.minY:Math.abs(t)<this.breakingV?Math.abs(this.maxY-e)<Math.abs(this.minY-e)?this.maxY:this.minY:t<0?this.maxY:this.minY,s,this.duration);return[r,N(r,i)]}stop(){window.cancelAnimationFrame(this.animationframe)}};function N(t,e){return Math.abs(t-e)<=.001}class J extends r.Mw{constructor(t){var e,s,i,r;super(t),e=this,i={hide:!0,ratingHeight:0,overlayOpacity:.3,comment:""},(s="symbol"==typeof(r=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(s="state"))?r:r+"")in e?Object.defineProperty(e,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[s]=i,this.refComment=(0,o._3)(),this.refRating=(0,o._3)(),this.refHandle=(0,o._3)()}componentDidMount(){this.props.store.onUpdate(this,(()=>{this.shoudDisplay()&&this.open()})),this.props.store.onConvoEvent(this,(t=>{i.A.convoOfEv(t)===this.props.cid&&this.shoudDisplay()&&this.open()})),this.mouseUp=t=>this.onMouseUp(t),this.mouseMove=t=>this.onMouseMove(t),this.mouseDown=t=>this.onMouseDown(t);var t=this.refHandle.current;t.addEventListener("mousedown",this.mouseDown,{passive:!0}),t.addEventListener("touchstart",this.mouseDown,{passive:!0}),window.addEventListener("mouseup",this.mouseUp,{passive:!0}),window.addEventListener("touchend",this.mouseUp,{passive:!0}),window.addEventListener("mousemove",this.mouseMove,{passive:!0}),window.addEventListener("touchmove",this.mouseMove,{passive:!0}),this.animation=new G({maxY:400,minY:0,duration:150}),this.close(),(this.shoudDisplay()||"rating"===this.props.forceView)&&this.open()}componentWillUnmount(){var t=this.refHandle.current;t.removeEventListener("mousedown",this.mouseDown,0),t.removeEventListener("touchstart",this.mouseDown,0),window.removeEventListener("mouseup",this.mouseUp,0),window.removeEventListener("touchend",this.mouseUp,0),window.removeEventListener("mousemove",this.mouseMove,0),window.removeEventListener("touchmove",this.mouseMove,0)}render(){let t=this.state.hide?"d-none":"";return(0,o.h)("div",{class:t},(0,o.h)("div",{class:"rating--overlay",style:`opacity: ${.5*this.state.overlayOpacity} !important;`}),(0,o.h)("div",{class:"rating",ref:this.refRating,style:`color:red; height: ${this.state.ratingHeight}px !important;`},(0,o.h)("div",{class:"rating--handle",ref:this.refHandle},(0,o.h)("div",{class:"rating--thumb"})),(0,o.h)("div",{class:"rating--content"},(0,o.h)("div",{class:"rating--heading"},this.props.t("rating_title"),(0,o.h)("div",{class:"rating--close-btn",onClick:t=>this.onCloseRating(t)})),(0,o.h)("div",{class:"rating--description"},this.props.t("rating_description")),(0,o.h)("textarea",{ref:this.refComment,type:"text",class:"rating--comment"}),(0,o.h)("div",{class:"rating-faces-container"},(0,o.h)("div",{class:"rating-face-container",onClick:t=>this.onRatingPoor(t)},(0,o.h)("img",{alt:"poor",src:s(9801)}),(0,o.h)("p",{class:"rating-face--text"},this.props.t("poor"))),(0,o.h)("div",{class:"rating-face-container",onClick:t=>this.onRatingAverage(t)},(0,o.h)("img",{alt:"average",src:s(7134)}),(0,o.h)("p",{class:"rating-face--text"},this.props.t("average"))),(0,o.h)("div",{class:"rating-face-container",onClick:t=>this.onRatingGreat(t)},(0,o.h)("img",{alt:"great",src:s(940)}),(0,o.h)("p",{class:"rating-face--text"},this.props.t("great")))),(0,o.h)("div",{class:"rating-no-thanks",onClick:t=>this.onCloseRating(t)},this.props.t("no_thanks")))))}shoudDisplay(){if(!this.props.cid)return!1;var t,e,s;let r=this.props.store.matchUser(),o=!1;if(i.A.map(this.props.store.listEvents(this.props.cid),(a=>{a&&a.by&&("user"==a.by.type&&(o=!0),"conversation_state_updated"===a.type&&"ended"===i.A.get(a,"data.conversation.state")&&(s=a),"conversation_rating_requested"===a.type&&(t=a),"conversation_rated"===a.type&&a.by.id===r.id&&(e=a))})),!o)return!1;if(e)return!1;var a=this.props.plugin.chatbox.auto_request_rating&&s;return t||a}onCloseRating(){this.props.onRate&&this.props.onRate({no_rating:!0,comment:this.refComment.current.value}),this.close()}onRatingPoor(){this.props.onRate&&this.props.onRate({rating:1,comment:this.refComment.current.value}),this.close()}onRatingAverage(){this.props.onRate&&this.props.onRate({rating:3,comment:this.refComment.current.value}),this.close()}onRatingGreat(){this.props.onRate&&this.props.onRate({rating:5,comment:this.refComment.current.value}),this.close()}open(){if(this.state.hide&&(this.setState({hide:!1}),this.refRating.current)){i.A.setTimeout((()=>{this.refComment.current&&this.refComment.current.focus()}),400),this.refComment.current.value="";var t=this.refRating.current.currentStyle||window.getComputedStyle(this.refRating.current),e=parseFloat(t.height);this.animation.play(-20,e,(t=>{this.setState({ratingHeight:t,overlayOpacity:Math.min(1,(t-0)/500)})}))}}close(){if(!this.state.hide&&this.refRating.current){var t=this.refRating.current.currentStyle||window.getComputedStyle(this.refRating.current),e=parseFloat(t.height);this.animation.play(20,e,(t=>{this.setState({ratingHeight:t,overlayOpacity:Math.min(1,(t-0)/500)}),t<10&&(this.state.hide||this.setState({hide:!0}))}))}}onMouseDown(t){this.mousePushed=!0,this.animation.stop(),t.preventDefault(),t.touches&&t.touches[0]&&(t=t.touches[0]),this.mousePushedDy=t.pageY-window.pageYOffset-this.refRating.current.getBoundingClientRect().y}onMouseUp(t){if(this.mousePushed){t.touches&&t.touches[0]&&(t=t.touches[0]),this.mousePushed=!1;var e=this.refRating.current.currentStyle||window.getComputedStyle(this.refRating.current),s=parseFloat(e.height);this.animation.play(this.mouseVelocity,s,(t=>{this.setState({ratingHeight:t,overlayOpacity:Math.min(1,(t-0)/500)}),t<10&&(this.state.hide||(this.setState({hide:!0}),this.props.onRate&&this.props.onRate({no_rating:!0})))}))}}onMouseMove(t){if(this.mousePushed){t.touches&&t.touches[0]&&(t=t.touches[0]);var e=t.pageY;this.mouseVelocity=e-this.lastMouseY,this.lastMouseY=e,e-=this.mousePushedDy;var s=this.refRating.current.getBoundingClientRect().bottom-e;s>400&&(s=500-1e4/(s+-300)),this.setState({ratingHeight:s,overlayOpacity:Math.min(1,(s-0)/500)})}}}function K(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class Q extends r.Mw{constructor(t){super(t),K(this,"state",{show:!1,searchValue:""}),K(this,"filterRef",(0,o._3)()),K(this,"overlayRef",(0,o._3)()),K(this,"onTouchMove",(t=>{t.target===this.overlayRef.current&&(t.preventDefault(),t.stopPropagation())})),K(this,"hideDropdown",(()=>{this.setState({show:!1,searchValue:""})})),K(this,"onKeydown",(t=>{if("Escape"===t.key){if(!this.state.show)return;this.state.searchValue?this.setState({searchValue:""}):this.hideDropdown(),t.preventDefault(),t.stopPropagation()}})),K(this,"hasSearch",(()=>!!this.props.has_search||i.A.size(this.props.items)>=10)),K(this,"getFilteredOptions",(()=>{let t=this.props.items;return this.state.searchValue&&this.hasSearch()&&(t=i.A.filter(t,(t=>{let e=i.A.unicodeToAscii(t.name).toLowerCase().replace(/ /g,""),s=i.A.unicodeToAscii(t.desc).toLowerCase().replace(/ /g,""),r=i.A.unicodeToAscii(this.state.searchValue).toLowerCase().replace(/ /g,"");return-1!=e.indexOf(r)||-1!=s.indexOf(r)}))),t})),K(this,"onChangeSearchValue",(t=>{this.setState({searchValue:t.target.value})})),K(this,"toogleDropdown",(async()=>{await this.setState({show:!0,searchValue:""}),this.focusFilter()})),K(this,"onSelect",(t=>{this.props.onSelect(t),this.hideDropdown()})),K(this,"onBackgroundScroll",(t=>{console.log("EEEEEEE",t),alert("y")})),document.addEventListener("touchmove",(function(t){}))}componentDidMount(){window.addEventListener("keydown",this.onKeydown)}componentWillUnmount(){window.removeEventListener("keydown",this.onKeydown)}renderEmpty(){return(0,o.h)("div",{class:"dropdown_select_filter__empty"},(0,o.h)("img",{class:"dropdown_select_filter__empty_img",src:s(3142)}),(0,o.h)("div",{class:"muted",style:"text-align: center !important;"},"Không có kết quả"))}renderLoading(){return(0,o.h)("div",{class:"dropdown_select_filter__empty pt-3"},(0,o.h)(W,{size:"40",static:!0}),(0,o.h)("div",{class:"muted mt-2",style:"text-align: center !important;"},"Đang tải dữ liệu"))}focusFilter(){this.filterRef.current&&(this.filterRef.current.focus(),i.A.setTimeout((()=>{this.filterRef.current&&this.filterRef.current.focus()}),100))}renderDropdown(){if(!this.state.show)return null;let t=this.getFilteredOptions(),e=i.A.map(t,(t=>(0,o.h)("div",{class:"dropdown_select__item",onClick:e=>this.onSelect(t)},t.name))),r=null;if(this.hasSearch()){let t=(0,o.h)("img",{class:"dropdown_select_filter__icon",src:s(5452)});this.props.loading&&(t=(0,o.h)("img",{class:"dropdown_select_filter__icon",src:s(185)})),r=(0,o.h)("div",{class:"dropdown_select_filter"},t,(0,o.h)("input",{ref:this.filterRef,value:this.state.searchValue,onInput:this.onChangeSearchValue,type:"text",class:"dropdown_select_filter_input "}))}0==e.length&&(e=this.renderEmpty()),this.props.loading&&(e=this.renderLoading());let a=`width: ${this.props.width||"150px"} !important;`;return this.props.full?(a=" top: 20px !important; left: 20px !important; right: 20px !important; width: unset !important; ",(0,o.h)("div",{class:"dropdown_select__overlay",ref:this.overlayRef,onClick:this.hideDropdown,onTouchMove:this.onTouchMove},(0,o.h)("div",{class:"dropdown_select",style:a,onClick:t=>{t.preventDefault(),t.stopPropagation()}},r,(0,o.h)("div",{class:"dropdown_select__items"},e)))):(0,o.h)("div",{class:"dropdown_select",style:a},r,(0,o.h)("div",{class:"dropdown_select__items"},e))}render(){let t=(0,o.h)("div",{class:"muted text-truncate",style:"flex: 1 !important;"},"Chọn một phần tử");i.A.get(this.props,"selected.name")&&(t=(0,o.h)("div",{class:"text-truncate",style:"flex: 1 !important;"},i.A.get(this.props,"selected.name")));let e="position: relative !important;";return this.props.full&&(e=""),(0,o.h)("div",{style:e},(0,o.h)(r.tW,{onClickaway:this.hideDropdown},(0,o.h)("div",{type:"text",class:"dropdown_select_input "+this.props.extra_cls,onClick:this.toogleDropdown},t," ",(0,o.h)("img",{class:"dropdown_select__caret",src:s(7741)})),this.renderDropdown()))}}function X(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class Z extends r.Mw{constructor(t){super(t),X(this,"state",{show:!1,searchValue:"",addresses:[]}),X(this,"filterRef",(0,o._3)()),X(this,"overlayRef",(0,o._3)()),X(this,"onTouchMove",(t=>{t.target===this.overlayRef.current&&(t.preventDefault(),t.stopPropagation())})),X(this,"hideDropdown",(()=>{this.setState({show:!1,searchValue:""})})),X(this,"onKeydown",(t=>{if("Escape"===t.key){if(!this.state.show)return;this.state.searchValue?this.setState({searchValue:""}):this.hideDropdown(),t.preventDefault(),t.stopPropagation()}t.key})),X(this,"doSearch",i.A.throttle((async()=>{let t=Date.now();this.requestId=t;let e=await this.props.store.suggest_addresses(this.state.searchValue);this.requestId===t&&this.setState({addresses:i.A.get(e,"body.addresses",[])})}),100)),X(this,"onChangeSearchValue",(t=>{this.setState({searchValue:t.target.value}),this.props.onChangeAddress(t.target.value),this.doSearch()})),X(this,"toogleDropdown",(async()=>{await this.setState({show:!0,searchValue:this.props.initAddress||""}),this.focusFilter()})),X(this,"onSelect",(t=>{this.props.onSelect(t),this.hideDropdown()})),X(this,"onBackgroundScroll",(t=>{console.log("EEEEEEE",t)})),document.addEventListener("touchmove",(function(t){}))}componentDidMount(){window.addEventListener("keydown",this.onKeydown)}componentWillUnmount(){window.removeEventListener("keydown",this.onKeydown)}renderEmpty(){return(0,o.h)("div",{class:"dropdown_select_filter__empty"},(0,o.h)("img",{class:"dropdown_select_filter__empty_img",src:s(3142)}),(0,o.h)("div",{class:"muted",style:"text-align: center !important;"},"Không có kết quả"))}renderLoading(){return(0,o.h)("div",{class:"dropdown_select_filter__empty pt-3"},(0,o.h)(W,{size:"40",static:!0}),(0,o.h)("div",{class:"muted mt-2",style:"text-align: center !important;"},"Đang tải dữ liệu"))}focusFilter(){this.filterRef.current&&(this.filterRef.current.focus(),i.A.setTimeout((()=>{this.filterRef.current&&this.filterRef.current.focus()}),100))}renderDropdown(){if(!this.state.show)return null;let t=i.A.map(this.state.addresses,((t,e)=>{let s=[((t.address||"")+" "+tt(t.street)).trim()].join(", "),i=[tt(t.ward),tt(t.district),tt(t.province)].join(", ");return(0,o.h)("div",{class:"dropdown_select__item",onClick:e=>this.onSelect(t),key:e},(0,o.h)("div",null,(0,o.h)("b",null,s)),(0,o.h)("div",{style:"opacity: 0.7 !important;"},i))})),e=null,r=(0,o.h)("img",{class:"dropdown_select_filter__icon",src:s(5452)});this.props.loading&&(r=(0,o.h)("img",{class:"dropdown_select_filter__icon",src:s(185)})),e=(0,o.h)("div",{class:"dropdown_select_filter"},r,(0,o.h)("input",{ref:this.filterRef,value:this.state.searchValue,onInput:this.onChangeSearchValue,type:"text",class:"dropdown_select_filter_input "})),0==t.length&&(t=this.renderEmpty()),this.props.loading&&(t=this.renderLoading());let a=`width: ${this.props.width||"150px"} !important;`;return this.props.full?(a=" top: 20px !important; left: 20px !important; right: 20px !important; width: unset !important; ",(0,o.h)("div",{class:"dropdown_select__overlay",ref:this.overlayRef,onClick:this.hideDropdown,onTouchMove:this.onTouchMove},(0,o.h)("div",{class:"dropdown_select",style:a,onClick:t=>{t.preventDefault(),t.stopPropagation()}},e,(0,o.h)("div",{class:"dropdown_select__items"},t)))):(0,o.h)("div",{class:"dropdown_select",style:a},e,(0,o.h)("div",{class:"dropdown_select__items"},t))}render(){let t=(0,o.h)("div",{class:"text-truncate",style:"flex: 1 !important;"},this.props.initAddress),e="position: relative !important;";return this.props.full&&(e=""),(0,o.h)("div",{style:e},(0,o.h)(r.tW,{onClickaway:this.hideDropdown},(0,o.h)("div",{type:"text",class:"dropdown_select_input "+this.props.extra_cls,onClick:this.toogleDropdown},t),this.renderDropdown()))}}function tt(t){let e=(t+"").toLowerCase();return e.startsWith("tp ")?t.substr(3):e.startsWith("thanh pho ")||e.startsWith("thành phố ")?t.substr(10):e.startsWith("tỉnh ")?t.substr(5):e.startsWith("huyện ")?t.substr(6):e.startsWith("tỉnh ")?t.substr(5):e.startsWith("xã ")?t.substr(3):e.startsWith("thị trấn ")?t.substr(9):e.startsWith("thị xã ")?t.substr(7):e.startsWith("đường ")&&(t[7]<"0"||t[7]>"9")?t.substr(6):e.startsWith("phường ")&&(t[7]<"0"||t[7]>"9")?t.substr(7):e.startsWith("quận ")&&(t[7]<"0"||t[7]>"9")?t.substr(5):t}s.e(278).then(s.bind(s,9278));var et=document.createElement("link");et.href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap",et.rel="stylesheet",document.head.append(et),i.A.preloadWebfonts(["Roboto"],[400,500]),s(2538);class st extends r.Mw{render(){return"package"==this.props.name?this.props.active?(0,o.h)("img",{style:"width: 18px !important;",src:s(8512)}):(0,o.h)("img",{style:"width: 18px !important;",src:s(6857)}):"shop"===this.props.name?this.props.active?(0,o.h)("img",{style:"width: 18px !important;",src:s(5244)}):(0,o.h)("img",{style:"width: 18px !important;",src:s(2523)}):void 0}}function it(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}var rt=s(5860),ot=s(3080);class at extends r.Mw{constructor(t){super(t),it(this,"state",{loadProvince:!0,g_err:"",fullname:"",email:"",phone:"",loading:!0,order:{},err:{},shipping_address:"new",selectedProvince:null,selectedDistrict:null,selectedWard:null,street:"",address:"",sending:!1,step:""}),it(this,"renderMobileSuccess",(t=>(0,o.h)("div",{class:"order",style:"height: 100% !important"},(0,o.h)("div",{style:"display: flex !important; align-items: center !important; padding-top: 40px !important; padding-bottom: 20px !important; flex-direction: column !important; height: 100% !important"},(0,o.h)("img",{style:"width: 60px !important; height: 60px !important;",width:"60",height:"60",src:rt}),(0,o.h)("div",{style:"margin-top: 20px !important; margin-bottom: 10px !important"},(0,o.h)("b",{style:"font-size: 18px !important;"},"Đơn hàng của bạn đã được ghi nhận")),(0,o.h)("div",{class:"muted"},"Tôi sẽ liên hệ lại với bạn khi đơn hàng được xử lý"),(0,o.h)("div",{style:"flex:1 !important"}),(0,o.h)("div",{style:"margin-top: 20px !important; padding: 0px 20px 0 20px !important; width: 100% !important"},(0,o.h)("div",{class:"order_btn order__btn__light",onClick:this.close},this.props.t("close"))))))),it(this,"onSelectProvince",(async t=>{this.setState({selectedProvince:t,err:{},g_err:""}),this.setState({loadDistrict:!0});let e=await this.props.store.list_districts({id:t.id});this.setState({loadDistrict:!1}),e.error||this.setState({districts:i.A.get(e,"body.addresses")})})),it(this,"onSelectDistrict",(async t=>{this.setState({selectedDistrict:t,err:{},g_err:""}),this.setState({loadWard:!0});let e=await this.props.store.list_wards({id:t.id});this.setState({loadWard:!1}),e.error||this.setState({wards:i.A.get(e,"body.addresses")})})),it(this,"onSelectWard",(t=>this.setState({selectedWard:t,err:{},g_err:""}))),it(this,"onChangeFullname",(t=>this.setState({fullname:t.target.value,err:{},g_err:""}))),it(this,"onChangeAddress",(t=>this.setState({address:t,err:{},g_err:""}))),it(this,"onSelectAddress",(t=>{t&&(this.setState({address:[i.A.trim(t.address),i.A.trim(t.street)].join(" ").trim(),street:t.street,err:{},g_err:""}),this.onSelectWard({id:t.ward_id,name:t.ward}),this.onSelectDistrict({id:t.district_id,name:t.district}),this.onSelectProvince({id:t.province_id,name:t.province}))})),it(this,"onChangeEmail",(t=>this.setState({email:t.target.value,err:{},g_err:""}))),it(this,"onChangePhone",(t=>this.setState({phone:t.target.value,err:{},g_err:""}))),it(this,"onChangePaymentMethod",(t=>this.setState({pm:t}))),it(this,"onChangeQuantity",((t,e)=>{let s=parseInt(e)||1;t.quantity=s,this.forceUpdate()})),it(this,"confirm",(async()=>{this.setState({g_err:""});let t={};if(this.state.shipping||this.setState({g_err:"Mời bạn chọn địa chỉ giao hàng trước khi xác nhận"}),"shop"===this.state.shipping?(i.A.isPhone(this.state.phone)||(t.phone=!0),i.A.trim(this.state.fullname)||(t.name=!0),i.A.trim(this.state.email)||(t.email=!0)):"new"==this.state.shipping_address&&(i.A.isPhone(this.state.phone)||(t.phone=!0),i.A.trim(this.state.fullname)||(t.name=!0),i.A.trim(this.state.address)||(t.address=!0),0==i.A.size(this.state.selectedWard)&&(t.ward=!0),0==i.A.size(this.state.selectedDistrict)&&(t.district=!0),0==i.A.size(this.state.selectedProvince)&&(t.province=!0)),i.A.size(t)>0)return void this.setState({err:t,g_err:this.props.t("input_shipping_info_err")});let e=this.props.store.matchUser(),s=i.A.getUserAttr(e,"fullname","text"),r=i.A.getUserAttr(e,"emails","text"),o=i.A.getUserAttr(e,"phones","text"),a=i.A.cloneDeep(this.state.order);if("shop"===this.state.shipping)i.A.set(a,"shipping.pickup_at_shop",!0),i.A.set(a,"shipping.address.phone",this.state.phone),i.A.set(a,"shipping.address.fullname",this.state.fullname),i.A.set(a,"shipping.address.email",this.state.email);else if("new"==this.state.shipping_address){let t=await this.props.store.createShippingAddress({address:this.state.address,country:"Việt Nam",fullname:this.state.fullname,email:this.state.email,phone:this.state.phone,district:this.state.selectedDistrict.name,district_id:this.state.selectedDistrict.id,province:this.state.selectedProvince.name,province_id:this.state.selectedProvince.id,ward:this.state.selectedWard.name,street:this.state.street,ward_id:this.state.selectedWard.id});if(t.error)return this.setState({g_err:this.props.t("update_failed")});i.A.set(a,"shipping.address",t.body)}else{let e=this.props.store.matchShippingAddresses(),s=i.A.find(e,(t=>t.id===this.state.shipping_address));if(!s)return this.setState({err:t,g_err:this.props.t("input_shipping_info_err")});i.A.set(a,"shipping.address",s)}let n=!1;!s&&this.state.fullname&&(n=!0,i.A.setUserAttr(e,{key:"fullname",text:this.state.fullname})),!r&&this.state.email&&(n=!0,i.A.setUserAttr(e,{key:"emails",text:this.state.email})),!o&&this.state.phone&&(n=!0,i.A.setUserAttr(e,{key:"phones",text:this.state.phone})),n&&this.props.store.setUser(e),this.setState({sending:!0}),a.user_confirmation="confirmed";let l=await this.props.store.updateOrder(a);if(this.setState({sending:!1}),l.error)return this.setState({g_err:this.props.t("update_failed")});this.setState({step:"success"}),this.props.onResponse&&this.props.onResponse("confirmed")})),it(this,"onCancel",(()=>{if(this.props.onResponse&&this.props.onResponse("rejected"),this.props.cid&&!this.state.order.user_confirmation){let t=i.A.cloneDeep(this.state.order);t.user_confirmation="rejected",this.props.store.updateOrder(t)}this.close()})),it(this,"close",(()=>{this.props.onClose&&this.props.onClose()})),this.load()}async load(){if(!this.props.order_id)return;let t=await this.props.store.fetchOrder(this.props.order_id);this.setState({loading:!1}),t.error?this.setState({error:t.error}):this.setState({order:t.body}),this.props.store.matchUser();let e=i.A.get(this.props.store.matchUser(),"attributes",[]),s=i.A.get(i.A.find(e,(t=>"fullname"===t.key)),"text"),r=i.A.get(i.A.find(e,(t=>"emails"===t.key)),"text"),o=i.A.get(i.A.find(e,(t=>"phones"===t.key)),"text");this.setState({fullname:s,email:r,phone:o}),await this.props.store.fetchShippingAddresses();let a=await this.props.store.list_provinces();this.setState({loadProvince:!1}),a.error||this.setState({provinces:i.A.get(a,"body.addresses")})}isMobile(){return!!this.props.cid||!!this.props.isMobile||this.props.store.isMobile()}onChangeShippingAddress(t){this.setState({shipping_address:t,err:{},g_err:""})}onChangeShipping(t){this.setState({shipping:t,err:{},g_err:""})}renderDesktopPaymentMethod(t){return null}renderDesktopShipping(t){let e=!1;if(t.status&&"open"!=t.status||(e=!t.user_confirmation),this.props.store.matchUser(),e){let t=this.props.store.matchShippingAddresses(),e=i.A.map(this.state.provinces,(t=>({id:t.id,name:t.province}))),s=i.A.map(this.state.districts,(t=>({id:t.id,name:t.district}))),r=i.A.map(this.state.wards,(t=>({id:t.id,name:t.ward}))),a="ship_card",n=null,l=!1;if("ship"===this.state.shipping){l=!0;let h=i.A.map(t,(t=>{let e=[t.street,t.ward,t.district,t.region,t.country].filter((t=>t)).join(", "),s=null;return t.phone&&(s=(0,o.h)(o.FK,null," · ",this.props.t("phn")," ",t.phone)),(0,o.h)("div",{style:"margin-bottom: 15px !important"},(0,o.h)("div",{class:"radio d-flex "},(0,o.h)("input",{type:"radio",id:"shipping_addr."+t.id,onInput:e=>this.onChangeShippingAddress(t.id),name:"shipping_address",checked:this.state.shipping_address===t.id}),(0,o.h)("label",{class:"radio--label",for:"shipping_addr."+t.id,style:`font-weight: ${this.state.shipping_address===t.id?500:400} !important`},t.fullname,s,(0,o.h)("div",{class:"mt-1 muted"},"DC ",e)),(0,o.h)("div",{class:"radio--check"},(0,o.h)("div",{class:"inside"}))))}));h.push((0,o.h)("div",{style:""},(0,o.h)("div",{class:"radio d-flex "},(0,o.h)("input",{type:"radio",id:"shipping_addr.new",onInput:t=>this.onChangeShippingAddress("new"),name:"shipping_address",checked:"new"===this.state.shipping_address}),(0,o.h)("label",{class:"radio--label",for:"shipping_addr.new"},"new"===this.state.shipping_address?(0,o.h)("b",null,"Tới địa chỉ khác"):"Tới địa chỉ khác"),(0,o.h)("div",{class:"radio--check"},(0,o.h)("div",{class:"inside"})))));let p=(0,o.h)("div",{style:"padding-left: 22px !important;"},(0,o.h)("div",{class:"d-flex"},(0,o.h)("div",{class:"mr-2",style:"flex: 1 !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("fullname")),(0,o.h)("input",{type:"text",class:"form-control "+(this.state.err.name&&"err"),onInput:this.onChangeFullname,value:this.state.fullname})),(0,o.h)("div",{class:"ml-2",style:"flex: 1 !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("phones")),(0,o.h)("input",{type:"text",class:"form-control "+(this.state.err.phone&&"err"),onInput:this.onChangePhone,value:this.state.phone}))),(0,o.h)("div",{class:"",style:"width: 100% !important"},(0,o.h)("div",{class:"order_form_label"},this.props.t("address")),(0,o.h)(Z,{initAddress:this.state.address,store:this.props.store,width:"100%",onChangeAddress:this.onChangeAddress,full:this.isMobile(),onSelect:this.onSelectAddress,extra_cls:this.state.err.address&&"err"})),(0,o.h)("div",{class:"d-flex",style:"justify-content: space-between !important;"},(0,o.h)("div",{style:"flex: 1 !important; overflow:hidden !important; margin-right: 7px !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("province")),(0,o.h)(Q,{width:"194",full:this.isMobile(),has_search:!0,loading:this.state.loadProvince,items:e,selected:this.state.selectedProvince,onSelect:this.onSelectProvince,extra_cls:this.state.err.province&&"err"})),(0,o.h)("div",{style:"flex: 1 !important; overflow:hidden !important; margin-left: 7px !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("district")),(0,o.h)(Q,{width:"194",full:this.isMobile(),selected:this.state.selectedDistrict,has_search:!0,onSelect:this.onSelectDistrict,loading:this.state.loadDistrict,extra_cls:this.state.err.district&&"err",items:s}))),(0,o.h)("div",{class:"d-flex",style:"justify-content: space-between !important;"},(0,o.h)("div",{style:"flex: 1 !important; overflow:hidden !important; margin-right: 7px !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("ward")),(0,o.h)(Q,{width:"194",selected:this.state.selectedWard,full:this.isMobile(),has_search:!0,onSelect:this.onSelectWard,extra_cls:this.state.err.ward&&"err",loading:this.state.loadWard,items:r})),(0,o.h)("div",{style:"flex: 1 !important; margin-left: 7px !important;"})));a+=" ship_card__active",0==i.A.size(t)?n=(0,o.h)("div",null,(0,o.h)("div",{class:"mt-3 mb-2 "},this.props.t("input_shipping_info")),p):("new"!==this.state.shipping_address&&(p=null),n=(0,o.h)("div",null,(0,o.h)("div",{class:"mt-3 mb-2",style:"margin-bottom: 10px !important;"},"Vui lòng chọn địa chỉ giao hàng"),(0,o.h)("div",{class:"form"},h),p))}let h="ship_card",p=!1;"shop"===this.state.shipping&&(p=!0,h+=" ship_card__active",n=(0,o.h)("div",null,(0,o.h)("div",{class:"d-flex"},(0,o.h)("div",{class:"mr-2",style:"flex: 3 !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("fullname")),(0,o.h)("input",{type:"text",class:"form-control "+(this.state.err.name&&"err"),onInput:this.onChangeFullname,value:this.state.fullname})),(0,o.h)("div",{class:"ml-2",style:"flex: 2 !important;"},(0,o.h)("div",{class:"order_form_label"},this.props.t("phones")),(0,o.h)("input",{type:"text",class:"form-control "+(this.state.err.phone&&"err"),onInput:this.onChangePhone,value:this.state.phone}))),(0,o.h)("div",null,(0,o.h)("div",{class:"order_form_label"},this.props.t("email")),(0,o.h)("input",{type:"text",class:"form-control "+(this.state.err.email&&"err"),onInput:this.onChangeEmail,value:this.state.email}))));let d="card_section";return this.isMobile()&&(d="order_section"),(0,o.h)(o.FK,null,(0,o.h)("div",{class:"order_section__line"}),(0,o.h)("div",{class:d},(0,o.h)("div",{class:"order_label"},this.props.t("ship_to")),(0,o.h)("div",{class:"d-flex"},(0,o.h)("div",{class:h+" mr-3",onClick:t=>this.onChangeShipping("shop")},(0,o.h)(st,{name:"shop",active:p})," ",(0,o.h)("b",{class:"ml-2"},"Nhận hàng tại shop")),(0,o.h)("div",{class:a,onClick:t=>this.onChangeShipping("ship")},(0,o.h)(st,{name:"package",active:l})," ",(0,o.h)("b",{class:"ml-2"},"Giao hàng cho tôi"))),n))}let s=i.A.get(t,"shipping.address")||{},r=[s.address,s.ward,s.district,s.region,s.country].filter((t=>t)).join(", "),a=null;s.phone&&(a=(0,o.h)("div",{class:"mt-1 muted"},this.props.t("phn"),": ",s.phone)),i.A.get(t,"shipping.pickup_at_shop")&&(r="Nhận hàng tại cửa hàng");let n=r?(0,o.h)("div",null,r):(0,o.h)("i",{class:"i muted"},"Chưa có địa chỉ giao hàng"),l="card_section";return this.isMobile()&&(l="order_section"),(0,o.h)("div",{class:l},(0,o.h)("div",{class:"order_label "},this.props.t("ship_to")),n,a)}renderDesktopSummary(t){let e=null;t.deposit>0&&(e=(0,o.h)("span",{class:"muted"},"(cọc ",i.A.formatCurrency(t.deposit),")"));let r=null;t.total_discount>0&&(r=(0,o.h)("div",{class:"order_summary_line"},(0,o.h)("div",null,"Giảm giá"),(0,o.h)("div",null,i.A.formatCurrency(t.total_discount))));let a=null;(e||t.payment_made)&&(a=(0,o.h)(o.FK,null,(0,o.h)("div",{class:"order_summary_line"},(0,o.h)("div",null,"Bạn đã trả"),(0,o.h)("div",null,e," ",i.A.formatCurrency(t.payment_made))),(0,o.h)("div",{class:"order_summary_line"},(0,o.h)("div",null,"Bạn chưa trả"),(0,o.h)("div",null,i.A.formatCurrency((t.total||0)-(t.payment_made||0))))));let n=(0,o.h)("div",{class:"order_summary_line"},(0,o.h)("div",null,"Tiền thuế"),(0,o.h)("div",null,i.A.formatCurrency(t.total_tax))),l=(0,o.h)("div",{class:"order_summary_line"},(0,o.h)("div",null,"Phí vận chuyển"),(0,o.h)("div",null,i.A.get(t,"shipping.fee",0)," d")),h=!1;t.status&&"open"!=t.status||(h=!t.user_confirmation);let p=null;h&&(l=null,n=null,p=(0,o.h)("div",{class:"muted"},(0,o.h)("img",{class:"order_ship_icon",src:s(7324)}),"  Chưa bao gồm thuế và phí vận chuyển"));let d="";return this.isMobile()&&(d="order_section"),(0,o.h)(o.FK,null,(0,o.h)("div",{class:"order_section__line"}),(0,o.h)("div",{class:d},(0,o.h)("div",{class:"order_label"},"Tóm tắt"),(0,o.h)("div",{class:"order_summary_line"},(0,o.h)("div",null,"Tổng tiền hàng"),(0,o.h)("div",null,i.A.formatCurrency(t.subtotal))),n,r,l,p,(0,o.h)("div",{class:"order_summary_line",style:"margin-top: 10px !important; padding-top: 15px !important; border-top: 1px solid #eee !important"},(0,o.h)("div",null,"Bạn phải trả"),(0,o.h)("div",{class:"order__total"},i.A.formatCurrency(t.total))),a))}renderStatusBadge(t){let e=t.status||"open";return(0,o.h)("div",{style:"float: right !important;",class:"order_status order_status__"+e},e)}renderShippingInfo(t){"open"!=t.status||t.user_confirmation;let e=i.A.get(t,"shipping.shipping_provider");if(!e)return null;let r=i.A.get(t,"shipping.shipping_code"),a=null;return r&&(a=(0,o.h)("div",{class:"muted",style:"margin-top: 3px !important"},"Vận đơn ",(0,o.h)("a",{class:"order_tracking_link",target:"_blank",href:"https://giaohangtietkiem.vn/tra-cuu-van-don/"+r},r," ",(0,o.h)("img",{class:"order_tracking_link_icon",src:s(3266)})))),"ghtk"==e?(0,o.h)("div",{class:"order_section"},(0,o.h)("div",{class:"order_section_label"},"Đơn vị vận chuyển"),(0,o.h)("div",{class:"d-flex align-items-center"},(0,o.h)("img",{class:"order_shipping_provider_logo",src:nt.ghtk.logo}),(0,o.h)("div",null,nt.ghtk.name,a))):null}renderDesktopShippingInfo(t){let e=i.A.get(t,"shipping.shipping_provider");if(!e)return null;let r=i.A.get(t,"shipping.shipping_code"),a=null;return r&&(a=(0,o.h)("div",{class:"muted",style:"margin-top: 3px !important"},"Vận đơn ",(0,o.h)("a",{class:"order_tracking_link",target:"_blank",href:"https://giaohangtietkiem.vn/tra-cuu-van-don/"+r},r," ",(0,o.h)("img",{class:"order_tracking_link_icon",src:s(3266)})))),"ghtk"==e?(0,o.h)(o.FK,null,(0,o.h)("div",{class:"order_label"},"Đơn vị vận chuyển"),(0,o.h)("div",{class:"d-flex align-items-center"},(0,o.h)("img",{class:"order_shipping_provider_logo",src:nt.ghtk.logo}),(0,o.h)("div",null,nt.ghtk.name,a))):null}renderProducts(t){let e=null;return e=i.A.map(t.items,(t=>{if(!t||!t.product)return null;let e=t.product;return(0,o.h)("div",{class:"order_attachment__product"},(0,o.h)("img",{class:"order_attachment__product_img",alt:""+e.id,src:i.A.get(e,"images.0")||s(2876)}),(0,o.h)("div",{style:"overflow: hidden !important;"},(0,o.h)("div",{class:"order_attachment__product_name"},e.name),(0,o.h)("div",{class:"order_attachment__product_desc"},e.description||e.long_description),(0,o.h)("div",{class:"order_attachment__product_desc"},this.props.t("qty")," ",t.quantity," · ",i.A.formatCurrency(e.price))))})),this.isMobile()?(0,o.h)("div",{class:"order_section"},(0,o.h)("div",{class:"order_section_label"},this.props.t("product")),e):(0,o.h)("div",null,(0,o.h)("div",{class:"order_label"},this.props.t("product")),e)}renderDesktopProducts(t){let e=null,r=!1;return t.status&&"open"!=t.status||(r=!t.user_confirmation),e=r?i.A.map(t.items,(t=>{if(!t||!t.product)return null;let e=t.product;return(0,o.h)("div",{class:"order_attachment__product"},(0,o.h)("img",{class:"order_attachment__product_img",alt:""+e.id,src:i.A.get(e,"images.0")||s(2876)}),(0,o.h)("div",{style:"overflow: hidden !important; flex: 1 !important"},(0,o.h)("div",{class:"order_attachment__product_name"},e.name),(0,o.h)("div",{class:"order_attachment__product_desc"},e.description||e.long_description),(0,o.h)("div",{class:"order_attachment__product_desc"},i.A.formatCurrency(e.price))),(0,o.h)("input",{class:"form-control",style:"text-align: center !important; font-weight: 400 !important; width: 50px !important",value:t.quantity,onInput:e=>this.onChangeQuantity(t,e.target.value),type:"text"}),(0,o.h)("div",{style:"width: 80px !important; text-align: right !important; "},(0,o.h)("b",null,i.A.formatCurrency(t.quantity*e.price))))})):i.A.map(t.items,(t=>{if(!t||!t.product)return null;let e=t.product;return(0,o.h)("div",{class:"order_attachment__product"},(0,o.h)("img",{class:"order_attachment__product_img",alt:""+e.id,src:i.A.get(e,"images.0")||s(2876)}),(0,o.h)("div",{style:"overflow: hidden !important; flex: 1 !important"},(0,o.h)("div",{class:"order_attachment__product_name"},e.name),(0,o.h)("div",{class:"order_attachment__product_desc"},e.description||e.long_description),(0,o.h)("div",{class:"order_attachment__product_desc"},i.A.formatCurrency(e.price))),(0,o.h)("div",{style:"text-align: center !important; font-weight: 400 !important; width: 50px !important"},t.quantity),(0,o.h)("div",{style:"width: 80px !important; text-align: right !important; "},(0,o.h)("b",null,i.A.formatCurrency(t.total))))})),(0,o.h)("div",{class:"card_section"},(0,o.h)("div",{class:"desktop_order__heading"},this.renderStatusBadge(t),(0,o.h)("b",{style:"font-size: 18px !important;"},this.props.t("order")," #",t.order_number||t.id),(0,o.h)("div",{class:"muted"},(0,o.h)($,{style:"font-size: 13px !important;",time:t.issue_date||t.created}))),(0,o.h)("div",{class:"order_label d-flex",style:"margin-top: 20px !important;justify-content: space-between !important; align-items: flex-end !important;"},(0,o.h)("div",{style:"flex: 1 !important;"},this.props.t("product")),(0,o.h)("div",{style:"font-weight: 400 !important; text-align:center !important; width: 50px !important"},this.props.t("qty")),(0,o.h)("div",{style:"font-weight: 400 !important; text-align: right !important; width: 80px !important;"},this.props.t("total"))),e)}renderMobile(t){if("success"===this.state.step)return this.renderMobileSuccess(t);let e=null;this.state.g_err&&(e=(0,o.h)("div",{class:"mb-2 text__danger"},(0,o.h)("img",{style:"margin-top: -4px !important; height: 15px !important;",src:ot})," ",(0,o.h)("b",null,this.state.g_err)));let s=(0,o.h)("div",null,e,(0,o.h)("div",{class:"btn-confirm-order",style:"margin-top: 0 !important;",onClick:this.confirm},this.props.t("confirm_order"))),i=(0,o.h)("div",{class:"order_btn order__btn__light mt-3",onClick:this.onCancel},this.props.t("cancel_order"));return(t.user_confirmation||"open"!=t.status)&&(s=null,this.props.cid&&(i=(0,o.h)("div",{class:"order_btn order__btn__light mt-3",onClick:this.close},this.props.t("close")))),(0,o.h)("div",{class:"order",style:"height: 100% !important"},(0,o.h)("div",{class:"order--content"},(0,o.h)("div",{class:"order--heading"},this.renderStatusBadge(t),(0,o.h)("b",{style:"font-size: 16px !important;"},this.props.t("order")," #",t.order_number||t.id),(0,o.h)("div",{class:"muted"},(0,o.h)($,{style:"font-size: 13px !important;",time:t.issue_date||t.created}))),this.renderProducts(t),this.renderDesktopShipping(t),this.renderShippingInfo(t),this.renderDesktopPaymentMethod(t),this.renderDesktopSummary(t),(0,o.h)("div",{class:"order_section pb-3",style:"padding-top: 0 !important;"},s,i)))}renderActions(t){let e=null,s=!1;if(t.status&&"open"!=t.status||(s=!t.user_confirmation),"success"===this.state.step)return(0,o.h)("div",{class:"d-flex",style:"align-items: center !important; justify-content: flex-end !important"},(0,o.h)("div",null,"Ghi nhận thành công")," ",(0,o.h)("img",{style:"width: 16px !important; height: 16px !important;",width:"16",height:"16",src:rt}));if(s){let t=null;this.state.g_err&&(t=(0,o.h)("div",{class:"mb-2 text__danger"},(0,o.h)("img",{style:"margin-top: -4px !important; height: 15px !important;",src:ot})," ",(0,o.h)("b",null,this.state.g_err))),e=(0,o.h)("div",null,t,(0,o.h)("div",{class:"btn-confirm-order",onClick:this.confirm},this.props.t("confirm_order")),(0,o.h)("div",{class:"btn-cancel-order",onClick:this.onCancel},this.props.t("cancel_order")))}return e}renderDesktop(t){let e=this.props.store.matchAccount();var i=e.logo_url||s(3582);return(0,o.h)("div",{class:"desktop order"},(0,o.h)("div",{class:"order_acc_header"},(0,o.h)("img",{class:"order_acc_logo",src:i}),(0,o.h)("div",{class:"order_acc_name"},e.name)),(0,o.h)("div",{class:"desktop_order__content"},(0,o.h)("div",{style:"flex: 1 !important; padding-right: 20px !important;"},this.renderDesktopProducts(t),this.renderDesktopShipping(t),this.renderDesktopShippingInfo(t),this.renderDesktopPaymentMethod(t),(0,o.h)("div",{class:"order__footer"},(0,o.h)("a",{target:"_blank",href:"https://subiz.com.vn",class:"order__footer_link"},"Cung cấp bởi ",(0,o.h)("b",null,"Subiz")),(0,o.h)("div",{class:"order__footer_delimiter"}),(0,o.h)("a",{target:"_blank",href:"https://subiz.com.vn/vi/terms-of-service.html",class:"order__footer_link"},"Điều khoản"),(0,o.h)("a",{target:"_blank",href:"https://subiz.com.vn/vi/privacy-policy.html",class:"order__footer_link"},"Quyền riêng tư"))),(0,o.h)("div",null,(0,o.h)("div",{class:"order_recap"},this.renderDesktopSummary(t),this.renderActions(t)))))}render(){if(this.state.loading)return(0,o.h)("div",{class:"order_error"},(0,o.h)(W,{class:"mt-4",size:"60",static:!0}));if(this.state.error)return(0,o.h)("div",{class:"order_error"},(0,o.h)("img",{class:"mt-3",src:s(6907)}),(0,o.h)("div",{class:"mt-3"},this.props.t("order_load_error")));let t=this.state.order;return this.isMobile()?this.renderMobile(t):this.renderDesktop(t)}}let nt={ghtk:{name:"Giao hàng tiết kiệm",logo:s(7362)},ghn:{name:"Giao hàng nhanh",logo:s(1113)}};function lt(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}s(2538);class ht extends r.Mw{constructor(t){super(t),lt(this,"state",{hide:!0,ratingHeight:0,overlayOpacity:.3}),lt(this,"onResponse",(t=>{this.setState({response:t})})),lt(this,"confirm",(()=>{this.props.store.sendConvoEvent(this.props.cid,"message_sent",{message:{format:"plaintext",text:"confirm",attachments:[{type:"postback",postback:{payload:JSON.stringify({type:"order_confirmation",status:"confirmed"})}}]}})})),lt(this,"close",(async()=>{if(await i.A.sleep(100),"confirmed"===this.state.response?this.props.store.sendConvoEvent(this.props.cid,"message_sent",{message:{format:"plaintext",text:this.props.t("confirm_order"),attachments:[{type:"postback",postback:{payload:JSON.stringify({type:"order_confirmation",status:"confirmed"})}}]}}):"rejected"===this.state.response&&this.props.store.sendConvoEvent(this.props.cid,"message_sent",{message:{format:"plaintext",text:this.props.t("cancel_order"),attachments:[{type:"postback",postback:{payload:JSON.stringify({type:"order_confirmation",status:"cancelled"})}}]}}),this.setState({response:""}),!this.state.hide&&this.refRating.current){var t=this.refRating.current.currentStyle||window.getComputedStyle(this.refRating.current),e=parseFloat(t.height);this.animation.play(20,e,(t=>{this.setState({ratingHeight:t,overlayOpacity:Math.min(1,(t-0)/500)}),t<10&&(this.state.hide||this.setState({hide:!0}))})),this.props.onClose()}})),this.refRating=(0,o._3)(),this.refHandle=(0,o._3)()}componentDidMount(){this.mouseUp=t=>this.onMouseUp(t),this.mouseMove=t=>this.onMouseMove(t),this.mouseDown=t=>this.onMouseDown(t);var t=this.refHandle.current;t.addEventListener("mousedown",this.mouseDown,{passive:!0}),t.addEventListener("touchstart",this.mouseDown,{passive:!0}),window.addEventListener("mouseup",this.mouseUp,{passive:!0}),window.addEventListener("touchend",this.mouseUp,{passive:!0}),window.addEventListener("mousemove",this.mouseMove,{passive:!0}),window.addEventListener("touchmove",this.mouseMove,{passive:!0}),this.animation=new G({maxY:400,minY:0,duration:150}),this.close()}componentWillUnmount(){var t=this.refHandle.current;t.removeEventListener("mousedown",this.mouseDown,0),t.removeEventListener("touchstart",this.mouseDown,0),window.removeEventListener("mouseup",this.mouseUp,0),window.removeEventListener("touchend",this.mouseUp,0),window.removeEventListener("mousemove",this.mouseMove,0),window.removeEventListener("touchmove",this.mouseMove,0)}render(){this._show!=this.props.show&&(this._show=this.props.show,i.A.setTimeout((()=>{this._show?this.open():this.close()})));let t=this.state.hide?"d-none":"";return(0,o.h)("div",{class:t},(0,o.h)("div",{class:"extension--overlay",style:`opacity: ${.5*this.state.overlayOpacity} !important;`}),(0,o.h)("div",{class:"extension",ref:this.refRating,style:`height: ${this.state.ratingHeight}px !important;`},(0,o.h)("div",{class:"extension--close-btn",onClick:this.close},this.props.t("close")),(0,o.h)("div",{class:"extension--handle",ref:this.refHandle},(0,o.h)("div",{class:"extension--thumb"})),(0,o.h)("div",{style:"overflow-x: hidden !important; overflow-y: scroll !important; height: 100% !important;"},(0,o.h)(at,{key:this.props.order_id,store:this.props.store,onResponse:this.onResponse,onClose:this.close,t:this.props.t,order_id:this.props.order_id,cid:this.props.cid}))))}open(){if(this.state.hide&&this.props.order_id&&(this.setState({hide:!1}),this.refRating.current)){var t=this.refRating.current.currentStyle||window.getComputedStyle(this.refRating.current),e=parseFloat(t.height);this.animation.play(-20,e,(t=>{this.setState({ratingHeight:t,overlayOpacity:Math.min(1,(t-0)/500)})}))}}onMouseDown(t){this.mousePushed=!0,this.animation.stop(),t.preventDefault(),t.touches&&t.touches[0]&&(t=t.touches[0]),this.mousePushedDy=t.pageY-window.pageYOffset-this.refRating.current.getBoundingClientRect().y}onMouseUp(t){if(this.mousePushed){t.touches&&t.touches[0]&&(t=t.touches[0]),this.mousePushed=!1;var e=this.refRating.current.currentStyle||window.getComputedStyle(this.refRating.current),s=parseFloat(e.height);this.animation.play(this.mouseVelocity,s,(t=>{this.setState({ratingHeight:t,overlayOpacity:Math.min(1,(t-0)/500)}),t<10&&(this.state.hide||(this.setState({hide:!0}),this.props.onRate&&this.props.onRate({no_rating:!0})))}))}}onMouseMove(t){if(this.mousePushed){t.touches&&t.touches[0]&&(t=t.touches[0]);var e=t.pageY;this.mouseVelocity=e-this.lastMouseY,this.lastMouseY=e,e-=this.mousePushedDy;var s=this.refRating.current.getBoundingClientRect().bottom-e;s>400&&(s=500-1e4/(s+-300)),this.setState({ratingHeight:s,overlayOpacity:Math.min(1,(s-0)/500)})}}}function pt(t,e,s){var i;return(e="symbol"==typeof(i=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(e))?i:i+"")in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}var dt=s(8506),ct=s(9150),ut=s(9419);const mt="https://file-subiz.com/fiqoahedjbgwclpouoml-avatar_default_baa8a1d7.png";class gt extends r.Mw{constructor(t){super(t),pt(this,"msgInput",(0,o._3)()),pt(this,"formMounted",(t=>{let e=this.fillForm(t);e.question={key:"question",is_required:!0,label:this.props.t.i18n(i.A.get(t,"i18n_question_label",{}))||t.question_label,type:"text",value:this.state.quickReplyMessage.text},this.setState({formData:e}),this.props.store.isMobile()||this.focusInput()})),pt(this,"sendMessage",(async t=>{let e=i.A.find(t.attachments,(t=>"postback"===t.type));if(this.isFormRequired()&&e)return this.onStartConvoClick(),void this.fillQuickReplyToQuestion(t);let s=t.text;if(!this.props.cid){this._creating=(this._creating||0)+1;let e=this._creating;this.setState({creating:!0});const{convo:i,error:r}=await this.props.store.startConvo({locale:this.props.t.locale(),message:s,initial_by:this.props.store.matchUser().id});if(e!=this._creating)return;if(await this.props.store.sendConvoEvent(i.id,"message_sent",{message:t}),e!=this._creating)return;return this.setState({creating:!1}),void this.props.onGo({view:"chat",cid:i.id})}await this.props.store.sendConvoEvent(this.props.cid,"message_sent",{message:t}),this.setState({creating:!1})})),pt(this,"onLink",((t,e)=>{if(!e)return t.preventDefault();let s=e.replace(/(^\w+:|^)\/\//,"");if(s.startsWith("widget.subiz.com.vn/orders/")){let e=s.substr(27);return e=e.split("/")[0],this.setState({showOrder:!0,order_id:e}),void t.preventDefault()}})),pt(this,"closeOrder",(t=>{this.setState({showOrder:!1,order_id:""}),this.focusInput()})),this.userSent={},this.wasFormInputed=!1,this.setState({creating:!1,clickedJoin:!1,formData:{},showOrder:!1,order_id:"",quickReplyMessage:{}}),this.props.store.onUpdate(this,(t=>this.forceUpdate()))}componentDidMount(){this.props.store.isMobile()||this.focusInput(),this.updateFormDataFields()}componentDidUpdate(t){t.isShow!==this.props.isShow&&(this.props.isShow&&!this.props.store.isMobile()&&this.focusInput(),this.props.isShow&&this.props.store.isMobile()&&this.blur(),this.updateFormDataFields()),t.cid!==this.props.cid&&(this.closeOrder(),this.setState({clickedJoin:!1,quickReplyMessage:{}}),i.A.setTimeout((()=>{this.events&&this.events.focus(),this.props.store.isMobile()||this.focusInput()}),100),this.updateFormDataFields())}shouldShowForm(){let t,e=this.props.plugin.chatbox||{},s=this.props.store.matchAccount()||{};i.A.get(e,"prechat_form.enabled")&&(t=e.prechat_form);let r=i.A.get(e,"offline_form.enabled");if(this.isOffline(s,e)&&r&&(t=e.offline_form),!this.hasSentMessage(this.props.cid)&&t&&(i.A.size(t.groups)||t.group_required))return!0;let o=this.isFormRequired();return o&&!this.props.cid||o&&this.props.cid&&this.state.clickedJoin}render(){let t,e=this.shouldShowForm(),s="",r=this.props.plugin.chatbox||{},a=this.props.store.matchAccount()||{},n=this.props.t("prechat_form_btn");i.A.get(r,"prechat_form.enabled")&&(t=r.prechat_form);let l=i.A.get(r,"offline_form.enabled");this.isOffline(a,r)&&l&&(t=r.offline_form,n=this.props.t("offline_form_btn"),s="offline"),"offline_form"===this.props.view&&(e=!0,t=r.offline_form,s="offline",n=this.props.t("offline_form_btn")),"prechat_form"===this.props.view&&(e=!0,t=r.prechat_form,n=this.props.t("prechat_form_btn"),s="prechat");let h=null;h="list"===this.props.view?this.renderConvoList():e?this.renderForm(t,n,s):this.renderChat();let p=i.A.get(r,"desktop_button.position")||"right";this.props.store.isMobile()&&(p=i.A.get(r,"mobile_button.position",p));let d="widget-container widget-container--"+p;return this.props.store.isMobile()||"full"!==i.A.get(r,"window_mode")||(d+=" widget-container--full"),this.props.isShow||(d+=" widget-container--hide"),(0,o.h)("div",{class:d},(0,o.h)(v,{t:this.props.t,plugin:this.props.plugin,store:this.props.store,cid:this.props.cid,view:this.props.view,onClose:this.props.onClose,onGotoList:()=>this.props.onGo({view:"list"})}),h)}async submitPrechatForm(t,e){if(this.state.submiting)return;var s=!1;if(i.A.map(this.state.formData,((t,e)=>{t.is_required&&(void 0===t.value||""===t.value||0===i.A.size(t.value)&&Array.isArray(t.value))?(t.error=this.props.t("error_empty"),s=!0):t.error="","emails"===e.substr(5)&&!i.A.isEmail(t.value)&&t.is_required&&(t.error=this.props.t("error_email_invalid"),s=!0),"phones"===e.substr(5)&&!i.A.isPhone(t.value)&&t.is_required&&(t.error=this.props.t("error_phone_invalid"),s=!0)})),s)return this.forceUpdate();let r=i.A.cloneDeep(this.state.formData),o=i.A.cloneDeep(this.props.store.matchUser()),a=!1;i.A.map(r,((t,e)=>{if(e.startsWith("attr:")){var s={key:e.substr(5)};a=a||"emails"==e||"phones"==e,"number"===t.type&&(s.number=parseInt(t.value)),"datetime"===t.type&&(s.datetime=new i.A.Date(t.value).toISOString()),"list"===t.type&&(s.text=t.value),"text"!==t.type&&"boolean"!==t.type||(s[t.type]=t.value),i.A.setUserAttr(o,s)}})),a&&i.A.setUserAttr(o,{key:"lead_source",text:"widget"});let n=i.A.get(r,"question.value"),l=i.A.get(r,"group.value","");this._creating=(this._creating||0)+1;let h=this._creating;this.setState({creating:!0});let p=i.A.map(r,((t,e)=>({key:e,type:t.type,value:i.A.stringify(t.value)})));if(this.props.store.submitForm("chatbox_"+e,p,o),h!=this._creating)return;if(this.props.cid){if(this.setState({clickedJoin:!1}),await this.props.store.sendConvoEvent(this.props.cid,"message_sent",{message:{text:n,format:"plaintext",fields:[{key:"to_agent_group",value:i.A.stringify(l)}],attachments:this.state.quickReplyMessage.attachments}}),h!=this._creating)return;return this.setState({creating:!1,quickReplyMessage:{}}),t.end_conversation_after_submit&&await this.props.store.endConvo(this.props.cid),void this._creating}let d={text:n,format:"plaintext"},c={group_id:l,message:n,locale:this.props.t.locale(),initial_by:o.id};this.setState({creatingError:null});const{error:u,convo:m}=await this.props.store.startConvo(c);if(h!=this._creating)return;if(u)return void this.setState({creating:!1,creatingError:u});let g=m.id;this.userSent[g]=!0,await this.props.store.sendConvoEvent(g,"message_sent",{message:d}),h==this._creating&&(this.setState({creating:!1,clickedJoin:!1,quickReplyMessage:{}}),this.props.onGo({view:"chat",cid:g}),this.props.store.isMobile()||this.focusInput())}onBooleanChange(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>s===t));r&&(r.value=e.target.checked,this.setState({formData:s}))}onInputChange(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>s===t));r&&(r.value=e,this.setState({formData:s}))}onListAddItem(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>s===t));r&&(r.value=r.value||[],r.value.push(e),this.setState({formData:s}))}onListRemoveItem(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>s===t));r&&(r.value=r.value||[],r.value.splice(e,1),this.setState({formData:s}))}renderCheckboxField(t){let e=i.A.get(t,"def.items",[]),s=[],r=t.value||"";return r&&(s=r.split(",")),(0,o.h)("div",null,i.A.map(e,(e=>(0,o.h)("div",{class:"checkbox"},(0,o.h)("input",{type:"checkbox",id:"form-checkbox"+ft(t.key)+e.value,onChange:s=>this.toggleCheckboxField(t.key,e.value),checked:s.includes(e.value)}),(0,o.h)("label",{class:"checkbox--label",for:"form-checkbox"+ft(t.key)+e.value},this.props.t.i18n(e.i18n_label)||e.label||e.value),(0,o.h)("div",{class:"checkbox--check"},(0,o.h)("div",null))))))}toggleCheckboxField(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>e.key===t));if(!r)return;let o=r.value||"",a=[];o&&(a=o.split(",")),a.includes(e)?a=i.A.filter(a,(t=>t!==e)):a.push(e),r.value=a.join(","),this.setState({formData:s})}renderRadioField(t){let e=i.A.get(t,"def.items",[]),s=t.value||"";return(0,o.h)("div",null,i.A.map(e,(e=>(0,o.h)("div",{class:"radio"},(0,o.h)("input",{type:"radio",name:"form-radio"+ft(t.key),id:"form-radio"+ft(t.key)+e.value,onChange:s=>this.toggleRadioField(t.key,e.value),checked:s===e.value}),(0,o.h)("label",{class:"radio--label",for:"form-radio"+ft(t.key)+e.value},this.props.t.i18n(e.i18n_label)||e.label||e.value),(0,o.h)("div",{class:"radio--check"},(0,o.h)("div",null))))))}toggleRadioField(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>e.key===t));r&&(r.value=e,this.setState({formData:s}))}selectDropdownField(t,e){this.wasFormInputed=!0;let s=i.A.cloneDeep(this.state.formData),r=i.A.find(s,((e,s)=>e.key===t));r&&(r.value=e,this.setState({formData:s}))}renderDropdownField(t){let e=i.A.get(t,"def.items",[]);return(0,o.h)("select",{class:"form-control",value:t.value,onChange:e=>this.selectDropdownField(t.key,e.target.value)},(0,o.h)("option",{value:""},"-- ",this.props.t("no_select")," --"),i.A.map(e,(t=>(0,o.h)("option",{value:t.value},this.props.t.i18n(t.i18n_label)||t.label||t.value))))}renderFields(){if(0===i.A.size(this.state.formData))return null;let t=i.A.map(this.state.formData,((t,e)=>{if(this.state.quickReplyMessage.text&&"question"===e)return null;let s=null;var r=t.error?"input--error":"";if("text"===t.type)s="question"===e?(0,o.h)("textarea",{class:"form-control",ref:t=>{this["form_"+ft(e)]=t},value:t.value||"",onInput:t=>this.onInputChange(e,t.target.value),row:"4",class:"form-control"}):"checkbox"===i.A.get(t,"def.select")?this.renderCheckboxField(t):"radio"===i.A.get(t,"def.select")?this.renderRadioField(t):"dropdown"===i.A.get(t,"def.select")?this.renderDropdownField(t):i.A.get(t,"def.multiple_line")?(0,o.h)("textarea",{class:"form-control",ref:t=>{this["form_"+ft(e)]=t},value:t.value||"",onInput:t=>this.onInputChange(e,t.target.value),onChange:t=>this.onInputChange(e,t.target.value),row:"4",class:"form-control"}):(0,o.h)("input",{value:t.value||"",onInput:t=>this.onInputChange(e,t.target.value),onChange:t=>this.onInputChange(e,t.target.value),ref:t=>{this["form_"+ft(e)]=t},class:`form-control ${r}`,type:"text"});else if("number"===t.type)s=(0,o.h)("input",{value:t.value,onInput:t=>this.onInputChange(e,t.target.value),ref:t=>{this["form_"+ft(e)]=t},class:`form-control ${r}`,type:"number"});else if("boolean"===t.type)s=(0,o.h)("div",{class:"checkbox"},(0,o.h)("input",{type:"checkbox",id:"form-checkbox"+ft(e),onInput:t=>this.onBooleanChange(e,t),checked:t.value}),(0,o.h)("label",{class:"checkbox--label",for:"form-checkbox"+ft(e)},t.label),(0,o.h)("div",{class:"checkbox--check"},(0,o.h)("div",null)));else if("group"===t.type)s=i.A.map(t.list,(s=>(0,o.h)("div",{class:"radio"},(0,o.h)("input",{type:"radio",id:"form-radio"+ft(e)+ft(s.value),checked:t.value===s.value,onInput:t=>this.onInputChange(e,s.value)}),(0,o.h)("label",{class:"radio--label",for:"form-radio"+ft(e)+ft(s.value)},s.label),(0,o.h)("div",{class:"radio--check"},(0,o.h)("div",{class:"inside"})))));else if("list"===t.type){let r=this.state.formData[e].value||[],a=i.A.filter(i.A.get(t,"list",[]),(t=>!i.A.includes(r,t)));s=(0,o.h)(S,{selected:r,items:a,onAddItem:t=>this.onListAddItem(e,t),onRemoveItem:t=>this.onListRemoveItem(e,t)}),s=this.renderDropdownField(t)}else"datetime"===t.type&&(s=(0,o.h)("input",{value:t.value,onInput:t=>this.onInputChange(e,t.target.value),class:`form-control ${r}`,type:"date"}));let a="";return"fullname"===t.key?a=this.props.t("fullname"):"emails"===t.key?a=this.props.t("email"):"phones"===t.key?a=this.props.t("phones"):"question"===t.key&&(a=t.label||this.props.t("your_question")),t.label&&(a=t.label),(0,o.h)("div",{key:"form_"+ft(e)},(0,o.h)("div",{class:"label"},a,t.is_required?(0,o.h)("span",{class:"ml-1 red"},"*"):""),t.error?(0,o.h)("div",{class:"form-control--valid-input--error"},t.error):"",s)}));return(0,o.h)("div",{class:"pt-2"},t)}renderForm(t,e,s){let r=this.props.t.i18n(i.A.get(t,"i18n_title",{}));return r||(r=i.A.get(t,"title",this.props.t("capture_lead_title"))),r=r.replace("↵",""),(0,o.h)("div",{class:"widget-body"},(0,o.h)(vt,{key:t._updated,form:t,onMount:this.formMounted}),(0,o.h)("div",{class:"widget-body--content flex-grow-1 pl-3 pr-3 d-flex flex-column"},(0,o.h)("div",{class:"flex-grow-1"},(0,o.h)("div",{class:"form mt-3 pl-3 pr-3 pt-3 pb-3 d-flex flex-column"},(0,o.h)("div",null,r),this.renderFields())),(0,o.h)(m,{store:this.props.store,t:this.props.t})),(0,o.h)("div",{class:"message-input message-input--preform"},(0,o.h)("button",{class:"btn--start-convo",onClick:e=>this.submitPrechatForm(t,s),disabled:this.state.creating},e)))}goToConvo(t){this.props.onGo({view:"chat",cid:t})}renderConvoList(){let t=this.props.store.matchConvo("*");var e=i.A.map(t,(t=>this.props.store.matchConvo(t.id)));e=i.A.filter(e,(t=>!!t)),e=i.A.orderByF(e,(t=>i.A.get(t,"last_message_sent.created",t.actived)),"desc");var s=i.A.map(e,(t=>{let e=i.A.filter(t.members,(t=>("agent"===t.type||"bot"===t.type)&&"active"===t.membership)),s=i.A.map(e,(t=>t.id));return s=s||i.A.agentsOfConvo(t)[0],(0,o.h)("div",{class:"convo-list--item",onClick:()=>this.goToConvo(t.id),key:t.id},(0,o.h)(g,{plugin:this.props.plugin,store:this.props.store,mode:"member",class:"d-flex flex-row",tooltipPos:"right",agent_ids:s}),this.renderConvoSummary(t))}));let r=(0,o.h)("div",{class:"convo-list--list"},s);return 0===i.A.size(e)&&(r=(0,o.h)("div",{class:"convo-list--list"},(0,o.h)("div",{class:"empty-container"},(0,o.h)("img",{alt:"empty",src:ut}),(0,o.h)("div",{class:"empty-desc"},this.props.t("empty_convo"))))),(0,o.h)("div",{class:"convo-list"},(0,o.h)("div",{class:"convo-list--container"},(0,o.h)("div",{class:"convo-list--title"},this.props.t("conversations")),r),(0,o.h)("div",{class:"convo-list--footer"},(0,o.h)("button",{class:"btn--start-convo",onClick:t=>this.goToConvo("")},(0,o.h)("span",null,this.props.t("start_conversation")),(0,o.h)("img",{src:dt,alt:"send button",width:"26",height:"26"})),(0,o.h)(m,{store:this.props.store})))}blur(){if(!this.props.store.isPreview){var t=this.msgInput.current;t&&(i.A.setTimeout((()=>t&&t.blur())),i.A.setTimeout((()=>t&&t.blur()),300))}}focusInput(){if(!this.props.store.isPreview){if(this.shouldShowForm()){let t="";return i.A.map(this.state.formData,((e,s)=>{"text"===e.type&&(t||e.value||(t=s))})),void i.A.setTimeout((()=>{var e=this["form_"+ft(t)];e&&e.focus()}),300)}var t=this.msgInput.current;t&&(i.A.setTimeout((()=>t.focus())),i.A.setTimeout((()=>t.focus()),300))}}onRate(t){this.props.cid&&(this.props.store.sendConvoEvent(this.props.cid,"conversation_rated",{conversation:{ratings:[t]}}),this.focusInput())}fillQuickReplyToQuestion(t){let e=this.state.formData;e&&i.A.set(e,"question.value",t.text),this.setState({formData:e,quickReplyMessage:t})}createPostback(t){this.props.store.createPostback(this.props.cid,t)}onChangeMessageInput(){this.wasFormInputed=!0}renderChat(){let t=(0,o.h)(_,{store:this.props.store,ref:this.msgInput,cid:this.props.cid,onChange:this.onChangeMessageInput,onSend:this.sendMessage,t:this.props.t}),e=this.props.store.matchConvo(this.props.cid)||{};return(this.isFormRequired()||"ended"===e.state)&&(t=(0,o.h)("div",{class:"message-input message-input--preform"},(0,o.h)("button",{class:"btn--start-convo",onClick:t=>this.onStartConvoClick(t)},this.props.t("offline_preform_btn")))),(0,o.h)("div",{class:"widget-body"},(0,o.h)("div",{class:"widget-body--content",onClick:t=>this.onContainerClick(t)},(0,o.h)(V,{isShow:this.props.isShow,onLink:this.onLink,store:this.props.store,chatbox:this.props.plugin.chatbox||{},onFormSubmit:t=>this.onEventFormSubmit(t),ref:t=>this.events=t,cid:this.props.cid,creating:this.creating,onSend:t=>this.sendMessage(t),onPostback:t=>this.createPostback(t),t:this.props.t}),(0,o.h)(Y,{store:this.props.store,cid:this.props.cid,t:this.props.t})),(0,o.h)(J,{forceView:this.props.view,plugin:this.props.plugin,store:this.props.store,onRate:t=>this.onRate(t),cid:this.props.cid,t:this.props.t}),(0,o.h)(ht,{forceView:this.props.view,plugin:this.props.plugin,show:this.state.showOrder,order_id:this.state.order_id,store:this.props.store,onClose:this.closeOrder,cid:this.props.cid,t:this.props.t}),t)}async onStartConvoClick(){if("ended"===(this.props.store.matchConvo(this.props.cid)||{}).state)return this.props.onGo({view:"chat",cid:""});this.setState({clickedJoin:!0,quickReplyMessage:{}})}onEventFormSubmit(){this.focusInput()}onContainerClick(){window.getSelection().toString().length>0||this.props.store.isMobile()||this.focusInput()}isFormRequired(){let t,e=this.props.plugin.chatbox||{},s=this.props.store.matchAccount()||{};i.A.get(e,"prechat_form.enabled")&&(t=e.prechat_form);let r=i.A.get(e,"offline_form.enabled");if(this.isOffline(s,e)&&r&&(t=e.offline_form),!t)return!1;let o=this.fillForm(t),a=this.props.store.matchConvo(this.props.cid)||{};if("ended"===a.state)return!0;a.state&&"pending"!==a.state&&delete o.group;let n=!0;return i.A.each(o,(t=>{t.value&&(n=!1)})),!(!n||this.userHasSent(this.props.cid))||!!i.A.find(o,(t=>t.is_required&&(null==t.value||""===t.value)))}renderConvoSummary(t){let e=this.props.plugin.chatbox||{},s=this.props.store.matchAgent("*"),r=i.A.filter(t.members,(t=>("agent"===t.type||"bot"===t.type)&&"active"===t.membership)),a=i.A.map(r,(t=>t.id));a=a||i.A.agentsOfConvo(t)[0];let n=i.A.map(a,(t=>s[t]||{avatar_url:mt,fullname:"Offline Agent"}));var l=i.A.each(n,(t=>t.fullname)).join(", ");!e.hide_agent_profile&&l||(l=this.props.store.matchAccount().name),l||(l=this.props.t("agent"));var h=null;"user"===t.lastSenderType&&(h=(0,o.h)("span",null,this.props.t("you"),":"));let p=i.A.isConvoSeen(t,this.props.store.matchUser().id);var d=this.renderMessagePreview(t.last_message_sent),c=i.A.getMs(i.A.get(t,"last_message_sent.created"))||i.A.getMs(t.created);let u=p?null:(0,o.h)("div",{class:"convo-list--item-unread"});return"ended"===t.state&&(u=(0,o.h)("img",{alt:"conversation ended",class:"convo-list--convo-completed",src:ct,title:this.props.t("conversation_ended")})),(0,o.h)("div",{class:"convo-list--convo-last-info"},(0,o.h)("div",{class:"d-flex flex-row"},(0,o.h)("div",{class:"convo-list--convo-name"},l),(0,o.h)("div",{class:"convo-list--convo-time"},(0,o.h)($,{ago:!0,time:c,key:c,short:!0}))),(0,o.h)("div",{class:"d-flex flex-row"},(0,o.h)("div",{class:"convo-list--convo-last-message"},h,d),u))}agentsOfConvo(t){let e=this.props.store.matchAgent("*");var s=i.A.agentsOfConvo(t,!0);return i.A.map(s,(t=>e[t]||{avatar_url:mt,fullname:"Offline Agent"}))}renderMessagePreview(t){let e=this.props.t("sent_you_a_message"),s=i.A.get(t,"data.message.text");if("plaintext"!==i.A.get(t,"data.message.format")&&(s=e),!s&&i.A.size(i.A.get(t,"data.message.attachments"))>0&&(s=e),!s)return null;let r=i.A.get(t,"by.type");return(0,o.h)("div",{class:"convo-list--convo-last-mes"},i.A.map(i.A.extractText(s),(t=>"emoji"===t.type?(0,o.h)(a,{emojiCode:t.text,byType:r}):t.text)))}userHasSent(t){var e=this.props.store.matchConvo(t)||{};let s=this.props.store.matchUser();return!!this.userSent[t]||i.A.find(e.members,(t=>t.id===s.id&&("active"===t.membership||t.last_sent>0)))}hasSentMessage(t){let e=this.props.store.matchConvo(t)||{};return i.A.find(e.members,(t=>"bot"===t.type||t.last_sent))}isOffline(t,e){let s=i.A.get(e,"offline_form.enable_when"),r=!0;return"all_agents_offline"===s&&(r=t.is_online),"out_of_bussiness_hour"===s&&(r=t.is_in_business_hour),!r}updateFormDataFields(){let t,e=this.props.plugin.chatbox||{},s=this.props.store.matchAccount()||{};i.A.get(e,"prechat_form.enabled")&&(t=e.prechat_form);let r=i.A.get(e,"offline_form.enabled");if(this.isOffline(s,e)&&r&&(t=e.offline_form),"offline_form"===this.props.view&&(t=e.offline_form),"prechat_form"===this.props.view&&(t=e.prechat_form),0===i.A.size(t))return[];var o={};i.A.each(t.fields,(t=>{var e=Object.assign({},t);"list"===t.type&&(e.list=t.list),e.label=this.props.t.i18n(i.A.get(t,"i18n_label",{}))||t.label,o["attr:"+t.key]=e})),t.group_required&&i.A.size(t.groups)>0&&(o.group={key:"group",is_required:!!t.group_required,label:this.props.t.i18n(i.A.get(t,"i18n_group_label",{}))||t.group_label,type:"group",list:i.A.map(t.groups,(t=>({value:t.id,label:t.name})))}),o.question={key:"question",is_required:!0,label:this.props.t.i18n(i.A.get(t,"i18n_question_label",{}))||t.question_label,type:"text"},this.isFormChanged(this.state.formData,o)&&this.setState({formData:o})}isFormChanged(t,e){let s=Object.keys(t),r=Object.keys(e);if(s.length!==r.length)return!0;for(let o=0;o<s.length;o++){if(i.A.get(t,`${s[o]}.label`)!==i.A.get(e,`${r[o]}.label`))return!0;if(i.A.get(t,`${s[o]}.is_required`)!==i.A.get(e,`${r[o]}.is_required`))return!0;if(i.A.stringify(i.A.get(t,`${s[o]}.list`))!==i.A.stringify(i.A.get(e,`${r[o]}.list`)))return!0}return!1}fillForm(t){if(0===i.A.size(t))return[];var e={};let s=this.props.store.matchUser();return i.A.each(t.fields,(t=>{var r=Object.assign({},t);r.value=i.A.getUserAttr(s,t.key,t.type),"emails"!=r.key||r.value||(r.value=i.A.getUserAttr(s,"related_email","text")),"phones"!=r.key||r.value||(r.value=i.A.getUserAttr(s,"related_phone","text")),"boolean"!==t.type||r.value||(r.value=!1),"datetime"===t.type&&r.value&&(r.value=new i.A.Date(e.value).toLocaleDateString("en-CA")),"list"===t.type&&(r.list=t.list),r.label=this.props.t.i18n(i.A.get(t,"i18n_label",{}))||t.label,e["attr:"+t.key]=r})),t.group_required&&i.A.size(t.groups)>0&&(e.group={key:"group",is_required:!!t.group_required,label:this.props.t.i18n(i.A.get(t,"i18n_group_label",{}))||t.group_label,type:"group",list:i.A.map(t.groups,(t=>({value:t.id,label:t.name})))}),e}}class vt extends r.Mw{componentDidMount(){this.props.onMount(this.props.form)}}function ft(t){return encodeURIComponent(t)}let _t=s.e(278).then(s.bind(s,9278));class yt extends r.Mw{constructor(t){super(t),this.refButton=(0,o._3)(),this.refWidget=(0,o._3)()}async refreshCSS(){let t=this.props.store.matchPlugin(),e=i.A.find(t,(t=>t.id===this.props.plugin.id));if(!e)return;let s=(await _t).default.default.toString();var r=i.A.replaceCssVariable(s,e.chatbox);i.A.setCss(this.props.plugin.id,this.$cssStyleDiv,r)}componentWillUnmount(){i.A.setCss(this.props.plugin.id,this.$cssStyleDiv,"")}async componentDidMount(){if(this.$cssStyleDiv=document.getElementById("subiz-style-for-"+this.props.plugin.id),this.$cssStyleDiv||(this.$cssStyleDiv=document.createElement("style"),document.head.appendChild(this.$cssStyleDiv),this.$cssStyleDiv.type="text/css",this.$cssStyleDiv.id="subiz-style-for-"+this.props.plugin.id),this.setState({cssready:!1,isShowWidget:!1,widgetView:"",widgetConvoId:""}),this.checkExpand(),this.props.store.onResetCSS(this,(()=>this.refreshCSS())),this.props.store.onConvoEvent(this,(t=>this.onConvoEvent(t))),this.props.store.onUpdate(this,(t=>this.checkExpand())),await this.refreshCSS(),this.setState({cssready:!0}),this.props.store.matchIsOpen()&&this.props.store.matchLastview().view){if(this.props.store.isMobile())return;this.showWidget(Object.assign({},this.props.store.matchLastview().opts,{view:this.props.store.matchLastview().view}))}else bt(),this.state.isShowWidget||this.hideWidget()}render(){return this.state.cssready?i.A.isUserBanned(this.props.store.matchUser())?null:this.props.t?(0,o.h)("div",{class:this.props.store.isMobile()?"mobile":"desktop"},(0,o.h)(h,{plugin:this.props.plugin,store:this.props.store,key:"chat_button",ref:this.refButton,isShow:!this.state.isShowWidget,onClick:t=>this.showWidget(t),t:this.props.t}),(0,o.h)(gt,{plugin:this.props.plugin,store:this.props.store,view:this.state.widgetView,cid:this.state.widgetConvoId,isShow:this.state.isShowWidget,onClose:t=>this.onWidgetClose(t),onGo:t=>this.showWidget(t),t:this.props.t,ref:this.refWidget})):null:null}onConvoEvent(t){this.checkExpand(),this.checkShowBotConvo(t)}checkShowBotConvo(t){let e=this.refWidget.current;if(!e)return;if(e.wasFormInputed)return;if("message_sent"!==t.type)return;if(!this.state.isShowWidget)return;let s=i.A.get(t,"by.type");if(!(i.A.get(t,"by.id")||"").startsWith("bb")||"agent"!==s)return;let r=i.A.get(t,"data.message.conversation_id");r&&this.showWidget({cid:r,view:"chat"})}checkExpand(){if(this.props.store.isMobile())return;if(this.props.plugin._no_auto_expand)return;if(this.props.store.matchHasManuallyClosed())return;let t=this.props.store.matchConvo("*"),e=i.A.find(t,(t=>!i.A.isConvoSeen(t,this.props.store.matchUser().id)));e&&e.id&&(this.state.isShowWidget||this.showWidget({view:"chat",cid:e.id}))}getCurrentView(){return{is_show_widget:this.state.isShowWidget,conversation_id:this.state.widgetConvoId,view:this.state.widgetView}}async showWidget(t){if(this.refButton.current&&this.refButton.current.ClearPreview(),!t.view){let e=this.props.store.matchLastview()||{};t.view=i.A.get(e,"view"),t.cid=i.A.get(e,"opts.cid")}if(!(t=t||{}).view&&!t.cid){let e=this.props.store.matchConvo("*"),s=i.A.find(e,(t=>!i.A.isConvoSeen(t,this.props.store.matchUser().id)));t.cid=i.A.get(s,"id",i.A.get(e,"0.id")),t.view="chat"}this.props.store.isMobile()&&function(){document.body&&document.body.classList&&document.body.classList.add("sbz_no_scroll"),document.documentElement&&document.documentElement.classList&&document.documentElement.classList.add("sbz_no_scroll");let t=document.createElement("meta");t.httpEquiv="X-UA-Compatible",t.name="viewport",t.id="subiz-meta-viewport",t.content="maximum-scale=1.0, user-scalable=no, width=device-width, initial-scale=1.0",document.getElementsByTagName("head")[0].appendChild(t)}(),this.setState({widgetConvoId:t.cid,widgetView:t.view}),this.props.store.setIsOpen(!0),this.forceUpdate(),this.setState({isShowWidget:!0}),this.props.store.setLastview(t.view,{cid:t.cid})}showGreeting(){this.refButton.current&&this.refButton.current.ShowGreeting()}hideGreeting(){this.refButton.current&&this.refButton.current.HideGreeting()}hideWidget(){bt(),this.props.store.setIsOpen(!1),this.setState({isShowWidget:!1})}onWidgetClose(){this.refButton.current&&this.refButton.current.ClearPreview(),this.props.store.setHasManuallyClosed(),this.hideWidget(),this.props.store.emitCloseWidgetEvent()}}function bt(){document.body&&document.body.classList&&document.body.classList.remove("sbz_no_scroll"),document.documentElement&&document.documentElement.classList&&document.documentElement.classList.remove("sbz_no_scroll");let t=document.getElementById("subiz-meta-viewport");t&&t.remove()}},1108:(t,e,s)=>{t.exports=s.p+"assets/img/bubble_default.7d5e4ab.svg"},7741:(t,e,s)=>{t.exports=s.p+"assets/img/caret.998eb8f.svg"},1370:(t,e,s)=>{t.exports=s.p+"assets/img/convos_empty.2353007.svg"},2876:(t,e,s)=>{t.exports=s.p+"assets/img/default.06e6ee0.jpg"},2538:(t,e,s)=>{t.exports=s.p+"assets/img/default_avatar.5b74dc1.png"},9150:(t,e,s)=>{t.exports=s.p+"assets/img/done_gray.d7e8203.svg"},5860:(t,e,s)=>{t.exports=s.p+"assets/img/done_green.b817fd4.svg"},9419:(t,e,s)=>{t.exports=s.p+"assets/img/empty.29bed2d.svg"},6907:(t,e,s)=>{t.exports=s.p+"assets/img/empty_1.0b98af0.svg"},3266:(t,e,s)=>{t.exports=s.p+"assets/img/external-link.90577cc.svg"},1113:(t,e,s)=>{t.exports=s.p+"assets/img/ghn.070f8e3.svg"},7362:(t,e,s)=>{t.exports=s.p+"assets/img/ghtk.326eac1.svg"},3582:(t,e,s)=>{t.exports=s.p+"assets/img/image_default.be0698b.png"},7324:(t,e,s)=>{t.exports=s.p+"assets/img/info.ebce7ea.svg"},185:(t,e,s)=>{t.exports=s.p+"assets/img/loader.37000a7.svg"},6973:(t,e,s)=>{t.exports=s.p+"assets/img/loading_static.a27f0ac.svg"},3142:(t,e,s)=>{t.exports=s.p+"assets/img/not_found_search.2ddb8d1.png"},8512:(t,e,s)=>{t.exports=s.p+"assets/img/package.8d37d0f.svg"},6857:(t,e,s)=>{t.exports=s.p+"assets/img/package_fade.763c001.svg"},7134:(t,e,s)=>{t.exports=s.p+"assets/img/rating--average.1ea492c.svg"},940:(t,e,s)=>{t.exports=s.p+"assets/img/rating--great.e3d712e.svg"},9801:(t,e,s)=>{t.exports=s.p+"assets/img/rating--poor.2938a25.svg"},5452:(t,e,s)=>{t.exports=s.p+"assets/img/search.f9705ff.svg"},8506:(t,e,s)=>{t.exports=s.p+"assets/img/send.6db52a9.svg"},5244:(t,e,s)=>{t.exports=s.p+"assets/img/shop.f7dc7d8.svg"},2523:(t,e,s)=>{t.exports=s.p+"assets/img/shop_faded.df7845a.svg"},9529:(t,e,s)=>{t.exports=s.p+"assets/img/subiz-mono.877e9f5.svg"},3080:(t,e,s)=>{t.exports=s.p+"assets/img/x.26fdfa3.svg"}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[74],{9074:(t,e,s)=>{s.r(e),s.d(e,{DEFVAL:()=>p,default:()=>n,replaceCssVariable:()=>l});var i=s(1405),a=s(172),o=s(2840);let r=s.e(997).then(s.bind(s,997));class n extends o.Mw{constructor(t){var e,s,i,a;super(t),e=this,i={map:!1,map_loading:!1,map_initialized:!1},(s="symbol"==typeof(a=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(s="state"))?a:a+"")in e?Object.defineProperty(e,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[s]=i,this.showMap=this.showMap.bind(this),this.hideMap=this.hideMap.bind(this)}async initMap(){this.map_initialized||(this.setState({map_initialized:!0,map_loading:!0}),await new Loader({apiKey:"YOUR_API_KEY",version:"weekly"}).load(),this.gmap=new google.maps.Map(document.getElementById("map")),this.setState({map_loading:!1}))}js2css(t,e){return i.A.js2css(t,e,{"@font_size":this.props.plugin.popup.font_size,"@font_family":this.props.plugin.popup.font_family,"@text_color":this.props.plugin.popup.text_color,"@primary_color":this.props.plugin.popup.primary_color,"@background":this.props.plugin.popup.background,"@spacer0":spacer/2+"px","@spacer":spacer+"px","@spacer2":2*spacer+"px","@spacer3":3*spacer+"px"})}renderMapButton(t){let e=(0,a.h)("svg",{width:"20px","aria-hidden":"true",focusable:"false","data-prefix":"fas","data-icon":"map-marker-alt",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",class:"svg-inline--fa fa-map-marker-alt fa-w-12 fa-3x"},(0,a.h)("path",{fill:"red",d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z",class:""}));return(0,a.h)("div",{class:"contact_button",onClick:this.showMap},this.renderMapModal(t),e)}async setMap(t,e){console.log("HEE"),await this.initMap(),console.log("HEE22"),window.gmap=this.gmap,this.gmap.map.setCenter(new google.maps.LatLng(t,e))}renderMapModal(t){let e="map_modal";this.state.map?e+=" map_modal__show":e+=" map_modal__hide";let s="overlay";this.state.map||(s+=" overlay__hidden");let o=i.A.map(t.map.locations,(t=>(0,a.h)("div",{class:"map_location",onClick:e=>this.setMap(t.latitude,t.longitude)},(0,a.h)("div",null,t.name),(0,a.h)("div",null,t.latitude),(0,a.h)("div",null,t.longitude))));o.unshift((0,a.h)("div",{class:"map_title"},t.map.title));let r=(0,a.h)("div",{id:"map",style:"height: 100%; width: 100%"}," ");return(0,a.h)("div",{class:s,onClick:this.hideMap},(0,a.h)("div",{class:e,onClick:t=>t.stopPropagation()},(0,a.h)("div",{class:"map_body"},(0,a.h)("div",{class:"map_locations"},o),r,(0,a.h)("div",{class:"mapouter"},(0,a.h)("div",{class:"gmap_canvas"},(0,a.h)("iframe",{width:"300",height:"400",id:"gmap_canvas",src:"https://maps.google.com/maps?q=2880%20Broadway,%20New%20York&t=&z=13&ie=UTF8&iwloc=&output=embed",frameborder:"0",scrolling:"no",marginheight:"0",marginwidth:"0"}))))))}hideMap(t){t.stopPropagation(),this.setState({map:!1})}showMap(){this.setState({map:!0})}renderZaloButton(t){let e=(0,a.h)("svg",{width:"20px ","aria-hidden":"true",focusable:"false","data-prefix":"fab","data-icon":"facebook-f",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",class:"svg-inline--fa fa-facebook-f fa-w-10 fa-5x"},(0,a.h)("path",{fill:"currentColor",d:"M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z",class:""}));return(0,a.h)("div",{class:"contact_button"},e)}renderFacebookButton(t){let e=(0,a.h)("svg",{width:"20px ","aria-hidden":"true",focusable:"false","data-prefix":"fab","data-icon":"facebook-f",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",class:"svg-inline--fa fa-facebook-f fa-w-10 fa-5x"},(0,a.h)("path",{fill:"currentColor",d:"M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z",class:""}));return(0,a.h)("div",{class:"contact_button"},e)}renderChatButton(){return(0,a.h)("div",null,"Chat")}renderCallButton(){let t=(0,a.h)("svg",{width:"20px","aria-hidden":"true",focusable:"false","data-prefix":"fas","data-icon":"phone",role:"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",class:"svg-inline--fa fa-phone fa-w-16 fa-7x"},(0,a.h)("path",{fill:"currentColor",d:"M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z",class:""}));return(0,a.h)("div",null,t)}renderButtons(t){return 0===i.A.size(t)?null:i.A.map(t,(t=>"map"===t.type?this.renderMapButton(t):"zalo"===t.type?this.renderZaloButton(t):"facebook"===t.type?this.renderFacebookButton(t):"call"===t.type?this.renderCallButton(t):"chat"===t.type?this.renderChatButton(t):null))}renderByLayoutSideByStandard(){let t=this.renderButtons(this.props.plugin.contact.buttons);return(0,a.h)("div",null,t)}renderLineComponent(t){let e=Object.assign({},t.style,this.props.mobile?t.mobile_style:{});return(0,a.h)("div",{style:this.js2css(e)})}renderTextComponent(t){let e=Object.assign({},t.style,this.props.mobile?t.mobile_style:{});return(0,a.h)("div",{class:"text",style:this.js2css(e),dangerouslySetInnerHTML:{__html:i.A.get(t,"text.html")}})}async refreshCSS(){var t=l((await r).default.default.toString(),this.props.plugin.popup);i.A.setCss(this.props.plugin.id,this.$cssStyleDiv,t),this.setState({cssready:!0})}componentDidMount(){this.$cssStyleDiv=document.createElement("style"),document.head.appendChild(this.$cssStyleDiv),this.$cssStyleDiv.type="text/css",this.$cssStyleDiv.id="subiz-style-for-"+this.props.plugin.id,this.refreshCSS();let t=JSON.stringify(this.props.plugin);this.setState({pluginjson:t})}render(){if(!this.state.cssready)return null;let t=JSON.stringify(this.props.plugin);if(this.state.pluginjson!==t&&(this.refreshCSS(),i.A.setTimeout((()=>this.setState({pluginjson:t})))),this.state.close)return null;let e,s,o,r,n,l=i.A.get(this.props.plugin,"contact.layout","standard"),p=null;"standard"!==l&&l||(p=this.renderByLayoutSideByStandard()),"footer"===l&&(p=this.renderByLayoutFooter(i.A.get(this.props.plugin,`popup.pages.${this.state.pageIndex}`))),"mini"===l&&(p=this.renderByLayoutMini(i.A.get(this.props.plugin,`popup.pages.${this.state.pageIndex}`))),"docked"===l&&(p=this.renderByLayoutDocked(i.A.get(this.props.plugin,`popup.pages.${this.state.pageIndex}`)));let h=i.A.get(this.props.plugin,"contact.position","bottom-left");return"center-left"===h?(e="0",r="50%",n="translateY(-50%)"):"top-left"===h?(e="0",r="20px"):"bottom-right"===h?(s="0",o="20px"):"center-right"===h?(s="0",r="50%",n="translateY(-50%)"):"top-right"===h?(s="0",r="20px"):(e="0",o="20px"),(0,a.h)("div",{style:i.A.js2css({position:"absolute",left:e,right:s,bottom:o,top:r,transform:n,display:"flex",align_items:"center",justify_content:"center",overflow:"hidden"}),onClick:t=>t.stopPropagation()},p)}}function l(t,e){var s=[t];s=i.A.tokenize(s,"'@font_family'"),s=i.A.tokenize(s,"'@font_size'"),s=i.A.tokenize(s,"'@text_color'"),s=i.A.tokenize(s,"'@primary_color'"),s=i.A.tokenize(s,"'@background'"),s=i.A.tokenize(s,"'@spacer'"),s=i.A.tokenize(s,"'@spacer0'"),s=i.A.tokenize(s,"'@spacer2'"),s=i.A.tokenize(s,"'@spacer3'");for(var a=[],o=0;o<s.length;o++){var r=s[o];if("string"!=typeof r){var n=r.type.substr(2,r.type.length-3),l=i.A.get(e,n)||i.A.get(p,n)||"";a.push(l)}else a.push(r)}return a.join("")}const p={font_size:"16px",font_family:"roboto",text_color:"#333",primary_color:"#333"}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[997],{997:(n,t,e)=>{e.r(t),e.d(t,{default:()=>o});const o=e(1938)},1938:(n,t,e)=>{e.r(t),e.d(t,{default:()=>r});var o=e(6314),i=e.n(o)()((function(n){return n[1]}));i.push([n.id,"/*\n#sbz92 * {\n\tall: unset !important;\n}\n\n#sbz92 {\n\tz-index: @z-index + 100 !important;\n\t#makeImportant() !important;\n}\n\n// prevent #subiz inheriting client site styles\ndiv#sbz92 {\n\tall: initial;\n}\n\n// prevent #subiz inheriting client site !important styles\nbody div#sbz92 {\n\tall: initial !important;\n}\n\nbody div#sbz92 .overlay {\n\tposition: fixed !important;\n\tuser-select: none !important;\n}\n*/\n#sbz92 {\n z-index: 2000000100 !important;\n /* Handle on hover */\n}\n#sbz92 *,\n#sbz92 *::before,\n#sbz92 *::after {\n box-sizing: border-box;\n}\n#sbz92 [tabindex='-1']:focus:not(:focus-visible) {\n outline: 0;\n}\n#sbz92 b,\n#sbz92 strong {\n font-weight: 500;\n}\n#sbz92 a {\n color: #020202;\n text-decoration: none;\n background-color: transparent;\n}\n#sbz92 a:hover {\n cursor: pointer;\n color: #000000;\n text-decoration: underline;\n}\n#sbz92 a:not([href]) {\n color: inherit;\n text-decoration: none;\n}\n#sbz92 a:not([href]):hover {\n color: inherit;\n text-decoration: none;\n}\n#sbz92 img {\n vertical-align: middle;\n border-style: none;\n}\n#sbz92 svg {\n overflow: hidden;\n vertical-align: middle;\n}\n#sbz92 label {\n display: inline-block;\n}\n#sbz92 button {\n border-radius: 0;\n}\n#sbz92 button:focus {\n outline: 1px dotted;\n outline: 5px auto -webkit-focus-ring-color;\n}\n#sbz92 input,\n#sbz92 button,\n#sbz92 select,\n#sbz92 optgroup,\n#sbz92 textarea {\n margin: 0;\n}\n#sbz92 button,\n#sbz92 input {\n overflow: visible;\n}\n#sbz92 button,\n#sbz92 select {\n text-transform: none;\n}\n#sbz92 select {\n word-wrap: normal;\n}\n#sbz92 button,\n#sbz92 [type=\"button\"],\n#sbz92 [type=\"reset\"],\n#sbz92 [type=\"submit\"] {\n -webkit-appearance: button;\n}\n#sbz92 button:not(:disabled),\n#sbz92 [type='button']:not(:disabled),\n#sbz92 [type='reset']:not(:disabled),\n#sbz92 [type='submit']:not(:disabled) {\n cursor: pointer;\n}\n#sbz92 button::-moz-focus-inner,\n#sbz92 [type='button']::-moz-focus-inner,\n#sbz92 [type='reset']::-moz-focus-inner,\n#sbz92 [type='submit']::-moz-focus-inner {\n padding: 0;\n border-style: none;\n}\n#sbz92 input[type='radio'],\n#sbz92 input[type='checkbox'] {\n box-sizing: border-box;\n padding: 0;\n}\n#sbz92 input[type='date'],\n#sbz92 input[type='time'],\n#sbz92 input[type='datetime-local'],\n#sbz92 input[type='month'] {\n -webkit-appearance: listbox;\n}\n#sbz92 textarea {\n overflow: auto;\n resize: vertical;\n}\n#sbz92 [type='number']::-webkit-inner-spin-button,\n#sbz92 [type='number']::-webkit-outer-spin-button {\n height: auto;\n}\n#sbz92 [hidden] {\n display: none;\n}\n#sbz92 ::-webkit-input-placeholder {\n /* Edge */\n color: #777;\n}\n#sbz92 :-ms-input-placeholder {\n /* Internet Explorer 10-11 */\n color: #777;\n}\n#sbz92 ::placeholder {\n color: #777;\n}\n#sbz92 div {\n display: block;\n text-rendering: geometricPrecision;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n#sbz92 ::-webkit-scrollbar {\n width: 7px;\n height: 7px;\n}\n#sbz92 ::-webkit-scrollbar-track {\n border-radius: 10px;\n}\n#sbz92 ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n background: #d6d6d6;\n}\n#sbz92 ::-webkit-scrollbar-thumb:hover {\n background: #aaa;\n}\n#sbz92 .overlay {\n position: fixed;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: #000c;\n z-index: 20000000000100;\n overflow: auto;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n#sbz92 .overlay.overlay__hidden {\n display: none;\n}\n#sbz92 .map_modal {\n max-with: 80%;\n max-height: 80%;\n width: 400px;\n height: 400px;\n background: white;\n}\n#sbz92 .map_body {\n width: 100%;\n height: 100%;\n display: flex;\n}\n#sbz92 .map_location {\n border-bottom: 1px solid lightgray;\n padding: 20px;\n font-size: 16px;\n font-family: 'roboto';\n}\n#sbz92 .map_title {\n font-size: 18px;\n font-weight: 500;\n padding: 10px;\n text-align: center;\n border-bottom: 1px solid lightgray;\n font-family: 'roboto';\n}\n#sbz92 .map_locations {\n border-right: 1px solid lightgray;\n width: 200px;\n height: 100%;\n}\n#sbz92 .sm.contact_button {\n width: 40px;\n height: 40px;\n}\n#sbz92 .lg.contact_button {\n width: 60px;\n height: 60px;\n}\n#sbz92 .contact_button {\n width: 50px;\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n background: pink;\n}\n",""]);const r=i},6314:n=>{n.exports=function(n){var t=[];return t.toString=function(){return this.map((function(t){var e=n(t);return t[2]?"@media ".concat(t[2]," {").concat(e,"}"):e})).join("")},t.i=function(n,e,o){"string"==typeof n&&(n=[[null,n,""]]);var i={};if(o)for(var r=0;r<this.length;r++){var s=this[r][0];null!=s&&(i[s]=!0)}for(var b=0;b<n.length;b++){var a=[].concat(n[b]);o&&i[a[0]]||(e&&(a[2]?a[2]="".concat(e," and ").concat(a[2]):a[2]=e),t.push(a))}},t}}}]);