@epam/ai-dial-chat-hooks 1.1.0-dev.383 → 1.1.0-dev.390

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 (319) hide show
  1. package/api-error-DuLNy43N.js +45 -0
  2. package/attachment-types-AAoN9E95.js +7760 -0
  3. package/{attachment/useAttachmentValidation/useAttachmentValidation.d.ts → attachments.d.ts} +88 -44
  4. package/attachments.js +2 -0
  5. package/browser-Btsa0Lmr.js +607 -0
  6. package/catalog.d.ts +946 -0
  7. package/catalog.js +3 -0
  8. package/{conversation-sources/useConversationSources/useConversationSources.d.ts → conversation-sources.d.ts} +25 -20
  9. package/conversation-sources.js +2 -0
  10. package/conversation-transfer.d.ts +189 -0
  11. package/conversation-transfer.js +3 -0
  12. package/conversation.d.ts +907 -0
  13. package/conversation.js +2 -0
  14. package/cron-weekday-B4w29eAC.js +4 -0
  15. package/date-BeuD8G79.js +4 -0
  16. package/deployment-id-CxWgJTs9.js +6 -0
  17. package/file-manager.d.ts +1344 -0
  18. package/file-manager.js +4 -0
  19. package/formatting-CZyyxBG3.js +4 -0
  20. package/index.d.ts +4945 -126
  21. package/index.js +27 -19152
  22. package/oauth.d.ts +440 -0
  23. package/oauth.js +3 -0
  24. package/package.json +142 -21
  25. package/prompt-resource-Bt1I-8ri.js +41 -0
  26. package/scheduled-task-trigger-D9RZCk52.js +145 -0
  27. package/{scheduled-task/scheduled-task-trigger.d.ts → scheduled-tasks.d.ts} +51 -27
  28. package/scheduled-tasks.js +2 -0
  29. package/{conversation/useConversationScroll/useConversationScroll.d.ts → scroll-anchoring.d.ts} +50 -46
  30. package/scroll-anchoring.js +2 -0
  31. package/{useShareRecipientsCount/useShareRecipientsCount.d.ts → sharing.d.ts} +65 -36
  32. package/sharing.js +3 -0
  33. package/skill-editor.d.ts +503 -0
  34. package/skill-editor.js +3 -0
  35. package/skill-manifest-CCX8s4nn.js +4035 -0
  36. package/{skill/useSkillsState/useSkillsState.d.ts → skills-state.d.ts} +40 -35
  37. package/skills-state.js +2 -0
  38. package/string-utils-iBi2Y55C.js +10 -0
  39. package/toolset-id-CkxRHyU0.js +10 -0
  40. package/useAttachmentValidation-CkMTd5lA.js +102 -0
  41. package/useConversationImport-C2h1GBY4.js +807 -0
  42. package/useConversationScroll-CliIMnjP.js +122 -0
  43. package/useConversationSources-DKaKvjXZ.js +47 -0
  44. package/useDialFileManagerTabConfig-DGQw8H8H.js +2289 -0
  45. package/usePanelMaxWidth-BEZYuqF9.js +44 -0
  46. package/useShareLink-xkiaxATt.js +44 -0
  47. package/useShareRecipientsCount-BgwCLKY0.js +37 -0
  48. package/useSkillFileActions-BU5PzZ_8.js +373 -0
  49. package/useSkillFilePreview-BYfZUJhr.js +1005 -0
  50. package/useSkillsState-BoLlwmzb.js +52 -0
  51. package/useToolsMenu-BXdahO0i.js +1874 -0
  52. package/useToolsetLogin-GhFtKs4D.js +276 -0
  53. package/useUsageData-D7BxloKZ.js +201 -0
  54. package/utils.d.ts +373 -0
  55. package/utils.js +7 -0
  56. package/{usePageFileDrag/usePageFileDrag.d.ts → viewport-layout.d.ts} +27 -16
  57. package/viewport-layout.js +2 -0
  58. package/api-error/api-error.d.ts +0 -18
  59. package/api-error/api-error.d.ts.map +0 -1
  60. package/api-transport/create-csrf-middleware.d.ts +0 -15
  61. package/api-transport/create-csrf-middleware.d.ts.map +0 -1
  62. package/api-transport/create-unauthorized-middleware.d.ts +0 -40
  63. package/api-transport/create-unauthorized-middleware.d.ts.map +0 -1
  64. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +0 -32
  65. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +0 -1
  66. package/attachment/useAttachmentValidation/useAttachmentValidation.d.ts.map +0 -1
  67. package/catalog/catalog-derivations.d.ts +0 -27
  68. package/catalog/catalog-derivations.d.ts.map +0 -1
  69. package/catalog/catalog-primary-action.d.ts +0 -47
  70. package/catalog/catalog-primary-action.d.ts.map +0 -1
  71. package/catalog/create-publish-api.d.ts +0 -32
  72. package/catalog/create-publish-api.d.ts.map +0 -1
  73. package/catalog/deployment-endpoint-url.d.ts +0 -19
  74. package/catalog/deployment-endpoint-url.d.ts.map +0 -1
  75. package/catalog/deployment-id.d.ts +0 -21
  76. package/catalog/deployment-id.d.ts.map +0 -1
  77. package/catalog/entity-details.d.ts +0 -132
  78. package/catalog/entity-details.d.ts.map +0 -1
  79. package/catalog/map-deployment-limits-to-catalog.d.ts +0 -33
  80. package/catalog/map-deployment-limits-to-catalog.d.ts.map +0 -1
  81. package/catalog/map-deployment-limits-to-input.d.ts +0 -15
  82. package/catalog/map-deployment-limits-to-input.d.ts.map +0 -1
  83. package/catalog/map-deployment-to-catalog-item.d.ts +0 -60
  84. package/catalog/map-deployment-to-catalog-item.d.ts.map +0 -1
  85. package/catalog/map-entity-details-to-catalog.d.ts +0 -23
  86. package/catalog/map-entity-details-to-catalog.d.ts.map +0 -1
  87. package/catalog/map-prompt-to-catalog-item.d.ts +0 -43
  88. package/catalog/map-prompt-to-catalog-item.d.ts.map +0 -1
  89. package/catalog/map-skill-to-catalog-item.d.ts +0 -87
  90. package/catalog/map-skill-to-catalog-item.d.ts.map +0 -1
  91. package/catalog/mcp-endpoint-url.d.ts +0 -18
  92. package/catalog/mcp-endpoint-url.d.ts.map +0 -1
  93. package/catalog/publish.d.ts +0 -17
  94. package/catalog/publish.d.ts.map +0 -1
  95. package/catalog/useCatalogItemDetails.d.ts +0 -73
  96. package/catalog/useCatalogItemDetails.d.ts.map +0 -1
  97. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.d.ts +0 -37
  98. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.d.ts.map +0 -1
  99. package/catalog/usePublishFolders/usePublishFolders.d.ts +0 -73
  100. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +0 -1
  101. package/conversation/announcement-message.d.ts +0 -34
  102. package/conversation/announcement-message.d.ts.map +0 -1
  103. package/conversation/conversation-transfer/async.d.ts +0 -10
  104. package/conversation/conversation-transfer/async.d.ts.map +0 -1
  105. package/conversation/conversation-transfer/attachment-refs.d.ts +0 -12
  106. package/conversation/conversation-transfer/attachment-refs.d.ts.map +0 -1
  107. package/conversation/conversation-transfer/build-upload-path.d.ts +0 -40
  108. package/conversation/conversation-transfer/build-upload-path.d.ts.map +0 -1
  109. package/conversation/conversation-transfer/date.d.ts +0 -5
  110. package/conversation/conversation-transfer/date.d.ts.map +0 -1
  111. package/conversation/conversation-transfer/dial-file-resolve.d.ts +0 -10
  112. package/conversation/conversation-transfer/dial-file-resolve.d.ts.map +0 -1
  113. package/conversation/conversation-transfer/export-conversation.d.ts +0 -8
  114. package/conversation/conversation-transfer/export-conversation.d.ts.map +0 -1
  115. package/conversation/conversation-transfer/import-conversation.d.ts +0 -82
  116. package/conversation/conversation-transfer/import-conversation.d.ts.map +0 -1
  117. package/conversation/conversation-transfer/progress.d.ts +0 -60
  118. package/conversation/conversation-transfer/progress.d.ts.map +0 -1
  119. package/conversation/conversation-transfer/queue.d.ts +0 -54
  120. package/conversation/conversation-transfer/queue.d.ts.map +0 -1
  121. package/conversation/conversation-transfer/types.d.ts +0 -36
  122. package/conversation/conversation-transfer/types.d.ts.map +0 -1
  123. package/conversation/conversation-transfer/zip-export.d.ts +0 -31
  124. package/conversation/conversation-transfer/zip-export.d.ts.map +0 -1
  125. package/conversation/conversation-transfer/zip-import.d.ts +0 -17
  126. package/conversation/conversation-transfer/zip-import.d.ts.map +0 -1
  127. package/conversation/create-chat-stream-api.d.ts +0 -38
  128. package/conversation/create-chat-stream-api.d.ts.map +0 -1
  129. package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.d.ts +0 -39
  130. package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.d.ts.map +0 -1
  131. package/conversation/display-name-watch.d.ts +0 -4
  132. package/conversation/display-name-watch.d.ts.map +0 -1
  133. package/conversation/footer-message.d.ts +0 -10
  134. package/conversation/footer-message.d.ts.map +0 -1
  135. package/conversation/get-model-id-from-conversation-id.d.ts +0 -27
  136. package/conversation/get-model-id-from-conversation-id.d.ts.map +0 -1
  137. package/conversation/greeting.d.ts +0 -18
  138. package/conversation/greeting.d.ts.map +0 -1
  139. package/conversation/message-factory.d.ts +0 -7
  140. package/conversation/message-factory.d.ts.map +0 -1
  141. package/conversation/message-utils.d.ts +0 -27
  142. package/conversation/message-utils.d.ts.map +0 -1
  143. package/conversation/overlay-messages.d.ts +0 -5
  144. package/conversation/overlay-messages.d.ts.map +0 -1
  145. package/conversation/quick-app-conversation-starters.d.ts +0 -10
  146. package/conversation/quick-app-conversation-starters.d.ts.map +0 -1
  147. package/conversation/starter-option.d.ts +0 -21
  148. package/conversation/starter-option.d.ts.map +0 -1
  149. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts +0 -34
  150. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts.map +0 -1
  151. package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.d.ts +0 -46
  152. package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.d.ts.map +0 -1
  153. package/conversation/useAttachmentUpload/useAttachmentUpload.d.ts +0 -26
  154. package/conversation/useAttachmentUpload/useAttachmentUpload.d.ts.map +0 -1
  155. package/conversation/useConversationExport/useConversationExport.d.ts +0 -72
  156. package/conversation/useConversationExport/useConversationExport.d.ts.map +0 -1
  157. package/conversation/useConversationHandlers/attachment-to-dto.d.ts +0 -7
  158. package/conversation/useConversationHandlers/attachment-to-dto.d.ts.map +0 -1
  159. package/conversation/useConversationHandlers/message-factory.d.ts +0 -9
  160. package/conversation/useConversationHandlers/message-factory.d.ts.map +0 -1
  161. package/conversation/useConversationHandlers/message-utils.d.ts +0 -14
  162. package/conversation/useConversationHandlers/message-utils.d.ts.map +0 -1
  163. package/conversation/useConversationHandlers/starter-option.d.ts +0 -14
  164. package/conversation/useConversationHandlers/starter-option.d.ts.map +0 -1
  165. package/conversation/useConversationHandlers/useConversationHandlers.d.ts +0 -66
  166. package/conversation/useConversationHandlers/useConversationHandlers.d.ts.map +0 -1
  167. package/conversation/useConversationImport/useConversationImport.d.ts +0 -53
  168. package/conversation/useConversationImport/useConversationImport.d.ts.map +0 -1
  169. package/conversation/useConversationLookupMaps/useConversationLookupMaps.d.ts +0 -24
  170. package/conversation/useConversationLookupMaps/useConversationLookupMaps.d.ts.map +0 -1
  171. package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts +0 -58
  172. package/conversation/useConversationPanelItems/useConversationPanelItems.d.ts.map +0 -1
  173. package/conversation/useConversationScroll/useConversationScroll.d.ts.map +0 -1
  174. package/conversation/useConversationStream/apply-chunk.d.ts +0 -20
  175. package/conversation/useConversationStream/apply-chunk.d.ts.map +0 -1
  176. package/conversation/useConversationStream/buffered-generation.d.ts +0 -15
  177. package/conversation/useConversationStream/buffered-generation.d.ts.map +0 -1
  178. package/conversation/useConversationStream/conversation-path.d.ts +0 -7
  179. package/conversation/useConversationStream/conversation-path.d.ts.map +0 -1
  180. package/conversation/useConversationStream/generation-resume.d.ts +0 -39
  181. package/conversation/useConversationStream/generation-resume.d.ts.map +0 -1
  182. package/conversation/useConversationStream/useConversationStream.d.ts +0 -92
  183. package/conversation/useConversationStream/useConversationStream.d.ts.map +0 -1
  184. package/conversation/useImportFilePicker/useImportFilePicker.d.ts +0 -32
  185. package/conversation/useImportFilePicker/useImportFilePicker.d.ts.map +0 -1
  186. package/conversation-sources/useConversationSources/useConversationSources.d.ts.map +0 -1
  187. package/files/annotation.d.ts +0 -10
  188. package/files/annotation.d.ts.map +0 -1
  189. package/files/attachment-canvas.d.ts +0 -104
  190. package/files/attachment-canvas.d.ts.map +0 -1
  191. package/files/attachment-dto-to-display.d.ts +0 -10
  192. package/files/attachment-dto-to-display.d.ts.map +0 -1
  193. package/files/attachment-types.d.ts +0 -14
  194. package/files/attachment-types.d.ts.map +0 -1
  195. package/files/create-files-api.d.ts +0 -52
  196. package/files/create-files-api.d.ts.map +0 -1
  197. package/files/create-upload-file-with-progress.d.ts +0 -24
  198. package/files/create-upload-file-with-progress.d.ts.map +0 -1
  199. package/files/dial-file-manager-copy-move.util.d.ts +0 -15
  200. package/files/dial-file-manager-copy-move.util.d.ts.map +0 -1
  201. package/files/dial-file-manager-mapping.util.d.ts +0 -35
  202. package/files/dial-file-manager-mapping.util.d.ts.map +0 -1
  203. package/files/dial-file-manager-path.util.d.ts +0 -39
  204. package/files/dial-file-manager-path.util.d.ts.map +0 -1
  205. package/files/dial-file-manager.model.d.ts +0 -26
  206. package/files/dial-file-manager.model.d.ts.map +0 -1
  207. package/files/dial-file-manager.types.d.ts +0 -317
  208. package/files/dial-file-manager.types.d.ts.map +0 -1
  209. package/files/dial-file-to-attachment.d.ts +0 -26
  210. package/files/dial-file-to-attachment.d.ts.map +0 -1
  211. package/files/dial-file.d.ts +0 -17
  212. package/files/dial-file.d.ts.map +0 -1
  213. package/files/dial-files-api.d.ts +0 -71
  214. package/files/dial-files-api.d.ts.map +0 -1
  215. package/files/download-destination.d.ts +0 -31
  216. package/files/download-destination.d.ts.map +0 -1
  217. package/files/file-manager-variant.d.ts +0 -4
  218. package/files/file-manager-variant.d.ts.map +0 -1
  219. package/files/file-name.d.ts +0 -19
  220. package/files/file-name.d.ts.map +0 -1
  221. package/files/prepare-download-destination.d.ts +0 -8
  222. package/files/prepare-download-destination.d.ts.map +0 -1
  223. package/files/resolve-dial-file-api-path.d.ts +0 -13
  224. package/files/resolve-dial-file-api-path.d.ts.map +0 -1
  225. package/files/useDialFileListing/useDialFileListing.d.ts +0 -73
  226. package/files/useDialFileListing/useDialFileListing.d.ts.map +0 -1
  227. package/files/useDialFileManager/useDialFileManager.d.ts +0 -16
  228. package/files/useDialFileManager/useDialFileManager.d.ts.map +0 -1
  229. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.d.ts +0 -14
  230. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.d.ts.map +0 -1
  231. package/files/useDialFileMetadata/useDialFileMetadata.d.ts +0 -28
  232. package/files/useDialFileMetadata/useDialFileMetadata.d.ts.map +0 -1
  233. package/files/useDialFileMutations/useDialFileMutations.d.ts +0 -68
  234. package/files/useDialFileMutations/useDialFileMutations.d.ts.map +0 -1
  235. package/files/useDialFileSharing/useDialFileSharing.d.ts +0 -30
  236. package/files/useDialFileSharing/useDialFileSharing.d.ts.map +0 -1
  237. package/files/useDialFileUploadBatch/useDialFileUploadBatch.d.ts +0 -45
  238. package/files/useDialFileUploadBatch/useDialFileUploadBatch.d.ts.map +0 -1
  239. package/index.d.ts.map +0 -1
  240. package/oauth/authorize-url.d.ts +0 -16
  241. package/oauth/authorize-url.d.ts.map +0 -1
  242. package/oauth/handshake.d.ts +0 -30
  243. package/oauth/handshake.d.ts.map +0 -1
  244. package/oauth/models.d.ts +0 -81
  245. package/oauth/models.d.ts.map +0 -1
  246. package/oauth/popup.d.ts +0 -30
  247. package/oauth/popup.d.ts.map +0 -1
  248. package/oauth/toolset-id.d.ts +0 -23
  249. package/oauth/toolset-id.d.ts.map +0 -1
  250. package/oauth/types.d.ts +0 -84
  251. package/oauth/types.d.ts.map +0 -1
  252. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts +0 -54
  253. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts.map +0 -1
  254. package/oauth/useToolsetLogin/useToolsetLogin.d.ts +0 -79
  255. package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +0 -1
  256. package/prompt/export-prompt.d.ts +0 -31
  257. package/prompt/export-prompt.d.ts.map +0 -1
  258. package/prompt/prompt-resource.d.ts +0 -30
  259. package/prompt/prompt-resource.d.ts.map +0 -1
  260. package/prompt/prompt.d.ts +0 -34
  261. package/prompt/prompt.d.ts.map +0 -1
  262. package/prompt/usePromptsState/usePromptsState.d.ts +0 -34
  263. package/prompt/usePromptsState/usePromptsState.d.ts.map +0 -1
  264. package/scheduled-task/scheduled-task-mapping.d.ts +0 -19
  265. package/scheduled-task/scheduled-task-mapping.d.ts.map +0 -1
  266. package/scheduled-task/scheduled-task-trigger.d.ts.map +0 -1
  267. package/shared/application-schema.d.ts +0 -10
  268. package/shared/application-schema.d.ts.map +0 -1
  269. package/shared/browser-timezone.d.ts +0 -7
  270. package/shared/browser-timezone.d.ts.map +0 -1
  271. package/shared/cron-weekday.d.ts +0 -5
  272. package/shared/cron-weekday.d.ts.map +0 -1
  273. package/shared/custom-apps.d.ts +0 -7
  274. package/shared/custom-apps.d.ts.map +0 -1
  275. package/shared/external-services.d.ts +0 -16
  276. package/shared/external-services.d.ts.map +0 -1
  277. package/shared/formatting.d.ts +0 -5
  278. package/shared/formatting.d.ts.map +0 -1
  279. package/shared/locale.d.ts +0 -45
  280. package/shared/locale.d.ts.map +0 -1
  281. package/shared/string-utils.d.ts +0 -9
  282. package/shared/string-utils.d.ts.map +0 -1
  283. package/shared/toolset-login-events.d.ts +0 -15
  284. package/shared/toolset-login-events.d.ts.map +0 -1
  285. package/skill/skill-file-batch-validation.d.ts +0 -70
  286. package/skill/skill-file-batch-validation.d.ts.map +0 -1
  287. package/skill/skill-file-preview.d.ts +0 -25
  288. package/skill/skill-file-preview.d.ts.map +0 -1
  289. package/skill/skill-manifest.d.ts +0 -28
  290. package/skill/skill-manifest.d.ts.map +0 -1
  291. package/skill/skill-types.d.ts +0 -42
  292. package/skill/skill-types.d.ts.map +0 -1
  293. package/skill/skill.d.ts +0 -114
  294. package/skill/skill.d.ts.map +0 -1
  295. package/skill/useSkillEditorLoad.d.ts +0 -74
  296. package/skill/useSkillEditorLoad.d.ts.map +0 -1
  297. package/skill/useSkillEditorSubmit.d.ts +0 -105
  298. package/skill/useSkillEditorSubmit.d.ts.map +0 -1
  299. package/skill/useSkillFileActions.d.ts +0 -53
  300. package/skill/useSkillFileActions.d.ts.map +0 -1
  301. package/skill/useSkillFilePreview.d.ts +0 -38
  302. package/skill/useSkillFilePreview.d.ts.map +0 -1
  303. package/skill/useSkillsState/useSkillsState.d.ts.map +0 -1
  304. package/test-setup.d.ts +0 -2
  305. package/test-setup.d.ts.map +0 -1
  306. package/usage/useUsageData/useUsageData.d.ts +0 -20
  307. package/usage/useUsageData/useUsageData.d.ts.map +0 -1
  308. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts +0 -128
  309. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts.map +0 -1
  310. package/usePageFileDrag/usePageFileDrag.d.ts.map +0 -1
  311. package/usePanelMaxWidth/usePanelMaxWidth.d.ts +0 -6
  312. package/usePanelMaxWidth/usePanelMaxWidth.d.ts.map +0 -1
  313. package/useShareLink/useShareLink.d.ts +0 -23
  314. package/useShareLink/useShareLink.d.ts.map +0 -1
  315. package/useShareRecipientsCount/useShareRecipientsCount.d.ts.map +0 -1
  316. package/useToolsMenu/useToolsMenu.d.ts +0 -31
  317. package/useToolsMenu/useToolsMenu.d.ts.map +0 -1
  318. package/useViewportWidth/useViewportWidth.d.ts +0 -3
  319. package/useViewportWidth/useViewportWidth.d.ts.map +0 -1
@@ -0,0 +1,1874 @@
1
+ import { n as e, r as t } from "./string-utils-iBi2Y55C.js";
2
+ import { n } from "./deployment-id-CxWgJTs9.js";
3
+ import { t as r } from "./useShareRecipientsCount-BgwCLKY0.js";
4
+ import { AttachmentErrorReason as i, FilterTab as a, MessageRole as o, ResponseFormat as s, StatusEvent as c, generateUUID as l, isStatusMessage as u } from "@epam/ai-dial-chat-shared";
5
+ import { normalizeRawAnnotations as d } from "@epam/ai-dial-quotations";
6
+ import { useCallback as f, useEffect as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
7
+ import { SendCompletionDtoModeEnum as v } from "@epam/ai-dial-chat-api-client";
8
+ //#region ../../node_modules/dompurify/dist/purify.es.mjs
9
+ function y(e, t) {
10
+ (t == null || t > e.length) && (t = e.length);
11
+ for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
12
+ return r;
13
+ }
14
+ function b(e) {
15
+ if (Array.isArray(e)) return e;
16
+ }
17
+ function x(e, t) {
18
+ var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
19
+ if (n != null) {
20
+ var r, i, a, o, s = [], c = !0, l = !1;
21
+ try {
22
+ if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
23
+ } catch (e) {
24
+ l = !0, i = e;
25
+ } finally {
26
+ try {
27
+ if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
28
+ } finally {
29
+ if (l) throw i;
30
+ }
31
+ }
32
+ return s;
33
+ }
34
+ }
35
+ function S() {
36
+ throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
37
+ }
38
+ function C(e, t) {
39
+ return b(e) || x(e, t) || w(e, t) || S();
40
+ }
41
+ function w(e, t) {
42
+ if (e) {
43
+ if (typeof e == "string") return y(e, t);
44
+ var n = {}.toString.call(e).slice(8, -1);
45
+ return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? y(e, t) : void 0;
46
+ }
47
+ }
48
+ var ee = Object.entries, T = Object.setPrototypeOf, E = Object.isFrozen, D = Object.getPrototypeOf, O = Object.getOwnPropertyDescriptor, k = Object.freeze, A = Object.seal, te = Object.create, ne = typeof Reflect < "u" && Reflect, re = ne.apply, j = ne.construct;
49
+ k ||= function(e) {
50
+ return e;
51
+ }, A ||= function(e) {
52
+ return e;
53
+ }, re ||= function(e, t) {
54
+ var n = [...arguments].slice(2);
55
+ return e.apply(t, n);
56
+ }, j ||= function(e) {
57
+ return new e(...[...arguments].slice(1));
58
+ };
59
+ var ie = F(Array.prototype.forEach), ae = F(Array.prototype.lastIndexOf), oe = F(Array.prototype.pop), se = F(Array.prototype.push), ce = F(Array.prototype.splice), M = Array.isArray, le = F(String.prototype.toLowerCase), ue = F(String.prototype.toString), de = F(String.prototype.match), fe = F(String.prototype.replace), pe = F(String.prototype.indexOf), me = F(String.prototype.trim), he = F(Number.prototype.toString), ge = F(Boolean.prototype.toString), _e = typeof BigInt > "u" ? null : F(BigInt.prototype.toString), ve = typeof Symbol > "u" ? null : F(Symbol.prototype.toString), N = F(Object.prototype.hasOwnProperty), ye = F(Object.prototype.toString), P = F(RegExp.prototype.test), be = xe(TypeError);
60
+ function F(e) {
61
+ return function(t) {
62
+ t instanceof RegExp && (t.lastIndex = 0);
63
+ var n = [...arguments].slice(1);
64
+ return re(e, t, n);
65
+ };
66
+ }
67
+ function xe(e) {
68
+ return function() {
69
+ return j(e, [...arguments]);
70
+ };
71
+ }
72
+ function I(e, t) {
73
+ let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : le;
74
+ if (T && T(e, null), !M(t)) return e;
75
+ let r = t.length;
76
+ for (; r--;) {
77
+ let i = t[r];
78
+ if (typeof i == "string") {
79
+ let e = n(i);
80
+ e !== i && (E(t) || (t[r] = e), i = e);
81
+ }
82
+ e[i] = !0;
83
+ }
84
+ return e;
85
+ }
86
+ function Se(e) {
87
+ for (let t = 0; t < e.length; t++) N(e, t) || (e[t] = null);
88
+ return e;
89
+ }
90
+ function L(e) {
91
+ let t = te(null);
92
+ for (let r of ee(e)) {
93
+ var n = C(r, 2);
94
+ let i = n[0], a = n[1];
95
+ N(e, i) && (M(a) ? t[i] = Se(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = L(a) : t[i] = a);
96
+ }
97
+ return t;
98
+ }
99
+ function Ce(e) {
100
+ switch (typeof e) {
101
+ case "string": return e;
102
+ case "number": return he(e);
103
+ case "boolean": return ge(e);
104
+ case "bigint": return _e ? _e(e) : "0";
105
+ case "symbol": return ve ? ve(e) : "Symbol()";
106
+ case "undefined": return ye(e);
107
+ case "function":
108
+ case "object": {
109
+ if (e === null) return ye(e);
110
+ let t = e, n = R(t, "toString");
111
+ if (typeof n == "function") {
112
+ let e = n(t);
113
+ return typeof e == "string" ? e : ye(e);
114
+ }
115
+ return ye(e);
116
+ }
117
+ default: return ye(e);
118
+ }
119
+ }
120
+ function R(e, t) {
121
+ for (; e !== null;) {
122
+ let n = O(e, t);
123
+ if (n) {
124
+ if (n.get) return F(n.get);
125
+ if (typeof n.value == "function") return F(n.value);
126
+ }
127
+ e = D(e);
128
+ }
129
+ function n() {
130
+ return null;
131
+ }
132
+ return n;
133
+ }
134
+ function we(e) {
135
+ try {
136
+ return P(e, ""), !0;
137
+ } catch {
138
+ return !1;
139
+ }
140
+ }
141
+ var Te = k(/* @__PURE__ */ "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.search.section.select.shadow.slot.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".split(".")), Ee = k(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), De = k([
142
+ "feBlend",
143
+ "feColorMatrix",
144
+ "feComponentTransfer",
145
+ "feComposite",
146
+ "feConvolveMatrix",
147
+ "feDiffuseLighting",
148
+ "feDisplacementMap",
149
+ "feDistantLight",
150
+ "feDropShadow",
151
+ "feFlood",
152
+ "feFuncA",
153
+ "feFuncB",
154
+ "feFuncG",
155
+ "feFuncR",
156
+ "feGaussianBlur",
157
+ "feImage",
158
+ "feMerge",
159
+ "feMergeNode",
160
+ "feMorphology",
161
+ "feOffset",
162
+ "fePointLight",
163
+ "feSpecularLighting",
164
+ "feSpotLight",
165
+ "feTile",
166
+ "feTurbulence"
167
+ ]), Oe = k([
168
+ "animate",
169
+ "color-profile",
170
+ "cursor",
171
+ "discard",
172
+ "font-face",
173
+ "font-face-format",
174
+ "font-face-name",
175
+ "font-face-src",
176
+ "font-face-uri",
177
+ "foreignobject",
178
+ "hatch",
179
+ "hatchpath",
180
+ "mesh",
181
+ "meshgradient",
182
+ "meshpatch",
183
+ "meshrow",
184
+ "missing-glyph",
185
+ "script",
186
+ "set",
187
+ "solidcolor",
188
+ "unknown",
189
+ "use"
190
+ ]), ke = k(/* @__PURE__ */ "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".split(".")), Ae = k([
191
+ "maction",
192
+ "maligngroup",
193
+ "malignmark",
194
+ "mlongdiv",
195
+ "mscarries",
196
+ "mscarry",
197
+ "msgroup",
198
+ "mstack",
199
+ "msline",
200
+ "msrow",
201
+ "semantics",
202
+ "annotation",
203
+ "annotation-xml",
204
+ "mprescripts",
205
+ "none"
206
+ ]), je = k(["#text"]), Me = k(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.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.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), Ne = k(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.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.dominant-baseline.dur.edgemode.elevation.end.exponent.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.intercept.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.mask-type.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.slope.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.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.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".split(".")), Pe = k(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.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".split(".")), Fe = k([
207
+ "xlink:href",
208
+ "xml:id",
209
+ "xlink:title",
210
+ "xml:space",
211
+ "xmlns:xlink"
212
+ ]), Ie = A(/{{[\w\W]*|^[\w\W]*}}/g), Le = A(/<%[\w\W]*|^[\w\W]*%>/g), Re = A(/\${[\w\W]*/g), ze = A(/^data-[\-\w.\u00B7-\uFFFF]+$/), Be = A(/^aria-[\-\w]+$/), Ve = A(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), He = A(/^(?:\w+script|data):/i), Ue = A(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), We = A(/^html$/i), Ge = A(/^[a-z][.\w]*(-[.\w]+)+$/i), Ke = A(/<[/\w!]/g), qe = A(/<[/\w]/g), Je = A(/<\/no(script|embed|frames)/i), Ye = A(/\/>/i), z = {
213
+ element: 1,
214
+ attribute: 2,
215
+ text: 3,
216
+ cdataSection: 4,
217
+ entityReference: 5,
218
+ entityNode: 6,
219
+ processingInstruction: 7,
220
+ comment: 8,
221
+ document: 9,
222
+ documentType: 10,
223
+ documentFragment: 11,
224
+ notation: 12
225
+ }, Xe = function() {
226
+ return typeof window > "u" ? null : window;
227
+ }, Ze = function(e, t) {
228
+ if (typeof e != "object" || typeof e.createPolicy != "function") return null;
229
+ let n = null, r = "data-tt-policy-suffix";
230
+ t && t.hasAttribute(r) && (n = t.getAttribute(r));
231
+ let i = "dompurify" + (n ? "#" + n : "");
232
+ try {
233
+ return e.createPolicy(i, {
234
+ createHTML(e) {
235
+ return e;
236
+ },
237
+ createScriptURL(e) {
238
+ return e;
239
+ }
240
+ });
241
+ } catch {
242
+ return console.warn("TrustedTypes policy " + i + " could not be created."), null;
243
+ }
244
+ }, Qe = function() {
245
+ return {
246
+ afterSanitizeAttributes: [],
247
+ afterSanitizeElements: [],
248
+ afterSanitizeShadowDOM: [],
249
+ beforeSanitizeAttributes: [],
250
+ beforeSanitizeElements: [],
251
+ beforeSanitizeShadowDOM: [],
252
+ uponSanitizeAttribute: [],
253
+ uponSanitizeElement: [],
254
+ uponSanitizeShadowNode: []
255
+ };
256
+ }, B = function(e, t, n, r) {
257
+ return N(e, t) && M(e[t]) ? I(r.base ? L(r.base) : {}, e[t], r.transform) : n;
258
+ };
259
+ function $e() {
260
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Xe(), t = (e) => $e(e);
261
+ if (t.version = "3.4.13", t.removed = [], !e || !e.document || e.document.nodeType !== z.document || !e.Element) return t.isSupported = !1, t;
262
+ let n = e.document, r = n, i = r.currentScript;
263
+ e.DocumentFragment;
264
+ let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
265
+ e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
266
+ let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = R(d, "cloneNode"), p = R(d, "remove"), m = R(d, "nextSibling"), h = R(d, "childNodes"), g = R(d, "parentNode"), _ = R(d, "shadowRoot"), v = R(d, "attributes"), y = o && o.prototype ? R(o.prototype, "nodeType") : null, b = o && o.prototype ? R(o.prototype, "nodeName") : null, x = o && o.prototype ? R(o.prototype, "ownerDocument") : null;
267
+ if (typeof a == "function") {
268
+ let e = n.createElement("template");
269
+ e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
270
+ }
271
+ let S, C = "", w, T = !1, E = 0, D = function() {
272
+ if (E > 0) throw be("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
273
+ }, O = function(e) {
274
+ D(), E++;
275
+ try {
276
+ return S.createHTML(e);
277
+ } finally {
278
+ E--;
279
+ }
280
+ }, ne = function(e) {
281
+ D(), E++;
282
+ try {
283
+ return S.createScriptURL(e);
284
+ } finally {
285
+ E--;
286
+ }
287
+ }, re = function() {
288
+ return T ||= (w = Ze(u, i), !0), w;
289
+ }, j = n, he = j.implementation, ge = j.createNodeIterator, _e = j.createDocumentFragment, ve = j.getElementsByTagName, ye = r.importNode, F = Qe();
290
+ t.isSupported = typeof ee == "function" && typeof g == "function" && he && he.createHTMLDocument !== void 0;
291
+ let xe = Ie, Se = Le, et = Re, tt = ze, nt = Be, rt = He, it = Ue, at = Ge, ot = Ve, V = null, st = I({}, [
292
+ ...Te,
293
+ ...Ee,
294
+ ...De,
295
+ ...ke,
296
+ ...je
297
+ ]), H = null, ct = I({}, [
298
+ ...Me,
299
+ ...Ne,
300
+ ...Pe,
301
+ ...Fe
302
+ ]), U = Object.seal(te(null, {
303
+ tagNameCheck: {
304
+ writable: !0,
305
+ configurable: !1,
306
+ enumerable: !0,
307
+ value: null
308
+ },
309
+ attributeNameCheck: {
310
+ writable: !0,
311
+ configurable: !1,
312
+ enumerable: !0,
313
+ value: null
314
+ },
315
+ allowCustomizedBuiltInElements: {
316
+ writable: !0,
317
+ configurable: !1,
318
+ enumerable: !0,
319
+ value: !1
320
+ }
321
+ })), lt = null, ut = null, W = Object.seal(te(null, {
322
+ tagCheck: {
323
+ writable: !0,
324
+ configurable: !1,
325
+ enumerable: !0,
326
+ value: null
327
+ },
328
+ attributeCheck: {
329
+ writable: !0,
330
+ configurable: !1,
331
+ enumerable: !0,
332
+ value: null
333
+ }
334
+ })), dt = !0, ft = !0, pt = !1, mt = !0, G = !1, K = !0, q = !1, ht = !1, gt = null, _t = null, vt = !1, yt = !1, bt = !1, xt = !1, St = !0, Ct = !1, wt = "user-content-", Tt = !0, Et = !1, Dt = {}, J = null, Ot = I({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), kt = null, At = I({}, [
335
+ "audio",
336
+ "video",
337
+ "img",
338
+ "source",
339
+ "image",
340
+ "track"
341
+ ]), jt = null, Mt = I({}, [
342
+ "alt",
343
+ "class",
344
+ "for",
345
+ "id",
346
+ "label",
347
+ "name",
348
+ "pattern",
349
+ "placeholder",
350
+ "role",
351
+ "summary",
352
+ "title",
353
+ "value",
354
+ "style",
355
+ "xmlns"
356
+ ]), Nt = "http://www.w3.org/1998/Math/MathML", Pt = "http://www.w3.org/2000/svg", Y = "http://www.w3.org/1999/xhtml", Ft = Y, It = !1, Lt = null, Rt = I({}, [
357
+ Nt,
358
+ Pt,
359
+ Y
360
+ ], ue), zt = k([
361
+ "mi",
362
+ "mo",
363
+ "mn",
364
+ "ms",
365
+ "mtext"
366
+ ]), Bt = I({}, zt), Vt = k(["annotation-xml"]), Ht = I({}, Vt), Ut = I({}, [
367
+ "title",
368
+ "style",
369
+ "font",
370
+ "a",
371
+ "script"
372
+ ]), Wt = null, Gt = ["application/xhtml+xml", "text/html"], X = null, Kt = null, qt = n.createElement("form"), Jt = function(e) {
373
+ return e instanceof RegExp || e instanceof Function;
374
+ }, Yt = function() {
375
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
376
+ if (Kt && Kt === e) return;
377
+ (!e || typeof e != "object") && (e = {}), e = L(e), Wt = Gt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, X = Wt === "application/xhtml+xml" ? ue : le, V = B(e, "ALLOWED_TAGS", st, { transform: X }), H = B(e, "ALLOWED_ATTR", ct, { transform: X }), Lt = B(e, "ALLOWED_NAMESPACES", Rt, { transform: ue }), jt = B(e, "ADD_URI_SAFE_ATTR", Mt, {
378
+ transform: X,
379
+ base: Mt
380
+ }), kt = B(e, "ADD_DATA_URI_TAGS", At, {
381
+ transform: X,
382
+ base: At
383
+ }), J = B(e, "FORBID_CONTENTS", Ot, { transform: X }), lt = B(e, "FORBID_TAGS", L({}), { transform: X }), ut = B(e, "FORBID_ATTR", L({}), { transform: X }), Dt = N(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? L(e.USE_PROFILES) : e.USE_PROFILES : !1, dt = e.ALLOW_ARIA_ATTR !== !1, ft = e.ALLOW_DATA_ATTR !== !1, pt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, mt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, G = e.SAFE_FOR_TEMPLATES || !1, K = e.SAFE_FOR_XML !== !1, q = e.WHOLE_DOCUMENT || !1, yt = e.RETURN_DOM || !1, bt = e.RETURN_DOM_FRAGMENT || !1, xt = e.RETURN_TRUSTED_TYPE || !1, vt = e.FORCE_BODY || !1, St = e.SANITIZE_DOM !== !1, Ct = e.SANITIZE_NAMED_PROPS || !1, Tt = e.KEEP_CONTENT !== !1, Et = e.IN_PLACE || !1, ot = we(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Ve, Ft = typeof e.NAMESPACE == "string" ? e.NAMESPACE : Y, Bt = N(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? L(e.MATHML_TEXT_INTEGRATION_POINTS) : I({}, zt), Ht = N(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? L(e.HTML_INTEGRATION_POINTS) : I({}, Vt);
384
+ let t = N(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? L(e.CUSTOM_ELEMENT_HANDLING) : te(null);
385
+ if (U = te(null), N(t, "tagNameCheck") && Jt(t.tagNameCheck) && (U.tagNameCheck = t.tagNameCheck), N(t, "attributeNameCheck") && Jt(t.attributeNameCheck) && (U.attributeNameCheck = t.attributeNameCheck), N(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (U.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), A(U), G && (ft = !1), bt && (yt = !0), Dt && (V = I({}, je), H = te(null), Dt.html === !0 && (I(V, Te), I(H, Me)), Dt.svg === !0 && (I(V, Ee), I(H, Ne), I(H, Fe)), Dt.svgFilters === !0 && (I(V, De), I(H, Ne), I(H, Fe)), Dt.mathMl === !0 && (I(V, ke), I(H, Pe), I(H, Fe))), W.tagCheck = null, W.attributeCheck = null, N(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? W.tagCheck = e.ADD_TAGS : M(e.ADD_TAGS) && (V === st && (V = L(V)), I(V, e.ADD_TAGS, X))), N(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? W.attributeCheck = e.ADD_ATTR : M(e.ADD_ATTR) && (H === ct && (H = L(H)), I(H, e.ADD_ATTR, X))), N(e, "ADD_URI_SAFE_ATTR") && M(e.ADD_URI_SAFE_ATTR) && I(jt, e.ADD_URI_SAFE_ATTR, X), N(e, "FORBID_CONTENTS") && M(e.FORBID_CONTENTS) && (J === Ot && (J = L(J)), I(J, e.FORBID_CONTENTS, X)), N(e, "ADD_FORBID_CONTENTS") && M(e.ADD_FORBID_CONTENTS) && (J === Ot && (J = L(J)), I(J, e.ADD_FORBID_CONTENTS, X)), Tt && (V["#text"] = !0), q && I(V, [
386
+ "html",
387
+ "head",
388
+ "body"
389
+ ]), V.table && (I(V, ["tbody"]), delete lt.tbody), e.TRUSTED_TYPES_POLICY) {
390
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw be("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
391
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw be("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
392
+ let t = S;
393
+ S = e.TRUSTED_TYPES_POLICY;
394
+ try {
395
+ C = O("");
396
+ } catch (e) {
397
+ throw S = t, e;
398
+ }
399
+ } else e.TRUSTED_TYPES_POLICY === null ? (S = void 0, C = "") : (S === void 0 && (S = re()), S && typeof C == "string" && (C = O("")));
400
+ k && k(e), Kt = e;
401
+ }, Xt = I({}, [
402
+ ...Ee,
403
+ ...De,
404
+ ...Oe
405
+ ]), Zt = I({}, [...ke, ...Ae]), Qt = function(e, t, n) {
406
+ return t.namespaceURI === Y ? e === "svg" : t.namespaceURI === Nt ? e === "svg" && (n === "annotation-xml" || Bt[n]) : !!Xt[e];
407
+ }, $t = function(e, t, n) {
408
+ return t.namespaceURI === Y ? e === "math" : t.namespaceURI === Pt ? e === "math" && Ht[n] : !!Zt[e];
409
+ }, en = function(e, t, n) {
410
+ return t.namespaceURI === Pt && !Ht[n] || t.namespaceURI === Nt && !Bt[n] ? !1 : !Zt[e] && (Ut[e] || !Xt[e]);
411
+ }, tn = function(e) {
412
+ let t = g(e);
413
+ (!t || !t.tagName) && (t = {
414
+ namespaceURI: Ft,
415
+ tagName: "template"
416
+ });
417
+ let n = le(e.tagName), r = le(t.tagName);
418
+ return Lt[e.namespaceURI] ? e.namespaceURI === Pt ? Qt(n, t, r) : e.namespaceURI === Nt ? $t(n, t, r) : e.namespaceURI === Y ? en(n, t, r) : !!(Wt === "application/xhtml+xml" && Lt[e.namespaceURI]) : !1;
419
+ }, Z = function(e) {
420
+ se(t.removed, { element: e });
421
+ try {
422
+ g(e).removeChild(e);
423
+ } catch {
424
+ if (p(e), !g(e)) throw be("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
425
+ }
426
+ }, nn = function(e) {
427
+ an(e);
428
+ let t = h(e);
429
+ if (t) {
430
+ let e = [];
431
+ ie(t, (t) => {
432
+ se(e, t);
433
+ }), ie(e, (e) => {
434
+ try {
435
+ p(e);
436
+ } catch {}
437
+ });
438
+ }
439
+ let n = v(e);
440
+ if (n) for (let t = n.length - 1; t >= 0; --t) {
441
+ let r = n[t], i = r && r.name;
442
+ if (typeof i == "string") try {
443
+ e.removeAttribute(i);
444
+ } catch {}
445
+ }
446
+ }, Q = function(e, n) {
447
+ try {
448
+ se(t.removed, {
449
+ attribute: n.getAttributeNode(e),
450
+ from: n
451
+ });
452
+ } catch {
453
+ se(t.removed, {
454
+ attribute: null,
455
+ from: n
456
+ });
457
+ }
458
+ if (n.removeAttribute(e), e === "is") if (yt || bt) try {
459
+ Z(n);
460
+ } catch {}
461
+ else try {
462
+ n.setAttribute(e, "");
463
+ } catch {}
464
+ }, rn = function(e) {
465
+ let t = v(e);
466
+ if (t) for (let n = t.length - 1; n >= 0; --n) {
467
+ let r = t[n], i = r && r.name;
468
+ if (!(typeof i != "string" || H[X(i)])) try {
469
+ e.removeAttribute(i);
470
+ } catch {}
471
+ }
472
+ }, an = function(e) {
473
+ let t = [e];
474
+ for (; t.length > 0;) {
475
+ let e = t.pop();
476
+ (y ? y(e) : e.nodeType) === z.element && rn(e);
477
+ let n = h(e);
478
+ if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
479
+ }
480
+ }, on = function(e) {
481
+ if (!K) return;
482
+ let t = [e];
483
+ for (; t.length > 0;) {
484
+ let e = t.pop(), n = y ? y(e) : e.nodeType;
485
+ if (n === z.processingInstruction || n === z.comment && P(qe, e.data)) {
486
+ try {
487
+ p(e);
488
+ } catch {}
489
+ continue;
490
+ }
491
+ if (n === z.element) {
492
+ let t = e, n = X(b ? b(e) : e.nodeName);
493
+ try {
494
+ t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
495
+ } catch {}
496
+ }
497
+ let r = h(e);
498
+ if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
499
+ }
500
+ }, sn = function(e) {
501
+ let t = null, r = null;
502
+ if (vt) e = "<remove></remove>" + e;
503
+ else {
504
+ let t = de(e, /^[\r\n\t ]+/);
505
+ r = t && t[0];
506
+ }
507
+ Wt === "application/xhtml+xml" && Ft === Y && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
508
+ let i = S ? O(e) : e;
509
+ if (Ft === Y) try {
510
+ t = new l().parseFromString(i, Wt);
511
+ } catch {}
512
+ if (!t || !t.documentElement) {
513
+ t = he.createDocument(Ft, "template", null);
514
+ try {
515
+ t.documentElement.innerHTML = It ? C : i;
516
+ } catch {}
517
+ }
518
+ let a = t.body || t.documentElement;
519
+ return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), Ft === Y ? ve.call(t, q ? "html" : "body")[0] : q ? t.documentElement : a;
520
+ }, cn = function(e) {
521
+ let t = x ? x(e) : e.ownerDocument;
522
+ return ge.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
523
+ }, ln = function(e) {
524
+ return e = fe(e, xe, " "), e = fe(e, Se, " "), e = fe(e, et, " "), e;
525
+ }, un = function(e) {
526
+ e.normalize();
527
+ let t = x ? x(e) : e.ownerDocument, n = ge.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
528
+ for (; r;) r.data = ln(r.data), r = n.nextNode();
529
+ let i = e.querySelectorAll?.call(e, "template");
530
+ i && ie(i, (e) => {
531
+ fn(e.content) && un(e.content);
532
+ });
533
+ }, dn = function(e) {
534
+ let t = b ? b(e) : null;
535
+ return typeof t != "string" || X(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== v(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== y(e) || e.childNodes !== h(e);
536
+ }, fn = function(e) {
537
+ if (!y || typeof e != "object" || !e) return !1;
538
+ try {
539
+ return y(e) === z.documentFragment;
540
+ } catch {
541
+ return !1;
542
+ }
543
+ }, pn = function(e) {
544
+ if (!y || typeof e != "object" || !e) return !1;
545
+ try {
546
+ return typeof y(e) == "number";
547
+ } catch {
548
+ return !1;
549
+ }
550
+ };
551
+ function $(e, n, r) {
552
+ e.length !== 0 && ie(e, (e) => {
553
+ e.call(t, n, r, Kt);
554
+ });
555
+ }
556
+ let mn = function(e, t) {
557
+ return !!(K && e.hasChildNodes() && !pn(e.firstElementChild) && P(Ke, e.textContent) && P(Ke, e.innerHTML) || K && e.namespaceURI === Y && t === "style" && pn(e.firstElementChild) || e.nodeType === z.processingInstruction || K && e.nodeType === z.comment && P(qe, e.data));
558
+ }, hn = function(e, t, n) {
559
+ if (!lt[t] && bn(t) && (U.tagNameCheck instanceof RegExp && P(U.tagNameCheck, t) || U.tagNameCheck instanceof Function && U.tagNameCheck(t))) return !1;
560
+ if (Tt && !J[t]) {
561
+ let t = g(e), r = h(e);
562
+ if (r && t) {
563
+ let i = r.length;
564
+ for (let a = i - 1; a >= 0; --a) {
565
+ let i = e === n ? f(r[a], !0) : r[a];
566
+ t.insertBefore(i, m(e));
567
+ }
568
+ }
569
+ }
570
+ return Z(e), !0;
571
+ }, gn = function(e, t, n, r) {
572
+ return e.length === 0 ? t : t === n || t === r ? L(t) : t;
573
+ }, _n = function(e, n) {
574
+ if ($(F.beforeSanitizeElements, e, null), e !== n && g(e) === null) return Et && an(e), !0;
575
+ if (dn(e)) return Z(e), !0;
576
+ let r = X(b ? b(e) : e.nodeName);
577
+ if (V = gn(F.uponSanitizeElement, V, st, gt), $(F.uponSanitizeElement, e, {
578
+ tagName: r,
579
+ allowedTags: V
580
+ }), e !== n && g(e) === null) return Et && an(e), !0;
581
+ if (mn(e, r)) return Z(e), !0;
582
+ if (lt[r] || !(W.tagCheck instanceof Function && W.tagCheck(r)) && !V[r]) {
583
+ let t = hn(e, r, n);
584
+ return t === !1 && $(F.afterSanitizeElements, e, null), t;
585
+ }
586
+ if ((y ? y(e) : e.nodeType) === z.element && !tn(e) || (r === "noscript" || r === "noembed" || r === "noframes") && P(Je, e.innerHTML)) return Z(e), !0;
587
+ if (G && e.nodeType === z.text) {
588
+ let n = ln(e.textContent);
589
+ e.textContent !== n && (se(t.removed, { element: e.cloneNode() }), e.textContent = n);
590
+ }
591
+ return $(F.afterSanitizeElements, e, null), !1;
592
+ }, vn = function(e, t, r) {
593
+ if (ut[t] || K && t === "patchsrc" || K && t === "for" && e !== "label" && e !== "output" || St && (t === "id" || t === "name") && (r in n || r in qt)) return !1;
594
+ let i = H[t] || W.attributeCheck instanceof Function && W.attributeCheck(t, e);
595
+ if (!(ft && P(tt, t)) && !(dt && P(nt, t))) {
596
+ if (!i) {
597
+ if (!(bn(e) && (U.tagNameCheck instanceof RegExp && P(U.tagNameCheck, e) || U.tagNameCheck instanceof Function && U.tagNameCheck(e)) && (U.attributeNameCheck instanceof RegExp && P(U.attributeNameCheck, t) || U.attributeNameCheck instanceof Function && U.attributeNameCheck(t, e)) || t === "is" && U.allowCustomizedBuiltInElements && (U.tagNameCheck instanceof RegExp && P(U.tagNameCheck, r) || U.tagNameCheck instanceof Function && U.tagNameCheck(r)))) return !1;
598
+ } else if (!jt[t] && !P(ot, fe(r, it, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && pe(r, "data:") === 0 && kt[e]) && !(pt && !P(rt, fe(r, it, ""))) && r) return !1;
599
+ }
600
+ return !0;
601
+ }, yn = I({}, [
602
+ "annotation-xml",
603
+ "color-profile",
604
+ "font-face",
605
+ "font-face-format",
606
+ "font-face-name",
607
+ "font-face-src",
608
+ "font-face-uri",
609
+ "missing-glyph"
610
+ ]), bn = function(e) {
611
+ return !yn[le(e)] && P(at, e);
612
+ }, xn = function(e, t, n, r) {
613
+ if (S && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
614
+ case "TrustedHTML": return O(r);
615
+ case "TrustedScriptURL": return ne(r);
616
+ }
617
+ return r;
618
+ }, Sn = function(e, n, r, i) {
619
+ try {
620
+ r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), dn(e) ? Z(e) : oe(t.removed);
621
+ } catch {
622
+ Q(n, e);
623
+ }
624
+ }, Cn = function(e) {
625
+ $(F.beforeSanitizeAttributes, e, null);
626
+ let t = e.attributes;
627
+ if (!t || dn(e)) return;
628
+ H = gn(F.uponSanitizeAttribute, H, ct, _t);
629
+ let n = {
630
+ attrName: "",
631
+ attrValue: "",
632
+ keepAttr: !0,
633
+ allowedAttributes: H,
634
+ forceKeepAttr: void 0
635
+ }, r = t.length, i = X(e.nodeName);
636
+ for (; r--;) {
637
+ let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = X(o), u = c, d = o === "value" ? u : me(u);
638
+ if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, $(F.uponSanitizeAttribute, e, n), d = n.attrValue, Ct && (l === "id" || l === "name") && pe(d, wt) !== 0 && (Q(o, e), d = wt + d), K && P(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
639
+ Q(o, e);
640
+ continue;
641
+ }
642
+ if (l === "attributename" && de(d, "href")) {
643
+ Q(o, e);
644
+ continue;
645
+ }
646
+ if (!n.forceKeepAttr) {
647
+ if (!n.keepAttr) {
648
+ Q(o, e);
649
+ continue;
650
+ }
651
+ if (!mt && P(Ye, d)) {
652
+ Q(o, e);
653
+ continue;
654
+ }
655
+ if (G && (d = ln(d)), !vn(i, l, d)) {
656
+ Q(o, e);
657
+ continue;
658
+ }
659
+ d = xn(i, l, s, d), d !== u && Sn(e, o, s, d);
660
+ }
661
+ }
662
+ $(F.afterSanitizeAttributes, e, null);
663
+ }, wn = function(e) {
664
+ let t = null, n = cn(e);
665
+ for ($(F.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if ($(F.uponSanitizeShadowNode, t, null), _n(t, e), Cn(t), fn(t.content) && wn(t.content), (y ? y(t) : t.nodeType) === z.element) {
666
+ let e = _(t);
667
+ fn(e) && (Tn(e), wn(e));
668
+ }
669
+ $(F.afterSanitizeShadowDOM, e, null);
670
+ }, Tn = function(e) {
671
+ let t = [{
672
+ node: e,
673
+ shadow: null
674
+ }];
675
+ for (; t.length > 0;) {
676
+ let e = t.pop();
677
+ if (e.shadow) {
678
+ wn(e.shadow);
679
+ continue;
680
+ }
681
+ let n = e.node, r = (y ? y(n) : n.nodeType) === z.element, i = h(n);
682
+ if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
683
+ node: i[e],
684
+ shadow: null
685
+ });
686
+ if (r) {
687
+ let e = b ? b(n) : null;
688
+ if (typeof e == "string" && X(e) === "template") {
689
+ let e = n.content;
690
+ fn(e) && t.push({
691
+ node: e,
692
+ shadow: null
693
+ });
694
+ }
695
+ }
696
+ if (r) {
697
+ let e = _(n);
698
+ fn(e) && t.push({
699
+ node: null,
700
+ shadow: e
701
+ }, {
702
+ node: e,
703
+ shadow: null
704
+ });
705
+ }
706
+ }
707
+ };
708
+ return t.sanitize = function(e) {
709
+ let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
710
+ if (It = !e, It && (e = "<!-->"), typeof e != "string" && !pn(e) && (e = Ce(e), typeof e != "string")) throw be("dirty is not a string, aborting");
711
+ if (!t.isSupported) return e;
712
+ ht ? (V = gt, H = _t) : Yt(n), (F.uponSanitizeElement.length > 0 || F.uponSanitizeAttribute.length > 0) && (V = L(V)), F.uponSanitizeAttribute.length > 0 && (H = L(H)), t.removed = [];
713
+ let c = Et && typeof e != "string" && pn(e);
714
+ if (c) {
715
+ on(e);
716
+ let t = b ? b(e) : e.nodeName;
717
+ if (typeof t == "string") {
718
+ let n = X(t);
719
+ if (!V[n] || lt[n]) throw nn(e), be("root node is forbidden and cannot be sanitized in-place");
720
+ }
721
+ if (dn(e)) throw nn(e), be("root node is clobbered and cannot be sanitized in-place");
722
+ try {
723
+ Tn(e);
724
+ } catch (t) {
725
+ throw nn(e), t;
726
+ }
727
+ } else if (pn(e)) i = sn("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === z.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Tn(a);
728
+ else {
729
+ if (!yt && !G && !q && e.indexOf("<") === -1) return S && xt ? O(e) : e;
730
+ if (i = sn(e), !i) return yt ? null : xt ? C : "";
731
+ }
732
+ i && vt && Z(i.firstChild);
733
+ let l = c ? e : i;
734
+ try {
735
+ let e = cn(l);
736
+ for (; o = e.nextNode();) _n(o, l), Cn(o), fn(o.content) && wn(o.content);
737
+ } catch (n) {
738
+ throw c && (nn(e), ie(t.removed, (e) => {
739
+ e.element && an(e.element);
740
+ })), n;
741
+ }
742
+ if (c) return ie(t.removed, (e) => {
743
+ e.element && an(e.element);
744
+ }), G && un(e), e;
745
+ if (yt) {
746
+ if (G && un(i), bt) for (s = _e.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
747
+ else s = i;
748
+ return (H.shadowroot || H.shadowrootmode) && (s = ye.call(r, s, !0)), s;
749
+ }
750
+ let u = q ? i.outerHTML : i.innerHTML;
751
+ return q && V["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && P(We, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), G && (u = ln(u)), S && xt ? O(u) : u;
752
+ }, t.setConfig = function() {
753
+ Yt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), ht = !0, gt = V, _t = H;
754
+ }, t.clearConfig = function() {
755
+ Kt = null, ht = !1, gt = null, _t = null, S = w, C = "";
756
+ }, t.isValidAttribute = function(e, t, n) {
757
+ return Kt || Yt({}), vn(X(e), X(t), n);
758
+ }, t.addHook = function(e, t) {
759
+ typeof t == "function" && N(F, e) && se(F[e], t);
760
+ }, t.removeHook = function(e, t) {
761
+ if (N(F, e)) {
762
+ if (t !== void 0) {
763
+ let n = ae(F[e], t);
764
+ return n === -1 ? void 0 : ce(F[e], n, 1)[0];
765
+ }
766
+ return oe(F[e]);
767
+ }
768
+ }, t.removeHooks = function(e) {
769
+ N(F, e) && (F[e] = []);
770
+ }, t.removeAllHooks = function() {
771
+ F = Qe();
772
+ }, t;
773
+ }
774
+ var et = $e(), tt = {
775
+ ALLOWED_TAGS: [
776
+ "a",
777
+ "b",
778
+ "strong",
779
+ "em",
780
+ "br",
781
+ "span"
782
+ ],
783
+ ALLOWED_ATTR: [
784
+ "href",
785
+ "target",
786
+ "rel"
787
+ ]
788
+ }, nt = {
789
+ ALLOWED_TAGS: [
790
+ "a",
791
+ "b",
792
+ "strong",
793
+ "em",
794
+ "u",
795
+ "br",
796
+ "span",
797
+ "p"
798
+ ],
799
+ ALLOWED_ATTR: [
800
+ "href",
801
+ "target",
802
+ "rel"
803
+ ]
804
+ };
805
+ et.addHook("afterSanitizeAttributes", (e) => {
806
+ e.tagName === "A" && e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
807
+ });
808
+ var rt = (e) => et.sanitize(e, tt), it = (e) => et.sanitize(e, nt), at = (e) => typeof e == "string" && e.length > 0, ot = ({ title: e, description: t }) => at(e) || at(t), V = (e) => ot(e) || at(e.html), st = (e) => ot(e) ? JSON.stringify({
809
+ title: e.title ?? "",
810
+ description: e.description ?? ""
811
+ }) : e.html ?? "", H = { "Content-Type": "application/json" }, ct = (e, t, n) => {
812
+ let r = e.trim();
813
+ if (!r || r.startsWith(":") || !r.startsWith("data: ")) return;
814
+ let i = r.slice(6);
815
+ if (i !== "[DONE]") try {
816
+ let e = JSON.parse(i);
817
+ if (e.error) {
818
+ n(Error(e.error.message));
819
+ return;
820
+ }
821
+ t(e);
822
+ } catch {}
823
+ }, U = (e) => {
824
+ let { completionsBasePath: t } = e, n = (...t) => (e.fetchImpl ?? fetch)(...t);
825
+ return {
826
+ streamCompletion: (r, i, a, o, s, c, l, u, d) => {
827
+ let { onChunk: f, onComplete: p, onError: m, signal: h } = o;
828
+ (async () => {
829
+ let o;
830
+ try {
831
+ let f = e.getTimezone?.();
832
+ o = await n(`${t}/completions`, {
833
+ method: "POST",
834
+ credentials: "include",
835
+ signal: h,
836
+ headers: {
837
+ ...H,
838
+ ...e.getCsrfToken() == null ? {} : { "X-CSRF-Token": e.getCsrfToken() },
839
+ ...f ? { "X-Timezone": f } : {}
840
+ },
841
+ body: JSON.stringify({
842
+ path: r,
843
+ message: i ?? "",
844
+ model: a,
845
+ custom_content: s || {},
846
+ ...c != null && { generationId: c },
847
+ ...l != null && { mode: l },
848
+ ...u != null && { messageIndex: u },
849
+ ...d != null && { clientChannelId: d }
850
+ })
851
+ });
852
+ } catch (e) {
853
+ if (e instanceof Error && e.name === "AbortError") return;
854
+ m(e instanceof Error ? e : Error(String(e)));
855
+ return;
856
+ }
857
+ let g = o.headers.get("x-csrf-token");
858
+ if (g && e.setCsrfToken(g), !o.ok) {
859
+ m(/* @__PURE__ */ Error(`Stream request failed with status ${o.status}`));
860
+ return;
861
+ }
862
+ if (!o.body) {
863
+ m(/* @__PURE__ */ Error("No response body"));
864
+ return;
865
+ }
866
+ let _ = o.body.getReader(), v = new TextDecoder(), y = "", b = !1, x = (e) => {
867
+ b = !0, m(e);
868
+ };
869
+ try {
870
+ for (;;) {
871
+ let { done: e, value: t } = await _.read();
872
+ if (e) {
873
+ y.trim() && ct(y, f, x);
874
+ break;
875
+ }
876
+ y += v.decode(t, { stream: !0 });
877
+ let n = y.split("\n");
878
+ y = n.pop() ?? "";
879
+ for (let e of n) ct(e, f, x);
880
+ }
881
+ b || p();
882
+ } catch (e) {
883
+ if (e instanceof Error && e.name === "AbortError") return;
884
+ m(e instanceof Error ? e : Error(String(e)));
885
+ } finally {
886
+ _.releaseLock();
887
+ }
888
+ })();
889
+ },
890
+ stopCompletion: async (r) => {
891
+ let i = await n(`${t}/completions/stop`, {
892
+ method: "POST",
893
+ credentials: "include",
894
+ headers: {
895
+ ...H,
896
+ ...e.getCsrfToken() == null ? {} : { "X-CSRF-Token": e.getCsrfToken() }
897
+ },
898
+ body: JSON.stringify(r)
899
+ }), a = i.headers.get("x-csrf-token");
900
+ if (a && e.setCsrfToken(a), !i.ok) throw Error(`stopCompletion failed: ${i.status}`);
901
+ }
902
+ };
903
+ }, lt = (e) => e.messages.filter((e) => e.role !== o.Status).length < 2 ? !1 : e.llmNamingDone !== !0, ut = {
904
+ ALLOWED_TAGS: [
905
+ "a",
906
+ "span",
907
+ "strong",
908
+ "u",
909
+ "em",
910
+ "br",
911
+ "p"
912
+ ],
913
+ ALLOWED_ATTR: [
914
+ "href",
915
+ "target",
916
+ "rel"
917
+ ]
918
+ }, W = (e) => et.sanitize(e, ut), dt = (e) => {
919
+ let t = e.trim();
920
+ return /^v/i.test(t) ? t : `v${t}`;
921
+ }, ft = "__", pt = /[-+]/, mt = /^\d+$/, G = ".scheduler", K = "applications", q = (e) => e ? e.split(pt)[0].split(".").every((e) => mt.test(e)) : !1, ht = (e, t) => {
922
+ let [n, r] = e.split(ft);
923
+ return t && q(r) ? [n, r].join(ft) : n;
924
+ }, gt = (e) => {
925
+ let t = e.split("/");
926
+ if (t.length < 3) return;
927
+ let n = t.slice(2), r = n[0] === G ? n.slice(2) : n, i = r.findIndex((e) => e.includes(ft));
928
+ if (i === -1) return;
929
+ let a = r[i], o = r.slice(0, i).filter(Boolean), s = ht(a, o[0] === K), c = [...o, s].filter(Boolean);
930
+ return c.length > 0 ? c.join("/") : void 0;
931
+ }, _t = (e, t, n) => {
932
+ let r = n != null && n.length > 0;
933
+ return e >= 5 && e <= 11 ? r ? t.morningWithName : t.morningNoName : e >= 12 && e <= 16 ? r ? t.afternoonWithName : t.afternoonNoName : e >= 17 && e <= 20 ? r ? t.eveningWithName : t.eveningNoName : r ? t.nightWithName : t.nightNoName;
934
+ }, vt = (e, t) => {
935
+ let n = {
936
+ event_type: c.ModelChanged,
937
+ previous_deployment_id: e,
938
+ new_deployment_id: t
939
+ };
940
+ return {
941
+ id: l(),
942
+ role: o.Status,
943
+ content: "",
944
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
945
+ deploymentId: t,
946
+ custom_content: n
947
+ };
948
+ }, yt = (e, t, n, r) => r && t === n - 1 && e.role === o.Assistant, bt = (e) => {
949
+ for (let t = e.length - 1; t >= 0; t--) {
950
+ let n = e[t];
951
+ if (u(n) && n.custom_content?.event_type === c.ModelChanged) return n.custom_content.new_deployment_id;
952
+ }
953
+ return null;
954
+ }, xt = (e) => e.role === o.Assistant && (e.custom_content?.stages?.length ?? 0) > 0, St = (e) => {
955
+ for (let t = e.length - 1; t >= 0; t--) if (e[t].role === o.User) return e[t].custom_content?.configuration_value;
956
+ }, Ct = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? s.PlainText : s.Markdown, wt = (e) => e.map((e, t) => ({
957
+ id: t.toString(),
958
+ role: e.role,
959
+ content: e.content
960
+ })), Tt = (e) => typeof e == "object" && !!e && !Array.isArray(e), Et = (e) => {
961
+ if (typeof e == "string") return e.trim() || void 0;
962
+ }, Dt = (e) => {
963
+ if (!Tt(e) || !Array.isArray(e.starters)) return {
964
+ starters: [],
965
+ introText: void 0,
966
+ isChatMessageInputDisabled: !1
967
+ };
968
+ let t = e.autoSubmit !== !1;
969
+ return {
970
+ starters: e.starters.filter(Tt).map((e) => ({
971
+ title: Et(e.title),
972
+ text: Et(e.text)
973
+ })).filter((e) => e.title != null && e.text != null).map((e, n) => ({
974
+ const: n,
975
+ title: e.title,
976
+ "dial:widgetOptions": {
977
+ populateText: e.text,
978
+ submit: t,
979
+ confirmationMessage: null
980
+ }
981
+ })),
982
+ introText: Et(e.introText),
983
+ isChatMessageInputDisabled: e.chatMessageInputDisabled === !0
984
+ };
985
+ }, J = (e) => e["dial:widgetOptions"].populateText || e.title, Ot = (e) => {
986
+ let t = e?.properties;
987
+ if (!t) return {
988
+ starters: [],
989
+ propertyKey: void 0,
990
+ description: void 0
991
+ };
992
+ let n;
993
+ if ("starter" in t ? n = "starter" : "button" in t && (n = "button"), !n) return {
994
+ starters: [],
995
+ propertyKey: void 0,
996
+ description: void 0
997
+ };
998
+ let r = t[n], i = r?.oneOf, a = typeof r?.description == "string" ? r.description : void 0;
999
+ return Array.isArray(i) ? {
1000
+ starters: i,
1001
+ propertyKey: n,
1002
+ description: a
1003
+ } : {
1004
+ starters: [],
1005
+ propertyKey: n,
1006
+ description: a
1007
+ };
1008
+ }, kt = (e, t, n) => {
1009
+ let i = !!(e.isReadonly || e.sharedWithMe || e.publishedWithMe), a = !i && t != null ? [...new Set(t.map((e) => e.folderPath.join("/")))] : [];
1010
+ return {
1011
+ isReadonly: i,
1012
+ publishedFolders: a,
1013
+ isRevokeVisible: n.status === r.Unknown || n.status === r.Resolved && (n.count ?? 0) > 0,
1014
+ isPublishApplicable: a.length === 0,
1015
+ isUnpublishApplicable: a.length > 0
1016
+ };
1017
+ }, At = ({ activeConversationId: e, items: t, refreshConversations: n, markConversationViewed: r, conversationIdsMatch: i, toPanelConversationId: a }) => {
1018
+ let o = h(() => e ? a(e) : void 0, [e, a]);
1019
+ return p(() => {
1020
+ o && (t.some((e) => i(e.id, o)) || n());
1021
+ }, [o, i]), p(() => {
1022
+ if (!o) return;
1023
+ let e = t.find((e) => i(e.id, o));
1024
+ e && r(e.id);
1025
+ }, [
1026
+ o,
1027
+ t,
1028
+ r,
1029
+ i
1030
+ ]), o;
1031
+ }, jt = () => {
1032
+ let [e, t] = _(null), [n, r] = _(!1), [i, a] = _(null), o = g(null), s = g(!1), c = g(0), l = g(null), u = f((e, n) => {
1033
+ let { activeElement: i } = document;
1034
+ l.current = n ?? (i instanceof HTMLElement ? i : null), c.current += 1, o.current = e, s.current = !1, t(e), r(!1), a(null);
1035
+ }, []);
1036
+ p(() => {
1037
+ if (e != null) return;
1038
+ let t = l.current;
1039
+ l.current = null, t?.isConnected && t.focus({ preventScroll: !0 });
1040
+ }, [e]);
1041
+ let d = f(() => {
1042
+ c.current += 1, o.current = null, s.current = !1, t(null), a(null), r(!1);
1043
+ }, []), m = f(async (e, n) => {
1044
+ let i = o.current;
1045
+ if (s.current || i == null) return;
1046
+ let l = ++c.current;
1047
+ s.current = !0, r(!0), a(null);
1048
+ try {
1049
+ if (await e(i), l !== c.current) return;
1050
+ o.current = null, t(null), a(null), s.current = !1, r(!1);
1051
+ } catch (e) {
1052
+ if (l !== c.current) return;
1053
+ a(n(e)), s.current = !1, r(!1);
1054
+ }
1055
+ }, []);
1056
+ return {
1057
+ pending: e,
1058
+ isPending: e != null,
1059
+ isRunning: n,
1060
+ error: i,
1061
+ open: u,
1062
+ close: d,
1063
+ confirm: m
1064
+ };
1065
+ }, Mt = ({ items: e, toPanelConversationId: t }) => h(() => {
1066
+ let n = new Map(e.map((e) => [t(e.id), e.id])), r = new Map(e.map((e) => [t(e.id), e]));
1067
+ return {
1068
+ toContextId: (e) => n.get(e),
1069
+ getRawItem: (e) => r.get(e)
1070
+ };
1071
+ }, [e, t]), Nt = (e) => e.sharedWithMe ? a.Shared : e.publishedWithMe ? a.Organization : a.MyChats, Pt = ({ items: e, deployments: r, isDeploymentsLoading: i, toPanelConversationId: a, resolveIconUrl: o, resolveIconTooltip: s, resolveHref: c, resolveTaskBadge: l }) => h(() => e.map((e) => {
1072
+ let u = a(e.id), d = gt(e.id), f = d ? n(r, d) : void 0, p = d ? t(d.split("/").pop() ?? d) : "", m = l?.(e);
1073
+ return {
1074
+ id: u,
1075
+ title: e.title,
1076
+ isPinned: e.isPinned ?? !1,
1077
+ iconUrl: o(f),
1078
+ iconTooltip: s(f, p),
1079
+ isIconLoading: i,
1080
+ source: Nt(e),
1081
+ href: c(u),
1082
+ ...m == null ? {} : {
1083
+ showTaskBadge: !0,
1084
+ taskBadgeLabel: m.label,
1085
+ isUnread: m.isUnread
1086
+ }
1087
+ };
1088
+ }), [
1089
+ e,
1090
+ r,
1091
+ i,
1092
+ a,
1093
+ o,
1094
+ s,
1095
+ c,
1096
+ l
1097
+ ]), Y = ({ accept: e, onFileSelected: t }) => {
1098
+ let n = g(null);
1099
+ return m(() => {
1100
+ let t = n.current;
1101
+ t && (e === void 0 || e === "" ? t.removeAttribute("accept") : t.accept = e);
1102
+ }, [e]), {
1103
+ inputRef: n,
1104
+ triggerImport: f(() => {
1105
+ n.current?.click();
1106
+ }, []),
1107
+ handleFileChange: f((e) => {
1108
+ let n = e.target.files?.[0];
1109
+ e.target.value = "", n && t(n);
1110
+ }, [t])
1111
+ };
1112
+ }, Ft = 700, It = (e) => (e.split(/[\\/]/).filter(Boolean).pop() ?? "file").replace(/\.\.+/g, ".").replace(/^\.+/, "") || "file", Lt = (e, t = /* @__PURE__ */ new Date()) => `uploads/${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}/${encodeURIComponent(It(e))}`, Rt = ({ filesApi: e, bucket: t, onNetworkError: n, debounceMs: r = Ft }) => {
1113
+ let a = g([]), o = g(null);
1114
+ return { handleUploadAttachment: f(async (s) => {
1115
+ if (!t) throw Error("User bucket is not available");
1116
+ try {
1117
+ return (await e.uploadFile({
1118
+ bucket: t,
1119
+ path: Lt(s.name),
1120
+ file: s.file
1121
+ })).url;
1122
+ } catch (e) {
1123
+ if (!navigator.onLine) {
1124
+ a.current.push(s.name), o.current != null && clearTimeout(o.current), o.current = setTimeout(() => {
1125
+ let e = a.current.splice(0);
1126
+ n?.(e), o.current = null;
1127
+ }, r);
1128
+ let t = e instanceof Error ? e : /* @__PURE__ */ Error("Network upload failed");
1129
+ throw t.errorReason = i.Network, t;
1130
+ }
1131
+ throw e;
1132
+ }
1133
+ }, [
1134
+ t,
1135
+ r,
1136
+ e,
1137
+ n
1138
+ ]) };
1139
+ }, zt = (e) => {
1140
+ if (!e.url) throw Error(`Attachment "${e.name}" has not been uploaded`);
1141
+ return {
1142
+ type: e.contentType,
1143
+ title: e.name,
1144
+ url: e.url
1145
+ };
1146
+ }, Bt = (e) => {
1147
+ if (e.length) return e.map(zt);
1148
+ }, Vt = (e, t, n) => {
1149
+ let r = new Date(Date.now()).toISOString();
1150
+ return {
1151
+ userMessage: {
1152
+ role: o.User,
1153
+ content: e,
1154
+ timestamp: r,
1155
+ ...t && Object.keys(t).length ? { custom_content: t } : {}
1156
+ },
1157
+ assistantMessage: {
1158
+ role: o.Assistant,
1159
+ content: "",
1160
+ timestamp: r,
1161
+ ...n ? { deploymentId: n } : {}
1162
+ }
1163
+ };
1164
+ }, Ht = (e) => e != null && Object.keys(e).length > 0, Ut = (e, t, n, r) => {
1165
+ if (t !== e.content || r.length > 0) return !0;
1166
+ let i = e.custom_content?.attachments?.length ?? 0;
1167
+ return n.length !== i;
1168
+ }, Wt = (e, t) => {
1169
+ let { populateText: n } = e["dial:widgetOptions"];
1170
+ return n == null && t ? t : J(e);
1171
+ }, Gt = (e, t) => {
1172
+ let { populateText: n, submit: r } = e["dial:widgetOptions"];
1173
+ return r && n == null ? "" : t ?? J(e);
1174
+ }, X = (t) => {
1175
+ let n = t.indexOf("/");
1176
+ return e(n === -1 ? t : t.substring(n + 1));
1177
+ }, Kt = ({ conversation: e, conversationId: t, bucket: n, isStreaming: r, startStream: i, state: { setConversation: a, conversationRef: s }, filesApi: c, conversationsApi: u, rateApi: d, resolveModelId: p, onConversationDeleted: m, showNetworkError: h, toolConfigurationValue: g }) => {
1178
+ let [y, b] = _(null), [x, S] = _(/* @__PURE__ */ new Set()), [C, w] = _(null), { handleUploadAttachment: ee } = Rt({
1179
+ filesApi: c,
1180
+ bucket: n,
1181
+ onNetworkError: h
1182
+ }), T = f(async (n, r) => {
1183
+ if (!t || !e) return;
1184
+ let o = Bt(r), c = Ht(g), u = o?.length || c ? {
1185
+ ...o?.length ? { attachments: o } : {},
1186
+ ...c ? { configuration_value: g } : {}
1187
+ } : void 0, d = p(), { userMessage: f, assistantMessage: m } = Vt(n, u, d);
1188
+ a((e) => {
1189
+ if (!e) return e;
1190
+ let t = {
1191
+ ...e,
1192
+ messages: [
1193
+ ...e.messages,
1194
+ f,
1195
+ m
1196
+ ]
1197
+ };
1198
+ return s.current = t, t;
1199
+ }), i(t, n, e.messages.length + 1, d, u, l(), v.Append);
1200
+ }, [
1201
+ e,
1202
+ t,
1203
+ s,
1204
+ p,
1205
+ a,
1206
+ i,
1207
+ g
1208
+ ]), E = f((n) => {
1209
+ if (r || !t || !e || n === -1 || e.messages[n]?.role !== o.Assistant) return;
1210
+ let c = e.messages[n - 1];
1211
+ if (!c || c.role !== o.User) return;
1212
+ let u = p();
1213
+ a((e) => {
1214
+ if (!e) return e;
1215
+ let t = {
1216
+ ...e.messages[n],
1217
+ content: "",
1218
+ custom_content: void 0,
1219
+ wasStoppedByUser: void 0,
1220
+ stoppedWithoutContent: void 0,
1221
+ streamErrorMessage: void 0,
1222
+ deploymentId: u
1223
+ }, r = {
1224
+ ...e,
1225
+ messages: [...e.messages.slice(0, n), t]
1226
+ };
1227
+ return s.current = r, r;
1228
+ }), S((e) => new Set([...e].filter((e) => e < n))), i(t, c.content, n, u, c.custom_content, l(), v.Regenerate);
1229
+ }, [
1230
+ e,
1231
+ t,
1232
+ s,
1233
+ r,
1234
+ p,
1235
+ a,
1236
+ i
1237
+ ]), D = f((e) => {
1238
+ r || b(e);
1239
+ }, [r]), O = f(() => {
1240
+ if (!t || y == null) return;
1241
+ b(null);
1242
+ let e = X(t);
1243
+ a((t) => {
1244
+ if (!t) return t;
1245
+ let n = y;
1246
+ if (n === -1) return t;
1247
+ let r = t.messages[n + 1]?.role === o.Assistant ? t.messages.filter((e, t) => t !== n && t !== n + 1) : t.messages.filter((e, t) => t !== n);
1248
+ if (r.length === 0 || r.length === 1 && r[0].role === o.Status) return u.deleteConversation({ path: e }), m?.(), t;
1249
+ let i = {
1250
+ ...t,
1251
+ messages: r
1252
+ };
1253
+ return s.current = i, u.saveConversation({
1254
+ path: e,
1255
+ saveConversationBodyDto: { conversation: i }
1256
+ }), i;
1257
+ });
1258
+ }, [
1259
+ t,
1260
+ s,
1261
+ u,
1262
+ m,
1263
+ y,
1264
+ a
1265
+ ]), k = f(async (n, r, i) => {
1266
+ if (!t || !e) return !1;
1267
+ let o = e.messages[n];
1268
+ if (!o) return !1;
1269
+ let c = o.rating, l = {
1270
+ ...e,
1271
+ messages: e.messages.map((e, t) => t === n ? {
1272
+ ...e,
1273
+ rating: r ?? void 0
1274
+ } : e)
1275
+ };
1276
+ a(() => (s.current = l, l));
1277
+ let f = X(t), p = () => {
1278
+ a((e) => e && {
1279
+ ...e,
1280
+ messages: e.messages.map((e, t) => t === n ? {
1281
+ ...e,
1282
+ rating: c
1283
+ } : e)
1284
+ });
1285
+ }, m = () => u.saveConversation({
1286
+ path: f,
1287
+ saveConversationBodyDto: { conversation: l }
1288
+ });
1289
+ if (r != null) {
1290
+ let t = o.responseId;
1291
+ if (!t) return p(), !1;
1292
+ try {
1293
+ return await d.rateMessage({ rateMessageDto: {
1294
+ conversationId: e.id,
1295
+ responseId: t,
1296
+ modelId: e.model.id,
1297
+ rate: r,
1298
+ ...i ? { comment: i } : {}
1299
+ } }), await m(), !0;
1300
+ } catch {
1301
+ return p(), !1;
1302
+ }
1303
+ } else try {
1304
+ return await m(), !0;
1305
+ } catch {
1306
+ return p(), !1;
1307
+ }
1308
+ }, [
1309
+ e,
1310
+ t,
1311
+ s,
1312
+ u,
1313
+ d,
1314
+ a
1315
+ ]), A = f((n, r, o) => {
1316
+ if (!t || !e) return;
1317
+ let c = o ?? n.title, u = Gt(n, o), d = r ? { [r]: n.const } : void 0, f = Ht(g), m = d || f ? {
1318
+ ...d ? { form_value: d } : {},
1319
+ ...f ? { configuration_value: g } : {}
1320
+ } : void 0, h = p(), { userMessage: _, assistantMessage: y } = Vt(c, m, h);
1321
+ a((e) => {
1322
+ if (!e) return e;
1323
+ let t = {
1324
+ ...e,
1325
+ messages: [
1326
+ ...e.messages,
1327
+ _,
1328
+ y
1329
+ ]
1330
+ };
1331
+ return s.current = t, t;
1332
+ }), i(t, u, e.messages.length + 1, h, m, l(), v.Append);
1333
+ }, [
1334
+ e,
1335
+ t,
1336
+ s,
1337
+ p,
1338
+ a,
1339
+ i,
1340
+ g
1341
+ ]);
1342
+ return {
1343
+ handleSend: T,
1344
+ handleUploadAttachment: ee,
1345
+ handleRegenerateMessage: E,
1346
+ handleDeleteMessage: D,
1347
+ handleConfirmDelete: O,
1348
+ handleRateMessage: k,
1349
+ handleButtonSelect: f((n, i, a) => {
1350
+ !t || !e || r || (n["dial:widgetOptions"].confirmationMessage ? w({
1351
+ starter: n,
1352
+ propertyKey: i,
1353
+ description: a
1354
+ }) : A(n, i, a));
1355
+ }, [
1356
+ e,
1357
+ t,
1358
+ r,
1359
+ A
1360
+ ]),
1361
+ handleConfirmStarter: f(() => {
1362
+ if (!C) return;
1363
+ let { starter: e, propertyKey: t, description: n } = C;
1364
+ w(null), A(e, t, n);
1365
+ }, [C, A]),
1366
+ handleStartEdit: f((e) => {
1367
+ S((t) => new Set([...t, e]));
1368
+ }, []),
1369
+ handleCancelEdit: f((e) => {
1370
+ S((t) => {
1371
+ let n = new Set(t);
1372
+ return n.delete(e), n;
1373
+ });
1374
+ }, []),
1375
+ handleEditMessage: f(async (n, c, u, d) => {
1376
+ if (r || !t || !e) return;
1377
+ let f = n;
1378
+ if (f === -1 || e.messages[f].role !== o.User) return;
1379
+ let m = e.messages[f];
1380
+ if (!Ut(m, c, u, d)) {
1381
+ S((e) => {
1382
+ let t = new Set(e);
1383
+ return t.delete(f), t;
1384
+ });
1385
+ return;
1386
+ }
1387
+ let h = Bt(d), g = new Set(u.map((e) => e.id)), _ = [...(m.custom_content?.attachments ?? []).filter((e) => {
1388
+ let t = e.url ?? e.data ?? e.title;
1389
+ return g.has(t);
1390
+ }), ...h ?? []], { attachments: y, ...b } = m.custom_content ?? {}, x = _.length > 0 ? {
1391
+ ...b,
1392
+ attachments: _
1393
+ } : Object.keys(b).length > 0 ? b : void 0, C = {
1394
+ ...m,
1395
+ content: c,
1396
+ custom_content: x
1397
+ }, w = Date.now(), ee = {
1398
+ role: o.Assistant,
1399
+ content: "",
1400
+ timestamp: new Date(w).toISOString()
1401
+ }, T = [
1402
+ ...e.messages.slice(0, f),
1403
+ C,
1404
+ ee
1405
+ ], E = {
1406
+ ...e,
1407
+ messages: T
1408
+ };
1409
+ a(() => (s.current = E, E));
1410
+ let D = p();
1411
+ i(t, c, T.length - 1, D, x, l(), v.Edit), S(/* @__PURE__ */ new Set());
1412
+ }, [
1413
+ e,
1414
+ t,
1415
+ s,
1416
+ r,
1417
+ p,
1418
+ a,
1419
+ i
1420
+ ]),
1421
+ editingMessageIndexes: x,
1422
+ pendingDeleteIndex: y,
1423
+ setPendingDeleteIndex: b,
1424
+ pendingStarterContext: C,
1425
+ setPendingStarterContext: w
1426
+ };
1427
+ }, qt = (e, t) => {
1428
+ let n = [...e];
1429
+ for (let e of t) {
1430
+ let t = n.findIndex((t) => t.index === e.index);
1431
+ if (t >= 0) {
1432
+ let r = n[t];
1433
+ n[t] = {
1434
+ ...r,
1435
+ ...e,
1436
+ body: {
1437
+ ...r.body,
1438
+ ...e.body,
1439
+ title: (r.body?.title ?? "") + (e.body?.title ?? "") || void 0,
1440
+ quote: (r.body?.quote ?? "") + (e.body?.quote ?? "") || void 0
1441
+ }
1442
+ };
1443
+ } else n.push(e);
1444
+ }
1445
+ return n;
1446
+ }, Jt = (e, t) => {
1447
+ let n = [...e];
1448
+ for (let e of t) {
1449
+ let t = e.index == null ? -1 : n.findIndex((t) => t.index === e.index);
1450
+ t >= 0 ? n[t] = {
1451
+ ...n[t],
1452
+ ...e,
1453
+ title: (n[t].title ?? "") + (e.title ?? ""),
1454
+ data: e.data == null ? n[t].data : (n[t].data ?? "") + e.data
1455
+ } : n.push(e);
1456
+ }
1457
+ return n;
1458
+ }, Yt = (e, t) => {
1459
+ let n = [...e];
1460
+ for (let e of t) {
1461
+ let t = n.findIndex((t) => t.index === e.index);
1462
+ t >= 0 ? n[t] = {
1463
+ ...n[t],
1464
+ ...e,
1465
+ name: (n[t].name ?? "") + (e.name ?? ""),
1466
+ content: (n[t].content ?? "") + (e.content ?? "") || void 0,
1467
+ attachments: e.attachments?.length ? Jt(n[t].attachments ?? [], e.attachments) : n[t].attachments
1468
+ } : n.push({
1469
+ ...e,
1470
+ name: e.name ?? ""
1471
+ });
1472
+ }
1473
+ return n;
1474
+ }, Xt = (e, t, n) => {
1475
+ let r = n.choices[0]?.delta, i = r?.content ?? "", a = r?.custom_content?.form_schema, o = r?.custom_content?.attachments, s = r?.custom_content?.stages, c = r?.custom_content?.annotations, l = r?.custom_fields?.annotations, u = r?.custom_content?.state, f = !!i || !!a || !!o?.length || !!s?.length || !!c?.length || !!l?.length || !!u, p = r?.responseId ?? (f ? n.id : void 0);
1476
+ return !f && !p ? null : e.map((e, n) => {
1477
+ if (n !== t) return e;
1478
+ let r = [...e.custom_content?.attachments ?? [], ...o ?? []], f = l?.length ? d(l, r) : [], m = [...c ?? [], ...f], h = a || o?.length || s?.length || m.length || u;
1479
+ return {
1480
+ ...e,
1481
+ content: i ? e.content + i : e.content,
1482
+ ...p && { responseId: p },
1483
+ ...h && { custom_content: {
1484
+ ...e.custom_content,
1485
+ ...a && { form_schema: a },
1486
+ ...o?.length && { attachments: r },
1487
+ ...s?.length && { stages: Yt(e.custom_content?.stages ?? [], s) },
1488
+ ...m.length && { annotations: qt(e.custom_content?.annotations ?? [], m) },
1489
+ ...u && { state: u }
1490
+ } }
1491
+ };
1492
+ });
1493
+ }, Zt = (e, t) => ({
1494
+ ...e,
1495
+ ...t,
1496
+ ...(e.custom_content || t.custom_content) && { custom_content: {
1497
+ ...e.custom_content,
1498
+ ...t.custom_content
1499
+ } }
1500
+ }), Qt = (e, t) => {
1501
+ if (t.messageIndex > e.messages.length) return e;
1502
+ let n = [...e.messages];
1503
+ return t.messageIndex === n.length ? n.push(t.message) : n[t.messageIndex] = Zt(n[t.messageIndex], t.message), {
1504
+ ...e,
1505
+ messages: n
1506
+ };
1507
+ }, $t = (e) => {
1508
+ let t = e.custom_content;
1509
+ return !!e.content || e.responseId != null || !!t?.attachments?.length || !!t?.stages?.length || !!t?.annotations?.length || !!t?.form_schema || t?.state != null;
1510
+ }, en = (e) => {
1511
+ let t = e.messages[e.messages.length - 1];
1512
+ return !!t && t.role === o.Assistant && !$t(t) && t.streamErrorMessage == null && !t.wasStoppedByUser;
1513
+ }, tn = 300 * 1e3, Z = "awaiting-resume", nn = async (e, t) => {
1514
+ let n = e.getReader(), r = new TextDecoder(), i = "";
1515
+ try {
1516
+ for (;;) {
1517
+ let { done: e, value: a } = await n.read();
1518
+ if (e) break;
1519
+ i += r.decode(a, { stream: !0 });
1520
+ let o = i.split("\n");
1521
+ i = o.pop() ?? "";
1522
+ let s = !1;
1523
+ for (let e of o) {
1524
+ let n = e.trim();
1525
+ if (!n.startsWith("data:")) continue;
1526
+ let r = n.slice(5).trim(), i;
1527
+ try {
1528
+ i = JSON.parse(r);
1529
+ } catch {
1530
+ continue;
1531
+ }
1532
+ if (await t(i)) {
1533
+ s = !0;
1534
+ break;
1535
+ }
1536
+ }
1537
+ if (s) break;
1538
+ }
1539
+ } catch {} finally {
1540
+ n.releaseLock();
1541
+ }
1542
+ }, Q = ({ transport: t, setConversation: n, conversationRef: r, resumingPathsRef: i, bufferedGenerationsRef: a, addStreamingPath: o, removeStreamingPath: s, isPathDisplayed: c }) => (l, u) => {
1543
+ if (!en(u)) return;
1544
+ let d = X(l);
1545
+ if (i.current.has(d)) return;
1546
+ i.current.add(d), o(d);
1547
+ let f = u.messages.length - 1, p = (e) => {
1548
+ i.current.delete(d), s(d), a.current.delete(d), e && c(d) && (n(e), r.current = e);
1549
+ }, m = async () => {
1550
+ try {
1551
+ p(await t.getConversation(e(l)));
1552
+ } catch {
1553
+ p();
1554
+ }
1555
+ }, h = (e) => {
1556
+ let t = {
1557
+ generationId: Z,
1558
+ messageIndex: f,
1559
+ message: e
1560
+ };
1561
+ a.current.set(d, t), c(d) && n((e) => {
1562
+ if (!e) return e;
1563
+ let n = Qt(e, t);
1564
+ return r.current = n, n;
1565
+ });
1566
+ }, g = (e) => {
1567
+ let t = a.current.get(d);
1568
+ if (t?.generationId === Z) {
1569
+ let n = Xt([t.message], 0, e);
1570
+ n && (t.message = n[0]);
1571
+ }
1572
+ c(d) && n((e) => {
1573
+ if (!e) return e;
1574
+ let t = a.current.get(d);
1575
+ if (t?.generationId !== Z) return e;
1576
+ let n = Qt(e, t);
1577
+ return r.current = n, n;
1578
+ });
1579
+ }, _ = async () => {
1580
+ let n = new AbortController(), r;
1581
+ try {
1582
+ r = await t.watchConversation(d, n.signal);
1583
+ } catch {
1584
+ await m();
1585
+ return;
1586
+ }
1587
+ let i = !1, a = window.setTimeout(() => {
1588
+ n.abort();
1589
+ }, tn);
1590
+ try {
1591
+ await nn(r, async (n) => {
1592
+ if (n?.action !== "UPDATE") return !1;
1593
+ try {
1594
+ let n = await t.getConversation(e(l));
1595
+ if (!en(n)) return p(n), i = !0, !0;
1596
+ } catch {}
1597
+ return !1;
1598
+ });
1599
+ } finally {
1600
+ clearTimeout(a);
1601
+ }
1602
+ i || await m();
1603
+ }, v = async () => {
1604
+ let e = new AbortController(), n;
1605
+ try {
1606
+ n = await t.attachToGeneration(d, e.signal);
1607
+ } catch {
1608
+ return !1;
1609
+ }
1610
+ let r = !1;
1611
+ return await nn(n, (e) => {
1612
+ switch (e.type) {
1613
+ case "snapshot": return h(e.message), !1;
1614
+ case "chunk": return g(e.chunk), !1;
1615
+ case "done":
1616
+ case "error":
1617
+ case "stopped": return r = !0, !0;
1618
+ }
1619
+ }), r ? (await m(), !0) : !1;
1620
+ };
1621
+ (async () => {
1622
+ await v() || await _();
1623
+ })();
1624
+ }, rn = 2e4, an = ({ conversationId: t, state: { setConversation: n, conversationRef: r }, transport: i, generation: { startGeneration: a, completeGeneration: o }, channel: s, overlay: c, onStopError: u }) => {
1625
+ let [d, m] = _(() => /* @__PURE__ */ new Set()), [y, b] = _(null), x = g(null), S = g(null), C = g(/* @__PURE__ */ new Set()), w = g(/* @__PURE__ */ new Map()), ee = g(/* @__PURE__ */ new Set()), T = g(t);
1626
+ p(() => {
1627
+ T.current = t;
1628
+ }, [t]);
1629
+ let E = f((e) => X(T.current ?? "") === e, []), D = f((e) => {
1630
+ m((t) => {
1631
+ if (t.has(e)) return t;
1632
+ let n = new Set(t);
1633
+ return n.add(e), n;
1634
+ });
1635
+ }, []), O = f((e) => {
1636
+ m((t) => {
1637
+ if (!t.has(e)) return t;
1638
+ let n = new Set(t);
1639
+ return n.delete(e), n;
1640
+ });
1641
+ }, []), k = f((t, u, d, f, p, m, h = v.Append) => {
1642
+ let g = m ?? l(), _ = X(t);
1643
+ x.current = g, S.current = _, b(_);
1644
+ let y;
1645
+ h === v.Regenerate ? y = d : h === v.Edit && (y = d - 1);
1646
+ let C = a(_, g), T = r.current?.messages[d];
1647
+ T ? w.current.set(_, {
1648
+ generationId: g,
1649
+ messageIndex: d,
1650
+ message: T
1651
+ }) : w.current.delete(_), D(_), c?.notifyGenerationStart?.(), s?.ensureConnected();
1652
+ let k = {
1653
+ signal: C.signal,
1654
+ onChunk: (e) => {
1655
+ if (x.current !== g) return;
1656
+ let t = w.current.get(_);
1657
+ if (t?.generationId === g) {
1658
+ let n = Xt([t.message], 0, e);
1659
+ n && (t.message = n[0]);
1660
+ }
1661
+ E(_) && n((t) => {
1662
+ if (!t) return t;
1663
+ let n = w.current.get(_), i;
1664
+ if (n?.generationId === g) i = Qt(t, n);
1665
+ else {
1666
+ let n = Xt(t.messages, d, e);
1667
+ if (!n) return t;
1668
+ i = {
1669
+ ...t,
1670
+ messages: n
1671
+ };
1672
+ }
1673
+ return r.current = i, i;
1674
+ });
1675
+ },
1676
+ onComplete: async () => {
1677
+ if (w.current.get(_)?.generationId === g && w.current.delete(_), O(_), x.current === g && (x.current = null, S.current = null, b(null)), o(_, g), ee.current.has(g) ? ee.current.delete(g) : c?.notifyGenerationEnd?.(), E(_)) try {
1678
+ let a = await i.getConversation(e(t));
1679
+ if (!E(_)) return;
1680
+ n(a), r.current = a;
1681
+ } catch {}
1682
+ },
1683
+ onError: (e) => {
1684
+ let t = w.current.get(_), i = t?.generationId === g ? t : void 0;
1685
+ i && w.current.delete(_), O(_), x.current === g && (x.current = null, S.current = null, b(null)), E(_) && n((t) => {
1686
+ if (!t) return t;
1687
+ let n = i?.generationId === g ? Qt(t, i) : t, a = {
1688
+ ...n,
1689
+ messages: n.messages.map((t, n) => n === d ? {
1690
+ ...t,
1691
+ streamErrorMessage: e.message
1692
+ } : t)
1693
+ };
1694
+ return r.current = a, a;
1695
+ });
1696
+ }
1697
+ };
1698
+ (async () => {
1699
+ try {
1700
+ let e = s?.channelId ?? await s?.waitForChannel(rn) ?? void 0;
1701
+ i.streamCompletion(_, u, f, k, p, g, h, y, e);
1702
+ } catch (e) {
1703
+ k.onError(e instanceof Error ? e : Error(String(e)));
1704
+ }
1705
+ })();
1706
+ }, [
1707
+ a,
1708
+ o,
1709
+ D,
1710
+ O,
1711
+ E,
1712
+ s?.channelId,
1713
+ s?.ensureConnected,
1714
+ s?.waitForChannel,
1715
+ c,
1716
+ i
1717
+ ]), A = f((e, t) => {
1718
+ let n = X(e), r = w.current.get(n);
1719
+ return r ? Qt(t, r) : t;
1720
+ }, []), te = f(() => {
1721
+ let e = x.current;
1722
+ if (!e || !t) return;
1723
+ let n = X(t);
1724
+ S.current === n && (ee.current.add(e), c?.notifyStopGenerating?.(), i.stopCompletion({
1725
+ generationId: e,
1726
+ path: n
1727
+ }).catch((e) => {
1728
+ let t = e instanceof Error ? e : Error(String(e));
1729
+ u?.(t);
1730
+ }));
1731
+ }, [
1732
+ t,
1733
+ u,
1734
+ c,
1735
+ i
1736
+ ]), ne = h(() => Q({
1737
+ transport: i,
1738
+ setConversation: n,
1739
+ conversationRef: r,
1740
+ resumingPathsRef: C,
1741
+ bufferedGenerationsRef: w,
1742
+ addStreamingPath: D,
1743
+ removeStreamingPath: O,
1744
+ isPathDisplayed: E
1745
+ }), [
1746
+ D,
1747
+ O,
1748
+ E,
1749
+ i
1750
+ ]), re = t != null && d.has(X(t)), j = t == null ? null : X(t);
1751
+ return {
1752
+ startStream: k,
1753
+ handleStop: te,
1754
+ resumeIfAwaitingGeneration: ne,
1755
+ restoreBufferedGeneration: A,
1756
+ isStreaming: re,
1757
+ canStopStreaming: j != null && y === j
1758
+ };
1759
+ }, on = {
1760
+ settings: "Settings",
1761
+ savedNotification: "Chat settings have been saved",
1762
+ responseFormatLabel: "Response format",
1763
+ responseFormatHint: "Applies to new and existing messages",
1764
+ responseFormatMarkdown: "Markdown",
1765
+ responseFormatPlainText: "Plain text",
1766
+ systemPromptLabel: "System prompt",
1767
+ systemPromptTooltip: "Enter a prompt",
1768
+ temperatureLabel: "Temperature",
1769
+ temperaturePrecise: "Precise",
1770
+ temperatureNeutral: "Neutral",
1771
+ temperatureCreative: "Creative",
1772
+ temperatureHint: "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.",
1773
+ saveLabel: "Apply changes",
1774
+ saveDisabledTooltip: "Please select a response format"
1775
+ }, sn = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? s.PlainText : s.Markdown, cn = (e) => {
1776
+ let t = h(() => ({
1777
+ ...on,
1778
+ ...e.labels
1779
+ }), [e.labels]), { onSaved: n } = e, r = e.mode === "local" ? e.values.responseFormat : sn(e.conversation.responseFormat), i = e.mode === "local" ? e.values.systemPrompt : e.conversation.prompt ?? "", a = e.mode === "local" ? e.values.temperature : e.conversation.temperature ?? .5, o = f((t) => {
1780
+ e.mode === "local" ? e.onValuesChange({
1781
+ responseFormat: t.responseFormat ?? e.values.responseFormat,
1782
+ systemPrompt: t.systemPrompt ?? e.values.systemPrompt,
1783
+ temperature: t.temperature ?? e.values.temperature
1784
+ }) : e.onConversationChange({
1785
+ ...e.conversation,
1786
+ ...t.responseFormat != null && { responseFormat: t.responseFormat },
1787
+ ...t.systemPrompt != null && { prompt: t.systemPrompt },
1788
+ ...t.temperature != null && { temperature: t.temperature }
1789
+ }), n?.();
1790
+ }, [n, e]), s = e.deploymentFeatures?.systemPrompt ?? !1, c = !e.isQuickApp && (e.deploymentFeatures?.temperature ?? !1);
1791
+ return h(() => ({
1792
+ features: {
1793
+ systemPrompt: s,
1794
+ temperature: c,
1795
+ responseFormat: !0
1796
+ },
1797
+ responseFormat: r,
1798
+ systemPrompt: i,
1799
+ temperature: a,
1800
+ onSave: o,
1801
+ menuItemLabel: t.settings,
1802
+ title: t.settings,
1803
+ responseFormatLabel: t.responseFormatLabel,
1804
+ responseFormatHint: t.responseFormatHint,
1805
+ responseFormatMarkdownLabel: t.responseFormatMarkdown,
1806
+ responseFormatPlainTextLabel: t.responseFormatPlainText,
1807
+ systemPromptLabel: t.systemPromptLabel,
1808
+ systemPromptTooltip: t.systemPromptTooltip,
1809
+ temperatureLabel: t.temperatureLabel,
1810
+ temperatureLabels: [
1811
+ t.temperaturePrecise,
1812
+ t.temperatureNeutral,
1813
+ t.temperatureCreative
1814
+ ],
1815
+ temperatureHint: t.temperatureHint,
1816
+ saveLabel: t.saveLabel,
1817
+ saveDisabledTooltip: t.saveDisabledTooltip
1818
+ }), [
1819
+ o,
1820
+ s,
1821
+ c,
1822
+ t,
1823
+ r,
1824
+ i,
1825
+ a
1826
+ ]);
1827
+ }, ln = (e) => e.type === "boolean" || e.type == null && typeof e.default == "boolean", un = (e) => {
1828
+ let t = e.replace(/[_-]+/g, " ").trim();
1829
+ return t.length === 0 ? e : t.charAt(0).toUpperCase() + t.slice(1);
1830
+ }, dn = (e) => {
1831
+ let t = e?.properties;
1832
+ return t == null ? [] : Object.entries(t).filter(([, e]) => ln(e)).map(([e, t]) => ({
1833
+ id: e,
1834
+ label: typeof t.title == "string" && t.title.length > 0 ? t.title : un(e),
1835
+ defaultValue: t.default === !0
1836
+ }));
1837
+ }, fn = (e) => {
1838
+ let { selectedItemId: t, selectedDeploymentConfiguration: n, toolIcon: r } = e, i = h(() => dn(n), [n]), a = h(() => Object.fromEntries(i.map(({ id: e, defaultValue: t }) => [e, t])), [i]), [o, s] = _(a), c = JSON.stringify(a), l = g(a);
1839
+ l.current = a, p(() => {
1840
+ s(l.current);
1841
+ }, [t, c]);
1842
+ let u = f((e) => {
1843
+ s((t) => e in t ? {
1844
+ ...t,
1845
+ [e]: !t[e]
1846
+ } : t);
1847
+ }, [s]), d = f((e) => {
1848
+ e != null && s((t) => {
1849
+ let n = !1, r = { ...t };
1850
+ for (let i of Object.keys(t)) {
1851
+ let a = e[i];
1852
+ typeof a == "boolean" && a !== t[i] && (r[i] = a, n = !0);
1853
+ }
1854
+ return n ? r : t;
1855
+ });
1856
+ }, [s]);
1857
+ return {
1858
+ toolsMenuItems: h(() => i.map(({ id: e, label: t }) => ({
1859
+ id: e,
1860
+ label: t,
1861
+ icon: r ?? null,
1862
+ isSelected: o[e] ?? !1
1863
+ })), [
1864
+ i,
1865
+ o,
1866
+ r
1867
+ ]),
1868
+ onToolToggle: u,
1869
+ toolConfigurationValue: h(() => Object.fromEntries(i.map(({ id: e }) => [e, o[e] ?? !1])), [i, o]),
1870
+ restoreToolConfiguration: d
1871
+ };
1872
+ };
1873
+ //#endregion
1874
+ export { Ct as A, ot as B, Ot as C, St as D, bt as E, W as F, it as H, lt as I, U as L, _t as M, gt as N, yt as O, dt as P, st as R, J as S, wt as T, rt as V, Pt as _, Kt as a, At as b, Gt as c, Vt as d, zt as f, Nt as g, Y as h, en as i, vt as j, xt as k, Ht as l, Rt as m, cn as n, X as o, Bt as p, an as r, Wt as s, fn as t, Ut as u, Mt as v, Dt as w, kt as x, jt as y, V as z };