@urbiport/js 0.0.1

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 (316) hide show
  1. package/README.md +169 -0
  2. package/dist/components/Bot.d.ts +26 -0
  3. package/dist/components/Bot.d.ts.map +1 -0
  4. package/dist/components/Button.d.ts +10 -0
  5. package/dist/components/Button.d.ts.map +1 -0
  6. package/dist/components/ConversationContainer/AvatarSideContainer.d.ts +8 -0
  7. package/dist/components/ConversationContainer/AvatarSideContainer.d.ts.map +1 -0
  8. package/dist/components/ConversationContainer/ChatChunk.d.ts +20 -0
  9. package/dist/components/ConversationContainer/ChatChunk.d.ts.map +1 -0
  10. package/dist/components/ConversationContainer/ConversationContainer.d.ts +17 -0
  11. package/dist/components/ConversationContainer/ConversationContainer.d.ts.map +1 -0
  12. package/dist/components/ConversationContainer/LoadingChunk.d.ts +7 -0
  13. package/dist/components/ConversationContainer/LoadingChunk.d.ts.map +1 -0
  14. package/dist/components/ConversationContainer/PopupBlockedToast.d.ts +7 -0
  15. package/dist/components/ConversationContainer/PopupBlockedToast.d.ts.map +1 -0
  16. package/dist/components/ConversationContainer/index.d.ts +2 -0
  17. package/dist/components/ConversationContainer/index.d.ts.map +1 -0
  18. package/dist/components/ErrorMessage.d.ts +6 -0
  19. package/dist/components/ErrorMessage.d.ts.map +1 -0
  20. package/dist/components/InputChatBlock.d.ts +18 -0
  21. package/dist/components/InputChatBlock.d.ts.map +1 -0
  22. package/dist/components/LiteBadge.d.ts +6 -0
  23. package/dist/components/LiteBadge.d.ts.map +1 -0
  24. package/dist/components/Modal.d.ts +9 -0
  25. package/dist/components/Modal.d.ts.map +1 -0
  26. package/dist/components/ProgressBar.d.ts +6 -0
  27. package/dist/components/ProgressBar.d.ts.map +1 -0
  28. package/dist/components/SendButton.d.ts +10 -0
  29. package/dist/components/SendButton.d.ts.map +1 -0
  30. package/dist/components/Spinner.d.ts +3 -0
  31. package/dist/components/Spinner.d.ts.map +1 -0
  32. package/dist/components/TextInputAddFileButton.d.ts +7 -0
  33. package/dist/components/TextInputAddFileButton.d.ts.map +1 -0
  34. package/dist/components/TypingBubble.d.ts +2 -0
  35. package/dist/components/TypingBubble.d.ts.map +1 -0
  36. package/dist/components/avatars/Avatar.d.ts +4 -0
  37. package/dist/components/avatars/Avatar.d.ts.map +1 -0
  38. package/dist/components/avatars/DefaultAvatar.d.ts +2 -0
  39. package/dist/components/avatars/DefaultAvatar.d.ts.map +1 -0
  40. package/dist/components/bubbles/GuestBubble.d.ts +10 -0
  41. package/dist/components/bubbles/GuestBubble.d.ts.map +1 -0
  42. package/dist/components/bubbles/HostBubble.d.ts +12 -0
  43. package/dist/components/bubbles/HostBubble.d.ts.map +1 -0
  44. package/dist/components/bubbles/LoadingBubble.d.ts +2 -0
  45. package/dist/components/bubbles/LoadingBubble.d.ts.map +1 -0
  46. package/dist/components/bubbles/StreamingBubble.d.ts +8 -0
  47. package/dist/components/bubbles/StreamingBubble.d.ts.map +1 -0
  48. package/dist/components/icons/CameraIcon.d.ts +3 -0
  49. package/dist/components/icons/CameraIcon.d.ts.map +1 -0
  50. package/dist/components/icons/CheckIcon.d.ts +3 -0
  51. package/dist/components/icons/CheckIcon.d.ts.map +1 -0
  52. package/dist/components/icons/ChevronDownIcon.d.ts +3 -0
  53. package/dist/components/icons/ChevronDownIcon.d.ts.map +1 -0
  54. package/dist/components/icons/CloseIcon.d.ts +3 -0
  55. package/dist/components/icons/CloseIcon.d.ts.map +1 -0
  56. package/dist/components/icons/FileIcon.d.ts +3 -0
  57. package/dist/components/icons/FileIcon.d.ts.map +1 -0
  58. package/dist/components/icons/MicrophoneIcon.d.ts +3 -0
  59. package/dist/components/icons/MicrophoneIcon.d.ts.map +1 -0
  60. package/dist/components/icons/PaperClipIcon.d.ts +3 -0
  61. package/dist/components/icons/PaperClipIcon.d.ts.map +1 -0
  62. package/dist/components/icons/PictureIcon.d.ts +3 -0
  63. package/dist/components/icons/PictureIcon.d.ts.map +1 -0
  64. package/dist/components/icons/PlusIcon.d.ts +3 -0
  65. package/dist/components/icons/PlusIcon.d.ts.map +1 -0
  66. package/dist/components/icons/SendIcon.d.ts +3 -0
  67. package/dist/components/icons/SendIcon.d.ts.map +1 -0
  68. package/dist/components/icons/TypebotLogo.d.ts +2 -0
  69. package/dist/components/icons/TypebotLogo.d.ts.map +1 -0
  70. package/dist/components/icons/index.d.ts +2 -0
  71. package/dist/components/icons/index.d.ts.map +1 -0
  72. package/dist/components/index.d.ts +4 -0
  73. package/dist/components/index.d.ts.map +1 -0
  74. package/dist/components/inputs/SearchInput.d.ts +9 -0
  75. package/dist/components/inputs/SearchInput.d.ts.map +1 -0
  76. package/dist/components/inputs/ShortTextInput.d.ts +8 -0
  77. package/dist/components/inputs/ShortTextInput.d.ts.map +1 -0
  78. package/dist/components/inputs/Textarea.d.ts +8 -0
  79. package/dist/components/inputs/Textarea.d.ts.map +1 -0
  80. package/dist/components/inputs/index.d.ts +3 -0
  81. package/dist/components/inputs/index.d.ts.map +1 -0
  82. package/dist/constants.d.ts +7 -0
  83. package/dist/constants.d.ts.map +1 -0
  84. package/dist/features/blocks/bubbles/audio/components/AudioBubble.d.ts +8 -0
  85. package/dist/features/blocks/bubbles/audio/components/AudioBubble.d.ts.map +1 -0
  86. package/dist/features/blocks/bubbles/audio/components/index.d.ts +2 -0
  87. package/dist/features/blocks/bubbles/audio/components/index.d.ts.map +1 -0
  88. package/dist/features/blocks/bubbles/audio/index.d.ts +2 -0
  89. package/dist/features/blocks/bubbles/audio/index.d.ts.map +1 -0
  90. package/dist/features/blocks/bubbles/embed/components/CustomEmbedBubble.d.ts +11 -0
  91. package/dist/features/blocks/bubbles/embed/components/CustomEmbedBubble.d.ts.map +1 -0
  92. package/dist/features/blocks/bubbles/embed/components/EmbedBubble.d.ts +11 -0
  93. package/dist/features/blocks/bubbles/embed/components/EmbedBubble.d.ts.map +1 -0
  94. package/dist/features/blocks/bubbles/embed/components/index.d.ts +2 -0
  95. package/dist/features/blocks/bubbles/embed/components/index.d.ts.map +1 -0
  96. package/dist/features/blocks/bubbles/embed/index.d.ts +2 -0
  97. package/dist/features/blocks/bubbles/embed/index.d.ts.map +1 -0
  98. package/dist/features/blocks/bubbles/image/components/ImageBubble.d.ts +10 -0
  99. package/dist/features/blocks/bubbles/image/components/ImageBubble.d.ts.map +1 -0
  100. package/dist/features/blocks/bubbles/image/index.d.ts +2 -0
  101. package/dist/features/blocks/bubbles/image/index.d.ts.map +1 -0
  102. package/dist/features/blocks/bubbles/textBubble/components/TextBubble.d.ts +11 -0
  103. package/dist/features/blocks/bubbles/textBubble/components/TextBubble.d.ts.map +1 -0
  104. package/dist/features/blocks/bubbles/textBubble/components/plate/PlateBlock.d.ts +9 -0
  105. package/dist/features/blocks/bubbles/textBubble/components/plate/PlateBlock.d.ts.map +1 -0
  106. package/dist/features/blocks/bubbles/textBubble/components/plate/PlateText.d.ts +9 -0
  107. package/dist/features/blocks/bubbles/textBubble/components/plate/PlateText.d.ts.map +1 -0
  108. package/dist/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.d.ts +3 -0
  109. package/dist/features/blocks/bubbles/textBubble/helpers/convertRichTextToPlainText.d.ts.map +1 -0
  110. package/dist/features/blocks/bubbles/textBubble/index.d.ts +2 -0
  111. package/dist/features/blocks/bubbles/textBubble/index.d.ts.map +1 -0
  112. package/dist/features/blocks/bubbles/video/components/VideoBubble.d.ts +9 -0
  113. package/dist/features/blocks/bubbles/video/components/VideoBubble.d.ts.map +1 -0
  114. package/dist/features/blocks/bubbles/video/index.d.ts +2 -0
  115. package/dist/features/blocks/bubbles/video/index.d.ts.map +1 -0
  116. package/dist/features/blocks/inputs/buttons/components/Buttons.d.ts +11 -0
  117. package/dist/features/blocks/inputs/buttons/components/Buttons.d.ts.map +1 -0
  118. package/dist/features/blocks/inputs/buttons/components/Checkbox.d.ts +7 -0
  119. package/dist/features/blocks/inputs/buttons/components/Checkbox.d.ts.map +1 -0
  120. package/dist/features/blocks/inputs/buttons/components/MultipleChoicesForm.d.ts +10 -0
  121. package/dist/features/blocks/inputs/buttons/components/MultipleChoicesForm.d.ts.map +1 -0
  122. package/dist/features/blocks/inputs/date/components/DateForm.d.ts +10 -0
  123. package/dist/features/blocks/inputs/date/components/DateForm.d.ts.map +1 -0
  124. package/dist/features/blocks/inputs/date/index.d.ts +2 -0
  125. package/dist/features/blocks/inputs/date/index.d.ts.map +1 -0
  126. package/dist/features/blocks/inputs/email/components/EmailInput.d.ts +10 -0
  127. package/dist/features/blocks/inputs/email/components/EmailInput.d.ts.map +1 -0
  128. package/dist/features/blocks/inputs/email/index.d.ts +2 -0
  129. package/dist/features/blocks/inputs/email/index.d.ts.map +1 -0
  130. package/dist/features/blocks/inputs/fileUpload/components/FilePreview.d.ts +8 -0
  131. package/dist/features/blocks/inputs/fileUpload/components/FilePreview.d.ts.map +1 -0
  132. package/dist/features/blocks/inputs/fileUpload/components/FileUploadForm.d.ts +11 -0
  133. package/dist/features/blocks/inputs/fileUpload/components/FileUploadForm.d.ts.map +1 -0
  134. package/dist/features/blocks/inputs/fileUpload/components/SelectedFile.d.ts +6 -0
  135. package/dist/features/blocks/inputs/fileUpload/components/SelectedFile.d.ts.map +1 -0
  136. package/dist/features/blocks/inputs/fileUpload/helpers/sanitizeSelectedFiles.d.ts +14 -0
  137. package/dist/features/blocks/inputs/fileUpload/helpers/sanitizeSelectedFiles.d.ts.map +1 -0
  138. package/dist/features/blocks/inputs/fileUpload/helpers/uploadFiles.d.ts +21 -0
  139. package/dist/features/blocks/inputs/fileUpload/helpers/uploadFiles.d.ts.map +1 -0
  140. package/dist/features/blocks/inputs/fileUpload/index.d.ts +2 -0
  141. package/dist/features/blocks/inputs/fileUpload/index.d.ts.map +1 -0
  142. package/dist/features/blocks/inputs/number/components/NumberInput.d.ts +10 -0
  143. package/dist/features/blocks/inputs/number/components/NumberInput.d.ts.map +1 -0
  144. package/dist/features/blocks/inputs/number/index.d.ts +2 -0
  145. package/dist/features/blocks/inputs/number/index.d.ts.map +1 -0
  146. package/dist/features/blocks/inputs/number/numberInputHelper.d.ts +2 -0
  147. package/dist/features/blocks/inputs/number/numberInputHelper.d.ts.map +1 -0
  148. package/dist/features/blocks/inputs/payment/components/PaymentForm.d.ts +11 -0
  149. package/dist/features/blocks/inputs/payment/components/PaymentForm.d.ts.map +1 -0
  150. package/dist/features/blocks/inputs/payment/components/StripePaymentForm.d.ts +11 -0
  151. package/dist/features/blocks/inputs/payment/components/StripePaymentForm.d.ts.map +1 -0
  152. package/dist/features/blocks/inputs/payment/components/index.d.ts +2 -0
  153. package/dist/features/blocks/inputs/payment/components/index.d.ts.map +1 -0
  154. package/dist/features/blocks/inputs/payment/helpers/paymentInProgressStorage.d.ts +5 -0
  155. package/dist/features/blocks/inputs/payment/helpers/paymentInProgressStorage.d.ts.map +1 -0
  156. package/dist/features/blocks/inputs/payment/index.d.ts +2 -0
  157. package/dist/features/blocks/inputs/payment/index.d.ts.map +1 -0
  158. package/dist/features/blocks/inputs/phone/components/PhoneInput.d.ts +9 -0
  159. package/dist/features/blocks/inputs/phone/components/PhoneInput.d.ts.map +1 -0
  160. package/dist/features/blocks/inputs/phone/index.d.ts +2 -0
  161. package/dist/features/blocks/inputs/phone/index.d.ts.map +1 -0
  162. package/dist/features/blocks/inputs/pictureChoice/MultiplePictureChoice.d.ts +11 -0
  163. package/dist/features/blocks/inputs/pictureChoice/MultiplePictureChoice.d.ts.map +1 -0
  164. package/dist/features/blocks/inputs/pictureChoice/SinglePictureChoice.d.ts +11 -0
  165. package/dist/features/blocks/inputs/pictureChoice/SinglePictureChoice.d.ts.map +1 -0
  166. package/dist/features/blocks/inputs/rating/components/RatingForm.d.ts +10 -0
  167. package/dist/features/blocks/inputs/rating/components/RatingForm.d.ts.map +1 -0
  168. package/dist/features/blocks/inputs/rating/index.d.ts +2 -0
  169. package/dist/features/blocks/inputs/rating/index.d.ts.map +1 -0
  170. package/dist/features/blocks/inputs/textInput/components/TextInput.d.ts +11 -0
  171. package/dist/features/blocks/inputs/textInput/components/TextInput.d.ts.map +1 -0
  172. package/dist/features/blocks/inputs/textInput/components/VoiceRecorder.d.ts +10 -0
  173. package/dist/features/blocks/inputs/textInput/components/VoiceRecorder.d.ts.map +1 -0
  174. package/dist/features/blocks/inputs/textInput/components/VolumeProcessor.d.ts +2 -0
  175. package/dist/features/blocks/inputs/textInput/components/VolumeProcessor.d.ts.map +1 -0
  176. package/dist/features/blocks/inputs/textInput/index.d.ts +2 -0
  177. package/dist/features/blocks/inputs/textInput/index.d.ts.map +1 -0
  178. package/dist/features/blocks/inputs/url/components/UrlInput.d.ts +10 -0
  179. package/dist/features/blocks/inputs/url/components/UrlInput.d.ts.map +1 -0
  180. package/dist/features/blocks/inputs/url/index.d.ts +2 -0
  181. package/dist/features/blocks/inputs/url/index.d.ts.map +1 -0
  182. package/dist/features/blocks/integrations/chatwoot/index.d.ts +2 -0
  183. package/dist/features/blocks/integrations/chatwoot/index.d.ts.map +1 -0
  184. package/dist/features/blocks/integrations/chatwoot/utils/executeChatwoot.d.ts +5 -0
  185. package/dist/features/blocks/integrations/chatwoot/utils/executeChatwoot.d.ts.map +1 -0
  186. package/dist/features/blocks/integrations/chatwoot/utils/index.d.ts +2 -0
  187. package/dist/features/blocks/integrations/chatwoot/utils/index.d.ts.map +1 -0
  188. package/dist/features/blocks/integrations/googleAnalytics/index.d.ts +2 -0
  189. package/dist/features/blocks/integrations/googleAnalytics/index.d.ts.map +1 -0
  190. package/dist/features/blocks/integrations/googleAnalytics/utils/executeGoogleAnalytics.d.ts +3 -0
  191. package/dist/features/blocks/integrations/googleAnalytics/utils/executeGoogleAnalytics.d.ts.map +1 -0
  192. package/dist/features/blocks/integrations/googleAnalytics/utils/index.d.ts +2 -0
  193. package/dist/features/blocks/integrations/googleAnalytics/utils/index.d.ts.map +1 -0
  194. package/dist/features/blocks/integrations/openai/streamChat.d.ts +17 -0
  195. package/dist/features/blocks/integrations/openai/streamChat.d.ts.map +1 -0
  196. package/dist/features/blocks/integrations/pixel/executePixel.d.ts +3 -0
  197. package/dist/features/blocks/integrations/pixel/executePixel.d.ts.map +1 -0
  198. package/dist/features/blocks/integrations/webhook/executeWebhook.d.ts +3 -0
  199. package/dist/features/blocks/integrations/webhook/executeWebhook.d.ts.map +1 -0
  200. package/dist/features/blocks/logic/redirect/index.d.ts +2 -0
  201. package/dist/features/blocks/logic/redirect/index.d.ts.map +1 -0
  202. package/dist/features/blocks/logic/redirect/utils/executeRedirect.d.ts +5 -0
  203. package/dist/features/blocks/logic/redirect/utils/executeRedirect.d.ts.map +1 -0
  204. package/dist/features/blocks/logic/redirect/utils/index.d.ts +2 -0
  205. package/dist/features/blocks/logic/redirect/utils/index.d.ts.map +1 -0
  206. package/dist/features/blocks/logic/script/executeScript.d.ts +9 -0
  207. package/dist/features/blocks/logic/script/executeScript.d.ts.map +1 -0
  208. package/dist/features/blocks/logic/setVariable/executeSetVariable.d.ts +6 -0
  209. package/dist/features/blocks/logic/setVariable/executeSetVariable.d.ts.map +1 -0
  210. package/dist/features/blocks/logic/wait/utils/executeWait.d.ts +6 -0
  211. package/dist/features/blocks/logic/wait/utils/executeWait.d.ts.map +1 -0
  212. package/dist/features/bubble/components/Bubble.d.ts +9 -0
  213. package/dist/features/bubble/components/Bubble.d.ts.map +1 -0
  214. package/dist/features/bubble/components/BubbleButton.d.ts +9 -0
  215. package/dist/features/bubble/components/BubbleButton.d.ts.map +1 -0
  216. package/dist/features/bubble/components/PreviewMessage.d.ts +9 -0
  217. package/dist/features/bubble/components/PreviewMessage.d.ts.map +1 -0
  218. package/dist/features/bubble/components/index.d.ts +2 -0
  219. package/dist/features/bubble/components/index.d.ts.map +1 -0
  220. package/dist/features/bubble/index.d.ts +2 -0
  221. package/dist/features/bubble/index.d.ts.map +1 -0
  222. package/dist/features/bubble/types.d.ts +35 -0
  223. package/dist/features/bubble/types.d.ts.map +1 -0
  224. package/dist/features/commands/index.d.ts +3 -0
  225. package/dist/features/commands/index.d.ts.map +1 -0
  226. package/dist/features/commands/types.d.ts +19 -0
  227. package/dist/features/commands/types.d.ts.map +1 -0
  228. package/dist/features/commands/utils/close.d.ts +2 -0
  229. package/dist/features/commands/utils/close.d.ts.map +1 -0
  230. package/dist/features/commands/utils/hidePreviewMessage.d.ts +2 -0
  231. package/dist/features/commands/utils/hidePreviewMessage.d.ts.map +1 -0
  232. package/dist/features/commands/utils/index.d.ts +9 -0
  233. package/dist/features/commands/utils/index.d.ts.map +1 -0
  234. package/dist/features/commands/utils/open.d.ts +2 -0
  235. package/dist/features/commands/utils/open.d.ts.map +1 -0
  236. package/dist/features/commands/utils/setInputValue.d.ts +2 -0
  237. package/dist/features/commands/utils/setInputValue.d.ts.map +1 -0
  238. package/dist/features/commands/utils/setPrefilledVariables.d.ts +2 -0
  239. package/dist/features/commands/utils/setPrefilledVariables.d.ts.map +1 -0
  240. package/dist/features/commands/utils/showPreviewMessage.d.ts +3 -0
  241. package/dist/features/commands/utils/showPreviewMessage.d.ts.map +1 -0
  242. package/dist/features/commands/utils/toggle.d.ts +2 -0
  243. package/dist/features/commands/utils/toggle.d.ts.map +1 -0
  244. package/dist/features/commands/utils/unmount.d.ts +2 -0
  245. package/dist/features/commands/utils/unmount.d.ts.map +1 -0
  246. package/dist/features/popup/components/Popup.d.ts +10 -0
  247. package/dist/features/popup/components/Popup.d.ts.map +1 -0
  248. package/dist/features/popup/components/index.d.ts +2 -0
  249. package/dist/features/popup/components/index.d.ts.map +1 -0
  250. package/dist/features/popup/index.d.ts +2 -0
  251. package/dist/features/popup/index.d.ts.map +1 -0
  252. package/dist/features/popup/types.d.ts +9 -0
  253. package/dist/features/popup/types.d.ts.map +1 -0
  254. package/dist/features/standard/components/Standard.d.ts +5 -0
  255. package/dist/features/standard/components/Standard.d.ts.map +1 -0
  256. package/dist/features/standard/components/index.d.ts +2 -0
  257. package/dist/features/standard/components/index.d.ts.map +1 -0
  258. package/dist/features/standard/index.d.ts +2 -0
  259. package/dist/features/standard/index.d.ts.map +1 -0
  260. package/dist/index.d.ts +7 -0
  261. package/dist/index.d.ts.map +1 -0
  262. package/dist/index.js +2 -0
  263. package/dist/lib/gtag.d.ts +4 -0
  264. package/dist/lib/gtag.d.ts.map +1 -0
  265. package/dist/lib/gtm.d.ts +3 -0
  266. package/dist/lib/gtm.d.ts.map +1 -0
  267. package/dist/lib/pixel.d.ts +4 -0
  268. package/dist/lib/pixel.d.ts.map +1 -0
  269. package/dist/lib/stripe.d.ts +3 -0
  270. package/dist/lib/stripe.d.ts.map +1 -0
  271. package/dist/queries/continueChatQuery.d.ts +554 -0
  272. package/dist/queries/continueChatQuery.d.ts.map +1 -0
  273. package/dist/queries/saveClientLogsQuery.d.ts +7 -0
  274. package/dist/queries/saveClientLogsQuery.d.ts.map +1 -0
  275. package/dist/queries/startChatQuery.d.ts +723 -0
  276. package/dist/queries/startChatQuery.d.ts.map +1 -0
  277. package/dist/register.d.ts +2 -0
  278. package/dist/register.d.ts.map +1 -0
  279. package/dist/types.d.ts +37 -0
  280. package/dist/types.d.ts.map +1 -0
  281. package/dist/utils/CorsError.d.ts +4 -0
  282. package/dist/utils/CorsError.d.ts.map +1 -0
  283. package/dist/utils/botContainerHeightSignal.d.ts +2 -0
  284. package/dist/utils/botContainerHeightSignal.d.ts.map +1 -0
  285. package/dist/utils/botContainerSignal.d.ts +2 -0
  286. package/dist/utils/botContainerSignal.d.ts.map +1 -0
  287. package/dist/utils/executeClientSideActions.d.ts +20 -0
  288. package/dist/utils/executeClientSideActions.d.ts.map +1 -0
  289. package/dist/utils/formattedMessagesSignal.d.ts +8 -0
  290. package/dist/utils/formattedMessagesSignal.d.ts.map +1 -0
  291. package/dist/utils/getAnswerContent.d.ts +3 -0
  292. package/dist/utils/getAnswerContent.d.ts.map +1 -0
  293. package/dist/utils/guessApiHost.d.ts +6 -0
  294. package/dist/utils/guessApiHost.d.ts.map +1 -0
  295. package/dist/utils/injectFont.d.ts +3 -0
  296. package/dist/utils/injectFont.d.ts.map +1 -0
  297. package/dist/utils/injectStartProps.d.ts +3 -0
  298. package/dist/utils/injectStartProps.d.ts.map +1 -0
  299. package/dist/utils/isMobileSignal.d.ts +2 -0
  300. package/dist/utils/isMobileSignal.d.ts.map +1 -0
  301. package/dist/utils/persist.d.ts +9 -0
  302. package/dist/utils/persist.d.ts.map +1 -0
  303. package/dist/utils/setCssVariablesValue.d.ts +3 -0
  304. package/dist/utils/setCssVariablesValue.d.ts.map +1 -0
  305. package/dist/utils/storage.d.ts +717 -0
  306. package/dist/utils/storage.d.ts.map +1 -0
  307. package/dist/utils/streamingMessageSignal.d.ts +8 -0
  308. package/dist/utils/streamingMessageSignal.d.ts.map +1 -0
  309. package/dist/utils/toaster.d.ts +2 -0
  310. package/dist/utils/toaster.d.ts.map +1 -0
  311. package/dist/web.d.ts +17 -0
  312. package/dist/web.d.ts.map +1 -0
  313. package/dist/web.js +14 -0
  314. package/dist/window.d.ts +40 -0
  315. package/dist/window.d.ts.map +1 -0
  316. package/package.json +57 -0
package/dist/web.js ADDED
@@ -0,0 +1,14 @@
1
+ // v0.3.12
2
+ function e(e){return Object.keys(e).reduce(((t,n)=>{const r=e[n];var i;return t[n]=Object.assign({},r),o(r.value)&&(i=r.value,"[object Function]"!==Object.prototype.toString.call(i))&&!Array.isArray(r.value)&&(t[n].value=Object.assign({},r.value)),Array.isArray(r.value)&&(t[n].value=r.value.slice(0)),t}),{})}function t(e){if(e)try{return JSON.parse(e)}catch(t){return e}}function n(e,t,n,o){if(null==n||!1===n)return e.removeAttribute(t);let r=o?JSON.stringify(n):n;e.__updating[t]=!0,"true"===r&&(r=""),e.setAttribute(t,r),Promise.resolve().then((()=>delete e.__updating[t]))}function o(e){return null!=e&&("object"==typeof e||"function"==typeof e)}let r;function i(o,i){const a=Object.keys(i);return class extends o{static get observedAttributes(){return a.map((e=>i[e].attribute))}constructor(){super(),this.__initialized=!1,this.__released=!1,this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props={}}connectedCallback(){if(this.__initialized)return;this.__releaseCallbacks=[],this.__propertyChangedCallbacks=[],this.__updating={},this.props=function(o,r){const i=e(r);return Object.keys(r).forEach((e=>{const r=i[e],a=o.getAttribute(r.attribute),s=o[e];null!=a&&(r.value=r.parse?t(a):a),null!=s&&(r.value=Array.isArray(s)?s.slice(0):s),r.reflect&&n(o,r.attribute,r.value,!!r.parse),Object.defineProperty(o,e,{get:()=>r.value,set(t){const o=r.value;r.value=t,r.reflect&&n(this,r.attribute,r.value,!!r.parse);for(let n=0,r=this.__propertyChangedCallbacks.length;n<r;n++)this.__propertyChangedCallbacks[n](e,t,o)},enumerable:!0,configurable:!0})})),i}(this,i);const o=function(e){return Object.keys(e).reduce(((t,n)=>(t[n]=e[n].value,t)),{})}(this.props),a=this.Component,s=r;try{r=this,this.__initialized=!0,"function"==typeof(l=a)&&0===l.toString().indexOf("class")?new a(o,{element:this}):a(o,{element:this})}finally{r=s}var l}async disconnectedCallback(){if(await Promise.resolve(),this.isConnected)return;this.__propertyChangedCallbacks.length=0;let e=null;for(;e=this.__releaseCallbacks.pop();)e(this);delete this.__initialized,this.__released=!0}attributeChangedCallback(e,n,o){if(this.__initialized&&!this.__updating[e]&&(e=this.lookupProp(e))in i){if(null==o&&!this[e])return;this[e]=i[e].parse?t(o):o}}lookupProp(e){if(i)return a.find((t=>e===t||e===i[t].attribute))}get renderRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}addReleaseCallback(e){this.__releaseCallbacks.push(e)}addPropertyChangedCallback(e){this.__propertyChangedCallbacks.push(e)}}}function a(e,t={},n={}){const{BaseElement:r=HTMLElement,extension:a,customElements:s=window.customElements}=n;return n=>{if(!e)throw new Error("tag is required to register a Component");let l=s.get(e);return l?(l.prototype.Component=n,l):(l=i(r,function(e){return e?Object.keys(e).reduce(((t,n)=>{const r=e[n];return t[n]=o(r)&&"value"in r?r:{value:r},t[n].attribute||(t[n].attribute=n.replace(/\.?([A-Z]+)/g,((e,t)=>"-"+t.toLowerCase())).replace("_","-").replace(/^-/,"")),t[n].parse="parse"in t[n]?t[n].parse:"string"!=typeof t[n].value,t}),{}):{}}(t)),l.prototype.Component=n,l.prototype.registeredTag=e,s.define(e,l,a),l)}}const s={context:void 0,registry:void 0},l=Symbol("solid-proxy"),c=Symbol("solid-track"),d=Symbol("solid-dev-component"),u={equals:(e,t)=>e===t};let p=F;const g=1,h=2,f={owned:null,cleanups:null,context:null,owner:null};var m=null;let b=null,y=null,v=null,w=null,x=0;function k(e,t){const n=y,o=m,r=0===e.length,i=r?f:{owned:null,cleanups:null,context:null,owner:void 0===t?o:t},a=r?e:()=>e((()=>C((()=>V(i)))));m=i,y=null;try{return B(a,!0)}finally{y=n,m=o}}function _(e,t){const n={value:e,observers:null,observerSlots:null,comparator:(t=t?Object.assign({},u,t):u).equals||void 0};return[N.bind(n),e=>("function"==typeof e&&(e=e(n.value)),L(n,e))]}function T(e,t,n){D(M(e,t,!1,g))}function S(e,t,n){p=j;const o=M(e,t,!1,g);n&&n.render||(o.user=!0),w?w.push(o):D(o)}function E(e,t,n){n=n?Object.assign({},u,n):u;const o=M(e,t,!0,0);return o.observers=null,o.observerSlots=null,o.comparator=n.equals||void 0,D(o),N.bind(o)}function C(e){if(null===y)return e();const t=y;y=null;try{return e()}finally{y=t}}function P(e){S((()=>C(e)))}function I(e){return null===m||(null===m.cleanups?m.cleanups=[e]:m.cleanups.push(e)),e}function O(){return y}function A(){return m}function $(e){let t;return void 0!==(t=W(m,e.id))?t:e.defaultValue}function R(e){const t=E(e),n=E((()=>q(t())));return n.toArray=()=>{const e=n();return Array.isArray(e)?e:null!=e?[e]:[]},n}function N(){if(this.sources&&this.state)if(this.state===g)D(this);else{const e=v;v=null,B((()=>z(this)),!1),v=e}if(y){const e=this.observers?this.observers.length:0;y.sources?(y.sources.push(this),y.sourceSlots.push(e)):(y.sources=[this],y.sourceSlots=[e]),this.observers?(this.observers.push(y),this.observerSlots.push(y.sources.length-1)):(this.observers=[y],this.observerSlots=[y.sources.length-1])}return this.value}function L(e,t,n){let o=e.value;return e.comparator&&e.comparator(o,t)||(e.value=t,e.observers&&e.observers.length&&B((()=>{for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t],o=b&&b.running;o&&b.disposed.has(n),(o?n.tState:n.state)||(n.pure?v.push(n):w.push(n),n.observers&&H(n)),o||(n.state=g)}if(v.length>1e6)throw v=[],new Error}),!1)),t}function D(e){if(!e.fn)return;V(e);const t=m,n=y,o=x;y=m=e,function(e,t,n){let o;try{o=e.fn(t)}catch(t){return e.pure&&(e.state=g,e.owned&&e.owned.forEach(V),e.owned=null),e.updatedAt=n+1,G(t)}(!e.updatedAt||e.updatedAt<=n)&&(null!=e.updatedAt&&"observers"in e?L(e,o):e.value=o,e.updatedAt=n)}(e,e.value,o),y=n,m=t}function M(e,t,n,o=g,r){const i={fn:e,state:o,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:m,context:null,pure:n};return null===m||m!==f&&(m.owned?m.owned.push(i):m.owned=[i]),i}function U(e){if(0===e.state)return;if(e.state===h)return z(e);if(e.suspense&&C(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<x);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if((e=t[n]).state===g)D(e);else if(e.state===h){const n=v;v=null,B((()=>z(e,t[0])),!1),v=n}}function B(e,t){if(v)return e();let n=!1;t||(v=[]),w?n=!0:w=[],x++;try{const t=e();return function(e){v&&(F(v),v=null);if(e)return;const t=w;w=null,t.length&&B((()=>p(t)),!1)}(n),t}catch(e){n||(w=null),v=null,G(e)}}function F(e){for(let t=0;t<e.length;t++)U(e[t])}function j(e){let t,n=0;for(t=0;t<e.length;t++){const o=e[t];o.user?e[n++]=o:U(o)}for(t=0;t<n;t++)U(e[t])}function z(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const o=e.sources[n];if(o.sources){const e=o.state;e===g?o!==t&&(!o.updatedAt||o.updatedAt<x)&&U(o):e===h&&z(o,t)}}}function H(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=h,n.pure?v.push(n):w.push(n),n.observers&&H(n))}}function V(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),n=e.sourceSlots.pop(),o=t.observers;if(o&&o.length){const e=o.pop(),r=t.observerSlots.pop();n<o.length&&(e.sourceSlots[r]=n,o[n]=e,t.observerSlots[n]=r)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)V(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0,e.context=null}function G(e,t=m){const n=function(e){return e instanceof Error?e:new Error("string"==typeof e?e:"Unknown error",{cause:e})}(e);throw n}function W(e,t){return e?e.context&&void 0!==e.context[t]?e.context[t]:W(e.owner,t):void 0}function q(e){if("function"==typeof e&&!e.length)return q(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const o=q(e[n]);Array.isArray(o)?t.push.apply(t,o):t.push(o)}return t}return e}function K(e,t){return function(t){let n;return T((()=>n=C((()=>(m.context={[e]:t.value},R((()=>t.children)))))),void 0),n}}const Y=Symbol("fallback");function X(e){for(let t=0;t<e.length;t++)e[t]()}function Z(e,t){return C((()=>e(t||{})))}function J(){return!0}const Q={get:(e,t,n)=>t===l?n:e.get(t),has:(e,t)=>t===l||e.has(t),set:J,deleteProperty:J,getOwnPropertyDescriptor:(e,t)=>({configurable:!0,enumerable:!0,get:()=>e.get(t),set:J,deleteProperty:J}),ownKeys:e=>e.keys()};function ee(e){return(e="function"==typeof e?e():e)?e:{}}function te(){for(let e=0,t=this.length;e<t;++e){const t=this[e]();if(void 0!==t)return t}}function ne(...e){let t=!1;for(let n=0;n<e.length;n++){const o=e[n];t=t||!!o&&l in o,e[n]="function"==typeof o?(t=!0,E(o)):o}if(t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){const o=ee(e[n])[t];if(void 0!==o)return o}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ee(e[n]))return!0;return!1},keys(){const t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ee(e[n])));return[...new Set(t)]}},Q);const n={},o={},r=new Set;for(let t=e.length-1;t>=0;t--){const i=e[t];if(!i)continue;const a=Object.getOwnPropertyNames(i);for(let e=0,t=a.length;e<t;e++){const t=a[e];if("__proto__"===t||"constructor"===t)continue;const s=Object.getOwnPropertyDescriptor(i,t);if(r.has(t)){const e=o[t];e?s.get?e.push(s.get.bind(i)):void 0!==s.value&&e.push((()=>s.value)):void 0===n[t]&&(n[t]=s.value)}else s.get?(r.add(t),Object.defineProperty(n,t,{enumerable:!0,configurable:!0,get:te.bind(o[t]=[s.get.bind(i)])})):(void 0!==s.value&&r.add(t),n[t]=s.value)}}return n}function oe(e,...t){if(l in e){const n=new Set(t.length>1?t.flat():t[0]),o=t.map((t=>new Proxy({get:n=>t.includes(n)?e[n]:void 0,has:n=>t.includes(n)&&n in e,keys:()=>t.filter((t=>t in e))},Q)));return o.push(new Proxy({get:t=>n.has(t)?void 0:e[t],has:t=>!n.has(t)&&t in e,keys:()=>Object.keys(e).filter((e=>!n.has(e)))},Q)),o}const n={},o=t.map((()=>({})));for(const r of Object.getOwnPropertyNames(e)){const i=Object.getOwnPropertyDescriptor(e,r),a=!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable;let s=!1,l=0;for(const e of t)e.includes(r)&&(s=!0,a?o[l][r]=i.value:Object.defineProperty(o[l],r,i)),++l;s||(a?n[r]=i.value:Object.defineProperty(n,r,i))}return[...o,n]}let re=0;function ie(){const e=s.context;return e?`${e.id}${e.count++}`:"cl-"+re++}const ae=e=>`Stale read from <${e}>.`;function se(e){const t="fallback"in e&&{fallback:()=>e.fallback};return E(function(e,t,n={}){let o=[],r=[],i=[],a=0,s=t.length>1?[]:null;return I((()=>X(i))),()=>{let l,d,u=e()||[];return u[c],C((()=>{let e,t,c,g,h,f,m,b,y,v=u.length;if(0===v)0!==a&&(X(i),i=[],o=[],r=[],a=0,s&&(s=[])),n.fallback&&(o=[Y],r[0]=k((e=>(i[0]=e,n.fallback()))),a=1);else if(0===a){for(r=new Array(v),d=0;d<v;d++)o[d]=u[d],r[d]=k(p);a=v}else{for(c=new Array(v),g=new Array(v),s&&(h=new Array(v)),f=0,m=Math.min(a,v);f<m&&o[f]===u[f];f++);for(m=a-1,b=v-1;m>=f&&b>=f&&o[m]===u[b];m--,b--)c[b]=r[m],g[b]=i[m],s&&(h[b]=s[m]);for(e=new Map,t=new Array(b+1),d=b;d>=f;d--)y=u[d],l=e.get(y),t[d]=void 0===l?-1:l,e.set(y,d);for(l=f;l<=m;l++)y=o[l],d=e.get(y),void 0!==d&&-1!==d?(c[d]=r[l],g[d]=i[l],s&&(h[d]=s[l]),d=t[d],e.set(y,d)):i[l]();for(d=f;d<v;d++)d in c?(r[d]=c[d],i[d]=g[d],s&&(s[d]=h[d],s[d](d))):r[d]=k(p);r=r.slice(0,a=v),o=u.slice(0)}return r}));function p(e){if(i[d]=e,s){const[e,n]=_(d);return s[d]=n,t(u[d],e)}return t(u[d])}}}((()=>e.each),e.children,t||void 0))}function le(e){const t=e.keyed,n=E((()=>e.when),void 0,{equals:(e,n)=>t?e===n:!e==!n});return E((()=>{const o=n();if(o){const r=e.children;return"function"==typeof r&&r.length>0?C((()=>r(t?o:()=>{if(!C(n))throw ae("Show");return e.when}))):r}return e.fallback}),void 0,void 0)}function ce(e){let t=!1;const n=R((()=>e.children)),o=E((()=>{let e=n();Array.isArray(e)||(e=[e]);for(let n=0;n<e.length;n++){const o=e[n].when;if(o)return t=!!e[n].keyed,[n,o,e[n]]}return[-1]}),void 0,{equals:(e,n)=>e[0]===n[0]&&(t?e[1]===n[1]:!e[1]==!n[1])&&e[2]===n[2]});return E((()=>{const[n,r,i]=o();if(n<0)return e.fallback;const a=i.children;return"function"==typeof a&&a.length>0?C((()=>a(t?r:()=>{if(C(o)[0]!==n)throw ae("Match");return i.when}))):a}),void 0,void 0)}function de(e){return e}const ue=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline","allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"]),pe=new Set(["innerHTML","textContent","innerText","children"]),ge=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),he=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});const fe=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),me=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),be={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};const ye="_$DX_DELEGATE";function ve(e,t,n){let o;const r=()=>{const t=document.createElement("template");return t.innerHTML=e,n?t.content.firstChild.firstChild:t.content.firstChild},i=t?()=>C((()=>document.importNode(o||(o=r()),!0))):()=>(o||(o=r())).cloneNode(!0);return i.cloneNode=i,i}function we(e,t=window.document){const n=t[ye]||(t[ye]=new Set);for(let o=0,r=e.length;o<r;o++){const r=e[o];n.has(r)||(n.add(r),t.addEventListener(r,Pe))}}function xe(e,t,n){null==n?e.removeAttribute(t):e.setAttribute(t,n)}function ke(e,t){null==t?e.removeAttribute("class"):e.className=t}function _e(e,t={},n,o){const r={};return o||T((()=>r.children=Ie(e,t.children,r.children))),T((()=>t.ref&&t.ref(e))),T((()=>function(e,t,n,o,r={},i=!1){t||(t={});for(const o in r)if(!(o in t)){if("children"===o)continue;r[o]=Ce(e,o,null,r[o],n,i)}for(const a in t){if("children"===a){o||Ie(e,t.children);continue}const s=t[a];r[a]=Ce(e,a,s,r[a],n,i)}}(e,t,n,!0,r,!0))),r}function Te(e,t,n){return C((()=>e(t,n)))}function Se(e,t,n,o){if(void 0===n||o||(o=[]),"function"!=typeof t)return Ie(e,t,o,n);T((o=>Ie(e,t(),o,n)),o)}function Ee(e,t,n){const o=t.trim().split(/\s+/);for(let t=0,r=o.length;t<r;t++)e.classList.toggle(o[t],n)}function Ce(e,t,n,o,r,i){let a,s,l,c,d;if("style"===t)return function(e,t,n){if(!t)return n?xe(e,"style"):t;const o=e.style;if("string"==typeof t)return o.cssText=t;let r,i;for(i in"string"==typeof n&&(o.cssText=n=void 0),n||(n={}),t||(t={}),n)null==t[i]&&o.removeProperty(i),delete n[i];for(i in t)r=t[i],r!==n[i]&&(o.setProperty(i,r),n[i]=r);return n}(e,n,o);if("classList"===t)return function(e,t,n={}){const o=Object.keys(t||{}),r=Object.keys(n);let i,a;for(i=0,a=r.length;i<a;i++){const o=r[i];o&&"undefined"!==o&&!t[o]&&(Ee(e,o,!1),delete n[o])}for(i=0,a=o.length;i<a;i++){const r=o[i],a=!!t[r];r&&"undefined"!==r&&n[r]!==a&&a&&(Ee(e,r,!0),n[r]=a)}return n}(e,n,o);if(n===o)return o;if("ref"===t)i||n(e);else if("on:"===t.slice(0,3)){const r=t.slice(3);o&&e.removeEventListener(r,o),n&&e.addEventListener(r,n)}else if("oncapture:"===t.slice(0,10)){const r=t.slice(10);o&&e.removeEventListener(r,o,!0),n&&e.addEventListener(r,n,!0)}else if("on"===t.slice(0,2)){const r=t.slice(2).toLowerCase(),i=fe.has(r);if(!i&&o){const t=Array.isArray(o)?o[0]:o;e.removeEventListener(r,t)}(i||n)&&(!function(e,t,n,o){if(o)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const o=n[0];e.addEventListener(t,n[0]=t=>o.call(e,n[1],t))}else e.addEventListener(t,n)}(e,r,n,i),i&&we([r]))}else if("attr:"===t.slice(0,5))xe(e,t.slice(5),n);else if((d="prop:"===t.slice(0,5))||(l=pe.has(t))||!r&&((c=function(e,t){const n=he[e];return"object"==typeof n?n[t]?n.$:void 0:n}(t,e.tagName))||(s=ue.has(t)))||(a=e.nodeName.includes("-")))d&&(t=t.slice(5),s=!0),"class"===t||"className"===t?ke(e,n):!a||s||l?e[c||t]=n:e[(u=t,u.toLowerCase().replace(/-([a-z])/g,((e,t)=>t.toUpperCase())))]=n;else{const o=r&&t.indexOf(":")>-1&&be[t.split(":")[0]];o?function(e,t,n,o){null==o?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,o)}(e,o,t,n):xe(e,ge[t]||t,n)}var u;return n}function Pe(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n||document});n;){const o=n[t];if(o&&!n.disabled){const r=n[`${t}Data`];if(void 0!==r?o.call(n,r,e):o.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function Ie(e,t,n,o,r){for(;"function"==typeof n;)n=n();if(t===n)return n;const i=typeof t,a=void 0!==o;if(e=a&&n[0]&&n[0].parentNode||e,"string"===i||"number"===i)if("number"===i&&(t=t.toString()),a){let r=n[0];r&&3===r.nodeType?r.data=t:r=document.createTextNode(t),n=$e(e,n,o,r)}else n=""!==n&&"string"==typeof n?e.firstChild.data=t:e.textContent=t;else if(null==t||"boolean"===i)n=$e(e,n,o);else{if("function"===i)return T((()=>{let r=t();for(;"function"==typeof r;)r=r();n=Ie(e,r,n,o)})),()=>n;if(Array.isArray(t)){const i=[],s=n&&Array.isArray(n);if(Oe(i,t,n,r))return T((()=>n=Ie(e,i,n,o,!0))),()=>n;if(0===i.length){if(n=$e(e,n,o),a)return n}else s?0===n.length?Ae(e,i,o):function(e,t,n){let o=n.length,r=t.length,i=o,a=0,s=0,l=t[r-1].nextSibling,c=null;for(;a<r||s<i;)if(t[a]!==n[s]){for(;t[r-1]===n[i-1];)r--,i--;if(r===a){const t=i<o?s?n[s-1].nextSibling:n[i-s]:l;for(;s<i;)e.insertBefore(n[s++],t)}else if(i===s)for(;a<r;)c&&c.has(t[a])||t[a].remove(),a++;else if(t[a]===n[i-1]&&n[s]===t[r-1]){const o=t[--r].nextSibling;e.insertBefore(n[s++],t[a++].nextSibling),e.insertBefore(n[--i],o),t[r]=n[i]}else{if(!c){c=new Map;let e=s;for(;e<i;)c.set(n[e],e++)}const o=c.get(t[a]);if(null!=o)if(s<o&&o<i){let l,d=a,u=1;for(;++d<r&&d<i&&null!=(l=c.get(t[d]))&&l===o+u;)u++;if(u>o-s){const r=t[a];for(;s<o;)e.insertBefore(n[s++],r)}else e.replaceChild(n[s++],t[a++])}else a++;else t[a++].remove()}}else a++,s++}(e,n,i):(n&&$e(e),Ae(e,i));n=i}else if(t.nodeType){if(Array.isArray(n)){if(a)return n=$e(e,n,o,t);$e(e,n,null,t)}else null!=n&&""!==n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t);n=t}else console.warn("Unrecognized value. Skipped inserting",t)}return n}function Oe(e,t,n,o){let r=!1;for(let i=0,a=t.length;i<a;i++){let a,s=t[i],l=n&&n[i];if(null==s||!0===s||!1===s);else if("object"==(a=typeof s)&&s.nodeType)e.push(s);else if(Array.isArray(s))r=Oe(e,s,l)||r;else if("function"===a)if(o){for(;"function"==typeof s;)s=s();r=Oe(e,Array.isArray(s)?s:[s],Array.isArray(l)?l:[l])||r}else e.push(s),r=!0;else{const t=String(s);l&&3===l.nodeType&&l.data===t?e.push(l):e.push(document.createTextNode(t))}}return r}function Ae(e,t,n=null){for(let o=0,r=t.length;o<r;o++)e.insertBefore(t[o],n)}function $e(e,t,n,o){if(void 0===n)return e.textContent="";const r=o||document.createTextNode("");if(t.length){let o=!1;for(let i=t.length-1;i>=0;i--){const a=t[i];if(r!==a){const t=a.parentNode===e;o||i?t&&a.remove():t?e.replaceChild(r,a):e.insertBefore(r,n)}else o=!0}}else e.insertBefore(r,n);return[r]}function Re(e,t=!1){return t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function Ne(e){const{useShadow:t}=e,n=document.createTextNode(""),o=A();let r;return S((()=>{r||(r=function(e,t){const n=m,o=y;m=e,y=null;try{return B(t,!0)}catch(e){G(e)}finally{m=n,y=o}}(o,(()=>E((()=>e.children)))));const i=e.mount||document.body;if(i instanceof HTMLHeadElement){const[e,t]=_(!1),n=()=>t(!0);k((t=>Se(i,(()=>e()?t():r()),null))),I(n)}else{const o=Re(e.isSVG?"g":"div",e.isSVG),a=t&&o.attachShadow?o.attachShadow({mode:"open"}):o;Object.defineProperty(o,"_$host",{get:()=>n.parentNode,configurable:!0}),Se(a,r),i.appendChild(o),e.ref&&e.ref(o),I((()=>i.removeChild(o)))}}),void 0,{render:!!!s.context}),n}function Le(e){const[t,n]=oe(e,["component"]),o=E((()=>t.component));return E((()=>{const e=o();switch(typeof e){case"function":return Object.assign(e,{[d]:!0}),C((()=>e(n)));case"string":const t=me.has(e),o=Re(e,t);return _e(o,n,t),o}}))}function De(e){return(t,n)=>{const{element:o}=n;return k((r=>{const i=function(e){const t=Object.keys(e),n={};for(let o=0;o<t.length;o++){const[r,i]=_(e[t[o]]);Object.defineProperty(n,t[o],{get:r,set(e){i((()=>e))}})}return n}(t);o.addPropertyChangedCallback(((e,t)=>i[e]=t)),o.addReleaseCallback((()=>{o.renderRoot.textContent="",r()}));const a=e(i,n);return Se(o.renderRoot,a)}),function(e){if(e.assignedSlot&&e.assignedSlot._$owner)return e.assignedSlot._$owner;let t=e.parentNode;for(;t&&!t._$owner&&(!t.assignedSlot||!t.assignedSlot._$owner);)t=t.parentNode;return t&&t.assignedSlot?t.assignedSlot._$owner:e._$owner}(o))}}function Me(e,t,n){return 2===arguments.length&&(n=t,t={}),a(e,t)(De(n))}const Ue={typebot:void 0,onNewInputBlock:void 0,onAnswer:void 0,onEnd:void 0,onInit:void 0,onNewLogs:void 0,isPreview:void 0,startFrom:void 0,prefilledVariables:void 0,apiHost:void 0,resultId:void 0,sessionId:void 0},Be={...Ue,onClose:void 0,onOpen:void 0,theme:void 0,autoShowDelay:void 0,isOpen:void 0,defaultOpen:void 0},Fe={...Ue,onClose:void 0,onOpen:void 0,theme:void 0,previewMessage:void 0,onPreviewMessageClick:void 0,autoShowDelay:void 0};var je='/*! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.-right-2{right:-8px}.-top-2{top:-8px}.bottom-5{bottom:20px}.left-0{left:0}.left-5{left:20px}.right-0{right:0}.right-2{right:8px}.right-5{right:20px}.top-0{top:0}.top-2{top:8px}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.m-2{margin:8px}.m-auto{margin:auto}.mx-4{margin-left:16px;margin-right:16px}.my-2{margin-bottom:8px;margin-top:8px}.-mr-1{margin-right:-4px}.-mt-1{margin-top:-4px}.ml-2{margin-left:8px}.mt-1{margin-top:4px}.mt-4{margin-top:16px}.\\!block{display:block!important}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-10{height:40px}.h-2{height:8px}.h-2\\.5{height:10px}.h-3{height:12px}.h-4{height:16px}.h-5{height:20px}.h-6{height:24px}.h-8{height:32px}.h-9{height:36px}.h-\\[56px\\]{height:56px}.h-\\[58px\\]{height:58px}.h-\\[80vh\\]{height:80vh}.h-full{height:100%}.h-screen{height:100vh}.max-h-80{max-height:320px}.max-h-\\[464px\\]{max-height:464px}.min-h-full{min-height:100%}.w-10{width:40px}.w-2{width:8px}.w-3{width:12px}.w-4{width:16px}.w-5{width:20px}.w-6{width:24px}.w-8{width:32px}.w-\\[35px\\]{width:35px}.w-\\[58px\\]{width:58px}.w-\\[60\\%\\]{width:60%}.w-full{width:100%}.min-w-0{min-width:0}.min-w-\\[250px\\]{min-width:250px}.max-w-\\[256px\\]{max-width:256px}.max-w-\\[350px\\]{max-width:350px}.max-w-\\[90\\%\\]{max-width:90%}.max-w-full{max-width:100%}.max-w-lg{max-width:512px}.max-w-xs{max-width:320px}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.-rotate-180{--tw-rotate:-180deg}.-rotate-180,.rotate-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate:0deg}.scale-0{--tw-scale-x:0;--tw-scale-y:0}.scale-0,.scale-100{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x:1;--tw-scale-y:1}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .3s ease-out}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-6{gap:24px}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.scroll-smooth{scroll-behavior:smooth}.text-ellipsis{text-overflow:ellipsis}.whitespace-pre-wrap{white-space:pre-wrap}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:8px}.rounded-md{border-radius:6px}.border{border-width:1px}.border-2{border-width:2px}.border-dashed{border-style:dashed}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}.border-gray-400{--tw-border-opacity:1;border-color:rgb(156 163 175/var(--tw-border-opacity))}.bg-\\[rgba\\(0\\2c 0\\2c 0\\2c 0\\.5\\)\\]{background-color:rgba(0,0,0,.5)}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-black\\/20{background-color:rgba(0,0,0,.2)}.bg-blue-400{--tw-bg-opacity:1;background-color:rgb(96 165 250/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity))}.bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity))}.bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity))}.bg-pink-400{--tw-bg-opacity:1;background-color:rgb(244 114 182/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:0.5}.fill-transparent{fill:transparent}.stroke-2{stroke-width:2}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:2px}.p-1{padding:4px}.p-2{padding:8px}.p-3{padding:12px}.p-4{padding:16px}.p-\\[1px\\]{padding:1px}.px-2{padding-left:8px;padding-right:8px}.px-3{padding-left:12px;padding-right:12px}.px-4{padding-left:16px;padding-right:16px}.px-8{padding-left:32px;padding-right:32px}.px-\\[15px\\]{padding-left:15px;padding-right:15px}.py-1{padding-bottom:4px;padding-top:4px}.py-2{padding-bottom:8px;padding-top:8px}.py-4{padding-bottom:16px;padding-top:16px}.py-6{padding-bottom:24px;padding-top:24px}.py-\\[7px\\]{padding-bottom:7px;padding-top:7px}.pb-0{padding-bottom:0}.pl-2{padding-left:8px}.pl-4{padding-left:16px}.pr-1{padding-right:4px}.pr-2{padding-right:8px}.pr-4{padding-right:16px}.pt-10{padding-top:40px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-2xl{font-size:24px;line-height:32px}.text-4xl{font-size:36px;line-height:40px}.text-base{font-size:16px;line-height:24px}.text-sm{font-size:14px;line-height:20px}.text-xl{font-size:20px;line-height:28px}.text-xs{font-size:12px;line-height:16px}.font-bold{font-weight:700}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.blur{--tw-blur:blur(8px)}.blur,.brightness-150{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.brightness-150{--tw-brightness:brightness(1.5)}.brightness-200{--tw-brightness:brightness(2)}.brightness-200,.brightness-95{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.brightness-95{--tw-brightness:brightness(.95)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.scrollable-container::-webkit-scrollbar{display:none}.scrollable-container{-ms-overflow-style:none;scrollbar-width:none}.text-fade-in{transition:opacity .4s ease-in .2s}.bubble-typing{transition:width .4s ease-out,height .4s ease-out}.bubble1,.bubble2,.bubble3{background-color:var(--typebot-host-bubble-color);opacity:.5}.bubble1,.bubble2{animation:chatBubbles 1s ease-in-out infinite}.bubble2{animation-delay:.3s}.bubble3{animation:chatBubbles 1s ease-in-out infinite;animation-delay:.5s}@keyframes chatBubbles{0%{transform:translateY(2.5)}50%{transform:translateY(-2.5px)}to{transform:translateY(0)}}button,input,textarea{font-weight:300}a{text-decoration:underline}ol,ul{margin-inline-end:0;margin-inline-start:0;padding-inline-start:40px}ol{list-style-type:decimal}ul{list-style-type:disc}li:not(:last-child){margin-bottom:8px}pre{word-wrap:break-word;max-height:100%;max-width:100%;overflow:auto;overflow-wrap:break-word;white-space:pre-wrap}.slate-bold{font-weight:700}.slate-italic{font-style:oblique}.slate-underline{text-decoration:underline}.text-input::-moz-placeholder{color:var(--typebot-input-placeholder-color)!important;opacity:1!important}.text-input::placeholder{color:var(--typebot-input-placeholder-color)!important;opacity:1!important}.typebot-container{background-color:var(--typebot-container-bg-color);background-image:var(--typebot-container-bg-image);background-position:50%;background-size:cover;container-type:inline-size;font-family:var(--typebot-container-font-family),-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.typebot-chat-view{-webkit-backdrop-filter:blur(var(--typebot-chat-container-blur));backdrop-filter:blur(var(--typebot-chat-container-blur));background-color:rgba(var(--typebot-chat-container-bg-rgb),var(--typebot-chat-container-opacity));border-color:rgba(var(--typebot-chat-container-border-rgb),var(--typebot-chat-container-border-opacity));border-width:var(--typebot-chat-container-border-width);box-shadow:var(--typebot-chat-container-box-shadow);color:rgb(var(--typebot-chat-container-color));max-width:var(--typebot-chat-container-max-width);min-height:100%;padding-left:20px;padding-right:20px}@container (min-width: 480px){.typebot-chat-view{border-radius:var(--typebot-chat-container-border-radius);max-height:var(--typebot-chat-container-max-height);min-height:var(--typebot-chat-container-max-height)}}.typebot-button{-webkit-backdrop-filter:blur(var(--typebot-button-blur));backdrop-filter:blur(var(--typebot-button-blur));background-color:rgba(var(--typebot-button-bg-rgb),var(--typebot-button-opacity));border-color:rgba(var(--typebot-button-border-rgb),var(--typebot-button-border-opacity));border-radius:var(--typebot-button-border-radius);border-width:var(--typebot-button-border-width);box-shadow:var(--typebot-button-box-shadow);color:var(--typebot-button-color);transition:all .3s ease}.typebot-selectable{background-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.08));border-color:rgba(var(--typebot-button-border-rgb),calc(var(--selectable-alpha-ratio)*.25));border-radius:var(--typebot-button-border-radius);border-width:var(--typebot-button-border-width);color:rgb(var(--typebot-chat-container-color));transition:all .3s ease}.typebot-selectable:hover{background-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.12));border-color:rgba(var(--typebot-button-border-rgb),calc(var(--selectable-alpha-ratio)*.3))}.typebot-selectable.selected{background-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.18));border-color:rgba(var(--typebot-button-border-rgb),calc(var(--selectable-alpha-ratio)*.35))}.typebot-checkbox{background-color:rgba(var(--typebot-checkbox-bg-rgb));border:1px solid rgba(var(--typebot-button-bg-rgb),var(--typebot-button-opacity));border-radius:var(--typebot-button-border-radius);border-radius:2px;color:var(--typebot-button-color);padding:1px;transition:all .3s ease}.typebot-checkbox.checked{background-color:rgb(var(--typebot-button-bg-rgb))}.typebot-host-bubble{color:var(--typebot-host-bubble-color)}.typebot-host-bubble>.bubble-typing{-webkit-backdrop-filter:blur(var(--typebot-host-bubble-blur));backdrop-filter:blur(var(--typebot-host-bubble-blur));background-color:rgba(var(--typebot-host-bubble-bg-rgb),var(--typebot-host-bubble-opacity));border-color:rgba(var(--typebot-host-bubble-border-rgb),var(--typebot-host-bubble-border-opacity));border-radius:var(--typebot-host-bubble-border-radius);border-width:var(--typebot-host-bubble-border-width);box-shadow:var(--typebot-host-bubble-box-shadow)}.typebot-host-bubble iframe,.typebot-host-bubble img,.typebot-host-bubble video{border-radius:6px}.typebot-guest-bubble{-webkit-backdrop-filter:blur(var(--typebot-guest-bubble-blur));backdrop-filter:blur(var(--typebot-guest-bubble-blur));background-color:rgba(var(--typebot-guest-bubble-bg-rgb),var(--typebot-guest-bubble-opacity));border-color:rgba(var(--typebot-guest-bubble-border-rgb),var(--typebot-guest-bubble-border-opacity));border-width:var(--typebot-guest-bubble-border-width);box-shadow:var(--typebot-guest-bubble-box-shadow);color:var(--typebot-guest-bubble-color)}.typebot-guest-bubble,.typebot-guest-bubble-image-attachment{border-radius:var(--typebot-guest-bubble-border-radius)}.typebot-input{-webkit-backdrop-filter:blur(var(--typebot-input-blur));backdrop-filter:blur(var(--typebot-input-blur));background-color:rgba(var(--typebot-input-bg-rgb),var(--typebot-input-opacity));border-color:rgba(var(--typebot-input-border-rgb),var(--typebot-input-border-opacity));border-radius:var(--typebot-input-border-radius);border-width:var(--typebot-input-border-width);box-shadow:var(--typebot-input-box-shadow);transition:filter .1s ease}.typebot-input,.typebot-input-error-message{color:var(--typebot-input-color)}.typebot-input-form .typebot-button{box-shadow:var(--typebot-input-box-shadow)}.typebot-button>.send-icon{fill:var(--typebot-button-color)}.ping span{background-color:rgb(var(--typebot-button-bg-rgb))}.rating-icon-container svg{stroke:rgb(var(--typebot-button-bg-rgb));fill:var(--typebot-host-bubble-bg-color);height:42px;transition:fill .1s ease-out;width:42px}.rating-icon-container.selected svg{fill:rgb(var(--typebot-button-bg-rgb))}.rating-icon-container:hover svg{filter:brightness(.9)}.rating-icon-container:active svg{filter:brightness(.75)}.upload-progress-bar{border-radius:var(--typebot-input-border-radius)}.total-files-indicator,.upload-progress-bar{background-color:rgb(var(--typebot-button-bg-rgb))}.total-files-indicator{color:var(--typebot-button-color);font-size:10px}.typebot-upload-input{border-radius:var(--typebot-input-border-radius);transition:border-color .1s ease-out}.typebot-upload-input.dragging-over{border-color:rgb(var(--typebot-button-bg-rgb))}.secondary-button{background-color:var(--typebot-host-bubble-bg-color);border-radius:var(--typebot-button-border-radius);color:var(--typebot-host-bubble-color)}.typebot-country-select{border-radius:var(--typebot-button-border-radius);color:var(--typebot-input-color)}.typebot-country-select,.typebot-date-input{background-color:var(--typebot-input-bg-color)}.typebot-date-input{color:var(--typebot-input-color);color-scheme:light}.typebot-date-input,.typebot-popup-blocked-toast{border-radius:var(--typebot-input-border-radius)}.typebot-picture-button{background-color:rgb(var(--typebot-button-bg-rgb));border-radius:var(--typebot-button-border-radius);color:var(--typebot-button-color);transition:all .3s ease;width:236px}.typebot-picture-button>img,.typebot-selectable-picture>img{border-radius:var(--typebot-button-border-radius) var(--typebot-button-border-radius) 0 0;height:100%;max-height:200px;min-width:200px;-o-object-fit:cover;object-fit:cover;width:100%}.typebot-picture-button.has-svg>img,.typebot-selectable-picture.has-svg>img{max-height:128px;-o-object-fit:contain;object-fit:contain;padding:1rem}.typebot-selectable-picture{background-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.08));border:1px solid rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.25));border-radius:var(--typebot-button-border-radius);color:rgb(var(--typebot-chat-container-color));transition:all .3s ease;width:236px}.typebot-selectable-picture:hover{background-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.12));border-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.3))}.typebot-selectable-picture.selected{background-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.18));border-color:rgba(var(--typebot-button-bg-rgb),calc(var(--selectable-alpha-ratio)*.35))}select option{background-color:var(--typebot-input-bg-color);color:var(--typebot-input-color)}.typebot-progress-bar-container{background-color:rgba(var(--typebot-progress-bar-bg-rgb),calc(var(--selectable-alpha-ratio)*.12));bottom:var(--typebot-progress-bar-bottom);height:var(--typebot-progress-bar-height);left:0;position:var(--typebot-progress-bar-position);top:var(--typebot-progress-bar-top);width:100%;z-index:42424242}.typebot-progress-bar-container>.typebot-progress-bar{background-color:var(--typebot-progress-bar-color);height:100%;position:absolute;transition:width .25s ease}.typebot-recorder .left-gradient{background-image:linear-gradient(to right,rgba(var(--typebot-input-bg-rgb),1),rgba(var(--typebot-input-bg-rgb),0))}.typebot-recorder .right-gradient{background-image:linear-gradient(to left,rgba(var(--typebot-input-bg-rgb),1),rgba(var(--typebot-input-bg-rgb),0))}.typebot-recorder button{background-color:rgba(var(--typebot-button-bg-rgb),.3);color:rgba(var(--typebot-button-bg-rgb))}@keyframes fadeInFromTop{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeOutFromTop{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-4px)}}@keyframes fadeInFromBottom{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeOutFromBottom{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}[data-scope=menu][data-part=content]{-webkit-backdrop-filter:blur(var(--typebot-input-blur));backdrop-filter:blur(var(--typebot-input-blur));border-color:rgba(var(--typebot-input-border-rgb),var(--typebot-input-border-opacity));border-width:var(--typebot-input-border-width);box-shadow:var(--typebot-input-box-shadow);color:var(--typebot-input-color)}[data-scope=menu][data-part=content],[data-scope=menu][data-part=item]{background-color:rgba(var(--typebot-input-bg-rgb),var(--typebot-input-opacity));border-radius:var(--typebot-input-border-radius)}[data-scope=menu][data-part=item]{cursor:pointer}[data-scope=menu][data-part=content][data-state=open]{animation:fadeInFromTop .15s ease-out forwards}[data-scope=menu][data-part=content][data-state=closed]{animation:fadeOutFromTop 50ms ease-out forwards}[data-scope=toast][data-part=group]{width:100%}[data-scope=toast][data-part=root]{background-color:rgba(var(--typebot-input-bg-rgb),var(--typebot-input-opacity));border-radius:var(--typebot-chat-container-border-radius);box-shadow:var(--typebot-input-box-shadow);color:var(--typebot-input-color);display:flex;flex-direction:column;gap:4px;max-width:60vw;padding:16px 32px 16px 16px}[data-scope=toast][data-part=title]{font-weight:600}[data-scope=toast][data-part=description]{font-size:14px;line-height:20px}[data-scope=toast][data-part=root][data-state=open]{animation:fadeInFromBottom .15s ease-out forwards}[data-scope=toast][data-part=root][data-state=closed]{animation:fadeOutFromBottom 50ms ease-out forwards}[data-scope=progress][data-part=root]{height:100%;width:100%}[data-scope=progress][data-part=circle]{--size:40px;--thickness:4px;--radius:18px;--circomference:113.09724px}[data-scope=progress][data-part=circle-range]{stroke:#fff;--transition-prop:stroke-dasharray,stroke,stroke-dashoffset;--transition-duration:0.2s;transition-duration:.2s;transition-property:stroke-dasharray,stroke,stroke-dashoffset}[data-scope=progress][data-part=circle-track]{stroke:rgba(0,0,0,.5)}.hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.hover\\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.hover\\:brightness-90:hover{--tw-brightness:brightness(.9)}.hover\\:brightness-90:hover,.hover\\:brightness-95:hover{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:brightness-95:hover{--tw-brightness:brightness(.95)}.hover\\:backdrop-brightness-95:hover{--tw-backdrop-brightness:brightness(.95);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.active\\:scale-95:active{--tw-scale-x:.95;--tw-scale-y:.95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\\:brightness-75:active{--tw-brightness:brightness(.75)}.active\\:brightness-75:active,.active\\:brightness-90:active{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.active\\:brightness-90:active{--tw-brightness:brightness(.9)}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:brightness-100:disabled{--tw-brightness:brightness(1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group:hover .group-hover\\:opacity-100{opacity:1}.data-\\[state\\=open\\]\\:backdrop-brightness-90[data-state=open]{--tw-backdrop-brightness:brightness(.9);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}@media (min-width:640px){.sm\\:right-5{right:20px}.sm\\:my-8{margin-bottom:32px;margin-top:32px}.sm\\:p-0{padding:0}.sm\\:opacity-0{opacity:0}}';const ze=async e=>{let t;try{const n="string"==typeof e?e:e.url;t=await fetch(n,{method:"string"==typeof e?"GET":e.method,mode:"cors",headers:"string"!=typeof e&&He(e.body)?{"Content-Type":"application/json"}:void 0,body:"string"!=typeof e&&He(e.body)?JSON.stringify(e.body):void 0});const o=await t.json();if(!t.ok)throw"error"in o?o.error:o;return{data:o,response:t}}catch(e){return console.error(e),{error:e,response:t}}},He=e=>null!=e,Ve=e=>null==e,Ge=e=>null==e||""===e,We=e=>null!=e&&""!==e,qe=e=>e?.startsWith("data:image/svg")||e?.endsWith(".svg"),Ke=e=>{e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((e,t,n,o)=>t+t+n+n+o+o));const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]},Ye=e=>(([e,t,n])=>(299*e+587*t+114*n)/1e3>155)(Ke(e));function Xe(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Xe(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function Ze(){for(var e,t,n=0,o="";n<arguments.length;)(e=arguments[n++])&&(t=Xe(e))&&(o&&(o+=" "),o+=t);return o}const Je=ve('<svg part="button-icon" viewBox="0 0 24 24"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z">'),Qe=ve('<img part="button-icon" alt="Bubble button icon">'),et=ve('<span part="button-icon">'),tt=ve('<svg part="button-icon" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M18.601 8.39897C18.269 8.06702 17.7309 8.06702 17.3989 8.39897L12 13.7979L6.60099 8.39897C6.26904 8.06702 5.73086 8.06702 5.39891 8.39897C5.06696 8.73091 5.06696 9.2691 5.39891 9.60105L11.3989 15.601C11.7309 15.933 12.269 15.933 12.601 15.601L18.601 9.60105C18.9329 9.2691 18.9329 8.73091 18.601 8.39897Z">'),nt=ve('<img part="button-icon" alt="Bubble button close icon">'),ot=ve('<button part="button" aria-label="Open chatbot">'),rt="#0042DA",it="#27272A",at="#fff",st=e=>e.startsWith("http")||e.startsWith("data:image/svg+xml"),lt=e=>(()=>{const t=ot();return t.$$click=()=>e.toggleBot(),t.style.setProperty("z-index","42424242"),Se(t,Z(le,{get when(){return Ve(e.customIconSrc)},keyed:!0,get children(){const t=Je();return T((n=>{const o=e.iconColor??(Ye(e.backgroundColor??rt)?it:at),r=Ze("stroke-2 fill-transparent absolute duration-200 transition w-[60%]",e.isBotOpened?"scale-0 opacity-0":"scale-100 opacity-100");return o!==n._v$&&(null!=(n._v$=o)?t.style.setProperty("stroke",o):t.style.removeProperty("stroke")),r!==n._v$2&&xe(t,"class",n._v$2=r),n}),{_v$:void 0,_v$2:void 0}),t}}),null),Se(t,Z(le,{get when(){return E((()=>!!e.customIconSrc))()&&st(e.customIconSrc)},get children(){const t=Qe();return T((n=>{const o=e.customIconSrc,r=Ze("duration-200 transition",e.isBotOpened?"scale-0 opacity-0":"scale-100 opacity-100",qe(e.customIconSrc)?"w-[60%]":"w-full h-full",qe(e.customIconSrc)?"":"object-cover rounded-full");return o!==n._v$3&&xe(t,"src",n._v$3=o),r!==n._v$4&&ke(t,n._v$4=r),n}),{_v$3:void 0,_v$4:void 0}),t}}),null),Se(t,Z(le,{get when(){return E((()=>!!e.customIconSrc))()&&!st(e.customIconSrc)},get children(){const t=et();return t.style.setProperty("font-family","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'"),Se(t,(()=>e.customIconSrc)),T((()=>ke(t,Ze("text-4xl duration-200 transition",e.isBotOpened?"scale-0 opacity-0":"scale-100 opacity-100")))),t}}),null),Se(t,Z(le,{get when(){return Ve(e.customCloseIconSrc)},get children(){const t=tt();return T((n=>{const o=e.iconColor??(Ye(e.backgroundColor??rt)?it:at),r=Ze("absolute duration-200 transition w-[60%]",e.isBotOpened?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-180 opacity-0");return o!==n._v$5&&(null!=(n._v$5=o)?t.style.setProperty("fill",o):t.style.removeProperty("fill")),r!==n._v$6&&xe(t,"class",n._v$6=r),n}),{_v$5:void 0,_v$6:void 0}),t}}),null),Se(t,Z(le,{get when(){return E((()=>!!e.customCloseIconSrc))()&&st(e.customCloseIconSrc)},get children(){const t=nt();return T((n=>{const o=e.customCloseIconSrc,r=Ze("absolute duration-200 transition",e.isBotOpened?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-180 opacity-0",qe(e.customCloseIconSrc)?"w-[60%]":"w-full h-full",qe(e.customCloseIconSrc)?"":"object-cover rounded-full");return o!==n._v$7&&xe(t,"src",n._v$7=o),r!==n._v$8&&ke(t,n._v$8=r),n}),{_v$7:void 0,_v$8:void 0}),t}}),null),Se(t,Z(le,{get when(){return E((()=>!!e.customCloseIconSrc))()&&!st(e.customCloseIconSrc)},get children(){const t=et();return t.style.setProperty("font-family","-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'"),Se(t,(()=>e.customCloseIconSrc)),T((()=>ke(t,Ze("absolute text-4xl duration-200 transition",e.isBotOpened?"scale-100 rotate-0 opacity-100":"scale-0 -rotate-180 opacity-0")))),t}}),null),T((n=>{const o=Ze("fixed bottom-5 shadow-md rounded-full hover:scale-110 active:scale-95 transition-transform duration-200 flex justify-center items-center animate-fade-in","left"===e.placement?" left-5":" right-5"),r=e.backgroundColor??rt,i=e.buttonSize,a=e.buttonSize;return o!==n._v$9&&ke(t,n._v$9=o),r!==n._v$10&&(null!=(n._v$10=r)?t.style.setProperty("background-color",r):t.style.removeProperty("background-color")),i!==n._v$11&&(null!=(n._v$11=i)?t.style.setProperty("width",i):t.style.removeProperty("width")),a!==n._v$12&&(null!=(n._v$12=a)?t.style.setProperty("height",a):t.style.removeProperty("height")),n}),{_v$9:void 0,_v$10:void 0,_v$11:void 0,_v$12:void 0}),t})();we(["click"]);const ct=ve('<div part="preview-message"><p>'),dt=ve('<img class="rounded-full w-8 h-8 object-cover" alt="Bot avatar" elementtiming="Bot avatar" fetchpriority="high">'),ut=ve('<button part="preview-message-close-button" aria-label="Close"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18">'),pt="#F7F8FF",gt="#303235",ht=e=>{const[t,n]=_(!1),[o,r]=_({x:0,y:0}),i=e=>{r({x:e.touches[0].clientX,y:e.touches[0].clientY})},a=t=>{const n=t.changedTouches[0].clientX,i=t.changedTouches[0].clientY;(Math.abs(n-o().x)>10||i-o().y>10)&&e.onCloseClick(),r({x:0,y:0})};return(()=>{const o=ct(),r=o.firstChild;return o.$$touchend=a,o.$$touchstart=i,o.addEventListener("mouseleave",(()=>n(!1))),o.addEventListener("mouseenter",(()=>n(!0))),o.$$click=()=>e.onClick(),o.style.setProperty("z-index","42424242"),Se(o,Z(ft,{get isHovered(){return t()},get previewMessageTheme(){return e.previewMessageTheme},get onClick(){return e.onCloseClick}}),r),Se(o,Z(le,{get when(){return e.avatarUrl},keyed:!0,children:e=>(()=>{const t=dt();return xe(t,"src",e),t})()}),r),Se(r,(()=>e.message)),T((t=>{const n="fixed max-w-[256px] rounded-md duration-200 flex items-center gap-4 shadow-md animate-fade-in cursor-pointer hover:shadow-lg p-4"+("left"===e.placement?" left-5":" right-5"),r=e.previewMessageTheme?.backgroundColor??pt,i=e.previewMessageTheme?.textColor??gt,a=`calc(${e.buttonSize} + 32px)`;return n!==t._v$&&ke(o,t._v$=n),r!==t._v$2&&(null!=(t._v$2=r)?o.style.setProperty("background-color",r):o.style.removeProperty("background-color")),i!==t._v$3&&(null!=(t._v$3=i)?o.style.setProperty("color",i):o.style.removeProperty("color")),a!==t._v$4&&(null!=(t._v$4=a)?o.style.setProperty("bottom",a):o.style.removeProperty("bottom")),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),o})()},ft=e=>(()=>{const t=ut();return t.$$click=t=>(t.stopPropagation(),e.onClick()),T((n=>{const o="absolute -top-2 -right-2 rounded-full w-6 h-6 p-1 hover:brightness-95 active:brightness-90 transition-all border "+(e.isHovered?"opacity-100":"opacity-0"),r=e.previewMessageTheme?.closeButtonBackgroundColor??pt,i=e.previewMessageTheme?.closeButtonIconColor??gt;return o!==n._v$5&&ke(t,n._v$5=o),r!==n._v$6&&(null!=(n._v$6=r)?t.style.setProperty("background-color",r):t.style.removeProperty("background-color")),i!==n._v$7&&(null!=(n._v$7=i)?t.style.setProperty("color",i):t.style.removeProperty("color")),n}),{_v$5:void 0,_v$6:void 0,_v$7:void 0}),t})();we(["click","touchstart","touchend"]);const mt=ve('<svg viewBox="0 0 800 800" width="16"><rect width="800" height="800" rx="80" fill="#0042DA"></rect><rect x="650" y="293" width="85.4704" height="384.617" rx="20" transform="rotate(90 650 293)" fill="#FF8E20"></rect><path fill-rule="evenodd" clip-rule="evenodd" d="M192.735 378.47C216.337 378.47 235.47 359.337 235.47 335.735C235.47 312.133 216.337 293 192.735 293C169.133 293 150 312.133 150 335.735C150 359.337 169.133 378.47 192.735 378.47Z" fill="#FF8E20"></path><rect x="150" y="506.677" width="85.4704" height="384.617" rx="20" transform="rotate(-90 150 506.677)" fill="white"></rect><path fill-rule="evenodd" clip-rule="evenodd" d="M607.265 421.206C583.663 421.206 564.53 440.34 564.53 463.942C564.53 487.544 583.663 506.677 607.265 506.677C630.867 506.677 650 487.544 650 463.942C650 440.34 630.867 421.206 607.265 421.206Z" fill="white">'),bt=()=>mt(),yt=ve('<a href="https://quick.bot/?utm_source=litebadge" target="_blank" rel="noopener noreferrer" class="lite-badge" id="lite-badge"><span>Made with Typebot'),vt=e=>{let t,n;const o=n=>{n.forEach((n=>{n.removedNodes.forEach((n=>{"id"in n&&t&&"lite-badge"==n.id&&(console.log("Sorry, you can't remove the brand 😅"),e.botContainer?.append(t))}))}))};return P((()=>{document&&e.botContainer&&(n=new MutationObserver(o),n.observe(e.botContainer,{subtree:!1,childList:!0}))})),I((()=>{n&&n.disconnect()})),(()=>{const e=yt(),n=e.firstChild;return"function"==typeof t?Te(t,e):t=e,Se(e,Z(bt,{}),n),e})()},wt=(e,t)=>"undefined"!=typeof window?window.__ENV?window.__ENV[e]??t:void 0:"undefined"!=typeof process?process.env[e]??t:void 0,xt=({ignoreChatApiUrl:e}={ignoreChatApiUrl:!1})=>{const t=wt("NEXT_PUBLIC_CHAT_API_URL"),n=wt("NEXT_PUBLIC_USE_EXPERIMENTAL_CHAT_API_ON")?.split(",");if(!e&&t&&(!n||n.some((e=>e===window.location.href))))return t;const o=wt("NEXT_PUBLIC_VIEWER_URL")?.split(","),r=o?.find((e=>window.location.href.startsWith(e)));return r??o?.[0]??"https://quick.bot"},kt=()=>sessionStorage.getItem("typebotPaymentInProgress"),_t=()=>{sessionStorage.removeItem("typebotPaymentInProgress")};class Tt extends Error{constructor(e,t,n){const o=`${e.status||0===e.status?e.status:""} ${e.statusText||""}`.trim();super(`Request failed with ${o?`status code ${o}`:"an unknown error"}`),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="HTTPError",this.response=e,this.request=t,this.options=n}}class St extends Error{constructor(e){super("Request timed out"),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TimeoutError",this.request=e}}const Et=e=>null!==e&&"object"==typeof e,Ct=(...e)=>{for(const t of e)if((!Et(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return It({},...e)},Pt=(e={},t={})=>{const n=new globalThis.Headers(e),o=t instanceof globalThis.Headers,r=new globalThis.Headers(t);for(const[e,t]of r.entries())o&&"undefined"===t||void 0===t?n.delete(e):n.set(e,t);return n},It=(...e)=>{let t={},n={};for(const o of e)if(Array.isArray(o))Array.isArray(t)||(t=[]),t=[...t,...o];else if(Et(o)){for(let[e,n]of Object.entries(o))Et(n)&&e in t&&(n=It(t[e],n)),t={...t,[e]:n};Et(o.headers)&&(n=Pt(n,o.headers),t.headers=n)}return t},Ot=(()=>{let e=!1,t=!1;const n="function"==typeof globalThis.ReadableStream,o="function"==typeof globalThis.Request;return n&&o&&(t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")),e&&!t})(),At="function"==typeof globalThis.AbortController,$t="function"==typeof globalThis.ReadableStream,Rt="function"==typeof globalThis.FormData,Nt=["get","post","put","patch","head","delete"],Lt={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},Dt=2147483647,Mt=Symbol("stop"),Ut={json:!0,parseJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},Bt={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},Ft=e=>Nt.includes(e)?e.toUpperCase():e,jt=[413,429,503],zt={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:jt,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},Ht=(e={})=>{if("number"==typeof e)return{...zt,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...zt,...e,afterStatusCodes:jt}};class Vt{static create(e,t){const n=new Vt(e,t),o=async()=>{if("number"==typeof n._options.timeout&&n._options.timeout>Dt)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await n._fetch();for(const t of n._options.hooks.afterResponse){const o=await t(n.request,n._options,n._decorateResponse(e.clone()));o instanceof globalThis.Response&&(e=o)}if(n._decorateResponse(e),!e.ok&&n._options.throwHttpErrors){let t=new Tt(e,n.request,n._options);for(const e of n._options.hooks.beforeError)t=await e(t);throw t}if(n._options.onDownloadProgress){if("function"!=typeof n._options.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!$t)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(e.clone(),n._options.onDownloadProgress)}return e},r=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(o):o();for(const[e,o]of Object.entries(Lt))r[e]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||o);const i=(await r).clone();if("json"===e){if(204===i.status)return"";if(0===(await i.clone().arrayBuffer()).byteLength)return"";if(t.parseJson)return t.parseJson(await i.text())}return i[e]()};return r}constructor(e,t={}){Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"abortController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._input=e;const n=this._input instanceof Request&&"credentials"in Request.prototype?this._input.credentials:void 0;if(this._options={...n&&{credentials:n},...t,headers:Pt(this._input.headers,t.headers),hooks:It({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},t.hooks),method:Ft(t.method??this._input.method),prefixUrl:String(t.prefixUrl||""),retry:Ht(t.retry),throwHttpErrors:!1!==t.throwHttpErrors,timeout:t.timeout??1e4,fetch:t.fetch??globalThis.fetch.bind(globalThis)},"string"!=typeof this._input&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&"string"==typeof this._input){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(At){if(this.abortController=new globalThis.AbortController,this._options.signal){const e=this._options.signal;this._options.signal.addEventListener("abort",(()=>{this.abortController.abort(e.reason)}))}this._options.signal=this.abortController.signal}if(Ot&&(this._options.duplex="half"),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const e="?"+("string"==typeof this._options.searchParams?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);!(Rt&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)||this._options.headers&&this._options.headers["content-type"]||this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(t,{...this.request}),this._options)}void 0!==this._options.json&&(this._options.body=JSON.stringify(this._options.json),this.request.headers.set("content-type",this._options.headers.get("content-type")??"application/json"),this.request=new globalThis.Request(this.request,{body:this._options.body}))}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount<=this._options.retry.limit&&!(e instanceof St)){if(e instanceof Tt){if(!this._options.retry.statusCodes.includes(e.response.status))return 0;const t=e.response.headers.get("Retry-After");if(t&&this._options.retry.afterStatusCodes.includes(e.response.status)){let e=Number(t);return Number.isNaN(e)?e=Date.parse(t)-Date.now():e*=1e3,void 0!==this._options.retry.maxRetryAfter&&e>this._options.retry.maxRetryAfter?0:e}if(413===e.response.status)return 0}const t=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,t)}return 0}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(t){const n=Math.min(this._calculateRetryDelay(t),Dt);if(0!==n&&this._retryCount>0){await async function(e,{signal:t}){return new Promise(((n,o)=>{function r(){clearTimeout(i),o(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",r,{once:!0}));const i=setTimeout((()=>{t?.removeEventListener("abort",r),n()}),e)}))}(n,{signal:this._options.signal});for(const e of this._options.hooks.beforeRetry){if(await e({request:this.request,options:this._options,error:t,retryCount:this._retryCount})===Mt)return}return this._retry(e)}throw t}}async _fetch(){for(const e of this._options.hooks.beforeRequest){const t=await e(this.request,this._options);if(t instanceof Request){this.request=t;break}if(t instanceof Response)return t}const e=((e,t)=>{const n={};for(const o in t)o in Bt||o in Ut||o in e||(n[o]=t[o]);return n})(this.request,this._options);return!1===this._options.timeout?this._options.fetch(this.request.clone(),e):async function(e,t,n,o){return new Promise(((r,i)=>{const a=setTimeout((()=>{n&&n.abort(),i(new St(e))}),o.timeout);o.fetch(e,t).then(r).catch(i).then((()=>{clearTimeout(a)}))}))}(this.request.clone(),e,this.abortController,this._options)}_stream(e,t){const n=Number(e.headers.get("content-length"))||0;let o=0;return 204===e.status?(t&&t({percent:1,totalBytes:n,transferredBytes:o},new Uint8Array),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(r){const i=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array),await async function e(){const{done:a,value:s}=await i.read();if(a)r.close();else{if(t){o+=s.byteLength;t({percent:0===n?0:o/n,transferredBytes:o,totalBytes:n},s)}r.enqueue(s),await e()}}()}}),{status:e.status,statusText:e.statusText,headers:e.headers})}}
3
+ /*! MIT License © Sindre Sorhus */const Gt=e=>{const t=(t,n)=>Vt.create(t,Ct(e,n));for(const n of Nt)t[n]=(t,o)=>Vt.create(t,Ct(e,o,{method:n}));return t.create=e=>Gt(Ct(e)),t.extend=t=>Gt(Ct(e,t)),t.stop=Mt,t};var Wt=Gt();class qt extends Error{constructor(e){super("This bot can only be executed on "+e)}}const[Kt,Yt]=_(),Xt=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="19px" color="white"><path d="M476.59 227.05l-.16-.07L49.35 49.84A23.56 23.56 0 0027.14 52 24.65 24.65 0 0016 72.59v113.29a24 24 0 0019.52 23.57l232.93 43.07a4 4 0 010 7.86L35.53 303.45A24 24 0 0016 327v113.31A23.57 23.57 0 0026.59 460a23.94 23.94 0 0013.22 4 24.55 24.55 0 009.52-1.93L476.4 285.94l.19-.09a32 32 0 000-58.8z">'),Zt=e=>(()=>{const t=Xt();return _e(t,e,!0,!0),t})(),Jt=ve('<svg><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">'),Qt=e=>(()=>{const t=Jt();return _e(t,ne(e,{get class(){return"animate-spin h-6 w-6 "+e.class},xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","data-testid":"loading-spinner"}),!0,!0),t})(),en=ve("<button>"),tn=e=>{const t=R((()=>e.children)),[n,o]=oe(e,["disabled","class"]);return(()=>{const r=en();return _e(r,ne(o,{get disabled(){return e.isDisabled||e.isLoading},get class(){return"py-2 px-4 font-semibold focus:outline-none filter hover:brightness-90 active:brightness-75 disabled:opacity-50 disabled:cursor-not-allowed disabled:brightness-100 flex justify-center"+("secondary"===e.variant?" secondary-button":" typebot-button")+" "+n.class}}),!1,!0),Se(r,Z(le,{get when(){return!e.isLoading},get fallback(){return Z(Qt,{})},get children(){return t()}})),r})()},nn=e=>{const[t,n]=oe(e,["disableIcon"]),o=Kt()&&!t.disableIcon||!e.children||"string"==typeof e.children&&Ge(e.children);return Z(tn,ne({type:"submit"},n,{get class(){return Ze("flex items-center",e.class)},"aria-label":o?"Send":void 0,get children(){return Z(ce,{get children(){return[Z(de,{when:o,get children(){return Z(Zt,{get class(){return"send-icon flex w-6 h-6 "+(t.disableIcon?"hidden":"")}})}}),Z(de,{when:!o,get children(){return e.children}})]}})}}))},on=ve('<div class="flex items-center gap-1"><div class="w-2 h-2 rounded-full bubble1"></div><div class="w-2 h-2 rounded-full bubble2"></div><div class="w-2 h-2 rounded-full bubble3">'),rn=()=>on(),an=ve('<input class="focus:outline-none bg-transparent px-4 py-4 flex-1 w-full text-input" type="text">'),sn=e=>{const[t,n]=oe(e,["ref","onInput"]);return(()=>{const o=an();o.$$input=e=>t.onInput(e.currentTarget.value);const r=e.ref;return"function"==typeof r?Te(r,o):e.ref=o,o.style.setProperty("font-size","16px"),_e(o,n,!1,!1),o})()};we(["input"]);const ln=ve('<textarea class="focus:outline-none bg-transparent px-4 py-4 flex-1 w-full text-input" rows="6" data-testid="textarea" required>'),cn=e=>{const[t,n]=oe(e,["ref","onInput"]);return(()=>{const e=ln();e.$$input=e=>t.onInput(e.currentTarget.value);const o=t.ref;return"function"==typeof o?Te(o,e):t.ref=e,e.style.setProperty("font-size","16px"),_e(e,ne({get autofocus(){return!Kt()}},n),!1,!1),e})()};we(["input"]);const dn=!0,un=ve('<div><div class="flex w-full items-center"><div class="flex relative z-10 items-start typebot-host-bubble max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing z-10 "></div><audio controls>');let pn;const gn=e=>{let t,n,o=!1;const[r,i]=_(!!e.onTransitionEnd);return P((()=>{pn=setTimeout((()=>{o||(o=!0,i(!1),setTimeout((()=>e.onTransitionEnd?.(t)),400))}),100)})),I((()=>{pn&&clearTimeout(pn)})),(()=>{const o=un(),i=o.firstChild.firstChild.firstChild,a=i.nextSibling;"function"==typeof t?Te(t,o):t=o,Se(i,(()=>{const e=E((()=>!!r()));return()=>e()&&Z(rn,{})})());return"function"==typeof n?Te(n,a):n=a,T((t=>{const n=Ze("flex flex-col",e.onTransitionEnd?"animate-fade-in":void 0),s=r()?"64px":"100%",l=r()?"32px":"100%",c=e.content?.url,d=!!e.onTransitionEnd&&(e.content?.isAutoplayEnabled??dn),u="z-10 text-fade-in "+(r()?"opacity-0":"opacity-100 m-2"),p=r()?Kt()?"32px":"36px":"revert";return n!==t._v$&&ke(o,t._v$=n),s!==t._v$2&&(null!=(t._v$2=s)?i.style.setProperty("width",s):i.style.removeProperty("width")),l!==t._v$3&&(null!=(t._v$3=l)?i.style.setProperty("height",l):i.style.removeProperty("height")),c!==t._v$4&&xe(a,"src",t._v$4=c),d!==t._v$5&&(a.autoplay=t._v$5=d),u!==t._v$6&&ke(a,t._v$6=u),p!==t._v$7&&(null!=(t._v$7=p)?a.style.setProperty("height",p):a.style.removeProperty("height")),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0,_v$7:void 0}),o})()},hn=400,fn=ve('<div><div class="flex w-full items-center"><div class="flex relative z-10 items-start typebot-host-bubble w-full max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing z-10 "></div><div><iframe id="embed-bubble-content" class="w-full h-full ">');let mn;const bn=e=>{let t;const[n,o]=_(!!e.onTransitionEnd),r=t=>{e.content?.waitForEvent?.isEnabled&&We(t.data.name)&&t.data.name===e.content?.waitForEvent.name&&(e.onCompleted?.(e.content.waitForEvent.saveDataInVariableId&&t.data.data?{type:"text",value:t.data.data}:void 0),window.removeEventListener("message",r))};return P((()=>{mn=setTimeout((()=>{o(!1),e.content?.waitForEvent?.isEnabled&&window.addEventListener("message",r),setTimeout((()=>{e.onTransitionEnd?.(t)}),400)}),2e3)})),I((()=>{mn&&clearTimeout(mn),window.removeEventListener("message",r)})),(()=>{const o=fn(),r=o.firstChild.firstChild.firstChild,i=r.nextSibling,a=i.firstChild;return"function"==typeof t?Te(t,o):t=o,Se(r,(()=>{const e=E((()=>!!n()));return()=>e()&&Z(rn,{})})()),T((t=>{const s=Ze("flex flex-col w-full",e.onTransitionEnd?"animate-fade-in":void 0),l=n()?"64px":"100%",c=n()?"32px":"100%",d=Ze("p-4 z-20 text-fade-in w-full",n()?"opacity-0":"opacity-100 p-4"),u=n()?Kt()?"32px":"36px":`${e.content?.height??hn}px`,p=e.content?.url;return s!==t._v$&&ke(o,t._v$=s),l!==t._v$2&&(null!=(t._v$2=l)?r.style.setProperty("width",l):r.style.removeProperty("width")),c!==t._v$3&&(null!=(t._v$3=c)?r.style.setProperty("height",c):r.style.removeProperty("height")),d!==t._v$4&&ke(i,t._v$4=d),u!==t._v$5&&(null!=(t._v$5=u)?i.style.setProperty("height",u):i.style.removeProperty("height")),p!==t._v$6&&xe(a,"src",t._v$6=p),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0}),o})()},yn=e=>"string"==typeof e?e:e instanceof Error?e.name+": "+e.message:JSON.stringify(e),vn=Object.getPrototypeOf((async function(){})).constructor,wn=async({content:e,args:t})=>{try{const n=vn(...t.map((e=>e.id)),xn(e));await n(...t.map((e=>e.value)))}catch(e){return{logs:[{status:"error",description:"Script block failed to execute",details:yn(e)}]}}},xn=e=>e.replace(/<script>/g,"").replace(/<\/script>/g,""),kn=async({args:e,content:t})=>{try{const n=vn(...Object.keys(e),t);await n(...Object.keys(e).map((t=>e[t])))}catch(e){console.warn("Script threw an error:",e)}},[_n,Tn]=_("100%"),Sn=ve('<div><div class="flex w-full items-center"><div class="flex relative z-10 items-start typebot-host-bubble w-full max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing z-10 "></div><div><div class="w-full overflow-y-auto">');let En;const Cn=e=>{let t;const[n,o]=_(!!e.onTransitionEnd);let r;return P((()=>{kn({args:{...e.content.initFunction.args,typebotElement:r},content:e.content.initFunction.content}),e.content.waitForEventFunction&&kn({args:{...e.content.waitForEventFunction.args,continueFlow:t=>e.onCompleted(t?{type:"text",value:t}:void 0)},content:e.content.waitForEventFunction.content}),En=setTimeout((()=>{o(!1),setTimeout((()=>e.onTransitionEnd?.(t)),400)}),2e3)})),I((()=>{En&&clearTimeout(En)})),(()=>{const o=Sn(),i=o.firstChild.firstChild.firstChild,a=i.nextSibling,s=a.firstChild;"function"==typeof t?Te(t,o):t=o,Se(i,(()=>{const e=E((()=>!!n()));return()=>e()&&Z(rn,{})})());return"function"==typeof r?Te(r,s):r=s,T((t=>{const r=Ze("flex flex-col w-full",e.onTransitionEnd?"animate-fade-in":void 0),l=n()?"64px":"100%",c=n()?"32px":"100%",d=Ze("p-2 z-20 text-fade-in w-full",n()?"opacity-0":"opacity-100"),u=n()?Kt()?"32px":"36px":void 0,p=`calc(${_n()} - 100px)`;return r!==t._v$&&ke(o,t._v$=r),l!==t._v$2&&(null!=(t._v$2=l)?i.style.setProperty("width",l):i.style.removeProperty("width")),c!==t._v$3&&(null!=(t._v$3=c)?i.style.setProperty("height",c):i.style.removeProperty("height")),d!==t._v$4&&ke(a,t._v$4=d),u!==t._v$5&&(null!=(t._v$5=u)?a.style.setProperty("height",u):a.style.removeProperty("height")),p!==t._v$6&&(null!=(t._v$6=p)?s.style.setProperty("max-height",p):s.style.removeProperty("max-height")),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0}),o})()},Pn={alt:"Bubble image"},In=ve('<img elementtiming="Bubble image" fetchpriority="high">'),On=ve('<div><div class="flex w-full items-center"><div class="flex relative z-10 items-start typebot-host-bubble max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing z-10 ">'),An=ve('<a target="_blank">'),$n=ve("<figure>");let Rn;const Nn=e=>{let t,n;const[o,r]=_(!!e.onTransitionEnd),i=()=>{o()&&(r(!1),setTimeout((()=>{e.onTransitionEnd?.(t)}),400))};P((()=>{n&&(Rn=setTimeout(i,5e3),n.onload=()=>{clearTimeout(Rn),i()})})),I((()=>{Rn&&clearTimeout(Rn)}));const a=(()=>{const t=In();return"function"==typeof n?Te(n,t):n=t,t.style.setProperty("max-height","512px"),T((n=>{const r=e.content?.url,i=e.content?.clickLink?.alt??Pn.alt,a=Ze(o()?"opacity-0":"opacity-100",e.onTransitionEnd?"text-fade-in":void 0,e.content?.url?.endsWith(".svg")?"w-full":void 0),s=o()?"32px":"auto";return r!==n._v$&&xe(t,"src",n._v$=r),i!==n._v$2&&xe(t,"alt",n._v$2=i),a!==n._v$3&&ke(t,n._v$3=a),s!==n._v$4&&(null!=(n._v$4=s)?t.style.setProperty("height",s):t.style.removeProperty("height")),n}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),t})();return(()=>{const n=On(),r=n.firstChild.firstChild,i=r.firstChild;return"function"==typeof t?Te(t,n):t=n,Se(i,(()=>{const e=E((()=>!!o()));return()=>e()?Z(rn,{}):null})()),Se(r,(()=>{const t=E((()=>!!e.content?.clickLink));return()=>t()?(()=>{const t=An();return Se(t,a),T((n=>{const r=e.content.clickLink.url,i=Ze("z-10",o()?"h-8":"p-4");return r!==n._v$8&&xe(t,"href",n._v$8=r),i!==n._v$9&&ke(t,n._v$9=i),n}),{_v$8:void 0,_v$9:void 0}),t})():(()=>{const e=$n();return Se(e,a),T((()=>ke(e,Ze("z-10",!o()&&"p-4",o()?Kt()?"h-8":"h-9":"")))),e})()})(),null),T((t=>{const r=Ze("flex flex-col",e.onTransitionEnd?"animate-fade-in":void 0),a=o()?"64px":"100%",s=o()?"32px":"100%";return r!==t._v$5&&ke(n,t._v$5=r),a!==t._v$6&&(null!=(t._v$6=a)?i.style.setProperty("width",a):i.style.removeProperty("width")),s!==t._v$7&&(null!=(t._v$7=s)?i.style.setProperty("height",s):i.style.removeProperty("height")),t}),{_v$5:void 0,_v$6:void 0,_v$7:void 0}),n})()},Ln=ve("<br>"),Dn=ve("<span>"),Mn=e=>(()=>{const t=Dn();return Se(t,(()=>e.text),null),Se(t,Z(le,{get when(){return E((()=>!!e.isUniqueChild))()&&Ge(e.text)},get children(){return Ln()}}),null),T((()=>ke(t,((e,t,n)=>{let o="";return e&&(o+="slate-bold"),t&&(o+=" slate-italic"),n&&(o+=" slate-underline"),o})(e.bold,e.italic,e.underline)))),t})(),Un=ve('<a target="_blank" rel="noopener noreferrer">'),Bn=ve("<ol>"),Fn=ve("<ul>"),jn=ve("<li>"),zn=ve("<span>"),Hn=ve("<div>"),Vn=e=>Z(ce,{get children(){return[Z(de,{get when(){return He(e.element.text)},get children(){return Z(Mn,ne((()=>e.element),{get isUniqueChild(){return e.isUniqueChild??!1}}))}}),Z(de,{when:!0,get children(){return Z(ce,{get children(){return[Z(de,{get when(){return"a"===e.element.type},get children(){const t=Un();return Se(t,Z(se,{get each(){return e.element.children},children:t=>Z(Vn,{element:t,get isUniqueChild(){return 1===e.element.children?.length}})})),T((()=>xe(t,"href",e.element.url))),t}}),Z(de,{get when(){return"ol"===e.element.type},get children(){const t=Bn();return Se(t,Z(se,{get each(){return e.element.children},children:t=>Z(Vn,{element:t,get isUniqueChild(){return 1===e.element.children?.length}})})),t}}),Z(de,{get when(){return"ul"===e.element.type},get children(){const t=Fn();return Se(t,Z(se,{get each(){return e.element.children},children:t=>Z(Vn,{element:t,get isUniqueChild(){return 1===e.element.children?.length}})})),t}}),Z(de,{get when(){return"li"===e.element.type},get children(){const t=jn();return Se(t,Z(se,{get each(){return e.element.children},children:t=>Z(Vn,{element:t,get isUniqueChild(){return 1===e.element.children?.length}})})),t}}),Z(de,{when:!0,get children(){return Z(Gn,{get element(){return e.element},get insideInlineVariable(){return e.insideInlineVariable??!1},get children(){return Z(se,{get each(){return e.element.children},children:t=>Z(Vn,{element:t,get isUniqueChild(){return 1===e.element.children?.length},get insideInlineVariable(){return"inline-variable"===e.element.type}})})}})}})]}})}})]}}),Gn=e=>Z(ce,{get children(){return[Z(de,{get when(){return"inline-variable"===e.element.type||e.insideInlineVariable},get children(){const t=zn();return Se(t,(()=>e.children)),T((()=>xe(t,"data-element-type",e.element.type))),t}}),Z(de,{when:!0,get children(){const t=Hn();return Se(t,(()=>e.children)),T((()=>xe(t,"data-element-type",e.element.type))),t}})]}}),Wn=e=>e.map((e=>e.text??Wn(e.children))).join(""),qn={isInputPrefillEnabled:!1,isHideQueryParamsEnabled:!0,isNewResultOnRefreshEnabled:!0,rememberUser:{isEnabled:!1,storage:"session"},isBrandingEnabled:!1,isTypingEmulationEnabled:!0},Kn={enabled:!0,speed:400,maxDelay:3,delayBetweenBubbles:0,isDisabledOnFirstMessage:!0},Yn=ve('<div><div class="flex w-full items-center"><div class="flex relative items-start typebot-host-bubble max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing " data-testid="host-bubble"></div><div>');let Xn;const Zn=e=>{let t;const[n,o]=_(!!e.onTransitionEnd),r=()=>{n()&&(o(!1),setTimeout((()=>{e.onTransitionEnd?.(t)}),400))};return P((()=>{if(!n)return;const t=e.content?.richText?Wn(e.content.richText):"",o=!1===e.typingEmulation?.enabled||e.isTypingSkipped?0:(({bubbleContent:e,typingSettings:t})=>{let n=e.match(/(\w+)/g)?.length??0;0===n&&(n=e.length);const{enabled:o,speed:r,maxDelay:i}={enabled:t?.enabled??Kn.enabled,speed:t?.speed??Kn.speed,maxDelay:t?.maxDelay??Kn.maxDelay};let a=o?n/r*6e4:0;return a>1e3*i&&(a=1e3*i),a})({bubbleContent:t,typingSettings:e.typingEmulation});Xn=setTimeout(r,o)})),I((()=>{Xn&&clearTimeout(Xn)})),(()=>{const o=Yn(),r=o.firstChild.firstChild.firstChild,i=r.nextSibling;return"function"==typeof t?Te(t,o):t=o,Se(r,(()=>{const e=E((()=>!!n()));return()=>e()&&Z(rn,{})})()),Se(i,Z(se,{get each(){return e.content?.richText},children:e=>Z(Vn,{element:e})})),T((t=>{const a=Ze("flex flex-col",e.onTransitionEnd?"animate-fade-in":void 0),s=n()?"64px":"100%",l=n()?"32px":"100%",c=Ze("overflow-hidden text-fade-in mx-4 my-2 whitespace-pre-wrap slate-html-container relative text-ellipsis",n()?"opacity-0":"opacity-100"),d=n()?Kt()?"16px":"20px":"100%";return a!==t._v$&&ke(o,t._v$=a),s!==t._v$2&&(null!=(t._v$2=s)?r.style.setProperty("width",s):r.style.removeProperty("width")),l!==t._v$3&&(null!=(t._v$3=l)?r.style.setProperty("height",l):r.style.removeProperty("height")),c!==t._v$4&&ke(i,t._v$4=c),d!==t._v$5&&(null!=(t._v$5=d)?i.style.setProperty("height",d):i.style.removeProperty("height")),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0}),o})()};let Jn=function(e){return e.URL="url",e.YOUTUBE="youtube",e.VIMEO="vimeo",e.TIKTOK="tiktok",e.GUMLET="gumlet",e}({});const Qn=[Jn.YOUTUBE,Jn.VIMEO,Jn.TIKTOK,Jn.GUMLET],eo=400,to="100%",no=!0,oo=!0,ro={[Jn.VIMEO]:"https://player.vimeo.com/video",[Jn.YOUTUBE]:"https://www.youtube.com/embed",[Jn.TIKTOK]:"https://www.tiktok.com/embed/v2",[Jn.GUMLET]:"https://play.gumlet.io/embed"},io=ve("<video>"),ao=ve('<div><iframe class="w-full h-full" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>'),so=ve('<div><div class="flex w-full items-center"><div class="flex relative z-10 items-start typebot-host-bubble overflow-hidden w-full max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing z-10 ">');let lo;const co=e=>{let t;const[n,o]=_(!!e.onTransitionEnd);return P((()=>{const r=e.content?.type&&Qn.includes(e.content?.type)?2e3:100;lo=setTimeout((()=>{n()&&(o(!1),setTimeout((()=>{e.onTransitionEnd?.(t)}),400))}),r)})),I((()=>{lo&&clearTimeout(lo)})),(()=>{const o=so(),r=o.firstChild.firstChild,i=r.firstChild;return"function"==typeof t?Te(t,o):t=o,Se(i,(()=>{const e=E((()=>!!n()));return()=>e()&&Z(rn,{})})()),Se(r,Z(ce,{get children(){return[Z(de,{get when(){return e.content?.type&&e.content.type===Jn.URL},get children(){const t=io();return T((o=>{const r=!!e.onTransitionEnd&&(e.content?.isAutoplayEnabled??oo),i=e.content?.url,a=e.content?.areControlsDisplayed??no,s="p-4 focus:outline-none w-full z-10 text-fade-in rounded-md "+(n()?"opacity-0":"opacity-100"),l=n()?Kt()?"32px":"36px":"auto",c=e.content?.aspectRatio,d=e.content?.maxWidth??to;return r!==o._v$&&(t.autoplay=o._v$=r),i!==o._v$2&&xe(t,"src",o._v$2=i),a!==o._v$3&&(t.controls=o._v$3=a),s!==o._v$4&&ke(t,o._v$4=s),l!==o._v$5&&(null!=(o._v$5=l)?t.style.setProperty("height",l):t.style.removeProperty("height")),c!==o._v$6&&(null!=(o._v$6=c)?t.style.setProperty("aspect-ratio",c):t.style.removeProperty("aspect-ratio")),d!==o._v$7&&(null!=(o._v$7=d)?t.style.setProperty("max-width",d):t.style.removeProperty("max-width")),o}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0,_v$7:void 0}),t}}),Z(de,{get when(){return E((()=>!!e.content?.type))()&&Qn.includes(e.content.type)},get children(){const t=ao(),o=t.firstChild;return T((r=>{const i=Ze("p-4 z-10 text-fade-in w-full",n()?"opacity-0":"opacity-100 p-4"),a=n()?Kt()?"32px":"36px":e.content?.aspectRatio?void 0:`${e.content?.height??eo}px`,s=e.content?.aspectRatio,l=e.content?.maxWidth??to,c=`${ro[e.content?.type]}/${e.content?.id??""}${e.content?.queryParamsStr??""}`;return i!==r._v$8&&ke(t,r._v$8=i),a!==r._v$9&&(null!=(r._v$9=a)?t.style.setProperty("height",a):t.style.removeProperty("height")),s!==r._v$10&&(null!=(r._v$10=s)?t.style.setProperty("aspect-ratio",s):t.style.removeProperty("aspect-ratio")),l!==r._v$11&&(null!=(r._v$11=l)?t.style.setProperty("max-width",l):t.style.removeProperty("max-width")),c!==r._v$12&&xe(o,"src",r._v$12=c),r}),{_v$8:void 0,_v$9:void 0,_v$10:void 0,_v$11:void 0,_v$12:void 0}),t}})]}}),null),T((t=>{const r=Ze("flex flex-col w-full",e.onTransitionEnd?"animate-fade-in":void 0),a=n()?"64px":"100%",s=n()?"32px":"100%",l=e.content?.maxWidth??to;return r!==t._v$13&&ke(o,t._v$13=r),a!==t._v$14&&(null!=(t._v$14=a)?i.style.setProperty("width",a):i.style.removeProperty("width")),s!==t._v$15&&(null!=(t._v$15=s)?i.style.setProperty("height",s):i.style.removeProperty("height")),l!==t._v$16&&(null!=(t._v$16=l)?i.style.setProperty("max-width",l):i.style.removeProperty("max-width")),t}),{_v$13:void 0,_v$14:void 0,_v$15:void 0,_v$16:void 0}),o})()};let uo=function(e){return e.TEXT="text",e.IMAGE="image",e.VIDEO="video",e.EMBED="embed",e.AUDIO="audio",e}({});const po=e=>Z(ce,{get children(){return[Z(de,{get when(){return e.message.type===uo.TEXT},get children(){return Z(Zn,{get content(){return e.message.content},get isTypingSkipped(){return e.isTypingSkipped},get typingEmulation(){return e.typingEmulation},get onTransitionEnd(){return e.onTransitionEnd}})}}),Z(de,{get when(){return e.message.type===uo.IMAGE},get children(){return Z(Nn,{get content(){return e.message.content},get onTransitionEnd(){return e.onTransitionEnd}})}}),Z(de,{get when(){return e.message.type===uo.VIDEO},get children(){return Z(co,{get content(){return e.message.content},get onTransitionEnd(){return e.onTransitionEnd}})}}),Z(de,{get when(){return e.message.type===uo.EMBED},get children(){return Z(bn,{get content(){return e.message.content},get onTransitionEnd(){return e.onTransitionEnd},get onCompleted(){return e.onCompleted}})}}),Z(de,{get when(){return"custom-embed"===e.message.type},get children(){return Z(Cn,{get content(){return e.message.content},get onTransitionEnd(){return e.onTransitionEnd},get onCompleted(){return e.onCompleted}})}}),Z(de,{get when(){return e.message.type===uo.AUDIO},get children(){return Z(gn,{get content(){return e.message.content},get onTransitionEnd(){return e.onTransitionEnd}})}})]}}),go=ve('<figure data-testid="default-avatar"><svg width="75" height="75" viewBox="0 0 75 75" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="mask0" x="0" y="0" mask-type="alpha"><circle cx="37.5" cy="37.5" r="37.5" fill="#0042DA"></circle></mask><g mask="url(#mask0)"><rect x="-30" y="-43" width="131" height="154" fill="#0042DA"></rect><rect x="2.50413" y="120.333" width="81.5597" height="86.4577" rx="2.5" transform="rotate(-52.6423 2.50413 120.333)" stroke="#FED23D" stroke-width="5"></rect><circle cx="76.5" cy="-1.5" r="29" stroke="#FF8E20" stroke-width="5"></circle><path d="M-49.8224 22L-15.5 -40.7879L18.8224 22H-49.8224Z" stroke="#F7F8FF" stroke-width="5">'),ho=()=>(()=>{const e=go(),t=e.firstChild;return T((n=>{const o="flex justify-center items-center rounded-full text-white relative flex-shrink-0 "+(Kt()?"w-6 h-6 text-sm":"w-10 h-10 text-xl"),r="absolute top-0 left-0 "+(Kt()?" w-6 h-6 text-sm":"w-full h-full text-xl");return o!==n._v$&&ke(e,n._v$=o),r!==n._v$2&&xe(t,"class",n._v$2=r),n}),{_v$:void 0,_v$2:void 0}),e})(),fo=ve('<figure><img alt="Bot avatar" class="rounded-full object-cover w-full h-full" elementtiming="Bot avatar" fetchpriority="high">'),mo=e=>{const[t,n]=_(e.initialAvatarSrc);return S((()=>{!t()?.startsWith("{{")&&t()||!e.initialAvatarSrc?.startsWith("http")||n(e.initialAvatarSrc)})),Z(le,{get when(){return We(t())},keyed:!0,get fallback(){return Z(ho,{})},get children(){const e=fo(),n=e.firstChild;return T((o=>{const r="flex justify-center items-center rounded-full text-white relative animate-fade-in flex-shrink-0 "+(Kt()?"w-6 h-6 text-sm":"w-10 h-10 text-xl"),i=t();return r!==o._v$&&ke(e,o._v$=r),i!==o._v$2&&xe(n,"src",o._v$2=i),o}),{_v$:void 0,_v$2:void 0}),e}})},bo=Symbol(),yo=Object.getPrototypeOf,vo=new WeakMap,wo=e=>(e=>e&&(vo.has(e)?vo.get(e):yo(e)===Object.prototype||yo(e)===Array.prototype))(e)&&e[bo]||null,xo=(e,t=!0)=>{vo.set(e,t)};function ko(e,t){const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;return n?(n[e]||(n[e]=t()),n[e]):t()}var _o=e=>"object"==typeof e&&null!==e,To=ko("__zag__proxyStateMap",(()=>new WeakMap)),So=ko("__zag__refSet",(()=>new WeakSet)),[Eo]=((e=Object.is,t=(e,t)=>new Proxy(e,t),n=e=>_o(e)&&!So.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),o=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},r=new WeakMap,i=(e,t,n=o)=>{const i=r.get(e);if(i?.[0]===t)return i[1];const a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return xo(a,!0),r.set(e,[t,a]),Reflect.ownKeys(e).forEach((t=>{const o=Reflect.get(e,t);So.has(o)?(xo(o,!1),a[t]=o):o instanceof Promise?Object.defineProperty(a,t,{get:()=>n(o)}):To.has(o)?a[t]=Io(o,n):a[t]=o})),Object.freeze(a)},a=new WeakMap,s=[1,1],l=o=>{if(!_o(o))throw new Error("object required");const r=a.get(o);if(r)return r;let l=s[0];const c=new Set,d=(e,t=++s[0])=>{l!==t&&(l=t,c.forEach((n=>n(e,t))))};let u=s[1];const p=e=>(t,n)=>{const o=[...t];o[1]=[e,...o[1]],d(o,n)},g=new Map,h=e=>{const t=g.get(e);t&&(g.delete(e),t[1]?.())},f=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),m=t(f,{deleteProperty(e,t){const n=Reflect.get(e,t);h(t);const o=Reflect.deleteProperty(e,t);return o&&d(["delete",[t],n]),o},set(t,o,r,i){const s=Reflect.has(t,o),l=Reflect.get(t,o,i);if(s&&(e(l,r)||a.has(r)&&e(l,a.get(r))))return!0;h(o),_o(r)&&(r=wo(r)||r);let u=r;if(Object.getOwnPropertyDescriptor(t,o)?.set);else if(r instanceof Promise)r.then((e=>{Object.assign(r,{status:"fulfilled",value:e}),d(["resolve",[o],e])})).catch((e=>{Object.assign(r,{status:"rejected",reason:e}),d(["reject",[o],e])}));else{!To.has(r)&&n(r)&&(u=Co(r));const e=!So.has(u)&&To.get(u);e&&((e,t)=>{if(c.size){const n=t[3](p(e));g.set(e,[t,n])}else g.set(e,[t])})(o,e)}return Reflect.set(t,o,u,i),d(["set",[o],r,l]),!0}});a.set(o,m);const b=[f,(e=++s[1])=>(u===e||c.size||(u=e,g.forEach((([t])=>{const n=t[1](e);n>l&&(l=n)}))),l),i,e=>{c.add(e),1===c.size&&g.forEach((([e,t],n)=>{const o=e[3](p(n));g.set(n,[e,o])}));return()=>{c.delete(e),0===c.size&&g.forEach((([e,t],n)=>{t&&(t(),g.set(n,[e]))}))}}];return To.set(m,b),Reflect.ownKeys(o).forEach((e=>{const t=Object.getOwnPropertyDescriptor(o,e);t.get||t.set?Object.defineProperty(f,e,t):m[e]=o[e]})),m})=>[l,To,So,e,t,n,o,r,i,a,s])();function Co(e={}){return Eo(e)}function Po(e,t,n){const o=To.get(e);let r;const i=[],a=o[3];let s=!1;const l=a((e=>{i.push(e),n?t(i.splice(0)):r||(r=Promise.resolve().then((()=>{r=void 0,s&&t(i.splice(0))})))}));return s=!0,()=>{s=!1,l()}}function Io(e,t){const n=To.get(e),[o,r,i]=n;return i(o,r(),t)}function Oo(e){return So.add(e),e}function Ao(e,t){Object.keys(t).forEach((o=>{if(Object.getOwnPropertyDescriptor(e,o))throw new Error("object property already defined");const r=t[o],{get:i,set:a}="function"==typeof r?{get:r}:r,s={get:()=>i(Io(n))};a&&(s.set=e=>a(n,e)),Object.defineProperty(e,o,s)}));const n=Co(e);return n}function $o(e,t,n){"object"==typeof n.value&&(n.value=Ro(n.value)),n.enumerable&&!n.get&&!n.set&&n.configurable&&n.writable&&"__proto__"!==t?e[t]=n.value:Object.defineProperty(e,t,n)}function Ro(e){if("object"!=typeof e)return e;var t,n,o,r=0,i=Object.prototype.toString.call(e);if("[object Object]"===i?o=Object.create(e.__proto__||null):"[object Array]"===i?o=Array(e.length):"[object Set]"===i?(o=new Set,e.forEach((function(e){o.add(Ro(e))}))):"[object Map]"===i?(o=new Map,e.forEach((function(e,t){o.set(Ro(t),Ro(e))}))):"[object Date]"===i?o=new Date(+e):"[object RegExp]"===i?o=new RegExp(e.source,e.flags):"[object DataView]"===i?o=new e.constructor(Ro(e.buffer)):"[object ArrayBuffer]"===i?o=e.slice(0):"Array]"===i.slice(-6)&&(o=new e.constructor(e)),o){for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)$o(o,n[r],Object.getOwnPropertyDescriptor(e,n[r]));for(r=0,n=Object.getOwnPropertyNames(e);r<n.length;r++)Object.hasOwnProperty.call(o,t=n[r])&&o[t]===e[t]||$o(o,t,Object.getOwnPropertyDescriptor(e,t))}return o||e}var No=Object.defineProperty,Lo=(e,t,n)=>((e,t,n)=>t in e?No(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);var Do=(e,...t)=>("function"==typeof e?e(...t):e)??void 0,Mo=()=>{},Uo=(...e)=>(...t)=>{e.forEach((function(e){e?.(...t)}))},Bo=(()=>{let e=0;return()=>(e++,e.toString(36))})(),Fo=e=>Array.isArray(e),jo=e=>!(null==e||"object"!=typeof e||Fo(e)),zo=e=>"string"==typeof e,Ho=e=>"function"==typeof e;function Vo(e){if(!Go(e)||void 0===e)return e;const t=Reflect.ownKeys(e).filter((e=>"string"==typeof e)),n={};for(const o of t){const t=e[o];void 0!==t&&(n[o]=Vo(t))}return n}var Go=e=>e&&"object"==typeof e&&e.constructor===Object;function Wo(...e){1===e.length?e[0]:e[1],2!==e.length||e[0]}function qo(...e){1===e.length?e[0]:e[1],2!==e.length||e[0]}function Ko(e,...t){for(const n of t){const t=Vo(n);for(const o in t)jo(n[o])?(e[o]||(e[o]={}),Ko(e[o],n[o])):e[o]=n[o]}return e}function Yo(e){return Ro(e)}function Xo(e){return zo(e)?{type:e}:e}function Zo(e){return e?Fo(e)?e.slice():[e]:[]}function Jo(e){return jo(e)&&null!=e.predicate}var Qo=()=>!0;function er(e,t,n,o){return r=>zo(r)?!!e[r]?.(t,n,o):Ho(r)?r(t,n,o):r.predicate(e)(t,n,o)}var tr={or:function(...e){return{predicate:t=>(n,o,r)=>e.map(er(t,n,o,r)).some(Boolean)}},and:function(...e){return{predicate:t=>(n,o,r)=>e.map(er(t,n,o,r)).every(Boolean)}},not:function(e){return{predicate:t=>(n,o,r)=>!er(t,n,o,r)(e)}},stateIn:function(...e){return(t,n,o)=>o.state.matches(...e)}};function nr(e,t){return e=e??Qo,(n,o,r)=>{if(zo(e)){const i=t[e];return Ho(i)?i(n,o,r):i}return Jo(e)?e.predicate(t)(n,o,r):e?.(n,o,r)}}function or(e,t){return(n,o,r)=>Jo(e)?e.predicate(t)(n,o,r):e}function rr(e,t){return(n,o)=>{if("number"==typeof(r=e)&&!Number.isNaN(r))return e;var r;if(Ho(e))return e(n,o);if(zo(e)){const r=Number.parseFloat(e);if(!Number.isNaN(r))return r;if(t){const r=t?.[e];return qo(null==r,`[@zag-js/core > determine-delay] Cannot determine delay for \`${e}\`. It doesn't exist in \`options.delays\``),Ho(r)?r(n,o):r}}}}function ir(e){return zo(e)?{target:e}:e}var ar=class{constructor(e,t){Lo(this,"status","Not Started"),Lo(this,"state"),Lo(this,"initialState"),Lo(this,"initialContext"),Lo(this,"id"),Lo(this,"type","machine"),Lo(this,"activityEvents",new Map),Lo(this,"delayedEvents",new Map),Lo(this,"stateListeners",new Set),Lo(this,"doneListeners",new Set),Lo(this,"contextWatchers",new Set),Lo(this,"removeStateListener",Mo),Lo(this,"parent"),Lo(this,"children",new Map),Lo(this,"guardMap"),Lo(this,"actionMap"),Lo(this,"delayMap"),Lo(this,"activityMap"),Lo(this,"sync"),Lo(this,"options"),Lo(this,"config"),Lo(this,"_created",(()=>{const e=Xo("machine.created");this.executeActions(this.config?.created,e)})),Lo(this,"start",(e=>{if(this.state.value="",this.state.tags=[],"Running"===this.status)return this;this.status="Running",this.removeStateListener=Po(this.state,(()=>{this.stateListeners.forEach((e=>{e(this.stateSnapshot)}))}),this.sync),this.setupContextWatchers(),this.executeActivities(Xo("machine.start"),Zo(this.config.activities),"machine.start"),this.executeActions(this.config.entry,Xo("machine.start"));const t=Xo("machine.init"),n=jo(e)?e.value:e,o=jo(e)?e.context:void 0;o&&this.setContext(o);const r={target:n??this.config.initial},i=this.getNextStateInfo(r,t);return this.initialState=i,this.performStateChangeEffects(this.state.value,i,t),this})),Lo(this,"setupContextWatchers",(()=>{const{watch:e}=this.config;if(!e)return;let t=Io(this.state.context);const n=Po(this.state.context,(()=>{const n=Io(this.state.context);for(const[o,r]of Object.entries(e)){(this.options.compareFns?.[o]??Object.is)(t[o],n[o])||this.executeActions(r,this.state.event)}t=n}));this.contextWatchers.add(n)})),Lo(this,"stop",(()=>{if("Stopped"!==this.status)return this.performExitEffects(this.state.value,Xo("machine.stop")),this.executeActions(this.config.exit,Xo("machine.stop")),this.setState(""),this.setEvent("machine.stop"),this.stopStateListeners(),this.stopChildren(),this.stopActivities(),this.stopDelayedEvents(),this.stopContextWatchers(),this.status="Stopped",this})),Lo(this,"stopStateListeners",(()=>{this.removeStateListener(),this.stateListeners.clear()})),Lo(this,"stopContextWatchers",(()=>{this.contextWatchers.forEach((e=>e())),this.contextWatchers.clear()})),Lo(this,"stopDelayedEvents",(()=>{this.delayedEvents.forEach((e=>{e.forEach((e=>e()))})),this.delayedEvents.clear()})),Lo(this,"stopActivities",(e=>{e?(this.activityEvents.get(e)?.forEach((e=>e())),this.activityEvents.get(e)?.clear(),this.activityEvents.delete(e)):(this.activityEvents.forEach((e=>{e.forEach((e=>e())),e.clear()})),this.activityEvents.clear())})),Lo(this,"sendChild",((e,t)=>{const n=Xo(e),o=Do(t,this.contextSnapshot),r=this.children.get(o);r||qo(`[@zag-js/core] Cannot send '${n.type}' event to unknown child`),r.send(n)})),Lo(this,"stopChild",(e=>{this.children.has(e)||qo(`[@zag-js/core > stop-child] Cannot stop unknown child ${e}`),this.children.get(e).stop(),this.children.delete(e)})),Lo(this,"removeChild",(e=>{this.children.delete(e)})),Lo(this,"stopChildren",(()=>{this.children.forEach((e=>e.stop())),this.children.clear()})),Lo(this,"setParent",(e=>{this.parent=e})),Lo(this,"spawn",((e,t)=>{const n=Do(e);return t&&(n.id=t),n.type="machine.actor",n.setParent(this),this.children.set(n.id,n),n.onDone((()=>{this.removeChild(n.id)})).start(),Oo(n)})),Lo(this,"stopActivity",(e=>{if(!this.state.value)return;const t=this.activityEvents.get(this.state.value);t?.get(e)?.(),t?.delete(e)})),Lo(this,"addActivityCleanup",((e,t,n)=>{e&&(this.activityEvents.has(e)?this.activityEvents.get(e)?.set(t,n):this.activityEvents.set(e,new Map([[t,n]])))})),Lo(this,"setState",(e=>{this.state.previousValue=this.state.value,this.state.value=e;const t=this.getStateNode(e);null==e?function(e){for(;e.length>0;)e.pop()}(this.state.tags):this.state.tags=Zo(t?.tags)})),Lo(this,"setContext",(e=>{e&&Ko(this.state.context,Vo(e))})),Lo(this,"setOptions",(e=>{const t=Vo(e);this.actionMap={...this.actionMap,...t.actions},this.delayMap={...this.delayMap,...t.delays},this.activityMap={...this.activityMap,...t.activities},this.guardMap={...this.guardMap,...t.guards}})),Lo(this,"getStateNode",(e=>{if(e)return this.config.states?.[e]})),Lo(this,"getNextStateInfo",((e,t)=>{const n=this.determineTransition(e,t),o=!n?.target,r=n?.target??this.state.value,i=this.state.value!==r,a=this.getStateNode(r),s={reenter:!o&&!i&&!n?.internal,transition:n,stateNode:a,target:r,changed:i};return this.log("NextState:",`[${t.type}]`,this.state.value,"----\x3e",s.target),s})),Lo(this,"getAfterActions",((e,t)=>{let n;return{entry:()=>{n=globalThis.setTimeout((()=>{const t=this.getNextStateInfo(e,this.state.event);this.performStateChangeEffects(this.state.value,t,this.state.event)}),t)},exit:()=>{globalThis.clearTimeout(n)}}})),Lo(this,"getDelayedEventActions",(e=>{const t=this.getStateNode(e),n=this.state.event;if(!t||!t.after)return;const o=[],r=[];if(Fo(t.after)){const e=this.determineTransition(t.after,n);if(!e)return;if(i=e,a="delay",!Object.prototype.hasOwnProperty.call(i,a))throw new Error(`[@zag-js/core > after] Delay is required for after transition: ${JSON.stringify(e)}`);const s=rr(e.delay,this.delayMap)(this.contextSnapshot,n),l=this.getAfterActions(e,s);return o.push(l.entry),r.push(l.exit),{entries:o,exits:r}}var i,a;if(jo(t.after))for(const e in t.after){const i=t.after[e],a=rr(e,this.delayMap)(this.contextSnapshot,n),s=this.getAfterActions(i,a);o.push(s.entry),r.push(s.exit)}return{entries:o,exits:r}})),Lo(this,"executeActions",((e,t)=>{const n=or(e,this.guardMap)(this.contextSnapshot,t,this.guardMeta);for(const e of Zo(n)){const n=zo(e)?this.actionMap?.[e]:e;Wo(zo(e)&&!n,`[@zag-js/core > execute-actions] No implementation found for action: \`${e}\``),n?.(this.state.context,t,this.meta)}})),Lo(this,"executeActivities",((e,t,n)=>{for(const o of t){const t=zo(o)?this.activityMap?.[o]:o;if(!t){Wo(`[@zag-js/core > execute-activity] No implementation found for activity: \`${o}\``);continue}const r=t(this.state.context,e,this.meta);if(r){const e=zo(o)?o:o.name||Bo();this.addActivityCleanup(n??this.state.value,e,r)}}})),Lo(this,"createEveryActivities",((e,t)=>{if(e)if(Fo(e)){const n=Zo(e).find((e=>{const t=rr(e.delay,this.delayMap)(this.contextSnapshot,this.state.event);return nr(e.guard,this.guardMap)(this.contextSnapshot,this.state.event,this.guardMeta)??null!=t}));if(!n)return;const o=rr(n.delay,this.delayMap)(this.contextSnapshot,this.state.event);t((()=>{const e=globalThis.setInterval((()=>{this.executeActions(n.actions,this.state.event)}),o);return()=>{globalThis.clearInterval(e)}}))}else for(const n in e){const o=e?.[n],r=rr(n,this.delayMap)(this.contextSnapshot,this.state.event);t((()=>{const e=globalThis.setInterval((()=>{this.executeActions(o,this.state.event)}),r);return()=>{globalThis.clearInterval(e)}}))}})),Lo(this,"setEvent",(e=>{this.state.previousEvent=this.state.event,this.state.event=Oo(Xo(e))})),Lo(this,"performExitEffects",((e,t)=>{const n=this.state.value;if(""===n)return;const o=e?this.getStateNode(e):void 0;this.stopActivities(n);const r=Zo(or(o?.exit,this.guardMap)(this.contextSnapshot,t,this.guardMeta)),i=this.delayedEvents.get(n);i&&r.push(...i),this.executeActions(r,t)})),Lo(this,"performEntryEffects",((e,t)=>{const n=this.getStateNode(e),o=Zo(n?.activities);this.createEveryActivities(n?.every,(e=>{o.unshift(e)})),o.length>0&&this.executeActivities(t,o);const r=Zo(or(n?.entry,this.guardMap)(this.contextSnapshot,t,this.guardMeta)),i=this.getDelayedEventActions(e);n?.after&&i&&(this.delayedEvents.set(e,i?.exits),r.push(...i.entries)),this.executeActions(r,t),"final"===n?.type&&(this.state.done=!0,this.doneListeners.forEach((e=>{e(this.stateSnapshot)})),this.stop())})),Lo(this,"performTransitionEffects",((e,t)=>{const n=this.determineTransition(e,t);this.executeActions(n?.actions,t)})),Lo(this,"performStateChangeEffects",((e,t,n)=>{this.setEvent(n);const o=t.changed||t.reenter;o&&this.performExitEffects(e,n),this.performTransitionEffects(t.transition,n),this.setState(t.target),o&&this.performEntryEffects(t.target,n)})),Lo(this,"determineTransition",((e,t)=>{const n=(o=e,r=this.guardMap,(e,t,n)=>Zo(o).map(ir).find((o=>nr(o.guard,r)(e,t,n)??o.target??o.actions)));var o,r;return n?.(this.contextSnapshot,t,this.guardMeta)})),Lo(this,"sendParent",(e=>{this.parent||qo("[@zag-js/core > send-parent] Cannot send event to an unknown parent");const t=Xo(e);this.parent?.send(t)})),Lo(this,"log",((...e)=>{})),Lo(this,"send",(e=>{const t=Xo(e);this.transition(this.state.value,t)})),Lo(this,"transition",((e,t)=>{const n=zo(e)?this.getStateNode(e):e?.stateNode,o=Xo(t);if(!n&&!this.config.on){return void Wo("Stopped"===this.status?"[@zag-js/core > transition] Cannot transition a stopped machine":`[@zag-js/core > transition] State does not have a definition for \`state\`: ${e}, \`event\`: ${o.type}`)}const r=n?.on?.[o.type]??this.config.on?.[o.type],i=this.getNextStateInfo(r,o);return this.performStateChangeEffects(this.state.value,i,o),i.stateNode})),Lo(this,"subscribe",(e=>(this.stateListeners.add(e),"Running"===this.status&&e(this.stateSnapshot),()=>{this.stateListeners.delete(e)}))),Lo(this,"onDone",(e=>(this.doneListeners.add(e),this))),Lo(this,"onTransition",(e=>(this.stateListeners.add(e),"Running"===this.status&&e(this.stateSnapshot),this))),this.config=Yo(e),this.options=Yo(t??{}),this.id=this.config.id??`machine-${Bo()}`,this.guardMap=this.options?.guards??{},this.actionMap=this.options?.actions??{},this.delayMap=this.options?.delays??{},this.activityMap=this.options?.activities??{},this.sync=this.options?.sync??!1,this.state=function(e){const t=e.computed??{},n=e.context??{},o=e.initial?e.states?.[e.initial]?.tags:[];return Co({value:e.initial??"",previousValue:"",event:{},previousEvent:{},context:Ao(n,t),done:!1,tags:o??[],hasTag(e){return this.tags.includes(e)},matches(...e){return e.includes(this.value)},can(e){return this.nextEvents.includes(e)},get nextEvents(){const t=e.states?.[this.value]?.on??{},n=e?.on??{};return Object.keys({...t,...n})},get changed(){return!("machine.init"===this.event.value||!this.previousValue)&&this.value!==this.previousValue}})}(this.config),this.initialContext=Io(this.state.context)}get stateSnapshot(){return Io(this.state)}getState(){return this.stateSnapshot}get contextSnapshot(){return this.stateSnapshot.context}get self(){const e=this;return{id:this.id,send:this.send.bind(this),sendParent:this.sendParent.bind(this),sendChild:this.sendChild.bind(this),stop:this.stop.bind(this),stopChild:this.stopChild.bind(this),spawn:this.spawn.bind(this),stopActivity:this.stopActivity.bind(this),get state(){return e.stateSnapshot},get initialContext(){return e.initialContext},get initialState(){return e.initialState?.target??""}}}get meta(){return{state:this.stateSnapshot,guards:this.guardMap,send:this.send.bind(this),self:this.self,initialContext:this.initialContext,initialState:this.initialState?.target??"",getState:()=>this.stateSnapshot,getAction:e=>this.actionMap[e],getGuard:e=>this.guardMap[e]}}get guardMeta(){return{state:this.stateSnapshot}}get[Symbol.toStringTag](){return"Machine"}},sr=(e,t)=>new ar(e,t),lr=(...e)=>e.map((e=>e?.trim?.())).filter(Boolean).join(" "),cr=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,dr=e=>{const t={};let n;for(;n=cr.exec(e);)t[n[1]]=n[2];return t},ur=(e,t)=>{if(zo(e)){if(zo(t))return`${e};${t}`;e=dr(e)}else zo(t)&&(t=dr(t));return Object.assign({},e??{},t??{})};function pr(...e){let t={};for(let n of e){for(let e in t)e.startsWith("on")&&"function"==typeof t[e]&&"function"==typeof n[e]?t[e]=Uo(n[e],t[e]):t[e]="className"!==e&&"class"!==e?"style"!==e?void 0!==n[e]?n[e]:t[e]:ur(t[e],n[e]):lr(t[e],n[e]);for(let e in n)void 0===t[e]&&(t[e]=n[e])}return t}var gr=()=>e=>Array.from(new Set(e));const hr=Symbol("store-raw"),fr=Symbol("store-node");function mr(e){let t=e[l];if(!t&&(Object.defineProperty(e,l,{value:t=new Proxy(e,_r)}),!Array.isArray(e))){const n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let r=0,i=n.length;r<i;r++){const i=n[r];o[i].get&&Object.defineProperty(e,i,{enumerable:o[i].enumerable,get:o[i].get.bind(t)})}}return t}function br(e){let t;return null!=e&&"object"==typeof e&&(e[l]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function yr(e,t=new Set){let n,o,r,i;if(n=null!=e&&e[hr])return n;if(!br(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,i=e.length;n<i;n++)r=e[n],(o=yr(r,t))!==r&&(e[n]=o)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const n=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let s=0,l=n.length;s<l;s++)i=n[s],a[i].get||(r=e[i],(o=yr(r,t))!==r&&(e[i]=o))}return e}function vr(e){let t=e[fr];return t||Object.defineProperty(e,fr,{value:t=Object.create(null)}),t}function wr(e,t,n){return e[t]||(e[t]=kr(n))}function xr(e){if(O()){const t=vr(e);(t._||(t._=kr()))()}}function kr(e){const[t,n]=_(e,{equals:!1,internal:!0});return t.$=n,t}const _r={get(e,t,n){if(t===hr)return e;if(t===l)return n;if(t===c)return xr(e),n;const o=vr(e),r=o[t];let i=r?r():e[t];if(t===fr||"__proto__"===t)return i;if(!r){const n=Object.getOwnPropertyDescriptor(e,t);!O()||"function"==typeof i&&!e.hasOwnProperty(t)||n&&n.get||(i=wr(o,t,i)())}return br(i)?mr(i):i},has(e,t){return t===hr||t===l||t===c||t===fr||"__proto__"===t||(this.get(e,t,e),t in e)},set:()=>!0,deleteProperty:()=>!0,ownKeys:function(e){return xr(e),Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return n&&!n.get&&n.configurable&&t!==l&&t!==fr?(delete n.value,delete n.writable,n.get=()=>e[l][t],n):n}};function Tr(e,t,n,o=!1){if(!o&&e[t]===n)return;const r=e[t],i=e.length;void 0===n?delete e[t]:e[t]=n;let a,s=vr(e);if((a=wr(s,t,r))&&a.$((()=>n)),Array.isArray(e)&&e.length!==i){for(let t=e.length;t<i;t++)(a=s[t])&&a.$();(a=wr(s,"length",i))&&a.$(e.length)}(a=s._)&&a.$()}function Sr(e,t){const n=Object.keys(t);for(let o=0;o<n.length;o+=1){const r=n[o];Tr(e,r,t[r])}}function Er(e,t,n=[]){let o,r=e;if(t.length>1){o=t.shift();const i=typeof o,a=Array.isArray(e);if(Array.isArray(o)){for(let r=0;r<o.length;r++)Er(e,[o[r]].concat(t),n);return}if(a&&"function"===i){for(let r=0;r<e.length;r++)o(e[r],r)&&Er(e,[r].concat(t),n);return}if(a&&"object"===i){const{from:r=0,to:i=e.length-1,by:a=1}=o;for(let o=r;o<=i;o+=a)Er(e,[o].concat(t),n);return}if(t.length>1)return void Er(e[o],t,[o].concat(n));r=e[o],n=[o].concat(n)}let i=t[0];"function"==typeof i&&(i=i(r,n),i===r)||void 0===o&&null==i||(i=yr(i),void 0===o||br(r)&&br(i)&&!Array.isArray(i)?Sr(r,i):Tr(e,o,i))}function Cr(...[e,t]){const n=yr(e||{}),o=Array.isArray(n);return[mr(n),function(...e){B((()=>{o&&1===e.length?function(e,t){if("function"==typeof t&&(t=t(e)),t=yr(t),Array.isArray(t)){if(e===t)return;let n=0,o=t.length;for(;n<o;n++){const o=t[n];e[n]!==o&&Tr(e,n,o)}Tr(e,"length",o)}else Sr(e,t)}(n,e[0]):Er(n,e)}),!1)}]}const Pr=Symbol("store-root");function Ir(e,t,n,o,r){const i=t[n];if(e===i)return;if(n!==Pr&&(!br(e)||!br(i)||r&&e[r]!==i[r]))return void Tr(t,n,e);if(Array.isArray(e)){if(e.length&&i.length&&(!o||r&&e[0]&&null!=e[0][r])){let t,n,a,s,l,c,d,u;for(a=0,s=Math.min(i.length,e.length);a<s&&(i[a]===e[a]||r&&i[a]&&e[a]&&i[a][r]===e[a][r]);a++)Ir(e[a],i,a,o,r);const p=new Array(e.length),g=new Map;for(s=i.length-1,l=e.length-1;s>=a&&l>=a&&(i[s]===e[l]||r&&i[a]&&e[a]&&i[s][r]===e[l][r]);s--,l--)p[l]=i[s];if(a>l||a>s){for(n=a;n<=l;n++)Tr(i,n,e[n]);for(;n<e.length;n++)Tr(i,n,p[n]),Ir(e[n],i,n,o,r);return void(i.length>e.length&&Tr(i,"length",e.length))}for(d=new Array(l+1),n=l;n>=a;n--)c=e[n],u=r&&c?c[r]:c,t=g.get(u),d[n]=void 0===t?-1:t,g.set(u,n);for(t=a;t<=s;t++)c=i[t],u=r&&c?c[r]:c,n=g.get(u),void 0!==n&&-1!==n&&(p[n]=i[t],n=d[n],g.set(u,n));for(n=a;n<e.length;n++)n in p?(Tr(i,n,p[n]),Ir(e[n],i,n,o,r)):Tr(i,n,e[n])}else for(let t=0,n=e.length;t<n;t++)Ir(e[t],i,t,o,r);return void(i.length>e.length&&Tr(i,"length",e.length))}const a=Object.keys(e);for(let t=0,n=a.length;t<n;t++)Ir(e[a[t]],i,a[t],o,r);const s=Object.keys(i);for(let t=0,n=s.length;t<n;t++)void 0===e[s[t]]&&Tr(i,s[t],void 0)}function Or(e,t={}){const{merge:n,key:o="id"}=t,r=yr(e);return e=>{if(!br(e)||!br(r))return r;const t=Ir(r,{[Pr]:e},Pr,n,o);return void 0===t?e:t}}function Ar(...e){const t={};for(let n=0;n<e.length;n++){let o=e[n];if("function"==typeof o&&(o=o()),o){const n=Object.getOwnPropertyDescriptors(o);for(const o in n)o in t||Object.defineProperty(t,o,{enumerable:!0,get(){let t={};if("style"===o||"class"===o||"className"===o||o.startsWith("on")){for(let n=0;n<e.length;n++){let r=e[n];"function"==typeof r&&(r=r()),t=pr(t,{[o]:(r||{})[o]})}return t[o]}for(let t=e.length-1;t>=0;t--){let n,r=e[t];if("function"==typeof r&&(r=r()),n=(r||{})[o],void 0!==n)return n}}})}}return t}var $r=e=>!(null==e||"object"!=typeof e||(e=>Array.isArray(e))(e)),Rr=e=>"string"==typeof e,Nr={onFocus:"onFocusIn",onBlur:"onFocusOut",onDoubleClick:"onDblClick",onChange:"onInput",defaultChecked:"checked",defaultValue:"value",htmlFor:"for",className:"class"},Lr=e=>e.startsWith("--")?e:function(e){if(jr.hasOwnProperty(e))return jr[e];var t=e.replace(Br,zr);return jr[e]=Fr.test(t)?"-"+t:t}(e);var Dr,Mr=(Dr=e=>{const t={};for(const o in e){const r=e[o];"readOnly"===o&&!1===r||("style"===o&&$r(r)?t.style=Ur(r):"children"!==o?t[(n=o,n in Nr?Nr[n]:n)]=r:Rr(r)&&(t.textContent=r))}var n;return t},new Proxy({},{get:()=>Dr}));function Ur(e){let t={};for(const o in e){const r=e[o];!Rr(r)&&("number"!=typeof(n=r)||Number.isNaN(n))||(t[Lr(o)]=r)}var n;return t}var Br=/[A-Z]/g,Fr=/^ms-/,jr={};function zr(e){return"-"+e.toLowerCase()}function Hr(e,t){const{actions:n,context:o}=t??{},[r,i]=Cr(e.getState());return P((()=>{const t=e.subscribe((e=>{i(Or(e))}));I((()=>{t()}))})),S((()=>{const t="function"==typeof o?o():o;e.setContext(t)})),S((()=>{e.setOptions({actions:n})})),r}function Vr(e,t){const n=function(e,t){const{state:n,context:o}=t??{},r=(()=>{const t="function"==typeof e?e():e,n="function"==typeof o?o():o;return n&&t.setContext(n),t._created(),t})();return P((()=>{r.start(n),I((()=>{r.stop()}))})),r}(e,t);return[Hr(n,t),n.send,n]}var Gr=(e,t=[])=>({parts:(...n)=>{if(qr(t))return Gr(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Gr(e,[...t,...n]),rename:e=>Gr(e,t),keys:()=>t,build:()=>[...new Set(t)].reduce(((t,n)=>Object.assign(t,{[n]:{selector:[`&[data-scope="${Wr(e)}"][data-part="${Wr(n)}"]`,`& [data-scope="${Wr(e)}"][data-part="${Wr(n)}"]`].join(", "),attrs:{"data-scope":Wr(e),"data-part":Wr(n)}}})),{})}),Wr=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),qr=e=>0===e.length,Kr=e=>e?"":void 0,Yr=e=>"object"==typeof e&&e?.nodeType===Node.ELEMENT_NODE&&"string"==typeof e?.nodeName,Xr=e=>e.nodeType===Node.DOCUMENT_NODE;function Zr(e,t){return!(!e||!t)&&(!(!Yr(e)||!Yr(t))&&(e===t||e.contains(t)))}function Jr(e){return Xr(e)?e:(e=>null!=e&&e===e.window)(e)?e.document:e?.ownerDocument??document}function Qr(e){return(e=>e&&(e=>void 0!==e.nodeType)(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e)(e)?Qr(e.host):Xr(e)?e.defaultView??window:Yr(e)?e.ownerDocument?.defaultView??window:window}var ei=()=>"undefined"!=typeof document;var ti=e=>ei()&&e.test(function(){const e=navigator.userAgentData;return e?.platform??navigator.platform}()),ni=()=>{return e=/firefox\//i,ei()&&e.test(navigator.userAgent);var e};function oi(e){const t=function(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}(e);return t?.[0]??e.target}function ri(e){const t=e.currentTarget;if(!t)return!1;const n=ti(/mac|iphone|ipad|ipod/i);if(n&&!e.metaKey)return!1;if(!n&&!e.ctrlKey)return!1;const o=t.localName;return"a"===o||("button"===o&&"submit"===t.type||"input"===o&&"submit"===t.type)}function ii(e){const t=e.currentTarget;if(!t)return!1;const n=t.localName;return!!e.altKey&&("a"===n||("button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type))}var ai=e=>e.id;function si(e,t,n=ai){const o=function(e,t,n=ai){return e.find((e=>n(e)===t))}(e,t,n);return o?e.indexOf(o):-1}function li(e,t,n,o=ai){const r=n?si(e,n,o):-1;let i=n?((e,t)=>e.map(((n,o)=>e[(Math.max(t,0)+o)%e.length])))(e,r):e;return 1===t.length&&(i=i.filter((e=>o(e)!==n))),i.find((e=>{return n=(e=>(e.dataset.valuetext??e.textContent??"").split("").map((e=>{const t=e.charCodeAt(0);return t>0&&t<128?e:t>=128&&t<=255?`/x${t.toString(16)}`.replace("/","\\"):""})).join("").trim())(e),o=t,n.trim().toLowerCase().startsWith(o.toLowerCase());var n,o}))}function ci(e,t){const{state:n,activeId:o,key:r,timeout:i=350,itemToId:a}=t,s=n.keysSoFar+r,l=s.length>1&&Array.from(s).every((e=>e===s[0]))?s[0]:s;const c=li(e.slice(),l,o,a);function d(){clearTimeout(n.timer),n.timer=-1}return function e(t){n.keysSoFar=t,d(),""!==t&&(n.timer=+setTimeout((()=>{e(""),d()}),i))}(s),c}var di=Object.assign(ci,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:function(e){return 1===e.key.length&&!e.ctrlKey&&!e.metaKey}});var ui=e=>"object"==typeof e&&null!==e&&1===e.nodeType;var pi="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type";function gi(e){return!(!e||e.closest("[inert]"))&&(e.matches(pi)&&(!!ui(t=e)&&(t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0)));var t}function hi(e,t){if(!e)return[];const n=Array.from(e.querySelectorAll(pi)),o=n.filter(fi);return t&&fi(e)&&o.unshift(e),o.forEach(((e,t)=>{if((e=>ui(e)&&"IFRAME"===e.tagName)(e)&&e.contentDocument){const n=hi(e.contentDocument.body);o.splice(t,1,...n)}})),!o.length&&t?n:o}function fi(e){return null!=e&&e.tabIndex>0||gi(e)&&!(parseInt(e.getAttribute("tabindex")||"0",10)<0)}function mi(e){const{root:t,getInitialEl:n,filter:o,enabled:r=!0}=e;if(!r)return;let i=null;if(i||(i="function"==typeof n?n():n),i||(i=t?.querySelector("[data-autofocus],[autofocus]")),!i){const e=hi(t);i=o?e.filter(o)[0]:e[0]}return i||t||void 0}function bi(e){const t=e.currentTarget;if(!t)return!1;const[n,o]=function(e,t){const n=hi(e,t);return[n[0]||null,n[n.length-1]||null]}(t),r=t.ownerDocument||document;return(r.activeElement!==n||!e.shiftKey)&&(!(r.activeElement===o&&!e.shiftKey)&&!(!n&&!o))}function yi(e){if(null==e||!Yr(e))return!1;try{return e instanceof Qr(e).HTMLInputElement&&null!=e.selectionStart||/(textarea|select)/.test(e.localName)||e.isContentEditable}catch{return!1}}var vi=/auto|scroll|overlay|hidden|clip/;function wi(e){const t=globalThis.requestAnimationFrame(e);return()=>{globalThis.cancelAnimationFrame(t)}}function xi(e,t){const{defer:n}=t,o=n?wi:e=>e(),r=[];return r.push(o((()=>{const n="function"==typeof e?e():e;r.push(function(e,t){if(!e)return;const{attributes:n,callback:o}=t,r=new(e.ownerDocument.defaultView||window).MutationObserver((e=>{for(const t of e)"attributes"===t.type&&t.attributeName&&n.includes(t.attributeName)&&o(t)}));return r.observe(e,{attributes:!0,attributeFilter:n}),()=>r.disconnect()}(n,t))}))),()=>{r.forEach((e=>e?.()))}}function ki(e,t){return Array.from(e?.querySelectorAll(t)??[])}function _i(e){const t={getRootNode:e=>e.getRootNode?.()??document,getDoc:e=>Jr(t.getRootNode(e)),getWin:e=>t.getDoc(e).defaultView??window,getActiveElement:e=>t.getDoc(e).activeElement,isActiveElement:(e,n)=>n===t.getActiveElement(e),getById:(e,n)=>t.getRootNode(e).getElementById(n),setValue:(e,t)=>{if(null==e||null==t)return;const n=t.toString();e.value!==n&&(e.value=t.toString())}};return{...t,...e}}function Ti(e,t){const{rootEl:n,...o}=t||{};e&&n&&function(e){const t=Qr(e),{overflow:n,overflowX:o,overflowY:r,display:i}=t.getComputedStyle(e);return vi.test(n+r+o)&&!["inline","contents"].includes(i)}(n)&&function(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}(n)&&e.scrollIntoView(o)}var Si=new WeakMap;function Ei(e,t){if(!e)return()=>{};return function(e,t,n){Si.has(e)||Si.set(e,new Map);const o=Si.get(e),r=o.get(t);if(!r)return o.set(t,n()),()=>{o.get(t)?.(),o.delete(t)};const i=n(),a=()=>{i(),r(),o.delete(t)};return o.set(t,a),()=>{o.get(t)===a&&(i(),o.set(t,r))}}(e,"style",(()=>{const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}))}var Ci=1e3/60;function Pi(e,t){const n=[];return e?.forEach((e=>{const o=function(e,t){const n=e();if(Yr(n)&&n.isConnected)return t(n),()=>{};{const n=setInterval((()=>{const o=e();Yr(o)&&o.isConnected&&(t(o),clearInterval(n))}),Ci);return()=>clearInterval(n)}}(e,t);n.push(o)})),()=>{n.forEach((e=>e()))}}var Ii=e=>"Array"===e?.constructor.name,Oi=(e,t)=>{if(Object.is(e,t))return!0;if(null==e&&null!=t||null!=e&&null==t)return!1;if("function"==typeof e?.isEqual&&"function"==typeof t?.isEqual)return e.isEqual(t);if("function"==typeof e&&"function"==typeof t)return e.toString()===t.toString();if(Ii(e)&&Ii(t))return Array.from(e).toString()===Array.from(t).toString();if("object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(t??Object.create(null)),o=n.length;for(let t=0;t<o;t++){if(!Reflect.has(e,n[t]))return!1}for(let r=0;r<o;r++){const o=n[r];if(!Oi(e[o],t[o]))return!1}return!0},Ai=(e,...t)=>("function"==typeof e?e(...t):e)??void 0,$i=()=>{},Ri=(...e)=>(...t)=>{e.forEach((function(e){e?.(...t)}))},Ni=(()=>{let e=0;return()=>(e++,e.toString(36))})(),Li=e=>"number"==typeof e&&!Number.isNaN(e),Di=e=>"function"==typeof e;function Mi(e){if(!Ui(e)||void 0===e)return e;const t=Reflect.ownKeys(e).filter((e=>"string"==typeof e)),n={};for(const o of t){const t=e[o];void 0!==t&&(n[o]=Mi(t))}return n}var Ui=e=>e&&"object"==typeof e&&e.constructor===Object;function Bi(...e){1===e.length?e[0]:e[1],2!==e.length||e[0]}var Fi=(e,t,n,o)=>{const r="function"==typeof e?e():e;return r?.addEventListener(t,n,o),()=>{r?.removeEventListener(t,n,o)}};var ji=e=>0===e.button,zi=e=>2===e.button||ti(/^Mac/)&&e.ctrlKey&&0===e.button;function Hi(e){if(!function(e){return e?.matches("a[href]")??!1}(e))return;const t=()=>e.click();ni()?function(e,t,n){const o=(e=>{const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)})((()=>{e.removeEventListener(t,r,!0),n()})),r=()=>{o(),n()};e.addEventListener(t,r,{once:!0,capture:!0})}(e,"keyup",t):queueMicrotask(t)}function Vi(e,t,n){if(!e)return;const o=new(e.ownerDocument.defaultView||window).CustomEvent(t,n);return e.dispatchEvent(o)}var Gi={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Wi={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function qi(e,t={}){const{dir:n="ltr",orientation:o="horizontal"}=t;let{key:r}=e;r=Gi[r]??r;return"rtl"===n&&"horizontal"===o&&r in Wi&&(r=Wi[r]),r}function Ki(e,t="client"){return(e=>"touches"in e&&e.touches.length>0)(e)?function(e,t="client"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}(e,t):function(e,t="client"){return{x:e[`${t}X`],y:e[`${t}Y`]}}(e,t)}const Yi=Math.min,Xi=Math.max,Zi=Math.round,Ji=Math.floor,Qi=e=>({x:e,y:e}),ea={left:"right",right:"left",bottom:"top",top:"bottom"},ta={start:"end",end:"start"};function na(e,t,n){return Xi(e,Yi(t,n))}function oa(e,t){return"function"==typeof e?e(t):e}function ra(e){return e.split("-")[0]}function ia(e){return e.split("-")[1]}function aa(e){return"x"===e?"y":"x"}function sa(e){return"y"===e?"height":"width"}function la(e){return["top","bottom"].includes(ra(e))?"y":"x"}function ca(e){return aa(la(e))}function da(e){return e.replace(/start|end/g,(e=>ta[e]))}function ua(e){return e.replace(/left|right|bottom|top/g,(e=>ea[e]))}function pa(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function ga(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function ha(e,t,n){let{reference:o,floating:r}=e;const i=la(t),a=ca(t),s=sa(a),l=ra(t),c="y"===i,d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,p=o[s]/2-r[s]/2;let g;switch(l){case"top":g={x:d,y:o.y-r.height};break;case"bottom":g={x:d,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:u};break;case"left":g={x:o.x-r.width,y:u};break;default:g={x:o.x,y:o.y}}switch(ia(t)){case"start":g[a]-=p*(n&&c?-1:1);break;case"end":g[a]+=p*(n&&c?-1:1)}return g}async function fa(e,t){var n;void 0===t&&(t={});const{x:o,y:r,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=!1,padding:g=0}=oa(t,e),h=pa(g),f=s[p?"floating"===u?"reference":"floating":u],m=ga(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(f)))||n?f:f.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),b="floating"===u?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=ga(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:b,offsetParent:y,strategy:l}):b);return{top:(m.top-w.top+h.top)/v.y,bottom:(w.bottom-m.bottom+h.bottom)/v.y,left:(m.left-w.left+h.left)/v.x,right:(w.right-m.right+h.right)/v.x}}function ma(){return"undefined"!=typeof window}function ba(e){return wa(e)?(e.nodeName||"").toLowerCase():"#document"}function ya(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function va(e){var t;return null==(t=(wa(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function wa(e){return!!ma()&&(e instanceof Node||e instanceof ya(e).Node)}function xa(e){return!!ma()&&(e instanceof Element||e instanceof ya(e).Element)}function ka(e){return!!ma()&&(e instanceof HTMLElement||e instanceof ya(e).HTMLElement)}function _a(e){return!(!ma()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ya(e).ShadowRoot)}function Ta(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Oa(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(r)}function Sa(e){return["table","td","th"].includes(ba(e))}function Ea(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ca(e){const t=Pa(),n=xa(e)?Oa(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Pa(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ia(e){return["html","body","#document"].includes(ba(e))}function Oa(e){return ya(e).getComputedStyle(e)}function Aa(e){return xa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $a(e){if("html"===ba(e))return e;const t=e.assignedSlot||e.parentNode||_a(e)&&e.host||va(e);return _a(t)?t.host:t}function Ra(e){const t=$a(e);return Ia(t)?e.ownerDocument?e.ownerDocument.body:e.body:ka(t)&&Ta(t)?t:Ra(t)}function Na(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const r=Ra(e),i=r===(null==(o=e.ownerDocument)?void 0:o.body),a=ya(r);if(i){const e=function(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}
4
+ /*!
5
+ * tabbable 6.2.0
6
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
7
+ */(a);return t.concat(a,a.visualViewport||[],Ta(r)?r:[],e&&n?Na(e):[])}return t.concat(r,Na(r,[],n))}var La=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Da=La.join(","),Ma="undefined"==typeof Element,Ua=Ma?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ba=!Ma&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Fa=function e(t,n){var o;void 0===n&&(n=!0);var r=null==t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},ja=function(e,t,n){if(Fa(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Da));return t&&Ua.call(e,Da)&&o.unshift(e),o=o.filter(n)},za=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var a=i.shift();if(!Fa(a,!1))if("SLOT"===a.tagName){var s=a.assignedElements(),l=e(s.length?s:a.children,!0,o);o.flatten?r.push.apply(r,l):r.push({scopeParent:a,candidates:l})}else{Ua.call(a,Da)&&o.filter(a)&&(n||!t.includes(a))&&r.push(a);var c=a.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(a),d=!Fa(c,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(a));if(c&&d){var u=e(!0===c?a.children:c.children,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return r},Ha=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Va=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Ha(e)?0:e.tabIndex},Ga=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Wa=function(e){return"INPUT"===e.tagName},qa=function(e){return function(e){return Wa(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Ba(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var r=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!r||r===e}(e)},Ka=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},Ya=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Ua.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ua.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ka(e)}else{if("function"==typeof o){for(var i=e;e;){var a=e.parentElement,s=Ba(e);if(a&&!a.shadowRoot&&!0===o(a))return Ka(e);e=e.assignedSlot?e.assignedSlot:a||s===e.ownerDocument?a:s.host}e=i}if(function(e){var t,n,o,r,i=e&&Ba(e),a=null===(t=i)||void 0===t?void 0:t.host,s=!1;if(i&&i!==e)for(s=!!(null!==(n=a)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(a)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!s&&a;){var l,c,d;s=!(null===(c=a=null===(l=i=Ba(a))||void 0===l?void 0:l.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(a))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Xa=function(e,t){return!(t.disabled||Fa(t)||function(e){return Wa(e)&&"hidden"===e.type}(t)||Ya(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var o=t.children.item(n);if("LEGEND"===o.tagName)return!!Ua.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},Za=function(e,t){return!(qa(t)||Va(t)<0||!Xa(e,t))},Ja=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Qa=function e(t){var n=[],o=[];return t.forEach((function(t,r){var i=!!t.scopeParent,a=i?t.scopeParent:t,s=function(e,t){var n=Va(e);return n<0&&t&&!Ha(e)?0:n}(a,i),l=i?e(t.candidates):a;0===s?i?n.push.apply(n,l):n.push(a):o.push({documentOrder:r,tabIndex:s,item:t,isScope:i,content:l})})),o.sort(Ga).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},es=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ua.call(e,Da)&&Za(t,e)},ts=La.concat("iframe").join(","),ns=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ua.call(e,ts)&&Xa(t,e)};
8
+ /*!
9
+ * focus-trap 7.5.4
10
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
11
+ */
12
+ function os(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function rs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?os(Object(n),!0).forEach((function(t){is(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):os(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function is(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var as=function(e,t){if(e.length>0){var n=e[e.length-1];n!==t&&n.pause()}var o=e.indexOf(t);-1===o||e.splice(o,1),e.push(t)},ss=function(e,t){var n=e.indexOf(t);-1!==n&&e.splice(n,1),e.length>0&&e[e.length-1].unpause()},ls=function(e){return"Tab"===(null==e?void 0:e.key)||9===(null==e?void 0:e.keyCode)},cs=function(e){return ls(e)&&!e.shiftKey},ds=function(e){return ls(e)&&e.shiftKey},us=function(e){return setTimeout(e,0)},ps=function(e,t){var n=-1;return e.every((function(e,o){return!t(e)||(n=o,!1)})),n},gs=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return"function"==typeof e?e.apply(void 0,n):e},hs=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},fs=[],ms=function(e,t){var n,o=(null==t?void 0:t.document)||document,r=(null==t?void 0:t.trapStack)||fs,i=rs({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:cs,isKeyBackward:ds},t),a={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},s=function(e,t,n){return e&&void 0!==e[t]?e[t]:i[n||t]},l=function(e,t){var n="function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():void 0;return a.containerGroups.findIndex((function(t){var o=t.container,r=t.tabbableNodes;return o.contains(e)||(null==n?void 0:n.includes(o))||r.find((function(t){return t===e}))}))},c=function(e){var t=i[e];if("function"==typeof t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];t=t.apply(void 0,r)}if(!0===t&&(t=void 0),!t){if(void 0===t||!1===t)return t;throw new Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var s=t;if("string"==typeof t&&!(s=o.querySelector(t)))throw new Error("`".concat(e,"` as selector refers to no known node"));return s},d=function(){var e=c("initialFocus");if(!1===e)return!1;if(void 0===e||!ns(e,i.tabbableOptions))if(l(o.activeElement)>=0)e=o.activeElement;else{var t=a.tabbableGroups[0];e=t&&t.firstTabbableNode||c("fallbackFocus")}if(!e)throw new Error("Your focus-trap needs to have at least one focusable element");return e},u=function(){if(a.containerGroups=a.containers.map((function(e){var t=function(e,t){var n;return n=(t=t||{}).getShadowRoot?za([e],t.includeContainer,{filter:Za.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ja}):ja(e,t.includeContainer,Za.bind(null,t)),Qa(n)}(e,i.tabbableOptions),n=function(e,t){return(t=t||{}).getShadowRoot?za([e],t.includeContainer,{filter:Xa.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):ja(e,t.includeContainer,Xa.bind(null,t))}(e,i.tabbableOptions),o=t.length>0?t[0]:void 0,r=t.length>0?t[t.length-1]:void 0,a=n.find((function(e){return es(e)})),s=n.slice().reverse().find((function(e){return es(e)})),l=!!t.find((function(e){return Va(e)>0}));return{container:e,tabbableNodes:t,focusableNodes:n,posTabIndexesFound:l,firstTabbableNode:o,lastTabbableNode:r,firstDomTabbableNode:a,lastDomTabbableNode:s,nextTabbableNode:function(e){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=t.indexOf(e);return r<0?o?n.slice(n.indexOf(e)+1).find((function(e){return es(e)})):n.slice(0,n.indexOf(e)).reverse().find((function(e){return es(e)})):t[r+(o?1:-1)]}}})),a.tabbableGroups=a.containerGroups.filter((function(e){return e.tabbableNodes.length>0})),a.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find((function(e){return e.posTabIndexesFound}))&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function e(t){var n=t.activeElement;if(n)return n.shadowRoot&&null!==n.shadowRoot.activeElement?e(n.shadowRoot):n},g=function e(t){!1!==t&&t!==p(document)&&(t&&t.focus?(t.focus({preventScroll:!!i.preventScroll}),a.mostRecentlyFocusedNode=t,function(e){return e.tagName&&"input"===e.tagName.toLowerCase()&&"function"==typeof e.select}(t)&&t.select()):e(d()))},h=function(e){var t=c("setReturnFocus",e);return t||!1!==t&&e},f=function(e){var t=e.target,n=e.event,o=e.isBackward,r=void 0!==o&&o;t=t||hs(n),u();var s=null;if(a.tabbableGroups.length>0){var d=l(t,n),p=d>=0?a.containerGroups[d]:void 0;if(d<0)s=r?a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:a.tabbableGroups[0].firstTabbableNode;else if(r){var g=ps(a.tabbableGroups,(function(e){var n=e.firstTabbableNode;return t===n}));if(g<0&&(p.container===t||ns(t,i.tabbableOptions)&&!es(t,i.tabbableOptions)&&!p.nextTabbableNode(t,!1))&&(g=d),g>=0){var h=0===g?a.tabbableGroups.length-1:g-1,f=a.tabbableGroups[h];s=Va(t)>=0?f.lastTabbableNode:f.lastDomTabbableNode}else ls(n)||(s=p.nextTabbableNode(t,!1))}else{var m=ps(a.tabbableGroups,(function(e){var n=e.lastTabbableNode;return t===n}));if(m<0&&(p.container===t||ns(t,i.tabbableOptions)&&!es(t,i.tabbableOptions)&&!p.nextTabbableNode(t))&&(m=d),m>=0){var b=m===a.tabbableGroups.length-1?0:m+1,y=a.tabbableGroups[b];s=Va(t)>=0?y.firstTabbableNode:y.firstDomTabbableNode}else ls(n)||(s=p.nextTabbableNode(t))}}else s=c("fallbackFocus");return s},m=function(e){var t=hs(e);l(t,e)>=0||(gs(i.clickOutsideDeactivates,e)?n.deactivate({returnFocus:i.returnFocusOnDeactivate}):gs(i.allowOutsideClick,e)||e.preventDefault())},b=function(e){var t=hs(e),n=l(t,e)>=0;if(n||t instanceof Document)n&&(a.mostRecentlyFocusedNode=t);else{var o;e.stopImmediatePropagation();var r=!0;if(a.mostRecentlyFocusedNode)if(Va(a.mostRecentlyFocusedNode)>0){var s=l(a.mostRecentlyFocusedNode),c=a.containerGroups[s].tabbableNodes;if(c.length>0){var u=c.findIndex((function(e){return e===a.mostRecentlyFocusedNode}));u>=0&&(i.isKeyForward(a.recentNavEvent)?u+1<c.length&&(o=c[u+1],r=!1):u-1>=0&&(o=c[u-1],r=!1))}}else a.containerGroups.some((function(e){return e.tabbableNodes.some((function(e){return Va(e)>0}))}))||(r=!1);else r=!1;r&&(o=f({target:a.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(a.recentNavEvent)})),g(o||(a.mostRecentlyFocusedNode||d()))}a.recentNavEvent=void 0},y=function(e){if(!(t=e,"Escape"!==(null==t?void 0:t.key)&&"Esc"!==(null==t?void 0:t.key)&&27!==(null==t?void 0:t.keyCode)||!1===gs(i.escapeDeactivates,e)))return e.preventDefault(),void n.deactivate();var t;(i.isKeyForward(e)||i.isKeyBackward(e))&&function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.recentNavEvent=e;var n=f({event:e,isBackward:t});n&&(ls(e)&&e.preventDefault(),g(n))}(e,i.isKeyBackward(e))},v=function(e){var t=hs(e);l(t,e)>=0||gs(i.clickOutsideDeactivates,e)||gs(i.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},w=function(){if(a.active)return as(r,n),a.delayInitialFocusTimer=i.delayInitialFocus?us((function(){g(d())})):g(d()),o.addEventListener("focusin",b,!0),o.addEventListener("mousedown",m,{capture:!0,passive:!1}),o.addEventListener("touchstart",m,{capture:!0,passive:!1}),o.addEventListener("click",v,{capture:!0,passive:!1}),o.addEventListener("keydown",y,{capture:!0,passive:!1}),n},x=function(){if(a.active)return o.removeEventListener("focusin",b,!0),o.removeEventListener("mousedown",m,!0),o.removeEventListener("touchstart",m,!0),o.removeEventListener("click",v,!0),o.removeEventListener("keydown",y,!0),n},k="undefined"!=typeof window&&"MutationObserver"in window?new MutationObserver((function(e){e.some((function(e){return Array.from(e.removedNodes).some((function(e){return e===a.mostRecentlyFocusedNode}))}))&&g(d())})):void 0,_=function(){k&&(k.disconnect(),a.active&&!a.paused&&a.containers.map((function(e){k.observe(e,{subtree:!0,childList:!0})})))};return(n={get active(){return a.active},get paused(){return a.paused},activate:function(e){if(a.active)return this;var t=s(e,"onActivate"),n=s(e,"onPostActivate"),r=s(e,"checkCanFocusTrap");r||u(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=o.activeElement,null==t||t();var i=function(){r&&u(),w(),_(),null==n||n()};return r?(r(a.containers.concat()).then(i,i),this):(i(),this)},deactivate:function(e){if(!a.active)return this;var t=rs({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},e);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,x(),a.active=!1,a.paused=!1,_(),ss(r,n);var o=s(t,"onDeactivate"),l=s(t,"onPostDeactivate"),c=s(t,"checkCanReturnFocus"),d=s(t,"returnFocus","returnFocusOnDeactivate");null==o||o();var u=function(){us((function(){d&&g(h(a.nodeFocusedBeforeActivation)),null==l||l()}))};return d&&c?(c(h(a.nodeFocusedBeforeActivation)).then(u,u),this):(u(),this)},pause:function(e){if(a.paused||!a.active)return this;var t=s(e,"onPause"),n=s(e,"onPostPause");return a.paused=!0,null==t||t(),x(),_(),null==n||n(),this},unpause:function(e){if(!a.paused||!a.active)return this;var t=s(e,"onUnpause"),n=s(e,"onPostUnpause");return a.paused=!1,null==t||t(),u(),w(),_(),null==n||n(),this},updateContainerElements:function(e){var t=[].concat(e).filter(Boolean);return a.containers=t.map((function(e){return"string"==typeof e?o.querySelector(e):e})),a.active&&u(),_(),this}}).updateContainerElements(e),n};function bs(e){const t=Oa(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=ka(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:o,s=Zi(n)!==i||Zi(o)!==a;return s&&(n=i,o=a),{width:n,height:o,$:s}}function ys(e){return xa(e)?e:e.contextElement}function vs(e){const t=ys(e);if(!ka(t))return Qi(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:i}=bs(t);let a=(i?Zi(n.width):n.width)/o,s=(i?Zi(n.height):n.height)/r;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const ws=Qi(0);function xs(e){const t=ya(e);return Pa()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ws}function ks(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=e.getBoundingClientRect(),i=ys(e);let a=Qi(1);t&&(o?xa(o)&&(a=vs(o)):a=vs(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==ya(e))&&t}(i,n,o)?xs(i):Qi(0);let l=(r.left+s.x)/a.x,c=(r.top+s.y)/a.y,d=r.width/a.x,u=r.height/a.y;if(i){const e=ya(i),t=o&&xa(o)?ya(o):o;let n=e,r=n.frameElement;for(;r&&o&&t!==n;){const e=vs(r),t=r.getBoundingClientRect(),o=Oa(r),i=t.left+(r.clientLeft+parseFloat(o.paddingLeft))*e.x,a=t.top+(r.clientTop+parseFloat(o.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,u*=e.y,l+=i,c+=a,n=ya(r),r=n.frameElement}}return ga({width:d,height:u,x:l,y:c})}const _s=[":popover-open",":modal"];function Ts(e){return _s.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ss(e){return ks(va(e)).left+Aa(e).scrollLeft}function Es(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=ya(e),o=va(e),r=n.visualViewport;let i=o.clientWidth,a=o.clientHeight,s=0,l=0;if(r){i=r.width,a=r.height;const e=Pa();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)o=function(e){const t=va(e),n=Aa(e),o=e.ownerDocument.body,r=Xi(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=Xi(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Ss(e);const s=-n.scrollTop;return"rtl"===Oa(o).direction&&(a+=Xi(t.clientWidth,o.clientWidth)-r),{width:r,height:i,x:a,y:s}}(va(e));else if(xa(t))o=function(e,t){const n=ks(e,!0,"fixed"===t),o=n.top+e.clientTop,r=n.left+e.clientLeft,i=ka(e)?vs(e):Qi(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:o*i.y}}(t,n);else{const n=xs(e);o={...t,x:t.x-n.x,y:t.y-n.y}}return ga(o)}function Cs(e,t){const n=$a(e);return!(n===t||!xa(n)||Ia(n))&&("fixed"===Oa(n).position||Cs(n,t))}function Ps(e,t,n){const o=ka(t),r=va(t),i="fixed"===n,a=ks(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Qi(0);if(o||!o&&!i)if(("body"!==ba(t)||Ta(r))&&(s=Aa(t)),o){const e=ks(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else r&&(l.x=Ss(r));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Is(e){return"static"===Oa(e).position}function Os(e,t){return ka(e)&&"fixed"!==Oa(e).position?t?t(e):e.offsetParent:null}function As(e,t){const n=ya(e);if(Ts(e))return n;if(!ka(e)){let t=$a(e);for(;t&&!Ia(t);){if(xa(t)&&!Is(t))return t;t=$a(t)}return n}let o=Os(e,t);for(;o&&Sa(o)&&Is(o);)o=Os(o,t);return o&&Ia(o)&&Is(o)&&!Ca(o)?n:o||function(e){let t=$a(e);for(;ka(t)&&!Ia(t);){if(Ca(t))return t;if(Ea(t))return null;t=$a(t)}return null}(e)||n}const $s={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const i="fixed"===r,a=va(o),s=!!t&&Ts(t.floating);if(o===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Qi(1);const d=Qi(0),u=ka(o);if((u||!u&&!i)&&(("body"!==ba(o)||Ta(a))&&(l=Aa(o)),ka(o))){const e=ks(o);c=vs(o),d.x=e.x+o.clientLeft,d.y=e.y+o.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x,y:n.y*c.y-l.scrollTop*c.y+d.y}},getDocumentElement:va,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i="clippingAncestors"===n?Ts(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Na(e,[],!1).filter((e=>xa(e)&&"body"!==ba(e))),r=null;const i="fixed"===Oa(e).position;let a=i?$a(e):e;for(;xa(a)&&!Ia(a);){const t=Oa(a),n=Ca(a);n||"fixed"!==t.position||(r=null),(i?!n&&!r:!n&&"static"===t.position&&r&&["absolute","fixed"].includes(r.position)||Ta(a)&&!n&&Cs(e,a))?o=o.filter((e=>e!==a)):r=t,a=$a(a)}return t.set(e,o),o}(t,this._c):[].concat(n),a=[...i,o],s=a[0],l=a.reduce(((e,n)=>{const o=Es(t,n,r);return e.top=Xi(o.top,e.top),e.right=Yi(o.right,e.right),e.bottom=Yi(o.bottom,e.bottom),e.left=Xi(o.left,e.left),e}),Es(t,s,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:As,getElementRects:async function(e){const t=this.getOffsetParent||As,n=this.getDimensions,o=await n(e.floating);return{reference:Ps(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=bs(e);return{width:t,height:n}},getScale:vs,isElement:xa,isRTL:function(e){return"rtl"===Oa(e).direction}};function Rs(e,t,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=o,c=ys(e),d=r||i?[...c?Na(c):[],...Na(t)]:[];d.forEach((e=>{r&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&s?function(e,t){let n,o=null;const r=va(e);function i(){var e;clearTimeout(n),null==(e=o)||e.disconnect(),o=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:d,width:u,height:p}=e.getBoundingClientRect();if(s||t(),!u||!p)return;const g={rootMargin:-Ji(d)+"px "+-Ji(r.clientWidth-(c+u))+"px "+-Ji(r.clientHeight-(d+p))+"px "+-Ji(c)+"px",threshold:Xi(0,Yi(1,l))||1};let h=!0;function f(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{o=new IntersectionObserver(f,{...g,root:r.ownerDocument})}catch(e){o=new IntersectionObserver(f,g)}o.observe(e)}(!0),i}(c,n):null;let p,g=-1,h=null;a&&(h=new ResizeObserver((e=>{let[o]=e;o&&o.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let f=l?ks(e):null;return l&&function t(){const o=ks(e);!f||o.x===f.x&&o.y===f.y&&o.width===f.width&&o.height===f.height||n();f=o,p=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach((e=>{r&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Ns=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:o,elements:r}=e,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),a=ra(n),s=ia(n),l="y"===la(n),c=["left","top"].includes(a)?-1:1,d=i&&l?-1:1,u=oa(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof h&&(g="end"===s?-1*h:h),l?{x:g*d,y:p*c}:{x:p*c,y:g*d}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(o=s.arrow)&&o.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:a}}}}},Ls=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=oa(e,t),c={x:n,y:o},d=await fa(t,l),u=la(ra(r)),p=aa(u);let g=c[p],h=c[u];if(i){const e="y"===p?"bottom":"right";g=na(g+d["y"===p?"top":"left"],g,g-d[e])}if(a){const e="y"===u?"bottom":"right";h=na(h+d["y"===u?"top":"left"],h,h-d[e])}const f=s.fn({...t,[p]:g,[u]:h});return{...f,data:{x:f.x-n,y:f.y-o,enabled:{[p]:i,[u]:a}}}}}},Ds=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:f=!0,...m}=oa(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const b=ra(r),y=la(s),v=ra(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(v||!f?[ua(s)]:function(e){const t=ua(e);return[da(e),t,da(t)]}(s)),k="none"!==h;!p&&k&&x.push(...function(e,t,n,o){const r=ia(e);let i=function(e,t,n){const o=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:o:t?o:r;case"left":case"right":return t?i:a;default:return[]}}(ra(e),"start"===n,o);return r&&(i=i.map((e=>e+"-"+r)),t&&(i=i.concat(i.map(da)))),i}(s,f,h,w));const _=[s,...x],T=await fa(t,m),S=[];let E=(null==(o=i.flip)?void 0:o.overflows)||[];if(d&&S.push(T[b]),u){const e=function(e,t,n){void 0===n&&(n=!1);const o=ia(e),r=ca(e),i=sa(r);let a="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ua(a)),[a,ua(a)]}(r,a,w);S.push(T[e[0]],T[e[1]])}if(E=[...E,{placement:r,overflows:S}],!S.every((e=>e<=0))){var C,P;const e=((null==(C=i.flip)?void 0:C.index)||0)+1,t=_[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(g){case"bestFit":{var I;const e=null==(I=E.filter((e=>{if(k){const t=la(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:I[0];e&&(n=e);break}case"initialPlacement":n=s}if(r!==n)return{reset:{placement:n}}}return{}}}},Ms=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:i,platform:a,elements:s}=t,{apply:l=()=>{},...c}=oa(e,t),d=await fa(t,c),u=ra(r),p=ia(r),g="y"===la(r),{width:h,height:f}=i.floating;let m,b;"top"===u||"bottom"===u?(m=u,b=p===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(b=u,m="end"===p?"top":"bottom");const y=f-d.top-d.bottom,v=h-d.left-d.right,w=Yi(f-d[m],y),x=Yi(h-d[b],v),k=!t.middlewareData.shift;let _=w,T=x;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(T=v),null!=(o=t.middlewareData.shift)&&o.enabled.y&&(_=y),k&&!p){const e=Xi(d.left,0),t=Xi(d.right,0),n=Xi(d.top,0),o=Xi(d.bottom,0);g?T=h-2*(0!==e||0!==t?e+t:Xi(d.left,d.right)):_=f-2*(0!==n||0!==o?n+o:Xi(d.top,d.bottom))}await l({...t,availableWidth:T,availableHeight:_});const S=await a.getDimensions(s.floating);return h!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},Us=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:d=0}=oa(e,t)||{};if(null==c)return{};const u=pa(d),p={x:n,y:o},g=ca(r),h=sa(g),f=await a.getDimensions(c),m="y"===g,b=m?"top":"left",y=m?"bottom":"right",v=m?"clientHeight":"clientWidth",w=i.reference[h]+i.reference[g]-p[g]-i.floating[h],x=p[g]-i.reference[g],k=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let _=k?k[v]:0;_&&await(null==a.isElement?void 0:a.isElement(k))||(_=s.floating[v]||i.floating[h]);const T=w/2-x/2,S=_/2-f[h]/2-1,E=Yi(u[b],S),C=Yi(u[y],S),P=E,I=_-f[h]-C,O=_/2-f[h]/2+T,A=na(P,O,I),$=!l.arrow&&null!=ia(r)&&O!==A&&i.reference[h]/2-(O<P?E:C)-f[h]/2<0,R=$?O<P?O-P:O-I:0;return{[g]:p[g]+R,data:{[g]:A,centerOffset:O-A-R,...$&&{alignmentOffset:R}},reset:$}}}),Bs=function(e){return void 0===e&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=oa(e,t),d={x:n,y:o},u=la(r),p=aa(u);let g=d[p],h=d[u];const f=oa(s,t),m="number"==typeof f?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(l){const e="y"===p?"height":"width",t=i.reference[p]-i.floating[e]+m.mainAxis,n=i.reference[p]+i.reference[e]-m.mainAxis;g<t?g=t:g>n&&(g=n)}if(c){var b,y;const e="y"===p?"width":"height",t=["top","left"].includes(ra(r)),n=i.reference[u]-i.floating[e]+(t&&(null==(b=a.offset)?void 0:b[u])||0)+(t?0:m.crossAxis),o=i.reference[u]+i.reference[e]+(t?0:(null==(y=a.offset)?void 0:y[u])||0)-(t?m.crossAxis:0);h<n?h=n:h>o&&(h=o)}return{[p]:g,[u]:h}}}},Fs=(e,t,n)=>{const o=new Map,r={platform:$s,...n},i={...r.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=ha(c,o,l),p=o,g={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:f}=s[n],{x:m,y:b,data:y,reset:v}=await f({x:d,y:u,initialPlacement:o,placement:p,strategy:r,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=m?m:d,u=null!=b?b:u,g={...g,[i]:{...g[i],...y}},v&&h<=50&&(h++,"object"==typeof v&&(v.placement&&(p=v.placement),v.rects&&(c=!0===v.rects?await a.getElementRects({reference:e,floating:t,strategy:r}):v.rects),({x:d,y:u}=ha(c,p,l))),n=-1)}return{x:d,y:u,placement:p,strategy:r,middlewareData:g}})(e,t,{...r,platform:i})};function js(e=0,t=0,n=0,o=0){if("function"==typeof DOMRect)return new DOMRect(e,t,n,o);const r={x:e,y:t,width:n,height:o,top:t,right:e+n,bottom:t+o,left:e};return{...r,toJSON:()=>r}}function zs(e,t){return{contextElement:Yr(e)?e:void 0,getBoundingClientRect:()=>{const n=e,o=t?.(n);return o||!n?function(e){if(!e)return js();const{x:t,y:n,width:o,height:r}=e;return js(t,n,o,r)}(o):n.getBoundingClientRect()}}}var Hs=e=>({variable:e,reference:`var(${e})`}),Vs={arrowSize:Hs("--arrow-size"),arrowSizeHalf:Hs("--arrow-size-half"),arrowBg:Hs("--arrow-background"),transformOrigin:Hs("--transform-origin"),arrowOffset:Hs("--arrow-offset")},Gs={name:"transformOrigin",fn({placement:e,elements:t,middlewareData:n}){const{arrow:o}=n,r=(e=>({top:"bottom center","top-start":e?`${e.x}px bottom`:"left bottom","top-end":e?`${e.x}px bottom`:"right bottom",bottom:"top center","bottom-start":e?`${e.x}px top`:"top left","bottom-end":e?`${e.x}px top`:"top right",left:"right center","left-start":e?`right ${e.y}px`:"right top","left-end":e?`right ${e.y}px`:"right bottom",right:"left center","right-start":e?`left ${e.y}px`:"left top","right-end":e?`left ${e.y}px`:"left bottom"}))(o)[e],{floating:i}=t;return i.style.setProperty(Vs.transformOrigin.variable,r),{data:{transformOrigin:r}}}},Ws={name:"rects",fn:({rects:e})=>({data:e})},qs=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};const{x:o,y:r}=n.arrow,i=t.split("-")[0];return Object.assign(e.style,{left:null!=o?`${o}px`:"",top:null!=r?`${r}px`:"",[i]:`calc(100% + ${Vs.arrowOffset.reference})`}),{}}}};var Ks={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function Ys(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function Xs(e){return Ai(e.boundary)}function Zs(e,t){if(e)return Us({element:e,padding:t.arrowPadding})}function Js(e,t){if(null!=(t.offset??t.gutter))return Ns((({placement:n})=>{const o=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,i="number"==typeof r?r+o:r??o,{hasAlign:a}=function(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:null!=n}}(n),s=a?void 0:t.shift;return Mi({crossAxis:t.offset?.crossAxis??s,mainAxis:i,alignmentAxis:t.shift})}))}function Qs(e){if(e.flip)return Ds({boundary:Xs(e),padding:e.overflowPadding,fallbackPlacements:!0===e.flip?void 0:e.flip})}function el(e){if(e.slide||e.overlap)return Ls({boundary:Xs(e),mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Bs()})}function tl(e){return Ms({padding:e.overflowPadding,apply({elements:e,rects:t,availableHeight:n,availableWidth:o}){const r=e.floating,i=Math.round(t.reference.width);o=Math.floor(o),n=Math.floor(n),r.style.setProperty("--reference-width",`${i}px`),r.style.setProperty("--available-width",`${o}px`),r.style.setProperty("--available-height",`${n}px`)}})}function nl(e,t,n={}){const{defer:o,...r}=n,i=o?wi:e=>e(),a=[];return a.push(i((()=>{const n="function"==typeof e?e():e,o="function"==typeof t?t():t;a.push(function(e,t,n={}){const o=zs(e,n.getAnchorRect);if(!t||!o)return;const r=Object.assign({},Ks,n),i=t.querySelector("[data-part=arrow]"),a=[Js(i,r),Qs(r),el(r),Zs(i,r),qs(i),Gs,tl(r),Ws],{placement:s,strategy:l,onComplete:c,onPositioned:d}=r,u=async()=>{if(!o||!t)return;const e=await Fs(o,t,{placement:s,middleware:a,strategy:l});c?.(e),d?.({placed:!0});const n=Qr(t),r=Ys(n,e.x),i=Ys(n,e.y);t.style.setProperty("--x",`${r}px`),t.style.setProperty("--y",`${i}px`);const u=t.firstElementChild;if(u){const e=n.getComputedStyle(u).zIndex;t.style.setProperty("--z-index",e)}},p=async()=>{n.updatePosition?(await n.updatePosition({updatePosition:u}),d?.({placed:!0})):await u()},g=function(e){return e?!0===e?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}(r.listeners),h=r.listeners?Rs(o,t,p,g):$i;return p(),()=>{h?.(),d?.({placed:!1})}}(n,o,r))}))),()=>{a.forEach((e=>e?.()))}}var ol={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};var rl="pointerdown.outside",il="focus.outside";function al(e){for(const t of e)if(Yr(t)&&gi(t))return!0;return!1}var sl=e=>"clientY"in e;function ll(e,t){const{exclude:n,onFocusOutside:o,onPointerDownOutside:r,onInteractOutside:i,defer:a}=t;if(!e)return;const s=Jr(e),l=function(e){const t={each(t){for(let n=0;n<e.frames?.length;n+=1){const o=e.frames[n];o&&t(o)}},addEventListener:(e,n,o)=>(t.each((t=>{try{t.document.addEventListener(e,n,o)}catch{}})),()=>{try{t.removeEventListener(e,n,o)}catch{}}),removeEventListener(e,n,o){t.each((t=>{try{t.document.removeEventListener(e,n,o)}catch{}}))}};return t}(Qr(e));function c(t){const o=oi(t);return!!Yr(o)&&(!Zr(e,o)&&(!function(e,t){if(!sl(t)||!e)return!1;const n=e.getBoundingClientRect();return 0!==n.width&&0!==n.height&&n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}(e,t)&&(!function(e){const t=oi(e);if(!t||!sl(e))return!1;const n=t.scrollHeight>t.clientHeight&&e.clientX>t.clientWidth,o=t.scrollWidth>t.clientWidth&&e.clientY>t.clientHeight;return n||o}(t)&&!n?.(o))))}let d;function u(t){function n(){const n=a?wi:e=>e(),o=t.composedPath?.()??[t.target];n((()=>{if(e&&c(t)){if(r||i){const t=Ri(r,i);e.addEventListener(rl,t,{once:!0})}Vi(e,rl,{bubbles:!1,cancelable:!0,detail:{originalEvent:t,contextmenu:zi(t),focusable:al(o)}})}}))}"touch"===t.pointerType?(l.removeEventListener("click",n),s.removeEventListener("click",n),d=n,s.addEventListener("click",n,{once:!0}),l.addEventListener("click",n,{once:!0})):n()}const p=new Set,g=setTimeout((()=>{p.add(l.addEventListener("pointerdown",u,!0)),p.add(Fi(s,"pointerdown",u,!0))}),0);function h(t){(a?wi:e=>e())((()=>{if(e&&c(t)){if(o||i){const t=Ri(o,i);e.addEventListener(il,t,{once:!0})}Vi(e,il,{bubbles:!1,cancelable:!0,detail:{originalEvent:t,contextmenu:!1,focusable:gi(oi(t))}})}}))}return p.add(Fi(s,"focusin",h,!0)),p.add(l.addEventListener("focusin",h,!0)),()=>{clearTimeout(g),d&&(l.removeEventListener("click",d),s.removeEventListener("click",d)),p.forEach((e=>e()))}}function cl(e,t){const{defer:n}=t,o=n?wi:e=>e(),r=[];return r.push(o((()=>{const n="function"==typeof e?e():e;r.push(ll(n,t))}))),()=>{r.forEach((e=>e?.()))}}function dl(e,t){return Fi(Jr(e),"keydown",(e=>{"Escape"===e.key&&(e.isComposing||t?.(e))}),{capture:!0})}var ul,pl={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter((e=>e.pointerBlocking))},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){return this.indexOf(e)<(this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1)},isTopMost(e){const t=this.layers[this.count()-1];return t?.node===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},isInNestedLayer(e,t){return this.getNestedLayers(e).some((e=>Zr(e.node,t)))},isInBranch(e){return Array.from(this.branches).some((t=>Zr(t,e)))},add(e){const t=this.layers.push(e);e.node.style.setProperty("--layer-index",`${t}`)},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);if(!(t<0)){if(t<this.count()-1){this.getNestedLayers(e).forEach((e=>e.dismiss()))}this.layers.splice(t,1),e.style.removeProperty("--layer-index")}},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},indexOf(e){return this.layers.findIndex((t=>t.node===e))},dismiss(e){this.layers[this.indexOf(e)]?.dismiss()},clear(){this.remove(this.layers[0].node)}};function gl(){pl.layers.forEach((({node:e})=>{e.style.pointerEvents=pl.isBelowPointerBlockingLayer(e)?"none":"auto"}))}function hl(e,t){const n=Jr(e),o=[];if(pl.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(ul=document.body.style.pointerEvents,queueMicrotask((()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")}))),t){const e=Pi(t,(e=>{o.push(Ei(e,{pointerEvents:"auto"}))}));o.push(e)}return()=>{pl.hasPointerBlockingLayer()||(queueMicrotask((()=>{n.body.style.pointerEvents=ul,n.body.removeAttribute("data-inert"),0===n.body.style.length&&n.body.removeAttribute("style")})),o.forEach((e=>e())))}}function fl(e,t){const{defer:n}=t,o=n?wi:e=>e(),r=[];return r.push(o((()=>{const n=Di(e)?e():e;r.push(function(e,t){if(!e)return void Bi("[@zag-js/dismissable] node is `null` or `undefined`");const{onDismiss:n,pointerBlocking:o,exclude:r,debug:i}=t,a={dismiss:n,node:e,pointerBlocking:o};pl.add(a),gl();const s=[o?hl(e,t.persistentElements):void 0,dl(e,(function(o){pl.isTopMost(e)&&(t.onEscapeKeyDown?.(o),!o.defaultPrevented&&n&&(o.preventDefault(),n()))})),cl(e,{exclude:function(n){if(!e)return!1;const o="function"==typeof r?r():r,i=Array.isArray(o)?o:[o],a=t.persistentElements?.map((e=>e())).filter(Yr);return a&&i.push(...a),i.some((e=>Zr(e,n)))||pl.isInNestedLayer(e,n)},onFocusOutside:function(e){const o=oi(e.detail.originalEvent);pl.isInBranch(o)||(t.onFocusOutside?.(e),t.onInteractOutside?.(e),e.defaultPrevented||(i&&console.log("onFocusOutside:",e.detail.originalEvent),n?.()))},onPointerDownOutside:function(o){const r=oi(o.detail.originalEvent);pl.isBelowPointerBlockingLayer(e)||pl.isInBranch(r)||(t.onPointerDownOutside?.(o),t.onInteractOutside?.(o),o.defaultPrevented||(i&&console.log("onPointerDownOutside:",o.detail.originalEvent),n?.()))},defer:t.defer})];return()=>{pl.remove(e),gl(),function(e){e.style.pointerEvents=""}(e),s.forEach((e=>e?.()))}}(n,t))}))),()=>{r.forEach((e=>e?.()))}}function ml(e){return e?.animationName||"none"}gr()(["onExitComplete","present","immediate"]);var bl=new WeakMap,yl=[];function vl(e,t={}){const{defer:n}=t,o=n?wi:e=>e(),r=[];return r.push(o((()=>{const n="function"==typeof e?e():e;r.push(function(e,t={}){const{rootEl:n}=t,o=e.filter(Boolean);if(0===o.length)return;const r=o[0].ownerDocument||document,i=r.defaultView??window,a=new Set(o),s=new Set,l=n??r.body;let c=e=>{for(let t of e.querySelectorAll("[data-live-announcer], [data-zag-top-layer]"))a.add(t);let t=e=>{if(a.has(e)||s.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(let t of a)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=r.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),o=t(e);if(o===NodeFilter.FILTER_ACCEPT&&d(e),o!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;null!=e;)d(e),e=n.nextNode()}},d=e=>{let t=bl.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),s.add(e),bl.set(e,t+1))};yl.length&&yl[yl.length-1].disconnect(),c(l);const u=new i.MutationObserver((e=>{for(let t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...a,...s].some((e=>e.contains(t.target)))){for(let e of t.removedNodes)e instanceof i.Element&&(a.delete(e),s.delete(e));for(let e of t.addedNodes)!(e instanceof i.HTMLElement||e instanceof i.SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.zagTopLayer?e instanceof i.Element&&c(e):a.add(e)}}));u.observe(l,{childList:!0,subtree:!0});let p={observe(){u.observe(l,{childList:!0,subtree:!0})},disconnect(){u.disconnect()}};return yl.push(p),()=>{u.disconnect();for(let e of s){let t=bl.get(e);1===t?(e.removeAttribute("aria-hidden"),bl.delete(e)):bl.set(e,t-1)}p===yl[yl.length-1]?(yl.pop(),yl.length&&yl[yl.length-1].observe()):yl.splice(yl.indexOf(p),1)}}(n,t))}))),()=>{r.forEach((e=>e?.()))}}var wl="data-zag-scroll-lock";function xl(e,t){if(!e)return;const n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}function kl(e){const t=e??document,n=t.defaultView??window,{documentElement:o,body:r}=t;if(r.hasAttribute(wl))return;r.setAttribute(wl,"");const i=n.innerWidth-o.clientWidth,a=function(e){const t=e.getBoundingClientRect().left;return Math.round(t)+e.scrollLeft?"paddingLeft":"paddingRight"}(o),s=[function(e,t,n){if(!e)return;const o=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{o?e.style.setProperty(t,o):e.style.removeProperty(t)}}(o,"--scrollbar-width",`${i}px`),ti(/iP(hone|ad|od)|iOS/)?(()=>{const{scrollX:e,scrollY:t,visualViewport:o}=n,s=o?.offsetLeft??0,l=o?.offsetTop??0,c=xl(r,{position:"fixed",overflow:"hidden",top:-(t-Math.floor(l))+"px",left:-(e-Math.floor(s))+"px",right:"0",[a]:`${i}px`});return()=>{c?.(),n.scrollTo({left:e,top:t,behavior:"instant"})}})():xl(r,{overflow:"hidden",[a]:`${i}px`})];return()=>{s.forEach((e=>e?.())),r.removeAttribute(wl)}}var _l=Gr("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger").build(),Tl=_i({getPositionerId:e=>e.ids?.positioner??`dialog:${e.id}:positioner`,getBackdropId:e=>e.ids?.backdrop??`dialog:${e.id}:backdrop`,getContentId:e=>e.ids?.content??`dialog:${e.id}:content`,getTriggerId:e=>e.ids?.trigger??`dialog:${e.id}:trigger`,getTitleId:e=>e.ids?.title??`dialog:${e.id}:title`,getDescriptionId:e=>e.ids?.description??`dialog:${e.id}:description`,getCloseTriggerId:e=>e.ids?.closeTrigger??`dialog:${e.id}:close`,getContentEl:e=>Tl.getById(e,Tl.getContentId(e)),getPositionerEl:e=>Tl.getById(e,Tl.getPositionerId(e)),getBackdropEl:e=>Tl.getById(e,Tl.getBackdropId(e)),getTriggerEl:e=>Tl.getById(e,Tl.getTriggerId(e)),getTitleEl:e=>Tl.getById(e,Tl.getTitleId(e)),getDescriptionEl:e=>Tl.getById(e,Tl.getDescriptionId(e)),getCloseTriggerEl:e=>Tl.getById(e,Tl.getCloseTriggerId(e))});function Sl(e){const t=Mi(e);return sr({id:"dialog",initial:t.open?"open":"closed",context:{role:"dialog",renderedElements:{title:!0,description:!0},modal:!0,trapFocus:!0,preventScroll:!0,closeOnInteractOutside:!0,closeOnEscape:!0,restoreFocus:!0,...t},created:["checkInitialFocusEl"],watch:{open:["toggleVisibility"]},states:{open:{entry:["checkRenderedElements","syncZIndex"],activities:["trackDismissableElement","trapFocus","preventScroll","hideContentBelow"],on:{"CONTROLLED.CLOSE":{target:"closed",actions:["setFinalFocus"]},CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","setFinalFocus"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["invokeOnClose","setFinalFocus"]}]}},closed:{on:{"CONTROLLED.OPEN":{target:"open"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}],TOGGLE:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen"]}]}}}},{guards:{isOpenControlled:e=>!!e["open.controlled"]},activities:{trackDismissableElement:(e,t,{send:n})=>fl((()=>Tl.getContentEl(e)),{defer:!0,pointerBlocking:e.modal,exclude:[Tl.getTriggerEl(e)],onInteractOutside(t){e.onInteractOutside?.(t),e.closeOnInteractOutside&&"alertdialog"!==e.role||t.preventDefault()},persistentElements:e.persistentElements,onFocusOutside:e.onFocusOutside,onPointerDownOutside:e.onPointerDownOutside,onEscapeKeyDown(t){e.onEscapeKeyDown?.(t),e.closeOnEscape?n({type:"CLOSE",src:"escape-key"}):t.preventDefault()},onDismiss(){n({type:"CLOSE",src:"interact-outside"})}}),preventScroll(e){if(e.preventScroll)return kl(Tl.getDoc(e))},trapFocus(e){if(!e.trapFocus||!e.modal)return;let t;const n=function(e){const t=new Set;function n(e){const n=globalThis.requestAnimationFrame(e);t.add((()=>globalThis.cancelAnimationFrame(n)))}return n((()=>n(e))),function(){t.forEach((e=>e()))}}((()=>{const n=Tl.getContentEl(e);if(n){t=ms(n,{document:Tl.getDoc(e),escapeDeactivates:!1,preventScroll:!0,returnFocusOnDeactivate:!1,fallbackFocus:n,allowOutsideClick:!0,initialFocus:mi({root:n,getInitialEl:e.initialFocusEl})});try{t.activate()}catch{}}}));return()=>{t?.deactivate(),n()}},hideContentBelow(e){if(!e.modal)return;return vl((()=>[Tl.getContentEl(e)]),{defer:!0})}},actions:{checkInitialFocusEl(e){e.initialFocusEl||"alertdialog"!==e.role||(e.initialFocusEl=()=>Tl.getCloseTriggerEl(e))},checkRenderedElements(e){wi((()=>{e.renderedElements.title=!!Tl.getTitleEl(e),e.renderedElements.description=!!Tl.getDescriptionEl(e)}))},syncZIndex(e){wi((()=>{const t=Tl.getContentEl(e);if(!t)return;const n=Tl.getWin(e).getComputedStyle(t);[Tl.getPositionerEl(e),Tl.getBackdropEl(e)].forEach((e=>{e?.style.setProperty("--z-index",n.zIndex)}))}))},invokeOnClose(e){e.onOpenChange?.({open:!1})},invokeOnOpen(e){e.onOpenChange?.({open:!0})},toggleVisibility(e,t,{send:n}){n({type:e.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})},setFinalFocus(e){e.restoreFocus&&queueMicrotask((()=>{const t=e.finalFocusEl?.()??Tl.getTriggerEl(e);t?.focus({preventScroll:!0})}))}}})}gr()(["aria-label","closeOnEscape","closeOnInteractOutside","dir","finalFocusEl","getRootNode","getRootNode","id","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","open.controlled","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]);var El=(e,t)=>({x:e,y:t});function Cl(e,t){const n=function(e){const{x:t,y:n,width:o,height:r}=e,i=t+o/2,a=n+r/2;return{x:t,y:n,width:o,height:r,minX:t,minY:n,maxX:t+o,maxY:n+r,midX:i,midY:a,center:El(i,a)}}(e),{top:o,right:r,left:i,bottom:a}={top:El((s=n).minX,s.minY),right:El(s.maxX,s.minY),bottom:El(s.maxX,s.maxY),left:El(s.minX,s.maxY)};var s;const[l]=t.split("-");return{top:[i,o,r,a],right:[o,r,a,i],bottom:[o,i,a,r],left:[r,o,i,a]}[l]}var Pl=Gr("menu").parts("arrow","arrowTip","content","contextTrigger","indicator","item","itemGroup","itemGroupLabel","itemIndicator","itemText","positioner","separator","trigger","triggerItem").build(),Il=_i({getTriggerId:e=>e.ids?.trigger??`menu:${e.id}:trigger`,getContextTriggerId:e=>e.ids?.contextTrigger??`menu:${e.id}:ctx-trigger`,getContentId:e=>e.ids?.content??`menu:${e.id}:content`,getArrowId:e=>e.ids?.arrow??`menu:${e.id}:arrow`,getPositionerId:e=>e.ids?.positioner??`menu:${e.id}:popper`,getGroupId:(e,t)=>e.ids?.group?.(t)??`menu:${e.id}:group:${t}`,getGroupLabelId:(e,t)=>e.ids?.label?.(t)??`menu:${e.id}:label:${t}`,getContentEl:e=>Il.getById(e,Il.getContentId(e)),getPositionerEl:e=>Il.getById(e,Il.getPositionerId(e)),getTriggerEl:e=>Il.getById(e,Il.getTriggerId(e)),getHighlightedItemEl:e=>e.highlightedValue?Il.getById(e,e.highlightedValue):null,getArrowEl:e=>Il.getById(e,Il.getArrowId(e)),getElements:e=>{const t=`[role^="menuitem"][data-ownedby=${CSS.escape(Il.getContentId(e))}]:not([data-disabled])`;return ki(Il.getContentEl(e),t)},getFirstEl:e=>Il.getElements(e)[0],getLastEl:e=>{return(t=Il.getElements(e))[t.length-1];var t},getNextEl:(e,t)=>function(e,t,n=!0){let o=si(e,t);return o=n?(o+1)%e.length:Math.min(o+1,e.length-1),e[o]}(Il.getElements(e),e.highlightedValue,t??e.loopFocus),getPrevEl:(e,t)=>function(e,t,n=!0){let o=si(e,t);return-1===o?n?e[e.length-1]:null:(o=n?(o-1+e.length)%e.length:Math.max(0,o-1),e[o])}(Il.getElements(e),e.highlightedValue,t??e.loopFocus),getElemByKey:(e,t)=>di(Il.getElements(e),{state:e.typeaheadState,key:t,activeId:e.highlightedValue}),isTargetDisabled:e=>Yr(e)&&(""===e.dataset.disabled||e.hasAttribute("disabled")),isTriggerItem:e=>!!e?.getAttribute("role")?.startsWith("menuitem")&&!!e?.hasAttribute("aria-controls"),getOptionFromItemEl:e=>({id:e.id,name:e.dataset.name,value:e.dataset.value,valueText:e.dataset.valueText,type:e.dataset.type})});function Ol(e,t,n){const o=e.context.isSubmenu,r=e.context.isTypingAhead,i=e.context.composite,a=e.hasTag("open"),s=function(e={}){const{placement:t,sameWidth:n,fitViewport:o,strategy:r="absolute"}=e;return{arrow:{position:"absolute",width:Vs.arrowSize.reference,height:Vs.arrowSize.reference,[Vs.arrowSizeHalf.variable]:`calc(${Vs.arrowSize.reference} / 2)`,[Vs.arrowOffset.variable]:`calc(${Vs.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?ol[t.split("-")[0]]:void 0,background:Vs.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:r,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:o?"var(--available-width)":void 0,maxHeight:o?"var(--available-height)":void 0,top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}({...e.context.positioning,placement:e.context.anchorPoint?"bottom":e.context.currentPlacement});function l(t){return{disabled:!!t.disabled,highlighted:e.context.highlightedValue===t.value}}function c(e){const t=e.valueText??e.value;return{...e,id:e.value,valueText:t}}function d(e){return{...l(c(e)),checked:!!e.checked}}function u(o){const{value:r,closeOnSelect:i,valueText:a}=o,s=l(o);return n.element({...Pl.item.attrs,id:r,role:"menuitem","aria-disabled":s.disabled,"data-disabled":Kr(s.disabled),"data-ownedby":Il.getContentId(e.context),"data-highlighted":Kr(s.highlighted),"data-valuetext":a,onDragStart(e){e.currentTarget.matches("a[href]")&&e.preventDefault()},onPointerMove(e){if(s.disabled)return;if("mouse"!==e.pointerType)return;const n=e.currentTarget;s.highlighted||t({type:"ITEM_POINTERMOVE",id:r,target:n,closeOnSelect:i})},onPointerLeave(n){if(s.disabled)return;if("mouse"!==n.pointerType)return;if(!e.previousEvent.type.includes("POINTER"))return;const o=n.currentTarget;t({type:"ITEM_POINTERLEAVE",id:r,target:o,closeOnSelect:i})},onPointerDown(e){if(s.disabled)return;const n=e.currentTarget;t({type:"ITEM_POINTERDOWN",target:n,id:r,closeOnSelect:i})},onPointerUp(e){if(ii(e))return;if(ri(e))return;if(s.disabled)return;if(!ji(e))return;const n=e.currentTarget;t({type:"ITEM_CLICK",src:"pointerup",target:n,id:r,closeOnSelect:i}),"touch"===e.pointerType&&Hi(n)},onTouchEnd(e){e.preventDefault(),e.stopPropagation()}})}return{highlightedValue:e.context.highlightedValue,open:a,setOpen(e){e!==a&&t(e?"OPEN":"CLOSE")},setHighlightedValue(e){t({type:"HIGHLIGHTED.SET",id:e})},setParent(e){t({type:"PARENT.SET",value:e,id:e.state.context.id})},setChild(e){t({type:"CHILD.SET",value:e,id:e.state.context.id})},reposition(e={}){t({type:"POSITIONING.SET",options:e})},getContextTriggerProps:()=>n.element({...Pl.contextTrigger.attrs,dir:e.context.dir,id:Il.getContextTriggerId(e.context),onPointerDown(e){if("mouse"===e.pointerType)return;const n=Ki(e);t({type:"CONTEXT_MENU_START",point:n})},onPointerCancel(e){"mouse"!==e.pointerType&&t("CONTEXT_MENU_CANCEL")},onPointerMove(e){"mouse"!==e.pointerType&&t("CONTEXT_MENU_CANCEL")},onPointerUp(e){"mouse"!==e.pointerType&&t("CONTEXT_MENU_CANCEL")},onContextMenu(e){const n=Ki(e);t({type:"CONTEXT_MENU",point:n}),e.preventDefault()},style:{WebkitTouchCallout:"none",userSelect:"none"}}),getTriggerItemProps:e=>pr(u({value:e.getTriggerProps().id}),e.getTriggerProps()),getTriggerProps:()=>n.button({...o?Pl.triggerItem.attrs:Pl.trigger.attrs,"data-placement":e.context.currentPlacement,type:"button",dir:e.context.dir,id:Il.getTriggerId(e.context),"data-uid":e.context.id,"aria-haspopup":i?"menu":"dialog","aria-controls":Il.getContentId(e.context),"aria-expanded":a||void 0,"data-state":a?"open":"closed",onPointerMove(e){if("mouse"!==e.pointerType)return;!Il.isTargetDisabled(e.currentTarget)&&o&&t({type:"TRIGGER_POINTERMOVE",target:e.currentTarget})},onPointerLeave(e){if("mouse"!==e.pointerType)return;if(Il.isTargetDisabled(e.currentTarget)||!o)return;const n=Ki(e);t({type:"TRIGGER_POINTERLEAVE",target:e.currentTarget,point:n})},onClick(e){Il.isTriggerItem(e.currentTarget)&&t({type:"TRIGGER_CLICK",target:e.currentTarget})},onPointerDown(e){const n=Il.isTargetDisabled(e.currentTarget);!ji(e)||n||zi(e)||(e.preventDefault(),Il.isTriggerItem(e.currentTarget)||t({type:"TRIGGER_CLICK",target:e.currentTarget}))},onBlur(){t("TRIGGER_BLUR")},onFocus(){t("TRIGGER_FOCUS")},onKeyDown(n){if(n.defaultPrevented)return;const o={ArrowDown(){t("ARROW_DOWN")},ArrowUp(){t("ARROW_UP")},Enter(){t({type:"ARROW_DOWN",src:"enter"})},Space(){t({type:"ARROW_DOWN",src:"space"})}}[qi(n,e.context)];o&&(n.preventDefault(),o(n))}}),getIndicatorProps:()=>n.element({...Pl.indicator.attrs,dir:e.context.dir,"data-state":a?"open":"closed"}),getPositionerProps:()=>n.element({...Pl.positioner.attrs,dir:e.context.dir,id:Il.getPositionerId(e.context),style:s.floating}),getArrowProps:()=>n.element({id:Il.getArrowId(e.context),...Pl.arrow.attrs,dir:e.context.dir,style:s.arrow}),getArrowTipProps:()=>n.element({...Pl.arrowTip.attrs,dir:e.context.dir,style:s.arrowTip}),getContentProps:()=>n.element({...Pl.content.attrs,id:Il.getContentId(e.context),"aria-label":e.context["aria-label"],hidden:!a,"data-state":a?"open":"closed",role:i?"menu":"dialog",tabIndex:0,dir:e.context.dir,"aria-activedescendant":e.context.highlightedValue??void 0,"aria-labelledby":Il.getTriggerId(e.context),"data-placement":e.context.currentPlacement,onPointerEnter(e){"mouse"===e.pointerType&&t("MENU_POINTERENTER")},onKeyDown(n){if(n.defaultPrevented)return;if(!(e=>Zr(e.currentTarget,oi(e)))(n))return;const o=oi(n);if(!(o?.closest("[role=menu]")===n.currentTarget||o===n.currentTarget))return;if("Tab"===n.key){if(!bi(n))return void n.preventDefault()}const i=Il.getHighlightedItemEl(e.context),a={ArrowDown(){t("ARROW_DOWN")},ArrowUp(){t("ARROW_UP")},ArrowLeft(){t("ARROW_LEFT")},ArrowRight(){t("ARROW_RIGHT")},Enter(){t("ENTER"),Hi(i)},Space(e){r?t({type:"TYPEAHEAD",key:e.key}):a.Enter?.(e)},Home(){t("HOME")},End(){t("END")}},s=qi(n,{dir:e.context.dir}),l=a[s];if(l)return l(n),n.stopPropagation(),void n.preventDefault();var c;e.context.typeahead&&(1!==(c=n).key.length||c.ctrlKey||c.metaKey||(e=>e.ctrlKey||e.altKey||e.metaKey)(n)||yi(o)||(t({type:"TYPEAHEAD",key:n.key}),n.preventDefault()))}}),getSeparatorProps:()=>n.element({...Pl.separator.attrs,role:"separator",dir:e.context.dir,"aria-orientation":"horizontal"}),getItemState:l,getItemProps:u,getOptionItemState:d,getOptionItemProps(o){const{type:r,disabled:i,onCheckedChange:a,closeOnSelect:s}=o,l=c(o),p=d(o);return{...u(l),...n.element({"data-type":r,...Pl.item.attrs,dir:e.context.dir,"data-value":l.value,role:`menuitem${r}`,"aria-checked":!!p.checked,"data-state":p.checked?"checked":"unchecked",onPointerUp(e){if(!ji(e)||i)return;if(ii(e))return;if(ri(e))return;const n=e.currentTarget;t({type:"ITEM_CLICK",src:"pointerup",target:n,option:l,closeOnSelect:s}),a?.(!p.checked)}})}},getItemIndicatorProps(t){const o=d(t);return n.element({...Pl.itemIndicator.attrs,dir:e.context.dir,"data-disabled":Kr(o.disabled),"data-highlighted":Kr(o.highlighted),"data-state":o.checked?"checked":"unchecked",hidden:!o.checked})},getItemTextProps(t){const o=d(t);return n.element({...Pl.itemText.attrs,dir:e.context.dir,"data-disabled":Kr(o.disabled),"data-highlighted":Kr(o.highlighted),"data-state":o.checked?"checked":"unchecked"})},getItemGroupLabelProps:t=>n.element({id:Il.getGroupLabelId(e.context,t.htmlFor),dir:e.context.dir,...Pl.itemGroupLabel.attrs}),getItemGroupProps:t=>n.element({id:Il.getGroupId(e.context,t.id),...Pl.itemGroup.attrs,dir:e.context.dir,"aria-labelledby":Il.getGroupLabelId(e.context,t.id),role:"group"})}}var{not:Al,and:$l,or:Rl}=tr;function Nl(e){let t=e.parent;for(;t&&t.state.context.isSubmenu;)t=t.state.context.parent;t?.send("CLOSE")}var Ll={highlighted(e,t){Oi(e.highlightedValue,t)||(e.highlightedValue=t,e.onHighlightChange?.({highlightedValue:t}))}};gr()(["anchorPoint","aria-label","closeOnSelect","dir","getRootNode","highlightedValue","id","ids","loopFocus","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","onEscapeKeyDown","onSelect","onHighlightChange","open","open.controlled","positioning","typeahead","composite"]),gr()(["closeOnSelect","disabled","value","valueText"]),gr()(["htmlFor"]),gr()(["id"]),gr()(["disabled","valueText","closeOnSelect","type","value","checked","onCheckedChange"]);var Dl=Gr("progress").parts("root","label","track","range","valueText","view","circle","circleTrack","circleRange").build(),Ml=_i({getRootId:e=>e.ids?.root??`progress-${e.id}`,getTrackId:e=>e.ids?.track??`progress-${e.id}-track`,getLabelId:e=>e.ids?.label??`progress-${e.id}-label`,getCircleId:e=>e.ids?.circle??`progress-${e.id}-circle`});function Ul(e,t){return e+(t-e)/2}function Bl(e){const t=Mi(e);return sr({id:"progress",initial:"idle",context:{max:t.max??100,min:t.min??0,value:Ul(t.min??0,t.max??100),orientation:"horizontal",translations:{value:({percent:e})=>-1===e?"loading...":`${e} percent`,...t.translations},...t},created:["validateContext"],computed:{isIndeterminate:e=>null===e.value,percent:e=>Li(e.value)?Math.round((e.value-e.min)/(e.max-e.min)*100):-1,isAtMax:e=>e.value===e.max,isHorizontal:e=>"horizontal"===e.orientation,isRtl:e=>"rtl"===e.dir},states:{idle:{on:{"VALUE.SET":{actions:["setValue"]}}}}},{actions:{setValue:(e,t)=>{e.value=null===t.value?null:Math.max(0,Math.min(t.value,e.max))},validateContext:e=>{if(null!=e.value){if(!Fl(e.max))throw new Error(`[progress] The max value passed \`${e.max}\` is not a valid number`);if(!function(e,t){return Fl(e)&&e<=t}(e.value,e.max))throw new Error(`[progress] The value passed \`${e.value}\` exceeds the max value \`${e.max}\``);if(!function(e,t){return Fl(e)&&e>=t}(e.value,e.min))throw new Error(`[progress] The value passed \`${e.value}\` exceeds the min value \`${e.min}\``)}}}})}function Fl(e){return Li(e)&&!isNaN(e)}gr()(["dir","getRootNode","id","ids","max","min","orientation","translations","value"]);var jl=Gr("toast").parts("group","root","title","description","actionTrigger","closeTrigger").build(),zl=_i({getRegionId:e=>`toast-group:${e}`,getRegionEl:(e,t)=>zl.getById(e,`toast-group:${t}`),getRootId:e=>`toast:${e.id}`,getRootEl:e=>zl.getById(e,zl.getRootId(e)),getTitleId:e=>`toast:${e.id}:title`,getDescriptionId:e=>`toast:${e.id}:description`,getCloseTriggerId:e=>`toast${e.id}:close`});function Hl(e,t){return e.filter((e=>e.state.context.placement===t))}var Vl={info:5e3,error:5e3,success:2e3,loading:1/0,DEFAULT:5e3};function Gl(e,t){return e??Vl[t]??Vl.DEFAULT}function Wl(e,t){const n=e.offsets,o="string"==typeof n?{left:n,right:n,bottom:n,top:n}:n,r="rtl"===e.dir,i=t.replace("-start",r?"-right":"-left").replace("-end",r?"-left":"-right"),a=i.includes("right"),s=i.includes("left"),l={position:"fixed",pointerEvents:e.count>0?void 0:"none",display:"flex",flexDirection:"column","--gap":`${e.gap}px`,"--first-height":`${e.heights[0]?.height||0}px`,zIndex:2147483647};let c="center";if(a&&(c="flex-end"),s&&(c="flex-start"),l.alignItems=c,i.includes("top")){const e=o.top;l.top=`max(env(safe-area-inset-top, 0px), ${e})`}if(i.includes("bottom")){const e=o.bottom;l.bottom=`max(env(safe-area-inset-bottom, 0px), ${e})`}if(!i.includes("left")){const e=o.right;l.insetInlineEnd=`calc(env(safe-area-inset-right, 0px) + ${e})`}if(!i.includes("right")){const e=o.left;l.insetInlineStart=`calc(env(safe-area-inset-left, 0px) + ${e})`}return l}function ql(e,t){const[n]=e.placement.split("-"),o=!e.frontmost,r=!e.stacked,i={position:"absolute",pointerEvents:"auto","--opacity":"0","--remove-delay":`${e.removeDelay}ms`,"--duration":`${"loading"===e.type?Number.MAX_SAFE_INTEGER:e.duration}ms`,"--initial-height":`${e.height}px`,"--offset":`${e.offset}px`,"--index":e.index,"--z-index":e.zIndex,"--lift-amount":"calc(var(--lift) * var(--gap))","--y":"100%","--x":"0"},a=e=>Object.assign(i,e);return"top"===n?a({top:"0","--sign":"-1","--y":"-100%","--lift":"1"}):"bottom"===n&&a({bottom:"0","--sign":"1","--y":"100%","--lift":"-1"}),e.mounted&&(a({"--y":"0","--opacity":"1"}),e.stacked&&a({"--y":"calc(var(--lift) * var(--offset))","--height":"var(--initial-height)"})),t||a({"--opacity":"0",pointerEvents:"none"}),o&&r&&(a({"--base-scale":"var(--index) * 0.05 + 1","--y":"calc(var(--lift-amount) * var(--index))","--scale":"calc(-1 * var(--base-scale))","--height":"var(--first-height)"}),t||a({"--y":"calc(var(--sign) * 40%)"})),o&&e.stacked&&!t&&a({"--y":"calc(var(--lift) * var(--offset) + var(--lift) * -100%)"}),e.frontmost&&!t&&a({"--y":"calc(var(--lift) * -100%)"}),i}function Kl(e,t){const n={position:"absolute",inset:"0",scale:"1 2",pointerEvents:t?"none":"auto"};var o;return e.frontmost&&!t&&(o={height:"calc(var(--initial-height) + 80%)"},Object.assign(n,o)),n}var{not:Yl,and:Xl,or:Zl}=tr;function Jl(e,t){Hl(e.toasts,e.placement).forEach(t)}var Ql={connect:function(e,t,n){function o(){var t;return(t=e)instanceof ar||"machine"===t?.type?e.getState():e}function r(e){return Hl(o().context.toasts,e)}function i(e){const t=o().context.toasts;return!!t.length&&!!t.find((t=>t.id==e))}function a(e){const n=`toast:${Ni()}`,o=e.id?e.id:n;return i(o)||t({type:"ADD_TOAST",toast:{...e,id:o}}),o}function s(e,n){return i(e)?(t({type:"UPDATE_TOAST",id:e,toast:n}),e):e}function l(e){const{id:t}=e;return!!t&&i(t)&&null!=t?s(t,e):a(e)}function c(e){null==e?t("DISMISS_ALL"):i(e)&&t({type:"DISMISS_TOAST",id:e})}return{getCount:()=>o().context.count,getPlacements(){const e=o().context.toasts.map((e=>e.state.context.placement));return Array.from(new Set(e))},getToastsByPlacement:r,isVisible:i,create:a,update:s,upsert:l,dismiss:c,remove(e){null==e?t("REMOVE_ALL"):i(e)&&t({type:"REMOVE_TOAST",id:e})},dismissByPlacement(e){r(e).forEach((e=>c(e.id)))},loading:e=>l({...e,type:"loading"}),success:e=>l({...e,type:"success"}),error:e=>l({...e,type:"error"}),promise(e,t,n={}){const o=l({...n,...t.loading,type:"loading"});return Ai(e).then((e=>{const r=Ai(t.success,e);l({...n,...r,id:o,type:"success"})})).catch((e=>{const r=Ai(t.error,e);l({...n,...r,id:o,type:"error"})})).finally((()=>{t.finally?.()})),o},pause(e){null==e?t("PAUSE_ALL"):i(e)&&t({type:"PAUSE_TOAST",id:e})},resume(e){null==e?t("RESUME_ALL"):i(e)&&t({type:"RESUME_TOAST",id:e})},getGroupProps(e){const{placement:r,label:i="Notifications"}=e,a=o(),s=a.context.hotkey.join("+").replace(/Key/g,"").replace(/Digit/g,""),[l,c="center"]=r.split("-");return n.element({...jl.group.attrs,dir:a.context.dir,tabIndex:-1,"aria-label":`${r} ${i} ${s}`,id:zl.getRegionId(r),"data-placement":r,"data-side":l,"data-align":c,"aria-live":"polite",role:"region",style:Wl(a.context,r),onMouseMove(){t({type:"REGION.POINTER_ENTER",placement:r})},onMouseLeave(){t({type:"REGION.POINTER_LEAVE",placement:r})},onFocus(e){t({type:"REGION.FOCUS",target:e.relatedTarget})},onBlur(e){a.context.isFocusWithin&&!Zr(e.currentTarget,e.relatedTarget)&&t({type:"REGION.BLUR"})}})},subscribe(e){const t=o();return Po(t.context.toasts,(()=>{const n=r(t.context.placement).map((e=>e.getState().context));e(n)}))}}},machine:function(e){const t=Mi(e);return sr({id:"toaster",initial:t.overlap?"overlap":"stack",context:{dir:"ltr",max:Number.MAX_SAFE_INTEGER,gap:16,pauseOnPageIdle:!1,hotkey:["altKey","KeyT"],offsets:"1rem",placement:"bottom",removeDelay:200,...t,toasts:[],lastFocusedEl:null,isFocusWithin:!1,heights:[]},computed:{count:e=>e.toasts.length},activities:["trackDocumentVisibility","trackHotKeyPress"],watch:{toasts:["collapsedIfEmpty","setDismissableBranch"]},exit:["removeToasts","clearDismissableBranch","clearLastFocusedEl"],on:{PAUSE_TOAST:{actions:["pauseToast"]},PAUSE_ALL:{actions:["pauseToasts"]},RESUME_TOAST:{actions:["resumeToast"]},RESUME_ALL:{actions:["resumeToasts"]},ADD_TOAST:{guard:"isWithinRange",actions:["createToast","syncToastIndex"]},UPDATE_TOAST:{actions:["updateToast"]},DISMISS_TOAST:{actions:["dismissToast"]},DISMISS_ALL:{actions:["dismissToasts"]},REMOVE_TOAST:{actions:["removeToast","syncToastIndex","syncToastOffset"]},REMOVE_ALL:{actions:["removeToasts"]},UPDATE_HEIGHT:{actions:["syncHeights","syncToastOffset"]},"DOC.HOTKEY":{actions:["focusRegionEl"]},"REGION.BLUR":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts","restoreLastFocusedEl"]},{actions:["resumeToasts","restoreLastFocusedEl"]}]},states:{stack:{entry:["expandToasts"],on:{"REGION.POINTER_LEAVE":[{guard:"isOverlapping",target:"overlap",actions:["resumeToasts"]},{actions:["resumeToasts"]}],"REGION.OVERLAP":{target:"overlap"},"REGION.FOCUS":{actions:["setLastFocusedEl","pauseToasts"]},"REGION.POINTER_ENTER":{actions:["pauseToasts"]}}},overlap:{entry:["collapseToasts"],on:{"REGION.STACK":{target:"stack"},"REGION.POINTER_ENTER":{target:"stack",actions:["pauseToasts"]},"REGION.FOCUS":{target:"stack",actions:["setLastFocusedEl","pauseToasts"]}}}}},{guards:{isWithinRange:e=>e.toasts.length<e.max,isOverlapping:e=>!!e.overlap},activities:{trackHotKeyPress:(e,t,{send:n})=>Fi(document,"keydown",(t=>{e.hotkey.every((e=>t[e]||t.code===e))&&n({type:"DOC.HOTKEY"})}),{capture:!0}),trackDocumentVisibility(e,t,{send:n}){if(!e.pauseOnPageIdle)return;const o=zl.getDoc(e);return Fi(o,"visibilitychange",(()=>{n("hidden"===o.visibilityState?"PAUSE_ALL":"RESUME_ALL")}))}},actions:{setDismissableBranch(e){const t=Hl(e.toasts,e.placement).length>0;if(!t)return void e._cleanup?.();if(t&&e._cleanup)return;e._cleanup=function(e,t={}){const{defer:n}=t,o=n?wi:e=>e(),r=[];return r.push(o((()=>{const t=Di(e)?e():e;t?(pl.addBranch(t),r.push((()=>{pl.removeBranch(t)}))):Bi("[@zag-js/dismissable] branch node is `null` or `undefined`")}))),()=>{r.forEach((e=>e?.()))}}((()=>zl.getRegionEl(e,e.placement)),{defer:!0})},clearDismissableBranch(e){e._cleanup?.()},focusRegionEl(e){queueMicrotask((()=>{zl.getRegionEl(e,e.placement)?.focus()}))},expandToasts(e){Jl(e,(e=>{e.state.context.stacked=!0}))},collapseToasts(e){Jl(e,(e=>{e.state.context.stacked=!1}))},collapsedIfEmpty(e,t,{send:n}){!e.overlap||e.toasts.length>1||n("REGION.OVERLAP")},pauseToast(e,t,{self:n}){n.sendChild("PAUSE",t.id)},pauseToasts(e){e.toasts.forEach((e=>e.send("PAUSE")))},resumeToast(e,t,{self:n}){n.sendChild("RESUME",t.id)},resumeToasts(e){e.toasts.forEach((e=>e.send("RESUME")))},measureToasts(e){e.toasts.forEach((e=>e.send("MEASURE")))},createToast(e,t,{self:n,getState:o}){const r=function(e){const{type:t="info",duration:n,id:o="1",placement:r="bottom",removeDelay:i=200,...a}=e,s=Mi(a),l=Gl(n,t);return sr({id:o,context:{id:o,type:t,remaining:l,duration:l,removeDelay:i,createdAt:Date.now(),placement:r,...s,height:0,offset:0,frontmost:!1,mounted:!1,index:-1,zIndex:0},initial:"loading"===t?"visible:persist":"visible",on:{UPDATE:[{guard:Xl("hasTypeChanged","isChangingToLoading"),target:"visible:persist",actions:["setContext"]},{guard:Zl("hasDurationChanged","hasTypeChanged"),target:"visible:updating",actions:["setContext"]},{actions:["setContext"]}],MEASURE:{actions:["measureHeight"]}},entry:["invokeOnVisible"],activities:["trackHeight"],states:{"visible:updating":{tags:["visible","updating"],after:{0:"visible"}},"visible:persist":{tags:["visible","paused"],on:{RESUME:{guard:Yl("isLoadingType"),target:"visible",actions:["setCreatedAt"]},DISMISS:"dismissing"}},visible:{tags:["visible"],after:{VISIBLE_DURATION:"dismissing"},on:{DISMISS:"dismissing",PAUSE:{target:"visible:persist",actions:"setRemainingDuration"}}},dismissing:{entry:"invokeOnDismiss",after:{REMOVE_DELAY:{target:"unmounted",actions:"notifyParentToRemove"}}},unmounted:{entry:"invokeOnUnmount",type:"final"}}},{activities:{trackHeight(e,t,{self:n}){let o;return wi((()=>{const t=zl.getRootEl(e);if(!t)return;e.mounted=!0,Bi(2!==ki(t,"[data-ghost]").length,"[toast] No ghost element found in toast. Render the `ghostBefore` and `ghostAfter` elements");const r=()=>{const o=t.style.height;t.style.height="auto";const r=t.getBoundingClientRect().height;t.style.height=o,e.height=r,n.sendParent({type:"UPDATE_HEIGHT",id:n.id,height:r,placement:e.placement})};r();const i=new(zl.getWin(e).MutationObserver)(r);i.observe(t,{childList:!0,subtree:!0,characterData:!0}),o=()=>i.disconnect()})),()=>o?.()}},guards:{isChangingToLoading:(e,t)=>"loading"===t.toast?.type,isLoadingType:e=>"loading"===e.type,hasTypeChanged:(e,t)=>null!=t.toast?.type&&t.toast.type!==e.type,hasDurationChanged:(e,t)=>null!=t.toast?.duration&&t.toast.duration!==e.duration},delays:{VISIBLE_DURATION:e=>e.remaining,REMOVE_DELAY:e=>e.removeDelay},actions:{measureHeight(e,t,{self:n}){wi((()=>{const t=zl.getRootEl(e);if(!t)return;e.mounted=!0;const o=t.style.height;t.style.height="auto";const r=t.getBoundingClientRect().height;t.style.height=o,e.height=r,n.sendParent({type:"UPDATE_HEIGHT",id:n.id,height:r,placement:e.placement})}))},setRemainingDuration(e){e.remaining-=Date.now()-e.createdAt},setCreatedAt(e){e.createdAt=Date.now()},notifyParentToRemove(e,t,{self:n}){n.sendParent({type:"REMOVE_TOAST",id:n.id})},invokeOnDismiss(e){e.onStatusChange?.({status:"dismissing"})},invokeOnUnmount(e){e.onStatusChange?.({status:"unmounted"})},invokeOnVisible(e){e.onStatusChange?.({status:"visible"})},setContext(e,t){const n=t.toast?.duration,o=Gl(n,t.toast?.type??e.type);Object.assign(e,{...t.toast,duration:o,remaining:o})}}})}({placement:e.placement,duration:e.duration,removeDelay:e.removeDelay,...t.toast,dir:e.dir,getRootNode:e.getRootNode,stacked:o().matches("stack")}),i=n.spawn(r);e.toasts=[i,...e.toasts]},updateToast(e,t,{self:n}){n.sendChild({type:"UPDATE",toast:t.toast},t.id)},dismissToast(e,t,{self:n}){n.sendChild("DISMISS",t.id)},dismissToasts(e){e.toasts.forEach((e=>e.send("DISMISS")))},removeToast(e,t,{self:n}){n.stopChild(t.id),e.toasts=e.toasts.filter((e=>e.id!==t.id)),e.heights=e.heights.filter((e=>e.id!==t.id))},removeToasts(e,t,{self:n}){e.toasts.forEach((e=>n.stopChild(e.id))),e.toasts=[],e.heights=[]},syncHeights(e,t){const n=e.heights.find((e=>e.id===t.id));if(n)n.height=t.height,n.placement=t.placement;else{const n={id:t.id,height:t.height,placement:t.placement};e.heights=[n,...e.heights]}},syncToastIndex(e){Jl(e,((e,t,n)=>{e.state.context.index=t,e.state.context.frontmost=0===t,e.state.context.zIndex=n.length-t}))},syncToastOffset(e,t){const n=t.placement??e.placement;Jl({...e,placement:n},(t=>{const n=Math.max(e.heights.findIndex((e=>e.id===t.id)),0),o=e.heights.reduce(((e,t,o)=>o>=n?e:e+t.height),0);t.state.context.offset=n*e.gap+o}))},setLastFocusedEl(e,t){!e.isFocusWithin&&t.target&&(e.isFocusWithin=!0,e.lastFocusedEl=Oo(t.target))},restoreLastFocusedEl(e){e.isFocusWithin=!1,e.lastFocusedEl&&(e.lastFocusedEl.focus({preventScroll:!0}),e.lastFocusedEl=null)},clearLastFocusedEl(e){e.lastFocusedEl&&(e.lastFocusedEl.focus({preventScroll:!0}),e.lastFocusedEl=null,e.isFocusWithin=!1)}}})}};function ec(e={}){const{strict:t=!0,hookName:n="useContext",providerName:o="Provider",errorMessage:r,defaultValue:i}=e,a=function(e){const t=Symbol("context");return{id:t,Provider:K(t),defaultValue:e}}(i);return[a.Provider,function e(){const i=$(a);if(!i&&t){const t=new Error(r??`${n} returned \`undefined\`. Seems you forgot to wrap component within ${o}`);throw t.name="ContextError",Error.captureStackTrace?.(t,e),t}return i},a]}const tc=()=>(e,t)=>oe(e,t),[nc,oc]=ec({hookName:"useRenderStrategyContext",providerName:"<RenderStrategyProvider />"}),rc=e=>tc()(e,["lazyMount","unmountOnExit"]),ic=e=>t=>{const[n,o]=oe(t,["asChild"]);if(n.asChild){const e=e=>{const[,t]=oe(o,["ref"]);return Ar(t,e)};return n.asChild(e)}return Z(Le,ne({component:e},o))};const ac=function(){const e=new Map;return new Proxy(ic,{apply:(e,t,n)=>ic(n[0]),get(t,n){const o=n;return e.has(o)||e.set(o,ic(o)),e.get(o)}})}(),[sc,lc]=ec({hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:()=>({getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window})});var cc=ve("<span hidden>");const dc=e=>{const[t,n]=_(),o=()=>((e,...t)=>"function"==typeof e?e(...t):e)(e.value)??t()?.ownerDocument??document,r=E((()=>({getRootNode:o,getDocument:()=>Jr(o()),getWindow:()=>Qr(o())})));return Z(sc,{value:r,get children(){return[E((()=>e.children)),Z(le,{get when(){return!e.value},get children(){var e=cc();return Te(n,e),e}})]}})},[uc,pc]=ec({hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:()=>({dir:"ltr",locale:"en-US"})}),gc=e=>tc()(e,["immediate","lazyMount","onExitComplete","present","unmountOnExit"]),hc=e=>{const[t,n]=rc(e),[o,r]=_(!1),[i,a]=Vr(sr({initial:(s=n).present?"mounted":"unmounted",context:{node:null,styles:null,unmountAnimationName:null,prevAnimationName:null,present:!1,initial:!1,...s},exit:["clearInitial"],watch:{present:["setInitial","syncPresence"]},on:{"NODE.SET":{actions:["setNode","setStyles"]}},states:{mounted:{on:{UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]},"UNMOUNT.SUSPEND":"unmountSuspended"}},unmountSuspended:{activities:["trackAnimationEvents"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]},"ANIMATION.END":{target:"unmounted",actions:["invokeOnExitComplete"]},UNMOUNT:{target:"unmounted",actions:["invokeOnExitComplete"]}}},unmounted:{entry:["clearPrevAnimationName"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]}}}}},{actions:{setInitial(e){e.initial=!0},clearInitial(e){e.initial=!1},invokeOnExitComplete(e){e.onExitComplete?.()},setNode(e,t){e.node=Oo(t.node)},setStyles(e,t){const n=t.node.ownerDocument.defaultView||window;e.styles=Oo(n.getComputedStyle(t.node))},syncPresence(e,t,{send:n}){if(e.present)return void n({type:"MOUNT",src:"presence.changed"});const o=ml(e.styles);(e.immediate?queueMicrotask:requestAnimationFrame)((()=>{e.unmountAnimationName=o,"none"===o||o===e.prevAnimationName||"none"===e.styles?.display?n({type:"UNMOUNT",src:"presence.changed"}):n({type:"UNMOUNT.SUSPEND"})}))},setPrevAnimationName(e){(e.immediate?queueMicrotask:requestAnimationFrame)((()=>{e.prevAnimationName=ml(e.styles)}))},clearPrevAnimationName(e){e.prevAnimationName=null}},activities:{trackAnimationEvents(e,t,{send:n}){const o=e.node;if(!o)return;const r=t=>{t.target===o&&(e.prevAnimationName=ml(e.styles))},i=t=>{const r=ml(e.styles);t.target===o&&r===e.unmountAnimationName&&n({type:"UNMOUNT",src:"animationend"})};return o.addEventListener("animationstart",r),o.addEventListener("animationcancel",i),o.addEventListener("animationend",i),()=>{o.removeEventListener("animationstart",r),o.removeEventListener("animationcancel",i),o.removeEventListener("animationend",i)}}}}),{context:n});var s;const l=E((()=>function(e,t){const n=e.matches("mounted","unmountSuspended");return{skip:!e.context.initial&&n,present:n,setNode(e){e&&t({type:"NODE.SET",node:e})},unmount(){t({type:"UNMOUNT"})}}}(i,a)));return S((()=>{l().present&&r(!0)})),E((()=>({unmounted:!l().present&&!o()&&t.lazyMount||t.unmountOnExit&&!l().present&&o(),present:l().present,presenceProps:{ref:l().setNode,hidden:!l().present,"data-state":n.present?"open":"closed"}})))},[fc,mc]=ec({hookName:"usePresenceContext",providerName:"<PresenceProvider />"}),[bc,yc]=ec({hookName:"useDialogContext",providerName:"<DialogProvider />"}),vc=e=>{const t=pc(),n=lc(),o=ie(),r=E((()=>({id:o,dir:t().dir,getRootNode:n().getRootNode,open:e.defaultOpen,"open.controlled":void 0!==e.open,...e}))),[i,a]=Vr(Sl(r()),{context:r});return E((()=>function(e,t,n){const o=e.context["aria-label"],r=e.matches("open"),i=e.context.renderedElements;return{open:r,setOpen(e){e!==r&&t(e?"OPEN":"CLOSE")},getTriggerProps:()=>n.button({..._l.trigger.attrs,dir:e.context.dir,id:Tl.getTriggerId(e.context),"aria-haspopup":"dialog",type:"button","aria-expanded":r,"data-state":r?"open":"closed","aria-controls":Tl.getContentId(e.context),onClick(e){e.defaultPrevented||t("TOGGLE")}}),getBackdropProps:()=>n.element({..._l.backdrop.attrs,dir:e.context.dir,hidden:!r,id:Tl.getBackdropId(e.context),"data-state":r?"open":"closed"}),getPositionerProps:()=>n.element({..._l.positioner.attrs,dir:e.context.dir,id:Tl.getPositionerId(e.context),style:{pointerEvents:r?void 0:"none"}}),getContentProps:()=>n.element({..._l.content.attrs,dir:e.context.dir,role:e.context.role,hidden:!r,id:Tl.getContentId(e.context),tabIndex:-1,"data-state":r?"open":"closed","aria-modal":!0,"aria-label":o||void 0,"aria-labelledby":o||!i.title?void 0:Tl.getTitleId(e.context),"aria-describedby":i.description?Tl.getDescriptionId(e.context):void 0}),getTitleProps:()=>n.element({..._l.title.attrs,dir:e.context.dir,id:Tl.getTitleId(e.context)}),getDescriptionProps:()=>n.element({..._l.description.attrs,dir:e.context.dir,id:Tl.getDescriptionId(e.context)}),getCloseTriggerProps:()=>n.button({..._l.closeTrigger.attrs,dir:e.context.dir,id:Tl.getCloseTriggerId(e.context),type:"button",onClick(e){e.defaultPrevented||(e.stopPropagation(),t("CLOSE"))}})}}(i,a,Mr)))};var wc=Object.freeze({__proto__:null,Backdrop:e=>{const t=yc(),n=oc(),o=hc(Ar(n,(()=>({present:t().open})))),r=Ar((()=>t().getBackdropProps()),(()=>o().presenceProps),e);return Z(le,{get when(){return!o().unmounted},get children(){return Z(ac.div,r)}})},CloseTrigger:e=>{const t=yc(),n=Ar((()=>t().getCloseTriggerProps()),e);return Z(ac.button,n)},Content:e=>{const t=yc(),n=mc(),o=Ar((()=>t().getContentProps()),(()=>n().presenceProps),e);return Z(le,{get when(){return!n().unmounted},get children(){return Z(ac.div,o)}})},Context:e=>e.children(yc()),Description:e=>{const t=yc(),n=Ar((()=>t().getDescriptionProps()),e);return Z(ac.div,n)},Positioner:e=>{const t=yc(),n=mc(),o=Ar((()=>t().getPositionerProps()),e);return Z(le,{get when(){return!n().unmounted},get children(){return Z(ac.div,o)}})},Root:e=>{const[t,n]=gc(e),[o]=rc(t),[r,i]=tc()(n,["aria-label","closeOnEscape","closeOnInteractOutside","defaultOpen","finalFocusEl","id","ids","initialFocusEl","modal","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenChange","onPointerDownOutside","open","persistentElements","preventScroll","restoreFocus","role","trapFocus"]),a=vc(r),s=hc(Ar(t,(()=>({present:a().open}))));return Z(bc,{value:a,get children(){return Z(nc,{value:o,get children(){return Z(fc,{value:s,get children(){return i.children}})}})}})},RootProvider:e=>{const[t,n]=gc(e),[o]=rc(t),r=hc(Ar(t,(()=>({present:n.value().open}))));return Z(bc,{get value(){return n.value},get children(){return Z(nc,{value:o,get children(){return Z(fc,{value:r,get children(){return n.children}})}})}})},Title:e=>{const t=yc(),n=Ar((()=>t().getTitleProps()),e);return Z(ac.h2,n)},Trigger:e=>{const t=yc(),n=mc(),o=Ar((()=>t().getTriggerProps()),(()=>({"aria-controls":n().unmounted&&null})),e);return Z(ac.button,o)}});const[xc,kc]=ec({hookName:"useMenuContext",providerName:"<MenuProvider />",strict:!1}),[_c,Tc]=ec({hookName:"useMenuItemContext",providerName:"<MenuItemProvider />"}),[Sc,Ec]=ec({hookName:"useMenuOptionItemPropsContext",providerName:"<MenuOptionItemPropsProvider />"}),[Cc,Pc]=ec({hookName:"useMenuItemGroupContext",providerName:"<MenuItemGroupProvider />"}),Ic=e=>{const t=pc(),n=lc(),o=ie(),r=E((()=>({id:o,dir:t().dir,getRootNode:n().getRootNode,open:e.defaultOpen,"open.controlled":void 0!==e.open,...e}))),[i,a,s]=Vr(function(e){const t=Mi(e);return sr({id:"menu",initial:t.open?"open":"idle",context:{highlightedValue:null,loopFocus:!1,anchorPoint:null,closeOnSelect:!0,typeahead:!0,composite:!0,...t,positioning:{placement:"bottom-start",gutter:8,...t.positioning},intentPolygon:null,parent:null,lastHighlightedValue:null,children:Oo({}),suspendPointer:!1,restoreFocus:!0,typeaheadState:di.defaultOptions},computed:{isSubmenu:e=>null!==e.parent,isRtl:e=>"rtl"===e.dir,isTypingAhead:e=>""!==e.typeaheadState.keysSoFar},watch:{isSubmenu:"setSubmenuPlacement",anchorPoint:"reposition",open:"toggleVisibility"},on:{"PARENT.SET":{actions:"setParentMenu"},"CHILD.SET":{actions:"setChildMenu"},OPEN:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:"invokeOnOpen"}],OPEN_AUTOFOCUS:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{internal:!0,target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],CLOSE:[{guard:"isOpenControlled",actions:"invokeOnClose"},{target:"closed",actions:"invokeOnClose"}],"HIGHLIGHTED.RESTORE":{actions:"restoreHighlightedItem"},"HIGHLIGHTED.SET":{actions:"setHighlightedItem"}},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":"open","CONTROLLED.CLOSE":"closed",CONTEXT_MENU_START:{target:"opening:contextmenu",actions:"setAnchorPoint"},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:"invokeOnOpen"}],TRIGGER_FOCUS:{guard:Al("isSubmenu"),target:"closed"},TRIGGER_POINTERMOVE:{guard:"isSubmenu",target:"opening"}}},"opening:contextmenu":{tags:["closed"],after:{LONG_PRESS_DELAY:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:"invokeOnOpen"}]},on:{"CONTROLLED.OPEN":"open","CONTROLLED.CLOSE":"closed",CONTEXT_MENU_CANCEL:[{guard:"isOpenControlled",actions:"invokeOnClose"},{target:"closed",actions:"invokeOnClose"}]}},opening:{tags:["closed"],after:{SUBMENU_OPEN_DELAY:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:"invokeOnOpen"}]},on:{"CONTROLLED.OPEN":"open","CONTROLLED.CLOSE":"closed",BLUR:[{guard:"isOpenControlled",actions:"invokeOnClose"},{target:"closed",actions:"invokeOnClose"}],TRIGGER_POINTERLEAVE:[{guard:"isOpenControlled",actions:"invokeOnClose"},{target:"closed",actions:"invokeOnClose"}]}},closing:{tags:["open"],activities:["trackPointerMove","trackInteractOutside"],after:{SUBMENU_CLOSE_DELAY:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"closed",actions:["focusParentMenu","restoreParentHiglightedItem","invokeOnClose"]}]},on:{"CONTROLLED.OPEN":"open","CONTROLLED.CLOSE":{target:"closed",actions:["focusParentMenu","restoreParentHiglightedItem"]},MENU_POINTERENTER:{target:"open",actions:"clearIntentPolygon"},POINTER_MOVED_AWAY_FROM_SUBMENU:[{guard:"isOpenControlled",actions:"invokeOnClose"},{target:"closed",actions:["focusParentMenu","restoreParentHiglightedItem"]}]}},closed:{tags:["closed"],entry:["clearHighlightedItem","focusTrigger","clearAnchorPoint","resumePointer"],on:{"CONTROLLED.OPEN":[{guard:Rl("isOpenAutoFocusEvent","isArrowDownEvent"),target:"open",actions:"highlightFirstItem"},{guard:"isArrowUpEvent",target:"open",actions:"highlightLastItem"},{target:"open"}],CONTEXT_MENU_START:{target:"opening:contextmenu",actions:"setAnchorPoint"},CONTEXT_MENU:[{guard:"isOpenControlled",actions:["setAnchorPoint","invokeOnOpen"]},{target:"open",actions:["setAnchorPoint","invokeOnOpen"]}],TRIGGER_CLICK:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:"invokeOnOpen"}],TRIGGER_POINTERMOVE:{guard:"isTriggerItem",target:"opening"},TRIGGER_BLUR:"idle",ARROW_DOWN:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:["highlightFirstItem","invokeOnOpen"]}],ARROW_UP:[{guard:"isOpenControlled",actions:"invokeOnOpen"},{target:"open",actions:["highlightLastItem","invokeOnOpen"]}]}},open:{tags:["open"],activities:["trackInteractOutside","trackPositioning","scrollToHighlightedItem"],entry:["focusMenu","resumePointer"],on:{"CONTROLLED.CLOSE":[{target:"closed",guard:"isArrowLeftEvent",actions:["focusParentMenu"]},{target:"closed"}],TRIGGER_CLICK:[{guard:$l(Al("isTriggerItem"),"isOpenControlled"),actions:"invokeOnClose"},{guard:Al("isTriggerItem"),target:"closed",actions:"invokeOnClose"}],ARROW_UP:{actions:["highlightPrevItem","focusMenu"]},ARROW_DOWN:{actions:["highlightNextItem","focusMenu"]},ARROW_LEFT:[{guard:$l("isSubmenu","isOpenControlled"),actions:"invokeOnClose"},{guard:"isSubmenu",target:"closed",actions:["focusParentMenu","invokeOnClose"]}],HOME:{actions:["highlightFirstItem","focusMenu"]},END:{actions:["highlightLastItem","focusMenu"]},ARROW_RIGHT:{guard:"isTriggerItemHighlighted",actions:"openSubmenu"},ENTER:[{guard:"isTriggerItemHighlighted",actions:"openSubmenu"},{guard:$l("closeOnSelect","isOpenControlled"),actions:["clickHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"closed",actions:"clickHighlightedItem"},{actions:"clickHighlightedItem"}],ITEM_POINTERMOVE:[{guard:Al("suspendPointer"),actions:["setHighlightedItem","focusMenu"]},{actions:"setLastHighlightedItem"}],ITEM_POINTERLEAVE:{guard:$l(Al("suspendPointer"),Al("isTriggerItem")),actions:"clearHighlightedItem"},ITEM_CLICK:[{guard:$l(Al("isTriggerItemHighlighted"),Al("isHighlightedItemEditable"),"closeOnSelect","isOpenControlled"),actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:$l(Al("isTriggerItemHighlighted"),Al("isHighlightedItemEditable"),"closeOnSelect"),target:"closed",actions:["invokeOnSelect","setOptionState","closeRootMenu","invokeOnClose"]},{guard:$l(Al("isTriggerItemHighlighted"),Al("isHighlightedItemEditable")),actions:["invokeOnSelect","setOptionState"]},{actions:"setHighlightedItem"}],TRIGGER_POINTERLEAVE:{target:"closing",actions:"setIntentPolygon"},ITEM_POINTERDOWN:{actions:"setHighlightedItem"},TYPEAHEAD:{actions:"highlightMatchedItem"},FOCUS_MENU:{actions:"focusMenu"},"POSITIONING.SET":{actions:"reposition"}}}}},{delays:{LONG_PRESS_DELAY:700,SUBMENU_OPEN_DELAY:100,SUBMENU_CLOSE_DELAY:100},guards:{closeOnSelect:(e,t)=>!!(t?.closeOnSelect??e.closeOnSelect),isTriggerItem:(e,t)=>Il.isTriggerItem(t.target),isTriggerItemHighlighted:(e,t)=>{const n=t.target??Il.getHighlightedItemEl(e);return!!n?.hasAttribute("aria-controls")},isSubmenu:e=>e.isSubmenu,suspendPointer:e=>e.suspendPointer,isHighlightedItemEditable:e=>yi(Il.getHighlightedItemEl(e)),isWithinPolygon:(e,t)=>!!e.intentPolygon&&function(e,t){const{x:n,y:o}=t;let r=!1;for(let t=0,i=e.length-1;t<e.length;i=t++){const a=e[t].x,s=e[t].y,l=e[i].x,c=e[i].y;s>o!=c>o&&n<(l-a)*(o-s)/(c-s)+a&&(r=!r)}return r}(e.intentPolygon,t.point),isOpenControlled:e=>!!e["open.controlled"],isArrowLeftEvent:(e,t)=>"ARROW_LEFT"===t.previousEvent?.type,isArrowUpEvent:(e,t)=>"ARROW_UP"===t.previousEvent?.type,isArrowDownEvent:(e,t)=>"ARROW_DOWN"===t.previousEvent?.type,isOpenAutoFocusEvent:(e,t)=>"OPEN_AUTOFOCUS"===t.previousEvent?.type},activities:{trackPositioning(e){if(!e.anchorPoint)return e.currentPlacement=e.positioning.placement,nl(Il.getTriggerEl(e),(()=>Il.getPositionerEl(e)),{...e.positioning,defer:!0,onComplete(t){e.currentPlacement=t.placement}})},trackInteractOutside:(e,t,{send:n})=>fl((()=>Il.getContentEl(e)),{defer:!0,exclude:[Il.getTriggerEl(e)],onInteractOutside:e.onInteractOutside,onFocusOutside:e.onFocusOutside,onEscapeKeyDown(t){e.onEscapeKeyDown?.(t),e.isSubmenu&&t.preventDefault(),Nl(e)},onPointerDownOutside(t){e.restoreFocus=!t.detail.focusable,e.onPointerDownOutside?.(t)},onDismiss(){n({type:"CLOSE",src:"interact-outside"})}}),trackPointerMove(e,t,{guards:n,send:o}){const{isWithinPolygon:r}=n;e.parent.state.context.suspendPointer=!0;const i=Il.getDoc(e);return Fi(i,"pointermove",(t=>{const n={x:t.clientX,y:t.clientY};r(e,{point:n})||(o("POINTER_MOVED_AWAY_FROM_SUBMENU"),e.parent.state.context.suspendPointer=!1)}))},scrollToHighlightedItem(e,t,{getState:n}){const o=()=>{n().event.type.startsWith("ITEM_POINTER")||Ti(Il.getHighlightedItemEl(e),{rootEl:Il.getContentEl(e),block:"nearest"})};return wi((()=>o())),xi((()=>Il.getContentEl(e)),{defer:!0,attributes:["aria-activedescendant"],callback:o})}},actions:{setAnchorPoint(e,t){e.anchorPoint=t.point},clearAnchorPoint(e){e.anchorPoint=null},setSubmenuPlacement(e){e.isSubmenu&&(e.positioning.placement=e.isRtl?"left-start":"right-start",e.positioning.gutter=0)},reposition(e,t){const n=e.anchorPoint?()=>({width:0,height:0,...e.anchorPoint}):void 0;nl(Il.getTriggerEl(e),(()=>Il.getPositionerEl(e)),{...e.positioning,getAnchorRect:n,...t.options??{},listeners:!1,onComplete(t){e.currentPlacement=t.placement}})},setOptionState(e,t){if(!t.option)return;const{checked:n,onCheckedChange:o,type:r}=t.option;"radio"===r?o?.(!0):"checkbox"===r&&o?.(!n)},clickHighlightedItem(e,t,{send:n}){const o=Il.getHighlightedItemEl(e);if(!o||o.dataset.disabled)return;const r=Il.getOptionFromItemEl(o);n({type:"ITEM_CLICK",src:"enter",target:o,id:r.id,option:r,closeOnSelect:e.closeOnSelect})},setIntentPolygon(e,t){const n=Il.getContentEl(e),o=e.currentPlacement;if(!n||!o)return;const r=Cl(n.getBoundingClientRect(),o);if(!r)return;const i="right"===function(e){return e.split("-")[0]}(o),a=i?-5:5;e.intentPolygon=[{...t.point,x:t.point.x+a},...r]},clearIntentPolygon(e){e.intentPolygon=null},resumePointer(e){e.parent&&(e.parent.state.context.suspendPointer=!1)},setHighlightedItem(e,t){Ll.highlighted(e,t.id)},clearHighlightedItem(e){Ll.highlighted(e,null)},focusMenu(e){wi((()=>{const t=Il.getContentEl(e),n=mi({root:t,enabled:!Zr(t,Il.getActiveElement(e)),filter:e=>!e.role?.startsWith("menuitem")});n?.focus({preventScroll:!0})}))},highlightFirstItem(e){const t=Il.getFirstEl(e);t&&Ll.highlighted(e,t.id)},highlightLastItem(e){const t=Il.getLastEl(e);t&&Ll.highlighted(e,t.id)},highlightNextItem(e,t){const n=Il.getNextEl(e,t.loop);Ll.highlighted(e,n?.id??null)},highlightPrevItem(e,t){const n=Il.getPrevEl(e,t.loop);Ll.highlighted(e,n?.id??null)},invokeOnSelect(e){e.highlightedValue&&e.onSelect?.({value:e.highlightedValue})},focusTrigger(e){e.isSubmenu||e.anchorPoint||!e.restoreFocus||wi((()=>Il.getTriggerEl(e)?.focus({preventScroll:!0})))},highlightMatchedItem(e,t){const n=Il.getElemByKey(e,t.key);n&&Ll.highlighted(e,n.id)},setParentMenu(e,t){e.parent=Oo(t.value)},setChildMenu(e,t){e.children[t.id]=Oo(t.value)},closeRootMenu(e){Nl(e)},openSubmenu(e){const t=Il.getHighlightedItemEl(e),n=t?.getAttribute("data-uid"),o=n?e.children[n]:null;o?.send("OPEN_AUTOFOCUS")},focusParentMenu(e){e.parent?.send("FOCUS_MENU")},setLastHighlightedItem(e,t){e.lastHighlightedValue=t.id},restoreHighlightedItem(e){e.lastHighlightedValue&&(Ll.highlighted(e,e.lastHighlightedValue),e.lastHighlightedValue=null)},restoreParentHiglightedItem(e){e.parent?.send("HIGHLIGHTED.RESTORE")},invokeOnOpen(e){e.onOpenChange?.({open:!0})},invokeOnClose(e){e.onOpenChange?.({open:!1})},toggleVisibility(e,t,{send:n}){n({type:e.open?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:t})}}})}(r()),{context:r});return{api:E((()=>Ol(i,a,Mr))),machine:s}},[Oc,Ac]=ec({hookName:"useMenuMachineContext",providerName:"<MenuMachineProvider />",strict:!1}),[$c,Rc]=ec({hookName:"useMenuMachineContext",providerName:"<MenuMachineProvider />",strict:!1});var Nc=Object.freeze({__proto__:null,Arrow:e=>{const t=kc(),n=Ar((()=>t().getArrowProps()),e);return Z(ac.div,n)},ArrowTip:e=>{const t=kc(),n=Ar((()=>t().getArrowTipProps()),e);return Z(ac.div,n)},CheckboxItem:e=>{const[t,n]=tc()(e,["checked","closeOnSelect","disabled","onCheckedChange","value","valueText"]),o=Ar(t,{type:"checkbox"}),r=kc(),i=Ar((()=>r().getOptionItemProps(o)),n),a=E((()=>r().getItemState(o)));return Z(Sc,{value:o,get children(){return Z(_c,{value:a,get children(){return Z(ac.div,i)}})}})},Content:e=>{const t=kc(),n=mc(),o=Ar((()=>t().getContentProps()),(()=>n().presenceProps),e);return Z(le,{get when(){return!n().unmounted},get children(){return Z(ac.div,o)}})},Context:e=>e.children(kc()),ContextTrigger:e=>{const t=kc(),n=Ar((()=>t().getContextTriggerProps()),e);return Z(ac.button,n)},Indicator:e=>{const t=kc(),n=Ar((()=>t().getIndicatorProps()),e);return Z(ac.div,n)},Item:e=>{const[t,n]=tc()(e,["closeOnSelect","disabled","value","valueText"]),o=kc(),r=Ar((()=>o().getItemProps(t)),n),i=E((()=>o().getItemState(t)));return Z(_c,{value:i,get children(){return Z(ac.div,r)}})},ItemContext:e=>e.children(Tc()),ItemGroup:e=>{const[t,n]=tc()(e,["id"]),o=Ar({id:ie()},t),r=kc(),i=Ar((()=>r().getItemGroupProps(o)),n);return Z(Cc,{value:o,get children(){return Z(ac.div,i)}})},ItemGroupLabel:e=>{const t=kc(),n=Pc(),o=Ar(t().getItemGroupLabelProps({htmlFor:n.id}),e);return Z(ac.div,o)},ItemIndicator:e=>{const t=kc(),n=Ec(),o=Ar((()=>t().getItemIndicatorProps(n)),e);return Z(ac.div,o)},ItemText:e=>{const t=kc(),n=Ec(),o=Ar((()=>t().getItemTextProps(n)),e);return Z(ac.div,o)},Positioner:e=>{const t=kc(),n=mc(),o=Ar((()=>t().getPositionerProps()),e);return Z(le,{get when(){return!n().unmounted},get children(){return Z(ac.div,o)}})},RadioItem:e=>{const[t,n]=tc()(e,["closeOnSelect","disabled","value","valueText"]),o=kc(),r=Pc(),i=Ar(t,(()=>({type:"radio",checked:r.value===t.value,onCheckedChange:()=>r.onValueChange?.({value:t.value})}))),a=Ar((()=>o().getOptionItemProps(i)),n),s=E((()=>o().getItemState(i)));return Z(Sc,{value:i,get children(){return Z(_c,{value:s,get children(){return Z(ac.div,a)}})}})},RadioItemGroup:e=>{const[t,n]=tc()(e,["id","onValueChange","value"]),o=kc(),r=Ar({id:ie()},t),i=Ar((()=>o().getItemGroupProps(r)),n);return Z(Cc,{value:r,get children(){return Z(ac.div,i)}})},Root:e=>{const[t,n]=gc(e),[o,r]=tc()(n,["anchorPoint","aria-label","closeOnSelect","composite","defaultOpen","highlightedValue","id","ids","loopFocus","onEscapeKeyDown","onFocusOutside","onHighlightChange","onInteractOutside","onOpenChange","onPointerDownOutside","onSelect","open","positioning","typeahead"]),i=kc(),a=Ac(),s=Ic(o),l=hc(Ar(t,(()=>({present:s.api().open}))));S((()=>{a&&(i?.().setChild(s.machine),s.api().setParent(a))}));return Z($c,{value:()=>i?.().getTriggerItemProps(s.api()),get children(){return Z(Oc,{get value(){return s.machine},get children(){return Z(xc,{get value(){return s.api},get children(){return Z(fc,{value:l,get children(){return r.children}})}})}})}})},RootProvider:e=>{const t=kc(),n=Ac(),[o,r]=gc(e),i=hc(Ar(o,(()=>({present:r.value.api().open}))));S((()=>{n&&(t?.().setChild(r.value.machine),r.value.api().setParent(n))}));return Z($c,{value:()=>t?.().getTriggerItemProps(r.value.api()),get children(){return Z(Oc,{get value(){return r.value.machine},get children(){return Z(xc,{get value(){return r.value.api},get children(){return Z(fc,{value:i,get children(){return r.children}})}})}})}})},Separator:e=>{const t=kc(),n=Ar((()=>t().getSeparatorProps()),e);return Z(ac.hr,n)},Trigger:e=>{const t=kc(),n=mc(),o=Ar((()=>t().getTriggerProps()),(()=>({"aria-controls":n().unmounted&&null})),e);return Z(ac.button,o)},TriggerItem:e=>{const t=Rc(),n=Ar((()=>t?.()),e);return Z(ac.div,n)}});const[Lc,Dc]=ec({hookName:"useProgressContext",providerName:"<ProgressProvider />"}),Mc=e=>{const t=pc(),n=lc(),o=ie(),r=E((()=>({id:o,dir:t().dir,getRootNode:n().getRootNode,...e}))),[i,a]=Vr(Bl(r()),{context:r});return E((()=>function(e,t,n){const o=e.context.percent,r=e.context.max,i=e.context.min,a=e.context.orientation,s=e.context.translations,l=e.context.isIndeterminate,c=e.context.value,d=s.value({value:c,max:r,percent:o,min:i}),u=function(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}(c,r),p={role:"progressbar","aria-label":d,"data-max":r,"aria-valuemin":i,"aria-valuemax":r,"aria-valuenow":c??void 0,"data-orientation":a,"data-state":u},g=function(e){const t={style:{"--radius":"calc(var(--size) / 2 - var(--thickness) / 2)",cx:"calc(var(--size) / 2)",cy:"calc(var(--size) / 2)",r:"var(--radius)",fill:"transparent",strokeWidth:"var(--thickness)"}};return{root:{viewBox:"0 0 var(--size) var(--size)",style:{width:"var(--size)",height:"var(--size)"}},track:t,range:{opacity:0===e.value?0:void 0,style:{...t.style,"--percent":e.percent,"--circumference":"calc(2 * 3.14159 * var(--radius))","--offset":"calc(var(--circumference) * (100 - var(--percent)) / 100}))",strokeDashoffset:"calc(var(--circumference) * ((100 - var(--percent)) / 100))",strokeDasharray:e.isIndeterminate?void 0:"var(--circumference)",transformOrigin:"center",transform:"rotate(-90deg)"}}}}(e.context);return{value:c,valueAsString:d,setValue(e){t({type:"VALUE.SET",value:e})},setToMax(){t({type:"VALUE.SET",value:r})},getRootProps:()=>n.element({dir:e.context.dir,...Dl.root.attrs,id:Ml.getRootId(e.context),"data-max":r,"data-value":c??void 0,"data-state":u,"data-orientation":a,style:{"--percent":l?void 0:o}}),getLabelProps:()=>n.element({dir:e.context.dir,id:Ml.getLabelId(e.context),...Dl.label.attrs,"data-orientation":a}),getValueTextProps:()=>n.element({dir:e.context.dir,"aria-live":"polite",...Dl.valueText.attrs}),getTrackProps:()=>n.element({dir:e.context.dir,id:Ml.getTrackId(e.context),...Dl.track.attrs,...p}),getRangeProps:()=>n.element({dir:e.context.dir,...Dl.range.attrs,"data-orientation":a,"data-state":u,style:{[e.context.isHorizontal?"width":"height"]:l?void 0:`${o}%`}}),getCircleProps:()=>n.element({dir:e.context.dir,id:Ml.getCircleId(e.context),...Dl.circle.attrs,...p,...g.root}),getCircleTrackProps:()=>n.element({dir:e.context.dir,"data-orientation":a,...Dl.circleTrack.attrs,...g.track}),getCircleRangeProps:()=>n.element({dir:e.context.dir,...Dl.circleRange.attrs,...g.range,"data-state":u}),getViewProps:t=>n.element({dir:e.context.dir,...Dl.view.attrs,"data-state":t.state,hidden:t.state!==u})}}(i,a,Mr)))};var Uc=Object.freeze({__proto__:null,Circle:e=>{const t=Dc(),n=Ar((()=>t().getCircleProps()),e);return Z(ac.svg,n)},CircleRange:e=>{const t=Dc(),n=Ar((()=>t().getCircleRangeProps()),e);return Z(ac.circle,n)},CircleTrack:e=>{const t=Dc(),n=Ar((()=>t().getCircleTrackProps()),e);return Z(ac.circle,n)},Context:e=>e.children(Dc()),Label:e=>{const t=Dc(),n=Ar((()=>t().getLabelProps()),e);return Z(ac.label,n)},Range:e=>{const t=Dc(),n=Ar((()=>t().getRangeProps()),e);return Z(ac.div,n)},Root:e=>{const[t,n]=tc()(e,["id","ids","max","min","orientation","translations","value"]),o=Mc(t),r=Ar((()=>o().getRootProps()),n);return Z(Lc,{value:o,get children(){return Z(ac.div,r)}})},RootProvider:e=>{const[{value:t},n]=tc()(e,["value"]),o=Ar((()=>t().getRootProps()),n);return Z(Lc,{value:t,get children(){return Z(ac.div,o)}})},Track:e=>{const t=Dc(),n=Ar((()=>t().getTrackProps()),e);return Z(ac.div,n)},ValueText:e=>{const t=Dc(),n=Ar((()=>t().getValueTextProps()),e);return Z(ac.span,ne(n,{get children(){return e.children||t().valueAsString}}))},View:e=>{const[t,n]=tc()(e,["state"]),o=Dc(),r=Ar((()=>o().getViewProps(t)),n);return Z(ac.span,r)}}),Bc=(e,t=[])=>({parts:(...n)=>{if(jc(t))return Bc(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Bc(e,[...t,...n]),rename:e=>Bc(e,t),keys:()=>t,build:()=>[...new Set(t)].reduce(((t,n)=>Object.assign(t,{[n]:{selector:[`&[data-scope="${Fc(e)}"][data-part="${Fc(n)}"]`,`& [data-scope="${Fc(e)}"][data-part="${Fc(n)}"]`].join(", "),attrs:{"data-scope":Fc(e),"data-part":Fc(n)}}})),{})}),Fc=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),jc=e=>0===e.length;function zc(e,t){const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;return n?(n[e]||(n[e]=t()),n[e]):t()}zc("__zag__proxyStateMap",(()=>new WeakMap)),zc("__zag__refSet",(()=>new WeakSet)),Bc("signature-pad").parts("root","control","segment","segmentPath","guide","clearTrigger","label").build();var Hc=_i({getRootId:e=>e.ids?.root??`signature-${e.id}`,getControlId:e=>e.ids?.control??`signature-control-${e.id}`,getHiddenInputId:e=>e.ids?.hiddenInput??`signature-input-${e.id}`,getControlEl:e=>Hc.getById(e,Hc.getControlId(e)),getSegmentEl:e=>{return t=Hc.getControlEl(e),n="[data-part=segment]",t?.querySelector(n)??null;var t,n},getHiddenInputEl:e=>Hc.getById(e,Hc.getHiddenInputId(e)),getDataUrl:(e,t)=>e.isEmpty?Promise.resolve(""):function(e,t){const{type:n,quality:o=.92}=t;if(!e)throw new Error("[get-data-url]: could not find the svg element");const r=Qr(e),i=r.document,a='<?xml version="1.0" standalone="no"?>\r\n'+(new r.XMLSerializer).serializeToString(e),s="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(a);if("image/svg+xml"===n)return Promise.resolve(s);const l=e.getBoundingClientRect(),c=r.devicePixelRatio||1,d=i.createElement("canvas"),u=new r.Image;u.src=s,d.width=l.width*c,d.height=l.height*c;const p=d.getContext("2d");return p.scale(c,c),new Promise((e=>{u.onload=()=>{p.drawImage(u,0,0),e(d.toDataURL(n,o))}}))}(Hc.getSegmentEl(e),t)});gr()(["dir","disabled","getRootNode","id","ids","onDraw","onDrawEnd","readOnly","drawing","name"]);const[Vc,Gc]=ec({hookName:"useToastContext",providerName:"<ToastProvider />"});var Wc=ve("<div><div></div><div>");const qc=e=>{const[t,n]=oe(e,["toaster","children"]),[o,r]=Vr(t.toaster.machine),i=o.context.placement,a=E((()=>Ql.connect(o,r,Mr))),s=E((()=>a().getToastsByPlacement(i))),l=Ar(a().getGroupProps({placement:i}),n);return Z(ac.div,ne(l,{get children(){return Z(se,{get each(){return s()},children:e=>Z(Kc,{value:e,children:e=>t.children(e)})})}}))},Kc=e=>{const[t,n]=[Hr(o=e.value),o.send];var o;const r=E((()=>function(e,t,n){const o=e.hasTag("visible"),r=e.hasTag("paused"),i=e.context.placement,a=e.context.type,[s,l="center"]=i.split("-");return{type:a,title:e.context.title,description:e.context.description,placement:i,visible:o,paused:r,pause(){t("PAUSE")},resume(){t("RESUME")},dismiss(){t("DISMISS")},getRootProps:()=>n.element({...jl.root.attrs,dir:e.context.dir,id:zl.getRootId(e.context),"data-state":o?"open":"closed","data-type":a,"data-placement":i,"data-align":l,"data-side":s,"data-mounted":Kr(e.context.mounted),"data-paused":Kr(r),"data-first":Kr(e.context.frontmost),"data-sibling":Kr(!e.context.frontmost),"data-stack":Kr(e.context.stacked),"data-overlap":Kr(!e.context.stacked),role:"status","aria-atomic":"true",tabIndex:0,style:ql(e.context,o),onKeyDown(e){e.defaultPrevented||"Escape"==e.key&&(t("DISMISS"),e.preventDefault())}}),getGhostBeforeProps:()=>n.element({"data-ghost":"before",style:Kl(e.context,o)}),getGhostAfterProps:()=>n.element({"data-ghost":"after",style:(e.context,{position:"absolute",left:"0",height:"calc(var(--gap) + 2px)",bottom:"100%",width:"100%"})}),getTitleProps:()=>n.element({...jl.title.attrs,id:zl.getTitleId(e.context)}),getDescriptionProps:()=>n.element({...jl.description.attrs,id:zl.getDescriptionId(e.context)}),getActionTriggerProps:()=>n.button({...jl.actionTrigger.attrs,type:"button",onClick(e){e.defaultPrevented||t("DISMISS")}}),getCloseTriggerProps:()=>n.button({id:zl.getCloseTriggerId(e.context),...jl.closeTrigger.attrs,type:"button","aria-label":"Dismiss notification",onClick(e){e.defaultPrevented||t("DISMISS")}})}}(t,n,Mr))),i=E((()=>t.context));return Z(Vc,{value:r,get children(){return e.children(i)}})};var Yc=Object.freeze({__proto__:null,ActionTrigger:e=>{const t=Gc(),n=Ar((()=>t().getActionTriggerProps()),e);return Z(ac.button,n)},CloseTrigger:e=>{const t=Gc(),n=Ar((()=>t().getCloseTriggerProps()),e);return Z(ac.button,n)},Context:e=>e.children(Gc()),Description:e=>{const t=Gc(),n=Ar((()=>t().getDescriptionProps()),e);return Z(ac.div,n)},Root:e=>{const t=Gc(),n=Ar((()=>t().getRootProps()),e);return o=Wc(),r=o.firstChild,i=r.nextSibling,_e(o,n,!1,!0),_e(r,ne((()=>t().getGhostBeforeProps())),!1,!1),Se(o,(()=>e.children),i),_e(i,ne((()=>t().getGhostAfterProps())),!1,!1),o;var o,r,i},Title:e=>{const t=Gc(),n=Ar((()=>t().getTitleProps()),e);return Z(ac.div,n)}});const Xc=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2px" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18">'),Zc=e=>(()=>{const t=Xc();return _e(t,e,!0,!0),t})(),Jc=e=>Z(wc.Root,{get open(){return e.isOpen},lazyMount:!0,unmountOnExit:!0,onOpenChange:t=>t.open?void 0:e.onClose?.(),get children(){return[Z(wc.Backdrop,{class:"fixed inset-0 bg-[rgba(0,0,0,0.5)] h-screen z-50"}),Z(wc.Positioner,{class:"fixed inset-0 z-50 flex items-center justify-center px-2",get children(){return[Z(wc.Content,{get children(){return e.children}}),Z(wc.CloseTrigger,{class:"fixed top-2 right-2 z-50 rounded-md bg-white p-2 text-black",get children(){return Z(Zc,{class:"w-6 h-6"})}})]}})]}}),Qc=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2px" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"></path><path d="M14 2v4a2 2 0 0 0 2 2h4">'),ed=e=>(()=>{const t=Qc();return _e(t,e,!0,!0),t})(),td=ve('<div class="flex items-center gap-4 border bg-white border-gray-200 rounded-md p-2 text-gray-900 min-w-[250px]"><div></div><div class="flex flex-col"><span class="text-md font-semibold text-sm"></span><span class="text-gray-500 text-xs">'),nd=e=>{const t=rd(e.file);return(()=>{const n=td(),o=n.firstChild,r=o.nextSibling.firstChild,i=r.nextSibling;return Se(o,Z(ed,{class:"w-6 h-6"})),Se(r,(()=>e.file.name)),Se(i,(()=>od(e.file))),T((()=>ke(o,Ze("rounded-md text-white p-2 flex items-center","pink"===t&&"bg-pink-400","blue"===t&&"bg-blue-400","green"===t&&"bg-green-400","gray"===t&&"bg-gray-400","orange"===t&&"bg-orange-400")))),n})()},od=e=>{switch(e.name.split(".").pop()){case"pdf":return"PDF";case"doc":case"docx":return"Word";case"xls":case"xlsx":case"csv":return"Sheet";case"json":return"JSON";case"md":return"Markdown";default:return"DOCUMENT"}},rd=e=>{const t=e.name.split(".").pop();if(!t)return"gray";switch(t){case"pdf":return"pink";case"doc":case"docx":return"blue";case"xls":case"xlsx":case"csv":return"green";case"json":return"orange";default:return"gray"}},id=ve('<div class="flex justify-end items-end animate-fade-in gap-2 guest-container">'),ad=ve("<div>"),sd=ve('<span class="px-[15px] py-[7px]">'),ld=ve('<img alt="Attachment">'),cd=ve('<div class="flex flex-col gap-1 items-end"><div class="p-[1px] whitespace-pre-wrap max-w-full typebot-guest-bubble flex flex-col" data-testid="guest-bubble">'),dd=ve("<img>"),ud=ve('<div class="flex flex-col gap-1 items-end"><div class="p-2 w-full whitespace-pre-wrap typebot-guest-bubble flex flex-col" data-testid="guest-bubble"><audio controls>'),pd=e=>(()=>{const t=id();return Se(t,Z(ce,{get children(){return[Z(de,{get when(){return"text"===e.answer?.type},get children(){return Z(gd,{get answer(){return e.answer}})}}),Z(de,{get when(){return"recording"===e.answer?.type},get children(){return Z(hd,{get answer(){return e.answer}})}})]}}),null),Se(t,Z(le,{get when(){return e.showAvatar},get children(){return Z(mo,{get initialAvatarSrc(){return e.avatarSrc}})}}),null),T((()=>null!=(e.hasHostAvatar?Kt()?"28px":"50px":void 0)?t.style.setProperty("margin-left",e.hasHostAvatar?Kt()?"28px":"50px":void 0):t.style.removeProperty("margin-left"))),t})(),gd=e=>{const[t,n]=_();return(()=>{const o=cd(),r=o.firstChild;return Se(o,Z(le,{get when(){return(e.answer.attachments??[]).length>0},get children(){return[(()=>{const t=ad();return Se(t,Z(se,{get each(){return e.answer.attachments?.filter((e=>e.type.startsWith("image")))},children:(t,o)=>(()=>{const r=dd();return r.$$click=()=>n(t.url),T((n=>{const i=t.url,a=`Attached image ${o()+1}`,s=Ze("typebot-guest-bubble-image-attachment cursor-pointer",e.answer.attachments.filter((e=>e.type.startsWith("image"))).length>1&&"max-w-[90%]");return i!==n._v$&&xe(r,"src",n._v$=i),a!==n._v$2&&xe(r,"alt",n._v$2=a),s!==n._v$3&&ke(r,n._v$3=s),n}),{_v$:void 0,_v$2:void 0,_v$3:void 0}),r})()})),T((()=>ke(t,Ze("flex gap-1 overflow-auto max-w-[350px]",Kt()?"flex-wrap justify-end":"items-center")))),t})(),(()=>{const t=ad();return Se(t,Z(se,{get each(){return e.answer.attachments?.filter((e=>!e.type.startsWith("image")))},children:e=>Z(nd,{get file(){return{name:e.url.split("/").at(-1)}}})})),T((()=>ke(t,Ze("flex gap-1 overflow-auto max-w-[350px]",Kt()?"flex-wrap justify-end":"items-center")))),t})()]}}),r),Se(r,Z(le,{get when(){return We(e.answer.label??e.answer.value)},get children(){const t=sd();return Se(t,(()=>e.answer.label??e.answer.value)),t}})),Se(o,Z(Jc,{get isOpen(){return void 0!==t()},onClose:()=>n(void 0),get children(){const e=ld();return e.style.setProperty("border-radius","6px"),T((()=>xe(e,"src",t()))),e}}),null),o})()},hd=e=>(()=>{const t=ud(),n=t.firstChild.firstChild;return T((()=>xe(n,"src",e.answer.url))),t})();we(["click"]);const fd="Send";let md=function(e){return e.TEXT="text input",e.NUMBER="number input",e.EMAIL="email input",e.URL="url input",e.DATE="date input",e.PHONE="phone number input",e.CHOICE="choice input",e.PICTURE_CHOICE="picture choice input",e.PAYMENT="payment input",e.RATING="rating input",e.FILE="file input",e}({});const bd={button:fd,placeholder:"Type your answer..."},yd={isEnabled:!1,visibility:"Auto"},vd=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2px" stroke-linecap="round" stroke-linejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"></path><path d="M14 2v4a2 2 0 0 0 2 2h4"></path><circle cx="10" cy="12" r="2"></circle><path d="m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22">'),wd=e=>(()=>{const t=vd();return _e(t,e,!0,!0),t})(),xd=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48">'),kd=e=>(()=>{const t=xd();return _e(t,e,!0,!0),t})(),_d=ve('<input type="file" id="document-upload" multiple class="hidden">'),Td=ve('<input type="file" id="photos-upload" accept="image/*, video/*" multiple class="hidden">'),Sd=ve('<label aria-label="Add attachments" for="document-upload">'),Ed=ve("<label> Document"),Cd=ve("<label> Photos & videos"),Pd=e=>[(()=>{const t=_d();return t.addEventListener("change",(t=>{t.currentTarget.files&&e.onNewFiles(t.currentTarget.files)})),t})(),(()=>{const t=Td();return t.addEventListener("change",(t=>{t.currentTarget.files&&e.onNewFiles(t.currentTarget.files)})),t})(),Z(ce,{get children(){return[Z(de,{get when(){return Kt()},get children(){const t=Sd();return Se(t,Z(kd,{class:"w-5"})),T((()=>ke(t,Ze("filter data-[state=open]:backdrop-brightness-90 hover:backdrop-brightness-95 transition rounded-md p-2 focus:outline-none",e.class)))),t}}),Z(de,{when:!0,get children(){return Z(Nc.Root,{get children(){return[Z(Nc.Trigger,{get class(){return Ze("filter data-[state=open]:backdrop-brightness-90 hover:backdrop-brightness-95 transition rounded-md p-2 focus:outline-none",e.class)},"aria-label":"Add attachments",get children(){return Z(kd,{class:"w-5"})}}),Z(Nc.Positioner,{get children(){return Z(Nc.Content,{class:"p-3 gap-2 focus:outline-none",get children(){return[Z(Nc.Item,{value:"document",asChild:e=>(()=>{const t=Ed(),n=t.firstChild;return _e(t,ne(e,{for:"document-upload",class:"p-2 filter hover:brightness-95 flex gap-3 items-center"}),!1,!0),Se(t,Z(ed,{class:"w-4"}),n),t})()}),Z(Nc.Item,{value:"photos",asChild:e=>(()=>{const t=Cd(),n=t.firstChild;return _e(t,ne(e,{for:"photos-upload",class:"p-2 filter hover:brightness-95 flex gap-3 items-center"}),!1,!0),Se(t,Z(wd,{class:"w-4"}),n),t})()})]}})}})]}})}})]}})],Id=ve('<img class="rounded-md object-cover w-[58px] h-[58px]">'),Od=ve('<div class="relative group flex-shrink-0"><button class="absolute -right-2 p-0.5 -top-2 rounded-full bg-gray-200 text-black border border-gray-400 opacity-1 sm:opacity-0 group-hover:opacity-100 transition-opacity" aria-label="Remove attachment">'),Ad=ve('<div class="absolute w-full h-full inset-0 bg-black/20 rounded-md">'),$d=e=>(()=>{const t=Od(),n=t.firstChild;return Se(t,Z(ce,{get children(){return[Z(de,{get when(){return e.file.type.startsWith("image")},get children(){const t=Id();return T((n=>{const o=URL.createObjectURL(e.file),r=e.file.name;return o!==n._v$&&xe(t,"src",n._v$=o),r!==n._v$2&&xe(t,"alt",n._v$2=r),n}),{_v$:void 0,_v$2:void 0}),t}}),Z(de,{when:!0,get children(){return Z(nd,{get file(){return e.file}})}})]}}),n),n.addEventListener("click",e.onRemoveClick),Se(n,Z(Zc,{class:"w-4"})),Se(t,Z(le,{get when(){return He(e.uploadProgressPercent)&&100!==e.uploadProgressPercent},get children(){return Z(Rd,{get progressPercent(){return e.uploadProgressPercent}})}}),null),t})(),Rd=e=>{const[t,n]=_(e.progressPercent??0);let o;return S((()=>{if(20===e.progressPercent){o=setInterval((()=>{t()<100&&n((e=>e+(Math.floor(10*Math.random())+1)))}),1e3)}})),I((()=>{clearInterval(o)})),(()=>{const e=Ad();return Se(e,Z(Uc.Root,{get value(){return t()},class:"flex items-center justify-center",get children(){return Z(Uc.Circle,{get children(){return[Z(Uc.CircleTrack,{}),Z(Uc.CircleRange,{})]}})}})),e})()},Nd=({newFile:e,existingFiles:t,params:n,onError:o})=>{const r=n.sizeLimit??wt("NEXT_PUBLIC_BOT_FILE_UPLOAD_MAX_SIZE");if(r&&e.size>1024*r*1024)return void o({title:"File too large",description:`${e.name} is larger than ${r}MB`});if(0===t.length)return e;let i=e.name,a=1;for(;t.some((e=>e.name===i));){const t=e.name.lastIndexOf("."),n=-1!==t?e.name.slice(t):"";i=`${e.name.slice(0,t)}(${a})${n}`,a++}return new File([e],i,{type:e.type})},Ld=(e=>{const t=Ql.machine({id:"1",...e});return{...Ql.connect(t,t.send,Mr),machine:t}})({placement:"bottom-end",gap:24}),Dd=async({apiHost:e,files:t,onUploadProgress:n})=>{const o=[];let r=0;for(const{input:i,file:a}of t){n&&n({progress:r/t.length*100,fileIndex:r}),r+=1;const{data:s}=await ze({method:"POST",url:`${e}/api/v2/generate-upload-url`,body:{fileName:i.fileName,sessionId:i.sessionId,fileType:a.type}});if(s?.presignedUrl){const e=new FormData;Object.entries(s.formData).forEach((([t,n])=>{e.append(t,n)})),e.append("file",a);if(!(await fetch(s.presignedUrl,{method:"POST",body:e})).ok)continue;o.push({url:s.fileUrl,type:a.type})}}return o};let Md=function(e){return e.COLOR="Color",e.IMAGE="Image",e.NONE="None",e}({});const Ud="#303235",Bd="#FFFFFF",Fd="Open Sans",jd=Md.COLOR,zd="#ffffff",Hd="absolute",Vd="medium",Gd="transparent",Wd=Ud,qd=Bd,Kd="#0042DA",Yd=Bd,Xd=Ud,Zd=!0,Jd=!1,Qd=ve('<div><button class="p-0.5 rounded-full" aria-label="Stop recording"></button><div class="relative flex w-full"><canvas class="w-full h-[56px]"></canvas><div class="absolute left-gradient w-2 left-0 h-[56px]"></div><div class="absolute right-gradient w-3 right-0 h-[56px]"></div></div><span class="time-container flex-none w-[35px] font-bold text-sm">'),eu=e=>{const[t,n]=_(0);let o,r,i,a,s,l,c,d,u,p=[],g=0;const h=Ke(e.buttonsTheme?.backgroundColor??Kd).join(", "),f=()=>{if(!i||!o||!u)return;const e=performance.now(),t=e-u;u=e,i.clearRect(0,0,o.width,o.height),i.fillStyle=`rgba(${h}, 0.2)`;for(let e=0;e<(o.width+3)/6;e++){const t=6*e-g,n=.1*o.height,r=(o.height-n)/2;i.beginPath(),i.roundRect(t,r,3,n,5),i.fill()}i.fillStyle=`rgba(${h}, 1)`;for(let e=0;e<p.length;e++){const t=o.width+6*(e+1)-g,n=o.height*(p[e]/100),r=(o.height-n)/2;i.beginPath(),i.roundRect(t,r,3,n,5),i.fill()}g+=t/1e3*60,r=requestAnimationFrame(f)},m=()=>{i&&o&&i.clearRect(0,0,o.width,o.height),g=0,s?.disconnect(),s=void 0,l?.disconnect(),l=void 0,a?.close(),a=void 0,c?.getTracks().forEach((e=>e.stop())),c=void 0,p=[],clearTimeout(d),n(0),cancelAnimationFrame(r),e.onAbortRecording()};return S((()=>{"asking"===e.recordingStatus?(async()=>{o&&(c=await navigator.mediaDevices.getUserMedia({audio:!0}),e.onRecordingConfirmed(c),i||(i=o.getContext("2d")??void 0),d=setInterval((()=>{n((e=>e+1))}),1e3),a=new AudioContext,s=await tu(a),l=a.createMediaStreamSource(c),l.connect(s),s.connect(a.destination),s.port.onmessage=e=>{6*((o.width+3)/6+p.length)<o.width+g&&p.push(Math.min(Math.max(e.data,5),90))},u=performance.now(),r=requestAnimationFrame(f))})():"stopped"===e.recordingStatus&&m()})),I((()=>{m()})),(()=>{const n=Qd(),r=n.firstChild,i=r.nextSibling,a=i.firstChild,s=i.nextSibling;r.addEventListener("click",m),Se(r,Z(Zc,{class:"w-4"}));return"function"==typeof o?Te(o,a):o=a,Se(s,(()=>nu(t()))),T((()=>ke(n,Ze("w-full gap-2 items-center transition-opacity px-2 typebot-recorder","started"===e.recordingStatus?"opacity-1 flex":"opacity-0 hidden")))),n})()},tu=async e=>{const t=new Blob(['\nconst gainFactor = 3;\n\nclass VolumeProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n }\n\n process(inputs) {\n const input = inputs[0];\n if (input.length > 0) {\n const channelData = input[0];\n let sum = 0;\n for (let i = 0; i < channelData.length; i++) {\n sum += channelData[i] * channelData[i];\n }\n const rms = Math.sqrt(sum / channelData.length);\n this.port.postMessage(rms * 100 * gainFactor)\n }\n return true;\n }\n}\n\nregisterProcessor("volume-processor", VolumeProcessor);\n\n'],{type:"application/javascript"}),n=URL.createObjectURL(t);return await e.audioWorklet.addModule(n),new AudioWorkletNode(e,"volume-processor")},nu=e=>`${Math.floor(e/60)}:${(e%60).toString().padStart(2,"0")}`,ou=ve('<svg viewBox="0 0 384 512" stroke="currentColor" fill="currentColor"><path d="M192 0C139 0 96 43 96 96l0 160c0 53 43 96 96 96s96-43 96-96l0-160c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 89.1 66.2 162.7 152 174.4l0 33.6-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l72 0 72 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-33.6c85.8-11.7 152-85.3 152-174.4l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 70.7-57.3 128-128 128s-128-57.3-128-128l0-40z">'),ru=e=>(()=>{const t=ou();return _e(t,e,!0,!0),t})();function iu(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})})),n}var au={},su=function(e,t){return su=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},su(e,t)};function lu(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}su(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var cu=function(){return cu=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},cu.apply(this,arguments)};function du(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function uu(e,t,n,o){var r,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function pu(e,t){return function(n,o){t(n,o,e)}}function gu(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function hu(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))}function fu(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}var mu=Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]};function bu(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||mu(t,e,n)}function yu(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vu(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function wu(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(vu(arguments[t]));return e}function xu(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}function ku(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}function _u(e){return this instanceof _u?(this.v=e,this):new _u(e)}function Tu(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,r=n.apply(e,t||[]),i=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(e){r[e]&&(o[e]=function(t){return new Promise((function(n,o){i.push([e,t,n,o])>1||s(e,t)}))})}function s(e,t){try{!function(e){e.value instanceof _u?Promise.resolve(e.value.v).then(l,c):d(i[0][2],e)}(r[e](t))}catch(e){d(i[0][3],e)}}function l(e){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function Su(e){var t,n;return t={},o("next"),o("throw",(function(e){throw e})),o("return"),t[Symbol.iterator]=function(){return this},t;function o(o,r){t[o]=e[o]?function(t){return(n=!n)?{value:_u(e[o](t)),done:!1}:r?r(t):t}:r}}function Eu(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=yu(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(n){t[n]=e[n]&&function(t){return new Promise((function(o,r){(function(e,t,n,o){Promise.resolve(o).then((function(t){e({value:t,done:n})}),t)})(o,r,(t=e[n](t)).done,t.value)}))}}}function Cu(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Pu=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Iu(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&mu(t,e,n);return Pu(t,e),t}function Ou(e){return e&&e.__esModule?e:{default:e}}function Au(e,t,n,o){if("a"===n&&!o)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?o:"a"===n?o.call(e):o?o.value:t.get(e)}function $u(e,t,n,o,r){if("m"===o)throw new TypeError("Private method is not writable");if("a"===o&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===o?r.call(e,n):r?r.value=n:t.set(e,n),n}function Ru(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function Nu(e,t,n){if(null!=t){if("object"!=typeof t)throw new TypeError("Object expected.");var o;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");o=t[Symbol.asyncDispose]}if(void 0===o){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");o=t[Symbol.dispose]}if("function"!=typeof o)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:o,async:n})}else n&&e.stack.push({async:!0});return t}var Lu="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var o=new Error(n);return o.name="SuppressedError",o.error=e,o.suppressed=t,o};function Du(e){function t(t){e.error=e.hasError?new Lu(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var o=e.stack.pop();try{var r=o.dispose&&o.dispose.call(o.value);if(o.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var Mu,Uu={__extends:lu,__assign:cu,__rest:du,__decorate:uu,__param:pu,__metadata:gu,__awaiter:hu,__generator:fu,__createBinding:mu,__exportStar:bu,__values:yu,__read:vu,__spread:wu,__spreadArrays:xu,__spreadArray:ku,__await:_u,__asyncGenerator:Tu,__asyncDelegator:Su,__asyncValues:Eu,__makeTemplateObject:Cu,__importStar:Iu,__importDefault:Ou,__classPrivateFieldGet:Au,__classPrivateFieldSet:$u,__classPrivateFieldIn:Ru,__addDisposableResource:Nu,__disposeResources:Du},Bu=iu(Object.freeze({__proto__:null,__addDisposableResource:Nu,get __assign(){return cu},__asyncDelegator:Su,__asyncGenerator:Tu,__asyncValues:Eu,__await:_u,__awaiter:hu,__classPrivateFieldGet:Au,__classPrivateFieldIn:Ru,__classPrivateFieldSet:$u,__createBinding:mu,__decorate:uu,__disposeResources:Du,__esDecorate:function(e,t,n,o,r,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=o.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?o.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,o.name):{}),p=!1,g=n.length-1;g>=0;g--){var h={};for(var f in o)h[f]="access"===f?{}:o[f];for(var f in o.access)h.access[f]=o.access[f];h.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var m=(0,n[g])("accessor"===l?{get:u.get,set:u.set}:u[c],h);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(s=a(m.get))&&(u.get=s),(s=a(m.set))&&(u.set=s),(s=a(m.init))&&r.unshift(s)}else(s=a(m))&&("field"===l?r.unshift(s):u[c]=s)}d&&Object.defineProperty(d,o.name,u),p=!0},__exportStar:bu,__extends:lu,__generator:fu,__importDefault:Ou,__importStar:Iu,__makeTemplateObject:Cu,__metadata:gu,__param:pu,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:vu,__rest:du,__runInitializers:function(e,t,n){for(var o=arguments.length>2,r=0;r<t.length;r++)n=o?t[r].call(e,n):t[r].call(e);return o?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:wu,__spreadArray:ku,__spreadArrays:xu,__values:yu,default:Uu})),Fu={},ju={},zu={};function Hu(){if(Mu)return zu;Mu=1,Object.defineProperty(zu,"__esModule",{value:!0}),zu.WebmBase=void 0;return zu.WebmBase=class{constructor(e="Unknown",t=0){this.name=e,this.start=t}getType(){return"Unknown"}updateBySource(){}setSource(e){this.source=e,this.updateBySource()}updateByData(){}setData(e){this.data=e,this.updateByData()}getValue(){return this.data}setValue(e){this.setData(e)}},zu}var Vu,Gu,Wu={},qu={},Ku={};function Yu(){return Vu||(Vu=1,Object.defineProperty(Ku,"__esModule",{value:!0}),Ku.SectionType=void 0,function(e){e.Container="Container",e.Uint="Uint",e.Int="Int",e.Float="Float",e.String="String",e.Date="Date",e.Binary="Binary"}(e||(Ku.SectionType=e={}))),Ku;var e}function Xu(){if(Gu)return qu;Gu=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.sections=void 0;const e=Yu();return qu.sections={172351395:{name:"EBML",type:e.SectionType.Container},646:{name:"EBMLVersion",type:e.SectionType.Uint},759:{name:"EBMLReadVersion",type:e.SectionType.Uint},754:{name:"EBMLMaxIDLength",type:e.SectionType.Uint},755:{name:"EBMLMaxSizeLength",type:e.SectionType.Uint},642:{name:"DocType",type:e.SectionType.String},647:{name:"DocTypeVersion",type:e.SectionType.Uint},645:{name:"DocTypeReadVersion",type:e.SectionType.Uint},108:{name:"Void",type:e.SectionType.Binary},63:{name:"CRC-32",type:e.SectionType.Binary},190023271:{name:"SignatureSlot",type:e.SectionType.Container},16010:{name:"SignatureAlgo",type:e.SectionType.Uint},16026:{name:"SignatureHash",type:e.SectionType.Uint},16037:{name:"SignaturePublicKey",type:e.SectionType.Binary},16053:{name:"Signature",type:e.SectionType.Binary},15963:{name:"SignatureElements",type:e.SectionType.Container},15995:{name:"SignatureElementList",type:e.SectionType.Container},9522:{name:"SignedElement",type:e.SectionType.Binary},139690087:{name:"Segment",type:e.SectionType.Container},21863284:{name:"SeekHead",type:e.SectionType.Container},3515:{name:"Seek",type:e.SectionType.Container},5035:{name:"SeekID",type:e.SectionType.Binary},5036:{name:"SeekPosition",type:e.SectionType.Uint},88713574:{name:"Info",type:e.SectionType.Container},13220:{name:"SegmentUID",type:e.SectionType.Binary},13188:{name:"SegmentFilename",type:e.SectionType.String},1882403:{name:"PrevUID",type:e.SectionType.Binary},1868715:{name:"PrevFilename",type:e.SectionType.String},2013475:{name:"NextUID",type:e.SectionType.Binary},1999803:{name:"NextFilename",type:e.SectionType.String},1092:{name:"SegmentFamily",type:e.SectionType.Binary},10532:{name:"ChapterTranslate",type:e.SectionType.Container},10748:{name:"ChapterTranslateEditionUID",type:e.SectionType.Uint},10687:{name:"ChapterTranslateCodec",type:e.SectionType.Uint},10661:{name:"ChapterTranslateID",type:e.SectionType.Binary},710577:{name:"TimecodeScale",type:e.SectionType.Uint},1161:{name:"Duration",type:e.SectionType.Float},1121:{name:"DateUTC",type:e.SectionType.Date},15273:{name:"Title",type:e.SectionType.String},3456:{name:"MuxingApp",type:e.SectionType.String},5953:{name:"WritingApp",type:e.SectionType.String},103:{name:"Timecode",type:e.SectionType.Uint},6228:{name:"SilentTracks",type:e.SectionType.Container},6359:{name:"SilentTrackNumber",type:e.SectionType.Uint},39:{name:"Position",type:e.SectionType.Uint},43:{name:"PrevSize",type:e.SectionType.Uint},35:{name:"SimpleBlock",type:e.SectionType.Binary},32:{name:"BlockGroup",type:e.SectionType.Container},33:{name:"Block",type:e.SectionType.Binary},34:{name:"BlockVirtual",type:e.SectionType.Binary},13729:{name:"BlockAdditions",type:e.SectionType.Container},38:{name:"BlockMore",type:e.SectionType.Container},110:{name:"BlockAddID",type:e.SectionType.Uint},37:{name:"BlockAdditional",type:e.SectionType.Binary},27:{name:"BlockDuration",type:e.SectionType.Uint},122:{name:"ReferencePriority",type:e.SectionType.Uint},123:{name:"ReferenceBlock",type:e.SectionType.Int},125:{name:"ReferenceVirtual",type:e.SectionType.Int},36:{name:"CodecState",type:e.SectionType.Binary},13730:{name:"DiscardPadding",type:e.SectionType.Int},14:{name:"Slices",type:e.SectionType.Container},104:{name:"TimeSlice",type:e.SectionType.Container},76:{name:"LaceNumber",type:e.SectionType.Uint},77:{name:"FrameNumber",type:e.SectionType.Uint},75:{name:"BlockAdditionID",type:e.SectionType.Uint},78:{name:"Delay",type:e.SectionType.Uint},79:{name:"SliceDuration",type:e.SectionType.Uint},72:{name:"ReferenceFrame",type:e.SectionType.Container},73:{name:"ReferenceOffset",type:e.SectionType.Uint},74:{name:"ReferenceTimeCode",type:e.SectionType.Uint},47:{name:"EncryptedBlock",type:e.SectionType.Binary},106212971:{name:"Tracks",type:e.SectionType.Container},46:{name:"TrackEntry",type:e.SectionType.Container},87:{name:"TrackNumber",type:e.SectionType.Uint},13253:{name:"TrackUID",type:e.SectionType.Uint},3:{name:"TrackType",type:e.SectionType.Uint},57:{name:"FlagEnabled",type:e.SectionType.Uint},8:{name:"FlagDefault",type:e.SectionType.Uint},5546:{name:"FlagForced",type:e.SectionType.Uint},28:{name:"FlagLacing",type:e.SectionType.Uint},11751:{name:"MinCache",type:e.SectionType.Uint},11768:{name:"MaxCache",type:e.SectionType.Uint},254851:{name:"DefaultDuration",type:e.SectionType.Uint},216698:{name:"DefaultDecodedFieldDuration",type:e.SectionType.Uint},209231:{name:"TrackTimecodeScale",type:e.SectionType.Float},4991:{name:"TrackOffset",type:e.SectionType.Int},5614:{name:"MaxBlockAdditionID",type:e.SectionType.Uint},4974:{name:"Name",type:e.SectionType.String},177564:{name:"Language",type:e.SectionType.String},6:{name:"CodecID",type:e.SectionType.String},9122:{name:"CodecPrivate",type:e.SectionType.Binary},362120:{name:"CodecName",type:e.SectionType.String},13382:{name:"AttachmentLink",type:e.SectionType.Uint},1742487:{name:"CodecSettings",type:e.SectionType.String},1785920:{name:"CodecInfoURL",type:e.SectionType.String},438848:{name:"CodecDownloadURL",type:e.SectionType.String},42:{name:"CodecDecodeAll",type:e.SectionType.Uint},12203:{name:"TrackOverlay",type:e.SectionType.Uint},5802:{name:"CodecDelay",type:e.SectionType.Uint},5819:{name:"SeekPreRoll",type:e.SectionType.Uint},9764:{name:"TrackTranslate",type:e.SectionType.Container},9980:{name:"TrackTranslateEditionUID",type:e.SectionType.Uint},9919:{name:"TrackTranslateCodec",type:e.SectionType.Uint},9893:{name:"TrackTranslateTrackID",type:e.SectionType.Binary},96:{name:"Video",type:e.SectionType.Container},26:{name:"FlagInterlaced",type:e.SectionType.Uint},5048:{name:"StereoMode",type:e.SectionType.Uint},5056:{name:"AlphaMode",type:e.SectionType.Uint},5049:{name:"OldStereoMode",type:e.SectionType.Uint},48:{name:"PixelWidth",type:e.SectionType.Uint},58:{name:"PixelHeight",type:e.SectionType.Uint},5290:{name:"PixelCropBottom",type:e.SectionType.Uint},5307:{name:"PixelCropTop",type:e.SectionType.Uint},5324:{name:"PixelCropLeft",type:e.SectionType.Uint},5341:{name:"PixelCropRight",type:e.SectionType.Uint},5296:{name:"DisplayWidth",type:e.SectionType.Uint},5306:{name:"DisplayHeight",type:e.SectionType.Uint},5298:{name:"DisplayUnit",type:e.SectionType.Uint},5299:{name:"AspectRatioType",type:e.SectionType.Uint},963876:{name:"ColourSpace",type:e.SectionType.Binary},1029411:{name:"GammaValue",type:e.SectionType.Float},230371:{name:"FrameRate",type:e.SectionType.Float},97:{name:"Audio",type:e.SectionType.Container},53:{name:"SamplingFrequency",type:e.SectionType.Float},14517:{name:"OutputSamplingFrequency",type:e.SectionType.Float},31:{name:"Channels",type:e.SectionType.Uint},15739:{name:"ChannelPositions",type:e.SectionType.Binary},8804:{name:"BitDepth",type:e.SectionType.Uint},98:{name:"TrackOperation",type:e.SectionType.Container},99:{name:"TrackCombinePlanes",type:e.SectionType.Container},100:{name:"TrackPlane",type:e.SectionType.Container},101:{name:"TrackPlaneUID",type:e.SectionType.Uint},102:{name:"TrackPlaneType",type:e.SectionType.Uint},105:{name:"TrackJoinBlocks",type:e.SectionType.Container},109:{name:"TrackJoinUID",type:e.SectionType.Uint},64:{name:"TrickTrackUID",type:e.SectionType.Uint},65:{name:"TrickTrackSegmentUID",type:e.SectionType.Binary},70:{name:"TrickTrackFlag",type:e.SectionType.Uint},71:{name:"TrickMasterTrackUID",type:e.SectionType.Uint},68:{name:"TrickMasterTrackSegmentUID",type:e.SectionType.Binary},11648:{name:"ContentEncodings",type:e.SectionType.Container},8768:{name:"ContentEncoding",type:e.SectionType.Container},4145:{name:"ContentEncodingOrder",type:e.SectionType.Uint},4146:{name:"ContentEncodingScope",type:e.SectionType.Uint},4147:{name:"ContentEncodingType",type:e.SectionType.Uint},4148:{name:"ContentCompression",type:e.SectionType.Container},596:{name:"ContentCompAlgo",type:e.SectionType.Uint},597:{name:"ContentCompSettings",type:e.SectionType.Binary},4149:{name:"ContentEncryption",type:e.SectionType.Container},2017:{name:"ContentEncAlgo",type:e.SectionType.Uint},2018:{name:"ContentEncKeyID",type:e.SectionType.Binary},2019:{name:"ContentSignature",type:e.SectionType.Binary},2020:{name:"ContentSigKeyID",type:e.SectionType.Binary},2021:{name:"ContentSigAlgo",type:e.SectionType.Uint},2022:{name:"ContentSigHashAlgo",type:e.SectionType.Uint},206814059:{name:"Cues",type:e.SectionType.Container},59:{name:"CuePoint",type:e.SectionType.Container},51:{name:"CueTime",type:e.SectionType.Uint},55:{name:"CueTrackPositions",type:e.SectionType.Container},119:{name:"CueTrack",type:e.SectionType.Uint},113:{name:"CueClusterPosition",type:e.SectionType.Uint},112:{name:"CueRelativePosition",type:e.SectionType.Uint},50:{name:"CueDuration",type:e.SectionType.Uint},4984:{name:"CueBlockNumber",type:e.SectionType.Uint},106:{name:"CueCodecState",type:e.SectionType.Uint},91:{name:"CueReference",type:e.SectionType.Container},22:{name:"CueRefTime",type:e.SectionType.Uint},23:{name:"CueRefCluster",type:e.SectionType.Uint},4959:{name:"CueRefNumber",type:e.SectionType.Uint},107:{name:"CueRefCodecState",type:e.SectionType.Uint},155296873:{name:"Attachments",type:e.SectionType.Container},8615:{name:"AttachedFile",type:e.SectionType.Container},1662:{name:"FileDescription",type:e.SectionType.String},1646:{name:"FileName",type:e.SectionType.String},1632:{name:"FileMimeType",type:e.SectionType.String},1628:{name:"FileData",type:e.SectionType.Binary},1710:{name:"FileUID",type:e.SectionType.Uint},1653:{name:"FileReferral",type:e.SectionType.Binary},1633:{name:"FileUsedStartTime",type:e.SectionType.Uint},1634:{name:"FileUsedEndTime",type:e.SectionType.Uint},4433776:{name:"Chapters",type:e.SectionType.Container},1465:{name:"EditionEntry",type:e.SectionType.Container},1468:{name:"EditionUID",type:e.SectionType.Uint},1469:{name:"EditionFlagHidden",type:e.SectionType.Uint},1499:{name:"EditionFlagDefault",type:e.SectionType.Uint},1501:{name:"EditionFlagOrdered",type:e.SectionType.Uint},54:{name:"ChapterAtom",type:e.SectionType.Container},13252:{name:"ChapterUID",type:e.SectionType.Uint},5716:{name:"ChapterStringUID",type:e.SectionType.String},17:{name:"ChapterTimeStart",type:e.SectionType.Uint},18:{name:"ChapterTimeEnd",type:e.SectionType.Uint},24:{name:"ChapterFlagHidden",type:e.SectionType.Uint},1432:{name:"ChapterFlagEnabled",type:e.SectionType.Uint},11879:{name:"ChapterSegmentUID",type:e.SectionType.Binary},11964:{name:"ChapterSegmentEditionUID",type:e.SectionType.Uint},9155:{name:"ChapterPhysicalEquiv",type:e.SectionType.Uint},15:{name:"ChapterTrack",type:e.SectionType.Container},9:{name:"ChapterTrackNumber",type:e.SectionType.Uint},0:{name:"ChapterDisplay",type:e.SectionType.Container},5:{name:"ChapString",type:e.SectionType.String},892:{name:"ChapLanguage",type:e.SectionType.String},894:{name:"ChapCountry",type:e.SectionType.String},10564:{name:"ChapProcess",type:e.SectionType.Container},10581:{name:"ChapProcessCodecID",type:e.SectionType.Uint},1293:{name:"ChapProcessPrivate",type:e.SectionType.Binary},10513:{name:"ChapProcessCommand",type:e.SectionType.Container},10530:{name:"ChapProcessTime",type:e.SectionType.Uint},10547:{name:"ChapProcessData",type:e.SectionType.Binary},39109479:{name:"Tags",type:e.SectionType.Container},13171:{name:"Tag",type:e.SectionType.Container},9152:{name:"Targets",type:e.SectionType.Container},10442:{name:"TargetTypeValue",type:e.SectionType.Uint},9162:{name:"TargetType",type:e.SectionType.String},9157:{name:"TagTrackUID",type:e.SectionType.Uint},9161:{name:"TagEditionUID",type:e.SectionType.Uint},9156:{name:"TagChapterUID",type:e.SectionType.Uint},9158:{name:"TagAttachmentUID",type:e.SectionType.Uint},10184:{name:"SimpleTag",type:e.SectionType.Container},1443:{name:"TagName",type:e.SectionType.String},1146:{name:"TagLanguage",type:e.SectionType.String},1156:{name:"TagDefault",type:e.SectionType.Uint},1159:{name:"TagString",type:e.SectionType.String},1157:{name:"TagBinary",type:e.SectionType.Binary},5552:{name:"Colour",type:e.SectionType.Container},5553:{name:"MatrixCoefficients",type:e.SectionType.Uint},5554:{name:"BitsPerChannel",type:e.SectionType.Uint},5555:{name:"ChromaSubsamplingHorz",type:e.SectionType.Uint},5556:{name:"ChromaSubsamplingVert",type:e.SectionType.Uint},5557:{name:"CbSubsamplingHorz",type:e.SectionType.Uint},5558:{name:"CbSubsamplingVert",type:e.SectionType.Uint},5559:{name:"ChromaSitingHorz",type:e.SectionType.Uint},5560:{name:"ChromaSitingVert",type:e.SectionType.Uint},5561:{name:"Range",type:e.SectionType.Uint},5562:{name:"TransferCharacteristics",type:e.SectionType.Uint},5563:{name:"Primaries",type:e.SectionType.Uint},5564:{name:"MaxCLL",type:e.SectionType.Uint},5565:{name:"MaxFALL",type:e.SectionType.Uint}},qu}var Zu,Ju={};function Qu(){if(Zu)return Ju;Zu=1,Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.WebmUint=void 0;const e=Hu();function t(e){return e.length%2==1?"0"+e:e}let n=class extends e.WebmBase{constructor(e,t=0){super(e,t)}getType(){return"Uint"}updateBySource(){this.data="";for(let e=0;e<this.source.length;e++){const n=this.source[e].toString(16);this.data+=t(n)}}updateByData(){const e=this.data.length/2;this.source=new Uint8Array(e);for(let t=0;t<e;t++){const e=this.data.substring(2*t,2*t+2);this.source[t]=parseInt(e,16)}}getValue(){return parseInt(this.data,16)}setValue(e){this.setData(t(e.toString(16)))}};return Ju.WebmUint=n,Ju}var ep,tp={};function np(){if(ep)return tp;ep=1,Object.defineProperty(tp,"__esModule",{value:!0}),tp.WebmFloat=void 0;const e=Hu();let t=class extends e.WebmBase{constructor(e,t=0){super(e,t)}getType(){return"Float"}getFloatArrayType(){return this.source&&4===this.source.length?Float32Array:Float64Array}updateBySource(){const e=this.source.reverse(),t=new(this.getFloatArrayType())(e.buffer);this.data=t[0]}updateByData(){const e=new(this.getFloatArrayType())([this.data]),t=new Uint8Array(e.buffer);this.source=t.reverse()}};return tp.WebmFloat=t,tp}var op,rp,ip={};function ap(){if(op)return ip;op=1,Object.defineProperty(ip,"__esModule",{value:!0}),ip.WebmString=void 0;const e=Hu();let t=class extends e.WebmBase{constructor(e,t=0){super(e,t)}getType(){return"String"}updateBySource(){this.data=this.source}updateByData(){this.source=this.data}getValue(){let e="";return this.source.forEach((t=>{e+=String.fromCharCode(t)})),e}};return ip.WebmString=t,ip}function sp(){if(rp)return Wu;rp=1,Object.defineProperty(Wu,"__esModule",{value:!0}),Wu.WebmContainer=void 0;const e=Hu(),t=Xu(),n=Yu(),o=Qu(),r=np(),i=ap();let a=class a extends e.WebmBase{constructor(e,t=!1,n=0){super(e,n),this.isInfinite=t,this.offset=0}getType(){return"Container"}readByte(){return this.source[this.offset++]}readUint(){const e=this.readByte(),t=8-e.toString(2).length;let n=e-(1<<7-t);for(let e=0;e<t;e++)n<<=8,n|=this.readByte();return n}updateBySource(){var s;let l;for(this.data=[],this.offset=0;this.offset<this.source.length;this.offset=l){const c=this.offset,d=this.readUint(),{name:u,type:p}=null!==(s=t.sections[d])&&void 0!==s?s:{},g=this.readUint();l=this.source.length,g>=0&&(l=Math.min(this.offset+g,l));const h=this.source.slice(this.offset,l);let f;switch(p){case n.SectionType.Container:f=new a(u,g<0,c);break;case n.SectionType.Uint:f=new o.WebmUint(u,c);break;case n.SectionType.Float:f=new r.WebmFloat(u,c);break;case n.SectionType.String:f=new i.WebmString(u,c);break;default:f=new e.WebmBase(u,c)}f.setSource(h),this.data.push({id:d,idHex:d.toString(16),data:f})}}writeUint(e,t=!1){let n;for(n=1;(e<0||e>=1<<7*n)&&n<8;n++);if(!t){for(let t=0;t<n;t++)this.source[this.offset+t]=e>>8*(n-1-t)&255;this.source[this.offset]&=(1<<8-n)-1,this.source[this.offset]|=1<<8-n}this.offset+=n}writeSections(e=!1){this.offset=0;for(let t=0;t<this.data.length;t++){const n=this.data[t],o=n.data.source,r=o.length;this.writeUint(n.id,e),this.writeUint(n.data instanceof a&&n.data.isInfinite?-1:r,e),e||this.source.set(o,this.offset),this.offset+=r}return this.offset}updateByData(){const e=this.writeSections(!0);this.source=new Uint8Array(e),this.writeSections()}getSectionById(e){for(let t=0;t<this.data.length;t++){const n=this.data[t];if(n.id===e)return n.data}return null}};return Wu.WebmContainer=a,Wu}var lp,cp={};var dp,up,pp={};function gp(){return up||(up=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Bu;t.__exportStar(Hu(),e),t.__exportStar(sp(),e),t.__exportStar(function(){if(lp)return cp;lp=1,Object.defineProperty(cp,"__esModule",{value:!0}),cp.WebmFile=void 0;const e=Bu,t=sp();let n=class n extends t.WebmContainer{constructor(e){super("File"),this.setSource(e)}getType(){return"File"}toBlob(e="video/webm"){return new Blob([this.source.buffer],{type:e})}static blobToArray(e){return new Promise(((t,n)=>{try{const o=new FileReader;o.onloadend=()=>{try{t(new Uint8Array(o.result))}catch(e){n(e)}},o.readAsArrayBuffer(e)}catch(e){n(e)}}))}static fromBlob(t){return e.__awaiter(this,void 0,void 0,(function*(){const e=yield n.blobToArray(t);return new n(e)}))}};return cp.WebmFile=n,cp}(),e),t.__exportStar(np(),e),t.__exportStar(ap(),e),t.__exportStar(Qu(),e),t.__exportStar(Yu(),e),t.__exportStar((dp||(dp=1,Object.defineProperty(pp,"__esModule",{value:!0})),pp),e),t.__exportStar(Xu(),e)}(ju)),ju}var hp,fp,mp={};function bp(){if(hp)return mp;hp=1,Object.defineProperty(mp,"__esModule",{value:!0}),mp.fixParsedWebmDuration=void 0;const e=gp();return mp.fixParsedWebmDuration=(t,n,o={})=>{let r=o.logger;void 0===r?r=e=>console.debug(e):r||(r=()=>{});const i=t.getSectionById(139690087);if(!i)return r("[fix-webm-duration] Segment section is missing"),!1;const a=i.getSectionById(88713574);if(!a)return r("[fix-webm-duration] Info section is missing"),!1;const s=a.getSectionById(710577);if(!s)return r("[fix-webm-duration] TimecodeScale section is missing"),!1;let l=a.getSectionById(1161);if(l){if(!(l.getValue()<=0))return r(`[fix-webm-duration] Duration section is present, and the value is ${l.getValue()}`),!1;r(`[fix-webm-duration] Duration section is present, but the value is ${l.getValue()}`),l.setValue(n)}else r("[fix-webm-duration] Duration section is missing"),l=new e.WebmFloat("Duration"),l.setValue(n),a.data.push({id:1161,data:l});return s.setValue(1e6),a.updateByData(),i.updateByData(),t.updateByData(),!0},mp}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=Bu;t.__exportStar(function(){if(fp)return Fu;fp=1,Object.defineProperty(Fu,"__esModule",{value:!0}),Fu.fixWebmDuration=void 0;const e=Bu,t=gp(),n=bp();return Fu.fixWebmDuration=(o,r,i)=>e.__awaiter(void 0,void 0,void 0,(function*(){try{const e=yield t.WebmFile.fromBlob(o);if((0,n.fixParsedWebmDuration)(e,r,i))return e.toBlob(o.type)}catch(e){}return o})),Fu}(),e),t.__exportStar(bp(),e)}(au);const yp=ve('<div class="p-2 flex gap-2 border-gray-100 overflow-auto">'),vp=ve("<div>"),wp=ve("<div><div>"),xp=e=>{const[t,n]=_(e.defaultValue??""),[o,r]=_([]),[i,a]=_(void 0),[s,l]=_(!1),[c,d]=_("stopped");let u,p,g=[];const h=e=>n(e),f=async()=>{if("started"===c()&&p)p.stop();else if(""!==u?.value&&u?.reportValidity()){let n;if(o().length>0){a(void 0);const t=await Dd({apiHost:e.context.apiHost??xt({ignoreChatApiUrl:!0}),files:o().map((t=>({file:t,input:{sessionId:e.context.sessionId,fileName:t.name}}))),onUploadProgress:a});n=t?.filter(He)}e.onSubmit({type:"text",value:u?.value??t(),attachments:n})}else u?.focus()},m=t=>{e.block.options?.isLong||"Enter"===t.key&&f()},b=t=>{e.block.options?.isLong&&"Enter"===t.key&&(t.metaKey||t.ctrlKey)&&f()};P((()=>{!Kt()&&u&&u.focus({preventScroll:!0}),window.addEventListener("message",y)})),I((()=>{window.removeEventListener("message",y)}));const y=e=>{const{data:t}=e;t.isFromTypebot&&"setInputValue"===t.command&&n(t.value)},v=e=>{e.preventDefault(),l(!0)},w=()=>l(!1),x=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer?.files&&k(e.dataTransfer.files)},k=e=>{const t=Array.from(e).map((e=>Nd({existingFiles:o(),newFile:e,params:{sizeLimit:wt("NEXT_PUBLIC_BOT_FILE_UPLOAD_MAX_SIZE")},onError:({description:e,title:t})=>{Ld.create({description:e,title:t})}}))).filter(He);0!==t.length&&r((e=>[...t,...e]))},S=()=>{d("asking")},C=t=>{let n;const o=MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"video/mp4";p=new MediaRecorder(t,{mimeType:o}),p.ondataavailable=e=>{0!==e.data.size&&g.push(e.data)},p.onstart=()=>{n=Date.now()},p.onstop=async()=>{if("started"!==c()||0===g.length)return;const t=Date.now()-n,r=await au.fixWebmDuration(new Blob(g,{type:o}),t),i=new File([r],`rec-${e.block.id}-${Date.now()}.${"audio/webm"===o?"webm":"mp4"}`,{type:o});a(void 0);const s=(await Dd({apiHost:e.context.apiHost??xt({ignoreChatApiUrl:!0}),files:[{file:i,input:{sessionId:e.context.sessionId,fileName:i.name}}],onUploadProgress:a})).filter(He).map((e=>e.url));e.onSubmit({type:"recording",url:s[0]})},p.start(),d("started")},O=()=>{p?.stop(),d("stopped"),p=void 0,g=[]};return(()=>{const n=wp(),a=n.firstChild;return n.addEventListener("dragleave",w),n.addEventListener("dragover",v),n.addEventListener("drop",x),n.$$keydown=m,Se(a,Z(eu,{get recordingStatus(){return c()},get buttonsTheme(){return e.context.typebot.theme.chat?.buttons},onRecordingConfirmed:C,onAbortRecording:O}),null),Se(a,Z(le,{get when(){return"started"!==c()},get children(){return[Z(le,{get when(){return o().length},get children(){const e=yp();return e.style.setProperty("border-bottom-width","1px"),Se(e,Z(se,{get each(){return o()},children:(e,t)=>Z($d,{file:e,get uploadProgressPercent(){return E((()=>!!i()))()?E((()=>i()?.fileIndex===t()))()?20:t()<(i()?.fileIndex??0)?100:0:void 0},onRemoveClick:()=>(e=>{r((t=>t.filter(((t,n)=>n!==e))))})(t())})})),e}}),(()=>{const n=vp();return Se(n,(()=>{const n=E((()=>!!e.block.options?.isLong));return()=>n()?Z(cn,{ref(e){"function"==typeof u?u(e):u=e},onInput:h,onKeyDown:b,get value(){return t()},get placeholder(){return e.block.options?.labels?.placeholder??bd.placeholder}}):Z(sn,{ref(e){"function"==typeof u?u(e):u=e},onInput:h,get value(){return t()},get placeholder(){return e.block.options?.labels?.placeholder??bd.placeholder}})})(),null),Se(n,Z(le,{get when(){return(e.block.options?.attachments?.isEnabled??yd.isEnabled)&&e.block.options?.attachments?.saveVariableId},get children(){return Z(Pd,{onNewFiles:k,get class(){return Ze(e.block.options?.isLong?"ml-2":void 0)}})}}),null),T((()=>ke(n,Ze("flex justify-between px-2",e.block.options?.isLong?"items-end":"items-center")))),n})()]}}),null),Se(n,Z(ce,{get children(){return[Z(de,{get when(){return!t()&&"started"!==c()&&e.block.options?.audioClip?.isEnabled},get children(){return Z(tn,{class:"h-[56px] flex items-center","on:click":S,"aria-label":"Record voice",get children(){return Z(ru,{class:"flex w-6 h-6"})}})}}),Z(de,{when:!0,get children(){return Z(nn,{type:"button","on:click":f,get isDisabled(){return Boolean(i())},class:"h-[56px]",get children(){return e.block.options?.labels?.button}})}})]}}),null),T((t=>{const o=Ze("typebot-input-form flex w-full gap-2 items-end",e.block.options?.isLong&&"started"!==c()?"max-w-full":"max-w-[350px]"),r=Ze("relative typebot-input flex-col w-full",s()&&"filter brightness-95");return o!==t._v$&&ke(n,t._v$=o),r!==t._v$2&&ke(a,t._v$2=r),t}),{_v$:void 0,_v$2:void 0}),n})()};we(["keydown"]);const kp={button:fd,placeholder:"Type a number..."},_p=ve('<div class="typebot-input-form flex w-full gap-2 items-end max-w-[350px]"><div class="flex typebot-input w-full"><input class="focus:outline-none bg-transparent px-4 py-4 flex-1 w-full text-input" type="number">'),Tp=e=>{const[t,n]=_(e.defaultValue??""),[o,r,i]=[C(a=()=>t()),function(e){S((function(){const t=a();if(null==t)return void(e.value=t);const n=e.value;(0===t&&""===n||t!=n)&&(e.value=t+"")}))},function(e){return e.validity.badInput?a():""!=e.value?e.valueAsNumber:void 0}];var a;let s;const l=()=>{""!==s?.value&&s?.reportValidity()?e.onSubmit({type:"text",value:s?.value??t().toString()}):s?.focus()},c=e=>{"Enter"===e.key&&l()};P((()=>{!Kt()&&s&&s.focus({preventScroll:!0}),window.addEventListener("message",d)})),I((()=>{window.removeEventListener("message",d)}));const d=e=>{const{data:t}=e;t.isFromTypebot&&"setInputValue"===t.command&&n(t.value)};return(()=>{const t=_p(),a=t.firstChild.firstChild;t.$$keydown=c,a.$$input=e=>{n(i(e.currentTarget))},Te(r,a,(()=>!0));return"function"==typeof s?Te(s,a):s=a,a.style.setProperty("font-size","16px"),a.style.setProperty("appearance","auto"),a.value=o,Se(t,Z(nn,{type:"button",class:"h-[56px]","on:click":l,get children(){return e.block.options?.labels?.button}}),null),T((t=>{const n=e.block.options?.labels?.placeholder??kp.placeholder,o=e.block.options?.min,r=e.block.options?.max,i=e.block.options?.step??"any";return n!==t._v$&&xe(a,"placeholder",t._v$=n),o!==t._v$2&&xe(a,"min",t._v$2=o),r!==t._v$3&&xe(a,"max",t._v$3=r),i!==t._v$4&&xe(a,"step",t._v$4=i),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),t})()};we(["keydown","input"]);const Sp={button:fd,placeholder:"Type your email..."},Ep=ve('<div class="typebot-input-form flex w-full gap-2 items-end max-w-[350px]"><div class="flex typebot-input w-full">'),Cp=e=>{const[t,n]=_(e.defaultValue??"");let o;const r=e=>n(e),i=()=>{""!==o?.value&&o?.reportValidity()?e.onSubmit({type:"text",value:o?.value??t()}):o?.focus()},a=e=>{"Enter"===e.key&&i()};P((()=>{!Kt()&&o&&o.focus({preventScroll:!0}),window.addEventListener("message",s)})),I((()=>{window.removeEventListener("message",s)}));const s=e=>{const{data:t}=e;t.isFromTypebot&&"setInputValue"===t.command&&n(t.value)};return(()=>{const n=Ep(),s=n.firstChild;return n.$$keydown=a,Se(s,Z(sn,{ref(e){"function"==typeof o?o(e):o=e},get value(){return t()},get placeholder(){return e.block.options?.labels?.placeholder??Sp.placeholder},onInput:r,type:"email",autocomplete:"email"})),Se(n,Z(nn,{type:"button",class:"h-[56px]","on:click":i,get children(){return e.block.options?.labels?.button}}),null),n})()};we(["keydown"]);const Pp={button:fd,placeholder:"Type a URL..."},Ip=ve('<div class="typebot-input-form flex w-full gap-2 items-end max-w-[350px]"><div class="flex typebot-input w-full">'),Op=e=>{const[t,n]=_(e.defaultValue??"");let o;const r=e=>{n(e)},i=()=>{o&&!o?.value.startsWith("http")&&(o.value=`https://${o.value}`),""!==o?.value&&o?.reportValidity()?e.onSubmit({type:"text",value:o?.value??t()}):o?.focus()},a=e=>{"Enter"===e.key&&i()};P((()=>{!Kt()&&o&&o.focus({preventScroll:!0}),window.addEventListener("message",s)})),I((()=>{window.removeEventListener("message",s)}));const s=e=>{const{data:t}=e;t.isFromTypebot&&"setInputValue"===t.command&&n(t.value)};return(()=>{const n=Ip(),s=n.firstChild;return n.$$keydown=a,Se(s,Z(sn,{ref(e){"function"==typeof o?o(e):o=e},get value(){return t()},get placeholder(){return e.block.options?.labels?.placeholder??Pp.placeholder},onInput:r,type:"url",autocomplete:"url"})),Se(n,Z(nn,{type:"button",class:"h-[56px]","on:click":i,get children(){return e.block.options?.labels?.button}}),null),n})()};we(["keydown"]);const Ap=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2px" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9">'),$p=e=>(()=>{const t=Ap();return _e(t,e,!0,!0),t})(),Rp=[{name:"International",flag:"🌐",code:"INT",dial_code:null},{name:"Afghanistan",flag:"🇦🇫",code:"AF",dial_code:"+93"},{name:"Åland Islands",flag:"🇦🇽",code:"AX",dial_code:"+358"},{name:"Albania",flag:"🇦🇱",code:"AL",dial_code:"+355"},{name:"Algeria",flag:"🇩🇿",code:"DZ",dial_code:"+213"},{name:"American Samoa",flag:"🇦🇸",code:"AS",dial_code:"+1684"},{name:"Andorra",flag:"🇦🇩",code:"AD",dial_code:"+376"},{name:"Angola",flag:"🇦🇴",code:"AO",dial_code:"+244"},{name:"Anguilla",flag:"🇦🇮",code:"AI",dial_code:"+1264"},{name:"Antarctica",flag:"🇦🇶",code:"AQ",dial_code:"+672"},{name:"Antigua and Barbuda",flag:"🇦🇬",code:"AG",dial_code:"+1268"},{name:"Argentina",flag:"🇦🇷",code:"AR",dial_code:"+54"},{name:"Armenia",flag:"🇦🇲",code:"AM",dial_code:"+374"},{name:"Aruba",flag:"🇦🇼",code:"AW",dial_code:"+297"},{name:"Australia",flag:"🇦🇺",code:"AU",dial_code:"+61"},{name:"Austria",flag:"🇦🇹",code:"AT",dial_code:"+43"},{name:"Azerbaijan",flag:"🇦🇿",code:"AZ",dial_code:"+994"},{name:"Bahamas",flag:"🇧🇸",code:"BS",dial_code:"+1242"},{name:"Bahrain",flag:"🇧🇭",code:"BH",dial_code:"+973"},{name:"Bangladesh",flag:"🇧🇩",code:"BD",dial_code:"+880"},{name:"Barbados",flag:"🇧🇧",code:"BB",dial_code:"+1246"},{name:"Belarus",flag:"🇧🇾",code:"BY",dial_code:"+375"},{name:"Belgium",flag:"🇧🇪",code:"BE",dial_code:"+32"},{name:"Belize",flag:"🇧🇿",code:"BZ",dial_code:"+501"},{name:"Benin",flag:"🇧🇯",code:"BJ",dial_code:"+229"},{name:"Bermuda",flag:"🇧🇲",code:"BM",dial_code:"+1441"},{name:"Bhutan",flag:"🇧🇹",code:"BT",dial_code:"+975"},{name:"Bolivia, Plurinational State of bolivia",flag:"🇧🇴",code:"BO",dial_code:"+591"},{name:"Bosnia and Herzegovina",flag:"🇧🇦",code:"BA",dial_code:"+387"},{name:"Botswana",flag:"🇧🇼",code:"BW",dial_code:"+267"},{name:"Bouvet Island",flag:"🇧🇻",code:"BV",dial_code:"+47"},{name:"Brazil",flag:"🇧🇷",code:"BR",dial_code:"+55"},{name:"British Indian Ocean Territory",flag:"🇮🇴",code:"IO",dial_code:"+246"},{name:"Brunei Darussalam",flag:"🇧🇳",code:"BN",dial_code:"+673"},{name:"Bulgaria",flag:"🇧🇬",code:"BG",dial_code:"+359"},{name:"Burkina Faso",flag:"🇧🇫",code:"BF",dial_code:"+226"},{name:"Burundi",flag:"🇧🇮",code:"BI",dial_code:"+257"},{name:"Cambodia",flag:"🇰🇭",code:"KH",dial_code:"+855"},{name:"Cameroon",flag:"🇨🇲",code:"CM",dial_code:"+237"},{name:"Canada",flag:"🇨🇦",code:"CA",dial_code:"+1"},{name:"Cape Verde",flag:"🇨🇻",code:"CV",dial_code:"+238"},{name:"Cayman Islands",flag:"🇰🇾",code:"KY",dial_code:"+345"},{name:"Central African Republic",flag:"🇨🇫",code:"CF",dial_code:"+236"},{name:"Chad",flag:"🇹🇩",code:"TD",dial_code:"+235"},{name:"Chile",flag:"🇨🇱",code:"CL",dial_code:"+56"},{name:"China",flag:"🇨🇳",code:"CN",dial_code:"+86"},{name:"Christmas Island",flag:"🇨🇽",code:"CX",dial_code:"+61"},{name:"Cocos (Keeling) Islands",flag:"🇨🇨",code:"CC",dial_code:"+61"},{name:"Colombia",flag:"🇨🇴",code:"CO",dial_code:"+57"},{name:"Comoros",flag:"🇰🇲",code:"KM",dial_code:"+269"},{name:"Congo",flag:"🇨🇬",code:"CG",dial_code:"+242"},{name:"Congo, The Democratic Republic of the Congo",flag:"🇨🇩",code:"CD",dial_code:"+243"},{name:"Cook Islands",flag:"🇨🇰",code:"CK",dial_code:"+682"},{name:"Costa Rica",flag:"🇨🇷",code:"CR",dial_code:"+506"},{name:"Cote d'Ivoire",flag:"🇨🇮",code:"CI",dial_code:"+225"},{name:"Croatia",flag:"🇭🇷",code:"HR",dial_code:"+385"},{name:"Cuba",flag:"🇨🇺",code:"CU",dial_code:"+53"},{name:"Cyprus",flag:"🇨🇾",code:"CY",dial_code:"+357"},{name:"Czech Republic",flag:"🇨🇿",code:"CZ",dial_code:"+420"},{name:"Denmark",flag:"🇩🇰",code:"DK",dial_code:"+45"},{name:"Djibouti",flag:"🇩🇯",code:"DJ",dial_code:"+253"},{name:"Dominica",flag:"🇩🇲",code:"DM",dial_code:"+1767"},{name:"Dominican Republic",flag:"🇩🇴",code:"DO",dial_code:"+1849"},{name:"Dominican Republic",flag:"🇩🇴",code:"DO",dial_code:"+1829"},{name:"Dominican Republic",flag:"🇩🇴",code:"DO",dial_code:"+1809"},{name:"Ecuador",flag:"🇪🇨",code:"EC",dial_code:"+593"},{name:"Egypt",flag:"🇪🇬",code:"EG",dial_code:"+20"},{name:"El Salvador",flag:"🇸🇻",code:"SV",dial_code:"+503"},{name:"Equatorial Guinea",flag:"🇬🇶",code:"GQ",dial_code:"+240"},{name:"Eritrea",flag:"🇪🇷",code:"ER",dial_code:"+291"},{name:"Estonia",flag:"🇪🇪",code:"EE",dial_code:"+372"},{name:"Ethiopia",flag:"🇪🇹",code:"ET",dial_code:"+251"},{name:"Falkland Islands (Malvinas)",flag:"🇫🇰",code:"FK",dial_code:"+500"},{name:"Faroe Islands",flag:"🇫🇴",code:"FO",dial_code:"+298"},{name:"Fiji",flag:"🇫🇯",code:"FJ",dial_code:"+679"},{name:"Finland",flag:"🇫🇮",code:"FI",dial_code:"+358"},{name:"France",flag:"🇫🇷",code:"FR",dial_code:"+33"},{name:"French Guiana",flag:"🇬🇫",code:"GF",dial_code:"+594"},{name:"French Polynesia",flag:"🇵🇫",code:"PF",dial_code:"+689"},{name:"French Southern Territories",flag:"🇹🇫",code:"TF",dial_code:"+262"},{name:"Gabon",flag:"🇬🇦",code:"GA",dial_code:"+241"},{name:"Gambia",flag:"🇬🇲",code:"GM",dial_code:"+220"},{name:"Georgia",flag:"🇬🇪",code:"GE",dial_code:"+995"},{name:"Germany",flag:"🇩🇪",code:"DE",dial_code:"+49"},{name:"Ghana",flag:"🇬🇭",code:"GH",dial_code:"+233"},{name:"Gibraltar",flag:"🇬🇮",code:"GI",dial_code:"+350"},{name:"Greece",flag:"🇬🇷",code:"GR",dial_code:"+30"},{name:"Greenland",flag:"🇬🇱",code:"GL",dial_code:"+299"},{name:"Grenada",flag:"🇬🇩",code:"GD",dial_code:"+1473"},{name:"Guadeloupe",flag:"🇬🇵",code:"GP",dial_code:"+590"},{name:"Guam",flag:"🇬🇺",code:"GU",dial_code:"+1671"},{name:"Guatemala",flag:"🇬🇹",code:"GT",dial_code:"+502"},{name:"Guernsey",flag:"🇬🇬",code:"GG",dial_code:"+44"},{name:"Guinea",flag:"🇬🇳",code:"GN",dial_code:"+224"},{name:"Guinea-Bissau",flag:"🇬🇼",code:"GW",dial_code:"+245"},{name:"Guyana",flag:"🇬🇾",code:"GY",dial_code:"+592"},{name:"Haiti",flag:"🇭🇹",code:"HT",dial_code:"+509"},{name:"Heard Island and Mcdonald Islands",flag:"🇭🇲",code:"HM",dial_code:"+672"},{name:"Holy See (Vatican City State)",flag:"🇻🇦",code:"VA",dial_code:"+379"},{name:"Honduras",flag:"🇭🇳",code:"HN",dial_code:"+504"},{name:"Hong Kong",flag:"🇭🇰",code:"HK",dial_code:"+852"},{name:"Hungary",flag:"🇭🇺",code:"HU",dial_code:"+36"},{name:"Iceland",flag:"🇮🇸",code:"IS",dial_code:"+354"},{name:"India",flag:"🇮🇳",code:"IN",dial_code:"+91"},{name:"Indonesia",flag:"🇮🇩",code:"ID",dial_code:"+62"},{name:"Iran, Islamic Republic of Persian Gulf",flag:"🇮🇷",code:"IR",dial_code:"+98"},{name:"Iraq",flag:"🇮🇶",code:"IQ",dial_code:"+964"},{name:"Ireland",flag:"🇮🇪",code:"IE",dial_code:"+353"},{name:"Isle of Man",flag:"🇮🇲",code:"IM",dial_code:"+44"},{name:"Israel",flag:"🇮🇱",code:"IL",dial_code:"+972"},{name:"Italy",flag:"🇮🇹",code:"IT",dial_code:"+39"},{name:"Jamaica",flag:"🇯🇲",code:"JM",dial_code:"+1876"},{name:"Japan",flag:"🇯🇵",code:"JP",dial_code:"+81"},{name:"Jersey",flag:"🇯🇪",code:"JE",dial_code:"+44"},{name:"Jordan",flag:"🇯🇴",code:"JO",dial_code:"+962"},{name:"Kazakhstan",flag:"🇰🇿",code:"KZ",dial_code:"+7"},{name:"Kenya",flag:"🇰🇪",code:"KE",dial_code:"+254"},{name:"Kiribati",flag:"🇰🇮",code:"KI",dial_code:"+686"},{name:"Korea, Democratic People's Republic of Korea",flag:"🇰🇵",code:"KP",dial_code:"+850"},{name:"Korea, Republic of South Korea",flag:"🇰🇷",code:"KR",dial_code:"+82"},{name:"Kosovo",flag:"🇽🇰",code:"XK",dial_code:"+383"},{name:"Kuwait",flag:"🇰🇼",code:"KW",dial_code:"+965"},{name:"Kyrgyzstan",flag:"🇰🇬",code:"KG",dial_code:"+996"},{name:"Laos",flag:"🇱🇦",code:"LA",dial_code:"+856"},{name:"Latvia",flag:"🇱🇻",code:"LV",dial_code:"+371"},{name:"Lebanon",flag:"🇱🇧",code:"LB",dial_code:"+961"},{name:"Lesotho",flag:"🇱🇸",code:"LS",dial_code:"+266"},{name:"Liberia",flag:"🇱🇷",code:"LR",dial_code:"+231"},{name:"Libyan Arab Jamahiriya",flag:"🇱🇾",code:"LY",dial_code:"+218"},{name:"Liechtenstein",flag:"🇱🇮",code:"LI",dial_code:"+423"},{name:"Lithuania",flag:"🇱🇹",code:"LT",dial_code:"+370"},{name:"Luxembourg",flag:"🇱🇺",code:"LU",dial_code:"+352"},{name:"Macao",flag:"🇲🇴",code:"MO",dial_code:"+853"},{name:"Macedonia",flag:"🇲🇰",code:"MK",dial_code:"+389"},{name:"Madagascar",flag:"🇲🇬",code:"MG",dial_code:"+261"},{name:"Malawi",flag:"🇲🇼",code:"MW",dial_code:"+265"},{name:"Malaysia",flag:"🇲🇾",code:"MY",dial_code:"+60"},{name:"Maldives",flag:"🇲🇻",code:"MV",dial_code:"+960"},{name:"Mali",flag:"🇲🇱",code:"ML",dial_code:"+223"},{name:"Malta",flag:"🇲🇹",code:"MT",dial_code:"+356"},{name:"Marshall Islands",flag:"🇲🇭",code:"MH",dial_code:"+692"},{name:"Martinique",flag:"🇲🇶",code:"MQ",dial_code:"+596"},{name:"Mauritania",flag:"🇲🇷",code:"MR",dial_code:"+222"},{name:"Mauritius",flag:"🇲🇺",code:"MU",dial_code:"+230"},{name:"Mayotte",flag:"🇾🇹",code:"YT",dial_code:"+262"},{name:"Mexico",flag:"🇲🇽",code:"MX",dial_code:"+52"},{name:"Micronesia, Federated States of Micronesia",flag:"🇫🇲",code:"FM",dial_code:"+691"},{name:"Moldova",flag:"🇲🇩",code:"MD",dial_code:"+373"},{name:"Monaco",flag:"🇲🇨",code:"MC",dial_code:"+377"},{name:"Mongolia",flag:"🇲🇳",code:"MN",dial_code:"+976"},{name:"Montenegro",flag:"🇲🇪",code:"ME",dial_code:"+382"},{name:"Montserrat",flag:"🇲🇸",code:"MS",dial_code:"+1664"},{name:"Morocco",flag:"🇲🇦",code:"MA",dial_code:"+212"},{name:"Mozambique",flag:"🇲🇿",code:"MZ",dial_code:"+258"},{name:"Myanmar",flag:"🇲🇲",code:"MM",dial_code:"+95"},{name:"Namibia",flag:"🇳🇦",code:"NA",dial_code:"+264"},{name:"Nauru",flag:"🇳🇷",code:"NR",dial_code:"+674"},{name:"Nepal",flag:"🇳🇵",code:"NP",dial_code:"+977"},{name:"Netherlands",flag:"🇳🇱",code:"NL",dial_code:"+31"},{name:"Netherlands Antilles",flag:"",code:"AN",dial_code:"+599"},{name:"New Caledonia",flag:"🇳🇨",code:"NC",dial_code:"+687"},{name:"New Zealand",flag:"🇳🇿",code:"NZ",dial_code:"+64"},{name:"Nicaragua",flag:"🇳🇮",code:"NI",dial_code:"+505"},{name:"Niger",flag:"🇳🇪",code:"NE",dial_code:"+227"},{name:"Nigeria",flag:"🇳🇬",code:"NG",dial_code:"+234"},{name:"Niue",flag:"🇳🇺",code:"NU",dial_code:"+683"},{name:"Norfolk Island",flag:"🇳🇫",code:"NF",dial_code:"+672"},{name:"Northern Mariana Islands",flag:"🇲🇵",code:"MP",dial_code:"+1670"},{name:"Norway",flag:"🇳🇴",code:"NO",dial_code:"+47"},{name:"Oman",flag:"🇴🇲",code:"OM",dial_code:"+968"},{name:"Pakistan",flag:"🇵🇰",code:"PK",dial_code:"+92"},{name:"Palau",flag:"🇵🇼",code:"PW",dial_code:"+680"},{name:"Palestinian Territory, Occupied",flag:"🇵🇸",code:"PS",dial_code:"+970"},{name:"Panama",flag:"🇵🇦",code:"PA",dial_code:"+507"},{name:"Papua New Guinea",flag:"🇵🇬",code:"PG",dial_code:"+675"},{name:"Paraguay",flag:"🇵🇾",code:"PY",dial_code:"+595"},{name:"Peru",flag:"🇵🇪",code:"PE",dial_code:"+51"},{name:"Philippines",flag:"🇵🇭",code:"PH",dial_code:"+63"},{name:"Pitcairn",flag:"🇵🇳",code:"PN",dial_code:"+64"},{name:"Poland",flag:"🇵🇱",code:"PL",dial_code:"+48"},{name:"Portugal",flag:"🇵🇹",code:"PT",dial_code:"+351"},{name:"Puerto Rico",flag:"🇵🇷",code:"PR",dial_code:"+1939"},{name:"Qatar",flag:"🇶🇦",code:"QA",dial_code:"+974"},{name:"Romania",flag:"🇷🇴",code:"RO",dial_code:"+40"},{name:"Russia",flag:"🇷🇺",code:"RU",dial_code:"+7"},{name:"Rwanda",flag:"🇷🇼",code:"RW",dial_code:"+250"},{name:"Reunion",flag:"🇷🇪",code:"RE",dial_code:"+262"},{name:"Saint Barthelemy",flag:"🇧🇱",code:"BL",dial_code:"+590"},{name:"Saint Helena, Ascension and Tristan Da Cunha",flag:"🇸🇭",code:"SH",dial_code:"+290"},{name:"Saint Kitts and Nevis",flag:"🇰🇳",code:"KN",dial_code:"+1869"},{name:"Saint Lucia",flag:"🇱🇨",code:"LC",dial_code:"+1758"},{name:"Saint Martin",flag:"🇲🇫",code:"MF",dial_code:"+590"},{name:"Saint Pierre and Miquelon",flag:"🇵🇲",code:"PM",dial_code:"+508"},{name:"Saint Vincent and the Grenadines",flag:"🇻🇨",code:"VC",dial_code:"+1784"},{name:"Samoa",flag:"🇼🇸",code:"WS",dial_code:"+685"},{name:"San Marino",flag:"🇸🇲",code:"SM",dial_code:"+378"},{name:"Sao Tome and Principe",flag:"🇸🇹",code:"ST",dial_code:"+239"},{name:"Saudi Arabia",flag:"🇸🇦",code:"SA",dial_code:"+966"},{name:"Senegal",flag:"🇸🇳",code:"SN",dial_code:"+221"},{name:"Serbia",flag:"🇷🇸",code:"RS",dial_code:"+381"},{name:"Seychelles",flag:"🇸🇨",code:"SC",dial_code:"+248"},{name:"Sierra Leone",flag:"🇸🇱",code:"SL",dial_code:"+232"},{name:"Singapore",flag:"🇸🇬",code:"SG",dial_code:"+65"},{name:"Slovakia",flag:"🇸🇰",code:"SK",dial_code:"+421"},{name:"Slovenia",flag:"🇸🇮",code:"SI",dial_code:"+386"},{name:"Solomon Islands",flag:"🇸🇧",code:"SB",dial_code:"+677"},{name:"Somalia",flag:"🇸🇴",code:"SO",dial_code:"+252"},{name:"South Africa",flag:"🇿🇦",code:"ZA",dial_code:"+27"},{name:"South Sudan",flag:"🇸🇸",code:"SS",dial_code:"+211"},{name:"South Georgia and the South Sandwich Islands",flag:"🇬🇸",code:"GS",dial_code:"+500"},{name:"Spain",flag:"🇪🇸",code:"ES",dial_code:"+34"},{name:"Sri Lanka",flag:"🇱🇰",code:"LK",dial_code:"+94"},{name:"Sudan",flag:"🇸🇩",code:"SD",dial_code:"+249"},{name:"Suriname",flag:"🇸🇷",code:"SR",dial_code:"+597"},{name:"Svalbard and Jan Mayen",flag:"🇸🇯",code:"SJ",dial_code:"+47"},{name:"Swaziland",flag:"🇸🇿",code:"SZ",dial_code:"+268"},{name:"Sweden",flag:"🇸🇪",code:"SE",dial_code:"+46"},{name:"Switzerland",flag:"🇨🇭",code:"CH",dial_code:"+41"},{name:"Syrian Arab Republic",flag:"🇸🇾",code:"SY",dial_code:"+963"},{name:"Taiwan",flag:"🇹🇼",code:"TW",dial_code:"+886"},{name:"Tajikistan",flag:"🇹🇯",code:"TJ",dial_code:"+992"},{name:"Tanzania, United Republic of Tanzania",flag:"🇹🇿",code:"TZ",dial_code:"+255"},{name:"Thailand",flag:"🇹🇭",code:"TH",dial_code:"+66"},{name:"Timor-Leste",flag:"🇹🇱",code:"TL",dial_code:"+670"},{name:"Togo",flag:"🇹🇬",code:"TG",dial_code:"+228"},{name:"Tokelau",flag:"🇹🇰",code:"TK",dial_code:"+690"},{name:"Tonga",flag:"🇹🇴",code:"TO",dial_code:"+676"},{name:"Trinidad and Tobago",flag:"🇹🇹",code:"TT",dial_code:"+1868"},{name:"Tunisia",flag:"🇹🇳",code:"TN",dial_code:"+216"},{name:"Turkey",flag:"🇹🇷",code:"TR",dial_code:"+90"},{name:"Turkmenistan",flag:"🇹🇲",code:"TM",dial_code:"+993"},{name:"Turks and Caicos Islands",flag:"🇹🇨",code:"TC",dial_code:"+1649"},{name:"Tuvalu",flag:"🇹🇻",code:"TV",dial_code:"+688"},{name:"Uganda",flag:"🇺🇬",code:"UG",dial_code:"+256"},{name:"Ukraine",flag:"🇺🇦",code:"UA",dial_code:"+380"},{name:"United Arab Emirates",flag:"🇦🇪",code:"AE",dial_code:"+971"},{name:"United Kingdom",flag:"🇬🇧",code:"GB",dial_code:"+44"},{name:"United States",flag:"🇺🇸",code:"US",dial_code:"+1"},{name:"Uruguay",flag:"🇺🇾",code:"UY",dial_code:"+598"},{name:"Uzbekistan",flag:"🇺🇿",code:"UZ",dial_code:"+998"},{name:"Vanuatu",flag:"🇻🇺",code:"VU",dial_code:"+678"},{name:"Venezuela, Bolivarian Republic of Venezuela",flag:"🇻🇪",code:"VE",dial_code:"+58"},{name:"Vietnam",flag:"🇻🇳",code:"VN",dial_code:"+84"},{name:"Virgin Islands, British",flag:"🇻🇬",code:"VG",dial_code:"+1284"},{name:"Virgin Islands, U.S.",flag:"🇻🇮",code:"VI",dial_code:"+1340"},{name:"Wallis and Futuna",flag:"🇼🇫",code:"WF",dial_code:"+681"},{name:"Yemen",flag:"🇾🇪",code:"YE",dial_code:"+967"},{name:"Zambia",flag:"🇿🇲",code:"ZM",dial_code:"+260"},{name:"Zimbabwe",flag:"🇿🇼",code:"ZW",dial_code:"+263"}],Np={button:fd,placeholder:"Type your phone number..."},Lp=ve('<div class="typebot-input-form flex w-full gap-2 items-end max-w-[350px]"><div class="flex typebot-input w-full"><div class="relative typebot-country-select flex justify-center items-center"><div class="pl-2 pr-1 flex items-center gap-2"><span></span></div><select class="absolute top-0 left-0 w-full h-full cursor-pointer opacity-0">'),Dp=ve("<option> "),Mp=e=>{const[t,n]=_(Ge(e.defaultCountryCode)?"INT":e.defaultCountryCode),[o,r]=_(e.defaultValue??"");let i;const a=e=>{r(e),""!==e&&"+"!==e||"INT"===t()||n("INT");const o=e?.startsWith("+")&&e.length>2&&Rp.reduce(((t,n)=>!n?.dial_code||null!==t&&!t.dial_code?t:e?.startsWith(n.dial_code)&&n.dial_code.length>(t?.dial_code.length??0)?n:t),null);o&&n(o.code)},s=()=>{const n=Rp.find((e=>e.code===t()))?.dial_code;if(""!==i?.value&&i?.reportValidity()){const t=i?.value??o();e.onSubmit({type:"text",value:t.startsWith("+")?t:`${n??""}${t}`})}else i?.focus()},l=e=>{"Enter"===e.key&&s()},c=e=>{const t=e.currentTarget.value;n(t);const a=Rp.find((e=>e.code===t))?.dial_code;""===o()&&a&&r(a),i?.focus()};P((()=>{!Kt()&&i&&i.focus({preventScroll:!0}),window.addEventListener("message",d)})),I((()=>{window.removeEventListener("message",d)}));const d=e=>{const{data:t}=e;t.isFromTypebot&&"setInputValue"===t.command&&r(t.value)};return(()=>{const n=Lp(),r=n.firstChild,d=r.firstChild.firstChild,u=d.firstChild,p=d.nextSibling;return n.$$keydown=l,Se(u,(()=>Rp.find((e=>t()===e.code))?.flag)),Se(d,Z($p,{class:"w-3"}),null),p.addEventListener("change",c),Se(p,Z(se,{each:Rp,children:e=>(()=>{const n=Dp(),o=n.firstChild;return Se(n,(()=>e.name),o),Se(n,(()=>e.dial_code?`(${e.dial_code})`:""),null),T((()=>n.selected=e.code===t())),T((()=>n.value=e.code)),n})()})),Se(r,Z(sn,{type:"tel",ref(e){"function"==typeof i?i(e):i=e},get value(){return o()},onInput:a,get placeholder(){return e.labels?.placeholder??Np.placeholder},get autofocus(){return!Kt()}}),null),Se(n,Z(nn,{type:"button",class:"h-[56px]","on:click":s,get children(){return e.labels?.button}}),null),n})()};we(["keydown"]);const Up={button:fd,from:"From:",to:"To:"},Bp=ve('<div class="typebot-input-form flex gap-2 items-end"><form><div class="flex flex-col"><div><input class="focus:outline-none flex-1 w-full text-input typebot-date-input" data-testid="from-date">'),Fp=ve('<p class="font-semibold">'),jp=ve('<div class="flex items-center p-4"><input class="focus:outline-none flex-1 w-full text-input ml-2 typebot-date-input" data-testid="to-date">'),zp=e=>{const[t,n]=_(Hp(e.defaultValue??"")),o=()=>{""===t().from&&""===t().to||e.onSubmit({type:"text",value:`${t().from}${e.options?.isRange?` to ${t().to}`:""}`})};return(()=>{const r=Bp(),i=r.firstChild,a=i.firstChild,s=a.firstChild,l=s.firstChild;return i.addEventListener("submit",(e=>{e.preventDefault(),o()})),Se(s,(()=>{const t=E((()=>!!e.options?.isRange));return()=>t()&&(()=>{const t=Fp();return Se(t,(()=>e.options.labels?.from??Up.from)),t})()})(),l),l.addEventListener("change",(e=>n({...t(),from:e.currentTarget.value}))),l.style.setProperty("min-height","32px"),l.style.setProperty("min-width","100px"),l.style.setProperty("font-size","16px"),Se(a,(()=>{const o=E((()=>!!e.options?.isRange));return()=>o()&&(()=>{const o=jp(),r=o.firstChild;return Se(o,(()=>{const t=E((()=>!!e.options.isRange));return()=>t()&&(()=>{const t=Fp();return Se(t,(()=>e.options.labels?.to??Up.to)),t})()})(),r),r.addEventListener("change",(e=>n({...t(),to:e.currentTarget.value}))),r.style.setProperty("min-height","32px"),r.style.setProperty("min-width","100px"),r.style.setProperty("font-size","16px"),T((t=>{const n=e.options.hasTime?"datetime-local":"date",o=e.options?.min,i=e.options?.max;return n!==t._v$6&&xe(r,"type",t._v$6=n),o!==t._v$7&&xe(r,"min",t._v$7=o),i!==t._v$8&&xe(r,"max",t._v$8=i),t}),{_v$6:void 0,_v$7:void 0,_v$8:void 0}),T((()=>r.value=t().to)),o})()})(),null),Se(r,Z(nn,{class:"h-[56px]","on:click":o,get children(){return e.options?.labels?.button}}),null),T((t=>{const n=Ze("flex typebot-input",e.options?.isRange?"items-end":"items-center"),o="flex items-center p-4 "+(e.options?.isRange?"pb-0 gap-2":""),r=e.options?.hasTime?"datetime-local":"date",a=e.options?.min,c=e.options?.max;return n!==t._v$&&ke(i,t._v$=n),o!==t._v$2&&ke(s,t._v$2=o),r!==t._v$3&&xe(l,"type",t._v$3=r),a!==t._v$4&&xe(l,"min",t._v$4=a),c!==t._v$5&&xe(l,"max",t._v$5=c),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0}),T((()=>l.value=t().from)),r})()},Hp=e=>{if(!e.includes("to"))return{from:e,to:""};const[t,n]=e.split(" to ");return{from:t,to:n}},Vp="Numbers",Gp=10,Wp={button:fd},qp=0,Kp=ve('<form class="flex flex-col gap-2"><div class="flex flex-wrap justify-center gap-2"></div><div class="flex justify-end">'),Yp=ve('<span class="text-sm w-full rating-label">'),Xp=ve('<span class="text-sm w-full text-right pr-2 rating-label">'),Zp=ve('<div role="checkbox">'),Jp=ve("<div>"),Qp=e=>{const[t,n]=_(e.defaultValue?Number(e.defaultValue):void 0),o=n=>{n.preventDefault();const o=t();Ve(o)||e.onSubmit({type:"text",value:o.toString()})},r=t=>{e.block.options?.isOneClickSubmitEnabled&&e.onSubmit({type:"text",value:t.toString()}),n(t)};return(()=>{const n=Kp(),i=n.firstChild,a=i.nextSibling;return n.addEventListener("submit",o),Se(n,(()=>{const t=E((()=>!!e.block.options?.labels?.left));return()=>t()&&(()=>{const t=Yp();return Se(t,(()=>e.block.options.labels.left)),t})()})(),i),Se(i,Z(se,{get each(){return Array.from(Array((e.block.options?.length??Gp)+("Numbers"===(e.block.options?.buttonType??Vp)?-((e.block.options?.startsAt??qp)-1):0)))},children:(n,o)=>Z(eg,ne((()=>e.block.options),{get rating(){return t()},get idx(){return o()+("Numbers"===(e.block.options?.buttonType??Vp)?e.block.options?.startsAt??qp:1)},onClick:r}))})),Se(n,(()=>{const t=E((()=>!!e.block.options?.labels?.right));return()=>t()&&(()=>{const t=Xp();return Se(t,(()=>e.block.options.labels.right)),t})()})(),a),Se(a,(()=>{const n=E((()=>!!He(t())));return()=>n()&&Z(nn,{disableIcon:!0,get children(){return e.block.options?.labels?.button??Wp.button}})})()),n})()},eg=e=>{const t=t=>{t.preventDefault(),e.onClick(e.idx)};return Z(ce,{get children(){return[Z(de,{get when(){return"Numbers"===(e.buttonType??Vp)},get children(){return[Z(le,{get when(){return e.isOneClickSubmitEnabled},get children(){return Z(tn,{"on:click":t,get children(){return e.idx}})}}),Z(le,{get when(){return!e.isOneClickSubmitEnabled},get children(){const n=Zp();return n.addEventListener("click",t),Se(n,(()=>e.idx)),T((t=>{const o=He(e.rating)&&e.idx<=e.rating,r="py-2 px-4 font-semibold focus:outline-none cursor-pointer select-none typebot-selectable"+(He(e.rating)&&e.idx<=e.rating?" selected":"");return o!==t._v$&&xe(n,"aria-checked",t._v$=o),r!==t._v$2&&ke(n,t._v$2=r),t}),{_v$:void 0,_v$2:void 0}),n}})]}}),Z(de,{get when(){return"Numbers"!==(e.buttonType??Vp)},get children(){const t=Jp();return t.addEventListener("click",(()=>e.onClick(e.idx))),T((n=>{const o="flex justify-center items-center rating-icon-container cursor-pointer "+(He(e.rating)&&e.idx<=e.rating?"selected":""),r=e.customIcon?.isEnabled&&!Ge(e.customIcon.svg)?e.customIcon.svg:tg;return o!==n._v$3&&ke(t,n._v$3=o),r!==n._v$4&&(t.innerHTML=n._v$4=r),n}),{_v$3:void 0,_v$4:void 0}),t}})]}})},tg='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-star"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>',ng={isRequired:!0,isMultipleAllowed:!1,visibility:"Auto",labels:{placeholder:"<strong>\n Click to upload\n </strong> or drag and drop<br>\n (size limit: 10MB)",button:"Upload",clear:"Clear",skip:"Skip",success:{single:"File uploaded",multiple:"{total} files uploaded"}}},og=ve('<div class="w-full bg-gray-200 rounded-full h-2.5"><div class="upload-progress-bar h-2.5 rounded-full">'),rg=ve('<div class="p-4 flex gap-2 border-gray-200 border overflow-auto bg-white rounded-md w-full">'),ig=ve('<div class="flex flex-col justify-center items-center gap-4 max-w-[90%]"><p class="text-sm text-gray-500 text-center">'),ag=ve('<input id="dropzone-file" type="file" class="hidden">'),sg=ve('<div class="flex justify-end">'),lg=ve('<div class="flex justify-end"><div class="flex gap-2">'),cg=ve('<form class="flex flex-col w-full gap-2"><label for="dropzone-file">'),dg=ve('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-gray-500"><polyline points="16 16 12 12 8 16"></polyline><line x1="12" y1="12" x2="12" y2="21"></line><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"></path><polyline points="16 16 12 12 8 16">'),ug=e=>{const[t,n]=_([]),[o,r]=_(!1),[i,a]=_(0),[s,l]=_(!1),c=o=>{const r=Array.from(o).map((n=>Nd({existingFiles:t(),newFile:n,params:{sizeLimit:e.block.options&&"sizeLimit"in e.block.options?e.block.options.sizeLimit:void 0},onError:({description:e,title:t})=>Ld.create({title:t,description:e})}))).filter(He);if(0!==r.length)return e.block.options?.isMultipleAllowed?void n([...t(),...r]):u(r[0])},d=async e=>{e.preventDefault(),0!==t().length&&p(t())},u=async t=>{r(!0);const n=await Dd({apiHost:e.context.apiHost??xt({ignoreChatApiUrl:!0}),files:[{file:t,input:{sessionId:e.context.sessionId,fileName:t.name}}]});if(r(!1),n.length&&n[0])return e.onSubmit({type:"text",label:e.block.options?.labels?.success?.single??ng.labels.success.single,value:n[0]?gg(n[0].url):"",attachments:[{type:t.type,url:n[0].url}]});Ld.create({description:"An error occured while uploading the file"})},p=async t=>{r(!0);const n=await Dd({apiHost:e.context.apiHost??xt({ignoreChatApiUrl:!0}),files:t.map((t=>({file:t,input:{sessionId:e.context.sessionId,fileName:t.name}}))),onUploadProgress:a});if(r(!1),a(0),n.length!==t.length)return Ld.create({description:"An error occured while uploading the files"});e.onSubmit({type:"text",label:n.length>1?(e.block.options?.labels?.success?.multiple??ng.labels.success.multiple).replaceAll("{total}",n.length.toString()):e.block.options?.labels?.success?.single??ng.labels.success.single,value:n.filter(He).map((({url:e})=>gg(e))).join(", "),attachments:n.filter(He)})},g=e=>{e.preventDefault(),l(!0)},h=()=>l(!1),f=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer?.files&&c(e.dataTransfer.files)},m=()=>n([]),b=()=>e.onSkip(e.block.options?.labels?.skip??ng.labels.skip);return(()=>{const r=cg(),a=r.firstChild;return r.addEventListener("submit",d),a.addEventListener("drop",f),a.addEventListener("dragleave",h),a.addEventListener("dragover",g),Se(a,Z(ce,{get children(){return[Z(de,{get when(){return o()},get children(){return Z(le,{get when(){return t().length>1},get fallback(){return Z(Qt,{})},get children(){const e=og(),t=e.firstChild;return t.style.setProperty("transition","width 150ms cubic-bezier(0.4, 0, 0.2, 1)"),T((()=>null!=`${i()>0?i:10}%`?t.style.setProperty("width",`${i()>0?i:10}%`):t.style.removeProperty("width"))),e}})}}),Z(de,{get when(){return!o()},get children(){return[(()=>{const o=ig(),r=o.firstChild;return Se(o,Z(le,{get when(){return t().length},get fallback(){return Z(pg,{})},get children(){const e=rg();return e.addEventListener("click",(e=>{e.preventDefault(),e.stopPropagation()})),Se(e,Z(se,{get each(){return t()},children:(e,t)=>Z($d,{file:e,onRemoveClick:()=>(e=>{n((t=>t.filter(((t,n)=>n!==e))))})(t())})})),e}}),r),T((()=>r.innerHTML=e.block.options?.labels?.placeholder??ng.labels.placeholder)),o})(),(()=>{const t=ag();return t.addEventListener("change",(e=>{e.currentTarget.files&&c(e.currentTarget.files)})),T((()=>t.multiple=e.block.options?.isMultipleAllowed??ng.isMultipleAllowed)),t})()]}})]}})),Se(r,Z(le,{get when(){return 0===t().length&&!1===e.block.options?.isRequired},get children(){const t=sg();return Se(t,Z(tn,{"on:click":b,get children(){return e.block.options?.labels?.skip??ng.labels.skip}})),t}}),null),Se(r,Z(le,{get when(){return E((()=>!!(e.block.options?.isMultipleAllowed&&t().length>0)))()&&!o()},get children(){const n=lg(),o=n.firstChild;return Se(o,Z(le,{get when(){return t().length},get children(){return Z(tn,{variant:"secondary","on:click":m,get children(){return e.block.options?.labels?.clear??ng.labels.clear}})}}),null),Se(o,Z(nn,{type:"submit",disableIcon:!0,get children(){return E((()=>(e.block.options?.labels?.button??ng.labels.button)===ng.labels.button))()?`Upload ${t().length} file${t().length>1?"s":""}`:e.block.options?.labels?.button}}),null),n}}),null),T((()=>ke(a,"typebot-upload-input py-6 flex flex-col justify-center items-center w-full bg-gray-50 border-2 border-gray-300 border-dashed cursor-pointer hover:bg-gray-100 px-8 "+(s()?"dragging-over":"")))),r})()},pg=()=>dg(),gg=e=>{const t=e.split("/").pop();if(!t)return e;const n=encodeURIComponent(t);return e.replace(t,n)};(function(e){return e.STRIPE="Stripe",e})({}).STRIPE;const hg={button:"Pay",success:"Success"},fg=ve('<div class="typebot-input-error-message mt-4 text-center animate-fade-in">'),mg=ve('<form id="payment-form" class="flex flex-col p-4 typebot-input w-full items-center"><slot name="stripe-payment-form">');let bg,yg=null,vg=null;const wg=e=>{const[t,n]=_(),[o,r]=_(!1),[i,a]=_(!1);P((async()=>{if(xg(bg),!e.options?.publicKey)return n("Missing Stripe public key");var t;if(yg=await(t=e.options?.publicKey,new Promise((e=>{if(window.Stripe)return e(window.Stripe(t));const n=document.createElement("script");n.src="https://js.stripe.com/v3",document.body.appendChild(n),n.onload=()=>{if(!window.Stripe)throw new Error("Stripe.js failed to load.");e(window.Stripe(t))}}))),!yg)return;vg=yg.elements({appearance:{theme:"stripe",variables:{colorPrimary:getComputedStyle(bg).getPropertyValue("--typebot-button-bg-color")}},clientSecret:e.options.paymentIntentSecret});vg.create("payment",{layout:"tabs"}).mount("#payment-element"),setTimeout((()=>{r(!0),e.onTransitionEnd()}),1e3)}));const s=async t=>{if(t.preventDefault(),!yg||!vg)return;var o;a(!0),o={sessionId:e.context.sessionId,resultId:e.context.resultId,typebot:e.context.typebot},sessionStorage.setItem("typebotPaymentInProgress",JSON.stringify(o));const{postalCode:r,...i}=e.options?.additionalInformation?.address??{},{error:s,paymentIntent:l}=await yg.confirmPayment({elements:vg,confirmParams:{return_url:window.location.href,payment_method_data:{billing_details:{name:e.options?.additionalInformation?.name,email:e.options?.additionalInformation?.email,phone:e.options?.additionalInformation?.phoneNumber,address:{...i,postal_code:r}}}},redirect:"if_required"});return _t(),a(!1),"validation_error"!==s?.type?"card_error"===s?.type?n(s.message):s||"succeeded"!==l.status?void 0:e.onSuccess():void 0};return(()=>{const n=mg(),r=n.firstChild;n.addEventListener("submit",s);return"function"==typeof bg?Te(bg,r):bg=r,r._$owner=A(),Se(n,Z(le,{get when(){return o()},get children(){return Z(nn,{get isLoading(){return i()},class:"mt-4 w-full max-w-lg animate-fade-in",disableIcon:!0,get children(){return[E((()=>e.options?.labels?.button??hg.button))," ",E((()=>e.options?.amountLabel))]}})}}),null),Se(n,Z(le,{get when(){return t()},get children(){const e=fg();return Se(e,t),e}}),null),n})()},xg=e=>{const t=e.getRootNode().host,n=document.createElement("div");n.style.width="100%",n.slot="stripe-payment-form",t.appendChild(n);const o=document.createElement("div");o.id="payment-element",n.appendChild(o)},kg=e=>Z(wg,{get onSuccess(){return e.onSuccess},get options(){return e.options},get context(){return e.context},get onTransitionEnd(){return e.onTransitionEnd}}),_g=ve('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3px" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12">'),Tg=e=>(()=>{const t=_g();return _e(t,e,!0,!0),t})(),Sg=ve("<div>"),Eg=e=>(()=>{const t=Sg();return Se(t,Z(le,{get when(){return e.isChecked},get children(){return Z(Tg,{})}})),T((()=>ke(t,"w-4 h-4 typebot-checkbox"+(e.isChecked?" checked":"")+(e.class?` ${e.class}`:"")))),t})(),Cg=ve('<button class="w-5 h-5">'),Pg=ve('<div class="flex justify-between items-center gap-2 w-full pr-4"><input class="focus:outline-none bg-transparent px-4 py-4 flex-1 w-full text-input" type="text">'),Ig=e=>{const[t,n]=_(""),[o,r]=oe(e,["onInput","ref"]),i=()=>{n(""),e.onClear()};return(()=>{const a=Pg(),s=a.firstChild;s.$$input=e=>(e=>{n(e),o.onInput(e)})(e.currentTarget.value);const l=e.ref;return"function"==typeof l?Te(l,s):e.ref=s,s.style.setProperty("font-size","16px"),_e(s,ne({get value(){return t()}},r),!1,!1),Se(a,Z(le,{get when(){return t().length>0},get children(){const e=Cg();return e.addEventListener("click",i),Se(e,Z(Zc,{})),e}}),null),a})()};we(["input"]);const Og=fd,Ag="Filter the options...",$g=ve('<div class="flex items-end typebot-input w-full">'),Rg=ve('<form class="flex flex-col items-end gap-2 w-full"><div>'),Ng=ve('<span><div role="checkbox"><div class="flex items-center gap-2"><span>'),Lg=ve('<span><div role="checkbox" aria-checked class="w-full py-2 px-4 font-semibold focus:outline-none cursor-pointer select-none typebot-selectable selected"><div class="flex items-center gap-2"><span>'),Dg=e=>{let t;const[n,o]=_(e.defaultItems),[r,i]=_([]);P((()=>{!Kt()&&t&&t.focus({preventScroll:!0})}));const a=e=>{s(e)},s=e=>{const t=r().indexOf(e);i(-1!==t?t=>t.filter((t=>t!==e)):t=>[...t,e])},l=()=>e.onSubmit({type:"text",value:r().map((t=>e.defaultItems.find((e=>e.id===t))?.content)).join(", ")}),c=t=>{o(e.defaultItems.filter((e=>e.content?.toLowerCase().includes((t??"").toLowerCase()))))};return(()=>{const i=Rg(),s=i.firstChild;return i.addEventListener("submit",l),Se(i,Z(le,{get when(){return e.options?.isSearchable},get children(){const n=$g();return Se(n,Z(Ig,{ref(e){"function"==typeof t?t(e):t=e},onInput:c,get placeholder(){return e.options?.searchInputPlaceholder??Ag},onClear:()=>o(e.defaultItems)})),n}}),s),Se(s,Z(se,{get each(){return n()},children:e=>(()=>{const t=Ng(),n=t.firstChild,o=n.firstChild,i=o.firstChild;return n.addEventListener("click",(()=>a(e.id))),Se(o,Z(Eg,{get isChecked(){return r().some((t=>t===e.id))},class:"flex-shrink-0"}),i),Se(i,(()=>e.content)),T((o=>{const i="relative"+(Kt()?" w-full":""),a=r().some((t=>t===e.id)),s="w-full py-2 px-4 font-semibold focus:outline-none cursor-pointer select-none typebot-selectable"+(r().some((t=>t===e.id))?" selected":""),l=e.id;return i!==o._v$&&ke(t,o._v$=i),a!==o._v$2&&xe(n,"aria-checked",o._v$2=a),s!==o._v$3&&ke(n,o._v$3=s),l!==o._v$4&&xe(n,"data-itemid",o._v$4=l),o}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),t})()}),null),Se(s,Z(se,{get each(){return r().filter((e=>n().every((t=>t.id!==e))))},children:t=>(()=>{const n=Lg(),o=n.firstChild,r=o.firstChild,i=r.firstChild;return o.addEventListener("click",(()=>a(t))),xe(o,"data-itemid",t),Se(r,Z(Eg,{isChecked:!0}),i),Se(i,(()=>e.defaultItems.find((e=>e.id===t))?.content)),T((()=>ke(n,"relative"+(Kt()?" w-full":"")))),n})()}),null),Se(i,(()=>{const t=E((()=>r().length>0));return()=>t()&&Z(nn,{disableIcon:!0,get children(){return e.options?.buttonLabel??Og}})})(),null),T((()=>ke(s,"flex flex-wrap justify-end gap-2"+(e.options?.isSearchable?" overflow-y-scroll max-h-80 rounded-md":"")))),i})()},Mg=ve('<div class="flex items-end typebot-input w-full">'),Ug=ve('<div class="flex flex-col gap-2 w-full"><div>'),Bg=ve("<span>"),Fg=ve('<span class="flex h-3 w-3 absolute top-0 right-0 -mt-1 -mr-1 ping"><span class="animate-ping absolute inline-flex h-full w-full rounded-full brightness-200 opacity-75"></span><span class="relative inline-flex rounded-full h-3 w-3 brightness-150">'),jg=e=>{let t;const[n,o]=_(e.defaultItems);P((()=>{!Kt()&&t&&t.focus({preventScroll:!0})}));const r=t=>{o(e.defaultItems.filter((e=>e.content?.toLowerCase().includes((t??"").toLowerCase()))))};return(()=>{const i=Ug(),a=i.firstChild;return Se(i,Z(le,{get when(){return e.options?.isSearchable},get children(){const n=Mg();return Se(n,Z(Ig,{ref(e){"function"==typeof t?t(e):t=e},onInput:r,get placeholder(){return e.options?.searchInputPlaceholder??Ag},onClear:()=>o(e.defaultItems)})),n}}),a),Se(a,Z(se,{get each(){return n()},children:(t,o)=>(()=>{const r=Bg();return Se(r,Z(tn,{"on:click":()=>{return t=o(),e.onSubmit({type:"text",value:n()[t].content??""});var t},get"data-itemid"(){return t.id},class:"w-full",get children(){return t.content}}),null),Se(r,(()=>{const t=E((()=>!(0!==e.chunkIndex||1!==e.defaultItems.length)));return()=>t()&&Fg()})(),null),T((()=>ke(r,"relative"+(Kt()?" w-full":"")))),r})()})),T((()=>ke(a,"flex flex-wrap justify-end gap-2"+(e.options?.isSearchable?" overflow-y-scroll max-h-80 rounded-md":"")))),i})()},zg=ve('<div class="flex items-end typebot-input w-full">'),Hg=ve('<div class="flex flex-col gap-2 w-full"><div>'),Vg=ve('<button><img fetchpriority="high" class="m-auto"><div><span class="font-semibold"></span><span class="text-sm whitespace-pre-wrap text-left">'),Gg=e=>{let t;const[n,o]=_(e.defaultItems),[r,i]=_(0);P((()=>{!Kt()&&t&&t.focus({preventScroll:!0})}));const a=t=>{o(e.defaultItems.filter((e=>e.title?.toLowerCase().includes((t??"").toLowerCase())||e.description?.toLowerCase().includes((t??"").toLowerCase()))))};S((()=>{r()===e.defaultItems.filter((e=>He(e.pictureSrc))).length&&e.onTransitionEnd()}));const s=()=>{i((e=>e+1))};return(()=>{const r=Hg(),i=r.firstChild;return Se(r,Z(le,{get when(){return e.options?.isSearchable},get children(){const n=zg();return Se(n,Z(Ig,{ref(e){"function"==typeof t?t(e):t=e},onInput:a,get placeholder(){return e.options?.searchInputPlaceholder??""},onClear:()=>o(e.defaultItems)})),n}}),i),Se(i,Z(se,{get each(){return n()},children:(t,o)=>(()=>{const r=Vg(),i=r.firstChild,a=i.nextSibling,l=a.firstChild,c=l.nextSibling;return r.addEventListener("click",(()=>(t=>{const o=n()[t];return e.onSubmit({type:"text",label:We(o.title)?o.title:o.pictureSrc??o.id,value:o.id})})(o()))),i.addEventListener("load",s),Se(l,(()=>t.title)),Se(c,(()=>t.description)),T((e=>{const n=t.id,s="flex flex-col typebot-picture-button focus:outline-none filter hover:brightness-90 active:brightness-75 justify-between "+(qe(t.pictureSrc)?"has-svg":""),l=t.pictureSrc,c=t.title??`Picture ${o()+1}`,d=`Picture choice ${o()+1}`,u="flex flex-col gap-1 py-2 flex-shrink-0 px-4 w-full"+(t.description?" items-start":"");return n!==e._v$&&xe(r,"data-itemid",e._v$=n),s!==e._v$2&&ke(r,e._v$2=s),l!==e._v$3&&xe(i,"src",e._v$3=l),c!==e._v$4&&xe(i,"alt",e._v$4=c),d!==e._v$5&&xe(i,"elementtiming",e._v$5=d),u!==e._v$6&&ke(a,e._v$6=u),e}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0}),r})()})),T((()=>ke(i,"gap-2 flex flex-wrap justify-end"+(e.options?.isSearchable?" overflow-y-scroll max-h-[464px] rounded-md":"")))),r})()},Wg=fd,qg="Filter the options...",Kg=ve('<div class="flex items-end typebot-input w-full">'),Yg=ve('<form class="flex flex-col gap-2 w-full items-end"><div>'),Xg=ve('<span class="font-semibold">'),Zg=ve('<span class="text-sm whitespace-pre-wrap text-left">'),Jg=ve('<div class="flex flex-col gap-1 ">'),Qg=ve('<div role="checkbox"><img fetchpriority="high" class="m-auto"><div>'),eh=ve('<div role="checkbox" aria-checked class="flex flex-col focus:outline-none cursor-pointer select-none typebot-selectable-picture selected"><img fetchpriority="high"><div>'),th=e=>{let t;const[n,o]=_(e.defaultItems),[r,i]=_([]),[a,s]=_(0);P((()=>{!Kt()&&t&&t.focus({preventScroll:!0})}));const l=e=>{c(e)},c=e=>{const t=r().indexOf(e);i(-1!==t?t=>t.filter((t=>t!==e)):t=>[...t,e])},d=()=>e.onSubmit({type:"text",value:r().map((t=>{const n=e.defaultItems.find((e=>e.id===t));return We(n?.title)?n.title:n?.pictureSrc})).join(", ")}),u=t=>{o(e.defaultItems.filter((e=>e.title?.toLowerCase().includes((t??"").toLowerCase())||e.description?.toLowerCase().includes((t??"").toLowerCase()))))};S((()=>{a()===e.defaultItems.filter((e=>He(e.pictureSrc))).length&&e.onTransitionEnd()}));const p=()=>{s((e=>e+1))};return(()=>{const i=Yg(),a=i.firstChild;return i.addEventListener("submit",d),Se(i,Z(le,{get when(){return e.options?.isSearchable},get children(){const n=Kg();return Se(n,Z(Ig,{ref(e){"function"==typeof t?t(e):t=e},onInput:u,get placeholder(){return e.options?.searchInputPlaceholder??qg},onClear:()=>o(e.defaultItems)})),n}}),a),Se(a,Z(se,{get each(){return n()},children:(e,t)=>(()=>{const n=Qg(),o=n.firstChild,i=o.nextSibling;return n.addEventListener("click",(()=>l(e.id))),o.addEventListener("load",p),Se(i,Z(Eg,{get isChecked(){return r().some((t=>t===e.id))},get class(){return"flex-shrink-0"+(e.title||e.description?" mt-1":void 0)}}),null),Se(i,Z(le,{get when(){return e.title||e.description},get children(){const t=Jg();return Se(t,Z(le,{get when(){return e.title},get children(){const t=Xg();return Se(t,(()=>e.title)),t}}),null),Se(t,Z(le,{get when(){return e.description},get children(){const t=Zg();return Se(t,(()=>e.description)),t}}),null),t}}),null),T((a=>{const s=r().some((t=>t===e.id)),l="flex flex-col focus:outline-none cursor-pointer select-none typebot-selectable-picture"+(r().some((t=>t===e.id))?" selected":"")+(qe(e.pictureSrc)?" has-svg":""),c=e.id,d=e.pictureSrc,u=e.title??`Picture ${t()+1}`,p=`Picture choice ${t()+1}`,g="flex gap-3 py-2 flex-shrink-0"+(Ge(e.title)&&Ge(e.description)?" justify-center":" px-3");return s!==a._v$&&xe(n,"aria-checked",a._v$=s),l!==a._v$2&&ke(n,a._v$2=l),c!==a._v$3&&xe(n,"data-itemid",a._v$3=c),d!==a._v$4&&xe(o,"src",a._v$4=d),u!==a._v$5&&xe(o,"alt",a._v$5=u),p!==a._v$6&&xe(o,"elementtiming",a._v$6=p),g!==a._v$7&&ke(i,a._v$7=g),a}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0,_v$7:void 0}),n})()}),null),Se(a,Z(se,{get each(){return r().filter((e=>n().every((t=>t.id!==e)))).map((t=>e.defaultItems.find((e=>e.id===t)))).filter(He)},children:(t,n)=>(()=>{const o=eh(),i=o.firstChild,a=i.nextSibling;return o.addEventListener("click",(()=>l(t.id))),Se(a,Z(Eg,{get isChecked(){return r().some((e=>e===t.id))},get class(){return"flex-shrink-0"+(t.title||t.description?" mt-1":void 0)}}),null),Se(a,Z(le,{get when(){return t.title||t.description},get children(){const e=Jg();return Se(e,Z(le,{get when(){return t.title},get children(){const e=Xg();return Se(e,(()=>t.title)),e}}),null),Se(e,Z(le,{get when(){return t.description},get children(){const e=Zg();return Se(e,(()=>t.description)),e}}),null),e}}),null),T((r=>{const s=t.id,l=e.defaultItems.find((e=>e.id===t.id))?.pictureSrc,c=t.title??`Selected picture ${n()+1}`,d=`Selected picture choice ${n()+1}`,u="flex gap-3 py-2 flex-shrink-0"+(Ge(t.title)&&Ge(t.description)?" justify-center":" pl-4");return s!==r._v$8&&xe(o,"data-itemid",r._v$8=s),l!==r._v$9&&xe(i,"src",r._v$9=l),c!==r._v$10&&xe(i,"alt",r._v$10=c),d!==r._v$11&&xe(i,"elementtiming",r._v$11=d),u!==r._v$12&&ke(a,r._v$12=u),r}),{_v$8:void 0,_v$9:void 0,_v$10:void 0,_v$11:void 0,_v$12:void 0}),o})()}),null),Se(i,(()=>{const t=E((()=>r().length>0));return()=>t()&&Z(nn,{disableIcon:!0,get children(){return e.options?.buttonLabel??Wg}})})(),null),T((()=>ke(a,"flex flex-wrap justify-end gap-2"+(e.options?.isSearchable?" overflow-y-scroll max-h-[464px] rounded-md":"")))),i})()},[nh,oh]=_([]);function rh(e,t){const[n,o]=_(!1);if(!t.storage)return[...e,n,o];const r=ih(t.storage||qn.rememberUser.storage),i=JSON.stringify.bind(JSON),a=JSON.parse.bind(JSON),s=r.getItem(t.key),l="function"==typeof e[0]?t=>e[1]((()=>a(t))):t=>e[1](Or(a(t)));return s&&(l(s),o(!0),t.onRecovered?.()),[e[0],"function"==typeof e[0]?n=>{o(!1);const a=e[1](n);return n?r.setItem(t.key,i(a)):r.removeItem(t.key),a}:(...n)=>{o(!1),e[1](...n);const a=i(C((()=>e[0])));r.setItem(t.key,a)},n,o]}const ih=e=>"session"===(e??qn.rememberUser.storage)?sessionStorage:localStorage,ah=ve("<div>"),sh=ve('<div class="flex justify-end animate-fade-in gap-2 typebot-input-container">'),lh=e=>{const[t,n]=rh(_(),{key:`typebot-${e.context.typebot.id}-input-${e.chunkIndex}`,storage:e.context.storage}),o=async t=>{n(t),e.onSubmit(t)},r=t=>{n({type:"text",value:t}),e.onSkip()};return S((()=>{const t=nh().findLast((t=>e.chunkIndex===t.inputIndex))?.formattedMessage;t&&e.block.type!==md.FILE&&n((e=>"text"===e?.type?{...e,label:t}:e))})),Z(ce,{get children(){return[Z(de,{get when(){return t()&&!e.hasError},get children(){return Z(pd,{get answer(){return t()},get showAvatar(){return e.guestAvatar?.isEnabled??Jd},get avatarSrc(){return e.guestAvatar?.url&&e.guestAvatar.url},get hasHostAvatar(){return e.hasHostAvatar}})}}),Z(de,{get when(){return Ve(t())||e.hasError},get children(){const n=sh(),i=e.ref;return"function"==typeof i?Te(i,n):e.ref=n,Se(n,Z(le,{get when(){return e.hasHostAvatar},get children(){const e=ah();return T((()=>ke(e,"flex flex-shrink-0 items-center "+(Kt()?"w-6 h-6":"w-10 h-10")))),e}}),null),Se(n,Z(dh,{get context(){return e.context},get block(){return e.block},get chunkIndex(){return e.chunkIndex},get isInputPrefillEnabled(){return e.isInputPrefillEnabled},get existingAnswer(){return E((()=>!!e.hasError))()?ch(t()):void 0},get onTransitionEnd(){return e.onTransitionEnd},onSubmit:o,onSkip:r}),null),T((()=>xe(n,"data-blockid",e.block.id))),n}})]}})},ch=e=>{if(e)return"text"===e.type?e.value:e.url},dh=e=>{const t=t=>e.onSubmit(t),n=()=>e.existingAnswer??(e.isInputPrefillEnabled?e.block.prefilledValue:void 0),o=()=>e.onSubmit({type:"text",value:e.block.options?.labels?.success??hg.success});return Z(ce,{get children(){return[Z(de,{get when(){return e.block.type===md.TEXT},get children(){return Z(xp,{get block(){return e.block},get defaultValue(){return n()},get context(){return e.context},onSubmit:t})}}),Z(de,{get when(){return e.block.type===md.NUMBER},get children(){return Z(Tp,{get block(){return e.block},get defaultValue(){return n()},onSubmit:t})}}),Z(de,{get when(){return e.block.type===md.EMAIL},get children(){return Z(Cp,{get block(){return e.block},get defaultValue(){return n()},onSubmit:t})}}),Z(de,{get when(){return e.block.type===md.URL},get children(){return Z(Op,{get block(){return e.block},get defaultValue(){return n()},onSubmit:t})}}),Z(de,{get when(){return e.block.type===md.PHONE},get children(){return Z(Mp,{get labels(){return e.block.options?.labels},get defaultCountryCode(){return e.block.options?.defaultCountryCode},get defaultValue(){return n()},onSubmit:t})}}),Z(de,{get when(){return e.block.type===md.DATE},get children(){return Z(zp,{get options(){return e.block.options},get defaultValue(){return n()},onSubmit:t})}}),Z(de,{get when(){return uh(e.block)},keyed:!0,children:n=>Z(ce,{get children(){return[Z(de,{get when(){return!n.options?.isMultipleChoice},get children(){return Z(jg,{get chunkIndex(){return e.chunkIndex},get defaultItems(){return n.items},get options(){return n.options},onSubmit:t})}}),Z(de,{get when(){return n.options?.isMultipleChoice},get children(){return Z(Dg,{get defaultItems(){return n.items},get options(){return n.options},onSubmit:t})}})]}})}),Z(de,{get when(){return ph(e.block)},keyed:!0,children:n=>Z(ce,{get children(){return[Z(de,{get when(){return!n.options?.isMultipleChoice},get children(){return Z(Gg,{get defaultItems(){return n.items},get options(){return n.options},onSubmit:t,get onTransitionEnd(){return e.onTransitionEnd}})}}),Z(de,{get when(){return n.options?.isMultipleChoice},get children(){return Z(th,{get defaultItems(){return n.items},get options(){return n.options},onSubmit:t,get onTransitionEnd(){return e.onTransitionEnd}})}})]}})}),Z(de,{get when(){return e.block.type===md.RATING},get children(){return Z(Qp,{get block(){return e.block},get defaultValue(){return n()},onSubmit:t})}}),Z(de,{get when(){return e.block.type===md.FILE},get children(){return Z(ug,{get context(){return e.context},get block(){return e.block},onSubmit:t,get onSkip(){return e.onSkip}})}}),Z(de,{get when(){return e.block.type===md.PAYMENT},get children(){return Z(kg,{get context(){return e.context},get options(){return{...e.block.options,...e.block.runtimeOptions}},onSuccess:o,get onTransitionEnd(){return e.onTransitionEnd}})}})]}})},uh=e=>e?.type===md.CHOICE?e:void 0,ph=e=>e?.type===md.PICTURE_CHOICE?e:void 0,gh=ve("<div><div>"),hh=e=>{let t;const[n,o]=_(0),r=new ResizeObserver((e=>o(e[0].target.clientHeight-(Kt()?24:40))));return P((()=>{t&&r.observe(t)})),I((()=>{t&&r.unobserve(t)})),(()=>{const o=gh(),r=o.firstChild;return"function"==typeof t?Te(t,o):t=o,Se(r,Z(mo,{get initialAvatarSrc(){return e.hostAvatarSrc}})),T((t=>{const i="flex flex-shrink-0 items-center relative typebot-avatar-container "+(Kt()?"w-6":"w-10"),a="absolute flex items-center top-0"+(Kt()?" w-6 h-6":" w-10 h-10")+(e.hideAvatar?" opacity-0":" opacity-100"),s=`${n()}px`,l=e.isTransitionDisabled?void 0:"top 350ms ease-out, opacity 250ms ease-out";return i!==t._v$&&ke(o,t._v$=i),a!==t._v$2&&ke(r,t._v$2=a),s!==t._v$3&&(null!=(t._v$3=s)?r.style.setProperty("top",s):r.style.removeProperty("top")),l!==t._v$4&&(null!=(t._v$4=l)?r.style.setProperty("transition",l):r.style.removeProperty("transition")),t}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),o})()},[fh,mh]=_();function bh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let yh={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function vh(e){yh=e}const wh=/[&<>"']/,xh=new RegExp(wh.source,"g"),kh=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,_h=new RegExp(kh.source,"g"),Th={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sh=e=>Th[e];function Eh(e,t){if(t){if(wh.test(e))return e.replace(xh,Sh)}else if(kh.test(e))return e.replace(_h,Sh);return e}const Ch=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ph(e){return e.replace(Ch,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Ih=/(^|[^\[])\^/g;function Oh(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,o)=>(o=(o="object"==typeof o&&"source"in o?o.source:o).replace(Ih,"$1"),e=e.replace(t,o),n),getRegex:()=>new RegExp(e,t)};return n}function Ah(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const $h={exec:()=>null};function Rh(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let o=!1,r=t;for(;--r>=0&&"\\"===n[r];)o=!o;return o?"|":" |"})),o=n.split(/ \|/);let r=0;if(o[0].trim()||o.shift(),o.length>0&&!o[o.length-1].trim()&&o.pop(),t)if(o.length>t)o.splice(t);else for(;o.length<t;)o.push("");for(;r<o.length;r++)o[r]=o[r].trim().replace(/\\\|/g,"|");return o}function Nh(e,t,n){const o=e.length;if(0===o)return"";let r=0;for(;r<o;){const i=e.charAt(o-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.slice(0,o-r)}function Lh(e,t,n,o){const r=t.href,i=t.title?Eh(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){o.state.inLink=!0;const e={type:"link",raw:n,href:r,title:i,text:a,tokens:o.inlineTokens(a)};return o.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:i,text:Eh(a)}}class Dh{options;rules;lexer;constructor(e){this.options=e||yh}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Nh(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const o=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=o.length?e.slice(o.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Nh(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *>[ \t]?/gm,""),n=this.lexer.state.top;this.lexer.state.top=!0;const o=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:o,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const o=n.length>1,r={type:"list",raw:"",ordered:o,start:o?+n.slice(0,-1):"",loose:!1,items:[]};n=o?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=o?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a="",s="",l=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let o=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],d=0;this.options.pedantic?(d=2,s=o.trimStart()):(d=t[2].search(/[^ ]/),d=d>4?1:d,s=o.slice(d),d+=t[1].length);let u=!1;if(!o&&/^ *$/.test(c)&&(a+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(c))break;if(i.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=d||!c.trim())s+="\n"+c.slice(d);else{if(u)break;if(o.search(/[^ ]/)>=4)break;if(r.test(o))break;if(i.test(o))break;if(n.test(o))break;s+="\n"+c}u||c.trim()||(u=!0),a+=l+"\n",e=e.substring(l.length+1),o=c.slice(d)}}r.loose||(l?r.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,g=null;this.options.gfm&&(g=/^\[[ xX]\] /.exec(s),g&&(p="[ ] "!==g[0],s=s.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:a,task:!!g,checked:p,loose:!1,text:s,tokens:[]}),r.raw+=a}r.items[r.items.length-1].raw=a.trimEnd(),r.items[r.items.length-1].text=s.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(t){if(!/[:|]/.test(t[2]))return;const e={type:"table",raw:t[0],header:Rh(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^\||\| *$/g,"").split("|"),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,o,r,i=e.align.length;for(t=0;t<i;t++){const n=e.align[t];n&&(/^ *-+: *$/.test(n)?e.align[t]="right":/^ *:-+: *$/.test(n)?e.align[t]="center":/^ *:-+ *$/.test(n)?e.align[t]="left":e.align[t]=null)}for(i=e.rows.length,t=0;t<i;t++)e.rows[t]=Rh(e.rows[t],e.header.length).map((e=>({text:e,tokens:[]})));for(i=e.header.length,n=0;n<i;n++)e.header[n].tokens=this.lexer.inline(e.header[n].text);for(i=e.rows.length,n=0;n<i;n++)for(r=e.rows[n],o=0;o<r.length;o++)r[o].tokens=this.lexer.inline(r[o].text);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Eh(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Nh(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let o=0;o<e.length;o++)if("\\"===e[o])o++;else if(e[o]===t[0])n++;else if(e[o]===t[1]&&(n--,n<0))return o;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],o="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],o=e[3])}else o=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),Lh(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:o?o.replace(this.rules.inline._escapes,"$1"):o},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return Lh(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let o=this.rules.inline.emStrong.lDelim.exec(e);if(!o)return;if(o[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...o[0]].length-1;let r,i,a=n,s=0;const l="*"===o[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+o[0].length-1);null!=(o=l.exec(t));){if(r=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!r)continue;if(i=[...r].length,o[3]||o[4]){a+=i;continue}if((o[5]||o[6])&&n%3&&!((n+i)%3)){s+=i;continue}if(a-=i,a>0)continue;i=Math.min(i,i+a+s);const t=[...e].slice(0,n+o.index+i+1).join("");if(Math.min(n,i)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const l=t.slice(2,-2);return{type:"strong",raw:t,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),o=/^ /.test(e)&&/ $/.test(e);return n&&o&&(e=e.substring(1,e.length-1)),e=Eh(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=Eh(t[1]),n="mailto:"+e):(e=Eh(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=Eh(t[0]),n="mailto:"+e;else{let o;do{o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])[0]}while(o!==t[0]);e=Eh(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:Eh(t[0]),{type:"text",raw:t[0],text:e}}}}const Mh={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:$h,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Mh.def=Oh(Mh.def).replace("label",Mh._label).replace("title",Mh._title).getRegex(),Mh.bullet=/(?:[*+-]|\d{1,9}[.)])/,Mh.listItemStart=Oh(/^( *)(bull) */).replace("bull",Mh.bullet).getRegex(),Mh.list=Oh(Mh.list).replace(/bull/g,Mh.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Mh.def.source+")").getRegex(),Mh._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Mh._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Mh.html=Oh(Mh.html,"i").replace("comment",Mh._comment).replace("tag",Mh._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mh.lheading=Oh(Mh.lheading).replace(/bull/g,Mh.bullet).getRegex(),Mh.paragraph=Oh(Mh._paragraph).replace("hr",Mh.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mh._tag).getRegex(),Mh.blockquote=Oh(Mh.blockquote).replace("paragraph",Mh.paragraph).getRegex(),Mh.normal={...Mh},Mh.gfm={...Mh.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},Mh.gfm.table=Oh(Mh.gfm.table).replace("hr",Mh.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mh._tag).getRegex(),Mh.gfm.paragraph=Oh(Mh._paragraph).replace("hr",Mh.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",Mh.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mh._tag).getRegex(),Mh.pedantic={...Mh.normal,html:Oh("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Mh._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$h,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Oh(Mh.normal._paragraph).replace("hr",Mh.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Mh.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const Uh={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:$h,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:$h,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/,_punctuation:"\\p{P}$+<=>`^|~"};Uh.punctuation=Oh(Uh.punctuation,"u").replace(/punctuation/g,Uh._punctuation).getRegex(),Uh.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,Uh.anyPunctuation=/\\[punct]/g,Uh._escapes=/\\([punct])/g,Uh._comment=Oh(Mh._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),Uh.emStrong.lDelim=Oh(Uh.emStrong.lDelim,"u").replace(/punct/g,Uh._punctuation).getRegex(),Uh.emStrong.rDelimAst=Oh(Uh.emStrong.rDelimAst,"gu").replace(/punct/g,Uh._punctuation).getRegex(),Uh.emStrong.rDelimUnd=Oh(Uh.emStrong.rDelimUnd,"gu").replace(/punct/g,Uh._punctuation).getRegex(),Uh.anyPunctuation=Oh(Uh.anyPunctuation,"gu").replace(/punct/g,Uh._punctuation).getRegex(),Uh._escapes=Oh(Uh._escapes,"gu").replace(/punct/g,Uh._punctuation).getRegex(),Uh._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Uh._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Uh.autolink=Oh(Uh.autolink).replace("scheme",Uh._scheme).replace("email",Uh._email).getRegex(),Uh._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Uh.tag=Oh(Uh.tag).replace("comment",Uh._comment).replace("attribute",Uh._attribute).getRegex(),Uh._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Uh._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Uh._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Uh.link=Oh(Uh.link).replace("label",Uh._label).replace("href",Uh._href).replace("title",Uh._title).getRegex(),Uh.reflink=Oh(Uh.reflink).replace("label",Uh._label).replace("ref",Mh._label).getRegex(),Uh.nolink=Oh(Uh.nolink).replace("ref",Mh._label).getRegex(),Uh.reflinkSearch=Oh(Uh.reflinkSearch,"g").replace("reflink",Uh.reflink).replace("nolink",Uh.nolink).getRegex(),Uh.normal={...Uh},Uh.pedantic={...Uh.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Oh(/^!?\[(label)\]\((.*?)\)/).replace("label",Uh._label).getRegex(),reflink:Oh(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Uh._label).getRegex()},Uh.gfm={...Uh.normal,escape:Oh(Uh.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Uh.gfm.url=Oh(Uh.gfm.url,"i").replace("email",Uh.gfm._extended_email).getRegex(),Uh.breaks={...Uh.gfm,br:Oh(Uh.br).replace("{2,}","*").getRegex(),text:Oh(Uh.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class Bh{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||yh,this.options.tokenizer=this.options.tokenizer||new Dh,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Mh.normal,inline:Uh.normal};this.options.pedantic?(t.block=Mh.pedantic,t.inline=Uh.pedantic):this.options.gfm&&(t.block=Mh.gfm,this.options.breaks?t.inline=Uh.breaks:t.inline=Uh.gfm),this.tokenizer.rules=t}static get rules(){return{block:Mh,inline:Uh}}static lex(e,t){return new Bh(t).lex(e)}static lexInline(e,t){return new Bh(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,o,r,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((o=>!!(n=o.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),o=t[t.length-1],!o||"paragraph"!==o.type&&"text"!==o.type?t.push(n):(o.raw+="\n"+n.raw,o.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=o.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),o=t[t.length-1],!o||"paragraph"!==o.type&&"text"!==o.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(o.raw+="\n"+n.raw,o.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=o.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let o;this.options.extensions.startBlock.forEach((e=>{o=e.call({lexer:this},n),"number"==typeof o&&o>=0&&(t=Math.min(t,o))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))o=t[t.length-1],i&&"paragraph"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=o.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),o=t[t.length-1],o&&"text"===o.type?(o.raw+="\n"+n.raw,o.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=o.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,o,r,i,a,s,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,i.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(s=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((o=>!!(n=o.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),o=t[t.length-1],o&&"text"===n.type&&"text"===o.type?(o.raw+=n.raw,o.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),o=t[t.length-1],o&&"text"===n.type&&"text"===o.type?(o.raw+=n.raw,o.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,l,s))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let o;this.options.extensions.startInline.forEach((e=>{o=e.call({lexer:this},n),"number"==typeof o&&o>=0&&(t=Math.min(t,o))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(s=n.raw.slice(-1)),a=!0,o=t[t.length-1],o&&"text"===o.type?(o.raw+=n.raw,o.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class Fh{options;constructor(e){this.options=e||yh}code(e,t,n){const o=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",o?'<pre><code class="language-'+Eh(o)+'">'+(n?e:Eh(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:Eh(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const o=t?"ol":"ul";return"<"+o+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+o+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const o=Ah(e);if(null===o)return n;let r='<a href="'+(e=o)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const o=Ah(e);if(null===o)return n;let r=`<img src="${e=o}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class jh{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class zh{options;renderer;textRenderer;constructor(e){this.options=e||yh,this.options.renderer=this.options.renderer||new Fh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new jh}static parse(e,t){return new zh(t).parse(e)}static parseInline(e,t){return new zh(t).parseInline(e)}parse(e,t=!0){let n="";for(let o=0;o<e.length;o++){const r=e[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Ph(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",o="";for(let t=0;t<e.header.length;t++)o+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(o);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];o="";for(let t=0;t<n.length;t++)o+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});i+=this.renderer.tablerow(o)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=r,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r,t=e.ordered,o=e.start,i=e.loose;let a="";for(let t=0;t<e.items.length;t++){const n=e.items[t],o=n.checked,r=n.task;let s="";if(n.task){const e=this.renderer.checkbox(!!o);i?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):s+=e+" "}s+=this.parse(n.tokens,i),a+=this.renderer.listitem(s,r,!!o)}n+=this.renderer.list(a,t,o);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=r,a=i.tokens?this.parseInline(i.tokens):i.text;for(;o+1<e.length&&"text"===e[o+1].type;)i=e[++o],a+="\n"+(i.tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(a):a;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let o=0;o<e.length;o++){const r=e[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class Hh{options;constructor(e){this.options=e||yh}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(e){return e}postprocess(e){return e}}const Vh=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Bh.lex,zh.parse);parseInline=this.#e(Bh.lexInline,zh.parseInline);Parser=zh;parser=zh.parse;Renderer=Fh;TextRenderer=jh;Lexer=Bh;lexer=Bh.lex;Tokenizer=Dh;Hooks=Hh;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const o of e)switch(n=n.concat(t.call(this,o)),o.type){case"table":{const e=o;for(const o of e.header)n=n.concat(this.walkTokens(o.tokens,t));for(const o of e.rows)for(const e of o)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=o;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=o;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((o=>{n=n.concat(this.walkTokens(e[o],t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let o=e.renderer.apply(this,t);return!1===o&&(o=n.apply(this,t)),o}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new Fh(this.defaults);for(const n in e.renderer){const o=e.renderer[n],r=n,i=t[r];t[r]=(...e)=>{let n=o.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new Dh(this.defaults);for(const n in e.tokenizer){const o=e.tokenizer[n],r=n,i=t[r];t[r]=(...e)=>{let n=o.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new Hh;for(const n in e.hooks){const o=e.hooks[n],r=n,i=t[r];Hh.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(o.call(t,e)).then((e=>i.call(t,e)));const n=o.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=o.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,o=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(o.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#e(e,t){return(n,o)=>{const r={...o},i={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const a=this.#t(!!i.silent,!!i.async);if(null==n)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(a);try{i.hooks&&(n=i.hooks.preprocess(n));const o=e(n,i);i.walkTokens&&this.walkTokens(o,i.walkTokens);let r=t(o,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Eh(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Gh(e,t){return Vh.parse(e,t)}Gh.options=Gh.setOptions=function(e){return Vh.setOptions(e),Gh.defaults=Vh.defaults,vh(Gh.defaults),Gh},Gh.getDefaults=bh,Gh.defaults=yh,Gh.use=function(...e){return Vh.use(...e),Gh.defaults=Vh.defaults,vh(Gh.defaults),Gh},Gh.walkTokens=function(e,t){return Vh.walkTokens(e,t)},Gh.parseInline=Vh.parseInline,Gh.Parser=zh,Gh.parser=zh.parse,Gh.Renderer=Fh,Gh.TextRenderer=jh,Gh.Lexer=Bh,Gh.lexer=Bh.lex,Gh.Tokenizer=Dh,Gh.Hooks=Hh,Gh.parse=Gh,Gh.options,Gh.setOptions,Gh.use,Gh.walkTokens,Gh.parseInline;
13
+ /*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */
14
+ const{entries:Wh,setPrototypeOf:qh,isFrozen:Kh,getPrototypeOf:Yh,getOwnPropertyDescriptor:Xh}=Object;let{freeze:Zh,seal:Jh,create:Qh}=Object,{apply:ef,construct:tf}="undefined"!=typeof Reflect&&Reflect;Zh||(Zh=function(e){return e}),Jh||(Jh=function(e){return e}),ef||(ef=function(e,t,n){return e.apply(t,n)}),tf||(tf=function(e,t){return new e(...t)});const nf=ff(Array.prototype.forEach),of=ff(Array.prototype.pop),rf=ff(Array.prototype.push),af=ff(String.prototype.toLowerCase),sf=ff(String.prototype.toString),lf=ff(String.prototype.match),cf=ff(String.prototype.replace),df=ff(String.prototype.indexOf),uf=ff(String.prototype.trim),pf=ff(RegExp.prototype.test),gf=(hf=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return tf(hf,t)});var hf;function ff(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return ef(e,t,o)}}function mf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:af;qh&&qh(e,null);let o=t.length;for(;o--;){let r=t[o];if("string"==typeof r){const e=n(r);e!==r&&(Kh(t)||(t[o]=e),r=e)}e[r]=!0}return e}function bf(e){const t=Qh(null);for(const[n,o]of Wh(e))void 0!==Xh(e,n)&&(t[n]=o);return t}function yf(e,t){for(;null!==e;){const n=Xh(e,t);if(n){if(n.get)return ff(n.get);if("function"==typeof n.value)return ff(n.value)}e=Yh(e)}return function(e){return console.warn("fallback value for",e),null}}const vf=Zh(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),wf=Zh(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),xf=Zh(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),kf=Zh(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_f=Zh(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Tf=Zh(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Sf=Zh(["#text"]),Ef=Zh(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),Cf=Zh(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Pf=Zh(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),If=Zh(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Of=Jh(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Af=Jh(/<%[\w\W]*|[\w\W]*%>/gm),$f=Jh(/\${[\w\W]*}/gm),Rf=Jh(/^data-[\-\w.\u00B7-\uFFFF]/),Nf=Jh(/^aria-[\-\w]+$/),Lf=Jh(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Df=Jh(/^(?:\w+script|data):/i),Mf=Jh(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Uf=Jh(/^html$/i);var Bf=Object.freeze({__proto__:null,MUSTACHE_EXPR:Of,ERB_EXPR:Af,TMPLIT_EXPR:$f,DATA_ATTR:Rf,ARIA_ATTR:Nf,IS_ALLOWED_URI:Lf,IS_SCRIPT_OR_DATA:Df,ATTR_WHITESPACE:Mf,DOCTYPE_NAME:Uf});const Ff=function(){return"undefined"==typeof window?null:window};var jf=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ff();const n=t=>e(t);if(n.version="3.0.6",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;let{document:o}=t;const r=o,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:p,DOMParser:g,trustedTypes:h}=t,f=c.prototype,m=yf(f,"cloneNode"),b=yf(f,"nextSibling"),y=yf(f,"childNodes"),v=yf(f,"parentNode");if("function"==typeof s){const e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let w,x="";const{implementation:k,createNodeIterator:_,createDocumentFragment:T,getElementsByTagName:S}=o,{importNode:E}=r;let C={};n.isSupported="function"==typeof Wh&&"function"==typeof v&&k&&void 0!==k.createHTMLDocument;const{MUSTACHE_EXPR:P,ERB_EXPR:I,TMPLIT_EXPR:O,DATA_ATTR:A,ARIA_ATTR:$,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:N}=Bf;let{IS_ALLOWED_URI:L}=Bf,D=null;const M=mf({},[...vf,...wf,...xf,..._f,...Sf]);let U=null;const B=mf({},[...Ef,...Cf,...Pf,...If]);let F=Object.seal(Qh(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),j=null,z=null,H=!0,V=!0,G=!1,W=!0,q=!1,K=!1,Y=!1,X=!1,Z=!1,J=!1,Q=!1,ee=!0,te=!1,ne=!0,oe=!1,re={},ie=null;const ae=mf({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let se=null;const le=mf({},["audio","video","img","source","image","track"]);let ce=null;const de=mf({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ue="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",ge="http://www.w3.org/1999/xhtml";let he=ge,fe=!1,me=null;const be=mf({},[ue,pe,ge],sf);let ye=null;const ve=["application/xhtml+xml","text/html"];let we=null,xe=null;const ke=o.createElement("form"),_e=function(e){return e instanceof RegExp||e instanceof Function},Te=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!xe||xe!==e){if(e&&"object"==typeof e||(e={}),e=bf(e),ye=ye=-1===ve.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,we="application/xhtml+xml"===ye?sf:af,D="ALLOWED_TAGS"in e?mf({},e.ALLOWED_TAGS,we):M,U="ALLOWED_ATTR"in e?mf({},e.ALLOWED_ATTR,we):B,me="ALLOWED_NAMESPACES"in e?mf({},e.ALLOWED_NAMESPACES,sf):be,ce="ADD_URI_SAFE_ATTR"in e?mf(bf(de),e.ADD_URI_SAFE_ATTR,we):de,se="ADD_DATA_URI_TAGS"in e?mf(bf(le),e.ADD_DATA_URI_TAGS,we):le,ie="FORBID_CONTENTS"in e?mf({},e.FORBID_CONTENTS,we):ae,j="FORBID_TAGS"in e?mf({},e.FORBID_TAGS,we):{},z="FORBID_ATTR"in e?mf({},e.FORBID_ATTR,we):{},re="USE_PROFILES"in e&&e.USE_PROFILES,H=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,G=e.ALLOW_UNKNOWN_PROTOCOLS||!1,W=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,q=e.SAFE_FOR_TEMPLATES||!1,K=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,X=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,ne=!1!==e.KEEP_CONTENT,oe=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||Lf,he=e.NAMESPACE||ge,F=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(F.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_e(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(F.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(F.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(V=!1),J&&(Z=!0),re&&(D=mf({},[...Sf]),U=[],!0===re.html&&(mf(D,vf),mf(U,Ef)),!0===re.svg&&(mf(D,wf),mf(U,Cf),mf(U,If)),!0===re.svgFilters&&(mf(D,xf),mf(U,Cf),mf(U,If)),!0===re.mathMl&&(mf(D,_f),mf(U,Pf),mf(U,If))),e.ADD_TAGS&&(D===M&&(D=bf(D)),mf(D,e.ADD_TAGS,we)),e.ADD_ATTR&&(U===B&&(U=bf(U)),mf(U,e.ADD_ATTR,we)),e.ADD_URI_SAFE_ATTR&&mf(ce,e.ADD_URI_SAFE_ATTR,we),e.FORBID_CONTENTS&&(ie===ae&&(ie=bf(ie)),mf(ie,e.FORBID_CONTENTS,we)),ne&&(D["#text"]=!0),K&&mf(D,["html","head","body"]),D.table&&(mf(D,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw gf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw gf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=e.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else void 0===w&&(w=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(h,i)),null!==w&&"string"==typeof x&&(x=w.createHTML(""));Zh&&Zh(e),xe=e}},Se=mf({},["mi","mo","mn","ms","mtext"]),Ee=mf({},["foreignobject","desc","title","annotation-xml"]),Ce=mf({},["title","style","font","a","script"]),Pe=mf({},wf);mf(Pe,xf),mf(Pe,kf);const Ie=mf({},_f);mf(Ie,Tf);const Oe=function(e){rf(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Ae=function(e,t){try{rf(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){rf(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!U[e])if(Z||J)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},$e=function(e){let t=null,n=null;if(X)e="<remove></remove>"+e;else{const t=lf(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ye&&he===ge&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=w?w.createHTML(e):e;if(he===ge)try{t=(new g).parseFromString(r,ye)}catch(e){}if(!t||!t.documentElement){t=k.createDocument(he,"template",null);try{t.documentElement.innerHTML=fe?x:r}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(o.createTextNode(n),i.childNodes[0]||null),he===ge?S.call(t,K?"html":"body")[0]:K?t.documentElement:i},Re=function(e){return _.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null)},Ne=function(e){return"function"==typeof l&&e instanceof l},Le=function(e,t,o){C[e]&&nf(C[e],(e=>{e.call(n,t,o,xe)}))},De=function(e){let t=null;if(Le("beforeSanitizeElements",e,null),(o=e)instanceof p&&("string"!=typeof o.nodeName||"string"!=typeof o.textContent||"function"!=typeof o.removeChild||!(o.attributes instanceof u)||"function"!=typeof o.removeAttribute||"function"!=typeof o.setAttribute||"string"!=typeof o.namespaceURI||"function"!=typeof o.insertBefore||"function"!=typeof o.hasChildNodes))return Oe(e),!0;var o;const r=we(e.nodeName);if(Le("uponSanitizeElement",e,{tagName:r,allowedTags:D}),e.hasChildNodes()&&!Ne(e.firstElementChild)&&pf(/<[/\w]/g,e.innerHTML)&&pf(/<[/\w]/g,e.textContent))return Oe(e),!0;if(!D[r]||j[r]){if(!j[r]&&Ue(r)){if(F.tagNameCheck instanceof RegExp&&pf(F.tagNameCheck,r))return!1;if(F.tagNameCheck instanceof Function&&F.tagNameCheck(r))return!1}if(ne&&!ie[r]){const t=v(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t){for(let o=n.length-1;o>=0;--o)t.insertBefore(m(n[o],!0),b(e))}}return Oe(e),!0}return e instanceof c&&!function(e){let t=v(e);t&&t.tagName||(t={namespaceURI:he,tagName:"template"});const n=af(e.tagName),o=af(t.tagName);return!!me[e.namespaceURI]&&(e.namespaceURI===pe?t.namespaceURI===ge?"svg"===n:t.namespaceURI===ue?"svg"===n&&("annotation-xml"===o||Se[o]):Boolean(Pe[n]):e.namespaceURI===ue?t.namespaceURI===ge?"math"===n:t.namespaceURI===pe?"math"===n&&Ee[o]:Boolean(Ie[n]):e.namespaceURI===ge?!(t.namespaceURI===pe&&!Ee[o])&&!(t.namespaceURI===ue&&!Se[o])&&!Ie[n]&&(Ce[n]||!Pe[n]):!("application/xhtml+xml"!==ye||!me[e.namespaceURI]))}(e)?(Oe(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!pf(/<\/no(script|embed|frames)/i,e.innerHTML)?(q&&3===e.nodeType&&(t=e.textContent,nf([P,I,O],(e=>{t=cf(t,e," ")})),e.textContent!==t&&(rf(n.removed,{element:e.cloneNode()}),e.textContent=t)),Le("afterSanitizeElements",e,null),!1):(Oe(e),!0)},Me=function(e,t,n){if(ee&&("id"===t||"name"===t)&&(n in o||n in ke))return!1;if(V&&!z[t]&&pf(A,t));else if(H&&pf($,t));else if(!U[t]||z[t]){if(!(Ue(e)&&(F.tagNameCheck instanceof RegExp&&pf(F.tagNameCheck,e)||F.tagNameCheck instanceof Function&&F.tagNameCheck(e))&&(F.attributeNameCheck instanceof RegExp&&pf(F.attributeNameCheck,t)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(t))||"is"===t&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&pf(F.tagNameCheck,n)||F.tagNameCheck instanceof Function&&F.tagNameCheck(n))))return!1}else if(ce[t]);else if(pf(L,cf(n,N,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==df(n,"data:")||!se[e]){if(G&&!pf(R,cf(n,N,"")));else if(n)return!1}else;return!0},Ue=function(e){return e.indexOf("-")>0},Be=function(e){Le("beforeSanitizeAttributes",e,null);const{attributes:t}=e;if(!t)return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:U};let r=t.length;for(;r--;){const i=t[r],{name:a,namespaceURI:s,value:l}=i,c=we(a);let d="value"===a?l:uf(l);if(o.attrName=c,o.attrValue=d,o.keepAttr=!0,o.forceKeepAttr=void 0,Le("uponSanitizeAttribute",e,o),d=o.attrValue,o.forceKeepAttr)continue;if(Ae(a,e),!o.keepAttr)continue;if(!W&&pf(/\/>/i,d)){Ae(a,e);continue}q&&nf([P,I,O],(e=>{d=cf(d,e," ")}));const u=we(e.nodeName);if(Me(u,c,d)){if(!te||"id"!==c&&"name"!==c||(Ae(a,e),d="user-content-"+d),w&&"object"==typeof h&&"function"==typeof h.getAttributeType)if(s);else switch(h.getAttributeType(u,c)){case"TrustedHTML":d=w.createHTML(d);break;case"TrustedScriptURL":d=w.createScriptURL(d)}try{s?e.setAttributeNS(s,a,d):e.setAttribute(a,d),of(n.removed)}catch(e){}}}Le("afterSanitizeAttributes",e,null)},Fe=function e(t){let n=null;const o=Re(t);for(Le("beforeSanitizeShadowDOM",t,null);n=o.nextNode();)Le("uponSanitizeShadowNode",n,null),De(n)||(n.content instanceof a&&e(n.content),Be(n));Le("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,i=null,s=null,c=null;if(fe=!e,fe&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Ne(e)){if("function"!=typeof e.toString)throw gf("toString is not a function");if("string"!=typeof(e=e.toString()))throw gf("dirty is not a string, aborting")}if(!n.isSupported)return e;if(Y||Te(t),n.removed=[],"string"==typeof e&&(oe=!1),oe){if(e.nodeName){const t=we(e.nodeName);if(!D[t]||j[t])throw gf("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)o=$e("\x3c!----\x3e"),i=o.ownerDocument.importNode(e,!0),1===i.nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!Z&&!q&&!K&&-1===e.indexOf("<"))return w&&Q?w.createHTML(e):e;if(o=$e(e),!o)return Z?null:Q?x:""}o&&X&&Oe(o.firstChild);const d=Re(oe?e:o);for(;s=d.nextNode();)De(s)||(s.content instanceof a&&Fe(s.content),Be(s));if(oe)return e;if(Z){if(J)for(c=T.call(o.ownerDocument);o.firstChild;)c.appendChild(o.firstChild);else c=o;return(U.shadowroot||U.shadowrootmode)&&(c=E.call(r,c,!0)),c}let u=K?o.outerHTML:o.innerHTML;return K&&D["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&pf(Uf,o.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+o.ownerDocument.doctype.name+">\n"+u),q&&nf([P,I,O],(e=>{u=cf(u,e," ")})),w&&Q?w.createHTML(u):u},n.setConfig=function(){Te(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Y=!0},n.clearConfig=function(){xe=null,Y=!1},n.isValidAttribute=function(e,t,n){xe||Te({});const o=we(e),r=we(t);return Me(o,r,n)},n.addHook=function(e,t){"function"==typeof t&&(C[e]=C[e]||[],rf(C[e],t))},n.removeHook=function(e){if(C[e])return of(C[e])},n.removeHooks=function(e){C[e]&&(C[e]=[])},n.removeAllHooks=function(){C={}},n}();const zf=ve('<div class="flex flex-col animate-fade-in typebot-streaming-container"><div class="flex w-full items-center"><div class="flex relative items-start typebot-host-bubble max-w-full"><div class="flex items-center absolute px-4 py-2 bubble-typing " data-testid="host-bubble"></div><div class="flex flex-col overflow-hidden text-fade-in mx-4 my-2 relative text-ellipsis h-full gap-6">'),Hf=ve("<span>"),Vf=e=>{const[t,n]=rh(_([]),{key:`typebot-streaming-message-${e.streamingMessageId}`,storage:e.context.storage});return Gh.use({renderer:{link:(e,t,n)=>`<a href="${e}" target="_blank" rel="noopener noreferrer">${n}</a>`}}),S((()=>{if(fh()?.id!==e.streamingMessageId)return[];n(fh()?.content.split("```").map(((e,t)=>t%2==0?e.split("\n\n").map((e=>jf.sanitize(Gh.parse(e.replace(/【.+】/g,""),{breaks:!0}),{ADD_ATTR:["target"]}))):[jf.sanitize(Gh.parse("```"+e+"```",{breaks:!0}),{ADD_ATTR:["target"]})])).flat().filter(We)??[])})),(()=>{const e=zf(),n=e.firstChild.firstChild.firstChild,o=n.nextSibling;return n.style.setProperty("width","100%"),n.style.setProperty("height","100%"),Se(o,Z(se,{get each(){return t()},children:e=>(()=>{const t=Hf();return t.innerHTML=e,t})()})),e})()},Gf=ve('<div><div class="flex flex-col flex-1 gap-2">'),Wf=ve('<div class="flex flex-col w-full min-w-0 gap-2 typebot-chat-chunk">'),qf=e=>{let t;const[n,o]=_(e.isTransitionDisabled?e.messages.length:0),[r,i]=_();P((()=>{e.streamingMessageId||(0===e.messages.length&&e.onAllBubblesDisplayed(),e.onScrollToBottom(t,50))}));const a=async t=>{(e.settings.typingEmulation?.delayBetweenBubbles??Kn.delayBetweenBubbles)>0&&n()<e.messages.length-1&&await new Promise((t=>setTimeout(t,1e3*(e.settings.typingEmulation?.delayBetweenBubbles??Kn.delayBetweenBubbles))));const r=e.messages[n()].id;await e.onNewBubbleDisplayed(r),o(n()===e.messages.length?n():n()+1),e.onScrollToBottom(t),n()===e.messages.length&&(i(t),e.onAllBubblesDisplayed())};return(()=>{const o=Wf();return Se(o,Z(le,{get when(){return e.messages.length>0},get children(){const t=Gf(),o=t.firstChild;return Se(t,Z(le,{get when(){return(e.theme.chat?.hostAvatar?.isEnabled??Zd)&&e.messages.length>0},get children(){return Z(hh,{get hostAvatarSrc(){return e.theme.chat?.hostAvatar?.url},get hideAvatar(){return e.hideAvatar},get isTransitionDisabled(){return e.isTransitionDisabled}})}}),o),Se(o,Z(se,{get each(){return e.messages.slice(0,n()+1)},children:(t,n)=>Z(po,{message:t,get typingEmulation(){return e.settings.typingEmulation},get isTypingSkipped(){return E((()=>!(!(e.settings.typingEmulation?.isDisabledOnFirstMessage??Kn.isDisabledOnFirstMessage)||0!==e.index)))()&&0===n()},get onTransitionEnd(){return e.isTransitionDisabled?void 0:a},get onCompleted(){return e.onSubmit}})})),T((n=>{const r="flex"+(Kt()?" gap-1":" gap-2"),i=e.theme.chat?.guestAvatar?.isEnabled?Kt()?"calc(100% - 60px)":"calc(100% - 48px - 48px)":"100%";return r!==n._v$&&ke(t,n._v$=r),i!==n._v$2&&(null!=(n._v$2=i)?o.style.setProperty("max-width",i):o.style.removeProperty("max-width")),n}),{_v$:void 0,_v$2:void 0}),t}}),null),Se(o,(()=>{const o=E((()=>!(!e.input||n()!==e.messages.length)));return()=>o()&&Z(lh,{ref(e){"function"==typeof t?t(e):t=e},get block(){return e.input},get chunkIndex(){return e.index},get hasHostAvatar(){return e.theme.chat?.hostAvatar?.isEnabled??Zd},get guestAvatar(){return e.theme.chat?.guestAvatar},get context(){return e.context},get isInputPrefillEnabled(){return e.settings.general?.isInputPrefillEnabled??qn.isInputPrefillEnabled},get hasError(){return e.hasError},onTransitionEnd:()=>e.onScrollToBottom(r()),get onSubmit(){return e.onSubmit},get onSkip(){return e.onSkip}})})(),null),Se(o,Z(le,{get when(){return e.streamingMessageId},keyed:!0,children:t=>(()=>{const n=Gf(),o=n.firstChild;return Se(n,Z(le,{get when(){return e.theme.chat?.hostAvatar?.isEnabled??Zd},get children(){return Z(hh,{get hostAvatarSrc(){return e.theme.chat?.hostAvatar?.url},get hideAvatar(){return e.hideAvatar}})}}),o),Se(o,Z(Vf,{streamingMessageId:t,get context(){return e.context}})),T((t=>{const r="flex"+(Kt()?" gap-1":" gap-2"),i=e.theme.chat?.guestAvatar?.isEnabled?Kt()?"calc(100% - 60px)":"calc(100% - 48px - 48px)":"100%";return r!==t._v$3&&ke(n,t._v$3=r),i!==t._v$4&&(null!=(t._v$4=i)?o.style.setProperty("max-width",i):o.style.removeProperty("max-width")),t}),{_v$3:void 0,_v$4:void 0}),n})()}),null),o})()},Kf=async e=>{e?.trackingId&&(e=>{e&&(window.gtag?window.gtag("event",e.action,{event_category:Ge(e.category)?void 0:e.category,event_label:Ge(e.label)?void 0:e.label,value:e.value,send_to:Ge(e.sendTo)?void 0:e.sendTo}):console.error("Google Analytics was not properly initialized"))})(e)};var Yf={exports:{}};const Xf="undefined"!=typeof Buffer,Zf=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Jf=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Qf(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),Xf&&Buffer.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));const o=JSON.parse(e,t);if(null===o||"object"!=typeof o)return o;const r=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if("ignore"===r&&"ignore"===i)return o;if("ignore"!==r&&"ignore"!==i){if(!1===Zf.test(e)&&!1===Jf.test(e))return o}else if("ignore"!==r&&"ignore"===i){if(!1===Zf.test(e))return o}else if(!1===Jf.test(e))return o;return em(o,{protoAction:r,constructorAction:i,safe:n&&n.safe})}function em(e,{protoAction:t="error",constructorAction:n="error",safe:o}={}){let r=[e];for(;r.length;){const e=r;r=[];for(const i of e){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(i,"__proto__")){if(!0===o)return null;if("error"===t)throw new SyntaxError("Object contains forbidden prototype property");delete i.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(i,"constructor")&&Object.prototype.hasOwnProperty.call(i.constructor,"prototype")){if(!0===o)return null;if("error"===n)throw new SyntaxError("Object contains forbidden prototype property");delete i.constructor}for(const e in i){const t=i[e];t&&"object"==typeof t&&r.push(t)}}}return e}function tm(e,t,n){const o=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return Qf(e,t,n)}finally{Error.stackTraceLimit=o}}Yf.exports=tm,Yf.exports.default=tm,Yf.exports.parse=tm,Yf.exports.safeParse=function(e,t){const n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return Qf(e,t,{safe:!0})}catch(e){return null}finally{Error.stackTraceLimit=n}},Yf.exports.scan=em;var nm={code:"0",name:"text",parse:e=>{if("string"!=typeof e)throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},om={code:"1",name:"function_call",parse:e=>{if(null==e||"object"!=typeof e||!("function_call"in e)||"object"!=typeof e.function_call||null==e.function_call||!("name"in e.function_call)||!("arguments"in e.function_call)||"string"!=typeof e.function_call.name||"string"!=typeof e.function_call.arguments)throw new Error('"function_call" parts expect an object with a "function_call" property.');return{type:"function_call",value:e}}},rm={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},im={code:"3",name:"error",parse:e=>{if("string"!=typeof e)throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},am={code:"4",name:"assistant_message",parse:e=>{if(!(null!=e&&"object"==typeof e&&"id"in e&&"role"in e&&"content"in e&&"string"==typeof e.id&&"string"==typeof e.role&&"assistant"===e.role&&Array.isArray(e.content)&&e.content.every((e=>null!=e&&"object"==typeof e&&"type"in e&&"text"===e.type&&"text"in e&&null!=e.text&&"object"==typeof e.text&&"value"in e.text&&"string"==typeof e.text.value))))throw new Error('"assistant_message" parts expect an object with an "id", "role", and "content" property.');return{type:"assistant_message",value:e}}},sm={code:"5",name:"assistant_control_data",parse:e=>{if(null==e||"object"!=typeof e||!("threadId"in e)||!("messageId"in e)||"string"!=typeof e.threadId||"string"!=typeof e.messageId)throw new Error('"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.');return{type:"assistant_control_data",value:{threadId:e.threadId,messageId:e.messageId}}}},lm={code:"6",name:"data_message",parse:e=>{if(null==e||"object"!=typeof e||!("role"in e)||!("data"in e)||"string"!=typeof e.role||"data"!==e.role)throw new Error('"data_message" parts expect an object with a "role" and "data" property.');return{type:"data_message",value:e}}},cm={code:"7",name:"tool_calls",parse:e=>{if(null==e||"object"!=typeof e||!("tool_calls"in e)||"object"!=typeof e.tool_calls||null==e.tool_calls||!Array.isArray(e.tool_calls)||e.tool_calls.some((e=>!(null!=e&&"object"==typeof e&&"id"in e&&"string"==typeof e.id&&"type"in e&&"string"==typeof e.type&&"function"in e&&null!=e.function&&"object"==typeof e.function&&"arguments"in e.function&&"string"==typeof e.function.name&&"string"==typeof e.function.arguments))))throw new Error('"tool_calls" parts expect an object with a ToolCallPayload.');return{type:"tool_calls",value:e}}},dm={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw new Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},um={code:"9",name:"tool_call",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("toolName"in e)||"string"!=typeof e.toolName||!("args"in e)||"object"!=typeof e.args)throw new Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},pm={code:"a",name:"tool_result",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("result"in e))throw new Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},gm={code:"b",name:"tool_call_streaming_start",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("toolName"in e)||"string"!=typeof e.toolName)throw new Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},hm={code:"c",name:"tool_call_delta",parse:e=>{if(null==e||"object"!=typeof e||!("toolCallId"in e)||"string"!=typeof e.toolCallId||!("argsTextDelta"in e)||"string"!=typeof e.argsTextDelta)throw new Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},fm={code:"d",name:"finish_message",parse:e=>{if(!(null!=e&&"object"==typeof e&&"finishReason"in e&&"string"==typeof e.finishReason&&"usage"in e&&null!=e.usage&&"object"==typeof e.usage&&"promptTokens"in e.usage&&"completionTokens"in e.usage))throw new Error('"finish_message" parts expect an object with a "finishReason" and "usage" property.');return"number"!=typeof e.usage.promptTokens&&(e.usage.promptTokens=Number.NaN),"number"!=typeof e.usage.completionTokens&&(e.usage.completionTokens=Number.NaN),{type:"finish_message",value:e}}},mm=[nm,om,rm,im,am,sm,lm,cm,dm,um,pm,gm,hm,fm],bm={[nm.code]:nm,[om.code]:om,[rm.code]:rm,[im.code]:im,[am.code]:am,[sm.code]:sm,[lm.code]:lm,[cm.code]:cm,[dm.code]:dm,[um.code]:um,[pm.code]:pm,[gm.code]:gm,[hm.code]:hm,[fm.code]:fm},ym=mm.map((e=>e.code)),vm=e=>{const t=e.indexOf(":");if(-1===t)throw new Error("Failed to parse stream string. No separator found.");const n=e.slice(0,t);if(!ym.includes(n))throw new Error(`Failed to parse stream string. Invalid code ${n}.`);const o=n,r=e.slice(t+1),i=JSON.parse(r);return bm[o].parse(i)},wm="\n".charCodeAt(0);function xm(e,t){const n=new Uint8Array(t);let o=0;for(const t of e)n.set(t,o),o+=t.length;return e.length=0,n}let km=null;const _m=e=>async({messages:t,onMessageStream:n})=>{try{km=new AbortController;const o=e.apiHost,r=await fetch((We(o)?o:xt())+`/api/v2/sessions/${e.sessionId}/streamMessage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:t}),signal:km.signal});if(!r.ok)return(e.retryAttempt??0)<1&&(403===r.status||500===r.status||503===r.status)?(await new Promise((e=>setTimeout(e,3e3))),_m({...e,retryAttempt:(e.retryAttempt??0)+1})({messages:t,onMessageStream:n})):{error:await r.json()||"Failed to fetch the chat response."};if(!r.body)throw new Error("The response body is empty.");let i="";const a=r.body.getReader(),s=ie();for await(const{type:e,value:t}of async function*(e,{isAborted:t}={}){const n=new TextDecoder,o=[];let r=0;for(;;){const{value:i}=await e.read();if(i&&(o.push(i),r+=i.length,i[i.length-1]!==wm))continue;if(0===o.length)break;const a=xm(o,r);r=0;const s=n.decode(a,{stream:!0}).split("\n").filter((e=>""!==e)).map(vm);for(const e of s)yield e;if(null==t?void 0:t()){e.cancel();break}}}(a,{isAborted:()=>null===km}))"text"===e&&(i+=t,n&&n({id:s,message:i}));return km=null,{message:i}}catch(e){return console.error(e),"AbortError"===e.name?(km=null,{error:{message:"Request aborted"}}):e instanceof Error?{error:{message:e.message}}:{error:{message:"Failed to fetch the chat response."}}}},Tm=e=>{if(Ve(e))return null;if("string"==typeof e)return e;try{return JSON.stringify(e)}catch{return console.warn("Failed to safely stringify variable value",e),null}},Sm=Object.getPrototypeOf((async function(){})).constructor,Em=async e=>{Ge(e?.pixelId)||(e=>{if(!e?.eventType||!e.pixelId)return;if(!window.fbq)return void console.error("Facebook Pixel was not properly initialized");const t=e.params?.length?e.params.reduce(((e,t)=>t.key&&t.value?{...e,[t.key]:t.value}:e),{}):void 0;if("Custom"===e.eventType){if(!e.name)return;window.fbq("trackSingleCustom",e.pixelId,e.name,t)}window.fbq("trackSingle",e.pixelId,e.eventType,t)})(e)},Cm=async e=>{const t=e.customHeadCode;We(t)&&(e=>{e.split("</noscript>").forEach((e=>{const[t,n]=e.split("<noscript>"),o=document.createRange().createContextualFragment(t);if(document.head.append(o),Ve(n))return;const r=document.createElement("noscript"),i=document.createRange().createContextualFragment(n);r.append(i),document.head.append(r)}))})(t);const n=e.gtmId;We(n)&&document.body.prepend((e=>{if(document.getElementById("gtm-noscript"))return"";const t=document.createElement("noscript");t.id="gtm-noscript";const n=document.createElement("iframe");return n.src=`https://www.googletagmanager.com/ns.html?id=${e}`,n.height="0",n.width="0",n.style.display="none",n.style.visibility="hidden",t.appendChild(n),t})(n));const o=e.googleAnalyticsId;var r;We(o)&&await(r=o,He(window.gtag)?Promise.resolve():new Promise((e=>{const t=document.getElementById("gtag");if(!t){const t=document.createElement("script");t.src=`https://www.googletagmanager.com/gtag/js?id=${r}`,t.id="gtag";const n=document.createElement("script");n.innerHTML=`window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n \n gtag('config', '${r}');\n `,document.body.appendChild(t),document.body.appendChild(n),t.onload=()=>{e()}}t&&e()})));const i=e.pixelIds;He(i)&&(e=>{const t=document.createElement("script");t.innerHTML=`!function(f,b,e,v,n,t,s)\n {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n n.queue=[];t=b.createElement(e);t.async=!0;\n t.src=v;s=b.getElementsByTagName(e)[0];\n s.parentNode.insertBefore(t,s)}(window, document,'script',\n 'https://connect.facebook.net/en_US/fbevents.js');\n ${e.map((e=>`fbq('init', '${e}');`)).join("\n")}\n fbq('track', 'PageView');`,document.head.appendChild(t)})(i)},Pm=async({clientSideAction:e,context:t,onMessageStream:n})=>{if("chatwoot"in e)return o=e.chatwoot,void wn(o.scriptToExecute);var o;if("googleAnalytics"in e)return Kf(e.googleAnalytics);if("scriptToExecute"in e)return wn(e.scriptToExecute);if("redirect"in e)return(({url:e,isNewTab:t}={})=>{if(!e)return;return window.open(e,t?"_blank":"_top")?void 0:{blockedPopupUrl:e}})(e.redirect);if("wait"in e)return await(async({secondsToWaitFor:e})=>{await new Promise((t=>setTimeout(t,1e3*e)))})(e.wait),e.expectsDedicatedReply?{replyToSend:void 0}:void 0;if("setVariable"in e)return(async({content:e,args:t,isCode:n})=>{try{if(!isNaN(e)&&/0[^.].+/.test(e))return{replyToSend:e};const n=Sm(...t.map((e=>e.id)),e.includes("return ")?e:`return ${e}`),o=await n(...t.map((e=>e.value)));return{replyToSend:Tm(o)??void 0}}catch(t){return console.error(t),{replyToSend:Tm(e)??void 0,logs:n?[{status:"error",description:"Failed to execute Set Variable code",details:yn(t)}]:void 0}}})(e.setVariable.scriptToExecute);if("streamOpenAiChatCompletion"in e||"stream"in e){const{error:o,message:r}=await _m(t)({messages:"streamOpenAiChatCompletion"in e?e.streamOpenAiChatCompletion?.messages:void 0,onMessageStream:n});return o?{replyToSend:void 0,logs:[{status:"error",description:"Message streaming returned an error",details:JSON.stringify(o,null,2)}]}:{replyToSend:r}}if("webhookToExecute"in e){return{replyToSend:await(async e=>{const{url:t,method:n,body:o,headers:r}=e;try{const e=await fetch(t,{method:n,body:"GET"!==n&&o?JSON.stringify(o):void 0,headers:r}),i=e.status,a=await e.json();return JSON.stringify({statusCode:i,data:a})}catch(e){return console.error(e),JSON.stringify({statusCode:500,data:"An error occured while executing the webhook on the client"})}})(e.webhookToExecute)}}return"startPropsToInject"in e?Cm(e.startPropsToInject):"pixel"in e?Em(e.pixel):"codeToExecute"in e?kn(e.codeToExecute):void 0},Im=ve('<div class="flex flex-col animate-fade-in"><div class="flex w-full items-center"><div class="flex relative items-start typebot-host-bubble"><div class="flex items-center absolute px-4 py-2 bubble-typing " data-testid="host-bubble"></div><p class="overflow-hidden text-fade-in mx-4 my-2 whitespace-pre-wrap slate-html-container relative opacity-0 h-6 text-ellipsis">'),Om=()=>(()=>{const e=Im(),t=e.firstChild.firstChild.firstChild;return t.style.setProperty("width","64px"),t.style.setProperty("height","32px"),Se(t,Z(rn,{})),e})(),Am=ve('<div class="flex w-full typebot-loading-chunk"><div class="flex flex-col w-full min-w-0"><div class="flex gap-2">'),$m=e=>(()=>{const t=Am(),n=t.firstChild.firstChild;return Se(n,Z(le,{get when(){return e.theme.chat?.hostAvatar?.isEnabled??Zd},get children(){return Z(hh,{get hostAvatarSrc(){return e.theme.chat?.hostAvatar?.url}})}}),null),Se(n,Z(Om,{}),null),t})(),Rm=ve('<div class="w-full max-w-xs p-4 text-gray-500 bg-white shadow flex flex-col gap-2 typebot-popup-blocked-toast" role="alert"><div class="flex flex-col gap-1"><span class=" text-sm font-semibold text-gray-900">Popup blocked</span><div class="text-sm font-normal">The bot wants to open a new tab but it was blocked by your browser. It needs a manual approval.</div></div><a target="_blank" class="py-1 px-4 justify-center text-sm font-semibold text-white focus:outline-none flex items-center disabled:opacity-50 disabled:cursor-not-allowed disabled:brightness-100 filter hover:brightness-90 active:brightness-75 typebot-button" rel="noreferrer">Continue in new tab'),Nm=e=>(()=>{const t=Rm(),n=t.firstChild.nextSibling;return n.$$click=()=>e.onLinkClick(),T((()=>xe(n,"href",e.url))),t})();we(["click"]);const Lm=async({apiHost:e,sessionId:t,clientLogs:n})=>{try{await Wt.post(`${We(e)?e:xt()}/api/v1/sessions/${t}/clientLogs`,{json:{clientLogs:n}})}catch(e){console.log(e)}},Dm=e=>"text"===e.type?e.label??e.value:e.url,Mm=ve('<div class="flex flex-col overflow-y-auto w-full px-3 pt-10 relative scrollable-container typebot-chat-view scroll-smooth gap-2">'),Um=ve('<div class="flex justify-end">'),Bm=ve('<div class="w-full flex-shrink-0 typebot-bottom-spacer">'),Fm=e=>{let t;const[n,o,r,i]=rh(_([{input:e.initialChatReply.input,messages:e.initialChatReply.messages,clientSideActions:e.initialChatReply.clientSideActions}]),{key:`typebot-${e.context.typebot.id}-chatChunks`,storage:e.context.storage,onRecovered:()=>{setTimeout((()=>{t?.scrollTo(0,t.scrollHeight)}),200)}}),[a,s]=_(e.initialChatReply.dynamicTheme),[l,c]=_(e.initialChatReply.typebot.theme),[d,u]=_(!1),[p,g]=_(),[h,f]=_(!1);P((()=>{(async()=>{const e=n()[0];if(!e.clientSideActions)return;const t=e.clientSideActions.filter((e=>Ve(e.lastBubbleBlockId)));await k(t)})()}));const m=({id:e,message:t})=>{u(!1);const r=[...n()].pop();r&&(r.streamingMessageId!==e&&o((t=>[...t,{messages:[],streamingMessageId:e}])),mh({id:e,content:t}))};S((()=>{c(((e,t)=>({...e,chat:{...e.chat,hostAvatar:e.chat?.hostAvatar&&t?.hostAvatarUrl?{...e.chat.hostAvatar,url:t.hostAvatarUrl}:e.chat?.hostAvatar,guestAvatar:e.chat?.guestAvatar&&t?.guestAvatarUrl?{...e.chat.guestAvatar,url:t?.guestAvatarUrl}:e.chat?.guestAvatar}}))(e.initialChatReply.typebot.theme,a()))}));const b=async t=>{t&&(e.onNewLogs?.(t),e.context.isPreview||await Lm({apiHost:e.context.apiHost,sessionId:e.initialChatReply.sessionId,clientLogs:t}))},y=async t=>{i(!1),f(!1);const r=[...n()].pop()?.input;r?.id&&e.onAnswer&&t&&e.onAnswer({message:Dm(t),blockId:r.id});const a=setTimeout((()=>{u(!0)}),1e3);v();const{data:l,error:c}=await(async({apiHost:e,message:t,sessionId:n})=>{try{return{data:await Wt.post(`${We(e)?e:xt()}/api/v1/sessions/${n}/continueChat`,{json:{message:t},timeout:!1}).json()}}catch(e){return{error:e}}})({apiHost:e.context.apiHost,sessionId:e.initialChatReply.sessionId,message:zm(t)});if(clearTimeout(a),u(!1),c){f(!0);const t=[{description:"Failed to send the reply",details:c instanceof Tt?{status:c.response.status,body:await c.response.json()}:c,status:"error"}];return await Lm({apiHost:e.context.apiHost,sessionId:e.initialChatReply.sessionId,clientLogs:t}),void e.onNewLogs?.(t)}if(l){if(l.progress&&e.onProgressUpdate?.(l.progress),l.lastMessageNewFormat&&oh([...nh(),{inputIndex:[...n()].length-1,formattedMessage:l.lastMessageNewFormat}]),l.logs&&e.onNewLogs?.(l.logs),l.dynamicTheme&&s(l.dynamicTheme),l.input&&e.onNewInputBlock&&e.onNewInputBlock(l.input),l.clientSideActions){const e=l.clientSideActions.filter((e=>Ve(e.lastBubbleBlockId)));if(await k(e),1===l.clientSideActions.length&&"stream"===l.clientSideActions[0].type&&0===l.messages.length&&void 0===l.input)return}o((e=>[...e,{input:l.input,messages:l.messages,clientSideActions:l.clientSideActions}]))}},v=(e,n=0)=>{if(!t)return;const o=.6*t.clientHeight-128;t.scrollTop+t.clientHeight>=t.scrollHeight-o&&setTimeout((()=>{t?.scrollTo(0,e?e.offsetTop-n:t.scrollHeight)}),50)},w=async()=>{const t=[...n()].pop();t&&Ve(t.input)&&e.onEnd?.()},x=async e=>{const t=[...n()].pop();if(t&&t.clientSideActions){const n=t.clientSideActions.filter((t=>t.lastBubbleBlockId===e));await k(n)}},k=async t=>{if(!r())for(const n of t){("streamOpenAiChatCompletion"in n||"webhookToExecute"in n||"stream"in n)&&u(!0);const t=await Pm({clientSideAction:n,context:{apiHost:e.context.apiHost,sessionId:e.initialChatReply.sessionId},onMessageStream:m});if(t&&"logs"in t&&b(t.logs),t&&"replyToSend"in t)return u(!1),void y(t.replyToSend?{type:"text",value:t.replyToSend}:void 0);t&&"blockedPopupUrl"in t&&g(t.blockedPopupUrl)}};I((()=>{mh(void 0),oh([])}));const T=()=>y(void 0);return(()=>{const o=Mm();return"function"==typeof t?Te(t,o):t=o,Se(o,Z(se,{get each(){return n()},children:(t,o)=>Z(qf,{get index(){return o()},get messages(){return t.messages},get input(){return t.input},get theme(){return l()},get settings(){return e.initialChatReply.typebot.settings},get streamingMessageId(){return t.streamingMessageId},get context(){return e.context},get hideAvatar(){return E((()=>!t.input))()&&((n()[o()+1]?.messages??0).length>0||void 0!==n()[o()+1]?.streamingMessageId||t.messages.length>0&&d())},get hasError(){return E((()=>!!h()))()&&o()===n().length-1},get isTransitionDisabled(){return o()!==n().length-1},onNewBubbleDisplayed:x,onAllBubblesDisplayed:w,onSubmit:y,onScrollToBottom:v,onSkip:T})}),null),Se(o,Z(le,{get when(){return d()},get children(){return Z($m,{get theme(){return l()}})}}),null),Se(o,Z(le,{get when(){return p()},keyed:!0,children:e=>(()=>{const t=Um();return Se(t,Z(Nm,{url:e,onLinkClick:()=>g(void 0)})),t})()}),null),Se(o,Z(jm,{}),null),o})()},jm=()=>(()=>{const e=Bm();return e.style.setProperty("height","128px"),e})(),zm=e=>{if(e)return"text"===e.type?{type:"text",text:e.value,attachedFileUrls:e.attachments?.map((e=>e.url))}:"recording"===e.type?{type:"audio",url:e.url}:void 0},Hm=ve('<div class="h-full flex justify-center items-center flex-col"><p class="text-2xl text-center"></p><pre>'),Vm=e=>(()=>{const t=Hm(),n=t.firstChild,o=n.nextSibling;return Se(n,(()=>e.error.message)),Se(o,(()=>JSON.stringify(e.error.cause,null,2))),t})(),Gm="resultId",Wm=(e,{typebotId:t,storage:n})=>{try{const o=JSON.stringify(e);Xm(n).setItem(`typebot-${t}-initialChatReply`,o)}catch{}},qm=()=>{try{sessionStorage.setItem("typebot-botOpened","true")}catch{}},Km=()=>{try{sessionStorage.removeItem("typebot-botOpened")}catch{}},Ym=()=>{try{return"true"===sessionStorage.getItem("typebot-botOpened")}catch{return!1}},Xm=e=>"session"===(e??qn.rememberUser.storage)?sessionStorage:localStorage,Zm=e=>{Object.keys(localStorage).forEach((t=>{t.startsWith(`typebot-${e}`)&&localStorage.removeItem(t)})),Object.keys(sessionStorage).forEach((t=>{t.startsWith(`typebot-${e}`)&&sessionStorage.removeItem(t)}))},Jm={bgImage:"--typebot-container-bg-image",bgColor:"--typebot-container-bg-color",fontFamily:"--typebot-container-font-family",progressBar:{position:"--typebot-progress-bar-position",color:"--typebot-progress-bar-color",colorRgb:"--typebot-progress-bar-bg-rgb",height:"--typebot-progress-bar-height",top:"--typebot-progress-bar-top",bottom:"--typebot-progress-bar-bottom"}},Qm={container:{maxWidth:"--typebot-chat-container-max-width",maxHeight:"--typebot-chat-container-max-height",bgColor:"--typebot-chat-container-bg-rgb",color:"--typebot-chat-container-color",borderRadius:"--typebot-chat-container-border-radius",borderWidth:"--typebot-chat-container-border-width",borderColor:"--typebot-chat-container-border-rgb",borderOpacity:"--typebot-chat-container-border-opacity",opacity:"--typebot-chat-container-opacity",blur:"--typebot-chat-container-blur",boxShadow:"--typebot-chat-container-box-shadow"},hostBubbles:{bgColor:"--typebot-host-bubble-bg-rgb",color:"--typebot-host-bubble-color",borderRadius:"--typebot-host-bubble-border-radius",borderWidth:"--typebot-host-bubble-border-width",borderColor:"--typebot-host-bubble-border-rgb",borderOpacity:"--typebot-host-bubble-border-opacity",opacity:"--typebot-host-bubble-opacity",blur:"--typebot-host-bubble-blur",boxShadow:"--typebot-host-bubble-box-shadow"},guestBubbles:{bgColor:"--typebot-guest-bubble-bg-rgb",color:"--typebot-guest-bubble-color",borderRadius:"--typebot-guest-bubble-border-radius",borderWidth:"--typebot-guest-bubble-border-width",borderColor:"--typebot-guest-bubble-border-rgb",borderOpacity:"--typebot-guest-bubble-border-opacity",opacity:"--typebot-guest-bubble-opacity",blur:"--typebot-guest-bubble-blur",boxShadow:"--typebot-guest-bubble-box-shadow"},inputs:{bgColor:"--typebot-input-bg-rgb",color:"--typebot-input-color",placeholderColor:"--typebot-input-placeholder-color",borderRadius:"--typebot-input-border-radius",borderWidth:"--typebot-input-border-width",borderColor:"--typebot-input-border-rgb",borderOpacity:"--typebot-input-border-opacity",opacity:"--typebot-input-opacity",blur:"--typebot-input-blur",boxShadow:"--typebot-input-box-shadow"},buttons:{bgRgb:"--typebot-button-bg-rgb",color:"--typebot-button-color",borderRadius:"--typebot-button-border-radius",borderWidth:"--typebot-button-border-width",borderColor:"--typebot-button-border-rgb",borderOpacity:"--typebot-button-border-opacity",opacity:"--typebot-button-opacity",blur:"--typebot-button-blur",boxShadow:"--typebot-button-box-shadow"},checkbox:{bgRgb:"--typebot-checkbox-bg-rgb",alphaRatio:"--selectable-alpha-ratio"}},eb=(e,t,n)=>{cb(e?.background,t),t.setProperty(Jm.fontFamily,("string"==typeof e?.font?e.font:e?.font?.family)??Fd),tb(e?.progressBar,t,n)},tb=(e,t,n)=>{const o=e?.position??Hd;t.setProperty(Jm.progressBar.position,"fixed"===o?n?"absolute":"fixed":o),t.setProperty(Jm.progressBar.color,e?.color??"#0042DA"),t.setProperty(Jm.progressBar.colorRgb,Ke(e?.backgroundColor??"#e0edff").join(", ")),t.setProperty(Jm.progressBar.height,`${e?.thickness??4}px`);const r=e?.placement??"Top";t.setProperty(Jm.progressBar.top,"Top"===r?"0":"auto"),t.setProperty(Jm.progressBar.bottom,"Bottom"===r?"0":"auto")},nb=(e,t,n)=>{ob(e?.container,t,n,e?.roundness),rb(e?.hostBubbles,n,e?.roundness),ib(e?.guestBubbles,n,e?.roundness),ab(e?.buttons,n,e?.roundness),sb(e?.inputs,n,e?.roundness),lb(e?.container,t,n)},ob=(e,t,n,o)=>{const r=e?.backgroundColor??Gd,i="transparent"===r||Ge(r);n.setProperty(Qm.container.bgColor,i?"0, 0, 0":Ke(r).join(", ")),n.setProperty(Qm.container.color,Ke(e?.color??((({chatContainer:e,generalBackground:t})=>{const n=e?.backgroundColor??Gd;if((e?.opacity??1)<=.3||"transparent"===n||Ge(n)){const e=t?.type??jd,n=e===Md.IMAGE?"#000000":e===Md.COLOR&&We(t?.content)?t.content:"#ffffff";return Ye(n)}return Ye(e?.backgroundColor??zd)})({chatContainer:e,generalBackground:t})?Ud:Bd)).join(", ")),n.setProperty(Qm.container.maxWidth,e?.maxWidth??"800px"),n.setProperty(Qm.container.maxHeight,e?.maxHeight??"100%");const a=i?"1":(e?.opacity??1).toString();n.setProperty(Qm.container.opacity,i?"0":(e?.opacity??1).toString()),n.setProperty(Qm.container.blur,"1"===a||i?"0xp":`${e?.blur??0}px`),pb(e?.shadow,n,Qm.container.boxShadow),ub(e?.border??{roundeness:o??Vd},n,Qm.container.borderRadius),n.setProperty(Qm.container.borderWidth,He(e?.border?.thickness)?`${e?.border?.thickness}px`:"0"),n.setProperty(Qm.container.borderOpacity,He(e?.border?.opacity)?e.border.opacity.toString():1..toString()),n.setProperty(Qm.container.borderColor,Ke(e?.border?.color??"").join(", "))},rb=(e,t,n)=>{t.setProperty(Qm.hostBubbles.bgColor,Ke(e?.backgroundColor??"#F7F8FF").join(", ")),t.setProperty(Qm.hostBubbles.color,e?.color??Wd),ub(e?.border??{roundeness:n??Vd},t,Qm.hostBubbles.borderRadius),t.setProperty(Qm.hostBubbles.borderWidth,He(e?.border?.thickness)?`${e?.border?.thickness}px`:"0"),t.setProperty(Qm.hostBubbles.borderColor,Ke(e?.border?.color??"").join(", ")),t.setProperty(Qm.hostBubbles.opacity,"transparent"===e?.backgroundColor?"0":He(e?.opacity)?e.opacity.toString():1..toString()),t.setProperty(Qm.hostBubbles.borderOpacity,He(e?.border?.opacity)?e.border.opacity.toString():1..toString()),t.setProperty(Qm.hostBubbles.blur,He(e?.blur)?`${e.blur??0}px`:"none"),pb(e?.shadow,t,Qm.hostBubbles.boxShadow)},ib=(e,t,n)=>{t.setProperty(Qm.guestBubbles.bgColor,Ke(e?.backgroundColor??"#FF8E21").join(", ")),t.setProperty(Qm.guestBubbles.color,e?.color??qd),ub(e?.border??{roundeness:n??Vd},t,Qm.guestBubbles.borderRadius),t.setProperty(Qm.guestBubbles.borderWidth,He(e?.border?.thickness)?`${e?.border?.thickness}px`:"0"),t.setProperty(Qm.guestBubbles.borderColor,Ke(e?.border?.color??"").join(", ")),t.setProperty(Qm.guestBubbles.borderOpacity,He(e?.border?.opacity)?e.border.opacity.toString():1..toString()),t.setProperty(Qm.guestBubbles.opacity,"transparent"===e?.backgroundColor?"0":He(e?.opacity)?e.opacity.toString():1..toString()),t.setProperty(Qm.guestBubbles.blur,He(e?.blur)?`${e.blur??0}px`:"none"),pb(e?.shadow,t,Qm.guestBubbles.boxShadow)},ab=(e,t,n)=>{const o=e?.backgroundColor??Kd;t.setProperty(Qm.buttons.bgRgb,Ke(o).join(", ")),t.setProperty(Qm.buttons.bgRgb,Ke(o).join(", ")),t.setProperty(Qm.buttons.color,e?.color??Yd),ub(e?.border??{roundeness:n??Vd},t,Qm.buttons.borderRadius),t.setProperty(Qm.buttons.borderWidth,He(e?.border?.thickness)?`${e?.border?.thickness}px`:"1px"),t.setProperty(Qm.buttons.borderColor,Ke(e?.border?.color??e?.backgroundColor??Kd).join(", ")),t.setProperty(Qm.buttons.borderOpacity,He(e?.border?.opacity)?e.border.opacity.toString():1..toString()),t.setProperty(Qm.buttons.opacity,"transparent"===e?.backgroundColor?"0":He(e?.opacity)?e.opacity.toString():1..toString()),t.setProperty(Qm.buttons.blur,He(e?.blur)?`${e.blur??0}px`:"none"),pb(e?.shadow,t,Qm.buttons.boxShadow)},sb=(e,t,n)=>{t.setProperty(Qm.inputs.bgColor,Ke(e?.backgroundColor??"#FFFFFF").join(", ")),t.setProperty(Qm.inputs.color,e?.color??Xd),t.setProperty(Qm.inputs.placeholderColor,e?.placeholderColor??"#9095A0"),ub(e?.border??{roundeness:n??Vd},t,Qm.inputs.borderRadius),t.setProperty(Qm.inputs.borderWidth,He(e?.border?.thickness)?`${e?.border?.thickness}px`:"0"),t.setProperty(Qm.inputs.borderColor,Ke(e?.border?.color??"").join(", ")),t.setProperty(Qm.inputs.borderOpacity,He(e?.border?.opacity)?e.border.opacity.toString():1..toString()),t.setProperty(Qm.inputs.opacity,"transparent"===e?.backgroundColor?"0":He(e?.opacity)?e.opacity.toString():1..toString()),t.setProperty(Qm.inputs.blur,He(e?.blur)?`${e.blur??0}px`:"none"),pb(e?.shadow??"md",t,Qm.inputs.boxShadow)},lb=(e,t,n)=>{const o=e?.backgroundColor??Gd;if("transparent"===o||Ge(o)||(e?.opacity??1)<=.2){const e=t?.type??jd;n.setProperty(Qm.checkbox.bgRgb,e===Md.IMAGE?"rgba(255, 255, 255, 0.75)":Ke((e===Md.COLOR?t?.content:"#ffffff")??"#ffffff").join(", ")),e===Md.IMAGE?n.setProperty(Qm.checkbox.alphaRatio,"3"):n.setProperty(Qm.checkbox.alphaRatio,t?.content&&Ye(t?.content)?"1":"2")}else n.setProperty(Qm.checkbox.bgRgb,Ke(o).concat(e?.opacity??1).join(", ")),n.setProperty(Qm.checkbox.alphaRatio,Ye(o)?"1":"2")},cb=(e,t)=>{t.setProperty(Jm.bgImage,null),t.setProperty(Jm.bgColor,null),t.setProperty((e?.type??jd)===Md.IMAGE?Jm.bgImage:Jm.bgColor,db({type:e?.type??jd,content:e?.content??zd}))},db=({type:e,content:t}={})=>{switch(e){case Md.NONE:return"transparent";case void 0:case Md.COLOR:return t??zd;case Md.IMAGE:return`url(${t})`}},ub=(e,t,n)=>{switch(e?.roundeness??Vd){case"none":t.setProperty(n,"0");break;case"medium":t.setProperty(n,"6px");break;case"large":t.setProperty(n,"20px");break;case"custom":t.setProperty(n,`${e.customRoundeness??6}px`)}},pb=(e,t,n)=>{if(void 0!==e)switch(e){case"none":t.setProperty(n,"0 0 #0000");break;case"sm":t.setProperty(n,"0 1px 2px 0 rgb(0 0 0 / 0.05)");break;case"md":t.setProperty(n,"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)");break;case"lg":t.setProperty(n,"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)");break;case"xl":t.setProperty(n,"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)");break;case"2xl":t.setProperty(n,"0 25px 50px -12px rgb(0 0 0 / 0.25)")}else t.setProperty(n,"0 0 #0000")};const gb="typebot-font",hb=e=>{const t=document.getElementById(gb);if("string"==typeof e||"Google"===e.type){const n=("string"==typeof e?e:e.family)??Fd;if(t?.getAttribute("href")?.includes(n))return;t?.remove();const o=document.createElement("link");return o.href=`https://fonts.bunny.net/css2?family=${n}:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&display=swap`,o.rel="stylesheet",o.id=gb,void document.head.appendChild(o)}if("Custom"===e.type){if(We(e.css)){if(t?.innerHTML===e.css)return;t?.remove();const n=document.createElement("style");n.innerHTML=e.css,n.id=gb,document.head.appendChild(n)}if(We(e.url)){if(t?.getAttribute("href")===e.url)return;t?.remove();const n=document.createElement("link");n.href=e.url,n.rel="stylesheet",n.id=gb,document.head.appendChild(n)}}},fb=ve('<div class="typebot-progress-bar-container"><div class="typebot-progress-bar">'),mb=e=>(()=>{const t=fb(),n=t.firstChild;return T((()=>null!=`${e.value}%`?n.style.setProperty("width",`${e.value}%`):n.style.removeProperty("width"))),t})(),[bb,yb]=_(),vb=ve("<style>"),wb=ve("<div>"),xb=e=>{const[t,n]=_(),[o,r]=_(""),[i,a]=_(!1),[s,l]=_(),c=async()=>{e.font&&hb(e.font),a(!0);const t=new URLSearchParams(location.search);e.onInit?.();const o={};t.forEach(((e,t)=>{o[t]=e}));const i="string"==typeof e.typebot?e.typebot:void 0,s="string"!=typeof e.typebot||(e.isPreview??!1),c=(e=>{if(e)try{return sessionStorage.getItem(`${Gm}-${e}`)??localStorage.getItem(`${Gm}-${e}`)??void 0}catch{}})(i),{data:d,error:u}=await async function({typebot:e,isPreview:t,apiHost:n,prefilledVariables:o,resultId:r,stripeRedirectStatus:i,startFrom:a,sessionId:s}){if(Ve(e))throw new Error("Typebot ID is required to get initial messages");const l=kt()??void 0,c=l?JSON.parse(l):void 0;if(c){_t();try{return{data:{...await Wt.post(`${We(n)?n:xt()}/api/v1/sessions/${c.sessionId}/continueChat`,{json:{message:c?"failed"===i?"fail":"Success":void 0},timeout:!1}).json(),...c}}}catch(e){return{error:e}}}const d="string"==typeof e?e:e.id;if(t)try{return{data:await Wt.post(`${We(n)?n:xt()}/api/v1/bots/${d}/preview/startChat`,{json:{isStreamEnabled:!0,startFrom:a,typebot:e,prefilledVariables:o,sessionId:s},timeout:!1}).json()}}catch(e){return{error:e}}try{const e=parent!==window&&We(document.referrer)?new URL(document.referrer).origin:void 0,t=await Wt.post(`${We(n)?n:xt()}/api/v1/bots/${d}/startChat`,{headers:{"x-typebot-iframe-referrer-origin":e},json:{isStreamEnabled:!0,prefilledVariables:o,resultId:r,isOnlyRegistering:!1},timeout:!1}),i=t.headers.get("access-control-allow-origin");if(e&&i&&"*"!==i&&!e.includes(i))throw new qt(i);return{data:await t.json()}}catch(e){return{error:e}}}({stripeRedirectStatus:t.get("redirect_status")??void 0,typebot:e.typebot,apiHost:e.apiHost,isPreview:s,resultId:We(e.resultId)?e.resultId:c,prefilledVariables:{...o,...e.prefilledVariables},startFrom:e.startFrom,sessionId:e.sessionId});if(u instanceof Tt)return s?l(new Error("An error occurred while loading the bot.",{cause:{status:u.response.status,body:await u.response.json()}})):400===u.response.status||403===u.response.status?l(new Error("This bot is now closed.")):404===u.response.status?l(new Error("The bot you're looking for doesn't exist.")):l(new Error(`Error! Couldn't initiate the chat. (${u.response.statusText})`));if(u instanceof qt)return l(new Error(u.message));if(!d)return u&&(console.error(u),s)?l(new Error("Error! Could not reach server. Check your connection.",{cause:u})):l(new Error("Error! Could not reach server. Check your connection."));if(d.resultId&&i&&(d.typebot.settings.general?.rememberUser?.isEnabled??qn.rememberUser.isEnabled)){c&&c!==d.resultId&&Zm(d.typebot.id);const t=d.typebot.settings.general?.rememberUser?.storage??qn.rememberUser.storage;((e="session")=>(t,n)=>{try{Xm(e).setItem(`${Gm}-${t}`,n)}catch{}})(t)(i,d.resultId);const o=(e=>{if(e)try{const t=sessionStorage.getItem(`typebot-${e}-initialChatReply`)??localStorage.getItem(`typebot-${e}-initialChatReply`);if(!t)return;return JSON.parse(t)}catch{}})(d.typebot.id);o&&o.typebot.publishedAt&&d.typebot.publishedAt?new Date(o.typebot.publishedAt).getTime()===new Date(d.typebot.publishedAt).getTime()?n(o):(Zm(d.typebot.id),n(d),Wm(d,{typebotId:d.typebot.id,storage:t})):(n(d),Wm(d,{typebotId:d.typebot.id,storage:t})),e.onChatStatePersisted?.(!0)}else Zm(d.typebot.id),n(d),d.input?.id&&e.onNewInputBlock&&e.onNewInputBlock(d.input),d.logs&&e.onNewLogs?.(d.logs),e.onChatStatePersisted?.(!1);r(d.typebot.theme.customCss??"")};return S((()=>{Ve(e.typebot)||i()||c().then()})),S((()=>{Ve(e.typebot)||"string"==typeof e.typebot||(r(e.typebot.theme.customCss??""),e.typebot.theme.general?.progressBar?.isEnabled&&t()&&!t()?.typebot.theme.general?.progressBar?.isEnabled&&(a(!1),c().then()))})),I((()=>{a(!1)})),[(()=>{const e=vb();return Se(e,o),e})(),(()=>{const e=vb();return Se(e,"#lite-badge{background-color:#fff!important;border-radius:4px!important;border-width:1px!important;bottom:20px!important;color:#111827!important;display:flex!important;font-size:14px!important;font-weight:600!important;gap:8px!important;left:auto!important;line-height:20px!important;opacity:1!important;padding:4px 8px!important;position:absolute!important;right:auto!important;text-decoration:none!important;top:auto!important;transition:background-color .2s ease-in-out!important;visibility:visible!important;z-index:50!important}#lite-badge:hover{background-color:#f7f8ff!important}"),e})(),Z(le,{get when(){return s()},keyed:!0,children:e=>Z(Vm,{error:e})}),Z(le,{get when(){return t()},keyed:!0,children:t=>Z(kb,{get class(){return e.class},get initialChatReply(){return{...t,typebot:{...t.typebot,settings:"string"==typeof e.typebot?t.typebot?.settings:e.typebot?.settings,theme:"string"==typeof e.typebot?t.typebot?.theme:e.typebot?.theme}}},get context(){return{apiHost:e.apiHost,isPreview:"string"!=typeof e.typebot||(e.isPreview??!1),resultId:t.resultId,sessionId:t.sessionId,typebot:t.typebot,storage:t.typebot.settings.general?.rememberUser?.isEnabled&&"string"==typeof e.typebot&&!e.isPreview?t.typebot.settings.general?.rememberUser?.storage??qn.rememberUser.storage:void 0}},get progressBarRef(){return e.progressBarRef},get onNewInputBlock(){return e.onNewInputBlock},get onNewLogs(){return e.onNewLogs},get onAnswer(){return e.onAnswer},get onEnd(){return e.onEnd}})})]},kb=e=>{const[t,n]=rh(_(e.initialChatReply.progress),{storage:e.context.storage,key:`typebot-${e.context.typebot.id}-progressValue`});let o;const r=new ResizeObserver((e=>Yt(e[0].target.clientWidth<400)));return P((()=>{o&&(yb(o),r.observe(o),Tn(`${o.clientHeight}px`))})),S((()=>{hb(e.initialChatReply.typebot.theme.general?.font??{type:"Google",family:Fd}),o&&((e,t,n)=>{if(!e)return;const o=t?.style;o&&(eb(e.general,o,n),nb(e.chat,e.general?.background,o))})(e.initialChatReply.typebot.theme,o,e.context.isPreview)})),I((()=>{o&&r.unobserve(o)})),(()=>{const r=wb();return"function"==typeof o?Te(o,r):o=r,Se(r,Z(le,{get when(){return He(t())&&e.initialChatReply.typebot.theme.general?.progressBar?.isEnabled},get children(){return Z(le,{get when(){return e.progressBarRef&&"fixed"===(e.initialChatReply.typebot.theme.general?.progressBar?.position??Hd)},get fallback(){return Z(mb,{get value(){return t()}})},get children(){return Z(Ne,{get mount(){return e.progressBarRef},get children(){return Z(mb,{get value(){return t()}})}})}})}}),null),Se(r,Z(Fm,{get context(){return e.context},get initialChatReply(){return e.initialChatReply},get onNewInputBlock(){return e.onNewInputBlock},get onAnswer(){return e.onAnswer},get onEnd(){return e.onEnd},get onNewLogs(){return e.onNewLogs},onProgressUpdate:n}),null),Se(r,Z(le,{get when(){return e.initialChatReply.typebot.settings.general?.isBrandingEnabled},get children(){return Z(vt,{botContainer:o})}}),null),Se(r,Z(qc,{toaster:Ld,children:e=>Z(Yc.Root,{get children(){return[Z(Yc.Title,{get children(){return e().title}}),Z(Yc.Description,{get children(){return e().description}}),Z(Yc.CloseTrigger,{class:"absolute right-2 top-2",get children(){return Z(Zc,{class:"w-4 h-4"})}})]}})}),null),T((()=>ke(r,Ze("relative flex w-full h-full text-base overflow-hidden flex-col justify-center items-center typebot-container",e.class)))),r})()},_b=ve("<style>"),Tb=ve("<div>"),Sb=ve('<div part="bot">'),Eb=e=>{const[t,n]=oe(e,["onOpen","onClose","previewMessage","onPreviewMessageClick","theme","autoShowDelay"]),[o,r]=_(!0),[i,a]=_(n.prefilledVariables),[s,l]=_(!1),[c,d]=_({message:t.previewMessage?.message??"",avatarUrl:t.previewMessage?.avatarUrl}),[u,p]=_(!1),[g,h]=_(!1),[f,m]=_(Cb(t.theme?.button?.size??"medium"));let b;S((()=>{m(Cb(t.theme?.button?.size??"medium"))})),P((()=>{window.addEventListener("message",y);const e=t.autoShowDelay,n=t.previewMessage?.autoShowDelay;(Ym()||kt())&&v(),He(e)&&setTimeout((()=>{v()}),e),He(n)&&setTimeout((()=>{E()}),n)})),I((()=>{window.removeEventListener("message",y)})),S((()=>{e.prefilledVariables&&a((t=>({...t,...e.prefilledVariables})))}));const y=e=>{const{data:t}=e;t.isFromTypebot&&("open"===t.command&&v(),"close"===t.command&&w(),"toggle"===t.command&&x(),"showPreviewMessage"===t.command&&E(t.message),"hidePreviewMessage"===t.command&&C(),"setPrefilledVariables"===t.command&&a((e=>({...e,...t.variables}))),"unmount"===t.command&&O())},v=()=>{g()||h(!0),C(),p(!0),u()&&t.onOpen?.()},w=()=>{p(!1),Km(),u()&&t.onClose?.()},x=()=>{u()?w():v()},k=()=>{t.onPreviewMessageClick?.(),v()},E=e=>{e&&d(e),u()||l(!0)},C=()=>{l(!1)},O=()=>{u()?(w(),setTimeout((()=>{r(!1)}),200)):r(!1)},A=e=>{n.onChatStatePersisted?.(e),e&&qm()};return Z(le,{get when(){return o()},get children(){return Z(dc,{get value(){return document.querySelector("typebot-bubble")?.shadowRoot},get children(){return[(()=>{const e=_b();return Se(e,je),e})(),Z(le,{get when(){return s()},get children(){return Z(ht,ne(c,{get placement(){return t.theme?.placement},get previewMessageTheme(){return t.theme?.previewMessage},get buttonSize(){return f()},onClick:k,onCloseClick:C}))}}),Z(lt,ne((()=>t.theme?.button),{get placement(){return t.theme?.placement},toggleBot:x,get isBotOpened(){return u()},get buttonSize(){return f()}})),(()=>{const e=Tb();return"function"==typeof b?Te(b,e):b=e,e})(),(()=>{const o=Sb();return o.style.setProperty("transition","transform 200ms cubic-bezier(0, 1.2, 1, 1), opacity 150ms ease-out"),o.style.setProperty("box-shadow","rgb(0 0 0 / 16%) 0px 5px 40px"),o.style.setProperty("z-index","42424242"),Se(o,Z(le,{get when(){return g()},get children(){return Z(xb,ne(n,{onChatStatePersisted:A,get prefilledVariables(){return i()},class:"rounded-lg",progressBarRef:b}))}})),T((n=>{const r=`calc(100% - ${f()} - 32px)`,i=e.theme?.chatWindow?.maxHeight??"704px",a=e.theme?.chatWindow?.maxWidth??"400px",s="left"===e.theme?.placement?"bottom left":"bottom right",l=u()?"scale3d(1, 1, 1)":"scale3d(0, 0, 1)",c=t.theme?.chatWindow?.backgroundColor,d=`calc(${f()} + 32px)`,p="fixed rounded-lg w-full"+(u()?" opacity-1":" opacity-0 pointer-events-none")+("left"===e.theme?.placement?" left-5":" sm:right-5 right-0");return r!==n._v$&&(null!=(n._v$=r)?o.style.setProperty("height",r):o.style.removeProperty("height")),i!==n._v$2&&(null!=(n._v$2=i)?o.style.setProperty("max-height",i):o.style.removeProperty("max-height")),a!==n._v$3&&(null!=(n._v$3=a)?o.style.setProperty("max-width",a):o.style.removeProperty("max-width")),s!==n._v$4&&(null!=(n._v$4=s)?o.style.setProperty("transform-origin",s):o.style.removeProperty("transform-origin")),l!==n._v$5&&(null!=(n._v$5=l)?o.style.setProperty("transform",l):o.style.removeProperty("transform")),c!==n._v$6&&(null!=(n._v$6=c)?o.style.setProperty("background-color",c):o.style.removeProperty("background-color")),d!==n._v$7&&(null!=(n._v$7=d)?o.style.setProperty("bottom",d):o.style.removeProperty("bottom")),p!==n._v$8&&ke(o,n._v$8=p),n}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0,_v$7:void 0,_v$8:void 0}),o})()]}})}})},Cb=e=>"medium"===e?"48px":"large"===e?"64px":e||"48px",Pb=ve("<style>"),Ib=ve('<div class="relative" aria-labelledby="modal-title" role="dialog" aria-modal="true"><style></style><div class="fixed inset-0 bg-black bg-opacity-50 transition-opacity animate-fade-in" part="overlay"></div><div class="fixed inset-0 z-10 overflow-y-auto"><div class="flex min-h-full items-center justify-center p-4 text-center sm:p-0"><div>'),Ob=e=>{const[t,n]=oe(e,["onOpen","onClose","autoShowDelay","theme","isOpen","defaultOpen"]),[o,r]=_(n.prefilledVariables),[i,a]=_(t.isOpen??!1);P((()=>{(t.defaultOpen||kt()||Ym())&&c(),window.addEventListener("message",l);const e=t.autoShowDelay;He(e)&&setTimeout((()=>{c()}),e)})),I((()=>{window.removeEventListener("message",l)})),S((()=>{Ve(e.isOpen)||e.isOpen===i()||u()})),S((()=>{e.prefilledVariables&&r((t=>({...t,...e.prefilledVariables})))}));const s=e=>{e.stopPropagation()},l=e=>{const{data:t}=e;t.isFromTypebot&&("open"===t.command&&c(),"close"===t.command&&d(),"toggle"===t.command&&u(),"setPrefilledVariables"===t.command&&r((e=>({...e,...t.variables}))))},c=()=>{a(!0),t.onOpen?.(),document.body.style.setProperty("overflow","hidden","important"),document.addEventListener("pointerdown",d)},d=()=>{a(!1),t.onClose?.(),document.body.style.overflow="auto",document.removeEventListener("pointerdown",d),Km()},u=()=>i()?d():c(),p=e=>{n.onChatStatePersisted?.(e),e&&qm()};return Z(le,{get when(){return i()},get children(){return Z(dc,{get value(){return document.querySelector("typebot-popup")?.shadowRoot},get children(){return[(()=>{const e=Pb();return Se(e,je),e})(),(()=>{const t=Ib(),r=t.firstChild,i=r.nextSibling.nextSibling.firstChild.firstChild;return Se(r,je),i.addEventListener("pointerdown",s),Se(i,Z(xb,ne(n,{get prefilledVariables(){return o()},onChatStatePersisted:p}))),T((n=>{const o=e.theme?.zIndex??42424242,r="relative h-[80vh] transform overflow-hidden rounded-lg text-left transition-all sm:my-8 w-full max-w-lg"+(e.theme?.backgroundColor?" shadow-xl":""),a=e.theme?.backgroundColor??"transparent",s=e.theme?.width??"512px";return o!==n._v$&&(null!=(n._v$=o)?t.style.setProperty("z-index",o):t.style.removeProperty("z-index")),r!==n._v$2&&ke(i,n._v$2=r),a!==n._v$3&&(null!=(n._v$3=a)?i.style.setProperty("background-color",a):i.style.removeProperty("background-color")),s!==n._v$4&&(null!=(n._v$4=s)?i.style.setProperty("max-width",s):i.style.removeProperty("max-width")),n}),{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),t})()]}})}})},Ab=ve("<style>\n:host {\n display: block;\n width: 100%;\n height: 100%;\n overflow-y: hidden;\n}\n"),$b=(e,{element:t})=>{const[n,o]=_(!1),r=new IntersectionObserver((e=>{e.some((e=>e.isIntersecting))&&o(!0)}));P((()=>{window.addEventListener("message",i),r.observe(t)}));const i=e=>{const{data:t}=e;t.isFromTypebot};return I((()=>{r.disconnect()})),Z(dc,{get value(){return document.querySelector("typebot-standard")?.shadowRoot},get children(){return[(()=>{const e=Ab(),t=e.firstChild;return Se(e,je,t),e})(),Z(le,{get when(){return n()},get children(){return Z(xb,e)}})]}})},Rb=()=>{window.postMessage({isFromTypebot:!0,command:"close"})},Nb=()=>{window.postMessage({isFromTypebot:!0,command:"hidePreviewMessage"})},Lb=()=>{window.postMessage({isFromTypebot:!0,command:"open"})},Db=e=>{const t={isFromTypebot:!0,command:"setPrefilledVariables",variables:e};window.postMessage(t)},Mb=e=>{const t={isFromTypebot:!0,command:"showPreviewMessage",message:e};window.postMessage(t)},Ub=()=>{window.postMessage({isFromTypebot:!0,command:"toggle"})},Bb=e=>{const t={isFromTypebot:!0,command:"setInputValue",value:e};window.postMessage(t)},Fb=()=>{window.postMessage({isFromTypebot:!0,command:"unmount"})},jb=e=>{const t=e.id?document.getElementById(e.id):document.querySelector("typebot-standard");if(!t)throw new Error("<typebot-standard> element not found.");Object.assign(t,e)},zb=e=>{const t=document.createElement("typebot-popup");Object.assign(t,e),document.body.prepend(t)},Hb=e=>{const t=document.createElement("typebot-bubble");Object.assign(t,e),document.body.prepend(t)};"undefined"!=typeof window&&(Me("typebot-standard",Ue,$b),Me("typebot-bubble",Fe,Eb),Me("typebot-popup",Be,Ob));const Vb={initStandard:jb,initPopup:zb,initBubble:Hb,close:Rb,hidePreviewMessage:Nb,open:Lb,setPrefilledVariables:Db,showPreviewMessage:Mb,toggle:Ub,setInputValue:Bb,unmount:Fb};(e=>{"undefined"!=typeof window&&(window.Typebot={...e})})(Vb);export{Vb as default};